Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Becker2019-04-12 10:44:35 +0000
committerMatthias Becker2019-04-12 10:44:35 +0000
commit54cac7b35fcbea386f5fa253d5cf644e39769bf7 (patch)
tree0179149b296d4073468547d4d7c7d142550480f1 /bundles/org.eclipse.ui.workbench
parent8b7f8eff01f0b05f7887ef4c964722bfecd62c84 (diff)
downloadeclipse.platform.ui-54cac7b35fcbea386f5fa253d5cf644e39769bf7.tar.gz
eclipse.platform.ui-54cac7b35fcbea386f5fa253d5cf644e39769bf7.tar.xz
eclipse.platform.ui-54cac7b35fcbea386f5fa253d5cf644e39769bf7.zip
Bug 546220: Only use Tabs for indentation
This change only contains whitespace changes performed by the JDT formatter. No manual changes are contained. Change-Id: Iaca17909713341fc945eb180cc733b66211e1a13 Signed-off-by: Matthias Becker <ma.becker@sap.com>
Diffstat (limited to 'bundles/org.eclipse.ui.workbench')
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI Editor Support/org/eclipse/ui/internal/editorsupport/ComponentSupport.java148
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/e4/ui/workbench/addons/perspectiveswitcher/PerspectiveSwitcher.java34
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/e4/ui/workbench/addons/perspectiveswitcher/PerspectiveSwitcherCSSHandler.java23
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/AbstractSourceProvider.java59
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ActiveShellExpression.java42
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/BasicWorkingSetElementAdapter.java81
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ExtensionFactory.java21
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionBars.java188
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionBars2.java22
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionDelegate.java108
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionDelegate2.java65
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionDelegateWithEvent.java46
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionFilter.java66
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IAggregateWorkingSet.java8
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IContainmentAdapter.java75
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IDecoratorManager.java145
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorActionBarContributor.java32
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorActionDelegate.java19
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorDescriptor.java121
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorInput.java55
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorLauncher.java14
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorMatchingStrategy.java39
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorPart.java93
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorReference.java56
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorRegistry.java315
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorSite.java156
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IElementFactory.java4
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IFileEditorMapping.java98
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IFolderLayout.java22
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IInPlaceEditor.java24
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IInPlaceEditorInput.java30
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IKeyBindingService.java61
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ILocalWorkingSetManager.java26
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IMemento.java293
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INavigationHistory.java65
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INavigationLocation.java138
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INavigationLocationProvider.java32
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INestableKeyBindingService.java76
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INullSelectionListener.java11
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IObjectActionDelegate.java30
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPageLayout.java730
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPageListener.java42
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPageService.java78
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPartListener.java84
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPartListener2.java142
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPartService.java106
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPathEditorInput.java32
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPersistable.java17
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPersistableEditor.java7
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPersistableElement.java53
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveDescriptor.java60
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveFactory.java25
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveListener.java41
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveListener2.java32
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveListener3.java94
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveListener4.java13
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveRegistry.java137
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPlaceholderFolderLayout.java72
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPluginContribution.java22
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPropertyListener.java16
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IReusableEditor.java27
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISaveableFilter.java9
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISaveablePart.java138
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISaveablePart2.java57
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISaveablesSource.java37
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISecondarySaveableSource.java8
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISelectionListener.java30
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISelectionService.java240
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISharedImages.java912
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IShowEditorInput.java26
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISizeProvider.java96
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISourceProvider.java36
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISourceProviderListener.java39
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISources.java92
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IStartup.java12
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IViewActionDelegate.java16
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IViewLayout.java81
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IViewPart.java97
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IViewReference.java38
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IViewSite.java25
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWindowListener.java68
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbench.java257
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchActionConstants.java1265
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchCommandConstants.java630
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchListener.java66
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPage.java559
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPart.java196
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPart2.java46
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPart3.java33
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPartConstants.java64
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPartDescriptor.java41
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPartReference.java170
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPartSite.java158
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPreferenceConstants.java216
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPreferencePage.java20
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPropertyPage.java43
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPropertyPageMulti.java7
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchSite.java13
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWindow.java281
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWindowActionDelegate.java30
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWindowPulldownDelegate.java23
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWindowPulldownDelegate2.java33
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWizard.java28
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSet.java251
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSetElementAdapter.java14
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSetManager.java537
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSetUpdater.java25
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/LegacyHandlerSubmissionExpression.java70
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/MultiPartInitException.java21
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/NavigationLocation.java94
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/OpenAndLinkWithEditorHelper.java19
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/PartInitException.java64
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/PerspectiveAdapter.java26
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/PlatformUI.java277
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/Saveable.java167
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/SaveablesLifecycleEvent.java33
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/SelectionEnabler.java97
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/SubActionBars.java164
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/SubActionBars2.java25
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/WorkbenchEncoding.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/WorkbenchException.java65
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/XMLMemento.java852
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/about/IInstallationPageContainer.java14
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/about/ISystemSummarySection.java19
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/about/InstallationPage.java52
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ActionContext.java90
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ActionDelegate.java78
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ActionFactory.java2252
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ActionGroup.java152
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/BaseNewWizardMenu.java342
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/BaseSelectionListenerAction.java225
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CompoundContributionItem.java119
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ContributedAction.java75
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ContributionItemFactory.java319
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ExportResourcesAction.java168
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ImportResourcesAction.java141
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/LabelRetargetAction.java301
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/NewWizardAction.java270
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/NewWizardDropDownAction.java227
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenInNewWindowAction.java145
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenNewPageMenu.java125
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenNewWindowMenu.java118
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenPerspectiveAction.java93
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenPerspectiveMenu.java259
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/PartEventAction.java150
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/PerspectiveMenu.java470
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/QuickMenuCreator.java74
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/RetargetAction.java403
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/SelectionProviderAction.java183
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/SimpleWildcardTester.java80
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/WorkingSetFilterActionGroup.java193
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ActivitiesPreferencePage.java133
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ActivityCategoryPreferencePage.java690
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ActivityEvent.java326
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ActivityManagerEvent.java314
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/CategoryEvent.java145
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IActivity.java230
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IActivityListener.java17
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IActivityManager.java164
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IActivityManagerListener.java17
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IActivityPatternBinding.java47
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IActivityRequirementBinding.java39
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ICategory.java155
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ICategoryActivityBinding.java28
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ICategoryListener.java17
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IIdentifier.java110
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IIdentifierListener.java17
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IMutableActivityManager.java20
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ITriggerPoint.java17
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ITriggerPointAdvisor.java43
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ITriggerPointManager.java10
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IWorkbenchActivitySupport.java88
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IdentifierEvent.java90
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/NotDefinedException.java40
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/WorkbenchActivityHelper.java276
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/WorkbenchTriggerPointAdvisor.java80
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/ActionBarAdvisor.java473
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/DisplayAccess.java25
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/IActionBarConfigurer.java88
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/IWorkbenchConfigurer.java321
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/IWorkbenchWindowConfigurer.java466
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/WorkbenchAdvisor.java488
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/WorkbenchWindowAdvisor.java357
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/branding/IBundleGroupConstants.java73
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/branding/IProductConstants.java255
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/browser/AbstractWebBrowser.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/browser/AbstractWorkbenchBrowserSupport.java6
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/browser/IWebBrowser.java20
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/browser/IWorkbenchBrowserSupport.java119
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/AbstractHandler.java316
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ActionHandler.java365
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/CategoryEvent.java104
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/CommandEvent.java365
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/CommandException.java66
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/CommandManagerEvent.java536
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ExecutionException.java57
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ExtensionParameterValues.java10
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/HandlerEvent.java185
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/HandlerSubmission.java361
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICategory.java155
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICategoryListener.java18
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommand.java295
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommandImageService.java78
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommandListener.java17
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommandManager.java424
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommandManagerListener.java19
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommandService.java255
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IElementReference.java10
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IElementUpdater.java20
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IHandler.java101
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IHandlerListener.java18
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IKeyConfiguration.java230
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IKeyConfigurationListener.java23
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IKeySequenceBinding.java19
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IWorkbenchCommandSupport.java51
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/KeyConfigurationEvent.java168
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/NotDefinedException.java53
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/NotHandledException.java52
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/Priority.java17
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/ContextEvent.java163
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/ContextException.java66
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/ContextManagerEvent.java270
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/EnabledSubmission.java270
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/IContext.java139
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/IContextActivation.java32
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/IContextListener.java18
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/IContextManager.java118
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/IContextManagerListener.java19
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/IContextService.java304
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/IWorkbenchContextSupport.java184
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/NotDefinedException.java9
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/databinding/WorkbenchObservables.java95
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/databinding/WorkbenchProperties.java80
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/AbstractElementListSelectionDialog.java758
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CheckedTreeSelectionDialog.java552
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ContainerCheckedTreeViewer.java321
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/EditorSelectionDialog.java82
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ElementListSelectionDialog.java58
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ElementTreeSelectionDialog.java574
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FileEditorMappingContentProvider.java38
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FileEditorMappingLabelProvider.java116
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FileSystemElement.java373
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FilteredItemsSelectionDialog.java870
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FilteredList.java268
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FilteredTree.java412
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/IOverwriteQuery.java77
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ISelectionStatusValidator.java13
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ISelectionValidator.java21
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/IWorkingSetEditWizard.java19
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/IWorkingSetNewWizard.java25
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/IWorkingSetPage.java66
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/IWorkingSetSelectionDialog.java50
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ListDialog.java275
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ListSelectionDialog.java246
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/PatternFilter.java332
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/PreferenceLinkArea.java106
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/PreferencesUtil.java292
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/PropertyDialogAction.java97
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/PropertyPage.java52
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/SearchPattern.java286
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/SelectionDialog.java98
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/SelectionStatusDialog.java271
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/TwoArrayQuickSorter.java154
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/TwoPaneElementSelector.java491
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/TypeFilteringDialog.java405
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WorkingSetConfigurationBlock.java158
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WorkingSetGroup.java25
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/YesNoCancelListSelectionDialog.java132
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dnd/IDragAndDropService.java32
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/fieldassist/ContentAssistCommandAdapter.java178
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/fieldassist/ContentAssistField.java84
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/CollapseAllHandler.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/ExpandAllHandler.java4
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/HandlerUtil.java300
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/IHandlerActivation.java40
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/IHandlerService.java351
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/RadioState.java9
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/RegistryRadioState.java34
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/RegistryToggleState.java26
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/ShowPerspectiveHandler.java50
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/ShowViewHandler.java40
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/help/AbstractHelpUI.java82
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/help/IWorkbenchHelpSystem.java89
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractEvaluationHandler.java11
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractWorkingSet.java92
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractWorkingSetManager.java562
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionDescriptor.java608
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionExpression.java362
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionPresentation.java346
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetActionBars.java64
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetContributionItem.java52
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetManager.java240
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetMenuManager.java68
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetSeparator.java75
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetsEvent.java5
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActivateEditorHandler.java12
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActiveEditorAction.java278
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActivityPersistanceHelper.java351
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AggregateWorkingSet.java41
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AnimationEngine.java42
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AnimationFeedbackBase.java17
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/BindingToModelProcessor.java13
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/BrandingProperties.java144
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/BundleGroupProperties.java352
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ChangeToPerspectiveMenu.java75
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CloseAllHandler.java6
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CloseAllSavedAction.java177
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CloseEditorHandler.java9
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CloseOthersHandler.java21
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CommandToModelProcessor.java5
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ConfigurationInfo.java36
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ContextToModelProcessor.java1
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolBarToTrimManager.java13
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CycleBaseHandler.java130
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CyclePerspectiveHandler.java5
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CycleViewHandler.java13
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DefaultSaveable.java10
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DirtyPerspectiveMarker.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DragCursors.java274
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DragHandle.java178
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/E4PartWrapper.java1
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EarlyStartupRunnable.java54
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorActionBars.java111
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorActionBuilder.java165
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorHistory.java221
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorHistoryItem.java390
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorMenuManager.java246
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorPluginAction.java69
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorReference.java111
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorSite.java177
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorSiteDragAndDropServiceImpl.java78
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ExceptionHandler.java73
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ExtensionEventHandler.java279
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ExtensionEventHandlerMessages.java1
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/FaderAnimationFeedback.java16
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/FilteredTableBaseHandler.java122
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/HeapStatus.java682
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IActionSetContributionItem.java20
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IChangeListener.java14
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IHeapStatusConstants.java10
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IObjectActionContributor.java59
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IObjectContributor.java42
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IPreferenceConstants.java227
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IReorderListener.java4
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ISelectionConversionService.java16
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IWorkbenchConstants.java52
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IWorkbenchGraphicConstants.java107
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IWorkbenchHelpContextIds.java276
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IWorkbenchThemeConstants.java36
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ImageCycleFeedbackBase.java21
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IntModel.java52
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/InternalHandlerUtil.java52
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/JFaceUtil.java43
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/KeyBindingService.java168
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LegacyAnimationFeedback.java16
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LegacyResourceSupport.java1074
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LegacyTrim.java4
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LocalWorkingSetManager.java9
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/MessageLine.java81
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Model.java142
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NavigationHistory.java1400
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NavigationHistoryAction.java363
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NavigationHistoryEditorInfo.java117
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NavigationHistoryEntry.java289
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectActionContributor.java539
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectActionContributorManager.java153
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectActionContributorReader.java96
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectContributorManager.java1491
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectFilterTest.java94
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectPluginAction.java91
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/OpenPerspectivePropertyTester.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/OpenPreferencesAction.java16
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/OverlayIcon.java91
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PageEventAction.java218
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PageListenerList.java122
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PagePartSelectionTracker.java40
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartListenerList.java160
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartListenerList2.java228
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartPluginAction.java57
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartService.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartSite.java145
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartTester.java181
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PendingSyncExec.java40
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveAction.java108
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveBarContributionItem.java332
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveBarNewContributionItem.java85
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveExtensionReader.java448
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveListenerList.java267
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveTagger.java12
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveTracker.java165
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PlaceholderContributionItem.java280
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PlatformUIPreferenceListener.java40
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginAction.java562
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionBuilder.java814
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionContributionItem.java239
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionCoolBarContributionItem.java42
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionSet.java165
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionSetBuilder.java1261
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PopupMenuExtender.java433
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ProductInfo.java141
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ProductProperties.java527
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/RadioMenu.java186
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/RectangleAnimationFeedbackBase.java35
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/RectangleAnimationImageFeedback.java23
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ReferenceCounter.java292
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ReopenEditorMenu.java432
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ResetPerspectiveAction.java52
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SavePerspectiveAction.java39
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SaveableHelper.java124
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SaveablesList.java264
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SelectionAdapterFactory.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SelectionConversionService.java20
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SharedImages.java49
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShellPool.java189
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowInHandler.java20
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowInMenu.java77
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowViewMenu.java63
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowViewMenuHandler.java6
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SlavePageService.java6
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SlavePartService.java8
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SlaveSelectionService.java12
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SplitHandler.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/StandardTrim.java8
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/StartupThreading.java6
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SwitchToWindowMenu.java159
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ToggleEditorsVisibilityAction.java109
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/TrimFrame.java280
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/TrimUtil.java38
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/UILockListener.java224
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/UISynchronizer.java79
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewActionBuilder.java89
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewIntroAdapterPart.java185
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewIntroAdapterSite.java86
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewPluginAction.java65
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewReference.java15
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewSite.java6
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewerActionBuilder.java225
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WWinActionBars.java155
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WWinPluginAction.java349
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WWinPluginPulldown.java77
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java508
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchConfigurer.java213
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchEditorsHandler.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchErrorHandlerProxy.java6
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchHandlerServiceHandler.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchImages.java493
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchIntroManager.java287
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchLayoutSettingsTransfer.java18
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java201
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java1762
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPartReference.java501
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPlugin.java1309
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPreferenceInitializer.java36
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchSupportFactory.java6
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java558
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindowConfigurer.java679
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindowPropertyTester.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSet.java119
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSetComparator.java14
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSetFactory.java42
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSetManager.java40
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSetMenuContributionItem.java97
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutAction.java64
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutBundleData.java122
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutBundleGroupData.java109
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutData.java295
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutFeaturesButtonManager.java102
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutFeaturesPage.java81
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutItem.java98
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutPluginsPage.java149
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutSystemPage.java21
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutTextManager.java450
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutUtils.java44
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/BundleSigningInfo.java59
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/ConfigurationLogDefaultSection.java194
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/InstallationDialog.java55
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/InstallationHandler.java2
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/ProductInfoDialog.java6
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/ProductInfoPage.java5
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/AbstractWorkingSetPulldownDelegate.java13
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/ClearWorkingSetAction.java45
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/CommandAction.java73
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/DynamicHelpAction.java17
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/EditWorkingSetAction.java82
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/HelpContentsAction.java94
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/HelpSearchAction.java94
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/HelpSearchContributionItem.java16
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/ModifyWorkingSetDelegate.java66
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/NewWizardShortcutAction.java198
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/SelectWorkingSetAction.java80
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/SelectWorkingSetsAction.java23
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/AbstractActivityManager.java33
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/AbstractActivityRegistry.java83
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/Activity.java429
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityDefinition.java197
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityPatternBinding.java210
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityPatternBindingDefinition.java170
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityPropertyTester.java22
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityRegistryEvent.java16
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityRequirementBinding.java111
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityRequirementBindingDefinition.java171
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/Category.java296
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/CategoryActivityBinding.java105
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/CategoryActivityBindingDefinition.java161
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/CategoryDefinition.java181
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ExtensionActivityRegistry.java221
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/IActivityRegistry.java6
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/IActivityRegistryListener.java2
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/Identifier.java196
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/InternalActivityHelper.java12
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/MutableActivityManager.java743
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/PatternUtil.java16
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/Persistence.java259
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ProxyActivityManager.java73
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/AbstractTriggerPoint.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ActivityCategoryContentProvider.java92
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ActivityCategoryLabelProvider.java93
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ActivityContentProvider.java14
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ActivityEnabler.java117
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ActivityLabelProvider.java71
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ActivityMessages.java16
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ActivityViewerFilter.java36
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/CategorizedActivity.java176
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/EnablementDialog.java404
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ImageBindingRegistry.java24
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/RegistryTriggerPoint.java75
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/TriggerPointAdvisorDescriptor.java20
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/TriggerPointAdvisorRegistry.java39
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/TriggerPointManager.java136
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/WorkbenchActivitySupport.java463
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/WorkbenchTriggerPoints.java36
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/application/CompatibilityActionBarAdvisor.java43
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/application/CompatibilityWorkbenchWindowAdvisor.java100
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/browser/DefaultWebBrowser.java35
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/browser/DefaultWorkbenchBrowserSupport.java13
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/browser/WorkbenchBrowserSupport.java137
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandImageManager.java178
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandImageManagerEvent.java112
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandImagePersistence.java101
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandImageService.java90
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandLegacyWrapper.java61
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandManagerFactory.java34
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandManagerLegacyWrapper.java123
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandPersistence.java273
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandService.java88
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandServiceFactory.java26
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandStateProxy.java76
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/ElementReference.java9
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/ICommandImageManagerListener.java13
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/ILegacyAttributeNames.java4
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/LegacyCommandListenerWrapper.java21
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/ParameterValueConverterProxy.java44
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/SlaveCommandService.java44
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/WorkbenchCommandSupport.java67
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ActiveContextSourceProvider.java13
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextActivation.java38
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextAuthority.java397
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextLegacyWrapper.java42
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextManagerFactory.java18
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextManagerLegacyWrapper.java70
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextPersistence.java98
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextService.java50
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextServiceFactory.java6
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/LegacyContextListenerWrapper.java63
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/NestableContextService.java17
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/SlaveContextService.java65
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/WorkbenchContextSupport.java55
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DeclarativeDecorator.java82
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecorationBuilder.java11
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecorationImageBuilder.java56
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecorationReference.java128
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecorationResult.java9
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecorationScheduler.java121
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecoratorDefinition.java430
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecoratorManager.java318
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecoratorRegistryReader.java167
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/FullDecoratorDefinition.java209
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/FullDecoratorRunnable.java46
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/FullImageDecoratorRunnable.java58
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/FullTextDecoratorRunnable.java57
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/LightweightActionDescriptor.java201
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/LightweightDecoratorDefinition.java51
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/LightweightDecoratorManager.java84
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/AboutDialog.java547
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/AboutFeaturesDialog.java40
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/AboutPluginsDialog.java20
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/AbstractWorkingSetDialog.java36
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ActionSetComparator.java37
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/AdaptableForwarder.java5
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/CapabilityFilter.java6
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ContentTypeFilenameAssociationDialog.java176
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ContentTypesPreferencePage.java40
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/DataTransferWizardCollectionComparator.java60
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/DecoratorsPreferencePage.java390
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/DialogUtil.java135
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/EditorsPreferencePage.java445
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/EmptyPreferencePage.java33
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/EmptyPropertyPage.java12
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ErrorPreferencePage.java15
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/EventLoopProgressMonitor.java308
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ExportPage.java44
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ExportWizard.java121
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FileEditorsPreferencePage.java992
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FileExtensionDialog.java267
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FilteredPreferenceDialog.java150
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/GlobalizationPreferencePage.java32
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/IPropertyPageContributor.java27
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ImportExportPage.java542
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ImportExportWizard.java115
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ImportPage.java61
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ImportWizard.java112
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewContentTypeDialog.java7
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewWizard.java212
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewWizardCollectionComparator.java63
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewWizardNewPage.java1026
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewWizardSelectionPage.java147
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PerspContentProvider.java12
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PerspectivesPreferencePage.java203
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PreferenceBoldLabelProvider.java5
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PreferenceHistoryEntry.java22
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PreferenceNodeFilter.java22
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PreferencePageHistory.java82
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PreferencePatternFilter.java14
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PropertyDialog.java44
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PropertyPageContributorManager.java51
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PropertyPageManager.java10
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PropertyPageNode.java122
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/RegistryPageContributor.java114
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SavePerspectiveDialog.java472
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SelectPerspectiveDialog.java328
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ShowViewDialog.java51
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SimpleWorkingSetSelectionDialog.java29
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/StartupPreferencePage.java96
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewComparator.java4
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewContentProvider.java9
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewLabelProvider.java19
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewPatternFilter.java1
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewsPreferencePage.java81
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardActivityFilter.java15
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardCollectionElement.java573
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardContentProvider.java133
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardPatternFilter.java4
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardTagFilter.java13
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchDialogBlockedHandler.java67
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchEditorsDialog.java1090
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchPreferenceDialog.java82
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchPreferenceManager.java46
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchPreferenceNode.java9
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchPreferencePage.java552
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchWizardElement.java338
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchWizardListSelectionPage.java322
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchWizardNode.java243
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchWizardSelectionPage.java108
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetEditWizard.java123
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetFilter.java30
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetLabelProvider.java48
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetNewWizard.java183
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetSelectionDialog.java438
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetTypePage.java203
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/CategoryCheckProvider.java8
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/CustomizeActionBars.java6
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/CustomizePerspectiveDialog.java598
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/FilteredModelCheckListener.java5
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/FilteredTreeCheckProvider.java25
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/FilteredViewerCheckListener.java41
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/GrayOutUnavailableLabelProvider.java6
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/ItemDetailToolTip.java149
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/NameAndDescriptionToolTip.java71
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/ShortcutLabelProvider.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/ShowUsedActionSetsFilter.java4
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/TableToolTip.java4
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/TreeManager.java208
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/UnavailableContributionItemCheckListener.java35
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ActionBars.java10
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/CompatibilityEditor.java14
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/CompatibilityPart.java34
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/CompatibilityView.java7
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/E4Util.java2
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ModeledFolderLayout.java12
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ModeledPageLayout.java93
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ModeledPlaceholderFolderLayout.java7
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/SelectionService.java32
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/migration/PerspectiveBuilder.java7
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/migration/PerspectiveReader.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/migration/WindowBuilder.java15
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/migration/WindowReader.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/migration/WorkbenchMigrationProcessor.java10
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/ActivePartExpression.java8
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/AlwaysEnabledExpression.java1
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/AndExpression.java6
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/CompositeExpression.java10
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/LegacyActionExpressionWrapper.java31
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/LegacyActionSetExpression.java34
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/LegacyEditorActionBarExpression.java17
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/LegacyEditorContributionExpression.java34
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/LegacySelectionEnablerWrapper.java28
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/LegacyViewContributionExpression.java34
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/LegacyViewerContributionExpression.java37
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/WorkbenchWindowExpression.java23
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ActionCommandMappingService.java13
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ActionDelegateHandlerProxy.java223
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ActiveContextInfoHandler.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ClosePerspectiveHandler.java24
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/CommandLegacyActionWrapper.java130
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ContextMenuHandler.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/CyclePageHandler.java13
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/DisplayHelpHandler.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/E4HandlerProxy.java14
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/EditActionSetsHandler.java6
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ExecutableExtensionHandler.java59
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/FullScreenHandler.java10
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/HandlerActivation.java13
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/HandlerPersistence.java175
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/HandlerProxy.java153
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/IActionCommandMappingService.java29
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/IWorkbenchWindowHandlerDelegate.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/IntroHandler.java9
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerListenerWrapper.java24
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerProxy.java41
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerService.java117
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerWrapper.java29
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LockToolBarHandler.java1
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/MinimizePartHandler.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/NewEditorHandler.java17
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/OpenInNewWindowHandler.java15
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/PinEditorHandler.java15
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/PropertyDialogHandler.java6
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/QuickMenuHandler.java9
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ResetPerspectiveHandler.java25
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/RestartWorkbenchHandler.java2
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ReuseEditorTester.java6
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/SaveAllHandler.java7
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/SavePerspectiveHandler.java19
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/SelectAllHandler.java89
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ShowKeyAssistHandler.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ShowPreferencePageHandler.java10
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/SpyHandler.java13
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ToggleCoolbarHandler.java17
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ToggleStatusBarHandler.java6
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/TraversePageHandler.java4
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/WidgetMethodHandler.java120
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/WizardHandler.java258
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/WorkbenchWindowHandlerDelegate.java28
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/help/WorkbenchHelpSystem.java206
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/intro/IIntroConstants.java8
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/intro/IIntroDescriptor.java40
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/intro/IIntroRegistry.java54
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/intro/IntroDescriptor.java93
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/intro/IntroMessages.java5
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/intro/IntroRegistry.java36
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/AbstractKeyFormatter.java169
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/AbstractModifierKeyComparator.java16
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/AlphabeticModifierKeyComparator.java11
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/BindingPersistence.java740
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/BindingService.java48
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/CancelOnModifyListener.java39
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/CategoryPatternFilter.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/CompactKeyFormatter.java124
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/EmacsKeyFormatter.java76
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/FormalKeyFormatter.java34
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/GlobalKeyAssistDialog.java17
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/ImageFactory.java7
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KdeKeyFormatter.java55
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KeyAssistMessages.java7
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KeyBindingState.java242
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KeySequenceBinding.java125
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KeysPreferenceFiltersDialog.java12
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KeysPreferencePage.java904
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/LegacySchemeListenerWrapper.java21
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/MacKeyFormatter.java131
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/NativeKeyFormatter.java178
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/NativeModifierKeyComparator.java253
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/NewKeysPreferencePage.java185
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/NoKeysPreferencePage.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/SchemeLegacyWrapper.java27
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/BindingElement.java27
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/BindingModel.java62
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/CommonModel.java6
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/ConflictModel.java65
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/ContextModel.java44
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/KeyController.java179
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/SchemeModel.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/CacheWrapper.java168
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/CellData.java1053
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/CellLayout.java1564
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/CellLayoutUtil.java148
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/GridInfo.java271
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/ICachingLayout.java24
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/LayoutCache.java174
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/LayoutUtil.java58
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/Row.java181
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/SizeCache.java654
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/ActionSet.java72
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/CompatibilityWorkbenchWindowControlContribution.java17
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/ContributionFactoryGenerator.java6
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/ContributionRoot.java26
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/DynamicMenuContributionItem.java21
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/DynamicToolBarContributionItem.java22
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/ExtensionContribution.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/FocusControlSourceProvider.java18
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/IActionSetsListener.java7
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/InternalControlContribution.java8
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/LegacyActionPersistence.java394
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuAdditionCacheEntry.java85
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuFactoryGenerator.java16
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuHelper.java117
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuLocationURI.java29
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuPersistence.java22
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/PulldownDelegateWidgetProxy.java125
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/SlaveMenuService.java7
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/ViewAction.java14
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/WidgetProxy.java72
-rwxr-xr-xbundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/WorkbenchMenuService.java61
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ExternalEditor.java171
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ExternalProgramImageDescriptor.java101
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/Policy.java337
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ProgramImageDescriptor.java86
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/StringMatcher.java326
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/TestPartListener.java117
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/UIListenerLogging.java447
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/UIStats.java180
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/operations/AdvancedValidationUserApprover.java88
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/operations/TimeTriggeredProgressMonitorDialog.java153
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/operations/WorkbenchOperationSupport.java24
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/part/NullEditorInput.java41
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/part/StatusPart.java244
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/AbstractIntegerListener.java51
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/AbstractPropertyListener.java14
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/Base64.java178
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/IDynamicPropertyMap.java55
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/IPropertyMap.java110
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/IPropertyMapListener.java5
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PreferenceStoreAdapter.java106
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PreferenceTransferElement.java27
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PreferenceTransferManager.java18
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PreferencesAdapter.java106
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PreferencesSettingsTransfer.java2
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PropertyListenerList.java326
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PropertyMapAdapter.java177
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PropertyMapUnion.java177
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PropertyUtil.java161
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/SettingsTransferRegistryReader.java14
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/ThemeAdapter.java106
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/ThemeManagerAdapter.java48
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/WorkbenchPreferenceExpressionNode.java77
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/WorkbenchPreferenceExtensionNode.java95
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/WorkbenchSettingsTransfer.java5
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/WorkingCopyPreferences.java11
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/WorkingSetPropertyPage.java4
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/WorkingSetSettingsTransfer.java6
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/AbstractProgressViewer.java2
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/AnimationItem.java218
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/AnimationManager.java283
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/BlockedJobsDialog.java92
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/DetailedProgressViewer.java37
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/FinishedJobs.java19
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/GroupInfo.java4
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/IAnimationProcessor.java57
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/IJobBusyListener.java26
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/IJobProgressManagerListener.java84
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/IProgressUpdateCollector.java41
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/JobInfo.java360
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/JobTreeElement.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/JobsViewPreferenceDialog.java5
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressAnimationItem.java56
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressAnimationProcessor.java121
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressCanvasViewer.java281
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressContentProvider.java69
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressInfoItem.java229
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressLabelProvider.java16
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressManager.java88
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressManagerUtil.java129
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressMonitorFocusJobDialog.java74
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressMonitorJobsDialog.java545
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressRegion.java209
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressView.java27
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressViewUpdater.java271
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressViewerContentProvider.java22
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressViewerLabelProvider.java30
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/StatusAdapterHelper.java7
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/TaskBarProgressManager.java4
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/TaskInfo.java20
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/WorkbenchSiteProgressService.java288
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/provisional/application/IActionBarConfigurer2.java21
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/ActionElement.java8
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/ActionProvider.java12
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/CamelUtil.java32
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/CommandElement.java28
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/CommandProvider.java13
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/EditorElement.java8
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/EditorProvider.java12
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/PerspectiveElement.java19
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/PerspectiveProvider.java13
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/PreferenceElement.java16
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/PreferenceProvider.java13
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/PropertiesElement.java13
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/PropertiesProvider.java15
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/QuickAccessContents.java159
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/QuickAccessDialog.java294
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/QuickAccessEntry.java102
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/QuickAccessExtensionManager.java7
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/QuickAccessHandler.java6
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/SearchField.java99
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/ViewElement.java10
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/ViewProvider.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/WizardElement.java15
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/WizardProvider.java12
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionSetDescriptor.java284
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionSetRegistry.java510
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/CategorizedPageRegistryReader.java59
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/Category.java345
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/EditorDescriptor.java962
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/EditorRegistry.java1609
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/EditorRegistryReader.java147
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/FileEditorMapping.java354
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/IActionSet.java63
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/IActionSetDescriptor.java113
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/IWorkbenchRegistryConstants.java165
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ImportExportPespectiveHandler.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/KeywordRegistry.java10
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveDescriptor.java25
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveParameterValues.java4
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveRegistry.java41
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PreferencePageParameterValues.java40
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PreferencePageRegistryReader.java32
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PreferenceTransferRegistryReader.java35
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PropertyPagesRegistryReader.java47
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/RegistryReader.java294
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ShowViewHandler.java18
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/StickyViewDescriptor.java104
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/UIExtensionTracker.java45
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewCategory.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewDescriptor.java9
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewParameterValues.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewRegistry.java38
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WizardParameterValues.java7
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WizardsRegistryReader.java885
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WorkingSetDescriptor.java328
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WorkingSetRegistry.java209
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WorkingSetRegistryReader.java92
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/ActionSetSourceProvider.java10
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/EvaluationReference.java13
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/EvaluationResultCache.java23
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/EvaluationResultCacheComparator.java9
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/EvaluationService.java37
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/EvaluationServiceFactory.java5
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/ExpressionAuthority.java160
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/IEvaluationResultCache.java28
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/INestable.java9
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/IServiceLocatorCreator.java51
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/IWorkbenchLocationService.java12
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/MenuSourceProvider.java41
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/PreferencePersistence.java261
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/RegistryPersistence.java412
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/ServiceLocator.java45
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/ServiceLocatorCreator.java10
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/SlaveEvaluationService.java7
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/SourcePriorityNameMapping.java67
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/SourceProviderService.java17
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/WorkbenchLocationService.java8
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/WorkbenchServiceRegistry.java48
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/WorkbenchSourceProvider.java352
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/splash/EclipseSplashHandler.java35
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/splash/SplashHandlerFactory.java56
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/DefaultDetailsArea.java45
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/DetailsAreaManager.java12
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/IStatusDialogConstants.java69
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/InternalDialog.java292
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/LabelProviderWrapper.java102
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StackTraceSupportArea.java11
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StatusHandlerDescriptor.java12
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StatusHandlerDescriptorsMap.java17
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StatusHandlerProductBindingDescriptor.java6
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StatusHandlerRegistry.java64
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/SupportTray.java75
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/WorkbenchStatusDialogManagerImpl.java218
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/testing/ContributionInfoMessages.java1
-rwxr-xr-xbundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/testing/WorkbenchPartTestable.java2
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/testing/WorkbenchTestable.java147
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/CascadingColorRegistry.java93
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/CascadingFontRegistry.java93
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/CascadingMap.java58
-rwxr-xr-xbundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/CascadingTheme.java113
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ColorDefinition.java167
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ColorsAndFontsPreferencePage.java1766
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/FontDefinition.java149
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ICategorizedThemeElementDefinition.java16
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/IEditable.java12
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/IHierarchalThemeElementDefinition.java17
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/IThemeDescriptor.java36
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/IThemeElementDefinition.java39
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/IThemeRegistry.java327
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/LightColorFactory.java67
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/RGBBrightnessColorFactory.java10
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/RGBContrastFactory.java178
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/RGBInfoColorFactory.java12
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/RGBVisibleContrastColorFactory.java8
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/Theme.java369
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeDescriptor.java177
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeElementCategory.java170
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeElementDefinition.java8
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeElementHelper.java465
-rwxr-xr-xbundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeRegistry.java410
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeRegistryReader.java737
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemesExtension.java10
-rwxr-xr-xbundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/WorkbenchPreview.java214
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/WorkbenchThemeManager.java156
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/Animations.java10
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/ImageAnimationTweak.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/InterceptContributions.java31
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/LegacyAnimations.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/TabBehaviour.java21
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/TabBehaviourMRU.java7
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/Tweaklets.java9
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/BundleUtility.java60
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/ConfigurationElementMemento.java166
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/ImageSupport.java12
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/PrefUtil.java126
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/Util.java659
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/AbstractExtensionWizardRegistry.java56
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/AbstractWizardRegistry.java6
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/ImportWizardRegistry.java1
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/PreferencesContentProvider.java1
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/PreferencesExportWizard.java64
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/PreferencesImportWizard.java72
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/PreferencesMessages.java4
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/WizardPreferencesExportPage1.java46
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/WizardPreferencesImportPage1.java304
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/WizardPreferencesPage.java293
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/intro/IIntroManager.java153
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/intro/IIntroPart.java231
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/intro/IIntroSite.java75
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/CharacterKey.java71
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/IBindingService.java254
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/IKeyFormatter.java61
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/Key.java21
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/KeyFormatterFactory.java98
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/KeySequence.java545
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/KeyStroke.java524
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/ModifierKey.java47
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/NaturalKey.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/ParseException.java33
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/SWTKeySupport.java699
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/SpecialKey.java359
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/AbstractContributionFactory.java63
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/AbstractWorkbenchTrimWidget.java18
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/CommandContributionItem.java271
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/CommandContributionItemParameter.java121
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/ExtensionContributionFactory.java17
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/IContributionRoot.java28
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/IMenuService.java40
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/IWorkbenchContribution.java12
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/IWorkbenchWidget.java28
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/MenuUtil.java53
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/UIElement.java51
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/WorkbenchWindowControlContribution.java33
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/AdaptableList.java199
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/BaseWorkbenchContentProvider.java87
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/ContributionComparator.java60
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/IComparableContribution.java9
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/IContributionService.java4
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/IWorkbenchAdapter.java77
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/IWorkbenchAdapter2.java49
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/IWorkbenchAdapter3.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/PerspectiveLabelProvider.java153
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/WorkbenchAdapter.java116
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/WorkbenchLabelProvider.java283
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/WorkbenchPartLabelProvider.java136
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/WorkbenchViewerComparator.java34
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/WorkbenchViewerSorter.java40
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/IWorkbenchOperationSupport.java4
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/LinearUndoViolationUserApprover.java44
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/NonLocalUndoUserApprover.java116
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/OperationHistoryActionHandler.java94
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/RedoActionHandler.java20
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/UndoActionHandler.java26
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/UndoRedoActionGroup.java28
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/AbstractMultiEditor.java274
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/CellEditorActionHandler.java1236
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/CoolItemGroupMarker.java31
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/DrillDownAdapter.java491
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/DrillDownComposite.java96
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/DrillFrame.java113
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/DrillStack.java142
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/EditorActionBarContributor.java272
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/EditorInputTransfer.java367
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/EditorPart.java332
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IContributedContentsView.java22
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IDropActionDelegate.java15
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IPage.java73
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IPageBookViewPage.java39
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IPageSite.java68
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/ISetSelectionTarget.java12
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IShowInSource.java22
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IShowInTarget.java28
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IShowInTargetList.java26
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IntroPart.java389
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MessagePage.java80
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiEditor.java167
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiEditorInput.java139
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditor.java171
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditorActionBarContributor.java62
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditorPart.java494
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditorSite.java196
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageSelectionProvider.java195
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/Page.java134
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PageBook.java105
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PageBookView.java184
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PageSite.java56
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PageSwitcher.java35
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PluginDropAdapter.java174
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PluginTransfer.java110
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PluginTransferData.java61
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/ShowInContext.java95
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/ViewPart.java165
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/WorkbenchPart.java709
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/plugin/AbstractUIPlugin.java997
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/IWorkbenchPreferenceContainer.java29
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/IWorkingCopyManager.java19
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/ScopedPreferenceStore.java143
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/SettingsTransfer.java15
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/ViewPreferencesAction.java4
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/ViewSettingsDialog.java24
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/WizardPropertyPage.java81
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/WorkingCopyManager.java11
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/DeferredTreeContentManager.java192
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IDeferredWorkbenchAdapter.java55
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IElementCollector.java50
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IJobRunnable.java14
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IProgressConstants.java171
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IProgressConstants2.java31
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IProgressService.java138
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IWorkbenchSiteProgressService.java110
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/PendingUpdateAdapter.java86
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/UIJob.java201
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/WorkbenchJob.java111
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/quickaccess/QuickAccessElement.java1
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/quickaccess/QuickAccessProvider.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/services/AbstractServiceFactory.java31
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/services/IDisposable.java4
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/services/IEvaluationService.java68
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/services/IServiceLocator.java21
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/services/IServiceScopes.java5
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/services/IServiceWithSources.java18
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/services/ISourceProviderService.java9
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/splash/AbstractSplashHandler.java44
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/splash/BasicSplashHandler.java66
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/statushandlers/AbstractStatusAreaProvider.java25
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/statushandlers/AbstractStatusHandler.java67
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/statushandlers/IStatusAdapterConstants.java35
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/statushandlers/StatusAdapter.java48
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/statushandlers/StatusManager.java137
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/statushandlers/WorkbenchErrorHandler.java38
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/statushandlers/WorkbenchStatusDialogManager.java120
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/swt/IFocusService.java32
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/themes/ColorUtil.java63
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/themes/IColorFactory.java12
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/themes/ITheme.java161
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/themes/IThemeManager.java100
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/themes/IThemePreview.java24
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/themes/RGBBlendColorFactory.java68
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/views/IStickyViewDescriptor.java52
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/views/IViewCategory.java53
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/views/IViewDescriptor.java123
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/views/IViewRegistry.java60
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/IWizardCategory.java20
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/IWizardDescriptor.java31
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/IWizardRegistry.java7
1168 files changed, 74323 insertions, 82696 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI Editor Support/org/eclipse/ui/internal/editorsupport/ComponentSupport.java b/bundles/org.eclipse.ui.workbench/Eclipse UI Editor Support/org/eclipse/ui/internal/editorsupport/ComponentSupport.java
index 5711df83bfa..f69b7395125 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI Editor Support/org/eclipse/ui/internal/editorsupport/ComponentSupport.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI Editor Support/org/eclipse/ui/internal/editorsupport/ComponentSupport.java
@@ -24,100 +24,98 @@ import org.eclipse.ui.internal.util.PrefUtil;
import org.osgi.framework.Bundle;
/**
- * This class provides an OS independent interface to the
- * components available on the platform
+ * This class provides an OS independent interface to the components available
+ * on the platform
*/
public final class ComponentSupport {
- /**
- * Returns whether the current platform has support
- * for system in-place editor.
- */
- public static boolean inPlaceEditorSupported() {
- // check preference
- if (PrefUtil.getAPIPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.DISABLE_OPEN_EDITOR_IN_PLACE)) {
- return false;
- }
- // only Win32 is supported
- return Util.isWindows();
- }
+ /**
+ * Returns whether the current platform has support for system in-place editor.
+ */
+ public static boolean inPlaceEditorSupported() {
+ // check preference
+ if (PrefUtil.getAPIPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.DISABLE_OPEN_EDITOR_IN_PLACE)) {
+ return false;
+ }
+ // only Win32 is supported
+ return Util.isWindows();
+ }
- /**
- * Return the default system in-place editor part
- * or <code>null</code> if not support by platform.
- */
- public static IEditorPart getSystemInPlaceEditor() {
- if (inPlaceEditorSupported()) {
- return getOleEditor();
- }
- return null;
- }
+ /**
+ * Return the default system in-place editor part or <code>null</code> if not
+ * support by platform.
+ */
+ public static IEditorPart getSystemInPlaceEditor() {
+ if (inPlaceEditorSupported()) {
+ return getOleEditor();
+ }
+ return null;
+ }
- /**
- * Returns whether an in-place editor is available to
- * edit the file.
- *
- * @param filename the file name in the system
- */
- public static boolean inPlaceEditorAvailable(String filename) {
- if (inPlaceEditorSupported()) {
- return testForOleEditor(filename);
- }
+ /**
+ * Returns whether an in-place editor is available to edit the file.
+ *
+ * @param filename the file name in the system
+ */
+ public static boolean inPlaceEditorAvailable(String filename) {
+ if (inPlaceEditorSupported()) {
+ return testForOleEditor(filename);
+ }
return false;
- }
+ }
- /**
- * Get a new OLEEditor
- * @return IEditorPart
- */
- private static IEditorPart getOleEditor() {
- // @issue currently assumes OLE editor is provided by IDE plug-in
- // IDE plug-in is not on prereq chain of generic wb plug-in
- // hence: IContributorResourceAdapter.class won't compile
- // and Class.forName("org.eclipse.ui.internal.editorsupport.win32.OleEditor") won't find it
- // need to be trickier...
- Bundle bundle = Platform.getBundle("org.eclipse.ui.ide"); //$NON-NLS-1$
+ /**
+ * Get a new OLEEditor
+ *
+ * @return IEditorPart
+ */
+ private static IEditorPart getOleEditor() {
+ // @issue currently assumes OLE editor is provided by IDE plug-in
+ // IDE plug-in is not on prereq chain of generic wb plug-in
+ // hence: IContributorResourceAdapter.class won't compile
+ // and Class.forName("org.eclipse.ui.internal.editorsupport.win32.OleEditor")
+ // won't find it
+ // need to be trickier...
+ Bundle bundle = Platform.getBundle("org.eclipse.ui.ide"); //$NON-NLS-1$
- // it's not our job to activate the plug-in
- if (!BundleUtility.isActivated(bundle)) {
+ // it's not our job to activate the plug-in
+ if (!BundleUtility.isActivated(bundle)) {
return null;
}
- try {
- Class<?> c = bundle
- .loadClass("org.eclipse.ui.internal.editorsupport.win32.OleEditor"); //$NON-NLS-1$
+ try {
+ Class<?> c = bundle.loadClass("org.eclipse.ui.internal.editorsupport.win32.OleEditor"); //$NON-NLS-1$
return (IEditorPart) c.getDeclaredConstructor().newInstance();
- } catch (SecurityException | ClassNotFoundException | NoSuchMethodException
- | InvocationTargetException | IllegalArgumentException | InstantiationException
- | IllegalAccessException exception) {
- return null;
+ } catch (SecurityException | ClassNotFoundException | NoSuchMethodException | InvocationTargetException
+ | IllegalArgumentException | InstantiationException | IllegalAccessException exception) {
+ return null;
}
- }
+ }
- public static boolean testForOleEditor(String filename) {
- int nDot = filename.lastIndexOf('.');
- if (nDot >= 0) {
- try {
- String strName = filename.substring(nDot);
+ public static boolean testForOleEditor(String filename) {
+ int nDot = filename.lastIndexOf('.');
+ if (nDot >= 0) {
+ try {
+ String strName = filename.substring(nDot);
Class<?> oleClass = Class.forName("org.eclipse.swt.ole.win32.OLE"); //$NON-NLS-1$
Method findMethod = oleClass.getDeclaredMethod("findProgramID", String.class); //$NON-NLS-1$
strName = (String) findMethod.invoke(null, strName);
if (!strName.isEmpty()) {
return true;
}
- } catch (ClassNotFoundException exception) {
- //Couldn't ask so return false
- return false;
- } catch (NoSuchMethodException exception) {
- //Couldn't find the method so return false
- return false;
- } catch (IllegalAccessException exception) {
- return false;
- } catch (InvocationTargetException exception) {
- return false;
- }
+ } catch (ClassNotFoundException exception) {
+ // Couldn't ask so return false
+ return false;
+ } catch (NoSuchMethodException exception) {
+ // Couldn't find the method so return false
+ return false;
+ } catch (IllegalAccessException exception) {
+ return false;
+ } catch (InvocationTargetException exception) {
+ return false;
+ }
- }
- return false;
- }
+ }
+ return false;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/e4/ui/workbench/addons/perspectiveswitcher/PerspectiveSwitcher.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/e4/ui/workbench/addons/perspectiveswitcher/PerspectiveSwitcher.java
index b26063d134d..00c802cc035 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/e4/ui/workbench/addons/perspectiveswitcher/PerspectiveSwitcher.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/e4/ui/workbench/addons/perspectiveswitcher/PerspectiveSwitcher.java
@@ -417,8 +417,7 @@ public class PerspectiveSwitcher {
ToolItem curItem = bar.getItem(new Point(e.x, e.y));
if (curItem != null && curItem.getData() instanceof MPerspective) {
Rectangle bounds = curItem.getBounds();
- Point center = new Point(bounds.x + (bounds.width / 2), bounds.y
- + (bounds.height / 2));
+ Point center = new Point(bounds.x + (bounds.width / 2), bounds.y + (bounds.height / 2));
boolean atStart = (perspSwitcherToolbar.getStyle() & SWT.HORIZONTAL) != 0 ? e.x < center.x
: e.y < center.y;
@@ -488,8 +487,7 @@ public class PerspectiveSwitcher {
private Image getOpenPerspectiveImage() {
if (perspectiveImage == null || perspectiveImage.isDisposed()) {
- ImageDescriptor desc = WorkbenchImages
- .getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_NEW_PAGE);
+ ImageDescriptor desc = WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_NEW_PAGE);
perspectiveImage = desc.createImage();
}
return perspectiveImage;
@@ -507,7 +505,8 @@ public class PerspectiveSwitcher {
int index = perspIndex + 2; // HACK !! accounts for the 'open' and the
// separator
- final ToolItem psItem = index < perspSwitcherToolbar.getItemCount() ? new ToolItem(perspSwitcherToolbar, SWT.RADIO, index)
+ final ToolItem psItem = index < perspSwitcherToolbar.getItemCount()
+ ? new ToolItem(perspSwitcherToolbar, SWT.RADIO, index)
: new ToolItem(perspSwitcherToolbar, SWT.RADIO);
psItem.setData(persp);
IPerspectiveDescriptor descriptor = getDescriptorFor(persp.getElementId());
@@ -529,9 +528,8 @@ public class PerspectiveSwitcher {
}
}
}
- if (!foundImage
- || PrefUtil.getAPIPreferenceStore().getBoolean(
- IWorkbenchPreferenceConstants.SHOW_TEXT_ON_PERSPECTIVE_BAR)) {
+ if (!foundImage || PrefUtil.getAPIPreferenceStore()
+ .getBoolean(IWorkbenchPreferenceConstants.SHOW_TEXT_ON_PERSPECTIVE_BAR)) {
psItem.setText(persp.getLocalizedLabel());
psItem.setToolTipText(persp.getLocalizedTooltip());
}
@@ -565,8 +563,7 @@ public class PerspectiveSwitcher {
// FIXME see https://bugs.eclipse.org/bugs/show_bug.cgi?id=385547
private IPerspectiveDescriptor getDescriptorFor(String id) {
- IPerspectiveRegistry perspectiveRegistry = PlatformUI.getWorkbench()
- .getPerspectiveRegistry();
+ IPerspectiveRegistry perspectiveRegistry = PlatformUI.getWorkbench().getPerspectiveRegistry();
if (perspectiveRegistry instanceof PerspectiveRegistry) {
return ((PerspectiveRegistry) perspectiveRegistry).findPerspectiveWithId(id, false);
}
@@ -576,8 +573,8 @@ public class PerspectiveSwitcher {
private void selectPerspective() {
// let the handler perform the work to consolidate all the code
- ParameterizedCommand command = commandService.createCommand(
- IWorkbenchCommandConstants.PERSPECTIVES_SHOW_PERSPECTIVE, Collections.EMPTY_MAP);
+ ParameterizedCommand command = commandService
+ .createCommand(IWorkbenchCommandConstants.PERSPECTIVES_SHOW_PERSPECTIVE, Collections.EMPTY_MAP);
handlerService.executeHandler(command);
}
@@ -656,8 +653,7 @@ public class PerspectiveSwitcher {
} catch (NotHandledException e) {
}
if (!status.isOK())
- StatusManager.getManager().handle(status,
- StatusManager.SHOW | StatusManager.LOG);
+ StatusManager.getManager().handle(status, StatusManager.SHOW | StatusManager.LOG);
}));
}
@@ -683,8 +679,7 @@ public class PerspectiveSwitcher {
} catch (NotHandledException e) {
}
if (!status.isOK())
- StatusManager.getManager().handle(status,
- StatusManager.SHOW | StatusManager.LOG);
+ StatusManager.getManager().handle(status, StatusManager.SHOW | StatusManager.LOG);
}));
}
@@ -732,8 +727,7 @@ public class PerspectiveSwitcher {
private void setPropertyChangeListener() {
propertyChangeListener = propertyChangeEvent -> {
- if (IWorkbenchPreferenceConstants.SHOW_TEXT_ON_PERSPECTIVE_BAR
- .equals(propertyChangeEvent.getProperty())) {
+ if (IWorkbenchPreferenceConstants.SHOW_TEXT_ON_PERSPECTIVE_BAR.equals(propertyChangeEvent.getProperty())) {
Object newValue = propertyChangeEvent.getNewValue();
boolean showText = true; // default
if (newValue instanceof Boolean)
@@ -846,8 +840,8 @@ public class PerspectiveSwitcher {
Color border = comp.getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
RGB backgroundRGB = background.getRGB();
// TODO naive and hard coded, doesn't deal with high contrast, etc.
- Color gradientTop = new Color(comp.getDisplay(), backgroundRGB.red + 12,
- backgroundRGB.green + 10, backgroundRGB.blue + 10);
+ Color gradientTop = new Color(comp.getDisplay(), backgroundRGB.red + 12, backgroundRGB.green + 10,
+ backgroundRGB.blue + 10);
int h = size.y;
int curveStart = 0;
int curve_width = 5;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/e4/ui/workbench/addons/perspectiveswitcher/PerspectiveSwitcherCSSHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/e4/ui/workbench/addons/perspectiveswitcher/PerspectiveSwitcherCSSHandler.java
index 35434e777d7..14fed0305b4 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/e4/ui/workbench/addons/perspectiveswitcher/PerspectiveSwitcherCSSHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/e4/ui/workbench/addons/perspectiveswitcher/PerspectiveSwitcherCSSHandler.java
@@ -27,8 +27,8 @@ public class PerspectiveSwitcherCSSHandler extends AbstractCSSPropertySWTHandler
public static final ICSSPropertyHandler INSTANCE = new PerspectiveSwitcherCSSHandler();
@Override
- protected void applyCSSProperty(Control control, String property, CSSValue value,
- String pseudo, CSSEngine engine) throws Exception {
+ protected void applyCSSProperty(Control control, String property, CSSValue value, String pseudo, CSSEngine engine)
+ throws Exception {
Object obj = control.getData("modelElement"); //$NON-NLS-1$
if (obj instanceof ToolControlImpl) {
@@ -38,8 +38,7 @@ public class PerspectiveSwitcherCSSHandler extends AbstractCSSPropertySWTHandler
Color curveColor = null;
if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
borderColor = (Color) engine.convert(value, Color.class, control.getDisplay());
- borderColor = borderColor == null || borderColor.isDisposed() ? null
- : borderColor;
+ borderColor = borderColor == null || borderColor.isDisposed() ? null : borderColor;
((PerspectiveSwitcher) bar).setKeylineColor(borderColor, borderColor);
} else if (value.getCssValueType() == CSSValue.CSS_VALUE_LIST) {
@@ -47,15 +46,11 @@ public class PerspectiveSwitcherCSSHandler extends AbstractCSSPropertySWTHandler
if (list.getLength() == 2) {
CSSValue border = list.item(0);
CSSValue curve = list.item(1);
- borderColor = (Color) engine.convert(border, Color.class,
- control.getDisplay());
- borderColor = borderColor == null || borderColor.isDisposed() ? null
- : borderColor;
+ borderColor = (Color) engine.convert(border, Color.class, control.getDisplay());
+ borderColor = borderColor == null || borderColor.isDisposed() ? null : borderColor;
- curveColor = (Color) engine.convert(curve, Color.class,
- control.getDisplay());
- curveColor = curveColor == null || curveColor.isDisposed() ? null
- : curveColor;
+ curveColor = (Color) engine.convert(curve, Color.class, control.getDisplay());
+ curveColor = curveColor == null || curveColor.isDisposed() ? null : curveColor;
((PerspectiveSwitcher) bar).setKeylineColor(borderColor, curveColor);
}
@@ -66,8 +61,8 @@ public class PerspectiveSwitcherCSSHandler extends AbstractCSSPropertySWTHandler
}
@Override
- protected String retrieveCSSProperty(Control control, String property, String pseudo,
- CSSEngine engine) throws Exception {
+ protected String retrieveCSSProperty(Control control, String property, String pseudo, CSSEngine engine)
+ throws Exception {
// TODO Auto-generated method stub
return null;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/AbstractSourceProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/AbstractSourceProvider.java
index a426c5a3bf3..f969e2cfda1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/AbstractSourceProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/AbstractSourceProvider.java
@@ -40,15 +40,12 @@ public abstract class AbstractSourceProvider implements ISourceProvider {
protected static boolean DEBUG = Policy.DEBUG_SOURCES;
/**
- * The listeners to this source provider. This value is never
- * <code>null</code>.
+ * The listeners to this source provider. This value is never <code>null</code>.
*/
private final ListenerList<ISourceProviderListener> listeners = new ListenerList<>(ListenerList.IDENTITY);
-
@Override
- public final void addSourceProviderListener(
- final ISourceProviderListener listener) {
+ public final void addSourceProviderListener(final ISourceProviderListener listener) {
if (listener == null) {
throw new NullPointerException("The listener cannot be null"); //$NON-NLS-1$
}
@@ -59,16 +56,13 @@ public abstract class AbstractSourceProvider implements ISourceProvider {
/**
* Notifies all listeners that a single source has changed.
*
- * @param sourcePriority
- * The source priority that has changed.
- * @param sourceName
- * The name of the source that has changed; must not be
- * <code>null</code>.
- * @param sourceValue
- * The new value for the source; may be <code>null</code>.
+ * @param sourcePriority The source priority that has changed.
+ * @param sourceName The name of the source that has changed; must not be
+ * <code>null</code>.
+ * @param sourceValue The new value for the source; may be <code>null</code>.
*/
- protected final void fireSourceChanged(final int sourcePriority,
- final String sourceName, final Object sourceValue) {
+ protected final void fireSourceChanged(final int sourcePriority, final String sourceName,
+ final Object sourceValue) {
for (ISourceProviderListener listener : listeners) {
listener.sourceChanged(sourcePriority, sourceName, sourceValue);
}
@@ -77,16 +71,14 @@ public abstract class AbstractSourceProvider implements ISourceProvider {
/**
* Notifies all listeners that multiple sources have changed.
*
- * @param sourcePriority
- * The source priority that has changed.
- * @param sourceValuesByName
- * The map of source names (<code>String</code>) to source
- * values (<code>Object</code>) that have changed; must not
- * be <code>null</code>. The names must not be
- * <code>null</code>, but the values may be <code>null</code>.
+ * @param sourcePriority The source priority that has changed.
+ * @param sourceValuesByName The map of source names (<code>String</code>) to
+ * source values (<code>Object</code>) that have
+ * changed; must not be <code>null</code>. The names
+ * must not be <code>null</code>, but the values may
+ * be <code>null</code>.
*/
- protected final void fireSourceChanged(final int sourcePriority,
- final Map sourceValuesByName) {
+ protected final void fireSourceChanged(final int sourcePriority, final Map sourceValuesByName) {
for (ISourceProviderListener listener : listeners) {
listener.sourceChanged(sourcePriority, sourceValuesByName);
@@ -95,12 +87,11 @@ public abstract class AbstractSourceProvider implements ISourceProvider {
/**
* Logs a debugging message in an appropriate manner. If the message is
- * <code>null</code> or the <code>DEBUG</code> is <code>false</code>,
- * then this method does nothing.
+ * <code>null</code> or the <code>DEBUG</code> is <code>false</code>, then this
+ * method does nothing.
*
- * @param message
- * The debugging message to log; if <code>null</code>, then
- * nothing is logged.
+ * @param message The debugging message to log; if <code>null</code>, then
+ * nothing is logged.
* @since 3.2
*/
protected final void logDebuggingInfo(final String message) {
@@ -110,8 +101,7 @@ public abstract class AbstractSourceProvider implements ISourceProvider {
}
@Override
- public final void removeSourceProviderListener(
- final ISourceProviderListener listener) {
+ public final void removeSourceProviderListener(final ISourceProviderListener listener) {
if (listener == null) {
throw new NullPointerException("The listener cannot be null"); //$NON-NLS-1$
}
@@ -121,12 +111,11 @@ public abstract class AbstractSourceProvider implements ISourceProvider {
/**
* This method is called when the source provider is instantiated by
- * <code>org.eclipse.ui.services</code>. Clients may override this method
- * to perform initialization.
+ * <code>org.eclipse.ui.services</code>. Clients may override this method to
+ * perform initialization.
*
- * @param locator
- * The global service locator. It can be used to retrieve
- * services like the IContextService
+ * @param locator The global service locator. It can be used to retrieve
+ * services like the IContextService
* @since 3.4
*/
public void initialize(final IServiceLocator locator) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ActiveShellExpression.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ActiveShellExpression.java
index 86a0d86648b..0c4bc1c008e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ActiveShellExpression.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ActiveShellExpression.java
@@ -24,9 +24,8 @@ import org.eclipse.swt.widgets.Shell;
* <p>
* An expression that checks the active shell variable. The variable name is
* <code>ISources.ACTIVE_SHELL_NAME</code> and falls back to
- * <code>ISources.ACTIVE_WORKBENCH_WINDOW</code>. That is, if the active
- * shell doesn't match, then it will be allowed to match the active workbench
- * window.
+ * <code>ISources.ACTIVE_WORKBENCH_WINDOW</code>. That is, if the active shell
+ * doesn't match, then it will be allowed to match the active workbench window.
* </p>
*
* @since 3.1
@@ -36,36 +35,33 @@ public final class ActiveShellExpression extends Expression {
/**
* The seed for the hash code for all schemes.
*/
- private static final int HASH_INITIAL = ActiveShellExpression.class
- .getName().hashCode();
+ private static final int HASH_INITIAL = ActiveShellExpression.class.getName().hashCode();
/**
* The sources value to use with this expression.
*/
- public static final int SOURCES = ISources.ACTIVE_SHELL
- | ISources.ACTIVE_WORKBENCH_WINDOW;
+ public static final int SOURCES = ISources.ACTIVE_SHELL | ISources.ACTIVE_WORKBENCH_WINDOW;
/**
* The shell that must be active for this expression to evaluate to
- * <code>true</code>. If this value is <code>null</code>, then any
- * shell may be active.
+ * <code>true</code>. If this value is <code>null</code>, then any shell may be
+ * active.
*/
private final Shell activeShell;
/**
* Constructs a new instance of <code>ActiveShellExpression</code>
*
- * @param activeShell
- * The shell to match with the active shell; <code>null</code>
- * if it will match any active shell.
+ * @param activeShell The shell to match with the active shell;
+ * <code>null</code> if it will match any active shell.
*/
public ActiveShellExpression(final Shell activeShell) {
this.activeShell = activeShell;
}
/**
- * Expression information for this expression. Namely active shell and
- * active workbench window name.
+ * Expression information for this expression. Namely active shell and active
+ * workbench window name.
*
* @since 3.2
*/
@@ -91,15 +87,14 @@ public final class ActiveShellExpression extends Expression {
}
/**
- * Evaluates this expression. If the active shell defined by the context
- * matches the shell from this expression, then this evaluates to
- * <code>EvaluationResult.TRUE</code>. Similarly, if the active workbench
- * window shell defined by the context matches the shell from this
- * expression, then this evaluates to <code>EvaluationResult.TRUE</code>.
+ * Evaluates this expression. If the active shell defined by the context matches
+ * the shell from this expression, then this evaluates to
+ * <code>EvaluationResult.TRUE</code>. Similarly, if the active workbench window
+ * shell defined by the context matches the shell from this expression, then
+ * this evaluates to <code>EvaluationResult.TRUE</code>.
*
- * @param context
- * The context from which the current state is determined; must
- * not be <code>null</code>.
+ * @param context The context from which the current state is determined; must
+ * not be <code>null</code>.
* @return <code>EvaluationResult.TRUE</code> if the shell is active;
* <code>EvaluationResult.FALSE</code> otherwise.
*/
@@ -108,8 +103,7 @@ public final class ActiveShellExpression extends Expression {
if (activeShell != null) {
Object value = context.getVariable(ISources.ACTIVE_SHELL_NAME);
if (!activeShell.equals(value)) {
- value = context
- .getVariable(ISources.ACTIVE_WORKBENCH_WINDOW_SHELL_NAME);
+ value = context.getVariable(ISources.ACTIVE_WORKBENCH_WINDOW_SHELL_NAME);
if (!activeShell.equals(value)) {
return EvaluationResult.FALSE;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/BasicWorkingSetElementAdapter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/BasicWorkingSetElementAdapter.java
index b9ff39bb98a..52a5ef68ad1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/BasicWorkingSetElementAdapter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/BasicWorkingSetElementAdapter.java
@@ -56,8 +56,7 @@ import org.osgi.util.tracker.ServiceTracker;
*
* @since 3.3
*/
-public final class BasicWorkingSetElementAdapter implements
- IWorkingSetElementAdapter, IExecutableExtension {
+public final class BasicWorkingSetElementAdapter implements IWorkingSetElementAdapter, IExecutableExtension {
private static class Type {
private static final int NONE = 0;
@@ -72,19 +71,17 @@ public final class BasicWorkingSetElementAdapter implements
/**
* When invoked this method will iterate over all classes specified as
- * IExecutableExtension arguements to this class in order and compare with
- * the elements. If the element is directly assignable to the provided class
- * then it is added to the result array as is. If the class has specified
- * "adapt=true" as an argument and there is an available adapter in the
- * platform IAdapterManager then it is returned. Finally, if "adapt=true"
- * and the class is already loaded (determined by inspecting exported
- * bundles via the platform PackageAdmin) a direct query for the adapter is
- * made on the object and if it is not <code>null</code> then it is
- * returned.
+ * IExecutableExtension arguements to this class in order and compare with the
+ * elements. If the element is directly assignable to the provided class then it
+ * is added to the result array as is. If the class has specified "adapt=true"
+ * as an argument and there is an available adapter in the platform
+ * IAdapterManager then it is returned. Finally, if "adapt=true" and the class
+ * is already loaded (determined by inspecting exported bundles via the platform
+ * PackageAdmin) a direct query for the adapter is made on the object and if it
+ * is not <code>null</code> then it is returned.
* <p>
- * A consequence of the above is that it is possible for this method to
- * return differing results based on the state of bundles loaded within the
- * system.
+ * A consequence of the above is that it is possible for this method to return
+ * differing results based on the state of bundles loaded within the system.
* </p>
*
* @see org.eclipse.ui.IWorkingSetElementAdapter#adaptElements(org.eclipse.ui.IWorkingSet,
@@ -101,18 +98,16 @@ public final class BasicWorkingSetElementAdapter implements
adaptedElements.add(adaptable);
}
- return (IAdaptable[]) adaptedElements
- .toArray(new IAdaptable[adaptedElements.size()]);
+ return (IAdaptable[]) adaptedElements.toArray(new IAdaptable[adaptedElements.size()]);
}
/**
- * Adapt the given adaptable. Compares the given adaptable against the list
- * of desired types and returns the first type that generates a match.
+ * Adapt the given adaptable. Compares the given adaptable against the list of
+ * desired types and returns the first type that generates a match.
*
- * @param adaptable
- * the adaptable to adapt
- * @return the resultant adaptable. May be the same adaptable, a new
- * adaptable, or <code>null</code>.
+ * @param adaptable the adaptable to adapt
+ * @return the resultant adaptable. May be the same adaptable, a new adaptable,
+ * or <code>null</code>.
*/
private IAdaptable adapt(IAdaptable adaptable) {
for (Type preferredType : preferredTypes) {
@@ -126,25 +121,21 @@ public final class BasicWorkingSetElementAdapter implements
/**
* Adapt the given adaptable given the reference type.
*
- * @param type
- * the reference type
- * @param adaptable
- * the adaptable to adapt
- * @return the resultant adaptable. May be the same adaptable, a new
- * adaptable, or <code>null</code>.
+ * @param type the reference type
+ * @param adaptable the adaptable to adapt
+ * @return the resultant adaptable. May be the same adaptable, a new adaptable,
+ * or <code>null</code>.
*/
private IAdaptable adapt(Type type, IAdaptable adaptable) {
IAdapterManager adapterManager = Platform.getAdapterManager();
- Class[] directClasses = adapterManager.computeClassOrder(adaptable
- .getClass());
+ Class[] directClasses = adapterManager.computeClassOrder(adaptable.getClass());
for (Class clazz : directClasses) {
if (clazz.getName().equals(type.className))
return adaptable;
}
if ((type.flags & Type.ADAPT) != 0) {
- Object adapted = adapterManager.getAdapter(adaptable,
- type.className);
+ Object adapted = adapterManager.getAdapter(adaptable, type.className);
if (adapted instanceof IAdaptable)
return (IAdaptable) adapted;
@@ -153,8 +144,7 @@ public final class BasicWorkingSetElementAdapter implements
int lastDot = type.className.lastIndexOf('.');
if (lastDot > 0) { // this lives in a package
String packageName = type.className.substring(0, lastDot);
- ExportedPackage[] packages = admin
- .getExportedPackages(packageName);
+ ExportedPackage[] packages = admin.getExportedPackages(packageName);
if (packages != null && packages.length == 1) {
// if there is exactly one exporter of this
// package
@@ -164,9 +154,8 @@ public final class BasicWorkingSetElementAdapter implements
// if the bundle is loaded we can safely get the
// class object and check for an adapter on the
// object directly
- adapted = adaptable.getAdapter(packages[0]
- .getExportingBundle().loadClass(
- type.className));
+ adapted = adaptable
+ .getAdapter(packages[0].getExportingBundle().loadClass(type.className));
if (adapted instanceof IAdaptable)
return (IAdaptable) adapted;
@@ -188,8 +177,7 @@ public final class BasicWorkingSetElementAdapter implements
}
@Override
- public void setInitializationData(IConfigurationElement config,
- String propertyName, Object data) {
+ public void setInitializationData(IConfigurationElement config, String propertyName, Object data) {
if (data instanceof String) {
List preferredTypes = new ArrayList(0);
@@ -199,8 +187,7 @@ public final class BasicWorkingSetElementAdapter implements
parseOptions(classNameAndOptions, record);
preferredTypes.add(record);
}
- this.preferredTypes = (Type[]) preferredTypes
- .toArray(new Type[preferredTypes.size()]);
+ this.preferredTypes = (Type[]) preferredTypes.toArray(new Type[preferredTypes.size()]);
}
}
@@ -209,11 +196,10 @@ public final class BasicWorkingSetElementAdapter implements
* <code>some.package.Class[:option1=value1][:option2=value2]...
*
* @param classNameAndOptions the class name and possibly options to parse
- * @param record the record to fill
+ * @param record the record to fill
*/
private void parseOptions(String classNameAndOptions, Type record) {
- for (StringTokenizer toker = new StringTokenizer(classNameAndOptions,
- ";"); toker.hasMoreTokens();) { //$NON-NLS-1$
+ for (StringTokenizer toker = new StringTokenizer(classNameAndOptions, ";"); toker.hasMoreTokens();) { //$NON-NLS-1$
String token = toker.nextToken();
if (record.className == null)
record.className = token;
@@ -232,15 +218,14 @@ public final class BasicWorkingSetElementAdapter implements
}
/**
- * Prime the PackageAdmin service tracker and return the service (if
- * available).
+ * Prime the PackageAdmin service tracker and return the service (if available).
*
* @return the PackageAdmin service or null if it is not available
*/
private PackageAdmin getPackageAdmin() {
if (packageTracker == null) {
- packageTracker = new ServiceTracker(WorkbenchPlugin.getDefault()
- .getBundleContext(), PackageAdmin.class.getName(), null);
+ packageTracker = new ServiceTracker(WorkbenchPlugin.getDefault().getBundleContext(),
+ PackageAdmin.class.getName(), null);
packageTracker.open();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ExtensionFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ExtensionFactory.java
index dca18c08eaa..fce742e9d44 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ExtensionFactory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ExtensionFactory.java
@@ -44,8 +44,7 @@ import org.eclipse.ui.internal.wizards.preferences.PreferencesImportWizard;
*
* @since 3.1
*/
-public class ExtensionFactory implements IExecutableExtensionFactory,
- IExecutableExtension {
+public class ExtensionFactory implements IExecutableExtensionFactory, IExecutableExtension {
/**
* Factory ID for the Appearance preference page.
@@ -136,15 +135,14 @@ public class ExtensionFactory implements IExecutableExtensionFactory,
private Object configure(Object obj) throws CoreException {
if (obj instanceof IExecutableExtension) {
- ((IExecutableExtension) obj).setInitializationData(config,
- propertyName, null);
+ ((IExecutableExtension) obj).setInitializationData(config, propertyName, null);
}
return obj;
}
/**
- * Creates the object referenced by the factory id obtained from the
- * extension data.
+ * Creates the object referenced by the factory id obtained from the extension
+ * data.
*/
@Override
public Object create() throws CoreException {
@@ -192,18 +190,17 @@ public class ExtensionFactory implements IExecutableExtensionFactory,
return showInMenu;
}
- throw new CoreException(new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID,
- 0, "Unknown id in data argument for " + getClass(), null)); //$NON-NLS-1$
+ throw new CoreException(new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0,
+ "Unknown id in data argument for " + getClass(), null)); //$NON-NLS-1$
}
@Override
- public void setInitializationData(IConfigurationElement config,
- String propertyName, Object data) throws CoreException {
+ public void setInitializationData(IConfigurationElement config, String propertyName, Object data)
+ throws CoreException {
if (data instanceof String) {
id = (String) data;
} else {
- throw new CoreException(new Status(IStatus.ERROR,
- PlatformUI.PLUGIN_ID, 0,
+ throw new CoreException(new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0,
"Data argument must be a String for " + getClass(), null)); //$NON-NLS-1$
}
this.config = config;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionBars.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionBars.java
index 3623cbad7f7..7ca41ea1824 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionBars.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionBars.java
@@ -23,133 +23,139 @@ import org.eclipse.ui.services.IServiceLocator;
* Used by a part to access its menu, toolbar, and status line managers.
* <p>
* Within the workbench each part, editor or view, has a private set of action
- * bars. This set, which contains a menu, toolbar, and status line, appears
- * in the local toolbar for a view and in the window for an editor. The view
- * may provide an implementation for pre-existing actions or add new actions to
- * the action bars.
- * </p><p>
+ * bars. This set, which contains a menu, toolbar, and status line, appears in
+ * the local toolbar for a view and in the window for an editor. The view may
+ * provide an implementation for pre-existing actions or add new actions to the
+ * action bars.
+ * </p>
+ * <p>
* In a workbench window there are a number of actions which are applicable to
- * all parts. Some common examples are <code>CUT</code>, <code>COPY</code> and
- * <code>PASTE</code>. These actions, known as "global actions", are contributed to
- * the workbench window by the window itself and shared by all parts. The
- * presentation is owned by the window. The implementation is delegated to the
+ * all parts. Some common examples are <code>CUT</code>, <code>COPY</code> and
+ * <code>PASTE</code>. These actions, known as "global actions", are contributed
+ * to the workbench window by the window itself and shared by all parts. The
+ * presentation is owned by the window. The implementation is delegated to the
* active part.
- * </p><p>
- * To participate in the global action design an <code>IWorkbenchPart</code> should
- * register a handler for each global action which is implemented by the part. This
- * can be done by calling <code>setGlobalActionHandler</code>. For convenience, the
- * standard global actions are defined in
+ * </p>
+ * <p>
+ * To participate in the global action design an <code>IWorkbenchPart</code>
+ * should register a handler for each global action which is implemented by the
+ * part. This can be done by calling <code>setGlobalActionHandler</code>. For
+ * convenience, the standard global actions are defined in
* <code>org.eclipse.ui.IWorkbenchActionConstants</code>.
- * </p><p>
- * Additional work is required for the <code>Delete</code> global action. In
+ * </p>
+ * <p>
+ * Additional work is required for the <code>Delete</code> global action. In
* this case the accelerator is defined in the menu item text but is not hooked
- * on the window. This is to support text editors where the <code>Delete</code>
- * key is functional even when the <code>Delete</code> action is disabled (no text
- * is selected). An implementation for this accelerator must be defined locally,
- * in each part, by listening for <code>Delete</code> key events.
- * </p><p>
- * A part may also contribute new actions to the action bars as required. To do
+ * on the window. This is to support text editors where the <code>Delete</code>
+ * key is functional even when the <code>Delete</code> action is disabled (no
+ * text is selected). An implementation for this accelerator must be defined
+ * locally, in each part, by listening for <code>Delete</code> key events.
+ * </p>
+ * <p>
+ * A part may also contribute new actions to the action bars as required. To do
* this, call <code>getMenuManager</code>, <code>getToolBarManager</code>, or
* <code>getStatusLineManager</code> as appropriate to get the action target.
- * Add the action(s) to the target and call <code>update</code> to commit
- * any changes to the underlying widgets.
- * </p><p>
+ * Add the action(s) to the target and call <code>update</code> to commit any
+ * changes to the underlying widgets.
+ * </p>
+ * <p>
* This interface is not intended to be implemented by clients.
* </p>
+ *
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IActionBars {
- /**
- * Clears the global action handler list.
- * <p>
- * Note: Clients who manipulate the global action list are
- * responsible for calling <code>updateActionBars</code> so that the changes
- * can be propagated throughout the workbench.
- * </p>
- */
- void clearGlobalActionHandlers();
+ /**
+ * Clears the global action handler list.
+ * <p>
+ * Note: Clients who manipulate the global action list are responsible for
+ * calling <code>updateActionBars</code> so that the changes can be propagated
+ * throughout the workbench.
+ * </p>
+ */
+ void clearGlobalActionHandlers();
- /**
- * Returns the global action handler for the action with the given id.
- *
- * @param actionId an action id declared in the registry
- * @return an action handler which implements the action id, or
- * <code>null</code> if none is registered
- * @see IWorkbenchActionConstants
- * @see #setGlobalActionHandler(String, IAction)
- */
- IAction getGlobalActionHandler(String actionId);
+ /**
+ * Returns the global action handler for the action with the given id.
+ *
+ * @param actionId an action id declared in the registry
+ * @return an action handler which implements the action id, or
+ * <code>null</code> if none is registered
+ * @see IWorkbenchActionConstants
+ * @see #setGlobalActionHandler(String, IAction)
+ */
+ IAction getGlobalActionHandler(String actionId);
- /**
- * Returns the menu manager.
- * <p>
- * Note: Clients who add or remove items from the returned menu manager are
- * responsible for calling <code>updateActionBars</code> so that the changes
- * can be propagated throughout the workbench.
- * </p>
- *
- * @return the menu manager
- */
- IMenuManager getMenuManager();
+ /**
+ * Returns the menu manager.
+ * <p>
+ * Note: Clients who add or remove items from the returned menu manager are
+ * responsible for calling <code>updateActionBars</code> so that the changes can
+ * be propagated throughout the workbench.
+ * </p>
+ *
+ * @return the menu manager
+ */
+ IMenuManager getMenuManager();
- /**
- * Returns the service locator for these action bars. The locator is found
- * by looking locally, and then ascending the action bar hierarchy.
+ /**
+ * Returns the service locator for these action bars. The locator is found by
+ * looking locally, and then ascending the action bar hierarchy.
*
* @return The service locator; never <code>null</code>.
* @since 3.2
*/
IServiceLocator getServiceLocator();
- /**
+ /**
* Returns the status line manager.
* <p>
- * Note: Clients who add or remove items from the returned status line
- * manager are responsible for calling <code>updateActionBars</code> so
- * that the changes can be propagated throughout the workbench.
+ * Note: Clients who add or remove items from the returned status line manager
+ * are responsible for calling <code>updateActionBars</code> so that the changes
+ * can be propagated throughout the workbench.
* </p>
*
* @return the status line manager
*/
- IStatusLineManager getStatusLineManager();
+ IStatusLineManager getStatusLineManager();
- /**
- * Returns the tool bar manager.
- * <p>
- * Note: Clients who add or remove items from the returned tool bar manager are
- * responsible for calling <code>updateActionBars</code> so that the changes
- * can be propagated throughout the workbench.
- * </p>
- *
- * @return the tool bar manager
- */
- IToolBarManager getToolBarManager();
+ /**
+ * Returns the tool bar manager.
+ * <p>
+ * Note: Clients who add or remove items from the returned tool bar manager are
+ * responsible for calling <code>updateActionBars</code> so that the changes can
+ * be propagated throughout the workbench.
+ * </p>
+ *
+ * @return the tool bar manager
+ */
+ IToolBarManager getToolBarManager();
- /**
- * Sets the global action handler for the action with the given id.
- * <p>
- * Note: Clients who manipulate the global action list are
- * responsible for calling <code>updateActionBars</code> so that the changes
- * can be propagated throughout the workbench.
- * </p>
- *
- * @param actionId an action id declared in the registry
- * @param handler an action which implements the action id, or
- * <code>null</code> to clear any existing handler
- * @see IWorkbenchActionConstants
- */
- void setGlobalActionHandler(String actionId, IAction handler);
+ /**
+ * Sets the global action handler for the action with the given id.
+ * <p>
+ * Note: Clients who manipulate the global action list are responsible for
+ * calling <code>updateActionBars</code> so that the changes can be propagated
+ * throughout the workbench.
+ * </p>
+ *
+ * @param actionId an action id declared in the registry
+ * @param handler an action which implements the action id, or
+ * <code>null</code> to clear any existing handler
+ * @see IWorkbenchActionConstants
+ */
+ void setGlobalActionHandler(String actionId, IAction handler);
/**
* Updates the action bars.
* <p>
* Clients who add or remove items from the menu, tool bar, or status line
- * managers, or that update global action handlers, should call this method
- * to propagated the changes throughout the workbench.
+ * managers, or that update global action handlers, should call this method to
+ * propagated the changes throughout the workbench.
* </p>
*
* @see #setGlobalActionHandler(String, IAction)
* @see #clearGlobalActionHandlers()
*/
- void updateActionBars();
+ void updateActionBars();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionBars2.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionBars2.java
index aacfc08082b..f2f467e8f6d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionBars2.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionBars2.java
@@ -24,16 +24,16 @@ import org.eclipse.jface.action.ICoolBarManager;
*/
public interface IActionBars2 extends IActionBars {
- /**
- * Returns the cool bar manager.
- * <p>
- * Note: Clients who add or remove items from the returned cool bar manager are
- * responsible for calling <code>updateActionBars</code> so that the changes
- * can be propagated throughout the workbench.
- * </p>
- *
- * @return the cool bar manager.
- */
- ICoolBarManager getCoolBarManager();
+ /**
+ * Returns the cool bar manager.
+ * <p>
+ * Note: Clients who add or remove items from the returned cool bar manager are
+ * responsible for calling <code>updateActionBars</code> so that the changes can
+ * be propagated throughout the workbench.
+ * </p>
+ *
+ * @return the cool bar manager.
+ */
+ ICoolBarManager getCoolBarManager();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionDelegate.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionDelegate.java
index 5ffc74ed494..dceb660769e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionDelegate.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionDelegate.java
@@ -19,68 +19,74 @@ import org.eclipse.jface.viewers.ISelection;
/**
* Interface for actions contributed via an extension point.
* <p>
- * This interface should be implemented by clients who need to contribute actions
- * via an extension point. The workbench will generate a <b>proxy action</b>
- * object on behalf of the plug-in to avoid having to activate the plug-in until
- * the user needs it. If the action is performed the workbench will load the class
- * that implements this interface and create what is called an <b>action
- * delegate</b> object. Then the request, and all subsequent ones, are
- * forwarded through the proxy action to the action delegate, which does the
+ * This interface should be implemented by clients who need to contribute
+ * actions via an extension point. The workbench will generate a <b>proxy
+ * action</b> object on behalf of the plug-in to avoid having to activate the
+ * plug-in until the user needs it. If the action is performed the workbench
+ * will load the class that implements this interface and create what is called
+ * an <b>action delegate</b> object. Then the request, and all subsequent ones,
+ * are forwarded through the proxy action to the action delegate, which does the
* real work.
- * </p><p>
+ * </p>
+ * <p>
* The proxy action is the one that appears in the UI, so the action delegate
* will need to talk to the proxy action in order to keep up an appropriate
- * appearance. Once the action delegate has been created, it will be
- * notified of all selection changes, allowing it to enable or disable the
- * proxy action appropriately.
- * </p><p>
+ * appearance. Once the action delegate has been created, it will be notified of
+ * all selection changes, allowing it to enable or disable the proxy action
+ * appropriately.
+ * </p>
+ * <p>
* An action delegate cannot be consulted about selection changes before the
- * action is performed because it does not exist. For this reason, control of
+ * action is performed because it does not exist. For this reason, control of
* the action's enable state should also be exercised through simple XML rules
- * contained in the extension. These rules allow enable state control before
- * the action delegate's plug-in is loaded.
- * </p><p>
+ * contained in the extension. These rules allow enable state control before the
+ * action delegate's plug-in is loaded.
+ * </p>
+ * <p>
* Clients can choose to subclass the provided abstract implementation
- * <code>org.eclipse.ui.actions.ActionDelegate</code> or implement the
- * interface directly.
+ * <code>org.eclipse.ui.actions.ActionDelegate</code> or implement the interface
+ * directly.
* </p>
*
* @see org.eclipse.ui.actions.ActionDelegate
* @see org.eclipse.ui.IActionDelegate2
*/
public interface IActionDelegate {
- /**
- * Performs this action.
- * <p>
- * This method is called by the proxy action when the action has been
- * triggered. Implement this method to do the actual work.
- * </p><p>
- * <b>Note:</b> If the action delegate also implements
- * <code>IActionDelegate2</code>, then this method is not invoked but
- * instead the <code>runWithEvent(IAction, Event)</code> method is called.
- * </p>
- *
- * @param action the action proxy that handles the presentation portion of the
- * action
- */
- void run(IAction action);
+ /**
+ * Performs this action.
+ * <p>
+ * This method is called by the proxy action when the action has been triggered.
+ * Implement this method to do the actual work.
+ * </p>
+ * <p>
+ * <b>Note:</b> If the action delegate also implements
+ * <code>IActionDelegate2</code>, then this method is not invoked but instead
+ * the <code>runWithEvent(IAction, Event)</code> method is called.
+ * </p>
+ *
+ * @param action the action proxy that handles the presentation portion of the
+ * action
+ */
+ void run(IAction action);
- /**
- * Notifies this action delegate that the selection in the workbench has changed.
- * <p>
- * Implementers can use this opportunity to change the availability of the
- * action or to modify other presentation properties.
- * </p><p>
- * When the selection changes, the action enablement state is updated based on
- * the criteria specified in the plugin.xml file. Then the delegate is notified
- * of the selection change regardless of whether the enablement criteria in the
- * plugin.xml file is met.
- * </p>
- *
- * @param action the action proxy that handles presentation portion of
- * the action
- * @param selection the current selection, or <code>null</code> if there
- * is no selection.
- */
- void selectionChanged(IAction action, ISelection selection);
+ /**
+ * Notifies this action delegate that the selection in the workbench has
+ * changed.
+ * <p>
+ * Implementers can use this opportunity to change the availability of the
+ * action or to modify other presentation properties.
+ * </p>
+ * <p>
+ * When the selection changes, the action enablement state is updated based on
+ * the criteria specified in the plugin.xml file. Then the delegate is notified
+ * of the selection change regardless of whether the enablement criteria in the
+ * plugin.xml file is met.
+ * </p>
+ *
+ * @param action the action proxy that handles presentation portion of the
+ * action
+ * @param selection the current selection, or <code>null</code> if there is no
+ * selection.
+ */
+ void selectionChanged(IAction action, ISelection selection);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionDelegate2.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionDelegate2.java
index 31fb837b27d..034c14f1719 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionDelegate2.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionDelegate2.java
@@ -24,11 +24,13 @@ import org.eclipse.swt.widgets.Event;
* An action delegate that implements this interface will have its
* <code>runWithEvent(IAction, Event)</code> called instead of its
* <code>run(IAction)</code> method.
- * </p><p>
+ * </p>
+ * <p>
* Clients should implement this interface, in addition to
* <code>IActionDelegate</code> or sub-interfaces, if interested in the
* triggering event or in the lifecycle of the delegate object.
- * </p><p>
+ * </p>
+ * <p>
* Clients can choose to subclass the provided abstract implementation
* <code>org. eclipse. ui. actions. ActionDelegate</code> or implement the
* interface directly.
@@ -39,36 +41,35 @@ import org.eclipse.swt.widgets.Event;
* @since 2.1
*/
public interface IActionDelegate2 extends IActionDelegate {
- /**
- * Allows the action delegate to initialize itself after being created by
- * the proxy action. This lifecycle method is called after the
- * action delegate has been created and before any other method of the
- * action delegate is called.
- *
- * @param action the proxy action that handles the presentation portion of
- * the action.
- */
- void init(IAction action);
+ /**
+ * Allows the action delegate to initialize itself after being created by the
+ * proxy action. This lifecycle method is called after the action delegate has
+ * been created and before any other method of the action delegate is called.
+ *
+ * @param action the proxy action that handles the presentation portion of the
+ * action.
+ */
+ void init(IAction action);
- /**
- * Allows the action delegate to clean up. This lifecycle method is called
- * when the proxy action is done with this action delegate. This is the last
- * method called.
- */
- void dispose();
+ /**
+ * Allows the action delegate to clean up. This lifecycle method is called when
+ * the proxy action is done with this action delegate. This is the last method
+ * called.
+ */
+ void dispose();
- /**
- * Performs this action, passing the SWT event which triggered it. This
- * method is called by the proxy action when the action has been triggered.
- * Implement this method to do the actual work.
- * <p>
- * <b>Note:</b> This method is called instead of <code>run(IAction)</code>.
- * </p>
- *
- * @param action the action proxy that handles the presentation portion of
- * the action
- * @param event the SWT event which triggered this action being run
- * @since 2.0
- */
- void runWithEvent(IAction action, Event event);
+ /**
+ * Performs this action, passing the SWT event which triggered it. This method
+ * is called by the proxy action when the action has been triggered. Implement
+ * this method to do the actual work.
+ * <p>
+ * <b>Note:</b> This method is called instead of <code>run(IAction)</code>.
+ * </p>
+ *
+ * @param action the action proxy that handles the presentation portion of the
+ * action
+ * @param event the SWT event which triggered this action being run
+ * @since 2.0
+ */
+ void runWithEvent(IAction action, Event event);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionDelegateWithEvent.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionDelegateWithEvent.java
index fb2b940908d..786fd24bd3e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionDelegateWithEvent.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionDelegateWithEvent.java
@@ -17,14 +17,15 @@ import org.eclipse.jface.action.IAction;
import org.eclipse.swt.widgets.Event;
/**
- * This interface is a mixin interface for action delegates, adding the ability to
- * examine the triggering SWT event when it is run.
- * If an action delegate implements this interface, then <code>runWithEvent(IAction, Event)</code>
- * is called instead of <code>run(IAction)</code>.
+ * This interface is a mixin interface for action delegates, adding the ability
+ * to examine the triggering SWT event when it is run. If an action delegate
+ * implements this interface, then <code>runWithEvent(IAction, Event)</code> is
+ * called instead of <code>run(IAction)</code>.
* <p>
- * Clients should implement this interface, in addition to <code>IActionDelegate</code>
- * (or subinterface), if they need to examine the triggering event.
- * Otherwise, they should simply implement <code>IActionDelegate</code> (or subinterface).
+ * Clients should implement this interface, in addition to
+ * <code>IActionDelegate</code> (or subinterface), if they need to examine the
+ * triggering event. Otherwise, they should simply implement
+ * <code>IActionDelegate</code> (or subinterface).
* <p>
*
* @since 2.0
@@ -33,20 +34,21 @@ import org.eclipse.swt.widgets.Event;
@Deprecated
public interface IActionDelegateWithEvent {
- /**
- * Performs this action, passing the SWT event which triggered it.
- * <p>
- * This method is called when the delegating action has been triggered.
- * Implement this method to do the actual work.
- * If an action delegate implements this interface, this method
- * is called instead of <code>run(IAction)</code>.
- * <p>
- *
- * @param action the action proxy that handles the presentation portion of the action
- * @param event the SWT event which triggered this action being run
- * @since 2.0
- * @deprecated Use org.eclipse.ui.IActionDelegate2 instead.
- */
- @Deprecated void runWithEvent(IAction action, Event event);
+ /**
+ * Performs this action, passing the SWT event which triggered it.
+ * <p>
+ * This method is called when the delegating action has been triggered.
+ * Implement this method to do the actual work. If an action delegate implements
+ * this interface, this method is called instead of <code>run(IAction)</code>.
+ * <p>
+ *
+ * @param action the action proxy that handles the presentation portion of the
+ * action
+ * @param event the SWT event which triggered this action being run
+ * @since 2.0
+ * @deprecated Use org.eclipse.ui.IActionDelegate2 instead.
+ */
+ @Deprecated
+ void runWithEvent(IAction action, Event event);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionFilter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionFilter.java
index 3018581992a..032345ec0d6 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionFilter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionFilter.java
@@ -17,47 +17,49 @@ package org.eclipse.ui;
* An adapter which performs action filtering.
* <p>
* Within the workbench a plugin may extend the actions which appear in the
- * context menu for any object. The visibility of each action extension is controlled
- * by action filtering. By default, the workbench will filter each action extension using
- * the <code>objectClass</code> and optional <code>nameFilter</code> attributes defined
- * in xml. If the action extension passes this test the action will be added to the
- * context menu for the object.
+ * context menu for any object. The visibility of each action extension is
+ * controlled by action filtering. By default, the workbench will filter each
+ * action extension using the <code>objectClass</code> and optional
+ * <code>nameFilter</code> attributes defined in xml. If the action extension
+ * passes this test the action will be added to the context menu for the object.
* </p>
* <p>
- * In some situations the object class and name are not enough to describe the intended
- * target action. In those situations an action extension may define one or more
- * <code>filter</code> sub-elements. Each one of these elements describes one attribute of
- * the action target using a <code>name value</code> pair. The attributes for an object
- * are type specific and beyond the domain of the workbench itself, so the workbench
- * will delegate filtering at this level to an <code>IActionFilter</code>. This is a
- * filtering strategy which is provided by the selection itself and may perform type
- * specific filtering.
+ * In some situations the object class and name are not enough to describe the
+ * intended target action. In those situations an action extension may define
+ * one or more <code>filter</code> sub-elements. Each one of these elements
+ * describes one attribute of the action target using a <code>name value</code>
+ * pair. The attributes for an object are type specific and beyond the domain of
+ * the workbench itself, so the workbench will delegate filtering at this level
+ * to an <code>IActionFilter</code>. This is a filtering strategy which is
+ * provided by the selection itself and may perform type specific filtering.
* </p>
* <p>
- * The workbench will retrieve the filter from the selected object by testing to see
- * if it implements <code>IActionFilter</code>. If that fails, the workbench will ask for
- * a filter through through the <code>IAdaptable</code> mechanism. If a filter is
- * found the workbench will pass each name value pair to the filter to determine if it
- * matches the state of the selected object. If so, or there is no filter, the action
- * will be added to the context menu for the object.
+ * The workbench will retrieve the filter from the selected object by testing to
+ * see if it implements <code>IActionFilter</code>. If that fails, the workbench
+ * will ask for a filter through through the <code>IAdaptable</code> mechanism.
+ * If a filter is found the workbench will pass each name value pair to the
+ * filter to determine if it matches the state of the selected object. If so, or
+ * there is no filter, the action will be added to the context menu for the
+ * object.
* </p>
* <p>
- * Clients that implement this filter mechanism are strongly encouraged to extend this
- * interface to provide a list of attribute names and possible values that are
- * considered public for other clients to reference.
+ * Clients that implement this filter mechanism are strongly encouraged to
+ * extend this interface to provide a list of attribute names and possible
+ * values that are considered public for other clients to reference.
* </p>
*
* @see org.eclipse.core.runtime.IAdaptable
*/
public interface IActionFilter {
- /**
- * Returns whether the specific attribute matches the state of the target
- * object.
- *
- * @param target the target object
- * @param name the attribute name
- * @param value the attribute value
- * @return <code>true</code> if the attribute matches; <code>false</code> otherwise
- */
- boolean testAttribute(Object target, String name, String value);
+ /**
+ * Returns whether the specific attribute matches the state of the target
+ * object.
+ *
+ * @param target the target object
+ * @param name the attribute name
+ * @param value the attribute value
+ * @return <code>true</code> if the attribute matches; <code>false</code>
+ * otherwise
+ */
+ boolean testAttribute(Object target, String name, String value);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IAggregateWorkingSet.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IAggregateWorkingSet.java
index 6300c0bb32c..30ba9c058ff 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IAggregateWorkingSet.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IAggregateWorkingSet.java
@@ -16,8 +16,8 @@ package org.eclipse.ui;
/**
* Contains a set of {@link IWorkingSet}.
*
- * Sets of working sets are used by viewers to contain all of the working
- * sets being shown. Sets can also be nested.
+ * Sets of working sets are used by viewers to contain all of the working sets
+ * being shown. Sets can also be nested.
*
* In classes that implement this, the {@link IWorkingSet#getElements()} returns
* all of the elements of each of the working sets in this set.
@@ -33,8 +33,8 @@ public interface IAggregateWorkingSet extends IWorkingSet {
/**
* Returns the working sets contained in this aggregate working set.
*
- * Clients can do what they wish with the returned array, as it
- * will have no effect on the state of the this object.
+ * Clients can do what they wish with the returned array, as it will have no
+ * effect on the state of the this object.
*
* @return the working sets contained in this aggregate working set.
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IContainmentAdapter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IContainmentAdapter.java
index 75bb252156a..fc0f8b515d1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IContainmentAdapter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IContainmentAdapter.java
@@ -14,49 +14,50 @@
package org.eclipse.ui;
/**
- * This adapter interface provides a way to test element containment
- * in a model-independent way.
- * The workbench uses this interface in certain views
- * to test if a given resource is part of a working set.
+ * This adapter interface provides a way to test element containment in a
+ * model-independent way. The workbench uses this interface in certain views to
+ * test if a given resource is part of a working set.
*
* @since 2.1
*/
public interface IContainmentAdapter {
- /**
- * Checks whether the given element corresponds to the containment context.
- */
- int CHECK_CONTEXT = 1;
+ /**
+ * Checks whether the given element corresponds to the containment context.
+ */
+ int CHECK_CONTEXT = 1;
- /**
- * Checks whether the given element corresponds to a direct child of the
- * containment context. Does not include the containment context itself.
- */
- int CHECK_IF_CHILD = 2;
+ /**
+ * Checks whether the given element corresponds to a direct child of the
+ * containment context. Does not include the containment context itself.
+ */
+ int CHECK_IF_CHILD = 2;
- /**
- * Checks whether the given element corresponds to an ancestor of the
- * containment context. Does not include the containment context itself.
- */
- int CHECK_IF_ANCESTOR = 4;
+ /**
+ * Checks whether the given element corresponds to an ancestor of the
+ * containment context. Does not include the containment context itself.
+ */
+ int CHECK_IF_ANCESTOR = 4;
- /**
- * Checks whether the given element corresponds to a descendant of the
- * containment context. Does not include the containment context itself.
- */
- int CHECK_IF_DESCENDANT = 8;
+ /**
+ * Checks whether the given element corresponds to a descendant of the
+ * containment context. Does not include the containment context itself.
+ */
+ int CHECK_IF_DESCENDANT = 8;
- /**
- * Returns whether the given element is considered contained
- * in the specified containment context or if it is the context
- * itself.
- *
- * @param containmentContext object that provides containment
- * context for the element. This is typically a container object
- * (e.g., IFolder) and may be the element object itself.
- * @param element object that should be tested for containment
- * @param flags one or more of <code>CHECK_CONTEXT</code>,
- * <code>CHECK_IF_CHILD</code>, <code>CHECK_IF_ANCESTOR</code>,
- * <code>CHECK_IF_DESCENDENT</code> logically ORed together.
- */
- boolean contains(Object containmentContext, Object element, int flags);
+ /**
+ * Returns whether the given element is considered contained in the specified
+ * containment context or if it is the context itself.
+ *
+ * @param containmentContext object that provides containment context for the
+ * element. This is typically a container object
+ * (e.g., IFolder) and may be the element object
+ * itself.
+ * @param element object that should be tested for containment
+ * @param flags one or more of <code>CHECK_CONTEXT</code>,
+ * <code>CHECK_IF_CHILD</code>,
+ * <code>CHECK_IF_ANCESTOR</code>,
+ * <code>CHECK_IF_DESCENDENT</code> logically ORed
+ * together.
+ */
+ boolean contains(Object containmentContext, Object element, int flags);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IDecoratorManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IDecoratorManager.java
index 5135bb3d548..5d921b569f3 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IDecoratorManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IDecoratorManager.java
@@ -32,87 +32,84 @@ import org.eclipse.jface.viewers.ILightweightLabelDecorator;
*
* @noimplement This interface is not intended to be implemented by clients.
*/
-public interface IDecoratorManager extends IDelayedLabelDecorator{
+public interface IDecoratorManager extends IDelayedLabelDecorator {
- /**
- * Returns the label decorator which applies the decorations from all
- * enabled decorators.
- * Views which allow decoration of their elements should use this
- * label decorator.
- * This decorator should be disposed when it is no longer referenced
- * by the caller or the images created within it may be kept until
- * {@link JFaceResources#getResources()} is disposed.
- *
- * @return {@link ILabelDecorator}
- * @see DecoratingLabelProvider
- * @see IBaseLabelProvider#dispose()
- */
- ILabelDecorator getLabelDecorator();
+ /**
+ * Returns the label decorator which applies the decorations from all enabled
+ * decorators. Views which allow decoration of their elements should use this
+ * label decorator. This decorator should be disposed when it is no longer
+ * referenced by the caller or the images created within it may be kept until
+ * {@link JFaceResources#getResources()} is disposed.
+ *
+ * @return {@link ILabelDecorator}
+ * @see DecoratingLabelProvider
+ * @see IBaseLabelProvider#dispose()
+ */
+ ILabelDecorator getLabelDecorator();
- /**
- * Return the IBaseLabelProvider that corresponds to the
- * decoratorId. This can handle both lightweight and full
- * decorators.
- *
- * @param decoratorId the decorator id
- * @return the label provider
- */
- IBaseLabelProvider getBaseLabelProvider(String decoratorId);
+ /**
+ * Return the IBaseLabelProvider that corresponds to the decoratorId. This can
+ * handle both lightweight and full decorators.
+ *
+ * @param decoratorId the decorator id
+ * @return the label provider
+ */
+ IBaseLabelProvider getBaseLabelProvider(String decoratorId);
- /**
- * Returns the full label decorator instance for the specified decorator id
- * if it is enabled. Otherwise returns <code>null</code>. Returns
- * <code>null</code> for lightweight decorators. It is recommended that
- * getBaseLabelProvider is used instead so that lightweight decorators are
- * also checked.
- *
- * @param decoratorId the decorator id
- * @return the label decorator
- */
- ILabelDecorator getLabelDecorator(String decoratorId);
+ /**
+ * Returns the full label decorator instance for the specified decorator id if
+ * it is enabled. Otherwise returns <code>null</code>. Returns <code>null</code>
+ * for lightweight decorators. It is recommended that getBaseLabelProvider is
+ * used instead so that lightweight decorators are also checked.
+ *
+ * @param decoratorId the decorator id
+ * @return the label decorator
+ */
+ ILabelDecorator getLabelDecorator(String decoratorId);
- /**
- * Returns the lightweight label decorator instance for the specified
- * decorator id if it is enabled. Otherwise returns <code>null</code>.
- * Returns <code>null</code> for heavyweight decorators.
- * Use <code>getLabelDecorator</code> instead for heavyweight
- * decorators.
- *
- * @param decoratorId the decorator id
- * @return the lightweight label decorator
- * @deprecated use getBaseLabelProvider(String) instead.
- */
- @Deprecated
+ /**
+ * Returns the lightweight label decorator instance for the specified decorator
+ * id if it is enabled. Otherwise returns <code>null</code>. Returns
+ * <code>null</code> for heavyweight decorators. Use
+ * <code>getLabelDecorator</code> instead for heavyweight decorators.
+ *
+ * @param decoratorId the decorator id
+ * @return the lightweight label decorator
+ * @deprecated use getBaseLabelProvider(String) instead.
+ */
+ @Deprecated
ILightweightLabelDecorator getLightweightLabelDecorator(String decoratorId);
- /**
- * Returns whether the specified decorator is enabled.
- *
- * @param decoratorId the decorator id
- * @return <code>true</code> if the decorator is enabled, or
- * <code>false</code> if not
- */
- boolean getEnabled(String decoratorId);
+ /**
+ * Returns whether the specified decorator is enabled.
+ *
+ * @param decoratorId the decorator id
+ * @return <code>true</code> if the decorator is enabled, or <code>false</code>
+ * if not
+ */
+ boolean getEnabled(String decoratorId);
- /**
- * Sets whether the specified decorator is enabled.
- *
- * @param decoratorId the decorator id
- * @param enabled <code>true</code> to enable the decorator, or
- * <code>false</code> to disable it
- * @throws CoreException if the decorator cannot be instantiated
- */
- void setEnabled(String decoratorId, boolean enabled) throws CoreException;
+ /**
+ * Sets whether the specified decorator is enabled.
+ *
+ * @param decoratorId the decorator id
+ * @param enabled <code>true</code> to enable the decorator, or
+ * <code>false</code> to disable it
+ * @throws CoreException if the decorator cannot be instantiated
+ */
+ void setEnabled(String decoratorId, boolean enabled) throws CoreException;
- /**
- * Fire a LabelProviderChangedEvent for the decorator that corresponds to
- * decoratorID if it exists and is enabled using the IBaseLabelProvider
- * as the argument to the event. Otherwise do nothing.
- * <p> This method must be called from the user interface thread as widget
- * updates may result. </p>
- *
- * @param decoratorId the decorator id
- */
- void update(String decoratorId);
+ /**
+ * Fire a LabelProviderChangedEvent for the decorator that corresponds to
+ * decoratorID if it exists and is enabled using the IBaseLabelProvider as the
+ * argument to the event. Otherwise do nothing.
+ * <p>
+ * This method must be called from the user interface thread as widget updates
+ * may result.
+ * </p>
+ *
+ * @param decoratorId the decorator id
+ */
+ void update(String decoratorId);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorActionBarContributor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorActionBarContributor.java
index 27687110e45..cd9961133f7 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorActionBarContributor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorActionBarContributor.java
@@ -37,7 +37,7 @@ package org.eclipse.ui;
* @see IEditorActionBarContributor
*/
public interface IEditorActionBarContributor {
- /**
+ /**
* Initializes this contributor, which is expected to add contributions as
* required to the given action bars and global action handlers.
* <p>
@@ -59,21 +59,21 @@ public interface IEditorActionBarContributor {
* @param page the workbench page for this contributor
* @since 2.0
*/
- void init(IActionBars bars, IWorkbenchPage page);
+ void init(IActionBars bars, IWorkbenchPage page);
- /**
- * Sets the active editor for the contributor.
- * Implementors should disconnect from the old editor, connect to the
- * new editor, and update the actions to reflect the new editor.
- *
- * @param targetEditor the new editor target
- */
- void setActiveEditor(IEditorPart targetEditor);
+ /**
+ * Sets the active editor for the contributor. Implementors should disconnect
+ * from the old editor, connect to the new editor, and update the actions to
+ * reflect the new editor.
+ *
+ * @param targetEditor the new editor target
+ */
+ void setActiveEditor(IEditorPart targetEditor);
- /**
- * Disposes this contributor.
- *
- * @since 2.0
- */
- void dispose();
+ /**
+ * Disposes this contributor.
+ *
+ * @since 2.0
+ */
+ void dispose();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorActionDelegate.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorActionDelegate.java
index 45e97d1ed3b..d0d4072077a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorActionDelegate.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorActionDelegate.java
@@ -23,13 +23,14 @@ import org.eclipse.jface.action.IAction;
* link to the currently active editor instance.
*/
public interface IEditorActionDelegate extends IActionDelegate {
- /**
- * Sets the active editor for the delegate.
- * Implementors should disconnect from the old editor, connect to the
- * new editor, and update the action to reflect the new editor.
- *
- * @param action the action proxy that handles presentation portion of the action
- * @param targetEditor the new editor target
- */
- void setActiveEditor(IAction action, IEditorPart targetEditor);
+ /**
+ * Sets the active editor for the delegate. Implementors should disconnect from
+ * the old editor, connect to the new editor, and update the action to reflect
+ * the new editor.
+ *
+ * @param action the action proxy that handles presentation portion of the
+ * action
+ * @param targetEditor the new editor target
+ */
+ void setActiveEditor(IAction action, IEditorPart targetEditor);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorDescriptor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorDescriptor.java
index 1093ccfcf3c..4336f6b9933 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorDescriptor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorDescriptor.java
@@ -34,69 +34,72 @@ import org.eclipse.jface.resource.ImageDescriptor;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IEditorDescriptor extends IWorkbenchPartDescriptor {
- /**
- * Returns the editor id.
- * <p>
- * For internal editors, this is the extension id as defined in the workbench
- * registry; for external editors, it is path and file name of the external
- * program.
- * </p>
- *
- * @return the id of the editor
- */
- @Override String getId();
+ /**
+ * Returns the editor id.
+ * <p>
+ * For internal editors, this is the extension id as defined in the workbench
+ * registry; for external editors, it is path and file name of the external
+ * program.
+ * </p>
+ *
+ * @return the id of the editor
+ */
+ @Override
+ String getId();
- /**
- * Returns the descriptor of the image for this editor.
- *
- * @return the descriptor of the image to display next to this editor
- */
- @Override ImageDescriptor getImageDescriptor();
+ /**
+ * Returns the descriptor of the image for this editor.
+ *
+ * @return the descriptor of the image to display next to this editor
+ */
+ @Override
+ ImageDescriptor getImageDescriptor();
- /**
- * Returns the label to show for this editor.
- *
- * @return the editor label
- */
- @Override String getLabel();
+ /**
+ * Returns the label to show for this editor.
+ *
+ * @return the editor label
+ */
+ @Override
+ String getLabel();
- /**
- * Returns whether this editor descriptor will open a regular editor
- * part inside the editor area.
- *
- * @return <code>true</code> if editor is inside editor area, and
- * <code>false</code> otherwise
- * @since 3.0
- */
- boolean isInternal();
+ /**
+ * Returns whether this editor descriptor will open a regular editor part inside
+ * the editor area.
+ *
+ * @return <code>true</code> if editor is inside editor area, and
+ * <code>false</code> otherwise
+ * @since 3.0
+ */
+ boolean isInternal();
- /**
- * Returns whether this editor descriptor will open an external
- * editor in-place inside the editor area.
- *
- * @return <code>true</code> if editor is in-place, and <code>false</code>
- * otherwise
- * @since 3.0
- */
- boolean isOpenInPlace();
+ /**
+ * Returns whether this editor descriptor will open an external editor in-place
+ * inside the editor area.
+ *
+ * @return <code>true</code> if editor is in-place, and <code>false</code>
+ * otherwise
+ * @since 3.0
+ */
+ boolean isOpenInPlace();
- /**
- * Returns whether this editor descriptor will open an external editor
- * in a new window outside the workbench.
- *
- * @return <code>true</code> if editor is external, and <code>false</code>
- * otherwise
- * @since 3.0
- */
- boolean isOpenExternal();
+ /**
+ * Returns whether this editor descriptor will open an external editor in a new
+ * window outside the workbench.
+ *
+ * @return <code>true</code> if editor is external, and <code>false</code>
+ * otherwise
+ * @since 3.0
+ */
+ boolean isOpenExternal();
- /**
- * Returns the editor matching strategy object for editors
- * represented by this editor descriptor, or <code>null</code>
- * if there is no explicit matching strategy specified.
- *
- * @return the editor matching strategy, or <code>null</code> if none
- * @since 3.1
- */
- IEditorMatchingStrategy getEditorMatchingStrategy();
+ /**
+ * Returns the editor matching strategy object for editors represented by this
+ * editor descriptor, or <code>null</code> if there is no explicit matching
+ * strategy specified.
+ *
+ * @return the editor matching strategy, or <code>null</code> if none
+ * @since 3.1
+ */
+ IEditorMatchingStrategy getEditorMatchingStrategy();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorInput.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorInput.java
index 260f5edf789..af5ace5ce22 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorInput.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorInput.java
@@ -17,14 +17,14 @@ import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.resource.ImageDescriptor;
/**
- * <code>IEditorInput</code> is a light weight descriptor of editor input,
- * like a file name but more abstract. It is not a model. It is a description of
- * the model source for an <code>IEditorPart</code>.
+ * <code>IEditorInput</code> is a light weight descriptor of editor input, like
+ * a file name but more abstract. It is not a model. It is a description of the
+ * model source for an <code>IEditorPart</code>.
* <p>
* Clients implementing this editor input interface should override
- * <code>Object.equals(Object)</code> to answer true for two inputs that are
- * the same. The <code>IWorkbenchPage.openEditor</code> APIs are dependent on
- * this to find an editor with the same input.
+ * <code>Object.equals(Object)</code> to answer true for two inputs that are the
+ * same. The <code>IWorkbenchPage.openEditor</code> APIs are dependent on this
+ * to find an editor with the same input.
* </p>
* <p>
* Clients should extend this interface to declare new types of editor inputs.
@@ -35,8 +35,8 @@ import org.eclipse.jface.resource.ImageDescriptor;
* define generic methods for getting and setting bytes.
* </p>
* <p>
- * Editor input must implement the <code>IAdaptable</code> interface;
- * extensions are managed by the platform's adapter manager.
+ * Editor input must implement the <code>IAdaptable</code> interface; extensions
+ * are managed by the platform's adapter manager.
* </p>
* <p>
* Please note that it is important that the editor input be light weight.
@@ -55,13 +55,13 @@ public interface IEditorInput extends IAdaptable {
/**
* Returns whether the editor input exists.
* <p>
- * This method is primarily used to determine if an editor input should
- * appear in the "File Most Recently Used" menu. An editor input will appear
- * in the list until the return value of <code>exists</code> becomes
- * <code>false</code> or it drops off the bottom of the list.
+ * This method is primarily used to determine if an editor input should appear
+ * in the "File Most Recently Used" menu. An editor input will appear in the
+ * list until the return value of <code>exists</code> becomes <code>false</code>
+ * or it drops off the bottom of the list.
*
- * @return <code>true</code> if the editor input exists;
- * <code>false</code> otherwise
+ * @return <code>true</code> if the editor input exists; <code>false</code>
+ * otherwise
*/
boolean exists();
@@ -69,18 +69,18 @@ public interface IEditorInput extends IAdaptable {
* Returns the image descriptor for this input.
*
* <p>
- * Note: although a null return value has never been permitted from this
- * method, there are many known buggy implementations that return null.
- * Clients that need the image for an editor are advised to use
- * IWorkbenchPart.getImage() instead of IEditorInput.getImageDescriptor(),
- * or to recover from a null return value in a manner that records the ID of
- * the problematic editor input. Implementors that have been returning null
- * from this method should pick some other default return value (such as
+ * Note: although a null return value has never been permitted from this method,
+ * there are many known buggy implementations that return null. Clients that
+ * need the image for an editor are advised to use IWorkbenchPart.getImage()
+ * instead of IEditorInput.getImageDescriptor(), or to recover from a null
+ * return value in a manner that records the ID of the problematic editor input.
+ * Implementors that have been returning null from this method should pick some
+ * other default return value (such as
* ImageDescriptor.getMissingImageDescriptor()).
* </p>
*
* @return the image descriptor for this input; may be <code>null</code> if
- * there is no image.
+ * there is no image.
*/
ImageDescriptor getImageDescriptor();
@@ -95,19 +95,18 @@ public interface IEditorInput extends IAdaptable {
String getName();
/**
- * Returns an object that can be used to save the state of this editor
- * input.
+ * Returns an object that can be used to save the state of this editor input.
*
- * @return the persistable element, or <code>null</code> if this editor
- * input cannot be persisted
+ * @return the persistable element, or <code>null</code> if this editor input
+ * cannot be persisted
*/
IPersistableElement getPersistable();
/**
* Returns the tool tip text for this editor input. This text is used to
* differentiate between two input with the same name. For instance,
- * MyClass.java in folder X and MyClass.java in folder Y. The format of the
- * text varies between input types.
+ * MyClass.java in folder X and MyClass.java in folder Y. The format of the text
+ * varies between input types.
*
* @return the tool tip text; never <code>null</code>.
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorLauncher.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorLauncher.java
index 5d8e24adfb3..9a0f7e01020 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorLauncher.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorLauncher.java
@@ -48,11 +48,11 @@ import org.eclipse.core.runtime.IPath;
*/
public interface IEditorLauncher {
- /**
- * Launches this external editor to edit the file at the given
- * location in the local file system.
- *
- * @param file the local file system path of the file to edit
- */
- void open(IPath file);
+ /**
+ * Launches this external editor to edit the file at the given location in the
+ * local file system.
+ *
+ * @param file the local file system path of the file to edit
+ */
+ void open(IPath file);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorMatchingStrategy.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorMatchingStrategy.java
index 68ada0525a1..c7e439ce7a8 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorMatchingStrategy.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorMatchingStrategy.java
@@ -16,29 +16,30 @@ package org.eclipse.ui;
/**
* An editor matching strategy allows editor extensions to provide their own
- * algorithm for matching the input of an open editor of that type to a
- * given editor input. This is used to find a matching editor during
- * {@link org.eclipse.ui.IWorkbenchPage#openEditor(IEditorInput, String, boolean)} and
- * {@link org.eclipse.ui.IWorkbenchPage#findEditor(IEditorInput)}.
+ * algorithm for matching the input of an open editor of that type to a given
+ * editor input. This is used to find a matching editor during
+ * {@link org.eclipse.ui.IWorkbenchPage#openEditor(IEditorInput, String, boolean)}
+ * and {@link org.eclipse.ui.IWorkbenchPage#findEditor(IEditorInput)}.
*
* @since 3.1
*/
public interface IEditorMatchingStrategy {
- /**
- * Returns whether the editor represented by the given editor reference
- * matches the given editor input.
- * <p>
- * Implementations should inspect the given editor input first,
- * and try to reject it early before calling <code>IEditorReference.getEditorInput()</code>,
- * since that method may be expensive.
- * </p>
- *
- * @param editorRef the editor reference to match against
- * @param input the editor input to match
- * @return <code>true</code> if the editor matches the given editor input,
- * <code>false</code> if it does not match
- */
- boolean matches(IEditorReference editorRef, IEditorInput input);
+ /**
+ * Returns whether the editor represented by the given editor reference matches
+ * the given editor input.
+ * <p>
+ * Implementations should inspect the given editor input first, and try to
+ * reject it early before calling
+ * <code>IEditorReference.getEditorInput()</code>, since that method may be
+ * expensive.
+ * </p>
+ *
+ * @param editorRef the editor reference to match against
+ * @param input the editor input to match
+ * @return <code>true</code> if the editor matches the given editor input,
+ * <code>false</code> if it does not match
+ */
+ boolean matches(IEditorReference editorRef, IEditorInput input);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorPart.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorPart.java
index 2875315ad71..8121aa6d2f5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorPart.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorPart.java
@@ -54,54 +54,55 @@ package org.eclipse.ui;
*/
public interface IEditorPart extends IWorkbenchPart, ISaveablePart {
- /**
- * The property id for <code>isDirty</code>.
- */
- int PROP_DIRTY = IWorkbenchPartConstants.PROP_DIRTY;
+ /**
+ * The property id for <code>isDirty</code>.
+ */
+ int PROP_DIRTY = IWorkbenchPartConstants.PROP_DIRTY;
- /**
- * The property id for <code>getEditorInput</code>.
- */
- int PROP_INPUT = IWorkbenchPartConstants.PROP_INPUT;
+ /**
+ * The property id for <code>getEditorInput</code>.
+ */
+ int PROP_INPUT = IWorkbenchPartConstants.PROP_INPUT;
- /**
- * Returns the input for this editor. If this value changes the part must
- * fire a property listener event with <code>PROP_INPUT</code>.
- *
- * @return the editor input
- */
- IEditorInput getEditorInput();
+ /**
+ * Returns the input for this editor. If this value changes the part must fire a
+ * property listener event with <code>PROP_INPUT</code>.
+ *
+ * @return the editor input
+ */
+ IEditorInput getEditorInput();
- /**
- * Returns the site for this editor.
- * This method is equivalent to <code>(IEditorSite) getSite()</code>.
- * <p>
- * The site can be <code>null</code> while the editor is being initialized.
- * After the initialization is complete, this value must be non-<code>null</code>
- * for the remainder of the editor's life cycle.
- * </p>
- *
- * @return the editor site; this value may be <code>null</code> if the editor
- * has not yet been initialized
- */
- IEditorSite getEditorSite();
+ /**
+ * Returns the site for this editor. This method is equivalent to
+ * <code>(IEditorSite) getSite()</code>.
+ * <p>
+ * The site can be <code>null</code> while the editor is being initialized.
+ * After the initialization is complete, this value must be
+ * non-<code>null</code> for the remainder of the editor's life cycle.
+ * </p>
+ *
+ * @return the editor site; this value may be <code>null</code> if the editor
+ * has not yet been initialized
+ */
+ IEditorSite getEditorSite();
- /**
- * Initializes this editor with the given editor site and input.
- * <p>
- * This method is automatically called shortly after the part is instantiated.
- * It marks the start of the part's lifecycle. The
- * {@link IWorkbenchPart#dispose IWorkbenchPart.dispose} method will be called
- * automically at the end of the lifecycle. Clients must not call this method.
- * </p><p>
- * Implementors of this method must examine the editor input object type to
- * determine if it is understood. If not, the implementor must throw
- * a <code>PartInitException</code>
- * </p>
- * @param site the editor site
- * @param input the editor input
- * @exception PartInitException if this editor was not initialized successfully
- */
- void init(IEditorSite site, IEditorInput input)
- throws PartInitException;
+ /**
+ * Initializes this editor with the given editor site and input.
+ * <p>
+ * This method is automatically called shortly after the part is instantiated.
+ * It marks the start of the part's lifecycle. The {@link IWorkbenchPart#dispose
+ * IWorkbenchPart.dispose} method will be called automically at the end of the
+ * lifecycle. Clients must not call this method.
+ * </p>
+ * <p>
+ * Implementors of this method must examine the editor input object type to
+ * determine if it is understood. If not, the implementor must throw a
+ * <code>PartInitException</code>
+ * </p>
+ *
+ * @param site the editor site
+ * @param input the editor input
+ * @exception PartInitException if this editor was not initialized successfully
+ */
+ void init(IEditorSite site, IEditorInput input) throws PartInitException;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorReference.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorReference.java
index 20f4ba01ceb..3cf737e3be7 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorReference.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorReference.java
@@ -25,42 +25,40 @@ package org.eclipse.ui;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IEditorReference extends IWorkbenchPartReference {
- /**
- * Returns the factory id of the factory used to
- * restore this editor. Returns null if the editor
- * is not persistable.
- */
- String getFactoryId();
+ /**
+ * Returns the factory id of the factory used to restore this editor. Returns
+ * null if the editor is not persistable.
+ */
+ String getFactoryId();
/**
- * Returns the editor input's name. May return null if the name is not
- * available or if the editor failed to be restored.
+ * Returns the editor input's name. May return null if the name is not available
+ * or if the editor failed to be restored.
*/
- String getName();
+ String getName();
- /**
- * Returns the editor referenced by this object.
- * Returns <code>null</code> if the editor was not instantiated or
- * it failed to be restored. Tries to restore the editor
- * if <code>restore</code> is true.
- */
- IEditorPart getEditor(boolean restore);
+ /**
+ * Returns the editor referenced by this object. Returns <code>null</code> if
+ * the editor was not instantiated or it failed to be restored. Tries to restore
+ * the editor if <code>restore</code> is true.
+ */
+ IEditorPart getEditor(boolean restore);
/**
* Returns true if the editor is pinned, otherwise returns false.
*/
- boolean isPinned();
+ boolean isPinned();
- /**
- * Returns the editor input for the editor referenced by this object.
- * <p>
- * Unlike most of the other methods on this type, this method
- * can trigger plug-in activation.
- * </p>
- *
- * @return the editor input for the editor referenced by this object
- * @throws PartInitException if there was an error restoring the editor input
- * @since 3.1
- */
- IEditorInput getEditorInput() throws PartInitException;
+ /**
+ * Returns the editor input for the editor referenced by this object.
+ * <p>
+ * Unlike most of the other methods on this type, this method can trigger
+ * plug-in activation.
+ * </p>
+ *
+ * @return the editor input for the editor referenced by this object
+ * @throws PartInitException if there was an error restoring the editor input
+ * @since 3.1
+ */
+ IEditorInput getEditorInput() throws PartInitException;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorRegistry.java
index b7a7443ebf5..ce89be952e0 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorRegistry.java
@@ -41,36 +41,35 @@ import org.eclipse.jface.resource.ImageDescriptor;
*/
public interface IEditorRegistry {
- /**
- * The property identifier for the contents of this registry.
- */
- int PROP_CONTENTS = 0x01;
+ /**
+ * The property identifier for the contents of this registry.
+ */
+ int PROP_CONTENTS = 0x01;
- /**
- * The identifier for the system external editor descriptor. This descriptor
- * is always present in the registry on all platforms.
- * This editor requires an input which implements
- * {@link org.eclipse.ui.IPathEditorInput IPathEditorInput}.
- * Use {@link #findEditor findEditor} to access the editor descriptor for
- * this identifier.
- *
- * @since 3.0
- */
- String SYSTEM_EXTERNAL_EDITOR_ID = "org.eclipse.ui.systemExternalEditor"; //$NON-NLS-1$
+ /**
+ * The identifier for the system external editor descriptor. This descriptor is
+ * always present in the registry on all platforms. This editor requires an
+ * input which implements {@link org.eclipse.ui.IPathEditorInput
+ * IPathEditorInput}. Use {@link #findEditor findEditor} to access the editor
+ * descriptor for this identifier.
+ *
+ * @since 3.0
+ */
+ String SYSTEM_EXTERNAL_EDITOR_ID = "org.eclipse.ui.systemExternalEditor"; //$NON-NLS-1$
- /**
- * The identifier for the system in-place editor descriptor. This descriptor
- * is only present in the registry on platforms that support in-place editing
- * (for example Win32). This editor requires an input which implements
- * {@link org.eclipse.ui.IInPlaceEditorInput IInPlaceEditorInput}. Use
- * {@link #findEditor findEditor} to access the editor descriptor for this
- * identifier.
- *
- * @since 3.0
- */
- String SYSTEM_INPLACE_EDITOR_ID = "org.eclipse.ui.systemInPlaceEditor"; //$NON-NLS-1$
+ /**
+ * The identifier for the system in-place editor descriptor. This descriptor is
+ * only present in the registry on platforms that support in-place editing (for
+ * example Win32). This editor requires an input which implements
+ * {@link org.eclipse.ui.IInPlaceEditorInput IInPlaceEditorInput}. Use
+ * {@link #findEditor findEditor} to access the editor descriptor for this
+ * identifier.
+ *
+ * @since 3.0
+ */
+ String SYSTEM_INPLACE_EDITOR_ID = "org.eclipse.ui.systemInPlaceEditor"; //$NON-NLS-1$
- /**
+ /**
* Adds a listener for changes to properties of this registry. Has no effect if
* an identical listener is already registered.
* <p>
@@ -83,189 +82,183 @@ public interface IEditorRegistry {
*
* @param listener a property listener
*/
- void addPropertyListener(IPropertyListener listener);
+ void addPropertyListener(IPropertyListener listener);
- /**
- * Finds and returns the descriptor of the editor with the given editor id.
- *
- * @param editorId the editor id
- * @return the editor descriptor with the given id, or <code>null</code> if not
- * found
- */
- IEditorDescriptor findEditor(String editorId);
+ /**
+ * Finds and returns the descriptor of the editor with the given editor id.
+ *
+ * @param editorId the editor id
+ * @return the editor descriptor with the given id, or <code>null</code> if not
+ * found
+ */
+ IEditorDescriptor findEditor(String editorId);
- /**
- * Returns the default editor. The default editor always exist.
- *
- * @return the descriptor of the default editor
- * @deprecated The system external editor is the default editor.
- * Use <code>findEditor(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID)</code>
- * instead.
- */
- @Deprecated IEditorDescriptor getDefaultEditor();
+ /**
+ * Returns the default editor. The default editor always exist.
+ *
+ * @return the descriptor of the default editor
+ * @deprecated The system external editor is the default editor. Use
+ * <code>findEditor(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID)</code>
+ * instead.
+ */
+ @Deprecated
+ IEditorDescriptor getDefaultEditor();
- /**
+ /**
* Returns the default editor for a given file name. This method assumes an
* unknown content type for the given file.
* <p>
- * The default editor is determined by taking the file extension for the
- * file and obtaining the default editor for that extension.
+ * The default editor is determined by taking the file extension for the file
+ * and obtaining the default editor for that extension.
* </p>
*
- * @param fileName
- * the file name in the system
- * @return the descriptor of the default editor, or <code>null</code> if
- * not found
+ * @param fileName the file name in the system
+ * @return the descriptor of the default editor, or <code>null</code> if not
+ * found
*/
- IEditorDescriptor getDefaultEditor(String fileName);
+ IEditorDescriptor getDefaultEditor(String fileName);
- /**
- * Returns the default editor for a given file name and with the given content type.
- * <p>
- * The default editor is determined by taking the file extension for the
- * file and obtaining the default editor for that extension.
- * </p>
- *
- * @param fileName the file name in the system
- * @param contentType the content type or <code>null</code> for the unknown content type
- * @return the descriptor of the default editor, or <code>null</code> if not
- * found
- * @since 3.1
- */
- IEditorDescriptor getDefaultEditor(String fileName, IContentType contentType);
+ /**
+ * Returns the default editor for a given file name and with the given content
+ * type.
+ * <p>
+ * The default editor is determined by taking the file extension for the file
+ * and obtaining the default editor for that extension.
+ * </p>
+ *
+ * @param fileName the file name in the system
+ * @param contentType the content type or <code>null</code> for the unknown
+ * content type
+ * @return the descriptor of the default editor, or <code>null</code> if not
+ * found
+ * @since 3.1
+ */
+ IEditorDescriptor getDefaultEditor(String fileName, IContentType contentType);
- /**
- * Returns the list of file editors registered to work against the file with
- * the given file name. This method assumes an unknown content type for the
- * given file.
+ /**
+ * Returns the list of file editors registered to work against the file with the
+ * given file name. This method assumes an unknown content type for the given
+ * file.
* <p>
- * Note: Use <code>getDefaultEditor(String)</code> if you only the need
- * the default editor rather than all candidate editors.
+ * Note: Use <code>getDefaultEditor(String)</code> if you only the need the
+ * default editor rather than all candidate editors.
* </p>
*
- * @param fileName
- * the file name in the system
+ * @param fileName the file name in the system
* @return a list of editor descriptors
*/
- IEditorDescriptor[] getEditors(String fileName);
+ IEditorDescriptor[] getEditors(String fileName);
- /**
- * Returns the list of file editors registered to work against the file with
- * the given file name and with the given content type.
+ /**
+ * Returns the list of file editors registered to work against the file with the
+ * given file name and with the given content type.
* <p>
- * Note: Use <code>getDefaultEditor(String)</code> if you only the need
- * the default editor rather than all candidate editors.
+ * Note: Use <code>getDefaultEditor(String)</code> if you only the need the
+ * default editor rather than all candidate editors.
* </p>
*
- * @param fileName
- * the file name in the system
- * @param contentType
- * the content type or <code>null</code> for the unknown
- * content type
+ * @param fileName the file name in the system
+ * @param contentType the content type or <code>null</code> for the unknown
+ * content type
* @return a list of editor descriptors
* @since 3.1
*/
- IEditorDescriptor[] getEditors(String fileName, IContentType contentType);
+ IEditorDescriptor[] getEditors(String fileName, IContentType contentType);
- /**
- * Returns a list of mappings from file type to editor. The resulting list
- * is sorted in ascending order by file extension.
- * <p>
- * Each mapping defines an extension and the set of editors that are
- * available for that type. The set of editors includes those registered
- * via plug-ins and those explicitly associated with a type by the user
- * in the workbench preference pages.
- * </p>
- *
- * @return a list of mappings sorted alphabetically by extension
- */
- IFileEditorMapping[] getFileEditorMappings();
+ /**
+ * Returns a list of mappings from file type to editor. The resulting list is
+ * sorted in ascending order by file extension.
+ * <p>
+ * Each mapping defines an extension and the set of editors that are available
+ * for that type. The set of editors includes those registered via plug-ins and
+ * those explicitly associated with a type by the user in the workbench
+ * preference pages.
+ * </p>
+ *
+ * @return a list of mappings sorted alphabetically by extension
+ */
+ IFileEditorMapping[] getFileEditorMappings();
- /**
+ /**
* Returns the image descriptor associated with a given file. This image is
* usually displayed next to the given file. This method assumes an unknown
* content type for the given file.
* <p>
* The image is determined by taking the file extension of the file and
- * obtaining the image for the default editor associated with that
- * extension. A default image is returned if no default editor is available.
+ * obtaining the image for the default editor associated with that extension. A
+ * default image is returned if no default editor is available.
* </p>
*
- * @param filename
- * the file name in the system
+ * @param filename the file name in the system
* @return the descriptor of the image to display next to the file
*/
- ImageDescriptor getImageDescriptor(String filename);
+ ImageDescriptor getImageDescriptor(String filename);
- /**
+ /**
* Returns the image descriptor associated with a given file. This image is
* usually displayed next to the given file.
* <p>
* The image is determined by taking the file extension of the file and
- * obtaining the image for the default editor associated with that
- * extension. A default image is returned if no default editor is available.
+ * obtaining the image for the default editor associated with that extension. A
+ * default image is returned if no default editor is available.
* </p>
*
- * @param filename
- * the file name in the system
- * @param contentType
- * the content type of the file or <code>null</code> for the
- * unknown content type
+ * @param filename the file name in the system
+ * @param contentType the content type of the file or <code>null</code> for the
+ * unknown content type
* @return the descriptor of the image to display next to the file
* @since 3.1
*/
- ImageDescriptor getImageDescriptor(String filename, IContentType contentType);
+ ImageDescriptor getImageDescriptor(String filename, IContentType contentType);
- /**
- * Removes the given property listener from this registry. Has no effect if
- * an identical listener is not registered.
+ /**
+ * Removes the given property listener from this registry. Has no effect if an
+ * identical listener is not registered.
*
- * @param listener
- * a property listener
+ * @param listener a property listener
*/
- void removePropertyListener(IPropertyListener listener);
+ void removePropertyListener(IPropertyListener listener);
- /**
- * Sets the default editor id for the files that match that
- * specified file name or extension. The specified editor must be
- * defined as an editor for that file name or extension.
- *
- * @param fileNameOrExtension the file name or extension pattern (e.g. "*.xml");
- * @param editorId the editor id or <code>null</code> for no default
- */
- void setDefaultEditor(String fileNameOrExtension, String editorId);
+ /**
+ * Sets the default editor id for the files that match that specified file name
+ * or extension. The specified editor must be defined as an editor for that file
+ * name or extension.
+ *
+ * @param fileNameOrExtension the file name or extension pattern (e.g. "*.xml");
+ * @param editorId the editor id or <code>null</code> for no default
+ */
+ void setDefaultEditor(String fileNameOrExtension, String editorId);
- /**
- * Returns whether there is an in-place editor that could handle a file
- * with the given name.
- *
- * @param filename the file name
- * @return <code>true</code> if an in-place editor is available, and
- * <code>false</code> otherwise
- * @since 3.0
- */
- boolean isSystemInPlaceEditorAvailable(String filename);
+ /**
+ * Returns whether there is an in-place editor that could handle a file with the
+ * given name.
+ *
+ * @param filename the file name
+ * @return <code>true</code> if an in-place editor is available, and
+ * <code>false</code> otherwise
+ * @since 3.0
+ */
+ boolean isSystemInPlaceEditorAvailable(String filename);
- /**
- * Returns whether the system has an editor that could handle a file
- * with the given name.
- *
- * @param filename the file name
- * @return <code>true</code> if an external editor available, and
- * <code>false</code> otherwise
- * @since 3.0
- */
- boolean isSystemExternalEditorAvailable(String filename);
+ /**
+ * Returns whether the system has an editor that could handle a file with the
+ * given name.
+ *
+ * @param filename the file name
+ * @return <code>true</code> if an external editor available, and
+ * <code>false</code> otherwise
+ * @since 3.0
+ */
+ boolean isSystemExternalEditorAvailable(String filename);
- /**
- * Returns the image descriptor associated with the system editor that
- * would be used to edit this file externally.
- *
- * @param filename the file name
- * @return the descriptor of the external editor image, or <code>null</code>
- * if none
- * @since 3.0
- */
- ImageDescriptor getSystemExternalEditorImageDescriptor(
- String filename);
+ /**
+ * Returns the image descriptor associated with the system editor that would be
+ * used to edit this file externally.
+ *
+ * @param filename the file name
+ * @return the descriptor of the external editor image, or <code>null</code> if
+ * none
+ * @since 3.0
+ */
+ ImageDescriptor getSystemExternalEditorImageDescriptor(String filename);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorSite.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorSite.java
index 20ba8810046..8a6495daf6e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorSite.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorSite.java
@@ -22,97 +22,89 @@ import org.eclipse.jface.viewers.ISelectionProvider;
* The workbench exposes its implemention of editor part sites via this
* interface, which is not intended to be implemented or extended by clients.
* </p>
+ *
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IEditorSite extends IWorkbenchPartSite {
- /**
- * Returns the action bar contributor for this editor.
- * <p>
- * An action contributor is responsable for the creation of actions.
- * By design, this contributor is used for one or more editors of the same type.
- * Thus, the contributor returned by this method is not owned completely
- * by the editor - it is shared.
- * </p>
- *
- * @return the editor action bar contributor, or <code>null</code> if none exists
- */
- IEditorActionBarContributor getActionBarContributor();
+ /**
+ * Returns the action bar contributor for this editor.
+ * <p>
+ * An action contributor is responsable for the creation of actions. By design,
+ * this contributor is used for one or more editors of the same type. Thus, the
+ * contributor returned by this method is not owned completely by the editor -
+ * it is shared.
+ * </p>
+ *
+ * @return the editor action bar contributor, or <code>null</code> if none
+ * exists
+ */
+ IEditorActionBarContributor getActionBarContributor();
- /**
- * Returns the action bars for this part site. Editors of the same type (and
- * in the same window) share the same action bars. Contributions to the
- * action bars are done by the <code>IEditorActionBarContributor</code>.
+ /**
+ * Returns the action bars for this part site. Editors of the same type (and in
+ * the same window) share the same action bars. Contributions to the action bars
+ * are done by the <code>IEditorActionBarContributor</code>.
*
* @return the action bars
* @since 2.1
*/
- IActionBars getActionBars();
+ IActionBars getActionBars();
- /**
- * <p>
- * Registers a pop-up menu with the default id for extension. The default id
- * is defined as the part id.
- * </p>
- * <p>
- * By default, context menus include object contributions based on the
- * editor input for the current editor. It is possible to override this
- * behaviour by calling this method with <code>includeEditorInput</code>
- * as <code>false</code>. This might be desirable for editors that
- * present a localized view of an editor input (e.g., a node in a model
- * editor).
- * </p>
- * <p>
- * For a detailed description of context menu registration see
- * {@link IWorkbenchPartSite#registerContextMenu(MenuManager, ISelectionProvider)}
- * </p>
- *
- * @param menuManager
- * the menu manager; must not be <code>null</code>.
- * @param selectionProvider
- * the selection provider; must not be <code>null</code>.
- * @param includeEditorInput
- * Whether the editor input should be included when adding object
- * contributions to this context menu.
- * @see IWorkbenchPartSite#registerContextMenu(MenuManager,
- * ISelectionProvider)
- * @since 3.1
- */
- void registerContextMenu(MenuManager menuManager,
- ISelectionProvider selectionProvider, boolean includeEditorInput);
+ /**
+ * <p>
+ * Registers a pop-up menu with the default id for extension. The default id is
+ * defined as the part id.
+ * </p>
+ * <p>
+ * By default, context menus include object contributions based on the editor
+ * input for the current editor. It is possible to override this behaviour by
+ * calling this method with <code>includeEditorInput</code> as
+ * <code>false</code>. This might be desirable for editors that present a
+ * localized view of an editor input (e.g., a node in a model editor).
+ * </p>
+ * <p>
+ * For a detailed description of context menu registration see
+ * {@link IWorkbenchPartSite#registerContextMenu(MenuManager, ISelectionProvider)}
+ * </p>
+ *
+ * @param menuManager the menu manager; must not be <code>null</code>.
+ * @param selectionProvider the selection provider; must not be
+ * <code>null</code>.
+ * @param includeEditorInput Whether the editor input should be included when
+ * adding object contributions to this context menu.
+ * @see IWorkbenchPartSite#registerContextMenu(MenuManager, ISelectionProvider)
+ * @since 3.1
+ */
+ void registerContextMenu(MenuManager menuManager, ISelectionProvider selectionProvider, boolean includeEditorInput);
- /**
- * <p>
- * Registers a pop-up menu with a particular id for extension. This method
- * should only be called if the target part has more than one context menu
- * to register.
- * </p>
- * <p>
- * By default, context menus include object contributions based on the
- * editor input for the current editor. It is possible to override this
- * behaviour by calling this method with <code>includeEditorInput</code>
- * as <code>false</code>. This might be desirable for editors that
- * present a localized view of an editor input (e.g., a node in a model
- * editor).
- * </p>
- * <p>
- * For a detailed description of context menu registration see
- * {@link IWorkbenchPartSite#registerContextMenu(MenuManager, ISelectionProvider)}
- * </p>
- *
- * @param menuId
- * the menu id; must not be <code>null</code>.
- * @param menuManager
- * the menu manager; must not be <code>null</code>.
- * @param selectionProvider
- * the selection provider; must not be <code>null</code>.
- * @param includeEditorInput
- * Whether the editor input should be included when adding object
- * contributions to this context menu.
- * @see IWorkbenchPartSite#registerContextMenu(MenuManager,
- * ISelectionProvider)
- * @since 3.1
- */
- void registerContextMenu(String menuId, MenuManager menuManager,
- ISelectionProvider selectionProvider, boolean includeEditorInput);
+ /**
+ * <p>
+ * Registers a pop-up menu with a particular id for extension. This method
+ * should only be called if the target part has more than one context menu to
+ * register.
+ * </p>
+ * <p>
+ * By default, context menus include object contributions based on the editor
+ * input for the current editor. It is possible to override this behaviour by
+ * calling this method with <code>includeEditorInput</code> as
+ * <code>false</code>. This might be desirable for editors that present a
+ * localized view of an editor input (e.g., a node in a model editor).
+ * </p>
+ * <p>
+ * For a detailed description of context menu registration see
+ * {@link IWorkbenchPartSite#registerContextMenu(MenuManager, ISelectionProvider)}
+ * </p>
+ *
+ * @param menuId the menu id; must not be <code>null</code>.
+ * @param menuManager the menu manager; must not be <code>null</code>.
+ * @param selectionProvider the selection provider; must not be
+ * <code>null</code>.
+ * @param includeEditorInput Whether the editor input should be included when
+ * adding object contributions to this context menu.
+ * @see IWorkbenchPartSite#registerContextMenu(MenuManager, ISelectionProvider)
+ * @since 3.1
+ */
+ void registerContextMenu(String menuId, MenuManager menuManager, ISelectionProvider selectionProvider,
+ boolean includeEditorInput);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IElementFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IElementFactory.java
index 09f7cc0ff0d..fa9c7ce0910 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IElementFactory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IElementFactory.java
@@ -35,7 +35,7 @@ import org.eclipse.core.runtime.IAdaptable;
* @see org.eclipse.ui.IWorkbench#getElementFactory
*/
public interface IElementFactory {
- /**
+ /**
* Re-creates and returns an object from the state captured within the given
* memento.
* <p>
@@ -52,5 +52,5 @@ public interface IElementFactory {
* @param memento a memento containing the state for the object
* @return an object, or <code>null</code> if the element could not be created
*/
- IAdaptable createElement(IMemento memento);
+ IAdaptable createElement(IMemento memento);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IFileEditorMapping.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IFileEditorMapping.java
index 8fdb870a019..458925f6f02 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IFileEditorMapping.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IFileEditorMapping.java
@@ -20,10 +20,10 @@ import org.eclipse.jface.resource.ImageDescriptor;
* An association between a file name/extension and a list of known editors for
* files of that type.
* <p>
- * The name and extension can never empty or null. The name may contain
- * the single wild card character (*) to indicate the editor applies to
- * all files with the same extension (e.g. *.doc). The name can never
- * embed the wild card character within itself (i.e. rep*)
+ * The name and extension can never empty or null. The name may contain the
+ * single wild card character (*) to indicate the editor applies to all files
+ * with the same extension (e.g. *.doc). The name can never embed the wild card
+ * character within itself (i.e. rep*)
* </p>
* <p>
* This interface is not intended to be implemented by clients.
@@ -33,60 +33,60 @@ import org.eclipse.jface.resource.ImageDescriptor;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IFileEditorMapping {
- /**
- * Returns the default editor registered for this type mapping.
- *
- * @return the descriptor of the default editor, or <code>null</code> if there
- * is no default editor registered. Will also return <code>null</code> if
- * the default editor exists but fails the Expressions check.
- */
- IEditorDescriptor getDefaultEditor();
+ /**
+ * Returns the default editor registered for this type mapping.
+ *
+ * @return the descriptor of the default editor, or <code>null</code> if there
+ * is no default editor registered. Will also return <code>null</code>
+ * if the default editor exists but fails the Expressions check.
+ */
+ IEditorDescriptor getDefaultEditor();
- /**
- * Returns the list of editors registered for this type mapping.
- *
- * @return a possibly empty list of editors.
- */
- IEditorDescriptor[] getEditors();
+ /**
+ * Returns the list of editors registered for this type mapping.
+ *
+ * @return a possibly empty list of editors.
+ */
+ IEditorDescriptor[] getEditors();
- /**
- * Returns the list of editors formerly registered for this type mapping
- * which have since been deleted.
- *
- * @return a possibly empty list of editors
- */
- IEditorDescriptor[] getDeletedEditors();
+ /**
+ * Returns the list of editors formerly registered for this type mapping which
+ * have since been deleted.
+ *
+ * @return a possibly empty list of editors
+ */
+ IEditorDescriptor[] getDeletedEditors();
- /**
- * Returns the file's extension for this type mapping.
- *
- * @return the extension for this mapping
- */
- String getExtension();
+ /**
+ * Returns the file's extension for this type mapping.
+ *
+ * @return the extension for this mapping
+ */
+ String getExtension();
- /**
- * Returns the descriptor of the image to use for a file of this type.
- * <p>
- * The image is obtained from the default editor. A default file image is
- * returned if no default editor is available.
- * </p>
- *
- * @return the descriptor of the image to use for a resource of this type
- */
- ImageDescriptor getImageDescriptor();
+ /**
+ * Returns the descriptor of the image to use for a file of this type.
+ * <p>
+ * The image is obtained from the default editor. A default file image is
+ * returned if no default editor is available.
+ * </p>
+ *
+ * @return the descriptor of the image to use for a resource of this type
+ */
+ ImageDescriptor getImageDescriptor();
- /**
+ /**
* Returns the label to use for this mapping. Labels have the form
* "<i>name.extension</i>".
*
* @return the label to use for this mapping
*/
- String getLabel();
+ String getLabel();
- /**
- * Returns the file's name for this type mapping.
- *
- * @return the name for this mapping
- */
- String getName();
+ /**
+ * Returns the file's name for this type mapping.
+ *
+ * @return the name for this mapping
+ */
+ String getName();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IFolderLayout.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IFolderLayout.java
index 2d701347975..4ca1742bdb0 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IFolderLayout.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IFolderLayout.java
@@ -14,8 +14,8 @@
package org.eclipse.ui;
/**
- * An <code>IFolderLayout</code> is used to define the initial views within a folder.
- * The folder itself is contained within an <code>IPageLayout</code>.
+ * An <code>IFolderLayout</code> is used to define the initial views within a
+ * folder. The folder itself is contained within an <code>IPageLayout</code>.
* <p>
* This interface is not intended to be implemented by clients.
* </p>
@@ -24,13 +24,13 @@ package org.eclipse.ui;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IFolderLayout extends IPlaceholderFolderLayout {
- /**
- * Adds a view with the given compound id to this folder.
- * See the {@link IPageLayout} type documentation for more details about compound ids.
- * The primary id must name a view contributed to the workbench's view extension point
- * (named <code>"org.eclipse.ui.views"</code>).
- *
- * @param viewId the view id
- */
- void addView(String viewId);
+ /**
+ * Adds a view with the given compound id to this folder. See the
+ * {@link IPageLayout} type documentation for more details about compound ids.
+ * The primary id must name a view contributed to the workbench's view extension
+ * point (named <code>"org.eclipse.ui.views"</code>).
+ *
+ * @param viewId the view id
+ */
+ void addView(String viewId);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IInPlaceEditor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IInPlaceEditor.java
index 6e7dd210198..2c0b156f09c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IInPlaceEditor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IInPlaceEditor.java
@@ -24,17 +24,17 @@ package org.eclipse.ui;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IInPlaceEditor extends IEditorPart {
- /**
- * Informs the in-place editor that the system file it is
- * editing was deleted by the application.
- */
- void sourceDeleted();
+ /**
+ * Informs the in-place editor that the system file it is editing was deleted by
+ * the application.
+ */
+ void sourceDeleted();
- /**
- * Informs the in-place editor that the system file it is
- * editing was moved or renamed by the application.
- *
- * @param input the new in-place editor input to use
- */
- void sourceChanged(IInPlaceEditorInput input);
+ /**
+ * Informs the in-place editor that the system file it is editing was moved or
+ * renamed by the application.
+ *
+ * @param input the new in-place editor input to use
+ */
+ void sourceChanged(IInPlaceEditorInput input);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IInPlaceEditorInput.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IInPlaceEditorInput.java
index 3704eb8aaba..31f61128d2c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IInPlaceEditorInput.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IInPlaceEditorInput.java
@@ -17,13 +17,15 @@ package org.eclipse.ui;
* This interface defines an editor input for in-place editors.
* <p>
* Clients implementing this editor input interface should override
- * <code>Object.equals(Object)</code> to answer true for two inputs
- * that are the same. The <code>IWorkbenchPage.openEditor</code> APIs
- * are dependent on this to find an editor with the same input.
- * </p><p>
- * Path-oriented editors should support this as a valid input type, and
- * can allow full read-write editing of its content.
- * </p><p>
+ * <code>Object.equals(Object)</code> to answer true for two inputs that are the
+ * same. The <code>IWorkbenchPage.openEditor</code> APIs are dependent on this
+ * to find an editor with the same input.
+ * </p>
+ * <p>
+ * Path-oriented editors should support this as a valid input type, and can
+ * allow full read-write editing of its content.
+ * </p>
+ * <p>
* All editor inputs must implement the <code>IAdaptable</code> interface;
* extensions are managed by the platform's adapter manager.
* </p>
@@ -32,11 +34,11 @@ package org.eclipse.ui;
* @since 3.0
*/
public interface IInPlaceEditorInput extends IPathEditorInput {
- /**
- * Sets the in-place editor this input is associated with.
- *
- * @param editor the in-place editor associated with this input
- * or <code>null</code> to disassociate.
- */
- void setInPlaceEditor(IInPlaceEditor editor);
+ /**
+ * Sets the in-place editor this input is associated with.
+ *
+ * @param editor the in-place editor associated with this input or
+ * <code>null</code> to disassociate.
+ */
+ void setInPlaceEditor(IInPlaceEditor editor);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IKeyBindingService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IKeyBindingService.java
index 6a134591bee..bb47d9ea5d8 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IKeyBindingService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IKeyBindingService.java
@@ -19,8 +19,8 @@ import org.eclipse.jface.action.IAction;
/**
* The key binding service allows one to query or set the scope of Eclipse for
* the purposes of resolving key assignments to commands, and to register
- * actions to handle specific commands. See the <code>org.eclipse.ui.commands</code>
- * extension point for details.
+ * actions to handle specific commands. See the
+ * <code>org.eclipse.ui.commands</code> extension point for details.
* <p>
* A participating workbench part is responsible to register all its actions
* with this service. The part is also responsible to set the current scope.
@@ -30,42 +30,39 @@ import org.eclipse.jface.action.IAction;
* </p>
*
* @since 2.0
- * @deprecated See IContextService to manage <b>scopes</b> and
- * IHandlerService to manage handlers. IAction can
- * be proxied by org.eclipse.jface.commands.ActionHandler.
+ * @deprecated See IContextService to manage <b>scopes</b> and IHandlerService
+ * to manage handlers. IAction can be proxied by
+ * org.eclipse.jface.commands.ActionHandler.
* @noimplement This interface is not intended to be implemented by clients.
*/
@Deprecated
public interface IKeyBindingService {
- /**
- * Returns the active accelerator scope ids.
- *
- * @return the active accelerator scope ids.
- */
- String[] getScopes();
+ /**
+ * Returns the active accelerator scope ids.
+ *
+ * @return the active accelerator scope ids.
+ */
+ String[] getScopes();
- /**
- * Registers an action with the key binding service.
- *
- * @param action
- * the action to be registered with the key binding service.
- */
- void registerAction(IAction action);
+ /**
+ * Registers an action with the key binding service.
+ *
+ * @param action the action to be registered with the key binding service.
+ */
+ void registerAction(IAction action);
- /**
- * Sets the active accelerator scope ids.
- *
- * @param scopes
- * the active accelerator scope ids.
- */
- void setScopes(String[] scopes);
+ /**
+ * Sets the active accelerator scope ids.
+ *
+ * @param scopes the active accelerator scope ids.
+ */
+ void setScopes(String[] scopes);
- /**
- * Unregisters an action with the key binding service.
- *
- * @param action
- * the action to be unregistered with the key binding service.
- */
- void unregisterAction(IAction action);
+ /**
+ * Unregisters an action with the key binding service.
+ *
+ * @param action the action to be unregistered with the key binding service.
+ */
+ void unregisterAction(IAction action);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ILocalWorkingSetManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ILocalWorkingSetManager.java
index be5b093a542..860d89e27e7 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ILocalWorkingSetManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ILocalWorkingSetManager.java
@@ -14,15 +14,15 @@
package org.eclipse.ui;
/**
- * A local working set manager can be used to manage a set of
- * working sets independently from the working sets managed by
- * the global working set manager. A local working set manager
- * can be saved and restored using the methods <code>saveState</code>
- * and <code>restoreState</code>. A new local working set manager can be created
- * using {@link org.eclipse.ui.IWorkbench#createLocalWorkingSetManager()}.
- * Clients of local working set managers are responsible for calling
- * {@link IWorkingSetManager#dispose()} when the working sets it manages
- * are no longer needed.
+ * A local working set manager can be used to manage a set of working sets
+ * independently from the working sets managed by the global working set
+ * manager. A local working set manager can be saved and restored using the
+ * methods <code>saveState</code> and <code>restoreState</code>. A new local
+ * working set manager can be created using
+ * {@link org.eclipse.ui.IWorkbench#createLocalWorkingSetManager()}. Clients of
+ * local working set managers are responsible for calling
+ * {@link IWorkingSetManager#dispose()} when the working sets it manages are no
+ * longer needed.
* <p>
* This interface is not intended to be implemented or extended by clients.
* </p>
@@ -34,17 +34,15 @@ package org.eclipse.ui;
public interface ILocalWorkingSetManager extends IWorkingSetManager {
/**
- * Saves the state of the working set manager to the given
- * memento.
+ * Saves the state of the working set manager to the given memento.
*
* @param memento the memento to save the state to
*/
void saveState(IMemento memento);
/**
- * Restores the state of the working set manager from the given
- * memento. The method can only be called as long as the working
- * set manager is still empty.
+ * Restores the state of the working set manager from the given memento. The
+ * method can only be called as long as the working set manager is still empty.
*
* @param memento the memento to restore the state from
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IMemento.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IMemento.java
index 852b7a823e1..07b86717d88 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IMemento.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IMemento.java
@@ -55,85 +55,82 @@ import org.w3c.dom.DOMException;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IMemento {
- /**
- * Special reserved key used to store the memento id
- * (value <code>"IMemento.internal.id"</code>).
- *
- * @see #getID()
- */
- String TAG_ID = "IMemento.internal.id"; //$NON-NLS-1$
-
- /**
- * Creates a new child of this memento with the given type.
- * <p>
- * The <code>getChild</code> and <code>getChildren</code> methods
- * are used to retrieve children of a given type.
- * </p>
- *
- * @param type the type
- * @return a new child memento
- * @see #getChild
- * @see #getChildren
- */
- IMemento createChild(String type);
-
- /**
- * Creates a new child of this memento with the given type and id.
- * The id is stored in the child memento (using a special reserved
- * key, <code>TAG_ID</code>) and can be retrieved using <code>getId</code>.
- * <p>
- * The <code>getChild</code> and <code>getChildren</code> methods
- * are used to retrieve children of a given type.
- * </p>
- *
- * @param type the type
- * @param id the child id
- * @return a new child memento with the given type and id
- * @see #getID
- */
- IMemento createChild(String type, String id);
-
- /**
+ /**
+ * Special reserved key used to store the memento id (value
+ * <code>"IMemento.internal.id"</code>).
+ *
+ * @see #getID()
+ */
+ String TAG_ID = "IMemento.internal.id"; //$NON-NLS-1$
+
+ /**
+ * Creates a new child of this memento with the given type.
+ * <p>
+ * The <code>getChild</code> and <code>getChildren</code> methods are used to
+ * retrieve children of a given type.
+ * </p>
+ *
+ * @param type the type
+ * @return a new child memento
+ * @see #getChild
+ * @see #getChildren
+ */
+ IMemento createChild(String type);
+
+ /**
+ * Creates a new child of this memento with the given type and id. The id is
+ * stored in the child memento (using a special reserved key,
+ * <code>TAG_ID</code>) and can be retrieved using <code>getId</code>.
+ * <p>
+ * The <code>getChild</code> and <code>getChildren</code> methods are used to
+ * retrieve children of a given type.
+ * </p>
+ *
+ * @param type the type
+ * @param id the child id
+ * @return a new child memento with the given type and id
+ * @see #getID
+ */
+ IMemento createChild(String type, String id);
+
+ /**
* Returns the first child with the given type id.
*
- * @param type
- * the type id
- * @return the first child with the given type. May return <code>null</code>
- * .
+ * @param type the type id
+ * @return the first child with the given type. May return <code>null</code> .
*/
- IMemento getChild(String type);
+ IMemento getChild(String type);
/**
* Returns all children of this node.
*
* @return an array of children of this node. This will not be
- * <code>null</code>. If there are no children, an array of length
- * zero will be returned.
+ * <code>null</code>. If there are no children, an array of length zero
+ * will be returned.
* @since 3.8
*/
IMemento[] getChildren();
- /**
+ /**
* Returns all children with the given type id.
*
- * @param type
- * the type id
+ * @param type the type id
* @return an array of children with the given type. This will not be
- * <code>null</code>. If there are no keys, an array of length zero
- * will be returned.
+ * <code>null</code>. If there are no keys, an array of length zero will
+ * be returned.
*/
- IMemento[] getChildren(String type);
+ IMemento[] getChildren(String type);
- /**
- * Returns the floating point value of the given key.
- *
- * @param key the key
- * @return the value, or <code>null</code> if the key was not found or was found
- * but was not a floating point number
- */
- Float getFloat(String key);
+ /**
+ * Returns the floating point value of the given key.
+ *
+ * @param key the key
+ * @return the value, or <code>null</code> if the key was not found or was found
+ * but was not a floating point number
+ */
+ Float getFloat(String key);
- /**
+ /**
* Returns the type for this memento.
*
* @return the memento type
@@ -143,107 +140,107 @@ public interface IMemento {
*/
String getType();
- /**
- * Returns the id for this memento.
- *
- * @return the memento id, or <code>null</code> if none
- * @see #createChild(java.lang.String,java.lang.String)
- */
- String getID();
-
- /**
- * Returns the integer value of the given key.
- *
- * @param key the key
- * @return the value, or <code>null</code> if the key was not found or was found
- * but was not an integer
- */
- Integer getInteger(String key);
-
- /**
- * Returns the string value of the given key.
- *
- * @param key the key
- * @return the value, or <code>null</code> if the key was not found
- */
- String getString(String key);
-
- /**
+ /**
+ * Returns the id for this memento.
+ *
+ * @return the memento id, or <code>null</code> if none
+ * @see #createChild(java.lang.String,java.lang.String)
+ */
+ String getID();
+
+ /**
+ * Returns the integer value of the given key.
+ *
+ * @param key the key
+ * @return the value, or <code>null</code> if the key was not found or was found
+ * but was not an integer
+ */
+ Integer getInteger(String key);
+
+ /**
+ * Returns the string value of the given key.
+ *
+ * @param key the key
+ * @return the value, or <code>null</code> if the key was not found
+ */
+ String getString(String key);
+
+ /**
* Returns the boolean value of the given key.
*
* @param key the key
* @return the value, or <code>null</code> if the key was not found
- * @since 3.4
+ * @since 3.4
*/
Boolean getBoolean(String key);
/**
- * Returns the data of the Text node of the memento. Each memento is allowed
- * only one Text node.
- *
- * @return the data of the Text node of the memento, or <code>null</code>
- * if the memento has no Text node.
- * @since 2.0
- */
- String getTextData();
-
- /**
- * Returns an array of all the attribute keys of the memento. This will not
- * be <code>null</code>. If there are no keys, an array of length zero will
- * be returned.
- * @return an array with all the attribute keys of the memento
- * @since 3.4
- */
+ * Returns the data of the Text node of the memento. Each memento is allowed
+ * only one Text node.
+ *
+ * @return the data of the Text node of the memento, or <code>null</code> if the
+ * memento has no Text node.
+ * @since 2.0
+ */
+ String getTextData();
+
+ /**
+ * Returns an array of all the attribute keys of the memento. This will not be
+ * <code>null</code>. If there are no keys, an array of length zero will be
+ * returned.
+ *
+ * @return an array with all the attribute keys of the memento
+ * @since 3.4
+ */
String[] getAttributeKeys();
- /**
- * Sets the value of the given key to the given floating point number.
- *
- * @param key the key
- * @param value the value
- */
- void putFloat(String key, float value);
-
- /**
- * Sets the value of the given key to the given integer.
- *
- * @param key the key
- * @param value the value
- */
- void putInteger(String key, int value);
-
- /**
- * Copy the attributes and children from <code>memento</code>
- * to the receiver.
- *
- * @param memento the IMemento to be copied.
- */
- void putMemento(IMemento memento);
-
- /**
- * Sets the value of the given key to the given string.
- *
- * @param key the key
- * @param value the value
- */
- void putString(String key, String value);
-
- /**
+ /**
+ * Sets the value of the given key to the given floating point number.
+ *
+ * @param key the key
+ * @param value the value
+ */
+ void putFloat(String key, float value);
+
+ /**
+ * Sets the value of the given key to the given integer.
+ *
+ * @param key the key
+ * @param value the value
+ */
+ void putInteger(String key, int value);
+
+ /**
+ * Copy the attributes and children from <code>memento</code> to the receiver.
+ *
+ * @param memento the IMemento to be copied.
+ */
+ void putMemento(IMemento memento);
+
+ /**
+ * Sets the value of the given key to the given string.
+ *
+ * @param key the key
+ * @param value the value
+ */
+ void putString(String key, String value);
+
+ /**
* Sets the value of the given key to the given boolean value.
*
- * @param key the key
+ * @param key the key
* @param value the value
- * @since 3.4
+ * @since 3.4
*/
void putBoolean(String key, boolean value);
- /**
- * Sets the memento's Text node to contain the given data. Creates the Text node if
- * none exists. If a Text node does exist, it's current contents are replaced.
- * Each memento is allowed only one text node.
- *
- * @param data the data to be placed on the Text node
- * @since 2.0
- */
- void putTextData(String data);
+ /**
+ * Sets the memento's Text node to contain the given data. Creates the Text node
+ * if none exists. If a Text node does exist, it's current contents are
+ * replaced. Each memento is allowed only one text node.
+ *
+ * @param data the data to be placed on the Text node
+ * @since 2.0
+ */
+ void putTextData(String data);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INavigationHistory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INavigationHistory.java
index 154ee06ee52..0a540e62e65 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INavigationHistory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INavigationHistory.java
@@ -14,22 +14,23 @@
package org.eclipse.ui;
/**
- * Manages a list of entries to keep a history of locations on editors,
- * enabling the user to go back and forward without losing context.
+ * Manages a list of entries to keep a history of locations on editors, enabling
+ * the user to go back and forward without losing context.
*
- * The history is a list of <code>INavigationLocation</code> and a pointer
- * to the current location. Whenever the back or forward action runs the
- * history restores the previous or next location.
+ * The history is a list of <code>INavigationLocation</code> and a pointer to
+ * the current location. Whenever the back or forward action runs the history
+ * restores the previous or next location.
*
* The back and/or forward actions should not change the content of the history
* in any way.
*
- * If the user steps N times in one direction (back or forward) and then N times to
- * the oposite direction, the editor and location should be exactly the same as before.
+ * If the user steps N times in one direction (back or forward) and then N times
+ * to the oposite direction, the editor and location should be exactly the same
+ * as before.
*
- * Clients must guarantee that the current location is
- * always in the history, which can be done either by marking
- * a new location or by updating the current location.
+ * Clients must guarantee that the current location is always in the history,
+ * which can be done either by marking a new location or by updating the current
+ * location.
*
* Not intended to be implemented by clients.
*
@@ -37,28 +38,28 @@ package org.eclipse.ui;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface INavigationHistory {
- /**
- * Mark the current location into the history. This message
- * should be sent by clients whenever significant changes
- * in location are detected.
- *
- * The location is obtained by calling <code>INavigationLocationProvider.createNavigationLocation</code>
- *
- * @param part the editor part
- */
- void markLocation(IEditorPart part);
+ /**
+ * Mark the current location into the history. This message should be sent by
+ * clients whenever significant changes in location are detected.
+ *
+ * The location is obtained by calling
+ * <code>INavigationLocationProvider.createNavigationLocation</code>
+ *
+ * @param part the editor part
+ */
+ void markLocation(IEditorPart part);
- /**
- * Returns the current location.
- *
- * @return the current location
- */
- INavigationLocation getCurrentLocation();
+ /**
+ * Returns the current location.
+ *
+ * @return the current location
+ */
+ INavigationLocation getCurrentLocation();
- /**
- * Returns all entries in the history.
- *
- * @return all entries in the history
- */
- INavigationLocation[] getLocations();
+ /**
+ * Returns all entries in the history.
+ *
+ * @return all entries in the history
+ */
+ INavigationLocation[] getLocations();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INavigationLocation.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INavigationLocation.java
index 6eab15ad2e5..3d2139500ea 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INavigationLocation.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INavigationLocation.java
@@ -16,88 +16,88 @@ package org.eclipse.ui;
/**
* Represents the context marked for the user in the navigation history.
*
- * Not intended to be implemented by clients. Clients should subclass NavigationLocation
- * instead.
+ * Not intended to be implemented by clients. Clients should subclass
+ * NavigationLocation instead.
*
* @since 2.1
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface INavigationLocation {
- /**
- * Disposes of this location and frees any allocated resource.
- */
- void dispose();
+ /**
+ * Disposes of this location and frees any allocated resource.
+ */
+ void dispose();
- /**
- * Release any state kept by this location. Any relevant state should be
- * saved by the previous call of saveState(IMemento). This object will
- * not be used until restoreState is called again.
- */
- void releaseState();
+ /**
+ * Release any state kept by this location. Any relevant state should be saved
+ * by the previous call of saveState(IMemento). This object will not be used
+ * until restoreState is called again.
+ */
+ void releaseState();
- /**
- * Persists the state of this location into the <code>memento</code>
- *
- * @param memento the storage were the state should be saved into.
- */
- void saveState(IMemento memento);
+ /**
+ * Persists the state of this location into the <code>memento</code>
+ *
+ * @param memento the storage were the state should be saved into.
+ */
+ void saveState(IMemento memento);
- /**
- * Restore the state of this location from the <code>memento</code>
- *
- * @param memento the storage were the state was saved into.
- */
- void restoreState(IMemento memento);
+ /**
+ * Restore the state of this location from the <code>memento</code>
+ *
+ * @param memento the storage were the state was saved into.
+ */
+ void restoreState(IMemento memento);
- /**
- * Restore the context saved by this location.
- */
- void restoreLocation();
+ /**
+ * Restore the context saved by this location.
+ */
+ void restoreLocation();
- /**
- * Merge the receiver into <code>currentLocation</code>. Return true if
- * the two locations could be merged otherwise return false.
- * <p>
- * This message is sent to all locations before being added to the history;
- * given the change to the new location to merge itself into the current
- * location minimizing the number of entries in the navigation history.
- * </p>
- *
- * @param currentLocation where the receiver should be merged into
- * @return boolean true if the merge was possible
- */
- boolean mergeInto(INavigationLocation currentLocation);
+ /**
+ * Merge the receiver into <code>currentLocation</code>. Return true if the two
+ * locations could be merged otherwise return false.
+ * <p>
+ * This message is sent to all locations before being added to the history;
+ * given the change to the new location to merge itself into the current
+ * location minimizing the number of entries in the navigation history.
+ * </p>
+ *
+ * @param currentLocation where the receiver should be merged into
+ * @return boolean true if the merge was possible
+ */
+ boolean mergeInto(INavigationLocation currentLocation);
- /**
- * Returns the input used for this location. Returns <code>null</code> if the
- * receiver's state has been released.
- *
- * @return the input for this location
- */
- Object getInput();
+ /**
+ * Returns the input used for this location. Returns <code>null</code> if the
+ * receiver's state has been released.
+ *
+ * @return the input for this location
+ */
+ Object getInput();
- /**
- * Returns the display name for this location. This name is used in the
- * navigation history list.
- *
- * @return the display name
- */
- String getText();
+ /**
+ * Returns the display name for this location. This name is used in the
+ * navigation history list.
+ *
+ * @return the display name
+ */
+ String getText();
- /**
- * Sets the location's input.
- * <p>
- * Should not be called by clients.
- * </p>
- *
- * @param input the editor input.
- */
- void setInput(Object input);
+ /**
+ * Sets the location's input.
+ * <p>
+ * Should not be called by clients.
+ * </p>
+ *
+ * @param input the editor input.
+ */
+ void setInput(Object input);
- /**
- * The message <code>update</code> is sent to the active location before
- * another location becomes active.
- */
- void update();
+ /**
+ * The message <code>update</code> is sent to the active location before another
+ * location becomes active.
+ */
+ void update();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INavigationLocationProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INavigationLocationProvider.java
index 91ed8bf9dce..96bbcccd7f7 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INavigationLocationProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INavigationLocationProvider.java
@@ -15,25 +15,25 @@
package org.eclipse.ui;
/**
- * Should be implemented by editors that wish to contribute to the
- * navigation history. The message <code>createNavigationLocation</code>
- * will be sent when a new location is marked in the history.
+ * Should be implemented by editors that wish to contribute to the navigation
+ * history. The message <code>createNavigationLocation</code> will be sent when
+ * a new location is marked in the history.
*
* @since 2.1
*/
public interface INavigationLocationProvider {
- /**
- * Creates an empty navigation location. The message <code>restoreState</code>
- * will be sent to the location to restore its state.
- *
- * @return INavigationLocation
- */
- INavigationLocation createEmptyNavigationLocation();
+ /**
+ * Creates an empty navigation location. The message <code>restoreState</code>
+ * will be sent to the location to restore its state.
+ *
+ * @return INavigationLocation
+ */
+ INavigationLocation createEmptyNavigationLocation();
- /**
- * Creates a navigation location describing the current state.
- *
- * @return INavigationLocation
- */
- INavigationLocation createNavigationLocation();
+ /**
+ * Creates a navigation location describing the current state.
+ *
+ * @return INavigationLocation
+ */
+ INavigationLocation createNavigationLocation();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INestableKeyBindingService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INestableKeyBindingService.java
index 186eea3ffab..5a36d67a78a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INestableKeyBindingService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INestableKeyBindingService.java
@@ -17,7 +17,7 @@ import org.eclipse.ui.services.IServiceLocator;
/**
* <p>
- * A service that is capable of nesting other services within itself. This
+ * A service that is capable of nesting other services within itself. This
* allows lower level components to query for a service provider in a
* hierarchical fashion, and for information to be resolved in a hierarchical
* manner
@@ -27,49 +27,49 @@ import org.eclipse.ui.services.IServiceLocator;
* </p>
*
* @since 2.1.3
- * @deprecated This is now handled by {@link IServiceLocator} which can
- * be nested.
+ * @deprecated This is now handled by {@link IServiceLocator} which can be
+ * nested.
* @noimplement This interface is not intended to be implemented by clients.
*/
@Deprecated
public interface INestableKeyBindingService extends IKeyBindingService {
- /**
- * Marks the service associated with <code>nestedSite</code> as active if
- * one exists. If there is no service associated, then nothing changes.
- * Calling this method with <code>null</code> forces deactivation of the
- * current service.
- *
- * @param nestedSite The site whose service should be activated;
- * <code>null</code> if the current service should be deactivated.
- * @return <code>true</code> if a service is activated (or deactivated, in
- * the case of a <code>null</code> parameter); <code>false</code> if
- * nothing changed.
- */
- boolean activateKeyBindingService(IWorkbenchSite nestedSite);
+ /**
+ * Marks the service associated with <code>nestedSite</code> as active if one
+ * exists. If there is no service associated, then nothing changes. Calling this
+ * method with <code>null</code> forces deactivation of the current service.
+ *
+ * @param nestedSite The site whose service should be activated;
+ * <code>null</code> if the current service should be
+ * deactivated.
+ * @return <code>true</code> if a service is activated (or deactivated, in the
+ * case of a <code>null</code> parameter); <code>false</code> if nothing
+ * changed.
+ */
+ boolean activateKeyBindingService(IWorkbenchSite nestedSite);
- /**
- * An accessor for the nested key binding service associated with a
- * particular site. If the key binding service does not exist for this
- * <code>nestedSite</code> already, then a new one should be constructed.
- *
- * @param nestedSite The site for which the service should be found;
- * should not be <code>null</code>.
- * @return The associated service, if any; or a new associated service, if
- * none existed previously.
- */
- IKeyBindingService getKeyBindingService(IWorkbenchSite nestedSite);
+ /**
+ * An accessor for the nested key binding service associated with a particular
+ * site. If the key binding service does not exist for this
+ * <code>nestedSite</code> already, then a new one should be constructed.
+ *
+ * @param nestedSite The site for which the service should be found; should not
+ * be <code>null</code>.
+ * @return The associated service, if any; or a new associated service, if none
+ * existed previously.
+ */
+ IKeyBindingService getKeyBindingService(IWorkbenchSite nestedSite);
- /**
- * Removes a nested key binding service from this key binding service. The
- * service to remove is determined by the <code>nestedSite</code> with
- * which it is associated.
- *
- * @param nestedSite The site from which to remove the nested service.
- * This site must not be <code>null</code>.
- * @return <code>true</code> if the service existed and could be removed;
- * <code>false</code> otherwise.
- */
- boolean removeKeyBindingService(IWorkbenchSite nestedSite);
+ /**
+ * Removes a nested key binding service from this key binding service. The
+ * service to remove is determined by the <code>nestedSite</code> with which it
+ * is associated.
+ *
+ * @param nestedSite The site from which to remove the nested service. This site
+ * must not be <code>null</code>.
+ * @return <code>true</code> if the service existed and could be removed;
+ * <code>false</code> otherwise.
+ */
+ boolean removeKeyBindingService(IWorkbenchSite nestedSite);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INullSelectionListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INullSelectionListener.java
index 7628d7fed1b..afd62c180dc 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INullSelectionListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INullSelectionListener.java
@@ -16,12 +16,11 @@ package org.eclipse.ui;
/**
* Interface for listening to <code>null</code> selection changes.
* <p>
- * This interface should be implemented by selection listeners
- * that want to be notified when the selection becomes <code>null</code>.
- * It has no methods. It simply indicates the desire to receive
- * <code>null</code> selection events through the existing
- * <code>selectionChanged</code> method. Either the part or the
- * selection may be <code>null</code>.
+ * This interface should be implemented by selection listeners that want to be
+ * notified when the selection becomes <code>null</code>. It has no methods. It
+ * simply indicates the desire to receive <code>null</code> selection events
+ * through the existing <code>selectionChanged</code> method. Either the part or
+ * the selection may be <code>null</code>.
* </p>
*
* @see ISelectionListener#selectionChanged
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IObjectActionDelegate.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IObjectActionDelegate.java
index 284d84d3273..ffd529ad236 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IObjectActionDelegate.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IObjectActionDelegate.java
@@ -16,26 +16,24 @@ package org.eclipse.ui;
import org.eclipse.jface.action.IAction;
/**
- * Interface for an object action that is contributed into a popup menu
- * for a view or editor. It extends <code>IActionDelegate</code>
- * and adds an initialization method for connecting the delegate to the
- * part it should work with.
+ * Interface for an object action that is contributed into a popup menu for a
+ * view or editor. It extends <code>IActionDelegate</code> and adds an
+ * initialization method for connecting the delegate to the part it should work
+ * with.
*/
public interface IObjectActionDelegate extends IActionDelegate {
- /**
- * Sets the active part for the delegate. The active part is commonly used
- * to get a working context for the action, such as the shell for any dialog
- * which is needed.
+ /**
+ * Sets the active part for the delegate. The active part is commonly used to
+ * get a working context for the action, such as the shell for any dialog which
+ * is needed.
* <p>
- * This method will be called every time the action appears in a popup menu.
- * The targetPart may change with each invocation.
+ * This method will be called every time the action appears in a popup menu. The
+ * targetPart may change with each invocation.
* </p>
*
- * @param action
- * the action proxy that handles presentation portion of the
- * action; must not be <code>null</code>.
- * @param targetPart
- * the new part target; must not be <code>null</code>.
+ * @param action the action proxy that handles presentation portion of the
+ * action; must not be <code>null</code>.
+ * @param targetPart the new part target; must not be <code>null</code>.
*/
- void setActivePart(IAction action, IWorkbenchPart targetPart);
+ void setActivePart(IAction action, IWorkbenchPart targetPart);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPageLayout.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPageLayout.java
index 7e7211501f9..a55965af0f2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPageLayout.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPageLayout.java
@@ -78,166 +78,174 @@ package org.eclipse.ui;
*/
public interface IPageLayout {
- /**
- * The part id for the workbench's editor area. This may only be used
- * as a reference part for view addition.
- */
+ /**
+ * The part id for the workbench's editor area. This may only be used as a
+ * reference part for view addition.
+ */
String ID_EDITOR_AREA = "org.eclipse.ui.editorss"; //$NON-NLS-1$
/**
* The view id for the workbench's Resource Navigator standard component.
*
- * @deprecated this has been replaced by the Common Navigator Framework as
- * of release 3.5.
+ * @deprecated this has been replaced by the Common Navigator Framework as of
+ * release 3.5.
*/
- @Deprecated
+ @Deprecated
String ID_RES_NAV = "org.eclipse.ui.views.ResourceNavigator"; //$NON-NLS-1$
- /**
- * The view id for the Project Explorer.
- * @since 3.5
- */
+ /**
+ * The view id for the Project Explorer.
+ *
+ * @since 3.5
+ */
String ID_PROJECT_EXPLORER = "org.eclipse.ui.navigator.ProjectExplorer"; //$NON-NLS-1$
- /**
- * The view id for the workbench's Property Sheet standard component.
- */
+ /**
+ * The view id for the workbench's Property Sheet standard component.
+ */
String ID_PROP_SHEET = "org.eclipse.ui.views.PropertySheet"; //$NON-NLS-1$
- /**
- * The view id for the workbench's Content Outline standard component.
- */
+ /**
+ * The view id for the workbench's Content Outline standard component.
+ */
String ID_OUTLINE = "org.eclipse.ui.views.ContentOutline"; //$NON-NLS-1$
- /**
- * The view id for the workbench's Bookmark Navigator standard component.
- */
+ /**
+ * The view id for the workbench's Bookmark Navigator standard component.
+ */
String ID_BOOKMARKS = "org.eclipse.ui.views.BookmarkView"; //$NON-NLS-1$
- /**
- * The view id for the workbench's Problems View standard component.
- * @since 3.0
- */
+ /**
+ * The view id for the workbench's Problems View standard component.
+ *
+ * @since 3.0
+ */
String ID_PROBLEM_VIEW = "org.eclipse.ui.views.ProblemView"; //$NON-NLS-1$
- /**
- * The view id for the workbench's Progress View standard component.
- * @since 3.2
- */
+ /**
+ * The view id for the workbench's Progress View standard component.
+ *
+ * @since 3.2
+ */
String ID_PROGRESS_VIEW = "org.eclipse.ui.views.ProgressView"; //$NON-NLS-1$
- /**
- * The view id for the workbench's Task List standard component.
- */
+ /**
+ * The view id for the workbench's Task List standard component.
+ */
String ID_TASK_LIST = "org.eclipse.ui.views.TaskList"; //$NON-NLS-1$
- /**
- * Id of the navigate action set.
- * (value <code>"org.eclipse.ui.NavigateActionSet"</code>)
- * @since 2.1
- */
+ /**
+ * Id of the navigate action set. (value
+ * <code>"org.eclipse.ui.NavigateActionSet"</code>)
+ *
+ * @since 2.1
+ */
String ID_NAVIGATE_ACTION_SET = "org.eclipse.ui.NavigateActionSet"; //$NON-NLS-1$
- /**
- * Relationship constant indicating a part should be placed to the left of
- * its relative.
- */
+ /**
+ * Relationship constant indicating a part should be placed to the left of its
+ * relative.
+ */
int LEFT = 1;
- /**
- * Relationship constant indicating a part should be placed to the right of
- * its relative.
- */
+ /**
+ * Relationship constant indicating a part should be placed to the right of its
+ * relative.
+ */
int RIGHT = 2;
- /**
- * Relationship constant indicating a part should be placed above its
- * relative.
- */
+ /**
+ * Relationship constant indicating a part should be placed above its relative.
+ */
int TOP = 3;
- /**
- * Relationship constant indicating a part should be placed below its
- * relative.
- */
+ /**
+ * Relationship constant indicating a part should be placed below its relative.
+ */
int BOTTOM = 4;
- /**
- * Minimum acceptable ratio value when adding a view
- * @since 2.0
- */
+ /**
+ * Minimum acceptable ratio value when adding a view
+ *
+ * @since 2.0
+ */
float RATIO_MIN = 0.05f;
- /**
- * Maximum acceptable ratio value when adding a view
- * @since 2.0
- */
+ /**
+ * Maximum acceptable ratio value when adding a view
+ *
+ * @since 2.0
+ */
float RATIO_MAX = 0.95f;
- /**
- * The default fast view ratio width.
- * @since 2.0
- * @deprecated discontinued support for fast views
- */
- @Deprecated
+ /**
+ * The default fast view ratio width.
+ *
+ * @since 2.0
+ * @deprecated discontinued support for fast views
+ */
+ @Deprecated
float DEFAULT_FASTVIEW_RATIO = 0.3f;
- /**
- * The default view ratio width for regular (non-fast) views.
- * @since 2.0
- */
+ /**
+ * The default view ratio width for regular (non-fast) views.
+ *
+ * @since 2.0
+ */
float DEFAULT_VIEW_RATIO = 0.5f;
- /**
- * A variable used to represent invalid ratios.
- * @since 2.0
- */
+ /**
+ * A variable used to represent invalid ratios.
+ *
+ * @since 2.0
+ */
float INVALID_RATIO = -1f;
- /**
- * A variable used to represent a ratio which has not been specified.
- * @since 2.0
- */
+ /**
+ * A variable used to represent a ratio which has not been specified.
+ *
+ * @since 2.0
+ */
float NULL_RATIO = -2f;
- /**
- * Adds an action set with the given id to this page layout.
- * The id must name an action set contributed to the workbench's extension
- * point (named <code>"org.eclipse.ui.actionSet"</code>).
- *
- * @param actionSetId the action set id
- */
+ /**
+ * Adds an action set with the given id to this page layout. The id must name an
+ * action set contributed to the workbench's extension point (named
+ * <code>"org.eclipse.ui.actionSet"</code>).
+ *
+ * @param actionSetId the action set id
+ */
void addActionSet(String actionSetId);
- /**
- * Adds the view with the given compound id to the page layout as a fast view.
- * See the {@link IPageLayout} type documentation for more details about compound ids.
- * The primary id must name a view contributed to the workbench's view extension
- * point (named <code>"org.eclipse.ui.views"</code>).
- *
- * @param viewId the compound id of the view to be added
- * @since 2.0
- * @deprecated discontinued support for fast views
- */
- @Deprecated
+ /**
+ * Adds the view with the given compound id to the page layout as a fast view.
+ * See the {@link IPageLayout} type documentation for more details about
+ * compound ids. The primary id must name a view contributed to the workbench's
+ * view extension point (named <code>"org.eclipse.ui.views"</code>).
+ *
+ * @param viewId the compound id of the view to be added
+ * @since 2.0
+ * @deprecated discontinued support for fast views
+ */
+ @Deprecated
void addFastView(String viewId);
- /**
- * Adds the view with the given compound id to the page layout as a fast view
- * with the given width ratio.
- * See the {@link IPageLayout} type documentation for more details about compound ids.
- * The primary id must name a view contributed to the workbench's view extension
- * point (named <code>"org.eclipse.ui.views"</code>).
- *
- * @param viewId the compound id of the view to be added
- * @param ratio the percentage of the workbench the fast view will cover
- * @since 2.0
- * @deprecated discontinued support for fast views
- */
- @Deprecated
+ /**
+ * Adds the view with the given compound id to the page layout as a fast view
+ * with the given width ratio. See the {@link IPageLayout} type documentation
+ * for more details about compound ids. The primary id must name a view
+ * contributed to the workbench's view extension point (named
+ * <code>"org.eclipse.ui.views"</code>).
+ *
+ * @param viewId the compound id of the view to be added
+ * @param ratio the percentage of the workbench the fast view will cover
+ * @since 2.0
+ * @deprecated discontinued support for fast views
+ */
+ @Deprecated
void addFastView(String viewId, float ratio);
- /**
+ /**
* Adds a new wizard shortcut to the page layout. These are typically shown in
* the UI to allow rapid navigation to appropriate new wizards. For example, in
* the Eclipse IDE, these appear as items under the File &gt; New menu. The id
@@ -248,7 +256,7 @@ public interface IPageLayout {
*/
void addNewWizardShortcut(String id);
- /**
+ /**
* Adds a perspective shortcut to the page layout. These are typically shown in
* the UI to allow rapid navigation to appropriate new wizards. For example, in
* the Eclipse IDE, these appear as items under the Window &gt; Open Perspective
@@ -260,48 +268,48 @@ public interface IPageLayout {
*/
void addPerspectiveShortcut(String id);
- /**
- * Adds a view placeholder to this page layout.
- * A view placeholder is used to define the position of a view before the view
- * appears. Initially, it is invisible; however, if the user ever opens a view
- * whose compound id matches the placeholder, the view will appear at the same
- * location as the placeholder.
- * See the {@link IPageLayout} type documentation for more details about compound ids.
- * If the placeholder contains wildcards, it remains in the layout, otherwise
- * it is replaced by the view.
- * If the primary id of the placeholder has no wildcards, it must refer to a view
- * contributed to the workbench's view extension point
- * (named <code>"org.eclipse.ui.views"</code>).
- *
- * @param viewId the compound view id (wildcards allowed)
- * @param relationship the position relative to the reference part;
- * one of <code>TOP</code>, <code>BOTTOM</code>, <code>LEFT</code>,
- * or <code>RIGHT</code>
- * @param ratio a ratio specifying how to divide the space currently occupied by the reference part,
- * in the range <code>0.05f</code> to <code>0.95f</code>.
- * Values outside this range will be clipped to facilitate direct manipulation.
- * For a vertical split, the part on top gets the specified ratio of the current space
- * and the part on bottom gets the rest.
- * Likewise, for a horizontal split, the part at left gets the specified ratio of the current space
- * and the part at right gets the rest.
- * @param refId the id of the reference part; either a view id, a folder id,
- * or the special editor area id returned by <code>getEditorArea</code>
- */
- void addPlaceholder(String viewId, int relationship, float ratio,
- String refId);
-
- /**
- * Adds an item to the Show In prompter.
- * The id must name a view contributed to the workbench's view extension point
- * (named <code>"org.eclipse.ui.views"</code>).
- *
- * @param id the view id
- *
- * @since 2.1
- */
+ /**
+ * Adds a view placeholder to this page layout. A view placeholder is used to
+ * define the position of a view before the view appears. Initially, it is
+ * invisible; however, if the user ever opens a view whose compound id matches
+ * the placeholder, the view will appear at the same location as the
+ * placeholder. See the {@link IPageLayout} type documentation for more details
+ * about compound ids. If the placeholder contains wildcards, it remains in the
+ * layout, otherwise it is replaced by the view. If the primary id of the
+ * placeholder has no wildcards, it must refer to a view contributed to the
+ * workbench's view extension point (named <code>"org.eclipse.ui.views"</code>).
+ *
+ * @param viewId the compound view id (wildcards allowed)
+ * @param relationship the position relative to the reference part; one of
+ * <code>TOP</code>, <code>BOTTOM</code>, <code>LEFT</code>,
+ * or <code>RIGHT</code>
+ * @param ratio a ratio specifying how to divide the space currently
+ * occupied by the reference part, in the range
+ * <code>0.05f</code> to <code>0.95f</code>. Values outside
+ * this range will be clipped to facilitate direct
+ * manipulation. For a vertical split, the part on top gets
+ * the specified ratio of the current space and the part on
+ * bottom gets the rest. Likewise, for a horizontal split,
+ * the part at left gets the specified ratio of the current
+ * space and the part at right gets the rest.
+ * @param refId the id of the reference part; either a view id, a folder
+ * id, or the special editor area id returned by
+ * <code>getEditorArea</code>
+ */
+ void addPlaceholder(String viewId, int relationship, float ratio, String refId);
+
+ /**
+ * Adds an item to the Show In prompter. The id must name a view contributed to
+ * the workbench's view extension point (named
+ * <code>"org.eclipse.ui.views"</code>).
+ *
+ * @param id the view id
+ *
+ * @since 2.1
+ */
void addShowInPart(String id);
- /**
+ /**
* Adds a show view shortcut to the page layout. These are typically shown in
* the UI to allow rapid navigation to appropriate views. For example, in the
* Eclipse IDE, these appear as items under the Window &gt; Show View menu. The
@@ -312,119 +320,125 @@ public interface IPageLayout {
*/
void addShowViewShortcut(String id);
- /**
- * Adds a view with the given compound id to this page layout.
- * See the {@link IPageLayout} type documentation for more details about compound ids.
- * The primary id must name a view contributed to the workbench's view extension point
- * (named <code>"org.eclipse.ui.views"</code>).
- *
- * @param viewId the compound view id
- * @param relationship the position relative to the reference part;
- * one of <code>TOP</code>, <code>BOTTOM</code>, <code>LEFT</code>,
- * or <code>RIGHT</code>
- * @param ratio a ratio specifying how to divide the space currently occupied by the reference part,
- * in the range <code>0.05f</code> to <code>0.95f</code>.
- * Values outside this range will be clipped to facilitate direct manipulation.
- * For a vertical split, the part on top gets the specified ratio of the current space
- * and the part on bottom gets the rest.
- * Likewise, for a horizontal split, the part at left gets the specified ratio of the current space
- * and the part at right gets the rest.
- * @param refId the id of the reference part; either a view id, a folder id,
- * or the special editor area id returned by <code>getEditorArea</code>
- */
- void addView(String viewId, int relationship, float ratio,
- String refId);
-
- /**
- * Creates and adds a new folder with the given id to this page layout.
- * The position and relative size of the folder is expressed relative to
- * a reference part.
- *
- * @param folderId the id for the new folder. This must be unique within
- * the layout to avoid collision with other parts.
- * @param relationship the position relative to the reference part;
- * one of <code>TOP</code>, <code>BOTTOM</code>, <code>LEFT</code>,
- * or <code>RIGHT</code>
- * @param ratio a ratio specifying how to divide the space currently occupied by the reference part,
- * in the range <code>0.05f</code> to <code>0.95f</code>.
- * Values outside this range will be clipped to facilitate direct manipulation.
- * For a vertical split, the part on top gets the specified ratio of the current space
- * and the part on bottom gets the rest.
- * Likewise, for a horizontal split, the part at left gets the specified ratio of the current space
- * and the part at right gets the rest.
- * @param refId the id of the reference part; either a view id, a folder id,
- * or the special editor area id returned by <code>getEditorArea</code>
- * @return the new folder
- */
- IFolderLayout createFolder(String folderId, int relationship,
- float ratio, String refId);
-
- /**
- * Creates and adds a placeholder for a new folder with the given id to this page layout.
- * The position and relative size of the folder is expressed relative to
- * a reference part.
- *
- * @param folderId the id for the new folder. This must be unique within
- * the layout to avoid collision with other parts.
- * @param relationship the position relative to the reference part;
- * one of <code>TOP</code>, <code>BOTTOM</code>, <code>LEFT</code>,
- * or <code>RIGHT</code>
- * @param ratio a ratio specifying how to divide the space currently occupied by the reference part,
- * in the range <code>0.05f</code> to <code>0.95f</code>.
- * Values outside this range will be clipped to facilitate direct manipulation.
- * For a vertical split, the part on top gets the specified ratio of the current space
- * and the part on bottom gets the rest.
- * Likewise, for a horizontal split, the part at left gets the specified ratio of the current space
- * and the part at right gets the rest.
- * @param refId the id of the reference part; either a view id, a folder id,
- * or the special editor area id returned by <code>getEditorArea</code>
- * @return a placeholder for the new folder
- * @since 2.0
- */
- IPlaceholderFolderLayout createPlaceholderFolder(String folderId,
- int relationship, float ratio, String refId);
-
- /**
- * Returns the special identifier for the editor area in this page
- * layout. The identifier for the editor area is also stored in
- * <code>ID_EDITOR_AREA</code>.
- * <p>
- * The editor area is automatically added to each layout before anything else.
- * It should be used as the point of reference when adding views to a layout.
- * </p>
- *
- * @return the special id of the editor area
- */
+ /**
+ * Adds a view with the given compound id to this page layout. See the
+ * {@link IPageLayout} type documentation for more details about compound ids.
+ * The primary id must name a view contributed to the workbench's view extension
+ * point (named <code>"org.eclipse.ui.views"</code>).
+ *
+ * @param viewId the compound view id
+ * @param relationship the position relative to the reference part; one of
+ * <code>TOP</code>, <code>BOTTOM</code>, <code>LEFT</code>,
+ * or <code>RIGHT</code>
+ * @param ratio a ratio specifying how to divide the space currently
+ * occupied by the reference part, in the range
+ * <code>0.05f</code> to <code>0.95f</code>. Values outside
+ * this range will be clipped to facilitate direct
+ * manipulation. For a vertical split, the part on top gets
+ * the specified ratio of the current space and the part on
+ * bottom gets the rest. Likewise, for a horizontal split,
+ * the part at left gets the specified ratio of the current
+ * space and the part at right gets the rest.
+ * @param refId the id of the reference part; either a view id, a folder
+ * id, or the special editor area id returned by
+ * <code>getEditorArea</code>
+ */
+ void addView(String viewId, int relationship, float ratio, String refId);
+
+ /**
+ * Creates and adds a new folder with the given id to this page layout. The
+ * position and relative size of the folder is expressed relative to a reference
+ * part.
+ *
+ * @param folderId the id for the new folder. This must be unique within the
+ * layout to avoid collision with other parts.
+ * @param relationship the position relative to the reference part; one of
+ * <code>TOP</code>, <code>BOTTOM</code>, <code>LEFT</code>,
+ * or <code>RIGHT</code>
+ * @param ratio a ratio specifying how to divide the space currently
+ * occupied by the reference part, in the range
+ * <code>0.05f</code> to <code>0.95f</code>. Values outside
+ * this range will be clipped to facilitate direct
+ * manipulation. For a vertical split, the part on top gets
+ * the specified ratio of the current space and the part on
+ * bottom gets the rest. Likewise, for a horizontal split,
+ * the part at left gets the specified ratio of the current
+ * space and the part at right gets the rest.
+ * @param refId the id of the reference part; either a view id, a folder
+ * id, or the special editor area id returned by
+ * <code>getEditorArea</code>
+ * @return the new folder
+ */
+ IFolderLayout createFolder(String folderId, int relationship, float ratio, String refId);
+
+ /**
+ * Creates and adds a placeholder for a new folder with the given id to this
+ * page layout. The position and relative size of the folder is expressed
+ * relative to a reference part.
+ *
+ * @param folderId the id for the new folder. This must be unique within the
+ * layout to avoid collision with other parts.
+ * @param relationship the position relative to the reference part; one of
+ * <code>TOP</code>, <code>BOTTOM</code>, <code>LEFT</code>,
+ * or <code>RIGHT</code>
+ * @param ratio a ratio specifying how to divide the space currently
+ * occupied by the reference part, in the range
+ * <code>0.05f</code> to <code>0.95f</code>. Values outside
+ * this range will be clipped to facilitate direct
+ * manipulation. For a vertical split, the part on top gets
+ * the specified ratio of the current space and the part on
+ * bottom gets the rest. Likewise, for a horizontal split,
+ * the part at left gets the specified ratio of the current
+ * space and the part at right gets the rest.
+ * @param refId the id of the reference part; either a view id, a folder
+ * id, or the special editor area id returned by
+ * <code>getEditorArea</code>
+ * @return a placeholder for the new folder
+ * @since 2.0
+ */
+ IPlaceholderFolderLayout createPlaceholderFolder(String folderId, int relationship, float ratio, String refId);
+
+ /**
+ * Returns the special identifier for the editor area in this page layout. The
+ * identifier for the editor area is also stored in <code>ID_EDITOR_AREA</code>.
+ * <p>
+ * The editor area is automatically added to each layout before anything else.
+ * It should be used as the point of reference when adding views to a layout.
+ * </p>
+ *
+ * @return the special id of the editor area
+ */
String getEditorArea();
- /**
- * Returns whether the page's layout will show
- * the editor area.
- *
- * @return <code>true</code> when editor area visible, <code>false</code> otherwise
- */
+ /**
+ * Returns whether the page's layout will show the editor area.
+ *
+ * @return <code>true</code> when editor area visible, <code>false</code>
+ * otherwise
+ */
boolean isEditorAreaVisible();
- /**
- * Show or hide the editor area for the page's layout.
- *
- * @param showEditorArea <code>true</code> to show the editor area, <code>false</code> to hide the editor area
- */
+ /**
+ * Show or hide the editor area for the page's layout.
+ *
+ * @param showEditorArea <code>true</code> to show the editor area,
+ * <code>false</code> to hide the editor area
+ */
void setEditorAreaVisible(boolean showEditorArea);
- /**
- * Returns the number of open editors before reusing editors or -1 if the
- * preference settings should be used instead.
- *
- * @return the number of open editors before reusing editors or -1 if the
- * preference settings should be used instead.
- *
- * @deprecated this always returns -1 as of Eclipse 2.1
- */
- @Deprecated
+ /**
+ * Returns the number of open editors before reusing editors or -1 if the
+ * preference settings should be used instead.
+ *
+ * @return the number of open editors before reusing editors or -1 if the
+ * preference settings should be used instead.
+ *
+ * @deprecated this always returns -1 as of Eclipse 2.1
+ */
+ @Deprecated
int getEditorReuseThreshold();
- /**
+ /**
* Sets the number of open editors before reusing editors. If &lt; 0 the user
* preference settings will be used.
*
@@ -432,117 +446,111 @@ public interface IPageLayout {
*
* @deprecated this method has no effect, as of Eclipse 2.1
*/
- @Deprecated
+ @Deprecated
void setEditorReuseThreshold(int openEditors);
- /**
- * Sets whether this layout is fixed.
- * In a fixed layout, layout parts cannot be moved or zoomed, and the initial
- * set of views cannot be closed.
- *
- * @param isFixed <code>true</code> if this layout is fixed, <code>false</code> if not
- * @since 3.0
- */
+ /**
+ * Sets whether this layout is fixed. In a fixed layout, layout parts cannot be
+ * moved or zoomed, and the initial set of views cannot be closed.
+ *
+ * @param isFixed <code>true</code> if this layout is fixed, <code>false</code>
+ * if not
+ * @since 3.0
+ */
void setFixed(boolean isFixed);
- /**
- * Returns <code>true</code> if this layout is fixed, <code>false</code> if not.
- * In a fixed layout, layout parts cannot be moved or zoomed, and the initial
- * set of views cannot be closed.
- * The default is <code>false</code>.
- *
- * @return <code>true</code> if this layout is fixed, <code>false</code> if not.
- * @since 3.0
- */
+ /**
+ * Returns <code>true</code> if this layout is fixed, <code>false</code> if not.
+ * In a fixed layout, layout parts cannot be moved or zoomed, and the initial
+ * set of views cannot be closed. The default is <code>false</code>.
+ *
+ * @return <code>true</code> if this layout is fixed, <code>false</code> if not.
+ * @since 3.0
+ */
boolean isFixed();
- /**
- * Returns the layout for the view or placeholder with the given compound id in
- * this page layout.
- * See the {@link IPageLayout} type documentation for more details about compound ids.
- * Returns <code>null</code> if the specified view or placeholder is unknown to the layout.
- *
- * @param id the compound view id or placeholder
- * @return the view layout, or <code>null</code>
- * @since 3.0
- */
+ /**
+ * Returns the layout for the view or placeholder with the given compound id in
+ * this page layout. See the {@link IPageLayout} type documentation for more
+ * details about compound ids. Returns <code>null</code> if the specified view
+ * or placeholder is unknown to the layout.
+ *
+ * @param id the compound view id or placeholder
+ * @return the view layout, or <code>null</code>
+ * @since 3.0
+ */
IViewLayout getViewLayout(String id);
- /**
- * Adds a standalone view with the given compound id to this page layout.
- * See the {@link IPageLayout} type documentation for more details about compound ids.
- * A standalone view cannot be docked together with other views.
- * A standalone view's title can optionally be hidden. If hidden,
- * then any controls typically shown with the title (such as the close button)
- * are also hidden. Any contributions or other content from the view itself
- * are always shown (e.g. toolbar or view menu contributions, content description).
- * <p>
- * The id must name a view contributed to the workbench's view extension point
- * (named <code>"org.eclipse.ui.views"</code>).
- * </p>
- *
- * @param viewId the compound view id
- * @param showTitle <code>true</code> to show the title and related controls,
- * <code>false</code> to hide them
- * @param relationship the position relative to the reference part;
- * one of <code>TOP</code>, <code>BOTTOM</code>, <code>LEFT</code>,
- * or <code>RIGHT</code>
- * @param ratio a ratio specifying how to divide the space currently occupied by the reference part,
- * in the range <code>0.05f</code> to <code>0.95f</code>.
- * Values outside this range will be clipped to facilitate direct manipulation.
- * For a vertical split, the part on top gets the specified ratio of the current space
- * and the part on bottom gets the rest.
- * Likewise, for a horizontal split, the part at left gets the specified ratio of the current space
- * and the part at right gets the rest.
- * @param refId the id of the reference part; either a view id, a folder id,
- * or the special editor area id returned by <code>getEditorArea</code>
- *
- * @since 3.0
- */
- void addStandaloneView(String viewId, boolean showTitle,
- int relationship, float ratio, String refId);
-
- /**
- * Adds a standalone view placeholder to this page layout. A view
- * placeholder is used to define the position of a view before the view
- * appears. Initially, it is invisible; however, if the user ever opens a
- * view whose compound id matches the placeholder, the view will appear at
- * the same location as the placeholder. See the {@link IPageLayout} type
- * documentation for more details about compound ids. If the placeholder
- * contains wildcards, it remains in the layout, otherwise it is replaced by
- * the view. If the primary id of the placeholder has no wildcards, it must
- * refer to a view contributed to the workbench's view extension point
+ /**
+ * Adds a standalone view with the given compound id to this page layout. See
+ * the {@link IPageLayout} type documentation for more details about compound
+ * ids. A standalone view cannot be docked together with other views. A
+ * standalone view's title can optionally be hidden. If hidden, then any
+ * controls typically shown with the title (such as the close button) are also
+ * hidden. Any contributions or other content from the view itself are always
+ * shown (e.g. toolbar or view menu contributions, content description).
+ * <p>
+ * The id must name a view contributed to the workbench's view extension point
* (named <code>"org.eclipse.ui.views"</code>).
+ * </p>
*
- * @param viewId
- * the compound view id (wildcards allowed)
- * @param relationship
- * the position relative to the reference part; one of
- * <code>TOP</code>, <code>BOTTOM</code>, <code>LEFT</code>,
- * or <code>RIGHT</code>
- * @param ratio
- * a ratio specifying how to divide the space currently occupied
- * by the reference part, in the range <code>0.05f</code> to
- * <code>0.95f</code>. Values outside this range will be
- * clipped to facilitate direct manipulation. For a vertical
- * split, the part on top gets the specified ratio of the current
- * space and the part on bottom gets the rest. Likewise, for a
- * horizontal split, the part at left gets the specified ratio of
- * the current space and the part at right gets the rest.
- * @param refId
- * the id of the reference part; either a view id, a folder id,
- * or the special editor area id returned by
- * <code>getEditorArea</code>
- * @param showTitle
- * true to show the view's title, false if not
+ * @param viewId the compound view id
+ * @param showTitle <code>true</code> to show the title and related controls,
+ * <code>false</code> to hide them
+ * @param relationship the position relative to the reference part; one of
+ * <code>TOP</code>, <code>BOTTOM</code>, <code>LEFT</code>,
+ * or <code>RIGHT</code>
+ * @param ratio a ratio specifying how to divide the space currently
+ * occupied by the reference part, in the range
+ * <code>0.05f</code> to <code>0.95f</code>. Values outside
+ * this range will be clipped to facilitate direct
+ * manipulation. For a vertical split, the part on top gets
+ * the specified ratio of the current space and the part on
+ * bottom gets the rest. Likewise, for a horizontal split,
+ * the part at left gets the specified ratio of the current
+ * space and the part at right gets the rest.
+ * @param refId the id of the reference part; either a view id, a folder
+ * id, or the special editor area id returned by
+ * <code>getEditorArea</code>
*
- * @since 3.2
+ * @since 3.0
*/
- void addStandaloneViewPlaceholder(String viewId, int relationship,
- float ratio, String refId, boolean showTitle);
+ void addStandaloneView(String viewId, boolean showTitle, int relationship, float ratio, String refId);
+ /**
+ * Adds a standalone view placeholder to this page layout. A view placeholder is
+ * used to define the position of a view before the view appears. Initially, it
+ * is invisible; however, if the user ever opens a view whose compound id
+ * matches the placeholder, the view will appear at the same location as the
+ * placeholder. See the {@link IPageLayout} type documentation for more details
+ * about compound ids. If the placeholder contains wildcards, it remains in the
+ * layout, otherwise it is replaced by the view. If the primary id of the
+ * placeholder has no wildcards, it must refer to a view contributed to the
+ * workbench's view extension point (named <code>"org.eclipse.ui.views"</code>).
+ *
+ * @param viewId the compound view id (wildcards allowed)
+ * @param relationship the position relative to the reference part; one of
+ * <code>TOP</code>, <code>BOTTOM</code>, <code>LEFT</code>,
+ * or <code>RIGHT</code>
+ * @param ratio a ratio specifying how to divide the space currently
+ * occupied by the reference part, in the range
+ * <code>0.05f</code> to <code>0.95f</code>. Values outside
+ * this range will be clipped to facilitate direct
+ * manipulation. For a vertical split, the part on top gets
+ * the specified ratio of the current space and the part on
+ * bottom gets the rest. Likewise, for a horizontal split,
+ * the part at left gets the specified ratio of the current
+ * space and the part at right gets the rest.
+ * @param refId the id of the reference part; either a view id, a folder
+ * id, or the special editor area id returned by
+ * <code>getEditorArea</code>
+ * @param showTitle true to show the view's title, false if not
+ *
+ * @since 3.2
+ */
+ void addStandaloneViewPlaceholder(String viewId, int relationship, float ratio, String refId, boolean showTitle);
- /**
+ /**
* Returns the perspective descriptor for the perspective being layed out.
*
* @return the perspective descriptor for the perspective being layed out
@@ -550,16 +558,14 @@ public interface IPageLayout {
*/
IPerspectiveDescriptor getDescriptor();
- /**
- * Returns the folder layout for the view or placeholder with the given
- * compound id in this page layout. See the {@link IPageLayout} type
- * documentation for more details about compound ids. Returns
- * <code>null</code> if the specified view or placeholder is unknown to
- * the layout, or the placeholder was not in a folder.
+ /**
+ * Returns the folder layout for the view or placeholder with the given compound
+ * id in this page layout. See the {@link IPageLayout} type documentation for
+ * more details about compound ids. Returns <code>null</code> if the specified
+ * view or placeholder is unknown to the layout, or the placeholder was not in a
+ * folder.
*
- * @param id
- * the compound view id or placeholder. Must not be
- * <code>null</code>.
+ * @param id the compound view id or placeholder. Must not be <code>null</code>.
* @return the folder layout, or <code>null</code>
* @since 3.3
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPageListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPageListener.java
index 33aaacbbbde..eef8631a1b8 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPageListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPageListener.java
@@ -22,27 +22,27 @@ package org.eclipse.ui;
* @see IPageService#addPageListener
*/
public interface IPageListener {
- /**
- * Notifies this listener that the given page has been activated.
- *
- * @param page the page that was activated
- * @see IWorkbenchWindow#setActivePage
- */
- void pageActivated(IWorkbenchPage page);
+ /**
+ * Notifies this listener that the given page has been activated.
+ *
+ * @param page the page that was activated
+ * @see IWorkbenchWindow#setActivePage
+ */
+ void pageActivated(IWorkbenchPage page);
- /**
- * Notifies this listener that the given page has been closed.
- *
- * @param page the page that was closed
- * @see IWorkbenchPage#close
- */
- void pageClosed(IWorkbenchPage page);
+ /**
+ * Notifies this listener that the given page has been closed.
+ *
+ * @param page the page that was closed
+ * @see IWorkbenchPage#close
+ */
+ void pageClosed(IWorkbenchPage page);
- /**
- * Notifies this listener that the given page has been opened.
- *
- * @param page the page that was opened
- * @see IWorkbenchWindow#openPage
- */
- void pageOpened(IWorkbenchPage page);
+ /**
+ * Notifies this listener that the given page has been opened.
+ *
+ * @param page the page that was opened
+ * @see IWorkbenchWindow#openPage
+ */
+ void pageOpened(IWorkbenchPage page);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPageService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPageService.java
index 667aa38b1b3..57949d08f56 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPageService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPageService.java
@@ -35,56 +35,54 @@ package org.eclipse.ui;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IPageService {
- /**
- * Adds the given listener for page lifecycle events.
- * Has no effect if an identical listener is already registered.
+ /**
+ * Adds the given listener for page lifecycle events. Has no effect if an
+ * identical listener is already registered.
* <p>
- * <b>Note:</b> listeners should be removed when no longer necessary. If
- * not, they will be removed when the IServiceLocator used to acquire this
- * service is disposed.
+ * <b>Note:</b> listeners should be removed when no longer necessary. If not,
+ * they will be removed when the IServiceLocator used to acquire this service is
+ * disposed.
* </p>
- *
- * @param listener a page listener
- * @see #removePageListener(IPageListener)
- */
- void addPageListener(IPageListener listener);
+ *
+ * @param listener a page listener
+ * @see #removePageListener(IPageListener)
+ */
+ void addPageListener(IPageListener listener);
- /**
- * Adds the given listener for a page's perspective lifecycle events.
- * Has no effect if an identical listener is already registered.
+ /**
+ * Adds the given listener for a page's perspective lifecycle events. Has no
+ * effect if an identical listener is already registered.
* <p>
- * <b>Note:</b> listeners should be removed when no longer necessary. If
- * not, they will be removed when the IServiceLocator used to acquire this
- * service is disposed.
+ * <b>Note:</b> listeners should be removed when no longer necessary. If not,
+ * they will be removed when the IServiceLocator used to acquire this service is
+ * disposed.
* </p>
- *
- * @param listener a perspective listener
- * @see #removePerspectiveListener(IPerspectiveListener)
- */
- void addPerspectiveListener(IPerspectiveListener listener);
+ *
+ * @param listener a perspective listener
+ * @see #removePerspectiveListener(IPerspectiveListener)
+ */
+ void addPerspectiveListener(IPerspectiveListener listener);
- /**
- * Returns the active page.
- *
- * @return the active page, or <code>null</code> if no page is currently active
- */
- IWorkbenchPage getActivePage();
+ /**
+ * Returns the active page.
+ *
+ * @return the active page, or <code>null</code> if no page is currently active
+ */
+ IWorkbenchPage getActivePage();
- /**
- * Removes the given page listener. Has no effect if an identical listener
- * is not registered.
+ /**
+ * Removes the given page listener. Has no effect if an identical listener is
+ * not registered.
*
- * @param listener
- * a page listener
+ * @param listener a page listener
*/
- void removePageListener(IPageListener listener);
+ void removePageListener(IPageListener listener);
- /**
- * Removes the given page's perspective listener. Has no effect if an
- * identical listener is not registered.
+ /**
+ * Removes the given page's perspective listener. Has no effect if an identical
+ * listener is not registered.
*
- * @param listener
- * a perspective listener
+ * @param listener a perspective listener
*/
- void removePerspectiveListener(IPerspectiveListener listener);
+ void removePerspectiveListener(IPerspectiveListener listener);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPartListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPartListener.java
index fc23b5d8272..4eea167356a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPartListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPartListener.java
@@ -23,50 +23,50 @@ package org.eclipse.ui;
*/
public interface IPartListener {
- /**
- * Notifies this listener that the given part has been activated.
- *
- * @param part the part that was activated
- * @see IWorkbenchPage#activate
- */
- void partActivated(IWorkbenchPart part);
+ /**
+ * Notifies this listener that the given part has been activated.
+ *
+ * @param part the part that was activated
+ * @see IWorkbenchPage#activate
+ */
+ void partActivated(IWorkbenchPart part);
- /**
- * Notifies this listener that the given part has been brought to the top.
- * <p>
- * These events occur when an editor is brought to the top in the editor area,
- * or when a view is brought to the top in a page book with multiple views.
- * They are normally only sent when a part is brought to the top
- * programmatically (via <code>IPerspective.bringToTop</code>). When a part is
- * activated by the user clicking on it, only <code>partActivated</code> is sent.
- * </p>
- *
- * @param part the part that was surfaced
- * @see IWorkbenchPage#bringToTop
- */
- void partBroughtToTop(IWorkbenchPart part);
+ /**
+ * Notifies this listener that the given part has been brought to the top.
+ * <p>
+ * These events occur when an editor is brought to the top in the editor area,
+ * or when a view is brought to the top in a page book with multiple views. They
+ * are normally only sent when a part is brought to the top programmatically
+ * (via <code>IPerspective.bringToTop</code>). When a part is activated by the
+ * user clicking on it, only <code>partActivated</code> is sent.
+ * </p>
+ *
+ * @param part the part that was surfaced
+ * @see IWorkbenchPage#bringToTop
+ */
+ void partBroughtToTop(IWorkbenchPart part);
- /**
- * Notifies this listener that the given part has been closed.
- *
- * @param part the part that was closed
- * @see IWorkbenchPage#hideView(IViewPart)
- */
- void partClosed(IWorkbenchPart part);
+ /**
+ * Notifies this listener that the given part has been closed.
+ *
+ * @param part the part that was closed
+ * @see IWorkbenchPage#hideView(IViewPart)
+ */
+ void partClosed(IWorkbenchPart part);
- /**
- * Notifies this listener that the given part has been deactivated.
- *
- * @param part the part that was deactivated
- * @see IWorkbenchPage#activate(IWorkbenchPart)
- */
- void partDeactivated(IWorkbenchPart part);
+ /**
+ * Notifies this listener that the given part has been deactivated.
+ *
+ * @param part the part that was deactivated
+ * @see IWorkbenchPage#activate(IWorkbenchPart)
+ */
+ void partDeactivated(IWorkbenchPart part);
- /**
- * Notifies this listener that the given part has been opened.
- *
- * @param part the part that was opened
- * @see IWorkbenchPage#showView(String)
- */
- void partOpened(IWorkbenchPart part);
+ /**
+ * Notifies this listener that the given part has been opened.
+ *
+ * @param part the part that was opened
+ * @see IWorkbenchPage#showView(String)
+ */
+ void partOpened(IWorkbenchPart part);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPartListener2.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPartListener2.java
index d719dbe1598..d530eba0d9b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPartListener2.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPartListener2.java
@@ -17,7 +17,6 @@ import org.eclipse.jface.dialogs.IPageChangeProvider;
import org.eclipse.jface.dialogs.IPageChangedListener;
import org.eclipse.jface.dialogs.PageChangedEvent;
-
/**
* Interface for listening to part lifecycle events.
* <p>
@@ -36,81 +35,82 @@ import org.eclipse.jface.dialogs.PageChangedEvent;
*/
public interface IPartListener2 {
- /**
- * Notifies this listener that the given part has been activated.
- *
- * @param partRef the part that was activated
- * @see IWorkbenchPage#activate
- */
- void partActivated(IWorkbenchPartReference partRef);
+ /**
+ * Notifies this listener that the given part has been activated.
+ *
+ * @param partRef the part that was activated
+ * @see IWorkbenchPage#activate
+ */
+ void partActivated(IWorkbenchPartReference partRef);
- /**
- * Notifies this listener that the given part has been brought to the top.
- * <p>
- * These events occur when an editor is brought to the top in the editor area,
- * or when a view is brought to the top in a page book with multiple views.
- * They are normally only sent when a part is brought to the top
- * programmatically (via <code>IPerspective.bringToTop</code>). When a part is
- * activated by the user clicking on it, only <code>partActivated</code> is sent.
- * </p>
- *
- * @param partRef the part that was surfaced
- * @see IWorkbenchPage#bringToTop
- */
- void partBroughtToTop(IWorkbenchPartReference partRef);
+ /**
+ * Notifies this listener that the given part has been brought to the top.
+ * <p>
+ * These events occur when an editor is brought to the top in the editor area,
+ * or when a view is brought to the top in a page book with multiple views. They
+ * are normally only sent when a part is brought to the top programmatically
+ * (via <code>IPerspective.bringToTop</code>). When a part is activated by the
+ * user clicking on it, only <code>partActivated</code> is sent.
+ * </p>
+ *
+ * @param partRef the part that was surfaced
+ * @see IWorkbenchPage#bringToTop
+ */
+ void partBroughtToTop(IWorkbenchPartReference partRef);
- /**
- * Notifies this listener that the given part has been closed.
- * <p>
- * Note that if other perspectives in the same page share the view,
- * this notification is not sent. It is only sent when the view
- * is being removed from the page entirely (it is being disposed).
- * </p>
- *
- * @param partRef the part that was closed
- * @see IWorkbenchPage#hideView
- */
- void partClosed(IWorkbenchPartReference partRef);
+ /**
+ * Notifies this listener that the given part has been closed.
+ * <p>
+ * Note that if other perspectives in the same page share the view, this
+ * notification is not sent. It is only sent when the view is being removed from
+ * the page entirely (it is being disposed).
+ * </p>
+ *
+ * @param partRef the part that was closed
+ * @see IWorkbenchPage#hideView
+ */
+ void partClosed(IWorkbenchPartReference partRef);
- /**
- * Notifies this listener that the given part has been deactivated.
- *
- * @param partRef the part that was deactivated
- * @see IWorkbenchPage#activate
- */
- void partDeactivated(IWorkbenchPartReference partRef);
+ /**
+ * Notifies this listener that the given part has been deactivated.
+ *
+ * @param partRef the part that was deactivated
+ * @see IWorkbenchPage#activate
+ */
+ void partDeactivated(IWorkbenchPartReference partRef);
- /**
- * Notifies this listener that the given part has been opened.
- * <p>
- * Note that if other perspectives in the same page share the view,
- * this notification is not sent. It is only sent when the view
- * is being newly opened in the page (it is being created).
- * </p>
- *
- * @param partRef the part that was opened
- * @see IWorkbenchPage#showView
- */
- void partOpened(IWorkbenchPartReference partRef);
+ /**
+ * Notifies this listener that the given part has been opened.
+ * <p>
+ * Note that if other perspectives in the same page share the view, this
+ * notification is not sent. It is only sent when the view is being newly opened
+ * in the page (it is being created).
+ * </p>
+ *
+ * @param partRef the part that was opened
+ * @see IWorkbenchPage#showView
+ */
+ void partOpened(IWorkbenchPartReference partRef);
- /**
- * Notifies this listener that the given part is hidden or obscured by another part.
- *
- * @param partRef the part that is hidden or obscured by another part
- */
- void partHidden(IWorkbenchPartReference partRef);
+ /**
+ * Notifies this listener that the given part is hidden or obscured by another
+ * part.
+ *
+ * @param partRef the part that is hidden or obscured by another part
+ */
+ void partHidden(IWorkbenchPartReference partRef);
- /**
- * Notifies this listener that the given part is visible.
- *
- * @param partRef the part that is visible
- */
- void partVisible(IWorkbenchPartReference partRef);
+ /**
+ * Notifies this listener that the given part is visible.
+ *
+ * @param partRef the part that is visible
+ */
+ void partVisible(IWorkbenchPartReference partRef);
- /**
- * Notifies this listener that the given part's input was changed.
- *
- * @param partRef the part whose input was changed
- */
- void partInputChanged(IWorkbenchPartReference partRef);
+ /**
+ * Notifies this listener that the given part's input was changed.
+ *
+ * @param partRef the part whose input was changed
+ */
+ void partInputChanged(IWorkbenchPartReference partRef);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPartService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPartService.java
index 3c199141c31..ef6671bdf9c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPartService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPartService.java
@@ -33,71 +33,69 @@ package org.eclipse.ui;
*/
public interface IPartService {
- /**
- * Adds the given listener for part lifecycle events.
- * Has no effect if an identical listener is already registered.
+ /**
+ * Adds the given listener for part lifecycle events. Has no effect if an
+ * identical listener is already registered.
* <p>
- * <b>Note:</b> listeners should be removed when no longer necessary. If
- * not, they will be removed when the IServiceLocator used to acquire this
- * service is disposed.
+ * <b>Note:</b> listeners should be removed when no longer necessary. If not,
+ * they will be removed when the IServiceLocator used to acquire this service is
+ * disposed.
* </p>
- *
- * @param listener a part listener
- * @see #removePartListener(IPartListener)
- */
- void addPartListener(IPartListener listener);
+ *
+ * @param listener a part listener
+ * @see #removePartListener(IPartListener)
+ */
+ void addPartListener(IPartListener listener);
- /**
- * Adds the given listener for part lifecycle events.
- * Has no effect if an identical listener is already registered.
- * <p>
- * As of 3.5, the IPartListener2 can also implement IPageChangedListener
- * to be notified about any parts that implement IPageChangeProvider and
- * post PageChangedEvents.
- * </p>
+ /**
+ * Adds the given listener for part lifecycle events. Has no effect if an
+ * identical listener is already registered.
* <p>
- * <b>Note:</b> listeners should be removed when no longer necessary. If
- * not, they will be removed when the IServiceLocator used to acquire this
- * service is disposed.
+ * As of 3.5, the IPartListener2 can also implement IPageChangedListener to be
+ * notified about any parts that implement IPageChangeProvider and post
+ * PageChangedEvents.
* </p>
- *
- * @param listener a part listener
- * @see #removePartListener(IPartListener2)
- * @see org.eclipse.jface.dialogs.IPageChangeProvider
- * @see org.eclipse.jface.dialogs.IPageChangedListener
- */
- void addPartListener(IPartListener2 listener);
+ * <p>
+ * <b>Note:</b> listeners should be removed when no longer necessary. If not,
+ * they will be removed when the IServiceLocator used to acquire this service is
+ * disposed.
+ * </p>
+ *
+ * @param listener a part listener
+ * @see #removePartListener(IPartListener2)
+ * @see org.eclipse.jface.dialogs.IPageChangeProvider
+ * @see org.eclipse.jface.dialogs.IPageChangedListener
+ */
+ void addPartListener(IPartListener2 listener);
- /**
- * Returns the active part.
- *
- * @return the active part, or <code>null</code> if no part is currently active
- */
- IWorkbenchPart getActivePart();
+ /**
+ * Returns the active part.
+ *
+ * @return the active part, or <code>null</code> if no part is currently active
+ */
+ IWorkbenchPart getActivePart();
- /**
- * Returns the active part reference.
- *
- * @return the active part reference, or <code>null</code> if no part
- * is currently active
- */
- IWorkbenchPartReference getActivePartReference();
+ /**
+ * Returns the active part reference.
+ *
+ * @return the active part reference, or <code>null</code> if no part is
+ * currently active
+ */
+ IWorkbenchPartReference getActivePartReference();
- /**
- * Removes the given part listener. Has no effect if an identical listener
- * is not registered.
+ /**
+ * Removes the given part listener. Has no effect if an identical listener is
+ * not registered.
*
- * @param listener
- * a part listener
+ * @param listener a part listener
*/
- void removePartListener(IPartListener listener);
+ void removePartListener(IPartListener listener);
- /**
- * Removes the given part listener. Has no effect if an identical listener
- * is not registered.
+ /**
+ * Removes the given part listener. Has no effect if an identical listener is
+ * not registered.
*
- * @param listener
- * a part listener
+ * @param listener a part listener
*/
- void removePartListener(IPartListener2 listener);
+ void removePartListener(IPartListener2 listener);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPathEditorInput.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPathEditorInput.java
index 2bdf9d38b79..a6b1e5892eb 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPathEditorInput.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPathEditorInput.java
@@ -16,17 +16,19 @@ package org.eclipse.ui;
import org.eclipse.core.runtime.IPath;
/**
- * This interface defines an editor input based on the local file system path
- * of a file.
+ * This interface defines an editor input based on the local file system path of
+ * a file.
* <p>
* Clients implementing this editor input interface should override
- * <code>Object.equals(Object)</code> to answer true for two inputs
- * that are the same. The <code>IWorkbenchPage.openEditor</code> APIs
- * are dependent on this to find an editor with the same input.
- * </p><p>
- * Path-oriented editors should support this as a valid input type, and
- * can allow full read-write editing of its content.
- * </p><p>
+ * <code>Object.equals(Object)</code> to answer true for two inputs that are the
+ * same. The <code>IWorkbenchPage.openEditor</code> APIs are dependent on this
+ * to find an editor with the same input.
+ * </p>
+ * <p>
+ * Path-oriented editors should support this as a valid input type, and can
+ * allow full read-write editing of its content.
+ * </p>
+ * <p>
* All editor inputs must implement the <code>IAdaptable</code> interface;
* extensions are managed by the platform's adapter manager.
* </p>
@@ -35,10 +37,10 @@ import org.eclipse.core.runtime.IPath;
* @since 3.0
*/
public interface IPathEditorInput extends IEditorInput {
- /**
- * Returns the local file system path of the file underlying this editor input.
- *
- * @return a local file system path
- */
- IPath getPath();
+ /**
+ * Returns the local file system path of the file underlying this editor input.
+ *
+ * @return a local file system path
+ */
+ IPath getPath();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPersistable.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPersistable.java
index b8e91c9837a..fbf76d8f32a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPersistable.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPersistable.java
@@ -13,18 +13,17 @@
*******************************************************************************/
package org.eclipse.ui;
-
/**
- * Objects implementing this interface are capable of saving their
- * state in an {@link IMemento}.
+ * Objects implementing this interface are capable of saving their state in an
+ * {@link IMemento}.
*
* @since 3.1
*/
public interface IPersistable {
- /**
- * Saves the state of the object in the given memento.
- *
- * @param memento the storage area for object's state
- */
- void saveState(IMemento memento);
+ /**
+ * Saves the state of the object in the given memento.
+ *
+ * @param memento the storage area for object's state
+ */
+ void saveState(IMemento memento);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPersistableEditor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPersistableEditor.java
index ddb4801975d..e694a3a717b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPersistableEditor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPersistableEditor.java
@@ -39,11 +39,10 @@ package org.eclipse.ui;
*/
public interface IPersistableEditor extends IPersistable {
/**
- * Called with a memento for this editor. The editor can parse the data or
- * save the memento. This method may not be called.
+ * Called with a memento for this editor. The editor can parse the data or save
+ * the memento. This method may not be called.
*
- * @param memento
- * the saved state for this editor. May be <code>null</code>.
+ * @param memento the saved state for this editor. May be <code>null</code>.
*/
void restoreState(IMemento memento);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPersistableElement.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPersistableElement.java
index 43c7bf6214a..e9d1d4accd8 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPersistableElement.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPersistableElement.java
@@ -13,26 +13,25 @@
*******************************************************************************/
package org.eclipse.ui;
-
/**
* Interface for asking an object to store its state in a memento.
* <p>
- * This interface is typically included in interfaces where
- * persistance is required.
- * </p><p>
- * When the workbench is shutdown objects which implement this interface
- * will be persisted. At this time the <code>getFactoryId</code> method
- * is invoked to discover the id of the element factory that will be used
- * to re-create the object from a memento. Then the <code>saveState</code>
- * method is invoked to store the element data into a newly created memento.
- * The resulting mementos are collected up and written out to a single file.
+ * This interface is typically included in interfaces where persistance is
+ * required.
+ * </p>
+ * <p>
+ * When the workbench is shutdown objects which implement this interface will be
+ * persisted. At this time the <code>getFactoryId</code> method is invoked to
+ * discover the id of the element factory that will be used to re-create the
+ * object from a memento. Then the <code>saveState</code> method is invoked to
+ * store the element data into a newly created memento. The resulting mementos
+ * are collected up and written out to a single file.
* </p>
* <p>
- * During workbench startup these mementos are read from the file. The
- * factory Id for each is retrieved and mapped to an <code>IElementFactory</code>
- * which has been registered in the element factory extension point. If a
- * factory exists for the Id it will be engaged to re-create the original
- * object.
+ * During workbench startup these mementos are read from the file. The factory
+ * Id for each is retrieved and mapped to an <code>IElementFactory</code> which
+ * has been registered in the element factory extension point. If a factory
+ * exists for the Id it will be engaged to re-create the original object.
* </p>
*
* @see org.eclipse.core.runtime.IAdaptable
@@ -40,16 +39,16 @@ package org.eclipse.ui;
* @see org.eclipse.ui.IElementFactory
*/
public interface IPersistableElement extends IPersistable {
- /**
- * Returns the id of the element factory which should be used to re-create this
- * object.
- * <p>
- * Factory ids are declared in extensions to the standard extension point
- * <code>"org.eclipse.ui.elementFactories"</code>.
- * </p>
- *
- * @return the element factory id
- * @see IElementFactory
- */
- String getFactoryId();
+ /**
+ * Returns the id of the element factory which should be used to re-create this
+ * object.
+ * <p>
+ * Factory ids are declared in extensions to the standard extension point
+ * <code>"org.eclipse.ui.elementFactories"</code>.
+ * </p>
+ *
+ * @return the element factory id
+ * @see IElementFactory
+ */
+ String getFactoryId();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveDescriptor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveDescriptor.java
index c38be220e7b..03bc82eb3b0 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveDescriptor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveDescriptor.java
@@ -47,37 +47,37 @@ import org.eclipse.jface.resource.ImageDescriptor;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IPerspectiveDescriptor {
- /**
- * Returns the description of this perspective.
- * This is the value of its <code>"description"</code> attribute.
- *
- * @return the description
- * @since 3.0
- */
- String getDescription();
+ /**
+ * Returns the description of this perspective. This is the value of its
+ * <code>"description"</code> attribute.
+ *
+ * @return the description
+ * @since 3.0
+ */
+ String getDescription();
- /**
- * Returns this perspective's id. For perspectives declared via an extension,
- * this is the value of its <code>"id"</code> attribute.
- *
- * @return the perspective id
- */
- String getId();
+ /**
+ * Returns this perspective's id. For perspectives declared via an extension,
+ * this is the value of its <code>"id"</code> attribute.
+ *
+ * @return the perspective id
+ */
+ String getId();
- /**
- * Returns the descriptor of the image to show for this perspective.
- * If the extension for this perspective specifies an image, the descriptor
- * for it is returned. Otherwise a default image is returned.
- *
- * @return the descriptor of the image to show for this perspective
- */
- ImageDescriptor getImageDescriptor();
+ /**
+ * Returns the descriptor of the image to show for this perspective. If the
+ * extension for this perspective specifies an image, the descriptor for it is
+ * returned. Otherwise a default image is returned.
+ *
+ * @return the descriptor of the image to show for this perspective
+ */
+ ImageDescriptor getImageDescriptor();
- /**
- * Returns this perspective's label. For perspectives declared via an extension,
- * this is the value of its <code>"label"</code> attribute.
- *
- * @return the label
- */
- String getLabel();
+ /**
+ * Returns this perspective's label. For perspectives declared via an extension,
+ * this is the value of its <code>"label"</code> attribute.
+ *
+ * @return the label
+ */
+ String getLabel();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveFactory.java
index 896eaab41c9..25216130366 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveFactory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveFactory.java
@@ -75,17 +75,16 @@ package org.eclipse.ui;
* </p>
*/
public interface IPerspectiveFactory {
- /**
- * Creates the initial layout for a page.
- * <p>
- * Implementors of this method may add additional views to a
- * perspective. The perspective already contains an editor folder
- * identified by the result of <code>IPageLayout.getEditorArea()</code>.
- * Additional views should be added to the layout using this value as
- * the initial point of reference.
- * </p>
- *
- * @param layout the page layout
- */
- void createInitialLayout(IPageLayout layout);
+ /**
+ * Creates the initial layout for a page.
+ * <p>
+ * Implementors of this method may add additional views to a perspective. The
+ * perspective already contains an editor folder identified by the result of
+ * <code>IPageLayout.getEditorArea()</code>. Additional views should be added to
+ * the layout using this value as the initial point of reference.
+ * </p>
+ *
+ * @param layout the page layout
+ */
+ void createInitialLayout(IPageLayout layout);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveListener.java
index b761df2de67..424db981cb9 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveListener.java
@@ -23,26 +23,25 @@ package org.eclipse.ui;
* @see PerspectiveAdapter
*/
public interface IPerspectiveListener {
- /**
- * Notifies this listener that a perspective in the given page
- * has been activated.
- *
- * @param page the page containing the activated perspective
- * @param perspective the perspective descriptor that was activated
- * @see IWorkbenchPage#setPerspective
- */
- void perspectiveActivated(IWorkbenchPage page,
- IPerspectiveDescriptor perspective);
+ /**
+ * Notifies this listener that a perspective in the given page has been
+ * activated.
+ *
+ * @param page the page containing the activated perspective
+ * @param perspective the perspective descriptor that was activated
+ * @see IWorkbenchPage#setPerspective
+ */
+ void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective);
- /**
- * Notifies this listener that a perspective has changed in some way
- * (for example, editor area hidden, perspective reset,
- * view show/hide, editor open/close, etc).
- *
- * @param page the page containing the affected perspective
- * @param perspective the perspective descriptor
- * @param changeId one of the <code>CHANGE_*</code> constants on IWorkbenchPage
- */
- void perspectiveChanged(IWorkbenchPage page,
- IPerspectiveDescriptor perspective, String changeId);
+ /**
+ * Notifies this listener that a perspective has changed in some way (for
+ * example, editor area hidden, perspective reset, view show/hide, editor
+ * open/close, etc).
+ *
+ * @param page the page containing the affected perspective
+ * @param perspective the perspective descriptor
+ * @param changeId one of the <code>CHANGE_*</code> constants on
+ * IWorkbenchPage
+ */
+ void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveListener2.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveListener2.java
index 9a6edcef711..f1428fb9035 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveListener2.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveListener2.java
@@ -14,10 +14,10 @@
package org.eclipse.ui;
/**
- * Extension interface to <code>IPerspectiveListener</code> which
- * adds support for listening to part-specific perspective lifecycle events.
- * For example, this allows a perspective listener to determine which view
- * is being hidden during a <code>CHANGE_VIEW_HIDE</code> event.
+ * Extension interface to <code>IPerspectiveListener</code> which adds support
+ * for listening to part-specific perspective lifecycle events. For example,
+ * this allows a perspective listener to determine which view is being hidden
+ * during a <code>CHANGE_VIEW_HIDE</code> event.
* <p>
* This interface may be implemented by clients.
* </p>
@@ -28,16 +28,16 @@ package org.eclipse.ui;
*/
public interface IPerspectiveListener2 extends IPerspectiveListener {
- /**
- * Notifies this listener that a part in the given page's perspective
- * has changed in some way (for example, view show/hide, editor open/close, etc).
- *
- * @param page the workbench page containing the perspective
- * @param perspective the descriptor for the changed perspective
- * @param partRef the reference to the affected part
- * @param changeId one of the <code>CHANGE_*</code> constants on IWorkbenchPage
- */
- void perspectiveChanged(IWorkbenchPage page,
- IPerspectiveDescriptor perspective,
- IWorkbenchPartReference partRef, String changeId);
+ /**
+ * Notifies this listener that a part in the given page's perspective has
+ * changed in some way (for example, view show/hide, editor open/close, etc).
+ *
+ * @param page the workbench page containing the perspective
+ * @param perspective the descriptor for the changed perspective
+ * @param partRef the reference to the affected part
+ * @param changeId one of the <code>CHANGE_*</code> constants on
+ * IWorkbenchPage
+ */
+ void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, IWorkbenchPartReference partRef,
+ String changeId);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveListener3.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveListener3.java
index 43fb4c90ef5..80f3e3235b5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveListener3.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveListener3.java
@@ -14,8 +14,8 @@
package org.eclipse.ui;
/**
- * Extension interface to <code>IPerspectiveListener</code> which
- * adds support for listening to perspective open and close events.
+ * Extension interface to <code>IPerspectiveListener</code> which adds support
+ * for listening to perspective open and close events.
* <p>
* This interface may be implemented by clients.
* </p>
@@ -26,59 +26,45 @@ package org.eclipse.ui;
*/
public interface IPerspectiveListener3 extends IPerspectiveListener2 {
- /**
- * Notifies this listener that a perspective in the given page has been
- * opened.
- *
- * @param page
- * the page containing the opened perspective
- * @param perspective
- * the perspective descriptor that was opened
- * @see IWorkbenchPage#setPerspective(IPerspectiveDescriptor)
- */
- void perspectiveOpened(IWorkbenchPage page,
- IPerspectiveDescriptor perspective);
+ /**
+ * Notifies this listener that a perspective in the given page has been opened.
+ *
+ * @param page the page containing the opened perspective
+ * @param perspective the perspective descriptor that was opened
+ * @see IWorkbenchPage#setPerspective(IPerspectiveDescriptor)
+ */
+ void perspectiveOpened(IWorkbenchPage page, IPerspectiveDescriptor perspective);
- /**
- * Notifies this listener that a perspective in the given page has been
- * closed.
- *
- * @param page
- * the page containing the closed perspective
- * @param perspective
- * the perspective descriptor that was closed
- * @see IWorkbenchPage#closePerspective(IPerspectiveDescriptor, boolean, boolean)
- * @see IWorkbenchPage#closeAllPerspectives(boolean, boolean)
- */
- void perspectiveClosed(IWorkbenchPage page,
- IPerspectiveDescriptor perspective);
+ /**
+ * Notifies this listener that a perspective in the given page has been closed.
+ *
+ * @param page the page containing the closed perspective
+ * @param perspective the perspective descriptor that was closed
+ * @see IWorkbenchPage#closePerspective(IPerspectiveDescriptor, boolean,
+ * boolean)
+ * @see IWorkbenchPage#closeAllPerspectives(boolean, boolean)
+ */
+ void perspectiveClosed(IWorkbenchPage page, IPerspectiveDescriptor perspective);
- /**
- * Notifies this listener that a perspective in the given page has been
- * deactivated.
- *
- * @param page
- * the page containing the deactivated perspective
- * @param perspective
- * the perspective descriptor that was deactivated
- * @see IWorkbenchPage#setPerspective(IPerspectiveDescriptor)
- */
- void perspectiveDeactivated(IWorkbenchPage page,
- IPerspectiveDescriptor perspective);
+ /**
+ * Notifies this listener that a perspective in the given page has been
+ * deactivated.
+ *
+ * @param page the page containing the deactivated perspective
+ * @param perspective the perspective descriptor that was deactivated
+ * @see IWorkbenchPage#setPerspective(IPerspectiveDescriptor)
+ */
+ void perspectiveDeactivated(IWorkbenchPage page, IPerspectiveDescriptor perspective);
- /**
- * Notifies this listener that a perspective in the given page has been
- * saved as a new perspective with a different perspective descriptor.
- *
- * @param page
- * the page containing the saved perspective
- * @param oldPerspective
- * the old perspective descriptor
- * @param newPerspective
- * the new perspective descriptor
- * @see IWorkbenchPage#savePerspectiveAs(IPerspectiveDescriptor)
- */
- void perspectiveSavedAs(IWorkbenchPage page,
- IPerspectiveDescriptor oldPerspective,
- IPerspectiveDescriptor newPerspective);
+ /**
+ * Notifies this listener that a perspective in the given page has been saved as
+ * a new perspective with a different perspective descriptor.
+ *
+ * @param page the page containing the saved perspective
+ * @param oldPerspective the old perspective descriptor
+ * @param newPerspective the new perspective descriptor
+ * @see IWorkbenchPage#savePerspectiveAs(IPerspectiveDescriptor)
+ */
+ void perspectiveSavedAs(IWorkbenchPage page, IPerspectiveDescriptor oldPerspective,
+ IPerspectiveDescriptor newPerspective);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveListener4.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveListener4.java
index 5f03030c239..0f9845e4ec2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveListener4.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveListener4.java
@@ -29,20 +29,17 @@ package org.eclipse.ui;
public interface IPerspectiveListener4 extends IPerspectiveListener3 {
/**
* <p>
- * Notifies this listener that a perspective in the given page is about to
- * be deactivated.
+ * Notifies this listener that a perspective in the given page is about to be
+ * deactivated.
* </p>
* <p>
* Note: This does not have the ability to veto a perspective deactivation.
* </p>
*
- * @param page
- * the page containing the deactivated perspective
- * @param perspective
- * the perspective descriptor that was deactivated
+ * @param page the page containing the deactivated perspective
+ * @param perspective the perspective descriptor that was deactivated
* @see IWorkbenchPage#setPerspective(IPerspectiveDescriptor)
*/
- void perspectivePreDeactivate(IWorkbenchPage page,
- IPerspectiveDescriptor perspective);
+ void perspectivePreDeactivate(IWorkbenchPage page, IPerspectiveDescriptor perspective);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveRegistry.java
index 4f200fcf0a7..40936a27ba1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveRegistry.java
@@ -20,27 +20,30 @@ package org.eclipse.ui;
* It is initially populated with stock perspectives from the workbench's
* perspective extension point (<code>"org.eclipse.ui.perspectives"</code>) and
* with custom perspectives defined by the user.
- * </p><p>
+ * </p>
+ * <p>
* This interface is not intended to be implemented by clients.
* </p>
+ *
* @see IWorkbench#getPerspectiveRegistry
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IPerspectiveRegistry {
- /**
- * Clones an existing perspective.
- *
- * @param id the id for the cloned perspective, which must not already be used by
- * any registered perspective
- * @param label the label assigned to the cloned perspective
- * @param desc the perspective to clone
- * @return the cloned perspective descriptor
- * @throws IllegalArgumentException if there is already a perspective with the given id
- *
- * @since 3.0
- */
- IPerspectiveDescriptor clonePerspective(String id, String label,
- IPerspectiveDescriptor desc) throws IllegalArgumentException;
+ /**
+ * Clones an existing perspective.
+ *
+ * @param id the id for the cloned perspective, which must not already be
+ * used by any registered perspective
+ * @param label the label assigned to the cloned perspective
+ * @param desc the perspective to clone
+ * @return the cloned perspective descriptor
+ * @throws IllegalArgumentException if there is already a perspective with the
+ * given id
+ *
+ * @since 3.0
+ */
+ IPerspectiveDescriptor clonePerspective(String id, String label, IPerspectiveDescriptor desc)
+ throws IllegalArgumentException;
/**
* Deletes a perspective. Has no effect if the perspective is defined in an
@@ -51,61 +54,61 @@ public interface IPerspectiveRegistry {
*/
void deletePerspective(IPerspectiveDescriptor persp);
- /**
- * Finds and returns the registered perspective with the given perspective id.
- *
- * @param perspectiveId the perspective id
- * @return the perspective, or <code>null</code> if none
- * @see IPerspectiveDescriptor#getId
- */
- IPerspectiveDescriptor findPerspectiveWithId(String perspectiveId);
+ /**
+ * Finds and returns the registered perspective with the given perspective id.
+ *
+ * @param perspectiveId the perspective id
+ * @return the perspective, or <code>null</code> if none
+ * @see IPerspectiveDescriptor#getId
+ */
+ IPerspectiveDescriptor findPerspectiveWithId(String perspectiveId);
- /**
- * Finds and returns the registered perspective with the given label.
- *
- * @param label the label
- * @return the perspective, or <code>null</code> if none
- * @see IPerspectiveDescriptor#getLabel
- */
- IPerspectiveDescriptor findPerspectiveWithLabel(String label);
+ /**
+ * Finds and returns the registered perspective with the given label.
+ *
+ * @param label the label
+ * @return the perspective, or <code>null</code> if none
+ * @see IPerspectiveDescriptor#getLabel
+ */
+ IPerspectiveDescriptor findPerspectiveWithLabel(String label);
- /**
- * Returns the id of the default perspective for the workbench. This identifies one
- * perspective extension within the workbench's perspective registry.
- * <p>
- * Returns <code>null</code> if there is no default perspective.
- * </p>
- *
- * @return the default perspective id, or <code>null</code>
- */
- String getDefaultPerspective();
+ /**
+ * Returns the id of the default perspective for the workbench. This identifies
+ * one perspective extension within the workbench's perspective registry.
+ * <p>
+ * Returns <code>null</code> if there is no default perspective.
+ * </p>
+ *
+ * @return the default perspective id, or <code>null</code>
+ */
+ String getDefaultPerspective();
- /**
- * Returns a list of the perspectives known to the workbench.
- *
- * @return a list of perspectives
- */
- IPerspectiveDescriptor[] getPerspectives();
+ /**
+ * Returns a list of the perspectives known to the workbench.
+ *
+ * @return a list of perspectives
+ */
+ IPerspectiveDescriptor[] getPerspectives();
- /**
- * Sets the default perspective for the workbench to the given perspective id.
- * If non-<code>null</code>, the id must correspond to a perspective extension
- * within the workbench's perspective registry.
- * <p>
- * A <code>null</code> id indicates no default perspective.
- * </p>
- *
- * @param id a perspective id, or <code>null</code>
- */
- void setDefaultPerspective(String id);
+ /**
+ * Sets the default perspective for the workbench to the given perspective id.
+ * If non-<code>null</code>, the id must correspond to a perspective extension
+ * within the workbench's perspective registry.
+ * <p>
+ * A <code>null</code> id indicates no default perspective.
+ * </p>
+ *
+ * @param id a perspective id, or <code>null</code>
+ */
+ void setDefaultPerspective(String id);
- /**
- * Reverts a perspective back to its original definition
- * as specified in the plug-in manifest.
- *
- * @param perspToRevert the perspective to revert
- *
- * @since 3.0
- */
- void revertPerspective(IPerspectiveDescriptor perspToRevert);
+ /**
+ * Reverts a perspective back to its original definition as specified in the
+ * plug-in manifest.
+ *
+ * @param perspToRevert the perspective to revert
+ *
+ * @since 3.0
+ */
+ void revertPerspective(IPerspectiveDescriptor perspToRevert);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPlaceholderFolderLayout.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPlaceholderFolderLayout.java
index cb092125619..45e22a73976 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPlaceholderFolderLayout.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPlaceholderFolderLayout.java
@@ -15,9 +15,9 @@
package org.eclipse.ui;
/**
- * An <code>IPlaceholderFolderLayout</code> is used to define the initial
- * view placeholders within a folder.
- * The folder itself is contained within an <code>IPageLayout</code>.
+ * An <code>IPlaceholderFolderLayout</code> is used to define the initial view
+ * placeholders within a folder. The folder itself is contained within an
+ * <code>IPageLayout</code>.
* <p>
* This interface is not intended to be implemented by clients.
* </p>
@@ -28,54 +28,48 @@ package org.eclipse.ui;
*/
public interface IPlaceholderFolderLayout {
- /**
- * Adds a view placeholder to this folder.
- * A view placeholder is used to define the position of a view before the view
- * appears. Initially, it is invisible; however, if the user ever opens a view
- * whose compound id matches the placeholder, the view will appear at the same
- * location as the placeholder.
- * See the {@link IPageLayout} type documentation for more details about compound ids.
- * If the placeholder contains wildcards, it remains in the layout, otherwise
- * it is replaced by the view.
- * If the primary id of the placeholder has no wildcards, it must refer to a view
- * contributed to the workbench's view extension point
- * (named <code>"org.eclipse.ui.views"</code>).
- *
- * @param viewId the compound view id (wildcards allowed)
- */
- void addPlaceholder(String viewId);
+ /**
+ * Adds a view placeholder to this folder. A view placeholder is used to define
+ * the position of a view before the view appears. Initially, it is invisible;
+ * however, if the user ever opens a view whose compound id matches the
+ * placeholder, the view will appear at the same location as the placeholder.
+ * See the {@link IPageLayout} type documentation for more details about
+ * compound ids. If the placeholder contains wildcards, it remains in the
+ * layout, otherwise it is replaced by the view. If the primary id of the
+ * placeholder has no wildcards, it must refer to a view contributed to the
+ * workbench's view extension point (named <code>"org.eclipse.ui.views"</code>).
+ *
+ * @param viewId the compound view id (wildcards allowed)
+ */
+ void addPlaceholder(String viewId);
- /**
+ /**
* Returns the property with the given id or <code>null</code>. Folder
- * properties are an extensible mechanism for perspective authors to
- * customize the appearance of view stacks. The list of customizable
- * properties is determined by the presentation factory.
+ * properties are an extensible mechanism for perspective authors to customize
+ * the appearance of view stacks. The list of customizable properties is
+ * determined by the presentation factory.
*
- * @param id
- * Must not be <code>null</code>.
- * @return property value, or <code>null</code> if the property is not
- * set.
+ * @param id Must not be <code>null</code>.
+ * @return property value, or <code>null</code> if the property is not set.
* @since 3.3
*/
- String getProperty(String id);
+ String getProperty(String id);
- /**
+ /**
* Sets the given property to the given value. Folder properties are an
- * extensible mechanism for perspective authors to customize the appearance
- * of view stacks. The list of customizable properties is determined by the
+ * extensible mechanism for perspective authors to customize the appearance of
+ * view stacks. The list of customizable properties is determined by the
* presentation factory.
* <p>
* These folder properties are intended to be set during
- * <code>IPerspectiveFactory#createInitialLayout</code>. Any subsequent
- * changes to property values after this method completes will not fire
- * change notifications and will not be reflected in the presentation.
+ * <code>IPerspectiveFactory#createInitialLayout</code>. Any subsequent changes
+ * to property values after this method completes will not fire change
+ * notifications and will not be reflected in the presentation.
* </p>
*
- * @param id
- * property id. Must not be <code>null</code>.
- * @param value
- * property value. <code>null</code> will clear the property.
+ * @param id property id. Must not be <code>null</code>.
+ * @param value property value. <code>null</code> will clear the property.
* @since 3.3
*/
- void setProperty(String id, String value);
+ void setProperty(String id, String value);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPluginContribution.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPluginContribution.java
index 42eb3bbd8e5..11626c2773d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPluginContribution.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPluginContribution.java
@@ -23,16 +23,16 @@ package org.eclipse.ui;
*/
public interface IPluginContribution {
- /**
- * @return the local id of the contribution. Must not be <code>null</code>.
- * This should correspond to the extension-specific identifier for
- * a given contribution.
- */
- String getLocalId();
+ /**
+ * @return the local id of the contribution. Must not be <code>null</code>. This
+ * should correspond to the extension-specific identifier for a given
+ * contribution.
+ */
+ String getLocalId();
- /**
- * @return the id of the originating plugin. Can be <code>null</code> if
- * this contribution did not originate from a plugin.
- */
- String getPluginId();
+ /**
+ * @return the id of the originating plugin. Can be <code>null</code> if this
+ * contribution did not originate from a plugin.
+ */
+ String getPluginId();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPropertyListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPropertyListener.java
index f914191fdbb..c45b7fb845f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPropertyListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPropertyListener.java
@@ -22,12 +22,12 @@ package org.eclipse.ui;
* @see IWorkbenchPart#addPropertyListener
*/
public interface IPropertyListener {
- /**
- * Indicates that a property has changed.
- *
- * @param source the object whose property has changed
- * @param propId the id of the property which has changed; property ids
- * are generally defined as constants on the source class
- */
- void propertyChanged(Object source, int propId);
+ /**
+ * Indicates that a property has changed.
+ *
+ * @param source the object whose property has changed
+ * @param propId the id of the property which has changed; property ids are
+ * generally defined as constants on the source class
+ */
+ void propertyChanged(Object source, int propId);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IReusableEditor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IReusableEditor.java
index 2b91950bd06..83627eaed4e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IReusableEditor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IReusableEditor.java
@@ -16,20 +16,19 @@ package org.eclipse.ui;
/**
* Interface for reusable editors.
*
- * An editors may support changing its input so that
- * the workbench may change its contents instead of
- * opening a new editor.
+ * An editors may support changing its input so that the workbench may change
+ * its contents instead of opening a new editor.
*/
public interface IReusableEditor extends IEditorPart {
- /**
- * Sets the input to this editor.
- *
- * <p><b>Note:</b> Clients must fire the {@link IEditorPart#PROP_INPUT }
- * property change within their implementation of
- * <code>setInput()</code>.<p>
- *
- * @param input the editor input
- */
- void setInput(IEditorInput input);
+ /**
+ * Sets the input to this editor.
+ *
+ * <p>
+ * <b>Note:</b> Clients must fire the {@link IEditorPart#PROP_INPUT } property
+ * change within their implementation of <code>setInput()</code>.
+ * <p>
+ *
+ * @param input the editor input
+ */
+ void setInput(IEditorInput input);
}
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISaveableFilter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISaveableFilter.java
index 016453f859d..0b627bd49e2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISaveableFilter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISaveableFilter.java
@@ -16,16 +16,19 @@ package org.eclipse.ui;
/**
* A filter for selecting Saveables.
- * @see IWorkbench#saveAll(org.eclipse.jface.window.IShellProvider, org.eclipse.jface.operation.IRunnableContext, ISaveableFilter, boolean)
+ *
+ * @see IWorkbench#saveAll(org.eclipse.jface.window.IShellProvider,
+ * org.eclipse.jface.operation.IRunnableContext, ISaveableFilter, boolean)
* @since 3.3
*/
public interface ISaveableFilter {
/**
* Indicate whether the given saveable matches this filter.
- * @param saveable the saveable being tested
+ *
+ * @param saveable the saveable being tested
* @param containingParts the parts that contain the saveable. This list may
- * contain zero or more parts.
+ * contain zero or more parts.
* @return whether the given saveable matches this filter
*/
boolean select(Saveable saveable, IWorkbenchPart[] containingParts);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISaveablePart.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISaveablePart.java
index e6c81c61f62..23f28c5cbb3 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISaveablePart.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISaveablePart.java
@@ -17,85 +17,83 @@ package org.eclipse.ui;
import org.eclipse.core.runtime.IProgressMonitor;
/**
- * Workbench parts implement or adapt to this interface to participate
- * in the enablement and execution of the <code>Save</code> and
- * <code>Save As</code> actions.
+ * Workbench parts implement or adapt to this interface to participate in the
+ * enablement and execution of the <code>Save</code> and <code>Save As</code>
+ * actions.
*
* @since 2.1
* @see org.eclipse.ui.IEditorPart
*/
public interface ISaveablePart {
- /**
- * The property id for <code>isDirty</code>.
- */
- int PROP_DIRTY = IWorkbenchPartConstants.PROP_DIRTY;
+ /**
+ * The property id for <code>isDirty</code>.
+ */
+ int PROP_DIRTY = IWorkbenchPartConstants.PROP_DIRTY;
- /**
- * Saves the contents of this part.
- * <p>
- * If the save is successful, the part should fire a property changed event
- * reflecting the new dirty state (<code>PROP_DIRTY</code> property).
- * </p>
- * <p>
- * If the save is cancelled through user action, or for any other reason, the
- * part should invoke <code>setCancelled</code> on the <code>IProgressMonitor</code>
- * to inform the caller.
- * </p>
- * <p>
- * This method is long-running; progress and cancellation are provided
- * by the given progress monitor.
- * </p>
- *
- * @param monitor the progress monitor
- */
- void doSave(IProgressMonitor monitor);
+ /**
+ * Saves the contents of this part.
+ * <p>
+ * If the save is successful, the part should fire a property changed event
+ * reflecting the new dirty state (<code>PROP_DIRTY</code> property).
+ * </p>
+ * <p>
+ * If the save is cancelled through user action, or for any other reason, the
+ * part should invoke <code>setCancelled</code> on the
+ * <code>IProgressMonitor</code> to inform the caller.
+ * </p>
+ * <p>
+ * This method is long-running; progress and cancellation are provided by the
+ * given progress monitor.
+ * </p>
+ *
+ * @param monitor the progress monitor
+ */
+ void doSave(IProgressMonitor monitor);
- /**
- * Saves the contents of this part to another object.
- * <p>
- * Implementors are expected to open a "Save As" dialog where the user will
- * be able to select a new name for the contents. After the selection is made,
- * the contents should be saved to that new name. During this operation a
- * <code>IProgressMonitor</code> should be used to indicate progress.
- * </p>
- * <p>
- * If the save is successful, the part fires a property changed event
- * reflecting the new dirty state (<code>PROP_DIRTY</code> property).
- * </p>
- */
- void doSaveAs();
+ /**
+ * Saves the contents of this part to another object.
+ * <p>
+ * Implementors are expected to open a "Save As" dialog where the user will be
+ * able to select a new name for the contents. After the selection is made, the
+ * contents should be saved to that new name. During this operation a
+ * <code>IProgressMonitor</code> should be used to indicate progress.
+ * </p>
+ * <p>
+ * If the save is successful, the part fires a property changed event reflecting
+ * the new dirty state (<code>PROP_DIRTY</code> property).
+ * </p>
+ */
+ void doSaveAs();
- /**
- * Returns whether the contents of this part have changed since the last save
- * operation. If this value changes the part must fire a property listener
- * event with <code>PROP_DIRTY</code>.
- * <p>
- * <b>Note:</b> this method is called often on a part open or part
- * activation switch, for example by actions to determine their
- * enabled status.
- * </p>
- *
- * @return <code>true</code> if the contents have been modified and need
- * saving, and <code>false</code> if they have not changed since the last
- * save
- */
- boolean isDirty();
+ /**
+ * Returns whether the contents of this part have changed since the last save
+ * operation. If this value changes the part must fire a property listener event
+ * with <code>PROP_DIRTY</code>.
+ * <p>
+ * <b>Note:</b> this method is called often on a part open or part activation
+ * switch, for example by actions to determine their enabled status.
+ * </p>
+ *
+ * @return <code>true</code> if the contents have been modified and need saving,
+ * and <code>false</code> if they have not changed since the last save
+ */
+ boolean isDirty();
- /**
- * Returns whether the "Save As" operation is supported by this part.
- *
- * @return <code>true</code> if "Save As" is supported, and <code>false</code>
- * if not supported
- */
- boolean isSaveAsAllowed();
+ /**
+ * Returns whether the "Save As" operation is supported by this part.
+ *
+ * @return <code>true</code> if "Save As" is supported, and <code>false</code>
+ * if not supported
+ */
+ boolean isSaveAsAllowed();
- /**
- * Returns whether the contents of this part should be saved when the part
- * is closed.
- *
- * @return <code>true</code> if the contents of the part should be saved on
- * close, and <code>false</code> if the contents are expendable
- */
- boolean isSaveOnCloseNeeded();
+ /**
+ * Returns whether the contents of this part should be saved when the part is
+ * closed.
+ *
+ * @return <code>true</code> if the contents of the part should be saved on
+ * close, and <code>false</code> if the contents are expendable
+ */
+ boolean isSaveOnCloseNeeded();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISaveablePart2.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISaveablePart2.java
index ef5cadee6a3..430094d3efc 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISaveablePart2.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISaveablePart2.java
@@ -15,16 +15,14 @@
package org.eclipse.ui;
/**
- * Workbench parts implement or adapt to this interface to participate
- * in actions that require a prompt for the user to provide input on
- * what to do with unsaved data when the part is closed or the Workbench
- * is shut down.
+ * Workbench parts implement or adapt to this interface to participate in
+ * actions that require a prompt for the user to provide input on what to do
+ * with unsaved data when the part is closed or the Workbench is shut down.
* <p>
- * Note that if a part implements this interface, it is excluded from the
- * common "prompt to save" dialog, and instead opens its own dialog. This may
- * cause multiple prompts to the end user during a single user operation.
- * Implementors should be aware that this may lead to a less than optimal
- * user experience.
+ * Note that if a part implements this interface, it is excluded from the common
+ * "prompt to save" dialog, and instead opens its own dialog. This may cause
+ * multiple prompts to the end user during a single user operation. Implementors
+ * should be aware that this may lead to a less than optimal user experience.
* </p>
*
* @since 3.1
@@ -32,42 +30,41 @@ package org.eclipse.ui;
public interface ISaveablePart2 extends ISaveablePart {
/**
- * Standard return code constant (value 0) indicating that the part
- * needs to be saved.
+ * Standard return code constant (value 0) indicating that the part needs to be
+ * saved.
*/
int YES = 0;
/**
- * Standard return code constant (value 1) indicating that the part
- * does not need to be saved and the part should be closed.
+ * Standard return code constant (value 1) indicating that the part does not
+ * need to be saved and the part should be closed.
*/
int NO = 1;
/**
- * Standard return code constant (value 2) indicating that the part
- * does not need to be saved and the part should not be closed.
+ * Standard return code constant (value 2) indicating that the part does not
+ * need to be saved and the part should not be closed.
*/
int CANCEL = 2;
/**
- * Standard return code constant (value 3) indicating that the default
- * behavior for prompting the user to save will be used.
+ * Standard return code constant (value 3) indicating that the default behavior
+ * for prompting the user to save will be used.
*/
int DEFAULT = 3;
- /**
- * Prompts the user for input on what to do with unsaved data.
- * This method is only called when the part is closed or when
- * the Workbench is shutting down.
- * <p>
- * Implementors are expected to open a custom dialog where the
- * user will be able to determine what to do with the unsaved data.
- * Implementors may also return a result of <code>DEFAULT</code>
- * to get the default prompt handling from the Workbench.
- * </p>
- *
- * @return the return code, must be either <code>YES</code>,
- * <code>NO</code>, <code>CANCEL</code> or <code>DEFAULT</code>.
+ /**
+ * Prompts the user for input on what to do with unsaved data. This method is
+ * only called when the part is closed or when the Workbench is shutting down.
+ * <p>
+ * Implementors are expected to open a custom dialog where the user will be able
+ * to determine what to do with the unsaved data. Implementors may also return a
+ * result of <code>DEFAULT</code> to get the default prompt handling from the
+ * Workbench.
+ * </p>
+ *
+ * @return the return code, must be either <code>YES</code>, <code>NO</code>,
+ * <code>CANCEL</code> or <code>DEFAULT</code>.
*/
int promptToSaveOnClose();
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISaveablesSource.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISaveablesSource.java
index 987e976e0d1..cd4da8eda51 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISaveablesSource.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISaveablesSource.java
@@ -61,32 +61,31 @@ import org.eclipse.ui.part.EditorPart;
public interface ISaveablesSource {
/**
- * Returns the saveables presented by the workbench part. If the return
- * value of this method changes during the lifetime of
- * this part (i.e. after initialization and control creation but before disposal)
- * the part must notify an implicit listener using
+ * Returns the saveables presented by the workbench part. If the return value of
+ * this method changes during the lifetime of this part (i.e. after
+ * initialization and control creation but before disposal) the part must notify
+ * an implicit listener using
* {@link ISaveablesLifecycleListener#handleLifecycleEvent(SaveablesLifecycleEvent)}.
* <p>
- * Additions of saveables to the list of saveables of this part are
- * announced using an event of type
- * {@link SaveablesLifecycleEvent#POST_OPEN}. Removals are announced in a
- * two-stage process, first using an event of type
+ * Additions of saveables to the list of saveables of this part are announced
+ * using an event of type {@link SaveablesLifecycleEvent#POST_OPEN}. Removals
+ * are announced in a two-stage process, first using an event of type
* {@link SaveablesLifecycleEvent#PRE_CLOSE} followed by an event of type
* {@link SaveablesLifecycleEvent#POST_CLOSE}. Since firing the
- * <code>PRE_CLOSE</code> event may trigger prompts to save dirty
- * saveables, the cancellation status of the event must be checked by the
- * part after the notification. When removing only non-dirty saveables,
- * <code>POST_CLOSE</code> notification is sufficient.
+ * <code>PRE_CLOSE</code> event may trigger prompts to save dirty saveables, the
+ * cancellation status of the event must be checked by the part after the
+ * notification. When removing only non-dirty saveables, <code>POST_CLOSE</code>
+ * notification is sufficient.
* </p>
* <p>
* The listener is obtained from the part site by calling
* <code>partSite.getService(ISaveablesLifecycleListener.class)</code>.
* </p>
* <p>
- * The part must not notify from its initialization methods (e.g. <code>init</code>
- * or <code>createPartControl</code>), or from its dispose method. Parts that
- * implement {@link IReusableEditor} must notify when their input is changed
- * through {@link IReusableEditor#setInput(IEditorInput)}.
+ * The part must not notify from its initialization methods (e.g.
+ * <code>init</code> or <code>createPartControl</code>), or from its dispose
+ * method. Parts that implement {@link IReusableEditor} must notify when their
+ * input is changed through {@link IReusableEditor#setInput(IEditorInput)}.
* </p>
*
* @return the saveables presented by the workbench part
@@ -98,9 +97,9 @@ public interface ISaveablesSource {
/**
* Returns the saveables currently active in the workbench part.
* <p>
- * Certain workbench actions, such as Save, target only the active saveables
- * in the active part. For example, the active saveables could be determined
- * based on the current selection in the part.
+ * Certain workbench actions, such as Save, target only the active saveables in
+ * the active part. For example, the active saveables could be determined based
+ * on the current selection in the part.
* </p>
*
* @return the saveables currently active in the workbench part
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISecondarySaveableSource.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISecondarySaveableSource.java
index 82118ba847d..3f5344e2135 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISecondarySaveableSource.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISecondarySaveableSource.java
@@ -44,12 +44,12 @@ import org.eclipse.core.runtime.IAdaptable;
public interface ISecondarySaveableSource {
/**
- * Whether the dirty state changes should be supported by the framework if
- * the part directly implements {@link ISecondarySaveableSource}.
+ * Whether the dirty state changes should be supported by the framework if the
+ * part directly implements {@link ISecondarySaveableSource}.
* <p>
* If the part providing the adapter is not implementing
- * {@link ISecondarySaveableSource}, return value defines the default
- * behavior of "secondary" parts connected to this part.
+ * {@link ISecondarySaveableSource}, return value defines the default behavior
+ * of "secondary" parts connected to this part.
*
* @return default implementation returns {@code false}
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISelectionListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISelectionListener.java
index 97e8078c4bc..4d674a72ea3 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISelectionListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISelectionListener.java
@@ -28,19 +28,19 @@ import org.eclipse.jface.viewers.ISelection;
* @see org.eclipse.ui.INullSelectionListener
*/
public interface ISelectionListener extends EventListener {
- /**
- * Notifies this listener that the selection has changed.
- * <p>
- * This method is called when the selection changes from one to a
- * <code>non-null</code> value, but not when the selection changes to
- * <code>null</code>. If there is a requirement to be notified in the latter
- * scenario, implement <code>INullSelectionListener</code>. The event will
- * be posted through this method.
- * </p>
- *
- * @param part the workbench part containing the selection
- * @param selection the current selection. This may be <code>null</code>
- * if <code>INullSelectionListener</code> is implemented.
- */
- void selectionChanged(IWorkbenchPart part, ISelection selection);
+ /**
+ * Notifies this listener that the selection has changed.
+ * <p>
+ * This method is called when the selection changes from one to a
+ * <code>non-null</code> value, but not when the selection changes to
+ * <code>null</code>. If there is a requirement to be notified in the latter
+ * scenario, implement <code>INullSelectionListener</code>. The event will be
+ * posted through this method.
+ * </p>
+ *
+ * @param part the workbench part containing the selection
+ * @param selection the current selection. This may be <code>null</code> if
+ * <code>INullSelectionListener</code> is implemented.
+ */
+ void selectionChanged(IWorkbenchPart part, ISelection selection);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISelectionService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISelectionService.java
index a80ab33ff24..c191f6cd054 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISelectionService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISelectionService.java
@@ -39,143 +39,145 @@ import org.eclipse.jface.viewers.ISelection;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ISelectionService {
- /**
- * Adds the given selection listener.
- * Has no effect if an identical listener is already registered.
+ /**
+ * Adds the given selection listener. Has no effect if an identical listener is
+ * already registered.
* <p>
- * <b>Note:</b> listeners should be removed when no longer necessary. If
- * not, they will be removed when the IServiceLocator used to acquire this
- * service is disposed.
+ * <b>Note:</b> listeners should be removed when no longer necessary. If not,
+ * they will be removed when the IServiceLocator used to acquire this service is
+ * disposed.
* </p>
- *
- * @param listener a selection listener
- * @see #removeSelectionListener(ISelectionListener)
- */
- void addSelectionListener(ISelectionListener listener);
+ *
+ * @param listener a selection listener
+ * @see #removeSelectionListener(ISelectionListener)
+ */
+ void addSelectionListener(ISelectionListener listener);
- /**
- * Adds a part-specific selection listener which is notified when selection changes
- * in the part with the given id. This is independent of part activation - the part
- * need not be active for notification to be sent.
- * <p>
- * When the part is created, the listener is passed the part's initial selection.
- * When the part is disposed, the listener is passed a <code>null</code> selection,
- * but only if the listener implements <code>INullSelectionListener</code>.
- * </p>
- * <p>
- * Note: This will not correctly track editor parts as each editor does
- * not have a unique partId.
- * </p>
+ /**
+ * Adds a part-specific selection listener which is notified when selection
+ * changes in the part with the given id. This is independent of part activation
+ * - the part need not be active for notification to be sent.
* <p>
- * <b>Note:</b> listeners should be removed when no longer necessary. If
- * not, they will be removed when the IServiceLocator used to acquire this
- * service is disposed.
+ * When the part is created, the listener is passed the part's initial
+ * selection. When the part is disposed, the listener is passed a
+ * <code>null</code> selection, but only if the listener implements
+ * <code>INullSelectionListener</code>.
* </p>
- *
- * @param partId the id of the part to track
- * @param listener a selection listener
- * @since 2.0
- * @see #removeSelectionListener(String, ISelectionListener)
- */
- void addSelectionListener(String partId, ISelectionListener listener);
+ * <p>
+ * Note: This will not correctly track editor parts as each editor does not have
+ * a unique partId.
+ * </p>
+ * <p>
+ * <b>Note:</b> listeners should be removed when no longer necessary. If not,
+ * they will be removed when the IServiceLocator used to acquire this service is
+ * disposed.
+ * </p>
+ *
+ * @param partId the id of the part to track
+ * @param listener a selection listener
+ * @since 2.0
+ * @see #removeSelectionListener(String, ISelectionListener)
+ */
+ void addSelectionListener(String partId, ISelectionListener listener);
- /**
- * Adds the given post selection listener.It is equivalent to selection
- * changed if the selection was triggered by the mouse but it has a
- * delay if the selection is triggered by the keyboard arrows.
- * Has no effect if an identical listener is already registered.
- *
- * Note: Works only for StructuredViewer(s).
+ /**
+ * Adds the given post selection listener.It is equivalent to selection changed
+ * if the selection was triggered by the mouse but it has a delay if the
+ * selection is triggered by the keyboard arrows. Has no effect if an identical
+ * listener is already registered.
+ *
+ * Note: Works only for StructuredViewer(s).
* <p>
- * <b>Note:</b> listeners should be removed when no longer necessary. If
- * not, they will be removed when the IServiceLocator used to acquire this
- * service is disposed.
+ * <b>Note:</b> listeners should be removed when no longer necessary. If not,
+ * they will be removed when the IServiceLocator used to acquire this service is
+ * disposed.
* </p>
- *
- * @param listener a selection listener
- * @see #removePostSelectionListener(ISelectionListener)
- */
- void addPostSelectionListener(ISelectionListener listener);
+ *
+ * @param listener a selection listener
+ * @see #removePostSelectionListener(ISelectionListener)
+ */
+ void addPostSelectionListener(ISelectionListener listener);
- /**
- * Adds a part-specific selection listener which is notified when selection changes
- * in the part with the given id. This is independent of part activation - the part
- * need not be active for notification to be sent.
- * <p>
- * When the part is created, the listener is passed the part's initial selection.
- * When the part is disposed, the listener is passed a <code>null</code> selection,
- * but only if the listener implements <code>INullSelectionListener</code>.
- * </p>
- * <p>
- * Note: This will not correctly track editor parts as each editor does
- * not have a unique partId.
- * </p>
+ /**
+ * Adds a part-specific selection listener which is notified when selection
+ * changes in the part with the given id. This is independent of part activation
+ * - the part need not be active for notification to be sent.
+ * <p>
+ * When the part is created, the listener is passed the part's initial
+ * selection. When the part is disposed, the listener is passed a
+ * <code>null</code> selection, but only if the listener implements
+ * <code>INullSelectionListener</code>.
+ * </p>
+ * <p>
+ * Note: This will not correctly track editor parts as each editor does not have
+ * a unique partId.
+ * </p>
* <p>
- * <b>Note:</b> listeners should be removed when no longer necessary. If
- * not, they will be removed when the IServiceLocator used to acquire this
- * service is disposed.
+ * <b>Note:</b> listeners should be removed when no longer necessary. If not,
+ * they will be removed when the IServiceLocator used to acquire this service is
+ * disposed.
* </p>
- *
- * @param partId the id of the part to track
- * @param listener a selection listener
- * @since 2.0
- * @see #removePostSelectionListener(String, ISelectionListener)
- */
+ *
+ * @param partId the id of the part to track
+ * @param listener a selection listener
+ * @since 2.0
+ * @see #removePostSelectionListener(String, ISelectionListener)
+ */
void addPostSelectionListener(String partId, ISelectionListener listener);
- /**
- * Returns the current selection in the active part. If the selection in the
- * active part is <em>undefined</em> (the active part has no selection provider)
- * the result will be <code>null</code>.
- *
- * @return the current selection, or <code>null</code> if undefined
- */
- ISelection getSelection();
+ /**
+ * Returns the current selection in the active part. If the selection in the
+ * active part is <em>undefined</em> (the active part has no selection provider)
+ * the result will be <code>null</code>.
+ *
+ * @return the current selection, or <code>null</code> if undefined
+ */
+ ISelection getSelection();
- /**
- * Returns the current selection in the part with the given id. If the part is not open,
- * or if the selection in the active part is <em>undefined</em> (the active part has no selection provider)
- * the result will be <code>null</code>.
- *
- * @param partId the id of the part
- * @return the current selection, or <code>null</code> if undefined
- * @since 2.0
- */
- ISelection getSelection(String partId);
+ /**
+ * Returns the current selection in the part with the given id. If the part is
+ * not open, or if the selection in the active part is <em>undefined</em> (the
+ * active part has no selection provider) the result will be <code>null</code>.
+ *
+ * @param partId the id of the part
+ * @return the current selection, or <code>null</code> if undefined
+ * @since 2.0
+ */
+ ISelection getSelection(String partId);
- /**
- * Removes the given selection listener.
- * Has no effect if an identical listener is not registered.
- *
- * @param listener a selection listener
- */
- void removeSelectionListener(ISelectionListener listener);
+ /**
+ * Removes the given selection listener. Has no effect if an identical listener
+ * is not registered.
+ *
+ * @param listener a selection listener
+ */
+ void removeSelectionListener(ISelectionListener listener);
- /**
- * Removes the given part-specific selection listener.
- * Has no effect if an identical listener is not registered for the given part id.
- *
- * @param partId the id of the part to track
- * @param listener a selection listener
- * @since 2.0
- */
+ /**
+ * Removes the given part-specific selection listener. Has no effect if an
+ * identical listener is not registered for the given part id.
+ *
+ * @param partId the id of the part to track
+ * @param listener a selection listener
+ * @since 2.0
+ */
void removeSelectionListener(String partId, ISelectionListener listener);
- /**
- * Removes the given post selection listener.
- * Has no effect if an identical listener is not registered.
- *
- * @param listener a selection listener
- */
- void removePostSelectionListener(ISelectionListener listener);
+ /**
+ * Removes the given post selection listener. Has no effect if an identical
+ * listener is not registered.
+ *
+ * @param listener a selection listener
+ */
+ void removePostSelectionListener(ISelectionListener listener);
- /**
- * Removes the given part-specific post selection listener.
- * Has no effect if an identical listener is not registered for the given part id.
- *
- * @param partId the id of the part to track
- * @param listener a selection listener
- * @since 2.0
- */
+ /**
+ * Removes the given part-specific post selection listener. Has no effect if an
+ * identical listener is not registered for the given part id.
+ *
+ * @param partId the id of the part to track
+ * @param listener a selection listener
+ * @since 2.0
+ */
void removePostSelectionListener(String partId, ISelectionListener listener);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISharedImages.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISharedImages.java
index 3ec7715c4c9..bd1807a194e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISharedImages.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISharedImages.java
@@ -20,603 +20,673 @@ import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
/**
- * A registry for common images used by the workbench which may be useful
- * to other plug-ins.
+ * A registry for common images used by the workbench which may be useful to
+ * other plug-ins.
* <p>
- * This class provides <code>Image</code> and <code>ImageDescriptor</code>s
- * for each named image in the interface. All <code>Image</code> objects provided
- * by this class are managed by this class and must never be disposed
- * by other clients.
+ * This class provides <code>Image</code> and <code>ImageDescriptor</code>s for
+ * each named image in the interface. All <code>Image</code> objects provided by
+ * this class are managed by this class and must never be disposed by other
+ * clients.
* </p>
* <p>
* This interface is not intended to be implemented by clients.
* </p>
+ *
* @noimplement This interface is not intended to be implemented by clients.
* @noextend This interface is not intended to be extended by clients.
*/
public interface ISharedImages {
- /**
- * Identifies the error overlay image.
- * @since 3.4
- */
+ /**
+ * Identifies the error overlay image.
+ *
+ * @since 3.4
+ */
String IMG_DEC_FIELD_ERROR = "IMG_DEC_FIELD_ERROR"; //$NON-NLS-1$
- /**
- * Identifies the warning overlay image.
- * @since 3.4
- */
+ /**
+ * Identifies the warning overlay image.
+ *
+ * @since 3.4
+ */
String IMG_DEC_FIELD_WARNING = "IMG_DEC_FIELD_WARNING"; //$NON-NLS-1$
- /**
- * Identifies the default image used for views.
- */
+ /**
+ * Identifies the default image used for views.
+ */
String IMG_DEF_VIEW = "IMG_DEF_VIEW"; //$NON-NLS-1$
- /**
- * Identifies the collapse all image in the enabled state.
- * @since 3.4
- */
+ /**
+ * Identifies the collapse all image in the enabled state.
+ *
+ * @since 3.4
+ */
String IMG_ELCL_COLLAPSEALL = "IMG_ELCL_COLLAPSEALL"; //$NON-NLS-1$
- /**
- * Identifies the collapse all image in the disabled state.
- * @since 3.4
- */
+ /**
+ * Identifies the collapse all image in the disabled state.
+ *
+ * @since 3.4
+ */
String IMG_ELCL_COLLAPSEALL_DISABLED = "IMG_ELCL_COLLAPSEALL_DISABLED"; //$NON-NLS-1$
- /**
- * Identifies the remove image in the enabled state.
- * @since 3.4
- */
+ /**
+ * Identifies the remove image in the enabled state.
+ *
+ * @since 3.4
+ */
String IMG_ELCL_REMOVE = "IMG_ELCL_REMOVE"; //$NON-NLS-1$
- /**
- * Identifies the remove image in the disabled state.
- * @since 3.4
- */
+ /**
+ * Identifies the remove image in the disabled state.
+ *
+ * @since 3.4
+ */
String IMG_ELCL_REMOVE_DISABLED = "IMG_ELCL_REMOVE_DISABLED"; //$NON-NLS-1$
- /**
- * Identifies the remove all image in the enabled state.
- * @since 3.4
- */
+ /**
+ * Identifies the remove all image in the enabled state.
+ *
+ * @since 3.4
+ */
String IMG_ELCL_REMOVEALL = "IMG_ELCL_REMOVEALL"; //$NON-NLS-1$
- /**
- * Identifies the remove all image in the disabled state.
- * @since 3.4
- */
+ /**
+ * Identifies the remove all image in the disabled state.
+ *
+ * @since 3.4
+ */
String IMG_ELCL_REMOVEALL_DISABLED = "IMG_ELCL_REMOVEALL_DISABLED"; //$NON-NLS-1$
- /**
- * Identifies the stop image in the enabled state.
- * @since 3.4
- */
+ /**
+ * Identifies the stop image in the enabled state.
+ *
+ * @since 3.4
+ */
String IMG_ELCL_STOP = "IMG_ELCL_STOP"; //$NON-NLS-1$
- /**
- * Identifies the stop image in the disabled state.
- * @since 3.4
- */
+ /**
+ * Identifies the stop image in the disabled state.
+ *
+ * @since 3.4
+ */
String IMG_ELCL_STOP_DISABLED = "IMG_ELCL_STOP_DISABLED"; //$NON-NLS-1$
- /**
- * Identifies the synchronize image in the enabled state.
- * @since 3.4
- */
+ /**
+ * Identifies the synchronize image in the enabled state.
+ *
+ * @since 3.4
+ */
String IMG_ELCL_SYNCED = "IMG_ELCL_SYNCED"; //$NON-NLS-1$
- /**
- * Identifies the synchronize image in the disabled state.
- * @since 3.4
- */
+ /**
+ * Identifies the synchronize image in the disabled state.
+ *
+ * @since 3.4
+ */
String IMG_ELCL_SYNCED_DISABLED = "IMG_ELCL_SYNCED_DISABLED"; //$NON-NLS-1$
- /**
- * Identifies the clear image in the enabled state.
- * @since 3.4
- */
+ /**
+ * Identifies the clear image in the enabled state.
+ *
+ * @since 3.4
+ */
String IMG_ETOOL_CLEAR = "IMG_ETOOL_CLEAR"; //$NON-NLS-1$
- /**
- * Identifies the clear image in the disabled state.
- * @since 3.4
- */
+ /**
+ * Identifies the clear image in the disabled state.
+ *
+ * @since 3.4
+ */
String IMG_ETOOL_CLEAR_DISABLED = "IMG_ETOOL_CLEAR_DISABLED"; //$NON-NLS-1$
- /**
- * Identifies the default perspective image.
- * @since 3.4
- */
+ /**
+ * Identifies the default perspective image.
+ *
+ * @since 3.4
+ */
String IMG_ETOOL_DEF_PERSPECTIVE = "IMG_ETOOL_DEF_PERSPECTIVE"; //$NON-NLS-1$
- /**
- * Identifies the delete image in the enabled state.
- * @since 3.4
- */
+ /**
+ * Identifies the delete image in the enabled state.
+ *
+ * @since 3.4
+ */
String IMG_ETOOL_DELETE = "IMG_ETOOL_DELETE"; //$NON-NLS-1$
- /**
- * Identifies the delete image in the disabled state.
- * @since 3.4
- */
+ /**
+ * Identifies the delete image in the disabled state.
+ *
+ * @since 3.4
+ */
String IMG_ETOOL_DELETE_DISABLED = "IMG_ETOOL_DELETE_DISABLED"; //$NON-NLS-1$
- /**
- * Identifies the home image in the enabled state.
- * @since 3.4
- */
+ /**
+ * Identifies the home image in the enabled state.
+ *
+ * @since 3.4
+ */
String IMG_ETOOL_HOME_NAV = "IMG_ETOOL_HOME_NAV"; //$NON-NLS-1$
- /**
- * Identifies the home image in the disabled state.
- * @since 3.4
- */
+ /**
+ * Identifies the home image in the disabled state.
+ *
+ * @since 3.4
+ */
String IMG_ETOOL_HOME_NAV_DISABLED = "IMG_ETOOL_HOME_NAV_DISABLED"; //$NON-NLS-1$
- /**
- * Identifies the print image in the enabled state.
- * @since 3.4
- */
+ /**
+ * Identifies the print image in the enabled state.
+ *
+ * @since 3.4
+ */
String IMG_ETOOL_PRINT_EDIT = "IMG_ETOOL_PRINT_EDIT"; //$NON-NLS-1$
- /**
- * Identifies the print image in the disabled state.
- * @since 3.4
- */
+ /**
+ * Identifies the print image in the disabled state.
+ *
+ * @since 3.4
+ */
String IMG_ETOOL_PRINT_EDIT_DISABLED = "IMG_ETOOL_PRINT_EDIT_DISABLED"; //$NON-NLS-1$
- /**
- * Identifies the save image in the enabled state.
- * @since 3.4
- */
+ /**
+ * Identifies the save image in the enabled state.
+ *
+ * @since 3.4
+ */
String IMG_ETOOL_SAVE_EDIT = "IMG_ETOOL_SAVE_EDIT"; //$NON-NLS-1$
- /**
- * Identifies the save image in the disabled state.
- * @since 3.4
- */
+ /**
+ * Identifies the save image in the disabled state.
+ *
+ * @since 3.4
+ */
String IMG_ETOOL_SAVE_EDIT_DISABLED = "IMG_ETOOL_SAVE_EDIT_DISABLED"; //$NON-NLS-1$
- /**
- * Identifies the save all image in the enabled state.
- * @since 3.4
- */
+ /**
+ * Identifies the save all image in the enabled state.
+ *
+ * @since 3.4
+ */
String IMG_ETOOL_SAVEALL_EDIT = "IMG_ETOOL_SAVEALL_EDIT"; //$NON-NLS-1$
- /**
- * Identifies the save all image in the disabled state.
- * @since 3.4
- */
+ /**
+ * Identifies the save all image in the disabled state.
+ *
+ * @since 3.4
+ */
String IMG_ETOOL_SAVEALL_EDIT_DISABLED = "IMG_ETOOL_SAVEALL_EDIT_DISABLED"; //$NON-NLS-1$
- /**
- * Identifies the save as image in the enabled state.
- * @since 3.4
- */
+ /**
+ * Identifies the save as image in the enabled state.
+ *
+ * @since 3.4
+ */
String IMG_ETOOL_SAVEAS_EDIT = "IMG_ETOOL_SAVEAS_EDIT"; //$NON-NLS-1$
- /**
- * Identifies the save as image in the disabled state.
- * @since 3.4
- */
+ /**
+ * Identifies the save as image in the disabled state.
+ *
+ * @since 3.4
+ */
String IMG_ETOOL_SAVEAS_EDIT_DISABLED = "IMG_ETOOL_SAVEAS_EDIT_DISABLED"; //$NON-NLS-1$
- /**
- * Identifies the help image.
- * @since 3.4
- */
+ /**
+ * Identifies the help image.
+ *
+ * @since 3.4
+ */
String IMG_LCL_LINKTO_HELP = "IMG_LCL_LINKTO_HELP"; //$NON-NLS-1$
- /**
- * Identifies the add image.
- * @since 3.4
- */
+ /**
+ * Identifies the add image.
+ *
+ * @since 3.4
+ */
String IMG_OBJ_ADD = "IMG_OBJ_ADD"; //$NON-NLS-1$
- /**
- * Identifies an element image.
- */
+ /**
+ * Identifies an element image.
+ */
String IMG_OBJ_ELEMENT = "IMG_OBJ_ELEMENTS"; //$NON-NLS-1$
- /**
- * Identifies a file image.
- */
+ /**
+ * Identifies a file image.
+ */
String IMG_OBJ_FILE = "IMG_OBJ_FILE"; //$NON-NLS-1$
- /**
- * Identifies a folder image.
- */
+ /**
+ * Identifies a folder image.
+ */
String IMG_OBJ_FOLDER = "IMG_OBJ_FOLDER"; //$NON-NLS-1$
- /**
- * Identifies a project image.
- *
- * @deprecated in 3.0. This image is IDE-specific, and is therefore found
- * only in IDE configurations. IDE-specific tools should use
- * <code>org.eclipse.ui.ide.IDE.SharedImages.IMG_OBJ_PROJECT</code> instead.
- */
- @Deprecated
+ /**
+ * Identifies a project image.
+ *
+ * @deprecated in 3.0. This image is IDE-specific, and is therefore found only
+ * in IDE configurations. IDE-specific tools should use
+ * <code>org.eclipse.ui.ide.IDE.SharedImages.IMG_OBJ_PROJECT</code>
+ * instead.
+ */
+ @Deprecated
String IMG_OBJ_PROJECT = "IMG_OBJ_PROJECT"; //$NON-NLS-1$
- /**
- * Identifies a closed project image.
- *
- * @deprecated in 3.0. This image is IDE-specific, and is therefore found
- * only in IDE configurations. IDE-specific tools should use
- * <code>org.eclipse.ui.ide.IDE.SharedImages.IMG_OBJ_PROJECT_CLOSED</code> instead.
- */
- @Deprecated
+ /**
+ * Identifies a closed project image.
+ *
+ * @deprecated in 3.0. This image is IDE-specific, and is therefore found only
+ * in IDE configurations. IDE-specific tools should use
+ * <code>org.eclipse.ui.ide.IDE.SharedImages.IMG_OBJ_PROJECT_CLOSED</code>
+ * instead.
+ */
+ @Deprecated
String IMG_OBJ_PROJECT_CLOSED = "IMG_OBJ_PROJECT_CLOSED"; //$NON-NLS-1$
- /**
- * Identifies the default image used to indicate a bookmark.
- *
- * @deprecated in 3.0. This image is IDE-specific, and is therefore found
- * only in IDE configurations. IDE-specific tools should use
- * <code>org.eclipse.ui.ide.IDE.SharedImages.IMG_OBJS_BKMRK_TSK</code> instead.
- */
- @Deprecated
+ /**
+ * Identifies the default image used to indicate a bookmark.
+ *
+ * @deprecated in 3.0. This image is IDE-specific, and is therefore found only
+ * in IDE configurations. IDE-specific tools should use
+ * <code>org.eclipse.ui.ide.IDE.SharedImages.IMG_OBJS_BKMRK_TSK</code>
+ * instead.
+ */
+ @Deprecated
String IMG_OBJS_BKMRK_TSK = "IMG_OBJS_BKMRK_TSK"; //$NON-NLS-1$
- /**
- * Identifies the default image used to indicate errors.
- */
+ /**
+ * Identifies the default image used to indicate errors.
+ */
String IMG_OBJS_ERROR_TSK = "IMG_OBJS_ERROR_TSK"; //$NON-NLS-1$
- /**
- * Identifies the default image used to indicate information only.
- */
+ /**
+ * Identifies the default image used to indicate information only.
+ */
String IMG_OBJS_INFO_TSK = "IMG_OBJS_INFO_TSK"; //$NON-NLS-1$
- /**
- * Identifies the default image used to indicate a task.
- *
- * @deprecated in 3.0. This image is IDE-specific, and is therefore found
- * only in IDE configurations. IDE-specific tools should use
- * <code>org.eclipse.ui.ide.IDE.SharedImages.IMG_OBJS_TASK_TSK</code> instead.
- */
- @Deprecated
+ /**
+ * Identifies the default image used to indicate a task.
+ *
+ * @deprecated in 3.0. This image is IDE-specific, and is therefore found only
+ * in IDE configurations. IDE-specific tools should use
+ * <code>org.eclipse.ui.ide.IDE.SharedImages.IMG_OBJS_TASK_TSK</code>
+ * instead.
+ */
+ @Deprecated
String IMG_OBJS_TASK_TSK = "IMG_OBJS_TASK_TSK"; //$NON-NLS-1$
- /**
- * Identifies the default image used to indicate warnings.
- */
+ /**
+ * Identifies the default image used to indicate warnings.
+ */
String IMG_OBJS_WARN_TSK = "IMG_OBJS_WARN_TSK"; //$NON-NLS-1$
- /**
- * Identifies the image used for "open marker".
- *
- * @deprecated in 3.0. This image is IDE-specific, and is therefore found
- * only in IDE configurations. IDE-specific tools should use
- * <code>org.eclipse.ui.ide.IDE.SharedImages.IMG_OPEN_MARKER</code> instead.
- */
- @Deprecated
+ /**
+ * Identifies the image used for "open marker".
+ *
+ * @deprecated in 3.0. This image is IDE-specific, and is therefore found only
+ * in IDE configurations. IDE-specific tools should use
+ * <code>org.eclipse.ui.ide.IDE.SharedImages.IMG_OPEN_MARKER</code>
+ * instead.
+ */
+ @Deprecated
String IMG_OPEN_MARKER = "IMG_OPEN_MARKER"; //$NON-NLS-1$
- /**
- * Identifies the back image in the enabled state.
- */
+ /**
+ * Identifies the back image in the enabled state.
+ */
String IMG_TOOL_BACK = "IMG_TOOL_BACK"; //$NON-NLS-1$
- /**
- * Identifies the back image in the disabled state.
- */
+ /**
+ * Identifies the back image in the disabled state.
+ */
String IMG_TOOL_BACK_DISABLED = "IMG_TOOL_BACK_DISABLED"; //$NON-NLS-1$
- /**
- * Identifies the back image in the hover (colored) state.
- *
- * @deprecated in 3.0. This image is now the same as <code>IMG_TOOL_BACK</code>.
- * Enabled images are now in color. The workbench itself no longer uses the hover image variants.
- */
- @Deprecated
+ /**
+ * Identifies the back image in the hover (colored) state.
+ *
+ * @deprecated in 3.0. This image is now the same as <code>IMG_TOOL_BACK</code>.
+ * Enabled images are now in color. The workbench itself no longer
+ * uses the hover image variants.
+ */
+ @Deprecated
String IMG_TOOL_BACK_HOVER = "IMG_TOOL_BACK_HOVER"; //$NON-NLS-1$
- /**
- * Identifies the copy image in the enabled state.
- */
+ /**
+ * Identifies the copy image in the enabled state.
+ */
String IMG_TOOL_COPY = "IMG_TOOL_COPY"; //$NON-NLS-1$
- /**
- * Identifies the copy image in the disabled state.
- */
+ /**
+ * Identifies the copy image in the disabled state.
+ */
String IMG_TOOL_COPY_DISABLED = "IMG_TOOL_COPY_DISABLED"; //$NON-NLS-1$
- /**
- * Identifies the copy image in the hover (colored) state.
- *
- * @deprecated in 3.0. This image is now the same as <code>IMG_TOOL_COPY</code>.
- * Enabled images are now in color. The workbench itself no longer uses the hover image variants.
- */
- @Deprecated
+ /**
+ * Identifies the copy image in the hover (colored) state.
+ *
+ * @deprecated in 3.0. This image is now the same as <code>IMG_TOOL_COPY</code>.
+ * Enabled images are now in color. The workbench itself no longer
+ * uses the hover image variants.
+ */
+ @Deprecated
String IMG_TOOL_COPY_HOVER = "IMG_TOOL_COPY_HOVER"; //$NON-NLS-1$
- /**
- * Identifies the cut image in the enabled state.
- */
+ /**
+ * Identifies the cut image in the enabled state.
+ */
String IMG_TOOL_CUT = "IMG_TOOL_CUT"; //$NON-NLS-1$
- /**
- * Identifies the cut image in the disabled state.
- */
+ /**
+ * Identifies the cut image in the disabled state.
+ */
String IMG_TOOL_CUT_DISABLED = "IMG_TOOL_CUT_DISABLED"; //$NON-NLS-1$
- /**
- * Identifies the cut image in the hover (colored) state.
- *
- * @deprecated in 3.0. This image is now the same as <code>IMG_TOOL_CUT</code>.
- * Enabled images are now in color. The workbench itself no longer uses the hover image variants.
- */
- @Deprecated
+ /**
+ * Identifies the cut image in the hover (colored) state.
+ *
+ * @deprecated in 3.0. This image is now the same as <code>IMG_TOOL_CUT</code>.
+ * Enabled images are now in color. The workbench itself no longer
+ * uses the hover image variants.
+ */
+ @Deprecated
String IMG_TOOL_CUT_HOVER = "IMG_TOOL_CUT_HOVER"; //$NON-NLS-1$
- /**
- * Identifies the delete image in the enabled state.
- * @since 3.4
- */
+ /**
+ * Identifies the delete image in the enabled state.
+ *
+ * @since 3.4
+ */
String IMG_TOOL_DELETE = "IMG_TOOL_DELETE"; //$NON-NLS-1$
- /**
- * Identifies the delete image in the disabled state.
- * @since 3.4
- */
+ /**
+ * Identifies the delete image in the disabled state.
+ *
+ * @since 3.4
+ */
String IMG_TOOL_DELETE_DISABLED = "IMG_TOOL_DELETE_DISABLED"; //$NON-NLS-1$
- /**
- * Identifies the delete image in the hover (colored) state.
- *
- * @deprecated in 3.0. This image is now the same as <code>IMG_TOOL_DELETE</code>.
- * Enabled images are now in color. The workbench itself no longer uses the hover image variants.
- */
- @Deprecated
+ /**
+ * Identifies the delete image in the hover (colored) state.
+ *
+ * @deprecated in 3.0. This image is now the same as
+ * <code>IMG_TOOL_DELETE</code>. Enabled images are now in color.
+ * The workbench itself no longer uses the hover image variants.
+ */
+ @Deprecated
String IMG_TOOL_DELETE_HOVER = "IMG_TOOL_DELETE_HOVER"; //$NON-NLS-1$
- /**
- * Identifies the forward image in the enabled state.
- */
+ /**
+ * Identifies the forward image in the enabled state.
+ */
String IMG_TOOL_FORWARD = "IMG_TOOL_FORWARD"; //$NON-NLS-1$
- /**
- * Identifies the forward image in the disabled state.
- */
+ /**
+ * Identifies the forward image in the disabled state.
+ */
String IMG_TOOL_FORWARD_DISABLED = "IMG_TOOL_FORWARD_DISABLED"; //$NON-NLS-1$
- /**
- * Identifies the forward image in the hover (colored) state.
- *
- * @deprecated in 3.0. This image is now the same as <code>IMG_TOOL_FORWARD</code>.
- * Enabled images are now in color. The workbench itself no longer uses the hover image variants.
- */
- @Deprecated
+ /**
+ * Identifies the forward image in the hover (colored) state.
+ *
+ * @deprecated in 3.0. This image is now the same as
+ * <code>IMG_TOOL_FORWARD</code>. Enabled images are now in color.
+ * The workbench itself no longer uses the hover image variants.
+ */
+ @Deprecated
String IMG_TOOL_FORWARD_HOVER = "IMG_TOOL_FORWARD_HOVER"; //$NON-NLS-1$
- /**
- * Identifies the new wizard image in the enabled state.
- */
+ /**
+ * Identifies the new wizard image in the enabled state.
+ */
String IMG_TOOL_NEW_WIZARD = "IMG_TOOL_NEW_WIZARD"; //$NON-NLS-1$
- /**
- * Identifies the new wizard image in the disabled state.
- */
+ /**
+ * Identifies the new wizard image in the disabled state.
+ */
String IMG_TOOL_NEW_WIZARD_DISABLED = "IMG_TOOL_NEW_WIZARD_DISABLED"; //$NON-NLS-1$
- /**
- * Identifies the new wizard image in the hover (colored) state.
- *
- * @deprecated in 3.0. This image is now the same as <code>IMG_TOOL_NEW_WIZARD</code>.
- * Enabled images are now in color. The workbench itself no longer uses the hover image variants.
- */
- @Deprecated
+ /**
+ * Identifies the new wizard image in the hover (colored) state.
+ *
+ * @deprecated in 3.0. This image is now the same as
+ * <code>IMG_TOOL_NEW_WIZARD</code>. Enabled images are now in
+ * color. The workbench itself no longer uses the hover image
+ * variants.
+ */
+ @Deprecated
String IMG_TOOL_NEW_WIZARD_HOVER = "IMG_TOOL_NEW_WIZARD_HOVER"; //$NON-NLS-1$
- /**
- * Identifies the paste image in the enabled state.
- */
+ /**
+ * Identifies the paste image in the enabled state.
+ */
String IMG_TOOL_PASTE = "IMG_TOOL_PASTE"; //$NON-NLS-1$
- /**
- * Identifies the paste image in the disabled state.
- */
+ /**
+ * Identifies the paste image in the disabled state.
+ */
String IMG_TOOL_PASTE_DISABLED = "IMG_TOOL_PASTE_DISABLED"; //$NON-NLS-1$
- /**
- * Identifies the paste image in the hover (colored) state.
- *
- * @deprecated in 3.0. This image is now the same as <code>IMG_TOOL_PASTE</code>.
- * Enabled images are now in color. The workbench itself no longer uses the hover image variants.
- */
- @Deprecated
+ /**
+ * Identifies the paste image in the hover (colored) state.
+ *
+ * @deprecated in 3.0. This image is now the same as
+ * <code>IMG_TOOL_PASTE</code>. Enabled images are now in color. The
+ * workbench itself no longer uses the hover image variants.
+ */
+ @Deprecated
String IMG_TOOL_PASTE_HOVER = "IMG_TOOL_PASTE_HOVER"; //$NON-NLS-1$
- /**
- * Identifies the redo image in the enabled state.
- */
+ /**
+ * Identifies the redo image in the enabled state.
+ */
String IMG_TOOL_REDO = "IMG_TOOL_REDO"; //$NON-NLS-1$
- /**
- * Identifies the redo image in the disabled state.
- */
+ /**
+ * Identifies the redo image in the disabled state.
+ */
String IMG_TOOL_REDO_DISABLED = "IMG_TOOL_REDO_DISABLED"; //$NON-NLS-1$
- /**
- * Identifies the redo image in the hover (colored) state.
- *
- * @deprecated in 3.0. This image is now the same as <code>IMG_TOOL_REDO</code>.
- * Enabled images are now in color. The workbench itself no longer uses the hover image variants.
- */
- @Deprecated
+ /**
+ * Identifies the redo image in the hover (colored) state.
+ *
+ * @deprecated in 3.0. This image is now the same as <code>IMG_TOOL_REDO</code>.
+ * Enabled images are now in color. The workbench itself no longer
+ * uses the hover image variants.
+ */
+ @Deprecated
String IMG_TOOL_REDO_HOVER = "IMG_TOOL_REDO_HOVER"; //$NON-NLS-1$
- /**
- * Identifies the undo image in the enabled state.
- */
+ /**
+ * Identifies the undo image in the enabled state.
+ */
String IMG_TOOL_UNDO = "IMG_TOOL_UNDO"; //$NON-NLS-1$
- /**
- * Identifies the undo image in the disabled state.
- */
+ /**
+ * Identifies the undo image in the disabled state.
+ */
String IMG_TOOL_UNDO_DISABLED = "IMG_TOOL_UNDO_DISABLED"; //$NON-NLS-1$
- /**
- * Identifies the undo image in the hover (colored) state.
- *
- * @deprecated in 3.0. This image is now the same as <code>IMG_TOOL_UNDO</code>.
- * Enabled images are now in color. The workbench itself no longer uses the hover image variants.
- */
- @Deprecated
+ /**
+ * Identifies the undo image in the hover (colored) state.
+ *
+ * @deprecated in 3.0. This image is now the same as <code>IMG_TOOL_UNDO</code>.
+ * Enabled images are now in color. The workbench itself no longer
+ * uses the hover image variants.
+ */
+ @Deprecated
String IMG_TOOL_UNDO_HOVER = "IMG_TOOL_UNDO_HOVER"; //$NON-NLS-1$
- /**
- * Identifies the up image in the enabled state.
- */
+ /**
+ * Identifies the up image in the enabled state.
+ */
String IMG_TOOL_UP = "IMG_TOOL_UP"; //$NON-NLS-1$
- /**
- * Identifies the up image in the disabled state.
- */
+ /**
+ * Identifies the up image in the disabled state.
+ */
String IMG_TOOL_UP_DISABLED = "IMG_TOOL_UP_DISABLED"; //$NON-NLS-1$
- /**
- * Identifies the up image in the hover (colored) state.
- *
- * @deprecated in 3.0. This image is now the same as <code>IMG_TOOL_UP</code>.
- * Enabled images are now in color. The workbench itself no longer uses the hover image variants.
- */
- @Deprecated
+ /**
+ * Identifies the up image in the hover (colored) state.
+ *
+ * @deprecated in 3.0. This image is now the same as <code>IMG_TOOL_UP</code>.
+ * Enabled images are now in color. The workbench itself no longer
+ * uses the hover image variants.
+ */
+ @Deprecated
String IMG_TOOL_UP_HOVER = "IMG_TOOL_UP_HOVER"; //$NON-NLS-1$
- // The following set of constants represent the image pairs that are used
- // to construct cursors for drag and drop operations within the workbench
- // Each cursor is represented by two images; the 'source' and the 'mask'
- // These need to be combined using the following code snippet:
- // source = getImageDescriptor(sourceId);
- // mask = getImageDescriptor(maskId);
- // cursor = new Cursor(display, source.getImageData(), mask.getImageData(), 16, 16);
-
- /**
- * Cursor 'source' for the left arrow cursor. For cursor construction see:
- * @see Cursor#Cursor(Device, ImageData, ImageData, int, int)
- * @since 3.5
- */
+ // The following set of constants represent the image pairs that are used
+ // to construct cursors for drag and drop operations within the workbench
+ // Each cursor is represented by two images; the 'source' and the 'mask'
+ // These need to be combined using the following code snippet:
+ // source = getImageDescriptor(sourceId);
+ // mask = getImageDescriptor(maskId);
+ // cursor = new Cursor(display, source.getImageData(), mask.getImageData(), 16,
+ // 16);
+
+ /**
+ * Cursor 'source' for the left arrow cursor. For cursor construction see:
+ *
+ * @see Cursor#Cursor(Device, ImageData, ImageData, int, int)
+ * @since 3.5
+ */
String IMG_OBJS_DND_LEFT_SOURCE = "IMG_OBJS_DND_LEFT_SOURCE"; //$NON-NLS-1$
- /**
- * Cursor 'mask' for the left arrow cursor. For cursor construction see:
- * @see Cursor#Cursor(Device, ImageData, ImageData, int, int)
- * @since 3.5
- */
+ /**
+ * Cursor 'mask' for the left arrow cursor. For cursor construction see:
+ *
+ * @see Cursor#Cursor(Device, ImageData, ImageData, int, int)
+ * @since 3.5
+ */
String IMG_OBJS_DND_LEFT_MASK = "IMG_OBJS_DND_LEFT_MASK"; //$NON-NLS-1$
- /**
- * Cursor 'source' for the right arrow cursor. For cursor construction see:
- * @see Cursor#Cursor(Device, ImageData, ImageData, int, int)
- * @since 3.5
- */
+ /**
+ * Cursor 'source' for the right arrow cursor. For cursor construction see:
+ *
+ * @see Cursor#Cursor(Device, ImageData, ImageData, int, int)
+ * @since 3.5
+ */
String IMG_OBJS_DND_RIGHT_SOURCE = "IMG_OBJS_DND_RIGHT_SOURCE"; //$NON-NLS-1$
- /**
- * Cursor 'mask' for the right arrow cursor. For cursor construction see:
- * @see Cursor#Cursor(Device, ImageData, ImageData, int, int)
- * @since 3.5
- */
+ /**
+ * Cursor 'mask' for the right arrow cursor. For cursor construction see:
+ *
+ * @see Cursor#Cursor(Device, ImageData, ImageData, int, int)
+ * @since 3.5
+ */
String IMG_OBJS_DND_RIGHT_MASK = "IMG_OBJS_DND_RIGHT_MASK"; //$NON-NLS-1$
- /**
- * Cursor 'source' for the up arrow cursor. For cursor construction see:
- * @see Cursor#Cursor(Device, ImageData, ImageData, int, int)
- * @since 3.5
- */
+ /**
+ * Cursor 'source' for the up arrow cursor. For cursor construction see:
+ *
+ * @see Cursor#Cursor(Device, ImageData, ImageData, int, int)
+ * @since 3.5
+ */
String IMG_OBJS_DND_TOP_SOURCE = "IMG_OBJS_DND_TOP_SOURCE"; //$NON-NLS-1$
- /**
- * Cursor 'mask' for the up arrow cursor. For cursor construction see:
- * @see Cursor#Cursor(Device, ImageData, ImageData, int, int)
- * @since 3.5
- */
+ /**
+ * Cursor 'mask' for the up arrow cursor. For cursor construction see:
+ *
+ * @see Cursor#Cursor(Device, ImageData, ImageData, int, int)
+ * @since 3.5
+ */
String IMG_OBJS_DND_TOP_MASK = "IMG_OBJS_DND_TOP_MASK"; //$NON-NLS-1$
- /**
- * Cursor 'source' for the down arrow cursor. For cursor construction see:
- * @see Cursor#Cursor(Device, ImageData, ImageData, int, int)
- * @since 3.5
- */
+ /**
+ * Cursor 'source' for the down arrow cursor. For cursor construction see:
+ *
+ * @see Cursor#Cursor(Device, ImageData, ImageData, int, int)
+ * @since 3.5
+ */
String IMG_OBJS_DND_BOTTOM_SOURCE = "IMG_OBJS_DND_BOTTOM_SOURCE"; //$NON-NLS-1$
- /**
- * Cursor 'mask' for the down arrow cursor. For cursor construction see:
- * @see Cursor#Cursor(Device, ImageData, ImageData, int, int)
- * @since 3.5
- */
+ /**
+ * Cursor 'mask' for the down arrow cursor. For cursor construction see:
+ *
+ * @see Cursor#Cursor(Device, ImageData, ImageData, int, int)
+ * @since 3.5
+ */
String IMG_OBJS_DND_BOTTOM_MASK = "IMG_OBJS_DND_BOTTOM_MASK"; //$NON-NLS-1$
- /**
- * Cursor 'source' for the 'no drop' arrow cursor. For cursor construction see:
- * @see Cursor#Cursor(Device, ImageData, ImageData, int, int)
- * @since 3.5
- */
+ /**
+ * Cursor 'source' for the 'no drop' arrow cursor. For cursor construction see:
+ *
+ * @see Cursor#Cursor(Device, ImageData, ImageData, int, int)
+ * @since 3.5
+ */
String IMG_OBJS_DND_INVALID_SOURCE = "IMG_OBJS_DND_INVALID_SOURCE"; //$NON-NLS-1$
- /**
- * Cursor 'mask' for the 'no drop' arrow cursor. For cursor construction see:
- * @see Cursor#Cursor(Device, ImageData, ImageData, int, int)
- * @since 3.5
- */
+ /**
+ * Cursor 'mask' for the 'no drop' arrow cursor. For cursor construction see:
+ *
+ * @see Cursor#Cursor(Device, ImageData, ImageData, int, int)
+ * @since 3.5
+ */
String IMG_OBJS_DND_INVALID_MASK = "IMG_OBJS_DND_INVALID_MASK"; //$NON-NLS-1$
- /**
- * Cursor 'source' for the 'in stack' arrow cursor. For cursor construction see:
- * @see Cursor#Cursor(Device, ImageData, ImageData, int, int)
- * @since 3.5
- */
+ /**
+ * Cursor 'source' for the 'in stack' arrow cursor. For cursor construction see:
+ *
+ * @see Cursor#Cursor(Device, ImageData, ImageData, int, int)
+ * @since 3.5
+ */
String IMG_OBJS_DND_STACK_SOURCE = "IMG_OBJS_DND_STACK_SOURCE"; //$NON-NLS-1$
- /**
- * Cursor 'mask' for the 'in stack' arrow cursor. For cursor construction see:
- * @see Cursor#Cursor(Device, ImageData, ImageData, int, int)
- * @since 3.5
- */
+ /**
+ * Cursor 'mask' for the 'in stack' arrow cursor. For cursor construction see:
+ *
+ * @see Cursor#Cursor(Device, ImageData, ImageData, int, int)
+ * @since 3.5
+ */
String IMG_OBJS_DND_STACK_MASK = "IMG_OBJS_DND_STACK_MASK"; //$NON-NLS-1$
- /**
- * Cursor 'source' for the 'off-screen' (detached window) arrow cursor. For cursor construction see:
- * @see Cursor#Cursor(Device, ImageData, ImageData, int, int)
- * @since 3.5
- */
+ /**
+ * Cursor 'source' for the 'off-screen' (detached window) arrow cursor. For
+ * cursor construction see:
+ *
+ * @see Cursor#Cursor(Device, ImageData, ImageData, int, int)
+ * @since 3.5
+ */
String IMG_OBJS_DND_OFFSCREEN_SOURCE = "IMG_OBJS_DND_OFFSCREEN_SOURCE"; //$NON-NLS-1$
- /**
- * Cursor 'mask' for the 'off-screen' (detached window) arrow cursor. For cursor construction see:
- * @see Cursor#Cursor(Device, ImageData, ImageData, int, int)
- * @since 3.5
- */
+ /**
+ * Cursor 'mask' for the 'off-screen' (detached window) arrow cursor. For cursor
+ * construction see:
+ *
+ * @see Cursor#Cursor(Device, ImageData, ImageData, int, int)
+ * @since 3.5
+ */
String IMG_OBJS_DND_OFFSCREEN_MASK = "IMG_OBJS_DND_OFFSCREEN_MASK"; //$NON-NLS-1$
- /**
- * Cursor 'source' for the 'fast-view' arrow cursor. For cursor construction see:
- * @see Cursor#Cursor(Device, ImageData, ImageData, int, int)
- * @since 3.5
- */
+ /**
+ * Cursor 'source' for the 'fast-view' arrow cursor. For cursor construction
+ * see:
+ *
+ * @see Cursor#Cursor(Device, ImageData, ImageData, int, int)
+ * @since 3.5
+ */
String IMG_OBJS_DND_TOFASTVIEW_SOURCE = "IMG_OBJS_DND_TOFASTVIEW_SOURCE"; //$NON-NLS-1$
- /**
- * Cursor 'mask' for the 'fast-view' arrow cursor. For cursor construction see:
- * @see Cursor#Cursor(Device, ImageData, ImageData, int, int)
- * @since 3.5
- */
+ /**
+ * Cursor 'mask' for the 'fast-view' arrow cursor. For cursor construction see:
+ *
+ * @see Cursor#Cursor(Device, ImageData, ImageData, int, int)
+ * @since 3.5
+ */
String IMG_OBJS_DND_TOFASTVIEW_MASK = "IMG_OBJS_DND_TOFASTVIEW_MASK"; //$NON-NLS-1$
- /**
- * Retrieves the specified image from the workbench plugin's image registry.
- * Note: The returned <code>Image</code> is managed by the workbench; clients
- * must <b>not</b> dispose of the returned image.
- *
- * @param symbolicName the symbolic name of the image; there are constants
- * declared in this interface for build-in images that come with the workbench
- * @return the image, or <code>null</code> if not found
- */
+ /**
+ * Retrieves the specified image from the workbench plugin's image registry.
+ * Note: The returned <code>Image</code> is managed by the workbench; clients
+ * must <b>not</b> dispose of the returned image.
+ *
+ * @param symbolicName the symbolic name of the image; there are constants
+ * declared in this interface for build-in images that come
+ * with the workbench
+ * @return the image, or <code>null</code> if not found
+ */
Image getImage(String symbolicName);
- /**
- * Retrieves the image descriptor for specified image from the workbench's
- * image registry. Unlike <code>Image</code>s, image descriptors themselves do
- * not need to be disposed.
- *
- * @param symbolicName the symbolic name of the image; there are constants
- * declared in this interface for build-in images that come with the workbench
- * @return the image descriptor, or <code>null</code> if not found
- */
+ /**
+ * Retrieves the image descriptor for specified image from the workbench's image
+ * registry. Unlike <code>Image</code>s, image descriptors themselves do not
+ * need to be disposed.
+ *
+ * @param symbolicName the symbolic name of the image; there are constants
+ * declared in this interface for build-in images that come
+ * with the workbench
+ * @return the image descriptor, or <code>null</code> if not found
+ */
ImageDescriptor getImageDescriptor(String symbolicName);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IShowEditorInput.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IShowEditorInput.java
index f16ce61178f..46ffef71fe5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IShowEditorInput.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IShowEditorInput.java
@@ -14,27 +14,25 @@
package org.eclipse.ui;
-
/**
- * Shows the given editor input. Used when an editor is being opened and an existing
- * editor's input matches the one being opened.
+ * Shows the given editor input. Used when an editor is being opened and an
+ * existing editor's input matches the one being opened.
* <p>
- * Editors can optionally implement this interface, giving the editor the opportunity
- * to show the given input if it represents a different subset of the editor's content
- * than the one currently being shown.
+ * Editors can optionally implement this interface, giving the editor the
+ * opportunity to show the given input if it represents a different subset of
+ * the editor's content than the one currently being shown.
* </p>
*
* @since 3.1
*/
public interface IShowEditorInput {
- /**
- * Shows the given input if it represents a different subset of the editor's content
- * than the one currently being shown.
- *
- * @param editorInput the editor input to show
- */
- void showEditorInput(IEditorInput editorInput);
+ /**
+ * Shows the given input if it represents a different subset of the editor's
+ * content than the one currently being shown.
+ *
+ * @param editorInput the editor input to show
+ */
+ void showEditorInput(IEditorInput editorInput);
}
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISizeProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISizeProvider.java
index 2893dfc3b81..77cda0836ce 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISizeProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISizeProvider.java
@@ -13,7 +13,6 @@
*******************************************************************************/
package org.eclipse.ui;
-
/**
* Interface implemented by objects that are capable of computing a preferred
* size.
@@ -22,52 +21,57 @@ package org.eclipse.ui;
*/
public interface ISizeProvider {
- /**
- * Constant used to indicate infinite size. This is equal to Integer.MAX_VALUE, ensuring
- * that it is greater than any other integer.
- */
- int INFINITE = Integer.MAX_VALUE;
+ /**
+ * Constant used to indicate infinite size. This is equal to Integer.MAX_VALUE,
+ * ensuring that it is greater than any other integer.
+ */
+ int INFINITE = Integer.MAX_VALUE;
- /**
- * Returns a bitwise combination of flags indicating how and when computePreferredSize should
- * be used. When called with horizontal=true, this indicates the usage of computePreferredSize(true,...)
- * for computing widths. When called with horizontal=false, this indicates the usage of computeSize(false,...)
- * for computing heights. These flags are used for optimization. Each flag gives the part more control
- * over its preferred size but slows down the layout algorithm. Parts should return the minimum set
- * of flags necessary to specify their constraints.
- * <p>
- * If the return value of this function ever changes, the part must call <code>flushLayout</code> before
- * the changes will take effect.
- * </p>
- *
- * <ul>
- * <li>SWT.MAX: The part has a maximum size that will be returned by computePreferredSize(horizontal,
- * INFINITE, someWidth, INFINITE)</li>
- * <li>SWT.MIN: The part has a minimum size that will be returned by computePreferredSize(horizontal,
- * INFINITE, someWidth, 0)</li>
- * <li>SWT.WRAP: Indicates that computePreferredSize makes use of the availablePerpendicular argument. If this
- * flag is not specified, then the third argument to computePreferredSize will always be set to
- * INFINITE. The perpendicular size is expensive to compute, and it is usually only used
- * for wrapping parts.
- * <li>SWT.FILL: The part may not return the preferred size verbatim when computePreferredSize is
- * is given a value between the minimum and maximum sizes. This is commonly used if the part
- * wants to use a set of predetermined sizes instead of using the workbench-provided size.
- * For example, computePreferredSize(horizontal, availableSpace, someWidth,
- * preferredSize) may return the nearest predetermined size. Note that this flag should
- * be used sparingly. It can prevent layout caching and cause the workbench layout algorithm
- * to degrade to exponential worst-case runtime. If this flag is omitted, then
- * computePreferredSize may be used to compute the minimum and maximum sizes, but not for
- * anything in between.</li>
- * </ul>
- *
- * @param width a value of true or false determines whether the return value applies when computing
- * widths or heights respectively. That is, getSizeFlags(true) will be used when calling
- * computePreferredSize(true,...)
- * @return any bitwise combination of SWT.MAX, SWT.MIN, SWT.WRAP, and SWT.FILL
- */
- int getSizeFlags(boolean width);
+ /**
+ * Returns a bitwise combination of flags indicating how and when
+ * computePreferredSize should be used. When called with horizontal=true, this
+ * indicates the usage of computePreferredSize(true,...) for computing widths.
+ * When called with horizontal=false, this indicates the usage of
+ * computeSize(false,...) for computing heights. These flags are used for
+ * optimization. Each flag gives the part more control over its preferred size
+ * but slows down the layout algorithm. Parts should return the minimum set of
+ * flags necessary to specify their constraints.
+ * <p>
+ * If the return value of this function ever changes, the part must call
+ * <code>flushLayout</code> before the changes will take effect.
+ * </p>
+ *
+ * <ul>
+ * <li>SWT.MAX: The part has a maximum size that will be returned by
+ * computePreferredSize(horizontal, INFINITE, someWidth, INFINITE)</li>
+ * <li>SWT.MIN: The part has a minimum size that will be returned by
+ * computePreferredSize(horizontal, INFINITE, someWidth, 0)</li>
+ * <li>SWT.WRAP: Indicates that computePreferredSize makes use of the
+ * availablePerpendicular argument. If this flag is not specified, then the
+ * third argument to computePreferredSize will always be set to INFINITE. The
+ * perpendicular size is expensive to compute, and it is usually only used for
+ * wrapping parts.
+ * <li>SWT.FILL: The part may not return the preferred size verbatim when
+ * computePreferredSize is is given a value between the minimum and maximum
+ * sizes. This is commonly used if the part wants to use a set of predetermined
+ * sizes instead of using the workbench-provided size. For example,
+ * computePreferredSize(horizontal, availableSpace, someWidth, preferredSize)
+ * may return the nearest predetermined size. Note that this flag should be used
+ * sparingly. It can prevent layout caching and cause the workbench layout
+ * algorithm to degrade to exponential worst-case runtime. If this flag is
+ * omitted, then computePreferredSize may be used to compute the minimum and
+ * maximum sizes, but not for anything in between.</li>
+ * </ul>
+ *
+ * @param width a value of true or false determines whether the return value
+ * applies when computing widths or heights respectively. That is,
+ * getSizeFlags(true) will be used when calling
+ * computePreferredSize(true,...)
+ * @return any bitwise combination of SWT.MAX, SWT.MIN, SWT.WRAP, and SWT.FILL
+ */
+ int getSizeFlags(boolean width);
- /**
+ /**
* <p>
* Returns the best size for this part, given the available width and height and
* the workbench's preferred size for the part. Parts can overload this to
@@ -158,5 +162,5 @@ public interface ISizeProvider {
*
* @see ISizeProvider#getSizeFlags(boolean)
*/
- int computePreferredSize(boolean width, int availableParallel, int availablePerpendicular, int preferredResult);
+ int computePreferredSize(boolean width, int availableParallel, int availablePerpendicular, int preferredResult);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISourceProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISourceProvider.java
index b255bc32104..8297ce3a4ca 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISourceProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISourceProvider.java
@@ -38,39 +38,38 @@ public interface ISourceProvider {
* Adds a listener to this source provider. This listener will be notified
* whenever the corresponding source changes.
*
- * @param listener
- * The listener to add; must not be <code>null</code>.
+ * @param listener The listener to add; must not be <code>null</code>.
*/
void addSourceProviderListener(ISourceProviderListener listener);
/**
* Allows the source provider an opportunity to clean up resources (e.g.,
- * listeners) before being released. This method should be called by the
- * creator after the source provider has been removed from all the services
- * with which it was registered.
+ * listeners) before being released. This method should be called by the creator
+ * after the source provider has been removed from all the services with which
+ * it was registered.
*/
void dispose();
/**
- * Returns the current state of the sources tracked by this provider. This
- * is used to provide a view of the world if the event loop is busy and
- * things are some state has already changed.
+ * Returns the current state of the sources tracked by this provider. This is
+ * used to provide a view of the world if the event loop is busy and things are
+ * some state has already changed.
* <p>
* For use with core expressions, this map should contain
- * IEvaluationContext#UNDEFINED_VARIABLE for properties which
- * are only sometimes available.
+ * IEvaluationContext#UNDEFINED_VARIABLE for properties which are only sometimes
+ * available.
* </p>
*
- * @return A map of variable names (<code>String</code>) to variable
- * values (<code>Object</code>). This may be empty, and may be
+ * @return A map of variable names (<code>String</code>) to variable values
+ * (<code>Object</code>). This may be empty, and may be
* <code>null</code>.
*/
Map getCurrentState();
/**
- * Returns the names of those sources provided by this class. This is used
- * by clients of source providers to determine which source providers they
- * actually need.
+ * Returns the names of those sources provided by this class. This is used by
+ * clients of source providers to determine which source providers they actually
+ * need.
*
* @return An array of source names. This value should never be
* <code>null</code> or empty.
@@ -78,11 +77,10 @@ public interface ISourceProvider {
String[] getProvidedSourceNames();
/**
- * Removes a listener from this source provider. This listener will be
- * notified whenever the corresponding source changes.
+ * Removes a listener from this source provider. This listener will be notified
+ * whenever the corresponding source changes.
*
- * @param listener
- * The listener to remove; must not be <code>null</code>.
+ * @param listener The listener to remove; must not be <code>null</code>.
*/
void removeSourceProviderListener(ISourceProviderListener listener);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISourceProviderListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISourceProviderListener.java
index f194b41c3de..54e70b18996 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISourceProviderListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISourceProviderListener.java
@@ -32,38 +32,35 @@ public interface ISourceProviderListener {
/**
* Handles a change to multiple sources. The source priority should be a bit
- * mask indicating the sources. The map will be used to construct the
- * variables on an <code>IEvaluationContext</code>
+ * mask indicating the sources. The map will be used to construct the variables
+ * on an <code>IEvaluationContext</code>
*
- * @param sourcePriority
- * A bit mask of all the source priorities that have changed.
- * @param sourceValuesByName
- * A mapping of the source names (<code>String</code>) to the
- * source values (<code>Object</code>). The names should
- * never be <code>null</code>, but the values may be. The map
- * must not be <code>null</code>, and should contain at least
- * two elements (one for each source).
+ * @param sourcePriority A bit mask of all the source priorities that have
+ * changed.
+ * @param sourceValuesByName A mapping of the source names (<code>String</code>)
+ * to the source values (<code>Object</code>). The
+ * names should never be <code>null</code>, but the
+ * values may be. The map must not be
+ * <code>null</code>, and should contain at least two
+ * elements (one for each source).
* @see org.eclipse.core.expressions.IEvaluationContext
* @see ISources
*/
- void sourceChanged(final int sourcePriority,
- final Map sourceValuesByName);
+ void sourceChanged(final int sourcePriority, final Map sourceValuesByName);
/**
* Handles a change to one source. The source priority should indicate the
* source, and the name-value pair will be used to create an
* <code>IEvaluationContext</code> with a single variable.
*
- * @param sourcePriority
- * A bit mask of all the source priorities that have changed.
- * @param sourceName
- * The name of the source that changed; must not be
- * <code>null</code>.
- * @param sourceValue
- * The new value for that source; may be <code>null</code>.
+ * @param sourcePriority A bit mask of all the source priorities that have
+ * changed.
+ * @param sourceName The name of the source that changed; must not be
+ * <code>null</code>.
+ * @param sourceValue The new value for that source; may be
+ * <code>null</code>.
* @see org.eclipse.core.expressions.IEvaluationContext
* @see ISources
*/
- void sourceChanged(final int sourcePriority,
- final String sourceName, final Object sourceValue);
+ void sourceChanged(final int sourcePriority, final String sourceName, final Object sourceValue);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISources.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISources.java
index f7f45dcec34..ce2e8ecad45 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISources.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISources.java
@@ -37,24 +37,25 @@ import org.eclipse.ui.part.IShowInSource;
* conflicts. Another way to look at this is that the higher the value, the more
* "local" the source is to what the user is currently doing. This is similar
* to, but distinct from the concept of components. The nesting support provided
- * by components represent only one source (<code>ACTIVE_SITE</code>) that
- * the workbench understands.
+ * by components represent only one source (<code>ACTIVE_SITE</code>) that the
+ * workbench understands.
* </p>
* <p>
* Note that for backward compatibility, we must reserve the lowest three bits
* for <code>Priority</code> instances using the old
- * <code>HandlerSubmission</code> mechanism. This mechanism was used in
- * Eclipse 3.0.
+ * <code>HandlerSubmission</code> mechanism. This mechanism was used in Eclipse
+ * 3.0.
* </p>
* <p>
* <b>Note in 3.3:</b>
* </p>
* <p>
- * Currently, source variables are not extensible by user plugins, and
- * the number of bits available for resolving conflicts is limited. When
- * the variable sources become user extensible a new conflict resolution
- * mechanism will be implemented.
+ * Currently, source variables are not extensible by user plugins, and the
+ * number of bits available for resolving conflicts is limited. When the
+ * variable sources become user extensible a new conflict resolution mechanism
+ * will be implemented.
* </p>
+ *
* @noimplement This interface is not intended to be implemented by clients.
* @noextend This interface is not intended to be extended by clients.
*
@@ -64,8 +65,8 @@ import org.eclipse.ui.part.IShowInSource;
public interface ISources {
/**
- * The priority given to default handlers and handlers that are active
- * across the entire workbench.
+ * The priority given to default handlers and handlers that are active across
+ * the entire workbench.
*/
int WORKBENCH = 0;
@@ -95,12 +96,14 @@ public interface ISources {
/**
* The variable name for the active contexts. This is for use with the
* <code>ISourceProvider</code> and <code>IEvaluationContext</code>.
+ *
* @since 3.2
*/
String ACTIVE_CONTEXT_NAME = "activeContexts"; //$NON-NLS-1$
/**
* The priority given when the source includes a particular action set.
+ *
* @since 3.2
*/
int ACTIVE_ACTION_SETS = 1 << 8;
@@ -108,6 +111,7 @@ public interface ISources {
/**
* The variable name for the active action sets. This is for use with the
* {@link ISourceProvider} and {@link IEvaluationContext}.
+ *
* @since 3.2
*/
String ACTIVE_ACTION_SETS_NAME = "activeActionSets"; //$NON-NLS-1$
@@ -124,54 +128,54 @@ public interface ISources {
String ACTIVE_SHELL_NAME = "activeShell"; //$NON-NLS-1$
/**
- * The priority given when the source includes the currently active
- * workbench window shell.
+ * The priority given when the source includes the currently active workbench
+ * window shell.
+ *
* @since 3.2
*/
int ACTIVE_WORKBENCH_WINDOW_SHELL = 1 << 12;
/**
- * The variable name for the active workbench window shell. This is for use
- * with the <code>ISourceProvider</code> and
- * <code>IEvaluationContext</code>.
+ * The variable name for the active workbench window shell. This is for use with
+ * the <code>ISourceProvider</code> and <code>IEvaluationContext</code>.
+ *
* @since 3.2
*/
String ACTIVE_WORKBENCH_WINDOW_SHELL_NAME = "activeWorkbenchWindowShell"; //$NON-NLS-1$
/**
- * The priority given when the source includes the currently active
- * workbench window.
+ * The priority given when the source includes the currently active workbench
+ * window.
*/
int ACTIVE_WORKBENCH_WINDOW = 1 << 14;
/**
- * The variable name for the active workbench window. This is for use with
- * the <code>ISourceProvider</code> and <code>IEvaluationContext</code>.
+ * The variable name for the active workbench window. This is for use with the
+ * <code>ISourceProvider</code> and <code>IEvaluationContext</code>.
*/
String ACTIVE_WORKBENCH_WINDOW_NAME = "activeWorkbenchWindow"; //$NON-NLS-1$
/**
- * The priority given when the source includes subordinate properties of the currently active
- * workbench window.
+ * The priority given when the source includes subordinate properties of the
+ * currently active workbench window.
*
* @since 3.3
*/
int ACTIVE_WORKBENCH_WINDOW_SUBORDINATE = 1 << 15;
/**
- * The variable name for the coolbar visibility state of the active
- * workbench window. This is for use with the <code>ISourceProvider</code>
- * and <code>IEvaluationContext</code>.
+ * The variable name for the coolbar visibility state of the active workbench
+ * window. This is for use with the <code>ISourceProvider</code> and
+ * <code>IEvaluationContext</code>.
*
* @since 3.3
*/
- String ACTIVE_WORKBENCH_WINDOW_IS_COOLBAR_VISIBLE_NAME = ACTIVE_WORKBENCH_WINDOW_NAME
- + ".isCoolbarVisible"; //$NON-NLS-1$
+ String ACTIVE_WORKBENCH_WINDOW_IS_COOLBAR_VISIBLE_NAME = ACTIVE_WORKBENCH_WINDOW_NAME + ".isCoolbarVisible"; //$NON-NLS-1$
/**
* The variable name for the perspective bar visibility state of the active
- * workbench window. This is for use with the <code>ISourceProvider</code>
- * and <code>IEvaluationContext</code>.
+ * workbench window. This is for use with the <code>ISourceProvider</code> and
+ * <code>IEvaluationContext</code>.
*
* @since 3.3
*/
@@ -179,14 +183,13 @@ public interface ISources {
+ ".isPerspectiveBarVisible"; //$NON-NLS-1$
/**
- * The variable name for the current perspective of the active workbench
- * window. This is for use with the <code>ISourceProvider</code> and
+ * The variable name for the current perspective of the active workbench window.
+ * This is for use with the <code>ISourceProvider</code> and
* <code>IEvaluationContext</code>.
*
* @since 3.4
*/
- String ACTIVE_WORKBENCH_WINDOW_ACTIVE_PERSPECTIVE_NAME = ACTIVE_WORKBENCH_WINDOW_NAME
- + ".activePerspective"; //$NON-NLS-1$
+ String ACTIVE_WORKBENCH_WINDOW_ACTIVE_PERSPECTIVE_NAME = ACTIVE_WORKBENCH_WINDOW_NAME + ".activePerspective"; //$NON-NLS-1$
/**
* The priority given when the source includes the active editor part.
@@ -196,12 +199,14 @@ public interface ISources {
/**
* The variable name for the active editor part. This is for use with the
* <code>ISourceProvider</code> and <code>IEvaluationContext</code>.
+ *
* @since 3.2
*/
String ACTIVE_EDITOR_NAME = "activeEditor"; //$NON-NLS-1$
/**
* The editor input of the currently active editor.
+ *
* @since 3.5
*/
String ACTIVE_EDITOR_INPUT_NAME = "activeEditorInput"; //$NON-NLS-1$
@@ -214,8 +219,8 @@ public interface ISources {
int ACTIVE_EDITOR_ID = 1 << 18;
/**
- * The variable name for the active editor identifier. This is for use with
- * the <code>ISourceProvider</code> and <code>IEvaluationContext</code>.
+ * The variable name for the active editor identifier. This is for use with the
+ * <code>ISourceProvider</code> and <code>IEvaluationContext</code>.
*
* @since 3.2
*/
@@ -248,9 +253,9 @@ public interface ISources {
String ACTIVE_PART_ID_NAME = "activePartId"; //$NON-NLS-1$
/**
- * The priority given when the source includes the active workbench site. In
- * the case of nesting components, one should be careful to only activate
- * the most nested component.
+ * The priority given when the source includes the active workbench site. In the
+ * case of nesting components, one should be careful to only activate the most
+ * nested component.
*/
int ACTIVE_SITE = 1 << 26;
@@ -261,16 +266,18 @@ public interface ISources {
String ACTIVE_SITE_NAME = "activeSite"; //$NON-NLS-1$
/**
- * The variable for the showIn selection. This is for use with the
+ * The variable for the showIn selection. This is for use with the
* <code>ISourceProvider</code> and <code>IEvaluationContext</code>.
+ *
* @since 3.4
* @see IShowInSource
*/
String SHOW_IN_SELECTION = "showInSelection"; //$NON-NLS-1$
/**
- * The variable for the showIn input. This is for use with the
+ * The variable for the showIn input. This is for use with the
* <code>ISourceProvider</code> and <code>IEvaluationContext</code>.
+ *
* @since 3.4
* @see IShowInSource
*/
@@ -284,12 +291,14 @@ public interface ISources {
/**
* The variable name for the active selection. This is for use with the
* <code>ISourceProvider</code> and <code>IEvaluationContext</code>.
+ *
* @since 3.2
*/
String ACTIVE_CURRENT_SELECTION_NAME = "selection"; //$NON-NLS-1$
/**
* The priority given when the source includes the current menu.
+ *
* @since 3.2
*/
int ACTIVE_MENU = 1 << 31;
@@ -297,13 +306,14 @@ public interface ISources {
/**
* The variable name for the active menu. This is for use with the
* {@link ISourceProvider} and {@link IEvaluationContext}.
+ *
* @since 3.2
*/
String ACTIVE_MENU_NAME = "activeMenu"; //$NON-NLS-1$
/**
- * The variable name for the <b>local</b> selection, available while a
- * context menu is visible.
+ * The variable name for the <b>local</b> selection, available while a context
+ * menu is visible.
*
* @since 3.3
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IStartup.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IStartup.java
index f4d768b0ff9..a58e4e61997 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IStartup.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IStartup.java
@@ -14,15 +14,14 @@
package org.eclipse.ui;
/**
- * Plug-ins that register a startup extension will be activated after
- * the Workbench initializes and have an opportunity to run
- * code that can't be implemented using the normal contribution
- * mechanisms.
+ * Plug-ins that register a startup extension will be activated after the
+ * Workbench initializes and have an opportunity to run code that can't be
+ * implemented using the normal contribution mechanisms.
*
* @since 2.0
*/
public interface IStartup {
- /**
+ /**
* Will be called in a separate thread after the workbench initializes.
* <p>
* Note that most workbench methods must be called in the UI thread since they
@@ -46,6 +45,5 @@ public interface IStartup {
* @see org.eclipse.swt.widgets.Display#asyncExec
* @see org.eclipse.swt.widgets.Display#syncExec
*/
- void earlyStartup();
+ void earlyStartup();
}
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IViewActionDelegate.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IViewActionDelegate.java
index f52013cf82b..eb479180bb5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IViewActionDelegate.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IViewActionDelegate.java
@@ -15,15 +15,15 @@ package org.eclipse.ui;
/**
* Interface for an action that is contributed into a view's local tool bar,
- * pulldown menu, or popup menu. It extends <code>IActionDelegate</code>
- * and adds an initialization method for connecting the delegate to the view it
+ * pulldown menu, or popup menu. It extends <code>IActionDelegate</code> and
+ * adds an initialization method for connecting the delegate to the view it
* should work with.
*/
public interface IViewActionDelegate extends IActionDelegate {
- /**
- * Initializes this action delegate with the view it will work in.
- *
- * @param view the view that provides the context for this delegate
- */
- void init(IViewPart view);
+ /**
+ * Initializes this action delegate with the view it will work in.
+ *
+ * @param view the view that provides the context for this delegate
+ */
+ void init(IViewPart view);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IViewLayout.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IViewLayout.java
index 032b023e301..b168a9612a2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IViewLayout.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IViewLayout.java
@@ -14,7 +14,8 @@
package org.eclipse.ui;
/**
- * Represents the layout info for a view or placeholder in an {@link IPageLayout}.
+ * Represents the layout info for a view or placeholder in an
+ * {@link IPageLayout}.
* <p>
* This interface is not intended to be implemented by clients.
* </p>
@@ -24,48 +25,48 @@ package org.eclipse.ui;
*/
public interface IViewLayout {
- /**
- * Returns whether the view is closeable.
- * The default is <code>true</code>.
- *
- * @return <code>true</code> if the view is closeable, <code>false</code> if not
- */
- boolean isCloseable();
+ /**
+ * Returns whether the view is closeable. The default is <code>true</code>.
+ *
+ * @return <code>true</code> if the view is closeable, <code>false</code> if not
+ */
+ boolean isCloseable();
- /**
- * Sets whether the view is closeable.
- *
- * @param closeable <code>true</code> if the view is closeable, <code>false</code> if not
- */
- void setCloseable(boolean closeable);
+ /**
+ * Sets whether the view is closeable.
+ *
+ * @param closeable <code>true</code> if the view is closeable,
+ * <code>false</code> if not
+ */
+ void setCloseable(boolean closeable);
- /**
- * Returns whether the view is moveable.
- * The default is <code>true</code>.
- *
- * @return <code>true</code> if the view is moveable, <code>false</code> if not
- */
- boolean isMoveable();
+ /**
+ * Returns whether the view is moveable. The default is <code>true</code>.
+ *
+ * @return <code>true</code> if the view is moveable, <code>false</code> if not
+ */
+ boolean isMoveable();
- /**
- * Sets whether the view is moveable.
- *
- * @param moveable <code>true</code> if the view is moveable, <code>false</code> if not
- */
- void setMoveable(boolean moveable);
+ /**
+ * Sets whether the view is moveable.
+ *
+ * @param moveable <code>true</code> if the view is moveable, <code>false</code>
+ * if not
+ */
+ void setMoveable(boolean moveable);
- /**
- * Returns whether the view is a standalone view.
- *
- * @see IPageLayout#addStandaloneView
- */
- boolean isStandalone();
+ /**
+ * Returns whether the view is a standalone view.
+ *
+ * @see IPageLayout#addStandaloneView
+ */
+ boolean isStandalone();
- /**
- * Returns whether the view shows its title.
- * This is only applicable to standalone views.
- *
- * @see IPageLayout#addStandaloneView
- */
- boolean getShowTitle();
+ /**
+ * Returns whether the view shows its title. This is only applicable to
+ * standalone views.
+ *
+ * @see IPageLayout#addStandaloneView
+ */
+ boolean getShowTitle();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IViewPart.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IViewPart.java
index 9da6a0b8574..68c0cf69259 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IViewPart.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IViewPart.java
@@ -13,7 +13,6 @@
*******************************************************************************/
package org.eclipse.ui;
-
/**
* A view is a visual component within a workbench page. It is typically used to
* navigate a hierarchy of information (like the workspace), open an editor, or
@@ -56,54 +55,56 @@ package org.eclipse.ui;
* @see ISizeProvider
*/
public interface IViewPart extends IWorkbenchPart, IPersistable {
- /**
- * Returns the site for this view.
- * This method is equivalent to <code>(IViewSite) getSite()</code>.
- * <p>
- * The site can be <code>null</code> while the view is being initialized.
- * After the initialization is complete, this value must be non-<code>null</code>
- * for the remainder of the view's life cycle.
- * </p>
- *
- * @return the view site; this value may be <code>null</code> if the view
- * has not yet been initialized
- */
- IViewSite getViewSite();
+ /**
+ * Returns the site for this view. This method is equivalent to
+ * <code>(IViewSite) getSite()</code>.
+ * <p>
+ * The site can be <code>null</code> while the view is being initialized. After
+ * the initialization is complete, this value must be non-<code>null</code> for
+ * the remainder of the view's life cycle.
+ * </p>
+ *
+ * @return the view site; this value may be <code>null</code> if the view has
+ * not yet been initialized
+ */
+ IViewSite getViewSite();
- /**
- * Initializes this view with the given view site.
- * <p>
- * This method is automatically called by the workbench shortly after the
- * part is instantiated. It marks the start of the views's lifecycle. Clients must
- * not call this method.
- * </p>
- *
- * @param site the view site
- * @exception PartInitException if this view was not initialized successfully
- */
- void init(IViewSite site) throws PartInitException;
+ /**
+ * Initializes this view with the given view site.
+ * <p>
+ * This method is automatically called by the workbench shortly after the part
+ * is instantiated. It marks the start of the views's lifecycle. Clients must
+ * not call this method.
+ * </p>
+ *
+ * @param site the view site
+ * @exception PartInitException if this view was not initialized successfully
+ */
+ void init(IViewSite site) throws PartInitException;
- /**
- * Initializes this view with the given view site. A memento is passed to
- * the view which contains a snapshot of the views state from a previous
- * session. Where possible, the view should try to recreate that state
- * within the part controls.
- * <p>
- * This method is automatically called by the workbench shortly after the part
- * is instantiated. It marks the start of the views's lifecycle. Clients must
- * not call this method.
- * </p>
- *
- * @param site the view site
- * @param memento the IViewPart state or null if there is no previous saved state
- * @exception PartInitException if this view was not initialized successfully
- */
- void init(IViewSite site, IMemento memento) throws PartInitException;
+ /**
+ * Initializes this view with the given view site. A memento is passed to the
+ * view which contains a snapshot of the views state from a previous session.
+ * Where possible, the view should try to recreate that state within the part
+ * controls.
+ * <p>
+ * This method is automatically called by the workbench shortly after the part
+ * is instantiated. It marks the start of the views's lifecycle. Clients must
+ * not call this method.
+ * </p>
+ *
+ * @param site the view site
+ * @param memento the IViewPart state or null if there is no previous saved
+ * state
+ * @exception PartInitException if this view was not initialized successfully
+ */
+ void init(IViewSite site, IMemento memento) throws PartInitException;
- /**
- * Saves the object state within a memento.
- *
- * @param memento a memento to receive the object state
- */
- @Override void saveState(IMemento memento);
+ /**
+ * Saves the object state within a memento.
+ *
+ * @param memento a memento to receive the object state
+ */
+ @Override
+ void saveState(IMemento memento);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IViewReference.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IViewReference.java
index 857cbfdbf65..3df2f889eb9 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IViewReference.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IViewReference.java
@@ -19,29 +19,29 @@ package org.eclipse.ui;
* <p>
* This interface is not intended to be implemented by clients.
* </p>
+ *
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IViewReference extends IWorkbenchPartReference {
- /**
- * Returns the secondary ID for the view.
- *
- * @return the secondary ID, or <code>null</code> if there is no secondary id
- * @see IWorkbenchPage#showView(String, String, int)
- * @since 3.0
- */
- String getSecondaryId();
+ /**
+ * Returns the secondary ID for the view.
+ *
+ * @return the secondary ID, or <code>null</code> if there is no secondary id
+ * @see IWorkbenchPage#showView(String, String, int)
+ * @since 3.0
+ */
+ String getSecondaryId();
- /**
- * Returns the <code>IViewPart</code> referenced by this object.
- * Returns <code>null</code> if the view was not instantiated or
- * it failed to be restored. Tries to restore the view
- * if <code>restore</code> is true.
- */
- IViewPart getView(boolean restore);
+ /**
+ * Returns the <code>IViewPart</code> referenced by this object. Returns
+ * <code>null</code> if the view was not instantiated or it failed to be
+ * restored. Tries to restore the view if <code>restore</code> is true.
+ */
+ IViewPart getView(boolean restore);
- /**
- * Returns true if the view is a fast view otherwise returns false.
- */
- boolean isFastView();
+ /**
+ * Returns true if the view is a fast view otherwise returns false.
+ */
+ boolean isFastView();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IViewSite.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IViewSite.java
index ad364e989dd..8c9329b208f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IViewSite.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IViewSite.java
@@ -19,26 +19,27 @@ package org.eclipse.ui;
* The workbench exposes its implemention of view part sites via this interface,
* which is not intended to be implemented or extended by clients.
* </p>
+ *
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IViewSite extends IWorkbenchPartSite {
- /**
- * Returns the action bars for this part site.
- * Views have exclusive use of their site's action bars.
- *
- * @return the action bars
- */
- IActionBars getActionBars();
+ /**
+ * Returns the action bars for this part site. Views have exclusive use of their
+ * site's action bars.
+ *
+ * @return the action bars
+ */
+ IActionBars getActionBars();
/**
- * Returns the secondary id for this part site's part, or <code>null</code>
- * if it has none.
+ * Returns the secondary id for this part site's part, or <code>null</code> if
+ * it has none.
*
- * @return the secondary id for this part site's part or <code>null</code>
- * if it has none
+ * @return the secondary id for this part site's part or <code>null</code> if it
+ * has none
* @see IWorkbenchPage#showView(String, String, int)
* @since 3.0
*/
- String getSecondaryId();
+ String getSecondaryId();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWindowListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWindowListener.java
index 6e26dc46e1d..78e53f63575 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWindowListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWindowListener.java
@@ -20,42 +20,42 @@ package org.eclipse.ui;
* </p>
*/
public interface IWindowListener {
- /**
- * Notifies this listener that the given window has been activated.
- * <p>
- * <b>Note:</b> This event is not fired if no perspective is
- * open (the window is empty).
- * </p>
- *
- * @param window the window that was activated
- */
- void windowActivated(IWorkbenchWindow window);
+ /**
+ * Notifies this listener that the given window has been activated.
+ * <p>
+ * <b>Note:</b> This event is not fired if no perspective is open (the window is
+ * empty).
+ * </p>
+ *
+ * @param window the window that was activated
+ */
+ void windowActivated(IWorkbenchWindow window);
- /**
- * Notifies this listener that the given window has been deactivated.
- * <p>
- * <b>Note:</b> This event is not fired if no perspective is
- * open (the window is empty).
- * </p>
- *
- * @param window the window that was activated
- */
- void windowDeactivated(IWorkbenchWindow window);
+ /**
+ * Notifies this listener that the given window has been deactivated.
+ * <p>
+ * <b>Note:</b> This event is not fired if no perspective is open (the window is
+ * empty).
+ * </p>
+ *
+ * @param window the window that was activated
+ */
+ void windowDeactivated(IWorkbenchWindow window);
- /**
- * Notifies this listener that the given window has been closed.
- *
- * @param window the window that was closed
- * @see IWorkbenchWindow#close
- */
- void windowClosed(IWorkbenchWindow window);
+ /**
+ * Notifies this listener that the given window has been closed.
+ *
+ * @param window the window that was closed
+ * @see IWorkbenchWindow#close
+ */
+ void windowClosed(IWorkbenchWindow window);
- /**
- * Notifies this listener that the given window has been opened.
- *
- * @param window the window that was opened
- * @see IWorkbench#openWorkbenchWindow
- */
- void windowOpened(IWorkbenchWindow window);
+ /**
+ * Notifies this listener that the given window has been opened.
+ *
+ * @param window the window that was opened
+ * @see IWorkbench#openWorkbenchWindow
+ */
+ void windowOpened(IWorkbenchWindow window);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbench.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbench.java
index f3208e288c7..a6e854ea201 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbench.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbench.java
@@ -91,8 +91,7 @@ public interface IWorkbench extends IAdaptable, IServiceLocator {
* {@link Display#getDefault Display.getDefault()}.
* </p>
*
- * @return the display to be used for all UI interactions with this
- * workbench
+ * @return the display to be used for all UI interactions with this workbench
* @since 3.0
*/
Display getDisplay();
@@ -108,8 +107,7 @@ public interface IWorkbench extends IAdaptable, IServiceLocator {
/**
* Adds a workbench listener.
*
- * @param listener
- * the workbench listener to add
+ * @param listener the workbench listener to add
* @since 3.2
*/
void addWorkbenchListener(IWorkbenchListener listener);
@@ -117,8 +115,7 @@ public interface IWorkbench extends IAdaptable, IServiceLocator {
/**
* Removes a workbench listener.
*
- * @param listener
- * the workbench listener to remove
+ * @param listener the workbench listener to remove
* @since 3.2
*/
void removeWorkbenchListener(IWorkbenchListener listener);
@@ -126,8 +123,7 @@ public interface IWorkbench extends IAdaptable, IServiceLocator {
/**
* Adds a window listener.
*
- * @param listener
- * the window listener to add
+ * @param listener the window listener to add
* @since 2.0
*/
void addWindowListener(IWindowListener listener);
@@ -135,8 +131,7 @@ public interface IWorkbench extends IAdaptable, IServiceLocator {
/**
* Removes a window listener.
*
- * @param listener
- * the window listener to remove
+ * @param listener the window listener to remove
* @since 2.0
*/
void removeWindowListener(IWindowListener listener);
@@ -144,8 +139,8 @@ public interface IWorkbench extends IAdaptable, IServiceLocator {
/**
* Closes this workbench and all its open windows.
* <p>
- * If the workbench has an open editor with unsaved content, the user will
- * be given the opportunity to save it.
+ * If the workbench has an open editor with unsaved content, the user will be
+ * given the opportunity to save it.
* </p>
*
* @return <code>true</code> if the workbench was successfully closed, and
@@ -207,11 +202,10 @@ public interface IWorkbench extends IAdaptable, IServiceLocator {
* @since 2.0
* @deprecated this returns the internal preference store for the workbench,
* which clients should not use. Use
- * {@link PlatformUI#getPreferenceStore()} instead. Note that
- * these preference stores are not the same. If you were
- * previously storing preferences in the store returned by this
- * method you should move them to your own plugin preference
- * store.
+ * {@link PlatformUI#getPreferenceStore()} instead. Note that these
+ * preference stores are not the same. If you were previously
+ * storing preferences in the store returned by this method you
+ * should move them to your own plugin preference store.
*/
@Deprecated
IPreferenceStore getPreferenceStore();
@@ -224,9 +218,9 @@ public interface IWorkbench extends IAdaptable, IServiceLocator {
ISharedImages getSharedImages();
/**
- * Returns the number of open main windows associated with this workbench.
- * Note that wizards and dialogs are not included in this list since they
- * are not considered main windows.
+ * Returns the number of open main windows associated with this workbench. Note
+ * that wizards and dialogs are not included in this list since they are not
+ * considered main windows.
*
* @return the number of open windows
* @since 3.0
@@ -234,9 +228,9 @@ public interface IWorkbench extends IAdaptable, IServiceLocator {
int getWorkbenchWindowCount();
/**
- * Returns a list of the open main windows associated with this workbench.
- * Note that wizards and dialogs are not included in this list since they
- * are not considered main windows.
+ * Returns a list of the open main windows associated with this workbench. Note
+ * that wizards and dialogs are not included in this list since they are not
+ * considered main windows.
*
* @return a list of open windows
*/
@@ -261,70 +255,60 @@ public interface IWorkbench extends IAdaptable, IServiceLocator {
ILocalWorkingSetManager createLocalWorkingSetManager();
/**
- * Creates and opens a new workbench window with one page. The perspective
- * of the new page is defined by the specified perspective ID. The new
- * window and new page become active.
+ * Creates and opens a new workbench window with one page. The perspective of
+ * the new page is defined by the specified perspective ID. The new window and
+ * new page become active.
* <p>
- * <b>Note:</b> The caller is responsible to ensure the action using this
- * method will explicitly inform the user a new window will be opened.
- * Otherwise, callers are strongly recommended to use the
- * <code>openPerspective</code> APIs to programmatically show a
- * perspective to avoid confusing the user.
+ * <b>Note:</b> The caller is responsible to ensure the action using this method
+ * will explicitly inform the user a new window will be opened. Otherwise,
+ * callers are strongly recommended to use the <code>openPerspective</code> APIs
+ * to programmatically show a perspective to avoid confusing the user.
* </p>
* <p>
- * In most cases where this method is used the caller is tightly coupled to
- * a particular perspective. They define it in the registry and contribute
- * some user interface action to open or activate it. In situations like
- * this a static variable is often used to identify the perspective ID.
+ * In most cases where this method is used the caller is tightly coupled to a
+ * particular perspective. They define it in the registry and contribute some
+ * user interface action to open or activate it. In situations like this a
+ * static variable is often used to identify the perspective ID.
* </p>
*
- * @param perspectiveId
- * the perspective id for the window's initial page, or
- * <code>null</code> for no initial page
- * @param input
- * the page input, or <code>null</code> if there is no current
- * input. This is used to seed the input for the new page's
- * views.
+ * @param perspectiveId the perspective id for the window's initial page, or
+ * <code>null</code> for no initial page
+ * @param input the page input, or <code>null</code> if there is no
+ * current input. This is used to seed the input for the
+ * new page's views.
* @return the new workbench window
- * @exception WorkbenchException
- * if a new window and page could not be opened
+ * @exception WorkbenchException if a new window and page could not be opened
*
* @see IWorkbench#showPerspective(String, IWorkbenchWindow, IAdaptable)
*/
- IWorkbenchWindow openWorkbenchWindow(String perspectiveId,
- IAdaptable input) throws WorkbenchException;
+ IWorkbenchWindow openWorkbenchWindow(String perspectiveId, IAdaptable input) throws WorkbenchException;
/**
- * Creates and opens a new workbench window with one page. The perspective
- * of the new page is defined by the default perspective ID. The new window
- * and new page become active.
+ * Creates and opens a new workbench window with one page. The perspective of
+ * the new page is defined by the default perspective ID. The new window and new
+ * page become active.
* <p>
- * <b>Note:</b> The caller is responsible to ensure the action using this
- * method will explicitly inform the user a new window will be opened.
- * Otherwise, callers are strongly recommended to use the
- * <code>openPerspective</code> APIs to programmatically show a
- * perspective to avoid confusing the user.
+ * <b>Note:</b> The caller is responsible to ensure the action using this method
+ * will explicitly inform the user a new window will be opened. Otherwise,
+ * callers are strongly recommended to use the <code>openPerspective</code> APIs
+ * to programmatically show a perspective to avoid confusing the user.
* </p>
*
- * @param input
- * the page input, or <code>null</code> if there is no current
- * input. This is used to seed the input for the new page's
- * views.
+ * @param input the page input, or <code>null</code> if there is no current
+ * input. This is used to seed the input for the new page's views.
* @return the new workbench window
- * @exception WorkbenchException
- * if a new window and page could not be opened
+ * @exception WorkbenchException if a new window and page could not be opened
*
* @see IWorkbench#showPerspective(String, IWorkbenchWindow, IAdaptable)
*/
- IWorkbenchWindow openWorkbenchWindow(IAdaptable input)
- throws WorkbenchException;
+ IWorkbenchWindow openWorkbenchWindow(IAdaptable input) throws WorkbenchException;
/**
- * Closes then restarts the workbench with the same command line as used for
- * the previous launch.
+ * Closes then restarts the workbench with the same command line as used for the
+ * previous launch.
* <p>
- * If the workbench has an open editor with unsaved content, the user will
- * be given the opportunity to save it.
+ * If the workbench has an open editor with unsaved content, the user will be
+ * given the opportunity to save it.
* </p>
*
* @return <code>true</code> if the workbench was successfully closed, and
@@ -336,18 +320,18 @@ public interface IWorkbench extends IAdaptable, IServiceLocator {
/**
* Closes then restarts this workbench using the current workspace if
- * <code>useCurrentWorkspace</code> is <code>true</code>. Otherwise, works
- * as {@link IWorkbench#restart()}.
+ * <code>useCurrentWorkspace</code> is <code>true</code>. Otherwise, works as
+ * {@link IWorkbench#restart()}.
* <p>
- * If the workbench has an open editor with unsaved content, the user will
- * be given the opportunity to save it.
+ * If the workbench has an open editor with unsaved content, the user will be
+ * given the opportunity to save it.
* </p>
*
- * @param useCurrentWorkspace
- * <code>true</code> to use the current workspace while
- * restarting this workbench, and <code>false</code> to restart
- * the workbench with the same command line as used for the
- * previous launch
+ * @param useCurrentWorkspace <code>true</code> to use the current workspace
+ * while restarting this workbench, and
+ * <code>false</code> to restart the workbench with
+ * the same command line as used for the previous
+ * launch
*
* @return <code>true</code> if the workbench was successfully closed, and
* <code>false</code> if it could not be closed
@@ -389,8 +373,7 @@ public interface IWorkbench extends IAdaptable, IServiceLocator {
*
* @since 2.0
*/
- IWorkbenchPage showPerspective(String perspectiveId,
- IWorkbenchWindow window) throws WorkbenchException;
+ IWorkbenchPage showPerspective(String perspectiveId, IWorkbenchWindow window) throws WorkbenchException;
/**
* Shows the specified perspective to the user. The caller should use this
@@ -431,27 +414,26 @@ public interface IWorkbench extends IAdaptable, IServiceLocator {
*
* @since 2.0
*/
- IWorkbenchPage showPerspective(String perspectiveId,
- IWorkbenchWindow window, IAdaptable input)
+ IWorkbenchPage showPerspective(String perspectiveId, IWorkbenchWindow window, IAdaptable input)
throws WorkbenchException;
/**
* Returns the decorator manager.
* <p>
- * Any client using the decorator manager should come up with the text and
- * image for the element (including any of the part's own decorations)
- * before calling the decorator manager. It should also add a listener to be
- * notified when decorations change.
+ * Any client using the decorator manager should come up with the text and image
+ * for the element (including any of the part's own decorations) before calling
+ * the decorator manager. It should also add a listener to be notified when
+ * decorations change.
* </p>
* <p>
- * Note that if the element implements <code>IAdaptable</code>,
- * decorators may use this mechanism to obtain an adapter (for example an
- * <code>IResource</code>), and derive the decoration from the adapter
- * rather than the element. Since the adapter may differ from the original
- * element, those using the decorator manager should be prepared to handle
- * notification that the decoration for the adapter has changed, in addition
- * to handling notification that the decoration for the element has changed.
- * That is, it needs to be able to map back from the adapter to the element.
+ * Note that if the element implements <code>IAdaptable</code>, decorators may
+ * use this mechanism to obtain an adapter (for example an
+ * <code>IResource</code>), and derive the decoration from the adapter rather
+ * than the element. Since the adapter may differ from the original element,
+ * those using the decorator manager should be prepared to handle notification
+ * that the decoration for the adapter has changed, in addition to handling
+ * notification that the decoration for the element has changed. That is, it
+ * needs to be able to map back from the adapter to the element.
* </p>
*
* @return the decorator manager
@@ -459,24 +441,23 @@ public interface IWorkbench extends IAdaptable, IServiceLocator {
IDecoratorManager getDecoratorManager();
/**
- * Save all dirty editors in the workbench. Opens a dialog to prompt the
- * user if <code>confirm</code> is true. Return true if successful. Return
- * false if the user has canceled the command.
+ * Save all dirty editors in the workbench. Opens a dialog to prompt the user if
+ * <code>confirm</code> is true. Return true if successful. Return false if the
+ * user has canceled the command.
*
* @param confirm <code>true</code> to ask the user before saving unsaved
- * changes (recommended), and <code>false</code> to save
- * unsaved changes without asking
- * @return <code>true</code> if the command succeeded, and
- * <code>false</code> if the operation was canceled by the user or
- * an error occurred while saving
+ * changes (recommended), and <code>false</code> to save unsaved
+ * changes without asking
+ * @return <code>true</code> if the command succeeded, and <code>false</code> if
+ * the operation was canceled by the user or an error occurred while
+ * saving
*/
boolean saveAllEditors(boolean confirm);
/**
* Returns the element factory with the given id.
*
- * @param factoryId
- * the id of the element factory
+ * @param factoryId the id of the element factory
* @return the element factory, or <code>null</code> if none
* @see IElementFactory
* @since 3.0
@@ -486,8 +467,8 @@ public interface IWorkbench extends IAdaptable, IServiceLocator {
/**
* Returns an interface to manage activities at the workbench level.
*
- * @return an interface to manage activities at the workbench level.
- * Guaranteed not to be <code>null</code>.
+ * @return an interface to manage activities at the workbench level. Guaranteed
+ * not to be <code>null</code>.
* @since 3.0
*/
IWorkbenchActivitySupport getActivitySupport();
@@ -495,8 +476,8 @@ public interface IWorkbench extends IAdaptable, IServiceLocator {
/**
* Returns an interface to manage commands at the workbench level.
*
- * @return an interface to manage commands at the workbench level.
- * Guaranteed not to be <code>null</code>.
+ * @return an interface to manage commands at the workbench level. Guaranteed
+ * not to be <code>null</code>.
* @since 3.0
* @deprecated Please use {@link IServiceLocator#getService(Class)} instead.
* @see ICommandService
@@ -508,8 +489,8 @@ public interface IWorkbench extends IAdaptable, IServiceLocator {
/**
* Returns an interface to manage contexts at the workbench level.
*
- * @return an interface to manage contexts at the workbench level.
- * Guaranteed not to be <code>null</code>.
+ * @return an interface to manage contexts at the workbench level. Guaranteed
+ * not to be <code>null</code>.
* @since 3.0
* @deprecated Please use {@link IServiceLocator#getService(Class)} instead.
* @see IContextService
@@ -553,10 +534,10 @@ public interface IWorkbench extends IAdaptable, IServiceLocator {
/**
* Returns a boolean indicating whether the workbench is in the process of
- * starting. During this phase, it is not safe to make calls to other
- * methods of the workbench, or of objects owned by the workbench. To delay
- * work until after the workbench has been initialized, use {@link IStartup}
- * or {@link Display#asyncExec(Runnable)}.
+ * starting. During this phase, it is not safe to make calls to other methods of
+ * the workbench, or of objects owned by the workbench. To delay work until
+ * after the workbench has been initialized, use {@link IStartup} or
+ * {@link Display#asyncExec(Runnable)}.
*
* @return <code>true</code> if the workbench is in the process of starting,
* <code>false</code> otherwise
@@ -568,16 +549,16 @@ public interface IWorkbench extends IAdaptable, IServiceLocator {
* Returns a boolean indicating whether the workbench is in the process of
* closing.
*
- * @return <code>true</code> if the workbench is in the process of
- * closing, <code>false</code> otherwise
+ * @return <code>true</code> if the workbench is in the process of closing,
+ * <code>false</code> otherwise
* @since 3.1
*/
boolean isClosing();
/**
* <p>
- * Return the extension tracker for the workbench. This tracker may be used
- * by plug-ins to ensure responsiveness to changes to the plug-in registry.
+ * Return the extension tracker for the workbench. This tracker may be used by
+ * plug-ins to ensure responsiveness to changes to the plug-in registry.
* </p>
* <p>
* The tracker at this level of the workbench is typically used to track
@@ -625,37 +606,35 @@ public interface IWorkbench extends IAdaptable, IServiceLocator {
IWizardRegistry getExportWizardRegistry();
/**
- * Save all dirty saveables in the workbench that match the given filter.
- * Opens a dialog to prompt the user if <code>confirm</code> is true.
- * Return true if successful. Return false if the user has canceled the
- * command.
+ * Save all dirty saveables in the workbench that match the given filter. Opens
+ * a dialog to prompt the user if <code>confirm</code> is true. Return true if
+ * successful. Return false if the user has canceled the command.
*
* @since 3.3
*
- * @param shellProvider the provider used to obtain a shell in prompting is
- * required. Clients can use a workbench window for this.
+ * @param shellProvider the provider used to obtain a shell in prompting is
+ * required. Clients can use a workbench window for this.
* @param runnableContext a runnable context that will be used to provide a
- * progress monitor while the save is taking place. Clients can
- * use a workbench window for this.
- * @param filter the filter used to determine if a particular dirty saveable
- * needs to be saved or <code>null</code> if all dirty
- * saveables should be saved.
- * @param confirm <code>true</code> to ask the user before saving unsaved
- * changes (recommended), and <code>false</code> to save
- * unsaved changes without asking
- * @return <code>true</code> if the command succeeded, and
- * <code>false</code> if the operation was canceled by the user or
- * an error occurred while saving
- */
- boolean saveAll(IShellProvider shellProvider,
- IRunnableContext runnableContext, ISaveableFilter filter,
+ * progress monitor while the save is taking place.
+ * Clients can use a workbench window for this.
+ * @param filter the filter used to determine if a particular dirty
+ * saveable needs to be saved or <code>null</code> if all
+ * dirty saveables should be saved.
+ * @param confirm <code>true</code> to ask the user before saving
+ * unsaved changes (recommended), and <code>false</code>
+ * to save unsaved changes without asking
+ * @return <code>true</code> if the command succeeded, and <code>false</code> if
+ * the operation was canceled by the user or an error occurred while
+ * saving
+ */
+ boolean saveAll(IShellProvider shellProvider, IRunnableContext runnableContext, ISaveableFilter filter,
boolean confirm);
/**
- * Return a shell provider that can be used to get the best parenting
- * possible for a modal dialog. If modal shells are already created, use the
- * topmost modal shell as the parent to avoid two modal dialogs. If there
- * are no modal shells, use the shell of the active workbench window.
+ * Return a shell provider that can be used to get the best parenting possible
+ * for a modal dialog. If modal shells are already created, use the topmost
+ * modal shell as the parent to avoid two modal dialogs. If there are no modal
+ * shells, use the shell of the active workbench window.
*
* @return a shell provider that provides the best parenting possible for a
* modal dialog.
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchActionConstants.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchActionConstants.java
index 710867da00c..2bc3210aa42 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchActionConstants.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchActionConstants.java
@@ -16,162 +16,161 @@
package org.eclipse.ui;
/**
- * Action ids for standard actions, groups in the workbench menu bar, and
- * global actions.
+ * Action ids for standard actions, groups in the workbench menu bar, and global
+ * actions.
* <p>
* This interface contains constants only; it is not intended to be implemented
* or extended.
* </p>
* <h3>Standard menus</h3>
* <ul>
- * <li>File menu (<code>M_FILE</code>)</li>
- * <li>Edit menu (<code>M_EDIT</code>)</li>
- * <li>Window menu (<code>M_WINDOW</code>)</li>
- * <li>Help menu (<code>M_HELP</code>)</li>
+ * <li>File menu (<code>M_FILE</code>)</li>
+ * <li>Edit menu (<code>M_EDIT</code>)</li>
+ * <li>Window menu (<code>M_WINDOW</code>)</li>
+ * <li>Help menu (<code>M_HELP</code>)</li>
* </ul>
* <h3>Standard group for adding top level menus</h3>
* <ul>
- * <li>Extra top level menu group (<code>MB_ADDITIONS</code>)</li>
+ * <li>Extra top level menu group (<code>MB_ADDITIONS</code>)</li>
* </ul>
* <h3>Global actions</h3>
* <ul>
- * <li>Undo (<code>UNDO</code>)</li>
- * <li>Redo (<code>REDO</code>)</li>
- * <li>Cut (<code>CUT</code>)</li>
- * <li>Copy (<code>COPY</code>)</li>
- * <li>Paste (<code>PASTE</code>)</li>
- * <li>Delete (<code>DELETE</code>)</li>
- * <li>Find (<code>FIND</code>)</li>
- * <li>Select All (<code>SELECT_ALL</code>)</li>
- * <li>Add Bookmark (<code>BOOKMARK</code>)</li>
+ * <li>Undo (<code>UNDO</code>)</li>
+ * <li>Redo (<code>REDO</code>)</li>
+ * <li>Cut (<code>CUT</code>)</li>
+ * <li>Copy (<code>COPY</code>)</li>
+ * <li>Paste (<code>PASTE</code>)</li>
+ * <li>Delete (<code>DELETE</code>)</li>
+ * <li>Find (<code>FIND</code>)</li>
+ * <li>Select All (<code>SELECT_ALL</code>)</li>
+ * <li>Add Bookmark (<code>BOOKMARK</code>)</li>
* </ul>
* <h3>Standard File menu actions</h3>
* <ul>
- * <li>Start group (<code>FILE_START</code>)</li>
- * <li>End group (<code>FILE_END</code>)</li>
- * <li>New action (<code>NEW</code>)</li>
- * <li>Extra New-like action group (<code>NEW_EXT</code>)</li>
- * <li>Close action (<code>CLOSE</code>)</li>
- * <li>Close All action (<code>CLOSE_ALL</code>)</li>
- * <li>Extra Close-like action group (<code>CLOSE_EXT</code>)</li>
- * <li>Save action (<code>SAVE</code>)</li>
- * <li>Save As action (<code>SAVE_AS</code>)</li>
- * <li>Save All action (<code>SAVE_ALL</code>)</li>
- * <li>Extra Save-like action group (<code>SAVE_EXT</code>)</li>
- * <li>Import action (<code>IMPORT</code>)</li>
- * <li>Export action (<code>EXPORT</code>)</li>
- * <li>Extra Import-like action group (<code>IMPORT_EXT</code>)</li>
- * <li>Quit action (<code>QUIT</code>)</li>
+ * <li>Start group (<code>FILE_START</code>)</li>
+ * <li>End group (<code>FILE_END</code>)</li>
+ * <li>New action (<code>NEW</code>)</li>
+ * <li>Extra New-like action group (<code>NEW_EXT</code>)</li>
+ * <li>Close action (<code>CLOSE</code>)</li>
+ * <li>Close All action (<code>CLOSE_ALL</code>)</li>
+ * <li>Extra Close-like action group (<code>CLOSE_EXT</code>)</li>
+ * <li>Save action (<code>SAVE</code>)</li>
+ * <li>Save As action (<code>SAVE_AS</code>)</li>
+ * <li>Save All action (<code>SAVE_ALL</code>)</li>
+ * <li>Extra Save-like action group (<code>SAVE_EXT</code>)</li>
+ * <li>Import action (<code>IMPORT</code>)</li>
+ * <li>Export action (<code>EXPORT</code>)</li>
+ * <li>Extra Import-like action group (<code>IMPORT_EXT</code>)</li>
+ * <li>Quit action (<code>QUIT</code>)</li>
* </ul>
* <h3>Standard Edit menu actions</h3>
* <ul>
- * <li>Start group (<code>EDIT_START</code>)</li>
- * <li>End group (<code>EDIT_END</code>)</li>
- * <li>Undo global action (<code>UNDO</code>)</li>
- * <li>Redo global action (<code>REDO</code>)</li>
- * <li>Extra Undo-like action group (<code>UNDO_EXT</code>)</li>
- * <li>Cut global action (<code>CUT</code>)</li>
- * <li>Copy global action (<code>COPY</code>)</li>
- * <li>Paste global action (<code>PASTE</code>)</li>
- * <li>Extra Cut-like action group (<code>CUT_EXT</code>)</li>
- * <li>Delete global action (<code>DELETE</code>)</li>
- * <li>Find global action (<code>FIND</code>)</li>
- * <li>Select All global action (<code>SELECT_ALL</code>)</li>
- * <li>Bookmark global action (<code>BOOKMARK</code>)</li>
+ * <li>Start group (<code>EDIT_START</code>)</li>
+ * <li>End group (<code>EDIT_END</code>)</li>
+ * <li>Undo global action (<code>UNDO</code>)</li>
+ * <li>Redo global action (<code>REDO</code>)</li>
+ * <li>Extra Undo-like action group (<code>UNDO_EXT</code>)</li>
+ * <li>Cut global action (<code>CUT</code>)</li>
+ * <li>Copy global action (<code>COPY</code>)</li>
+ * <li>Paste global action (<code>PASTE</code>)</li>
+ * <li>Extra Cut-like action group (<code>CUT_EXT</code>)</li>
+ * <li>Delete global action (<code>DELETE</code>)</li>
+ * <li>Find global action (<code>FIND</code>)</li>
+ * <li>Select All global action (<code>SELECT_ALL</code>)</li>
+ * <li>Bookmark global action (<code>BOOKMARK</code>)</li>
* </ul>
* <h3>Standard Perspective menu actions</h3>
* <ul>
- * <li>Extra Perspective-like action group (<code>VIEW_EXT</code>)</li>
+ * <li>Extra Perspective-like action group (<code>VIEW_EXT</code>)</li>
* </ul>
* <h3>Standard Workbench menu actions</h3>
* <ul>
- * <li>Start group (<code>WB_START</code>)</li>
- * <li>End group (<code>WB_END</code>)</li>
- * <li>Extra Build-like action group (<code>BUILD_EXT</code>)</li>
- * <li>Build action (<code>BUILD</code>)</li>
- * <li>Rebuild All action (<code>REBUILD_ALL</code>)</li>
+ * <li>Start group (<code>WB_START</code>)</li>
+ * <li>End group (<code>WB_END</code>)</li>
+ * <li>Extra Build-like action group (<code>BUILD_EXT</code>)</li>
+ * <li>Build action (<code>BUILD</code>)</li>
+ * <li>Rebuild All action (<code>REBUILD_ALL</code>)</li>
* </ul>
* <h3>Standard Window menu actions</h3>
* <ul>
- * <li>Extra Window-like action group (<code>WINDOW_EXT</code>)</li>
+ * <li>Extra Window-like action group (<code>WINDOW_EXT</code>)</li>
* </ul>
* <h3>Standard Help menu actions</h3>
* <ul>
- * <li>Start group (<code>HELP_START</code>)</li>
- * <li>End group (<code>HELP_END</code>)</li>
- * <li>About action (<code>ABOUT</code>)</li>
+ * <li>Start group (<code>HELP_START</code>)</li>
+ * <li>End group (<code>HELP_END</code>)</li>
+ * <li>About action (<code>ABOUT</code>)</li>
* </ul>
* <h3>Standard pop-up menu groups</h3>
* <ul>
- * <li>Managing group (<code>GROUP_MANAGING</code>)</li>
- * <li>Reorganize group (<code>GROUP_REORGANIZE</code>)</li>
- * <li>Add group (<code>GROUP_ADD</code>)</li>
- * <li>File group (<code>GROUP_FILE</code>)</li>
+ * <li>Managing group (<code>GROUP_MANAGING</code>)</li>
+ * <li>Reorganize group (<code>GROUP_REORGANIZE</code>)</li>
+ * <li>Add group (<code>GROUP_ADD</code>)</li>
+ * <li>File group (<code>GROUP_FILE</code>)</li>
* </ul>
* <p>
- * To hook a global action handler, a view should use the following code:
- * <code>
+ * To hook a global action handler, a view should use the following code: <code>
* IAction copyHandler = ...;
* view.getSite().getActionBars().setGlobalActionHandler(
* IWorkbenchActionConstants.COPY,
* copyHandler);
- * </code>
- * For editors, this should be done in the <code>IEditorActionBarContributor</code>.
+ * </code> For editors, this should be done in the
+ * <code>IEditorActionBarContributor</code>.
* </p>
*
* @see org.eclipse.ui.IActionBars#setGlobalActionHandler
*
- * Note: many of the remaining non-deprecated constants here are IDE-specific
- * and should be deprecated and moved to a constant pool at the IDE layer
- * (e.g. IIDEActionConstants).
+ * Note: many of the remaining non-deprecated constants here are
+ * IDE-specific and should be deprecated and moved to a constant pool at
+ * the IDE layer (e.g. IIDEActionConstants).
* @noimplement This interface is not intended to be implemented by clients.
* @noextend This interface is not intended to be extended by clients.
*/
public interface IWorkbenchActionConstants {
- // Standard menus:
- /**
- * <p>
- * [Issue: MENU_PREFIX is "". It is used to prefix some of the other
- * constants. There doesn't seem to be much point for this.
- * Recommend deleting it.
- * ]
- * </p>
- */
+ // Standard menus:
+ /**
+ * <p>
+ * [Issue: MENU_PREFIX is "". It is used to prefix some of the other constants.
+ * There doesn't seem to be much point for this. Recommend deleting it. ]
+ * </p>
+ */
String MENU_PREFIX = ""; //$NON-NLS-1$
- /**
- * <p>
- * [Issue: SEP is "/". It is not used anywhere. Recommend deleting it.]
- * </p>
- */
+ /**
+ * <p>
+ * [Issue: SEP is "/". It is not used anywhere. Recommend deleting it.]
+ * </p>
+ */
String SEP = "/"; //$NON-NLS-1$
- /**
- * Name of standard File menu (value <code>"file"</code>).
- */
+ /**
+ * Name of standard File menu (value <code>"file"</code>).
+ */
String M_FILE = MENU_PREFIX + "file"; //$NON-NLS-1$
- /**
- * Name of standard Edit menu (value <code>"edit"</code>).
- */
+ /**
+ * Name of standard Edit menu (value <code>"edit"</code>).
+ */
String M_EDIT = MENU_PREFIX + "edit"; //$NON-NLS-1$
- /**
- * Name of standard View menu (value <code>"view"</code>).
- * @deprecated Since 3.0. This is no longer used.
- */
- @Deprecated
+ /**
+ * Name of standard View menu (value <code>"view"</code>).
+ *
+ * @deprecated Since 3.0. This is no longer used.
+ */
+ @Deprecated
String M_VIEW = MENU_PREFIX + "view"; //$NON-NLS-1$
- /**
- * Name of standard Workbench menu (value <code>"workbench"</code>).
- * @deprecated Since 3.0. This is no longer used.
- */
- @Deprecated
+ /**
+ * Name of standard Workbench menu (value <code>"workbench"</code>).
+ *
+ * @deprecated Since 3.0. This is no longer used.
+ */
+ @Deprecated
String M_WORKBENCH = MENU_PREFIX + "workbench"; //$NON-NLS-1$
- // menu reorg
+ // menu reorg
/**
* Name of standard Perspective menu (value <code>"perspective"</code>).
@@ -180,419 +179,419 @@ public interface IWorkbenchActionConstants {
*/
String M_PERSPECTIVE = MENU_PREFIX + "perspective"; //$NON-NLS-1$
- /**
- * Name of standard Navigate menu (value <code>"navigate"</code>).
- */
+ /**
+ * Name of standard Navigate menu (value <code>"navigate"</code>).
+ */
String M_NAVIGATE = MENU_PREFIX + "navigate"; //$NON-NLS-1$
- /**
- * Name of standard Project menu (value <code>"project"</code>).
- */
+ /**
+ * Name of standard Project menu (value <code>"project"</code>).
+ */
String M_PROJECT = MENU_PREFIX + "project"; //$NON-NLS-1$
- // end menu reorg
+ // end menu reorg
- /**
- * Name of standard Window menu (value <code>"window"</code>).
- */
+ /**
+ * Name of standard Window menu (value <code>"window"</code>).
+ */
String M_WINDOW = MENU_PREFIX + "window"; //$NON-NLS-1$
- /**
- * Name of Launch window menu (value <code>"launch"</code>).
- */
+ /**
+ * Name of Launch window menu (value <code>"launch"</code>).
+ */
String M_LAUNCH = MENU_PREFIX + "launch"; //$NON-NLS-1$
- /**
- * Name of standard Help menu (value <code>"help"</code>).
- */
+ /**
+ * Name of standard Help menu (value <code>"help"</code>).
+ */
String M_HELP = MENU_PREFIX + "help"; //$NON-NLS-1$
- /**
- * ID of the Project configure popup menu, can be used in
- * menuContributions and objectContributions.
- *
- * @since 3.5
- */
+ /**
+ * ID of the Project configure popup menu, can be used in menuContributions and
+ * objectContributions.
+ *
+ * @since 3.5
+ */
String M_PROJECT_CONFIGURE = "org.eclipse.ui.projectConfigure"; //$NON-NLS-1$
- // Standard area for adding top level menus:
- /**
- * Name of group for adding new top-level menus (value <code>"additions"</code>).
- */
+ // Standard area for adding top level menus:
+ /**
+ * Name of group for adding new top-level menus (value
+ * <code>"additions"</code>).
+ */
String MB_ADDITIONS = "additions"; // Group. //$NON-NLS-1$
- // Standard file actions:
- /**
- * File menu: name of group for start of menu (value <code>"fileStart"</code>).
- */
+ // Standard file actions:
+ /**
+ * File menu: name of group for start of menu (value <code>"fileStart"</code>).
+ */
String FILE_START = "fileStart"; // Group. //$NON-NLS-1$
- /**
- * File menu: name of group for end of menu (value <code>"fileEnd"</code>).
- */
+ /**
+ * File menu: name of group for end of menu (value <code>"fileEnd"</code>).
+ */
String FILE_END = "fileEnd"; // Group. //$NON-NLS-1$
- /**
- * File menu: name of standard New action (value <code>"new"</code>).
- *
- * @deprecated in 3.0. Use
- * <code>org.eclipse.ui.ActionFactory.NEW.getId()</code>
- * instead.
- */
- @Deprecated
+ /**
+ * File menu: name of standard New action (value <code>"new"</code>).
+ *
+ * @deprecated in 3.0. Use <code>org.eclipse.ui.ActionFactory.NEW.getId()</code>
+ * instead.
+ */
+ @Deprecated
String NEW = "new"; //$NON-NLS-1$
- /**
- * File menu: name of group for extra New-like actions (value <code>"new.ext"</code>).
- */
+ /**
+ * File menu: name of group for extra New-like actions (value
+ * <code>"new.ext"</code>).
+ */
String NEW_EXT = "new.ext"; // Group. //$NON-NLS-1$
- /**
- * File menu: name of standard Close action (value <code>"close"</code>).
- *
- * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#CLOSE
- * ActionFactory.CLOSE.getId()} instead.
- */
- @Deprecated
+ /**
+ * File menu: name of standard Close action (value <code>"close"</code>).
+ *
+ * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#CLOSE
+ * ActionFactory.CLOSE.getId()} instead.
+ */
+ @Deprecated
String CLOSE = "close"; //$NON-NLS-1$
- /**
- * File menu: name of standard Close All action (value <code>"closeAll"</code>).
- *
- * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#CLOSE_ALL
- * ActionFactory.CLOSE_ALL.getId()} instead.
- */
- @Deprecated
+ /**
+ * File menu: name of standard Close All action (value <code>"closeAll"</code>).
+ *
+ * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#CLOSE_ALL
+ * ActionFactory.CLOSE_ALL.getId()} instead.
+ */
+ @Deprecated
String CLOSE_ALL = "closeAll"; //$NON-NLS-1$
- /**
- * File menu: name of group for extra Close-like actions (value <code>"close.ext"</code>).
- */
+ /**
+ * File menu: name of group for extra Close-like actions (value
+ * <code>"close.ext"</code>).
+ */
String CLOSE_EXT = "close.ext"; // Group. //$NON-NLS-1$
- /**
- * File menu: name of standard Save action (value <code>"save"</code>).
- *
- * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#SAVE
- * ActionFactory.SAVE.getId()} instead.
- */
- @Deprecated
+ /**
+ * File menu: name of standard Save action (value <code>"save"</code>).
+ *
+ * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#SAVE
+ * ActionFactory.SAVE.getId()} instead.
+ */
+ @Deprecated
String SAVE = "save"; //$NON-NLS-1$
- /**
- * File menu: name of standard Save As action (value <code>"saveAs"</code>).
- *
- * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#SAVE_AS
- * ActionFactory.SAVE_AS.getId()} instead.
- */
- @Deprecated
+ /**
+ * File menu: name of standard Save As action (value <code>"saveAs"</code>).
+ *
+ * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#SAVE_AS
+ * ActionFactory.SAVE_AS.getId()} instead.
+ */
+ @Deprecated
String SAVE_AS = "saveAs"; //$NON-NLS-1$
- /**
- * File menu: name of standard Save All action (value <code>"saveAll"</code>).
- *
- * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#SAVE_ALL
- * ActionFactory.SAVE_ALL.getId()} instead.
- */
- @Deprecated
+ /**
+ * File menu: name of standard Save All action (value <code>"saveAll"</code>).
+ *
+ * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#SAVE_ALL
+ * ActionFactory.SAVE_ALL.getId()} instead.
+ */
+ @Deprecated
String SAVE_ALL = "saveAll"; //$NON-NLS-1$
- /**
- * File menu: name of group for extra Save-like actions (value <code>"save.ext"</code>).
- */
+ /**
+ * File menu: name of group for extra Save-like actions (value
+ * <code>"save.ext"</code>).
+ */
String SAVE_EXT = "save.ext"; // Group. //$NON-NLS-1$
- /**
- * File menu: name of standard Print global action
- * (value <code>"print"</code>).
- *
- * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#PRINT
- * ActionFactory.PRINT.getId()} instead.
- */
- @Deprecated
+ /**
+ * File menu: name of standard Print global action (value <code>"print"</code>).
+ *
+ * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#PRINT
+ * ActionFactory.PRINT.getId()} instead.
+ */
+ @Deprecated
String PRINT = "print"; // Global action. //$NON-NLS-1$
- /**
- * File menu: name of group for extra Print-like actions (value <code>"print.ext"</code>).
- * @since 3.0
- */
+ /**
+ * File menu: name of group for extra Print-like actions (value
+ * <code>"print.ext"</code>).
+ *
+ * @since 3.0
+ */
String PRINT_EXT = "print.ext"; // Group. //$NON-NLS-1$
- /**
- * File menu: name of standard Import action (value <code>"import"</code>).
- *
- * @deprecated in 3.0. Use
- * <code>org.eclipse.ui.ActionFactory.IMPORT.getId()</code>
- * instead.
- */
- @Deprecated
+ /**
+ * File menu: name of standard Import action (value <code>"import"</code>).
+ *
+ * @deprecated in 3.0. Use
+ * <code>org.eclipse.ui.ActionFactory.IMPORT.getId()</code> instead.
+ */
+ @Deprecated
String IMPORT = "import"; //$NON-NLS-1$
- /**
- * File menu: name of standard Export action (value <code>"export"</code>).
- *
- * @deprecated in 3.0. Use
- * <code>org.eclipse.ui.ActionFactory.EXPORT.getId()</code>
- * instead.
- */
- @Deprecated
+ /**
+ * File menu: name of standard Export action (value <code>"export"</code>).
+ *
+ * @deprecated in 3.0. Use
+ * <code>org.eclipse.ui.ActionFactory.EXPORT.getId()</code> instead.
+ */
+ @Deprecated
String EXPORT = "export"; //$NON-NLS-1$
- /**
- * File menu: name of group for extra Import-like actions (value <code>"import.ext"</code>).
- */
+ /**
+ * File menu: name of group for extra Import-like actions (value
+ * <code>"import.ext"</code>).
+ */
String IMPORT_EXT = "import.ext"; // Group. //$NON-NLS-1$
- /**
- * File menu: name of "Most Recently Used File" group.
- * (value <code>"mru"</code>).
- */
+ /**
+ * File menu: name of "Most Recently Used File" group. (value
+ * <code>"mru"</code>).
+ */
String MRU = "mru"; //$NON-NLS-1$
- /**
- * File menu: name of standard Quit action (value <code>"quit"</code>).
- *
- * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#QUIT
- * ActionFactory.QUIT.getId()} instead.
- */
- @Deprecated
+ /**
+ * File menu: name of standard Quit action (value <code>"quit"</code>).
+ *
+ * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#QUIT
+ * ActionFactory.QUIT.getId()} instead.
+ */
+ @Deprecated
String QUIT = "quit"; //$NON-NLS-1$
- // Standard edit actions:
- /**
- * Edit menu: name of group for start of menu (value <code>"editStart"</code>).
- */
+ // Standard edit actions:
+ /**
+ * Edit menu: name of group for start of menu (value <code>"editStart"</code>).
+ */
String EDIT_START = "editStart"; // Group. //$NON-NLS-1$
- /**
- * Edit menu: name of group for end of menu (value <code>"editEnd"</code>).
- */
+ /**
+ * Edit menu: name of group for end of menu (value <code>"editEnd"</code>).
+ */
String EDIT_END = "editEnd"; // Group. //$NON-NLS-1$
- /**
- * Edit menu: name of standard Undo global action
- * (value <code>"undo"</code>).
- *
- * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#UNDO
- * ActionFactory.UNDO.getId()} instead.
- */
- @Deprecated
+ /**
+ * Edit menu: name of standard Undo global action (value <code>"undo"</code>).
+ *
+ * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#UNDO
+ * ActionFactory.UNDO.getId()} instead.
+ */
+ @Deprecated
String UNDO = "undo"; // Global action. //$NON-NLS-1$
- /**
- * Edit menu: name of standard Redo global action
- * (value <code>"redo"</code>).
- *
- * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#REDO
- * ActionFactory.REDO.getId()} instead.
- */
- @Deprecated
+ /**
+ * Edit menu: name of standard Redo global action (value <code>"redo"</code>).
+ *
+ * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#REDO
+ * ActionFactory.REDO.getId()} instead.
+ */
+ @Deprecated
String REDO = "redo"; // Global action. //$NON-NLS-1$
- /**
- * Edit menu: name of group for extra Undo-like actions (value <code>"undo.ext"</code>).
- */
+ /**
+ * Edit menu: name of group for extra Undo-like actions (value
+ * <code>"undo.ext"</code>).
+ */
String UNDO_EXT = "undo.ext"; // Group. //$NON-NLS-1$
- /**
- * Edit menu: name of standard Cut global action
- * (value <code>"cut"</code>).
- *
- * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#CUT
- * ActionFactory.CUT.getId()} instead.
- */
- @Deprecated
+ /**
+ * Edit menu: name of standard Cut global action (value <code>"cut"</code>).
+ *
+ * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#CUT
+ * ActionFactory.CUT.getId()} instead.
+ */
+ @Deprecated
String CUT = "cut"; // Global action. //$NON-NLS-1$
- /**
- * Edit menu: name of standard Copy global action
- * (value <code>"copy"</code>).
- *
- * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#COPY
- * ActionFactory.COPY.getId()} instead.
- */
- @Deprecated
+ /**
+ * Edit menu: name of standard Copy global action (value <code>"copy"</code>).
+ *
+ * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#COPY
+ * ActionFactory.COPY.getId()} instead.
+ */
+ @Deprecated
String COPY = "copy"; // Global action. //$NON-NLS-1$
- /**
- * Edit menu: name of standard Paste global action
- * (value <code>"paste"</code>).
- *
- * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#PASTE
- * ActionFactory.PASTE.getId()} instead.
- */
- @Deprecated
+ /**
+ * Edit menu: name of standard Paste global action (value <code>"paste"</code>).
+ *
+ * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#PASTE
+ * ActionFactory.PASTE.getId()} instead.
+ */
+ @Deprecated
String PASTE = "paste"; // Global action. //$NON-NLS-1$
- /**
- * Edit menu: name of group for extra Cut-like actions (value <code>"cut.ext"</code>).
- */
+ /**
+ * Edit menu: name of group for extra Cut-like actions (value
+ * <code>"cut.ext"</code>).
+ */
String CUT_EXT = "cut.ext"; // Group. //$NON-NLS-1$
- /**
- * Edit menu: name of standard Delete global action
- * (value <code>"delete"</code>).
- *
- * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#DELETE
- * ActionFactory.DELETE.getId()} instead.
- */
- @Deprecated
+ /**
+ * Edit menu: name of standard Delete global action (value
+ * <code>"delete"</code>).
+ *
+ * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#DELETE
+ * ActionFactory.DELETE.getId()} instead.
+ */
+ @Deprecated
String DELETE = "delete"; // Global action. //$NON-NLS-1$
- /**
- * Edit menu: name of standard Find global action
- * (value <code>"find"</code>).
- *
- * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#FIND
- * ActionFactory.FIND.getId()} instead.
- */
- @Deprecated
+ /**
+ * Edit menu: name of standard Find global action (value <code>"find"</code>).
+ *
+ * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#FIND
+ * ActionFactory.FIND.getId()} instead.
+ */
+ @Deprecated
String FIND = "find"; // Global action. //$NON-NLS-1$
- /**
- * Edit menu: name of group for extra Find-like actions (value <code>"find.ext"</code>).
- */
+ /**
+ * Edit menu: name of group for extra Find-like actions (value
+ * <code>"find.ext"</code>).
+ */
String FIND_EXT = "find.ext"; // Group. //$NON-NLS-1$
- /**
- * Edit menu: name of standard Select All global action
- * (value <code>"selectAll"</code>).
- *
- * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#SELECT_ALL
- * ActionFactory.SELECT_ALL.getId()} instead.
- */
- @Deprecated
+ /**
+ * Edit menu: name of standard Select All global action (value
+ * <code>"selectAll"</code>).
+ *
+ * @deprecated in 3.0. Use
+ * {@link org.eclipse.ui.actions.ActionFactory#SELECT_ALL
+ * ActionFactory.SELECT_ALL.getId()} instead.
+ */
+ @Deprecated
String SELECT_ALL = "selectAll"; // Global action. //$NON-NLS-1$
- /**
- * Edit menu: name of standard Add Bookmark global action
- * (value <code>"bookmark"</code>).
- *
- * @deprecated in 3.0. Use
- * <code>org.eclipse.ui.ide.IDEActionFactory.BOOKMARK.getId()</code>
- * instead.
- */
- @Deprecated
+ /**
+ * Edit menu: name of standard Add Bookmark global action (value
+ * <code>"bookmark"</code>).
+ *
+ * @deprecated in 3.0. Use
+ * <code>org.eclipse.ui.ide.IDEActionFactory.BOOKMARK.getId()</code>
+ * instead.
+ */
+ @Deprecated
String BOOKMARK = "bookmark"; // Global action. //$NON-NLS-1$
- /**
- * Edit menu: name of standard Add Task global action
- * (value <code>"addTask"</code>).
- *
- * @deprecated in 3.0. Use
- * <code>org.eclipse.ui.ide.IDEActionFactory.ADD_TASK.getId()</code>
- * instead.
- */
- @Deprecated
+ /**
+ * Edit menu: name of standard Add Task global action (value
+ * <code>"addTask"</code>).
+ *
+ * @deprecated in 3.0. Use
+ * <code>org.eclipse.ui.ide.IDEActionFactory.ADD_TASK.getId()</code>
+ * instead.
+ */
+ @Deprecated
String ADD_TASK = "addTask"; // Global action. //$NON-NLS-1$
- /**
- * Edit menu: name of group for extra Add-like actions (value <code>"add.ext"</code>).
- */
+ /**
+ * Edit menu: name of group for extra Add-like actions (value
+ * <code>"add.ext"</code>).
+ */
String ADD_EXT = "add.ext"; // Group. //$NON-NLS-1$
- // Standard workbench actions:
- /**
- * Workbench menu: name of group for start of menu
- * (value <code>"wbStart"</code>).
- */
+ // Standard workbench actions:
+ /**
+ * Workbench menu: name of group for start of menu (value
+ * <code>"wbStart"</code>).
+ */
String WB_START = "wbStart"; // Group. //$NON-NLS-1$
- /**
- * Workbench menu: name of group for end of menu
- * (value <code>"wbEnd"</code>).
- */
+ /**
+ * Workbench menu: name of group for end of menu (value <code>"wbEnd"</code>).
+ */
String WB_END = "wbEnd"; // Group. //$NON-NLS-1$
- /**
- * Workbench menu: name of group for extra Build-like actions
- * (value <code>"build.ext"</code>).
- */
+ /**
+ * Workbench menu: name of group for extra Build-like actions (value
+ * <code>"build.ext"</code>).
+ */
String BUILD_EXT = "build.ext"; // Group. //$NON-NLS-1$
- /**
- * Workbench menu: name of standard Build action
- * (value <code>"build"</code>).
- *
- * @deprecated in 3.0. Use
- * <code>org.eclipse.ui.ide.IDEActionFactory.BUILD.getId()</code>
- * instead.
- */
- @Deprecated
+ /**
+ * Workbench menu: name of standard Build action (value <code>"build"</code>).
+ *
+ * @deprecated in 3.0. Use
+ * <code>org.eclipse.ui.ide.IDEActionFactory.BUILD.getId()</code>
+ * instead.
+ */
+ @Deprecated
String BUILD = "build"; //$NON-NLS-1$
- /**
- * Workbench menu: name of standard Rebuild All action
- * (value <code>"rebuildAll"</code>).
- *
- * @deprecated in 3.0. Use
- * <code>org.eclipse.ui.ide.IDEActionFactory.REBUILD_ALL.getId()</code>
- * instead.
- */
- @Deprecated
+ /**
+ * Workbench menu: name of standard Rebuild All action (value
+ * <code>"rebuildAll"</code>).
+ *
+ * @deprecated in 3.0. Use
+ * <code>org.eclipse.ui.ide.IDEActionFactory.REBUILD_ALL.getId()</code>
+ * instead.
+ */
+ @Deprecated
String REBUILD_ALL = "rebuildAll"; //$NON-NLS-1$
- // Workbench toolbar ids:
- /**
- * Workbench toolbar id for file toolbar group.
- *
- * @since 2.1
- */
+ // Workbench toolbar ids:
+ /**
+ * Workbench toolbar id for file toolbar group.
+ *
+ * @since 2.1
+ */
String TOOLBAR_FILE = "org.eclipse.ui.workbench.file"; //$NON-NLS-1$
- /**
+ /**
* Workbench toolbar id for edit toolbar group.
*
* @since 3.111
*/
String TOOLBAR_EDIT = "org.eclipse.ui.workbench.edit"; //$NON-NLS-1$
- /**
- * Workbench toolbar id for navigate toolbar group.
- *
- * @since 2.1
- */
+ /**
+ * Workbench toolbar id for navigate toolbar group.
+ *
+ * @since 2.1
+ */
String TOOLBAR_NAVIGATE = "org.eclipse.ui.workbench.navigate"; //$NON-NLS-1$
- /**
- * Workbench toolbar id for help toolbar group.
- *
- * @since 3.1
- */
+ /**
+ * Workbench toolbar id for help toolbar group.
+ *
+ * @since 3.1
+ */
String TOOLBAR_HELP = "org.eclipse.ui.workbench.help"; //$NON-NLS-1$
- // Workbench toolbar group ids. To add an item at the beginning of the group,
- // use the GROUP id. To add an item at the end of the group, use the EXT id.
+ // Workbench toolbar group ids. To add an item at the beginning of the group,
+ // use the GROUP id. To add an item at the end of the group, use the EXT id.
- /**
- * Group id for pin toolbar group.
- *
- * @since 2.1
- */
+ /**
+ * Group id for pin toolbar group.
+ *
+ * @since 2.1
+ */
String PIN_GROUP = "pin.group"; //$NON-NLS-1$
- /**
- * Group id for history toolbar group.
- *
- * @since 2.1
- */
+ /**
+ * Group id for history toolbar group.
+ *
+ * @since 2.1
+ */
String HISTORY_GROUP = "history.group"; //$NON-NLS-1$
- /**
- * Group id for new toolbar group.
- *
- * @since 2.1
- */
+ /**
+ * Group id for new toolbar group.
+ *
+ * @since 2.1
+ */
String NEW_GROUP = "new.group"; //$NON-NLS-1$
- /**
- * Group id for save group.
- *
- * @since 2.1
- */
+ /**
+ * Group id for save group.
+ *
+ * @since 2.1
+ */
String SAVE_GROUP = "save.group"; //$NON-NLS-1$
- /**
+ /**
* Group id for build group.
*
* @since 3.111
@@ -606,128 +605,132 @@ public interface IWorkbenchActionConstants {
*/
String BUILD_GROUP = "build.group"; //$NON-NLS-1$
- // Pop-up menu groups:
- /**
- * Pop-up menu: name of group for Managing actions (value <code>"group.managing"</code>).
- */
+ // Pop-up menu groups:
+ /**
+ * Pop-up menu: name of group for Managing actions (value
+ * <code>"group.managing"</code>).
+ */
String GROUP_MANAGING = "group.managing"; //$NON-NLS-1$
- /**
- * Pop-up menu: name of group for Reorganize actions (value <code>"group.reorganize"</code>).
- */
+ /**
+ * Pop-up menu: name of group for Reorganize actions (value
+ * <code>"group.reorganize"</code>).
+ */
String GROUP_REORGANIZE = "group.reorganize"; //$NON-NLS-1$
- /**
- * Pop-up menu: name of group for Add actions (value <code>"group.add"</code>).
- */
+ /**
+ * Pop-up menu: name of group for Add actions (value <code>"group.add"</code>).
+ */
String GROUP_ADD = "group.add"; //$NON-NLS-1$
- /**
- * Pop-up menu: name of group for File actions (value <code>"group.file"</code>).
- */
+ /**
+ * Pop-up menu: name of group for File actions (value
+ * <code>"group.file"</code>).
+ */
String GROUP_FILE = "group.file"; //$NON-NLS-1$
- /**
- * Pop-up menu: name of group for Show In actions (value <code>"group.showIn"</code>).
- *
- * @since 2.1
- */
+ /**
+ * Pop-up menu: name of group for Show In actions (value
+ * <code>"group.showIn"</code>).
+ *
+ * @since 2.1
+ */
String GROUP_SHOW_IN = "group.showIn"; //$NON-NLS-1$
- /**
- * Coolbar: name of group for application created actions
- *
- * @since 3.0
- */
+ /**
+ * Coolbar: name of group for application created actions
+ *
+ * @since 3.0
+ */
String GROUP_APP = "group.application"; //$NON-NLS-1$
- /**
- * Toolbar: name of group for editor action bars.
- */
+ /**
+ * Toolbar: name of group for editor action bars.
+ */
String GROUP_EDITOR = "group.editor"; //$NON-NLS-1$
- /**
- * Coolbar: name of group for help actions and contributions
- *
- * @since 3.1
- */
+ /**
+ * Coolbar: name of group for help actions and contributions
+ *
+ * @since 3.1
+ */
String GROUP_HELP = "group.help"; //$NON-NLS-1$
- // Standard view actions:
- /**
- * View menu: name of group for additional view-like items.
- * (value <code>"additions"</code>).
- */
+ // Standard view actions:
+ /**
+ * View menu: name of group for additional view-like items. (value
+ * <code>"additions"</code>).
+ */
String VIEW_EXT = MB_ADDITIONS; // Group.
- // Standard window actions:
- /**
- * Window menu: name of group for additional window-like items.
- * (value <code>"additions"</code>).
- */
+ // Standard window actions:
+ /**
+ * Window menu: name of group for additional window-like items. (value
+ * <code>"additions"</code>).
+ */
String WINDOW_EXT = MB_ADDITIONS; // Group.
- /**
- * Launch menu: name of group for launching additional windows.
- * (value <code>"additions"</code>).
- */
+ /**
+ * Launch menu: name of group for launching additional windows. (value
+ * <code>"additions"</code>).
+ */
String LAUNCH_EXT = MB_ADDITIONS; // Group.
- // menu reorg
- /**
- * File menu: name of standard Revert global action
- * (value <code>"revert"</code>).
- *
- * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#REVERT
- * ActionFactory.REVERT.getId()} instead.
- */
- @Deprecated
+ // menu reorg
+ /**
+ * File menu: name of standard Revert global action (value
+ * <code>"revert"</code>).
+ *
+ * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#REVERT
+ * ActionFactory.REVERT.getId()} instead.
+ */
+ @Deprecated
String REVERT = "revert"; // Global action. //$NON-NLS-1$
- /**
- * File menu: name of standard Refresh global action
- * (value <code>"refresh"</code>).
- *
- * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#REFRESH
- * ActionFactory.REFRESH.getId()} instead.
- */
- @Deprecated
+ /**
+ * File menu: name of standard Refresh global action (value
+ * <code>"refresh"</code>).
+ *
+ * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#REFRESH
+ * ActionFactory.REFRESH.getId()} instead.
+ */
+ @Deprecated
String REFRESH = "refresh"; // Global action. //$NON-NLS-1$
- /**
- * File menu: name of standard Properties global action
- * (value <code>"properties"</code>).
- *
- * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#PROPERTIES
- * ActionFactory.PROPERTIES.getId()} instead.
- */
- @Deprecated
+ /**
+ * File menu: name of standard Properties global action (value
+ * <code>"properties"</code>).
+ *
+ * @deprecated in 3.0. Use
+ * {@link org.eclipse.ui.actions.ActionFactory#PROPERTIES
+ * ActionFactory.PROPERTIES.getId()} instead.
+ */
+ @Deprecated
String PROPERTIES = "properties"; // Global action. //$NON-NLS-1$
- /**
- * Edit menu: name of standard Move global action
- * (value <code>"move"</code>).
- *
- * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#MOVE
- * ActionFactory.MOVE.getId()} instead.
- */
- @Deprecated
+ /**
+ * Edit menu: name of standard Move global action (value <code>"move"</code>).
+ *
+ * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#MOVE
+ * ActionFactory.MOVE.getId()} instead.
+ */
+ @Deprecated
String MOVE = "move"; // Global action. //$NON-NLS-1$
- /**
- * Edit menu: name of standard Rename global action
- * (value <code>"rename"</code>).
- *
- * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#RENAME
- * ActionFactory.RENAME.getId()} instead.
- */
- @Deprecated
+ /**
+ * Edit menu: name of standard Rename global action (value
+ * <code>"rename"</code>).
+ *
+ * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#RENAME
+ * ActionFactory.RENAME.getId()} instead.
+ */
+ @Deprecated
String RENAME = "rename"; // Global action. //$NON-NLS-1$
- /**
- * Edit menu: name of standard Add Task global action
- * (value <code>"addTask"</code>).
- */
+ /**
+ * Edit menu: name of standard Add Task global action (value
+ * <code>"addTask"</code>).
+ */
// String ADD_TASK = "addTask"; // Global action. //$NON-NLS-1$
/**
@@ -746,200 +749,192 @@ public interface IWorkbenchActionConstants {
*/
String PERSPECTIVE_END = "perspectiveStartEnd"; // Group. //$NON-NLS-1$
- /**
- * Navigate menu: name of group for start of menu
- * (value <code>"navStart"</code>).
- */
+ /**
+ * Navigate menu: name of group for start of menu (value
+ * <code>"navStart"</code>).
+ */
String NAV_START = "navStart"; // Group. //$NON-NLS-1$
- /**
- * Navigate menu: name of group for end of menu
- * (value <code>"navEnd"</code>).
- */
+ /**
+ * Navigate menu: name of group for end of menu (value <code>"navEnd"</code>).
+ */
String NAV_END = "navEnd"; // Group. //$NON-NLS-1$
- /**
- * File and Navigate menu: name of group for extra Open actions
- * (value <code>"open.ext"</code>).
- */
+ /**
+ * File and Navigate menu: name of group for extra Open actions (value
+ * <code>"open.ext"</code>).
+ */
String OPEN_EXT = "open.ext"; // Group. //$NON-NLS-1$
- /**
- * Navigate menu: name of group for extra Show actions
- * (value <code>"show.ext"</code>).
- */
+ /**
+ * Navigate menu: name of group for extra Show actions (value
+ * <code>"show.ext"</code>).
+ */
String SHOW_EXT = "show.ext"; // Group. //$NON-NLS-1$
- /**
- * Navigate menu: name of standard Go Into global action
- * (value <code>"goInto"</code>).
- */
+ /**
+ * Navigate menu: name of standard Go Into global action (value
+ * <code>"goInto"</code>).
+ */
String GO_INTO = "goInto"; // Global action. //$NON-NLS-1$
- /**
- * Navigate menu: name of standard Go To submenu
- * (value <code>"goTo"</code>).
- */
+ /**
+ * Navigate menu: name of standard Go To submenu (value <code>"goTo"</code>).
+ */
String GO_TO = "goTo"; //$NON-NLS-1$
- /**
- * Navigate menu: name of standard Go To Resource global action
- * (value <code>"goToResource"</code>).
- */
+ /**
+ * Navigate menu: name of standard Go To Resource global action (value
+ * <code>"goToResource"</code>).
+ */
String GO_TO_RESOURCE = "goToResource"; // Global action. //$NON-NLS-1$
- /**
- * Navigate menu: name of standard Sync With Editor global action (value
- * <code>"syncEditor"</code>).
- *
- * @deprecated this action will be removed soon; use SHOW_IN instead
- */
- @Deprecated
+ /**
+ * Navigate menu: name of standard Sync With Editor global action (value
+ * <code>"syncEditor"</code>).
+ *
+ * @deprecated this action will be removed soon; use SHOW_IN instead
+ */
+ @Deprecated
String SYNC_EDITOR = "syncEditor"; // Global action. //$NON-NLS-1$
- /**
- * Navigate menu: name of standard Show In... action
- * (value <code>"showIn"</code>).
- *
- * @since 2.1
- *
- * @deprecated
- */
- @Deprecated
+ /**
+ * Navigate menu: name of standard Show In... action (value
+ * <code>"showIn"</code>).
+ *
+ * @since 2.1
+ *
+ * @deprecated
+ */
+ @Deprecated
String SHOW_IN = "showIn"; //$NON-NLS-1$
- /**
- * Navigate menu: name of standard Back global action
- * (value <code>"back"</code>).
- *
- * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#BACK
- * ActionFactory.BACK.getId()} instead.
- */
- @Deprecated
+ /**
+ * Navigate menu: name of standard Back global action (value
+ * <code>"back"</code>).
+ *
+ * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#BACK
+ * ActionFactory.BACK.getId()} instead.
+ */
+ @Deprecated
String BACK = "back"; // Global action. //$NON-NLS-1$
- /**
- * Navigate menu: name of standard Forward global action
- * (value <code>"forward"</code>).
- *
- * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#FORWARD
- * ActionFactory.FORWARD.getId()} instead.
- */
- @Deprecated
+ /**
+ * Navigate menu: name of standard Forward global action (value
+ * <code>"forward"</code>).
+ *
+ * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#FORWARD
+ * ActionFactory.FORWARD.getId()} instead.
+ */
+ @Deprecated
String FORWARD = "forward"; // Global action. //$NON-NLS-1$
- /**
- * Navigate menu: name of standard Up global action
- * (value <code>"up"</code>).
- */
+ /**
+ * Navigate menu: name of standard Up global action (value <code>"up"</code>).
+ */
String UP = "up"; // Global action. //$NON-NLS-1$
- /**
- * Navigate menu: name of standard Next global action
- * (value <code>"next"</code>).
- *
- * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#NEXT
- * ActionFactory.NEXT.getId()} instead.
- */
- @Deprecated
+ /**
+ * Navigate menu: name of standard Next global action (value
+ * <code>"next"</code>).
+ *
+ * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#NEXT
+ * ActionFactory.NEXT.getId()} instead.
+ */
+ @Deprecated
String NEXT = "next"; // Global action. //$NON-NLS-1$
- /**
- * Navigate menu: name of standard Up global action
- * (value <code>"previous"</code>).
- *
- * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#PREVIOUS
- * ActionFactory.PREVIOUS.getId()} instead.
- */
- @Deprecated
+ /**
+ * Navigate menu: name of standard Up global action (value
+ * <code>"previous"</code>).
+ *
+ * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#PREVIOUS
+ * ActionFactory.PREVIOUS.getId()} instead.
+ */
+ @Deprecated
String PREVIOUS = "previous"; // Global action. //$NON-NLS-1$
- /**
- * Project menu: name of group for start of menu
- * (value <code>"projStart"</code>).
- */
+ /**
+ * Project menu: name of group for start of menu (value
+ * <code>"projStart"</code>).
+ */
String PROJ_START = "projStart"; // Group. //$NON-NLS-1$
- /**
- * Project menu: name of group for start of menu
- * (value <code>"projEnd"</code>).
- */
+ /**
+ * Project menu: name of group for start of menu (value <code>"projEnd"</code>).
+ */
String PROJ_END = "projEnd"; // Group. //$NON-NLS-1$
- /**
- * Project menu: name of standard Build Project global action
- * (value <code>"buildProject"</code>).
- *
- * @deprecated in 3.0. Use
- * <code>org.eclipse.ui.ide.IDEActionFactory.BUILD_PROJECT.getId()</code>
- * instead.
- */
- @Deprecated
+ /**
+ * Project menu: name of standard Build Project global action (value
+ * <code>"buildProject"</code>).
+ *
+ * @deprecated in 3.0. Use
+ * <code>org.eclipse.ui.ide.IDEActionFactory.BUILD_PROJECT.getId()</code>
+ * instead.
+ */
+ @Deprecated
String BUILD_PROJECT = "buildProject"; // Global action. //$NON-NLS-1$
- /**
- * Project menu: name of standard Rebuild Project global action
- * (value <code>"rebuildProject"</code>).
- *
- * @deprecated in 3.0. Use
- * <code>org.eclipse.ui.ide.IDEActionFactory.REBUILD_PROJECT.getId()</code>
- * instead.
- */
- @Deprecated
+ /**
+ * Project menu: name of standard Rebuild Project global action (value
+ * <code>"rebuildProject"</code>).
+ *
+ * @deprecated in 3.0. Use
+ * <code>org.eclipse.ui.ide.IDEActionFactory.REBUILD_PROJECT.getId()</code>
+ * instead.
+ */
+ @Deprecated
String REBUILD_PROJECT = "rebuildProject"; // Global action. //$NON-NLS-1$
- /**
- * Project menu: name of standard Open Project global action
- * (value <code>"openProject"</code>).
- *
- * @deprecated in 3.0. Use
- * <code>org.eclipse.ui.ide.IDEActionFactory.OPEN_PROJECT.getId()</code>
- * instead.
- */
- @Deprecated
+ /**
+ * Project menu: name of standard Open Project global action (value
+ * <code>"openProject"</code>).
+ *
+ * @deprecated in 3.0. Use
+ * <code>org.eclipse.ui.ide.IDEActionFactory.OPEN_PROJECT.getId()</code>
+ * instead.
+ */
+ @Deprecated
String OPEN_PROJECT = "openProject"; // Global action. //$NON-NLS-1$
- /**
- * Project menu: name of standard Close Project global action
- * (value <code>"closeProject"</code>).
- *
- * @deprecated in 3.0. Use
- * <code>org.eclipse.ui.ide.IDEActionFactory.CLOSE_PROJECT.getId()</code>
- * instead.
- */
- @Deprecated
+ /**
+ * Project menu: name of standard Close Project global action (value
+ * <code>"closeProject"</code>).
+ *
+ * @deprecated in 3.0. Use
+ * <code>org.eclipse.ui.ide.IDEActionFactory.CLOSE_PROJECT.getId()</code>
+ * instead.
+ */
+ @Deprecated
String CLOSE_PROJECT = "closeProject"; // Global action. //$NON-NLS-1$
- // end menu reorg
+ // end menu reorg
- // Standard help actions:
- /**
- * Help menu: name of group for start of menu
- * (value <code>"helpStart"</code>).
- */
+ // Standard help actions:
+ /**
+ * Help menu: name of group for start of menu (value <code>"helpStart"</code>).
+ */
String HELP_START = "helpStart"; // Group. //$NON-NLS-1$
- /**
- * Help menu: name of group for end of menu
- * (value <code>"helpEnd"</code>).
- */
+ /**
+ * Help menu: name of group for end of menu (value <code>"helpEnd"</code>).
+ */
String HELP_END = "helpEnd"; // Group. //$NON-NLS-1$
- /**
- * Help menu: name of standard About action
- * (value <code>"about"</code>).
- *
- * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#ABOUT
- * ActionFactory.ABOUT.getId()} instead.
- */
- @Deprecated
+ /**
+ * Help menu: name of standard About action (value <code>"about"</code>).
+ *
+ * @deprecated in 3.0. Use {@link org.eclipse.ui.actions.ActionFactory#ABOUT
+ * ActionFactory.ABOUT.getId()} instead.
+ */
+ @Deprecated
String ABOUT = "about"; //$NON-NLS-1$
- /**
- * Standard global actions in a workbench window.
- *
- * @deprecated in 3.0
- */
- @Deprecated
- String[] GLOBAL_ACTIONS = { UNDO, REDO, CUT, COPY,
- PASTE, PRINT, DELETE, FIND, SELECT_ALL, BOOKMARK };
+ /**
+ * Standard global actions in a workbench window.
+ *
+ * @deprecated in 3.0
+ */
+ @Deprecated
+ String[] GLOBAL_ACTIONS = { UNDO, REDO, CUT, COPY, PASTE, PRINT, DELETE, FIND, SELECT_ALL, BOOKMARK };
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchCommandConstants.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchCommandConstants.java
index 07bef58f70f..7ab29616832 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchCommandConstants.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchCommandConstants.java
@@ -23,17 +23,17 @@ package org.eclipse.ui;
*/
public interface IWorkbenchCommandConstants {
- // File Category:
+ // File Category:
- /**
- * Id for command "New" in category "File"
- * (value is <code>"org.eclipse.ui.newWizard"</code>).
- */
+ /**
+ * Id for command "New" in category "File" (value is
+ * <code>"org.eclipse.ui.newWizard"</code>).
+ */
String FILE_NEW = "org.eclipse.ui.newWizard"; //$NON-NLS-1$
/**
- * Id for parameter "New Wizard" in command "New" in category "File" (value
- * is <code>"newWizardId"</code>). Optional.
+ * Id for parameter "New Wizard" in command "New" in category "File" (value is
+ * <code>"newWizardId"</code>). Optional.
*
* @since 3.6
*/
@@ -45,16 +45,16 @@ public interface IWorkbenchCommandConstants {
*/
String FILE_CLOSE = "org.eclipse.ui.file.close"; //$NON-NLS-1$
- /**
- * Id for command "Close All" in category "File"
- * (value is <code>"org.eclipse.ui.file.closeAll"</code>).
- */
+ /**
+ * Id for command "Close All" in category "File" (value is
+ * <code>"org.eclipse.ui.file.closeAll"</code>).
+ */
String FILE_CLOSE_ALL = "org.eclipse.ui.file.closeAll"; //$NON-NLS-1$
- /**
- * Id for command "Import" in category "File"
- * (value is <code>"org.eclipse.ui.file.import"</code>).
- */
+ /**
+ * Id for command "Import" in category "File" (value is
+ * <code>"org.eclipse.ui.file.import"</code>).
+ */
String FILE_IMPORT = "org.eclipse.ui.file.import"; //$NON-NLS-1$
/**
@@ -79,224 +79,224 @@ public interface IWorkbenchCommandConstants {
*/
String FILE_EXPORT_PARM_WIZARDID = "exportWizardId"; //$NON-NLS-1$
- /**
- * Id for command "Save" in category "File"
- * (value is <code>"org.eclipse.ui.file.save"</code>).
- */
+ /**
+ * Id for command "Save" in category "File" (value is
+ * <code>"org.eclipse.ui.file.save"</code>).
+ */
String FILE_SAVE = "org.eclipse.ui.file.save"; //$NON-NLS-1$
- /**
- * Id for command "Save As" in category "File"
- * (value is <code>"org.eclipse.ui.file.saveAs"</code>).
- */
+ /**
+ * Id for command "Save As" in category "File" (value is
+ * <code>"org.eclipse.ui.file.saveAs"</code>).
+ */
String FILE_SAVE_AS = "org.eclipse.ui.file.saveAs"; //$NON-NLS-1$
- /**
- * Id for command "Save All" in category "File"
- * (value is <code>"org.eclipse.ui.file.saveAll"</code>).
- */
+ /**
+ * Id for command "Save All" in category "File" (value is
+ * <code>"org.eclipse.ui.file.saveAll"</code>).
+ */
String FILE_SAVE_ALL = "org.eclipse.ui.file.saveAll"; //$NON-NLS-1$
- /**
- * Id for command "Print" in category "File"
- * (value is <code>"org.eclipse.ui.file.print"</code>).
- */
+ /**
+ * Id for command "Print" in category "File" (value is
+ * <code>"org.eclipse.ui.file.print"</code>).
+ */
String FILE_PRINT = "org.eclipse.ui.file.print"; //$NON-NLS-1$
- /**
- * Id for command "Revert" in category "File"
- * (value is <code>"org.eclipse.ui.file.revert"</code>).
- */
+ /**
+ * Id for command "Revert" in category "File" (value is
+ * <code>"org.eclipse.ui.file.revert"</code>).
+ */
String FILE_REVERT = "org.eclipse.ui.file.revert"; //$NON-NLS-1$
- /**
- * Id for command "Restart" in category "File"
- * (value is <code>"org.eclipse.ui.file.restartWorkbench"</code>).
- */
+ /**
+ * Id for command "Restart" in category "File" (value is
+ * <code>"org.eclipse.ui.file.restartWorkbench"</code>).
+ */
String FILE_RESTART = "org.eclipse.ui.file.restartWorkbench"; //$NON-NLS-1$
- /**
- * Id for command "Refresh" in category "File"
- * (value is <code>"org.eclipse.ui.file.refresh"</code>).
- */
+ /**
+ * Id for command "Refresh" in category "File" (value is
+ * <code>"org.eclipse.ui.file.refresh"</code>).
+ */
String FILE_REFRESH = "org.eclipse.ui.file.refresh"; //$NON-NLS-1$
- /**
- * Id for command "Properties" in category "File"
- * (value is <code>"org.eclipse.ui.file.properties"</code>).
- */
+ /**
+ * Id for command "Properties" in category "File" (value is
+ * <code>"org.eclipse.ui.file.properties"</code>).
+ */
String FILE_PROPERTIES = "org.eclipse.ui.file.properties"; //$NON-NLS-1$
- /**
- * Id for command "Exit" in category "File"
- * (value is <code>"org.eclipse.ui.file.exit"</code>).
- */
+ /**
+ * Id for command "Exit" in category "File" (value is
+ * <code>"org.eclipse.ui.file.exit"</code>).
+ */
String FILE_EXIT = "org.eclipse.ui.file.exit"; //$NON-NLS-1$
- /**
- * Id for command "Move" in category "File"
- * (value is <code>"org.eclipse.ui.edit.move"</code>).
- */
+ /**
+ * Id for command "Move" in category "File" (value is
+ * <code>"org.eclipse.ui.edit.move"</code>).
+ */
String FILE_MOVE = "org.eclipse.ui.edit.move"; //$NON-NLS-1$
- /**
- * Id for command "Rename" in category "File"
- * (value is <code>"org.eclipse.ui.edit.rename"</code>).
- */
+ /**
+ * Id for command "Rename" in category "File" (value is
+ * <code>"org.eclipse.ui.edit.rename"</code>).
+ */
String FILE_RENAME = "org.eclipse.ui.edit.rename"; //$NON-NLS-1$
- /**
- * Id for command "Close Others" in category "File"
- * (value is <code>"org.eclipse.ui.file.closeOthers"</code>).
- */
+ /**
+ * Id for command "Close Others" in category "File" (value is
+ * <code>"org.eclipse.ui.file.closeOthers"</code>).
+ */
String FILE_CLOSE_OTHERS = "org.eclipse.ui.file.closeOthers"; //$NON-NLS-1$
- // Edit Category:
+ // Edit Category:
- /**
- * Id for command "Undo" in category "Edit"
- * (value is <code>"org.eclipse.ui.edit.undo"</code>).
- */
+ /**
+ * Id for command "Undo" in category "Edit" (value is
+ * <code>"org.eclipse.ui.edit.undo"</code>).
+ */
String EDIT_UNDO = "org.eclipse.ui.edit.undo"; //$NON-NLS-1$
- /**
- * Id for command "Redo" in category "Edit"
- * (value is <code>"org.eclipse.ui.edit.redo"</code>).
- */
+ /**
+ * Id for command "Redo" in category "Edit" (value is
+ * <code>"org.eclipse.ui.edit.redo"</code>).
+ */
String EDIT_REDO = "org.eclipse.ui.edit.redo"; //$NON-NLS-1$
- /**
- * Id for command "Cut" in category "Edit"
- * (value is <code>"org.eclipse.ui.edit.cut"</code>).
- */
+ /**
+ * Id for command "Cut" in category "Edit" (value is
+ * <code>"org.eclipse.ui.edit.cut"</code>).
+ */
String EDIT_CUT = "org.eclipse.ui.edit.cut"; //$NON-NLS-1$
- /**
- * Id for command "Copy" in category "Edit"
- * (value is <code>"org.eclipse.ui.edit.copy"</code>).
- */
+ /**
+ * Id for command "Copy" in category "Edit" (value is
+ * <code>"org.eclipse.ui.edit.copy"</code>).
+ */
String EDIT_COPY = "org.eclipse.ui.edit.copy"; //$NON-NLS-1$
- /**
- * Id for command "Paste" in category "Edit"
- * (value is <code>"org.eclipse.ui.edit.paste"</code>).
- */
+ /**
+ * Id for command "Paste" in category "Edit" (value is
+ * <code>"org.eclipse.ui.edit.paste"</code>).
+ */
String EDIT_PASTE = "org.eclipse.ui.edit.paste"; //$NON-NLS-1$
- /**
- * Id for command "Delete" in category "Edit"
- * (value is <code>"org.eclipse.ui.edit.delete"</code>).
- */
+ /**
+ * Id for command "Delete" in category "Edit" (value is
+ * <code>"org.eclipse.ui.edit.delete"</code>).
+ */
String EDIT_DELETE = "org.eclipse.ui.edit.delete"; //$NON-NLS-1$
- /**
- * Id for command "Content Assist" in category "Edit"
- * (value is <code>"org.eclipse.ui.edit.text.contentAssist.proposals"</code>).
- */
+ /**
+ * Id for command "Content Assist" in category "Edit" (value is
+ * <code>"org.eclipse.ui.edit.text.contentAssist.proposals"</code>).
+ */
String EDIT_CONTENT_ASSIST = "org.eclipse.ui.edit.text.contentAssist.proposals"; //$NON-NLS-1$
- /**
- * Id for command "Context Information" in category "Edit"
- * (value is <code>"org.eclipse.ui.edit.text.contentAssist.contextInformation"</code>).
- */
+ /**
+ * Id for command "Context Information" in category "Edit" (value is
+ * <code>"org.eclipse.ui.edit.text.contentAssist.contextInformation"</code>).
+ */
String EDIT_CONTEXT_INFORMATION = "org.eclipse.ui.edit.text.contentAssist.contextInformation"; //$NON-NLS-1$
- /**
- * Id for command "Select All" in category "Edit"
- * (value is <code>"org.eclipse.ui.edit.selectAll"</code>).
- */
+ /**
+ * Id for command "Select All" in category "Edit" (value is
+ * <code>"org.eclipse.ui.edit.selectAll"</code>).
+ */
String EDIT_SELECT_ALL = "org.eclipse.ui.edit.selectAll"; //$NON-NLS-1$
- /**
- * Id for command "Find and Replace" in category "Edit"
- * (value is <code>"org.eclipse.ui.edit.findReplace"</code>).
- */
+ /**
+ * Id for command "Find and Replace" in category "Edit" (value is
+ * <code>"org.eclipse.ui.edit.findReplace"</code>).
+ */
String EDIT_FIND_AND_REPLACE = "org.eclipse.ui.edit.findReplace"; //$NON-NLS-1$
- /**
- * Id for command "Add Task" in category "Edit".
- * (value is <code>"org.eclipse.ui.edit.addTask"</code>).
- */
+ /**
+ * Id for command "Add Task" in category "Edit". (value is
+ * <code>"org.eclipse.ui.edit.addTask"</code>).
+ */
String EDIT_ADD_TASK = "org.eclipse.ui.edit.addTask"; //$NON-NLS-1$
- /**
- * Id for command "Add Bookmark" in category "Edit"
- * (value is <code>"org.eclipse.ui.edit.addBookmark"</code>).
- */
+ /**
+ * Id for command "Add Bookmark" in category "Edit" (value is
+ * <code>"org.eclipse.ui.edit.addBookmark"</code>).
+ */
String EDIT_ADD_BOOKMARK = "org.eclipse.ui.edit.addBookmark"; //$NON-NLS-1$
- // Navigate Category:
+ // Navigate Category:
- /**
- * Id for command "Go Into" in category "Navigate"
- * (value is <code>"org.eclipse.ui.navigate.goInto"</code>).
- */
+ /**
+ * Id for command "Go Into" in category "Navigate" (value is
+ * <code>"org.eclipse.ui.navigate.goInto"</code>).
+ */
String NAVIGATE_GO_INTO = "org.eclipse.ui.navigate.goInto"; //$NON-NLS-1$
- /**
- * Id for command "Back" in category "Navigate"
- * (value is <code>"org.eclipse.ui.navigate.back"</code>).
- */
+ /**
+ * Id for command "Back" in category "Navigate" (value is
+ * <code>"org.eclipse.ui.navigate.back"</code>).
+ */
String NAVIGATE_BACK = "org.eclipse.ui.navigate.back"; //$NON-NLS-1$
- /**
- * Id for command "Forward" in category "Navigate"
- * (value is <code>"org.eclipse.ui.navigate.forward"</code>).
- */
+ /**
+ * Id for command "Forward" in category "Navigate" (value is
+ * <code>"org.eclipse.ui.navigate.forward"</code>).
+ */
String NAVIGATE_FORWARD = "org.eclipse.ui.navigate.forward"; //$NON-NLS-1$
- /**
- * Id for command "Up" in category "Navigate"
- * (value is <code>"org.eclipse.ui.navigate.up"</code>).
- */
+ /**
+ * Id for command "Up" in category "Navigate" (value is
+ * <code>"org.eclipse.ui.navigate.up"</code>).
+ */
String NAVIGATE_UP = "org.eclipse.ui.navigate.up"; //$NON-NLS-1$
- /**
- * Id for command "Next" in category "Navigate"
- * (value is <code>"org.eclipse.ui.navigate.next"</code>).
- */
+ /**
+ * Id for command "Next" in category "Navigate" (value is
+ * <code>"org.eclipse.ui.navigate.next"</code>).
+ */
String NAVIGATE_NEXT = "org.eclipse.ui.navigate.next"; //$NON-NLS-1$
- /**
- * Id for command "Backward History" in category "Navigate"
- * (value is <code>"org.eclipse.ui.navigate.backwardHistory"</code>).
- */
+ /**
+ * Id for command "Backward History" in category "Navigate" (value is
+ * <code>"org.eclipse.ui.navigate.backwardHistory"</code>).
+ */
String NAVIGATE_BACKWARD_HISTORY = "org.eclipse.ui.navigate.backwardHistory"; //$NON-NLS-1$
- /**
- * Id for command "Forward History" in category "Navigate"
- * (value is <code>"org.eclipse.ui.navigate.forwardHistory"</code>).
- */
+ /**
+ * Id for command "Forward History" in category "Navigate" (value is
+ * <code>"org.eclipse.ui.navigate.forwardHistory"</code>).
+ */
String NAVIGATE_FORWARD_HISTORY = "org.eclipse.ui.navigate.forwardHistory"; //$NON-NLS-1$
- /**
- * Id for command "Previous" in category "Navigate"
- * (value is <code>"org.eclipse.ui.navigate.previous"</code>).
- */
+ /**
+ * Id for command "Previous" in category "Navigate" (value is
+ * <code>"org.eclipse.ui.navigate.previous"</code>).
+ */
String NAVIGATE_PREVIOUS = "org.eclipse.ui.navigate.previous"; //$NON-NLS-1$
- /**
- * Id for command "Toggle Link with Editor " in category "Navigate"
- * (value is <code>"org.eclipse.ui.navigate.linkWithEditor"</code>).
- */
+ /**
+ * Id for command "Toggle Link with Editor " in category "Navigate" (value is
+ * <code>"org.eclipse.ui.navigate.linkWithEditor"</code>).
+ */
String NAVIGATE_TOGGLE_LINK_WITH_EDITOR = "org.eclipse.ui.navigate.linkWithEditor"; //$NON-NLS-1$
- /**
- * Id for command "Next Page" in category "Navigate"
- * (value is <code>"org.eclipse.ui.part.nextPage"</code>).
- */
+ /**
+ * Id for command "Next Page" in category "Navigate" (value is
+ * <code>"org.eclipse.ui.part.nextPage"</code>).
+ */
String NAVIGATE_NEXT_PAGE = "org.eclipse.ui.part.nextPage"; //$NON-NLS-1$
- /**
- * Id for command "Previous Page" in category "Navigate"
- * (value is <code>"org.eclipse.ui.part.previousPage"</code>).
- */
+ /**
+ * Id for command "Previous Page" in category "Navigate" (value is
+ * <code>"org.eclipse.ui.part.previousPage"</code>).
+ */
String NAVIGATE_PREVIOUS_PAGE = "org.eclipse.ui.part.previousPage"; //$NON-NLS-1$
- /**
- * Id for command "Collapse All" in category "Navigate"
- * (value is <code>"org.eclipse.ui.navigate.collapseAll"</code>).
- */
+ /**
+ * Id for command "Collapse All" in category "Navigate" (value is
+ * <code>"org.eclipse.ui.navigate.collapseAll"</code>).
+ */
String NAVIGATE_COLLAPSE_ALL = "org.eclipse.ui.navigate.collapseAll"; //$NON-NLS-1$
/**
@@ -307,16 +307,15 @@ public interface IWorkbenchCommandConstants {
*/
String NAVIGATE_EXPAND_ALL = "org.eclipse.ui.navigate.expandAll"; //$NON-NLS-1$
- /**
- * Id for command "Show In" in category "Navigate"
- * (value is <code>"org.eclipse.ui.navigate.showIn"</code>).
- */
+ /**
+ * Id for command "Show In" in category "Navigate" (value is
+ * <code>"org.eclipse.ui.navigate.showIn"</code>).
+ */
String NAVIGATE_SHOW_IN = "org.eclipse.ui.navigate.showIn"; //$NON-NLS-1$
/**
* Id for parameter "Target Id" in command "Show In" in category "Navigate"
- * (value is <code>"org.eclipse.ui.navigate.showIn.targetId"</code>).
- * Required.
+ * (value is <code>"org.eclipse.ui.navigate.showIn.targetId"</code>). Required.
*
* @since 3.6
*/
@@ -328,127 +327,127 @@ public interface IWorkbenchCommandConstants {
*/
String NAVIGATE_SHOW_IN_QUICK_MENU = "org.eclipse.ui.navigate.showInQuickMenu"; //$NON-NLS-1$
- // project category
+ // project category
- /**
- * Id for command "Build All" in category "Project".
- * (value is <code>"org.eclipse.ui.project.buildAll"</code>).
- */
+ /**
+ * Id for command "Build All" in category "Project". (value is
+ * <code>"org.eclipse.ui.project.buildAll"</code>).
+ */
String PROJECT_BUILD_ALL = "org.eclipse.ui.project.buildAll"; //$NON-NLS-1$
- /**
- * Id for command "Build Project" in category "Project".
- * (value is <code>"org.eclipse.ui.project.buildProject"</code>).
- */
+ /**
+ * Id for command "Build Project" in category "Project". (value is
+ * <code>"org.eclipse.ui.project.buildProject"</code>).
+ */
String PROJECT_BUILD_PROJECT = "org.eclipse.ui.project.buildProject"; //$NON-NLS-1$
- /**
- * Id for command "Close Project" in category "Project".
- * (value is <code>"org.eclipse.ui.project.closeProject"</code>).
- */
+ /**
+ * Id for command "Close Project" in category "Project". (value is
+ * <code>"org.eclipse.ui.project.closeProject"</code>).
+ */
String PROJECT_CLOSE_PROJECT = "org.eclipse.ui.project.closeProject"; //$NON-NLS-1$
- /**
- * Id for command "Close Unrelated Projects" in category "Project".
- * (value is <code>"org.eclipse.ui.project.closeUnrelatedProjects"</code>).
- */
+ /**
+ * Id for command "Close Unrelated Projects" in category "Project". (value is
+ * <code>"org.eclipse.ui.project.closeUnrelatedProjects"</code>).
+ */
String PROJECT_CLOSE_UNRELATED_PROJECTS = "org.eclipse.ui.project.closeUnrelatedProjects"; //$NON-NLS-1$
- /**
- * Id for command "Open Project" in category "Project".
- * (value is <code>"org.eclipse.ui.project.openProject"</code>).
- */
+ /**
+ * Id for command "Open Project" in category "Project". (value is
+ * <code>"org.eclipse.ui.project.openProject"</code>).
+ */
String PROJECT_OPEN_PROJECT = "org.eclipse.ui.project.openProject"; //$NON-NLS-1$
- // Window Category:
+ // Window Category:
- /**
- * Id for command "New Window" in category "Window"
- * (value is <code>"org.eclipse.ui.window.newWindow"</code>).
- */
+ /**
+ * Id for command "New Window" in category "Window" (value is
+ * <code>"org.eclipse.ui.window.newWindow"</code>).
+ */
String WINDOW_NEW_WINDOW = "org.eclipse.ui.window.newWindow"; //$NON-NLS-1$
- /**
- * Id for command "New Editor" in category "Window"
- * (value is <code>"org.eclipse.ui.window.newEditor"</code>).
- */
+ /**
+ * Id for command "New Editor" in category "Window" (value is
+ * <code>"org.eclipse.ui.window.newEditor"</code>).
+ */
String WINDOW_NEW_EDITOR = "org.eclipse.ui.window.newEditor"; //$NON-NLS-1$
- /**
- * Id for command "Show View Menu" in category "Window"
- * (value is <code>"org.eclipse.ui.window.showViewMenu"</code>).
- */
+ /**
+ * Id for command "Show View Menu" in category "Window" (value is
+ * <code>"org.eclipse.ui.window.showViewMenu"</code>).
+ */
String WINDOW_SHOW_VIEW_MENU = "org.eclipse.ui.window.showViewMenu"; //$NON-NLS-1$
- /**
- * Id for command "Activate Editor" in category "Window"
- * (value is <code>"org.eclipse.ui.window.activateEditor"</code>).
- */
+ /**
+ * Id for command "Activate Editor" in category "Window" (value is
+ * <code>"org.eclipse.ui.window.activateEditor"</code>).
+ */
String WINDOW_ACTIVATE_EDITOR = "org.eclipse.ui.window.activateEditor"; //$NON-NLS-1$
- /**
- * Id for command "Maximize Active View or Editor" in category "Window"
- * (value is <code>"org.eclipse.ui.window.maximizePart"</code>).
- */
+ /**
+ * Id for command "Maximize Active View or Editor" in category "Window" (value
+ * is <code>"org.eclipse.ui.window.maximizePart"</code>).
+ */
String WINDOW_MAXIMIZE_ACTIVE_VIEW_OR_EDITOR = "org.eclipse.ui.window.maximizePart"; //$NON-NLS-1$
- /**
- * Id for command "Minimize Active View or Editor" in category "Window"
- * (value is <code>"org.eclipse.ui.window.minimizePart"</code>).
- */
+ /**
+ * Id for command "Minimize Active View or Editor" in category "Window" (value
+ * is <code>"org.eclipse.ui.window.minimizePart"</code>).
+ */
String WINDOW_MINIMIZE_ACTIVE_VIEW_OR_EDITOR = "org.eclipse.ui.window.minimizePart"; //$NON-NLS-1$
- /**
- * Id for command "Next Editor" in category "Window"
- * (value is <code>"org.eclipse.ui.window.nextEditor"</code>).
- */
+ /**
+ * Id for command "Next Editor" in category "Window" (value is
+ * <code>"org.eclipse.ui.window.nextEditor"</code>).
+ */
String WINDOW_NEXT_EDITOR = "org.eclipse.ui.window.nextEditor"; //$NON-NLS-1$
- /**
- * Id for command "Previous Editor" in category "Window"
- * (value is <code>"org.eclipse.ui.window.previousEditor"</code>).
- */
+ /**
+ * Id for command "Previous Editor" in category "Window" (value is
+ * <code>"org.eclipse.ui.window.previousEditor"</code>).
+ */
String WINDOW_PREVIOUS_EDITOR = "org.eclipse.ui.window.previousEditor"; //$NON-NLS-1$
- /**
- * Id for command "Next View" in category "Window"
- * (value is <code>"org.eclipse.ui.window.nextView"</code>).
- */
+ /**
+ * Id for command "Next View" in category "Window" (value is
+ * <code>"org.eclipse.ui.window.nextView"</code>).
+ */
String WINDOW_NEXT_VIEW = "org.eclipse.ui.window.nextView"; //$NON-NLS-1$
- /**
- * Id for command "Previous View" in category "Window"
- * (value is <code>"org.eclipse.ui.window.previousView"</code>).
- */
+ /**
+ * Id for command "Previous View" in category "Window" (value is
+ * <code>"org.eclipse.ui.window.previousView"</code>).
+ */
String WINDOW_PREVIOUS_VIEW = "org.eclipse.ui.window.previousView"; //$NON-NLS-1$
- /**
- * Id for command "Next Perspective" in category "Window"
- * (value is <code>"org.eclipse.ui.window.nextPerspective"</code>).
- */
+ /**
+ * Id for command "Next Perspective" in category "Window" (value is
+ * <code>"org.eclipse.ui.window.nextPerspective"</code>).
+ */
String WINDOW_NEXT_PERSPECTIVE = "org.eclipse.ui.window.nextPerspective"; //$NON-NLS-1$
- /**
- * Id for command "Previous Perspective" in category "Window"
- * (value is <code>"org.eclipse.ui.window.previousPerspective"</code>).
- */
+ /**
+ * Id for command "Previous Perspective" in category "Window" (value is
+ * <code>"org.eclipse.ui.window.previousPerspective"</code>).
+ */
String WINDOW_PREVIOUS_PERSPECTIVE = "org.eclipse.ui.window.previousPerspective"; //$NON-NLS-1$
- /**
- * Id for command "Close All Perspectives" in category "Window"
- * (value is <code>"org.eclipse.ui.window.closeAllPerspectives"</code>).
- */
+ /**
+ * Id for command "Close All Perspectives" in category "Window" (value is
+ * <code>"org.eclipse.ui.window.closeAllPerspectives"</code>).
+ */
String WINDOW_CLOSE_ALL_PERSPECTIVES = "org.eclipse.ui.window.closeAllPerspectives"; //$NON-NLS-1$
- /**
- * Id for command "Close Perspective" in category "Window"
- * (value is <code>"org.eclipse.ui.window.closePerspective"</code>).
- */
+ /**
+ * Id for command "Close Perspective" in category "Window" (value is
+ * <code>"org.eclipse.ui.window.closePerspective"</code>).
+ */
String WINDOW_CLOSE_PERSPECTIVE = "org.eclipse.ui.window.closePerspective"; //$NON-NLS-1$
/**
- * Id for parameter "Perspective Id" in command "Close Perspective" in
- * category "Window" (value is
+ * Id for parameter "Perspective Id" in command "Close Perspective" in category
+ * "Window" (value is
* <code>"org.eclipse.ui.window.closePerspective.perspectiveId"</code>).
* Optional.
*
@@ -462,27 +461,27 @@ public interface IWorkbenchCommandConstants {
*/
String WINDOW_CLOSE_PART = "org.eclipse.ui.file.closePart"; //$NON-NLS-1$
- /**
- * Id for command "Customize Perspective" in category "Window"
- * (value is <code>"org.eclipse.ui.window.customizePerspective"</code>).
- */
+ /**
+ * Id for command "Customize Perspective" in category "Window" (value is
+ * <code>"org.eclipse.ui.window.customizePerspective"</code>).
+ */
String WINDOW_CUSTOMIZE_PERSPECTIVE = "org.eclipse.ui.window.customizePerspective"; //$NON-NLS-1$
- /**
- * Id for command "Pin Editor" in category "Window"
- * (value is <code>"org.eclipse.ui.window.pinEditor"</code>).
- */
+ /**
+ * Id for command "Pin Editor" in category "Window" (value is
+ * <code>"org.eclipse.ui.window.pinEditor"</code>).
+ */
String WINDOW_PIN_EDITOR = "org.eclipse.ui.window.pinEditor"; //$NON-NLS-1$
- /**
- * Id for command "Preferences" in category "Window"
- * (value is <code>"org.eclipse.ui.window.preferences"</code>).
- */
+ /**
+ * Id for command "Preferences" in category "Window" (value is
+ * <code>"org.eclipse.ui.window.preferences"</code>).
+ */
String WINDOW_PREFERENCES = "org.eclipse.ui.window.preferences"; //$NON-NLS-1$
/**
- * Id for parameter "Preference Page Id" in command "Preferences" in
- * category "Window" (value is <code>"preferencePageId"</code>). Optional.
+ * Id for parameter "Preference Page Id" in command "Preferences" in category
+ * "Window" (value is <code>"preferencePageId"</code>). Optional.
*
* @since 3.6
*/
@@ -494,16 +493,16 @@ public interface IWorkbenchCommandConstants {
*/
String WINDOW_RESET_PERSPECTIVE = "org.eclipse.ui.window.resetPerspective"; //$NON-NLS-1$
- /**
- * Id for command "Save Perspective As" in category "Window"
- * (value is <code>"org.eclipse.ui.window.savePerspective"</code>).
- */
+ /**
+ * Id for command "Save Perspective As" in category "Window" (value is
+ * <code>"org.eclipse.ui.window.savePerspective"</code>).
+ */
String WINDOW_SAVE_PERSPECTIVE_AS = "org.eclipse.ui.window.savePerspective"; //$NON-NLS-1$
- /**
- * Id for command "Show Key Assist" in category "Window"
- * (value is <code>"org.eclipse.ui.window.showKeyAssist"</code>).
- */
+ /**
+ * Id for command "Show Key Assist" in category "Window" (value is
+ * <code>"org.eclipse.ui.window.showKeyAssist"</code>).
+ */
String WINDOW_SHOW_KEY_ASSIST = "org.eclipse.ui.window.showKeyAssist"; //$NON-NLS-1$
/**
@@ -514,64 +513,63 @@ public interface IWorkbenchCommandConstants {
*/
String WINDOW_LOCK_TOOLBAR = "org.eclipse.ui.window.lockToolBar"; //$NON-NLS-1$
- // Help Category:
+ // Help Category:
- /**
- * Id for command "Help Contents" in category "Help"
- * (value is <code>"org.eclipse.ui.help.helpContents"</code>).
- */
+ /**
+ * Id for command "Help Contents" in category "Help" (value is
+ * <code>"org.eclipse.ui.help.helpContents"</code>).
+ */
String HELP_HELP_CONTENTS = "org.eclipse.ui.help.helpContents"; //$NON-NLS-1$
- /**
- * Id for command "Help Search" in category "Help"
- * (value is <code>"org.eclipse.ui.help.helpSearch"</code>).
- */
+ /**
+ * Id for command "Help Search" in category "Help" (value is
+ * <code>"org.eclipse.ui.help.helpSearch"</code>).
+ */
String HELP_HELP_SEARCH = "org.eclipse.ui.help.helpSearch"; //$NON-NLS-1$
- /**
- * Id for command "Dynamic Help" in category "Help"
- * (value is <code>"org.eclipse.ui.help.dynamicHelp"</code>).
- */
+ /**
+ * Id for command "Dynamic Help" in category "Help" (value is
+ * <code>"org.eclipse.ui.help.dynamicHelp"</code>).
+ */
String HELP_DYNAMIC_HELP = "org.eclipse.ui.help.dynamicHelp"; //$NON-NLS-1$
- /**
- * Id for command "Welcome" in category "Help"
- * (value is <code>"org.eclipse.ui.help.quickStartAction"</code>).
- */
+ /**
+ * Id for command "Welcome" in category "Help" (value is
+ * <code>"org.eclipse.ui.help.quickStartAction"</code>).
+ */
String HELP_WELCOME = "org.eclipse.ui.help.quickStartAction"; //$NON-NLS-1$
- /**
- * Id for command "Tips and Tricks" in category "Help"
- * (value is <code>"org.eclipse.ui.help.tipsAndTricksAction"</code>).
- */
+ /**
+ * Id for command "Tips and Tricks" in category "Help" (value is
+ * <code>"org.eclipse.ui.help.tipsAndTricksAction"</code>).
+ */
String HELP_TIPS_AND_TRICKS = "org.eclipse.ui.help.tipsAndTricksAction"; //$NON-NLS-1$
- /**
- * Id for command "About" in category "Help"
- * (value is <code>"org.eclipse.ui.help.aboutAction"</code>).
- */
+ /**
+ * Id for command "About" in category "Help" (value is
+ * <code>"org.eclipse.ui.help.aboutAction"</code>).
+ */
String HELP_ABOUT = "org.eclipse.ui.help.aboutAction"; //$NON-NLS-1$
- // Views Category:
+ // Views Category:
- /**
- * Id for command "Show View" in category "Views"
- * (value is <code>"org.eclipse.ui.views.showView"</code>).
- */
+ /**
+ * Id for command "Show View" in category "Views" (value is
+ * <code>"org.eclipse.ui.views.showView"</code>).
+ */
String VIEWS_SHOW_VIEW = "org.eclipse.ui.views.showView"; //$NON-NLS-1$
/**
- * Id for parameter "View Id" in command "Show View" in category "Views"
- * (value is <code>"org.eclipse.ui.views.showView.viewId"</code>).
+ * Id for parameter "View Id" in command "Show View" in category "Views" (value
+ * is <code>"org.eclipse.ui.views.showView.viewId"</code>).
*
* @since 3.6
*/
String VIEWS_SHOW_VIEW_PARM_ID = "org.eclipse.ui.views.showView.viewId"; //$NON-NLS-1$
/**
- * Id for parameter "Secondary Id" in command "Show View" in category
- * "Views" (value is
- * <code>"org.eclipse.ui.views.showView.secondaryId"</code>).
+ * Id for parameter "Secondary Id" in command "Show View" in category "Views"
+ * (value is <code>"org.eclipse.ui.views.showView.secondaryId"</code>).
*
* @since 3.7
*/
@@ -579,34 +577,32 @@ public interface IWorkbenchCommandConstants {
/**
* Id for parameter "As Fastview" in command "Show View" in category "Views"
- * (value is <code>"org.eclipse.ui.views.showView.makeFast"</code>).
- * Optional.
+ * (value is <code>"org.eclipse.ui.views.showView.makeFast"</code>). Optional.
*
* @since 3.6
*/
String VIEWS_SHOW_VIEW_PARM_FASTVIEW = "org.eclipse.ui.views.showView.makeFast"; //$NON-NLS-1$
- // Perspectives Category:
+ // Perspectives Category:
- /**
- * Id for command "Show Perspective" in category "Perspectives"
- * (value is <code>"org.eclipse.ui.perspectives.showPerspective"</code>).
- */
+ /**
+ * Id for command "Show Perspective" in category "Perspectives" (value is
+ * <code>"org.eclipse.ui.perspectives.showPerspective"</code>).
+ */
String PERSPECTIVES_SHOW_PERSPECTIVE = "org.eclipse.ui.perspectives.showPerspective"; //$NON-NLS-1$
/**
- * Id for parameter "Perspective Id" in command "Show Perspective" in
- * category "Perspectives" (value is
- * <code>"org.eclipse.ui.perspectives.showPerspective.perspectiveId"</code>
- * ).
+ * Id for parameter "Perspective Id" in command "Show Perspective" in category
+ * "Perspectives" (value is
+ * <code>"org.eclipse.ui.perspectives.showPerspective.perspectiveId"</code> ).
*
* @since 3.6
*/
String PERSPECTIVES_SHOW_PERSPECTIVE_PARM_ID = "org.eclipse.ui.perspectives.showPerspective.perspectiveId"; //$NON-NLS-1$
/**
- * Id for parameter "In New Window" in command "Show Perspective" in
- * category "Perspectives" (value is
+ * Id for parameter "In New Window" in command "Show Perspective" in category
+ * "Perspectives" (value is
* <code>"org.eclipse.ui.perspectives.showPerspective.newWindow"</code>).
* Optional.
*
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchListener.java
index c7a17c84933..c85d6e1d18f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchListener.java
@@ -25,39 +25,39 @@ package org.eclipse.ui;
*/
public interface IWorkbenchListener {
- /**
- * Notifies that the workbench is about to shut down.
- * <p>
- * This method is called immediately prior to workbench shutdown before any
- * windows have been closed.
- * </p>
- * <p>
- * The listener may veto a regular shutdown by returning <code>false</code>,
- * although this will be ignored if the workbench is being forced to shut down.
- * </p>
- * <p>
- * Since other workbench listeners may veto the shutdown, the listener should
- * not dispose resources or do any other work during this notification that would
- * leave the workbench in an inconsistent state.
- * </p>
- *
- * @param workbench the workbench
- * @param forced <code>true</code> if the workbench is being forced to shutdown,
- * <code>false</code> for a regular close
- * @return <code>true</code> to allow the workbench to proceed with shutdown,
- * <code>false</code> to veto a non-forced shutdown
- */
- boolean preShutdown(IWorkbench workbench, boolean forced);
+ /**
+ * Notifies that the workbench is about to shut down.
+ * <p>
+ * This method is called immediately prior to workbench shutdown before any
+ * windows have been closed.
+ * </p>
+ * <p>
+ * The listener may veto a regular shutdown by returning <code>false</code>,
+ * although this will be ignored if the workbench is being forced to shut down.
+ * </p>
+ * <p>
+ * Since other workbench listeners may veto the shutdown, the listener should
+ * not dispose resources or do any other work during this notification that
+ * would leave the workbench in an inconsistent state.
+ * </p>
+ *
+ * @param workbench the workbench
+ * @param forced <code>true</code> if the workbench is being forced to
+ * shutdown, <code>false</code> for a regular close
+ * @return <code>true</code> to allow the workbench to proceed with shutdown,
+ * <code>false</code> to veto a non-forced shutdown
+ */
+ boolean preShutdown(IWorkbench workbench, boolean forced);
- /**
- * Performs arbitrary finalization after the workbench stops running.
- * <p>
- * This method is called during workbench shutdown after all windows
- * have been closed.
- * </p>
- *
- * @param workbench the workbench
- */
- void postShutdown(IWorkbench workbench);
+ /**
+ * Performs arbitrary finalization after the workbench stops running.
+ * <p>
+ * This method is called during workbench shutdown after all windows have been
+ * closed.
+ * </p>
+ *
+ * @param workbench the workbench
+ */
+ void postShutdown(IWorkbench workbench);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPage.java
index dc431bd764c..079a97ef356 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPage.java
@@ -45,8 +45,8 @@ import org.eclipse.jface.util.IPropertyChangeListener;
*/
public interface IWorkbenchPage extends IPartService, ISelectionService {
/**
- * An optional attribute within a workspace marker (<code>IMarker</code>)
- * which identifies the preferred editor type to be opened when
+ * An optional attribute within a workspace marker (<code>IMarker</code>) which
+ * identifies the preferred editor type to be opened when
* <code>openEditor</code> is called.
*
* @see #openEditor(IEditorInput, String)
@@ -66,8 +66,8 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
String CHANGE_RESET = "reset"; //$NON-NLS-1$
/**
- * Change event id when the perspective has completed a reset to its
- * original state.
+ * Change event id when the perspective has completed a reset to its original
+ * state.
*
* @since 3.0
* @see IPerspectiveListener
@@ -160,18 +160,17 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
String CHANGE_WORKING_SETS_REPLACE = "workingSetsReplace"; //$NON-NLS-1$
/**
- * Show view mode that indicates the view should be made visible and
- * activated. Use of this mode has the same effect as calling
- * {@link #showView(String)}.
+ * Show view mode that indicates the view should be made visible and activated.
+ * Use of this mode has the same effect as calling {@link #showView(String)}.
*
* @since 3.0
*/
int VIEW_ACTIVATE = 1;
/**
- * Show view mode that indicates the view should be made visible. If the
- * view is opened in the container that contains the active view then this
- * has the same effect as <code>VIEW_CREATE</code>.
+ * Show view mode that indicates the view should be made visible. If the view is
+ * opened in the container that contains the active view then this has the same
+ * effect as <code>VIEW_CREATE</code>.
*
* @since 3.0
*/
@@ -179,9 +178,9 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
/**
* Show view mode that indicates the view should be made created but not
- * necessarily be made visible. It will only be made visible in the event
- * that it is opened in its own container. In other words, only if it is not
- * stacked with another view.
+ * necessarily be made visible. It will only be made visible in the event that
+ * it is opened in its own container. In other words, only if it is not stacked
+ * with another view.
*
* @since 3.0
*/
@@ -204,8 +203,8 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
int MATCH_INPUT = 1;
/**
- * Editor opening match mode specifying that the editor id should be
- * considered when matching against existing editors.
+ * Editor opening match mode specifying that the editor id should be considered
+ * when matching against existing editors.
*
* @since 3.2
*/
@@ -219,16 +218,14 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
int STATE_MINIMIZED = 0;
/**
- * State of a view in a given page when the page is zoomed in on the view
- * stack.
+ * State of a view in a given page when the page is zoomed in on the view stack.
*
* @since 3.2
*/
int STATE_MAXIMIZED = 1;
/**
- * State of a view in a given page when the view stack is in it's normal
- * state.
+ * State of a view in a given page when the view stack is in it's normal state.
*
* @since 3.2
*/
@@ -238,32 +235,28 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
* Activates the given part. The part will be brought to the front and given
* focus. The part must belong to this page.
*
- * @param part
- * the part to activate
+ * @param part the part to activate
*/
void activate(IWorkbenchPart part);
/**
* Adds a property change listener.
*
- * @param listener
- * the property change listener to add
+ * @param listener the property change listener to add
* @since 2.0
* @deprecated client should register listeners on the instance of
* {@link org.eclipse.ui.IWorkingSetManager} returned by
- * {@link org.eclipse.ui.IWorkbench#getWorkingSetManager()}
- * instead.
+ * {@link org.eclipse.ui.IWorkbench#getWorkingSetManager()} instead.
*/
@Deprecated
void addPropertyChangeListener(IPropertyChangeListener listener);
/**
* Moves the given part forward in the Z order of this page so as to make it
- * visible, without changing which part has focus. The part must belong to
- * this page.
+ * visible, without changing which part has focus. The part must belong to this
+ * page.
*
- * @param part
- * the part to bring forward
+ * @param part the part to bring forward
*/
void bringToTop(IWorkbenchPart part);
@@ -271,8 +264,8 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
* Closes this workbench page. If this page is the active one, this honor is
* passed along to one of the window's other pages if possible.
* <p>
- * If the page has an open editor with unsaved content, the user will be
- * given the opportunity to save it.
+ * If the page has an open editor with unsaved content, the user will be given
+ * the opportunity to save it.
* </p>
*
* @return <code>true</code> if the page was successfully closed, and
@@ -297,20 +290,17 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
boolean closeAllEditors(boolean save);
/**
- * Closes the given <code>Array</code> of editor references. The editors
- * must belong to this workbench page.
+ * Closes the given <code>Array</code> of editor references. The editors must
+ * belong to this workbench page.
* <p>
* If any of the editors have unsaved content and <code>save</code> is
- * <code>true</code>, the user will be given the opportunity to save
- * them.
+ * <code>true</code>, the user will be given the opportunity to save them.
* </p>
*
- * @param editorRefs
- * the editors to close
- * @param save
- * <code>true</code> to save the editor contents if required
- * (recommended), and <code>false</code> to discard any unsaved
- * changes
+ * @param editorRefs the editors to close
+ * @param save <code>true</code> to save the editor contents if required
+ * (recommended), and <code>false</code> to discard any
+ * unsaved changes
* @return <code>true</code> if the editors were successfully closed, and
* <code>false</code> if the editors are still open
* @since 3.0
@@ -320,16 +310,14 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
/**
* Closes the given editor. The editor must belong to this workbench page.
* <p>
- * If the editor has unsaved content and <code>save</code> is
- * <code>true</code>, the user will be given the opportunity to save it.
+ * If the editor has unsaved content and <code>save</code> is <code>true</code>,
+ * the user will be given the opportunity to save it.
* </p>
*
- * @param editor
- * the editor to close
- * @param save
- * <code>true</code> to save the editor contents if required
- * (recommended), and <code>false</code> to discard any unsaved
- * changes
+ * @param editor the editor to close
+ * @param save <code>true</code> to save the editor contents if required
+ * (recommended), and <code>false</code> to discard any unsaved
+ * changes
* @return <code>true</code> if the editor was successfully closed, and
* <code>false</code> if the editor is still open
*/
@@ -339,8 +327,7 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
* Returns the view in this page with the specified id. There is at most one
* view in the page with the specified id.
*
- * @param viewId
- * the id of the view extension to use
+ * @param viewId the id of the view extension to use
* @return the view, or <code>null</code> if none is found
*/
IViewPart findView(String viewId);
@@ -348,8 +335,7 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
/**
* Returns the view reference with the specified id.
*
- * @param viewId
- * the id of the view extension to use
+ * @param viewId the id of the view extension to use
* @return the view reference, or <code>null</code> if none is found
* @since 3.0
*/
@@ -358,11 +344,9 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
/**
* Returns the view reference with the specified id and secondary id.
*
- * @param viewId
- * the id of the view extension to use
- * @param secondaryId
- * the secondary id to use, or <code>null</code> for no
- * secondary id
+ * @param viewId the id of the view extension to use
+ * @param secondaryId the secondary id to use, or <code>null</code> for no
+ * secondary id
* @return the view reference, or <code>null</code> if none is found
* @since 3.0
*/
@@ -371,8 +355,8 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
/**
* Returns the active editor open in this page.
* <p>
- * This is the visible editor on the page, or, if there is more than one
- * visible editor, this is the one most recently brought to top.
+ * This is the visible editor on the page, or, if there is more than one visible
+ * editor, this is the one most recently brought to top.
* </p>
*
* @return the active editor, or <code>null</code> if no editor is active
@@ -383,26 +367,22 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
* Returns the editor with the specified input. Returns null if there is no
* opened editor with that input.
*
- * @param input
- * the editor input
+ * @param input the editor input
* @return an editor with input equals to <code>input</code>
*/
IEditorPart findEditor(IEditorInput input);
/**
* Returns an array of editor references that match the given input and/or
- * editor id, as specified by the given match flags. Returns an empty array
- * if there are no matching editors, or if matchFlags is MATCH_NONE.
- *
- * @param input
- * the editor input, or <code>null</code> if MATCH_INPUT is not
- * specified in matchFlags
- * @param editorId
- * the editor id, or <code>null</code> if MATCH_ID is not
- * specified in matchFlags
- * @param matchFlags
- * a bit mask consisting of zero or more of the MATCH_* constants
- * OR-ed together
+ * editor id, as specified by the given match flags. Returns an empty array if
+ * there are no matching editors, or if matchFlags is MATCH_NONE.
+ *
+ * @param input the editor input, or <code>null</code> if MATCH_INPUT is
+ * not specified in matchFlags
+ * @param editorId the editor id, or <code>null</code> if MATCH_ID is not
+ * specified in matchFlags
+ * @param matchFlags a bit mask consisting of zero or more of the MATCH_*
+ * constants OR-ed together
* @return the references for the matching editors
*
* @see #MATCH_NONE
@@ -410,8 +390,7 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
* @see #MATCH_ID
* @since 3.2
*/
- IEditorReference[] findEditors(IEditorInput input, String editorId,
- int matchFlags);
+ IEditorReference[] findEditors(IEditorInput input, String editorId, int matchFlags);
/**
* Returns a list of the editors open in this page.
@@ -423,9 +402,8 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
* @return a list of open editors
*
* @deprecated Clients are encouraged to use {@link #getEditorReferences()}
- * instead. Calling this method has the side effect of restoring
- * all the editors in the page which can cause plug-in
- * activation.
+ * instead. Calling this method has the side effect of restoring all
+ * the editors in the page which can cause plug-in activation.
*/
@Deprecated
IEditorPart[] getEditors();
@@ -476,8 +454,7 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
/**
* Returns a list of the reference to views visible on this page.
* <p>
- * Note that each page has its own views; views are never shared between
- * pages.
+ * Note that each page has its own views; views are never shared between pages.
* </p>
*
* @return a list of references to visible views
@@ -487,15 +464,14 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
/**
* Returns a list of the views visible on this page.
* <p>
- * Note that each page has its own views; views are never shared between
- * pages.
+ * Note that each page has its own views; views are never shared between pages.
* </p>
*
* @return a list of visible views
*
* @deprecated Clients are encouraged to use {@link #getViewReferences()}
- * instead. Calling this method has the side effect of restoring
- * all the views in the page which can cause plug-in activation.
+ * instead. Calling this method has the side effect of restoring all
+ * the views in the page which can cause plug-in activation.
*/
@Deprecated
IViewPart[] getViews();
@@ -520,31 +496,27 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
/**
* Hides an action set in this page.
* <p>
- * In most cases where this method is used the caller is tightly coupled to
- * a particular action set. They define it in the registry and may make it
- * visible in certain scenarios by calling <code>showActionSet</code>. A
- * static variable is often used to identify the action set id in caller
- * code.
+ * In most cases where this method is used the caller is tightly coupled to a
+ * particular action set. They define it in the registry and may make it visible
+ * in certain scenarios by calling <code>showActionSet</code>. A static variable
+ * is often used to identify the action set id in caller code.
* </p>
*
- * @param actionSetID
- * the action set to hide
+ * @param actionSetID the action set to hide
*/
void hideActionSet(String actionSetID);
/**
* Hides the given view. The view must belong to this page.
*
- * @param view
- * the view to hide
+ * @param view the view to hide
*/
void hideView(IViewPart view);
/**
* Hides the given view that belongs to the reference, if any.
*
- * @param view
- * the references whos view is to be hidden
+ * @param view the references whos view is to be hidden
* @since 3.0
*/
void hideView(IViewReference view);
@@ -552,15 +524,13 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
/**
* Returns whether the specified part is visible.
*
- * @param part
- * the part to test
+ * @param part the part to test
* @return boolean <code>true</code> if part is visible
*/
boolean isPartVisible(IWorkbenchPart part);
/**
- * Returns whether the page's current perspective is showing the editor
- * area.
+ * Returns whether the page's current perspective is showing the editor area.
*
* @return <code>true</code> when editor area visible, <code>false</code>
* otherwise
@@ -570,10 +540,8 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
/**
* Reuses the specified editor by setting its new input.
*
- * @param editor
- * the editor to be reused
- * @param input
- * the new input for the reusable editor
+ * @param editor the editor to be reused
+ * @param input the new input for the reusable editor
*/
void reuseEditor(IReusableEditor editor, IEditorInput input);
@@ -604,8 +572,7 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
* @exception PartInitException if the editor could not be created or
* initialized
*/
- IEditorPart openEditor(IEditorInput input, String editorId)
- throws PartInitException;
+ IEditorPart openEditor(IEditorInput input, String editorId) throws PartInitException;
/**
* Opens an editor on the given input.
@@ -632,8 +599,7 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
* @exception PartInitException if the editor could not be created or
* initialized
*/
- IEditorPart openEditor(IEditorInput input, String editorId,
- boolean activate) throws PartInitException;
+ IEditorPart openEditor(IEditorInput input, String editorId, boolean activate) throws PartInitException;
/**
* Opens an editor on the given input.
@@ -668,37 +634,34 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
* @see #MATCH_ID
* @since 3.2
*/
- IEditorPart openEditor(final IEditorInput input,
- final String editorId, final boolean activate, final int matchFlags)
- throws PartInitException;
+ IEditorPart openEditor(final IEditorInput input, final String editorId, final boolean activate,
+ final int matchFlags) throws PartInitException;
/**
* Removes the property change listener.
*
- * @param listener
- * the property change listener to remove
+ * @param listener the property change listener to remove
* @since 2.0
*/
void removePropertyChangeListener(IPropertyChangeListener listener);
/**
- * Changes the visible views, their layout, and the visible action sets
- * within the page to match the current perspective descriptor. This is a
- * rearrangement of components and not a replacement. The contents of the
- * current perspective descriptor are unaffected.
+ * Changes the visible views, their layout, and the visible action sets within
+ * the page to match the current perspective descriptor. This is a rearrangement
+ * of components and not a replacement. The contents of the current perspective
+ * descriptor are unaffected.
* <p>
- * For more information on perspective change see
- * <code>setPerspective()</code>.
+ * For more information on perspective change see <code>setPerspective()</code>.
* </p>
*/
void resetPerspective();
/**
- * Saves the contents of all dirty editors belonging to this workbench page.
- * If there are no dirty editors this method returns without effect.
+ * Saves the contents of all dirty editors belonging to this workbench page. If
+ * there are no dirty editors this method returns without effect.
* <p>
- * If <code>confirm</code> is <code>true</code> the user is prompted to
- * confirm the command.
+ * If <code>confirm</code> is <code>true</code> the user is prompted to confirm
+ * the command.
* </p>
* <p>
* Note that as of 3.2, this method also saves views that implement
@@ -706,110 +669,103 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
* </p>
*
* @param confirm <code>true</code> to ask the user before saving unsaved
- * changes (recommended), and <code>false</code> to save
- * unsaved changes without asking
- * @return <code>true</code> if the command succeeded, and
- * <code>false</code> if the operation was canceled by the user or
- * an error occurred while saving
+ * changes (recommended), and <code>false</code> to save unsaved
+ * changes without asking
+ * @return <code>true</code> if the command succeeded, and <code>false</code> if
+ * the operation was canceled by the user or an error occurred while
+ * saving
*/
boolean saveAllEditors(boolean confirm);
/**
- * Saves the contents of the given editor if dirty. If not, this method
- * returns without effect.
+ * Saves the contents of the given editor if dirty. If not, this method returns
+ * without effect.
* <p>
- * If <code>confirm</code> is <code>true</code> the user is prompted to
- * confirm the command. Otherwise, the save happens without prompt.
+ * If <code>confirm</code> is <code>true</code> the user is prompted to confirm
+ * the command. Otherwise, the save happens without prompt.
* </p>
* <p>
* The editor must belong to this workbench page.
* </p>
*
- * @param editor
- * the editor to close
- * @param confirm
- * <code>true</code> to ask the user before saving unsaved
- * changes (recommended), and <code>false</code> to save
- * unsaved changes without asking
- * @return <code>true</code> if the command succeeded, and
- * <code>false</code> if the editor was not saved
+ * @param editor the editor to close
+ * @param confirm <code>true</code> to ask the user before saving unsaved
+ * changes (recommended), and <code>false</code> to save unsaved
+ * changes without asking
+ * @return <code>true</code> if the command succeeded, and <code>false</code> if
+ * the editor was not saved
*/
boolean saveEditor(IEditorPart editor, boolean confirm);
/**
- * Saves the visible views, their layout, and the visible action sets for
- * this page to the current perspective descriptor. The contents of the
- * current perspective descriptor are overwritten.
+ * Saves the visible views, their layout, and the visible action sets for this
+ * page to the current perspective descriptor. The contents of the current
+ * perspective descriptor are overwritten.
*/
void savePerspective();
/**
- * Saves the visible views, their layout, and the visible action sets for
- * this page to the given perspective descriptor. The contents of the given
+ * Saves the visible views, their layout, and the visible action sets for this
+ * page to the given perspective descriptor. The contents of the given
* perspective descriptor are overwritten and it is made the current one for
* this page.
*
- * @param perspective
- * the perspective descriptor to save to
+ * @param perspective the perspective descriptor to save to
*/
void savePerspectiveAs(IPerspectiveDescriptor perspective);
/**
* Show or hide the editor area for the page's active perspective.
*
- * @param showEditorArea
- * <code>true</code> to show the editor area,
- * <code>false</code> to hide the editor area
+ * @param showEditorArea <code>true</code> to show the editor area,
+ * <code>false</code> to hide the editor area
*/
void setEditorAreaVisible(boolean showEditorArea);
/**
- * Changes the visible views, their layout, and the visible action sets
- * within the page to match the given perspective descriptor. This is a
- * rearrangement of components and not a replacement. The contents of the
- * old perspective descriptor are unaffected.
+ * Changes the visible views, their layout, and the visible action sets within
+ * the page to match the given perspective descriptor. This is a rearrangement
+ * of components and not a replacement. The contents of the old perspective
+ * descriptor are unaffected.
* <p>
- * When a perspective change occurs the old perspective is deactivated
- * (hidden) and cached for future reference. Then the new perspective is
- * activated (shown). The views within the page are shared by all existing
- * perspectives to make it easy for the user to switch between one
- * perspective and another quickly without loss of context.
+ * When a perspective change occurs the old perspective is deactivated (hidden)
+ * and cached for future reference. Then the new perspective is activated
+ * (shown). The views within the page are shared by all existing perspectives to
+ * make it easy for the user to switch between one perspective and another
+ * quickly without loss of context.
* </p>
* <p>
- * During activation the action sets are modified. If an action set is
- * specified in the new perspective which is not visible in the old one it
- * will be created. If an old action set is not specified in the new
- * perspective it will be disposed.
+ * During activation the action sets are modified. If an action set is specified
+ * in the new perspective which is not visible in the old one it will be
+ * created. If an old action set is not specified in the new perspective it will
+ * be disposed.
* </p>
* <p>
- * The visible views and their layout within the page also change. If a view
- * is specified in the new perspective which is not visible in the old one a
- * new instance of the view will be created. If an old view is not specified
- * in the new perspective it will be hidden. This view may reappear if the
- * user selects it from the View menu or if they switch to a perspective
- * (which may be the old one) where the view is visible.
+ * The visible views and their layout within the page also change. If a view is
+ * specified in the new perspective which is not visible in the old one a new
+ * instance of the view will be created. If an old view is not specified in the
+ * new perspective it will be hidden. This view may reappear if the user selects
+ * it from the View menu or if they switch to a perspective (which may be the
+ * old one) where the view is visible.
* </p>
* <p>
* The open editors are not modified by this method.
* </p>
*
- * @param perspective
- * the perspective descriptor
+ * @param perspective the perspective descriptor
*/
void setPerspective(IPerspectiveDescriptor perspective);
/**
* Shows an action set in this page.
* <p>
- * In most cases where this method is used the caller is tightly coupled to
- * a particular action set. They define it in the registry and may make it
- * visible in certain scenarios by calling <code>showActionSet</code>. A
- * static variable is often used to identify the action set id in caller
- * code.
+ * In most cases where this method is used the caller is tightly coupled to a
+ * particular action set. They define it in the registry and may make it visible
+ * in certain scenarios by calling <code>showActionSet</code>. A static variable
+ * is often used to identify the action set id in caller code.
* </p>
*
- * @param actionSetID
- * the action set to show
+ * @param actionSetID the action set to show
*/
void showActionSet(String actionSetID);
@@ -818,53 +774,43 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
* focus. If there is a view identified by the given view id (and with no
* secondary id) already open in this page, it is given focus.
*
- * @param viewId
- * the id of the view extension to use
+ * @param viewId the id of the view extension to use
* @return the shown view
- * @exception PartInitException
- * if the view could not be initialized
+ * @exception PartInitException if the view could not be initialized
*/
IViewPart showView(String viewId) throws PartInitException;
/**
- * Shows a view in this page with the given id and secondary id. The
- * behaviour of this method varies based on the supplied mode. If
+ * Shows a view in this page with the given id and secondary id. The behaviour
+ * of this method varies based on the supplied mode. If
* <code>VIEW_ACTIVATE</code> is supplied, the view is given focus. If
- * <code>VIEW_VISIBLE</code> is supplied, then it is made visible but not
- * given focus. Finally, if <code>VIEW_CREATE</code> is supplied the view is
- * created and will only be made visible if it is not created in a folder
- * that already contains visible views.
+ * <code>VIEW_VISIBLE</code> is supplied, then it is made visible but not given
+ * focus. Finally, if <code>VIEW_CREATE</code> is supplied the view is created
+ * and will only be made visible if it is not created in a folder that already
+ * contains visible views.
* <p>
- * This allows multiple instances of a particular view to be created. They
- * are disambiguated using the secondary id. If a secondary id is given, the
- * view must allow multiple instances by having specified
- * allowMultiple="true" in its extension.
+ * This allows multiple instances of a particular view to be created. They are
+ * disambiguated using the secondary id. If a secondary id is given, the view
+ * must allow multiple instances by having specified allowMultiple="true" in its
+ * extension.
* </p>
*
- * @param viewId
- * the id of the view extension to use
- * @param secondaryId
- * the secondary id to use, or <code>null</code> for no secondary
- * id
- * @param mode
- * the activation mode. Must be {@link #VIEW_ACTIVATE},
- * {@link #VIEW_VISIBLE} or {@link #VIEW_CREATE}
+ * @param viewId the id of the view extension to use
+ * @param secondaryId the secondary id to use, or <code>null</code> for no
+ * secondary id
+ * @param mode the activation mode. Must be {@link #VIEW_ACTIVATE},
+ * {@link #VIEW_VISIBLE} or {@link #VIEW_CREATE}
* @return a view
- * @exception PartInitException
- * if the view could not be initialized
- * @exception IllegalArgumentException
- * if the supplied mode is not valid
+ * @exception PartInitException if the view could not be initialized
+ * @exception IllegalArgumentException if the supplied mode is not valid
* @since 3.0
*/
- IViewPart showView(String viewId, String secondaryId, int mode)
- throws PartInitException;
+ IViewPart showView(String viewId, String secondaryId, int mode) throws PartInitException;
/**
- * Returns <code>true</code> if the editor is pinned and should not be
- * reused.
+ * Returns <code>true</code> if the editor is pinned and should not be reused.
*
- * @param editor
- * the editor to test
+ * @param editor the editor to test
* @return boolean whether the editor is pinned
*/
boolean isEditorPinned(IEditorPart editor);
@@ -890,10 +836,9 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
void setEditorReuseThreshold(int openEditors);
/**
- * Returns the navigation history which manages a list of entries keeping
- * the history of places (positions, selection and editors) the user visited
- * making it easier to the user to move back and forward without losing
- * context.
+ * Returns the navigation history which manages a list of entries keeping the
+ * history of places (positions, selection and editors) the user visited making
+ * it easier to the user to move back and forward without losing context.
*
* @return the navigation history
* @since 2.1
@@ -901,15 +846,14 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
INavigationHistory getNavigationHistory();
/**
- * Returns an array of IViewParts that are stacked with the given part in
- * the currently active perspective.
+ * Returns an array of IViewParts that are stacked with the given part in the
+ * currently active perspective.
*
- * @param part
- * the part to test
+ * @param part the part to test
* @return the parts that are stacked with this part, including the part in
- * question. <code>null</code> is returned if the part does not
- * belong to this page or the part is not contained in the active
- * perspective. The parts are in LRU order.
+ * question. <code>null</code> is returned if the part does not belong
+ * to this page or the part is not contained in the active perspective.
+ * The parts are in LRU order.
* @since 3.0
*/
IViewPart[] getViewStack(IViewPart part);
@@ -925,8 +869,8 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
String[] getNewWizardShortcuts();
/**
- * Returns the perspective shortcuts associated with the current
- * perspective. Returns an empty array if there is no current perspective.
+ * Returns the perspective shortcuts associated with the current perspective.
+ * Returns an empty array if there is no current perspective.
*
* @see IPageLayout#addPerspectiveShortcut(String)
* @return an array of perspective identifiers
@@ -945,8 +889,8 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
String[] getShowViewShortcuts();
/**
- * Returns the descriptors for the perspectives that are open in this page,
- * in the order in which they were opened.
+ * Returns the descriptors for the perspectives that are open in this page, in
+ * the order in which they were opened.
*
* @return the open perspective descriptors, in order of opening
* @since 3.1
@@ -954,8 +898,8 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
IPerspectiveDescriptor[] getOpenPerspectives();
/**
- * Returns the descriptors for the perspectives that are open in this page,
- * in the order in which they were activated (oldest first).
+ * Returns the descriptors for the perspectives that are open in this page, in
+ * the order in which they were activated (oldest first).
*
* @return the open perspective descriptors, in order of activation
* @since 3.1
@@ -964,41 +908,34 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
/**
* Closes the specified perspective in this page. If the last perspective in
- * this page is closed, then all editors are closed. Views that are not
- * shown in other perspectives are closed as well. If <code>saveParts</code>
- * is <code>true</code>, the user will be prompted to save any unsaved
- * changes for parts that are being closed. The page itself is closed if
+ * this page is closed, then all editors are closed. Views that are not shown in
+ * other perspectives are closed as well. If <code>saveParts</code> is
+ * <code>true</code>, the user will be prompted to save any unsaved changes for
+ * parts that are being closed. The page itself is closed if
* <code>closePage</code> is <code>true</code>.
*
- * @param desc
- * the descriptor of the perspective to be closed
- * @param saveParts
- * whether the page's parts should be saved if closed
- * @param closePage
- * whether the page itself should be closed if last perspective
+ * @param desc the descriptor of the perspective to be closed
+ * @param saveParts whether the page's parts should be saved if closed
+ * @param closePage whether the page itself should be closed if last perspective
* @since 3.1
*/
- void closePerspective(IPerspectiveDescriptor desc,
- boolean saveParts, boolean closePage);
+ void closePerspective(IPerspectiveDescriptor desc, boolean saveParts, boolean closePage);
/**
- * Closes all perspectives in this page. All editors are closed, prompting
- * to save any unsaved changes if <code>saveEditors</code> is
- * <code>true</code>. The page itself is closed if <code>closePage</code>
- * is <code>true</code>.
+ * Closes all perspectives in this page. All editors are closed, prompting to
+ * save any unsaved changes if <code>saveEditors</code> is <code>true</code>.
+ * The page itself is closed if <code>closePage</code> is <code>true</code>.
*
- * @param saveEditors
- * whether the page's editors should be saved
- * @param closePage
- * whether the page itself should be closed
+ * @param saveEditors whether the page's editors should be saved
+ * @param closePage whether the page itself should be closed
* @since 3.1
*/
void closeAllPerspectives(boolean saveEditors, boolean closePage);
/**
* <p>
- * Return the extension tracker for the workbench. This tracker may be used
- * by plug-ins to ensure responsiveness to changes to the plug-in registry.
+ * Return the extension tracker for the workbench. This tracker may be used by
+ * plug-ins to ensure responsiveness to changes to the plug-in registry.
* </p>
* <p>
* The tracker at this level of the workbench is typically used to track
@@ -1014,10 +951,9 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
IExtensionTracker getExtensionTracker();
/**
- * Return the visible working sets for this page. Please note that this
- * array is not filtered by activities. Clients should attempt to ensure
- * that any use of this method is consistant with the currently enabled
- * activity set.
+ * Return the visible working sets for this page. Please note that this array is
+ * not filtered by activities. Clients should attempt to ensure that any use of
+ * this method is consistant with the currently enabled activity set.
*
* @return the visible working sets for this page
* @see IWorkbench#getActivitySupport()
@@ -1029,9 +965,8 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
* Set the working sets for this page. Any duplicate entries will be removed
* from the array by this method.
*
- * @param sets
- * the new working sets for this page. The array may be empty,
- * but no element in the array may be <code>null</code>.
+ * @param sets the new working sets for this page. The array may be empty, but
+ * no element in the array may be <code>null</code>.
* @since 3.2
*/
void setWorkingSets(IWorkingSet[] sets);
@@ -1097,8 +1032,8 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
/**
* Returns the page "zoomed" state.
*
- * @return <code>true</code> if the page is zoomed in the workbench
- * window, <code>false</code> otherwise.
+ * @return <code>true</code> if the page is zoomed in the workbench window,
+ * <code>false</code> otherwise.
* @since 3.2
*/
boolean isPageZoomed();
@@ -1114,42 +1049,35 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
/**
* Zoom the page in on a part. If the part is already in zoom then zoom out.
*
- * @param ref
- * the workbench part to zoom in on. Must not be
- * <code>null</code>.
+ * @param ref the workbench part to zoom in on. Must not be <code>null</code>.
* @since 3.2
*/
void toggleZoom(IWorkbenchPartReference ref);
/**
- * Returns the maximized/minimized/restored state of the given part
- * reference.
+ * Returns the maximized/minimized/restored state of the given part reference.
*
- * @param ref
- * the workbench part to query. Must not be <code>null</code>.
+ * @param ref the workbench part to query. Must not be <code>null</code>.
* @return one of the STATE_* contants.
* @since 3.2
*/
int getPartState(IWorkbenchPartReference ref);
/**
- * Set the state of the given part reference. Setting the state of one part
- * can effect the state of other parts.
+ * Set the state of the given part reference. Setting the state of one part can
+ * effect the state of other parts.
*
- * @param ref
- * the workbench part reference. Must not be <code>null</code>.
- * @param state
- * one of the STATE_* constants.
+ * @param ref the workbench part reference. Must not be <code>null</code>.
+ * @param state one of the STATE_* constants.
* @since 3.2
*/
void setPartState(IWorkbenchPartReference ref, int state);
/**
- * Find the part reference for the given part. A convenience method to
- * quickly go from part to part reference.
+ * Find the part reference for the given part. A convenience method to quickly
+ * go from part to part reference.
*
- * @param part
- * The part to search for. It can be <code>null</code>.
+ * @param part The part to search for. It can be <code>null</code>.
* @return The reference for the given part, or <code>null</code> if no
* reference can be found.
* @since 3.2
@@ -1159,10 +1087,9 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
/**
* Add back an open but non-participating editor
*
- * @param ref
- * the editor to re-add. Must be an editor removed using
- * #hideEditor(IEditorReference), must not have been closed,
- * and must not be <code>null</code>.
+ * @param ref the editor to re-add. Must be an editor removed using
+ * #hideEditor(IEditorReference), must not have been closed, and must
+ * not be <code>null</code>.
* @since 3.5
* @see #hideEditor(IEditorReference)
*/
@@ -1171,52 +1098,55 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
/**
* Remove an open editor, turn it into a non-participating editor.
* <p>
- * A non-participating editor will not be returned in the list of open
- * editors ({@link #getEditorReferences()}) and will not be visible in the
- * editor area. However, it will continue to participate in the save
- * lifecycle and may still be closed by some workbench close events.
+ * A non-participating editor will not be returned in the list of open editors
+ * ({@link #getEditorReferences()}) and will not be visible in the editor area.
+ * However, it will continue to participate in the save lifecycle and may still
+ * be closed by some workbench close events.
* </p>
* <p>
- * Behaviour for hiding and showing editors from multiple stacks is not
- * defined (and unsupported) at this time.
+ * Behaviour for hiding and showing editors from multiple stacks is not defined
+ * (and unsupported) at this time.
* </p>
*
- * @param ref
- * the editor reference to remove. It must be a current open
- * editor belonging to this page, and must not be
- * <code>null</code>.
+ * @param ref the editor reference to remove. It must be a current open editor
+ * belonging to this page, and must not be <code>null</code>.
* @since 3.5
* @see #showEditor(IEditorReference)
*/
void hideEditor(IEditorReference ref);
/**
- * Opens editors for the given inputs. Only the editor constructed for the first input
- * gets activated.
+ * Opens editors for the given inputs. Only the editor constructed for the first
+ * input gets activated.
* <p>
* The editor type is determined by mapping <code>editorIDs</code> to an editor
- * extension registered with the workbench. An editor id is passed rather than
+ * extension registered with the workbench. An editor id is passed rather than
* an editor object to prevent the accidental creation of more than one editor
* for the same input. It also guarantees a consistent lifecycle for editors,
* regardless of whether they are created by the user or restored from saved
* data.
- * </p><p>
- * The length of the input array and editor ID arrays must be the same. The editors
- * are opened using pairs of { input[i], editorIDs[i] }.
* </p>
- * @param inputs the editor inputs
- * @param editorIDs the IDs of the editor extensions to use, in the order of inputs
- * @param matchFlags a bit mask consisting of zero or more of the MATCH_* constants OR-ed together
+ * <p>
+ * The length of the input array and editor ID arrays must be the same. The
+ * editors are opened using pairs of { input[i], editorIDs[i] }.
+ * </p>
+ *
+ * @param inputs the editor inputs
+ * @param editorIDs the IDs of the editor extensions to use, in the order of
+ * inputs
+ * @param matchFlags a bit mask consisting of zero or more of the MATCH_*
+ * constants OR-ed together
* @return references to the editors constructed for the inputs. The editors
- * corresponding to those reference might not be materialized.
- * @exception MultiPartInitException if at least one editor could not be created or initialized
+ * corresponding to those reference might not be materialized.
+ * @exception MultiPartInitException if at least one editor could not be created
+ * or initialized
* @see #MATCH_NONE
* @see #MATCH_INPUT
* @see #MATCH_ID
* @since 3.5
*/
- IEditorReference[] openEditors(final IEditorInput[] inputs, final String[] editorIDs,
- final int matchFlags) throws MultiPartInitException;
+ IEditorReference[] openEditors(final IEditorInput[] inputs, final String[] editorIDs, final int matchFlags)
+ throws MultiPartInitException;
/**
* Opens editors for the given inputs. Only the editor constructed for the given
@@ -1275,23 +1205,20 @@ public interface IWorkbenchPage extends IPartService, ISelectionService {
* @see #MATCH_ID
* @since 3.8.2
*/
- IEditorReference[] openEditors(final IEditorInput[] inputs, final String[] editorIDs,
- final IMemento[] mementos, final int matchFlags, final int activateIndex)
- throws MultiPartInitException;
+ IEditorReference[] openEditors(final IEditorInput[] inputs, final String[] editorIDs, final IMemento[] mementos,
+ final int matchFlags, final int activateIndex) throws MultiPartInitException;
/**
- * Return an IMemento containing the current state of the editor for each of
- * the given references. These mementos may be used to determine the initial
- * state of an editor on a subsequent open.
+ * Return an IMemento containing the current state of the editor for each of the
+ * given references. These mementos may be used to determine the initial state
+ * of an editor on a subsequent open.
*
- * @param editorRefs
- * The array of editor references to get the state for
- * @param includeInputState
- * If <code>true</code> then the resulting memento will be
- * contain the editor input's state as well as the editor's
- * state.
- * @return The array of mementos. The length of the array will match that of
- * the refs array.
+ * @param editorRefs The array of editor references to get the state for
+ * @param includeInputState If <code>true</code> then the resulting memento will
+ * be contain the editor input's state as well as the
+ * editor's state.
+ * @return The array of mementos. The length of the array will match that of the
+ * refs array.
* @since 3.8.2
*/
IMemento[] getEditorState(IEditorReference[] editorRefs, boolean includeInputState);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPart.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPart.java
index bf83e5ed499..9bc721a5e33 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPart.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPart.java
@@ -98,24 +98,24 @@ import org.eclipse.swt.widgets.Composite;
*/
public interface IWorkbenchPart extends IAdaptable {
- /**
- * The property id for <code>getTitle</code>, <code>getTitleImage</code>
- * and <code>getTitleToolTip</code>.
- */
- int PROP_TITLE = IWorkbenchPartConstants.PROP_TITLE;
+ /**
+ * The property id for <code>getTitle</code>, <code>getTitleImage</code> and
+ * <code>getTitleToolTip</code>.
+ */
+ int PROP_TITLE = IWorkbenchPartConstants.PROP_TITLE;
- /**
- * Adds a listener for changes to properties of this workbench part.
- * Has no effect if an identical listener is already registered.
- * <p>
- * The property ids are defined in {@link IWorkbenchPartConstants}.
- * </p>
- *
- * @param listener a property listener
- */
- void addPropertyListener(IPropertyListener listener);
+ /**
+ * Adds a listener for changes to properties of this workbench part. Has no
+ * effect if an identical listener is already registered.
+ * <p>
+ * The property ids are defined in {@link IWorkbenchPartConstants}.
+ * </p>
+ *
+ * @param listener a property listener
+ */
+ void addPropertyListener(IPropertyListener listener);
- /**
+ /**
* Creates the SWT controls for this workbench part.
* <p>
* Clients should not call this method (the workbench calls this method when it
@@ -136,98 +136,92 @@ public interface IWorkbenchPart extends IAdaptable {
*
* @param parent the parent control
*/
- void createPartControl(Composite parent);
+ void createPartControl(Composite parent);
- /**
- * Disposes of this workbench part.
- * <p>
- * This is the last method called on the <code>IWorkbenchPart</code>. At this
- * point the part controls (if they were ever created) have been disposed as part
- * of an SWT composite. There is no guarantee that createPartControl() has been
- * called, so the part controls may never have been created.
- * </p>
- * <p>
- * Within this method a part may release any resources, fonts, images, etc.&nbsp;
- * held by this part. It is also very important to deregister all listeners
- * from the workbench.
- * </p>
- * <p>
- * Clients should not call this method (the workbench calls this method at
- * appropriate times).
- * </p>
- */
- void dispose();
+ /**
+ * Disposes of this workbench part.
+ * <p>
+ * This is the last method called on the <code>IWorkbenchPart</code>. At this
+ * point the part controls (if they were ever created) have been disposed as
+ * part of an SWT composite. There is no guarantee that createPartControl() has
+ * been called, so the part controls may never have been created.
+ * </p>
+ * <p>
+ * Within this method a part may release any resources, fonts, images,
+ * etc.&nbsp; held by this part. It is also very important to deregister all
+ * listeners from the workbench.
+ * </p>
+ * <p>
+ * Clients should not call this method (the workbench calls this method at
+ * appropriate times).
+ * </p>
+ */
+ void dispose();
- /**
- * Returns the site for this workbench part. The site can be
- * <code>null</code> while the workbench part is being initialized. After
- * the initialization is complete, this value must be non-<code>null</code>
- * for the remainder of the part's life cycle.
- *
- * @return The part site; this value may be <code>null</code> if the part
- * has not yet been initialized
- */
- IWorkbenchPartSite getSite();
+ /**
+ * Returns the site for this workbench part. The site can be <code>null</code>
+ * while the workbench part is being initialized. After the initialization is
+ * complete, this value must be non-<code>null</code> for the remainder of the
+ * part's life cycle.
+ *
+ * @return The part site; this value may be <code>null</code> if the part has
+ * not yet been initialized
+ */
+ IWorkbenchPartSite getSite();
- /**
- * Returns the title of this workbench part. If this value changes
- * the part must fire a property listener event with
- * <code>PROP_TITLE</code>.
- * <p>
- * The title is used to populate the title bar of this part's visual
- * container.
- * </p>
- *
- * @return the workbench part title (not <code>null</code>)
- */
- String getTitle();
+ /**
+ * Returns the title of this workbench part. If this value changes the part must
+ * fire a property listener event with <code>PROP_TITLE</code>.
+ * <p>
+ * The title is used to populate the title bar of this part's visual container.
+ * </p>
+ *
+ * @return the workbench part title (not <code>null</code>)
+ */
+ String getTitle();
- /**
- * Returns the title image of this workbench part. If this value changes
- * the part must fire a property listener event with
- * <code>PROP_TITLE</code>.
- * <p>
- * The title image is usually used to populate the title bar of this part's
- * visual container. Since this image is managed by the part itself, callers
- * must <b>not</b> dispose the returned image.
- * </p>
- *
- * @return the title image
- */
- Image getTitleImage();
+ /**
+ * Returns the title image of this workbench part. If this value changes the
+ * part must fire a property listener event with <code>PROP_TITLE</code>.
+ * <p>
+ * The title image is usually used to populate the title bar of this part's
+ * visual container. Since this image is managed by the part itself, callers
+ * must <b>not</b> dispose the returned image.
+ * </p>
+ *
+ * @return the title image
+ */
+ Image getTitleImage();
- /**
- * Returns the title tool tip text of this workbench part.
- * An empty string result indicates no tool tip.
- * If this value changes the part must fire a property listener event with
- * <code>PROP_TITLE</code>.
- * <p>
- * The tool tip text is used to populate the title bar of this part's
- * visual container.
- * </p>
- *
- * @return the workbench part title tool tip (not <code>null</code>)
- */
- String getTitleToolTip();
+ /**
+ * Returns the title tool tip text of this workbench part. An empty string
+ * result indicates no tool tip. If this value changes the part must fire a
+ * property listener event with <code>PROP_TITLE</code>.
+ * <p>
+ * The tool tip text is used to populate the title bar of this part's visual
+ * container.
+ * </p>
+ *
+ * @return the workbench part title tool tip (not <code>null</code>)
+ */
+ String getTitleToolTip();
- /**
- * Removes the given property listener from this workbench part. Has no
- * effect if an identical listener is not registered.
+ /**
+ * Removes the given property listener from this workbench part. Has no effect
+ * if an identical listener is not registered.
*
- * @param listener
- * a property listener
+ * @param listener a property listener
*/
- void removePropertyListener(IPropertyListener listener);
+ void removePropertyListener(IPropertyListener listener);
- /**
- * Asks this part to take focus within the workbench. Parts must
- * assign focus to one of the controls contained in the part's
- * parent composite.
- * <p>
- * Clients should not call this method (the workbench calls this method at
- * appropriate times). To have the workbench activate a part, use
- * <code>IWorkbenchPage.activate(IWorkbenchPart) instead</code>.
- * </p>
- */
- void setFocus();
+ /**
+ * Asks this part to take focus within the workbench. Parts must assign focus to
+ * one of the controls contained in the part's parent composite.
+ * <p>
+ * Clients should not call this method (the workbench calls this method at
+ * appropriate times). To have the workbench activate a part, use
+ * <code>IWorkbenchPage.activate(IWorkbenchPart) instead</code>.
+ * </p>
+ */
+ void setFocus();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPart2.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPart2.java
index e176ae35179..e4479bd4c67 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPart2.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPart2.java
@@ -15,33 +15,33 @@ package org.eclipse.ui;
/**
* Extends {@link IWorkbenchPart}, adding the name and status text properties.
- * Prior to 3.0, a view's title was often modified to show both the part
- * name and extra status text. With this interface, the distinction is
- * made more explicit.
+ * Prior to 3.0, a view's title was often modified to show both the part name
+ * and extra status text. With this interface, the distinction is made more
+ * explicit.
*
* @since 3.0
*/
public interface IWorkbenchPart2 extends IWorkbenchPart {
- /**
- * Returns the name of this part. If this value changes the part must fire a
- * property listener event with {@link IWorkbenchPartConstants#PROP_PART_NAME}.
- *
- * @return the name of this view, or the empty string if the name is being managed
- * by the workbench (not <code>null</code>)
- */
- String getPartName();
+ /**
+ * Returns the name of this part. If this value changes the part must fire a
+ * property listener event with {@link IWorkbenchPartConstants#PROP_PART_NAME}.
+ *
+ * @return the name of this view, or the empty string if the name is being
+ * managed by the workbench (not <code>null</code>)
+ */
+ String getPartName();
- /**
- * Returns the content description of this part. The content description is an optional
- * user-readable string that describes what is currently being displayed in the part.
- * By default, the workbench will display the content description in a line
- * near the top of the view or editor.
- * An empty string indicates no content description
- * text. If this value changes the part must fire a property listener event
- * with {@link IWorkbenchPartConstants#PROP_CONTENT_DESCRIPTION}.
- *
- * @return the content description of this part (not <code>null</code>)
- */
- String getContentDescription();
+ /**
+ * Returns the content description of this part. The content description is an
+ * optional user-readable string that describes what is currently being
+ * displayed in the part. By default, the workbench will display the content
+ * description in a line near the top of the view or editor. An empty string
+ * indicates no content description text. If this value changes the part must
+ * fire a property listener event with
+ * {@link IWorkbenchPartConstants#PROP_CONTENT_DESCRIPTION}.
+ *
+ * @return the content description of this part (not <code>null</code>)
+ */
+ String getContentDescription();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPart3.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPart3.java
index 13dfb1ee817..55ee18198cb 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPart3.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPart3.java
@@ -31,54 +31,49 @@ public interface IWorkbenchPart3 extends IWorkbenchPart2 {
/**
* Add a listener for changes in the arbitrary properties set.
* <p>
- * <b>Note:</b> this is a different set of properties than the ones covered
- * by the IWorkbenchPartConstants.PROP_* constants.
+ * <b>Note:</b> this is a different set of properties than the ones covered by
+ * the IWorkbenchPartConstants.PROP_* constants.
* </p>
*
- * @param listener
- * Must not be <code>null</code>.
+ * @param listener Must not be <code>null</code>.
*/
void addPartPropertyListener(IPropertyChangeListener listener);
/**
* Remove a change listener from the arbitrary properties set.
* <p>
- * <b>Note:</b> this is a different set of properties than the ones covered
- * by the IWorkbenchPartConstants.PROP_* constants.
+ * <b>Note:</b> this is a different set of properties than the ones covered by
+ * the IWorkbenchPartConstants.PROP_* constants.
* </p>
*
- * @param listener
- * Must not be <code>null</code>.
+ * @param listener Must not be <code>null</code>.
*/
void removePartPropertyListener(IPropertyChangeListener listener);
/**
* Return the value for the arbitrary property key, or <code>null</code>.
*
- * @param key
- * the arbitrary property. Must not be <code>null</code>.
+ * @param key the arbitrary property. Must not be <code>null</code>.
* @return the property value, or <code>null</code>.
*/
String getPartProperty(String key);
/**
- * Set an arbitrary property on the part. It is the implementor's
- * responsibility to fire the corresponding PropertyChangeEvent.
+ * Set an arbitrary property on the part. It is the implementor's responsibility
+ * to fire the corresponding PropertyChangeEvent.
* <p>
* A default implementation has been added to WorkbenchPart.
* </p>
*
- * @param key
- * the arbitrary property. Must not be <code>null</code>.
- * @param value
- * the property value. A <code>null</code> value will remove
- * that property.
+ * @param key the arbitrary property. Must not be <code>null</code>.
+ * @param value the property value. A <code>null</code> value will remove that
+ * property.
*/
void setPartProperty(String key, String value);
/**
- * Return an unmodifiable map of the arbitrary properties. This method can
- * be used to save the properties during workbench save/restore.
+ * Return an unmodifiable map of the arbitrary properties. This method can be
+ * used to save the properties during workbench save/restore.
*
* @return A Map of the properties. Must not be <code>null</code>.
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPartConstants.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPartConstants.java
index 58a65d85fb0..ab44373d86f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPartConstants.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPartConstants.java
@@ -26,36 +26,38 @@ package org.eclipse.ui;
*/
public interface IWorkbenchPartConstants {
- /**
- * The property id for <code>getTitle</code>, <code>getTitleImage</code>
- * and <code>getTitleToolTip</code>.
- */
- int PROP_TITLE = 0x001;
-
- /**
- * The property id for <code>ISaveablePart.isDirty()</code>.
- */
- int PROP_DIRTY = 0x101;
-
- /**
- * The property id for <code>IEditorPart.getEditorInput()</code>.
- */
- int PROP_INPUT = 0x102;
-
- /**
- * The property id for <code>IWorkbenchPart2.getPartName</code>
- */
- int PROP_PART_NAME = 0x104;
-
- /**
- * The property id for <code>IWorkbenchPart2.getContentDescription()</code>
- */
- int PROP_CONTENT_DESCRIPTION = 0x105;
-
- /**
- * The property id for any method on the optional <code>ISizeProvider</code> interface
- * @since 3.4
- */
- int PROP_PREFERRED_SIZE = 0x303;
+ /**
+ * The property id for <code>getTitle</code>, <code>getTitleImage</code> and
+ * <code>getTitleToolTip</code>.
+ */
+ int PROP_TITLE = 0x001;
+
+ /**
+ * The property id for <code>ISaveablePart.isDirty()</code>.
+ */
+ int PROP_DIRTY = 0x101;
+
+ /**
+ * The property id for <code>IEditorPart.getEditorInput()</code>.
+ */
+ int PROP_INPUT = 0x102;
+
+ /**
+ * The property id for <code>IWorkbenchPart2.getPartName</code>
+ */
+ int PROP_PART_NAME = 0x104;
+
+ /**
+ * The property id for <code>IWorkbenchPart2.getContentDescription()</code>
+ */
+ int PROP_CONTENT_DESCRIPTION = 0x105;
+
+ /**
+ * The property id for any method on the optional <code>ISizeProvider</code>
+ * interface
+ *
+ * @since 3.4
+ */
+ int PROP_PREFERRED_SIZE = 0x303;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPartDescriptor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPartDescriptor.java
index b4bb766d8d6..477ff99881c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPartDescriptor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPartDescriptor.java
@@ -16,32 +16,33 @@ package org.eclipse.ui;
import org.eclipse.jface.resource.ImageDescriptor;
/**
- * Description of a workbench part. The part descriptor contains
- * the information needed to create part instances.
+ * Description of a workbench part. The part descriptor contains the information
+ * needed to create part instances.
* <p>
* This interface is not intended to be implemented by clients.
* </p>
+ *
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IWorkbenchPartDescriptor {
- /**
- * Returns the part id.
- *
- * @return the id of the part
- */
- String getId();
+ /**
+ * Returns the part id.
+ *
+ * @return the id of the part
+ */
+ String getId();
- /**
- * Returns the descriptor of the image for this part.
- *
- * @return the descriptor of the image to display next to this part
- */
- ImageDescriptor getImageDescriptor();
+ /**
+ * Returns the descriptor of the image for this part.
+ *
+ * @return the descriptor of the image to display next to this part
+ */
+ ImageDescriptor getImageDescriptor();
- /**
- * Returns the label to show for this part.
- *
- * @return the part label
- */
- String getLabel();
+ /**
+ * Returns the label to show for this part.
+ *
+ * @return the part label
+ */
+ String getLabel();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPartReference.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPartReference.java
index cd2f9503b7d..1cfd9a7dbde 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPartReference.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPartReference.java
@@ -18,116 +18,112 @@ import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.swt.graphics.Image;
/**
- * Implements a reference to a IWorkbenchPart.
- * The IWorkbenchPart will not be instantiated until the part
- * becomes visible or the API getPart is sent with true;
+ * Implements a reference to a IWorkbenchPart. The IWorkbenchPart will not be
+ * instantiated until the part becomes visible or the API getPart is sent with
+ * true;
* <p>
* This interface is not intended to be implemented by clients.
* </p>
+ *
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IWorkbenchPartReference {
/**
* Returns the IWorkbenchPart referenced by this object.
*
- * @param restore
- * tries to restore the part if <code>true</code>.
- * @return the part, or <code>null</code> if the part was not instantiated
- * or it failed to be restored.
+ * @param restore tries to restore the part if <code>true</code>.
+ * @return the part, or <code>null</code> if the part was not instantiated or it
+ * failed to be restored.
*/
- IWorkbenchPart getPart(boolean restore);
-
- /**
- * @see IWorkbenchPart#getTitle
- */
- String getTitle();
-
- /**
- * @see IWorkbenchPart#getTitleImage
- */
- Image getTitleImage();
-
- /**
- * @see IWorkbenchPart#getTitleToolTip
- */
- String getTitleToolTip();
-
- /**
- * @see IWorkbenchPartSite#getId
- */
- String getId();
-
- /**
- * @see IWorkbenchPart#addPropertyListener
- */
- void addPropertyListener(IPropertyListener listener);
-
- /**
- * @see IWorkbenchPart#removePropertyListener
- */
- void removePropertyListener(IPropertyListener listener);
-
- /**
- * Returns the workbench page that contains this part
- */
- IWorkbenchPage getPage();
-
- /**
- * Returns the name of the part, as it should be shown in tabs.
- *
- * @return the part name
- *
- * @since 3.0
- */
- String getPartName();
-
- /**
- * Returns the content description for the part (or the empty string if none)
- *
- * @return the content description for the part
- *
- * @since 3.0
- */
- String getContentDescription();
-
-
- /**
- * Returns whether the part is dirty (i.e. has unsaved changes).
- *
- * @return <code>true</code> if the part is dirty, <code>false</code> otherwise
- *
- * @since 3.2 (previously existed on IEditorReference)
- */
- boolean isDirty();
-
- /**
+ IWorkbenchPart getPart(boolean restore);
+
+ /**
+ * @see IWorkbenchPart#getTitle
+ */
+ String getTitle();
+
+ /**
+ * @see IWorkbenchPart#getTitleImage
+ */
+ Image getTitleImage();
+
+ /**
+ * @see IWorkbenchPart#getTitleToolTip
+ */
+ String getTitleToolTip();
+
+ /**
+ * @see IWorkbenchPartSite#getId
+ */
+ String getId();
+
+ /**
+ * @see IWorkbenchPart#addPropertyListener
+ */
+ void addPropertyListener(IPropertyListener listener);
+
+ /**
+ * @see IWorkbenchPart#removePropertyListener
+ */
+ void removePropertyListener(IPropertyListener listener);
+
+ /**
+ * Returns the workbench page that contains this part
+ */
+ IWorkbenchPage getPage();
+
+ /**
+ * Returns the name of the part, as it should be shown in tabs.
+ *
+ * @return the part name
+ *
+ * @since 3.0
+ */
+ String getPartName();
+
+ /**
+ * Returns the content description for the part (or the empty string if none)
+ *
+ * @return the content description for the part
+ *
+ * @since 3.0
+ */
+ String getContentDescription();
+
+ /**
+ * Returns whether the part is dirty (i.e. has unsaved changes).
+ *
+ * @return <code>true</code> if the part is dirty, <code>false</code> otherwise
+ *
+ * @since 3.2 (previously existed on IEditorReference)
+ */
+ boolean isDirty();
+
+ /**
* Return an arbitrary property from the reference. If the part has been
- * instantiated, it just delegates to the part. If not, then it looks in its
- * own cache of properties. If the property is not available or the part has
- * never been instantiated, it can return <code>null</code>.
+ * instantiated, it just delegates to the part. If not, then it looks in its own
+ * cache of properties. If the property is not available or the part has never
+ * been instantiated, it can return <code>null</code>.
*
- * @param key
- * The property to return. Must not be <code>null</code>.
+ * @param key The property to return. Must not be <code>null</code>.
* @return The String property, or <code>null</code>.
* @since 3.3
*/
- String getPartProperty(String key);
+ String getPartProperty(String key);
- /**
+ /**
* Add a listener for changes in the arbitrary properties set.
*
- * @param listener
- * Must not be <code>null</code>.
+ * @param listener Must not be <code>null</code>.
* @since 3.3
*/
- void addPartPropertyListener(IPropertyChangeListener listener);
+ void addPartPropertyListener(IPropertyChangeListener listener);
- /**
+ /**
* Remove a listener for changes in the arbitrary properties set.
*
- * @param listener
- * Must not be <code>null</code>.
+ * @param listener Must not be <code>null</code>.
* @since 3.3
*/
- void removePartPropertyListener(IPropertyChangeListener listener);
+ void removePartPropertyListener(IPropertyChangeListener listener);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPartSite.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPartSite.java
index ae4c71546a1..4151a28f02a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPartSite.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPartSite.java
@@ -24,41 +24,42 @@ import org.eclipse.ui.services.IServiceLocator;
* <p>
* This interface is not intended to be implemented or extended by clients.
* </p>
+ *
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IWorkbenchPartSite extends IWorkbenchSite {
- /**
- * Returns the part registry extension id for this workbench site's part.
- * <p>
- * The name comes from the <code>id</code> attribute in the configuration
- * element.
- * </p>
- *
- * @return the registry extension id
- */
- String getId();
+ /**
+ * Returns the part registry extension id for this workbench site's part.
+ * <p>
+ * The name comes from the <code>id</code> attribute in the configuration
+ * element.
+ * </p>
+ *
+ * @return the registry extension id
+ */
+ String getId();
- /**
- * Returns the unique identifier of the plug-in that defines this workbench
- * site's part.
- *
- * @return the unique identifier of the declaring plug-in
- */
- String getPluginId();
+ /**
+ * Returns the unique identifier of the plug-in that defines this workbench
+ * site's part.
+ *
+ * @return the unique identifier of the declaring plug-in
+ */
+ String getPluginId();
- /**
- * Returns the registered name for this workbench site's part.
- * <p>
- * The name comes from the <code>name</code> attribute in the configuration
- * element.
- * </p>
- *
- * @return the part name
- */
- String getRegisteredName();
+ /**
+ * Returns the registered name for this workbench site's part.
+ * <p>
+ * The name comes from the <code>name</code> attribute in the configuration
+ * element.
+ * </p>
+ *
+ * @return the part name
+ */
+ String getRegisteredName();
- /**
+ /**
* Registers a pop-up menu with a particular id for extension. This method
* should only be called if the target part has more than one context menu to
* register.
@@ -71,52 +72,50 @@ public interface IWorkbenchPartSite extends IWorkbenchSite {
* @param menuManager the menu manager
* @param selectionProvider the selection provider
*/
- void registerContextMenu(String menuId, MenuManager menuManager,
- ISelectionProvider selectionProvider);
+ void registerContextMenu(String menuId, MenuManager menuManager, ISelectionProvider selectionProvider);
- /**
- * Registers a pop-up menu with the default id for extension.
- * The default id is defined as the part id.
- * <p>
- * Within the workbench one plug-in may extend the pop-up menus for a view
- * or editor within another plug-in. In order to be eligible for extension,
- * the target part must publish each menu by calling <code>registerContextMenu</code>.
- * Once this has been done the workbench will automatically insert any action
- * extensions which exist.
- * </p>
- * <p>
- * A menu id must be provided for each registered menu. For consistency across
- * parts the following strategy should be adopted by all part implementors.
- * </p>
- * <ol>
- * <li>If the target part has only one context menu it should be registered
- * with <code>id == part id</code>. This can be done easily by calling
- * <code>registerContextMenu(MenuManager, ISelectionProvider)</code>.
- * <li>If the target part has more than one context menu a unique id should be
- * defined for each. Prefix each menu id with the part id and publish these
- * ids within the javadoc for the target part. Register each menu at
- * runtime by calling <code>registerContextMenu(String, MenuManager,
- * ISelectionProvider)</code>. </li>
- * </ol>
- * <p>
- * Any pop-up menu which is registered with the workbench should also define a
- * <code>GroupMarker</code> in the registered menu with id
- * <code>IWorkbenchActionConstants.MB_ADDITIONS</code>. Other plug-ins will use this
- * group as a reference point for insertion. The marker should be defined at an
- * appropriate location within the menu for insertion.
- * </p>
- *
- * @param menuManager the menu manager
- * @param selectionProvider the selection provider
- */
- void registerContextMenu(MenuManager menuManager,
- ISelectionProvider selectionProvider);
+ /**
+ * Registers a pop-up menu with the default id for extension. The default id is
+ * defined as the part id.
+ * <p>
+ * Within the workbench one plug-in may extend the pop-up menus for a view or
+ * editor within another plug-in. In order to be eligible for extension, the
+ * target part must publish each menu by calling
+ * <code>registerContextMenu</code>. Once this has been done the workbench will
+ * automatically insert any action extensions which exist.
+ * </p>
+ * <p>
+ * A menu id must be provided for each registered menu. For consistency across
+ * parts the following strategy should be adopted by all part implementors.
+ * </p>
+ * <ol>
+ * <li>If the target part has only one context menu it should be registered with
+ * <code>id == part id</code>. This can be done easily by calling
+ * <code>registerContextMenu(MenuManager, ISelectionProvider)</code>.
+ * <li>If the target part has more than one context menu a unique id should be
+ * defined for each. Prefix each menu id with the part id and publish these ids
+ * within the javadoc for the target part. Register each menu at runtime by
+ * calling <code>registerContextMenu(String, MenuManager,
+ * ISelectionProvider)</code>.</li>
+ * </ol>
+ * <p>
+ * Any pop-up menu which is registered with the workbench should also define a
+ * <code>GroupMarker</code> in the registered menu with id
+ * <code>IWorkbenchActionConstants.MB_ADDITIONS</code>. Other plug-ins will use
+ * this group as a reference point for insertion. The marker should be defined
+ * at an appropriate location within the menu for insertion.
+ * </p>
+ *
+ * @param menuManager the menu manager
+ * @param selectionProvider the selection provider
+ */
+ void registerContextMenu(MenuManager menuManager, ISelectionProvider selectionProvider);
- /**
+ /**
* Returns the key binding service in use.
* <p>
- * The part will access this service to register all of its actions, to set
- * the active scope.
+ * The part will access this service to register all of its actions, to set the
+ * active scope.
* </p>
*
* @return the key binding service in use
@@ -125,14 +124,15 @@ public interface IWorkbenchPartSite extends IWorkbenchSite {
* @see IContextService
* @see IHandlerService
*/
- @Deprecated IKeyBindingService getKeyBindingService();
+ @Deprecated
+ IKeyBindingService getKeyBindingService();
- /**
- * Returns the part associated with this site
- *
- * @since 3.1
- *
- * @return the part associated with this site
- */
- IWorkbenchPart getPart();
+ /**
+ * Returns the part associated with this site
+ *
+ * @since 3.1
+ *
+ * @return the part associated with this site
+ */
+ IWorkbenchPart getPart();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPreferenceConstants.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPreferenceConstants.java
index da0fd79c1e1..339367e24b1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPreferenceConstants.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPreferenceConstants.java
@@ -45,8 +45,8 @@ public interface IWorkbenchPreferenceConstants {
/**
* A named preference for how a new perspective is opened.
* <p>
- * Value is of type <code>String</code>. The possible values are defined
- * by <code>OPEN_PERSPECTIVE_WINDOW, OPEN_PERSPECTIVE_PAGE and
+ * Value is of type <code>String</code>. The possible values are defined by
+ * <code>OPEN_PERSPECTIVE_WINDOW, OPEN_PERSPECTIVE_PAGE and
* OPEN_PERSPECTIVE_REPLACE</code>.
* </p>
*
@@ -58,18 +58,17 @@ public interface IWorkbenchPreferenceConstants {
String OPEN_NEW_PERSPECTIVE = "OPEN_NEW_PERSPECTIVE"; //$NON-NLS-1$
/**
- * A named preference for how a new perspective is opened when the alternate
- * key modifiers are pressed. The alternate key modifiers are platform
- * dependent.
+ * A named preference for how a new perspective is opened when the alternate key
+ * modifiers are pressed. The alternate key modifiers are platform dependent.
* <p>
- * Value is of type <code>String</code>. The possible values are defined
- * by <code>OPEN_PERSPECTIVE_WINDOW, OPEN_PERSPECTIVE_PAGE and
+ * Value is of type <code>String</code>. The possible values are defined by
+ * <code>OPEN_PERSPECTIVE_WINDOW, OPEN_PERSPECTIVE_PAGE and
* OPEN_PERSPECTIVE_REPLACE</code>.
* </p>
*
- * @deprecated Workbench no longer supports alternate key modifier to open a
- * new perspective. Callers should use
- * IWorkbench.showPerspective methods.
+ * @deprecated Workbench no longer supports alternate key modifier to open a new
+ * perspective. Callers should use IWorkbench.showPerspective
+ * methods.
*/
@Deprecated
String ALTERNATE_OPEN_NEW_PERSPECTIVE = "ALTERNATE_OPEN_NEW_PERSPECTIVE"; //$NON-NLS-1$
@@ -78,8 +77,8 @@ public interface IWorkbenchPreferenceConstants {
* A named preference for how a new perspective is opened when the shift key
* modifier is pressed.
* <p>
- * Value is of type <code>String</code>. The possible values are defined
- * by <code>OPEN_PERSPECTIVE_WINDOW, OPEN_PERSPECTIVE_PAGE and
+ * Value is of type <code>String</code>. The possible values are defined by
+ * <code>OPEN_PERSPECTIVE_WINDOW, OPEN_PERSPECTIVE_PAGE and
* OPEN_PERSPECTIVE_REPLACE</code>.
* </p>
*
@@ -94,8 +93,8 @@ public interface IWorkbenchPreferenceConstants {
* A named preference for how a new perspective should be opened when a new
* project is created.
* <p>
- * Value is of type <code>String</code>. The possible values are defined
- * by the constants <code>OPEN_PERSPECTIVE_WINDOW, OPEN_PERSPECTIVE_PAGE,
+ * Value is of type <code>String</code>. The possible values are defined by the
+ * constants <code>OPEN_PERSPECTIVE_WINDOW, OPEN_PERSPECTIVE_PAGE,
* OPEN_PERSPECTIVE_REPLACE, and NO_NEW_PERSPECTIVE</code>.
* </p>
*
@@ -103,9 +102,8 @@ public interface IWorkbenchPreferenceConstants {
* @see #OPEN_PERSPECTIVE_PAGE
* @see #OPEN_PERSPECTIVE_REPLACE
* @see #NO_NEW_PERSPECTIVE
- * @deprecated in 3.0. This preference is IDE-specific, and is therefore
- * found only in IDE configurations. IDE-specific tools should
- * use
+ * @deprecated in 3.0. This preference is IDE-specific, and is therefore found
+ * only in IDE configurations. IDE-specific tools should use
* <code>org.eclipse.ui.ide.IDE.Preferences.PROJECT_OPEN_NEW_PERSPECTIVE</code>
* instead.
*/
@@ -113,16 +111,16 @@ public interface IWorkbenchPreferenceConstants {
String PROJECT_OPEN_NEW_PERSPECTIVE = "PROJECT_OPEN_NEW_PERSPECTIVE"; //$NON-NLS-1$
/**
- * A preference value indicating that an action should open a new
- * perspective in a new window.
+ * A preference value indicating that an action should open a new perspective in
+ * a new window.
*
* @see #PROJECT_OPEN_NEW_PERSPECTIVE
*/
String OPEN_PERSPECTIVE_WINDOW = "OPEN_PERSPECTIVE_WINDOW"; //$NON-NLS-1$
/**
- * A preference value indicating that an action should open a new
- * perspective in a new page.
+ * A preference value indicating that an action should open a new perspective in
+ * a new page.
*
* @see #PROJECT_OPEN_NEW_PERSPECTIVE
* @deprecated Opening a Perspective in a new page is no longer supported
@@ -132,8 +130,8 @@ public interface IWorkbenchPreferenceConstants {
String OPEN_PERSPECTIVE_PAGE = "OPEN_PERSPECTIVE_PAGE"; //$NON-NLS-1$
/**
- * A preference value indicating that an action should open a new
- * perspective by replacing the current perspective.
+ * A preference value indicating that an action should open a new perspective by
+ * replacing the current perspective.
*
* @see #PROJECT_OPEN_NEW_PERSPECTIVE
*/
@@ -153,9 +151,8 @@ public interface IWorkbenchPreferenceConstants {
String DEFAULT_PERSPECTIVE_ID = "defaultPerspectiveId"; //$NON-NLS-1$
/**
- * A named preference indicating where the perspective bar should be docked.
- * The default value (when this preference is not set) is
- * <code>TOP_RIGHT</code>.
+ * A named preference indicating where the perspective bar should be docked. The
+ * default value (when this preference is not set) is <code>TOP_RIGHT</code>.
* <p>
* This preference may be one of the following values: {@link #TOP_RIGHT},
* {@link #TOP_LEFT}, or {@link #LEFT}.
@@ -166,24 +163,25 @@ public interface IWorkbenchPreferenceConstants {
String DOCK_PERSPECTIVE_BAR = "DOCK_PERSPECTIVE_BAR"; //$NON-NLS-1$
/**
- * A preference indication the initial size of the perspective bar. The default value is 160.
- * This preference only works when <code>configurer.setShowPerspectiveBar(true)</code> is set in
+ * A preference indication the initial size of the perspective bar. The default
+ * value is 160. This preference only works when
+ * <code>configurer.setShowPerspectiveBar(true)</code> is set in
* WorkbenchWindowAdvisor#preWindowOpen()
*
- * This preference only uses integer values
- * bug 84603: [RCP] [PerspectiveBar] New API or pref to set default perspective bar size
+ * This preference only uses integer values bug 84603: [RCP] [PerspectiveBar]
+ * New API or pref to set default perspective bar size
*
- * @since 3.5
+ * @since 3.5
*/
String PERSPECTIVE_BAR_SIZE = "PERSPECTIVE_BAR_SIZE"; //$NON-NLS-1$
/**
- * A named preference indicating where the fast view bar should be docked in
- * a fresh workspace. This preference is meaningless after a workspace has
- * been setup, since the fast view bar state is then persisted in the
- * workbench. This preference is intended for applications that want the
- * initial docking location to be somewhere specific. The default value
- * (when this preference is not set) is the bottom.
+ * A named preference indicating where the fast view bar should be docked in a
+ * fresh workspace. This preference is meaningless after a workspace has been
+ * setup, since the fast view bar state is then persisted in the workbench. This
+ * preference is intended for applications that want the initial docking
+ * location to be somewhere specific. The default value (when this preference is
+ * not set) is the bottom.
*
* @see #LEFT
* @see #BOTTOM
@@ -193,8 +191,7 @@ public interface IWorkbenchPreferenceConstants {
String INITIAL_FAST_VIEW_BAR_LOCATION = "initialFastViewBarLocation"; //$NON-NLS-1$
/**
- * Constant to be used when referring to the top right of the workbench
- * window.
+ * Constant to be used when referring to the top right of the workbench window.
*
* @see #DOCK_PERSPECTIVE_BAR
* @since 3.0
@@ -202,8 +199,7 @@ public interface IWorkbenchPreferenceConstants {
String TOP_RIGHT = "topRight"; //$NON-NLS-1$
/**
- * Constant to be used when referring to the top left of the workbench
- * window.
+ * Constant to be used when referring to the top left of the workbench window.
*
* @see #DOCK_PERSPECTIVE_BAR
* @since 3.0
@@ -211,8 +207,7 @@ public interface IWorkbenchPreferenceConstants {
String TOP_LEFT = "topLeft"; //$NON-NLS-1$
/**
- * Constant to be used when referring to the left side of the workbench
- * window.
+ * Constant to be used when referring to the left side of the workbench window.
*
* @see #DOCK_PERSPECTIVE_BAR
* @see #INITIAL_FAST_VIEW_BAR_LOCATION
@@ -229,8 +224,7 @@ public interface IWorkbenchPreferenceConstants {
String BOTTOM = "bottom"; //$NON-NLS-1$
/**
- * Constant to be used when referring to the right side of the workbench
- * window.
+ * Constant to be used when referring to the right side of the workbench window.
*
* @see #INITIAL_FAST_VIEW_BAR_LOCATION
* @since 3.0
@@ -242,8 +236,7 @@ public interface IWorkbenchPreferenceConstants {
* introduction component (if available) on startup.
*
* <p>
- * The default value for this preference is: <code>true</code> (show
- * intro)
+ * The default value for this preference is: <code>true</code> (show intro)
* </p>
*
* @see org.eclipse.ui.application.WorkbenchWindowAdvisor#openIntro()
@@ -252,12 +245,12 @@ public interface IWorkbenchPreferenceConstants {
String SHOW_INTRO = "showIntro"; //$NON-NLS-1$
/**
- * A named preference for whether the workbench should show traditional
- * style tabs in editors and views.
+ * A named preference for whether the workbench should show traditional style
+ * tabs in editors and views.
*
* Boolean-valued: <code>true</code> if editors and views should use a
- * traditional style of tab and <code>false</code> if editors should show
- * new style tab (3.0 style)
+ * traditional style of tab and <code>false</code> if editors should show new
+ * style tab (3.0 style)
* <p>
* The default value for this preference is: <code>true</code>
* </p>
@@ -273,8 +266,8 @@ public interface IWorkbenchPreferenceConstants {
* Boolean-valued: <code>true</code>, if editors should show text on the
* perspective bar, <code>false</code> otherwise.
* <p>
- * The default value for this preference is: <code>true</code> (show text
- * on the perspective bar)
+ * The default value for this preference is: <code>true</code> (show text on the
+ * perspective bar)
* </p>
*
* @since 3.0
@@ -285,9 +278,8 @@ public interface IWorkbenchPreferenceConstants {
* A named preference for whether the workbench should show the "open
* perspective" button on the perspective bar.
*
- * Boolean-valued: <code>true</code>, if editors should show "open
- * perspective" button on the perspective bar, <code>false</code>
- * otherwise.
+ * Boolean-valued: <code>true</code>, if editors should show "open perspective"
+ * button on the perspective bar, <code>false</code> otherwise.
* <p>
* The default value for this preference is: <code>true</code> (show "open
* perspective" button on the perspective bar)
@@ -298,8 +290,8 @@ public interface IWorkbenchPreferenceConstants {
String SHOW_OPEN_ON_PERSPECTIVE_BAR = "SHOW_OPEN_ON_PERSPECTIVE_BAR"; //$NON-NLS-1$
/**
- * A named preference for whether the workbench should show the "Other..."
- * menu item in the perspective menu.
+ * A named preference for whether the workbench should show the "Other..." menu
+ * item in the perspective menu.
*
* Boolean-valued: <code>true</code>, if editors should show text on the
* "Other..." menu item, <code>false</code> otherwise.
@@ -349,11 +341,10 @@ public interface IWorkbenchPreferenceConstants {
String DYNAMIC_HELP_ACTION_TEXT = "dynamicHelpActionText"; //$NON-NLS-1$
/**
- * A named preference for enabling animations when a layout transition
- * occurs
+ * A named preference for enabling animations when a layout transition occurs
* <p>
- * The default value for this preference is: <code>true</code> (show
- * animations when a transition occurs)
+ * The default value for this preference is: <code>true</code> (show animations
+ * when a transition occurs)
* </p>
*
* @since 3.1
@@ -361,12 +352,12 @@ public interface IWorkbenchPreferenceConstants {
String ENABLE_ANIMATIONS = "ENABLE_ANIMATIONS"; //$NON-NLS-1$
/**
- * A named preference that view implementors can used to determine whether
- * or not they should utilize colored labels.
+ * A named preference that view implementors can used to determine whether or
+ * not they should utilize colored labels.
*
* <p>
- * The default value for this preference is: <code>true</code> (show
- * colored labels)
+ * The default value for this preference is: <code>true</code> (show colored
+ * labels)
* </p>
*
* @since 3.4
@@ -375,8 +366,8 @@ public interface IWorkbenchPreferenceConstants {
/**
* <p>
- * Workbench preference id for the key configuration identifier to be
- * treated as the default.
+ * Workbench preference id for the key configuration identifier to be treated as
+ * the default.
* </p>
* <p>
* The default value for this preference is
@@ -390,9 +381,8 @@ public interface IWorkbenchPreferenceConstants {
/**
* <p>
* Workbench preference identifier for the minimum width of editor tabs. By
- * default, Eclipse does not define this value and allows SWT to determine
- * this constant. We use <code>-1</code> internally to signify "use
- * default".
+ * default, Eclipse does not define this value and allows SWT to determine this
+ * constant. We use <code>-1</code> internally to signify "use default".
* </p>
* <p>
* The default value for this preference is <code>-1</code>.
@@ -429,9 +419,8 @@ public interface IWorkbenchPreferenceConstants {
String CURRENT_THEME_ID = "CURRENT_THEME_ID"; //$NON-NLS-1$
/**
- * A preference value indicating whether editors should be closed before
- * saving the workbench state when exiting. The default is
- * <code>false</code>.
+ * A preference value indicating whether editors should be closed before saving
+ * the workbench state when exiting. The default is <code>false</code>.
*
* @since 3.1
*/
@@ -453,18 +442,17 @@ public interface IWorkbenchPreferenceConstants {
String SHOW_MEMORY_MONITOR = "SHOW_MEMORY_MONITOR"; //$NON-NLS-1$
/**
- * Stores whether or not to use the window working set as the default
- * working set for newly created views (without previously stored state).
- * This is a hint that view implementors should honor.
+ * Stores whether or not to use the window working set as the default working
+ * set for newly created views (without previously stored state). This is a hint
+ * that view implementors should honor.
*
* @since 3.2
*/
String USE_WINDOW_WORKING_SET_BY_DEFAULT = "USE_WINDOW_WORKING_SET_BY_DEFAULT"; //$NON-NLS-1$
/**
- * Stores whether or not to show the text widget that allows type-ahead
- * search in the case where a FilteredTree is used to display and filter
- * tree items.
+ * Stores whether or not to show the text widget that allows type-ahead search
+ * in the case where a FilteredTree is used to display and filter tree items.
*
* @since 3.2
*/
@@ -479,10 +467,10 @@ public interface IWorkbenchPreferenceConstants {
String ENABLE_DETACHED_VIEWS = "ENABLE_DETACHED_VIEWS"; //$NON-NLS-1$
/**
- * Stores whether or not the workbench prompts for saving when a dirty
- * editor or view is closed, but the Saveable objects are still open in
- * other parts. If <code>true</code> (default), the user will be prompted.
- * If <code>false</code>, there will be no prompt.
+ * Stores whether or not the workbench prompts for saving when a dirty editor or
+ * view is closed, but the Saveable objects are still open in other parts. If
+ * <code>true</code> (default), the user will be prompted. If
+ * <code>false</code>, there will be no prompt.
*
* @see Saveable
* @since 3.2
@@ -490,17 +478,16 @@ public interface IWorkbenchPreferenceConstants {
String PROMPT_WHEN_SAVEABLE_STILL_OPEN = "PROMPT_WHEN_SAVEABLE_STILL_OPEN"; //$NON-NLS-1$
/**
- * Lists the extra perspectives to show in the perspective bar. The value is
- * a comma-separated list of perspective ids. The default is the empty
- * string.
+ * Lists the extra perspectives to show in the perspective bar. The value is a
+ * comma-separated list of perspective ids. The default is the empty string.
*
* @since 3.2
*/
String PERSPECTIVE_BAR_EXTRAS = "PERSPECTIVE_BAR_EXTRAS"; //$NON-NLS-1$
/**
- * Allows locking the trim to prevent user dragging on startup. The default
- * is <code>false</code>.
+ * Allows locking the trim to prevent user dragging on startup. The default is
+ * <code>false</code>.
*
* @since 3.2
*/
@@ -509,8 +496,8 @@ public interface IWorkbenchPreferenceConstants {
/**
* A named preference for providing the 3.3 presentation's min/max behaviour
* <p>
- * The default value for this preference is: <code>false</code>; use the
- * 3.2 behaviour.
+ * The default value for this preference is: <code>false</code>; use the 3.2
+ * behaviour.
* </p>
*
* @since 3.3
@@ -518,9 +505,8 @@ public interface IWorkbenchPreferenceConstants {
String ENABLE_NEW_MIN_MAX = "ENABLE_MIN_MAX"; //$NON-NLS-1$
/**
- * A named preference for disabling opening a new fast view from the fast
- * view bar controls ("Show View as a fast view" button or "New Fast View"
- * submenu).
+ * A named preference for disabling opening a new fast view from the fast view
+ * bar controls ("Show View as a fast view" button or "New Fast View" submenu).
* <p>
* Value is of type <code>boolean</code>.
* </p>
@@ -533,12 +519,12 @@ public interface IWorkbenchPreferenceConstants {
String DISABLE_NEW_FAST_VIEW = "disableNewFastView"; //$NON-NLS-1$
/**
- * A named preference for enabling the 3.2 behavior for closing sticky
- * views. When not enabled a sticky view is closed in all perspectives when
- * the view is closed.
+ * A named preference for enabling the 3.2 behavior for closing sticky views.
+ * When not enabled a sticky view is closed in all perspectives when the view is
+ * closed.
* <p>
- * The default value for this preference is: <code>false</code>; use the
- * 3.2 behaviour.
+ * The default value for this preference is: <code>false</code>; use the 3.2
+ * behaviour.
* </p>
*
* @since 3.3
@@ -546,8 +532,8 @@ public interface IWorkbenchPreferenceConstants {
String ENABLE_32_STICKY_CLOSE_BEHAVIOR = "ENABLE_32_STICKY_CLOSE_BEHAVIOR"; //$NON-NLS-1$
/**
- * An named preference for whether or not tabs are on the top or bottom
- * for views. Values are either {@link SWT#TOP} or {@link SWT#BOTTOM}.
+ * An named preference for whether or not tabs are on the top or bottom for
+ * views. Values are either {@link SWT#TOP} or {@link SWT#BOTTOM}.
* <p>
* The default value for this preference is: <code>SWT.TOP</code>.
* </p>
@@ -557,8 +543,8 @@ public interface IWorkbenchPreferenceConstants {
String VIEW_TAB_POSITION = "VIEW_TAB_POSITION"; //$NON-NLS-1$
/**
- * An named preference for whether or not tabs are on the top or bottom
- * for editors. Values are either {@link SWT#TOP} or {@link SWT#BOTTOM}.
+ * An named preference for whether or not tabs are on the top or bottom for
+ * editors. Values are either {@link SWT#TOP} or {@link SWT#BOTTOM}.
* <p>
* The default value for this preference is: <code>SWT.TOP</code>.
* </p>
@@ -568,12 +554,11 @@ public interface IWorkbenchPreferenceConstants {
String EDITOR_TAB_POSITION = "EDITOR_TAB_POSITION"; //$NON-NLS-1$
/**
- * Workbench preference id for whether the workbench should show multiple
- * editor tabs.
+ * Workbench preference id for whether the workbench should show multiple editor
+ * tabs.
*
- * Boolean-valued: <code>true</code> if editors should show multiple
- * editor tabs, and <code>false</code> if editors should show a single
- * editor tab.
+ * Boolean-valued: <code>true</code> if editors should show multiple editor
+ * tabs, and <code>false</code> if editors should show a single editor tab.
* <p>
* The default value for this preference is: <code>true</code>
* </p>
@@ -583,13 +568,12 @@ public interface IWorkbenchPreferenceConstants {
String SHOW_MULTIPLE_EDITOR_TABS = "SHOW_MULTIPLE_EDITOR_TABS"; //$NON-NLS-1$
/**
- * Workbench preference id for whether the workbench may open editors
- * in-place. Note that editors will only be opened in-place if this
- * preference is <code>false</code> and if the current platform supports
- * in-place editing.
+ * Workbench preference id for whether the workbench may open editors in-place.
+ * Note that editors will only be opened in-place if this preference is
+ * <code>false</code> and if the current platform supports in-place editing.
*
- * Boolean-valued: <code>false</code> if editors may be opened in-place,
- * and <code>true</code> if editors should never be opened in-place.
+ * Boolean-valued: <code>false</code> if editors may be opened in-place, and
+ * <code>true</code> if editors should never be opened in-place.
* <p>
* The default value for this preference is: <code>false</code>
* </p>
@@ -599,8 +583,8 @@ public interface IWorkbenchPreferenceConstants {
String DISABLE_OPEN_EDITOR_IN_PLACE = "DISABLE_OPEN_EDITOR_IN_PLACE"; //$NON-NLS-1$
/**
- * Workbench preference id for indicating the size of the list of most
- * recently used working sets.
+ * Workbench preference id for indicating the size of the list of most recently
+ * used working sets.
* <p>
* Integer-valued. The default value for this preference is: <code>5</code>.
* </p>
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPreferencePage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPreferencePage.java
index a8ef525434f..7658ffd2520 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPreferencePage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPreferencePage.java
@@ -33,14 +33,14 @@ import org.eclipse.jface.preference.IPreferencePage;
* </pre>
*/
public interface IWorkbenchPreferencePage extends IPreferencePage {
- /**
- * Initializes this preference page for the given workbench.
- * <p>
- * This method is called automatically as the preference page is being created
- * and initialized. Clients must not call this method.
- * </p>
- *
- * @param workbench the workbench
- */
- void init(IWorkbench workbench);
+ /**
+ * Initializes this preference page for the given workbench.
+ * <p>
+ * This method is called automatically as the preference page is being created
+ * and initialized. Clients must not call this method.
+ * </p>
+ *
+ * @param workbench the workbench
+ */
+ void init(IWorkbench workbench);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPropertyPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPropertyPage.java
index 06ea41f66dc..3f241b857c1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPropertyPage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPropertyPage.java
@@ -43,26 +43,27 @@ import org.eclipse.ui.dialogs.PropertyDialogAction;
* @see IWorkbenchPropertyPageMulti
*/
public interface IWorkbenchPropertyPage extends IPreferencePage {
- /**
- * Returns the object that owns the properties shown in this page.
- *
- * @return the object that owns the properties shown in this page
- */
- IAdaptable getElement();
+ /**
+ * Returns the object that owns the properties shown in this page.
+ *
+ * @return the object that owns the properties shown in this page
+ */
+ IAdaptable getElement();
- /**
- * Sets the object that owns the properties shown in this page.
- * The page is expected to store this object and provide it if
- * <code>getElement</code> is called.
- * <p> As of Eclipse 3.2 the org.eclipse.ui.propertyPages extension
- * point now supports non IAdaptable inputs. An input
- * that is not an IAdaptable will be wrapped in an
- * IAdaptable by the workbench before it is forwarded
- * to this method.
- * </p>
- * @see PropertyDialogAction
- *
- * @param element the object that owns the properties shown in this page
- */
- void setElement(IAdaptable element);
+ /**
+ * Sets the object that owns the properties shown in this page. The page is
+ * expected to store this object and provide it if <code>getElement</code> is
+ * called.
+ * <p>
+ * As of Eclipse 3.2 the org.eclipse.ui.propertyPages extension point now
+ * supports non IAdaptable inputs. An input that is not an IAdaptable will be
+ * wrapped in an IAdaptable by the workbench before it is forwarded to this
+ * method.
+ * </p>
+ *
+ * @see PropertyDialogAction
+ *
+ * @param element the object that owns the properties shown in this page
+ */
+ void setElement(IAdaptable element);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPropertyPageMulti.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPropertyPageMulti.java
index 704f3bd2027..25e02f85d43 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPropertyPageMulti.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPropertyPageMulti.java
@@ -26,11 +26,10 @@ import org.eclipse.jface.preference.IPreferencePage;
public interface IWorkbenchPropertyPageMulti extends IPreferencePage {
/**
- * Sets the elements that own properties shown on this page. This method
- * will be called if the property page responds to multiple selection.
+ * Sets the elements that own properties shown on this page. This method will be
+ * called if the property page responds to multiple selection.
*
- * @param elements
- * objects that own the properties shown in this page
+ * @param elements objects that own the properties shown in this page
*/
void setElements(IAdaptable[] elements);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchSite.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchSite.java
index bdd83205b02..0f8a0bbcdf4 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchSite.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchSite.java
@@ -49,8 +49,7 @@ import org.eclipse.ui.services.IServiceLocator;
* @since 2.0
* @noimplement This interface is not intended to be implemented by clients.
*/
-public interface IWorkbenchSite extends IAdaptable, IShellProvider,
- IServiceLocator {
+public interface IWorkbenchSite extends IAdaptable, IShellProvider, IServiceLocator {
/**
* Returns the page containing this workbench site.
@@ -68,8 +67,8 @@ public interface IWorkbenchSite extends IAdaptable, IShellProvider,
/**
* Returns the shell for this workbench site. Not intended to be called from
- * outside the UI thread. Clients should call IWorkbench.getDisplay() to
- * gain access to the display rather than calling getShell().getDisplay().
+ * outside the UI thread. Clients should call IWorkbench.getDisplay() to gain
+ * access to the display rather than calling getShell().getDisplay().
*
* <p>
* For compatibility, this method will not throw an exception if called from
@@ -78,7 +77,8 @@ public interface IWorkbenchSite extends IAdaptable, IShellProvider,
*
* @return the shell for this workbench site
*/
- @Override Shell getShell();
+ @Override
+ Shell getShell();
/**
* Returns the workbench window containing this workbench site.
@@ -90,8 +90,7 @@ public interface IWorkbenchSite extends IAdaptable, IShellProvider,
/**
* Sets the selection provider for this workbench site.
*
- * @param provider
- * the selection provider, or <code>null</code> to clear it
+ * @param provider the selection provider, or <code>null</code> to clear it
*/
void setSelectionProvider(ISelectionProvider provider);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWindow.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWindow.java
index 4eae6b4a1d2..d097eee0279 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWindow.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWindow.java
@@ -56,168 +56,161 @@ import org.eclipse.ui.services.IServiceLocator;
* @see IWorkbenchPage
* @noimplement This interface is not intended to be implemented by clients.
*/
-public interface IWorkbenchWindow extends IPageService, IRunnableContext,
- IServiceLocator, IShellProvider {
- /**
- * Closes this workbench window.
- * <p>
- * If the window has an open editor with unsaved content, the user will be
- * given the opportunity to save it.
- * </p>
- *
- * @return <code>true</code> if the window was successfully closed, and
- * <code>false</code> if it is still open
- */
- boolean close();
+public interface IWorkbenchWindow extends IPageService, IRunnableContext, IServiceLocator, IShellProvider {
+ /**
+ * Closes this workbench window.
+ * <p>
+ * If the window has an open editor with unsaved content, the user will be given
+ * the opportunity to save it.
+ * </p>
+ *
+ * @return <code>true</code> if the window was successfully closed, and
+ * <code>false</code> if it is still open
+ */
+ boolean close();
- /**
- * Returns the currently active page for this workbench window.
- *
- * @return the active page, or <code>null</code> if none
- */
- @Override IWorkbenchPage getActivePage();
+ /**
+ * Returns the currently active page for this workbench window.
+ *
+ * @return the active page, or <code>null</code> if none
+ */
+ @Override
+ IWorkbenchPage getActivePage();
- /**
- * Returns a list of the pages in this workbench window.
- * <p>
- * Note that each window has its own pages; pages are never shared between
- * different windows.
- * </p>
- *
- * @return a list of pages
- */
- IWorkbenchPage[] getPages();
+ /**
+ * Returns a list of the pages in this workbench window.
+ * <p>
+ * Note that each window has its own pages; pages are never shared between
+ * different windows.
+ * </p>
+ *
+ * @return a list of pages
+ */
+ IWorkbenchPage[] getPages();
- /**
- * Returns the part service which tracks part activation within this
- * workbench window.
- *
- * @return the part service
- */
- IPartService getPartService();
+ /**
+ * Returns the part service which tracks part activation within this workbench
+ * window.
+ *
+ * @return the part service
+ */
+ IPartService getPartService();
- /**
- * Returns the selection service which tracks selection within this
- * workbench window.
- *
- * @return the selection service
- */
- ISelectionService getSelectionService();
+ /**
+ * Returns the selection service which tracks selection within this workbench
+ * window.
+ *
+ * @return the selection service
+ */
+ ISelectionService getSelectionService();
- /**
- * Returns this workbench window's shell.
- *
- * @return the shell containing this window's controls or <code>null</code>
- * if the shell has not been created yet or if the window has been closed
- */
- @Override Shell getShell();
+ /**
+ * Returns this workbench window's shell.
+ *
+ * @return the shell containing this window's controls or <code>null</code> if
+ * the shell has not been created yet or if the window has been closed
+ */
+ @Override
+ Shell getShell();
- /**
- * Returns the workbench for this window.
- *
- * @return the workbench
- */
- IWorkbench getWorkbench();
+ /**
+ * Returns the workbench for this window.
+ *
+ * @return the workbench
+ */
+ IWorkbench getWorkbench();
- /**
- * Returns whether the specified menu is an application menu as opposed to
- * a part menu. Application menus contain items which affect the workbench
- * or window. Part menus contain items which affect the active part (view
- * or editor).
- * <p>
- * This is typically used during "in place" editing. Application menus
- * should be preserved during menu merging. All other menus may be removed
- * from the window.
- * </p>
- *
- * @param menuId
- * the menu id
- * @return <code>true</code> if the specified menu is an application
- * menu, and <code>false</code> if it is not
- */
- boolean isApplicationMenu(String menuId);
+ /**
+ * Returns whether the specified menu is an application menu as opposed to a
+ * part menu. Application menus contain items which affect the workbench or
+ * window. Part menus contain items which affect the active part (view or
+ * editor).
+ * <p>
+ * This is typically used during "in place" editing. Application menus should be
+ * preserved during menu merging. All other menus may be removed from the
+ * window.
+ * </p>
+ *
+ * @param menuId the menu id
+ * @return <code>true</code> if the specified menu is an application menu, and
+ * <code>false</code> if it is not
+ */
+ boolean isApplicationMenu(String menuId);
- /**
- * Creates and opens a new workbench page. The perspective of the new page
- * is defined by the specified perspective ID. The new page become active.
- * <p>
- * <b>Note:</b> Since release 2.0, a window is limited to contain at most
- * one page. If a page exist in the window when this method is used, then
- * another window is created for the new page. Callers are strongly
- * recommended to use the <code>IWorkbench.showPerspective</code> APIs to
- * programmatically show a perspective.
- * </p>
- *
- * @param perspectiveId
- * the perspective id for the window's initial page
- * @param input
- * the page input, or <code>null</code> if there is no current
- * input. This is used to seed the input for the new page's
- * views.
- * @return the new workbench page
- * @exception WorkbenchException
- * if a page could not be opened
- *
- * @see IWorkbench#showPerspective(String, IWorkbenchWindow, IAdaptable)
- */
- IWorkbenchPage openPage(String perspectiveId, IAdaptable input)
- throws WorkbenchException;
+ /**
+ * Creates and opens a new workbench page. The perspective of the new page is
+ * defined by the specified perspective ID. The new page become active.
+ * <p>
+ * <b>Note:</b> Since release 2.0, a window is limited to contain at most one
+ * page. If a page exist in the window when this method is used, then another
+ * window is created for the new page. Callers are strongly recommended to use
+ * the <code>IWorkbench.showPerspective</code> APIs to programmatically show a
+ * perspective.
+ * </p>
+ *
+ * @param perspectiveId the perspective id for the window's initial page
+ * @param input the page input, or <code>null</code> if there is no
+ * current input. This is used to seed the input for the
+ * new page's views.
+ * @return the new workbench page
+ * @exception WorkbenchException if a page could not be opened
+ *
+ * @see IWorkbench#showPerspective(String, IWorkbenchWindow, IAdaptable)
+ */
+ IWorkbenchPage openPage(String perspectiveId, IAdaptable input) throws WorkbenchException;
- /**
- * Creates and opens a new workbench page. The default perspective is used
- * as a template for creating the page. The page becomes active.
- * <p>
- * <b>Note:</b> Since release 2.0, a window is limited to contain at most
- * one page. If a page exist in the window when this method is used, then
- * another window is created for the new page. Callers are strongly
- * recommended to use the <code>IWorkbench.showPerspective</code> APIs to
- * programmatically show a perspective.
- * </p>
- *
- * @param input
- * the page input, or <code>null</code> if there is no current
- * input. This is used to seed the input for the new page's
- * views.
- * @return the new workbench window
- * @exception WorkbenchException
- * if a page could not be opened
- *
- * @see IWorkbench#showPerspective(String, IWorkbenchWindow, IAdaptable)
- */
- IWorkbenchPage openPage(IAdaptable input) throws WorkbenchException;
+ /**
+ * Creates and opens a new workbench page. The default perspective is used as a
+ * template for creating the page. The page becomes active.
+ * <p>
+ * <b>Note:</b> Since release 2.0, a window is limited to contain at most one
+ * page. If a page exist in the window when this method is used, then another
+ * window is created for the new page. Callers are strongly recommended to use
+ * the <code>IWorkbench.showPerspective</code> APIs to programmatically show a
+ * perspective.
+ * </p>
+ *
+ * @param input the page input, or <code>null</code> if there is no current
+ * input. This is used to seed the input for the new page's views.
+ * @return the new workbench window
+ * @exception WorkbenchException if a page could not be opened
+ *
+ * @see IWorkbench#showPerspective(String, IWorkbenchWindow, IAdaptable)
+ */
+ IWorkbenchPage openPage(IAdaptable input) throws WorkbenchException;
- /**
- * This specialization of IRunnableContext#run(boolean, boolean,
- * IRunnableWithProgress) blocks until the runnable has been run,
- * regardless of the value of <code>fork</code>.
- * It is recommended that <code>fork</code> is set to
- * true in most cases. If <code>fork</code> is set to <code>false</code>,
- * the runnable will run in the UI thread and it is the runnable's
- * responsibility to call <code>Display.readAndDispatch()</code>
- * to ensure UI responsiveness.
- *
- * @since 3.2
- */
- @Override void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException;
+ /**
+ * This specialization of IRunnableContext#run(boolean, boolean,
+ * IRunnableWithProgress) blocks until the runnable has been run, regardless of
+ * the value of <code>fork</code>. It is recommended that <code>fork</code> is
+ * set to true in most cases. If <code>fork</code> is set to <code>false</code>,
+ * the runnable will run in the UI thread and it is the runnable's
+ * responsibility to call <code>Display.readAndDispatch()</code> to ensure UI
+ * responsiveness.
+ *
+ * @since 3.2
+ */
+ @Override
+ void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable)
+ throws InvocationTargetException, InterruptedException;
- /**
+ /**
* Sets or clears the currently active page for this workbench window.
*
- * @param page
- * the new active page, or <code>null</code> for no active page
+ * @param page the new active page, or <code>null</code> for no active page
*/
- void setActivePage(IWorkbenchPage page);
+ void setActivePage(IWorkbenchPage page);
- /**
+ /**
* <p>
- * Return the extension tracker for the workbench. This tracker may be used
- * by plug-ins to ensure responsiveness to changes to the plug-in registry.
+ * Return the extension tracker for the workbench. This tracker may be used by
+ * plug-ins to ensure responsiveness to changes to the plug-in registry.
* </p>
* <p>
* The tracker at this level of the workbench is typically used to track
- * elements that persist for the life of the workbench. For example, the
- * action objects corresponding to new wizards contributed by plug-ins fall
- * into this category.
+ * elements that persist for the life of the workbench. For example, the action
+ * objects corresponding to new wizards contributed by plug-ins fall into this
+ * category.
* </p>
*
* @return the extension tracker
@@ -225,7 +218,7 @@ public interface IWorkbenchWindow extends IPageService, IRunnableContext,
* @see IWorkbenchPage#getExtensionTracker()
* @since 3.1
*/
- IExtensionTracker getExtensionTracker();
+ IExtensionTracker getExtensionTracker();
/**
* Returns a boolean indicating whether the workbench window is in the process
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWindowActionDelegate.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWindowActionDelegate.java
index 0ec4f5537f9..1b88e90ebfa 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWindowActionDelegate.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWindowActionDelegate.java
@@ -14,22 +14,22 @@
package org.eclipse.ui;
/**
- * Interface for an action that is contributed into the workbench window menu
- * or tool bar. It extends <code>IActionDelegate</code> and adds an
- * initialization method for connecting the delegate to the workbench window it
- * should work with.
+ * Interface for an action that is contributed into the workbench window menu or
+ * tool bar. It extends <code>IActionDelegate</code> and adds an initialization
+ * method for connecting the delegate to the workbench window it should work
+ * with.
*/
public interface IWorkbenchWindowActionDelegate extends IActionDelegate {
- /**
- * Disposes this action delegate. The implementor should unhook any references
- * to itself so that garbage collection can occur.
- */
- void dispose();
+ /**
+ * Disposes this action delegate. The implementor should unhook any references
+ * to itself so that garbage collection can occur.
+ */
+ void dispose();
- /**
- * Initializes this action delegate with the workbench window it will work in.
- *
- * @param window the window that provides the context for this delegate
- */
- void init(IWorkbenchWindow window);
+ /**
+ * Initializes this action delegate with the workbench window it will work in.
+ *
+ * @param window the window that provides the context for this delegate
+ */
+ void init(IWorkbenchWindow window);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWindowPulldownDelegate.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWindowPulldownDelegate.java
index 5f8f13c4d6f..277a940b689 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWindowPulldownDelegate.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWindowPulldownDelegate.java
@@ -18,18 +18,17 @@ import org.eclipse.swt.widgets.Menu;
/**
* Interface for a pulldown action that is contributed into the workbench window
- * tool bar. It extends <code>IWorkbenchWindowActionDelegate</code> and adds an
+ * tool bar. It extends <code>IWorkbenchWindowActionDelegate</code> and adds an
* initialization method to define the menu creator for the action.
*/
-public interface IWorkbenchWindowPulldownDelegate extends
- IWorkbenchWindowActionDelegate {
- /**
- * Returns the menu for this pull down action. This method will only be
- * called if the user opens the pull down menu for the action. Note that it
- * is the responsibility of the implementor to properly dispose of any SWT menus
- * created by this method.
- *
- * @return the menu
- */
- Menu getMenu(Control parent);
+public interface IWorkbenchWindowPulldownDelegate extends IWorkbenchWindowActionDelegate {
+ /**
+ * Returns the menu for this pull down action. This method will only be called
+ * if the user opens the pull down menu for the action. Note that it is the
+ * responsibility of the implementor to properly dispose of any SWT menus
+ * created by this method.
+ *
+ * @return the menu
+ */
+ Menu getMenu(Control parent);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWindowPulldownDelegate2.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWindowPulldownDelegate2.java
index dad7389c8b7..518580dca60 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWindowPulldownDelegate2.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWindowPulldownDelegate2.java
@@ -16,22 +16,21 @@ package org.eclipse.ui;
import org.eclipse.swt.widgets.Menu;
/**
- * Extension of IWorkbenchWindowPulldownDelegate that allows the delegate dropdown
- * menu to be a child of a Menu item. Necessary for CoolBar support. If a coolbar
- * group of items is not fully displayed, a chevron and a drop down menu will be
- * used to show the group's tool items. Therefore, a getMenu(Menu) method is necessary,
- * since the delegate drop down menu will be a child of the chevron menu item (not
- * the tool control).
+ * Extension of IWorkbenchWindowPulldownDelegate that allows the delegate
+ * dropdown menu to be a child of a Menu item. Necessary for CoolBar support. If
+ * a coolbar group of items is not fully displayed, a chevron and a drop down
+ * menu will be used to show the group's tool items. Therefore, a getMenu(Menu)
+ * method is necessary, since the delegate drop down menu will be a child of the
+ * chevron menu item (not the tool control).
*/
-public interface IWorkbenchWindowPulldownDelegate2 extends
- IWorkbenchWindowPulldownDelegate {
- /**
- * Returns the menu for this pull down action. This method will only be
- * called if the user opens the pull down menu for the action. Note that it
- * is the responsibility of the implementor to properly dispose of any SWT
- * menus created by this method.
- *
- * @return the menu
- */
- Menu getMenu(Menu parent);
+public interface IWorkbenchWindowPulldownDelegate2 extends IWorkbenchWindowPulldownDelegate {
+ /**
+ * Returns the menu for this pull down action. This method will only be called
+ * if the user opens the pull down menu for the action. Note that it is the
+ * responsibility of the implementor to properly dispose of any SWT menus
+ * created by this method.
+ *
+ * @return the menu
+ */
+ Menu getMenu(Menu parent);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWizard.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWizard.java
index edf55135089..8d86b9ea030 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWizard.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWizard.java
@@ -18,22 +18,22 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.IWizard;
/**
- * Implementors represent creation wizards that are to be
- * contributed to the workbench's creation wizard extension point.
+ * Implementors represent creation wizards that are to be contributed to the
+ * workbench's creation wizard extension point.
*
* @see org.eclipse.jface.wizard.IWizard
*/
public interface IWorkbenchWizard extends IWizard {
- /**
- * Initializes this creation wizard using the passed workbench and
- * object selection.
- * <p>
- * This method is called after the no argument constructor and
- * before other methods are called.
- * </p>
- *
- * @param workbench the current workbench
- * @param selection the current object selection
- */
- void init(IWorkbench workbench, IStructuredSelection selection);
+ /**
+ * Initializes this creation wizard using the passed workbench and object
+ * selection.
+ * <p>
+ * This method is called after the no argument constructor and before other
+ * methods are called.
+ * </p>
+ *
+ * @param workbench the current workbench
+ * @param selection the current object selection
+ */
+ void init(IWorkbench workbench, IStructuredSelection selection);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSet.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSet.java
index ff92f2b06e6..8cd9617cdb4 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSet.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSet.java
@@ -17,9 +17,9 @@ import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.resource.ImageDescriptor;
/**
- * A working set holds a number of IAdaptable elements.
- * A working set is intended to group elements for presentation to
- * the user or for operations on a set of elements.
+ * A working set holds a number of IAdaptable elements. A working set is
+ * intended to group elements for presentation to the user or for operations on
+ * a set of elements.
*
* @since 2.0 initial version
* @since 3.0 now extends {@link org.eclipse.ui.IPersistableElement}
@@ -27,148 +27,139 @@ import org.eclipse.jface.resource.ImageDescriptor;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IWorkingSet extends IPersistableElement, IAdaptable {
- /**
- * Returns the elements that are contained in this working set.
- * <p>
- * This method might throw an {@link IllegalStateException} if
- * the working set is invalid.
- * </p>
- * @return the working set's elements
- */
- IAdaptable[] getElements();
-
- /**
- * Returns the working set id. Returns <code>null</code> if no
- * working set id has been set.
- * This is one of the ids defined by extensions of the
- * org.eclipse.ui.workingSets extension point.
- * It is used by the workbench to determine the page to use in
- * the working set edit wizard. The default resource edit page
- * is used if this value is <code>null</code>.
- *
- * @return the working set id. May be <code>null</code>
- * @since 2.1
- */
- String getId();
-
- /**
- * Returns the working set icon.
- * Currently, this is one of the icons specified in the extensions
- * of the org.eclipse.ui.workingSets extension point.
- * The extension is identified using the value returned by
- * <code>getId()</code>.
- * Returns <code>null</code> if no icon has been specified in the
- * extension or if <code>getId()</code> returns <code>null</code>.
- *
- * @return the working set icon or <code>null</code>.
- * @since 2.1
- * @deprecated use {@link #getImageDescriptor()} instead
- */
- @Deprecated ImageDescriptor getImage();
-
- /**
- * Returns the working set icon.
- * Currently, this is one of the icons specified in the extensions
- * of the org.eclipse.ui.workingSets extension point.
- * The extension is identified using the value returned by
- * <code>getId()</code>.
- * Returns <code>null</code> if no icon has been specified in the
- * extension or if <code>getId()</code> returns <code>null</code>.
- *
- * @return the working set icon or <code>null</code>.
- * @since 3.3
- */
- ImageDescriptor getImageDescriptor();
-
- /**
- * Returns the name of the working set.
- *
- * @return the name of the working set
- */
- String getName();
-
- /**
+ /**
+ * Returns the elements that are contained in this working set.
+ * <p>
+ * This method might throw an {@link IllegalStateException} if the working set
+ * is invalid.
+ * </p>
+ *
+ * @return the working set's elements
+ */
+ IAdaptable[] getElements();
+
+ /**
+ * Returns the working set id. Returns <code>null</code> if no working set id
+ * has been set. This is one of the ids defined by extensions of the
+ * org.eclipse.ui.workingSets extension point. It is used by the workbench to
+ * determine the page to use in the working set edit wizard. The default
+ * resource edit page is used if this value is <code>null</code>.
+ *
+ * @return the working set id. May be <code>null</code>
+ * @since 2.1
+ */
+ String getId();
+
+ /**
+ * Returns the working set icon. Currently, this is one of the icons specified
+ * in the extensions of the org.eclipse.ui.workingSets extension point. The
+ * extension is identified using the value returned by <code>getId()</code>.
+ * Returns <code>null</code> if no icon has been specified in the extension or
+ * if <code>getId()</code> returns <code>null</code>.
+ *
+ * @return the working set icon or <code>null</code>.
+ * @since 2.1
+ * @deprecated use {@link #getImageDescriptor()} instead
+ */
+ @Deprecated
+ ImageDescriptor getImage();
+
+ /**
+ * Returns the working set icon. Currently, this is one of the icons specified
+ * in the extensions of the org.eclipse.ui.workingSets extension point. The
+ * extension is identified using the value returned by <code>getId()</code>.
+ * Returns <code>null</code> if no icon has been specified in the extension or
+ * if <code>getId()</code> returns <code>null</code>.
+ *
+ * @return the working set icon or <code>null</code>.
+ * @since 3.3
+ */
+ ImageDescriptor getImageDescriptor();
+
+ /**
+ * Returns the name of the working set.
+ *
+ * @return the name of the working set
+ */
+ String getName();
+
+ /**
* Sets the elements that are contained in this working set.
*
- * @param elements
- * the elements to set in this working set
- * @since 3.3 it is now recommended that all calls to this method pass
- * through the results from calling
- * {@link #adaptElements(IAdaptable[])} with the desired elements.
+ * @param elements the elements to set in this working set
+ * @since 3.3 it is now recommended that all calls to this method pass through
+ * the results from calling {@link #adaptElements(IAdaptable[])} with the
+ * desired elements.
*/
void setElements(IAdaptable[] elements);
- /**
- * Sets the working set id. This is one of the ids defined by extensions of
- * the org.eclipse.ui.workingSets extension point. It is used by the
- * workbench to determine the page to use in the working set edit wizard.
- * The default resource edit page is used if this value is <code>null</code>.
+ /**
+ * Sets the working set id. This is one of the ids defined by extensions of the
+ * org.eclipse.ui.workingSets extension point. It is used by the workbench to
+ * determine the page to use in the working set edit wizard. The default
+ * resource edit page is used if this value is <code>null</code>.
*
- * @param id
- * the working set id. May be <code>null</code>
+ * @param id the working set id. May be <code>null</code>
* @since 2.1
*/
- void setId(String id);
-
- /**
- * Sets the name of the working set.
- * The working set name should be unique.
- * The working set name must not have leading or trailing
- * whitespace.
- *
- * @param name the name of the working set
- */
- void setName(String name);
-
- /**
- * Returns whether this working set can be edited or not. To make
- * a working set editable the attribute <code>pageClass</code> of
- * the extension defining a working set must be provided.
- *
- * @return <code>true</code> if the working set can be edited; otherwise
- * <code>false</code>
- *
- * @since 3.1
- */
- boolean isEditable();
-
- /**
- * Returns whether this working set should be shown in user interface
- * components that list working sets by name.
- *
- * @return <code>true</code> if the working set should be shown in the
- * user interface; otherwise <code>false</code>
+ void setId(String id);
+
+ /**
+ * Sets the name of the working set. The working set name should be unique. The
+ * working set name must not have leading or trailing whitespace.
+ *
+ * @param name the name of the working set
+ */
+ void setName(String name);
+
+ /**
+ * Returns whether this working set can be edited or not. To make a working set
+ * editable the attribute <code>pageClass</code> of the extension defining a
+ * working set must be provided.
+ *
+ * @return <code>true</code> if the working set can be edited; otherwise
+ * <code>false</code>
+ *
+ * @since 3.1
+ */
+ boolean isEditable();
+
+ /**
+ * Returns whether this working set should be shown in user interface components
+ * that list working sets by name.
+ *
+ * @return <code>true</code> if the working set should be shown in the user
+ * interface; otherwise <code>false</code>
*
* @since 3.2
*/
boolean isVisible();
- /**
- * Return the name of this working set, formated for the end user. Often this value is
- * the same as the one returned from {@link #getName()}.
+ /**
+ * Return the name of this working set, formated for the end user. Often this
+ * value is the same as the one returned from {@link #getName()}.
*
* @return the name of this working set, formated for the end user
* @since 3.2
*/
- String getLabel();
+ String getLabel();
- /**
+ /**
* Set the name of this working set, formated for the end user.
*
- * @param label
- * the label for this working set. If <code>null</code> is
- * supplied then the value of {@link #getName()} will be used.
+ * @param label the label for this working set. If <code>null</code> is supplied
+ * then the value of {@link #getName()} will be used.
* @since 3.2
*/
void setLabel(String label);
/**
- * Returns <code>true</code> if this working set is capable of updating
- * itself and reacting to changes in the state of its members. For
- * non-aggregate working sets this means that the working set has an
- * {@link IWorkingSetUpdater} installed while for aggregates it means that
- * all component sets have {@link IWorkingSetUpdater}s installed. Otherwise
- * returns <code>false</code>.
+ * Returns <code>true</code> if this working set is capable of updating itself
+ * and reacting to changes in the state of its members. For non-aggregate
+ * working sets this means that the working set has an
+ * {@link IWorkingSetUpdater} installed while for aggregates it means that all
+ * component sets have {@link IWorkingSetUpdater}s installed. Otherwise returns
+ * <code>false</code>.
*
* @return whether the set is self-updating or not
* @since 3.2
@@ -183,7 +174,8 @@ public interface IWorkingSet extends IPersistableElement, IAdaptable {
* specific way. Please see the documentation for
* {@link IWorkbenchPage#getAggregateWorkingSet()} for details.
* <p>
- * If this is true, you can cast this working set to an {@link IAggregateWorkingSet}
+ * If this is true, you can cast this working set to an
+ * {@link IAggregateWorkingSet}
*
* @return whether this working set is an aggregate working set or not
* @since 3.2
@@ -200,15 +192,14 @@ public interface IWorkingSet extends IPersistableElement, IAdaptable {
/**
* Transforms the supplied elements into elements that are suitable for
- * containment in this working set. This is useful for UI elements which
- * wish to filter contributions to working sets based on applicability. This
- * is a hint, however, and is not considered when the
- * {@link #setElements(IAdaptable[])} method is invoked.
- *
- * @param objects
- * the objects to transform
- * @return an array of transformed elements that be empty if no elements
- * from the original array are suitable
+ * containment in this working set. This is useful for UI elements which wish to
+ * filter contributions to working sets based on applicability. This is a hint,
+ * however, and is not considered when the {@link #setElements(IAdaptable[])}
+ * method is invoked.
+ *
+ * @param objects the objects to transform
+ * @return an array of transformed elements that be empty if no elements from
+ * the original array are suitable
* @since 3.3
* @see org.eclipse.ui.IWorkingSetElementAdapter
* @see org.eclipse.ui.BasicWorkingSetElementAdapter
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSetElementAdapter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSetElementAdapter.java
index bb2bd38c553..96ad735234c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSetElementAdapter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSetElementAdapter.java
@@ -27,8 +27,8 @@ import org.eclipse.core.runtime.IAdaptable;
* <p>
* Usage of this interface is achieved via the <code>elementAdapterClass</code>
* attribute of the <code>org.eclipse.ui.workingSets</code> extension point.
- * Usage of this interface in <code>org.eclipse.ui.workingSets</code>
- * extensions is optional.
+ * Usage of this interface in <code>org.eclipse.ui.workingSets</code> extensions
+ * is optional.
* </p>
*
* @since 3.3
@@ -38,12 +38,9 @@ public interface IWorkingSetElementAdapter {
/**
* Converts the given elements for addition to/removal from the working set.
*
- * @param ws
- * the target working set that elements should be adapted for
- * @param elements
- * the elements to adapt
- * @return the (possibly adapted) elements to add to/remove from the working
- * set
+ * @param ws the target working set that elements should be adapted for
+ * @param elements the elements to adapt
+ * @return the (possibly adapted) elements to add to/remove from the working set
*/
IAdaptable[] adaptElements(IWorkingSet ws, IAdaptable[] elements);
@@ -52,4 +49,3 @@ public interface IWorkingSetElementAdapter {
*/
void dispose();
}
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSetManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSetManager.java
index 01f8aa72ab8..8205fece459 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSetManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSetManager.java
@@ -22,8 +22,8 @@ import org.eclipse.ui.dialogs.IWorkingSetNewWizard;
import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog;
/**
- * A working set manager stores working sets and provides property
- * change notification when a working set is added or removed.
+ * A working set manager stores working sets and provides property change
+ * notification when a working set is added or removed.
* <p>
* The workbench working set manager can be accessed using
* <code>IWorkbench#getWorkingSetManager()</code>
@@ -39,315 +39,303 @@ import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog;
*/
public interface IWorkingSetManager {
- /**
- * Change event id when a working set is added
- * newValue of the PropertyChangeEvent will be the added working set.
- * oldValue will be null.
- *
- * @see IPropertyChangeListener
- */
- String CHANGE_WORKING_SET_ADD = "workingSetAdd"; //$NON-NLS-1$
+ /**
+ * Change event id when a working set is added newValue of the
+ * PropertyChangeEvent will be the added working set. oldValue will be null.
+ *
+ * @see IPropertyChangeListener
+ */
+ String CHANGE_WORKING_SET_ADD = "workingSetAdd"; //$NON-NLS-1$
- /**
- * Change event id when a working set is removed
- * newValue of the PropertyChangeEvent will be null.
- * oldValue will be the removed working set.
- *
- * @see IPropertyChangeListener
- */
- String CHANGE_WORKING_SET_REMOVE = "workingSetRemove"; //$NON-NLS-1$
+ /**
+ * Change event id when a working set is removed newValue of the
+ * PropertyChangeEvent will be null. oldValue will be the removed working set.
+ *
+ * @see IPropertyChangeListener
+ */
+ String CHANGE_WORKING_SET_REMOVE = "workingSetRemove"; //$NON-NLS-1$
- /**
- * Change event id when the working set contents changed
- * newValue of the PropertyChangeEvent will be the changed working set.
- *
- * @see IPropertyChangeListener
- */
- String CHANGE_WORKING_SET_CONTENT_CHANGE = "workingSetContentChange"; //$NON-NLS-1$
+ /**
+ * Change event id when the working set contents changed newValue of the
+ * PropertyChangeEvent will be the changed working set.
+ *
+ * @see IPropertyChangeListener
+ */
+ String CHANGE_WORKING_SET_CONTENT_CHANGE = "workingSetContentChange"; //$NON-NLS-1$
- /**
- * Change event id when the working set name changed.
- * newValue of the PropertyChangeEvent will be the changed working set.
- *
- * @see IPropertyChangeListener
- */
- String CHANGE_WORKING_SET_NAME_CHANGE = "workingSetNameChange"; //$NON-NLS-1$
+ /**
+ * Change event id when the working set name changed. newValue of the
+ * PropertyChangeEvent will be the changed working set.
+ *
+ * @see IPropertyChangeListener
+ */
+ String CHANGE_WORKING_SET_NAME_CHANGE = "workingSetNameChange"; //$NON-NLS-1$
- /**
- * Change event id when the working set label changed.
- * newValue of the PropertyChangeEvent will be the changed working set.
- *
- * @see IPropertyChangeListener
- * @since 3.2
- */
- String CHANGE_WORKING_SET_LABEL_CHANGE = "workingSetLabelChange"; //$NON-NLS-1$
+ /**
+ * Change event id when the working set label changed. newValue of the
+ * PropertyChangeEvent will be the changed working set.
+ *
+ * @see IPropertyChangeListener
+ * @since 3.2
+ */
+ String CHANGE_WORKING_SET_LABEL_CHANGE = "workingSetLabelChange"; //$NON-NLS-1$
- /**
- * Change event id when a working set updater got installed.
- * NewValue of the PropertyChangeEvent will be the installed updater.
- * OldValue will be <code>null</code>
- * @since 3.1
- */
- String CHANGE_WORKING_SET_UPDATER_INSTALLED = "workingSetUpdaterInstalled"; //$NON-NLS-1$
+ /**
+ * Change event id when a working set updater got installed. NewValue of the
+ * PropertyChangeEvent will be the installed updater. OldValue will be
+ * <code>null</code>
+ *
+ * @since 3.1
+ */
+ String CHANGE_WORKING_SET_UPDATER_INSTALLED = "workingSetUpdaterInstalled"; //$NON-NLS-1$
- /**
- * Change event id when a working set updater got uninstalled.
- * NewValue will be <code>null</code>
- * OldValue of the PropertyChangeEvent will be the uninstalled updater.
- * @since 3.3
- */
- String CHANGE_WORKING_SET_UPDATER_UNINSTALLED = "workingSetUpdaterUninstalled"; //$NON-NLS-1$
+ /**
+ * Change event id when a working set updater got uninstalled. NewValue will be
+ * <code>null</code> OldValue of the PropertyChangeEvent will be the uninstalled
+ * updater.
+ *
+ * @since 3.3
+ */
+ String CHANGE_WORKING_SET_UPDATER_UNINSTALLED = "workingSetUpdaterUninstalled"; //$NON-NLS-1$
- /**
- * Adds a property change listener.
- *
- * @param listener the property change listener to add
- */
- void addPropertyChangeListener(IPropertyChangeListener listener);
+ /**
+ * Adds a property change listener.
+ *
+ * @param listener the property change listener to add
+ */
+ void addPropertyChangeListener(IPropertyChangeListener listener);
- /**
- * Adds a working set to the top of the list of most recently used
- * working sets, making it the most recently used working set.
- * The last (oldest) item will be deleted if the list exceeds the
- * size limit.
- *
- * @param workingSet the working set to add to the list of most
- * recently used working sets.
- */
- void addRecentWorkingSet(IWorkingSet workingSet);
+ /**
+ * Adds a working set to the top of the list of most recently used working sets,
+ * making it the most recently used working set. The last (oldest) item will be
+ * deleted if the list exceeds the size limit.
+ *
+ * @param workingSet the working set to add to the list of most recently used
+ * working sets.
+ */
+ void addRecentWorkingSet(IWorkingSet workingSet);
- /**
- * Adds a working set to the receiver. The working set must
- * not exist yet.
- *
- * @param workingSet the working set to add
- */
- void addWorkingSet(IWorkingSet workingSet);
+ /**
+ * Adds a working set to the receiver. The working set must not exist yet.
+ *
+ * @param workingSet the working set to add
+ */
+ void addWorkingSet(IWorkingSet workingSet);
- /**
- * Creates a new working set.
- * The working set is not added to the working set manager.
- *
- * @param name the name of the new working set. Should not have
- * leading or trailing whitespace.
- * @param elements the working set contents
- * @return a new working set with the specified name and content
- */
- IWorkingSet createWorkingSet(String name, IAdaptable[] elements);
+ /**
+ * Creates a new working set. The working set is not added to the working set
+ * manager.
+ *
+ * @param name the name of the new working set. Should not have leading or
+ * trailing whitespace.
+ * @param elements the working set contents
+ * @return a new working set with the specified name and content
+ */
+ IWorkingSet createWorkingSet(String name, IAdaptable[] elements);
- /**
- * Create a working set that is the union of a collection of other working
- * sets. One connected (via
- * {@link IWorkingSetManager#addWorkingSet(IWorkingSet)} this working set
- * will be automatically updated to reflect the contents of the component
- * sets, should they themselves change.
- *
- * @param name
- * the name of the new working set. Should not have leading or
- * trailing whitespace.
- * @param label
- * the user-friendly label the working set
- * @param components
- * the component working sets
+ /**
+ * Create a working set that is the union of a collection of other working sets.
+ * One connected (via {@link IWorkingSetManager#addWorkingSet(IWorkingSet)} this
+ * working set will be automatically updated to reflect the contents of the
+ * component sets, should they themselves change.
+ *
+ * @param name the name of the new working set. Should not have leading or
+ * trailing whitespace.
+ * @param label the user-friendly label the working set
+ * @param components the component working sets
* @return a new working set with the specified name and content
*
* @since 3.2
*/
- IWorkingSet createAggregateWorkingSet(String name, String label,
- IWorkingSet[] components);
+ IWorkingSet createAggregateWorkingSet(String name, String label, IWorkingSet[] components);
- /**
- * Re-creates and returns a working set from the state captured within the
- * given memento.
- *
- * @param memento a memento containing the state for the working set
- * @return the restored working set, or <code>null</code> if it could not be created
- *
- * @since 3.0
- */
- IWorkingSet createWorkingSet(IMemento memento);
-
- /**
- * Creates a working set edit wizard for the specified working set.
- * The working set will already be set in the wizard.
- * The caller is responsible for creating and opening a wizard dialog.
- *
- * Example:
- * <code>
- * IWorkingSetEditWizard wizard = workingSetManager.createWorkingSetEditWizard(workingSet);
- * if (wizard != null) {
- * WizardDialog dialog = new WizardDialog(shell, wizard);
- *
- * dialog.create();
- * if (dialog.open() == Window.OK) {
- * workingSet = wizard.getSelection();
- * }
- * }
- * </code>
- *
- * @param workingSet working set to create a working set edit wizard
- * for.
- * @return a working set edit wizard to edit the specified working set
- * or <code>null</code> if no edit wizard has been defined for the
- * working set. If the defined edit wizard for the working set could
- * not be loaded a default IResource based wizard will be returned.
- * If the default edit wizard can not be loaded <code>null</code> is
- * returned.
- * @since 2.1
- */
- IWorkingSetEditWizard createWorkingSetEditWizard(
- IWorkingSet workingSet);
+ /**
+ * Re-creates and returns a working set from the state captured within the given
+ * memento.
+ *
+ * @param memento a memento containing the state for the working set
+ * @return the restored working set, or <code>null</code> if it could not be
+ * created
+ *
+ * @since 3.0
+ */
+ IWorkingSet createWorkingSet(IMemento memento);
+ /**
+ * Creates a working set edit wizard for the specified working set. The working
+ * set will already be set in the wizard. The caller is responsible for creating
+ * and opening a wizard dialog.
+ *
+ * Example: <code>
+ * IWorkingSetEditWizard wizard = workingSetManager.createWorkingSetEditWizard(workingSet);
+ * if (wizard != null) {
+ * WizardDialog dialog = new WizardDialog(shell, wizard);
+ *
+ * dialog.create();
+ * if (dialog.open() == Window.OK) {
+ * workingSet = wizard.getSelection();
+ * }
+ * }
+ * </code>
+ *
+ * @param workingSet working set to create a working set edit wizard for.
+ * @return a working set edit wizard to edit the specified working set or
+ * <code>null</code> if no edit wizard has been defined for the working
+ * set. If the defined edit wizard for the working set could not be
+ * loaded a default IResource based wizard will be returned. If the
+ * default edit wizard can not be loaded <code>null</code> is returned.
+ * @since 2.1
+ */
+ IWorkingSetEditWizard createWorkingSetEditWizard(IWorkingSet workingSet);
- /**
- * Creates a working set new wizard. The wizard will allow creating new
- * working sets. Returns <code>null</code> if there aren't any working set
- * definitions that support creation of working sets.
- * <p>
- * Example:
- * <code>
- * IWorkingSetNewWizard wizard= workingSetManager.createWorkingSetNewWizard(null);
- * if (wizard != null) {
- * WizardDialog dialog = new WizardDialog(shell, wizard);
- *
- * dialog.create();
- * if (dialog.open() == Window.OK) {
- * ...
- * }
- * }
- * </code>
- * </p>
- *
- * @param workingSetIds a list of working set ids which are valid workings sets
- * to be created or <code>null</code> if all currently available working set types
- * are valid
- *
- * @return the working set new wizard or <code>null</code>
- *
- * @since 3.1
- */
- IWorkingSetNewWizard createWorkingSetNewWizard(String[] workingSetIds);
+ /**
+ * Creates a working set new wizard. The wizard will allow creating new working
+ * sets. Returns <code>null</code> if there aren't any working set definitions
+ * that support creation of working sets.
+ * <p>
+ * Example: <code>
+ * IWorkingSetNewWizard wizard= workingSetManager.createWorkingSetNewWizard(null);
+ * if (wizard != null) {
+ * WizardDialog dialog = new WizardDialog(shell, wizard);
+ *
+ * dialog.create();
+ * if (dialog.open() == Window.OK) {
+ * ...
+ * }
+ * }
+ * </code>
+ * </p>
+ *
+ * @param workingSetIds a list of working set ids which are valid workings sets
+ * to be created or <code>null</code> if all currently
+ * available working set types are valid
+ *
+ * @return the working set new wizard or <code>null</code>
+ *
+ * @since 3.1
+ */
+ IWorkingSetNewWizard createWorkingSetNewWizard(String[] workingSetIds);
- /**
- * @param parent the parent shell
- * @return the dialog
- * @deprecated use createWorkingSetSelectionDialog(parent, true) instead
- */
- @Deprecated IWorkingSetSelectionDialog createWorkingSetSelectionDialog(
- Shell parent);
+ /**
+ * @param parent the parent shell
+ * @return the dialog
+ * @deprecated use createWorkingSetSelectionDialog(parent, true) instead
+ */
+ @Deprecated
+ IWorkingSetSelectionDialog createWorkingSetSelectionDialog(Shell parent);
- /**
- * Creates a working set selection dialog that lists all working
- * sets and allows the user to add, remove and edit working sets.
- * The caller is responsible for opening the dialog with
- * <code>IWorkingSetSelectionDialog#open</code>, and subsequently
- * extracting the selected working sets using
- * <code>IWorkingSetSelectionDialog#getSelection</code>.
- *
- * @param parentShell the parent shell of the working set selection dialog
- * @param multi true= <code>IWorkingSetSelectionDialog#getSelection()</code>
- * returns the working sets chosen in the dialog as an array of working set.
- * false= <code>IWorkingSetSelectionDialog#getSelection()</code> returns
- * an array having a single aggregate working set of all working sets
- * selected in the dialog.
- * @return a working set selection dialog
- */
- IWorkingSetSelectionDialog createWorkingSetSelectionDialog(
- Shell parentShell, boolean multi);
+ /**
+ * Creates a working set selection dialog that lists all working sets and allows
+ * the user to add, remove and edit working sets. The caller is responsible for
+ * opening the dialog with <code>IWorkingSetSelectionDialog#open</code>, and
+ * subsequently extracting the selected working sets using
+ * <code>IWorkingSetSelectionDialog#getSelection</code>.
+ *
+ * @param parentShell the parent shell of the working set selection dialog
+ * @param multi true=
+ * <code>IWorkingSetSelectionDialog#getSelection()</code>
+ * returns the working sets chosen in the dialog as an array
+ * of working set. false=
+ * <code>IWorkingSetSelectionDialog#getSelection()</code>
+ * returns an array having a single aggregate working set of
+ * all working sets selected in the dialog.
+ * @return a working set selection dialog
+ */
+ IWorkingSetSelectionDialog createWorkingSetSelectionDialog(Shell parentShell, boolean multi);
- /**
- * Creates a working set selection dialog that lists all working
- * sets with the specified ids and allows the user to add, remove and
- * edit working sets with the specified ids.
- * The caller is responsible for opening the dialog with
- * <code>IWorkingSetSelectionDialog#open</code>, and subsequently
- * extracting the selected working sets using
- * <code>IWorkingSetSelectionDialog#getSelection</code>.
- *
- * @param parentShell the parent shell of the working set selection dialog
- * @param multi true= <code>IWorkingSetSelectionDialog#getSelection()</code>
- * returns the working sets chosen in the dialog as an array of working set.
- * false= <code>IWorkingSetSelectionDialog#getSelection()</code> returns
- * an array having a single aggregate working set of all working sets
- * selected in the dialog.
- * @param workingsSetIds a list of working set ids which are valid workings sets
- * to be selected, created, removed or edited, or <code>null</code> if all currently
- * available working set types are valid
- * @return a working set selection dialog
- * @since 3.1
- */
- IWorkingSetSelectionDialog createWorkingSetSelectionDialog(
- Shell parentShell, boolean multi, String[] workingsSetIds);
+ /**
+ * Creates a working set selection dialog that lists all working sets with the
+ * specified ids and allows the user to add, remove and edit working sets with
+ * the specified ids. The caller is responsible for opening the dialog with
+ * <code>IWorkingSetSelectionDialog#open</code>, and subsequently extracting the
+ * selected working sets using
+ * <code>IWorkingSetSelectionDialog#getSelection</code>.
+ *
+ * @param parentShell the parent shell of the working set selection dialog
+ * @param multi true=
+ * <code>IWorkingSetSelectionDialog#getSelection()</code>
+ * returns the working sets chosen in the dialog as an
+ * array of working set. false=
+ * <code>IWorkingSetSelectionDialog#getSelection()</code>
+ * returns an array having a single aggregate working set
+ * of all working sets selected in the dialog.
+ * @param workingsSetIds a list of working set ids which are valid workings sets
+ * to be selected, created, removed or edited, or
+ * <code>null</code> if all currently available working
+ * set types are valid
+ * @return a working set selection dialog
+ * @since 3.1
+ */
+ IWorkingSetSelectionDialog createWorkingSetSelectionDialog(Shell parentShell, boolean multi,
+ String[] workingsSetIds);
- /**
- * Returns the list of most recently used working sets.
- * The most recently used working set appears first in the list.
- *
- * @return the list of most recently used working sets
- */
- IWorkingSet[] getRecentWorkingSets();
+ /**
+ * Returns the list of most recently used working sets. The most recently used
+ * working set appears first in the list.
+ *
+ * @return the list of most recently used working sets
+ */
+ IWorkingSet[] getRecentWorkingSets();
- /**
- * Returns the working set with the specified name.
- * Returns null if there is no working set with that name.
- *
- * @param name the name of the working set to return
- * @return the working set with the specified name.
- */
- IWorkingSet getWorkingSet(String name);
+ /**
+ * Returns the working set with the specified name. Returns null if there is no
+ * working set with that name.
+ *
+ * @param name the name of the working set to return
+ * @return the working set with the specified name.
+ */
+ IWorkingSet getWorkingSet(String name);
- /**
+ /**
* Returns an array of all working sets stored in the receiver. The array is
- * sorted by names. Any working set whose {@link IWorkingSet#isVisible()}
- * method returns false will not be included in this array. For a complete
- * list of working sets please use {@link #getAllWorkingSets()}.
+ * sorted by names. Any working set whose {@link IWorkingSet#isVisible()} method
+ * returns false will not be included in this array. For a complete list of
+ * working sets please use {@link #getAllWorkingSets()}.
*
* @return the working sets stored in the receiver
*/
- IWorkingSet[] getWorkingSets();
+ IWorkingSet[] getWorkingSets();
- /**
- * Returns an array of all working sets stored in the receiver including
- * those that are marked as being not visible.
+ /**
+ * Returns an array of all working sets stored in the receiver including those
+ * that are marked as being not visible.
*
* @see IWorkingSet#isVisible()
* @return the working sets stored in the receiver
* @since 3.2
*/
- IWorkingSet[] getAllWorkingSets();
+ IWorkingSet[] getAllWorkingSets();
- /**
- * Removes the property change listener.
- *
- * @param listener the property change listener to remove
- */
- void removePropertyChangeListener(IPropertyChangeListener listener);
+ /**
+ * Removes the property change listener.
+ *
+ * @param listener the property change listener to remove
+ */
+ void removePropertyChangeListener(IPropertyChangeListener listener);
- /**
- * Removes the working set
- *
- * @param workingSet the working set to remove
- */
- void removeWorkingSet(IWorkingSet workingSet);
+ /**
+ * Removes the working set
+ *
+ * @param workingSet the working set to remove
+ */
+ void removeWorkingSet(IWorkingSet workingSet);
- /**
- * Disposes the working set manager.
- *
- * @since 3.1
- */
- void dispose();
+ /**
+ * Disposes the working set manager.
+ *
+ * @since 3.1
+ */
+ void dispose();
- /**
- * Utility method that will add the <code>element</code> to each given
- * working set in <code>workingSets</code> if possible. This method will
- * invoke {@link IWorkingSet#adaptElements(IAdaptable[])} for the element on
- * each working set and the result of this method will be used rather than
- * the original element in the addition operation.
- *
- * @param element
- * the element to adapt and then add to the working sets
- * @param workingSets
- * the working sets to add the element to
+ /**
+ * Utility method that will add the <code>element</code> to each given working
+ * set in <code>workingSets</code> if possible. This method will invoke
+ * {@link IWorkingSet#adaptElements(IAdaptable[])} for the element on each
+ * working set and the result of this method will be used rather than the
+ * original element in the addition operation.
+ *
+ * @param element the element to adapt and then add to the working sets
+ * @param workingSets the working sets to add the element to
* @since 3.4
*/
void addToWorkingSets(IAdaptable element, IWorkingSet[] workingSets);
@@ -355,8 +343,7 @@ public interface IWorkingSetManager {
/**
* Sets maximum length of the recent working sets list.
*
- * @param length
- * maximum number of recent working sets to be kept in the list
+ * @param length maximum number of recent working sets to be kept in the list
* @since 3.7
*/
void setRecentWorkingSetsLength(int length);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSetUpdater.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSetUpdater.java
index cf1630659b7..3be327cdba4 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSetUpdater.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSetUpdater.java
@@ -14,17 +14,18 @@
package org.eclipse.ui;
/**
- * An <code>IWorkingSetUpdater</code> can be used to dynamically update
- * the content of a working set.
+ * An <code>IWorkingSetUpdater</code> can be used to dynamically update the
+ * content of a working set.
* <p>
- * A working set updater manages a set of working sets. It is contributed
- * via the attribute <code>updaterClass</code> of the <code>
+ * A working set updater manages a set of working sets. It is contributed via
+ * the attribute <code>updaterClass</code> of the <code>
* org.eclipse.ui.workingSets</code> extension point. Extensions of this
* extension point must therefore implement this interface.
* </p>
* <p>
* API under construction and subject to change at any time.
* </p>
+ *
* @since 3.1
*/
public interface IWorkingSetUpdater {
@@ -40,26 +41,24 @@ public interface IWorkingSetUpdater {
*
* @param workingSet the working set to remove
*
- * @return <code>true</code> if the updater changed (e.g.
- * the element got removed)
+ * @return <code>true</code> if the updater changed (e.g. the element got
+ * removed)
*/
boolean remove(IWorkingSet workingSet);
/**
- * Returns <code>true</code> if the updater contains the
- * given working set; otherwise <code>false</code> is
- * returned.
+ * Returns <code>true</code> if the updater contains the given working set;
+ * otherwise <code>false</code> is returned.
*
* @param workingSet the parameter to check
*
- * @return whether the updater contains the given working
- * set
+ * @return whether the updater contains the given working set
*/
boolean contains(IWorkingSet workingSet);
/**
- * Disposes this working set updater. Implementations of this
- * method typically remove listeners from some delta providers.
+ * Disposes this working set updater. Implementations of this method typically
+ * remove listeners from some delta providers.
*/
void dispose();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/LegacyHandlerSubmissionExpression.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/LegacyHandlerSubmissionExpression.java
index b450cf9f129..df69abb7d41 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/LegacyHandlerSubmissionExpression.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/LegacyHandlerSubmissionExpression.java
@@ -33,46 +33,41 @@ public final class LegacyHandlerSubmissionExpression extends Expression {
/**
* The seed for the hash code for all schemes.
*/
- private static final int HASH_INITIAL = LegacyHandlerSubmissionExpression.class
- .getName().hashCode();
+ private static final int HASH_INITIAL = LegacyHandlerSubmissionExpression.class.getName().hashCode();
/**
* The identifier for the part that must be active for this expression to
- * evaluate to <code>true</code>. If this value is <code>null</code>,
- * then any part may be active.
+ * evaluate to <code>true</code>. If this value is <code>null</code>, then any
+ * part may be active.
*/
private final String activePartId;
/**
* The shell that must be active for this expression to evaluate to
- * <code>true</code>. If this value is <code>null</code>, then any
- * shell may be active.
+ * <code>true</code>. If this value is <code>null</code>, then any shell may be
+ * active.
*/
private final Shell activeShell;
/**
* The site that must be active for this expression to evaluate to
- * <code>true</code>. If this value is <code>null</code>, then any
- * site may be active.
+ * <code>true</code>. If this value is <code>null</code>, then any site may be
+ * active.
*/
private final IWorkbenchPartSite activeSite;
/**
- * Constructs a new instance of
- * <code>LegacyHandlerSubmissionExpression</code>
+ * Constructs a new instance of <code>LegacyHandlerSubmissionExpression</code>
*
- * @param activePartId
- * The part identifier to match with the active part;
- * <code>null</code> if it will match any active part.
- * @param activeShell
- * The shell to match with the active shell; <code>null</code>
- * if it will match any active shell.
- * @param activeSite
- * The site to match with the active site; <code>null</code> if
- * it will match any active site.
+ * @param activePartId The part identifier to match with the active part;
+ * <code>null</code> if it will match any active part.
+ * @param activeShell The shell to match with the active shell;
+ * <code>null</code> if it will match any active shell.
+ * @param activeSite The site to match with the active site; <code>null</code>
+ * if it will match any active site.
*/
- public LegacyHandlerSubmissionExpression(final String activePartId,
- final Shell activeShell, final IWorkbenchPartSite activeSite) {
+ public LegacyHandlerSubmissionExpression(final String activePartId, final Shell activeShell,
+ final IWorkbenchPartSite activeSite) {
this.activePartId = activePartId;
this.activeShell = activeShell;
@@ -80,9 +75,9 @@ public final class LegacyHandlerSubmissionExpression extends Expression {
}
/**
- * Collect expression info for a legacy handler submission. Namely
- * the active part id and name, active shell name, active workbench
- * window shell name and the active site name.
+ * Collect expression info for a legacy handler submission. Namely the active
+ * part id and name, active shell name, active workbench window shell name and
+ * the active site name.
*
* @since 3.2
*/
@@ -93,8 +88,7 @@ public final class LegacyHandlerSubmissionExpression extends Expression {
}
if (activeShell != null) {
info.addVariableNameAccess(ISources.ACTIVE_SHELL_NAME);
- info
- .addVariableNameAccess(ISources.ACTIVE_WORKBENCH_WINDOW_SHELL_NAME);
+ info.addVariableNameAccess(ISources.ACTIVE_WORKBENCH_WINDOW_SHELL_NAME);
}
if (activeSite != null) {
info.addVariableNameAccess(ISources.ACTIVE_SITE_NAME);
@@ -113,8 +107,7 @@ public final class LegacyHandlerSubmissionExpression extends Expression {
public boolean equals(final Object object) {
if (object instanceof LegacyHandlerSubmissionExpression) {
final LegacyHandlerSubmissionExpression that = (LegacyHandlerSubmissionExpression) object;
- return equals(this.activePartId, that.activePartId)
- && equals(this.activeShell, that.activeShell)
+ return equals(this.activePartId, that.activePartId) && equals(this.activeShell, that.activeShell)
&& equals(this.activeSite, that.activeSite);
}
@@ -123,21 +116,19 @@ public final class LegacyHandlerSubmissionExpression extends Expression {
/**
* Evaluates this expression. This tests the three conditions against the
- * current state of the application (as defined by <code>context</code>).
- * If a condition is <code>null</code>, then it matches any possible
- * value (i.e., it is not tested at all).
+ * current state of the application (as defined by <code>context</code>). If a
+ * condition is <code>null</code>, then it matches any possible value (i.e., it
+ * is not tested at all).
*
- * @param context
- * The context providing the current workbench state; must not be
- * <code>null</code>.
- * @return <code>EvaluationResult.TRUE</code> if the conditions all
- * matches; <code>EvaluationResult.FALSE</code> otherwise.
+ * @param context The context providing the current workbench state; must not be
+ * <code>null</code>.
+ * @return <code>EvaluationResult.TRUE</code> if the conditions all matches;
+ * <code>EvaluationResult.FALSE</code> otherwise.
*/
@Override
public EvaluationResult evaluate(final IEvaluationContext context) {
if (activePartId != null) {
- final Object value = context
- .getVariable(ISources.ACTIVE_PART_ID_NAME);
+ final Object value = context.getVariable(ISources.ACTIVE_PART_ID_NAME);
if (!activePartId.equals(value)) {
return EvaluationResult.FALSE;
}
@@ -146,8 +137,7 @@ public final class LegacyHandlerSubmissionExpression extends Expression {
if (activeShell != null) {
Object value = context.getVariable(ISources.ACTIVE_SHELL_NAME);
if (!activeShell.equals(value)) {
- value = context
- .getVariable(ISources.ACTIVE_WORKBENCH_WINDOW_SHELL_NAME);
+ value = context.getVariable(ISources.ACTIVE_WORKBENCH_WINDOW_SHELL_NAME);
if (!activeShell.equals(value)) {
return EvaluationResult.FALSE;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/MultiPartInitException.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/MultiPartInitException.java
index d1989a8f199..2205c141970 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/MultiPartInitException.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/MultiPartInitException.java
@@ -27,25 +27,24 @@ public class MultiPartInitException extends WorkbenchException {
private PartInitException[] exceptions;
/**
- * Creates a new exception object. Note that as of 3.5, this constructor
- * expects exactly one exception object in the given array, with all other
- * array positions being <code>null</code>. The restriction may be lifted in
- * the future, and clients of this class must not make this assumption.
+ * Creates a new exception object. Note that as of 3.5, this constructor expects
+ * exactly one exception object in the given array, with all other array
+ * positions being <code>null</code>. The restriction may be lifted in the
+ * future, and clients of this class must not make this assumption.
*
* @param references
* @param exceptions
*/
- public MultiPartInitException(IWorkbenchPartReference[] references,
- PartInitException[] exceptions) {
+ public MultiPartInitException(IWorkbenchPartReference[] references, PartInitException[] exceptions) {
super(exceptions[findFirstException(exceptions)].getStatus());
this.references = references;
this.exceptions = exceptions;
}
/**
- * Returns an array of part references, containing references of parts that
- * were intialized correctly. Any number of elements of the returned array
- * may have a <code>null</code> value.
+ * Returns an array of part references, containing references of parts that were
+ * intialized correctly. Any number of elements of the returned array may have a
+ * <code>null</code> value.
*
* @return the part reference array
*/
@@ -55,8 +54,8 @@ public class MultiPartInitException extends WorkbenchException {
/**
* Returns an array of exceptions, corresponding to parts that could not be
- * intialized correctly. At least one element of the returned array will
- * have a non-<code>null</code> value.
+ * intialized correctly. At least one element of the returned array will have a
+ * non-<code>null</code> value.
*
* @return the exception array
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/NavigationLocation.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/NavigationLocation.java
index 60f736fe3bb..3cbf5f67cb6 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/NavigationLocation.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/NavigationLocation.java
@@ -21,68 +21,68 @@ package org.eclipse.ui;
*/
public abstract class NavigationLocation implements INavigationLocation {
- private IWorkbenchPage page;
+ private IWorkbenchPage page;
- private IEditorInput input;
+ private IEditorInput input;
- /**
- * Constructs a NavigationLocation with its editor part.
- *
- * @param editorPart
- */
- protected NavigationLocation(IEditorPart editorPart) {
- this.page = editorPart.getSite().getPage();
- this.input = editorPart.getEditorInput();
- }
+ /**
+ * Constructs a NavigationLocation with its editor part.
+ *
+ * @param editorPart
+ */
+ protected NavigationLocation(IEditorPart editorPart) {
+ this.page = editorPart.getSite().getPage();
+ this.input = editorPart.getEditorInput();
+ }
- /**
- * Returns the part that the receiver holds the location for.
- *
- * @return IEditorPart
- */
- protected IEditorPart getEditorPart() {
- if (input == null) {
+ /**
+ * Returns the part that the receiver holds the location for.
+ *
+ * @return IEditorPart
+ */
+ protected IEditorPart getEditorPart() {
+ if (input == null) {
return null;
}
- return page.findEditor(input);
- }
+ return page.findEditor(input);
+ }
- @Override
+ @Override
public Object getInput() {
- return input;
- }
+ return input;
+ }
- @Override
+ @Override
public String getText() {
- IEditorPart part = getEditorPart();
- if (part == null) {
+ IEditorPart part = getEditorPart();
+ if (part == null) {
return ""; //$NON-NLS-1$
}
- return part.getTitle();
- }
+ return part.getTitle();
+ }
- @Override
+ @Override
public void setInput(Object input) {
- this.input = (IEditorInput) input;
- }
+ this.input = (IEditorInput) input;
+ }
- /**
- * May be extended by clients.
- *
- * @see org.eclipse.ui.INavigationLocation#dispose()
- */
- @Override
+ /**
+ * May be extended by clients.
+ *
+ * @see org.eclipse.ui.INavigationLocation#dispose()
+ */
+ @Override
public void dispose() {
- releaseState();
- }
+ releaseState();
+ }
- /**
- * May be extended by clients.
- *
- * @see org.eclipse.ui.INavigationLocation#releaseState()
- */
- @Override
+ /**
+ * May be extended by clients.
+ *
+ * @see org.eclipse.ui.INavigationLocation#releaseState()
+ */
+ @Override
public void releaseState() {
- input = null;
- }
+ input = null;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/OpenAndLinkWithEditorHelper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/OpenAndLinkWithEditorHelper.java
index fa20bd5443c..6261726ba32 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/OpenAndLinkWithEditorHelper.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/OpenAndLinkWithEditorHelper.java
@@ -24,9 +24,9 @@ import org.eclipse.jface.viewers.OpenEvent;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredViewer;
-
/**
- * Helper for opening editors on the viewer's selection and link the selection with the editor.
+ * Helper for opening editors on the viewer's selection and link the selection
+ * with the editor.
*
* @since 3.5
*/
@@ -40,7 +40,6 @@ public abstract class OpenAndLinkWithEditorHelper {
private InternalListener listener;
-
private final class InternalListener implements IOpenListener, ISelectionChangedListener, IDoubleClickListener {
@Override
@@ -65,7 +64,6 @@ public abstract class OpenAndLinkWithEditorHelper {
}
-
/**
* Creates a new helper for the given viewer.
*
@@ -81,7 +79,8 @@ public abstract class OpenAndLinkWithEditorHelper {
}
/**
- * Sets whether editor that corresponds to the viewer's selection should be brought to front.
+ * Sets whether editor that corresponds to the viewer's selection should be
+ * brought to front.
*
* @param enabled <code>true</code> to enable, <code>false</code> to disable
*/
@@ -92,7 +91,8 @@ public abstract class OpenAndLinkWithEditorHelper {
/**
* Disposes this helper.
* <p>
- * Clients only need to call this method if their viewer has a longer life-cycle than this helper.
+ * Clients only need to call this method if their viewer has a longer life-cycle
+ * than this helper.
* </p>
*/
public void dispose() {
@@ -117,8 +117,8 @@ public abstract class OpenAndLinkWithEditorHelper {
* Tells to open an editor for the given selection.
*
* @param selection the viewer's selection
- * @param activate <code>true</code> if the editor should be activated, <code>false</code>
- * otherwise
+ * @param activate <code>true</code> if the editor should be activated,
+ * <code>false</code> otherwise
* @since 3.5
*/
protected abstract void open(ISelection selection, boolean activate);
@@ -137,8 +137,7 @@ public abstract class OpenAndLinkWithEditorHelper {
* The default implementation does nothing i.e. does not implement linking.
* </p>
*
- * @param selection
- * the viewer's selection
+ * @param selection the viewer's selection
* @since 3.5, non-abstract since 4.3
*/
protected void linkToEditor(ISelection selection) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/PartInitException.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/PartInitException.java
index 5bf8f947bbd..7c11279b399 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/PartInitException.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/PartInitException.java
@@ -21,42 +21,44 @@ import org.eclipse.core.runtime.IStatus;
* <p>
* This exception class is not intended to be subclassed by clients.
* </p>
+ *
* @noextend This class is not intended to be subclassed by clients.
*/
public class PartInitException extends WorkbenchException {
- /**
- * Generated serial version UID for this class.
- * @since 3.1
- */
- private static final long serialVersionUID = 3257284721296684850L;
+ /**
+ * Generated serial version UID for this class.
+ *
+ * @since 3.1
+ */
+ private static final long serialVersionUID = 3257284721296684850L;
- /**
- * Creates a new exception with the given message.
- *
- * @param message the message
- */
- public PartInitException(String message) {
- super(message);
- }
+ /**
+ * Creates a new exception with the given message.
+ *
+ * @param message the message
+ */
+ public PartInitException(String message) {
+ super(message);
+ }
- /**
- * Creates a new exception with the given message.
- *
- * @param message the message
- * @param nestedException a exception to be wrapped by this PartInitException
- */
- public PartInitException(String message, Throwable nestedException) {
- super(message, nestedException);
- }
+ /**
+ * Creates a new exception with the given message.
+ *
+ * @param message the message
+ * @param nestedException a exception to be wrapped by this PartInitException
+ */
+ public PartInitException(String message, Throwable nestedException) {
+ super(message, nestedException);
+ }
- /**
- * Creates a new exception with the given status object. The message
- * of the given status is used as the exception message.
- *
- * @param status the status object to be associated with this exception
- */
- public PartInitException(IStatus status) {
- super(status);
- }
+ /**
+ * Creates a new exception with the given status object. The message of the
+ * given status is used as the exception message.
+ *
+ * @param status the status object to be associated with this exception
+ */
+ public PartInitException(IStatus status) {
+ super(status);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/PerspectiveAdapter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/PerspectiveAdapter.java
index b0c132c3f39..7c9f8262b31 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/PerspectiveAdapter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/PerspectiveAdapter.java
@@ -31,58 +31,50 @@ package org.eclipse.ui;
*/
public class PerspectiveAdapter implements IPerspectiveListener4 {
-
@Override
- public void perspectiveOpened(IWorkbenchPage page,
- IPerspectiveDescriptor perspective) {
+ public void perspectiveOpened(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
// do nothing
}
@Override
- public void perspectiveClosed(IWorkbenchPage page,
- IPerspectiveDescriptor perspective) {
+ public void perspectiveClosed(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
// do nothing
}
@Override
- public void perspectiveChanged(IWorkbenchPage page,
- IPerspectiveDescriptor perspective,
+ public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective,
IWorkbenchPartReference partRef, String changeId) {
// do nothing
}
@Override
- public void perspectiveActivated(IWorkbenchPage page,
- IPerspectiveDescriptor perspective) {
+ public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
// do nothing
}
@Override
- public void perspectiveChanged(IWorkbenchPage page,
- IPerspectiveDescriptor perspective, String changeId) {
+ public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId) {
// do nothing
}
@Override
- public void perspectiveDeactivated(IWorkbenchPage page,
- IPerspectiveDescriptor perspective) {
+ public void perspectiveDeactivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
// do nothing
}
@Override
- public void perspectiveSavedAs(IWorkbenchPage page,
- IPerspectiveDescriptor oldPerspective,
+ public void perspectiveSavedAs(IWorkbenchPage page, IPerspectiveDescriptor oldPerspective,
IPerspectiveDescriptor newPerspective) {
// do nothing
}
/**
* {@inheritDoc}
+ *
* @since 3.2
*/
@Override
- public void perspectivePreDeactivate(IWorkbenchPage page,
- IPerspectiveDescriptor perspective) {
+ public void perspectivePreDeactivate(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
// do nothing
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/PlatformUI.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/PlatformUI.java
index 812fa5a9084..19d8c4fc4c8 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/PlatformUI.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/PlatformUI.java
@@ -23,9 +23,9 @@ import org.eclipse.ui.internal.util.PrefUtil;
import org.eclipse.ui.testing.TestableObject;
/**
- * The central class for access to the Eclipse Platform User Interface.
- * This class cannot be instantiated; all functionality is provided by
- * static methods.
+ * The central class for access to the Eclipse Platform User Interface. This
+ * class cannot be instantiated; all functionality is provided by static
+ * methods.
*
* Features provided:
* <ul>
@@ -36,163 +36,164 @@ import org.eclipse.ui.testing.TestableObject;
* @see IWorkbench
*/
public final class PlatformUI {
- /**
- * Identifies the workbench plug-in.
- */
- public static final String PLUGIN_ID = "org.eclipse.ui"; //$NON-NLS-1$
+ /**
+ * Identifies the workbench plug-in.
+ */
+ public static final String PLUGIN_ID = "org.eclipse.ui"; //$NON-NLS-1$
- /**
- * Return code (value 0) indicating that the workbench terminated normally.
- *
- * @see #createAndRunWorkbench
- * @since 3.0
- */
- public static final int RETURN_OK = 0;
+ /**
+ * Return code (value 0) indicating that the workbench terminated normally.
+ *
+ * @see #createAndRunWorkbench
+ * @since 3.0
+ */
+ public static final int RETURN_OK = 0;
- /**
- * Return code (value 1) indicating that the workbench was terminated with
- * a call to <code>IWorkbench.restart</code>.
- *
- * @see #createAndRunWorkbench
- * @see IWorkbench#restart
- * @since 3.0
- */
- public static final int RETURN_RESTART = 1;
+ /**
+ * Return code (value 1) indicating that the workbench was terminated with a
+ * call to <code>IWorkbench.restart</code>.
+ *
+ * @see #createAndRunWorkbench
+ * @see IWorkbench#restart
+ * @since 3.0
+ */
+ public static final int RETURN_RESTART = 1;
- /**
- * Return code (value 2) indicating that the workbench failed to start.
- *
- * @see #createAndRunWorkbench
- * @see IWorkbench#restart
- * @since 3.0
- */
- public static final int RETURN_UNSTARTABLE = 2;
+ /**
+ * Return code (value 2) indicating that the workbench failed to start.
+ *
+ * @see #createAndRunWorkbench
+ * @see IWorkbench#restart
+ * @since 3.0
+ */
+ public static final int RETURN_UNSTARTABLE = 2;
- /**
- * Return code (value 3) indicating that the workbench was terminated with
- * a call to IWorkbenchConfigurer#emergencyClose.
- *
- * @see #createAndRunWorkbench
- * @since 3.0
- */
- public static final int RETURN_EMERGENCY_CLOSE = 3;
+ /**
+ * Return code (value 3) indicating that the workbench was terminated with a
+ * call to IWorkbenchConfigurer#emergencyClose.
+ *
+ * @see #createAndRunWorkbench
+ * @since 3.0
+ */
+ public static final int RETURN_EMERGENCY_CLOSE = 3;
- /**
- * Block instantiation.
- */
- private PlatformUI() {
- // do nothing
- }
+ /**
+ * Block instantiation.
+ */
+ private PlatformUI() {
+ // do nothing
+ }
- /**
- * Returns the workbench. Fails if the workbench has not been created yet.
- *
- * @return the workbench
- */
- public static IWorkbench getWorkbench() {
- if (Workbench.getInstance() == null) {
- // app forgot to call createAndRunWorkbench beforehand
- throw new IllegalStateException(WorkbenchMessages.PlatformUI_NoWorkbench);
- }
- return Workbench.getInstance();
- }
+ /**
+ * Returns the workbench. Fails if the workbench has not been created yet.
+ *
+ * @return the workbench
+ */
+ public static IWorkbench getWorkbench() {
+ if (Workbench.getInstance() == null) {
+ // app forgot to call createAndRunWorkbench beforehand
+ throw new IllegalStateException(WorkbenchMessages.PlatformUI_NoWorkbench);
+ }
+ return Workbench.getInstance();
+ }
- /**
- * Returns whether {@link #createAndRunWorkbench createAndRunWorkbench} has
- * been called to create the workbench, and the workbench has yet to
- * terminate.
+ /**
+ * Returns whether {@link #createAndRunWorkbench createAndRunWorkbench} has been
+ * called to create the workbench, and the workbench has yet to terminate.
* <p>
- * Note that this method may return <code>true</code> while the workbench
- * is still being initialized, so it may not be safe to call workbench API
- * methods even if this method returns true. See bug 49316 for details.
+ * Note that this method may return <code>true</code> while the workbench is
+ * still being initialized, so it may not be safe to call workbench API methods
+ * even if this method returns true. See bug 49316 for details.
* </p>
*
- * @return <code>true</code> if the workbench has been created and is
- * still running, and <code>false</code> if the workbench has not
- * yet been created or has completed
+ * @return <code>true</code> if the workbench has been created and is still
+ * running, and <code>false</code> if the workbench has not yet been
+ * created or has completed
* @since 3.0
*/
- public static boolean isWorkbenchRunning() {
+ public static boolean isWorkbenchRunning() {
return Workbench.getInstance() != null && Workbench.getInstance().isRunning();
- }
+ }
- /**
- * Creates the workbench and associates it with the given display and workbench
- * advisor, and runs the workbench UI. This entails processing and dispatching
- * events until the workbench is closed or restarted.
- * <p>
- * This method is intended to be called by the main class (the "application").
- * Fails if the workbench UI has already been created.
- * </p>
- * <p>
- * Use {@link #createDisplay createDisplay} to create the display to pass in.
- * </p>
- * <p>
- * Note that this method is intended to be called by the application
- * (<code>org.eclipse.core.boot.IPlatformRunnable</code>). It must be
- * called exactly once, and early on before anyone else asks
- * <code>getWorkbench()</code> for the workbench.
- * </p>
- *
- * @param display the display to be used for all UI interactions with the workbench
- * @param advisor the application-specific advisor that configures and
- * specializes the workbench
- * @return return code {@link #RETURN_OK RETURN_OK} for normal exit;
- * {@link #RETURN_RESTART RETURN_RESTART} if the workbench was terminated
- * with a call to {@link IWorkbench#restart IWorkbench.restart};
- * {@link #RETURN_UNSTARTABLE RETURN_UNSTARTABLE} if the workbench could
- * not be started;
- * {@link #RETURN_EMERGENCY_CLOSE RETURN_EMERGENCY_CLOSE} if the UI quit
- * because of an emergency; other values reserved for future use
- * @since 3.0
- */
+ /**
+ * Creates the workbench and associates it with the given display and workbench
+ * advisor, and runs the workbench UI. This entails processing and dispatching
+ * events until the workbench is closed or restarted.
+ * <p>
+ * This method is intended to be called by the main class (the "application").
+ * Fails if the workbench UI has already been created.
+ * </p>
+ * <p>
+ * Use {@link #createDisplay createDisplay} to create the display to pass in.
+ * </p>
+ * <p>
+ * Note that this method is intended to be called by the application
+ * (<code>org.eclipse.core.boot.IPlatformRunnable</code>). It must be called
+ * exactly once, and early on before anyone else asks
+ * <code>getWorkbench()</code> for the workbench.
+ * </p>
+ *
+ * @param display the display to be used for all UI interactions with the
+ * workbench
+ * @param advisor the application-specific advisor that configures and
+ * specializes the workbench
+ * @return return code {@link #RETURN_OK RETURN_OK} for normal exit;
+ * {@link #RETURN_RESTART RETURN_RESTART} if the workbench was
+ * terminated with a call to {@link IWorkbench#restart
+ * IWorkbench.restart}; {@link #RETURN_UNSTARTABLE RETURN_UNSTARTABLE}
+ * if the workbench could not be started; {@link #RETURN_EMERGENCY_CLOSE
+ * RETURN_EMERGENCY_CLOSE} if the UI quit because of an emergency; other
+ * values reserved for future use
+ * @since 3.0
+ */
public static int createAndRunWorkbench(Display display, WorkbenchAdvisor advisor) {
- return Workbench.createAndRunWorkbench(display, advisor);
- }
+ return Workbench.createAndRunWorkbench(display, advisor);
+ }
- /**
- * Creates the <code>Display</code> to be used by the workbench.
- * It is the caller's responsibility to dispose the resulting <code>Display</code>,
- * not the workbench's.
- *
- * @return the display
- * @since 3.0
- */
- public static Display createDisplay() {
- return Workbench.createDisplay();
- }
+ /**
+ * Creates the <code>Display</code> to be used by the workbench. It is the
+ * caller's responsibility to dispose the resulting <code>Display</code>, not
+ * the workbench's.
+ *
+ * @return the display
+ * @since 3.0
+ */
+ public static Display createDisplay() {
+ return Workbench.createDisplay();
+ }
- /**
- * Returns the testable object facade, for use by the test harness.
- * <p>
- * IMPORTANT: This method is only for use by the test harness.
- * Applications and regular plug-ins should not call this method.
- * </p><p>
- * To avoid depending on the the Workbench a {@link TestableObject}
- * can be obtained via OSGi service.
- * </p>
- *
- * @return the testable object facade
- * @since 3.0
- */
- public static TestableObject getTestableObject() {
+ /**
+ * Returns the testable object facade, for use by the test harness.
+ * <p>
+ * IMPORTANT: This method is only for use by the test harness. Applications and
+ * regular plug-ins should not call this method.
+ * </p>
+ * <p>
+ * To avoid depending on the the Workbench a {@link TestableObject} can be
+ * obtained via OSGi service.
+ * </p>
+ *
+ * @return the testable object facade
+ * @since 3.0
+ */
+ public static TestableObject getTestableObject() {
// Try finding a pre-registered TO in the OSGi service registry
TestableObject testableObject = WorkbenchPlugin.getDefault().getTestableObject();
if (testableObject == null) {
return Workbench.getWorkbenchTestable();
}
return testableObject;
- }
+ }
- /**
- * Returns the preference store used for publicly settable workbench preferences.
- * Constants for these preferences are defined on
- * {@link org.eclipse.ui.IWorkbenchPreferenceConstants}.
- *
- * @return the workbench public preference store
- * @since 3.0
- */
- public static IPreferenceStore getPreferenceStore() {
- return PrefUtil.getAPIPreferenceStore();
- }
+ /**
+ * Returns the preference store used for publicly settable workbench
+ * preferences. Constants for these preferences are defined on
+ * {@link org.eclipse.ui.IWorkbenchPreferenceConstants}.
+ *
+ * @return the workbench public preference store
+ * @since 3.0
+ */
+ public static IPreferenceStore getPreferenceStore() {
+ return PrefUtil.getAPIPreferenceStore();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/Saveable.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/Saveable.java
index 697d40ad56e..8da55f29f94 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/Saveable.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/Saveable.java
@@ -48,19 +48,18 @@ import org.eclipse.ui.progress.IJobRunnable;
public abstract class Saveable extends InternalSaveable implements IAdaptable {
/**
- * Either {@code null} or the System's {@link SWT#CURSOR_WAIT} cursor
- * instance. Should never be disposed.
+ * Either {@code null} or the System's {@link SWT#CURSOR_WAIT} cursor instance.
+ * Should never be disposed.
*/
private Cursor waitCursor;
private Cursor originalCursor;
/**
* Attempts to show this saveable in the given page and returns
- * <code>true</code> on success. The default implementation does nothing
- * and returns <code>false</code>.
+ * <code>true</code> on success. The default implementation does nothing and
+ * returns <code>false</code>.
*
- * @param page
- * the workbench page in which to show this saveable
+ * @param page the workbench page in which to show this saveable
* @return <code>true</code> if this saveable is now visible to the user
* @since 3.3
*/
@@ -81,8 +80,8 @@ public abstract class Saveable extends InternalSaveable implements IAdaptable {
/**
* Returns the tool tip text for this saveable. This text is used to
* differentiate between two inputs with the same name. For instance,
- * MyClass.java in folder X and MyClass.java in folder Y. The format of the
- * text varies between input types.
+ * MyClass.java in folder X and MyClass.java in folder Y. The format of the text
+ * varies between input types.
*
* @return the tool tip text; never <code>null</code>
*/
@@ -91,28 +90,26 @@ public abstract class Saveable extends InternalSaveable implements IAdaptable {
/**
* Returns the image descriptor for this saveable.
*
- * @return the image descriptor for this model; may be <code>null</code>
- * if there is no image
+ * @return the image descriptor for this model; may be <code>null</code> if
+ * there is no image
*/
public abstract ImageDescriptor getImageDescriptor();
/**
* Saves the contents of this saveable.
* <p>
- * If the save is cancelled through user action, or for any other reason,
- * the part should invoke <code>setCancelled</code> on the
+ * If the save is cancelled through user action, or for any other reason, the
+ * part should invoke <code>setCancelled</code> on the
* <code>IProgressMonitor</code> to inform the caller.
* </p>
* <p>
- * This method is long-running; progress and cancellation are provided by
- * the given progress monitor.
+ * This method is long-running; progress and cancellation are provided by the
+ * given progress monitor.
* </p>
*
- * @param monitor
- * the progress monitor
- * @throws CoreException
- * if the save fails; it is the caller's responsibility to
- * report the failure to the user
+ * @param monitor the progress monitor
+ * @throws CoreException if the save fails; it is the caller's responsibility to
+ * report the failure to the user
*/
public abstract void doSave(IProgressMonitor monitor) throws CoreException;
@@ -124,19 +121,18 @@ public abstract class Saveable extends InternalSaveable implements IAdaptable {
* determine their enabled status.
* </p>
*
- * @return <code>true</code> if the contents have been modified and need
- * saving, and <code>false</code> if they have not changed since
- * the last save
+ * @return <code>true</code> if the contents have been modified and need saving,
+ * and <code>false</code> if they have not changed since the last save
*/
public abstract boolean isDirty();
/**
* Clients must implement equals and hashCode as defined in
- * {@link Object#equals(Object)} and {@link Object#hashCode()}. Two
- * saveables should be equal if their dirty state is shared, and saving one
- * will save the other. If two saveables are equal, their names, tooltips,
- * and images should be the same because only one of them will be shown when
- * prompting the user to save.
+ * {@link Object#equals(Object)} and {@link Object#hashCode()}. Two saveables
+ * should be equal if their dirty state is shared, and saving one will save the
+ * other. If two saveables are equal, their names, tooltips, and images should
+ * be the same because only one of them will be shown when prompting the user to
+ * save.
*
* @param object
* @return true if this Saveable is equal to the given object
@@ -146,16 +142,16 @@ public abstract class Saveable extends InternalSaveable implements IAdaptable {
/**
* Clients must implement equals and hashCode as defined in
- * {@link Object#equals(Object)} and {@link Object#hashCode()}. Two
- * saveables should be equal if their dirty state is shared, and saving one
- * will save the other. If two saveables are equal, their hash codes MUST be
- * the same, and their names, tooltips, and images should be the same
- * because only one of them will be shown when prompting the user to save.
+ * {@link Object#equals(Object)} and {@link Object#hashCode()}. Two saveables
+ * should be equal if their dirty state is shared, and saving one will save the
+ * other. If two saveables are equal, their hash codes MUST be the same, and
+ * their names, tooltips, and images should be the same because only one of them
+ * will be shown when prompting the user to save.
* <p>
* IMPORTANT: Implementers should ensure that the hashCode returned is
* sufficiently unique so as not to collide with hashCodes returned by other
- * implementations. It is suggested that the defining plug-in's ID be used
- * as part of the returned hashCode, as in the following example:
+ * implementations. It is suggested that the defining plug-in's ID be used as
+ * part of the returned hashCode, as in the following example:
* </p>
*
* <pre>
@@ -171,85 +167,75 @@ public abstract class Saveable extends InternalSaveable implements IAdaptable {
/**
* Saves this saveable, or prepares this saveable for a background save
- * operation. Returns null if this saveable has been successfully saved, or
- * a job runnable that needs to be run to complete the save in the
- * background. This method is called in the UI thread. If this saveable
- * supports saving in the background, it should do only minimal work.
- * However, since the job runnable returned by this method (if any) will not
- * run on the UI thread, this method should copy any state that can only be
- * accessed from the UI thread so that the job runnable will be able to
- * access it.
+ * operation. Returns null if this saveable has been successfully saved, or a
+ * job runnable that needs to be run to complete the save in the background.
+ * This method is called in the UI thread. If this saveable supports saving in
+ * the background, it should do only minimal work. However, since the job
+ * runnable returned by this method (if any) will not run on the UI thread, this
+ * method should copy any state that can only be accessed from the UI thread so
+ * that the job runnable will be able to access it.
* <p>
* The supplied shell provider can be used from within this method and from
- * within the job runnable for the purpose of parenting dialogs. Care should
- * be taken not to open dialogs gratuitously and only if user input is
- * required for cases where the save cannot otherwise proceed - note that in
- * any given save operation, many saveable objects may be saved at the same
- * time. In particular, errors should be signaled by throwing an exception,
- * or if an error occurs while running the job runnable, an error status
- * should be returned.
+ * within the job runnable for the purpose of parenting dialogs. Care should be
+ * taken not to open dialogs gratuitously and only if user input is required for
+ * cases where the save cannot otherwise proceed - note that in any given save
+ * operation, many saveable objects may be saved at the same time. In
+ * particular, errors should be signaled by throwing an exception, or if an
+ * error occurs while running the job runnable, an error status should be
+ * returned.
* </p>
* <p>
- * If the foreground part of the save is cancelled through user action, or
- * for any other reason, the part should invoke <code>setCancelled</code>
- * on the <code>IProgressMonitor</code> to inform the caller. If the
- * background part of the save is cancelled, the job should return a
- * {@link IStatus#CANCEL} status.
+ * If the foreground part of the save is cancelled through user action, or for
+ * any other reason, the part should invoke <code>setCancelled</code> on the
+ * <code>IProgressMonitor</code> to inform the caller. If the background part of
+ * the save is cancelled, the job should return a {@link IStatus#CANCEL} status.
* </p>
* <p>
- * This method is long-running; progress and cancellation are provided by
- * the given progress monitor.
+ * This method is long-running; progress and cancellation are provided by the
+ * given progress monitor.
* </p>
* <p>
* The default implementation of this method calls
* {@link #doSave(IProgressMonitor)} and returns <code>null</code>.
* </p>
*
- * @param monitor
- * a progress monitor used for reporting progress and
- * cancellation
- * @param shellProvider
- * an object that can provide a shell for parenting dialogs
- * @return <code>null</code> if this saveable has been saved successfully,
- * or a job runnable that needs to be run to complete the save in
- * the background.
- * @throws CoreException
- * if the save fails; it is the caller's responsibility to
- * report the failure to the user
+ * @param monitor a progress monitor used for reporting progress and
+ * cancellation
+ * @param shellProvider an object that can provide a shell for parenting dialogs
+ * @return <code>null</code> if this saveable has been saved successfully, or a
+ * job runnable that needs to be run to complete the save in the
+ * background.
+ * @throws CoreException if the save fails; it is the caller's responsibility to
+ * report the failure to the user
* @since 3.3
*/
- public IJobRunnable doSave(IProgressMonitor monitor,
- IShellProvider shellProvider) throws CoreException {
+ public IJobRunnable doSave(IProgressMonitor monitor, IShellProvider shellProvider) throws CoreException {
doSave(monitor);
return null;
}
/**
* Disables the UI of the given parts containing this saveable if necessary.
- * This method is not intended to be called by clients. A corresponding call
- * to
+ * This method is not intended to be called by clients. A corresponding call to
* <p>
* Saveables that can be saved in the background should ensure that the user
* cannot make changes to their data from the UI, for example by disabling
- * controls, unless they are prepared to handle this case. This method is
- * called on the UI thread after a job runnable has been returned from
- * {@link #doSave(IProgressMonitor, IShellProvider)} and before
- * spinning the event loop. The <code>closing</code> flag indicates that
- * this saveable is currently being saved in response to closing a workbench
- * part, in which case further changes to this saveable through the UI must
- * be prevented.
+ * controls, unless they are prepared to handle this case. This method is called
+ * on the UI thread after a job runnable has been returned from
+ * {@link #doSave(IProgressMonitor, IShellProvider)} and before spinning the
+ * event loop. The <code>closing</code> flag indicates that this saveable is
+ * currently being saved in response to closing a workbench part, in which case
+ * further changes to this saveable through the UI must be prevented.
* </p>
* <p>
* The default implementation calls setEnabled(false) on the given parts'
* composites.
* </p>
*
- * @param parts
- * the workbench parts containing this saveable
- * @param closing
- * a boolean flag indicating whether the save was triggered by a
- * request to close a workbench part, and all of the given parts
- * will be closed after the save operation finishes successfully.
+ * @param parts the workbench parts containing this saveable
+ * @param closing a boolean flag indicating whether the save was triggered by a
+ * request to close a workbench part, and all of the given parts
+ * will be closed after the save operation finishes successfully.
*
* @since 3.3
*/
@@ -271,16 +257,15 @@ public abstract class Saveable extends InternalSaveable implements IAdaptable {
}
/**
- * Enables the UI of the given parts containing this saveable after a
- * background save operation has finished. This method is not intended to be
- * called by clients.
+ * Enables the UI of the given parts containing this saveable after a background
+ * save operation has finished. This method is not intended to be called by
+ * clients.
* <p>
* The default implementation calls setEnabled(true) on the given parts'
* composites.
* </p>
*
- * @param parts
- * the workbench parts containing this saveable
+ * @param parts the workbench parts containing this saveable
*
* @since 3.3
*/
@@ -292,8 +277,8 @@ public abstract class Saveable extends InternalSaveable implements IAdaptable {
paneComposite.setCursor(originalCursor);
if (waitCursor != null) {
/*
- * waitCursor is always the System SWT.CURSOR_WAIT instance and
- * should never be disposed
+ * waitCursor is always the System SWT.CURSOR_WAIT instance and should never be
+ * disposed
*/
waitCursor = null;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/SaveablesLifecycleEvent.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/SaveablesLifecycleEvent.java
index 0358ab90da6..988b5fe8679 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/SaveablesLifecycleEvent.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/SaveablesLifecycleEvent.java
@@ -16,7 +16,6 @@ package org.eclipse.ui;
import java.util.EventObject;
-
/**
* Event object describing a change to a set of Saveable objects.
*
@@ -65,22 +64,17 @@ public class SaveablesLifecycleEvent extends EventObject {
/**
* Creates a new SaveablesLifecycleEvent.
*
- * @param source
- * The source of the event. If an ISaveablesSource notifies
- * about changes to the saveables returned by
- * {@link ISaveablesSource#getSaveables()}, the source must be
- * the ISaveablesSource object.
- * @param eventType
- * the event type, currently one of POST_OPEN, PRE_CLOSE,
- * POST_CLOSE, DIRTY_CHANGED
- * @param saveables
- * The affected saveables
- * @param force
- * true if the event type is PRE_CLOSE and this is a closed force
- * that cannot be canceled.
+ * @param source The source of the event. If an ISaveablesSource notifies
+ * about changes to the saveables returned by
+ * {@link ISaveablesSource#getSaveables()}, the source must be
+ * the ISaveablesSource object.
+ * @param eventType the event type, currently one of POST_OPEN, PRE_CLOSE,
+ * POST_CLOSE, DIRTY_CHANGED
+ * @param saveables The affected saveables
+ * @param force true if the event type is PRE_CLOSE and this is a closed
+ * force that cannot be canceled.
*/
- public SaveablesLifecycleEvent(Object source, int eventType,
- Saveable[] saveables, boolean force) {
+ public SaveablesLifecycleEvent(Object source, int eventType, Saveable[] saveables, boolean force) {
super(source);
this.eventType = eventType;
this.saveables = saveables;
@@ -89,8 +83,8 @@ public class SaveablesLifecycleEvent extends EventObject {
/**
* Returns the eventType, currently one of POST_OPEN, PRE_CLOSE, POST_CLOSE,
- * DIRTY_CHANGED. Listeners should silently ignore unknown event types since
- * new event types might be added in the future.
+ * DIRTY_CHANGED. Listeners should silently ignore unknown event types since new
+ * event types might be added in the future.
*
* @return the eventType
*/
@@ -118,8 +112,7 @@ public class SaveablesLifecycleEvent extends EventObject {
}
/**
- * @param veto
- * The veto to set.
+ * @param veto The veto to set.
*/
public void setVeto(boolean veto) {
this.veto = veto;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/SelectionEnabler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/SelectionEnabler.java
index 2f698eef680..3a830e303d6 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/SelectionEnabler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/SelectionEnabler.java
@@ -35,20 +35,21 @@ import org.osgi.framework.Bundle;
/**
* Determines the enablement status given a selection. This calculation is done
* based on the definition of the <code>enablesFor</code> attribute,
- * <code>enablement</code> element, and the <code>selection</code> element
- * found in the <code>IConfigurationElement</code> provided.
+ * <code>enablement</code> element, and the <code>selection</code> element found
+ * in the <code>IConfigurationElement</code> provided.
* <p>
* This class can be instantiated by clients. It is not intended to be extended.
* </p>
*
* @since 3.0
*
- * Note: The dependency on org.eclipse.jface.text for ITextSelection must be
- * severed It may be possible to do with IActionFilter generic workbench
- * registers IActionFilter for "size" property against IStructuredSelection
- * workbench text registers IActionFilter for "size" property against
- * ITextSelection code here: sel.getAdapter(IActionFilter.class) As an interim
- * solution, use reflection to access selections implementing ITextSelection
+ * Note: The dependency on org.eclipse.jface.text for ITextSelection must
+ * be severed It may be possible to do with IActionFilter generic
+ * workbench registers IActionFilter for "size" property against
+ * IStructuredSelection workbench text registers IActionFilter for "size"
+ * property against ITextSelection code here:
+ * sel.getAdapter(IActionFilter.class) As an interim solution, use
+ * reflection to access selections implementing ITextSelection
*/
public final class SelectionEnabler {
@@ -63,8 +64,8 @@ public final class SelectionEnabler {
public static final int ANY_NUMBER = -2;
/**
- * The constant integer hash code value meaning the hash code has not yet
- * been computed.
+ * The constant integer hash code value meaning the hash code has not yet been
+ * computed.
*/
private static final int HASH_CODE_NOT_COMPUTED = -1;
@@ -76,8 +77,7 @@ public final class SelectionEnabler {
/**
* The seed for the hash code for all schemes.
*/
- private static final int HASH_INITIAL = SelectionEnabler.class.getName()
- .hashCode();
+ private static final int HASH_INITIAL = SelectionEnabler.class.getName().hashCode();
/**
* Cached value of <code>org.eclipse.jface.text.ITextSelection.class</code>;
@@ -99,25 +99,25 @@ public final class SelectionEnabler {
public static final int ONE_OR_MORE = -1;
/**
- * Hard-wired fully qualified name of the text selection class (not on
- * pre-req chain).
+ * Hard-wired fully qualified name of the text selection class (not on pre-req
+ * chain).
*/
private static final String TEXT_SELECTION_CLASS = "org.eclipse.jface.text.ITextSelection"; //$NON-NLS-1$
/**
- * Indicates whether the JFace text plug-in is even around. Without the
- * JFace text plug-in, text selections are moot.
+ * Indicates whether the JFace text plug-in is even around. Without the JFace
+ * text plug-in, text selections are moot.
*/
private static boolean textSelectionPossible = true;
public static final int UNKNOWN = 0;
/**
- * Returns <code>ITextSelection.class</code> or <code>null</code> if the
- * class is not available.
+ * Returns <code>ITextSelection.class</code> or <code>null</code> if the class
+ * is not available.
*
- * @return <code>ITextSelection.class</code> or <code>null</code> if
- * class not available
+ * @return <code>ITextSelection.class</code> or <code>null</code> if class not
+ * available
* @since 3.0
*/
private static Class getTextSelectionClass() {
@@ -164,8 +164,8 @@ public final class SelectionEnabler {
}
/**
- * Verifies that the given name matches the given wildcard filter. Returns
- * true if it does.
+ * Verifies that the given name matches the given wildcard filter. Returns true
+ * if it does.
*
* @param name
* @param filter
@@ -180,8 +180,8 @@ public final class SelectionEnabler {
private ActionExpression enablementExpression;
/**
- * The hash code for this object. This value is computed lazily, and marked
- * as invalid when one of the values on which it is based changes.
+ * The hash code for this object. This value is computed lazily, and marked as
+ * invalid when one of the values on which it is based changes.
*/
private transient int hashCode = HASH_CODE_NOT_COMPUTED;
@@ -205,8 +205,7 @@ public final class SelectionEnabler {
if (object instanceof SelectionEnabler) {
final SelectionEnabler that = (SelectionEnabler) object;
return Util.equals(this.classes, that.classes)
- && Util.equals(this.enablementExpression,
- that.enablementExpression)
+ && Util.equals(this.enablementExpression, that.enablementExpression)
&& Util.equals(this.mode, that.mode);
}
@@ -222,8 +221,7 @@ public final class SelectionEnabler {
public int hashCode() {
if (hashCode == HASH_CODE_NOT_COMPUTED) {
hashCode = HASH_INITIAL * HASH_FACTOR + Util.hashCode(classes);
- hashCode = hashCode * HASH_FACTOR
- + Util.hashCode(enablementExpression);
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(enablementExpression);
hashCode = hashCode * HASH_FACTOR + Util.hashCode(mode);
if (hashCode == HASH_CODE_NOT_COMPUTED) {
hashCode++;
@@ -233,8 +231,8 @@ public final class SelectionEnabler {
}
/**
- * Returns true if given structured selection matches the conditions
- * specified in the registry for this action.
+ * Returns true if given structured selection matches the conditions specified
+ * in the registry for this action.
*/
private boolean isEnabledFor(ISelection sel) {
Object obj = sel;
@@ -266,8 +264,8 @@ public final class SelectionEnabler {
}
/**
- * Returns true if given text selection matches the conditions specified in
- * the registry for this action.
+ * Returns true if given text selection matches the conditions specified in the
+ * registry for this action.
*/
private boolean isEnabledFor(ISelection sel, int count) {
if (verifySelectionCount(count) == false) {
@@ -293,8 +291,8 @@ public final class SelectionEnabler {
}
/**
- * Returns true if given structured selection matches the conditions
- * specified in the registry for this action.
+ * Returns true if given structured selection matches the conditions specified
+ * in the registry for this action.
*/
private boolean isEnabledFor(IStructuredSelection ssel) {
int count = ssel.size();
@@ -386,13 +384,12 @@ public final class SelectionEnabler {
}
/**
- * Parses registry element to extract mode and selection elements that will
- * be used for verification.
+ * Parses registry element to extract mode and selection elements that will be
+ * used for verification.
*/
private void parseClasses(IConfigurationElement config) {
// Get enables for.
- String enablesFor = config
- .getAttribute(IWorkbenchRegistryConstants.ATT_ENABLES_FOR);
+ String enablesFor = config.getAttribute(IWorkbenchRegistryConstants.ATT_ENABLES_FOR);
if (enablesFor == null) {
enablesFor = "*"; //$NON-NLS-1$
}
@@ -416,23 +413,19 @@ public final class SelectionEnabler {
}
// Get enablement block.
- IConfigurationElement[] children = config
- .getChildren(IWorkbenchRegistryConstants.TAG_ENABLEMENT);
+ IConfigurationElement[] children = config.getChildren(IWorkbenchRegistryConstants.TAG_ENABLEMENT);
if (children.length > 0) {
enablementExpression = new ActionExpression(children[0]);
return;
}
// Get selection block.
- children = config
- .getChildren(IWorkbenchRegistryConstants.TAG_SELECTION);
+ children = config.getChildren(IWorkbenchRegistryConstants.TAG_SELECTION);
if (children.length > 0) {
classes = new ArrayList();
for (IConfigurationElement sel : children) {
- String cname = sel
- .getAttribute(IWorkbenchRegistryConstants.ATT_CLASS);
- String name = sel
- .getAttribute(IWorkbenchRegistryConstants.ATT_NAME);
+ String cname = sel.getAttribute(IWorkbenchRegistryConstants.ATT_CLASS);
+ String name = sel.getAttribute(IWorkbenchRegistryConstants.ATT_NAME);
SelectionClass sclass = new SelectionClass();
sclass.className = cname;
sclass.nameFilter = name;
@@ -442,9 +435,9 @@ public final class SelectionEnabler {
}
/**
- * Verifies if the element is an instance of a class with a given class
- * name. If direct match fails, implementing interfaces will be tested, then
- * recursively all superclasses and their interfaces.
+ * Verifies if the element is an instance of a class with a given class name. If
+ * direct match fails, implementing interfaces will be tested, then recursively
+ * all superclasses and their interfaces.
*/
private boolean verifyClass(Object element, String className) {
Class eclass = element.getClass();
@@ -475,8 +468,7 @@ public final class SelectionEnabler {
/**
* Verifies if the given element matches one of the selection requirements.
- * Element must at least pass the type test, and optionally wildcard name
- * match.
+ * Element must at least pass the type test, and optionally wildcard name match.
*/
private boolean verifyElement(IAdaptable element) {
if (classes.isEmpty()) {
@@ -491,8 +483,7 @@ public final class SelectionEnabler {
return true;
}
IWorkbenchAdapter de = Adapters.adapt(element, IWorkbenchAdapter.class);
- if ((de != null)
- && verifyNameMatch(de.getLabel(element), sc.nameFilter)) {
+ if ((de != null) && verifyNameMatch(de.getLabel(element), sc.nameFilter)) {
return true;
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/SubActionBars.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/SubActionBars.java
index 451160a44a8..8fe644d8a1c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/SubActionBars.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/SubActionBars.java
@@ -52,9 +52,9 @@ public class SubActionBars extends EventManager implements IActionBars {
/**
* The expression to use when contributing handlers through
- * {@link #setGlobalActionHandler(String, IAction)}}. This ensures that
- * handlers contributed through {@link SubActionBars} are given priority
- * over handlers contributed to the {@link IHandlerService}.
+ * {@link #setGlobalActionHandler(String, IAction)}}. This ensures that handlers
+ * contributed through {@link SubActionBars} are given priority over handlers
+ * contributed to the {@link IHandlerService}.
*/
private static final Expression EXPRESSION = new Expression() {
@Override
@@ -64,8 +64,7 @@ public class SubActionBars extends EventManager implements IActionBars {
@Override
public final void collectExpressionInfo(final ExpressionInfo info) {
- info
- .addVariableNameAccess(SourcePriorityNameMapping.LEGACY_LEGACY_NAME);
+ info.addVariableNameAccess(SourcePriorityNameMapping.LEGACY_LEGACY_NAME);
}
};
@@ -79,9 +78,9 @@ public class SubActionBars extends EventManager implements IActionBars {
private boolean actionHandlersChanged;
/**
- * A map of handler activations ({@link IHandlerActivation} indexed by
- * action id ({@link String}) indexed by service locator ({@link IServiceLocator}).
- * This value is <code>null</code> if there are no activations.
+ * A map of handler activations ({@link IHandlerActivation} indexed by action id
+ * ({@link String}) indexed by service locator ({@link IServiceLocator}). This
+ * value is <code>null</code> if there are no activations.
*/
private Map activationsByActionIdByServiceLocator;
@@ -93,8 +92,7 @@ public class SubActionBars extends EventManager implements IActionBars {
/**
* A service locator appropriate for this action bar. This value is never
- * <code>null</code>. It must be capable of providing a
- * {@link IHandlerService}.
+ * <code>null</code>. It must be capable of providing a {@link IHandlerService}.
*/
private IServiceLocator serviceLocator;
@@ -105,11 +103,10 @@ public class SubActionBars extends EventManager implements IActionBars {
private Map actionIdByCommandId = new HashMap();
/**
- * Construct a new <code>SubActionBars</code> object. The service locator
- * will simply be the service locator of the parent.
+ * Construct a new <code>SubActionBars</code> object. The service locator will
+ * simply be the service locator of the parent.
*
- * @param parent
- * The parent of this action bar; must not be <code>null</code>.
+ * @param parent The parent of this action bar; must not be <code>null</code>.
*/
public SubActionBars(final IActionBars parent) {
this(parent, null);
@@ -118,16 +115,14 @@ public class SubActionBars extends EventManager implements IActionBars {
/**
* Constructs a new instance of <code>SubActionBars</code>.
*
- * @param parent
- * The parent of this action bar; must not be <code>null</code>.
- * @param serviceLocator
- * The service locator for this action bar; should not be
- * <code>null</code>.
+ * @param parent The parent of this action bar; must not be
+ * <code>null</code>.
+ * @param serviceLocator The service locator for this action bar; should not be
+ * <code>null</code>.
*
* @since 3.2
*/
- public SubActionBars(final IActionBars parent,
- final IServiceLocator serviceLocator) {
+ public SubActionBars(final IActionBars parent, final IServiceLocator serviceLocator) {
if (parent == null) {
throw new NullPointerException("The parent cannot be null"); //$NON-NLS-1$
}
@@ -146,10 +141,9 @@ public class SubActionBars extends EventManager implements IActionBars {
/**
* Activate the contributions.
* <p>
- * Workaround for toolbar layout flashing when editors contribute large
- * amounts of items. In this case we want to force the items to be
- * visible/hidden only when required, otherwise just change the enablement
- * state.
+ * Workaround for toolbar layout flashing when editors contribute large amounts
+ * of items. In this case we want to force the items to be visible/hidden only
+ * when required, otherwise just change the enablement state.
* </p>
*/
public void activate(boolean forceVisibility) {
@@ -157,11 +151,10 @@ public class SubActionBars extends EventManager implements IActionBars {
}
/**
- * Adds a property change listener. Has no effect if an identical listener
- * is already registered.
+ * Adds a property change listener. Has no effect if an identical listener is
+ * already registered.
*
- * @param listener
- * a property change listener
+ * @param listener a property change listener
*/
public void addPropertyChangeListener(IPropertyChangeListener listener) {
addListenerObject(listener);
@@ -187,14 +180,11 @@ public class SubActionBars extends EventManager implements IActionBars {
if (activationsByActionIdByServiceLocator != null) {
// Clean up the activations.
- final Iterator activationItr = activationsByActionIdByServiceLocator
- .entrySet().iterator();
+ final Iterator activationItr = activationsByActionIdByServiceLocator.entrySet().iterator();
while (activationItr.hasNext()) {
final Map.Entry value = (Map.Entry) activationItr.next();
- final IServiceLocator locator = (IServiceLocator) value
- .getKey();
- final IHandlerService service = locator
- .getService(IHandlerService.class);
+ final IServiceLocator locator = (IServiceLocator) value.getKey();
+ final IHandlerService service = locator.getService(IHandlerService.class);
final Map activationsByActionId = (Map) value.getValue();
Collection activations = activationsByActionId.values();
if (service != null) {
@@ -212,8 +202,7 @@ public class SubActionBars extends EventManager implements IActionBars {
/**
* Returns a new sub menu manager.
*
- * @param parent
- * the parent menu manager
+ * @param parent the parent menu manager
* @return the menu manager
*/
protected SubMenuManager createSubMenuManager(IMenuManager parent) {
@@ -223,8 +212,7 @@ public class SubActionBars extends EventManager implements IActionBars {
/**
* Returns a new sub toolbar manager.
*
- * @param parent
- * the parent toolbar manager
+ * @param parent the parent toolbar manager
* @return the tool bar manager
*/
protected SubToolBarManager createSubToolBarManager(IToolBarManager parent) {
@@ -277,8 +265,7 @@ public class SubActionBars extends EventManager implements IActionBars {
protected void fireActionHandlersChanged() {
if (actionHandlersChanged) {
// Doesn't actually pass the old and new values
- firePropertyChange(new PropertyChangeEvent(this, P_ACTION_HANDLERS,
- null, null));
+ firePropertyChange(new PropertyChangeEvent(this, P_ACTION_HANDLERS, null, null));
actionHandlersChanged = false;
}
}
@@ -287,8 +274,7 @@ public class SubActionBars extends EventManager implements IActionBars {
* Notifies any property change listeners that a property has changed. Only
* listeners registered at the time this method is called are notified.
*
- * @param event
- * the property change event
+ * @param event the property change event
*
* @see IPropertyChangeListener#propertyChange
*/
@@ -309,8 +295,7 @@ public class SubActionBars extends EventManager implements IActionBars {
/**
* Get the handler for a window action.
*
- * @param actionID
- * an action ID declared in the registry
+ * @param actionID an action ID declared in the registry
* @return an action handler which implements the action ID, or
* <code>null</code> if none is registered.
*/
@@ -323,8 +308,8 @@ public class SubActionBars extends EventManager implements IActionBars {
}
/**
- * Returns the complete list of active global action handlers. If there are
- * no global action handlers registered return null.
+ * Returns the complete list of active global action handlers. If there are no
+ * global action handlers registered return null.
*/
public Map getGlobalActionHandlers() {
return actionHandlers;
@@ -355,8 +340,8 @@ public class SubActionBars extends EventManager implements IActionBars {
/**
* Answer the service locator for this action bar.
*
- * @return an <code>IServiceLocater</code> or the parents if
- * the receiver does not have one
+ * @return an <code>IServiceLocater</code> or the parents if the receiver does
+ * not have one
*
* @since 3.2
*/
@@ -378,16 +363,15 @@ public class SubActionBars extends EventManager implements IActionBars {
@Override
public IStatusLineManager getStatusLineManager() {
if (statusLineMgr == null) {
- statusLineMgr = new SubStatusLineManager(parent
- .getStatusLineManager());
+ statusLineMgr = new SubStatusLineManager(parent.getStatusLineManager());
statusLineMgr.setVisible(active);
}
return statusLineMgr;
}
/**
- * Returns the tool bar manager. If items are added or removed from the
- * manager be sure to call <code>updateActionBars</code>.
+ * Returns the tool bar manager. If items are added or removed from the manager
+ * be sure to call <code>updateActionBars</code>.
*
* @return the tool bar manager
*/
@@ -431,8 +415,7 @@ public class SubActionBars extends EventManager implements IActionBars {
* Removes the given property change listener. Has no effect if an identical
* listener is not registered.
*
- * @param listener
- * a property change listener
+ * @param listener a property change listener
*/
public void removePropertyChangeListener(IPropertyChangeListener listener) {
removeListenerObject(listener);
@@ -459,30 +442,26 @@ public class SubActionBars extends EventManager implements IActionBars {
/**
* Add a handler for a window action.
*
- * @param actionID
- * an action ID declared in the registry
- * @param handler
- * an action which implements the action ID. <code>null</code>
- * may be passed to deregister a handler.
+ * @param actionID an action ID declared in the registry
+ * @param handler an action which implements the action ID. <code>null</code>
+ * may be passed to deregister a handler.
*/
@Override
public void setGlobalActionHandler(String actionID, IAction handler) {
if (actionID == null) {
/*
- * Bug 124061. It used to be invalid to pass null as an action id,
- * but some people still did it. Handle this case by trapping the
- * exception and logging it.
+ * Bug 124061. It used to be invalid to pass null as an action id, but some
+ * people still did it. Handle this case by trapping the exception and logging
+ * it.
*/
- WorkbenchPlugin
- .log("Cannot set the global action handler for a null action id"); //$NON-NLS-1$
+ WorkbenchPlugin.log("Cannot set the global action handler for a null action id"); //$NON-NLS-1$
return;
}
if (handler instanceof CommandLegacyActionWrapper) {
- // this is a registration of a fake action for an already
+ // this is a registration of a fake action for an already
// registered handler
- WorkbenchPlugin
- .log("Cannot feed a CommandLegacyActionWrapper back into the system"); //$NON-NLS-1$
+ WorkbenchPlugin.log("Cannot feed a CommandLegacyActionWrapper back into the system"); //$NON-NLS-1$
return;
}
@@ -512,24 +491,19 @@ public class SubActionBars extends EventManager implements IActionBars {
}
// Update the handler activations.
- final IHandlerService service = serviceLocator
- .getService(IHandlerService.class);
+ final IHandlerService service = serviceLocator.getService(IHandlerService.class);
Map activationsByActionId = null;
if (activationsByActionIdByServiceLocator == null) {
activationsByActionIdByServiceLocator = new WeakHashMap();
activationsByActionId = new HashMap();
- activationsByActionIdByServiceLocator.put(serviceLocator,
- activationsByActionId);
+ activationsByActionIdByServiceLocator.put(serviceLocator, activationsByActionId);
} else {
- activationsByActionId = (Map) activationsByActionIdByServiceLocator
- .get(serviceLocator);
+ activationsByActionId = (Map) activationsByActionIdByServiceLocator.get(serviceLocator);
if (activationsByActionId == null) {
activationsByActionId = new HashMap();
- activationsByActionIdByServiceLocator.put(
- serviceLocator, activationsByActionId);
+ activationsByActionIdByServiceLocator.put(serviceLocator, activationsByActionId);
} else if (activationsByActionId.containsKey(actionID)) {
- final Object value = activationsByActionId
- .remove(actionID);
+ final Object value = activationsByActionId.remove(actionID);
if (value instanceof IHandlerActivation) {
final IHandlerActivation activation = (IHandlerActivation) value;
actionIdByCommandId.remove(activation.getCommandId());
@@ -538,10 +512,8 @@ public class SubActionBars extends EventManager implements IActionBars {
}
activation.getHandler().dispose();
}
- } else if (commandId != null
- && actionIdByCommandId.containsKey(commandId)) {
- final Object value = activationsByActionId
- .remove(actionIdByCommandId.remove(commandId));
+ } else if (commandId != null && actionIdByCommandId.containsKey(commandId)) {
+ final Object value = activationsByActionId.remove(actionIdByCommandId.remove(commandId));
if (value instanceof IHandlerActivation) {
final IHandlerActivation activation = (IHandlerActivation) value;
if (service != null) {
@@ -559,14 +531,13 @@ public class SubActionBars extends EventManager implements IActionBars {
// priority.
final IHandler actionHandler = new ActionHandler(handler);
Expression handlerExpression = EXPRESSION;
- //XXX add new API in next release to avoid down-casting (bug 137091)
+ // XXX add new API in next release to avoid down-casting (bug 137091)
if (this instanceof EditorActionBars) {
- handlerExpression = ((EditorActionBars)this).getHandlerExpression();
+ handlerExpression = ((EditorActionBars) this).getHandlerExpression();
}
if (service != null) {
- final IHandlerActivation activation = service
- .activateHandler(commandId, actionHandler,
- handlerExpression);
+ final IHandlerActivation activation = service.activateHandler(commandId, actionHandler,
+ handlerExpression);
activationsByActionId.put(actionID, activation);
}
}
@@ -579,15 +550,11 @@ public class SubActionBars extends EventManager implements IActionBars {
// Remove the handler activation.
if (serviceLocator != null) {
- final IHandlerService service = serviceLocator
- .getService(IHandlerService.class);
+ final IHandlerService service = serviceLocator.getService(IHandlerService.class);
if (activationsByActionIdByServiceLocator != null) {
- final Map activationsByActionId = (Map) activationsByActionIdByServiceLocator
- .get(serviceLocator);
- if ((activationsByActionId != null)
- && (activationsByActionId.containsKey(actionID))) {
- final Object value = activationsByActionId
- .remove(actionID);
+ final Map activationsByActionId = (Map) activationsByActionIdByServiceLocator.get(serviceLocator);
+ if ((activationsByActionId != null) && (activationsByActionId.containsKey(actionID))) {
+ final Object value = activationsByActionId.remove(actionID);
if (value instanceof IHandlerActivation) {
final IHandlerActivation activation = (IHandlerActivation) value;
actionIdByCommandId.remove(activation.getCommandId());
@@ -604,8 +571,7 @@ public class SubActionBars extends EventManager implements IActionBars {
/**
* Sets the service locator for this action bar.
*
- * @param locator
- * The new locator; must not be <code>null</code>.
+ * @param locator The new locator; must not be <code>null</code>.
*
* @since 3.2
*/
@@ -617,8 +583,8 @@ public class SubActionBars extends EventManager implements IActionBars {
}
/**
- * Commits all UI changes. This should be called after additions or
- * subtractions have been made to a menu, status line, or toolbar.
+ * Commits all UI changes. This should be called after additions or subtractions
+ * have been made to a menu, status line, or toolbar.
*/
@Override
public void updateActionBars() {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/SubActionBars2.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/SubActionBars2.java
index 6cf3ffb3e34..18821011b9a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/SubActionBars2.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/SubActionBars2.java
@@ -30,8 +30,7 @@ public class SubActionBars2 extends SubActionBars implements IActionBars2 {
/**
* Constucts a sub action bars object using an IActionBars2 parent.
*
- * @param parent
- * the action bars to virtualize; must not be <code>null</code>.
+ * @param parent the action bars to virtualize; must not be <code>null</code>.
*/
public SubActionBars2(final IActionBars2 parent) {
this(parent, parent.getServiceLocator());
@@ -40,22 +39,20 @@ public class SubActionBars2 extends SubActionBars implements IActionBars2 {
/**
* Constucts a sub action bars object using an IActionBars2 parent.
*
- * @param parent
- * the action bars to virtualize; must not be <code>null</code>.
- * @param serviceLocator
- * The service locator for this action bar; must not be
- * <code>null</code>.
+ * @param parent the action bars to virtualize; must not be
+ * <code>null</code>.
+ * @param serviceLocator The service locator for this action bar; must not be
+ * <code>null</code>.
*
* @since 3.2
*/
- public SubActionBars2(final IActionBars2 parent,
- final IServiceLocator serviceLocator) {
+ public SubActionBars2(final IActionBars2 parent, final IServiceLocator serviceLocator) {
super(parent, serviceLocator);
}
/**
- * Returns the casted parent of the sub action bars. This method can return
- * an IActionBars2 since it can only accept IActionBars2 in the constructor.
+ * Returns the casted parent of the sub action bars. This method can return an
+ * IActionBars2 since it can only accept IActionBars2 in the constructor.
*
* @return the casted parent.
*/
@@ -66,8 +63,7 @@ public class SubActionBars2 extends SubActionBars implements IActionBars2 {
/**
* Returns a new sub coolbar manager.
*
- * @param parent
- * the parent coolbar manager
+ * @param parent the parent coolbar manager
* @return the cool bar manager
*/
protected SubCoolBarManager createSubCoolBarManager(ICoolBarManager parent) {
@@ -77,8 +73,7 @@ public class SubActionBars2 extends SubActionBars implements IActionBars2 {
@Override
public ICoolBarManager getCoolBarManager() {
if (coolBarMgr == null) {
- coolBarMgr = createSubCoolBarManager(getCastedParent()
- .getCoolBarManager());
+ coolBarMgr = createSubCoolBarManager(getCastedParent().getCoolBarManager());
coolBarMgr.setVisible(getActive());
}
return coolBarMgr;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/WorkbenchEncoding.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/WorkbenchEncoding.java
index b60475c787e..a2317d3a897 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/WorkbenchEncoding.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/WorkbenchEncoding.java
@@ -40,6 +40,7 @@ public class WorkbenchEncoding {
/**
* Create a new instance of the receiver.
+ *
* @param definedEncodings
*/
public EncodingsRegistryReader(List<String> definedEncodings) {
@@ -79,7 +80,7 @@ public class WorkbenchEncoding {
reader.readRegistry(Platform.getExtensionRegistry(), PlatformUI.PLUGIN_ID,
IWorkbenchRegistryConstants.PL_ENCODINGS);
- //Make it an array in case of concurrency issues with Iterators
+ // Make it an array in case of concurrency issues with Iterators
String[] encodings = new String[definedEncodings.size()];
List<String> invalid = new ArrayList<>();
definedEncodings.toArray(encodings);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/WorkbenchException.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/WorkbenchException.java
index 3a9f86e5ae9..abbf8e19e96 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/WorkbenchException.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/WorkbenchException.java
@@ -23,43 +23,44 @@ import org.eclipse.core.runtime.Status;
* <p>
* This exception class is not intended to be subclassed by clients.
* </p>
+ *
* @noextend This class is not intended to be subclassed by clients.
*/
public class WorkbenchException extends CoreException {
- /**
- * Generated serial version UID for this class.
- * @since 3.1
- */
- private static final long serialVersionUID = 3258125864872129078L;
+ /**
+ * Generated serial version UID for this class.
+ *
+ * @since 3.1
+ */
+ private static final long serialVersionUID = 3258125864872129078L;
- /**
- * Creates a new exception with the given message.
- *
- * @param message the message
- */
- public WorkbenchException(String message) {
- this(new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0, message, null));
- }
+ /**
+ * Creates a new exception with the given message.
+ *
+ * @param message the message
+ */
+ public WorkbenchException(String message) {
+ this(new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0, message, null));
+ }
- /**
- * Creates a new exception with the given message.
- *
- * @param message the message
- * @param nestedException an exception to be wrapped by this WorkbenchException
- */
- public WorkbenchException(String message, Throwable nestedException) {
- this(new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0, message,
- nestedException));
- }
+ /**
+ * Creates a new exception with the given message.
+ *
+ * @param message the message
+ * @param nestedException an exception to be wrapped by this WorkbenchException
+ */
+ public WorkbenchException(String message, Throwable nestedException) {
+ this(new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0, message, nestedException));
+ }
- /**
- * Creates a new exception with the given status object. The message
- * of the given status is used as the exception message.
- *
- * @param status the status object to be associated with this exception
- */
- public WorkbenchException(IStatus status) {
- super(status);
- }
+ /**
+ * Creates a new exception with the given status object. The message of the
+ * given status is used as the exception message.
+ *
+ * @param status the status object to be associated with this exception
+ */
+ public WorkbenchException(IStatus status) {
+ super(status);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/XMLMemento.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/XMLMemento.java
index d7b68a0cddb..e624e3b547b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/XMLMemento.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/XMLMemento.java
@@ -37,10 +37,9 @@ import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
-
/**
- * This class represents the default implementation of the
- * <code>IMemento</code> interface.
+ * This class represents the default implementation of the <code>IMemento</code>
+ * interface.
* <p>
* This class is not intended to be extended by clients.
* </p>
@@ -48,49 +47,47 @@ import org.xml.sax.SAXParseException;
* @see IMemento
*/
public final class XMLMemento implements IMemento {
- private Document factory;
-
- private Element element;
-
- /**
- * Creates a <code>Document</code> from the <code>Reader</code>
- * and returns a memento on the first <code>Element</code> for reading
- * the document.
- * <p>
- * Same as calling createReadRoot(reader, null)
- * </p>
- *
- * @param reader the <code>Reader</code> used to create the memento's document
- * @return a memento on the first <code>Element</code> for reading the document
- * @throws WorkbenchException if IO problems, invalid format, or no element.
- */
+ private Document factory;
+
+ private Element element;
+
+ /**
+ * Creates a <code>Document</code> from the <code>Reader</code> and returns a
+ * memento on the first <code>Element</code> for reading the document.
+ * <p>
+ * Same as calling createReadRoot(reader, null)
+ * </p>
+ *
+ * @param reader the <code>Reader</code> used to create the memento's document
+ * @return a memento on the first <code>Element</code> for reading the document
+ * @throws WorkbenchException if IO problems, invalid format, or no element.
+ */
public static XMLMemento createReadRoot(Reader reader) throws WorkbenchException {
- return createReadRoot(reader, null);
- }
-
- /**
- * Creates a <code>Document</code> from the <code>Reader</code>
- * and returns a memento on the first <code>Element</code> for reading
- * the document.
- *
- * @param reader the <code>Reader</code> used to create the memento's document
- * @param baseDir the directory used to resolve relative file names
- * in the XML document. This directory must exist and include the
- * trailing separator. The directory format, including the separators,
- * must be valid for the platform. Can be <code>null</code> if not
- * needed.
- * @return a memento on the first <code>Element</code> for reading the document
- * @throws WorkbenchException if IO problems, invalid format, or no element.
- */
+ return createReadRoot(reader, null);
+ }
+
+ /**
+ * Creates a <code>Document</code> from the <code>Reader</code> and returns a
+ * memento on the first <code>Element</code> for reading the document.
+ *
+ * @param reader the <code>Reader</code> used to create the memento's document
+ * @param baseDir the directory used to resolve relative file names in the XML
+ * document. This directory must exist and include the trailing
+ * separator. The directory format, including the separators,
+ * must be valid for the platform. Can be <code>null</code> if
+ * not needed.
+ * @return a memento on the first <code>Element</code> for reading the document
+ * @throws WorkbenchException if IO problems, invalid format, or no element.
+ */
public static XMLMemento createReadRoot(Reader reader, String baseDir) throws WorkbenchException {
- String errorMessage = null;
- Exception exception = null;
+ String errorMessage = null;
+ Exception exception = null;
- try {
+ try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- DocumentBuilder parser = factory.newDocumentBuilder();
- InputSource source = new InputSource(reader);
- if (baseDir != null) {
+ DocumentBuilder parser = factory.newDocumentBuilder();
+ InputSource source = new InputSource(reader);
+ if (baseDir != null) {
source.setSystemId(baseDir);
}
@@ -117,162 +114,152 @@ public final class XMLMemento implements IMemento {
}
});
- Document document = parser.parse(source);
- NodeList list = document.getChildNodes();
- for (int i = 0; i < list.getLength(); i++) {
- Node node = list.item(i);
- if (node instanceof Element) {
+ Document document = parser.parse(source);
+ NodeList list = document.getChildNodes();
+ for (int i = 0; i < list.getLength(); i++) {
+ Node node = list.item(i);
+ if (node instanceof Element) {
return new XMLMemento(document, (Element) node);
}
- }
- } catch (ParserConfigurationException e) {
- exception = e;
- errorMessage = WorkbenchMessages.XMLMemento_parserConfigError;
- } catch (IOException e) {
- exception = e;
- errorMessage = WorkbenchMessages.XMLMemento_ioError;
- } catch (SAXException e) {
- exception = e;
- errorMessage = WorkbenchMessages.XMLMemento_formatError;
- }
-
- String problemText = null;
- if (exception != null) {
+ }
+ } catch (ParserConfigurationException e) {
+ exception = e;
+ errorMessage = WorkbenchMessages.XMLMemento_parserConfigError;
+ } catch (IOException e) {
+ exception = e;
+ errorMessage = WorkbenchMessages.XMLMemento_ioError;
+ } catch (SAXException e) {
+ exception = e;
+ errorMessage = WorkbenchMessages.XMLMemento_formatError;
+ }
+
+ String problemText = null;
+ if (exception != null) {
problemText = exception.getMessage();
}
- if (problemText == null || problemText.length() == 0) {
- problemText = errorMessage != null ? errorMessage
- : WorkbenchMessages.XMLMemento_noElement;
+ if (problemText == null || problemText.length() == 0) {
+ problemText = errorMessage != null ? errorMessage : WorkbenchMessages.XMLMemento_noElement;
}
- throw new WorkbenchException(problemText, exception);
- }
+ throw new WorkbenchException(problemText, exception);
+ }
- /**
+ /**
* Returns a root memento for writing a document.
*
- * @param type
- * the element node type to create on the document
+ * @param type the element node type to create on the document
* @return the root memento for writing a document
* @throws DOMException
*/
public static XMLMemento createWriteRoot(String type) throws DOMException {
- Document document;
- try {
- document = DocumentBuilderFactory.newInstance()
- .newDocumentBuilder().newDocument();
- Element element = document.createElement(type);
- document.appendChild(element);
- return new XMLMemento(document, element);
- } catch (ParserConfigurationException e) {
+ Document document;
+ try {
+ document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
+ Element element = document.createElement(type);
+ document.appendChild(element);
+ return new XMLMemento(document, element);
+ } catch (ParserConfigurationException e) {
// throw new Error(e);
- throw new Error(e.getMessage());
- }
- }
-
- /**
- * Creates a memento for the specified document and element.
- * <p>
- * Clients should use <code>createReadRoot</code> and
- * <code>createWriteRoot</code> to create the initial
- * memento on a document.
- * </p>
- *
- * @param document the document for the memento
- * @param element the element node for the memento
- */
- public XMLMemento(Document document, Element element) {
- super();
- this.factory = document;
- this.element = element;
- }
+ throw new Error(e.getMessage());
+ }
+ }
+
+ /**
+ * Creates a memento for the specified document and element.
+ * <p>
+ * Clients should use <code>createReadRoot</code> and
+ * <code>createWriteRoot</code> to create the initial memento on a document.
+ * </p>
+ *
+ * @param document the document for the memento
+ * @param element the element node for the memento
+ */
+ public XMLMemento(Document document, Element element) {
+ super();
+ this.factory = document;
+ this.element = element;
+ }
/**
* Creates a new child of this memento with the given type.
* <p>
- * The <code>getChild</code> and <code>getChildren</code> methods are used
- * to retrieve children of a given type.
+ * The <code>getChild</code> and <code>getChildren</code> methods are used to
+ * retrieve children of a given type.
* </p>
*
- * @param type
- * the type
+ * @param type the type
* @return a new child memento
* @see #getChild
* @see #getChildren
- * @throws DOMException
- * if the child cannot be created
+ * @throws DOMException if the child cannot be created
*/
@Override
public IMemento createChild(String type) throws DOMException {
- Element child = factory.createElement(type);
- element.appendChild(child);
- return new XMLMemento(factory, child);
- }
+ Element child = factory.createElement(type);
+ element.appendChild(child);
+ return new XMLMemento(factory, child);
+ }
/**
* Creates a new child of this memento with the given type and id. The id is
* stored in the child memento (using a special reserved key,
* <code>TAG_ID</code>) and can be retrieved using <code>getId</code>.
* <p>
- * The <code>getChild</code> and <code>getChildren</code> methods are used
- * to retrieve children of a given type.
+ * The <code>getChild</code> and <code>getChildren</code> methods are used to
+ * retrieve children of a given type.
* </p>
*
- * @param type
- * the type
- * @param id
- * the child id
+ * @param type the type
+ * @param id the child id
* @return a new child memento with the given type and id
* @see #getID
- * @throws DOMException
- * if the child cannot be created
+ * @throws DOMException if the child cannot be created
*/
@Override
public IMemento createChild(String type, String id) throws DOMException {
- Element child = factory.createElement(type);
- child.setAttribute(TAG_ID, id == null ? "" : id); //$NON-NLS-1$
- element.appendChild(child);
- return new XMLMemento(factory, child);
- }
+ Element child = factory.createElement(type);
+ child.setAttribute(TAG_ID, id == null ? "" : id); //$NON-NLS-1$
+ element.appendChild(child);
+ return new XMLMemento(factory, child);
+ }
/**
* Create a copy of the child node and append it to this node.
*
* @param child
* @return An IMenento for the new child node.
- * @throws DOMException
- * if the child cannot be created
+ * @throws DOMException if the child cannot be created
*/
public IMemento copyChild(IMemento child) throws DOMException {
- Element childElement = ((XMLMemento) child).element;
- Element newElement = (Element) factory.importNode(childElement, true);
- element.appendChild(newElement);
- return new XMLMemento(factory, newElement);
- }
+ Element childElement = ((XMLMemento) child).element;
+ Element newElement = (Element) factory.importNode(childElement, true);
+ element.appendChild(newElement);
+ return new XMLMemento(factory, newElement);
+ }
- @Override
+ @Override
public IMemento getChild(String type) {
- // Get the nodes.
- NodeList nodes = element.getChildNodes();
- int size = nodes.getLength();
- if (size == 0) {
+ // Get the nodes.
+ NodeList nodes = element.getChildNodes();
+ int size = nodes.getLength();
+ if (size == 0) {
return null;
}
- // Find the first node which is a child of this node.
- for (int nX = 0; nX < size; nX++) {
- Node node = nodes.item(nX);
- if (node instanceof Element) {
- Element element = (Element) node;
- if (element.getNodeName().equals(type)) {
+ // Find the first node which is a child of this node.
+ for (int nX = 0; nX < size; nX++) {
+ Node node = nodes.item(nX);
+ if (node instanceof Element) {
+ Element element = (Element) node;
+ if (element.getNodeName().equals(type)) {
return new XMLMemento(factory, element);
}
- }
- }
+ }
+ }
- // A child was not found.
- return null;
- }
+ // A child was not found.
+ return null;
+ }
@Override
public IMemento[] getChildren() {
@@ -301,52 +288,52 @@ public final class XMLMemento implements IMemento {
return results;
}
- @Override
+ @Override
public IMemento[] getChildren(String type) {
- // Get the nodes.
- NodeList nodes = element.getChildNodes();
- int size = nodes.getLength();
- if (size == 0) {
+ // Get the nodes.
+ NodeList nodes = element.getChildNodes();
+ int size = nodes.getLength();
+ if (size == 0) {
return new IMemento[0];
}
- // Extract each node with given type.
+ // Extract each node with given type.
ArrayList<Element> list = new ArrayList<>(size);
- for (int nX = 0; nX < size; nX++) {
- Node node = nodes.item(nX);
- if (node instanceof Element) {
- Element element = (Element) node;
- if (element.getNodeName().equals(type)) {
+ for (int nX = 0; nX < size; nX++) {
+ Node node = nodes.item(nX);
+ if (node instanceof Element) {
+ Element element = (Element) node;
+ if (element.getNodeName().equals(type)) {
list.add(element);
}
- }
- }
-
- // Create a memento for each node.
- size = list.size();
- IMemento[] results = new IMemento[size];
- for (int x = 0; x < size; x++) {
- results[x] = new XMLMemento(factory, list.get(x));
- }
- return results;
- }
-
- @Override
+ }
+ }
+
+ // Create a memento for each node.
+ size = list.size();
+ IMemento[] results = new IMemento[size];
+ for (int x = 0; x < size; x++) {
+ results[x] = new XMLMemento(factory, list.get(x));
+ }
+ return results;
+ }
+
+ @Override
public Float getFloat(String key) {
- Attr attr = element.getAttributeNode(key);
- if (attr == null) {
+ Attr attr = element.getAttributeNode(key);
+ if (attr == null) {
return null;
}
- String strValue = attr.getValue();
- try {
+ String strValue = attr.getValue();
+ try {
return Float.valueOf(strValue);
- } catch (NumberFormatException e) {
- WorkbenchPlugin.log("Memento problem - Invalid float for key: " //$NON-NLS-1$
- + key + " value: " + strValue, e); //$NON-NLS-1$
- return null;
- }
- }
+ } catch (NumberFormatException e) {
+ WorkbenchPlugin.log("Memento problem - Invalid float for key: " //$NON-NLS-1$
+ + key + " value: " + strValue, e); //$NON-NLS-1$
+ return null;
+ }
+ }
/**
* @since 3.4
@@ -356,67 +343,65 @@ public final class XMLMemento implements IMemento {
return element.getNodeName();
}
- @Override
+ @Override
public String getID() {
- return element.getAttribute(TAG_ID);
- }
+ return element.getAttribute(TAG_ID);
+ }
- @Override
+ @Override
public Integer getInteger(String key) {
- Attr attr = element.getAttributeNode(key);
- if (attr == null) {
+ Attr attr = element.getAttributeNode(key);
+ if (attr == null) {
return null;
}
- String strValue = attr.getValue();
- try {
+ String strValue = attr.getValue();
+ try {
return Integer.valueOf(strValue);
- } catch (NumberFormatException e) {
- WorkbenchPlugin
- .log("Memento problem - invalid integer for key: " + key //$NON-NLS-1$
- + " value: " + strValue, e); //$NON-NLS-1$
- return null;
- }
- }
-
- @Override
+ } catch (NumberFormatException e) {
+ WorkbenchPlugin.log("Memento problem - invalid integer for key: " + key //$NON-NLS-1$
+ + " value: " + strValue, e); //$NON-NLS-1$
+ return null;
+ }
+ }
+
+ @Override
public String getString(String key) {
- Attr attr = element.getAttributeNode(key);
- if (attr == null) {
+ Attr attr = element.getAttributeNode(key);
+ if (attr == null) {
return null;
}
- return attr.getValue();
- }
+ return attr.getValue();
+ }
/**
* @since 3.4
*/
@Override
public Boolean getBoolean(String key) {
- Attr attr = element.getAttributeNode(key);
- if (attr == null) {
+ Attr attr = element.getAttributeNode(key);
+ if (attr == null) {
return null;
}
- return Boolean.valueOf(attr.getValue());
+ return Boolean.valueOf(attr.getValue());
}
/**
* Returns the data of the Text node of the memento. Each memento is allowed
* only one Text node.
*
- * @return the data of the Text node of the memento, or <code>null</code> if
- * the memento has no Text node.
+ * @return the data of the Text node of the memento, or <code>null</code> if the
+ * memento has no Text node.
* @since 2.0
- * @throws DOMException
- * if the text node is too big
+ * @throws DOMException if the text node is too big
*/
@Override
public String getTextData() throws DOMException {
- Text textNode = getTextNode();
- if (textNode != null) {
- return textNode.getData();
- }
- return null;
- }
+ Text textNode = getTextNode();
+ if (textNode != null) {
+ return textNode.getData();
+ }
+ return null;
+ }
/**
* @since 3.4
@@ -433,137 +418,123 @@ public final class XMLMemento implements IMemento {
return attributes;
}
- /**
- * Returns the Text node of the memento. Each memento is allowed only
- * one Text node.
- *
- * @return the Text node of the memento, or <code>null</code> if
- * the memento has no Text node.
- */
- private Text getTextNode() {
- // Get the nodes.
- NodeList nodes = element.getChildNodes();
- int size = nodes.getLength();
- if (size == 0) {
+ /**
+ * Returns the Text node of the memento. Each memento is allowed only one Text
+ * node.
+ *
+ * @return the Text node of the memento, or <code>null</code> if the memento has
+ * no Text node.
+ */
+ private Text getTextNode() {
+ // Get the nodes.
+ NodeList nodes = element.getChildNodes();
+ int size = nodes.getLength();
+ if (size == 0) {
return null;
}
- for (int nX = 0; nX < size; nX++) {
- Node node = nodes.item(nX);
- if (node instanceof Text) {
- return (Text) node;
- }
- }
- // a Text node was not found
- return null;
- }
-
- /**
+ for (int nX = 0; nX < size; nX++) {
+ Node node = nodes.item(nX);
+ if (node instanceof Text) {
+ return (Text) node;
+ }
+ }
+ // a Text node was not found
+ return null;
+ }
+
+ /**
* Places the element's attributes into the document.
*
- * @param copyText
- * true if the first text node should be copied
- * @throws DOMException
- * if the attributes or children cannot be copied to this node.
+ * @param copyText true if the first text node should be copied
+ * @throws DOMException if the attributes or children cannot be copied to this
+ * node.
*/
private void putElement(Element element, boolean copyText) throws DOMException {
- NamedNodeMap nodeMap = element.getAttributes();
- int size = nodeMap.getLength();
- for (int i = 0; i < size; i++) {
- Attr attr = (Attr) nodeMap.item(i);
- putString(attr.getName(), attr.getValue());
- }
-
- NodeList nodes = element.getChildNodes();
- size = nodes.getLength();
- // Copy first text node (fixes bug 113659).
- // Note that text data will be added as the first child (see putTextData)
- boolean needToCopyText = copyText;
- for (int i = 0; i < size; i++) {
- Node node = nodes.item(i);
- if (node instanceof Element) {
- XMLMemento child = (XMLMemento) createChild(node.getNodeName());
- child.putElement((Element) node, true);
- } else if (node instanceof Text && needToCopyText) {
- putTextData(((Text) node).getData());
- needToCopyText = false;
- }
- }
- }
+ NamedNodeMap nodeMap = element.getAttributes();
+ int size = nodeMap.getLength();
+ for (int i = 0; i < size; i++) {
+ Attr attr = (Attr) nodeMap.item(i);
+ putString(attr.getName(), attr.getValue());
+ }
+
+ NodeList nodes = element.getChildNodes();
+ size = nodes.getLength();
+ // Copy first text node (fixes bug 113659).
+ // Note that text data will be added as the first child (see putTextData)
+ boolean needToCopyText = copyText;
+ for (int i = 0; i < size; i++) {
+ Node node = nodes.item(i);
+ if (node instanceof Element) {
+ XMLMemento child = (XMLMemento) createChild(node.getNodeName());
+ child.putElement((Element) node, true);
+ } else if (node instanceof Text && needToCopyText) {
+ putTextData(((Text) node).getData());
+ needToCopyText = false;
+ }
+ }
+ }
/**
* Sets the value of the given key to the given floating point number.
*
- * @param key
- * the key
- * @param f
- * the value
- * @throws DOMException
- * if the attribute cannot be set
+ * @param key the key
+ * @param f the value
+ * @throws DOMException if the attribute cannot be set
*/
@Override
public void putFloat(String key, float f) throws DOMException {
- element.setAttribute(key, String.valueOf(f));
- }
+ element.setAttribute(key, String.valueOf(f));
+ }
/**
* Sets the value of the given key to the given integer.
*
- * @param key
- * the key
- * @param n
- * the value
- * @throws DOMException
- * if the attribute cannot be set
+ * @param key the key
+ * @param n the value
+ * @throws DOMException if the attribute cannot be set
*/
@Override
public void putInteger(String key, int n) throws DOMException {
- element.setAttribute(key, String.valueOf(n));
- }
+ element.setAttribute(key, String.valueOf(n));
+ }
/**
- * Copy the attributes and children from <code>memento</code> to the
- * receiver.
+ * Copy the attributes and children from <code>memento</code> to the receiver.
*
- * @param memento
- * the IMemento to be copied.
- * @throws DOMException
- * if the attributes or children cannot be copied to this node.
+ * @param memento the IMemento to be copied.
+ * @throws DOMException if the attributes or children cannot be copied to this
+ * node.
*/
@Override
public void putMemento(IMemento memento) throws DOMException {
- // Do not copy the element's top level text node (this would overwrite the existing text).
- // Text nodes of children are copied.
- putElement(((XMLMemento) memento).element, false);
- }
+ // Do not copy the element's top level text node (this would overwrite the
+ // existing text).
+ // Text nodes of children are copied.
+ putElement(((XMLMemento) memento).element, false);
+ }
/**
* Sets the value of the given key to the given string.
*
- * @param key
- * the key
- * @param value
- * the value
- * @throws DOMException
- * if the attribute cannot be set
+ * @param key the key
+ * @param value the value
+ * @throws DOMException if the attribute cannot be set
*/
@Override
public void putString(String key, String value) throws DOMException {
- if (value == null) {
+ if (value == null) {
return;
}
- element.setAttribute(key, value);
- }
+ element.setAttribute(key, value);
+ }
/**
* Sets the value of the given key to the given boolean value.
*
- * @param key
- * the key
- * @param value
- * the value
+ * @param key the key
+ * @param value the value
* @since 3.4
- * @throws DOMException
- * if the attribute cannot be set
+ * @throws DOMException if the attribute cannot be set
*/
@Override
public void putBoolean(String key, boolean value) throws DOMException {
@@ -571,42 +542,40 @@ public final class XMLMemento implements IMemento {
}
/**
- * Sets the memento's Text node to contain the given data. Creates the Text
- * node if none exists. If a Text node does exist, it's current contents are
+ * Sets the memento's Text node to contain the given data. Creates the Text node
+ * if none exists. If a Text node does exist, it's current contents are
* replaced. Each memento is allowed only one text node.
*
- * @param data
- * the data to be placed on the Text node
+ * @param data the data to be placed on the Text node
* @since 2.0
- * @throws DOMException
- * if the text node cannot be created under this node.
+ * @throws DOMException if the text node cannot be created under this node.
*/
@Override
public void putTextData(String data) throws DOMException {
- Text textNode = getTextNode();
- if (textNode == null) {
- textNode = factory.createTextNode(data);
+ Text textNode = getTextNode();
+ if (textNode == null) {
+ textNode = factory.createTextNode(data);
// Always add the text node as the first child (fixes bug 93718)
element.insertBefore(textNode, element.getFirstChild());
- } else {
- textNode.setData(data);
- }
- }
-
- /**
- * Saves this memento's document current values to the
- * specified writer.
- *
- * @param writer the writer used to save the memento's document
- * @throws IOException if there is a problem serializing the document to the stream.
- */
- public void save(Writer writer) throws IOException {
- DOMWriter out = new DOMWriter(writer);
- try {
- out.print(element);
- } finally {
- out.close();
- }
+ } else {
+ textNode.setData(data);
+ }
+ }
+
+ /**
+ * Saves this memento's document current values to the specified writer.
+ *
+ * @param writer the writer used to save the memento's document
+ * @throws IOException if there is a problem serializing the document to the
+ * stream.
+ */
+ public void save(Writer writer) throws IOException {
+ DOMWriter out = new DOMWriter(writer);
+ try {
+ out.print(element);
+ } finally {
+ out.close();
+ }
}
@Override
@@ -621,128 +590,127 @@ public final class XMLMemento implements IMemento {
}
/**
- * A simple XML writer. Using this instead of the javax.xml.transform classes allows
- * compilation against JCL Foundation (bug 80053).
- */
- private static final class DOMWriter extends PrintWriter {
-
- /* constants */
- private static final String XML_VERSION = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; //$NON-NLS-1$
-
- /**
- * Creates a new DOM writer on the given output writer.
- *
- * @param output the output writer
- */
- public DOMWriter(Writer output) {
- super(output);
- println(XML_VERSION);
- }
-
- /**
- * Prints the given element.
- *
- * @param element the element to print
- */
- public void print(Element element) {
- // Ensure extra whitespace is not emitted next to a Text node,
- // as that will result in a situation where the restored text data is not the
- // same as the saved text data.
- boolean hasChildren = element.hasChildNodes();
- startTag(element, hasChildren);
- if (hasChildren) {
- boolean prevWasText = false;
- NodeList children = element.getChildNodes();
- for (int i = 0; i < children.getLength(); i++) {
- Node node = children.item(i);
- if (node instanceof Element) {
- if (!prevWasText) {
- println();
- }
- print((Element) children.item(i));
- prevWasText = false;
- }
- else if (node instanceof Text) {
- print(getEscaped(node.getNodeValue()));
- prevWasText = true;
- }
- }
- if (!prevWasText) {
- println();
- }
- endTag(element);
- }
- }
-
- private void startTag(Element element, boolean hasChildren) {
- StringBuilder sb = new StringBuilder();
- sb.append("<"); //$NON-NLS-1$
- sb.append(element.getTagName());
- NamedNodeMap attributes = element.getAttributes();
- for (int i = 0; i < attributes.getLength(); i++) {
- Attr attribute = (Attr)attributes.item(i);
+ * A simple XML writer. Using this instead of the javax.xml.transform classes
+ * allows compilation against JCL Foundation (bug 80053).
+ */
+ private static final class DOMWriter extends PrintWriter {
+
+ /* constants */
+ private static final String XML_VERSION = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; //$NON-NLS-1$
+
+ /**
+ * Creates a new DOM writer on the given output writer.
+ *
+ * @param output the output writer
+ */
+ public DOMWriter(Writer output) {
+ super(output);
+ println(XML_VERSION);
+ }
+
+ /**
+ * Prints the given element.
+ *
+ * @param element the element to print
+ */
+ public void print(Element element) {
+ // Ensure extra whitespace is not emitted next to a Text node,
+ // as that will result in a situation where the restored text data is not the
+ // same as the saved text data.
+ boolean hasChildren = element.hasChildNodes();
+ startTag(element, hasChildren);
+ if (hasChildren) {
+ boolean prevWasText = false;
+ NodeList children = element.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ Node node = children.item(i);
+ if (node instanceof Element) {
+ if (!prevWasText) {
+ println();
+ }
+ print((Element) children.item(i));
+ prevWasText = false;
+ } else if (node instanceof Text) {
+ print(getEscaped(node.getNodeValue()));
+ prevWasText = true;
+ }
+ }
+ if (!prevWasText) {
+ println();
+ }
+ endTag(element);
+ }
+ }
+
+ private void startTag(Element element, boolean hasChildren) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("<"); //$NON-NLS-1$
+ sb.append(element.getTagName());
+ NamedNodeMap attributes = element.getAttributes();
+ for (int i = 0; i < attributes.getLength(); i++) {
+ Attr attribute = (Attr) attributes.item(i);
sb.append(" "); //$NON-NLS-1$
sb.append(attribute.getName());
sb.append("=\""); //$NON-NLS-1$
sb.append(getEscaped(String.valueOf(attribute.getValue())));
sb.append("\""); //$NON-NLS-1$
- }
- sb.append(hasChildren ? ">" : "/>"); //$NON-NLS-1$ //$NON-NLS-2$
- print(sb.toString());
- }
-
- private void endTag(Element element) {
- StringBuilder sb = new StringBuilder();
- sb.append("</"); //$NON-NLS-1$
- sb.append(element.getNodeName());
- sb.append(">"); //$NON-NLS-1$
- print(sb.toString());
- }
-
- private static void appendEscapedChar(StringBuilder buffer, char c) {
- String replacement = getReplacement(c);
- if (replacement != null) {
- buffer.append('&');
- buffer.append(replacement);
- buffer.append(';');
- } else if (c==9 || c==10 || c==13 || c>=32){
- buffer.append(c);
- }
- }
-
- private static String getEscaped(String s) {
- StringBuilder result = new StringBuilder(s.length() + 10);
- for (int i = 0; i < s.length(); ++i) {
+ }
+ sb.append(hasChildren ? ">" : "/>"); //$NON-NLS-1$ //$NON-NLS-2$
+ print(sb.toString());
+ }
+
+ private void endTag(Element element) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("</"); //$NON-NLS-1$
+ sb.append(element.getNodeName());
+ sb.append(">"); //$NON-NLS-1$
+ print(sb.toString());
+ }
+
+ private static void appendEscapedChar(StringBuilder buffer, char c) {
+ String replacement = getReplacement(c);
+ if (replacement != null) {
+ buffer.append('&');
+ buffer.append(replacement);
+ buffer.append(';');
+ } else if (c == 9 || c == 10 || c == 13 || c >= 32) {
+ buffer.append(c);
+ }
+ }
+
+ private static String getEscaped(String s) {
+ StringBuilder result = new StringBuilder(s.length() + 10);
+ for (int i = 0; i < s.length(); ++i) {
appendEscapedChar(result, s.charAt(i));
}
- return result.toString();
- }
+ return result.toString();
+ }
- private static String getReplacement(char c) {
- // Encode special XML characters into the equivalent character references.
+ private static String getReplacement(char c) {
+ // Encode special XML characters into the equivalent character references.
// The first five are defined by default for all XML documents.
// The next three (#xD, #xA, #x9) are encoded to avoid them
// being converted to spaces on deserialization
// (fixes bug 93720)
- switch (c) {
- case '<' :
- return "lt"; //$NON-NLS-1$
- case '>' :
- return "gt"; //$NON-NLS-1$
- case '"' :
- return "quot"; //$NON-NLS-1$
- case '\'' :
- return "apos"; //$NON-NLS-1$
- case '&' :
- return "amp"; //$NON-NLS-1$
- case '\r':
- return "#x0D"; //$NON-NLS-1$
- case '\n':
- return "#x0A"; //$NON-NLS-1$
- case '\u0009':
- return "#x09"; //$NON-NLS-1$
- }
- return null;
- }
- }
+ switch (c) {
+ case '<':
+ return "lt"; //$NON-NLS-1$
+ case '>':
+ return "gt"; //$NON-NLS-1$
+ case '"':
+ return "quot"; //$NON-NLS-1$
+ case '\'':
+ return "apos"; //$NON-NLS-1$
+ case '&':
+ return "amp"; //$NON-NLS-1$
+ case '\r':
+ return "#x0D"; //$NON-NLS-1$
+ case '\n':
+ return "#x0A"; //$NON-NLS-1$
+ case '\u0009':
+ return "#x09"; //$NON-NLS-1$
+ }
+ return null;
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/about/IInstallationPageContainer.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/about/IInstallationPageContainer.java
index b244ed214b2..f6108e148b5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/about/IInstallationPageContainer.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/about/IInstallationPageContainer.java
@@ -30,19 +30,17 @@ public interface IInstallationPageContainer {
* Register a button as belonging to a particular page in the container. The
* container will manage the placement and visibility of the page's buttons.
*
- * @param page
- * the page that created the button
- * @param button
- * the button to be managed
+ * @param page the page that created the button
+ * @param button the button to be managed
*
*/
void registerPageButton(InstallationPage page, Button button);
/**
- * Closes any modal containers that were used to launch this installation
- * page. This method should be used when a page is launching a long-running
- * task (such as a background job) that requires progress indication, in
- * order to allow platform progress indication to behave as expected.
+ * Closes any modal containers that were used to launch this installation page.
+ * This method should be used when a page is launching a long-running task (such
+ * as a background job) that requires progress indication, in order to allow
+ * platform progress indication to behave as expected.
*/
void closeModalContainers();
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/about/ISystemSummarySection.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/about/ISystemSummarySection.java
index ff2e271082c..0a7fc2e97d6 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/about/ISystemSummarySection.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/about/ISystemSummarySection.java
@@ -16,18 +16,19 @@ package org.eclipse.ui.about;
import java.io.PrintWriter;
/**
- * Extensions to <code>org.eclipse.ui.systemSummaryExtensions</code> must provide
- * an implementation of this interface. The class must provide a default
- * constructor. A new instance of the class will be created each time the system
+ * Extensions to <code>org.eclipse.ui.systemSummaryExtensions</code> must
+ * provide an implementation of this interface. The class must provide a default
+ * constructor. A new instance of the class will be created each time the system
* summary is created.
*
* @since 3.0
*/
public interface ISystemSummarySection {
- /**
- * A method that puts the section's information into the system summary's
- * configuration details log.
- * @param writer puts information into the system summary
- */
- void write(PrintWriter writer);
+ /**
+ * A method that puts the section's information into the system summary's
+ * configuration details log.
+ *
+ * @param writer puts information into the system summary
+ */
+ void write(PrintWriter writer);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/about/InstallationPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/about/InstallationPage.java
index 3e937455336..e0e510189bc 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/about/InstallationPage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/about/InstallationPage.java
@@ -51,8 +51,7 @@ public abstract class InstallationPage extends DialogPage {
* IInstallationPageContainer.
* </p>
*
- * @param newMessage
- * the message, or <code>null</code> to clear the message
+ * @param newMessage the message, or <code>null</code> to clear the message
*/
@Override
public void setMessage(String newMessage) {
@@ -60,8 +59,8 @@ public abstract class InstallationPage extends DialogPage {
}
/**
- * Sets the message for this page with an indication of what type of message
- * it is.
+ * Sets the message for this page with an indication of what type of message it
+ * is.
* <p>
* The valid message types are one of <code>NONE</code>,
* <code>INFORMATION</code>,<code>WARNING</code>, or <code>ERROR</code>.
@@ -71,10 +70,8 @@ public abstract class InstallationPage extends DialogPage {
* IInstallationPageContainer.
* </p>
*
- * @param newMessage
- * the message, or <code>null</code> to clear the message
- * @param newType
- * the message type
+ * @param newMessage the message, or <code>null</code> to clear the message
+ * @param newType the message type
*/
@Override
public void setMessage(String newMessage, int newType) {
@@ -82,14 +79,13 @@ public abstract class InstallationPage extends DialogPage {
}
/**
- * Set the page container that is hosting this page. This method is
- * typically called by the container itself so that the pages have access to
- * the container when registering buttons using
+ * Set the page container that is hosting this page. This method is typically
+ * called by the container itself so that the pages have access to the container
+ * when registering buttons using
* {@link IInstallationPageContainer#registerPageButton(InstallationPage, Button)}
* or performing other container-related tasks.
*
- * @param container
- * the container that is hosting the page.
+ * @param container the container that is hosting the page.
*/
public void setPageContainer(IInstallationPageContainer container) {
this.container = container;
@@ -98,8 +94,7 @@ public abstract class InstallationPage extends DialogPage {
/**
* Create the buttons that belong to this page using the specified parent.
*
- * @param parent
- * the parent to use for the buttons.
+ * @param parent the parent to use for the buttons.
*
* @see #createButton(Composite, int, String)
* @see #buttonPressed(int)
@@ -113,17 +108,14 @@ public abstract class InstallationPage extends DialogPage {
* <p>
* This method creates a standard push button, registers it for selection
* events, and registers it as a button belonging to this page. Subclasses
- * should not make any assumptions about the visibility, layout, or
- * presentation of this button inside the dialog.
+ * should not make any assumptions about the visibility, layout, or presentation
+ * of this button inside the dialog.
* </p>
*
- * @param parent
- * the parent composite
- * @param id
- * the id of the button (see <code>IDialogConstants.*_ID</code>
- * constants for standard dialog button ids)
- * @param label
- * the label from the button
+ * @param parent the parent composite
+ * @param id the id of the button (see <code>IDialogConstants.*_ID</code>
+ * constants for standard dialog button ids)
+ * @param label the label from the button
* @return the new button
*
* @see #createPageButtons(Composite)
@@ -133,7 +125,8 @@ public abstract class InstallationPage extends DialogPage {
Button button = new Button(parent, SWT.PUSH);
button.setText(label);
button.setData(Integer.valueOf(id));
- button.addSelectionListener(widgetSelectedAdapter(event -> buttonPressed(((Integer) event.widget.getData()).intValue())));
+ button.addSelectionListener(
+ widgetSelectedAdapter(event -> buttonPressed(((Integer) event.widget.getData()).intValue())));
container.registerPageButton(this, button);
return button;
}
@@ -143,16 +136,15 @@ public abstract class InstallationPage extends DialogPage {
* Subclasses should extend this method to handle the buttons created in
* {@link #createButton(Composite, int, String)}
*
- * @param buttonId
- * the id of the button that was pressed (see
- * <code>IDialogConstants.*_ID</code> constants)
+ * @param buttonId the id of the button that was pressed (see
+ * <code>IDialogConstants.*_ID</code> constants)
*/
protected void buttonPressed(int buttonId) {
}
/**
- * Get the page container that is hosting this page. This method is
- * typically used when registering buttons using
+ * Get the page container that is hosting this page. This method is typically
+ * used when registering buttons using
* {@link IInstallationPageContainer#registerPageButton(InstallationPage, Button)}
* or performing other container-related tasks.
*
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ActionContext.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ActionContext.java
index eec472a2ff0..4881288aa0d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ActionContext.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ActionContext.java
@@ -16,60 +16,60 @@ package org.eclipse.ui.actions;
import org.eclipse.jface.viewers.ISelection;
/**
- * An <code>ActionContext</code> represents the context used to determine
- * which actions are added by an <code>ActionGroup</code>, and what their
- * enabled state should be.
+ * An <code>ActionContext</code> represents the context used to determine which
+ * actions are added by an <code>ActionGroup</code>, and what their enabled
+ * state should be.
* <p>
- * This class encapsulates a selection and an input element.
- * Clients may subclass this class to add more information to the context.
+ * This class encapsulates a selection and an input element. Clients may
+ * subclass this class to add more information to the context.
* </p>
*/
public class ActionContext {
- /**
- * The selection.
- */
- private ISelection selection;
+ /**
+ * The selection.
+ */
+ private ISelection selection;
- /**
- * The input element.
- */
- private Object input;
+ /**
+ * The input element.
+ */
+ private Object input;
- /**
- * Creates a new action context with the given selection.
- */
- public ActionContext(ISelection selection) {
- setSelection(selection);
- }
+ /**
+ * Creates a new action context with the given selection.
+ */
+ public ActionContext(ISelection selection) {
+ setSelection(selection);
+ }
- /**
- * Returns the selection.
- */
- public ISelection getSelection() {
- return selection;
- }
+ /**
+ * Returns the selection.
+ */
+ public ISelection getSelection() {
+ return selection;
+ }
- /**
- * Sets the selection.
- */
- public void setSelection(ISelection selection) {
- this.selection = selection;
- }
+ /**
+ * Sets the selection.
+ */
+ public void setSelection(ISelection selection) {
+ this.selection = selection;
+ }
- /**
- * Returns the input element.
- */
- public Object getInput() {
- return input;
- }
+ /**
+ * Returns the input element.
+ */
+ public Object getInput() {
+ return input;
+ }
- /**
- * Sets the input element.
- *
- * @param input
- */
- public void setInput(Object input) {
- this.input = input;
- }
+ /**
+ * Sets the input element.
+ *
+ * @param input
+ */
+ public void setInput(Object input) {
+ this.input = input;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ActionDelegate.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ActionDelegate.java
index 8baec6b9def..343355c7452 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ActionDelegate.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ActionDelegate.java
@@ -28,53 +28,51 @@ import org.eclipse.ui.IActionDelegate2;
* </p>
*/
public abstract class ActionDelegate implements IActionDelegate2 {
- /**
- * The <code>ActionDelegate</code> implementation of this
- * <code>IActionDelegate</code> method does nothing. Subclasses may
- * reimplement.
- * <p>
- * <b>Note:</b> This method is not called directly by the proxy action. Only
- * by the default implementation of <code>runWithEvent</code> of this
- * abstract class.
- */
- @Override
+ /**
+ * The <code>ActionDelegate</code> implementation of this
+ * <code>IActionDelegate</code> method does nothing. Subclasses may reimplement.
+ * <p>
+ * <b>Note:</b> This method is not called directly by the proxy action. Only by
+ * the default implementation of <code>runWithEvent</code> of this abstract
+ * class.
+ */
+ @Override
public void run(IAction action) {
- }
+ }
- /**
- * The <code>ActionDelegate</code> implementation of this
- * <code>IActionDelegate</code> method does nothing. Subclasses may
- * reimplement.
- */
- @Override
+ /**
+ * The <code>ActionDelegate</code> implementation of this
+ * <code>IActionDelegate</code> method does nothing. Subclasses may reimplement.
+ */
+ @Override
public void selectionChanged(IAction action, ISelection selection) {
- }
+ }
- /**
- * The <code>ActionDelegate</code> implementation of this
- * <code>IActionDelegate2</code> method does nothing. Subclasses may
- * reimplement.
- */
- @Override
+ /**
+ * The <code>ActionDelegate</code> implementation of this
+ * <code>IActionDelegate2</code> method does nothing. Subclasses may
+ * reimplement.
+ */
+ @Override
public void init(IAction action) {
- }
+ }
- /**
- * The <code>ActionDelegate</code> implementation of this
- * <code>IActionDelegate2</code> method does nothing. Subclasses may
- * reimplement.
- */
- @Override
+ /**
+ * The <code>ActionDelegate</code> implementation of this
+ * <code>IActionDelegate2</code> method does nothing. Subclasses may
+ * reimplement.
+ */
+ @Override
public void dispose() {
- }
+ }
- /**
- * The <code>ActionDelegate</code> implementation of this
- * <code>IActionDelegate2</code> method redirects to the <code>run</code>
- * method. Subclasses may reimplement.
- */
- @Override
+ /**
+ * The <code>ActionDelegate</code> implementation of this
+ * <code>IActionDelegate2</code> method redirects to the <code>run</code>
+ * method. Subclasses may reimplement.
+ */
+ @Override
public void runWithEvent(IAction action, Event event) {
- run(action);
- }
+ run(action);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ActionFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ActionFactory.java
index eae2b5b729f..06868fe3638 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ActionFactory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ActionFactory.java
@@ -58,36 +58,33 @@ import org.eclipse.ui.internal.intro.IntroMessages;
*/
public abstract class ActionFactory {
- /**
- * Interface for a workbench action.
- */
- public interface IWorkbenchAction extends IAction {
- /**
- * Disposes of this action. Once disposed, this action cannot be used.
- * This operation has no effect if the action has already been
- * disposed.
- */
- void dispose();
- }
-
- private static class WorkbenchCommandAction extends CommandAction implements
- IWorkbenchAction {
+ /**
+ * Interface for a workbench action.
+ */
+ public interface IWorkbenchAction extends IAction {
+ /**
+ * Disposes of this action. Once disposed, this action cannot be used. This
+ * operation has no effect if the action has already been disposed.
+ */
+ void dispose();
+ }
+
+ private static class WorkbenchCommandAction extends CommandAction implements IWorkbenchAction {
/**
* @param commandIdIn
* @param window
*/
- public WorkbenchCommandAction(String commandIdIn,
- IWorkbenchWindow window) {
+ public WorkbenchCommandAction(String commandIdIn, IWorkbenchWindow window) {
super(window, commandIdIn);
}
}
/**
- * Workbench action (id: "about", commandId: "org.eclipse.ui.help.aboutAction"): Displays the
- * About dialog. This action maintains its enablement state.
+ * Workbench action (id: "about", commandId: "org.eclipse.ui.help.aboutAction"):
+ * Displays the About dialog. This action maintains its enablement state.
*/
- public static final ActionFactory ABOUT = new ActionFactory("about", //$NON-NLS-1$
- IWorkbenchCommandConstants.HELP_ABOUT) {
+ public static final ActionFactory ABOUT = new ActionFactory("about", //$NON-NLS-1$
+ IWorkbenchCommandConstants.HELP_ABOUT) {
@Override
public IWorkbenchAction create(IWorkbenchWindow window) {
@@ -95,8 +92,7 @@ public abstract class ActionFactory {
throw new IllegalArgumentException();
}
- WorkbenchCommandAction action = new WorkbenchCommandAction(
- getCommandId(), window);
+ WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
action.setId(getId());
IProduct product = Platform.getProduct();
@@ -108,236 +104,227 @@ public abstract class ActionFactory {
productName = ""; //$NON-NLS-1$
}
- action.setText(NLS.bind(WorkbenchMessages.AboutAction_text,
- productName));
- action.setToolTipText(NLS.bind(
- WorkbenchMessages.AboutAction_toolTip, productName));
- window.getWorkbench().getHelpSystem().setHelp(action,
- IWorkbenchHelpContextIds.ABOUT_ACTION);
+ action.setText(NLS.bind(WorkbenchMessages.AboutAction_text, productName));
+ action.setToolTipText(NLS.bind(WorkbenchMessages.AboutAction_toolTip, productName));
+ window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.ABOUT_ACTION);
return action;
}
};
/**
- * Workbench action (id: "activateEditor", commandId: "org.eclipse.ui.window.activateEditor"):
- * Activate the most recently used editor. This action maintains its enablement state.
+ * Workbench action (id: "activateEditor", commandId:
+ * "org.eclipse.ui.window.activateEditor"): Activate the most recently used
+ * editor. This action maintains its enablement state.
*/
- public static final ActionFactory ACTIVATE_EDITOR = new ActionFactory(
- "activateEditor", IWorkbenchCommandConstants.WINDOW_ACTIVATE_EDITOR) {//$NON-NLS-1$
+ public static final ActionFactory ACTIVATE_EDITOR = new ActionFactory("activateEditor", //$NON-NLS-1$
+ IWorkbenchCommandConstants.WINDOW_ACTIVATE_EDITOR) {
- @Override
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
if (window == null) {
throw new IllegalArgumentException();
}
- WorkbenchCommandAction action = new WorkbenchCommandAction(
- getCommandId(), window);
+ WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
action.setId(getId());
action.setText(WorkbenchMessages.ActivateEditorAction_text);
- action
- .setToolTipText(WorkbenchMessages.ActivateEditorAction_toolTip);
+ action.setToolTipText(WorkbenchMessages.ActivateEditorAction_toolTip);
return action;
}
- };
+ };
/**
- * Workbench action (id: "back", commandId: "org.eclipse.ui.navigate.back"): Back. This action
- * is a {@link RetargetAction} with id "back". This action maintains its enablement state.
+ * Workbench action (id: "back", commandId: "org.eclipse.ui.navigate.back"):
+ * Back. This action is a {@link RetargetAction} with id "back". This action
+ * maintains its enablement state.
*/
- public static final ActionFactory BACK = new ActionFactory("back", //$NON-NLS-1$
- IWorkbenchCommandConstants.NAVIGATE_BACK) {
+ public static final ActionFactory BACK = new ActionFactory("back", //$NON-NLS-1$
+ IWorkbenchCommandConstants.NAVIGATE_BACK) {
@Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- RetargetAction action = new LabelRetargetAction(getId(), WorkbenchMessages.Workbench_back);
- action.setToolTipText(WorkbenchMessages.Workbench_backToolTip);
- window.getPartService().addPartListener(action);
- action.setActionDefinitionId(getCommandId());
- return action;
- }
- };
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ RetargetAction action = new LabelRetargetAction(getId(), WorkbenchMessages.Workbench_back);
+ action.setToolTipText(WorkbenchMessages.Workbench_backToolTip);
+ window.getPartService().addPartListener(action);
+ action.setActionDefinitionId(getCommandId());
+ return action;
+ }
+ };
/**
- * Workbench action (id: "backardHistory", commandId: "org.eclipse.ui.navigate.backwardHistory"):
- * Backward in the navigation history. This action maintains its enablement state.
+ * Workbench action (id: "backardHistory", commandId:
+ * "org.eclipse.ui.navigate.backwardHistory"): Backward in the navigation
+ * history. This action maintains its enablement state.
*/
- public static final ActionFactory BACKWARD_HISTORY = new ActionFactory(
- "backardHistory", IWorkbenchCommandConstants.NAVIGATE_BACKWARD_HISTORY) {//$NON-NLS-1$
- @Override
+ public static final ActionFactory BACKWARD_HISTORY = new ActionFactory("backardHistory", //$NON-NLS-1$
+ IWorkbenchCommandConstants.NAVIGATE_BACKWARD_HISTORY) {
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- IWorkbenchAction action = new NavigationHistoryAction(window, false);
- action.setId(getId());
- return action;
- }
- };
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ IWorkbenchAction action = new NavigationHistoryAction(window, false);
+ action.setId(getId());
+ return action;
+ }
+ };
/**
- * Workbench action (id: "close", commandId: "org.eclipse.ui.file.close"): Close the active
- * editor. This action maintains its enablement state.
+ * Workbench action (id: "close", commandId: "org.eclipse.ui.file.close"): Close
+ * the active editor. This action maintains its enablement state.
*/
- public static final ActionFactory CLOSE = new ActionFactory("close",//$NON-NLS-1$
- IWorkbenchCommandConstants.FILE_CLOSE) {
+ public static final ActionFactory CLOSE = new ActionFactory("close", //$NON-NLS-1$
+ IWorkbenchCommandConstants.FILE_CLOSE) {
@Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- WorkbenchCommandAction action = new WorkbenchCommandAction(
- getCommandId(), window);
- action.setId(getId());
- action.setText(WorkbenchMessages.CloseEditorAction_text);
- action.setToolTipText(WorkbenchMessages.CloseEditorAction_toolTip);
- return action;
- }
- };
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
+ action.setId(getId());
+ action.setText(WorkbenchMessages.CloseEditorAction_text);
+ action.setToolTipText(WorkbenchMessages.CloseEditorAction_toolTip);
+ return action;
+ }
+ };
/**
- * Workbench action (id: "closeAll", commandId: "org.eclipse.ui.file.closeAll"): Close all open
- * editors. This action maintains its enablement state.
+ * Workbench action (id: "closeAll", commandId: "org.eclipse.ui.file.closeAll"):
+ * Close all open editors. This action maintains its enablement state.
*/
- public static final ActionFactory CLOSE_ALL = new ActionFactory("closeAll",//$NON-NLS-1$
- IWorkbenchCommandConstants.FILE_CLOSE_ALL) {
+ public static final ActionFactory CLOSE_ALL = new ActionFactory("closeAll", //$NON-NLS-1$
+ IWorkbenchCommandConstants.FILE_CLOSE_ALL) {
@Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- WorkbenchCommandAction action = new WorkbenchCommandAction(
- getCommandId(), window);
- action.setId(getId());
- action.setText(WorkbenchMessages.CloseAllAction_text);
- action.setToolTipText(WorkbenchMessages.CloseAllAction_toolTip);
- return action;
- }
- };
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
+ action.setId(getId());
+ action.setText(WorkbenchMessages.CloseAllAction_text);
+ action.setToolTipText(WorkbenchMessages.CloseAllAction_toolTip);
+ return action;
+ }
+ };
/**
- * Workbench action (id: "closeOthers", commandId: "org.eclipse.ui.file.closeOthers"): Close all
- * editors except the one that is active. This action maintains its enablement state.
+ * Workbench action (id: "closeOthers", commandId:
+ * "org.eclipse.ui.file.closeOthers"): Close all editors except the one that is
+ * active. This action maintains its enablement state.
*
* @since 3.2
*/
- public static final ActionFactory CLOSE_OTHERS = new ActionFactory("closeOthers",//$NON-NLS-1$
- IWorkbenchCommandConstants.FILE_CLOSE_OTHERS) {
+ public static final ActionFactory CLOSE_OTHERS = new ActionFactory("closeOthers", //$NON-NLS-1$
+ IWorkbenchCommandConstants.FILE_CLOSE_OTHERS) {
@Override
public IWorkbenchAction create(IWorkbenchWindow window) {
if (window == null) {
throw new IllegalArgumentException();
}
- WorkbenchCommandAction action = new WorkbenchCommandAction(
- getCommandId(), window);
+ WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
action.setId(getId());
action.setText(WorkbenchMessages.CloseOthersAction_text);
action.setToolTipText(WorkbenchMessages.CloseOthersAction_toolTip);
return action;
- }
- };
+ }
+ };
/**
- * Workbench action (id: "closeAllPerspectives", commandId: "org.eclipse.ui.window.closeAllPerspectives"):
- * Closes all perspectives. This action maintains its enablement state.
+ * Workbench action (id: "closeAllPerspectives", commandId:
+ * "org.eclipse.ui.window.closeAllPerspectives"): Closes all perspectives. This
+ * action maintains its enablement state.
*/
- public static final ActionFactory CLOSE_ALL_PERSPECTIVES = new ActionFactory(
- "closeAllPerspectives", IWorkbenchCommandConstants.WINDOW_CLOSE_ALL_PERSPECTIVES) {//$NON-NLS-1$
+ public static final ActionFactory CLOSE_ALL_PERSPECTIVES = new ActionFactory("closeAllPerspectives", //$NON-NLS-1$
+ IWorkbenchCommandConstants.WINDOW_CLOSE_ALL_PERSPECTIVES) {
@Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- WorkbenchCommandAction action = new WorkbenchCommandAction(
- getCommandId(), window);
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
- action.setId(getId());
- action.setText(WorkbenchMessages.CloseAllPerspectivesAction_text);
- action.setToolTipText(WorkbenchMessages.CloseAllPerspectivesAction_toolTip);
- window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.CLOSE_ALL_PAGES_ACTION);
+ action.setId(getId());
+ action.setText(WorkbenchMessages.CloseAllPerspectivesAction_text);
+ action.setToolTipText(WorkbenchMessages.CloseAllPerspectivesAction_toolTip);
+ window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.CLOSE_ALL_PAGES_ACTION);
- return action;
- }
- };
+ return action;
+ }
+ };
/**
- * Workbench action (id: "closeAllSaved"): Close all open editors except those with unsaved
- * changes. This action maintains its enablement state.
+ * Workbench action (id: "closeAllSaved"): Close all open editors except those
+ * with unsaved changes. This action maintains its enablement state.
*/
- public static final ActionFactory CLOSE_ALL_SAVED = new ActionFactory(
- "closeAllSaved") {//$NON-NLS-1$
- @Override
+ public static final ActionFactory CLOSE_ALL_SAVED = new ActionFactory("closeAllSaved") {//$NON-NLS-1$
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- IWorkbenchAction action = new CloseAllSavedAction(window);
- action.setId(getId());
- return action;
- }
- };
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ IWorkbenchAction action = new CloseAllSavedAction(window);
+ action.setId(getId());
+ return action;
+ }
+ };
/**
- * Workbench action (id: "closePerspective", commandId: "org.eclipse.ui.window.closePerspective"):
- * Closes the current perspective. This action maintains its enablement state.
+ * Workbench action (id: "closePerspective", commandId:
+ * "org.eclipse.ui.window.closePerspective"): Closes the current perspective.
+ * This action maintains its enablement state.
*/
- public static final ActionFactory CLOSE_PERSPECTIVE = new ActionFactory(
- "closePerspective", IWorkbenchCommandConstants.WINDOW_CLOSE_PERSPECTIVE) {//$NON-NLS-1$
+ public static final ActionFactory CLOSE_PERSPECTIVE = new ActionFactory("closePerspective", //$NON-NLS-1$
+ IWorkbenchCommandConstants.WINDOW_CLOSE_PERSPECTIVE) {
- @Override
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- WorkbenchCommandAction action = new WorkbenchCommandAction(
- getCommandId(), window);
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
- action.setId(getId());
- action.setText(WorkbenchMessages.
- ClosePerspectiveAction_text);
- action.setToolTipText(WorkbenchMessages.
- ClosePerspectiveAction_toolTip);
- window.getWorkbench().getHelpSystem().setHelp(action,
- IWorkbenchHelpContextIds.CLOSE_PAGE_ACTION);
- return action;
- }
- };
+ action.setId(getId());
+ action.setText(WorkbenchMessages.ClosePerspectiveAction_text);
+ action.setToolTipText(WorkbenchMessages.ClosePerspectiveAction_toolTip);
+ window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.CLOSE_PAGE_ACTION);
+ return action;
+ }
+ };
/**
- * Workbench action (id: "intro", commandId: "org.eclipse.ui.help.quickStartAction"): Activate
- * the introduction extension. This action should not be instantiated if no intro is provided.
- * Use code like:
+ * Workbench action (id: "intro", commandId:
+ * "org.eclipse.ui.help.quickStartAction"): Activate the introduction extension.
+ * This action should not be instantiated if no intro is provided. Use code
+ * like:
*
* <pre>
* if (window.getWorkbench().getIntroManager().hasIntro()) {
- * introAction= ActionFactory.INTRO.create(window);
+ * introAction = ActionFactory.INTRO.create(window);
* register(introAction);
* }
* </pre>
*/
- public static final ActionFactory INTRO = new ActionFactory("intro", //$NON-NLS-1$
- IWorkbenchCommandConstants.HELP_WELCOME) {
+ public static final ActionFactory INTRO = new ActionFactory("intro", //$NON-NLS-1$
+ IWorkbenchCommandConstants.HELP_WELCOME) {
@Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
action.setId(getId());
action.setText(IntroMessages.Intro_action_text);
- window.getWorkbench().getHelpSystem()
- .setHelp(action, IWorkbenchHelpContextIds.INTRO_ACTION);
- IntroDescriptor introDescriptor = ((Workbench) window.getWorkbench())
- .getIntroDescriptor();
+ window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.INTRO_ACTION);
+ IntroDescriptor introDescriptor = ((Workbench) window.getWorkbench()).getIntroDescriptor();
if (introDescriptor != null) {
action.setImageDescriptor(introDescriptor.getImageDescriptor());
String labelOverride = introDescriptor.getLabelOverride();
@@ -347,257 +334,246 @@ public abstract class ActionFactory {
}
return action;
- }
- };
-
- /**
- * Workbench action (id: "copy", commandId: "org.eclipse.ui.edit.copy"): Copy. This action is a
- * {@link RetargetAction} with id "copy". This action maintains its enablement state.
- */
- public static final ActionFactory COPY = new ActionFactory("copy", //$NON-NLS-1$
- IWorkbenchCommandConstants.EDIT_COPY) {
-
- @Override
- public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- RetargetAction action = new RetargetAction(getId(),WorkbenchMessages.Workbench_copy);
- action.setToolTipText(WorkbenchMessages.Workbench_copyToolTip);
- window.getPartService().addPartListener(action);
- action.setActionDefinitionId(getCommandId());
- ISharedImages sharedImages = window.getWorkbench()
- .getSharedImages();
- action.setImageDescriptor(sharedImages
- .getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
- action.setDisabledImageDescriptor(sharedImages
- .getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED));
- return action;
- }
- };
-
- /**
- * Workbench action (id: "cut", commandId: "org.eclipse.ui.edit.cut"): Cut. This action is a
- * {@link RetargetAction} with id "cut". This action maintains its enablement state.
- */
- public static final ActionFactory CUT = new ActionFactory("cut", //$NON-NLS-1$
- IWorkbenchCommandConstants.EDIT_CUT) {
-
- @Override
- public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- RetargetAction action = new RetargetAction(getId(),WorkbenchMessages.Workbench_cut);
- action.setToolTipText(WorkbenchMessages.Workbench_cutToolTip);
- window.getPartService().addPartListener(action);
- action.setActionDefinitionId(getCommandId());
- ISharedImages sharedImages = window.getWorkbench()
- .getSharedImages();
- action.setImageDescriptor(sharedImages
- .getImageDescriptor(ISharedImages.IMG_TOOL_CUT));
- action.setDisabledImageDescriptor(sharedImages
- .getImageDescriptor(ISharedImages.IMG_TOOL_CUT_DISABLED));
- return action;
- }
- };
-
- /**
- * Workbench action (id: "delete", commandId: "org.eclipse.ui.edit.delete"): Delete. This action
- * is a {@link RetargetAction} with id "delete". This action maintains its enablement state.
- */
- public static final ActionFactory DELETE = new ActionFactory("delete", //$NON-NLS-1$
- IWorkbenchCommandConstants.EDIT_DELETE) {
-
- @Override
- public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- RetargetAction action = new RetargetAction(getId(),WorkbenchMessages.Workbench_delete);
- action.setToolTipText(WorkbenchMessages.Workbench_deleteToolTip);
- window.getPartService().addPartListener(action);
- action.setActionDefinitionId(getCommandId());
- action.enableAccelerator(false);
- window.getWorkbench().getHelpSystem().setHelp(action,
- IWorkbenchHelpContextIds.DELETE_RETARGET_ACTION);
- ISharedImages sharedImages = window.getWorkbench()
- .getSharedImages();
- action.setImageDescriptor(sharedImages
- .getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
- action
- .setDisabledImageDescriptor(sharedImages
- .getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED));
- return action;
- }
- };
-
- /**
- * Workbench action (id: "editActionSets", commandId: "org.eclipse.ui.window.customizePerspective"):
- * Edit the action sets. This action maintains its enablement state.
- */
- public static final ActionFactory EDIT_ACTION_SETS = new ActionFactory(
- "editActionSets", IWorkbenchCommandConstants.WINDOW_CUSTOMIZE_PERSPECTIVE) {//$NON-NLS-1$
-
- @Override
- public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- WorkbenchCommandAction action = new WorkbenchCommandAction(
- getCommandId(), window);
- action.setId(getId());
- action.setText(WorkbenchMessages.EditActionSetsAction_text);
- action.setToolTipText(WorkbenchMessages.EditActionSetsAction_toolTip);
- window.getWorkbench().getHelpSystem().setHelp(action,
- IWorkbenchHelpContextIds.EDIT_ACTION_SETS_ACTION);
-
- return action;
- }
- };
-
- /**
- * Workbench action (id: "export", commandId: "org.eclipse.ui.file.export"): Opens the export
- * wizard. This action maintains its enablement state.
- */
- public static final ActionFactory EXPORT = new ActionFactory("export", //$NON-NLS-1$
- IWorkbenchCommandConstants.FILE_EXPORT) {
-
- @Override
- public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
-
- WorkbenchCommandAction action = new WorkbenchCommandAction(
- getCommandId(), window);
- action.setId(getId());
- action.setText(WorkbenchMessages.ExportResourcesAction_fileMenuText);
- action.setToolTipText(WorkbenchMessages.ExportResourcesAction_toolTip);
- window.getWorkbench().getHelpSystem().setHelp(action,
- IWorkbenchHelpContextIds.EXPORT_ACTION);
- action.setImageDescriptor(WorkbenchImages
- .getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_EXPORT_WIZ));
- return action;
- }
-
- };
-
- /**
- * Workbench action (id: "find", commandId: "org.eclipse.ui.edit.findReplace"): Find. This
- * action is a {@link RetargetAction} with id "find". This action maintains its enablement
- * state.
- */
- public static final ActionFactory FIND = new ActionFactory("find", //$NON-NLS-1$
- IWorkbenchCommandConstants.EDIT_FIND_AND_REPLACE) {
-
- @Override
- public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- RetargetAction action = new RetargetAction(getId(),WorkbenchMessages.Workbench_findReplace);
- action.setToolTipText(WorkbenchMessages.Workbench_findReplaceToolTip);
- window.getPartService().addPartListener(action);
- action.setActionDefinitionId(getCommandId());
- // Find's images are commented out due to a conflict with Search.
- // See bug 16412.
- // action.setImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_SEARCH_SRC));
- // action.setDisabledImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_SEARCH_SRC_DISABLED));
- return action;
- }
- };
-
- /**
- * Workbench action (id: "forward", commandId: "org.eclipse.ui.navigate.forward"): Forward. This
- * action is a {@link RetargetAction} with id "forward". This action maintains its enablement
- * state.
- */
- public static final ActionFactory FORWARD = new ActionFactory("forward", //$NON-NLS-1$
- IWorkbenchCommandConstants.NAVIGATE_FORWARD) {
-
- @Override
- public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- RetargetAction action = new LabelRetargetAction(getId(),WorkbenchMessages.Workbench_forward);
- action.setToolTipText(WorkbenchMessages.Workbench_forwardToolTip);
- window.getPartService().addPartListener(action);
- action.setActionDefinitionId(getCommandId());
- return action;
- }
- };
+ }
+ };
/**
- * Workbench action (id: "forwardHistory", commandId: "org.eclipse.ui.navigate.forwardHistory"):
- * Forward in the navigation history. This action maintains its enablement state.
+ * Workbench action (id: "copy", commandId: "org.eclipse.ui.edit.copy"): Copy.
+ * This action is a {@link RetargetAction} with id "copy". This action maintains
+ * its enablement state.
+ */
+ public static final ActionFactory COPY = new ActionFactory("copy", //$NON-NLS-1$
+ IWorkbenchCommandConstants.EDIT_COPY) {
+
+ @Override
+ public IWorkbenchAction create(IWorkbenchWindow window) {
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ RetargetAction action = new RetargetAction(getId(), WorkbenchMessages.Workbench_copy);
+ action.setToolTipText(WorkbenchMessages.Workbench_copyToolTip);
+ window.getPartService().addPartListener(action);
+ action.setActionDefinitionId(getCommandId());
+ ISharedImages sharedImages = window.getWorkbench().getSharedImages();
+ action.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
+ action.setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED));
+ return action;
+ }
+ };
+
+ /**
+ * Workbench action (id: "cut", commandId: "org.eclipse.ui.edit.cut"): Cut. This
+ * action is a {@link RetargetAction} with id "cut". This action maintains its
+ * enablement state.
+ */
+ public static final ActionFactory CUT = new ActionFactory("cut", //$NON-NLS-1$
+ IWorkbenchCommandConstants.EDIT_CUT) {
+
+ @Override
+ public IWorkbenchAction create(IWorkbenchWindow window) {
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ RetargetAction action = new RetargetAction(getId(), WorkbenchMessages.Workbench_cut);
+ action.setToolTipText(WorkbenchMessages.Workbench_cutToolTip);
+ window.getPartService().addPartListener(action);
+ action.setActionDefinitionId(getCommandId());
+ ISharedImages sharedImages = window.getWorkbench().getSharedImages();
+ action.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_CUT));
+ action.setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_CUT_DISABLED));
+ return action;
+ }
+ };
+
+ /**
+ * Workbench action (id: "delete", commandId: "org.eclipse.ui.edit.delete"):
+ * Delete. This action is a {@link RetargetAction} with id "delete". This action
+ * maintains its enablement state.
+ */
+ public static final ActionFactory DELETE = new ActionFactory("delete", //$NON-NLS-1$
+ IWorkbenchCommandConstants.EDIT_DELETE) {
+
+ @Override
+ public IWorkbenchAction create(IWorkbenchWindow window) {
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ RetargetAction action = new RetargetAction(getId(), WorkbenchMessages.Workbench_delete);
+ action.setToolTipText(WorkbenchMessages.Workbench_deleteToolTip);
+ window.getPartService().addPartListener(action);
+ action.setActionDefinitionId(getCommandId());
+ action.enableAccelerator(false);
+ window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.DELETE_RETARGET_ACTION);
+ ISharedImages sharedImages = window.getWorkbench().getSharedImages();
+ action.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
+ action.setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED));
+ return action;
+ }
+ };
+
+ /**
+ * Workbench action (id: "editActionSets", commandId:
+ * "org.eclipse.ui.window.customizePerspective"): Edit the action sets. This
+ * action maintains its enablement state.
*/
- public static final ActionFactory FORWARD_HISTORY = new ActionFactory(
- "forwardHistory", IWorkbenchCommandConstants.NAVIGATE_FORWARD_HISTORY) {//$NON-NLS-1$
+ public static final ActionFactory EDIT_ACTION_SETS = new ActionFactory("editActionSets", //$NON-NLS-1$
+ IWorkbenchCommandConstants.WINDOW_CUSTOMIZE_PERSPECTIVE) {
- @Override
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- IWorkbenchAction action = new NavigationHistoryAction(window, true);
- action.setId(getId());
- return action;
- }
- };
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
+ action.setId(getId());
+ action.setText(WorkbenchMessages.EditActionSetsAction_text);
+ action.setToolTipText(WorkbenchMessages.EditActionSetsAction_toolTip);
+ window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.EDIT_ACTION_SETS_ACTION);
+
+ return action;
+ }
+ };
/**
- * Workbench action (id: "goInto", commandId: "org.eclipse.ui.navigate.goInto"): Go Into. This
- * action is a {@link RetargetAction} with id "goInto". This action maintains its enablement
- * state.
+ * Workbench action (id: "export", commandId: "org.eclipse.ui.file.export"):
+ * Opens the export wizard. This action maintains its enablement state.
*/
- public static final ActionFactory GO_INTO = new ActionFactory("goInto", //$NON-NLS-1$
- IWorkbenchCommandConstants.NAVIGATE_GO_INTO) {
+ public static final ActionFactory EXPORT = new ActionFactory("export", //$NON-NLS-1$
+ IWorkbenchCommandConstants.FILE_EXPORT) {
- @Override
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- RetargetAction action = new LabelRetargetAction(getId(),WorkbenchMessages.Workbench_goInto);
- action.setToolTipText(WorkbenchMessages.Workbench_goIntoToolTip);
- window.getPartService().addPartListener(action);
- action.setActionDefinitionId(getCommandId());
- return action;
- }
- };
-
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+
+ WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
+ action.setId(getId());
+ action.setText(WorkbenchMessages.ExportResourcesAction_fileMenuText);
+ action.setToolTipText(WorkbenchMessages.ExportResourcesAction_toolTip);
+ window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.EXPORT_ACTION);
+ action.setImageDescriptor(
+ WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_EXPORT_WIZ));
+ return action;
+ }
+
+ };
+
/**
- * Workbench action (id: "import", commandId: "org.eclipse.ui.file.import"): Opens the import
- * wizard. This action maintains its enablement state.
- */
- public static final ActionFactory IMPORT = new ActionFactory("import", //$NON-NLS-1$
- IWorkbenchCommandConstants.FILE_IMPORT) {
+ * Workbench action (id: "find", commandId: "org.eclipse.ui.edit.findReplace"):
+ * Find. This action is a {@link RetargetAction} with id "find". This action
+ * maintains its enablement state.
+ */
+ public static final ActionFactory FIND = new ActionFactory("find", //$NON-NLS-1$
+ IWorkbenchCommandConstants.EDIT_FIND_AND_REPLACE) {
- @Override
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ RetargetAction action = new RetargetAction(getId(), WorkbenchMessages.Workbench_findReplace);
+ action.setToolTipText(WorkbenchMessages.Workbench_findReplaceToolTip);
+ window.getPartService().addPartListener(action);
+ action.setActionDefinitionId(getCommandId());
+ // Find's images are commented out due to a conflict with Search.
+ // See bug 16412.
+ // action.setImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_SEARCH_SRC));
+ // action.setDisabledImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_SEARCH_SRC_DISABLED));
+ return action;
+ }
+ };
- WorkbenchCommandAction action = new WorkbenchCommandAction(
- getCommandId(), window);
- action.setId(getId());
- action.setText(WorkbenchMessages.ImportResourcesAction_text);
- action.setToolTipText(WorkbenchMessages.ImportResourcesAction_toolTip);
- window.getWorkbench().getHelpSystem().setHelp(action,
- IWorkbenchHelpContextIds.IMPORT_ACTION);
- action.setImageDescriptor(WorkbenchImages
- .getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_IMPORT_WIZ));
- return action;
-
- }
- };
-
- /**
- * Workbench action (id: "lockToolBar"): Lock/unlock the workbench window
- * tool bar. This action maintains its enablement state.
+ /**
+ * Workbench action (id: "forward", commandId:
+ * "org.eclipse.ui.navigate.forward"): Forward. This action is a
+ * {@link RetargetAction} with id "forward". This action maintains its
+ * enablement state.
+ */
+ public static final ActionFactory FORWARD = new ActionFactory("forward", //$NON-NLS-1$
+ IWorkbenchCommandConstants.NAVIGATE_FORWARD) {
+
+ @Override
+ public IWorkbenchAction create(IWorkbenchWindow window) {
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ RetargetAction action = new LabelRetargetAction(getId(), WorkbenchMessages.Workbench_forward);
+ action.setToolTipText(WorkbenchMessages.Workbench_forwardToolTip);
+ window.getPartService().addPartListener(action);
+ action.setActionDefinitionId(getCommandId());
+ return action;
+ }
+ };
+
+ /**
+ * Workbench action (id: "forwardHistory", commandId:
+ * "org.eclipse.ui.navigate.forwardHistory"): Forward in the navigation history.
+ * This action maintains its enablement state.
+ */
+ public static final ActionFactory FORWARD_HISTORY = new ActionFactory("forwardHistory", //$NON-NLS-1$
+ IWorkbenchCommandConstants.NAVIGATE_FORWARD_HISTORY) {
+
+ @Override
+ public IWorkbenchAction create(IWorkbenchWindow window) {
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ IWorkbenchAction action = new NavigationHistoryAction(window, true);
+ action.setId(getId());
+ return action;
+ }
+ };
+
+ /**
+ * Workbench action (id: "goInto", commandId: "org.eclipse.ui.navigate.goInto"):
+ * Go Into. This action is a {@link RetargetAction} with id "goInto". This
+ * action maintains its enablement state.
+ */
+ public static final ActionFactory GO_INTO = new ActionFactory("goInto", //$NON-NLS-1$
+ IWorkbenchCommandConstants.NAVIGATE_GO_INTO) {
+
+ @Override
+ public IWorkbenchAction create(IWorkbenchWindow window) {
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ RetargetAction action = new LabelRetargetAction(getId(), WorkbenchMessages.Workbench_goInto);
+ action.setToolTipText(WorkbenchMessages.Workbench_goIntoToolTip);
+ window.getPartService().addPartListener(action);
+ action.setActionDefinitionId(getCommandId());
+ return action;
+ }
+ };
+
+ /**
+ * Workbench action (id: "import", commandId: "org.eclipse.ui.file.import"):
+ * Opens the import wizard. This action maintains its enablement state.
+ */
+ public static final ActionFactory IMPORT = new ActionFactory("import", //$NON-NLS-1$
+ IWorkbenchCommandConstants.FILE_IMPORT) {
+
+ @Override
+ public IWorkbenchAction create(IWorkbenchWindow window) {
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+
+ WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
+ action.setId(getId());
+ action.setText(WorkbenchMessages.ImportResourcesAction_text);
+ action.setToolTipText(WorkbenchMessages.ImportResourcesAction_toolTip);
+ window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.IMPORT_ACTION);
+ action.setImageDescriptor(
+ WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_IMPORT_WIZ));
+ return action;
+
+ }
+ };
+
+ /**
+ * Workbench action (id: "lockToolBar"): Lock/unlock the workbench window tool
+ * bar. This action maintains its enablement state.
*/
public static final ActionFactory LOCK_TOOL_BAR = new ActionFactory("lockToolBar", //$NON-NLS-1$
IWorkbenchCommandConstants.WINDOW_LOCK_TOOLBAR) {
@@ -610,45 +586,42 @@ public abstract class ActionFactory {
WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
action.setId(getId());
action.setToolTipText(WorkbenchMessages.LockToolBarAction_toolTip);
- window.getWorkbench().getHelpSystem()
- .setHelp(action, IWorkbenchHelpContextIds.LOCK_TOOLBAR_ACTION);
+ window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.LOCK_TOOLBAR_ACTION);
return action;
}
- };
+ };
/**
* Workbench action (id: "maximize", commandId:
- * "org.eclipse.ui.window.maximizePart"): Maximize/restore the active part.
- * This action maintains its enablement state.
+ * "org.eclipse.ui.window.maximizePart"): Maximize/restore the active part. This
+ * action maintains its enablement state.
*
- * @deprecated you should not use this field, kept for compatibility
- * reasons. use instead the command
+ * @deprecated you should not use this field, kept for compatibility reasons.
+ * use instead the command
* {@code org.eclipse.ui.window.maximizePart}.
*/
@Deprecated
- public static final ActionFactory MAXIMIZE = new ActionFactory("maximize", //$NON-NLS-1$
- IWorkbenchCommandConstants.WINDOW_MAXIMIZE_ACTIVE_VIEW_OR_EDITOR) {
+ public static final ActionFactory MAXIMIZE = new ActionFactory("maximize", //$NON-NLS-1$
+ IWorkbenchCommandConstants.WINDOW_MAXIMIZE_ACTIVE_VIEW_OR_EDITOR) {
- @Override
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- WorkbenchCommandAction action = new WorkbenchCommandAction(
- getCommandId(), window);
- action.setId(getId());
- action.setToolTipText(WorkbenchMessages.MaximizePartAction_toolTip);
- window.getWorkbench().getHelpSystem().setHelp(action,
- IWorkbenchHelpContextIds.MAXIMIZE_PART_ACTION);
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
+ action.setId(getId());
+ action.setToolTipText(WorkbenchMessages.MaximizePartAction_toolTip);
+ window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.MAXIMIZE_PART_ACTION);
- return action;
- }
- };
+ return action;
+ }
+ };
/**
* Workbench action (id: "minimize", commandId:
- * "org.eclipse.ui.window.minimizePart"): Minimizes the active part. This
- * action maintains its enablement state.
+ * "org.eclipse.ui.window.minimizePart"): Minimizes the active part. This action
+ * maintains its enablement state.
*
* @since 3.1
* @deprecated you should not use this field, that is kept for compatibility
@@ -656,112 +629,107 @@ public abstract class ActionFactory {
* {@code org.eclipse.ui.window.minimizePart}.
*/
@Deprecated
- public static final ActionFactory MINIMIZE = new ActionFactory("minimize", //$NON-NLS-1$
- IWorkbenchCommandConstants.WINDOW_MINIMIZE_ACTIVE_VIEW_OR_EDITOR) {
+ public static final ActionFactory MINIMIZE = new ActionFactory("minimize", //$NON-NLS-1$
+ IWorkbenchCommandConstants.WINDOW_MINIMIZE_ACTIVE_VIEW_OR_EDITOR) {
- @Override
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- WorkbenchCommandAction action = new WorkbenchCommandAction(
- getCommandId(), window);
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
action.setId(getId());
action.setToolTipText(WorkbenchMessages.MinimizePartAction_toolTip);
- window.getWorkbench().getHelpSystem().setHelp(action,
- IWorkbenchHelpContextIds.MINIMIZE_PART_ACTION);
- return action;
- }
- };
-
- /**
- * Workbench action (id: "move", commandId: "org.eclipse.ui.edit.move"): Move. This action is a
- * {@link RetargetAction} with id "move". This action maintains its enablement state.
- */
- public static final ActionFactory MOVE = new ActionFactory("move", //$NON-NLS-1$
- IWorkbenchCommandConstants.FILE_MOVE) {
-
- @Override
- public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- RetargetAction action = new RetargetAction(getId(),WorkbenchMessages.Workbench_move);
- action.setToolTipText(WorkbenchMessages.Workbench_moveToolTip);
- window.getPartService().addPartListener(action);
- action.setActionDefinitionId(getCommandId());
- return action;
- }
- };
-
- /**
- * Workbench action (id: "new", commandId: "org.eclipse.ui.newWizard"): Opens the new wizard
- * dialog. This action maintains its enablement state.
- */
- public static final ActionFactory NEW = new ActionFactory("new", //$NON-NLS-1$
- IWorkbenchCommandConstants.FILE_NEW) {
-
- @Override
- public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- WorkbenchCommandAction action = new WorkbenchCommandAction(
- getCommandId(), window);
- action.setId(getId());
- ISharedImages images = window.getWorkbench().getSharedImages();
- action.setImageDescriptor(images
- .getImageDescriptor(ISharedImages.IMG_TOOL_NEW_WIZARD));
- action.setDisabledImageDescriptor(images
- .getImageDescriptor(ISharedImages.IMG_TOOL_NEW_WIZARD_DISABLED));
- action.setText(WorkbenchMessages.NewWizardAction_text);
- action.setToolTipText(WorkbenchMessages.NewWizardAction_toolTip);
- window.getWorkbench().getHelpSystem().setHelp(action,
- IWorkbenchHelpContextIds.NEW_ACTION);
- return action;
- }
- };
-
- /**
- * Workbench action (id: "newWizardDropDown"): Drop-down action which shows shows the new wizard
- * drop down, or opens the new wizard dialog when pressed. For use in the toolbar. This action
- * maintains its enablement state.
+ window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.MINIMIZE_PART_ACTION);
+ return action;
+ }
+ };
+
+ /**
+ * Workbench action (id: "move", commandId: "org.eclipse.ui.edit.move"): Move.
+ * This action is a {@link RetargetAction} with id "move". This action maintains
+ * its enablement state.
+ */
+ public static final ActionFactory MOVE = new ActionFactory("move", //$NON-NLS-1$
+ IWorkbenchCommandConstants.FILE_MOVE) {
+
+ @Override
+ public IWorkbenchAction create(IWorkbenchWindow window) {
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ RetargetAction action = new RetargetAction(getId(), WorkbenchMessages.Workbench_move);
+ action.setToolTipText(WorkbenchMessages.Workbench_moveToolTip);
+ window.getPartService().addPartListener(action);
+ action.setActionDefinitionId(getCommandId());
+ return action;
+ }
+ };
+
+ /**
+ * Workbench action (id: "new", commandId: "org.eclipse.ui.newWizard"): Opens
+ * the new wizard dialog. This action maintains its enablement state.
+ */
+ public static final ActionFactory NEW = new ActionFactory("new", //$NON-NLS-1$
+ IWorkbenchCommandConstants.FILE_NEW) {
+
+ @Override
+ public IWorkbenchAction create(IWorkbenchWindow window) {
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
+ action.setId(getId());
+ ISharedImages images = window.getWorkbench().getSharedImages();
+ action.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_NEW_WIZARD));
+ action.setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_NEW_WIZARD_DISABLED));
+ action.setText(WorkbenchMessages.NewWizardAction_text);
+ action.setToolTipText(WorkbenchMessages.NewWizardAction_toolTip);
+ window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.NEW_ACTION);
+ return action;
+ }
+ };
+
+ /**
+ * Workbench action (id: "newWizardDropDown"): Drop-down action which shows
+ * shows the new wizard drop down, or opens the new wizard dialog when pressed.
+ * For use in the toolbar. This action maintains its enablement state.
*
* @since 3.1
*/
- public static final ActionFactory NEW_WIZARD_DROP_DOWN = new ActionFactory(
- "newWizardDropDown") { //$NON-NLS-1$
+ public static final ActionFactory NEW_WIZARD_DROP_DOWN = new ActionFactory("newWizardDropDown") { //$NON-NLS-1$
- @Override
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- IWorkbenchAction action = new NewWizardDropDownAction(window);
- action.setId(getId());
- return action;
- }
- };
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ IWorkbenchAction action = new NewWizardDropDownAction(window);
+ action.setId(getId());
+ return action;
+ }
+ };
/**
- * Workbench action (id: "next", commandId: "org.eclipse.ui.navigate.next"): Next. This action
- * is a {@link RetargetAction} with id "next". This action maintains its enablement state.
+ * Workbench action (id: "next", commandId: "org.eclipse.ui.navigate.next"):
+ * Next. This action is a {@link RetargetAction} with id "next". This action
+ * maintains its enablement state.
*/
- public static final ActionFactory NEXT = new ActionFactory("next", //$NON-NLS-1$
- IWorkbenchCommandConstants.NAVIGATE_NEXT) {
+ public static final ActionFactory NEXT = new ActionFactory("next", //$NON-NLS-1$
+ IWorkbenchCommandConstants.NAVIGATE_NEXT) {
- @Override
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- RetargetAction action = new LabelRetargetAction(getId(),WorkbenchMessages.Workbench_next);
- action.setToolTipText(WorkbenchMessages.Workbench_nextToolTip);
- window.getPartService().addPartListener(action);
- action.setActionDefinitionId(getCommandId());
- return action;
- }
- };
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ RetargetAction action = new LabelRetargetAction(getId(), WorkbenchMessages.Workbench_next);
+ action.setToolTipText(WorkbenchMessages.Workbench_nextToolTip);
+ window.getPartService().addPartListener(action);
+ action.setActionDefinitionId(getCommandId());
+ return action;
+ }
+ };
/**
* Workbench action (id: "nextEditor", commandId:
@@ -773,27 +741,25 @@ public abstract class ActionFactory {
* ActionFactory.linkCycleActionPair} to connect the two.
* </p>
*/
- public static final ActionFactory NEXT_EDITOR = new ActionFactory(
- "nextEditor", IWorkbenchCommandConstants.WINDOW_NEXT_EDITOR) {//$NON-NLS-1$
+ public static final ActionFactory NEXT_EDITOR = new ActionFactory("nextEditor", //$NON-NLS-1$
+ IWorkbenchCommandConstants.WINDOW_NEXT_EDITOR) {
- @Override
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
if (window == null) {
throw new IllegalArgumentException();
}
- IWorkbenchAction action = new WorkbenchCommandAction(
- getCommandId(), window);
+ IWorkbenchAction action = new WorkbenchCommandAction(getCommandId(), window);
action.setId(getId());
action.setText(WorkbenchMessages.CycleEditorAction_next_text);
action.setToolTipText(WorkbenchMessages.CycleEditorAction_next_toolTip);
- // @issue missing action ids
- window.getWorkbench().getHelpSystem().setHelp(action,
- IWorkbenchHelpContextIds.CYCLE_EDITOR_FORWARD_ACTION);
+ // @issue missing action ids
+ window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.CYCLE_EDITOR_FORWARD_ACTION);
return action;
}
- };
+ };
/**
* Workbench action (id: "nextPart", commandId:
@@ -805,25 +771,23 @@ public abstract class ActionFactory {
* ActionFactory.linkCycleActionPair} to connect the two.
* </p>
*/
- public static final ActionFactory NEXT_PART = new ActionFactory("nextPart", //$NON-NLS-1$
- IWorkbenchCommandConstants.WINDOW_NEXT_VIEW) {
+ public static final ActionFactory NEXT_PART = new ActionFactory("nextPart", //$NON-NLS-1$
+ IWorkbenchCommandConstants.WINDOW_NEXT_VIEW) {
- @Override
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- WorkbenchCommandAction action = new WorkbenchCommandAction(
- getCommandId(), window);
- action.setId(getId());
- action.setText(WorkbenchMessages.CyclePartAction_next_text);
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
+ action.setId(getId());
+ action.setText(WorkbenchMessages.CyclePartAction_next_text);
action.setToolTipText(WorkbenchMessages.CyclePartAction_next_toolTip);
// @issue missing action ids
- window.getWorkbench().getHelpSystem().setHelp(action,
- IWorkbenchHelpContextIds.CYCLE_PART_FORWARD_ACTION);
- return action;
- }
- };
+ window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.CYCLE_PART_FORWARD_ACTION);
+ return action;
+ }
+ };
/**
* Workbench action (id: "nextPerspective", commandId:
@@ -836,114 +800,112 @@ public abstract class ActionFactory {
* to connect the two.
* </p>
*/
- public static final ActionFactory NEXT_PERSPECTIVE = new ActionFactory(
- "nextPerspective", IWorkbenchCommandConstants.WINDOW_NEXT_PERSPECTIVE) {//$NON-NLS-1$
-
- @Override
- public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- WorkbenchCommandAction action = new WorkbenchCommandAction(
- getCommandId(), window);
- action.setId(getId());
- action.setText(WorkbenchMessages.CyclePerspectiveAction_next_text);
- action.setToolTipText(WorkbenchMessages.CyclePerspectiveAction_next_toolTip);
- // @issue missing action ids
- window.getWorkbench().getHelpSystem().setHelp(action,
+ public static final ActionFactory NEXT_PERSPECTIVE = new ActionFactory("nextPerspective", //$NON-NLS-1$
+ IWorkbenchCommandConstants.WINDOW_NEXT_PERSPECTIVE) {
+
+ @Override
+ public IWorkbenchAction create(IWorkbenchWindow window) {
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
+ action.setId(getId());
+ action.setText(WorkbenchMessages.CyclePerspectiveAction_next_text);
+ action.setToolTipText(WorkbenchMessages.CyclePerspectiveAction_next_toolTip);
+ // @issue missing action ids
+ window.getWorkbench().getHelpSystem().setHelp(action,
IWorkbenchHelpContextIds.CYCLE_PERSPECTIVE_FORWARD_ACTION);
- return action;
- }
- };
+ return action;
+ }
+ };
/**
- * Workbench action (id: "openNewWindow", commandId: "org.eclipse.ui.window.newWindow"): Open a
- * new workbench window. This action maintains its enablement state.
+ * Workbench action (id: "openNewWindow", commandId:
+ * "org.eclipse.ui.window.newWindow"): Open a new workbench window. This action
+ * maintains its enablement state.
*/
- public static final ActionFactory OPEN_NEW_WINDOW = new ActionFactory(
- "openNewWindow", IWorkbenchCommandConstants.WINDOW_NEW_WINDOW) {//$NON-NLS-1$
+ public static final ActionFactory OPEN_NEW_WINDOW = new ActionFactory("openNewWindow", //$NON-NLS-1$
+ IWorkbenchCommandConstants.WINDOW_NEW_WINDOW) {
- @Override
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- WorkbenchCommandAction action = new WorkbenchCommandAction(
- getCommandId(), window);
- action.setId(getId());
- action.setText(WorkbenchMessages.OpenInNewWindowAction_text);
- action.setToolTipText(WorkbenchMessages.OpenInNewWindowAction_toolTip);
- window.getWorkbench().getHelpSystem().setHelp(action,
- IWorkbenchHelpContextIds.OPEN_NEW_WINDOW_ACTION);
- return action;
- }
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
+ action.setId(getId());
+ action.setText(WorkbenchMessages.OpenInNewWindowAction_text);
+ action.setToolTipText(WorkbenchMessages.OpenInNewWindowAction_toolTip);
+ window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.OPEN_NEW_WINDOW_ACTION);
+ return action;
+ }
- };
+ };
/**
- * Workbench action (id: "paste", commandId: "org.eclipse.ui.edit.paste"): Paste. This action is
- * a {@link RetargetAction} with id "paste". This action maintains its enablement state.
+ * Workbench action (id: "paste", commandId: "org.eclipse.ui.edit.paste"):
+ * Paste. This action is a {@link RetargetAction} with id "paste". This action
+ * maintains its enablement state.
*/
- public static final ActionFactory PASTE = new ActionFactory("paste", //$NON-NLS-1$
- IWorkbenchCommandConstants.EDIT_PASTE) {
+ public static final ActionFactory PASTE = new ActionFactory("paste", //$NON-NLS-1$
+ IWorkbenchCommandConstants.EDIT_PASTE) {
- @Override
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- RetargetAction action = new RetargetAction(getId(),WorkbenchMessages.Workbench_paste);
- action.setToolTipText(WorkbenchMessages.Workbench_pasteToolTip);
- window.getPartService().addPartListener(action);
- action.setActionDefinitionId(getCommandId());
- ISharedImages sharedImages = window.getWorkbench()
- .getSharedImages();
- action.setImageDescriptor(sharedImages
- .getImageDescriptor(ISharedImages.IMG_TOOL_PASTE));
- action.setDisabledImageDescriptor(sharedImages
- .getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED));
- return action;
- }
- };
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ RetargetAction action = new RetargetAction(getId(), WorkbenchMessages.Workbench_paste);
+ action.setToolTipText(WorkbenchMessages.Workbench_pasteToolTip);
+ window.getPartService().addPartListener(action);
+ action.setActionDefinitionId(getCommandId());
+ ISharedImages sharedImages = window.getWorkbench().getSharedImages();
+ action.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE));
+ action.setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED));
+ return action;
+ }
+ };
/**
- * Workbench action (id: "preferences", commandId: "org.eclipse.ui.window.preferences"):
- * Displays the Preferences dialog. This action maintains its enablement state.
+ * Workbench action (id: "preferences", commandId:
+ * "org.eclipse.ui.window.preferences"): Displays the Preferences dialog. This
+ * action maintains its enablement state.
*/
- public static final ActionFactory PREFERENCES = new ActionFactory(
- "preferences", IWorkbenchCommandConstants.WINDOW_PREFERENCES) {//$NON-NLS-1$
+ public static final ActionFactory PREFERENCES = new ActionFactory("preferences", //$NON-NLS-1$
+ IWorkbenchCommandConstants.WINDOW_PREFERENCES) {
- @Override
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- IWorkbenchAction action = new OpenPreferencesAction(window);
- action.setId(getId());
- return action;
- }
- };
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ IWorkbenchAction action = new OpenPreferencesAction(window);
+ action.setId(getId());
+ return action;
+ }
+ };
/**
- * Workbench action (id: "previous", commandId: "org.eclipse.ui.navigate.previous"): Previous.
- * This action is a {@link RetargetAction} with id "previous". This action maintains its
+ * Workbench action (id: "previous", commandId:
+ * "org.eclipse.ui.navigate.previous"): Previous. This action is a
+ * {@link RetargetAction} with id "previous". This action maintains its
* enablement state.
*/
- public static final ActionFactory PREVIOUS = new ActionFactory("previous", //$NON-NLS-1$
- IWorkbenchCommandConstants.NAVIGATE_PREVIOUS) {
+ public static final ActionFactory PREVIOUS = new ActionFactory("previous", //$NON-NLS-1$
+ IWorkbenchCommandConstants.NAVIGATE_PREVIOUS) {
- @Override
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- RetargetAction action = new LabelRetargetAction(getId(),WorkbenchMessages.Workbench_previous);
- action.setToolTipText(WorkbenchMessages.Workbench_previousToolTip);
- window.getPartService().addPartListener(action);
- action.setActionDefinitionId(getCommandId());
- return action;
- }
- };
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ RetargetAction action = new LabelRetargetAction(getId(), WorkbenchMessages.Workbench_previous);
+ action.setToolTipText(WorkbenchMessages.Workbench_previousToolTip);
+ window.getPartService().addPartListener(action);
+ action.setActionDefinitionId(getCommandId());
+ return action;
+ }
+ };
/**
* Workbench action (id: "previousEditor", commandId:
@@ -955,26 +917,25 @@ public abstract class ActionFactory {
* ActionFactory.linkCycleActionPair} to connect the two.
* </p>
*/
- public static final ActionFactory PREVIOUS_EDITOR = new ActionFactory(
- "previousEditor", IWorkbenchCommandConstants.WINDOW_PREVIOUS_EDITOR) {//$NON-NLS-1$
-
- @Override
- public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- IWorkbenchAction action = new WorkbenchCommandAction(
- getCommandId(), window);
- action.setId(getId());
- action.setText(WorkbenchMessages.CycleEditorAction_prev_text);
- action.setToolTipText(WorkbenchMessages.CycleEditorAction_prev_toolTip);
- // @issue missing action ids
- window.getWorkbench().getHelpSystem().setHelp(action,
+ public static final ActionFactory PREVIOUS_EDITOR = new ActionFactory("previousEditor", //$NON-NLS-1$
+ IWorkbenchCommandConstants.WINDOW_PREVIOUS_EDITOR) {
+
+ @Override
+ public IWorkbenchAction create(IWorkbenchWindow window) {
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ IWorkbenchAction action = new WorkbenchCommandAction(getCommandId(), window);
+ action.setId(getId());
+ action.setText(WorkbenchMessages.CycleEditorAction_prev_text);
+ action.setToolTipText(WorkbenchMessages.CycleEditorAction_prev_toolTip);
+ // @issue missing action ids
+ window.getWorkbench().getHelpSystem().setHelp(action,
IWorkbenchHelpContextIds.CYCLE_EDITOR_BACKWARD_ACTION);
- return action;
- }
- };
+ return action;
+ }
+ };
/**
* Workbench action (id: "previousPart", commandId:
@@ -986,25 +947,23 @@ public abstract class ActionFactory {
* ActionFactory.linkCycleActionPair} to connect the two.
* </p>
*/
- public static final ActionFactory PREVIOUS_PART = new ActionFactory(
- "previousPart", IWorkbenchCommandConstants.WINDOW_PREVIOUS_VIEW) {//$NON-NLS-1$
+ public static final ActionFactory PREVIOUS_PART = new ActionFactory("previousPart", //$NON-NLS-1$
+ IWorkbenchCommandConstants.WINDOW_PREVIOUS_VIEW) {
- @Override
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- WorkbenchCommandAction action = new WorkbenchCommandAction(
- getCommandId(), window);
- action.setId(getId());
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
+ action.setId(getId());
action.setText(WorkbenchMessages.CyclePartAction_prev_text);
action.setToolTipText(WorkbenchMessages.CyclePartAction_prev_toolTip);
// @issue missing action ids
- window.getWorkbench().getHelpSystem().setHelp(action,
- IWorkbenchHelpContextIds.CYCLE_PART_BACKWARD_ACTION);
- return action;
- }
- };
+ window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.CYCLE_PART_BACKWARD_ACTION);
+ return action;
+ }
+ };
/**
* Workbench action (id: "previousPerspective", commandId:
@@ -1017,171 +976,167 @@ public abstract class ActionFactory {
* to connect the two.
* </p>
*/
- public static final ActionFactory PREVIOUS_PERSPECTIVE = new ActionFactory(
- "previousPerspective", IWorkbenchCommandConstants.WINDOW_PREVIOUS_PERSPECTIVE) {//$NON-NLS-1$
-
- @Override
- public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- WorkbenchCommandAction action = new WorkbenchCommandAction(
- getCommandId(), window);
- action.setId(getId());
- action.setText(WorkbenchMessages.CyclePerspectiveAction_prev_text);
- action.setToolTipText(WorkbenchMessages.CyclePerspectiveAction_prev_toolTip);
- // @issue missing action ids
- window.getWorkbench().getHelpSystem().setHelp(action,
+ public static final ActionFactory PREVIOUS_PERSPECTIVE = new ActionFactory("previousPerspective", //$NON-NLS-1$
+ IWorkbenchCommandConstants.WINDOW_PREVIOUS_PERSPECTIVE) {
+
+ @Override
+ public IWorkbenchAction create(IWorkbenchWindow window) {
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
+ action.setId(getId());
+ action.setText(WorkbenchMessages.CyclePerspectiveAction_prev_text);
+ action.setToolTipText(WorkbenchMessages.CyclePerspectiveAction_prev_toolTip);
+ // @issue missing action ids
+ window.getWorkbench().getHelpSystem().setHelp(action,
IWorkbenchHelpContextIds.CYCLE_PERSPECTIVE_BACKWARD_ACTION);
- return action;
- }
- };
-
- /**
- * Workbench action (id: "print", commandId: "org.eclipse.ui.file.print"): Print. This action is
- * a {@link RetargetAction} with id "print". This action maintains its enablement state.
- */
- public static final ActionFactory PRINT = new ActionFactory("print", //$NON-NLS-1$
- IWorkbenchCommandConstants.FILE_PRINT) {
-
- @Override
- public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- RetargetAction action = new RetargetAction(getId(),WorkbenchMessages.Workbench_print);
- action.setToolTipText(WorkbenchMessages.Workbench_printToolTip);
- window.getPartService().addPartListener(action);
- action.setActionDefinitionId(getCommandId());
- action
- .setImageDescriptor(WorkbenchImages
- .getImageDescriptor(ISharedImages.IMG_ETOOL_PRINT_EDIT));
- action
- .setDisabledImageDescriptor(WorkbenchImages
- .getImageDescriptor(ISharedImages.IMG_ETOOL_PRINT_EDIT_DISABLED));
- return action;
- }
- };
-
- /**
- * Workbench action (id: "properties", commandId: "org.eclipse.ui.file.properties"): Properties.
- * This action is a {@link RetargetAction} with id "properties". This action maintains its
+ return action;
+ }
+ };
+
+ /**
+ * Workbench action (id: "print", commandId: "org.eclipse.ui.file.print"):
+ * Print. This action is a {@link RetargetAction} with id "print". This action
+ * maintains its enablement state.
+ */
+ public static final ActionFactory PRINT = new ActionFactory("print", //$NON-NLS-1$
+ IWorkbenchCommandConstants.FILE_PRINT) {
+
+ @Override
+ public IWorkbenchAction create(IWorkbenchWindow window) {
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ RetargetAction action = new RetargetAction(getId(), WorkbenchMessages.Workbench_print);
+ action.setToolTipText(WorkbenchMessages.Workbench_printToolTip);
+ window.getPartService().addPartListener(action);
+ action.setActionDefinitionId(getCommandId());
+ action.setImageDescriptor(WorkbenchImages.getImageDescriptor(ISharedImages.IMG_ETOOL_PRINT_EDIT));
+ action.setDisabledImageDescriptor(
+ WorkbenchImages.getImageDescriptor(ISharedImages.IMG_ETOOL_PRINT_EDIT_DISABLED));
+ return action;
+ }
+ };
+
+ /**
+ * Workbench action (id: "properties", commandId:
+ * "org.eclipse.ui.file.properties"): Properties. This action is a
+ * {@link RetargetAction} with id "properties". This action maintains its
* enablement state.
*/
- public static final ActionFactory PROPERTIES = new ActionFactory(
- "properties", IWorkbenchCommandConstants.FILE_PROPERTIES) {//$NON-NLS-1$
-
- @Override
- public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- RetargetAction action = new RetargetAction(getId(),WorkbenchMessages.Workbench_properties);
- action.setToolTipText(WorkbenchMessages.Workbench_propertiesToolTip);
- window.getPartService().addPartListener(action);
- action.setActionDefinitionId(getCommandId());
- return action;
- }
- };
+ public static final ActionFactory PROPERTIES = new ActionFactory("properties", //$NON-NLS-1$
+ IWorkbenchCommandConstants.FILE_PROPERTIES) {
+
+ @Override
+ public IWorkbenchAction create(IWorkbenchWindow window) {
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ RetargetAction action = new RetargetAction(getId(), WorkbenchMessages.Workbench_properties);
+ action.setToolTipText(WorkbenchMessages.Workbench_propertiesToolTip);
+ window.getPartService().addPartListener(action);
+ action.setActionDefinitionId(getCommandId());
+ return action;
+ }
+ };
/**
- * Workbench action (id: "quit", commandId: "org.eclipse.ui.file.exit"): Quit (close the
- * workbench). This action maintains its enablement state.
+ * Workbench action (id: "quit", commandId: "org.eclipse.ui.file.exit"): Quit
+ * (close the workbench). This action maintains its enablement state.
*/
- public static final ActionFactory QUIT = new ActionFactory("quit", //$NON-NLS-1$
- IWorkbenchCommandConstants.FILE_EXIT) {
+ public static final ActionFactory QUIT = new ActionFactory("quit", //$NON-NLS-1$
+ IWorkbenchCommandConstants.FILE_EXIT) {
- @Override
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- WorkbenchCommandAction action = new WorkbenchCommandAction(
- getCommandId(), window);
- action.setId(getId());
- action.setText(WorkbenchMessages.Exit_text);
- action.setToolTipText(WorkbenchMessages.Exit_toolTip);
- window.getWorkbench().getHelpSystem().setHelp(action,
- IWorkbenchHelpContextIds.QUIT_ACTION);
- return action;
- }
- };
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
+ action.setId(getId());
+ action.setText(WorkbenchMessages.Exit_text);
+ action.setToolTipText(WorkbenchMessages.Exit_toolTip);
+ window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.QUIT_ACTION);
+ return action;
+ }
+ };
/**
- * Workbench action (id: "redo", commandId: "org.eclipse.ui.edit.redo"): Redo. This action is a
- * {@link RetargetAction} with id "redo". This action maintains its enablement state.
+ * Workbench action (id: "redo", commandId: "org.eclipse.ui.edit.redo"): Redo.
+ * This action is a {@link RetargetAction} with id "redo". This action maintains
+ * its enablement state.
*/
- public static final ActionFactory REDO = new ActionFactory("redo", //$NON-NLS-1$
- IWorkbenchCommandConstants.EDIT_REDO) {
+ public static final ActionFactory REDO = new ActionFactory("redo", //$NON-NLS-1$
+ IWorkbenchCommandConstants.EDIT_REDO) {
- @Override
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- LabelRetargetAction action = new LabelRetargetAction(getId(),WorkbenchMessages.Workbench_redo);
- action.setToolTipText(WorkbenchMessages.Workbench_redoToolTip);
- window.getPartService().addPartListener(action);
- action.setActionDefinitionId(getCommandId());
- ISharedImages sharedImages = window.getWorkbench()
- .getSharedImages();
- action.setImageDescriptor(sharedImages
- .getImageDescriptor(ISharedImages.IMG_TOOL_REDO));
- action.setDisabledImageDescriptor(sharedImages
- .getImageDescriptor(ISharedImages.IMG_TOOL_REDO_DISABLED));
- return action;
- }
- };
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ LabelRetargetAction action = new LabelRetargetAction(getId(), WorkbenchMessages.Workbench_redo);
+ action.setToolTipText(WorkbenchMessages.Workbench_redoToolTip);
+ window.getPartService().addPartListener(action);
+ action.setActionDefinitionId(getCommandId());
+ ISharedImages sharedImages = window.getWorkbench().getSharedImages();
+ action.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_REDO));
+ action.setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_REDO_DISABLED));
+ return action;
+ }
+ };
/**
- * Workbench action (id: "refresh", commandId: "org.eclipse.ui.file.refresh"): Refresh. This
- * action is a {@link RetargetAction} with id "refresh". This action maintains its enablement
- * state.
+ * Workbench action (id: "refresh", commandId: "org.eclipse.ui.file.refresh"):
+ * Refresh. This action is a {@link RetargetAction} with id "refresh". This
+ * action maintains its enablement state.
*/
- public static final ActionFactory REFRESH = new ActionFactory("refresh", //$NON-NLS-1$
- IWorkbenchCommandConstants.FILE_REFRESH) {
+ public static final ActionFactory REFRESH = new ActionFactory("refresh", //$NON-NLS-1$
+ IWorkbenchCommandConstants.FILE_REFRESH) {
- @Override
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- RetargetAction action = new RetargetAction(getId(),WorkbenchMessages.Workbench_refresh);
- action.setToolTipText(WorkbenchMessages.Workbench_refreshToolTip);
- window.getPartService().addPartListener(action);
- action.setActionDefinitionId(getCommandId());
- return action;
- }
- };
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ RetargetAction action = new RetargetAction(getId(), WorkbenchMessages.Workbench_refresh);
+ action.setToolTipText(WorkbenchMessages.Workbench_refreshToolTip);
+ window.getPartService().addPartListener(action);
+ action.setActionDefinitionId(getCommandId());
+ return action;
+ }
+ };
/**
- * Workbench action (id: "rename", commandId: "org.eclipse.ui.edit.rename"): Rename. This action
- * is a {@link RetargetAction} with id "rename". This action maintains its enablement state.
+ * Workbench action (id: "rename", commandId: "org.eclipse.ui.edit.rename"):
+ * Rename. This action is a {@link RetargetAction} with id "rename". This action
+ * maintains its enablement state.
*/
- public static final ActionFactory RENAME = new ActionFactory("rename", //$NON-NLS-1$
- IWorkbenchCommandConstants.FILE_RENAME) {
+ public static final ActionFactory RENAME = new ActionFactory("rename", //$NON-NLS-1$
+ IWorkbenchCommandConstants.FILE_RENAME) {
- @Override
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- RetargetAction action = new RetargetAction(getId(),WorkbenchMessages.Workbench_rename);
- action.setToolTipText(WorkbenchMessages.Workbench_renameToolTip);
- window.getPartService().addPartListener(action);
- action.setActionDefinitionId(getCommandId());
- return action;
- }
- };
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ RetargetAction action = new RetargetAction(getId(), WorkbenchMessages.Workbench_rename);
+ action.setToolTipText(WorkbenchMessages.Workbench_renameToolTip);
+ window.getPartService().addPartListener(action);
+ action.setActionDefinitionId(getCommandId());
+ return action;
+ }
+ };
/**
- * Workbench action (id: "resetPerspective", commandId: "org.eclipse.ui.window.resetPerspective"):
- * Resets the current perspective. This action maintains its enablement state.
+ * Workbench action (id: "resetPerspective", commandId:
+ * "org.eclipse.ui.window.resetPerspective"): Resets the current perspective.
+ * This action maintains its enablement state.
*/
- public static final ActionFactory RESET_PERSPECTIVE = new ActionFactory(
- "resetPerspective", IWorkbenchCommandConstants.WINDOW_RESET_PERSPECTIVE) {//$NON-NLS-1$
+ public static final ActionFactory RESET_PERSPECTIVE = new ActionFactory("resetPerspective", //$NON-NLS-1$
+ IWorkbenchCommandConstants.WINDOW_RESET_PERSPECTIVE) {
- @Override
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
if (window == null) {
throw new IllegalArgumentException();
@@ -1191,106 +1146,105 @@ public abstract class ActionFactory {
action.setId(getId());
action.setText(WorkbenchMessages.ResetPerspective_text);
action.setToolTipText(WorkbenchMessages.ResetPerspective_toolTip);
- window.getWorkbench().getHelpSystem()
- .setHelp(action, IWorkbenchHelpContextIds.RESET_PERSPECTIVE_ACTION);
+ window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.RESET_PERSPECTIVE_ACTION);
return action;
- }
- };
+ }
+ };
/**
- * Workbench action (id: "revert", commandId: "org.eclipse.ui.file.revert"): Revert. This action
- * is a {@link RetargetAction} with id "revert". This action maintains its enablement state.
+ * Workbench action (id: "revert", commandId: "org.eclipse.ui.file.revert"):
+ * Revert. This action is a {@link RetargetAction} with id "revert". This action
+ * maintains its enablement state.
*/
- public static final ActionFactory REVERT = new ActionFactory("revert", //$NON-NLS-1$
- IWorkbenchCommandConstants.FILE_REVERT) {
+ public static final ActionFactory REVERT = new ActionFactory("revert", //$NON-NLS-1$
+ IWorkbenchCommandConstants.FILE_REVERT) {
- @Override
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- RetargetAction action = new RetargetAction(getId(),WorkbenchMessages.Workbench_revert);
- action.setToolTipText(WorkbenchMessages.Workbench_revertToolTip);
- window.getPartService().addPartListener(action);
- action.setActionDefinitionId(getCommandId());
- return action;
- }
- };
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ RetargetAction action = new RetargetAction(getId(), WorkbenchMessages.Workbench_revert);
+ action.setToolTipText(WorkbenchMessages.Workbench_revertToolTip);
+ window.getPartService().addPartListener(action);
+ action.setActionDefinitionId(getCommandId());
+ return action;
+ }
+ };
/**
- * Workbench action (id: "save", commandId: "org.eclipse.ui.file.save"): Save the active editor.
- * This action maintains its enablement state.
+ * Workbench action (id: "save", commandId: "org.eclipse.ui.file.save"): Save
+ * the active editor. This action maintains its enablement state.
*/
- public static final ActionFactory SAVE = new ActionFactory("save", //$NON-NLS-1$
- IWorkbenchCommandConstants.FILE_SAVE) {
+ public static final ActionFactory SAVE = new ActionFactory("save", //$NON-NLS-1$
+ IWorkbenchCommandConstants.FILE_SAVE) {
- @Override
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
action.setText(WorkbenchMessages.SaveAction_text);
action.setToolTipText(WorkbenchMessages.SaveAction_toolTip);
- action.setId(getId());
- window.getWorkbench().getHelpSystem()
- .setHelp(action, IWorkbenchHelpContextIds.SAVE_ACTION);
- return action;
- }
- };
+ action.setId(getId());
+ window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.SAVE_ACTION);
+ return action;
+ }
+ };
/**
- * Workbench action (id: "saveAll", commandId: "org.eclipse.ui.file.saveAll"): Save all open
- * editors with unsaved changes. This action maintains its enablement state.
+ * Workbench action (id: "saveAll", commandId: "org.eclipse.ui.file.saveAll"):
+ * Save all open editors with unsaved changes. This action maintains its
+ * enablement state.
*/
- public static final ActionFactory SAVE_ALL = new ActionFactory("saveAll", //$NON-NLS-1$
- IWorkbenchCommandConstants.FILE_SAVE_ALL) {
+ public static final ActionFactory SAVE_ALL = new ActionFactory("saveAll", //$NON-NLS-1$
+ IWorkbenchCommandConstants.FILE_SAVE_ALL) {
- @Override
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
IWorkbenchAction action = new WorkbenchCommandAction(getCommandId(), window);
action.setText(WorkbenchMessages.SaveAll_text);
action.setToolTipText(WorkbenchMessages.SaveAll_toolTip);
- window.getWorkbench().getHelpSystem()
- .setHelp(action, IWorkbenchHelpContextIds.SAVE_ALL_ACTION);
- action.setId(getId());
- return action;
- }
- };
+ window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.SAVE_ALL_ACTION);
+ action.setId(getId());
+ return action;
+ }
+ };
/**
- * Workbench action (id: "saveAs", commandId: "org.eclipse.ui.file.saveAs"): Save As for the
- * active editor. This action maintains its enablement state.
+ * Workbench action (id: "saveAs", commandId: "org.eclipse.ui.file.saveAs"):
+ * Save As for the active editor. This action maintains its enablement state.
*/
- public static final ActionFactory SAVE_AS = new ActionFactory("saveAs", //$NON-NLS-1$
- IWorkbenchCommandConstants.FILE_SAVE_AS) {
+ public static final ActionFactory SAVE_AS = new ActionFactory("saveAs", //$NON-NLS-1$
+ IWorkbenchCommandConstants.FILE_SAVE_AS) {
- @Override
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
IWorkbenchAction action = new WorkbenchCommandAction(getCommandId(), window);
action.setText(WorkbenchMessages.SaveAs_text);
action.setToolTipText(WorkbenchMessages.SaveAs_toolTip);
- window.getWorkbench().getHelpSystem()
- .setHelp(action, IWorkbenchHelpContextIds.SAVE_AS_ACTION);
- action.setId(getId());
- return action;
- }
- };
+ window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.SAVE_AS_ACTION);
+ action.setId(getId());
+ return action;
+ }
+ };
/**
- * Workbench action (id: "savePerspective", commandId: "org.eclipse.ui.window.savePerspective"):
- * Save the current perspective. This action maintains its enablement state.
+ * Workbench action (id: "savePerspective", commandId:
+ * "org.eclipse.ui.window.savePerspective"): Save the current perspective. This
+ * action maintains its enablement state.
*/
- public static final ActionFactory SAVE_PERSPECTIVE = new ActionFactory(
- "savePerspective", IWorkbenchCommandConstants.WINDOW_SAVE_PERSPECTIVE_AS) {//$NON-NLS-1$
+ public static final ActionFactory SAVE_PERSPECTIVE = new ActionFactory("savePerspective", //$NON-NLS-1$
+ IWorkbenchCommandConstants.WINDOW_SAVE_PERSPECTIVE_AS) {
- @Override
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
if (window == null) {
throw new IllegalArgumentException();
@@ -1300,102 +1254,98 @@ public abstract class ActionFactory {
action.setId(getId());
action.setText(WorkbenchMessages.SavePerspective_text);
action.setToolTipText(WorkbenchMessages.SavePerspective_toolTip);
- window.getWorkbench().getHelpSystem()
- .setHelp(action, IWorkbenchHelpContextIds.SAVE_PERSPECTIVE_ACTION);
+ window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.SAVE_PERSPECTIVE_ACTION);
return action;
}
- };
+ };
/**
- * Workbench action (id: "selectAll", commandId: "org.eclipse.ui.edit.selectAll"): Select All.
- * This action is a {@link RetargetAction} with id "selectAll". This action maintains its
+ * Workbench action (id: "selectAll", commandId:
+ * "org.eclipse.ui.edit.selectAll"): Select All. This action is a
+ * {@link RetargetAction} with id "selectAll". This action maintains its
* enablement state.
*/
- public static final ActionFactory SELECT_ALL = new ActionFactory(
- "selectAll", IWorkbenchCommandConstants.EDIT_SELECT_ALL) {//$NON-NLS-1$
+ public static final ActionFactory SELECT_ALL = new ActionFactory("selectAll", //$NON-NLS-1$
+ IWorkbenchCommandConstants.EDIT_SELECT_ALL) {
- @Override
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- RetargetAction action = new RetargetAction(getId(),WorkbenchMessages.Workbench_selectAll);
- action.setToolTipText(WorkbenchMessages.Workbench_selectAllToolTip);
- window.getPartService().addPartListener(action);
- action.setActionDefinitionId(getCommandId());
- return action;
- }
- };
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ RetargetAction action = new RetargetAction(getId(), WorkbenchMessages.Workbench_selectAll);
+ action.setToolTipText(WorkbenchMessages.Workbench_selectAllToolTip);
+ window.getPartService().addPartListener(action);
+ action.setActionDefinitionId(getCommandId());
+ return action;
+ }
+ };
/**
- * Workbench action (id: "showEditor"): Show/hide the editor area. This action maintains its
- * enablement state.
+ * Workbench action (id: "showEditor"): Show/hide the editor area. This action
+ * maintains its enablement state.
*/
- public static final ActionFactory SHOW_EDITOR = new ActionFactory(
- "showEditor") {//$NON-NLS-1$
+ public static final ActionFactory SHOW_EDITOR = new ActionFactory("showEditor") {//$NON-NLS-1$
- @Override
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- IWorkbenchAction action = new ToggleEditorsVisibilityAction(window);
- action.setId(getId());
- return action;
- }
- };
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ IWorkbenchAction action = new ToggleEditorsVisibilityAction(window);
+ action.setId(getId());
+ return action;
+ }
+ };
/**
- * Workbench action (id: "showOpenEditors"): Show a list of open (and recently closed) editors.
- * This action maintains its enablement state.
+ * Workbench action (id: "showOpenEditors"): Show a list of open (and recently
+ * closed) editors. This action maintains its enablement state.
*/
- public static final ActionFactory SHOW_OPEN_EDITORS = new ActionFactory(
- "showOpenEditors") {//$NON-NLS-1$
+ public static final ActionFactory SHOW_OPEN_EDITORS = new ActionFactory("showOpenEditors") {//$NON-NLS-1$
- @Override
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- WorkbenchCommandAction action = new WorkbenchCommandAction("org.eclipse.ui.window.switchToEditor", window); //$NON-NLS-1$
- action.setId(getId());
- action.setText(WorkbenchMessages.WorkbenchEditorsAction_label);
- // @issue missing action id
- window.getWorkbench().getHelpSystem().setHelp(action,
- IWorkbenchHelpContextIds.WORKBENCH_EDITORS_ACTION);
- return action;
- }
- };
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ WorkbenchCommandAction action = new WorkbenchCommandAction("org.eclipse.ui.window.switchToEditor", window); //$NON-NLS-1$
+ action.setId(getId());
+ action.setText(WorkbenchMessages.WorkbenchEditorsAction_label);
+ // @issue missing action id
+ window.getWorkbench().getHelpSystem().setHelp(action, IWorkbenchHelpContextIds.WORKBENCH_EDITORS_ACTION);
+ return action;
+ }
+ };
/**
- * Workbench action (id: "showWorkbookEditors"): Shows a list of open editors in the current or
- * last active workbook.
+ * Workbench action (id: "showWorkbookEditors"): Shows a list of open editors in
+ * the current or last active workbook.
*/
- public static final ActionFactory SHOW_WORKBOOK_EDITORS = new ActionFactory(
- "showWorkBookEditors") {//$NON-NLS-1$
+ public static final ActionFactory SHOW_WORKBOOK_EDITORS = new ActionFactory("showWorkBookEditors") {//$NON-NLS-1$
- @Override
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
- WorkbenchCommandAction action = new WorkbenchCommandAction("org.eclipse.ui.window.openEditorDropDown", window); //$NON-NLS-1$
- action.setId(getId());
- action.setText(WorkbenchMessages.WorkbookEditorsAction_label);
+ WorkbenchCommandAction action = new WorkbenchCommandAction("org.eclipse.ui.window.openEditorDropDown", //$NON-NLS-1$
+ window);
+ action.setId(getId());
+ action.setText(WorkbenchMessages.WorkbookEditorsAction_label);
- return action;
- }
- };
+ return action;
+ }
+ };
/**
- * Workbench action (id: "showQuickAccess"): Shows a list of UI elements like editors, views,
- * perspectives etc.
+ * Workbench action (id: "showQuickAccess"): Shows a list of UI elements like
+ * editors, views, perspectives etc.
*
* @since 3.3
*/
- public static final ActionFactory SHOW_QUICK_ACCESS = new ActionFactory(
- "showQuickAccess") { //$NON-NLS-1$
+ public static final ActionFactory SHOW_QUICK_ACCESS = new ActionFactory("showQuickAccess") { //$NON-NLS-1$
@Override
public IWorkbenchAction create(IWorkbenchWindow window) {
@@ -1409,219 +1359,219 @@ public abstract class ActionFactory {
};
/**
- * Workbench action (id: "showPartPaneMenu"): Show the part pane menu. This action maintains its
- * enablement state.
+ * Workbench action (id: "showPartPaneMenu"): Show the part pane menu. This
+ * action maintains its enablement state.
+ */
+ public static final ActionFactory SHOW_PART_PANE_MENU = new ActionFactory("showPartPaneMenu") {//$NON-NLS-1$
+
+ @Override
+ public IWorkbenchAction create(IWorkbenchWindow window) {
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ WorkbenchCommandAction action = new WorkbenchCommandAction("org.eclipse.ui.window.showSystemMenu", window); //$NON-NLS-1$
+ action.setId(getId());
+ action.setText(WorkbenchMessages.ShowPartPaneMenuAction_text);
+ action.setToolTipText(WorkbenchMessages.ShowPartPaneMenuAction_toolTip);
+ return action;
+ }
+ };
+
+ /**
+ * Workbench action (id: "showViewMenu", commandId:
+ * "org.eclipse.ui.window.showViewMenu"): Show the view menu. This action
+ * maintains its enablement state.
+ */
+ public static final ActionFactory SHOW_VIEW_MENU = new ActionFactory("showViewMenu", //$NON-NLS-1$
+ IWorkbenchCommandConstants.WINDOW_SHOW_VIEW_MENU) {
+
+ @Override
+ public IWorkbenchAction create(IWorkbenchWindow window) {
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
+ action.setId(getId());
+ action.setText(WorkbenchMessages.ShowViewMenuAction_text);
+ action.setToolTipText(WorkbenchMessages.ShowViewMenuAction_toolTip);
+ return action;
+ }
+ };
+
+ /**
+ * Workbench action (id: "undo", commandId: "org.eclipse.ui.edit.undo"): Undo.
+ * This action is a {@link RetargetAction} with id "undo". This action maintains
+ * its enablement state.
+ */
+ public static final ActionFactory UNDO = new ActionFactory("undo", //$NON-NLS-1$
+ IWorkbenchCommandConstants.EDIT_UNDO) {
+
+ @Override
+ public IWorkbenchAction create(IWorkbenchWindow window) {
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ LabelRetargetAction action = new LabelRetargetAction(getId(), WorkbenchMessages.Workbench_undo);
+ action.setToolTipText(WorkbenchMessages.Workbench_undoToolTip);
+ window.getPartService().addPartListener(action);
+ action.setActionDefinitionId(getCommandId());
+ ISharedImages sharedImages = window.getWorkbench().getSharedImages();
+ action.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_UNDO));
+ action.setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_UNDO_DISABLED));
+ return action;
+ }
+ };
+
+ /**
+ * Workbench action (id: "up", commandId: "org.eclipse.ui.navigate.up"): Up.
+ * This action is a {@link RetargetAction} with id "up". This action maintains
+ * its enablement state.
+ */
+ public static final ActionFactory UP = new ActionFactory("up", //$NON-NLS-1$
+ IWorkbenchCommandConstants.NAVIGATE_UP) {
+
+ @Override
+ public IWorkbenchAction create(IWorkbenchWindow window) {
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ RetargetAction action = new LabelRetargetAction(getId(), WorkbenchMessages.Workbench_up);
+ action.setToolTipText(WorkbenchMessages.Workbench_upToolTip);
+ window.getPartService().addPartListener(action);
+ action.setActionDefinitionId(getCommandId());
+ return action;
+ }
+ };
+
+ /**
+ * Workbench action (id: "helpContents", commandId:
+ * "org.eclipse.ui.help.helpContents"): Open the help contents. This action is
+ * always enabled.
*/
- public static final ActionFactory SHOW_PART_PANE_MENU = new ActionFactory(
- "showPartPaneMenu") {//$NON-NLS-1$
-
- @Override
- public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- WorkbenchCommandAction action=new WorkbenchCommandAction("org.eclipse.ui.window.showSystemMenu",window); //$NON-NLS-1$
- action.setId(getId());
- action.setText(WorkbenchMessages.ShowPartPaneMenuAction_text);
- action.setToolTipText(WorkbenchMessages.ShowPartPaneMenuAction_toolTip);
- return action;
- }
- };
-
- /**
- * Workbench action (id: "showViewMenu", commandId: "org.eclipse.ui.window.showViewMenu"): Show
- * the view menu. This action maintains its enablement state.
- */
- public static final ActionFactory SHOW_VIEW_MENU = new ActionFactory(
- "showViewMenu", IWorkbenchCommandConstants.WINDOW_SHOW_VIEW_MENU) {//$NON-NLS-1$
-
- @Override
- public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- WorkbenchCommandAction action = new WorkbenchCommandAction(
- getCommandId(), window);
- action.setId(getId());
- action.setText(WorkbenchMessages.ShowViewMenuAction_text);
- action.setToolTipText(WorkbenchMessages.ShowViewMenuAction_toolTip);
- return action;
- }
- };
-
- /**
- * Workbench action (id: "undo", commandId: "org.eclipse.ui.edit.undo"): Undo. This action is a
- * {@link RetargetAction} with id "undo". This action maintains its enablement state.
- */
- public static final ActionFactory UNDO = new ActionFactory("undo", //$NON-NLS-1$
- IWorkbenchCommandConstants.EDIT_UNDO) {
-
- @Override
- public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- LabelRetargetAction action = new LabelRetargetAction(getId(),WorkbenchMessages.Workbench_undo);
- action.setToolTipText(WorkbenchMessages.Workbench_undoToolTip);
- window.getPartService().addPartListener(action);
- action.setActionDefinitionId(getCommandId());
- ISharedImages sharedImages = window.getWorkbench()
- .getSharedImages();
- action.setImageDescriptor(sharedImages
- .getImageDescriptor(ISharedImages.IMG_TOOL_UNDO));
- action.setDisabledImageDescriptor(sharedImages
- .getImageDescriptor(ISharedImages.IMG_TOOL_UNDO_DISABLED));
- return action;
- }
- };
-
- /**
- * Workbench action (id: "up", commandId: "org.eclipse.ui.navigate.up"): Up. This action is a
- * {@link RetargetAction} with id "up". This action maintains its enablement state.
- */
- public static final ActionFactory UP = new ActionFactory("up", //$NON-NLS-1$
- IWorkbenchCommandConstants.NAVIGATE_UP) {
-
- @Override
- public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- RetargetAction action = new LabelRetargetAction(getId(),WorkbenchMessages.Workbench_up);
- action.setToolTipText(WorkbenchMessages.Workbench_upToolTip);
- window.getPartService().addPartListener(action);
- action.setActionDefinitionId(getCommandId());
- return action;
- }
- };
-
- /**
- * Workbench action (id: "helpContents", commandId: "org.eclipse.ui.help.helpContents"): Open
- * the help contents. This action is always enabled.
- */
- public static final ActionFactory HELP_CONTENTS = new ActionFactory(
- "helpContents", IWorkbenchCommandConstants.HELP_HELP_CONTENTS) {//$NON-NLS-1$
-
- @Override
- public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- IWorkbenchAction action = new HelpContentsAction(window);
- action.setId(getId());
- return action;
- }
- };
-
- /**
- * Workbench action (id: "helpSearch", commandId: "org.eclipse.ui.help.helpSearch"): Open the
- * help search. This action is always enabled.
+ public static final ActionFactory HELP_CONTENTS = new ActionFactory("helpContents", //$NON-NLS-1$
+ IWorkbenchCommandConstants.HELP_HELP_CONTENTS) {
+
+ @Override
+ public IWorkbenchAction create(IWorkbenchWindow window) {
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ IWorkbenchAction action = new HelpContentsAction(window);
+ action.setId(getId());
+ return action;
+ }
+ };
+
+ /**
+ * Workbench action (id: "helpSearch", commandId:
+ * "org.eclipse.ui.help.helpSearch"): Open the help search. This action is
+ * always enabled.
*
* @since 3.1
*/
- public static final ActionFactory HELP_SEARCH = new ActionFactory(
- "helpSearch", IWorkbenchCommandConstants.HELP_HELP_SEARCH) {//$NON-NLS-1$
+ public static final ActionFactory HELP_SEARCH = new ActionFactory("helpSearch", //$NON-NLS-1$
+ IWorkbenchCommandConstants.HELP_HELP_SEARCH) {
- @Override
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- IWorkbenchAction action = new HelpSearchAction(window);
- action.setId(getId());
- return action;
- }
- };
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ IWorkbenchAction action = new HelpSearchAction(window);
+ action.setId(getId());
+ return action;
+ }
+ };
/**
- * Workbench action (id: "dynamicHelp", commandId: "org.eclipse.ui.help.dynamicHelp"): Open the
- * dynamic help. This action is always enabled.
+ * Workbench action (id: "dynamicHelp", commandId:
+ * "org.eclipse.ui.help.dynamicHelp"): Open the dynamic help. This action is
+ * always enabled.
*
* @since 3.1
*/
- public static final ActionFactory DYNAMIC_HELP = new ActionFactory(
- "dynamicHelp", IWorkbenchCommandConstants.HELP_DYNAMIC_HELP) {//$NON-NLS-1$
+ public static final ActionFactory DYNAMIC_HELP = new ActionFactory("dynamicHelp", //$NON-NLS-1$
+ IWorkbenchCommandConstants.HELP_DYNAMIC_HELP) {
- @Override
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- IWorkbenchAction action = new DynamicHelpAction(window);
- action.setId(getId());
- return action;
- }
- };
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ IWorkbenchAction action = new DynamicHelpAction(window);
+ action.setId(getId());
+ return action;
+ }
+ };
/**
- * Workbench action (id: "openPerspectiveDialog", commandId: "org.eclipse.ui.perspectives.showPerspective"):
- * Open the Open Perspective dialog. This action is always enabled.
+ * Workbench action (id: "openPerspectiveDialog", commandId:
+ * "org.eclipse.ui.perspectives.showPerspective"): Open the Open Perspective
+ * dialog. This action is always enabled.
*
* @since 3.1
*/
- public static final ActionFactory OPEN_PERSPECTIVE_DIALOG = new ActionFactory(
- "openPerspectiveDialog", IWorkbenchCommandConstants.PERSPECTIVES_SHOW_PERSPECTIVE) {//$NON-NLS-1$
+ public static final ActionFactory OPEN_PERSPECTIVE_DIALOG = new ActionFactory("openPerspectiveDialog", //$NON-NLS-1$
+ IWorkbenchCommandConstants.PERSPECTIVES_SHOW_PERSPECTIVE) {
- @Override
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
if (window == null) {
throw new IllegalArgumentException();
}
- WorkbenchCommandAction action = new WorkbenchCommandAction(
- getCommandId(), window);
+ WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
action.setId(getId());
- action.setText(WorkbenchMessages.OpenPerspectiveDialogAction_text);
- action.setToolTipText(WorkbenchMessages.OpenPerspectiveDialogAction_tooltip);
- action.setImageDescriptor(WorkbenchImages.getImageDescriptor(
- IWorkbenchGraphicConstants.IMG_ETOOL_NEW_PAGE));
+ action.setText(WorkbenchMessages.OpenPerspectiveDialogAction_text);
+ action.setToolTipText(WorkbenchMessages.OpenPerspectiveDialogAction_tooltip);
+ action.setImageDescriptor(
+ WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_NEW_PAGE));
return action;
- }
- };
+ }
+ };
/**
- * Workbench action (id: "newEditor", commandId: "org.eclipse.ui.window.newEditor"): Open a new
- * editor on the active editor's input. This action maintains its enablement state.
+ * Workbench action (id: "newEditor", commandId:
+ * "org.eclipse.ui.window.newEditor"): Open a new editor on the active editor's
+ * input. This action maintains its enablement state.
*
* @since 3.1
*/
- public static final ActionFactory NEW_EDITOR = new ActionFactory(
- "newEditor", IWorkbenchCommandConstants.WINDOW_NEW_EDITOR) {//$NON-NLS-1$
+ public static final ActionFactory NEW_EDITOR = new ActionFactory("newEditor", //$NON-NLS-1$
+ IWorkbenchCommandConstants.WINDOW_NEW_EDITOR) {
- @Override
+ @Override
public IWorkbenchAction create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
- WorkbenchCommandAction action = new WorkbenchCommandAction(
- getCommandId(), window);
+ WorkbenchCommandAction action = new WorkbenchCommandAction(getCommandId(), window);
action.setId(getId());
action.setText(WorkbenchMessages.NewEditorAction_text);
action.setToolTipText(WorkbenchMessages.NewEditorAction_tooltip);
return action;
- }
- };
+ }
+ };
/**
- * Workbench action (id: "toggleCoolbar"): Toggle the visibility of the coolbar and perspective
- * switcher. This will only enable visibility of the coolbar and perspective bar if the window
- * advisor creating the window allowed for their visibility initially.
+ * Workbench action (id: "toggleCoolbar"): Toggle the visibility of the coolbar
+ * and perspective switcher. This will only enable visibility of the coolbar and
+ * perspective bar if the window advisor creating the window allowed for their
+ * visibility initially.
*
* @since 3.3
*/
- public static final ActionFactory TOGGLE_COOLBAR = new ActionFactory(
- "toggleCoolbar") { //$NON-NLS-1$
+ public static final ActionFactory TOGGLE_COOLBAR = new ActionFactory("toggleCoolbar") { //$NON-NLS-1$
@Override
public IWorkbenchAction create(IWorkbenchWindow window) {
if (window == null) {
throw new IllegalArgumentException();
}
- WorkbenchCommandAction action = new WorkbenchCommandAction(
- "org.eclipse.ui.ToggleCoolbarAction", window); //$NON-NLS-1$
+ WorkbenchCommandAction action = new WorkbenchCommandAction("org.eclipse.ui.ToggleCoolbarAction", window); //$NON-NLS-1$
action.setId(getId());
// set the default text - this will be updated by the handler
action.setText(WorkbenchMessages.ToggleCoolbarVisibilityAction_hide_text);
@@ -1630,7 +1580,7 @@ public abstract class ActionFactory {
}
};
- /**
+ /**
* Establishes bi-direction connections between the forward and backward actions
* of a cycle pair.
* <p>
@@ -1646,81 +1596,75 @@ public abstract class ActionFactory {
* @param next the action that moves forward
* @param previous the action that moves backward
*/
- public static void linkCycleActionPair(IWorkbenchAction next,
- IWorkbenchAction previous) {
- }
+ public static void linkCycleActionPair(IWorkbenchAction next, IWorkbenchAction previous) {
+ }
- /**
- * Id of actions created by this action factory.
- */
- private final String actionId;
+ /**
+ * Id of actions created by this action factory.
+ */
+ private final String actionId;
- /**
- * Optional ID for this action.
- */
- private final String commandId;
+ /**
+ * Optional ID for this action.
+ */
+ private final String commandId;
- /**
- * Creates a new workbench action factory with the given id.
- *
- * @param actionId
- * the id of actions created by this action factory
- */
- protected ActionFactory(String actionId) {
- this(actionId, null);
- }
+ /**
+ * Creates a new workbench action factory with the given id.
+ *
+ * @param actionId the id of actions created by this action factory
+ */
+ protected ActionFactory(String actionId) {
+ this(actionId, null);
+ }
/**
* Create a new workbench action factory with the given IDs.
*
- * @param actionId
- * the id of actions created by this action factory
- * @param commandId
- * the matching command id
+ * @param actionId the id of actions created by this action factory
+ * @param commandId the matching command id
* @since 3.5
*/
- protected ActionFactory(String actionId, String commandId) {
- this.actionId = actionId;
- this.commandId = commandId;
- }
-
- /**
- * Creates a new standard action for the given workbench window. The action
- * has an id as specified by the particular factory.
- * <p>
- * Actions automatically register listeners against the workbench window so
- * that they can keep their enablement state up to date. Ordinarily, the
- * window's references to these listeners will be dropped automatically
- * when the window closes. However, if the client needs to get rid of an
- * action while the window is still open, the client must call
- * {@link IWorkbenchAction#dispose dispose}to give the action an
- * opportunity to deregister its listeners and to perform any other
- * cleanup.
- * </p>
- *
- * @param window
- * the workbench window
- * @return the workbench action
- */
- public abstract IWorkbenchAction create(IWorkbenchWindow window);
-
- /**
- * Returns the id of this action factory.
- *
- * @return the id of actions created by this action factory
- */
- public String getId() {
- return actionId;
- }
+ protected ActionFactory(String actionId, String commandId) {
+ this.actionId = actionId;
+ this.commandId = commandId;
+ }
+
+ /**
+ * Creates a new standard action for the given workbench window. The action has
+ * an id as specified by the particular factory.
+ * <p>
+ * Actions automatically register listeners against the workbench window so that
+ * they can keep their enablement state up to date. Ordinarily, the window's
+ * references to these listeners will be dropped automatically when the window
+ * closes. However, if the client needs to get rid of an action while the window
+ * is still open, the client must call {@link IWorkbenchAction#dispose
+ * dispose}to give the action an opportunity to deregister its listeners and to
+ * perform any other cleanup.
+ * </p>
+ *
+ * @param window the workbench window
+ * @return the workbench action
+ */
+ public abstract IWorkbenchAction create(IWorkbenchWindow window);
+
+ /**
+ * Returns the id of this action factory.
+ *
+ * @return the id of actions created by this action factory
+ */
+ public String getId() {
+ return actionId;
+ }
/**
* Return the command id of this action factory.
*
- * @return the command id of the action created by this action factory. May
- * be <code>null</code>.
+ * @return the command id of the action created by this action factory. May be
+ * <code>null</code>.
* @since 3.5
*/
- public String getCommandId() {
- return commandId;
- }
+ public String getCommandId() {
+ return commandId;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ActionGroup.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ActionGroup.java
index 4f791e436e1..6e72c9d0f2e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ActionGroup.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ActionGroup.java
@@ -17,98 +17,98 @@ import org.eclipse.jface.action.IMenuManager;
import org.eclipse.ui.IActionBars;
/**
- * An <code>ActionGroup</code> represents a group of actions
- * which are added to a context menu, or the action bars of a part, together.
- * The group is given a context which can be used to determine which actions
- * are added, and what their enabled state should be.
+ * An <code>ActionGroup</code> represents a group of actions which are added to
+ * a context menu, or the action bars of a part, together. The group is given a
+ * context which can be used to determine which actions are added, and what
+ * their enabled state should be.
* <p>
* This class is intended only as a convenience for managing groups of actions.
* Clients are not required to use this class in order to add actions to context
* menus or action bars.
* </p>
* <p>
- * Clients should subclass this class and extend or override the appropriate fill methods.
+ * Clients should subclass this class and extend or override the appropriate
+ * fill methods.
* </p>
*
* @since 2.0
*/
public abstract class ActionGroup {
- /**
- * The action context, used to determine which actions are added,
- * and what their enabled state should be.
- */
- private ActionContext context;
+ /**
+ * The action context, used to determine which actions are added, and what their
+ * enabled state should be.
+ */
+ private ActionContext context;
- /**
- * Returns the context used to determine which actions are added,
- * and what their enabled state should be.
- */
- public ActionContext getContext() {
- return context;
- }
+ /**
+ * Returns the context used to determine which actions are added, and what their
+ * enabled state should be.
+ */
+ public ActionContext getContext() {
+ return context;
+ }
- /**
- * Sets the context used to determine which actions are added,
- * and what their enabled state should be.
- *
- * @param context the context to use
- */
- public void setContext(ActionContext context) {
- this.context = context;
- }
+ /**
+ * Sets the context used to determine which actions are added, and what their
+ * enabled state should be.
+ *
+ * @param context the context to use
+ */
+ public void setContext(ActionContext context) {
+ this.context = context;
+ }
- /**
- * Adds the applicable actions to a context menu,
- * based on the state of the <code>ActionContext</code>.
- * <p>
- * The default implementation does nothing.
- * Subclasses may override or extend this method.
- * </p>
- *
- * @param menu the context menu manager
- */
- public void fillContextMenu(IMenuManager menu) {
- // do nothing
- }
+ /**
+ * Adds the applicable actions to a context menu, based on the state of the
+ * <code>ActionContext</code>.
+ * <p>
+ * The default implementation does nothing. Subclasses may override or extend
+ * this method.
+ * </p>
+ *
+ * @param menu the context menu manager
+ */
+ public void fillContextMenu(IMenuManager menu) {
+ // do nothing
+ }
- /**
- * Adds the applicable actions to a part's action bars,
- * including setting any global action handlers.
- * <p>
- * The default implementation does nothing.
- * Subclasses may override or extend this method.
- * </p>
- *
- * @param actionBars the part's action bars
- */
- public void fillActionBars(IActionBars actionBars) {
- // do nothing
- }
+ /**
+ * Adds the applicable actions to a part's action bars, including setting any
+ * global action handlers.
+ * <p>
+ * The default implementation does nothing. Subclasses may override or extend
+ * this method.
+ * </p>
+ *
+ * @param actionBars the part's action bars
+ */
+ public void fillActionBars(IActionBars actionBars) {
+ // do nothing
+ }
- /**
- * Updates the state of the actions added to the action bars,
- * including any global action handlers,
- * based on the state of the <code>ActionContext</code>.
- * <p>
- * The default implementation does nothing.
- * Subclasses may override or extend this method.
- * </p>
- */
- public void updateActionBars() {
- // do nothing
- }
+ /**
+ * Updates the state of the actions added to the action bars, including any
+ * global action handlers, based on the state of the <code>ActionContext</code>.
+ * <p>
+ * The default implementation does nothing. Subclasses may override or extend
+ * this method.
+ * </p>
+ */
+ public void updateActionBars() {
+ // do nothing
+ }
- /**
- * This method is called by the user of an action group to signal that the group is
- * no longer needed. Subclasses typically implement this method to deregister
- * any listeners or to free other resources.
- * <p>
- * The default implementation calls <code>setContext(null)</code>.
- * Subclasses may extend this method.
- * </p>
- */
- public void dispose() {
- setContext(null);
- }
+ /**
+ * This method is called by the user of an action group to signal that the group
+ * is no longer needed. Subclasses typically implement this method to deregister
+ * any listeners or to free other resources.
+ * <p>
+ * The default implementation calls <code>setContext(null)</code>. Subclasses
+ * may extend this method.
+ * </p>
+ */
+ public void dispose() {
+ setContext(null);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/BaseNewWizardMenu.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/BaseNewWizardMenu.java
index 0df06f873b1..43a55b80a9d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/BaseNewWizardMenu.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/BaseNewWizardMenu.java
@@ -41,224 +41,216 @@ import org.eclipse.ui.internal.actions.NewWizardShortcutAction;
import org.eclipse.ui.wizards.IWizardDescriptor;
/**
- * A <code>BaseNewWizardMenu</code> is used to populate a menu manager with
- * New Wizard actions for the current perspective's new wizard shortcuts,
- * including an Other... action to open the new wizard dialog.
+ * A <code>BaseNewWizardMenu</code> is used to populate a menu manager with New
+ * Wizard actions for the current perspective's new wizard shortcuts, including
+ * an Other... action to open the new wizard dialog.
* <p>
- * <strong>Note:</strong> Clients must dispose this menu when it is no longer required.
+ * <strong>Note:</strong> Clients must dispose this menu when it is no longer
+ * required.
* </p>
*
* @since 3.1
*/
public class BaseNewWizardMenu extends CompoundContributionItem {
- /*
- * @issue Should be possible to implement this class entirely using public
- * API. Cases to be fixed: WorkbenchWindow, NewWizardShortcutAction
- * Suggestions:
- * - add the ability to update the submenus of a window
- */
+ /*
+ * @issue Should be possible to implement this class entirely using public API.
+ * Cases to be fixed: WorkbenchWindow, NewWizardShortcutAction Suggestions: -
+ * add the ability to update the submenus of a window
+ */
- private final Map actions = new HashMap(21);
+ private final Map actions = new HashMap(21);
- private final IExtensionChangeHandler configListener = new IExtensionChangeHandler() {
+ private final IExtensionChangeHandler configListener = new IExtensionChangeHandler() {
- @Override
+ @Override
public void removeExtension(IExtension source, Object[] objects) {
- for (Object object : objects) {
- if (object instanceof NewWizardShortcutAction) {
- actions.values().remove(object);
- }
- }
- }
+ for (Object object : objects) {
+ if (object instanceof NewWizardShortcutAction) {
+ actions.values().remove(object);
+ }
+ }
+ }
- @Override
+ @Override
public void addExtension(IExtensionTracker tracker, IExtension extension) {
- // Do nothing
- }
- };
+ // Do nothing
+ }
+ };
- /**
- * TODO: should this be done with an addition listener?
- */
- private final IRegistryChangeListener registryListener = event -> {
- // reset the reader.
- // TODO This is expensive. Can we be more selective?
- if (getParent() != null) {
- getParent().markDirty();
- }
+ /**
+ * TODO: should this be done with an addition listener?
+ */
+ private final IRegistryChangeListener registryListener = event -> {
+ // reset the reader.
+ // TODO This is expensive. Can we be more selective?
+ if (getParent() != null) {
+ getParent().markDirty();
+ }
};
- private ActionFactory.IWorkbenchAction showDlgAction;
+ private ActionFactory.IWorkbenchAction showDlgAction;
- private IWorkbenchWindow workbenchWindow;
+ private IWorkbenchWindow workbenchWindow;
- /**
- * Creates a new wizard shortcut menu for the IDE.
- * <p>
- * <strong>Note:</strong> Clients must dispose this menu when it is no longer required.
- * </p>
- *
- * @param window
- * the window containing the menu
- * @param id
- * the contribution item identifier, or <code>null</code>
- */
- public BaseNewWizardMenu(IWorkbenchWindow window, String id) {
- super(id);
- Assert.isNotNull(window);
- this.workbenchWindow = window;
- showDlgAction = ActionFactory.NEW.create(window);
- registerListeners();
- // indicate that a new wizards submenu has been created
+ /**
+ * Creates a new wizard shortcut menu for the IDE.
+ * <p>
+ * <strong>Note:</strong> Clients must dispose this menu when it is no longer
+ * required.
+ * </p>
+ *
+ * @param window the window containing the menu
+ * @param id the contribution item identifier, or <code>null</code>
+ */
+ public BaseNewWizardMenu(IWorkbenchWindow window, String id) {
+ super(id);
+ Assert.isNotNull(window);
+ this.workbenchWindow = window;
+ showDlgAction = ActionFactory.NEW.create(window);
+ registerListeners();
+ // indicate that a new wizards submenu has been created
if (window instanceof WorkbenchWindow) {
- ((WorkbenchWindow) window)
- .addSubmenu(WorkbenchWindow.NEW_WIZARD_SUBMENU);
+ ((WorkbenchWindow) window).addSubmenu(WorkbenchWindow.NEW_WIZARD_SUBMENU);
}
- }
+ }
- /**
- * Adds the items to show to the given list.
- *
- * @param list the list to add items to
- */
- protected void addItems(List list) {
- if (addShortcuts(list)) {
- list.add(new Separator());
- }
- list.add(new ActionContributionItem(getShowDialogAction()));
- }
+ /**
+ * Adds the items to show to the given list.
+ *
+ * @param list the list to add items to
+ */
+ protected void addItems(List list) {
+ if (addShortcuts(list)) {
+ list.add(new Separator());
+ }
+ list.add(new ActionContributionItem(getShowDialogAction()));
+ }
- /**
- * Adds the new wizard shortcuts for the current perspective to the given list.
- *
- * @param list the list to add items to
- * @return <code>true</code> if any items were added, <code>false</code> if none were added
- */
- protected boolean addShortcuts(List list) {
- boolean added = false;
- IWorkbenchPage page = workbenchWindow.getActivePage();
- if (page != null) {
- String[] wizardIds = page.getNewWizardShortcuts();
- for (String wizardId : wizardIds) {
- IAction action = getAction(wizardId);
- if (action != null) {
- if (!WorkbenchActivityHelper.filterItem(action)) {
- list.add(new ActionContributionItem(action));
- added = true;
- }
- }
- }
- }
- return added;
- }
+ /**
+ * Adds the new wizard shortcuts for the current perspective to the given list.
+ *
+ * @param list the list to add items to
+ * @return <code>true</code> if any items were added, <code>false</code> if none
+ * were added
+ */
+ protected boolean addShortcuts(List list) {
+ boolean added = false;
+ IWorkbenchPage page = workbenchWindow.getActivePage();
+ if (page != null) {
+ String[] wizardIds = page.getNewWizardShortcuts();
+ for (String wizardId : wizardIds) {
+ IAction action = getAction(wizardId);
+ if (action != null) {
+ if (!WorkbenchActivityHelper.filterItem(action)) {
+ list.add(new ActionContributionItem(action));
+ added = true;
+ }
+ }
+ }
+ }
+ return added;
+ }
- @Override
+ @Override
public void dispose() {
- if (workbenchWindow != null) {
- unregisterListeners();
- showDlgAction.dispose();
- showDlgAction = null;
- workbenchWindow = null;
+ if (workbenchWindow != null) {
+ unregisterListeners();
+ showDlgAction.dispose();
+ showDlgAction = null;
+ workbenchWindow = null;
super.dispose();
- }
- }
+ }
+ }
/*
* Returns the action for the given wizard id, or null if not found.
*/
- private IAction getAction(String id) {
- // Keep a cache, rather than creating a new action each time,
- // so that image caching in ActionContributionItem works.
- IAction action = (IAction) actions.get(id);
- if (action == null) {
- IWizardDescriptor wizardDesc = WorkbenchPlugin.getDefault()
- .getNewWizardRegistry().findWizard(id);
- if (wizardDesc != null) {
- action = new NewWizardShortcutAction(workbenchWindow,
- wizardDesc);
+ private IAction getAction(String id) {
+ // Keep a cache, rather than creating a new action each time,
+ // so that image caching in ActionContributionItem works.
+ IAction action = (IAction) actions.get(id);
+ if (action == null) {
+ IWizardDescriptor wizardDesc = WorkbenchPlugin.getDefault().getNewWizardRegistry().findWizard(id);
+ if (wizardDesc != null) {
+ action = new NewWizardShortcutAction(workbenchWindow, wizardDesc);
actions.put(id, action);
IConfigurationElement element = Adapters.adapt(wizardDesc, IConfigurationElement.class);
if (element != null) {
- workbenchWindow.getExtensionTracker().registerObject(
- element.getDeclaringExtension(), action,
+ workbenchWindow.getExtensionTracker().registerObject(element.getDeclaringExtension(), action,
IExtensionTracker.REF_WEAK);
}
- }
- }
- return action;
- }
+ }
+ }
+ return action;
+ }
- @Override
+ @Override
protected IContributionItem[] getContributionItems() {
- ArrayList list = new ArrayList();
- if (workbenchWindow != null && workbenchWindow.getActivePage() != null
- && workbenchWindow.getActivePage().getPerspective() != null) {
- addItems(list);
- } else {
- String text = WorkbenchMessages.Workbench_noApplicableItems;
- Action dummyAction = new Action(text) {
- // dummy inner class; no methods
- };
- dummyAction.setEnabled(false);
- list.add(new ActionContributionItem(dummyAction));
- }
- return (IContributionItem[]) list.toArray(new IContributionItem[list.size()]);
- }
+ ArrayList list = new ArrayList();
+ if (workbenchWindow != null && workbenchWindow.getActivePage() != null
+ && workbenchWindow.getActivePage().getPerspective() != null) {
+ addItems(list);
+ } else {
+ String text = WorkbenchMessages.Workbench_noApplicableItems;
+ Action dummyAction = new Action(text) {
+ // dummy inner class; no methods
+ };
+ dummyAction.setEnabled(false);
+ list.add(new ActionContributionItem(dummyAction));
+ }
+ return (IContributionItem[]) list.toArray(new IContributionItem[list.size()]);
+ }
- /**
- * Returns the "Other..." action, used to show the new wizards dialog.
- *
- * @return the action used to show the new wizards dialog
- */
- protected IAction getShowDialogAction() {
- return showDlgAction;
- }
+ /**
+ * Returns the "Other..." action, used to show the new wizards dialog.
+ *
+ * @return the action used to show the new wizards dialog
+ */
+ protected IAction getShowDialogAction() {
+ return showDlgAction;
+ }
- /**
- * Returns the window in which this menu appears.
- *
- * @return the window in which this menu appears
- */
- protected IWorkbenchWindow getWindow() {
- return workbenchWindow;
- }
+ /**
+ * Returns the window in which this menu appears.
+ *
+ * @return the window in which this menu appears
+ */
+ protected IWorkbenchWindow getWindow() {
+ return workbenchWindow;
+ }
- /**
- * Registers listeners.
- *
- * @since 3.1
- */
- private void registerListeners() {
- Platform.getExtensionRegistry().addRegistryChangeListener(
- registryListener);
- workbenchWindow.getExtensionTracker().registerHandler(
- configListener, null);
- }
+ /**
+ * Registers listeners.
+ *
+ * @since 3.1
+ */
+ private void registerListeners() {
+ Platform.getExtensionRegistry().addRegistryChangeListener(registryListener);
+ workbenchWindow.getExtensionTracker().registerHandler(configListener, null);
+ }
- /**
- * Returns whether the new wizards registry has a non-empty category with
- * the given identifier.
- *
- * @param categoryId
- * the identifier for the category
- * @return <code>true</code> if there is a non-empty category with the
- * given identifier, <code>false</code> otherwise
- */
- protected boolean registryHasCategory(String categoryId) {
- return WorkbenchPlugin.getDefault().getNewWizardRegistry()
- .findCategory(categoryId) != null;
- }
+ /**
+ * Returns whether the new wizards registry has a non-empty category with the
+ * given identifier.
+ *
+ * @param categoryId the identifier for the category
+ * @return <code>true</code> if there is a non-empty category with the given
+ * identifier, <code>false</code> otherwise
+ */
+ protected boolean registryHasCategory(String categoryId) {
+ return WorkbenchPlugin.getDefault().getNewWizardRegistry().findCategory(categoryId) != null;
+ }
- /**
- * Unregisters listeners.
- *
- * @since 3.1
- */
- private void unregisterListeners() {
+ /**
+ * Unregisters listeners.
+ *
+ * @since 3.1
+ */
+ private void unregisterListeners() {
Platform.getExtensionRegistry().removeRegistryChangeListener(registryListener);
IExtensionTracker extensionTracker = workbenchWindow.getExtensionTracker();
if (extensionTracker != null) {
extensionTracker.unregisterHandler(configListener);
}
- }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/BaseSelectionListenerAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/BaseSelectionListenerAction.java
index 546a67a9398..da2b9365b5b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/BaseSelectionListenerAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/BaseSelectionListenerAction.java
@@ -51,132 +51,131 @@ import org.eclipse.swt.widgets.Event;
*
* @since 3.0
*/
-public abstract class BaseSelectionListenerAction extends Action implements
- ISelectionChangedListener {
- /**
- * The current selection.
- */
- private IStructuredSelection selection = new StructuredSelection();
+public abstract class BaseSelectionListenerAction extends Action implements ISelectionChangedListener {
+ /**
+ * The current selection.
+ */
+ private IStructuredSelection selection = new StructuredSelection();
- /**
- * Running flag: <code>true</code> iff the action is running.
- */
- private boolean running = false;
+ /**
+ * Running flag: <code>true</code> iff the action is running.
+ */
+ private boolean running = false;
- /**
- * The deferred selection. Any selection change that occurs
- * while the action is running is held here until the run is complete.
- */
- private IStructuredSelection deferredSelection = null;
+ /**
+ * The deferred selection. Any selection change that occurs while the action is
+ * running is held here until the run is complete.
+ */
+ private IStructuredSelection deferredSelection = null;
- /**
- * Creates a new action with the given text.
- *
- * @param text the string used as the text for the action,
- * or <code>null</code> if there is no text
- */
- protected BaseSelectionListenerAction(String text) {
- super(text);
- }
+ /**
+ * Creates a new action with the given text.
+ *
+ * @param text the string used as the text for the action, or <code>null</code>
+ * if there is no text
+ */
+ protected BaseSelectionListenerAction(String text) {
+ super(text);
+ }
- /**
- * Clears any cached state associated with the selection.
- * Called when the selection changes.
- * <p>
- * The <code>BaseSelectionListenerAction</code> implementation of this method
- * does nothing. Subclasses may override.
- * </p>
- */
- protected void clearCache() {
- // do nothing
- }
+ /**
+ * Clears any cached state associated with the selection. Called when the
+ * selection changes.
+ * <p>
+ * The <code>BaseSelectionListenerAction</code> implementation of this method
+ * does nothing. Subclasses may override.
+ * </p>
+ */
+ protected void clearCache() {
+ // do nothing
+ }
- /**
- * Returns the current structured selection in the workbench, or an empty
- * selection if nothing is selected or if selection does not include
- * objects (for example, raw text).
- *
- * @return the current structured selection in the workbench
- */
- public IStructuredSelection getStructuredSelection() {
- return selection;
- }
+ /**
+ * Returns the current structured selection in the workbench, or an empty
+ * selection if nothing is selected or if selection does not include objects
+ * (for example, raw text).
+ *
+ * @return the current structured selection in the workbench
+ */
+ public IStructuredSelection getStructuredSelection() {
+ return selection;
+ }
- /**
- * Notifies this action that the given structured selection has changed.
- * <p>
- * The <code>BaseSelectionListenerAction</code> implementation of this method
- * records the given selection for future reference and calls
- * <code>updateSelection</code>, updating the enable state of this action
- * based on the outcome. Subclasses should override <code>updateSelection</code>
- * to react to selection changes.
- * </p>
- *
- * @param selection the new selection
- */
- public final void selectionChanged(IStructuredSelection selection) {
- // Ignore any incoming selection change while the action is running,
- // otherwise the action can have unpredictable results, including lost
- // data, if it operates on a different selection than what it initially
- // validated.
- // See Bug 60606 [Navigator] (data loss) Navigator deletes/moves the wrong file
- if (running) {
- deferredSelection = selection;
- return;
- }
- this.selection = selection;
- clearCache();
- setEnabled(updateSelection(selection));
- }
+ /**
+ * Notifies this action that the given structured selection has changed.
+ * <p>
+ * The <code>BaseSelectionListenerAction</code> implementation of this method
+ * records the given selection for future reference and calls
+ * <code>updateSelection</code>, updating the enable state of this action based
+ * on the outcome. Subclasses should override <code>updateSelection</code> to
+ * react to selection changes.
+ * </p>
+ *
+ * @param selection the new selection
+ */
+ public final void selectionChanged(IStructuredSelection selection) {
+ // Ignore any incoming selection change while the action is running,
+ // otherwise the action can have unpredictable results, including lost
+ // data, if it operates on a different selection than what it initially
+ // validated.
+ // See Bug 60606 [Navigator] (data loss) Navigator deletes/moves the wrong file
+ if (running) {
+ deferredSelection = selection;
+ return;
+ }
+ this.selection = selection;
+ clearCache();
+ setEnabled(updateSelection(selection));
+ }
- /**
- * The <code>BaseSelectionListenerAction</code> implementation of this
- * <code>ISelectionChangedListener</code> method calls
- * <code>selectionChanged(IStructuredSelection)</code> assuming the selection is
- * a structured one. Subclasses should override the <code>updateSelection</code>
- * method to react to selection changes.
- */
- @Override
+ /**
+ * The <code>BaseSelectionListenerAction</code> implementation of this
+ * <code>ISelectionChangedListener</code> method calls
+ * <code>selectionChanged(IStructuredSelection)</code> assuming the selection is
+ * a structured one. Subclasses should override the <code>updateSelection</code>
+ * method to react to selection changes.
+ */
+ @Override
public final void selectionChanged(SelectionChangedEvent event) {
- ISelection selection = event.getSelection();
- if (selection instanceof IStructuredSelection) {
+ ISelection selection = event.getSelection();
+ if (selection instanceof IStructuredSelection) {
selectionChanged((IStructuredSelection) selection);
} else {
selectionChanged(StructuredSelection.EMPTY);
}
- }
+ }
- /**
- * Updates this action in response to the given selection.
- * <p>
- * The <code>BaseSelectionListenerAction</code> implementation of this method
- * returns <code>true</code>. Subclasses may extend to react to selection
- * changes; however, if the super method returns <code>false</code>, the
- * overriding method must also return <code>false</code>.
- * </p>
- *
- * @param selection the new selection
- * @return <code>true</code> if the action should be enabled for this selection,
- * and <code>false</code> otherwise
- */
- protected boolean updateSelection(IStructuredSelection selection) {
- return true;
- }
+ /**
+ * Updates this action in response to the given selection.
+ * <p>
+ * The <code>BaseSelectionListenerAction</code> implementation of this method
+ * returns <code>true</code>. Subclasses may extend to react to selection
+ * changes; however, if the super method returns <code>false</code>, the
+ * overriding method must also return <code>false</code>.
+ * </p>
+ *
+ * @param selection the new selection
+ * @return <code>true</code> if the action should be enabled for this selection,
+ * and <code>false</code> otherwise
+ */
+ protected boolean updateSelection(IStructuredSelection selection) {
+ return true;
+ }
- @Override
+ @Override
public void runWithEvent(Event event) {
- // Set the running flag during the run so that selection changes are deferred.
- // See selectionChanged(IStructuredSelection) for more details.
- running = true;
- try {
- run();
- } finally {
- running = false;
- IStructuredSelection s = deferredSelection;
- deferredSelection = null;
- if (s != null) {
- selectionChanged(s);
- }
- }
- }
+ // Set the running flag during the run so that selection changes are deferred.
+ // See selectionChanged(IStructuredSelection) for more details.
+ running = true;
+ try {
+ run();
+ } finally {
+ running = false;
+ IStructuredSelection s = deferredSelection;
+ deferredSelection = null;
+ if (s != null) {
+ selectionChanged(s);
+ }
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CompoundContributionItem.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CompoundContributionItem.java
index 5905eb4da37..dd7400d06c2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CompoundContributionItem.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CompoundContributionItem.java
@@ -21,101 +21,100 @@ import org.eclipse.jface.action.IMenuManager;
import org.eclipse.swt.widgets.Menu;
/**
- * A compound contribution is a contribution item consisting of a
- * dynamic list of contribution items.
+ * A compound contribution is a contribution item consisting of a dynamic list
+ * of contribution items.
*
* @since 3.1
*/
public abstract class CompoundContributionItem extends ContributionItem {
- private IMenuListener menuListener = manager -> manager.markDirty();
+ private IMenuListener menuListener = manager -> manager.markDirty();
- private IContributionItem[] oldItems;
+ private IContributionItem[] oldItems;
- /**
- * Creates a compound contribution item with a <code>null</code> id.
- */
- protected CompoundContributionItem() {
- super();
- }
+ /**
+ * Creates a compound contribution item with a <code>null</code> id.
+ */
+ protected CompoundContributionItem() {
+ super();
+ }
- /**
- * Creates a compound contribution item with the given (optional) id.
- *
- * @param id the contribution item identifier, or <code>null</code>
- */
- protected CompoundContributionItem(String id) {
- super(id);
- }
+ /**
+ * Creates a compound contribution item with the given (optional) id.
+ *
+ * @param id the contribution item identifier, or <code>null</code>
+ */
+ protected CompoundContributionItem(String id) {
+ super(id);
+ }
- @Override
+ @Override
public void fill(Menu menu, int index) {
- if (index == -1) {
+ if (index == -1) {
index = menu.getItemCount();
}
- IContributionItem[] items = getContributionItemsToFill();
+ IContributionItem[] items = getContributionItemsToFill();
if (index > menu.getItemCount()) {
index = menu.getItemCount();
}
- for (IContributionItem item : items) {
- int oldItemCount = menu.getItemCount();
- if (item.isVisible()) {
- item.fill(menu, index);
- }
- int newItemCount = menu.getItemCount();
- int numAdded = newItemCount - oldItemCount;
- index += numAdded;
- }
- }
+ for (IContributionItem item : items) {
+ int oldItemCount = menu.getItemCount();
+ if (item.isVisible()) {
+ item.fill(menu, index);
+ }
+ int newItemCount = menu.getItemCount();
+ int numAdded = newItemCount - oldItemCount;
+ index += numAdded;
+ }
+ }
- /**
+ /**
* Return a list of contributions items that will replace this item in the
- * parent manager. The list must contain new contribution items every call
- * since the old ones will be disposed.
+ * parent manager. The list must contain new contribution items every call since
+ * the old ones will be disposed.
*
* @return an array list of items to display. Must not be <code>null</code>.
*/
- protected abstract IContributionItem[] getContributionItems();
+ protected abstract IContributionItem[] getContributionItems();
- private IContributionItem[] getContributionItemsToFill() {
+ private IContributionItem[] getContributionItemsToFill() {
disposeOldItems();
oldItems = getContributionItems();
return oldItems;
}
private void disposeOldItems() {
- if (oldItems != null) {
- for (IContributionItem oldItem : oldItems) {
- oldItem.dispose();
- }
- oldItems = null;
- }
- }
+ if (oldItems != null) {
+ for (IContributionItem oldItem : oldItems) {
+ oldItem.dispose();
+ }
+ oldItems = null;
+ }
+ }
- @Override
+ @Override
public boolean isDirty() {
return true;
- }
+ }
- @Override
+ @Override
public boolean isDynamic() {
- return true;
- }
-
+ return true;
+ }
- @Override
+ @Override
public void setParent(IContributionManager parent) {
- if (getParent() instanceof IMenuManager) {
- IMenuManager menuMgr = (IMenuManager) getParent();
- menuMgr.removeMenuListener(menuListener);
- }
- if (parent instanceof IMenuManager) {
- IMenuManager menuMgr = (IMenuManager) parent;
- menuMgr.addMenuListener(menuListener);
- }
- super.setParent(parent);
- }
+ if (getParent() instanceof IMenuManager) {
+ IMenuManager menuMgr = (IMenuManager) getParent();
+ menuMgr.removeMenuListener(menuListener);
+ }
+ if (parent instanceof IMenuManager) {
+ IMenuManager menuMgr = (IMenuManager) parent;
+ menuMgr.addMenuListener(menuListener);
+ }
+ super.setParent(parent);
+ }
@Override
public void dispose() {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ContributedAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ContributedAction.java
index aac4c362730..228d3099c9f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ContributedAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ContributedAction.java
@@ -71,19 +71,14 @@ public final class ContributedAction extends CommandAction {
/**
* Create an action that can call a command.
*
- * @param locator
- * The appropriate service locator to use. If you use a part site
- * as your locator, this action will be tied to your part.
- * @param element
- * the contributed action element
+ * @param locator The appropriate service locator to use. If you use a part site
+ * as your locator, this action will be tied to your part.
+ * @param element the contributed action element
*/
- public ContributedAction(IServiceLocator locator,
- IConfigurationElement element) throws CommandNotMappedException {
+ public ContributedAction(IServiceLocator locator, IConfigurationElement element) throws CommandNotMappedException {
- String actionId = element
- .getAttribute(IWorkbenchRegistryConstants.ATT_ID);
- String commandId = element
- .getAttribute(IWorkbenchRegistryConstants.ATT_DEFINITION_ID);
+ String actionId = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
+ String commandId = element.getAttribute(IWorkbenchRegistryConstants.ATT_DEFINITION_ID);
// TODO throw some more exceptions here :-)
@@ -92,23 +87,19 @@ public final class ContributedAction extends CommandAction {
Object obj = element.getParent();
if (obj instanceof IConfigurationElement) {
- contributionId = ((IConfigurationElement) obj)
- .getAttribute(IWorkbenchRegistryConstants.ATT_ID);
+ contributionId = ((IConfigurationElement) obj).getAttribute(IWorkbenchRegistryConstants.ATT_ID);
if (contributionId == null) {
throw new CommandNotMappedException("Action " //$NON-NLS-1$
+ actionId + " configuration element invalid"); //$NON-NLS-1$
}
}
// legacy bridge part
- IActionCommandMappingService mapping = locator
- .getService(IActionCommandMappingService.class);
+ IActionCommandMappingService mapping = locator.getService(IActionCommandMappingService.class);
if (mapping == null) {
- throw new CommandNotMappedException(
- "No action mapping service available"); //$NON-NLS-1$
+ throw new CommandNotMappedException("No action mapping service available"); //$NON-NLS-1$
}
- commandId = mapping.getCommandId(mapping.getGeneratedCommandId(
- contributionId, actionId));
+ commandId = mapping.getCommandId(mapping.getGeneratedCommandId(contributionId, actionId));
}
// what, still no command?
if (commandId == null) {
@@ -120,58 +111,47 @@ public final class ContributedAction extends CommandAction {
init(locator, commandId, null);
if (locator instanceof IWorkbenchPartSite) {
- updateSiteAssociations((IWorkbenchPartSite) locator, commandId,
- actionId, element);
+ updateSiteAssociations((IWorkbenchPartSite) locator, commandId, actionId, element);
}
setId(actionId);
}
- private void updateSiteAssociations(IWorkbenchPartSite site,
- String commandId, String actionId, IConfigurationElement element) {
- IWorkbenchLocationService wls = site
- .getService(IWorkbenchLocationService.class);
+ private void updateSiteAssociations(IWorkbenchPartSite site, String commandId, String actionId,
+ IConfigurationElement element) {
+ IWorkbenchLocationService wls = site.getService(IWorkbenchLocationService.class);
IWorkbench workbench = wls.getWorkbench();
IWorkbenchWindow window = wls.getWorkbenchWindow();
- IHandlerService serv = workbench
- .getService(IHandlerService.class);
- appContext = new EvaluationContext(serv.getCurrentState(),
- Collections.EMPTY_LIST);
+ IHandlerService serv = workbench.getService(IHandlerService.class);
+ appContext = new EvaluationContext(serv.getCurrentState(), Collections.EMPTY_LIST);
// set up the appContext as we would want it.
- appContext.addVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME,
- StructuredSelection.EMPTY);
+ appContext.addVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME, StructuredSelection.EMPTY);
appContext.addVariable(ISources.ACTIVE_PART_NAME, site.getPart());
appContext.addVariable(ISources.ACTIVE_PART_ID_NAME, site.getId());
appContext.addVariable(ISources.ACTIVE_SITE_NAME, site);
if (site instanceof IEditorSite) {
appContext.addVariable(ISources.ACTIVE_EDITOR_NAME, site.getPart());
- appContext
- .addVariable(ISources.ACTIVE_EDITOR_ID_NAME, site.getId());
+ appContext.addVariable(ISources.ACTIVE_EDITOR_ID_NAME, site.getId());
}
appContext.addVariable(ISources.ACTIVE_WORKBENCH_WINDOW_NAME, window);
- appContext.addVariable(ISources.ACTIVE_WORKBENCH_WINDOW_SHELL_NAME,
- window.getShell());
+ appContext.addVariable(ISources.ACTIVE_WORKBENCH_WINDOW_SHELL_NAME, window.getShell());
partHandler = lookUpHandler(site, commandId);
if (partHandler == null) {
localHandler = true;
// if we can't find the handler, then at least we can
// call the action delegate run method
- partHandler = new ActionDelegateHandlerProxy(element,
- IWorkbenchRegistryConstants.ATT_CLASS, actionId,
- getParameterizedCommand(), site.getWorkbenchWindow(), null,
- null, null);
+ partHandler = new ActionDelegateHandlerProxy(element, IWorkbenchRegistryConstants.ATT_CLASS, actionId,
+ getParameterizedCommand(), site.getWorkbenchWindow(), null, null, null);
}
if (site instanceof MultiPageEditorSite) {
- IHandlerService siteServ = site
- .getService(IHandlerService.class);
+ IHandlerService siteServ = site.getService(IHandlerService.class);
siteServ.activateHandler(commandId, partHandler);
}
if (getParameterizedCommand() != null) {
- getParameterizedCommand().getCommand().removeCommandListener(
- getCommandListener());
+ getParameterizedCommand().getCommand().removeCommandListener(getCommandListener());
}
site.getPage().addPartListener(getPartListener());
}
@@ -189,8 +169,7 @@ public final class ContributedAction extends CommandAction {
@Override
public void runWithEvent(Event event) {
if (partHandler != null && getParameterizedCommand() != null) {
- IHandler oldHandler = getParameterizedCommand().getCommand()
- .getHandler();
+ IHandler oldHandler = getParameterizedCommand().getCommand().getHandler();
try {
getParameterizedCommand().getCommand().setHandler(partHandler);
getParameterizedCommand().executeWithChecks(event, appContext);
@@ -223,8 +202,7 @@ public final class ContributedAction extends CommandAction {
private IPartListener getPartListener() {
if (partListener == null) {
- final IWorkbenchPartSite site = (IWorkbenchPartSite) appContext
- .getVariable(ISources.ACTIVE_SITE_NAME);
+ final IWorkbenchPartSite site = (IWorkbenchPartSite) appContext.getVariable(ISources.ACTIVE_SITE_NAME);
final IWorkbenchPart currentPart;
if (site instanceof MultiPageEditorSite) {
@@ -268,8 +246,7 @@ public final class ContributedAction extends CommandAction {
partHandler.dispose();
}
if (partListener != null) {
- IWorkbenchPartSite site = (IWorkbenchPartSite) appContext
- .getVariable(ISources.ACTIVE_SITE_NAME);
+ IWorkbenchPartSite site = (IWorkbenchPartSite) appContext.getVariable(ISources.ACTIVE_SITE_NAME);
site.getPage().removePartListener(partListener);
partListener = null;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ContributionItemFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ContributionItemFactory.java
index dbb2c641964..a938b03eef4 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ContributionItemFactory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ContributionItemFactory.java
@@ -53,52 +53,52 @@ import org.eclipse.ui.menus.CommandContributionItemParameter;
*/
public abstract class ContributionItemFactory {
- /**
- * Id of contribution items created by this factory.
- */
- private final String contributionItemId;
+ /**
+ * Id of contribution items created by this factory.
+ */
+ private final String contributionItemId;
- /**
- * Creates a new workbench contribution item factory with the given id.
- *
- * @param contributionItemId the id of contribution items created by this factory
- */
- protected ContributionItemFactory(String contributionItemId) {
- this.contributionItemId = contributionItemId;
- }
+ /**
+ * Creates a new workbench contribution item factory with the given id.
+ *
+ * @param contributionItemId the id of contribution items created by this
+ * factory
+ */
+ protected ContributionItemFactory(String contributionItemId) {
+ this.contributionItemId = contributionItemId;
+ }
- /**
- * Creates a new standard contribution item for the given workbench window.
- * <p>
- * A typical contribution item automatically registers listeners against the
- * workbench window so that it can keep its enablement state up to date.
- * Ordinarily, the window's references to these listeners will be dropped
- * automatically when the window closes. However, if the client needs to get
- * rid of a contribution item while the window is still open, the client must
- * call IContributionItem#dispose to give the item an
- * opportunity to deregister its listeners and to perform any other cleanup.
- * </p>
- *
- * @param window the workbench window
- * @return the workbench contribution item
- */
- public abstract IContributionItem create(IWorkbenchWindow window);
+ /**
+ * Creates a new standard contribution item for the given workbench window.
+ * <p>
+ * A typical contribution item automatically registers listeners against the
+ * workbench window so that it can keep its enablement state up to date.
+ * Ordinarily, the window's references to these listeners will be dropped
+ * automatically when the window closes. However, if the client needs to get rid
+ * of a contribution item while the window is still open, the client must call
+ * IContributionItem#dispose to give the item an opportunity to deregister its
+ * listeners and to perform any other cleanup.
+ * </p>
+ *
+ * @param window the workbench window
+ * @return the workbench contribution item
+ */
+ public abstract IContributionItem create(IWorkbenchWindow window);
- /**
- * Returns the id of this contribution item factory.
- *
- * @return the id of contribution items created by this factory
- */
- public String getId() {
- return contributionItemId;
- }
+ /**
+ * Returns the id of this contribution item factory.
+ *
+ * @return the id of contribution items created by this factory
+ */
+ public String getId() {
+ return contributionItemId;
+ }
/**
- * Workbench action (id "pinEditor"): Toggle whether the editor is pinned.
- * This action maintains its enablement state.
+ * Workbench action (id "pinEditor"): Toggle whether the editor is pinned. This
+ * action maintains its enablement state.
*/
- public static final ContributionItemFactory PIN_EDITOR = new ContributionItemFactory(
- "pinEditor") { //$NON-NLS-1$
+ public static final ContributionItemFactory PIN_EDITOR = new ContributionItemFactory("pinEditor") { //$NON-NLS-1$
private static final String COMMAND_ID = IWorkbenchCommandConstants.WINDOW_PIN_EDITOR;
@Override
@@ -107,16 +107,12 @@ public abstract class ContributionItemFactory {
throw new IllegalArgumentException();
}
- CommandContributionItemParameter parameter = new CommandContributionItemParameter(
- window,
- COMMAND_ID,
- COMMAND_ID,
- null,
- WorkbenchImages
- .getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_PIN_EDITOR),
- WorkbenchImages
- .getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_PIN_EDITOR_DISABLED),
- null, null, null, WorkbenchMessages.PinEditorAction_toolTip, // Local workaround for http://bugs.eclipse.org/387583
+ CommandContributionItemParameter parameter = new CommandContributionItemParameter(window, COMMAND_ID,
+ COMMAND_ID, null,
+ WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_PIN_EDITOR),
+ WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_PIN_EDITOR_DISABLED), null,
+ null, null, WorkbenchMessages.PinEditorAction_toolTip, // Local workaround for
+ // http://bugs.eclipse.org/387583
CommandContributionItem.STYLE_CHECK, null, false);
final CommandContributionItem action = new CommandContributionItem(parameter);
action.setVisible(WorkbenchPlugin.getDefault().getPreferenceStore()
@@ -125,140 +121,135 @@ public abstract class ContributionItemFactory {
}
};
- /**
- * Workbench contribution item (id "openWindows"): A list of windows
- * currently open in the workbench. Selecting one of the items makes the
- * corresponding window the active window.
- * This action dynamically maintains the list of windows.
- */
- public static final ContributionItemFactory OPEN_WINDOWS = new ContributionItemFactory(
- "openWindows") { //$NON-NLS-1$
+ /**
+ * Workbench contribution item (id "openWindows"): A list of windows currently
+ * open in the workbench. Selecting one of the items makes the corresponding
+ * window the active window. This action dynamically maintains the list of
+ * windows.
+ */
+ public static final ContributionItemFactory OPEN_WINDOWS = new ContributionItemFactory("openWindows") { //$NON-NLS-1$
- @Override
+ @Override
public IContributionItem create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- return new SwitchToWindowMenu(window, getId(), true);
- }
- };
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ return new SwitchToWindowMenu(window, getId(), true);
+ }
+ };
- /**
- * Workbench contribution item (id "viewsShortlist"): A list of views
- * available to be opened in the window, arranged as a shortlist of
- * promising views and an "Other" subitem. Selecting
- * one of the items opens the corresponding view in the active window.
- * This action dynamically maintains the view shortlist.
- */
- public static final ContributionItemFactory VIEWS_SHORTLIST = new ContributionItemFactory(
- "viewsShortlist") { //$NON-NLS-1$
+ /**
+ * Workbench contribution item (id "viewsShortlist"): A list of views available
+ * to be opened in the window, arranged as a shortlist of promising views and an
+ * "Other" subitem. Selecting one of the items opens the corresponding view in
+ * the active window. This action dynamically maintains the view shortlist.
+ */
+ public static final ContributionItemFactory VIEWS_SHORTLIST = new ContributionItemFactory("viewsShortlist") { //$NON-NLS-1$
- @Override
+ @Override
public IContributionItem create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- return new ShowViewMenu(window, getId());
- }
- };
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ return new ShowViewMenu(window, getId());
+ }
+ };
- /**
- * Workbench contribution item (id "viewsShowIn"): A list of views
- * available to be opened in the window, arranged as a list of
- * alternate views to show the same item currently selected. Selecting
- * one of the items opens the corresponding view in the active window.
- * This action dynamically maintains the view list.
- */
- public static final ContributionItemFactory VIEWS_SHOW_IN = new ContributionItemFactory(
- "viewsShowIn") { //$NON-NLS-1$
+ /**
+ * Workbench contribution item (id "viewsShowIn"): A list of views available to
+ * be opened in the window, arranged as a list of alternate views to show the
+ * same item currently selected. Selecting one of the items opens the
+ * corresponding view in the active window. This action dynamically maintains
+ * the view list.
+ */
+ public static final ContributionItemFactory VIEWS_SHOW_IN = new ContributionItemFactory("viewsShowIn") { //$NON-NLS-1$
- @Override
+ @Override
public IContributionItem create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
- ShowInMenu showInMenu = new ShowInMenu();
- showInMenu.setId(getId());
- showInMenu.initialize(window);
+ ShowInMenu showInMenu = new ShowInMenu();
+ showInMenu.setId(getId());
+ showInMenu.initialize(window);
return showInMenu;
- }
- };
+ }
+ };
- /**
- * Workbench contribution item (id "reopenEditors"): A list of recent
- * editors (with inputs) available to be reopened in the window. Selecting
- * one of the items reopens the corresponding editor on its input in the
- * active window. This action dynamically maintains the list of editors.
- */
- public static final ContributionItemFactory REOPEN_EDITORS = new ContributionItemFactory(
- "reopenEditors") { //$NON-NLS-1$
+ /**
+ * Workbench contribution item (id "reopenEditors"): A list of recent editors
+ * (with inputs) available to be reopened in the window. Selecting one of the
+ * items reopens the corresponding editor on its input in the active window.
+ * This action dynamically maintains the list of editors.
+ */
+ public static final ContributionItemFactory REOPEN_EDITORS = new ContributionItemFactory("reopenEditors") { //$NON-NLS-1$
- @Override
+ @Override
public IContributionItem create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- return new ReopenEditorMenu(window, getId(), true);
- }
- };
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ return new ReopenEditorMenu(window, getId(), true);
+ }
+ };
- /**
- * Workbench contribution item (id "perspectivesShortlist"): A list of
- * perspectives available to be opened, arranged as a shortlist of
- * promising perspectives and an "Other" subitem. Selecting
- * one of the items makes the corresponding perspective active. Should a
- * new perspective need to be opened, a workbench user preference controls
- * whether the perspective is opened in the active window or a new window.
- * This action dynamically maintains the perspectives shortlist.
- */
- public static final ContributionItemFactory PERSPECTIVES_SHORTLIST = new ContributionItemFactory(
- "perspectivesShortlist") { //$NON-NLS-1$
+ /**
+ * Workbench contribution item (id "perspectivesShortlist"): A list of
+ * perspectives available to be opened, arranged as a shortlist of promising
+ * perspectives and an "Other" subitem. Selecting one of the items makes the
+ * corresponding perspective active. Should a new perspective need to be opened,
+ * a workbench user preference controls whether the perspective is opened in the
+ * active window or a new window. This action dynamically maintains the
+ * perspectives shortlist.
+ */
+ public static final ContributionItemFactory PERSPECTIVES_SHORTLIST = new ContributionItemFactory(
+ "perspectivesShortlist") { //$NON-NLS-1$
- @Override
+ @Override
public IContributionItem create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- return new ChangeToPerspectiveMenu(window, getId());
- }
- };
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ return new ChangeToPerspectiveMenu(window, getId());
+ }
+ };
- /**
- * Workbench contribution item (id "newWizardShortlist"): A list of
- * new item wizards available to be opened, arranged as a shortlist of
- * promising new item wizards and an "Other" subitem. Selecting
- * one of the items invokes the corresponding new item wizard.
- * This action dynamically maintains the new item wizard shortlist.
- * @since 3.1
- */
- public static final ContributionItemFactory NEW_WIZARD_SHORTLIST = new ContributionItemFactory(
- "newWizardShortlist") { //$NON-NLS-1$
+ /**
+ * Workbench contribution item (id "newWizardShortlist"): A list of new item
+ * wizards available to be opened, arranged as a shortlist of promising new item
+ * wizards and an "Other" subitem. Selecting one of the items invokes the
+ * corresponding new item wizard. This action dynamically maintains the new item
+ * wizard shortlist.
+ *
+ * @since 3.1
+ */
+ public static final ContributionItemFactory NEW_WIZARD_SHORTLIST = new ContributionItemFactory(
+ "newWizardShortlist") { //$NON-NLS-1$
- @Override
+ @Override
public IContributionItem create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- return new BaseNewWizardMenu(window, getId());
- }
- };
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ return new BaseNewWizardMenu(window, getId());
+ }
+ };
- /**
- * Workbench contribution item (id "helpSearch"): An editable field
- * for entering help search queries.
- * @since 3.1
- */
- public static final ContributionItemFactory HELP_SEARCH = new ContributionItemFactory(
- "helpSearch") {//$NON-NLS-1$
- @Override
+ /**
+ * Workbench contribution item (id "helpSearch"): An editable field for entering
+ * help search queries.
+ *
+ * @since 3.1
+ */
+ public static final ContributionItemFactory HELP_SEARCH = new ContributionItemFactory("helpSearch") {//$NON-NLS-1$
+ @Override
public IContributionItem create(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- return new HelpSearchContributionItem(window, getId());
- }
- };
-
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ return new HelpSearchContributionItem(window, getId());
+ }
+ };
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ExportResourcesAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ExportResourcesAction.java
index 41d9ff296ef..9f1babc33ad 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ExportResourcesAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ExportResourcesAction.java
@@ -27,11 +27,10 @@ import org.eclipse.ui.internal.WorkbenchMessages;
* <p>
* This method automatically registers listeners so that it can keep its
* enablement state up to date. Ordinarily, the window's references to these
- * listeners will be dropped automatically when the window closes. However,
- * if the client needs to get rid of an action while the window is still open,
- * the client must call IWorkbenchAction#dispose to give the
- * action an opportunity to deregister its listeners and to perform any other
- * cleanup.
+ * listeners will be dropped automatically when the window closes. However, if
+ * the client needs to get rid of an action while the window is still open, the
+ * client must call IWorkbenchAction#dispose to give the action an opportunity
+ * to deregister its listeners and to perform any other cleanup.
* </p>
* <p>
* Note: Despite the name, an export operation can deal with things other than
@@ -41,102 +40,103 @@ import org.eclipse.ui.internal.WorkbenchMessages;
* @since 2.0
* @noextend This class is not intended to be subclassed by clients.
*/
-public class ExportResourcesAction extends BaseSelectionListenerAction
- implements ActionFactory.IWorkbenchAction {
- /**
- * Reference to the WorkbenchCommandAction that executes the Export Wizard.
- */
- private ActionFactory.IWorkbenchAction action;
+public class ExportResourcesAction extends BaseSelectionListenerAction implements ActionFactory.IWorkbenchAction {
+ /**
+ * Reference to the WorkbenchCommandAction that executes the Export Wizard.
+ */
+ private ActionFactory.IWorkbenchAction action;
- /**
- * The workbench window; or <code>null</code> if this
- * action has been <code>dispose</code>d.
- */
- private IWorkbenchWindow workbenchWindow;
+ /**
+ * The workbench window; or <code>null</code> if this action has been
+ * <code>dispose</code>d.
+ */
+ private IWorkbenchWindow workbenchWindow;
- /**
- * Create a new instance of this class.
- *
- * @param window the window
- */
- public ExportResourcesAction(IWorkbenchWindow window) {
- this(window, WorkbenchMessages.ExportResourcesAction_text);
- }
+ /**
+ * Create a new instance of this class.
+ *
+ * @param window the window
+ */
+ public ExportResourcesAction(IWorkbenchWindow window) {
+ this(window, WorkbenchMessages.ExportResourcesAction_text);
+ }
- /**
- * Create a new instance of this class.
- *
- * @param window the window
- * @param label the label
- */
- public ExportResourcesAction(IWorkbenchWindow window, String label) {
- super(label);
- if (window == null) {
- throw new IllegalArgumentException();
- }
+ /**
+ * Create a new instance of this class.
+ *
+ * @param window the window
+ * @param label the label
+ */
+ public ExportResourcesAction(IWorkbenchWindow window, String label) {
+ super(label);
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
- this.workbenchWindow = window;
- action = ActionFactory.EXPORT.create(window);
+ this.workbenchWindow = window;
+ action = ActionFactory.EXPORT.create(window);
- setText(action.getText());
- setToolTipText(action.getToolTipText());
- setId(action.getId());
- setActionDefinitionId(action.getActionDefinitionId());
- window.getWorkbench().getHelpSystem().setHelp(this,
- IWorkbenchHelpContextIds.EXPORT_ACTION);
- setImageDescriptor(action.getImageDescriptor());
- }
+ setText(action.getText());
+ setToolTipText(action.getToolTipText());
+ setId(action.getId());
+ setActionDefinitionId(action.getActionDefinitionId());
+ window.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.EXPORT_ACTION);
+ setImageDescriptor(action.getImageDescriptor());
+ }
- /**
- * Create a new instance of this class
- *
- * @param workbench the workbench
- * @deprecated use the constructor <code>ExportResourcesAction(IWorkbenchWindow)</code>
- */
- @Deprecated
+ /**
+ * Create a new instance of this class
+ *
+ * @param workbench the workbench
+ * @deprecated use the constructor
+ * <code>ExportResourcesAction(IWorkbenchWindow)</code>
+ */
+ @Deprecated
public ExportResourcesAction(IWorkbench workbench) {
- this(workbench.getActiveWorkbenchWindow());
- }
+ this(workbench.getActiveWorkbenchWindow());
+ }
- /**
- * Create a new instance of this class.
- *
- * @param workbench the workbench
- * @param label the label
- * @deprecated use the constructor <code>ExportResourcesAction(IWorkbenchWindow, String)</code>
- */
- @Deprecated
+ /**
+ * Create a new instance of this class.
+ *
+ * @param workbench the workbench
+ * @param label the label
+ * @deprecated use the constructor
+ * <code>ExportResourcesAction(IWorkbenchWindow, String)</code>
+ */
+ @Deprecated
public ExportResourcesAction(IWorkbench workbench, String label) {
- this(workbench.getActiveWorkbenchWindow(), label);
- }
+ this(workbench.getActiveWorkbenchWindow(), label);
+ }
- /**
- * Invoke the Export wizards selection Wizard.
- */
- @Override
+ /**
+ * Invoke the Export wizards selection Wizard.
+ */
+ @Override
public void run() {
- if (workbenchWindow == null) {
- // action has been disposed
- return;
- }
- action.run();
- }
+ if (workbenchWindow == null) {
+ // action has been disposed
+ return;
+ }
+ action.run();
+ }
- /**
- * Sets the current selection.
- * In for backwards compatability. Use selectionChanged() instead.
- * @param selection the new selection
- * @deprecated
- */
- @Deprecated
+ /**
+ * Sets the current selection. In for backwards compatability. Use
+ * selectionChanged() instead.
+ *
+ * @param selection the new selection
+ * @deprecated
+ */
+ @Deprecated
public void setSelection(IStructuredSelection selection) {
- selectionChanged(selection);
- }
+ selectionChanged(selection);
+ }
@Override
public void dispose() {
workbenchWindow = null;
- if (action!=null) {
+ if (action != null) {
action.dispose();
}
action = null;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ImportResourcesAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ImportResourcesAction.java
index 943d40445e0..88ea0d45d88 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ImportResourcesAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ImportResourcesAction.java
@@ -27,11 +27,10 @@ import org.eclipse.ui.internal.WorkbenchMessages;
* <p>
* This method automatically registers listeners so that it can keep its
* enablement state up to date. Ordinarily, the window's references to these
- * listeners will be dropped automatically when the window closes. However,
- * if the client needs to get rid of an action while the window is still open,
- * the client must call IWorkbenchAction#dispose to give the
- * action an opportunity to deregister its listeners and to perform any other
- * cleanup.
+ * listeners will be dropped automatically when the window closes. However, if
+ * the client needs to get rid of an action while the window is still open, the
+ * client must call IWorkbenchAction#dispose to give the action an opportunity
+ * to deregister its listeners and to perform any other cleanup.
*
* </p>
* <p>
@@ -42,83 +41,83 @@ import org.eclipse.ui.internal.WorkbenchMessages;
* @since 2.0
* @noextend This class is not intended to be subclassed by clients.
*/
-public class ImportResourcesAction extends BaseSelectionListenerAction
- implements ActionFactory.IWorkbenchAction {
- /**
- * Reference to the WorkbenchCommandAction that executes the Import Wizard.
- */
- private ActionFactory.IWorkbenchAction action;
+public class ImportResourcesAction extends BaseSelectionListenerAction implements ActionFactory.IWorkbenchAction {
+ /**
+ * Reference to the WorkbenchCommandAction that executes the Import Wizard.
+ */
+ private ActionFactory.IWorkbenchAction action;
- /**
- * The workbench window; or <code>null</code> if this
- * action has been <code>dispose</code>d.
- */
- private IWorkbenchWindow workbenchWindow;
+ /**
+ * The workbench window; or <code>null</code> if this action has been
+ * <code>dispose</code>d.
+ */
+ private IWorkbenchWindow workbenchWindow;
- /**
- * Create a new instance of this class.
- *
- * @param window the window
- */
- public ImportResourcesAction(IWorkbenchWindow window) {
- super(WorkbenchMessages.ImportResourcesAction_text);
- if (window == null) {
- throw new IllegalArgumentException();
- }
+ /**
+ * Create a new instance of this class.
+ *
+ * @param window the window
+ */
+ public ImportResourcesAction(IWorkbenchWindow window) {
+ super(WorkbenchMessages.ImportResourcesAction_text);
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
- this.workbenchWindow = window;
- action = ActionFactory.IMPORT.create(window);
+ this.workbenchWindow = window;
+ action = ActionFactory.IMPORT.create(window);
- setText(action.getText());
- setToolTipText(action.getToolTipText());
- setId(action.getId());
- setActionDefinitionId(action.getActionDefinitionId());
- window.getWorkbench().getHelpSystem().setHelp(this,
- IWorkbenchHelpContextIds.IMPORT_ACTION);
- setImageDescriptor(action.getImageDescriptor());
- }
+ setText(action.getText());
+ setToolTipText(action.getToolTipText());
+ setId(action.getId());
+ setActionDefinitionId(action.getActionDefinitionId());
+ window.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.IMPORT_ACTION);
+ setImageDescriptor(action.getImageDescriptor());
+ }
- /**
- * Create a new instance of this class
- *
- * @param workbench the workbench
- * @deprecated use the constructor <code>ImportResourcesAction(IWorkbenchWindow)</code>
- */
- @Deprecated
+ /**
+ * Create a new instance of this class
+ *
+ * @param workbench the workbench
+ * @deprecated use the constructor
+ * <code>ImportResourcesAction(IWorkbenchWindow)</code>
+ */
+ @Deprecated
public ImportResourcesAction(IWorkbench workbench) {
- this(workbench.getActiveWorkbenchWindow());
- }
+ this(workbench.getActiveWorkbenchWindow());
+ }
- /**
- * Invoke the Import wizards selection Wizard.
- */
- @Override
+ /**
+ * Invoke the Import wizards selection Wizard.
+ */
+ @Override
public void run() {
- if (workbenchWindow == null) {
- // action has been disposed
- return;
- }
+ if (workbenchWindow == null) {
+ // action has been disposed
+ return;
+ }
- action.run();
- }
+ action.run();
+ }
- /**
- * Sets the current selection.
- * In for backwards compatability. Use selectionChanged() instead.
- * @param selection the new selection
- * @deprecated
- */
- @Deprecated
+ /**
+ * Sets the current selection. In for backwards compatability. Use
+ * selectionChanged() instead.
+ *
+ * @param selection the new selection
+ * @deprecated
+ */
+ @Deprecated
public void setSelection(IStructuredSelection selection) {
- selectionChanged(selection);
- }
+ selectionChanged(selection);
+ }
- @Override
+ @Override
public void dispose() {
- workbenchWindow = null;
- if (action!=null) {
- action.dispose();
- }
- action = null;
- }
+ workbenchWindow = null;
+ if (action != null) {
+ action.dispose();
+ }
+ action = null;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/LabelRetargetAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/LabelRetargetAction.java
index a0f8bd937cd..f4b2571908c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/LabelRetargetAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/LabelRetargetAction.java
@@ -19,9 +19,8 @@ import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.util.PropertyChangeEvent;
/**
- * A <code>LabelRetargetAction</code> extends the behavior of
- * RetargetAction. It will track the enable state, label, and
- * tool tip text of the target action..
+ * A <code>LabelRetargetAction</code> extends the behavior of RetargetAction. It
+ * will track the enable state, label, and tool tip text of the target action..
* <p>
* This class may be instantiated. It is not intented to be subclassed.
* </p>
@@ -30,169 +29,169 @@ import org.eclipse.jface.util.PropertyChangeEvent;
* @noextend This class is not intended to be subclassed by clients.
*/
public class LabelRetargetAction extends RetargetAction {
- private String defaultText;
-
- private String defaultToolTipText;
-
- private ImageDescriptor defaultHoverImage;
-
- private ImageDescriptor defaultImage;
-
- private ImageDescriptor defaultDisabledImage;
-
- private String acceleratorText;
-
- /**
- * Constructs a LabelRetargetAction with the given action id and text.
- *
- * @param actionID the retargetable action id
- * @param text the action's text, or <code>null</code> if there is no text
- */
- public LabelRetargetAction(String actionID, String text) {
- this(actionID, text, IAction.AS_UNSPECIFIED);
- }
-
- /**
- * Constructs a RetargetAction with the given action id, text and style.
- *
- * @param actionID the retargetable action id
- * @param text the action's text, or <code>null</code> if there is no text
- * @param style one of <code>AS_PUSH_BUTTON</code>, <code>AS_CHECK_BOX</code>,
- * <code>AS_DROP_DOWN_MENU</code>, <code>AS_RADIO_BUTTON</code>, and
- * <code>AS_UNSPECIFIED</code>.
- * @since 3.0
- */
- public LabelRetargetAction(String actionID, String text, int style) {
- super(actionID, text, style);
- this.defaultText = text;
- this.defaultToolTipText = text;
- acceleratorText = LegacyActionTools.extractAcceleratorText(text);
- }
-
- /**
- * The action handler has changed. Update self.
- */
- @Override
+ private String defaultText;
+
+ private String defaultToolTipText;
+
+ private ImageDescriptor defaultHoverImage;
+
+ private ImageDescriptor defaultImage;
+
+ private ImageDescriptor defaultDisabledImage;
+
+ private String acceleratorText;
+
+ /**
+ * Constructs a LabelRetargetAction with the given action id and text.
+ *
+ * @param actionID the retargetable action id
+ * @param text the action's text, or <code>null</code> if there is no text
+ */
+ public LabelRetargetAction(String actionID, String text) {
+ this(actionID, text, IAction.AS_UNSPECIFIED);
+ }
+
+ /**
+ * Constructs a RetargetAction with the given action id, text and style.
+ *
+ * @param actionID the retargetable action id
+ * @param text the action's text, or <code>null</code> if there is no text
+ * @param style one of <code>AS_PUSH_BUTTON</code>,
+ * <code>AS_CHECK_BOX</code>, <code>AS_DROP_DOWN_MENU</code>,
+ * <code>AS_RADIO_BUTTON</code>, and
+ * <code>AS_UNSPECIFIED</code>.
+ * @since 3.0
+ */
+ public LabelRetargetAction(String actionID, String text, int style) {
+ super(actionID, text, style);
+ this.defaultText = text;
+ this.defaultToolTipText = text;
+ acceleratorText = LegacyActionTools.extractAcceleratorText(text);
+ }
+
+ /**
+ * The action handler has changed. Update self.
+ */
+ @Override
protected void propagateChange(PropertyChangeEvent event) {
- super.propagateChange(event);
- String prop = event.getProperty();
- if (prop.equals(IAction.TEXT)) {
- String str = (String) event.getNewValue();
- super.setText(appendAccelerator(str));
- } else if (prop.equals(IAction.TOOL_TIP_TEXT)) {
- String str = (String) event.getNewValue();
- super.setToolTipText(str);
- } else if (prop.equals(IAction.IMAGE)) {
- updateImages(getActionHandler());
- }
- }
-
- /**
- * Sets the action handler. Update self.
- */
- @Override
+ super.propagateChange(event);
+ String prop = event.getProperty();
+ if (prop.equals(IAction.TEXT)) {
+ String str = (String) event.getNewValue();
+ super.setText(appendAccelerator(str));
+ } else if (prop.equals(IAction.TOOL_TIP_TEXT)) {
+ String str = (String) event.getNewValue();
+ super.setToolTipText(str);
+ } else if (prop.equals(IAction.IMAGE)) {
+ updateImages(getActionHandler());
+ }
+ }
+
+ /**
+ * Sets the action handler. Update self.
+ */
+ @Override
protected void setActionHandler(IAction handler) {
- // Run the default behavior.
- super.setActionHandler(handler);
-
- // Now update the label, tooltip and images.
- if (handler == null) {
- super.setText(defaultText);
- super.setToolTipText(defaultToolTipText);
- } else {
- // If no text is specified by the handler, use the default text. Fixes 22529.
- String handlerText = handler.getText();
- if (handlerText == null || handlerText.length() == 0) {
- handlerText = defaultText;
- }
- super.setText(appendAccelerator(handlerText));
- super.setToolTipText(handler.getToolTipText());
- }
- updateImages(handler);
- }
-
- @Override
+ // Run the default behavior.
+ super.setActionHandler(handler);
+
+ // Now update the label, tooltip and images.
+ if (handler == null) {
+ super.setText(defaultText);
+ super.setToolTipText(defaultToolTipText);
+ } else {
+ // If no text is specified by the handler, use the default text. Fixes 22529.
+ String handlerText = handler.getText();
+ if (handlerText == null || handlerText.length() == 0) {
+ handlerText = defaultText;
+ }
+ super.setText(appendAccelerator(handlerText));
+ super.setToolTipText(handler.getToolTipText());
+ }
+ updateImages(handler);
+ }
+
+ @Override
public void setDisabledImageDescriptor(ImageDescriptor image) {
- super.setDisabledImageDescriptor(image);
- defaultDisabledImage = image;
- }
+ super.setDisabledImageDescriptor(image);
+ defaultDisabledImage = image;
+ }
- @Override
+ @Override
public void setHoverImageDescriptor(ImageDescriptor image) {
- super.setHoverImageDescriptor(image);
- defaultHoverImage = image;
- }
+ super.setHoverImageDescriptor(image);
+ defaultHoverImage = image;
+ }
- @Override
+ @Override
public void setImageDescriptor(ImageDescriptor image) {
- super.setImageDescriptor(image);
- defaultImage = image;
- }
-
- /**
- * Sets the action's label text to the given value.
- */
- @Override
+ super.setImageDescriptor(image);
+ defaultImage = image;
+ }
+
+ /**
+ * Sets the action's label text to the given value.
+ */
+ @Override
public void setText(String text) {
- super.setText(text);
- acceleratorText = LegacyActionTools.extractAcceleratorText(text);
- defaultText = text;
- }
-
- /**
- * Sets the tooltip text to the given text.
- * The value <code>null</code> clears the tooltip text.
- */
- @Override
+ super.setText(text);
+ acceleratorText = LegacyActionTools.extractAcceleratorText(text);
+ defaultText = text;
+ }
+
+ /**
+ * Sets the tooltip text to the given text. The value <code>null</code> clears
+ * the tooltip text.
+ */
+ @Override
public void setToolTipText(String text) {
- super.setToolTipText(text);
- defaultToolTipText = text;
- }
-
- /**
- * Ensures the accelerator is correct in the text (handlers are not
- * allowed to change the accelerator).
- */
- private String appendAccelerator(String newText) {
- if (newText == null) {
+ super.setToolTipText(text);
+ defaultToolTipText = text;
+ }
+
+ /**
+ * Ensures the accelerator is correct in the text (handlers are not allowed to
+ * change the accelerator).
+ */
+ private String appendAccelerator(String newText) {
+ if (newText == null) {
return null;
}
- // Remove any accelerator
- String str = removeAcceleratorText(newText);
- // Append our accelerator
- if (acceleratorText != null) {
+ // Remove any accelerator
+ String str = removeAcceleratorText(newText);
+ // Append our accelerator
+ if (acceleratorText != null) {
str = str + '\t' + acceleratorText;
} else if (str != newText) {
str = str + '\t';
}
- return str;
- }
-
- /**
- * Updates the images for this action based on the given handler.
- */
- private void updateImages(IAction handler) {
- if (handler == null) {
- super.setHoverImageDescriptor(defaultHoverImage);
- super.setImageDescriptor(defaultImage);
- super.setDisabledImageDescriptor(defaultDisabledImage);
- } else {
- // use the default images if the handler has no images set
- ImageDescriptor hoverImage = handler.getHoverImageDescriptor();
- ImageDescriptor image = handler.getImageDescriptor();
- ImageDescriptor disabledImage = handler
- .getDisabledImageDescriptor();
- if (hoverImage != null || image != null || disabledImage != null) {
- super.setHoverImageDescriptor(hoverImage);
- super.setImageDescriptor(image);
- super.setDisabledImageDescriptor(disabledImage);
- } else {
- super.setHoverImageDescriptor(defaultHoverImage);
- super.setImageDescriptor(defaultImage);
- super.setDisabledImageDescriptor(defaultDisabledImage);
- }
- }
- }
+ return str;
+ }
+
+ /**
+ * Updates the images for this action based on the given handler.
+ */
+ private void updateImages(IAction handler) {
+ if (handler == null) {
+ super.setHoverImageDescriptor(defaultHoverImage);
+ super.setImageDescriptor(defaultImage);
+ super.setDisabledImageDescriptor(defaultDisabledImage);
+ } else {
+ // use the default images if the handler has no images set
+ ImageDescriptor hoverImage = handler.getHoverImageDescriptor();
+ ImageDescriptor image = handler.getImageDescriptor();
+ ImageDescriptor disabledImage = handler.getDisabledImageDescriptor();
+ if (hoverImage != null || image != null || disabledImage != null) {
+ super.setHoverImageDescriptor(hoverImage);
+ super.setImageDescriptor(image);
+ super.setDisabledImageDescriptor(disabledImage);
+ } else {
+ super.setHoverImageDescriptor(defaultHoverImage);
+ super.setImageDescriptor(defaultImage);
+ super.setDisabledImageDescriptor(defaultDisabledImage);
+ }
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/NewWizardAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/NewWizardAction.java
index 42c4338e00a..dd9090390d3 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/NewWizardAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/NewWizardAction.java
@@ -43,100 +43,99 @@ import org.eclipse.ui.internal.dialogs.NewWizard;
* <p>
* This method automatically registers listeners so that it can keep its
* enablement state up to date. Ordinarily, the window's references to these
- * listeners will be dropped automatically when the window closes. However,
- * if the client needs to get rid of an action while the window is still open,
- * the client must call #dispose() to give the
- * action an opportunity to deregister its listeners and to perform any other
- * cleanup.
+ * listeners will be dropped automatically when the window closes. However, if
+ * the client needs to get rid of an action while the window is still open, the
+ * client must call #dispose() to give the action an opportunity to deregister
+ * its listeners and to perform any other cleanup.
* </p>
+ *
* @noextend This class is not intended to be subclassed by clients.
*/
-public class NewWizardAction extends Action implements
- ActionFactory.IWorkbenchAction {
+public class NewWizardAction extends Action implements ActionFactory.IWorkbenchAction {
- /**
- * The wizard dialog width
- */
- private static final int SIZING_WIZARD_WIDTH = 500;
+ /**
+ * The wizard dialog width
+ */
+ private static final int SIZING_WIZARD_WIDTH = 500;
- /**
- * The wizard dialog height
- */
- private static final int SIZING_WIZARD_HEIGHT = 500;
+ /**
+ * The wizard dialog height
+ */
+ private static final int SIZING_WIZARD_HEIGHT = 500;
- /**
- * The id of the category to show or <code>null</code> to
- * show all the categories.
- */
- private String categoryId = null;
+ /**
+ * The id of the category to show or <code>null</code> to show all the
+ * categories.
+ */
+ private String categoryId = null;
/**
- * The title of the wizard window or <code>null</code> to use the default
- * wizard window title.
+ * The title of the wizard window or <code>null</code> to use the default wizard
+ * window title.
*/
private String windowTitle = null;
- /**
- * The workbench window; or <code>null</code> if this
- * action has been <code>dispose</code>d.
- */
- private IWorkbenchWindow workbenchWindow;
-
- /**
- * Tracks perspective activation, to update this action's
- * enabled state.
- */
- private PerspectiveTracker tracker;
-
- /**
- * Create a new instance of this class.
- * @param window
- */
- public NewWizardAction(IWorkbenchWindow window) {
- super(WorkbenchMessages.NewWizardAction_text);
- if (window == null) {
- throw new IllegalArgumentException();
- }
- this.workbenchWindow = window;
- tracker = new PerspectiveTracker(window, this);
- // @issues should be IDE-specific images
- ISharedImages images = PlatformUI.getWorkbench().getSharedImages();
- setImageDescriptor(images
- .getImageDescriptor(ISharedImages.IMG_TOOL_NEW_WIZARD));
- setDisabledImageDescriptor(images
- .getImageDescriptor(ISharedImages.IMG_TOOL_NEW_WIZARD_DISABLED));
- setToolTipText(WorkbenchMessages.NewWizardAction_toolTip);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
- IWorkbenchHelpContextIds.NEW_ACTION);
- }
-
- /**
- * Create a new instance of this class
- *
- * @deprecated use the constructor <code>NewWizardAction(IWorkbenchWindow)</code>
- */
- @Deprecated
+ /**
+ * The workbench window; or <code>null</code> if this action has been
+ * <code>dispose</code>d.
+ */
+ private IWorkbenchWindow workbenchWindow;
+
+ /**
+ * Tracks perspective activation, to update this action's enabled state.
+ */
+ private PerspectiveTracker tracker;
+
+ /**
+ * Create a new instance of this class.
+ *
+ * @param window
+ */
+ public NewWizardAction(IWorkbenchWindow window) {
+ super(WorkbenchMessages.NewWizardAction_text);
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ this.workbenchWindow = window;
+ tracker = new PerspectiveTracker(window, this);
+ // @issues should be IDE-specific images
+ ISharedImages images = PlatformUI.getWorkbench().getSharedImages();
+ setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_NEW_WIZARD));
+ setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_NEW_WIZARD_DISABLED));
+ setToolTipText(WorkbenchMessages.NewWizardAction_toolTip);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.NEW_ACTION);
+ }
+
+ /**
+ * Create a new instance of this class
+ *
+ * @deprecated use the constructor
+ * <code>NewWizardAction(IWorkbenchWindow)</code>
+ */
+ @Deprecated
public NewWizardAction() {
- this(PlatformUI.getWorkbench().getActiveWorkbenchWindow());
- }
-
- /**
- * Returns the id of the category of wizards to show
- * or <code>null</code> to show all categories.
- * @return String
- */
- public String getCategoryId() {
- return categoryId;
- }
-
- /**
- * Sets the id of the category of wizards to show
- * or <code>null</code> to show all categories.
- * @param id
- */
- public void setCategoryId(String id) {
- categoryId = id;
- }
+ this(PlatformUI.getWorkbench().getActiveWorkbenchWindow());
+ }
+
+ /**
+ * Returns the id of the category of wizards to show or <code>null</code> to
+ * show all categories.
+ *
+ * @return String
+ */
+ public String getCategoryId() {
+ return categoryId;
+ }
+
+ /**
+ * Sets the id of the category of wizards to show or <code>null</code> to show
+ * all categories.
+ *
+ * @param id
+ */
+ public void setCategoryId(String id) {
+ categoryId = id;
+ }
/**
* <p>
@@ -157,69 +156,62 @@ public class NewWizardAction extends Action implements
this.windowTitle = windowTitle;
}
- @Override
+ @Override
public void run() {
- if (workbenchWindow == null) {
- // action has been disposed
- return;
- }
- NewWizard wizard = new NewWizard();
- wizard.setCategoryId(categoryId);
+ if (workbenchWindow == null) {
+ // action has been disposed
+ return;
+ }
+ NewWizard wizard = new NewWizard();
+ wizard.setCategoryId(categoryId);
wizard.setWindowTitle(windowTitle);
- ISelection selection = workbenchWindow.getSelectionService()
- .getSelection();
- IStructuredSelection selectionToPass = StructuredSelection.EMPTY;
- if (selection instanceof IStructuredSelection) {
- selectionToPass = (IStructuredSelection) selection;
- } else {
- // @issue the following is resource-specific legacy code
- // Build the selection from the IFile of the editor
- Class resourceClass = LegacyResourceSupport.getResourceClass();
- if (resourceClass != null) {
- IWorkbenchPart part = workbenchWindow.getPartService()
- .getActivePart();
- if (part instanceof IEditorPart) {
- IEditorInput input = ((IEditorPart) part).getEditorInput();
+ ISelection selection = workbenchWindow.getSelectionService().getSelection();
+ IStructuredSelection selectionToPass = StructuredSelection.EMPTY;
+ if (selection instanceof IStructuredSelection) {
+ selectionToPass = (IStructuredSelection) selection;
+ } else {
+ // @issue the following is resource-specific legacy code
+ // Build the selection from the IFile of the editor
+ Class resourceClass = LegacyResourceSupport.getResourceClass();
+ if (resourceClass != null) {
+ IWorkbenchPart part = workbenchWindow.getPartService().getActivePart();
+ if (part instanceof IEditorPart) {
+ IEditorInput input = ((IEditorPart) part).getEditorInput();
Object resource = Adapters.adapt(input, resourceClass);
- if (resource != null) {
- selectionToPass = new StructuredSelection(resource);
- }
- }
- }
- }
-
- wizard.init(workbenchWindow.getWorkbench(), selectionToPass);
-
- IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault()
- .getDialogSettings();
- IDialogSettings wizardSettings = workbenchSettings
- .getSection("NewWizardAction"); //$NON-NLS-1$
- if (wizardSettings == null) {
+ if (resource != null) {
+ selectionToPass = new StructuredSelection(resource);
+ }
+ }
+ }
+ }
+
+ wizard.init(workbenchWindow.getWorkbench(), selectionToPass);
+
+ IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
+ IDialogSettings wizardSettings = workbenchSettings.getSection("NewWizardAction"); //$NON-NLS-1$
+ if (wizardSettings == null) {
wizardSettings = workbenchSettings.addNewSection("NewWizardAction"); //$NON-NLS-1$
}
- wizard.setDialogSettings(wizardSettings);
- wizard.setForcePreviousAndNextButtons(true);
-
- Shell parent = workbenchWindow.getShell();
- WizardDialog dialog = new WizardDialog(parent, wizard);
- dialog.create();
- dialog.getShell().setSize(
- Math.max(SIZING_WIZARD_WIDTH, dialog.getShell().getSize().x),
- SIZING_WIZARD_HEIGHT);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(dialog.getShell(),
- IWorkbenchHelpContextIds.NEW_WIZARD);
- dialog.open();
- }
-
- @Override
+ wizard.setDialogSettings(wizardSettings);
+ wizard.setForcePreviousAndNextButtons(true);
+
+ Shell parent = workbenchWindow.getShell();
+ WizardDialog dialog = new WizardDialog(parent, wizard);
+ dialog.create();
+ dialog.getShell().setSize(Math.max(SIZING_WIZARD_WIDTH, dialog.getShell().getSize().x), SIZING_WIZARD_HEIGHT);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(dialog.getShell(), IWorkbenchHelpContextIds.NEW_WIZARD);
+ dialog.open();
+ }
+
+ @Override
public void dispose() {
- if (workbenchWindow == null) {
- // action has already been disposed
- return;
- }
- tracker.dispose();
- workbenchWindow = null;
- }
+ if (workbenchWindow == null) {
+ // action has already been disposed
+ return;
+ }
+ tracker.dispose();
+ workbenchWindow = null;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/NewWizardDropDownAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/NewWizardDropDownAction.java
index 46805886534..60627436c47 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/NewWizardDropDownAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/NewWizardDropDownAction.java
@@ -27,71 +27,68 @@ import org.eclipse.ui.internal.PerspectiveTracker;
import org.eclipse.ui.internal.WorkbenchMessages;
/**
- * Action which, when run, will open the new wizard dialog.
- * In addition, it has a drop-down showing the new wizard shortcuts
- * associated with the current perspective.
+ * Action which, when run, will open the new wizard dialog. In addition, it has
+ * a drop-down showing the new wizard shortcuts associated with the current
+ * perspective.
* <p>
* This class may be instantiated; it is not intended to be subclassed.
* </p>
*
* @since 3.1
*/
-public class NewWizardDropDownAction extends Action implements
- ActionFactory.IWorkbenchAction {
+public class NewWizardDropDownAction extends Action implements ActionFactory.IWorkbenchAction {
- /**
- * The workbench window; or <code>null</code> if this
- * action has been <code>dispose</code>d.
- */
- private IWorkbenchWindow workbenchWindow;
+ /**
+ * The workbench window; or <code>null</code> if this action has been
+ * <code>dispose</code>d.
+ */
+ private IWorkbenchWindow workbenchWindow;
- /**
- * Tracks perspective activation, to update this action's
- * enabled state.
- */
- private PerspectiveTracker tracker;
+ /**
+ * Tracks perspective activation, to update this action's enabled state.
+ */
+ private PerspectiveTracker tracker;
- private ActionFactory.IWorkbenchAction showDlgAction;
+ private ActionFactory.IWorkbenchAction showDlgAction;
- private IContributionItem newWizardMenu;
+ private IContributionItem newWizardMenu;
- private IMenuCreator menuCreator = new IMenuCreator() {
+ private IMenuCreator menuCreator = new IMenuCreator() {
- private MenuManager dropDownMenuMgr;
+ private MenuManager dropDownMenuMgr;
- /**
- * Creates the menu manager for the drop-down.
- */
- private void createDropDownMenuMgr() {
- if (dropDownMenuMgr == null) {
- dropDownMenuMgr = new MenuManager();
- dropDownMenuMgr.add(newWizardMenu);
- }
- }
+ /**
+ * Creates the menu manager for the drop-down.
+ */
+ private void createDropDownMenuMgr() {
+ if (dropDownMenuMgr == null) {
+ dropDownMenuMgr = new MenuManager();
+ dropDownMenuMgr.add(newWizardMenu);
+ }
+ }
- @Override
+ @Override
public Menu getMenu(Control parent) {
- createDropDownMenuMgr();
- return dropDownMenuMgr.createContextMenu(parent);
- }
+ createDropDownMenuMgr();
+ return dropDownMenuMgr.createContextMenu(parent);
+ }
- @Override
+ @Override
public Menu getMenu(Menu parent) {
- createDropDownMenuMgr();
- Menu menu = new Menu(parent);
- IContributionItem[] items = dropDownMenuMgr.getItems();
- for (IContributionItem item : items) {
- IContributionItem newItem = item;
- if (item instanceof ActionContributionItem) {
- newItem = new ActionContributionItem(
- ((ActionContributionItem) item).getAction());
- }
- newItem.fill(menu, -1);
- }
- return menu;
- }
-
- @Override
+ createDropDownMenuMgr();
+ Menu menu = new Menu(parent);
+ IContributionItem[] items = dropDownMenuMgr.getItems();
+ for (IContributionItem item : items) {
+ IContributionItem newItem = item;
+ if (item instanceof ActionContributionItem) {
+ newItem = new ActionContributionItem(((ActionContributionItem) item).getAction());
+ }
+ newItem.fill(menu, -1);
+ }
+ return menu;
+ }
+
+ @Override
public void dispose() {
if (dropDownMenuMgr != null) {
// remove the wizard menu before disposing the menu manager, the
@@ -106,76 +103,72 @@ public class NewWizardDropDownAction extends Action implements
dropDownMenuMgr.dispose();
dropDownMenuMgr = null;
}
- }
- };
-
- /**
- * Create a new <code>NewWizardDropDownAction</code>, with the default
- * action for opening the new wizard dialog, and the default contribution item
- * for populating the drop-down menu.
- *
- * @param window the window in which this action appears
- */
- public NewWizardDropDownAction(IWorkbenchWindow window) {
- this(window, ActionFactory.NEW.create(window), ContributionItemFactory.NEW_WIZARD_SHORTLIST.create(window));
- }
-
- /**
- * Create a new <code>NewWizardDropDownAction</code>.
- *
- * @param window the window in which this action appears
- * @param showDlgAction the action to delegate to when this action is run directly,
- * rather than being dropped down
- * @param newWizardMenu the contribution item that adds the contents to the drop-down menu
- */
- public NewWizardDropDownAction(IWorkbenchWindow window,
- ActionFactory.IWorkbenchAction showDlgAction,
- IContributionItem newWizardMenu) {
- super(WorkbenchMessages.NewWizardDropDown_text);
- if (window == null) {
- throw new IllegalArgumentException();
- }
- this.workbenchWindow = window;
- this.showDlgAction = showDlgAction;
- this.newWizardMenu = newWizardMenu;
- tracker = new PerspectiveTracker(window, this);
-
- setToolTipText(showDlgAction.getToolTipText());
-
- ISharedImages sharedImages = window.getWorkbench()
- .getSharedImages();
- setImageDescriptor(sharedImages
- .getImageDescriptor(ISharedImages.IMG_TOOL_NEW_WIZARD));
- setDisabledImageDescriptor(sharedImages
- .getImageDescriptor(ISharedImages.IMG_TOOL_NEW_WIZARD_DISABLED));
-
- setMenuCreator(menuCreator);
- }
-
-
- @Override
+ }
+ };
+
+ /**
+ * Create a new <code>NewWizardDropDownAction</code>, with the default action
+ * for opening the new wizard dialog, and the default contribution item for
+ * populating the drop-down menu.
+ *
+ * @param window the window in which this action appears
+ */
+ public NewWizardDropDownAction(IWorkbenchWindow window) {
+ this(window, ActionFactory.NEW.create(window), ContributionItemFactory.NEW_WIZARD_SHORTLIST.create(window));
+ }
+
+ /**
+ * Create a new <code>NewWizardDropDownAction</code>.
+ *
+ * @param window the window in which this action appears
+ * @param showDlgAction the action to delegate to when this action is run
+ * directly, rather than being dropped down
+ * @param newWizardMenu the contribution item that adds the contents to the
+ * drop-down menu
+ */
+ public NewWizardDropDownAction(IWorkbenchWindow window, ActionFactory.IWorkbenchAction showDlgAction,
+ IContributionItem newWizardMenu) {
+ super(WorkbenchMessages.NewWizardDropDown_text);
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ this.workbenchWindow = window;
+ this.showDlgAction = showDlgAction;
+ this.newWizardMenu = newWizardMenu;
+ tracker = new PerspectiveTracker(window, this);
+
+ setToolTipText(showDlgAction.getToolTipText());
+
+ ISharedImages sharedImages = window.getWorkbench().getSharedImages();
+ setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_NEW_WIZARD));
+ setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_NEW_WIZARD_DISABLED));
+
+ setMenuCreator(menuCreator);
+ }
+
+ @Override
public void dispose() {
- if (workbenchWindow == null) {
- // action has already been disposed
- return;
- }
- tracker.dispose();
- showDlgAction.dispose();
- newWizardMenu.dispose();
- menuCreator.dispose();
- workbenchWindow = null;
- }
-
- /**
- * Runs the action, which opens the New wizard dialog.
- */
- @Override
+ if (workbenchWindow == null) {
+ // action has already been disposed
+ return;
+ }
+ tracker.dispose();
+ showDlgAction.dispose();
+ newWizardMenu.dispose();
+ menuCreator.dispose();
+ workbenchWindow = null;
+ }
+
+ /**
+ * Runs the action, which opens the New wizard dialog.
+ */
+ @Override
public void run() {
- if (workbenchWindow == null) {
- // action has been disposed
- return;
- }
- showDlgAction.run();
- }
+ if (workbenchWindow == null) {
+ // action has been disposed
+ return;
+ }
+ showDlgAction.run();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenInNewWindowAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenInNewWindowAction.java
index 19474d46615..1362e3eeb9c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenInNewWindowAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenInNewWindowAction.java
@@ -28,99 +28,90 @@ import org.eclipse.ui.internal.misc.StatusUtil;
import org.eclipse.ui.statushandlers.StatusManager;
/**
- * Opens a new window. The initial perspective
- * for the new window will be the same type as
- * the active perspective in the window which this
- * action is running in. The default input for the
- * new window's page is application-specific.
+ * Opens a new window. The initial perspective for the new window will be the
+ * same type as the active perspective in the window which this action is
+ * running in. The default input for the new window's page is
+ * application-specific.
*/
-public class OpenInNewWindowAction extends Action implements
- ActionFactory.IWorkbenchAction {
+public class OpenInNewWindowAction extends Action implements ActionFactory.IWorkbenchAction {
- /**
- * The workbench window; or <code>null</code> if this
- * action has been <code>dispose</code>d.
- */
- private IWorkbenchWindow workbenchWindow;
+ /**
+ * The workbench window; or <code>null</code> if this action has been
+ * <code>dispose</code>d.
+ */
+ private IWorkbenchWindow workbenchWindow;
- private IAdaptable pageInput;
+ private IAdaptable pageInput;
- /**
- * Creates a new <code>OpenInNewWindowAction</code>. Sets
- * the new window page's input to be an application-specific
- * default.
- *
- * @param window the workbench window containing this action
- */
- public OpenInNewWindowAction(IWorkbenchWindow window) {
- this(window, ((Workbench) window.getWorkbench()).getDefaultPageInput());
+ /**
+ * Creates a new <code>OpenInNewWindowAction</code>. Sets the new window page's
+ * input to be an application-specific default.
+ *
+ * @param window the workbench window containing this action
+ */
+ public OpenInNewWindowAction(IWorkbenchWindow window) {
+ this(window, ((Workbench) window.getWorkbench()).getDefaultPageInput());
setActionDefinitionId(IWorkbenchCommandConstants.WINDOW_NEW_WINDOW);
- }
+ }
- /**
- * Creates a new <code>OpenInNewWindowAction</code>.
- *
- * @param window the workbench window containing this action
- * @param input the input for the new window's page
- */
- public OpenInNewWindowAction(IWorkbenchWindow window, IAdaptable input) {
- super(WorkbenchMessages.OpenInNewWindowAction_text);
- if (window == null) {
- throw new IllegalArgumentException();
- }
- this.workbenchWindow = window;
- // @issue missing action id
- setToolTipText(WorkbenchMessages.OpenInNewWindowAction_toolTip);
- pageInput = input;
- window.getWorkbench().getHelpSystem().setHelp(this,
- IWorkbenchHelpContextIds.OPEN_NEW_WINDOW_ACTION);
- }
+ /**
+ * Creates a new <code>OpenInNewWindowAction</code>.
+ *
+ * @param window the workbench window containing this action
+ * @param input the input for the new window's page
+ */
+ public OpenInNewWindowAction(IWorkbenchWindow window, IAdaptable input) {
+ super(WorkbenchMessages.OpenInNewWindowAction_text);
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ this.workbenchWindow = window;
+ // @issue missing action id
+ setToolTipText(WorkbenchMessages.OpenInNewWindowAction_toolTip);
+ pageInput = input;
+ window.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.OPEN_NEW_WINDOW_ACTION);
+ }
- /**
- * Set the input to use for the new window's page.
- *
- * @param input the input
- */
- public void setPageInput(IAdaptable input) {
- pageInput = input;
- }
+ /**
+ * Set the input to use for the new window's page.
+ *
+ * @param input the input
+ */
+ public void setPageInput(IAdaptable input) {
+ pageInput = input;
+ }
- /**
- * The implementation of this <code>IAction</code> method
- * opens a new window. The initial perspective
- * for the new window will be the same type as
- * the active perspective in the window which this
- * action is running in.
- */
- @Override
+ /**
+ * The implementation of this <code>IAction</code> method opens a new window.
+ * The initial perspective for the new window will be the same type as the
+ * active perspective in the window which this action is running in.
+ */
+ @Override
public void run() {
- if (workbenchWindow == null) {
- // action has been disposed
- return;
- }
- try {
- String perspId;
+ if (workbenchWindow == null) {
+ // action has been disposed
+ return;
+ }
+ try {
+ String perspId;
- IWorkbenchPage page = workbenchWindow.getActivePage();
- if (page != null && page.getPerspective() != null) {
+ IWorkbenchPage page = workbenchWindow.getActivePage();
+ if (page != null && page.getPerspective() != null) {
perspId = page.getPerspective().getId();
} else {
- perspId = workbenchWindow.getWorkbench()
- .getPerspectiveRegistry().getDefaultPerspective();
+ perspId = workbenchWindow.getWorkbench().getPerspectiveRegistry().getDefaultPerspective();
}
- workbenchWindow.getWorkbench().openWorkbenchWindow(perspId,
- pageInput);
- } catch (WorkbenchException e) {
+ workbenchWindow.getWorkbench().openWorkbenchWindow(perspId, pageInput);
+ } catch (WorkbenchException e) {
StatusUtil.handleStatus(e.getStatus(),
- WorkbenchMessages.OpenInNewWindowAction_errorTitle
- + ": " + e.getMessage(), //$NON-NLS-1$
+ WorkbenchMessages.OpenInNewWindowAction_errorTitle + ": " + e.getMessage(), //$NON-NLS-1$
StatusManager.SHOW);
- }
- }
+ }
+ }
- @Override
+ @Override
public void dispose() {
- workbenchWindow = null;
- }
+ workbenchWindow = null;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenNewPageMenu.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenNewPageMenu.java
index 80d05c5000a..2c183347f00 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenNewPageMenu.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenNewPageMenu.java
@@ -24,84 +24,85 @@ import org.eclipse.ui.statushandlers.StatusManager;
/**
* A menu for page creation in the workbench.
* <p>
- * An <code>OpenNewPageMenu</code> is used to populate a menu with
- * "Open Page" actions. One item is added for each shortcut perspective,
- * as defined by the product ini. If the user selects one of these items a new page is
- * created in the workbench with the given perspective.
- * </p><p>
+ * An <code>OpenNewPageMenu</code> is used to populate a menu with "Open Page"
+ * actions. One item is added for each shortcut perspective, as defined by the
+ * product ini. If the user selects one of these items a new page is created in
+ * the workbench with the given perspective.
+ * </p>
+ * <p>
* The visible perspectives within the menu may also be updated dynamically to
* reflect user preference.
- * </p><p>
+ * </p>
+ * <p>
* The input for the page is determined by the value of <code>pageInput</code>.
* The input should be passed into the constructor of this class or set using
* the <code>setPageInput</code> method.
- * </p><p>
+ * </p>
+ * <p>
* This class may be instantiated; it is not intended to be subclassed.
* </p>
- * @deprecated Workbench no longer exposes the concept of "pages" in the
- * user ui model. See IWorkbench.showPerspective methods.
+ *
+ * @deprecated Workbench no longer exposes the concept of "pages" in the user ui
+ * model. See IWorkbench.showPerspective methods.
* @noextend This class is not intended to be subclassed by clients.
*/
@Deprecated
public class OpenNewPageMenu extends PerspectiveMenu {
- private IAdaptable pageInput;
+ private IAdaptable pageInput;
- /**
- * Constructs a new instance of <code>OpenNewPageMenu</code>.
- * <p>
- * If this method is used be sure to set the page input by invoking
- * <code>setPageInput</code>. The page input is required when the user
- * selects an item in the menu. At that point the menu will attempt to
- * open a new page with the selected perspective and page input. If there
- * is no page input an error dialog will be opened.
- * </p>
- *
- * @param window the window where a new page is created if an item within
- * the menu is selected
- */
- public OpenNewPageMenu(IWorkbenchWindow window) {
- this(window, null);
- }
+ /**
+ * Constructs a new instance of <code>OpenNewPageMenu</code>.
+ * <p>
+ * If this method is used be sure to set the page input by invoking
+ * <code>setPageInput</code>. The page input is required when the user selects
+ * an item in the menu. At that point the menu will attempt to open a new page
+ * with the selected perspective and page input. If there is no page input an
+ * error dialog will be opened.
+ * </p>
+ *
+ * @param window the window where a new page is created if an item within the
+ * menu is selected
+ */
+ public OpenNewPageMenu(IWorkbenchWindow window) {
+ this(window, null);
+ }
- /**
- * Constructs a new instance of <code>OpenNewPageMenu</code>.
- *
- * @param window the window where a new page is created if an item within
- * the menu is selected
- * @param input the page input
- */
- public OpenNewPageMenu(IWorkbenchWindow window, IAdaptable input) {
- super(window, "Open New Page Menu");//$NON-NLS-1$
- this.pageInput = input;
- }
+ /**
+ * Constructs a new instance of <code>OpenNewPageMenu</code>.
+ *
+ * @param window the window where a new page is created if an item within the
+ * menu is selected
+ * @param input the page input
+ */
+ public OpenNewPageMenu(IWorkbenchWindow window, IAdaptable input) {
+ super(window, "Open New Page Menu");//$NON-NLS-1$
+ this.pageInput = input;
+ }
- @Override
+ @Override
protected void run(IPerspectiveDescriptor desc) {
- // Verify page input.
- if (pageInput == null) {
- StatusUtil.handleStatus(
- WorkbenchMessages.OpenNewPageMenu_dialogTitle + ": " + //$NON-NLS-1$
- WorkbenchMessages.OpenNewPageMenu_unknownPageInput,
- StatusManager.SHOW);
+ // Verify page input.
+ if (pageInput == null) {
+ StatusUtil.handleStatus(WorkbenchMessages.OpenNewPageMenu_dialogTitle + ": " + //$NON-NLS-1$
+ WorkbenchMessages.OpenNewPageMenu_unknownPageInput, StatusManager.SHOW);
return;
- }
+ }
- // Open the page.
- try {
- getWindow().openPage(desc.getId(), pageInput);
- } catch (WorkbenchException e) {
- StatusUtil.handleStatus(
- WorkbenchMessages.OpenNewPageMenu_dialogTitle + ": " + //$NON-NLS-1$
- e.getMessage(), e, StatusManager.SHOW);
- }
- }
+ // Open the page.
+ try {
+ getWindow().openPage(desc.getId(), pageInput);
+ } catch (WorkbenchException e) {
+ StatusUtil.handleStatus(WorkbenchMessages.OpenNewPageMenu_dialogTitle + ": " + //$NON-NLS-1$
+ e.getMessage(), e, StatusManager.SHOW);
+ }
+ }
- /**
- * Sets the page input.
- *
- * @param input the page input
- */
- public void setPageInput(IAdaptable input) {
- pageInput = input;
- }
+ /**
+ * Sets the page input.
+ *
+ * @param input the page input
+ */
+ public void setPageInput(IAdaptable input) {
+ pageInput = input;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenNewWindowMenu.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenNewWindowMenu.java
index 22a8377f846..ca3912962e3 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenNewWindowMenu.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenNewWindowMenu.java
@@ -24,87 +24,87 @@ import org.eclipse.ui.statushandlers.StatusManager;
/**
* A menu for window creation in the workbench.
* <p>
- * An <code>OpenNewWindowMenu</code> is used to populate a menu with
- * "Open Window" actions. One item is added for each shortcut perspective,
- * as defined by the product ini. If the user selects one of these items a new window is
+ * An <code>OpenNewWindowMenu</code> is used to populate a menu with "Open
+ * Window" actions. One item is added for each shortcut perspective, as defined
+ * by the product ini. If the user selects one of these items a new window is
* created in the workbench with the given perspective.
- * </p><p>
+ * </p>
+ * <p>
* The visible perspectives within the menu may also be updated dynamically to
* reflect user preference.
- * </p><p>
+ * </p>
+ * <p>
* The input for the page is determined by the value of <code>pageInput</code>.
* The input should be passed into the constructor of this class or set using
* the <code>setPageInput</code> method.
- * </p><p>
+ * </p>
+ * <p>
* This class may be instantiated; it is not intended to be subclassed.
* </p>
+ *
* @deprecated See IWorkbench.showPerspective methods.
* @noextend This class is not intended to be subclassed by clients.
*/
@Deprecated
public class OpenNewWindowMenu extends PerspectiveMenu {
- private IAdaptable pageInput;
+ private IAdaptable pageInput;
- /**
- * Constructs a new instance of <code>OpenNewPageMenu</code>.
- * <p>
- * If this method is used be sure to set the page input by invoking
- * <code>setPageInput</code>. The page input is required when the user
- * selects an item in the menu. At that point the menu will attempt to
- * open a new page with the selected perspective and page input. If there
- * is no page input an error dialog will be opened.
- * </p>
- *
- * @param window the window where a new page is created if an item within
- * the menu is selected
- */
- public OpenNewWindowMenu(IWorkbenchWindow window) {
- this(window, null);
- }
+ /**
+ * Constructs a new instance of <code>OpenNewPageMenu</code>.
+ * <p>
+ * If this method is used be sure to set the page input by invoking
+ * <code>setPageInput</code>. The page input is required when the user selects
+ * an item in the menu. At that point the menu will attempt to open a new page
+ * with the selected perspective and page input. If there is no page input an
+ * error dialog will be opened.
+ * </p>
+ *
+ * @param window the window where a new page is created if an item within the
+ * menu is selected
+ */
+ public OpenNewWindowMenu(IWorkbenchWindow window) {
+ this(window, null);
+ }
- /**
- * Constructs a new instance of <code>OpenNewPageMenu</code>.
- *
- * @param window the window where a new page is created if an item within
- * the menu is selected
- * @param input the page input
- */
- public OpenNewWindowMenu(IWorkbenchWindow window, IAdaptable input) {
- super(window, "Open New Page Menu");//$NON-NLS-1$
- this.pageInput = input;
- }
+ /**
+ * Constructs a new instance of <code>OpenNewPageMenu</code>.
+ *
+ * @param window the window where a new page is created if an item within the
+ * menu is selected
+ * @param input the page input
+ */
+ public OpenNewWindowMenu(IWorkbenchWindow window, IAdaptable input) {
+ super(window, "Open New Page Menu");//$NON-NLS-1$
+ this.pageInput = input;
+ }
/**
* Opens a new window with a particular perspective and input.
*/
- @Override
+ @Override
protected void run(IPerspectiveDescriptor desc) {
- // Verify page input.
- if (pageInput == null) {
- StatusUtil.handleStatus(
- WorkbenchMessages.OpenNewWindowMenu_dialogTitle + ": " + //$NON-NLS-1$
- WorkbenchMessages.OpenNewWindowMenu_unknownInput,
- StatusManager.SHOW);
+ // Verify page input.
+ if (pageInput == null) {
+ StatusUtil.handleStatus(WorkbenchMessages.OpenNewWindowMenu_dialogTitle + ": " + //$NON-NLS-1$
+ WorkbenchMessages.OpenNewWindowMenu_unknownInput, StatusManager.SHOW);
return;
- }
+ }
- // Open the page.
- try {
- getWindow().getWorkbench().openWorkbenchWindow(desc.getId(),
- pageInput);
- } catch (WorkbenchException e) {
- StatusUtil.handleStatus(
- WorkbenchMessages.OpenNewWindowMenu_dialogTitle + ": " + //$NON-NLS-1$
- e.getMessage(), e, StatusManager.SHOW);
+ // Open the page.
+ try {
+ getWindow().getWorkbench().openWorkbenchWindow(desc.getId(), pageInput);
+ } catch (WorkbenchException e) {
+ StatusUtil.handleStatus(WorkbenchMessages.OpenNewWindowMenu_dialogTitle + ": " + //$NON-NLS-1$
+ e.getMessage(), e, StatusManager.SHOW);
}
- }
+ }
- /**
- * Sets the page input.
- *
- * @param input the page input
- */
- public void setPageInput(IAdaptable input) {
- pageInput = input;
- }
+ /**
+ * Sets the page input.
+ *
+ * @param input the page input
+ */
+ public void setPageInput(IAdaptable input) {
+ pageInput = input;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenPerspectiveAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenPerspectiveAction.java
index a05bec32732..3a748981e2b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenPerspectiveAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenPerspectiveAction.java
@@ -27,67 +27,58 @@ import org.eclipse.ui.internal.util.Util;
*
* @since 3.1
*/
-public final class OpenPerspectiveAction extends Action implements
- IPluginContribution {
+public final class OpenPerspectiveAction extends Action implements IPluginContribution {
- /**
- * The perspective menu that will handle the execution of this action. This
- * allows subclasses of <code>PerspectiveMenu</code> to define custom
- * behaviour for these actions. This value should not be <code>null</code>.
- */
- private final PerspectiveMenu callback;
+ /**
+ * The perspective menu that will handle the execution of this action. This
+ * allows subclasses of <code>PerspectiveMenu</code> to define custom behaviour
+ * for these actions. This value should not be <code>null</code>.
+ */
+ private final PerspectiveMenu callback;
- /**
- * The descriptor for the perspective that this action should open. This
- * value is never <code>null</code>.
- */
- private final IPerspectiveDescriptor descriptor;
+ /**
+ * The descriptor for the perspective that this action should open. This value
+ * is never <code>null</code>.
+ */
+ private final IPerspectiveDescriptor descriptor;
- /**
- * Constructs a new instance of <code>OpenPerspectiveAction</code>
- *
- * @param window
- * The workbench window in which this action is created; should
- * not be <code>null</code>.
- * @param descriptor
- * The descriptor for the perspective that this action should
- * open; must not be <code>null</code>.
- * @param callback
- * The perspective menu who will handle the actual execution of
- * this action; should not be <code>null</code>.
- */
- public OpenPerspectiveAction(final IWorkbenchWindow window,
- final IPerspectiveDescriptor descriptor,
- final PerspectiveMenu callback) {
- super(Util.ZERO_LENGTH_STRING);
+ /**
+ * Constructs a new instance of <code>OpenPerspectiveAction</code>
+ *
+ * @param window The workbench window in which this action is created;
+ * should not be <code>null</code>.
+ * @param descriptor The descriptor for the perspective that this action should
+ * open; must not be <code>null</code>.
+ * @param callback The perspective menu who will handle the actual execution
+ * of this action; should not be <code>null</code>.
+ */
+ public OpenPerspectiveAction(final IWorkbenchWindow window, final IPerspectiveDescriptor descriptor,
+ final PerspectiveMenu callback) {
+ super(Util.ZERO_LENGTH_STRING);
- this.descriptor = descriptor;
- this.callback = callback;
+ this.descriptor = descriptor;
+ this.callback = callback;
- final String label = descriptor.getLabel();
- setText(label);
- setToolTipText(label);
- setImageDescriptor(descriptor.getImageDescriptor());
+ final String label = descriptor.getLabel();
+ setText(label);
+ setToolTipText(label);
+ setImageDescriptor(descriptor.getImageDescriptor());
- window.getWorkbench().getHelpSystem().setHelp(this,
- IWorkbenchHelpContextIds.OPEN_PERSPECTIVE_ACTION);
- }
+ window.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.OPEN_PERSPECTIVE_ACTION);
+ }
-
- @Override
+ @Override
public void runWithEvent(final Event event) {
- callback.run(descriptor, new SelectionEvent(event));
- }
+ callback.run(descriptor, new SelectionEvent(event));
+ }
- @Override
+ @Override
public String getLocalId() {
- return descriptor.getId();
- }
+ return descriptor.getId();
+ }
- @Override
+ @Override
public String getPluginId() {
- return descriptor instanceof IPluginContribution ? ((IPluginContribution) descriptor)
- .getPluginId()
- : null;
- }
+ return descriptor instanceof IPluginContribution ? ((IPluginContribution) descriptor).getPluginId() : null;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenPerspectiveMenu.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenPerspectiveMenu.java
index b12ab02372e..271e15c1ca5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenPerspectiveMenu.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenPerspectiveMenu.java
@@ -29,154 +29,153 @@ import org.eclipse.ui.statushandlers.StatusManager;
/**
* A menu for window creation in the workbench.
* <p>
- * An <code>OpenPerspectiveMenu</code> is used to populate a menu with
- * actions that will open a new perspective. If the user selects one of
- * these items either a new page is added to the workbench, a new
- * workbench window is created with the chosen perspective or the current
- * perspective will be replaced with the new onw.
- * </p><p>
+ * An <code>OpenPerspectiveMenu</code> is used to populate a menu with actions
+ * that will open a new perspective. If the user selects one of these items
+ * either a new page is added to the workbench, a new workbench window is
+ * created with the chosen perspective or the current perspective will be
+ * replaced with the new onw.
+ * </p>
+ * <p>
* The visible perspectives within the menu may also be updated dynamically to
* reflect user preference.
- * </p><p>
+ * </p>
+ * <p>
* The input for the page is determined by the value of <code>pageInput</code>.
* The input should be passed into the constructor of this class or set using
* the <code>setPageInput</code> method.
- * </p><p>
+ * </p>
+ * <p>
* This class may be instantiated; it is not intended to be subclassed.
* </p>
- * @deprecated See IWorkbench.showPerspective methods.
+ *
+ * @deprecated See IWorkbench.showPerspective methods.
* @noextend This class is not intended to be subclassed by clients.
*/
@Deprecated
public class OpenPerspectiveMenu extends PerspectiveMenu {
- private IAdaptable pageInput;
-
- private IMenuManager parentMenuManager;
-
- private boolean replaceEnabled = true;
-
- private static String PAGE_PROBLEMS_TITLE = WorkbenchMessages.OpenPerspectiveMenu_pageProblemsTitle;
-
- private static String PAGE_PROBLEMS_MESSAGE = WorkbenchMessages.OpenPerspectiveMenu_errorUnknownInput;
-
- /**
- * Constructs a new menu.
- */
- public OpenPerspectiveMenu(IMenuManager menuManager, IWorkbenchWindow window) {
- this(window);
- this.parentMenuManager = menuManager;
- }
-
- /**
- * Constructs a new instance of <code>OpenNewPageMenu</code>.
- * <p>
- * If this method is used be sure to set the page input by invoking
- * <code>setPageInput</code>. The page input is required when the user
- * selects an item in the menu. At that point the menu will attempt to
- * open a new page with the selected perspective and page input. If there
- * is no page input an error dialog will be opened.
- * </p>
- *
- * @param window the window where a new page is created if an item within
- * the menu is selected
- */
- public OpenPerspectiveMenu(IWorkbenchWindow window) {
- this(window, null);
- showActive(true);
- }
-
- /**
- * Constructs a new instance of <code>OpenNewPageMenu</code>.
- *
- * @param window the window where a new page is created if an item within
- * the menu is selected
- * @param input the page input
- */
- public OpenPerspectiveMenu(IWorkbenchWindow window, IAdaptable input) {
- super(window, "Open New Page Menu");//$NON-NLS-1$
- this.pageInput = input;
- }
-
- /**
- * Return whether or not the menu can be run. Answer true unless the current mode
- * is replace and the replaceEnabled flag is false.
- */
- private boolean canRun() {
- if (openPerspectiveSetting().equals(
- IWorkbenchPreferenceConstants.OPEN_PERSPECTIVE_REPLACE)) {
+ private IAdaptable pageInput;
+
+ private IMenuManager parentMenuManager;
+
+ private boolean replaceEnabled = true;
+
+ private static String PAGE_PROBLEMS_TITLE = WorkbenchMessages.OpenPerspectiveMenu_pageProblemsTitle;
+
+ private static String PAGE_PROBLEMS_MESSAGE = WorkbenchMessages.OpenPerspectiveMenu_errorUnknownInput;
+
+ /**
+ * Constructs a new menu.
+ */
+ public OpenPerspectiveMenu(IMenuManager menuManager, IWorkbenchWindow window) {
+ this(window);
+ this.parentMenuManager = menuManager;
+ }
+
+ /**
+ * Constructs a new instance of <code>OpenNewPageMenu</code>.
+ * <p>
+ * If this method is used be sure to set the page input by invoking
+ * <code>setPageInput</code>. The page input is required when the user selects
+ * an item in the menu. At that point the menu will attempt to open a new page
+ * with the selected perspective and page input. If there is no page input an
+ * error dialog will be opened.
+ * </p>
+ *
+ * @param window the window where a new page is created if an item within the
+ * menu is selected
+ */
+ public OpenPerspectiveMenu(IWorkbenchWindow window) {
+ this(window, null);
+ showActive(true);
+ }
+
+ /**
+ * Constructs a new instance of <code>OpenNewPageMenu</code>.
+ *
+ * @param window the window where a new page is created if an item within the
+ * menu is selected
+ * @param input the page input
+ */
+ public OpenPerspectiveMenu(IWorkbenchWindow window, IAdaptable input) {
+ super(window, "Open New Page Menu");//$NON-NLS-1$
+ this.pageInput = input;
+ }
+
+ /**
+ * Return whether or not the menu can be run. Answer true unless the current
+ * mode is replace and the replaceEnabled flag is false.
+ */
+ private boolean canRun() {
+ if (openPerspectiveSetting().equals(IWorkbenchPreferenceConstants.OPEN_PERSPECTIVE_REPLACE)) {
return replaceEnabled;
}
- return true;
- }
-
- /**
- * Return the current perspective setting.
- */
- private String openPerspectiveSetting() {
- return PrefUtil.getAPIPreferenceStore().getString(
- IWorkbenchPreferenceConstants.OPEN_NEW_PERSPECTIVE);
- }
-
- /**
- * Runs an action for a particular perspective. Opens the perspective supplied
- * in a new window or a new page depending on the workbench preference.
- *
- * @param desc the selected perspective
- */
- @Override
+ return true;
+ }
+
+ /**
+ * Return the current perspective setting.
+ */
+ private String openPerspectiveSetting() {
+ return PrefUtil.getAPIPreferenceStore().getString(IWorkbenchPreferenceConstants.OPEN_NEW_PERSPECTIVE);
+ }
+
+ /**
+ * Runs an action for a particular perspective. Opens the perspective supplied
+ * in a new window or a new page depending on the workbench preference.
+ *
+ * @param desc the selected perspective
+ */
+ @Override
protected void run(IPerspectiveDescriptor desc) {
- openPage(desc, 0);
- }
-
- /**
- * Runs an action for a particular perspective. Check for shift or control events
- * to decide which event to run.
- *
- * @param desc the selected perspective
- * @param event the event sent along with the selection callback
- */
- @Override
+ openPage(desc, 0);
+ }
+
+ /**
+ * Runs an action for a particular perspective. Check for shift or control
+ * events to decide which event to run.
+ *
+ * @param desc the selected perspective
+ * @param event the event sent along with the selection callback
+ */
+ @Override
protected void run(IPerspectiveDescriptor desc, SelectionEvent event) {
- openPage(desc, event.stateMask);
- }
-
- private void openPage(IPerspectiveDescriptor desc, int keyStateMask) {
- // Verify page input.
- if (pageInput == null) {
- StatusUtil.handleStatus(PAGE_PROBLEMS_TITLE
- + ": " + PAGE_PROBLEMS_MESSAGE, StatusManager.SHOW); //$NON-NLS-1$
+ openPage(desc, event.stateMask);
+ }
+
+ private void openPage(IPerspectiveDescriptor desc, int keyStateMask) {
+ // Verify page input.
+ if (pageInput == null) {
+ StatusUtil.handleStatus(PAGE_PROBLEMS_TITLE + ": " + PAGE_PROBLEMS_MESSAGE, StatusManager.SHOW); //$NON-NLS-1$
return;
- }
-
- // Open the page.
- try {
- getWindow().getWorkbench().showPerspective(desc.getId(),
- getWindow(), pageInput);
- } catch (WorkbenchException e) {
- StatusUtil.handleStatus(
- PAGE_PROBLEMS_TITLE + ": " + e.getMessage(), e, //$NON-NLS-1$
+ }
+
+ // Open the page.
+ try {
+ getWindow().getWorkbench().showPerspective(desc.getId(), getWindow(), pageInput);
+ } catch (WorkbenchException e) {
+ StatusUtil.handleStatus(PAGE_PROBLEMS_TITLE + ": " + e.getMessage(), e, //$NON-NLS-1$
StatusManager.SHOW);
}
- }
-
- /**
- * Sets the page input.
- *
- * @param input the page input
- */
- public void setPageInput(IAdaptable input) {
- pageInput = input;
- }
-
- /**
- * Set whether replace menu item is enabled within its parent menu.
- */
- public void setReplaceEnabled(boolean isEnabled) {
- if (replaceEnabled != isEnabled) {
- replaceEnabled = isEnabled;
- if (canRun() && parentMenuManager != null) {
+ }
+
+ /**
+ * Sets the page input.
+ *
+ * @param input the page input
+ */
+ public void setPageInput(IAdaptable input) {
+ pageInput = input;
+ }
+
+ /**
+ * Set whether replace menu item is enabled within its parent menu.
+ */
+ public void setReplaceEnabled(boolean isEnabled) {
+ if (replaceEnabled != isEnabled) {
+ replaceEnabled = isEnabled;
+ if (canRun() && parentMenuManager != null) {
parentMenuManager.update(true);
}
- }
- }
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/PartEventAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/PartEventAction.java
index f49d4afa611..93e694dc737 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/PartEventAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/PartEventAction.java
@@ -46,94 +46,94 @@ import org.eclipse.ui.IWorkbenchPart;
*/
public abstract class PartEventAction extends Action implements IPartListener {
- /**
- * The active part, or <code>null</code> if none.
- */
- private IWorkbenchPart activePart;
+ /**
+ * The active part, or <code>null</code> if none.
+ */
+ private IWorkbenchPart activePart;
- /**
- * Creates a new action with the given text.
- *
- * @param text the action's text, or <code>null</code> if there is no text
- */
- protected PartEventAction(String text) {
- super(text);
- }
+ /**
+ * Creates a new action with the given text.
+ *
+ * @param text the action's text, or <code>null</code> if there is no text
+ */
+ protected PartEventAction(String text) {
+ super(text);
+ }
- /**
- * Creates a new action with the given text and style.
- *
- * @param text the action's text, or <code>null</code> if there is no text
- * @param style one of <code>AS_PUSH_BUTTON</code>, <code>AS_CHECK_BOX</code>,
- * <code>AS_DROP_DOWN_MENU</code>, <code>AS_RADIO_BUTTON</code>, and
- * <code>AS_UNSPECIFIED</code>
- * @since 3.0
- */
- protected PartEventAction(String text, int style) {
- super(text, style);
- }
+ /**
+ * Creates a new action with the given text and style.
+ *
+ * @param text the action's text, or <code>null</code> if there is no text
+ * @param style one of <code>AS_PUSH_BUTTON</code>, <code>AS_CHECK_BOX</code>,
+ * <code>AS_DROP_DOWN_MENU</code>, <code>AS_RADIO_BUTTON</code>,
+ * and <code>AS_UNSPECIFIED</code>
+ * @since 3.0
+ */
+ protected PartEventAction(String text, int style) {
+ super(text, style);
+ }
- /**
- * Returns the currently active part in the workbench.
- *
- * @return currently active part in the workbench, or <code>null</code> if none
- */
- public IWorkbenchPart getActivePart() {
- return activePart;
- }
+ /**
+ * Returns the currently active part in the workbench.
+ *
+ * @return currently active part in the workbench, or <code>null</code> if none
+ */
+ public IWorkbenchPart getActivePart() {
+ return activePart;
+ }
- /**
- * The <code>PartEventAction</code> implementation of this
- * <code>IPartListener</code> method records that the given part is active.
- * Subclasses may extend this method if action availability has to be
- * recalculated.
- */
- @Override
+ /**
+ * The <code>PartEventAction</code> implementation of this
+ * <code>IPartListener</code> method records that the given part is active.
+ * Subclasses may extend this method if action availability has to be
+ * recalculated.
+ */
+ @Override
public void partActivated(IWorkbenchPart part) {
- activePart = part;
- }
+ activePart = part;
+ }
- /**
- * The <code>PartEventAction</code> implementation of this
- * <code>IPartListener</code> method does nothing. Subclasses should extend
- * this method if action availability has to be recalculated.
- */
- @Override
+ /**
+ * The <code>PartEventAction</code> implementation of this
+ * <code>IPartListener</code> method does nothing. Subclasses should extend this
+ * method if action availability has to be recalculated.
+ */
+ @Override
public void partBroughtToTop(IWorkbenchPart part) {
- // do nothing
- }
+ // do nothing
+ }
- /**
- * The <code>PartEventAction</code> implementation of this
- * <code>IPartListener</code> method clears the active part if it just closed.
- * Subclasses may extend this method if action availability has to be
- * recalculated.
- */
- @Override
+ /**
+ * The <code>PartEventAction</code> implementation of this
+ * <code>IPartListener</code> method clears the active part if it just closed.
+ * Subclasses may extend this method if action availability has to be
+ * recalculated.
+ */
+ @Override
public void partClosed(IWorkbenchPart part) {
- if (part == activePart) {
+ if (part == activePart) {
activePart = null;
}
- }
+ }
- /**
- * The <code>PartEventAction</code> implementation of this
- * <code>IPartListener</code> method records that there is no active part.
- * Subclasses may extend this method if action availability has to be
- * recalculated.
- */
- @Override
+ /**
+ * The <code>PartEventAction</code> implementation of this
+ * <code>IPartListener</code> method records that there is no active part.
+ * Subclasses may extend this method if action availability has to be
+ * recalculated.
+ */
+ @Override
public void partDeactivated(IWorkbenchPart part) {
- activePart = null;
- }
+ activePart = null;
+ }
- /**
- * The <code>PartEventAction</code> implementation of this
- * <code>IPartListener</code> method does nothing. Subclasses should extend
- * this method if action availability has to be recalculated.
- */
- @Override
+ /**
+ * The <code>PartEventAction</code> implementation of this
+ * <code>IPartListener</code> method does nothing. Subclasses should extend this
+ * method if action availability has to be recalculated.
+ */
+ @Override
public void partOpened(IWorkbenchPart part) {
- // do nothing
- }
+ // do nothing
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/PerspectiveMenu.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/PerspectiveMenu.java
index be0ebe39e0e..20b15331771 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/PerspectiveMenu.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/PerspectiveMenu.java
@@ -57,222 +57,217 @@ import org.eclipse.ui.statushandlers.StatusManager;
/**
* A menu for perspective selection.
* <p>
- * A <code>PerspectiveMenu</code> is used to populate a menu with
- * perspective shortcut items. If the user selects one of these items
- * an action is performed for the selected perspective.
- * </p><p>
+ * A <code>PerspectiveMenu</code> is used to populate a menu with perspective
+ * shortcut items. If the user selects one of these items an action is performed
+ * for the selected perspective.
+ * </p>
+ * <p>
* The visible perspective items within the menu are dynamic and reflect the
* available set generated by each subclass. The default available set consists
* of the perspective shortcut list of the current perspective.
- * </p><p>
- * This class is abstract. Subclasses must implement the <code>run</code> method,
- * which performs a specialized action for the selected perspective.
+ * </p>
+ * <p>
+ * This class is abstract. Subclasses must implement the <code>run</code>
+ * method, which performs a specialized action for the selected perspective.
* </p>
*/
public abstract class PerspectiveMenu extends ContributionItem {
- /**
- * @since 3.4
- * @deprecated As of 3.5, replaced by {@link IWorkbenchCommandConstants#PERSPECTIVES_SHOW_PERSPECTIVE}
+ /**
+ * @since 3.4
+ * @deprecated As of 3.5, replaced by
+ * {@link IWorkbenchCommandConstants#PERSPECTIVES_SHOW_PERSPECTIVE}
*/
@Deprecated
protected static final String SHOW_PERSP_ID = IWorkbenchCommandConstants.PERSPECTIVES_SHOW_PERSPECTIVE;
private IPerspectiveRegistry reg;
- private IWorkbenchWindow window;
+ private IWorkbenchWindow window;
- private boolean showActive = false;
+ private boolean showActive = false;
- private boolean dirty = true;
+ private boolean dirty = true;
- private IMenuListener menuListener = manager -> {
- manager.markDirty();
- dirty = true;
+ private IMenuListener menuListener = manager -> {
+ manager.markDirty();
+ dirty = true;
};
private Comparator<IPerspectiveDescriptor> comparator = new Comparator<IPerspectiveDescriptor>() {
- private Collator collator = Collator.getInstance();
+ private Collator collator = Collator.getInstance();
- @Override
+ @Override
public int compare(IPerspectiveDescriptor ob1, IPerspectiveDescriptor ob2) {
return collator.compare(ob1.getLabel(), ob2.getLabel());
- }
- };
-
- /**
- * The translatable message to show when there are no perspectives.
- *
- * @since 3.1
- */
- private static final String NO_TARGETS_MSG = WorkbenchMessages.Workbench_showInNoPerspectives;
-
- /**
- * The map of perspective identifiers (String) to actions
- * (OpenPerspectiveAction). This map may be empty, but it is never
- * <code>null</code>.
- *
- * @since 3.1
- */
+ }
+ };
+
+ /**
+ * The translatable message to show when there are no perspectives.
+ *
+ * @since 3.1
+ */
+ private static final String NO_TARGETS_MSG = WorkbenchMessages.Workbench_showInNoPerspectives;
+
+ /**
+ * The map of perspective identifiers (String) to actions
+ * (OpenPerspectiveAction). This map may be empty, but it is never
+ * <code>null</code>.
+ *
+ * @since 3.1
+ */
private Map<String, IAction> actions = new HashMap<>();
- /**
- * The action for that allows the user to choose any perspective to open.
- *
- * @since 3.1
- */
- private Action openOtherAction = new Action(WorkbenchMessages.PerspectiveMenu_otherItem) {
- @Override
+ /**
+ * The action for that allows the user to choose any perspective to open.
+ *
+ * @since 3.1
+ */
+ private Action openOtherAction = new Action(WorkbenchMessages.PerspectiveMenu_otherItem) {
+ @Override
public final void runWithEvent(final Event event) {
- runOther(new SelectionEvent(event));
- }
- };
-
-
- /**
- * Constructs a new instance of <code>PerspectiveMenu</code>.
- *
- * @param window the window containing this menu
- * @param id the menu id
- */
- public PerspectiveMenu(IWorkbenchWindow window, String id) {
- super(id);
- this.window = window;
- reg = window.getWorkbench().getPerspectiveRegistry();
- openOtherAction
- .setActionDefinitionId(IWorkbenchCommandConstants.PERSPECTIVES_SHOW_PERSPECTIVE);
- }
-
- @Override
+ runOther(new SelectionEvent(event));
+ }
+ };
+
+ /**
+ * Constructs a new instance of <code>PerspectiveMenu</code>.
+ *
+ * @param window the window containing this menu
+ * @param id the menu id
+ */
+ public PerspectiveMenu(IWorkbenchWindow window, String id) {
+ super(id);
+ this.window = window;
+ reg = window.getWorkbench().getPerspectiveRegistry();
+ openOtherAction.setActionDefinitionId(IWorkbenchCommandConstants.PERSPECTIVES_SHOW_PERSPECTIVE);
+ }
+
+ @Override
public void fill(Menu menu, int index) {
- if (getParent() instanceof MenuManager) {
+ if (getParent() instanceof MenuManager) {
((MenuManager) getParent()).addMenuListener(menuListener);
}
- if (!dirty) {
+ if (!dirty) {
return;
}
- final MenuManager manager = new MenuManager();
- fillMenu(manager);
- final IContributionItem items[] = manager.getItems();
- if (items.length == 0) {
- MenuItem item = new MenuItem(menu, SWT.NONE, index++);
- item.setText(NO_TARGETS_MSG);
- item.setEnabled(false);
- } else {
- for (IContributionItem item : items) {
- item.fill(menu, index++);
- }
- }
- dirty = false;
- }
-
- /**
- * Fills the given menu manager with all the open perspective actions
- * appropriate for the currently active perspective. Filtering is applied to
- * the actions based on the activities and capabilities mechanism.
- *
- * @param manager
- * The menu manager that should receive the menu items; must not
- * be <code>null</code>.
- * @since 3.1
- */
- private final void fillMenu(final MenuManager manager) {
- // Clear out the manager so that we have a blank slate.
- manager.removeAll();
-
- // Collect and sort perspective descriptors.
+ final MenuManager manager = new MenuManager();
+ fillMenu(manager);
+ final IContributionItem items[] = manager.getItems();
+ if (items.length == 0) {
+ MenuItem item = new MenuItem(menu, SWT.NONE, index++);
+ item.setText(NO_TARGETS_MSG);
+ item.setEnabled(false);
+ } else {
+ for (IContributionItem item : items) {
+ item.fill(menu, index++);
+ }
+ }
+ dirty = false;
+ }
+
+ /**
+ * Fills the given menu manager with all the open perspective actions
+ * appropriate for the currently active perspective. Filtering is applied to the
+ * actions based on the activities and capabilities mechanism.
+ *
+ * @param manager The menu manager that should receive the menu items; must not
+ * be <code>null</code>.
+ * @since 3.1
+ */
+ private final void fillMenu(final MenuManager manager) {
+ // Clear out the manager so that we have a blank slate.
+ manager.removeAll();
+
+ // Collect and sort perspective descriptors.
final List<IPerspectiveDescriptor> persps = getPerspectiveItems();
- Collections.sort(persps, comparator);
+ Collections.sort(persps, comparator);
- /*
- * Convert the perspective descriptors to actions, and filter out
- * actions using the activity/capability mechanism.
- */
+ /*
+ * Convert the perspective descriptors to actions, and filter out actions using
+ * the activity/capability mechanism.
+ */
final List<IAction> actions = new ArrayList<>(persps.size());
for (Iterator<IPerspectiveDescriptor> i = persps.iterator(); i.hasNext();) {
- final IPerspectiveDescriptor descriptor = i
- .next();
- final IAction action = getAction(descriptor.getId());
- if (action != null) {
- if (WorkbenchActivityHelper.filterItem(action)) {
+ final IPerspectiveDescriptor descriptor = i.next();
+ final IAction action = getAction(descriptor.getId());
+ if (action != null) {
+ if (WorkbenchActivityHelper.filterItem(action)) {
continue;
}
- actions.add(action);
- }
- }
+ actions.add(action);
+ }
+ }
- // Go through and add each of the actions to the menu manager.
+ // Go through and add each of the actions to the menu manager.
for (Iterator<IAction> i = actions.iterator(); i.hasNext();) {
manager.add(i.next());
- }
-
- if (PrefUtil
- .getAPIPreferenceStore()
- .getBoolean(
- IWorkbenchPreferenceConstants.SHOW_OTHER_IN_PERSPECTIVE_MENU)) {
- // Add a separator and then "Other..."
- if (actions.size() > 0) {
+ }
+
+ if (PrefUtil.getAPIPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.SHOW_OTHER_IN_PERSPECTIVE_MENU)) {
+ // Add a separator and then "Other..."
+ if (actions.size() > 0) {
manager.add(new Separator());
}
manager.add(openOtherAction);
- }
- }
-
- /**
- * Returns the action for the given perspective id. This is a lazy cache. If
- * the action does not already exist, then it is created. If there is no
- * perspective with the given identifier, then the action is not created.
- *
- * @param id
- * The identifier of the perspective for which the action should
- * be retrieved.
- * @return The action for the given identifier; or <code>null</code> if
- * there is no perspective with the given identifier.
- * @since 3.1
- */
- private final IAction getAction(final String id) {
+ }
+ }
+
+ /**
+ * Returns the action for the given perspective id. This is a lazy cache. If the
+ * action does not already exist, then it is created. If there is no perspective
+ * with the given identifier, then the action is not created.
+ *
+ * @param id The identifier of the perspective for which the action should be
+ * retrieved.
+ * @return The action for the given identifier; or <code>null</code> if there is
+ * no perspective with the given identifier.
+ * @since 3.1
+ */
+ private final IAction getAction(final String id) {
IAction action = actions.get(id);
- if (action == null) {
- IPerspectiveDescriptor descriptor = reg.findPerspectiveWithId(id);
- if (descriptor != null) {
- action = new OpenPerspectiveAction(window, descriptor, this);
- action.setActionDefinitionId(id);
- actions.put(id, action);
- }
- }
- return action;
- }
-
- /*
- * Returns the perspective shortcut items for the active perspective.
- *
- * @return a list of <code>IPerspectiveDescriptor</code> items
- */
+ if (action == null) {
+ IPerspectiveDescriptor descriptor = reg.findPerspectiveWithId(id);
+ if (descriptor != null) {
+ action = new OpenPerspectiveAction(window, descriptor, this);
+ action.setActionDefinitionId(id);
+ actions.put(id, action);
+ }
+ }
+ return action;
+ }
+
+ /*
+ * Returns the perspective shortcut items for the active perspective.
+ *
+ * @return a list of <code>IPerspectiveDescriptor</code> items
+ */
private ArrayList<IPerspectiveDescriptor> getPerspectiveShortcuts() {
ArrayList<IPerspectiveDescriptor> list = new ArrayList<>();
- IWorkbenchPage page = window.getActivePage();
- if (page == null) {
+ IWorkbenchPage page = window.getActivePage();
+ if (page == null) {
return list;
}
- String[] ids = page.getPerspectiveShortcuts();
+ String[] ids = page.getPerspectiveShortcuts();
for (String perspectiveId : ids) {
IPerspectiveDescriptor desc = reg.findPerspectiveWithId(perspectiveId);
- if (desc != null && !list.contains(desc)) {
- if (WorkbenchActivityHelper.filterItem(desc)) {
+ if (desc != null && !list.contains(desc)) {
+ if (WorkbenchActivityHelper.filterItem(desc)) {
continue;
}
- list.add(desc);
- }
- }
+ list.add(desc);
+ }
+ }
- return list;
- }
+ return list;
+ }
- /**
+ /**
* Returns the available list of perspectives to display in the menu.
* <p>
* By default, the list contains the perspective shortcuts for the current
@@ -286,102 +281,101 @@ public abstract class PerspectiveMenu extends ContributionItem {
* <code>IPerspectiveDescriptor</code>
*/
protected ArrayList<IPerspectiveDescriptor> getPerspectiveItems() {
- /* Allow the user to see all the perspectives they have
- * selected via Customize Perspective. Bugzilla bug #23445 */
+ /*
+ * Allow the user to see all the perspectives they have selected via Customize
+ * Perspective. Bugzilla bug #23445
+ */
ArrayList<IPerspectiveDescriptor> shortcuts = getPerspectiveShortcuts();
ArrayList<IPerspectiveDescriptor> list = new ArrayList<>(shortcuts.size());
- // Add perspective shortcuts from the active perspective
- int size = shortcuts.size();
- for (int i = 0; i < size; i++) {
- if (!list.contains(shortcuts.get(i))) {
- list.add(shortcuts.get(i));
- }
- }
-
- return list;
- }
-
- /**
- * Returns whether the menu item representing the active perspective
- * will have a check mark.
- *
- * @return <code>true</code> if a check mark is shown, <code>false</code> otherwise
- */
- protected boolean getShowActive() {
- return showActive;
- }
-
- /**
- * Returns the window for this menu.
- *
- * @return the window
- */
- protected IWorkbenchWindow getWindow() {
- return window;
- }
-
- @Override
+ // Add perspective shortcuts from the active perspective
+ int size = shortcuts.size();
+ for (int i = 0; i < size; i++) {
+ if (!list.contains(shortcuts.get(i))) {
+ list.add(shortcuts.get(i));
+ }
+ }
+
+ return list;
+ }
+
+ /**
+ * Returns whether the menu item representing the active perspective will have a
+ * check mark.
+ *
+ * @return <code>true</code> if a check mark is shown, <code>false</code>
+ * otherwise
+ */
+ protected boolean getShowActive() {
+ return showActive;
+ }
+
+ /**
+ * Returns the window for this menu.
+ *
+ * @return the window
+ */
+ protected IWorkbenchWindow getWindow() {
+ return window;
+ }
+
+ @Override
public boolean isDirty() {
- return dirty;
- }
+ return dirty;
+ }
- @Override
+ @Override
public boolean isDynamic() {
- return true;
- }
-
- /**
- * Runs an action for a particular perspective. The behavior of the
- * action is defined by the subclass.
- *
- * @param desc the selected perspective
- */
- protected abstract void run(IPerspectiveDescriptor desc);
-
- /**
- * Runs an action for a particular perspective. The behavior of the action
- * is defined by the subclass. By default, this just calls
- * <code>run(IPerspectiveDescriptor)</code>.
- *
- * @param desc
- * the selected perspective
- * @param event
- * SelectionEvent - the event send along with the selection
- * callback
- */
- protected void run(IPerspectiveDescriptor desc, SelectionEvent event) {
- //Do a run without the event by default
- run(desc);
- }
+ return true;
+ }
/**
- * Show the "other" dialog, select a perspective, and run it. Pass on the selection event should
- * the menu need it.
+ * Runs an action for a particular perspective. The behavior of the action is
+ * defined by the subclass.
+ *
+ * @param desc the selected perspective
+ */
+ protected abstract void run(IPerspectiveDescriptor desc);
+
+ /**
+ * Runs an action for a particular perspective. The behavior of the action is
+ * defined by the subclass. By default, this just calls
+ * <code>run(IPerspectiveDescriptor)</code>.
+ *
+ * @param desc the selected perspective
+ * @param event SelectionEvent - the event send along with the selection
+ * callback
+ */
+ protected void run(IPerspectiveDescriptor desc, SelectionEvent event) {
+ // Do a run without the event by default
+ run(desc);
+ }
+
+ /**
+ * Show the "other" dialog, select a perspective, and run it. Pass on the
+ * selection event should the menu need it.
*
* @param event the selection event
*/
- void runOther(SelectionEvent event) {
- IHandlerService handlerService = window
- .getService(IHandlerService.class);
+ void runOther(SelectionEvent event) {
+ IHandlerService handlerService = window.getService(IHandlerService.class);
try {
handlerService.executeCommand(IWorkbenchCommandConstants.PERSPECTIVES_SHOW_PERSPECTIVE, null);
} catch (ExecutionException | NotDefinedException | NotEnabledException | NotHandledException e) {
- StatusManager.getManager().handle(
- new Status(IStatus.WARNING, WorkbenchPlugin.PI_WORKBENCH,
- "Failed to execute " + IWorkbenchCommandConstants.PERSPECTIVES_SHOW_PERSPECTIVE, e)); //$NON-NLS-1$
+ StatusManager.getManager().handle(new Status(IStatus.WARNING, WorkbenchPlugin.PI_WORKBENCH,
+ "Failed to execute " + IWorkbenchCommandConstants.PERSPECTIVES_SHOW_PERSPECTIVE, e)); //$NON-NLS-1$
}
}
- /**
- * Sets the showActive flag. If <code>showActive == true</code> then the
- * active perspective is hilighted with a check mark.
- *
- * @param b the new showActive flag
- */
- protected void showActive(boolean b) {
- showActive = b;
- }
+ /**
+ * Sets the showActive flag. If <code>showActive == true</code> then the active
+ * perspective is hilighted with a check mark.
+ *
+ * @param b the new showActive flag
+ */
+ protected void showActive(boolean b) {
+ showActive = b;
+ }
@Override
public void dispose() {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/QuickMenuCreator.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/QuickMenuCreator.java
index 68c546c4206..d6aa94040bf 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/QuickMenuCreator.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/QuickMenuCreator.java
@@ -79,16 +79,14 @@ public abstract class QuickMenuCreator {
/**
* Create the contents of the context menu.
*
- * @param menu
- * the menu to fill
+ * @param menu the menu to fill
*/
protected abstract void fillMenu(IMenuManager menu);
/**
* Determine the optimal point for this menu to appear.
*
- * @param focus
- * the focus control
+ * @param focus the focus control
* @return the optimal placement
* @since 3.5
*/
@@ -113,14 +111,11 @@ public abstract class QuickMenuCreator {
result = focus.toControl(cursorLocation);
}
if (clientArea != null && !clientArea.contains(result)) {
- result = new Point(clientArea.x + clientArea.width / 2,
- clientArea.y + clientArea.height / 2);
+ result = new Point(clientArea.x + clientArea.width / 2, clientArea.y + clientArea.height / 2);
}
Rectangle shellArea = focus.getShell().getClientArea();
- if (!shellArea.contains(focus.getShell().toControl(
- focus.toDisplay(result)))) {
- result = new Point(shellArea.x + shellArea.width / 2, shellArea.y
- + shellArea.height / 2);
+ if (!shellArea.contains(focus.getShell().toControl(focus.toDisplay(result)))) {
+ result = new Point(shellArea.x + shellArea.width / 2, shellArea.y + shellArea.height / 2);
}
return focus.toDisplay(result);
}
@@ -129,12 +124,10 @@ public abstract class QuickMenuCreator {
* Hook to compute the menu location if the focus widget is a styled text
* widget.
*
- * @param text
- * the styled text widget that has the focus
+ * @param text the styled text widget that has the focus
*
- * @return a widget relative position of the menu to pop up or
- * <code>null</code> if now position inside the widget can be
- * computed
+ * @return a widget relative position of the menu to pop up or <code>null</code>
+ * if now position inside the widget can be computed
* @since 3.5
*/
protected Point computeMenuLocation(StyledText text) {
@@ -149,12 +142,10 @@ public abstract class QuickMenuCreator {
/**
* Hook to compute the menu location if the focus widget is a tree widget.
*
- * @param tree
- * the tree widget that has the focus
+ * @param tree the tree widget that has the focus
*
- * @return a widget relative position of the menu to pop up or
- * <code>null</code> if now position inside the widget can be
- * computed
+ * @return a widget relative position of the menu to pop up or <code>null</code>
+ * if now position inside the widget can be computed
* @since 3.5
*/
protected Point computeMenuLocation(Tree tree) {
@@ -167,9 +158,8 @@ public abstract class QuickMenuCreator {
Rectangle bounds = items[0].getBounds();
Rectangle intersect = clientArea.intersection(bounds);
if (intersect != null && intersect.height == bounds.height) {
- return new Point(Math.max(0, bounds.x
- + getAvarageCharWith(tree) * CHAR_INDENT), bounds.y
- + bounds.height);
+ return new Point(Math.max(0, bounds.x + getAvarageCharWith(tree) * CHAR_INDENT),
+ bounds.y + bounds.height);
}
return null;
@@ -179,8 +169,8 @@ public abstract class QuickMenuCreator {
rectangles[i] = items[i].getBounds();
}
Point cursorLocation = tree.getDisplay().getCursorLocation();
- Point result = findBestLocation(getIncludedPositions(rectangles,
- clientArea), tree.toControl(cursorLocation));
+ Point result = findBestLocation(getIncludedPositions(rectangles, clientArea),
+ tree.toControl(cursorLocation));
if (result != null) {
result.x = result.x + getAvarageCharWith(tree) * CHAR_INDENT;
}
@@ -191,12 +181,10 @@ public abstract class QuickMenuCreator {
/**
* Hook to compute the menu location if the focus widget is a table widget.
*
- * @param table
- * the table widget that has the focus
+ * @param table the table widget that has the focus
*
- * @return a widget relative position of the menu to pop up or
- * <code>null</code> if now position inside the widget can be
- * computed
+ * @return a widget relative position of the menu to pop up or <code>null</code>
+ * if now position inside the widget can be computed
* @since 3.5
*/
protected Point computeMenuLocation(Table table) {
@@ -211,9 +199,8 @@ public abstract class QuickMenuCreator {
Rectangle iBounds = items[0].getImageBounds(0);
Rectangle intersect = clientArea.intersection(bounds);
if (intersect != null && intersect.height == bounds.height) {
- return new Point(Math.max(0, bounds.x + iBounds.width
- + getAvarageCharWith(table) * CHAR_INDENT), bounds.y
- + bounds.height);
+ return new Point(Math.max(0, bounds.x + iBounds.width + getAvarageCharWith(table) * CHAR_INDENT),
+ bounds.y + bounds.height);
}
return null;
@@ -225,25 +212,22 @@ public abstract class QuickMenuCreator {
}
Rectangle iBounds = items[0].getImageBounds(0);
Point cursorLocation = table.getDisplay().getCursorLocation();
- Point result = findBestLocation(getIncludedPositions(rectangles,
- clientArea), table.toControl(cursorLocation));
+ Point result = findBestLocation(getIncludedPositions(rectangles, clientArea),
+ table.toControl(cursorLocation));
if (result != null) {
- result.x = result.x + iBounds.width + getAvarageCharWith(table)
- * CHAR_INDENT;
+ result.x = result.x + iBounds.width + getAvarageCharWith(table) * CHAR_INDENT;
}
return result;
}
}
}
- private Point[] getIncludedPositions(Rectangle[] rectangles,
- Rectangle widgetBounds) {
+ private Point[] getIncludedPositions(Rectangle[] rectangles, Rectangle widgetBounds) {
List result = new ArrayList();
for (Rectangle rectangle : rectangles) {
Rectangle intersect = widgetBounds.intersection(rectangle);
if (intersect != null && intersect.height == rectangle.height) {
- result.add(new Point(intersect.x, intersect.y
- + intersect.height));
+ result.add(new Point(intersect.x, intersect.y + intersect.height));
}
}
return (Point[]) result.toArray(new Point[result.size()]);
@@ -287,12 +271,12 @@ public abstract class QuickMenuCreator {
}
/**
- * Dispose of this quick menu creator. Subclasses should ensure that they
- * call this method.
+ * Dispose of this quick menu creator. Subclasses should ensure that they call
+ * this method.
*
* @deprecated As of 3.5 this is not necessary as the SWT Menu created in
- * {@link #createMenu()} will be disposed shortly after the
- * SWT.Hide event.
+ * {@link #createMenu()} will be disposed shortly after the SWT.Hide
+ * event.
*/
@Deprecated
public void dispose() {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/RetargetAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/RetargetAction.java
index 08271b282fd..1653b31eafb 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/RetargetAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/RetargetAction.java
@@ -26,12 +26,11 @@ import org.eclipse.ui.SubActionBars;
import org.eclipse.ui.internal.PartSite;
/**
- * A <code>RetargetAction</code> tracks the active part in the workbench.
- * Each RetargetAction has an ID. If the active part provides an action
- * handler for the ID the enable and check state of the RetargetAction
- * is determined from the enable and check state of the handler. If the
- * active part does not provide an action handler then this action is
- * disabled.
+ * A <code>RetargetAction</code> tracks the active part in the workbench. Each
+ * RetargetAction has an ID. If the active part provides an action handler for
+ * the ID the enable and check state of the RetargetAction is determined from
+ * the enable and check state of the handler. If the active part does not
+ * provide an action handler then this action is disabled.
* <p>
* <b>Note:</b> instances of this class add themselves as listeners to their
* action handler. It is important for the creator of a retarget action to call
@@ -45,262 +44,258 @@ import org.eclipse.ui.internal.PartSite;
* @since 2.0
* @noextend This class is not intended to be subclassed by clients.
*/
-public class RetargetAction extends PartEventAction implements
- ActionFactory.IWorkbenchAction {
+public class RetargetAction extends PartEventAction implements ActionFactory.IWorkbenchAction {
- /**
- * The help listener assigned to this action, or <code>null</code> if none.
- */
- private HelpListener localHelpListener;
+ /**
+ * The help listener assigned to this action, or <code>null</code> if none.
+ */
+ private HelpListener localHelpListener;
- private boolean enableAccelerator = true;
+ private boolean enableAccelerator = true;
- private IAction handler;
+ private IAction handler;
- private IPropertyChangeListener propertyChangeListener = event -> RetargetAction.this.propagateChange(event);
+ private IPropertyChangeListener propertyChangeListener = event -> RetargetAction.this.propagateChange(event);
- /**
- * Constructs a RetargetAction with the given action id and text.
- *
- * @param actionID the retargetable action id
- * @param text the action's text, or <code>null</code> if there is no text
- */
- public RetargetAction(String actionID, String text) {
- this(actionID, text, IAction.AS_UNSPECIFIED);
- }
+ /**
+ * Constructs a RetargetAction with the given action id and text.
+ *
+ * @param actionID the retargetable action id
+ * @param text the action's text, or <code>null</code> if there is no text
+ */
+ public RetargetAction(String actionID, String text) {
+ this(actionID, text, IAction.AS_UNSPECIFIED);
+ }
- /**
- * Constructs a RetargetAction with the given action id, text and style.
- *
- * @param actionID the retargetable action id
- * @param text the action's text, or <code>null</code> if there is no text
- * @param style one of <code>AS_PUSH_BUTTON</code>, <code>AS_CHECK_BOX</code>,
- * <code>AS_DROP_DOWN_MENU</code>, <code>AS_RADIO_BUTTON</code>, and
- * <code>AS_UNSPECIFIED</code>
- * @since 3.0
- */
- public RetargetAction(String actionID, String text, int style) {
- super(text, style);
- setId(actionID);
- setEnabled(false);
- super.setHelpListener(e -> {
- HelpListener listener = null;
- if (handler != null) {
- // if we have a handler, see if it has a help listener
- listener = handler.getHelpListener();
- if (listener == null) {
+ /**
+ * Constructs a RetargetAction with the given action id, text and style.
+ *
+ * @param actionID the retargetable action id
+ * @param text the action's text, or <code>null</code> if there is no text
+ * @param style one of <code>AS_PUSH_BUTTON</code>,
+ * <code>AS_CHECK_BOX</code>, <code>AS_DROP_DOWN_MENU</code>,
+ * <code>AS_RADIO_BUTTON</code>, and <code>AS_UNSPECIFIED</code>
+ * @since 3.0
+ */
+ public RetargetAction(String actionID, String text, int style) {
+ super(text, style);
+ setId(actionID);
+ setEnabled(false);
+ super.setHelpListener(e -> {
+ HelpListener listener = null;
+ if (handler != null) {
+ // if we have a handler, see if it has a help listener
+ listener = handler.getHelpListener();
+ if (listener == null) {
// use our own help listener
- listener = localHelpListener;
+ listener = localHelpListener;
}
- }
- if (listener != null) {
+ }
+ if (listener != null) {
// pass on the event
- listener.helpRequested(e);
+ listener.helpRequested(e);
}
});
- }
+ }
- /**
- * Disposes of the action and any resources held.
- */
- @Override
+ /**
+ * Disposes of the action and any resources held.
+ */
+ @Override
public void dispose() {
- if (handler != null) {
- handler.removePropertyChangeListener(propertyChangeListener);
- handler = null;
- }
- IWorkbenchPart part = getActivePart();
- if (part != null) {
- IWorkbenchPartSite site = part.getSite();
- SubActionBars bars = (SubActionBars) ((PartSite) site).getActionBars();
- bars.removePropertyChangeListener(propertyChangeListener);
- }
- }
+ if (handler != null) {
+ handler.removePropertyChangeListener(propertyChangeListener);
+ handler = null;
+ }
+ IWorkbenchPart part = getActivePart();
+ if (part != null) {
+ IWorkbenchPartSite site = part.getSite();
+ SubActionBars bars = (SubActionBars) ((PartSite) site).getActionBars();
+ bars.removePropertyChangeListener(propertyChangeListener);
+ }
+ }
- /**
- * Enables the accelerator for this action.
- *
- * @param b the new enable state
- */
- public void enableAccelerator(boolean b) {
- enableAccelerator = b;
- }
+ /**
+ * Enables the accelerator for this action.
+ *
+ * @param b the new enable state
+ */
+ public void enableAccelerator(boolean b) {
+ enableAccelerator = b;
+ }
- @Override
+ @Override
public int getAccelerator() {
- if (enableAccelerator) {
+ if (enableAccelerator) {
return super.getAccelerator();
}
- return 0;
- }
+ return 0;
+ }
- /**
- * A workbench part has been activated. Try to connect
- * to it.
- *
- * @param part the workbench part that has been activated
- */
- @Override
+ /**
+ * A workbench part has been activated. Try to connect to it.
+ *
+ * @param part the workbench part that has been activated
+ */
+ @Override
public void partActivated(IWorkbenchPart part) {
- super.partActivated(part);
- IWorkbenchPartSite site = part.getSite();
- SubActionBars bars = (SubActionBars) ((PartSite) site).getActionBars();
- bars.addPropertyChangeListener(propertyChangeListener);
- setActionHandler(bars.getGlobalActionHandler(getId()));
- }
+ super.partActivated(part);
+ IWorkbenchPartSite site = part.getSite();
+ SubActionBars bars = (SubActionBars) ((PartSite) site).getActionBars();
+ bars.addPropertyChangeListener(propertyChangeListener);
+ setActionHandler(bars.getGlobalActionHandler(getId()));
+ }
- /**
- * A workbench part has been closed.
- *
- * @param part the workbench part that has been closed
- */
- @Override
+ /**
+ * A workbench part has been closed.
+ *
+ * @param part the workbench part that has been closed
+ */
+ @Override
public void partClosed(IWorkbenchPart part) {
- IWorkbenchPart activePart = part.getSite().getPage().getActivePart();
- if (activePart != null) {
+ IWorkbenchPart activePart = part.getSite().getPage().getActivePart();
+ if (activePart != null) {
// We are going to get a part activated message so don't bother setting the
- // action handler to null. This prevents enablement flash in the toolbar
- return;
+ // action handler to null. This prevents enablement flash in the toolbar
+ return;
}
- if (part == getActivePart()) {
+ if (part == getActivePart()) {
setActionHandler(null);
}
- super.partClosed(part);
- }
+ super.partClosed(part);
+ }
- /**
- * A workbench part has been deactivated. Disconnect from it.
- *
- * @param part the workbench part that has been deactivated
- */
- @Override
+ /**
+ * A workbench part has been deactivated. Disconnect from it.
+ *
+ * @param part the workbench part that has been deactivated
+ */
+ @Override
public void partDeactivated(IWorkbenchPart part) {
- super.partDeactivated(part);
- IWorkbenchPartSite site = part.getSite();
- SubActionBars bars = (SubActionBars) ((PartSite) site).getActionBars();
- bars.removePropertyChangeListener(propertyChangeListener);
+ super.partDeactivated(part);
+ IWorkbenchPartSite site = part.getSite();
+ SubActionBars bars = (SubActionBars) ((PartSite) site).getActionBars();
+ bars.removePropertyChangeListener(propertyChangeListener);
- IWorkbenchPart activePart = part.getSite().getPage().getActivePart();
- if (activePart != null) {
+ IWorkbenchPart activePart = part.getSite().getPage().getActivePart();
+ if (activePart != null) {
// We are going to get a part activated message so don't bother setting the
- // action handler to null. This prevents enablement flash in the toolbar
- return;
+ // action handler to null. This prevents enablement flash in the toolbar
+ return;
}
- setActionHandler(null);
- }
+ setActionHandler(null);
+ }
- /**
- * Either the action handler itself has changed, or the configured action
- * handlers on the action bars have changed. Update self.
- */
- protected void propagateChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(IAction.ENABLED)) {
- Boolean bool = (Boolean) event.getNewValue();
- setEnabled(bool.booleanValue());
- } else if (event.getProperty().equals(IAction.CHECKED)) {
- Boolean bool = (Boolean) event.getNewValue();
- setChecked(bool.booleanValue());
- } else if (event.getProperty().equals(SubActionBars.P_ACTION_HANDLERS)) {
- if (event.getSource() instanceof IActionBars) {
- IActionBars bars = (IActionBars) event.getSource();
- setActionHandler(bars.getGlobalActionHandler(getId()));
- }
- }
- }
+ /**
+ * Either the action handler itself has changed, or the configured action
+ * handlers on the action bars have changed. Update self.
+ */
+ protected void propagateChange(PropertyChangeEvent event) {
+ if (event.getProperty().equals(IAction.ENABLED)) {
+ Boolean bool = (Boolean) event.getNewValue();
+ setEnabled(bool.booleanValue());
+ } else if (event.getProperty().equals(IAction.CHECKED)) {
+ Boolean bool = (Boolean) event.getNewValue();
+ setChecked(bool.booleanValue());
+ } else if (event.getProperty().equals(SubActionBars.P_ACTION_HANDLERS)) {
+ if (event.getSource() instanceof IActionBars) {
+ IActionBars bars = (IActionBars) event.getSource();
+ setActionHandler(bars.getGlobalActionHandler(getId()));
+ }
+ }
+ }
- /**
- * Invoked when an action occurs.
- */
- @Override
+ /**
+ * Invoked when an action occurs.
+ */
+ @Override
public void run() {
- if (handler != null) {
+ if (handler != null) {
handler.run();
}
- }
+ }
- /**
- * Invoked when an action occurs.
- */
- @Override
+ /**
+ * Invoked when an action occurs.
+ */
+ @Override
public void runWithEvent(Event event) {
- if (handler != null) {
+ if (handler != null) {
handler.runWithEvent(event);
}
- }
+ }
- /**
- * Returns the action handler. This method was made public in 3.0.
- *
- * @return The current action handling this retargettable action. This
- * handler will be <code>null</code> if there is no current
- * handler.
- */
- public IAction getActionHandler() {
- return handler;
- }
+ /**
+ * Returns the action handler. This method was made public in 3.0.
+ *
+ * @return The current action handling this retargettable action. This handler
+ * will be <code>null</code> if there is no current handler.
+ */
+ public IAction getActionHandler() {
+ return handler;
+ }
- @Override
+ @Override
public final boolean isHandled() {
- return (handler != null);
- }
+ return (handler != null);
+ }
- /**
- * Sets the action handler.
- */
- protected void setActionHandler(IAction newHandler) {
- // Optimize.
- if (newHandler == handler) {
+ /**
+ * Sets the action handler.
+ */
+ protected void setActionHandler(IAction newHandler) {
+ // Optimize.
+ if (newHandler == handler) {
return;
}
- // Clear old action.
- if (handler != null) {
- handler.removePropertyChangeListener(propertyChangeListener);
- handler = null;
- }
+ // Clear old action.
+ if (handler != null) {
+ handler.removePropertyChangeListener(propertyChangeListener);
+ handler = null;
+ }
- // Set new action.
+ // Set new action.
IAction oldHandler = handler;
- handler = newHandler;
- if (handler == null) {
- setEnabled(false);
- if (getStyle() == AS_CHECK_BOX || getStyle() == AS_RADIO_BUTTON) {
- setChecked(false);
- }
- } else {
- setEnabled(handler.isEnabled());
- if (getStyle() == AS_CHECK_BOX || getStyle() == AS_RADIO_BUTTON) {
- setChecked(handler.isChecked());
- }
- handler.addPropertyChangeListener(propertyChangeListener);
- }
+ handler = newHandler;
+ if (handler == null) {
+ setEnabled(false);
+ if (getStyle() == AS_CHECK_BOX || getStyle() == AS_RADIO_BUTTON) {
+ setChecked(false);
+ }
+ } else {
+ setEnabled(handler.isEnabled());
+ if (getStyle() == AS_CHECK_BOX || getStyle() == AS_RADIO_BUTTON) {
+ setChecked(handler.isChecked());
+ }
+ handler.addPropertyChangeListener(propertyChangeListener);
+ }
// Notify listeners that the handler has changed.
- firePropertyChange(IHandlerAttributes.ATTRIBUTE_HANDLED, oldHandler,
- newHandler);
- }
+ firePropertyChange(IHandlerAttributes.ATTRIBUTE_HANDLED, oldHandler, newHandler);
+ }
- @Override
+ @Override
public void setChecked(boolean checked) {
- super.setChecked(checked);
- // This call may come from the SWT control event handler
- // itself, so notify the handler action to keep things
- // in sync.
- if (handler != null) {
+ super.setChecked(checked);
+ // This call may come from the SWT control event handler
+ // itself, so notify the handler action to keep things
+ // in sync.
+ if (handler != null) {
handler.setChecked(checked);
}
- }
+ }
- /**
- * The <code>RetargetAction</code> implementation of this method declared on
- * <code>IAction</code> stores the help listener in a local field. The
- * supplied listener is only used if there is no hanlder.
- */
- @Override
+ /**
+ * The <code>RetargetAction</code> implementation of this method declared on
+ * <code>IAction</code> stores the help listener in a local field. The supplied
+ * listener is only used if there is no hanlder.
+ */
+ @Override
public void setHelpListener(HelpListener listener) {
- localHelpListener = listener;
- }
+ localHelpListener = listener;
+ }
/**
* Returns a string representation of this action.
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/SelectionProviderAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/SelectionProviderAction.java
index 5860a55a4a9..7112f684c1f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/SelectionProviderAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/SelectionProviderAction.java
@@ -40,112 +40,113 @@ import org.eclipse.jface.viewers.StructuredSelection;
* <li><code>selectionChanged(ISelection)</code></li>
* </ul>
*/
-public abstract class SelectionProviderAction extends Action implements
- ISelectionChangedListener {
+public abstract class SelectionProviderAction extends Action implements ISelectionChangedListener {
- /**
- * The selection provider that is the target of this action.
- */
- private ISelectionProvider provider;
+ /**
+ * The selection provider that is the target of this action.
+ */
+ private ISelectionProvider provider;
- /**
- * Creates a new action with the given text that monitors selection changes
- * within the given selection provider.
- * The resulting action is added as a listener on the selection provider.
- *
- * @param provider the selection provider that will provide selection notification
- * @param text the string used as the text for the action,
- * or <code>null</code> if there is no text
- */
- protected SelectionProviderAction(ISelectionProvider provider, String text) {
- super(text);
- this.provider = provider;
- provider.addSelectionChangedListener(this);
- }
+ /**
+ * Creates a new action with the given text that monitors selection changes
+ * within the given selection provider. The resulting action is added as a
+ * listener on the selection provider.
+ *
+ * @param provider the selection provider that will provide selection
+ * notification
+ * @param text the string used as the text for the action, or
+ * <code>null</code> if there is no text
+ */
+ protected SelectionProviderAction(ISelectionProvider provider, String text) {
+ super(text);
+ this.provider = provider;
+ provider.addSelectionChangedListener(this);
+ }
- /**
- * Disposes this action by removing it as a listener from the selection provider.
- * This must be called by the creator of the action when the action is no longer needed.
- */
- public void dispose() {
- provider.removeSelectionChangedListener(this);
- }
+ /**
+ * Disposes this action by removing it as a listener from the selection
+ * provider. This must be called by the creator of the action when the action is
+ * no longer needed.
+ */
+ public void dispose() {
+ provider.removeSelectionChangedListener(this);
+ }
- /**
- * Returns the current selection in the selection provider.
- *
- * @return the current selection in the selection provider
- */
- public ISelection getSelection() {
- return provider.getSelection();
- }
+ /**
+ * Returns the current selection in the selection provider.
+ *
+ * @return the current selection in the selection provider
+ */
+ public ISelection getSelection() {
+ return provider.getSelection();
+ }
- /**
- * Returns the selection provider that is the target of this action.
- *
- * @return the target selection provider of this action
- */
- public ISelectionProvider getSelectionProvider() {
- return provider;
- }
+ /**
+ * Returns the selection provider that is the target of this action.
+ *
+ * @return the target selection provider of this action
+ */
+ public ISelectionProvider getSelectionProvider() {
+ return provider;
+ }
- /**
- * Returns the current structured selection in the selection provider, or an
- * empty selection if nothing is selected or if selection does not include
- * objects (for example, raw text).
- *
- * @return the current structured selection in the selection provider
- */
- public IStructuredSelection getStructuredSelection() {
- ISelection selection = provider.getSelection();
- if (selection instanceof IStructuredSelection) {
+ /**
+ * Returns the current structured selection in the selection provider, or an
+ * empty selection if nothing is selected or if selection does not include
+ * objects (for example, raw text).
+ *
+ * @return the current structured selection in the selection provider
+ */
+ public IStructuredSelection getStructuredSelection() {
+ ISelection selection = provider.getSelection();
+ if (selection instanceof IStructuredSelection) {
return (IStructuredSelection) selection;
}
return new StructuredSelection();
- }
+ }
- /**
- * Notifies this action that the given (non-structured) selection has changed
- * in the selection provider.
- * <p>
- * The <code>SelectionProviderAction</code> implementation of this method
- * does nothing. Subclasses may reimplement to react to this selection change.
- * </p>
- *
- * @param selection the new selection
- */
- public void selectionChanged(ISelection selection) {
- }
+ /**
+ * Notifies this action that the given (non-structured) selection has changed in
+ * the selection provider.
+ * <p>
+ * The <code>SelectionProviderAction</code> implementation of this method does
+ * nothing. Subclasses may reimplement to react to this selection change.
+ * </p>
+ *
+ * @param selection the new selection
+ */
+ public void selectionChanged(ISelection selection) {
+ }
- /**
- * Notifies this action that the given structured selection has changed
- * in the selection provider.
- * <p>
- * The <code>SelectionProviderAction</code> implementation of this method
- * does nothing. Subclasses may reimplement to react to this selection change.
- * </p>
- *
- * @param selection the new selection
- */
- public void selectionChanged(IStructuredSelection selection) {
- // Hook in subclass.
- }
+ /**
+ * Notifies this action that the given structured selection has changed in the
+ * selection provider.
+ * <p>
+ * The <code>SelectionProviderAction</code> implementation of this method does
+ * nothing. Subclasses may reimplement to react to this selection change.
+ * </p>
+ *
+ * @param selection the new selection
+ */
+ public void selectionChanged(IStructuredSelection selection) {
+ // Hook in subclass.
+ }
- /**
- * The <code>SelectionProviderAction</code> implementation of this
- * <code>ISelectionChangedListener</code> method calls
- * <code>selectionChanged(IStructuredSelection)</code> if the selection is
- * a structured selection but <code>selectionChanged(ISelection)</code> if it is
- * not. Subclasses should override either of those methods method to react to
- * selection changes.
- */
- @Override
+ /**
+ * The <code>SelectionProviderAction</code> implementation of this
+ * <code>ISelectionChangedListener</code> method calls
+ * <code>selectionChanged(IStructuredSelection)</code> if the selection is a
+ * structured selection but <code>selectionChanged(ISelection)</code> if it is
+ * not. Subclasses should override either of those methods method to react to
+ * selection changes.
+ */
+ @Override
public final void selectionChanged(SelectionChangedEvent event) {
- ISelection selection = event.getSelection();
- if (selection instanceof IStructuredSelection) {
+ ISelection selection = event.getSelection();
+ if (selection instanceof IStructuredSelection) {
selectionChanged((IStructuredSelection) selection);
} else {
selectionChanged(selection);
}
- }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/SimpleWildcardTester.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/SimpleWildcardTester.java
index ad916fb5578..f071815df63 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/SimpleWildcardTester.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/SimpleWildcardTester.java
@@ -14,52 +14,52 @@
package org.eclipse.ui.actions;
/**
- * Implements an algorithm for very simple pattern matching in a string.
- * There is only one feature: "*" may be used at the start or the end of the
- * pattern to represent "one or more characters".
+ * Implements an algorithm for very simple pattern matching in a string. There
+ * is only one feature: "*" may be used at the start or the end of the pattern
+ * to represent "one or more characters".
*/
public final class SimpleWildcardTester {
- /**
- * Returns whether a string matches a particular pattern.
- *
- * @param pattern the input pattern
- * @param str the string to test
- * @return <code>true</code> if a match occurs; <code>false</code>otherwise.
- */
- public static boolean testWildcard(String pattern, String str) {
- if (pattern.equals("*")) {//$NON-NLS-1$
- return true;
- } else if (pattern.startsWith("*")) {//$NON-NLS-1$
- if (pattern.endsWith("*")) {//$NON-NLS-1$
- if (pattern.length() == 2) {
+ /**
+ * Returns whether a string matches a particular pattern.
+ *
+ * @param pattern the input pattern
+ * @param str the string to test
+ * @return <code>true</code> if a match occurs; <code>false</code>otherwise.
+ */
+ public static boolean testWildcard(String pattern, String str) {
+ if (pattern.equals("*")) {//$NON-NLS-1$
+ return true;
+ } else if (pattern.startsWith("*")) {//$NON-NLS-1$
+ if (pattern.endsWith("*")) {//$NON-NLS-1$
+ if (pattern.length() == 2) {
return true;
}
- return str.indexOf(pattern.substring(1, pattern.length() - 1)) >= 0;
- }
- return str.endsWith(pattern.substring(1));
- } else if (pattern.endsWith("*")) {//$NON-NLS-1$
- return str.startsWith(pattern.substring(0, pattern.length() - 1));
- } else {
- return str.equals(pattern);
- }
- }
+ return str.indexOf(pattern.substring(1, pattern.length() - 1)) >= 0;
+ }
+ return str.endsWith(pattern.substring(1));
+ } else if (pattern.endsWith("*")) {//$NON-NLS-1$
+ return str.startsWith(pattern.substring(0, pattern.length() - 1));
+ } else {
+ return str.equals(pattern);
+ }
+ }
- /**
- * Returns whether a string matches a particular pattern. Both string and
- * pattern are converted to lower case before pattern matching occurs.
- *
- * @param pattern the input pattern
- * @param str the string to test
- * @return <code>true</code> if a match occurs; <code>false</code>otherwise.
- */
- public static boolean testWildcardIgnoreCase(String pattern, String str) {
+ /**
+ * Returns whether a string matches a particular pattern. Both string and
+ * pattern are converted to lower case before pattern matching occurs.
+ *
+ * @param pattern the input pattern
+ * @param str the string to test
+ * @return <code>true</code> if a match occurs; <code>false</code>otherwise.
+ */
+ public static boolean testWildcardIgnoreCase(String pattern, String str) {
- //If str is null there was no extension to test
- if (str == null) {
+ // If str is null there was no extension to test
+ if (str == null) {
return false;
}
- pattern = pattern.toLowerCase();
- str = str.toLowerCase();
- return testWildcard(pattern, str);
- }
+ pattern = pattern.toLowerCase();
+ str = str.toLowerCase();
+ return testWildcard(pattern, str);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/WorkingSetFilterActionGroup.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/WorkingSetFilterActionGroup.java
index 2932b713302..df1f2234d0c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/WorkingSetFilterActionGroup.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/WorkingSetFilterActionGroup.java
@@ -47,30 +47,30 @@ import org.eclipse.ui.internal.util.Util;
* @since 2.1
*/
public class WorkingSetFilterActionGroup extends ActionGroup {
- private static final String TAG_WORKING_SET_NAME = "workingSetName"; //$NON-NLS-1$
+ private static final String TAG_WORKING_SET_NAME = "workingSetName"; //$NON-NLS-1$
- /**
- * Indicates if working set was changed
- */
- public static final String CHANGE_WORKING_SET = "changeWorkingSet"; //$NON-NLS-1$
+ /**
+ * Indicates if working set was changed
+ */
+ public static final String CHANGE_WORKING_SET = "changeWorkingSet"; //$NON-NLS-1$
- private static final String START_SEPARATOR_ID = "workingSetGroupStartSeparator"; //$NON-NLS-1$
+ private static final String START_SEPARATOR_ID = "workingSetGroupStartSeparator"; //$NON-NLS-1$
- private static final String SEPARATOR_ID = "workingSetGroupSeparator"; //$NON-NLS-1$
+ private static final String SEPARATOR_ID = "workingSetGroupSeparator"; //$NON-NLS-1$
private static final String WORKING_SET_ACTION_GROUP = "workingSetActionGroup"; //$NON-NLS-1$
- private IWorkingSet workingSet = null;
+ private IWorkingSet workingSet = null;
- private ClearWorkingSetAction clearWorkingSetAction;
+ private ClearWorkingSetAction clearWorkingSetAction;
- private SelectWorkingSetAction selectWorkingSetAction;
+ private SelectWorkingSetAction selectWorkingSetAction;
- private EditWorkingSetAction editWorkingSetAction;
+ private EditWorkingSetAction editWorkingSetAction;
- private IPropertyChangeListener workingSetUpdater;
+ private IPropertyChangeListener workingSetUpdater;
- private IMenuManager menuManager;
+ private IMenuManager menuManager;
private IWorkbenchWindow workbenchWindow;
@@ -80,61 +80,54 @@ public class WorkingSetFilterActionGroup extends ActionGroup {
private CompoundContributionItem mruList;
- /**
+ /**
* Creates a new instance of the receiver.
*
- * @param shell
- * shell to open dialogs and wizards on
- * @param workingSetUpdater
- * property change listener notified when a working set is set
- * @since 3.2 Please note that it is expected that clients treat any
- * selected working sets whose
- * {@link IWorkingSet#isAggregateWorkingSet()} method returns
- * <code>true</code> somewhat differently from traditional working
- * sets. Please see the documentation for
+ * @param shell shell to open dialogs and wizards on
+ * @param workingSetUpdater property change listener notified when a working set
+ * is set
+ * @since 3.2 Please note that it is expected that clients treat any selected
+ * working sets whose {@link IWorkingSet#isAggregateWorkingSet()} method
+ * returns <code>true</code> somewhat differently from traditional
+ * working sets. Please see the documentation for
* {@link IWorkbenchPage#getAggregateWorkingSet()} for details.
*/
- public WorkingSetFilterActionGroup(Shell shell,
- IPropertyChangeListener workingSetUpdater) {
- Assert.isNotNull(shell);
+ public WorkingSetFilterActionGroup(Shell shell, IPropertyChangeListener workingSetUpdater) {
+ Assert.isNotNull(shell);
- this.workingSetUpdater = workingSetUpdater;
- clearWorkingSetAction = new ClearWorkingSetAction(this);
- selectWorkingSetAction = new SelectWorkingSetAction(this, shell);
- editWorkingSetAction = new EditWorkingSetAction(this, shell);
- mruList = new CompoundContributionItem() {
+ this.workingSetUpdater = workingSetUpdater;
+ clearWorkingSetAction = new ClearWorkingSetAction(this);
+ selectWorkingSetAction = new SelectWorkingSetAction(this, shell);
+ editWorkingSetAction = new EditWorkingSetAction(this, shell);
+ mruList = new CompoundContributionItem() {
@Override
protected IContributionItem[] getContributionItems() {
- IWorkingSet[] workingSets = PlatformUI.getWorkbench()
- .getWorkingSetManager().getRecentWorkingSets();
+ IWorkingSet[] workingSets = PlatformUI.getWorkbench().getWorkingSetManager().getRecentWorkingSets();
List items = new ArrayList(workingSets.length);
List sortedWorkingSets = Arrays.asList(workingSets);
Collections.sort(sortedWorkingSets, new WorkingSetComparator());
int mruMenuCount = 0;
if (page != null && page.getAggregateWorkingSet() != null) {
- IContributionItem item = new WorkingSetMenuContributionItem(
- ++mruMenuCount,
+ IContributionItem item = new WorkingSetMenuContributionItem(++mruMenuCount,
WorkingSetFilterActionGroup.this, page.getAggregateWorkingSet());
items.add(item);
}
for (Iterator i = sortedWorkingSets.iterator(); i.hasNext();) {
IWorkingSet workingSet = (IWorkingSet) i.next();
if (workingSet != null && !workingSet.isAggregateWorkingSet()) {
- IContributionItem item = new WorkingSetMenuContributionItem(
- ++mruMenuCount,
+ IContributionItem item = new WorkingSetMenuContributionItem(++mruMenuCount,
WorkingSetFilterActionGroup.this, workingSet);
items.add(item);
}
}
- return (IContributionItem[]) items
- .toArray(new IContributionItem[items.size()]);
+ return (IContributionItem[]) items.toArray(new IContributionItem[items.size()]);
}
- };
+ };
- workbenchWindow = Util.getWorkbenchWindowForShell(shell);
- allowWindowWorkingSetByDefault = false;
+ workbenchWindow = Util.getWorkbenchWindowForShell(shell);
+ allowWindowWorkingSetByDefault = false;
// set the default working set to be that of the window.
page = workbenchWindow.getActivePage();
if (page == null) {
@@ -143,25 +136,24 @@ public class WorkingSetFilterActionGroup extends ActionGroup {
page = pages[0];
}
}
- }
+ }
- @Override
+ @Override
public void fillActionBars(IActionBars actionBars) {
- menuManager = actionBars.getMenuManager();
-
- if(menuManager.find(IWorkbenchActionConstants.MB_ADDITIONS) != null)
- menuManager.insertAfter(IWorkbenchActionConstants.MB_ADDITIONS, new Separator(WORKING_SET_ACTION_GROUP));
- else
- menuManager.add(new Separator(WORKING_SET_ACTION_GROUP));
-
- menuManager.appendToGroup(WORKING_SET_ACTION_GROUP, selectWorkingSetAction);
- menuManager.appendToGroup(WORKING_SET_ACTION_GROUP, clearWorkingSetAction);
- menuManager.appendToGroup(WORKING_SET_ACTION_GROUP, editWorkingSetAction);
- menuManager.appendToGroup(WORKING_SET_ACTION_GROUP, new Separator(START_SEPARATOR_ID));
- menuManager.appendToGroup(WORKING_SET_ACTION_GROUP, mruList);
- menuManager.appendToGroup(WORKING_SET_ACTION_GROUP, new Separator(SEPARATOR_ID));
- }
-
+ menuManager = actionBars.getMenuManager();
+
+ if (menuManager.find(IWorkbenchActionConstants.MB_ADDITIONS) != null)
+ menuManager.insertAfter(IWorkbenchActionConstants.MB_ADDITIONS, new Separator(WORKING_SET_ACTION_GROUP));
+ else
+ menuManager.add(new Separator(WORKING_SET_ACTION_GROUP));
+
+ menuManager.appendToGroup(WORKING_SET_ACTION_GROUP, selectWorkingSetAction);
+ menuManager.appendToGroup(WORKING_SET_ACTION_GROUP, clearWorkingSetAction);
+ menuManager.appendToGroup(WORKING_SET_ACTION_GROUP, editWorkingSetAction);
+ menuManager.appendToGroup(WORKING_SET_ACTION_GROUP, new Separator(START_SEPARATOR_ID));
+ menuManager.appendToGroup(WORKING_SET_ACTION_GROUP, mruList);
+ menuManager.appendToGroup(WORKING_SET_ACTION_GROUP, new Separator(SEPARATOR_ID));
+ }
@Override
public void fillContextMenu(IMenuManager menuManager) {
@@ -169,56 +161,54 @@ public class WorkingSetFilterActionGroup extends ActionGroup {
menuManager.add(clearWorkingSetAction);
menuManager.add(editWorkingSetAction);
menuManager.add(new Separator());
- menuManager.add(mruList);
+ menuManager.add(mruList);
menuManager.add(new Separator(SEPARATOR_ID));
}
- /**
- * Returns the working set which is currently selected.
- *
- * @return the working set which is currently selected.
- */
- public IWorkingSet getWorkingSet() {
- return workingSet;
- }
-
- /**
- * Sets the current working set.
- *
- * @param newWorkingSet the new working set
- */
- public void setWorkingSet(IWorkingSet newWorkingSet) {
- IWorkingSet oldWorkingSet = workingSet;
-
- workingSet = newWorkingSet;
- // Update action
- clearWorkingSetAction.setEnabled(newWorkingSet != null);
- editWorkingSetAction.setEnabled(newWorkingSet != null && newWorkingSet.isEditable());
-
- firePropertyChange(newWorkingSet, oldWorkingSet);
- }
-
- /**
- * Fire the property change to the updater if there is one available.
- *
- * @param newWorkingSet the new working set
- * @param oldWorkingSet the previous working set
- * @since 3.2
- */
+ /**
+ * Returns the working set which is currently selected.
+ *
+ * @return the working set which is currently selected.
+ */
+ public IWorkingSet getWorkingSet() {
+ return workingSet;
+ }
+
+ /**
+ * Sets the current working set.
+ *
+ * @param newWorkingSet the new working set
+ */
+ public void setWorkingSet(IWorkingSet newWorkingSet) {
+ IWorkingSet oldWorkingSet = workingSet;
+
+ workingSet = newWorkingSet;
+ // Update action
+ clearWorkingSetAction.setEnabled(newWorkingSet != null);
+ editWorkingSetAction.setEnabled(newWorkingSet != null && newWorkingSet.isEditable());
+
+ firePropertyChange(newWorkingSet, oldWorkingSet);
+ }
+
+ /**
+ * Fire the property change to the updater if there is one available.
+ *
+ * @param newWorkingSet the new working set
+ * @param oldWorkingSet the previous working set
+ * @since 3.2
+ */
private void firePropertyChange(IWorkingSet newWorkingSet, IWorkingSet oldWorkingSet) {
// Update viewer
if (workingSetUpdater != null && newWorkingSet != oldWorkingSet) {
- workingSetUpdater.propertyChange(new PropertyChangeEvent(this,
- WorkingSetFilterActionGroup.CHANGE_WORKING_SET,
- oldWorkingSet, newWorkingSet));
- }
+ workingSetUpdater.propertyChange(new PropertyChangeEvent(this,
+ WorkingSetFilterActionGroup.CHANGE_WORKING_SET, oldWorkingSet, newWorkingSet));
+ }
}
/**
* Saves the state of the filter actions in a memento.
*
- * @param memento
- * the memento
+ * @param memento the memento
* @since 3.3
*/
public void saveState(IMemento memento) {
@@ -248,10 +238,7 @@ public class WorkingSetFilterActionGroup extends ActionGroup {
}
private boolean useWindowWorkingSetByDefault() {
- return allowWindowWorkingSetByDefault
- && PlatformUI
- .getPreferenceStore()
- .getBoolean(
- IWorkbenchPreferenceConstants.USE_WINDOW_WORKING_SET_BY_DEFAULT);
+ return allowWindowWorkingSetByDefault && PlatformUI.getPreferenceStore()
+ .getBoolean(IWorkbenchPreferenceConstants.USE_WINDOW_WORKING_SET_BY_DEFAULT);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ActivitiesPreferencePage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ActivitiesPreferencePage.java
index b1296a3a134..82a6343404e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ActivitiesPreferencePage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ActivitiesPreferencePage.java
@@ -44,108 +44,109 @@ import org.eclipse.ui.internal.activities.ws.ActivityMessages;
* @see #ACTIVITY_PROMPT_BUTTON_TOOLTIP
* @since 3.1
*/
-public final class ActivitiesPreferencePage extends PreferencePage implements
- IWorkbenchPreferencePage, IExecutableExtension {
+public final class ActivitiesPreferencePage extends PreferencePage
+ implements IWorkbenchPreferencePage, IExecutableExtension {
/**
- * The name to use for the activities. Ie: "Capabilities".
+ * The name to use for the activities. Ie: "Capabilities".
*/
- public static final String ACTIVITY_NAME = "activityName"; //$NON-NLS-1$
+ public static final String ACTIVITY_NAME = "activityName"; //$NON-NLS-1$
/**
* The label to be used for the prompt button. Ie: "&amp;Prompt when enabling
* capabilities".
*/
- public static final String ACTIVITY_PROMPT_BUTTON = "activityPromptButton"; //$NON-NLS-1$
+ public static final String ACTIVITY_PROMPT_BUTTON = "activityPromptButton"; //$NON-NLS-1$
/**
- * The tooltip to be used for the prompt button. Ie: "Prompt when a feature is first used that requires enablement of capabilities".
+ * The tooltip to be used for the prompt button. Ie: "Prompt when a feature is
+ * first used that requires enablement of capabilities".
*/
- public static final String ACTIVITY_PROMPT_BUTTON_TOOLTIP = "activityPromptButtonTooltip"; //$NON-NLS-1$
+ public static final String ACTIVITY_PROMPT_BUTTON_TOOLTIP = "activityPromptButtonTooltip"; //$NON-NLS-1$
private Button activityPromptButton;
- private IWorkbench workbench;
+ private IWorkbench workbench;
- private ActivityEnabler enabler;
+ private ActivityEnabler enabler;
- private Properties strings = new Properties();
+ private Properties strings = new Properties();
- private IMutableActivityManager workingCopy;
+ private IMutableActivityManager workingCopy;
- /**
- * Create the prompt for activity enablement.
- *
- * @param composite the parent
- */
- protected void createActivityPromptPref(Composite composite) {
- activityPromptButton = new Button(composite, SWT.CHECK);
- activityPromptButton.setText(strings.getProperty(ACTIVITY_PROMPT_BUTTON, ActivityMessages.activityPromptButton));
- activityPromptButton.setToolTipText(strings.getProperty(ACTIVITY_PROMPT_BUTTON_TOOLTIP, ActivityMessages.activityPromptToolTip));
-
- setActivityButtonState();
- }
+ /**
+ * Create the prompt for activity enablement.
+ *
+ * @param composite the parent
+ */
+ protected void createActivityPromptPref(Composite composite) {
+ activityPromptButton = new Button(composite, SWT.CHECK);
+ activityPromptButton
+ .setText(strings.getProperty(ACTIVITY_PROMPT_BUTTON, ActivityMessages.activityPromptButton));
+ activityPromptButton.setToolTipText(
+ strings.getProperty(ACTIVITY_PROMPT_BUTTON_TOOLTIP, ActivityMessages.activityPromptToolTip));
+
+ setActivityButtonState();
+ }
- /**
- * Sets the state of the activity prompt button from preferences.
- */
- private void setActivityButtonState() {
- activityPromptButton.setSelection(getPreferenceStore().getBoolean(
- IPreferenceConstants.SHOULD_PROMPT_FOR_ENABLEMENT));
- }
+ /**
+ * Sets the state of the activity prompt button from preferences.
+ */
+ private void setActivityButtonState() {
+ activityPromptButton
+ .setSelection(getPreferenceStore().getBoolean(IPreferenceConstants.SHOULD_PROMPT_FOR_ENABLEMENT));
+ }
- @Override
+ @Override
protected Control createContents(Composite parent) {
- initializeDialogUnits(parent);
+ initializeDialogUnits(parent);
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- composite.setLayout(layout);
+ composite.setLayout(layout);
- createActivityPromptPref(composite);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- activityPromptButton.setLayoutData(data);
+ createActivityPromptPref(composite);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ activityPromptButton.setLayoutData(data);
- data = new GridData(GridData.FILL_BOTH);
- workingCopy = workbench.getActivitySupport().createWorkingCopy();
- enabler = new ActivityEnabler(workingCopy, strings);
- enabler.createControl(composite).setLayoutData(data);
+ data = new GridData(GridData.FILL_BOTH);
+ workingCopy = workbench.getActivitySupport().createWorkingCopy();
+ enabler = new ActivityEnabler(workingCopy, strings);
+ enabler.createControl(composite).setLayoutData(data);
- Dialog.applyDialogFont(composite);
+ Dialog.applyDialogFont(composite);
- return composite;
- }
+ return composite;
+ }
- @Override
+ @Override
public void init(IWorkbench aWorkbench) {
- this.workbench = aWorkbench;
- setPreferenceStore(WorkbenchPlugin.getDefault().getPreferenceStore());
- }
+ this.workbench = aWorkbench;
+ setPreferenceStore(WorkbenchPlugin.getDefault().getPreferenceStore());
+ }
- @Override
+ @Override
public boolean performOk() {
- enabler.updateActivityStates();
- workbench.getActivitySupport().setEnabledActivityIds(workingCopy.getEnabledActivityIds());
+ enabler.updateActivityStates();
+ workbench.getActivitySupport().setEnabledActivityIds(workingCopy.getEnabledActivityIds());
- getPreferenceStore().setValue(
- IPreferenceConstants.SHOULD_PROMPT_FOR_ENABLEMENT,
- activityPromptButton.getSelection());
+ getPreferenceStore().setValue(IPreferenceConstants.SHOULD_PROMPT_FOR_ENABLEMENT,
+ activityPromptButton.getSelection());
- return true;
- }
+ return true;
+ }
- @Override
+ @Override
protected void performDefaults() {
- enabler.restoreDefaults();
- activityPromptButton.setSelection(getPreferenceStore()
- .getDefaultBoolean(
- IPreferenceConstants.SHOULD_PROMPT_FOR_ENABLEMENT));
- super.performDefaults();
- }
+ enabler.restoreDefaults();
+ activityPromptButton.setSelection(
+ getPreferenceStore().getDefaultBoolean(IPreferenceConstants.SHOULD_PROMPT_FOR_ENABLEMENT));
+ super.performDefaults();
+ }
@Override
public void setInitializationData(IConfigurationElement config, String propertyName, Object data) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ActivityCategoryPreferencePage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ActivityCategoryPreferencePage.java
index 419a1cefbb8..5c52c584f66 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ActivityCategoryPreferencePage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ActivityCategoryPreferencePage.java
@@ -80,186 +80,177 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
*
* @since 3.1
*/
-public final class ActivityCategoryPreferencePage extends PreferencePage implements
- IWorkbenchPreferencePage, IExecutableExtension {
-
- /**
- * The name to use for the activities. Ie: "Capabilities".
- */
- public static final String ACTIVITY_NAME = "activityName"; //$NON-NLS-1$
-
- /**
- * The parameter to use if you want the page to show the allow button. Must
- * be true or false.
- */
- public static final String ALLOW_ADVANCED = "allowAdvanced"; //$NON-NLS-1$
-
- /**
- * The string to use for the message at the top of the preference page.
- */
- public static final String CAPTION_MESSAGE = "captionMessage"; //$NON-NLS-1$
-
- /**
- * The name to use for the activity categories. Ie: "Roles".
- */
- public static final String CATEGORY_NAME = "categoryName"; //$NON-NLS-1$
-
- /**
+public final class ActivityCategoryPreferencePage extends PreferencePage
+ implements IWorkbenchPreferencePage, IExecutableExtension {
+
+ /**
+ * The name to use for the activities. Ie: "Capabilities".
+ */
+ public static final String ACTIVITY_NAME = "activityName"; //$NON-NLS-1$
+
+ /**
+ * The parameter to use if you want the page to show the allow button. Must be
+ * true or false.
+ */
+ public static final String ALLOW_ADVANCED = "allowAdvanced"; //$NON-NLS-1$
+
+ /**
+ * The string to use for the message at the top of the preference page.
+ */
+ public static final String CAPTION_MESSAGE = "captionMessage"; //$NON-NLS-1$
+
+ /**
+ * The name to use for the activity categories. Ie: "Roles".
+ */
+ public static final String CATEGORY_NAME = "categoryName"; //$NON-NLS-1$
+
+ /**
* The label to be used for the prompt button. Ie: "&amp;Prompt when enabling
* capabilities".
*/
- public static final String ACTIVITY_PROMPT_BUTTON = "activityPromptButton"; //$NON-NLS-1$
+ public static final String ACTIVITY_PROMPT_BUTTON = "activityPromptButton"; //$NON-NLS-1$
- /**
- * The tooltip to be used for the prompt button. Ie: "Prompt when a feature is first used that requires enablement of capabilities".
- */
- public static final String ACTIVITY_PROMPT_BUTTON_TOOLTIP = "activityPromptButtonTooltip"; //$NON-NLS-1$
+ /**
+ * The tooltip to be used for the prompt button. Ie: "Prompt when a feature is
+ * first used that requires enablement of capabilities".
+ */
+ public static final String ACTIVITY_PROMPT_BUTTON_TOOLTIP = "activityPromptButtonTooltip"; //$NON-NLS-1$
- private class CategoryLabelProvider extends LabelProvider implements
- ITableLabelProvider, IActivityManagerListener {
+ private class CategoryLabelProvider extends LabelProvider implements ITableLabelProvider, IActivityManagerListener {
- private LocalResourceManager manager = new LocalResourceManager(
- JFaceResources.getResources());
+ private LocalResourceManager manager = new LocalResourceManager(JFaceResources.getResources());
- private ImageDescriptor lockDescriptor;
+ private ImageDescriptor lockDescriptor;
- private boolean decorate;
+ private boolean decorate;
- /**
- * @param decorate
- */
- public CategoryLabelProvider(boolean decorate) {
- this.decorate = decorate;
- lockDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(
- PlatformUI.PLUGIN_ID, "icons/full/ovr16/lock_ovr.png"); //$NON-NLS-1$
- }
+ /**
+ * @param decorate
+ */
+ public CategoryLabelProvider(boolean decorate) {
+ this.decorate = decorate;
+ lockDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(PlatformUI.PLUGIN_ID,
+ "icons/full/ovr16/lock_ovr.png"); //$NON-NLS-1$
+ }
+
+ @Override
+ public Image getColumnImage(Object element, int columnIndex) {
+ ICategory category = (ICategory) element;
+ ImageDescriptor descriptor = PlatformUI.getWorkbench().getActivitySupport().getImageDescriptor(category);
+ if (descriptor != null) {
+ try {
+ if (decorate) {
+ if (isLocked(category)) {
+ ImageData originalImageData = descriptor.getImageData();
+ OverlayIcon overlay = new OverlayIcon(descriptor, lockDescriptor,
+ new Point(originalImageData.width, originalImageData.height));
+ return manager.createImage(overlay);
+ }
+ }
+
+ return manager.createImage(descriptor);
+ } catch (DeviceResourceException e) {
+ WorkbenchPlugin.log(e);
+ }
+ }
+ return null;
+ }
@Override
- public Image getColumnImage(Object element, int columnIndex) {
- ICategory category = (ICategory) element;
- ImageDescriptor descriptor = PlatformUI.getWorkbench()
- .getActivitySupport().getImageDescriptor(category);
- if (descriptor != null) {
- try {
- if (decorate) {
- if (isLocked(category)) {
- ImageData originalImageData = descriptor
- .getImageData();
- OverlayIcon overlay = new OverlayIcon(
- descriptor, lockDescriptor, new Point(
- originalImageData.width,
- originalImageData.height));
- return manager.createImage(overlay);
- }
- }
-
- return manager.createImage(descriptor);
- } catch (DeviceResourceException e) {
- WorkbenchPlugin.log(e);
- }
- }
- return null;
- }
-
- @Override
public String getText(Object element) {
- String name = null;
- ICategory category = (ICategory) element;
- try {
- name = category.getName();
- } catch (NotDefinedException e) {
- name = category.getId();
- }
- if (decorate && isLocked(category)) {
- name = NLS.bind(ActivityMessages.ActivitiesPreferencePage_lockedMessage, name);
- }
- return name;
- }
+ String name = null;
+ ICategory category = (ICategory) element;
+ try {
+ name = category.getName();
+ } catch (NotDefinedException e) {
+ name = category.getId();
+ }
+ if (decorate && isLocked(category)) {
+ name = NLS.bind(ActivityMessages.ActivitiesPreferencePage_lockedMessage, name);
+ }
+ return name;
+ }
@Override
- public String getColumnText(Object element, int columnIndex) {
- return getText(element);
- }
+ public String getColumnText(Object element, int columnIndex) {
+ return getText(element);
+ }
- @Override
+ @Override
public void dispose() {
- super.dispose();
- manager.dispose();
- }
+ super.dispose();
+ manager.dispose();
+ }
@Override
- public void activityManagerChanged(
- ActivityManagerEvent activityManagerEvent) {
- if (activityManagerEvent.haveEnabledActivityIdsChanged()) {
- updateCategoryCheckState();
- fireLabelProviderChanged(new LabelProviderChangedEvent(this));
- }
- }
- }
-
- private class CategoryContentProvider implements IStructuredContentProvider {
+ public void activityManagerChanged(ActivityManagerEvent activityManagerEvent) {
+ if (activityManagerEvent.haveEnabledActivityIdsChanged()) {
+ updateCategoryCheckState();
+ fireLabelProviderChanged(new LabelProviderChangedEvent(this));
+ }
+ }
+ }
+
+ private class CategoryContentProvider implements IStructuredContentProvider {
@SuppressWarnings("unchecked")
@Override
- public Object[] getElements(Object inputElement) {
- // convert to category objects
+ public Object[] getElements(Object inputElement) {
+ // convert to category objects
return WorkbenchActivityHelper.resolveCategories(workingCopy, (Set<String>) inputElement);
- }
- }
+ }
+ }
- private class EmptyCategoryFilter extends ViewerFilter {
+ private class EmptyCategoryFilter extends ViewerFilter {
- @Override
- public boolean select(Viewer viewer, Object parentElement,
- Object element) {
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
ICategory category = (ICategory) element;
- if (InternalActivityHelper.getActivityIdsForCategory(workingCopy,
- category).isEmpty()) {
+ if (InternalActivityHelper.getActivityIdsForCategory(workingCopy, category).isEmpty()) {
return false;
}
return true;
}
- }
+ }
- protected IWorkbench workbench;
+ protected IWorkbench workbench;
- private CheckboxTableViewer categoryViewer;
+ private CheckboxTableViewer categoryViewer;
- private TableViewer dependantViewer;
+ private TableViewer dependantViewer;
- private Text descriptionText;
+ private Text descriptionText;
- private IMutableActivityManager workingCopy;
+ private IMutableActivityManager workingCopy;
- private Button activityPromptButton;
+ private Button activityPromptButton;
- private boolean allowAdvanced = false;
+ private boolean allowAdvanced = false;
- private Properties strings = new Properties();
+ private Properties strings = new Properties();
private ActivityEnabler enabler;
- @Override
+ @Override
protected Control createContents(Composite parent) {
- initializeDialogUnits(parent);
-
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(2, false);
- layout.marginHeight = layout.marginWidth = 0;
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- composite.setLayout(layout);
- Label label = new Label(composite, SWT.WRAP);
- label
- .setText(strings.getProperty(CAPTION_MESSAGE, ActivityMessages.ActivitiesPreferencePage_captionMessage));
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = 400;
- data.horizontalSpan = 2;
- label.setLayoutData(data);
- label = new Label(composite, SWT.NONE); //spacer
- data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- data.horizontalSpan = 2;
- label.setLayoutData(data);
- createPromptButton(composite);
+ initializeDialogUnits(parent);
+
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(2, false);
+ layout.marginHeight = layout.marginWidth = 0;
+ layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+ layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
+ composite.setLayout(layout);
+ Label label = new Label(composite, SWT.WRAP);
+ label.setText(strings.getProperty(CAPTION_MESSAGE, ActivityMessages.ActivitiesPreferencePage_captionMessage));
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ data.widthHint = 400;
+ data.horizontalSpan = 2;
+ label.setLayoutData(data);
+ label = new Label(composite, SWT.NONE); // spacer
+ data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
+ data.horizontalSpan = 2;
+ label.setLayoutData(data);
+ createPromptButton(composite);
workbench.getHelpSystem().setHelp(parent, IWorkbenchHelpContextIds.CAPABILITY_PREFERENCE_PAGE);
@@ -272,144 +263,143 @@ public final class ActivityCategoryPreferencePage extends PreferencePage impleme
return composite;
}
- createCategoryArea(composite);
- createDetailsArea(composite);
- createButtons(composite);
-
-
- Dialog.applyDialogFont(composite);
-
- return composite;
- }
-
- /**
- * @param composite
- */
- private void createPromptButton(Composite composite) {
- activityPromptButton = new Button(composite, SWT.CHECK);
- activityPromptButton.setText(strings.getProperty(ACTIVITY_PROMPT_BUTTON, ActivityMessages.activityPromptButton));
- activityPromptButton.setToolTipText(strings.getProperty(ACTIVITY_PROMPT_BUTTON_TOOLTIP, ActivityMessages.activityPromptToolTip));
- GridData data = new GridData();
- data.horizontalSpan = 2;
- activityPromptButton.setLayoutData(data);
- activityPromptButton.setSelection(getPreferenceStore()
- .getBoolean(
- IPreferenceConstants.SHOULD_PROMPT_FOR_ENABLEMENT));
- }
-
- private void createButtons(final Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(4, false);
- layout.marginHeight = layout.marginWidth = 0;
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- composite.setLayout(layout);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- composite.setLayoutData(data);
-
- Button enableAll = new Button(composite, SWT.PUSH);
+ createCategoryArea(composite);
+ createDetailsArea(composite);
+ createButtons(composite);
+
+ Dialog.applyDialogFont(composite);
+
+ return composite;
+ }
+
+ /**
+ * @param composite
+ */
+ private void createPromptButton(Composite composite) {
+ activityPromptButton = new Button(composite, SWT.CHECK);
+ activityPromptButton
+ .setText(strings.getProperty(ACTIVITY_PROMPT_BUTTON, ActivityMessages.activityPromptButton));
+ activityPromptButton.setToolTipText(
+ strings.getProperty(ACTIVITY_PROMPT_BUTTON_TOOLTIP, ActivityMessages.activityPromptToolTip));
+ GridData data = new GridData();
+ data.horizontalSpan = 2;
+ activityPromptButton.setLayoutData(data);
+ activityPromptButton
+ .setSelection(getPreferenceStore().getBoolean(IPreferenceConstants.SHOULD_PROMPT_FOR_ENABLEMENT));
+ }
+
+ private void createButtons(final Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(4, false);
+ layout.marginHeight = layout.marginWidth = 0;
+ layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+ layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
+ composite.setLayout(layout);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 2;
+ composite.setLayoutData(data);
+
+ Button enableAll = new Button(composite, SWT.PUSH);
enableAll.addSelectionListener(
widgetSelectedAdapter(e -> workingCopy.setEnabledActivityIds(workingCopy.getDefinedActivityIds())));
- enableAll.setText(ActivityMessages.ActivityEnabler_selectAll);
- setButtonLayoutData(enableAll);
+ enableAll.setText(ActivityMessages.ActivityEnabler_selectAll);
+ setButtonLayoutData(enableAll);
- Button disableAll = new Button(composite, SWT.PUSH);
+ Button disableAll = new Button(composite, SWT.PUSH);
disableAll.addSelectionListener(
widgetSelectedAdapter(e -> workingCopy.setEnabledActivityIds(Collections.emptySet())));
- disableAll.setText(ActivityMessages.ActivityEnabler_deselectAll);
- setButtonLayoutData(disableAll);
-
- }
-
- /**
- * @param parent
- */
- private void createDetailsArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = layout.marginWidth = 0;
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- new Label(composite, SWT.NONE).setText(ActivityMessages.ActivityEnabler_description);
- descriptionText = new Text(composite, SWT.WRAP | SWT.READ_ONLY | SWT.BORDER);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.heightHint = 100;
- data.widthHint = 200;
- descriptionText.setLayoutData(data);
-
- new Label(composite, SWT.NONE).setText(ActivityMessages.ActivitiesPreferencePage_requirements);
- dependantViewer = new TableViewer(composite, SWT.BORDER);
- dependantViewer.getControl().setLayoutData(
- new GridData(GridData.FILL_BOTH));
- dependantViewer.setContentProvider(new CategoryContentProvider());
- dependantViewer.addFilter(new EmptyCategoryFilter());
- dependantViewer.setLabelProvider(new CategoryLabelProvider(false));
- dependantViewer.setInput(Collections.EMPTY_SET);
- }
-
- /**
- * @param parent
- */
- private void createCategoryArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = layout.marginWidth = 0;
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- composite.setLayout(layout);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.widthHint = 200;
- composite.setLayoutData(data);
- Label label = new Label(composite, SWT.NONE);
- label.setText(strings.getProperty(CATEGORY_NAME, ActivityMessages.ActivityEnabler_categories));
- Table table = new Table(composite, SWT.CHECK | SWT.BORDER | SWT.SINGLE);
- table.addSelectionListener(widgetSelectedAdapter(e -> {
- if (e.detail == SWT.CHECK) {
- TableItem tableItem = (TableItem) e.item;
-
- ICategory category = (ICategory) tableItem.getData();
- if (isLocked(category)) {
- tableItem.setChecked(true);
- e.doit = false; // veto the check
- return;
- }
+ disableAll.setText(ActivityMessages.ActivityEnabler_deselectAll);
+ setButtonLayoutData(disableAll);
+
+ }
+
+ /**
+ * @param parent
+ */
+ private void createDetailsArea(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = layout.marginWidth = 0;
+ layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+ layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ new Label(composite, SWT.NONE).setText(ActivityMessages.ActivityEnabler_description);
+ descriptionText = new Text(composite, SWT.WRAP | SWT.READ_ONLY | SWT.BORDER);
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.heightHint = 100;
+ data.widthHint = 200;
+ descriptionText.setLayoutData(data);
+
+ new Label(composite, SWT.NONE).setText(ActivityMessages.ActivitiesPreferencePage_requirements);
+ dependantViewer = new TableViewer(composite, SWT.BORDER);
+ dependantViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
+ dependantViewer.setContentProvider(new CategoryContentProvider());
+ dependantViewer.addFilter(new EmptyCategoryFilter());
+ dependantViewer.setLabelProvider(new CategoryLabelProvider(false));
+ dependantViewer.setInput(Collections.EMPTY_SET);
+ }
+
+ /**
+ * @param parent
+ */
+ private void createCategoryArea(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = layout.marginWidth = 0;
+ layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+ layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
+ composite.setLayout(layout);
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.widthHint = 200;
+ composite.setLayoutData(data);
+ Label label = new Label(composite, SWT.NONE);
+ label.setText(strings.getProperty(CATEGORY_NAME, ActivityMessages.ActivityEnabler_categories));
+ Table table = new Table(composite, SWT.CHECK | SWT.BORDER | SWT.SINGLE);
+ table.addSelectionListener(widgetSelectedAdapter(e -> {
+ if (e.detail == SWT.CHECK) {
+ TableItem tableItem = (TableItem) e.item;
+
+ ICategory category = (ICategory) tableItem.getData();
+ if (isLocked(category)) {
+ tableItem.setChecked(true);
+ e.doit = false; // veto the check
+ return;
+ }
Set<String> activitySet = WorkbenchActivityHelper.getActivityIdsForCategory(category);
- if (tableItem.getChecked()) {
- activitySet.addAll(workingCopy.getEnabledActivityIds());
- } else {
+ if (tableItem.getChecked()) {
+ activitySet.addAll(workingCopy.getEnabledActivityIds());
+ } else {
HashSet<String> newSet = new HashSet<>(workingCopy.getEnabledActivityIds());
- newSet.removeAll(activitySet);
- activitySet = newSet;
- }
-
- workingCopy.setEnabledActivityIds(activitySet);
- updateCategoryCheckState(); // even though we're reacting to
- // a check change we may need to
- // refresh a greying change.
- // Just process the whole thing.
- }
- }));
- categoryViewer = new CheckboxTableViewer(table);
+ newSet.removeAll(activitySet);
+ activitySet = newSet;
+ }
+
+ workingCopy.setEnabledActivityIds(activitySet);
+ updateCategoryCheckState(); // even though we're reacting to
+ // a check change we may need to
+ // refresh a greying change.
+ // Just process the whole thing.
+ }
+ }));
+ categoryViewer = new CheckboxTableViewer(table);
categoryViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
- categoryViewer.setContentProvider(new CategoryContentProvider());
- CategoryLabelProvider categoryLabelProvider = new CategoryLabelProvider(true);
- workingCopy.addActivityManagerListener(categoryLabelProvider);
- categoryViewer.setLabelProvider(categoryLabelProvider);
- categoryViewer.setComparator(new ViewerComparator());
- categoryViewer.addFilter(new EmptyCategoryFilter());
+ categoryViewer.setContentProvider(new CategoryContentProvider());
+ CategoryLabelProvider categoryLabelProvider = new CategoryLabelProvider(true);
+ workingCopy.addActivityManagerListener(categoryLabelProvider);
+ categoryViewer.setLabelProvider(categoryLabelProvider);
+ categoryViewer.setComparator(new ViewerComparator());
+ categoryViewer.addFilter(new EmptyCategoryFilter());
categoryViewer.addSelectionChangedListener(event -> {
ICategory element = (ICategory) event.getStructuredSelection().getFirstElement();
setDetails(element);
});
- categoryViewer.setInput(workingCopy.getDefinedCategoryIds());
+ categoryViewer.setInput(workingCopy.getDefinedCategoryIds());
updateCategoryCheckState();
- }
+ }
/**
* Updates the check and grey state of the categories in the category viewer.
@@ -419,18 +409,17 @@ public final class ActivityCategoryPreferencePage extends PreferencePage impleme
private void updateCategoryCheckState() {
ICategory[] enabledCategories = getEnabledCategories();
ICategory[] partiallyEnabledCategories = getPartialCategories();
- Object[] allChecked = new Object[enabledCategories.length
- + partiallyEnabledCategories.length];
+ Object[] allChecked = new Object[enabledCategories.length + partiallyEnabledCategories.length];
System.arraycopy(enabledCategories, 0, allChecked, 0, enabledCategories.length);
- System.arraycopy(partiallyEnabledCategories, 0, allChecked, enabledCategories.length, partiallyEnabledCategories.length);
+ System.arraycopy(partiallyEnabledCategories, 0, allChecked, enabledCategories.length,
+ partiallyEnabledCategories.length);
categoryViewer.setCheckedElements(allChecked);
categoryViewer.setGrayedElements(partiallyEnabledCategories);
}
- private ICategory[] getPartialCategories() {
+ private ICategory[] getPartialCategories() {
return WorkbenchActivityHelper.resolveCategories(workingCopy,
- InternalActivityHelper
- .getPartiallyEnabledCategories(workingCopy));
+ InternalActivityHelper.getPartiallyEnabledCategories(workingCopy));
}
private ICategory[] getEnabledCategories() {
@@ -438,78 +427,70 @@ public final class ActivityCategoryPreferencePage extends PreferencePage impleme
InternalActivityHelper.getEnabledCategories(workingCopy));
}
- protected void setDetails(ICategory category) {
- if (category == null) {
- clearDetails();
- return;
- }
+ protected void setDetails(ICategory category) {
+ if (category == null) {
+ clearDetails();
+ return;
+ }
Set<String> categories = null;
- if (WorkbenchActivityHelper.isEnabled(workingCopy, category.getId())) {
- categories = WorkbenchActivityHelper.getDisabledCategories(
- workingCopy, category.getId());
-
- } else {
- categories = WorkbenchActivityHelper.getEnabledCategories(
- workingCopy, category.getId());
- }
-
- categories = WorkbenchActivityHelper.getContainedCategories(
- workingCopy, category.getId());
- dependantViewer.setInput(categories);
- try {
- descriptionText.setText(category.getDescription());
- } catch (NotDefinedException e) {
- descriptionText.setText(""); //$NON-NLS-1$
- }
- }
-
- /**
- * Clear the details area.
- */
- protected void clearDetails() {
- dependantViewer.setInput(Collections.EMPTY_SET);
- descriptionText.setText(""); //$NON-NLS-1$
- }
+ if (WorkbenchActivityHelper.isEnabled(workingCopy, category.getId())) {
+ categories = WorkbenchActivityHelper.getDisabledCategories(workingCopy, category.getId());
+
+ } else {
+ categories = WorkbenchActivityHelper.getEnabledCategories(workingCopy, category.getId());
+ }
+
+ categories = WorkbenchActivityHelper.getContainedCategories(workingCopy, category.getId());
+ dependantViewer.setInput(categories);
+ try {
+ descriptionText.setText(category.getDescription());
+ } catch (NotDefinedException e) {
+ descriptionText.setText(""); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Clear the details area.
+ */
+ protected void clearDetails() {
+ dependantViewer.setInput(Collections.EMPTY_SET);
+ descriptionText.setText(""); //$NON-NLS-1$
+ }
+
+ @Override
+ public void init(IWorkbench workbench) {
+ this.workbench = workbench;
+ workingCopy = workbench.getActivitySupport().createWorkingCopy();
+ setPreferenceStore(WorkbenchPlugin.getDefault().getPreferenceStore());
+ }
+
+ /**
+ * Return whether the category is locked.
+ *
+ * @param category the category to test
+ * @return whether the category is locked
+ */
+ protected boolean isLocked(ICategory category) {
+ return !WorkbenchActivityHelper.getDisabledCategories(workingCopy, category.getId()).isEmpty();
+ }
@Override
- public void init(IWorkbench workbench) {
- this.workbench = workbench;
- workingCopy = workbench.getActivitySupport().createWorkingCopy();
- setPreferenceStore(WorkbenchPlugin.getDefault().getPreferenceStore());
- }
-
- /**
- * Return whether the category is locked.
- *
- * @param category
- * the category to test
- * @return whether the category is locked
- */
- protected boolean isLocked(ICategory category) {
- return !WorkbenchActivityHelper.getDisabledCategories(workingCopy,
- category.getId()).isEmpty();
- }
-
- @Override
public boolean performOk() {
if (allowAdvanced) {
enabler.updateActivityStates();
}
- workbench.getActivitySupport().setEnabledActivityIds(
- workingCopy.getEnabledActivityIds());
- getPreferenceStore().setValue(
- IPreferenceConstants.SHOULD_PROMPT_FOR_ENABLEMENT,
- activityPromptButton.getSelection());
- return true;
- }
+ workbench.getActivitySupport().setEnabledActivityIds(workingCopy.getEnabledActivityIds());
+ getPreferenceStore().setValue(IPreferenceConstants.SHOULD_PROMPT_FOR_ENABLEMENT,
+ activityPromptButton.getSelection());
+ return true;
+ }
- @Override
+ @Override
protected void performDefaults() {
- super.performDefaults();
- activityPromptButton.setSelection(getPreferenceStore()
- .getDefaultBoolean(
- IPreferenceConstants.SHOULD_PROMPT_FOR_ENABLEMENT));
+ super.performDefaults();
+ activityPromptButton.setSelection(
+ getPreferenceStore().getDefaultBoolean(IPreferenceConstants.SHOULD_PROMPT_FOR_ENABLEMENT));
if (allowAdvanced) {
enabler.restoreDefaults();
return;
@@ -518,34 +499,33 @@ public final class ActivityCategoryPreferencePage extends PreferencePage impleme
Set<String> defaultEnabled = new HashSet<>();
Set<String> activityIds = workingCopy.getDefinedActivityIds();
for (String activityId : activityIds) {
- IActivity activity = workingCopy.getActivity(activityId);
- try {
- if (activity.isDefaultEnabled()) {
- defaultEnabled.add(activityId);
- }
- } catch (NotDefinedException e) {
- // this can't happen - we're iterating over defined activities.
- }
- }
-
- workingCopy.setEnabledActivityIds(defaultEnabled);
- }
+ IActivity activity = workingCopy.getActivity(activityId);
+ try {
+ if (activity.isDefaultEnabled()) {
+ defaultEnabled.add(activityId);
+ }
+ } catch (NotDefinedException e) {
+ // this can't happen - we're iterating over defined activities.
+ }
+ }
+
+ workingCopy.setEnabledActivityIds(defaultEnabled);
+ }
@Override
- public void setInitializationData(IConfigurationElement config,
- String propertyName, Object data) {
- if (data instanceof Hashtable) {
+ public void setInitializationData(IConfigurationElement config, String propertyName, Object data) {
+ if (data instanceof Hashtable) {
Hashtable<?, ?> table = (Hashtable<?, ?>) data;
- allowAdvanced = Boolean.parseBoolean((String) table.remove(ALLOW_ADVANCED));
- strings.putAll(table);
- }
- }
+ allowAdvanced = Boolean.parseBoolean((String) table.remove(ALLOW_ADVANCED));
+ strings.putAll(table);
+ }
+ }
- @Override
+ @Override
public void dispose() {
if ((workingCopy != null) && (!allowAdvanced)) {
- workingCopy.removeActivityManagerListener((CategoryLabelProvider) categoryViewer.getLabelProvider());
- }
- super.dispose();
- }
+ workingCopy.removeActivityManagerListener((CategoryLabelProvider) categoryViewer.getLabelProvider());
+ }
+ super.dispose();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ActivityEvent.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ActivityEvent.java
index bd1405b6c70..61fd8ef5e2e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ActivityEvent.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ActivityEvent.java
@@ -16,9 +16,8 @@ package org.eclipse.ui.activities;
/**
* An instance of this class describes changes to an instance of
- * <code>IActivity</code>. This class does not give details as to the
- * specifics of a change, only that the given property on the source object has
- * changed.
+ * <code>IActivity</code>. This class does not give details as to the specifics
+ * of a change, only that the given property on the source object has changed.
* <p>
* This class is not intended to be extended by clients.
* </p>
@@ -27,172 +26,163 @@ package org.eclipse.ui.activities;
* @see IActivityListener#activityChanged(ActivityEvent)
*/
public final class ActivityEvent {
- private IActivity activity;
-
- private boolean activityRequirementBindingsChanged;
-
- private boolean activityPatternBindingsChanged;
-
- private boolean definedChanged;
-
- private boolean enabledChanged;
-
- private boolean defaultEnabledChanged;
-
- private boolean nameChanged;
-
- private boolean descriptionChanged;
-
- /**
- * Creates a new instance of this class. Since 3.1 this method will assume
- * that the default enabled state has not changed.
- *
- * @param activity
- * the instance of the interface that changed.
- * @param activityRequirementBindingsChanged
- * <code>true</code>, iff the activityRequirementBindings
- * property changed.
- * @param activityPatternBindingsChanged
- * <code>true</code>, iff the activityPatternBindings property
- * changed.
- * @param definedChanged
- * <code>true</code>, iff the defined property changed.
- * @param descriptionChanged
- * <code>true</code>, iff the description property changed.
- * @param enabledChanged
- * <code>true</code>, iff the enabled property changed.
- * @param nameChanged
- * <code>true</code>, iff the name property changed.
- */
- public ActivityEvent(IActivity activity,
- boolean activityRequirementBindingsChanged,
- boolean activityPatternBindingsChanged, boolean definedChanged,
- boolean descriptionChanged, boolean enabledChanged,
- boolean nameChanged) {
-
- this(activity,
- activityRequirementBindingsChanged,
- activityPatternBindingsChanged,
- definedChanged,
- descriptionChanged,
- enabledChanged,
- nameChanged,
- false);
- }
-
- /**
- * Creates a new instance of this class.
- *
- * @param activity
- * the instance of the interface that changed.
- * @param activityRequirementBindingsChanged
- * <code>true</code>, iff the activityRequirementBindings property changed.
- * @param activityPatternBindingsChanged
- * <code>true</code>, iff the activityPatternBindings property changed.
- * @param definedChanged
- * <code>true</code>, iff the defined property changed.
- * @param descriptionChanged
- * <code>true</code>, iff the description property changed.
- * @param enabledChanged
- * <code>true</code>, iff the enabled property changed.
- * @param nameChanged
- * <code>true</code>, iff the name property changed.
- * @param defaultEnabledChanged
- * <code>true</code>, iff the default enabled property changed.
- * @since 3.1
- */
- public ActivityEvent(IActivity activity,
- boolean activityRequirementBindingsChanged,
- boolean activityPatternBindingsChanged, boolean definedChanged,
- boolean descriptionChanged, boolean enabledChanged,
- boolean nameChanged,
- boolean defaultEnabledChanged) {
- if (activity == null) {
+ private IActivity activity;
+
+ private boolean activityRequirementBindingsChanged;
+
+ private boolean activityPatternBindingsChanged;
+
+ private boolean definedChanged;
+
+ private boolean enabledChanged;
+
+ private boolean defaultEnabledChanged;
+
+ private boolean nameChanged;
+
+ private boolean descriptionChanged;
+
+ /**
+ * Creates a new instance of this class. Since 3.1 this method will assume that
+ * the default enabled state has not changed.
+ *
+ * @param activity the instance of the interface that
+ * changed.
+ * @param activityRequirementBindingsChanged <code>true</code>, iff the
+ * activityRequirementBindings
+ * property changed.
+ * @param activityPatternBindingsChanged <code>true</code>, iff the
+ * activityPatternBindings property
+ * changed.
+ * @param definedChanged <code>true</code>, iff the defined
+ * property changed.
+ * @param descriptionChanged <code>true</code>, iff the
+ * description property changed.
+ * @param enabledChanged <code>true</code>, iff the enabled
+ * property changed.
+ * @param nameChanged <code>true</code>, iff the name
+ * property changed.
+ */
+ public ActivityEvent(IActivity activity, boolean activityRequirementBindingsChanged,
+ boolean activityPatternBindingsChanged, boolean definedChanged, boolean descriptionChanged,
+ boolean enabledChanged, boolean nameChanged) {
+
+ this(activity, activityRequirementBindingsChanged, activityPatternBindingsChanged, definedChanged,
+ descriptionChanged, enabledChanged, nameChanged, false);
+ }
+
+ /**
+ * Creates a new instance of this class.
+ *
+ * @param activity the instance of the interface that
+ * changed.
+ * @param activityRequirementBindingsChanged <code>true</code>, iff the
+ * activityRequirementBindings
+ * property changed.
+ * @param activityPatternBindingsChanged <code>true</code>, iff the
+ * activityPatternBindings property
+ * changed.
+ * @param definedChanged <code>true</code>, iff the defined
+ * property changed.
+ * @param descriptionChanged <code>true</code>, iff the
+ * description property changed.
+ * @param enabledChanged <code>true</code>, iff the enabled
+ * property changed.
+ * @param nameChanged <code>true</code>, iff the name
+ * property changed.
+ * @param defaultEnabledChanged <code>true</code>, iff the default
+ * enabled property changed.
+ * @since 3.1
+ */
+ public ActivityEvent(IActivity activity, boolean activityRequirementBindingsChanged,
+ boolean activityPatternBindingsChanged, boolean definedChanged, boolean descriptionChanged,
+ boolean enabledChanged, boolean nameChanged, boolean defaultEnabledChanged) {
+ if (activity == null) {
throw new NullPointerException();
}
- this.activity = activity;
- this.activityRequirementBindingsChanged = activityRequirementBindingsChanged;
- this.activityPatternBindingsChanged = activityPatternBindingsChanged;
- this.definedChanged = definedChanged;
- this.enabledChanged = enabledChanged;
- this.nameChanged = nameChanged;
- this.descriptionChanged = descriptionChanged;
- this.defaultEnabledChanged = defaultEnabledChanged;
- }
-
-
- /**
- * Returns the instance of the interface that changed.
- *
- * @return the instance of the interface that changed. Guaranteed not to be
- * <code>null</code>.
- */
- public IActivity getActivity() {
- return activity;
- }
-
- /**
- * Returns whether or not the defined property changed.
- *
- * @return <code>true</code>, iff the defined property changed.
- */
- public boolean hasDefinedChanged() {
- return definedChanged;
- }
-
- /**
- * Returns whether or not the enabled property changed.
- *
- * @return <code>true</code>, iff the enabled property changed.
- */
- public boolean hasEnabledChanged() {
- return enabledChanged;
- }
-
- /**
- * Returns whether or not the default enabled property changed.
- *
- * @return <code>true</code>, iff the default enabled property changed.
- * @since 3.1
- */
- public boolean hasDefaultEnabledChanged() {
- return defaultEnabledChanged;
- }
-
- /**
- * Returns whether or not the name property changed.
- *
- * @return <code>true</code>, iff the name property changed.
- */
- public boolean hasNameChanged() {
- return nameChanged;
- }
-
- /**
- * Returns whether or not the description property changed.
- *
- * @return <code>true</code>, iff the description property changed.
- */
- public boolean hasDescriptionChanged() {
- return descriptionChanged;
- }
-
- /**
- * Returns whether or not the activityRequirementBindings property changed.
- *
- * @return <code>true</code>, iff the activityRequirementBindings property changed.
- */
- public boolean haveActivityRequirementBindingsChanged() {
- return activityRequirementBindingsChanged;
- }
-
- /**
- * Returns whether or not the activityPatternBindings property changed.
- *
- * @return <code>true</code>, iff the activityPatternBindings property changed.
- */
- public boolean haveActivityPatternBindingsChanged() {
- return activityPatternBindingsChanged;
- }
+ this.activity = activity;
+ this.activityRequirementBindingsChanged = activityRequirementBindingsChanged;
+ this.activityPatternBindingsChanged = activityPatternBindingsChanged;
+ this.definedChanged = definedChanged;
+ this.enabledChanged = enabledChanged;
+ this.nameChanged = nameChanged;
+ this.descriptionChanged = descriptionChanged;
+ this.defaultEnabledChanged = defaultEnabledChanged;
+ }
+
+ /**
+ * Returns the instance of the interface that changed.
+ *
+ * @return the instance of the interface that changed. Guaranteed not to be
+ * <code>null</code>.
+ */
+ public IActivity getActivity() {
+ return activity;
+ }
+
+ /**
+ * Returns whether or not the defined property changed.
+ *
+ * @return <code>true</code>, iff the defined property changed.
+ */
+ public boolean hasDefinedChanged() {
+ return definedChanged;
+ }
+
+ /**
+ * Returns whether or not the enabled property changed.
+ *
+ * @return <code>true</code>, iff the enabled property changed.
+ */
+ public boolean hasEnabledChanged() {
+ return enabledChanged;
+ }
+
+ /**
+ * Returns whether or not the default enabled property changed.
+ *
+ * @return <code>true</code>, iff the default enabled property changed.
+ * @since 3.1
+ */
+ public boolean hasDefaultEnabledChanged() {
+ return defaultEnabledChanged;
+ }
+
+ /**
+ * Returns whether or not the name property changed.
+ *
+ * @return <code>true</code>, iff the name property changed.
+ */
+ public boolean hasNameChanged() {
+ return nameChanged;
+ }
+
+ /**
+ * Returns whether or not the description property changed.
+ *
+ * @return <code>true</code>, iff the description property changed.
+ */
+ public boolean hasDescriptionChanged() {
+ return descriptionChanged;
+ }
+
+ /**
+ * Returns whether or not the activityRequirementBindings property changed.
+ *
+ * @return <code>true</code>, iff the activityRequirementBindings property
+ * changed.
+ */
+ public boolean haveActivityRequirementBindingsChanged() {
+ return activityRequirementBindingsChanged;
+ }
+
+ /**
+ * Returns whether or not the activityPatternBindings property changed.
+ *
+ * @return <code>true</code>, iff the activityPatternBindings property changed.
+ */
+ public boolean haveActivityPatternBindingsChanged() {
+ return activityPatternBindingsChanged;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ActivityManagerEvent.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ActivityManagerEvent.java
index bd8c978ec08..92deb1f133d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ActivityManagerEvent.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ActivityManagerEvent.java
@@ -19,7 +19,7 @@ import org.eclipse.ui.internal.util.Util;
/**
* An instance of this class describes changes to an instance of
- * <code>IActivityManager</code>. This class does not give details as to the
+ * <code>IActivityManager</code>. This class does not give details as to the
* specifics of a change, only that the given property on the source object has
* changed.
*
@@ -31,187 +31,187 @@ import org.eclipse.ui.internal.util.Util;
* @see IActivityManagerListener#activityManagerChanged(ActivityManagerEvent)
*/
public final class ActivityManagerEvent {
- private IActivityManager activityManager;
+ private IActivityManager activityManager;
- private boolean definedActivityIdsChanged;
+ private boolean definedActivityIdsChanged;
- private boolean definedCategoryIdsChanged;
+ private boolean definedCategoryIdsChanged;
- private boolean enabledActivityIdsChanged;
+ private boolean enabledActivityIdsChanged;
- /**
- * The set of activity identifiers (strings) that were defined before the
- * change occurred. If the defined activities did not changed, then this
- * value is <code>null</code>.
- */
+ /**
+ * The set of activity identifiers (strings) that were defined before the change
+ * occurred. If the defined activities did not changed, then this value is
+ * <code>null</code>.
+ */
private final Set<String> previouslyDefinedActivityIds;
- /**
- * The set of category identifiers (strings) that were defined before the
- * change occurred. If the defined category did not changed, then this value
- * is <code>null</code>.
- */
+ /**
+ * The set of category identifiers (strings) that were defined before the change
+ * occurred. If the defined category did not changed, then this value is
+ * <code>null</code>.
+ */
private final Set<String> previouslyDefinedCategoryIds;
- /**
- * The set of activity identifiers (strings) that were enabled before the
- * change occurred. If the enabled activities did not changed, then this
- * value is <code>null</code>.
- */
+ /**
+ * The set of activity identifiers (strings) that were enabled before the change
+ * occurred. If the enabled activities did not changed, then this value is
+ * <code>null</code>.
+ */
private final Set<String> previouslyEnabledActivityIds;
- /**
- * Creates a new instance of this class.
- *
- * @param activityManager
- * the instance of the interface that changed.
- * @param definedActivityIdsChanged
- * <code>true</code>, iff the definedActivityIds property
- * changed.
- * @param definedCategoryIdsChanged
- * <code>true</code>, iff the definedCategoryIds property
- * changed.
- * @param enabledActivityIdsChanged
- * <code>true</code>, iff the enabledActivityIds property
- * changed.
- * @param previouslyDefinedActivityIds
- * the set of identifiers to previously defined activities. This
- * set may be empty. If this set is not empty, it must only
- * contain instances of <code>String</code>. This set must be
- * <code>null</code> if definedActivityIdsChanged is
- * <code>false</code> and must not be null if
- * definedActivityIdsChanged is <code>true</code>.
- * @param previouslyDefinedCategoryIds
- * the set of identifiers to previously defined category. This
- * set may be empty. If this set is not empty, it must only
- * contain instances of <code>String</code>. This set must be
- * <code>null</code> if definedCategoryIdsChanged is
- * <code>false</code> and must not be null if
- * definedCategoryIdsChanged is <code>true</code>.
- * @param previouslyEnabledActivityIds
- * the set of identifiers to previously enabled activities. This
- * set may be empty. If this set is not empty, it must only
- * contain instances of <code>String</code>. This set must be
- * <code>null</code> if enabledActivityIdsChanged is
- * <code>false</code> and must not be null if
- * enabledActivityIdsChanged is <code>true</code>.
- */
- public ActivityManagerEvent(IActivityManager activityManager,
- boolean definedActivityIdsChanged,
- boolean definedCategoryIdsChanged,
- boolean enabledActivityIdsChanged,
+ /**
+ * Creates a new instance of this class.
+ *
+ * @param activityManager the instance of the interface that
+ * changed.
+ * @param definedActivityIdsChanged <code>true</code>, iff the
+ * definedActivityIds property changed.
+ * @param definedCategoryIdsChanged <code>true</code>, iff the
+ * definedCategoryIds property changed.
+ * @param enabledActivityIdsChanged <code>true</code>, iff the
+ * enabledActivityIds property changed.
+ * @param previouslyDefinedActivityIds the set of identifiers to previously
+ * defined activities. This set may be
+ * empty. If this set is not empty, it must
+ * only contain instances of
+ * <code>String</code>. This set must be
+ * <code>null</code> if
+ * definedActivityIdsChanged is
+ * <code>false</code> and must not be null
+ * if definedActivityIdsChanged is
+ * <code>true</code>.
+ * @param previouslyDefinedCategoryIds the set of identifiers to previously
+ * defined category. This set may be empty.
+ * If this set is not empty, it must only
+ * contain instances of <code>String</code>.
+ * This set must be <code>null</code> if
+ * definedCategoryIdsChanged is
+ * <code>false</code> and must not be null
+ * if definedCategoryIdsChanged is
+ * <code>true</code>.
+ * @param previouslyEnabledActivityIds the set of identifiers to previously
+ * enabled activities. This set may be
+ * empty. If this set is not empty, it must
+ * only contain instances of
+ * <code>String</code>. This set must be
+ * <code>null</code> if
+ * enabledActivityIdsChanged is
+ * <code>false</code> and must not be null
+ * if enabledActivityIdsChanged is
+ * <code>true</code>.
+ */
+ public ActivityManagerEvent(IActivityManager activityManager, boolean definedActivityIdsChanged,
+ boolean definedCategoryIdsChanged, boolean enabledActivityIdsChanged,
final Set<String> previouslyDefinedActivityIds, final Set<String> previouslyDefinedCategoryIds,
final Set<String> previouslyEnabledActivityIds) {
- if (activityManager == null) {
+ if (activityManager == null) {
throw new NullPointerException();
}
- if (!definedActivityIdsChanged && previouslyDefinedActivityIds != null) {
+ if (!definedActivityIdsChanged && previouslyDefinedActivityIds != null) {
throw new IllegalArgumentException();
}
- if (!definedCategoryIdsChanged && previouslyDefinedCategoryIds != null) {
+ if (!definedCategoryIdsChanged && previouslyDefinedCategoryIds != null) {
throw new IllegalArgumentException();
}
- if (!enabledActivityIdsChanged && previouslyEnabledActivityIds != null) {
+ if (!enabledActivityIdsChanged && previouslyEnabledActivityIds != null) {
throw new IllegalArgumentException();
}
- if (definedActivityIdsChanged) {
- this.previouslyDefinedActivityIds = Util.safeCopy(
- previouslyDefinedActivityIds, String.class);
- } else {
- this.previouslyDefinedActivityIds = null;
- }
-
- if (definedCategoryIdsChanged) {
- this.previouslyDefinedCategoryIds = Util.safeCopy(
- previouslyDefinedCategoryIds, String.class);
- } else {
- this.previouslyDefinedCategoryIds = null;
- }
-
- if (enabledActivityIdsChanged) {
- this.previouslyEnabledActivityIds = Util.safeCopy(
- previouslyEnabledActivityIds, String.class);
- } else {
- this.previouslyEnabledActivityIds = null;
- }
-
- this.activityManager = activityManager;
- this.definedActivityIdsChanged = definedActivityIdsChanged;
- this.definedCategoryIdsChanged = definedCategoryIdsChanged;
- this.enabledActivityIdsChanged = enabledActivityIdsChanged;
- }
-
- /**
- * Returns the instance of the interface that changed.
- *
- * @return the instance of the interface that changed. Guaranteed not to be
- * <code>null</code>.
- */
- public IActivityManager getActivityManager() {
- return activityManager;
- }
-
- /**
- * Returns the activity identifiers that were previously defined.
- *
- * @return The set of defined activity identifiers before the changed; may
- * be empty, but never <code>null</code>. This set will only
- * contain strings.
- */
+ if (definedActivityIdsChanged) {
+ this.previouslyDefinedActivityIds = Util.safeCopy(previouslyDefinedActivityIds, String.class);
+ } else {
+ this.previouslyDefinedActivityIds = null;
+ }
+
+ if (definedCategoryIdsChanged) {
+ this.previouslyDefinedCategoryIds = Util.safeCopy(previouslyDefinedCategoryIds, String.class);
+ } else {
+ this.previouslyDefinedCategoryIds = null;
+ }
+
+ if (enabledActivityIdsChanged) {
+ this.previouslyEnabledActivityIds = Util.safeCopy(previouslyEnabledActivityIds, String.class);
+ } else {
+ this.previouslyEnabledActivityIds = null;
+ }
+
+ this.activityManager = activityManager;
+ this.definedActivityIdsChanged = definedActivityIdsChanged;
+ this.definedCategoryIdsChanged = definedCategoryIdsChanged;
+ this.enabledActivityIdsChanged = enabledActivityIdsChanged;
+ }
+
+ /**
+ * Returns the instance of the interface that changed.
+ *
+ * @return the instance of the interface that changed. Guaranteed not to be
+ * <code>null</code>.
+ */
+ public IActivityManager getActivityManager() {
+ return activityManager;
+ }
+
+ /**
+ * Returns the activity identifiers that were previously defined.
+ *
+ * @return The set of defined activity identifiers before the changed; may be
+ * empty, but never <code>null</code>. This set will only contain
+ * strings.
+ */
public Set<String> getPreviouslyDefinedActivityIds() {
- return previouslyDefinedActivityIds;
- }
-
- /**
- * Returns the category identifiers that were previously defined.
- *
- * @return The set of defined category identifiers before the changed; may
- * be empty, but never <code>null</code>. This set will only
- * contain strings.
- */
+ return previouslyDefinedActivityIds;
+ }
+
+ /**
+ * Returns the category identifiers that were previously defined.
+ *
+ * @return The set of defined category identifiers before the changed; may be
+ * empty, but never <code>null</code>. This set will only contain
+ * strings.
+ */
public Set<String> getPreviouslyDefinedCategoryIds() {
- return previouslyDefinedCategoryIds;
- }
-
- /**
- * Returns the activity identifiers that were previously enabled.
- *
- * @return The set of enabled activity identifiers before the changed; may
- * be empty, but never <code>null</code>. This set will only
- * contain strings.
- */
+ return previouslyDefinedCategoryIds;
+ }
+
+ /**
+ * Returns the activity identifiers that were previously enabled.
+ *
+ * @return The set of enabled activity identifiers before the changed; may be
+ * empty, but never <code>null</code>. This set will only contain
+ * strings.
+ */
public Set<String> getPreviouslyEnabledActivityIds() {
- return previouslyEnabledActivityIds;
- }
-
- /**
- * Returns whether or not the definedActivityIds property changed.
- *
- * @return <code>true</code>, iff the definedActivityIds property changed.
- */
- public boolean haveDefinedActivityIdsChanged() {
- return definedActivityIdsChanged;
- }
-
- /**
- * Returns whether or not the definedCategoryIds property changed.
- *
- * @return <code>true</code>, iff the definedCategoryIds property changed.
- */
- public boolean haveDefinedCategoryIdsChanged() {
- return definedCategoryIdsChanged;
- }
-
- /**
- * Returns whether or not the enabledActivityIds property changed.
- *
- * @return <code>true</code>, iff the enabledActivityIds property changed.
- */
- public boolean haveEnabledActivityIdsChanged() {
- return enabledActivityIdsChanged;
- }
+ return previouslyEnabledActivityIds;
+ }
+
+ /**
+ * Returns whether or not the definedActivityIds property changed.
+ *
+ * @return <code>true</code>, iff the definedActivityIds property changed.
+ */
+ public boolean haveDefinedActivityIdsChanged() {
+ return definedActivityIdsChanged;
+ }
+
+ /**
+ * Returns whether or not the definedCategoryIds property changed.
+ *
+ * @return <code>true</code>, iff the definedCategoryIds property changed.
+ */
+ public boolean haveDefinedCategoryIdsChanged() {
+ return definedCategoryIdsChanged;
+ }
+
+ /**
+ * Returns whether or not the enabledActivityIds property changed.
+ *
+ * @return <code>true</code>, iff the enabledActivityIds property changed.
+ */
+ public boolean haveEnabledActivityIdsChanged() {
+ return enabledActivityIdsChanged;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/CategoryEvent.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/CategoryEvent.java
index 9feb869638d..255551e9027 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/CategoryEvent.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/CategoryEvent.java
@@ -16,9 +16,8 @@ package org.eclipse.ui.activities;
/**
* An instance of this class describes changes to an instance of
- * <code>ICategory</code>. This class does not give details as to the
- * specifics of a change, only that the given property on the source object has
- * changed.
+ * <code>ICategory</code>. This class does not give details as to the specifics
+ * of a change, only that the given property on the source object has changed.
*
* <p>
* This class is not intended to be extended by clients.
@@ -28,87 +27,87 @@ package org.eclipse.ui.activities;
* @see ICategoryListener#categoryChanged(CategoryEvent)
*/
public final class CategoryEvent {
- private ICategory category;
+ private ICategory category;
- private boolean categoryActivityBindingsChanged;
+ private boolean categoryActivityBindingsChanged;
- private boolean definedChanged;
+ private boolean definedChanged;
- private boolean nameChanged;
+ private boolean nameChanged;
- private boolean descriptionChanged;
+ private boolean descriptionChanged;
- /**
- * Creates a new instance of this class.
- *
- * @param category
- * the instance of the interface that changed.
- * @param categoryActivityBindingsChanged
- * <code>true</code>, iff the categoryActivityBindings property changed.
- * @param definedChanged
- * <code>true</code>, iff the defined property changed.
- * @param descriptionChanged
- * <code>true</code>, iff the description property changed.
- * @param nameChanged
- * <code>true</code>, iff the name property changed.
- */
- public CategoryEvent(ICategory category,
- boolean categoryActivityBindingsChanged, boolean definedChanged,
- boolean descriptionChanged, boolean nameChanged) {
- if (category == null) {
+ /**
+ * Creates a new instance of this class.
+ *
+ * @param category the instance of the interface that
+ * changed.
+ * @param categoryActivityBindingsChanged <code>true</code>, iff the
+ * categoryActivityBindings property
+ * changed.
+ * @param definedChanged <code>true</code>, iff the defined
+ * property changed.
+ * @param descriptionChanged <code>true</code>, iff the description
+ * property changed.
+ * @param nameChanged <code>true</code>, iff the name
+ * property changed.
+ */
+ public CategoryEvent(ICategory category, boolean categoryActivityBindingsChanged, boolean definedChanged,
+ boolean descriptionChanged, boolean nameChanged) {
+ if (category == null) {
throw new NullPointerException();
}
- this.category = category;
- this.categoryActivityBindingsChanged = categoryActivityBindingsChanged;
- this.definedChanged = definedChanged;
- this.nameChanged = nameChanged;
- this.descriptionChanged = descriptionChanged;
- }
+ this.category = category;
+ this.categoryActivityBindingsChanged = categoryActivityBindingsChanged;
+ this.definedChanged = definedChanged;
+ this.nameChanged = nameChanged;
+ this.descriptionChanged = descriptionChanged;
+ }
- /**
- * Returns the instance of the interface that changed.
- *
- * @return the instance of the interface that changed. Guaranteed not to be
- * <code>null</code>.
- */
- public ICategory getCategory() {
- return category;
- }
+ /**
+ * Returns the instance of the interface that changed.
+ *
+ * @return the instance of the interface that changed. Guaranteed not to be
+ * <code>null</code>.
+ */
+ public ICategory getCategory() {
+ return category;
+ }
- /**
- * Returns whether or not the defined property changed.
- *
- * @return <code>true</code>, iff the defined property changed.
- */
- public boolean hasDefinedChanged() {
- return definedChanged;
- }
+ /**
+ * Returns whether or not the defined property changed.
+ *
+ * @return <code>true</code>, iff the defined property changed.
+ */
+ public boolean hasDefinedChanged() {
+ return definedChanged;
+ }
- /**
- * Returns whether or not the name property changed.
- *
- * @return <code>true</code>, iff the name property changed.
- */
- public boolean hasNameChanged() {
- return nameChanged;
- }
+ /**
+ * Returns whether or not the name property changed.
+ *
+ * @return <code>true</code>, iff the name property changed.
+ */
+ public boolean hasNameChanged() {
+ return nameChanged;
+ }
- /**
- * Returns whether or not the description property changed.
- *
- * @return <code>true</code>, iff the description property changed.
- */
- public boolean hasDescriptionChanged() {
- return descriptionChanged;
- }
+ /**
+ * Returns whether or not the description property changed.
+ *
+ * @return <code>true</code>, iff the description property changed.
+ */
+ public boolean hasDescriptionChanged() {
+ return descriptionChanged;
+ }
- /**
- * Returns whether or not the categoryActivityBindings property changed.
- *
- * @return <code>true</code>, iff the categoryActivityBindings property changed.
- */
- public boolean haveCategoryActivityBindingsChanged() {
- return categoryActivityBindingsChanged;
- }
+ /**
+ * Returns whether or not the categoryActivityBindings property changed.
+ *
+ * @return <code>true</code>, iff the categoryActivityBindings property changed.
+ */
+ public boolean haveCategoryActivityBindingsChanged() {
+ return categoryActivityBindingsChanged;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IActivity.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IActivity.java
index 36f42e9562a..323edad5965 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IActivity.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IActivity.java
@@ -30,8 +30,8 @@ import org.eclipse.core.expressions.Expression;
* <p>
* The handle-based nature of this API allows it to work well with runtime
* plugin activation and deactivation, which can cause dynamic changes to the
- * extension registry. A client may get an <code>IActivity</code> handle that
- * is currently undefined ({@link #isDefined()} equals <code>false</code>) and
+ * extension registry. A client may get an <code>IActivity</code> handle that is
+ * currently undefined ({@link #isDefined()} equals <code>false</code>) and
* listen for it to become defined.
* </p>
*
@@ -45,134 +45,126 @@ import org.eclipse.core.expressions.Expression;
*/
public interface IActivity extends Comparable<IActivity> {
- /**
- * Registers an instance of <code>IActivityListener</code> to listen for
- * changes to properties of this instance.
- *
- * @param activityListener
- * the instance to register. Must not be <code>null</code>.
- * If an attempt is made to register an instance which is
- * already registered with this instance, no operation is
- * performed.
- */
- void addActivityListener(IActivityListener activityListener);
+ /**
+ * Registers an instance of <code>IActivityListener</code> to listen for changes
+ * to properties of this instance.
+ *
+ * @param activityListener the instance to register. Must not be
+ * <code>null</code>. If an attempt is made to register
+ * an instance which is already registered with this
+ * instance, no operation is performed.
+ */
+ void addActivityListener(IActivityListener activityListener);
- /**
- * Returns the set of activity requirement bindings for this instance.
- * <p>
- * This method will return all activity requirement bindings for this
- * instance, whether or not this instance is defined.
- * </p>
- * <p>
- * Notification is sent to all registered listeners if this property
- * changes.
- * </p>
- *
- * @return the set of activity requirement bindings. This set may be empty,
- * but is guaranteed not to be <code>null</code>. If this set is
- * not empty, it is guaranteed to only contain instances of
- * <code>IActivityRequirementBinding</code>.
- * @see IActivityRequirementBinding
- */
+ /**
+ * Returns the set of activity requirement bindings for this instance.
+ * <p>
+ * This method will return all activity requirement bindings for this instance,
+ * whether or not this instance is defined.
+ * </p>
+ * <p>
+ * Notification is sent to all registered listeners if this property changes.
+ * </p>
+ *
+ * @return the set of activity requirement bindings. This set may be empty, but
+ * is guaranteed not to be <code>null</code>. If this set is not empty,
+ * it is guaranteed to only contain instances of
+ * <code>IActivityRequirementBinding</code>.
+ * @see IActivityRequirementBinding
+ */
Set<IActivityRequirementBinding> getActivityRequirementBindings();
- /**
- * Returns the set of activity pattern bindings for this instance.
- * <p>
- * This method will return all activity pattern bindings for this instance,
- * whether or not this instance is defined.
- * </p>
- * <p>
- * Notification is sent to all registered listeners if this property
- * changes.
- * </p>
- *
- * @return the set of activity pattern bindings. This set may be empty, but
- * is guaranteed not to be <code>null</code>. If this set is not
- * empty, it is guaranteed to only contain instances of <code>IActivityPatternBinding</code>.
- * @see IActivityPatternBinding
- */
+ /**
+ * Returns the set of activity pattern bindings for this instance.
+ * <p>
+ * This method will return all activity pattern bindings for this instance,
+ * whether or not this instance is defined.
+ * </p>
+ * <p>
+ * Notification is sent to all registered listeners if this property changes.
+ * </p>
+ *
+ * @return the set of activity pattern bindings. This set may be empty, but is
+ * guaranteed not to be <code>null</code>. If this set is not empty, it
+ * is guaranteed to only contain instances of
+ * <code>IActivityPatternBinding</code>.
+ * @see IActivityPatternBinding
+ */
Set<IActivityPatternBinding> getActivityPatternBindings();
- /**
- * Returns the identifier of this instance.
- *
- * @return the identifier of this instance. Guaranteed not to be <code>null</code>.
- */
- String getId();
+ /**
+ * Returns the identifier of this instance.
+ *
+ * @return the identifier of this instance. Guaranteed not to be
+ * <code>null</code>.
+ */
+ String getId();
- /**
- * Returns the name of this instance suitable for display to the user.
- * <p>
- * Notification is sent to all registered listeners if this property
- * changes.
- * </p>
- *
- * @return the name of this instance. Guaranteed not to be <code>null</code>.
- * @throws NotDefinedException
- * if this instance is not defined.
- */
- String getName() throws NotDefinedException;
+ /**
+ * Returns the name of this instance suitable for display to the user.
+ * <p>
+ * Notification is sent to all registered listeners if this property changes.
+ * </p>
+ *
+ * @return the name of this instance. Guaranteed not to be <code>null</code>.
+ * @throws NotDefinedException if this instance is not defined.
+ */
+ String getName() throws NotDefinedException;
- /**
- * Returns the description of this instance suitable for display to the user.
- * <p>
- * Notification is sent to all registered listeners if this property
- * changes.
- * </p>
- *
- * @return the description of this instance. Guaranteed not to be <code>null</code>.
- * @throws NotDefinedException
- * if this instance is not defined.
- */
- String getDescription() throws NotDefinedException;
+ /**
+ * Returns the description of this instance suitable for display to the user.
+ * <p>
+ * Notification is sent to all registered listeners if this property changes.
+ * </p>
+ *
+ * @return the description of this instance. Guaranteed not to be
+ * <code>null</code>.
+ * @throws NotDefinedException if this instance is not defined.
+ */
+ String getDescription() throws NotDefinedException;
- /**
- * Returns whether or not this instance is defined. A defined activity
- * may have a name, description and bindings (both pattern and relational).
- * <p>
- * Notification is sent to all registered listeners if this property
- * changes.
- * </p>
- *
- * @return <code>true</code>, iff this instance is defined.
- */
- boolean isDefined();
+ /**
+ * Returns whether or not this instance is defined. A defined activity may have
+ * a name, description and bindings (both pattern and relational).
+ * <p>
+ * Notification is sent to all registered listeners if this property changes.
+ * </p>
+ *
+ * @return <code>true</code>, iff this instance is defined.
+ */
+ boolean isDefined();
- /**
- * Returns whether or not this instance is enabled.
- * <p>
- * Notification is sent to all registered listeners if this property
- * changes.
- * </p>
- *
- * @return <code>true</code>, iff this instance is enabled.
- */
- boolean isEnabled();
+ /**
+ * Returns whether or not this instance is enabled.
+ * <p>
+ * Notification is sent to all registered listeners if this property changes.
+ * </p>
+ *
+ * @return <code>true</code>, iff this instance is enabled.
+ */
+ boolean isEnabled();
- /**
- * Returns whether or not this instance should be enabled by default.
- *
- * @return <code>true</code>, iff this instance should be enabled by default.
- * @throws NotDefinedException
- * if this instance is not defined.
- * @since 3.1
- */
- boolean isDefaultEnabled() throws NotDefinedException;
+ /**
+ * Returns whether or not this instance should be enabled by default.
+ *
+ * @return <code>true</code>, iff this instance should be enabled by default.
+ * @throws NotDefinedException if this instance is not defined.
+ * @since 3.1
+ */
+ boolean isDefaultEnabled() throws NotDefinedException;
- /**
- * Removes an instance of <code>IActivityListener</code> listening
- * for changes to properties of this instance.
- *
- * @param activityListener
- * the instance to remove. Must not be <code>null</code>.
- * If an attempt is made to remove an instance which is not
- * already registered with this instance, no operation is
- * performed.
- */
- void removeActivityListener(IActivityListener activityListener);
+ /**
+ * Removes an instance of <code>IActivityListener</code> listening for changes
+ * to properties of this instance.
+ *
+ * @param activityListener the instance to remove. Must not be
+ * <code>null</code>. If an attempt is made to remove an
+ * instance which is not already registered with this
+ * instance, no operation is performed.
+ */
+ void removeActivityListener(IActivityListener activityListener);
- /**
+ /**
* Return an expression used to enable and disable this activity. If the
* expression is not <code>null</code>, this activity will be entirely
* controlled by the expression state.
@@ -180,5 +172,5 @@ public interface IActivity extends Comparable<IActivity> {
* @return The core expression, or <code>null</code>
* @since 3.4
*/
- Expression getExpression();
+ Expression getExpression();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IActivityListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IActivityListener.java
index f75a51f716c..14310b995e0 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IActivityListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IActivityListener.java
@@ -27,12 +27,13 @@ package org.eclipse.ui.activities;
*/
public interface IActivityListener {
- /**
- * Notifies that one or more properties of an instance of <code>IActivity</code>
- * have changed. Specific details are described in the <code>ActivityEvent</code>.
- *
- * @param activityEvent
- * the activity event. Guaranteed not to be <code>null</code>.
- */
- void activityChanged(ActivityEvent activityEvent);
+ /**
+ * Notifies that one or more properties of an instance of <code>IActivity</code>
+ * have changed. Specific details are described in the
+ * <code>ActivityEvent</code>.
+ *
+ * @param activityEvent the activity event. Guaranteed not to be
+ * <code>null</code>.
+ */
+ void activityChanged(ActivityEvent activityEvent);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IActivityManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IActivityManager.java
index b406f1d0841..1cf46d696e8 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IActivityManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IActivityManager.java
@@ -17,8 +17,8 @@ package org.eclipse.ui.activities;
import java.util.Set;
/**
- * An instance of this interface allows clients to manage activities, as
- * defined by the extension point <code>org.eclipse.ui.activities</code>.
+ * An instance of this interface allows clients to manage activities, as defined
+ * by the extension point <code>org.eclipse.ui.activities</code>.
* <p>
* This interface is not intended to be extended or implemented by clients.
* </p>
@@ -28,98 +28,90 @@ import java.util.Set;
*/
public interface IActivityManager {
- /**
- * Registers an instance of <code>IActivityManagerListener</code> to
- * listen for changes to properties of this instance.
- *
- * @param activityManagerListener
- * the instance to register. Must not be <code>null</code>.
- * If an attempt is made to register an instance which is
- * already registered with this instance, no operation is
- * performed.
- */
- void addActivityManagerListener(
- IActivityManagerListener activityManagerListener);
+ /**
+ * Registers an instance of <code>IActivityManagerListener</code> to listen for
+ * changes to properties of this instance.
+ *
+ * @param activityManagerListener the instance to register. Must not be
+ * <code>null</code>. If an attempt is made to
+ * register an instance which is already
+ * registered with this instance, no operation is
+ * performed.
+ */
+ void addActivityManagerListener(IActivityManagerListener activityManagerListener);
- /**
- * Returns an instance of <code>IActivity</code> given an identifier.
- *
- * @param activityId
- * an identifier. Must not be <code>null</code>
- * @return an instance of <code>IActivity</code>.
- */
- IActivity getActivity(String activityId);
+ /**
+ * Returns an instance of <code>IActivity</code> given an identifier.
+ *
+ * @param activityId an identifier. Must not be <code>null</code>
+ * @return an instance of <code>IActivity</code>.
+ */
+ IActivity getActivity(String activityId);
- /**
- * Returns an instance of <code>ICategory</code> given an identifier.
- *
- * @param categoryId
- * an identifier. Must not be <code>null</code>
- * @return an instance of <code>ICategory</code>.
- */
- ICategory getCategory(String categoryId);
+ /**
+ * Returns an instance of <code>ICategory</code> given an identifier.
+ *
+ * @param categoryId an identifier. Must not be <code>null</code>
+ * @return an instance of <code>ICategory</code>.
+ */
+ ICategory getCategory(String categoryId);
- /**
- * Returns the set of identifiers to defined activities.
- * <p>
- * Notification is sent to all registered listeners if this property
- * changes.
- * </p>
- *
- * @return the set of identifiers to defined activities. This set may be
- * empty, but is guaranteed not to be <code>null</code>. If this
- * set is not empty, it is guaranteed to only contain instances of
- * <code>String</code>.
- */
+ /**
+ * Returns the set of identifiers to defined activities.
+ * <p>
+ * Notification is sent to all registered listeners if this property changes.
+ * </p>
+ *
+ * @return the set of identifiers to defined activities. This set may be empty,
+ * but is guaranteed not to be <code>null</code>. If this set is not
+ * empty, it is guaranteed to only contain instances of
+ * <code>String</code>.
+ */
Set<String> getDefinedActivityIds();
- /**
- * Returns the set of identifiers to defined categories.
- * <p>
- * Notification is sent to all registered listeners if this property
- * changes.
- * </p>
- *
- * @return the set of identifiers to defined categories. This set may be
- * empty, but is guaranteed not to be <code>null</code>. If this
- * set is not empty, it is guaranteed to only contain instances of
- * <code>String</code>.
- */
+ /**
+ * Returns the set of identifiers to defined categories.
+ * <p>
+ * Notification is sent to all registered listeners if this property changes.
+ * </p>
+ *
+ * @return the set of identifiers to defined categories. This set may be empty,
+ * but is guaranteed not to be <code>null</code>. If this set is not
+ * empty, it is guaranteed to only contain instances of
+ * <code>String</code>.
+ */
Set<String> getDefinedCategoryIds();
- /**
- * Returns the set of identifiers to enabled activities.
- * <p>
- * Notification is sent to all registered listeners if this property
- * changes.
- * </p>
- *
- * @return the set of identifiers to enabled activities. This set may be
- * empty, but is guaranteed not to be <code>null</code>. If this
- * set is not empty, it is guaranteed to only contain instances of
- * <code>String</code>.
- */
+ /**
+ * Returns the set of identifiers to enabled activities.
+ * <p>
+ * Notification is sent to all registered listeners if this property changes.
+ * </p>
+ *
+ * @return the set of identifiers to enabled activities. This set may be empty,
+ * but is guaranteed not to be <code>null</code>. If this set is not
+ * empty, it is guaranteed to only contain instances of
+ * <code>String</code>.
+ */
Set<String> getEnabledActivityIds();
- /**
- * Returns an instance of <code>IIdentifier</code> given an identifier.
- *
- * @param identifierId
- * an identifier. Must not be <code>null</code>
- * @return an instance of <code>IIdentifier</code>.
- */
- IIdentifier getIdentifier(String identifierId);
+ /**
+ * Returns an instance of <code>IIdentifier</code> given an identifier.
+ *
+ * @param identifierId an identifier. Must not be <code>null</code>
+ * @return an instance of <code>IIdentifier</code>.
+ */
+ IIdentifier getIdentifier(String identifierId);
- /**
- * Removes an instance of <code>IActivityManagerListener</code>
- * listening for changes to properties of this instance.
- *
- * @param activityManagerListener
- * the instance to remove. Must not be <code>null</code>.
- * If an attempt is made to remove an instance which is not
- * already registered with this instance, no operation is
- * performed.
- */
- void removeActivityManagerListener(
- IActivityManagerListener activityManagerListener);
+ /**
+ * Removes an instance of <code>IActivityManagerListener</code> listening for
+ * changes to properties of this instance.
+ *
+ * @param activityManagerListener the instance to remove. Must not be
+ * <code>null</code>. If an attempt is made to
+ * remove an instance which is not already
+ * registered with this instance, no operation is
+ * performed.
+ */
+ void removeActivityManagerListener(IActivityManagerListener activityManagerListener);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IActivityManagerListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IActivityManagerListener.java
index e9780b6b31e..ef7848f771e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IActivityManagerListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IActivityManagerListener.java
@@ -27,12 +27,13 @@ package org.eclipse.ui.activities;
*/
public interface IActivityManagerListener {
- /**
- * Notifies that one or more properties of an instance of <code>IActivityManager</code>
- * have changed. Specific details are described in the <code>ActivityManagerEvent</code>.
- *
- * @param activityManagerEvent
- * the activity manager event. Guaranteed not to be <code>null</code>.
- */
- void activityManagerChanged(ActivityManagerEvent activityManagerEvent);
+ /**
+ * Notifies that one or more properties of an instance of
+ * <code>IActivityManager</code> have changed. Specific details are described in
+ * the <code>ActivityManagerEvent</code>.
+ *
+ * @param activityManagerEvent the activity manager event. Guaranteed not to be
+ * <code>null</code>.
+ */
+ void activityManagerChanged(ActivityManagerEvent activityManagerEvent);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IActivityPatternBinding.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IActivityPatternBinding.java
index 2947de57bdd..974e2cc414b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IActivityPatternBinding.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IActivityPatternBinding.java
@@ -18,8 +18,8 @@ import java.util.regex.Pattern;
/**
* An instance of this interface represents a binding between an activity and a
- * regular expression pattern. It's typically unnecessary to use this interface
- * directly. Rather, clients wishing to test strings against activity patterns
+ * regular expression pattern. It's typically unnecessary to use this interface
+ * directly. Rather, clients wishing to test strings against activity patterns
* should use instances of <code>IIdentifier</code>.
* <p>
* This interface is not intended to be extended or implemented by clients.
@@ -33,30 +33,29 @@ import java.util.regex.Pattern;
*/
public interface IActivityPatternBinding extends Comparable<IActivityPatternBinding> {
- /**
- * Returns the identifier of the activity represented in this binding.
- *
- * @return the identifier of the activity represented in this binding.
- * Guaranteed not to be <code>null</code>.
- */
- String getActivityId();
+ /**
+ * Returns the identifier of the activity represented in this binding.
+ *
+ * @return the identifier of the activity represented in this binding.
+ * Guaranteed not to be <code>null</code>.
+ */
+ String getActivityId();
- /**
- * Returns the pattern represented in this binding. This pattern should
- * conform to the regular expression syntax described by the
- * <code>java.util.regex.Pattern</code> class. If
- * {@link #isEqualityPattern()} is <code>true</code> a Pattern will be
- * generated based on the escaped version of the String returned by
- * {@link #getString()}.
+ /**
+ * Returns the pattern represented in this binding. This pattern should conform
+ * to the regular expression syntax described by the
+ * <code>java.util.regex.Pattern</code> class. If {@link #isEqualityPattern()}
+ * is <code>true</code> a Pattern will be generated based on the escaped version
+ * of the String returned by {@link #getString()}.
*
* @return the pattern. Guaranteed not to be <code>null</code>.
*/
Pattern getPattern();
- /**
- * If {@link #isEqualityPattern()} is <code>true</code> this will return
- * the raw <em>pattern</em> string. Otherwise it will return the string
- * version of the compiled pattern.
+ /**
+ * If {@link #isEqualityPattern()} is <code>true</code> this will return the raw
+ * <em>pattern</em> string. Otherwise it will return the string version of the
+ * compiled pattern.
*
* @return The raw <em>pattern</em> string, or the string version of the
* compiled pattern, depending on {@link #isEqualityPattern()}.
@@ -65,10 +64,10 @@ public interface IActivityPatternBinding extends Comparable<IActivityPatternBind
String getString();
/**
- * Answers whether or not the pattern should be treated as a regular string
- * or a regular expression. If <code>true</code>, this pattern binding
- * will represent an equality match between the pattern and a target ID
- * rather than a regular expression match.
+ * Answers whether or not the pattern should be treated as a regular string or a
+ * regular expression. If <code>true</code>, this pattern binding will represent
+ * an equality match between the pattern and a target ID rather than a regular
+ * expression match.
*
* @return whether the pattern should be treated as regular string
* @since 3.4
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IActivityRequirementBinding.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IActivityRequirementBinding.java
index 1da243a3137..935772e74e0 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IActivityRequirementBinding.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IActivityRequirementBinding.java
@@ -16,9 +16,9 @@ package org.eclipse.ui.activities;
/**
* An instance of this interface represents a binding between two activities.
- * The relationship can be interpreted as 'activity needs requiredActivity to
- * be enabled'.
- * Enablement of the activity requires enablement of the required activity.
+ * The relationship can be interpreted as 'activity needs requiredActivity to be
+ * enabled'. Enablement of the activity requires enablement of the required
+ * activity.
*
* <p>
* This interface is not intended to be extended or implemented by clients.
@@ -30,22 +30,21 @@ package org.eclipse.ui.activities;
*/
public interface IActivityRequirementBinding extends Comparable<IActivityRequirementBinding> {
- /**
- * Returns the identifier of the activity represented in this
- * binding.
- *
- * @return the identifier of the activity represented in this
- * binding. Guaranteed not to be <code>null</code>.
- */
- String getActivityId();
+ /**
+ * Returns the identifier of the activity represented in this binding.
+ *
+ * @return the identifier of the activity represented in this binding.
+ * Guaranteed not to be <code>null</code>.
+ */
+ String getActivityId();
- /**
- * Returns the identifier of the required activity represented in this
- * binding. The enablement of the activity described by {@link #getActivityId()}
- * requires the enablement of this activity.
- *
- * @return the identifier of the required activity represented in this
- * binding. Guaranteed not to be <code>null</code>.
- */
- String getRequiredActivityId();
+ /**
+ * Returns the identifier of the required activity represented in this binding.
+ * The enablement of the activity described by {@link #getActivityId()} requires
+ * the enablement of this activity.
+ *
+ * @return the identifier of the required activity represented in this binding.
+ * Guaranteed not to be <code>null</code>.
+ */
+ String getRequiredActivityId();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ICategory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ICategory.java
index ee345e10007..a075e524981 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ICategory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ICategory.java
@@ -17,8 +17,8 @@ package org.eclipse.ui.activities;
import java.util.Set;
/**
- * An instance of this interface is a category as defined by the extension
- * point <code>org.eclipse.ui.activities</code>.
+ * An instance of this interface is a category as defined by the extension point
+ * <code>org.eclipse.ui.activities</code>.
* <p>
* An instance of this interface can be obtained from an instance of
* <code>IActivityManager</code> for any identifier, whether or not a category
@@ -39,89 +39,84 @@ import java.util.Set;
*/
public interface ICategory extends Comparable<ICategory> {
- /**
- * Registers an instance of <code>ICategoryListener</code> to listen for
- * changes to properties of this instance.
- *
- * @param categoryListener
- * the instance to register. Must not be <code>null</code>.
- * If an attempt is made to register an instance which is
- * already registered with this instance, no operation is
- * performed.
- */
- void addCategoryListener(ICategoryListener categoryListener);
+ /**
+ * Registers an instance of <code>ICategoryListener</code> to listen for changes
+ * to properties of this instance.
+ *
+ * @param categoryListener the instance to register. Must not be
+ * <code>null</code>. If an attempt is made to register
+ * an instance which is already registered with this
+ * instance, no operation is performed.
+ */
+ void addCategoryListener(ICategoryListener categoryListener);
- /**
- * Returns the set of category activity bindings for this instance.
- * <p>
- * This method will return all category activity bindings for this
- * instance, whether or not this instance is defined.
- * </p>
- * <p>
- * Notification is sent to all registered listeners if this property
- * changes.
- * </p>
- *
- * @return the set of category activity bindings. This set may be empty,
- * but is guaranteed not to be <code>null</code>. If this set is
- * not empty, it is guaranteed to only contain instances of <code>ICategoryActivityBinding</code>.
- * @see ICategoryActivityBinding
- */
+ /**
+ * Returns the set of category activity bindings for this instance.
+ * <p>
+ * This method will return all category activity bindings for this instance,
+ * whether or not this instance is defined.
+ * </p>
+ * <p>
+ * Notification is sent to all registered listeners if this property changes.
+ * </p>
+ *
+ * @return the set of category activity bindings. This set may be empty, but is
+ * guaranteed not to be <code>null</code>. If this set is not empty, it
+ * is guaranteed to only contain instances of
+ * <code>ICategoryActivityBinding</code>.
+ * @see ICategoryActivityBinding
+ */
Set<ICategoryActivityBinding> getCategoryActivityBindings();
- /**
- * Returns the identifier of this instance.
- *
- * @return the identifier of this instance. Guaranteed not to be <code>null</code>.
- */
- String getId();
+ /**
+ * Returns the identifier of this instance.
+ *
+ * @return the identifier of this instance. Guaranteed not to be
+ * <code>null</code>.
+ */
+ String getId();
- /**
- * Returns the name of this instance suitable for display to the user.
- * <p>
- * Notification is sent to all registered listeners if this property
- * changes.
- * </p>
- *
- * @return the name of this instance. Guaranteed not to be <code>null</code>.
- * @throws NotDefinedException
- * if this instance is not defined.
- */
- String getName() throws NotDefinedException;
+ /**
+ * Returns the name of this instance suitable for display to the user.
+ * <p>
+ * Notification is sent to all registered listeners if this property changes.
+ * </p>
+ *
+ * @return the name of this instance. Guaranteed not to be <code>null</code>.
+ * @throws NotDefinedException if this instance is not defined.
+ */
+ String getName() throws NotDefinedException;
- /**
- * Returns the description of this instance suitable for display to the user.
- * <p>
- * Notification is sent to all registered listeners if this property
- * changes.
- * </p>
- *
- * @return the description of this instance. Guaranteed not to be <code>null</code>.
- * @throws NotDefinedException
- * if this instance is not defined.
- */
- String getDescription() throws NotDefinedException;
+ /**
+ * Returns the description of this instance suitable for display to the user.
+ * <p>
+ * Notification is sent to all registered listeners if this property changes.
+ * </p>
+ *
+ * @return the description of this instance. Guaranteed not to be
+ * <code>null</code>.
+ * @throws NotDefinedException if this instance is not defined.
+ */
+ String getDescription() throws NotDefinedException;
- /**
- * Returns whether or not this instance is defined.
- * <p>
- * Notification is sent to all registered listeners if this property
- * changes.
- * </p>
- *
- * @return <code>true</code>, iff this instance is defined.
- */
- boolean isDefined();
+ /**
+ * Returns whether or not this instance is defined.
+ * <p>
+ * Notification is sent to all registered listeners if this property changes.
+ * </p>
+ *
+ * @return <code>true</code>, iff this instance is defined.
+ */
+ boolean isDefined();
- /**
- * Removes an instance of <code>ICategoryListener</code> listening
- * for changes to properties of this instance.
- *
- * @param categoryListener
- * the instance to remove. Must not be <code>null</code>.
- * If an attempt is made to remove an instance which is not
- * already registered with this instance, no operation is
- * performed.
- */
- void removeCategoryListener(ICategoryListener categoryListener);
+ /**
+ * Removes an instance of <code>ICategoryListener</code> listening for changes
+ * to properties of this instance.
+ *
+ * @param categoryListener the instance to remove. Must not be
+ * <code>null</code>. If an attempt is made to remove an
+ * instance which is not already registered with this
+ * instance, no operation is performed.
+ */
+ void removeCategoryListener(ICategoryListener categoryListener);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ICategoryActivityBinding.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ICategoryActivityBinding.java
index 606ffe3e3c1..8acbf4a8a00 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ICategoryActivityBinding.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ICategoryActivityBinding.java
@@ -29,19 +29,19 @@ package org.eclipse.ui.activities;
*/
public interface ICategoryActivityBinding extends Comparable<ICategoryActivityBinding> {
- /**
- * Returns the identifier of the activity represented in this binding.
- *
- * @return the identifier of the activity represented in this binding.
- * Guaranteed not to be <code>null</code>.
- */
- String getActivityId();
+ /**
+ * Returns the identifier of the activity represented in this binding.
+ *
+ * @return the identifier of the activity represented in this binding.
+ * Guaranteed not to be <code>null</code>.
+ */
+ String getActivityId();
- /**
- * Returns the identifier of the category represented in this binding.
- *
- * @return the identifier of the category represented in this binding.
- * Guaranteed not to be <code>null</code>.
- */
- String getCategoryId();
+ /**
+ * Returns the identifier of the category represented in this binding.
+ *
+ * @return the identifier of the category represented in this binding.
+ * Guaranteed not to be <code>null</code>.
+ */
+ String getCategoryId();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ICategoryListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ICategoryListener.java
index bf0373e047c..52a0e09677d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ICategoryListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ICategoryListener.java
@@ -28,12 +28,13 @@ package org.eclipse.ui.activities;
*/
public interface ICategoryListener {
- /**
- * Notifies that one or more properties of an instance of <code>ICategory</code>
- * have changed. Specific details are described in the <code>CategoryEvent</code>.
- *
- * @param categoryEvent
- * the category event. Guaranteed not to be <code>null</code>.
- */
- void categoryChanged(CategoryEvent categoryEvent);
+ /**
+ * Notifies that one or more properties of an instance of <code>ICategory</code>
+ * have changed. Specific details are described in the
+ * <code>CategoryEvent</code>.
+ *
+ * @param categoryEvent the category event. Guaranteed not to be
+ * <code>null</code>.
+ */
+ void categoryChanged(CategoryEvent categoryEvent);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IIdentifier.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IIdentifier.java
index 58549f73486..4a2faa0806b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IIdentifier.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IIdentifier.java
@@ -22,8 +22,9 @@ import java.util.Set;
* <p>
* An <code>IIdentifier</code> is an object that offers an easy means to
* determine if a given string matches the pattern bindings of any IActivity
- * objects. Additionaly, one may query if an identifier is enabled. An
- * identifier is always considered enabled unless it matches only disabled activities.
+ * objects. Additionaly, one may query if an identifier is enabled. An
+ * identifier is always considered enabled unless it matches only disabled
+ * activities.
* </p>
* <p>
* The handle-based nature of this API allows it to work well with runtime
@@ -40,63 +41,60 @@ import java.util.Set;
*/
public interface IIdentifier extends Comparable<IIdentifier> {
- /**
- * Registers an instance of <code>IIdentifierListener</code> to listen
- * for changes to properties of this instance.
- *
- * @param identifierListener
- * the instance to register. Must not be <code>null</code>.
- * If an attempt is made to register an instance which is
- * already registered with this instance, no operation is
- * performed.
- */
- void addIdentifierListener(IIdentifierListener identifierListener);
+ /**
+ * Registers an instance of <code>IIdentifierListener</code> to listen for
+ * changes to properties of this instance.
+ *
+ * @param identifierListener the instance to register. Must not be
+ * <code>null</code>. If an attempt is made to
+ * register an instance which is already registered
+ * with this instance, no operation is performed.
+ */
+ void addIdentifierListener(IIdentifierListener identifierListener);
- /**
- * Returns the set of activity ids that this instance matches. Each
- * activity in this set will have at least one pattern binding that matches
- * the string returned by {@link #getId()}.
- * <p>
- * Notification is sent to all registered listeners if this property
- * changes.
- * </p>
- *
- * @return the set of activity ids that this instance matches. This set may
- * be empty, but is guaranteed not to be <code>null</code>. If
- * this set is not empty, it is guaranteed to only contain
- * instances of <code>String</code>.
- */
+ /**
+ * Returns the set of activity ids that this instance matches. Each activity in
+ * this set will have at least one pattern binding that matches the string
+ * returned by {@link #getId()}.
+ * <p>
+ * Notification is sent to all registered listeners if this property changes.
+ * </p>
+ *
+ * @return the set of activity ids that this instance matches. This set may be
+ * empty, but is guaranteed not to be <code>null</code>. If this set is
+ * not empty, it is guaranteed to only contain instances of
+ * <code>String</code>.
+ */
Set<String> getActivityIds();
- /**
- * Returns the identifier of this instance.
- *
- * @return the identifier of this instance. Guaranteed not to be <code>null</code>.
- */
- String getId();
+ /**
+ * Returns the identifier of this instance.
+ *
+ * @return the identifier of this instance. Guaranteed not to be
+ * <code>null</code>.
+ */
+ String getId();
- /**
- * Returns whether or not this instance is enabled. An identifier is always
- * considered enabled unless it matches only disabled activities.
- *
- * <p>
- * Notification is sent to all registered listeners if this property
- * changes.
- * </p>
- *
- * @return <code>true</code>, iff this instance is enabled.
- */
- boolean isEnabled();
+ /**
+ * Returns whether or not this instance is enabled. An identifier is always
+ * considered enabled unless it matches only disabled activities.
+ *
+ * <p>
+ * Notification is sent to all registered listeners if this property changes.
+ * </p>
+ *
+ * @return <code>true</code>, iff this instance is enabled.
+ */
+ boolean isEnabled();
- /**
- * Removes an instance of <code>IIdentifierListener</code> listening
- * for changes to properties of this instance.
- *
- * @param identifierListener
- * the instance to remove. Must not be <code>null</code>.
- * If an attempt is made to remove an instance which is not
- * already registered with this instance, no operation is
- * performed.
- */
- void removeIdentifierListener(IIdentifierListener identifierListener);
+ /**
+ * Removes an instance of <code>IIdentifierListener</code> listening for changes
+ * to properties of this instance.
+ *
+ * @param identifierListener the instance to remove. Must not be
+ * <code>null</code>. If an attempt is made to remove
+ * an instance which is not already registered with
+ * this instance, no operation is performed.
+ */
+ void removeIdentifierListener(IIdentifierListener identifierListener);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IIdentifierListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IIdentifierListener.java
index c71b8b9066e..afa18769e41 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IIdentifierListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IIdentifierListener.java
@@ -27,12 +27,13 @@ package org.eclipse.ui.activities;
*/
public interface IIdentifierListener {
- /**
- * Notifies that one or more properties of an instance of <code>IIdentifier</code>
- * have changed. Specific details are described in the <code>IdentifierEvent</code>.
- *
- * @param identifierEvent
- * the identifier event. Guaranteed not to be <code>null</code>.
- */
- void identifierChanged(IdentifierEvent identifierEvent);
+ /**
+ * Notifies that one or more properties of an instance of
+ * <code>IIdentifier</code> have changed. Specific details are described in the
+ * <code>IdentifierEvent</code>.
+ *
+ * @param identifierEvent the identifier event. Guaranteed not to be
+ * <code>null</code>.
+ */
+ void identifierChanged(IdentifierEvent identifierEvent);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IMutableActivityManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IMutableActivityManager.java
index becf3573d25..a87815b78c6 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IMutableActivityManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IMutableActivityManager.java
@@ -17,8 +17,8 @@ package org.eclipse.ui.activities;
import java.util.Set;
/**
- * An instance of this interface allows clients to manage activities, as
- * defined by the extension point <code>org.eclipse.ui.activities</code>.
+ * An instance of this interface allows clients to manage activities, as defined
+ * by the extension point <code>org.eclipse.ui.activities</code>.
* <p>
* This interface extends <code>IActivityManager</code> by granting the ability
* to alter the set of currently enabled activities.
@@ -32,13 +32,13 @@ import java.util.Set;
*/
public interface IMutableActivityManager extends IActivityManager {
- /**
- * Sets the set of identifiers to enabled activities.
- *
- * @param enabledActivityIds
- * the set of identifiers to enabled activities. This set may be
- * empty, but it must not be <code>null</code>. If this set
- * is not empty, it must only contain instances of <code>String</code>.
- */
+ /**
+ * Sets the set of identifiers to enabled activities.
+ *
+ * @param enabledActivityIds the set of identifiers to enabled activities. This
+ * set may be empty, but it must not be
+ * <code>null</code>. If this set is not empty, it
+ * must only contain instances of <code>String</code>.
+ */
void setEnabledActivityIds(Set<String> enabledActivityIds);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ITriggerPoint.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ITriggerPoint.java
index 915f5aff854..e077fdc2dba 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ITriggerPoint.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ITriggerPoint.java
@@ -32,7 +32,7 @@ package org.eclipse.ui.activities;
public interface ITriggerPoint {
/**
- * The interactive hint key. Value <code>"interactive"</code>.
+ * The interactive hint key. Value <code>"interactive"</code>.
*/
String HINT_INTERACTIVE = "interactive"; //$NON-NLS-1$
@@ -58,14 +58,13 @@ public interface ITriggerPoint {
*/
String getStringHint(String key);
-
/**
- * Return the hint with the given key defined on this trigger point as
- * interpreted as a <code>boolean</code>.
- *
- * @param key the hint key
- * @return the hint
- * @see Boolean#valueOf(java.lang.String)
- */
+ * Return the hint with the given key defined on this trigger point as
+ * interpreted as a <code>boolean</code>.
+ *
+ * @param key the hint key
+ * @return the hint
+ * @see Boolean#valueOf(java.lang.String)
+ */
boolean getBooleanHint(String key);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ITriggerPointAdvisor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ITriggerPointAdvisor.java
index 5d3d9f10152..5ce86d8b6ad 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ITriggerPointAdvisor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ITriggerPointAdvisor.java
@@ -31,37 +31,32 @@ import java.util.Set;
public interface ITriggerPointAdvisor {
/**
- * Answer whether the activities bound to the identifier should be enabled
- * when triggered by the provided trigger point.
+ * Answer whether the activities bound to the identifier should be enabled when
+ * triggered by the provided trigger point.
*
- * @param triggerPoint
- * the trigger point to test
- * @param identifier
- * the identifier to test against the trigger point
- * @return the set of activities that should be enabled if this the
- * contribution represented by this identifier is to be used. If
- * this is not <code>null</code>, the caller can proceed with
- * usage of the contribution provided that the collection of
- * activities is enabled. If this is <code>null</code>, the
- * caller should assume that the operation involving the
- * contribution should be aborted. If this method returns the empty
- * set then the operation can proceed without any changes to
- * activity enablement state. Please note that it is the callers
- * responsibility to ensure that the Set returned by this method is
- * actually enabled - after setting the enabled state of the
- * required activities the change should be verified by consulting
+ * @param triggerPoint the trigger point to test
+ * @param identifier the identifier to test against the trigger point
+ * @return the set of activities that should be enabled if this the contribution
+ * represented by this identifier is to be used. If this is not
+ * <code>null</code>, the caller can proceed with usage of the
+ * contribution provided that the collection of activities is enabled.
+ * If this is <code>null</code>, the caller should assume that the
+ * operation involving the contribution should be aborted. If this
+ * method returns the empty set then the operation can proceed without
+ * any changes to activity enablement state. Please note that it is the
+ * callers responsibility to ensure that the Set returned by this method
+ * is actually enabled - after setting the enabled state of the required
+ * activities the change should be verified by consulting
* {@link IActivityManager#getEnabledActivityIds()}.
*/
Set<String> allow(ITriggerPoint triggerPoint, IIdentifier identifier);
/**
- * Calculate the identifier's enabled state for a combination of activities
- * with and without enabled when core expressions.
+ * Calculate the identifier's enabled state for a combination of activities with
+ * and without enabled when core expressions.
*
- * @param activityManager
- * the activity manager
- * @param identifier
- * the identifier to update
+ * @param activityManager the activity manager
+ * @param identifier the identifier to update
*
* @return <code>true</code> if this identifier should be enabled,
* <code>false</code> otherwise
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ITriggerPointManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ITriggerPointManager.java
index f52bd10ea4a..1a1c73fadd5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ITriggerPointManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/ITriggerPointManager.java
@@ -30,10 +30,10 @@ import java.util.Set;
public interface ITriggerPointManager {
/**
- * Constant representing the id of an unknown trigger point. Used by clients
- * of {@link WorkbenchActivityHelper#allowUseOf(Object)} for trigger point
- * determination logic.
- */
+ * Constant representing the id of an unknown trigger point. Used by clients of
+ * {@link WorkbenchActivityHelper#allowUseOf(Object)} for trigger point
+ * determination logic.
+ */
String UNKNOWN_TRIGGER_POINT_ID = "org.eclipse.ui.internal.UnknownTriggerPoint"; //$NON-NLS-1$
/**
@@ -47,7 +47,7 @@ public interface ITriggerPointManager {
/**
* Return the set of defined trigger point ids.
*
- * @return the defined ids. Never <code>null</code> but may be empty.
+ * @return the defined ids. Never <code>null</code> but may be empty.
*/
Set<String> getDefinedTriggerPointIds();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IWorkbenchActivitySupport.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IWorkbenchActivitySupport.java
index 9a09755f242..acdf350408e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IWorkbenchActivitySupport.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IWorkbenchActivitySupport.java
@@ -18,7 +18,7 @@ import org.eclipse.jface.resource.ImageDescriptor;
/**
* An instance of this interface provides support for managing
- * <code>IWorkbench</code> activities. An instance of this interface may be
+ * <code>IWorkbench</code> activities. An instance of this interface may be
* obtained via {@link org.eclipse.ui.IWorkbench#getActivitySupport()}.
* <p>
* This interface is not intended to be extended or implemented by clients.
@@ -29,59 +29,59 @@ import org.eclipse.jface.resource.ImageDescriptor;
*/
public interface IWorkbenchActivitySupport {
- /**
- * Returns the activity manager for the workbench.
- *
- * @return the activity manager for the workbench. Guaranteed not to be
- * <code>null</code>.
- */
- IActivityManager getActivityManager();
+ /**
+ * Returns the activity manager for the workbench.
+ *
+ * @return the activity manager for the workbench. Guaranteed not to be
+ * <code>null</code>.
+ */
+ IActivityManager getActivityManager();
- /**
- * Sets the set of identifiers to enabled activities.
- *
- * @param enabledActivityIds
- * the set of identifiers to enabled activities. This set may be
- * empty, but it must not be <code>null</code>. If this set
- * is not empty, it must only contain instances of <code>String</code>.
- */
+ /**
+ * Sets the set of identifiers to enabled activities.
+ *
+ * @param enabledActivityIds the set of identifiers to enabled activities. This
+ * set may be empty, but it must not be
+ * <code>null</code>. If this set is not empty, it
+ * must only contain instances of <code>String</code>.
+ */
void setEnabledActivityIds(Set<String> enabledActivityIds);
- /**
- * Return the image associated with this activity.
- *
- * @param activity the activity
- * @return the image associated with this activity. Never <code>null</code>.
- * @since 3.1
- */
- ImageDescriptor getImageDescriptor(IActivity activity);
+ /**
+ * Return the image associated with this activity.
+ *
+ * @param activity the activity
+ * @return the image associated with this activity. Never <code>null</code>.
+ * @since 3.1
+ */
+ ImageDescriptor getImageDescriptor(IActivity activity);
- /**
- * Return the image associated with this category.
- *
- * @param category the category
- * @return the image associated with this category. Never <code>null</code>.
- * @since 3.1
- */
- ImageDescriptor getImageDescriptor(ICategory category);
+ /**
+ * Return the image associated with this category.
+ *
+ * @param category the category
+ * @return the image associated with this category. Never <code>null</code>.
+ * @since 3.1
+ */
+ ImageDescriptor getImageDescriptor(ICategory category);
/**
* Return the trigger point manager for this instance.
*
- * @return the trigger point manager. Never <code>null</code>.
+ * @return the trigger point manager. Never <code>null</code>.
* @since 3.1
*/
ITriggerPointManager getTriggerPointManager();
- /**
- * Return a copy of the current activity set. This copy will contain all
- * activity and category definitions that the workbench activity manager
- * contains, and will have the same enabled state. It will not have the same
- * listeners. This is useful for user interfaces that wish to modify the
- * activity enablement state (such as preference pages).
- *
- * @return a copy of the current activity set
- * @since 3.1
- */
- IMutableActivityManager createWorkingCopy();
+ /**
+ * Return a copy of the current activity set. This copy will contain all
+ * activity and category definitions that the workbench activity manager
+ * contains, and will have the same enabled state. It will not have the same
+ * listeners. This is useful for user interfaces that wish to modify the
+ * activity enablement state (such as preference pages).
+ *
+ * @return a copy of the current activity set
+ * @since 3.1
+ */
+ IMutableActivityManager createWorkingCopy();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IdentifierEvent.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IdentifierEvent.java
index fce5d1c5083..54e64a1918b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IdentifierEvent.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/IdentifierEvent.java
@@ -16,7 +16,7 @@ package org.eclipse.ui.activities;
/**
* An instance of this class describes changes to an instance of
- * <code>IIdentifier</code>. This class does not give details as to the
+ * <code>IIdentifier</code>. This class does not give details as to the
* specifics of a change, only that the given property on the source object has
* changed.
*
@@ -28,58 +28,56 @@ package org.eclipse.ui.activities;
* @see IIdentifierListener#identifierChanged(IdentifierEvent)
*/
public final class IdentifierEvent {
- private boolean activityIdsChanged;
+ private boolean activityIdsChanged;
- private boolean enabledChanged;
+ private boolean enabledChanged;
- private IIdentifier identifier;
+ private IIdentifier identifier;
- /**
- * Creates a new instance of this class.
- *
- * @param identifier
- * the instance of the interface that changed.
- * @param activityIdsChanged
- * <code>true</code>, iff the activityIds property changed.
- * @param enabledChanged
- * <code>true</code>, iff the enabled property changed.
- */
- public IdentifierEvent(IIdentifier identifier, boolean activityIdsChanged,
- boolean enabledChanged) {
- if (identifier == null) {
+ /**
+ * Creates a new instance of this class.
+ *
+ * @param identifier the instance of the interface that changed.
+ * @param activityIdsChanged <code>true</code>, iff the activityIds property
+ * changed.
+ * @param enabledChanged <code>true</code>, iff the enabled property
+ * changed.
+ */
+ public IdentifierEvent(IIdentifier identifier, boolean activityIdsChanged, boolean enabledChanged) {
+ if (identifier == null) {
throw new NullPointerException();
}
- this.identifier = identifier;
- this.activityIdsChanged = activityIdsChanged;
- this.enabledChanged = enabledChanged;
- }
+ this.identifier = identifier;
+ this.activityIdsChanged = activityIdsChanged;
+ this.enabledChanged = enabledChanged;
+ }
- /**
- * Returns the instance of the interface that changed.
- *
- * @return the instance of the interface that changed. Guaranteed not to be
- * <code>null</code>.
- */
- public IIdentifier getIdentifier() {
- return identifier;
- }
+ /**
+ * Returns the instance of the interface that changed.
+ *
+ * @return the instance of the interface that changed. Guaranteed not to be
+ * <code>null</code>.
+ */
+ public IIdentifier getIdentifier() {
+ return identifier;
+ }
- /**
- * Returns whether or not the activityIds property changed.
- *
- * @return <code>true</code>, iff the activityIds property changed.
- */
- public boolean hasActivityIdsChanged() {
- return activityIdsChanged;
- }
+ /**
+ * Returns whether or not the activityIds property changed.
+ *
+ * @return <code>true</code>, iff the activityIds property changed.
+ */
+ public boolean hasActivityIdsChanged() {
+ return activityIdsChanged;
+ }
- /**
- * Returns whether or not the enabled property changed.
- *
- * @return <code>true</code>, iff the enabled property changed.
- */
- public boolean hasEnabledChanged() {
- return enabledChanged;
- }
+ /**
+ * Returns whether or not the enabled property changed.
+ *
+ * @return <code>true</code>, iff the enabled property changed.
+ */
+ public boolean hasEnabledChanged() {
+ return enabledChanged;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/NotDefinedException.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/NotDefinedException.java
index e5b3d5d6476..ec76886b790 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/NotDefinedException.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/NotDefinedException.java
@@ -28,26 +28,26 @@ package org.eclipse.ui.activities;
*/
public final class NotDefinedException extends Exception {
- /**
- * Generated serial version UID for this class.
- * @since 3.1
- */
- private static final long serialVersionUID = 4050201929596811061L;
+ /**
+ * Generated serial version UID for this class.
+ *
+ * @since 3.1
+ */
+ private static final long serialVersionUID = 4050201929596811061L;
- /**
- * Creates a new instance of this class with no specified detail message.
- */
- public NotDefinedException() {
- //no-op
- }
+ /**
+ * Creates a new instance of this class with no specified detail message.
+ */
+ public NotDefinedException() {
+ // no-op
+ }
- /**
- * Creates a new instance of this class with the specified detail message.
- *
- * @param s
- * the detail message.
- */
- public NotDefinedException(String s) {
- super(s);
- }
+ /**
+ * Creates a new instance of this class with the specified detail message.
+ *
+ * @param s the detail message.
+ */
+ public NotDefinedException(String s) {
+ super(s);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/WorkbenchActivityHelper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/WorkbenchActivityHelper.java
index 427e98419ce..9eddd7f6b54 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/WorkbenchActivityHelper.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/WorkbenchActivityHelper.java
@@ -41,35 +41,31 @@ public final class WorkbenchActivityHelper {
public static final String TRIGGER_PRE_UI_POINT = "org.eclipse.ui.workbenchModel"; //$NON-NLS-1$
private static ITriggerPoint getTriggerPoint(String id) {
- return PlatformUI.getWorkbench().getActivitySupport()
- .getTriggerPointManager().getTriggerPoint(id);
+ return PlatformUI.getWorkbench().getActivitySupport().getTriggerPointManager().getTriggerPoint(id);
}
/**
* Return the identifier that maps to the given contribution.
*
- * @param contribution
- * the contribution
+ * @param contribution the contribution
* @return the identifier
* @since 3.1
*/
public static IIdentifier getIdentifier(IPluginContribution contribution) {
- IWorkbenchActivitySupport workbenchActivitySupport = PlatformUI
- .getWorkbench().getActivitySupport();
+ IWorkbenchActivitySupport workbenchActivitySupport = PlatformUI.getWorkbench().getActivitySupport();
IIdentifier identifier = workbenchActivitySupport.getActivityManager()
.getIdentifier(createUnifiedId(contribution));
return identifier;
}
/**
- * Answers whether a given contribution is allowed to be used based on
- * activity enablement. If it is currently disabled, then a dialog is opened
- * and the user is prompted to activate the requried activities. If the user
- * declines their activation then false is returned. In all other cases
- * <code>true</code> is returned.
+ * Answers whether a given contribution is allowed to be used based on activity
+ * enablement. If it is currently disabled, then a dialog is opened and the user
+ * is prompted to activate the requried activities. If the user declines their
+ * activation then false is returned. In all other cases <code>true</code> is
+ * returned.
*
- * @param object
- * the contribution to test.
+ * @param object the contribution to test.
* @return whether the contribution is allowed to be used based on activity
* enablement.
* @deprecated
@@ -77,22 +73,19 @@ public final class WorkbenchActivityHelper {
*/
@Deprecated
public static boolean allowUseOf(Object object) {
- return allowUseOf(PlatformUI.getWorkbench().getActivitySupport()
- .getTriggerPointManager().getTriggerPoint(
- ITriggerPointManager.UNKNOWN_TRIGGER_POINT_ID), object);
+ return allowUseOf(PlatformUI.getWorkbench().getActivitySupport().getTriggerPointManager()
+ .getTriggerPoint(ITriggerPointManager.UNKNOWN_TRIGGER_POINT_ID), object);
}
/**
- * Answers whether a given contribution is allowed to be used based on
- * activity enablement. If it is currently disabled, then a dialog is opened
- * and the user is prompted to activate the required activities. If the user
- * declines their activation then false is returned. In all other cases
- * <code>true</code> is returned.
+ * Answers whether a given contribution is allowed to be used based on activity
+ * enablement. If it is currently disabled, then a dialog is opened and the user
+ * is prompted to activate the required activities. If the user declines their
+ * activation then false is returned. In all other cases <code>true</code> is
+ * returned.
*
- * @param triggerPoint
- * the trigger point being hit
- * @param object
- * the contribution to test.
+ * @param triggerPoint the trigger point being hit
+ * @param object the contribution to test.
* @return whether the contribution is allowed to be used based on activity
* enablement.
*/
@@ -112,14 +105,13 @@ public final class WorkbenchActivityHelper {
}
/**
- * Restrict the use of the object only if it is matched by an activity with
- * a core expression. A normal disabled activity will not restrict the use
- * of this object.
+ * Restrict the use of the object only if it is matched by an activity with a
+ * core expression. A normal disabled activity will not restrict the use of this
+ * object.
*
- * @param object
- * the object to restrict
- * @return <code>true</code> if this object is matched by a disabled
- * activity with an expression.
+ * @param object the object to restrict
+ * @return <code>true</code> if this object is matched by a disabled activity
+ * with an expression.
* @since 3.4
*/
public static boolean restrictUseOf(Object object) {
@@ -127,24 +119,21 @@ public final class WorkbenchActivityHelper {
}
/**
- * Answers whether a given identifier is enabled. If it is not enabled, then
- * a dialog is opened and the user is prompted to enable the associated
+ * Answers whether a given identifier is enabled. If it is not enabled, then a
+ * dialog is opened and the user is prompted to enable the associated
* activities.
*
- * @param triggerPoint
- * the trigger point to test
- * @param identifier
- * the identifier to test.
+ * @param triggerPoint the trigger point to test
+ * @param identifier the identifier to test.
* @return whether the identifier is enabled.
*/
- private static boolean allow(ITriggerPoint triggerPoint,
- IIdentifier identifier) {
+ private static boolean allow(ITriggerPoint triggerPoint, IIdentifier identifier) {
if (identifier.isEnabled()) {
return true;
}
- ITriggerPointAdvisor advisor = ((WorkbenchActivitySupport) PlatformUI
- .getWorkbench().getActivitySupport()).getTriggerPointAdvisor();
+ ITriggerPointAdvisor advisor = ((WorkbenchActivitySupport) PlatformUI.getWorkbench().getActivitySupport())
+ .getTriggerPointAdvisor();
Set<String> activitiesToEnable = advisor.allow(triggerPoint, identifier);
if (activitiesToEnable == null) {
@@ -162,22 +151,22 @@ public final class WorkbenchActivityHelper {
// are now enabled. this means if something has an expression bound
// activity that is not currently enabled this call will always return
// false - trying to manually set such an activity will always fail.
- Set<?> newEnabled = PlatformUI.getWorkbench().getActivitySupport().getActivityManager()
- .getEnabledActivityIds();
+ Set<?> newEnabled = PlatformUI.getWorkbench().getActivitySupport().getActivityManager().getEnabledActivityIds();
return newEnabled.containsAll(activitiesToEnable);
}
/**
- * Utility method to create a <code>String</code> containing the plugin
- * and extension ids of a contribution. This will have the form
+ * Utility method to create a <code>String</code> containing the plugin and
+ * extension ids of a contribution. This will have the form
*
* <pre>
* pluginId / extensionId
- * </pre>. If the IPluginContribution does not define a plugin id then the
- * extension id alone is returned.
+ * </pre>
+ *
+ * . If the IPluginContribution does not define a plugin id then the extension
+ * id alone is returned.
*
- * @param contribution
- * the contribution to use
+ * @param contribution the contribution to use
* @return the unified id
*/
public static String createUnifiedId(IPluginContribution contribution) {
@@ -191,36 +180,31 @@ public final class WorkbenchActivityHelper {
/**
* Enables the set of activities.
*
- * @param activities
- * the activities to enable
+ * @param activities the activities to enable
*/
private static void enableActivities(Collection<String> activities) {
- IWorkbenchActivitySupport activitySupport = PlatformUI.getWorkbench()
- .getActivitySupport();
+ IWorkbenchActivitySupport activitySupport = PlatformUI.getWorkbench().getActivitySupport();
Set<String> newSet = new HashSet<>(activitySupport.getActivityManager().getEnabledActivityIds());
newSet.addAll(activities);
activitySupport.setEnabledActivityIds(newSet);
}
/**
- * Answers whether the provided object should be filtered from the UI based
- * on activity state. Returns <code>false</code> except when the object is
- * an instance of <code>IPluginContribution</code> whos unified id matches
- * an <code>IIdentifier</code> that is currently disabled.
+ * Answers whether the provided object should be filtered from the UI based on
+ * activity state. Returns <code>false</code> except when the object is an
+ * instance of <code>IPluginContribution</code> whos unified id matches an
+ * <code>IIdentifier</code> that is currently disabled.
*
- * @param object
- * the object to test
+ * @param object the object to test
* @return whether the object should be filtered
* @see #createUnifiedId(IPluginContribution)
*/
public static boolean filterItem(Object object) {
if (object instanceof IPluginContribution) {
IPluginContribution contribution = (IPluginContribution) object;
- IWorkbenchActivitySupport workbenchActivitySupport = PlatformUI
- .getWorkbench().getActivitySupport();
- IIdentifier identifier = workbenchActivitySupport
- .getActivityManager().getIdentifier(
- createUnifiedId(contribution));
+ IWorkbenchActivitySupport workbenchActivitySupport = PlatformUI.getWorkbench().getActivitySupport();
+ IIdentifier identifier = workbenchActivitySupport.getActivityManager()
+ .getIdentifier(createUnifiedId(contribution));
if (!identifier.isEnabled()) {
return true;
}
@@ -229,32 +213,28 @@ public final class WorkbenchActivityHelper {
}
/**
- * Returns whether the UI is set up to filter contributions. This is the
- * case if there are defined activities.
+ * Returns whether the UI is set up to filter contributions. This is the case if
+ * there are defined activities.
*
* @return whether the UI is set up to filter contributions
*/
public static boolean isFiltering() {
- return !PlatformUI.getWorkbench().getActivitySupport()
- .getActivityManager().getDefinedActivityIds().isEmpty();
+ return !PlatformUI.getWorkbench().getActivitySupport().getActivityManager().getDefinedActivityIds().isEmpty();
}
/**
- * Return a list of category ids that will become implicity enabled if the
- * given category becomes enabled Note that the set returned by this set
- * represents the delta of categories that would be enabled - if the
- * category is already enabled then it is omitted.
+ * Return a list of category ids that will become implicity enabled if the given
+ * category becomes enabled Note that the set returned by this set represents
+ * the delta of categories that would be enabled - if the category is already
+ * enabled then it is omitted.
*
- * @param activityManager
- * the activity manager to test against
- * @param categoryId
- * the category to be enabled
+ * @param activityManager the activity manager to test against
+ * @param categoryId the category to be enabled
* @return a list of category ids that will become implicity enabled if the
* given category becomes enabled
* @since 3.1
*/
- public static Set<String> getEnabledCategories(IActivityManager activityManager,
- String categoryId) {
+ public static Set<String> getEnabledCategories(IActivityManager activityManager, String categoryId) {
ICategory category = activityManager.getCategory(categoryId);
if (!category.isDefined()) {
return Collections.emptySet();
@@ -268,11 +248,9 @@ public final class WorkbenchActivityHelper {
if (otherCategoryId.equals(categoryId)) {
continue;
}
- ICategory otherCategory = activityManager
- .getCategory(otherCategoryId);
+ ICategory otherCategory = activityManager.getCategory(otherCategoryId);
Set<?> otherCategoryActivityIds = expandActivityDependencies(getActivityIdsForCategory(otherCategory));
- if (activityManager.getEnabledActivityIds().containsAll(
- otherCategoryActivityIds)) {
+ if (activityManager.getEnabledActivityIds().containsAll(otherCategoryActivityIds)) {
continue;
}
if (activities.containsAll(otherCategoryActivityIds)) {
@@ -284,11 +262,10 @@ public final class WorkbenchActivityHelper {
}
/**
- * Return the expanded activities for the given activity set. This will
- * resolve all activity requirement bindings.
+ * Return the expanded activities for the given activity set. This will resolve
+ * all activity requirement bindings.
*
- * @param baseActivities
- * the set of activities to expand
+ * @param baseActivities the set of activities to expand
* @return the expanded activities
* @since 3.1
*/
@@ -305,14 +282,12 @@ public final class WorkbenchActivityHelper {
/**
* Return the activities required for this activity.
*
- * @param activityId
- * the activity id
+ * @param activityId the activity id
* @return the activities required for this activity
* @since 3.1
*/
public static Set<String> getRequiredActivityIds(String activityId) {
- IActivityManager manager = PlatformUI.getWorkbench()
- .getActivitySupport().getActivityManager();
+ IActivityManager manager = PlatformUI.getWorkbench().getActivitySupport().getActivityManager();
IActivity activity = manager.getActivity(activityId);
if (!activity.isDefined()) {
return Collections.EMPTY_SET;
@@ -334,8 +309,7 @@ public final class WorkbenchActivityHelper {
/**
* Return the activities directly required by a given category.
*
- * @param category
- * the category
+ * @param category the category
* @return the activities directly required by a given category
* @since 3.1
*/
@@ -352,19 +326,16 @@ public final class WorkbenchActivityHelper {
/**
* Return a list of category ids that will become implicity disabled if the
* given category becomes disabled Note that the set returned by this set
- * represents the delta of categories that would be enabled - if the
- * category is already enabled then it is omitted.
+ * represents the delta of categories that would be enabled - if the category is
+ * already enabled then it is omitted.
*
- * @param activityManager
- * the activity manager to test against
- * @param categoryId
- * the category to be enabled
+ * @param activityManager the activity manager to test against
+ * @param categoryId the category to be enabled
* @return a list of category ids that will become implicity enabled if the
* given category becomes enabled
* @since 3.1
*/
- public static Set<String> getDisabledCategories(IActivityManager activityManager,
- String categoryId) {
+ public static Set<String> getDisabledCategories(IActivityManager activityManager, String categoryId) {
ICategory category = activityManager.getCategory(categoryId);
if (!category.isDefined()) {
return Collections.emptySet();
@@ -378,8 +349,7 @@ public final class WorkbenchActivityHelper {
if (otherCategoryId.equals(categoryId)) {
continue;
}
- ICategory otherCategory = activityManager
- .getCategory(otherCategoryId);
+ ICategory otherCategory = activityManager.getCategory(otherCategoryId);
Set<?> otherCategoryActivityIds = expandActivityDependencies(getActivityIdsForCategory(otherCategory));
if (otherCategoryActivityIds.isEmpty()) {
@@ -390,8 +360,7 @@ public final class WorkbenchActivityHelper {
continue;
}
- if (activityManager.getEnabledActivityIds().containsAll(
- otherCategoryActivityIds)) {
+ if (activityManager.getEnabledActivityIds().containsAll(otherCategoryActivityIds)) {
otherDisabledCategories.add(otherCategoryId);
}
@@ -400,19 +369,16 @@ public final class WorkbenchActivityHelper {
}
/**
- * Return a list of category ids that are implicitly contained within the
- * given category.
+ * Return a list of category ids that are implicitly contained within the given
+ * category.
*
- * @param activityManager
- * the activity manager to test agaisnt
- * @param categoryId
- * the category to be enabled
+ * @param activityManager the activity manager to test agaisnt
+ * @param categoryId the category to be enabled
* @return a list of category ids that will become implicity enabled if the
* given category becomes enabled
* @since 3.1
*/
- public static Set<String> getContainedCategories(
- IActivityManager activityManager, String categoryId) {
+ public static Set<String> getContainedCategories(IActivityManager activityManager, String categoryId) {
ICategory category = activityManager.getCategory(categoryId);
if (!category.isDefined()) {
return Collections.emptySet();
@@ -426,8 +392,7 @@ public final class WorkbenchActivityHelper {
if (otherCategoryId.equals(categoryId)) {
continue;
}
- ICategory otherCategory = activityManager
- .getCategory(otherCategoryId);
+ ICategory otherCategory = activityManager.getCategory(otherCategoryId);
Set<?> otherCategoryActivityIds = expandActivityDependencies(getActivityIdsForCategory(otherCategory));
if (otherCategoryActivityIds.isEmpty()) {
@@ -444,11 +409,10 @@ public final class WorkbenchActivityHelper {
}
/**
- * Return the set of enabled categories. An enabled category is one in which
- * all contained activities are enabled.
+ * Return the set of enabled categories. An enabled category is one in which all
+ * contained activities are enabled.
*
- * @param activityManager
- * the activity manager to test against
+ * @param activityManager the activity manager to test against
* @return the set of enabled categories.
* @since 3.1
*/
@@ -467,13 +431,11 @@ public final class WorkbenchActivityHelper {
/**
* Return the set of partially enabled categories.
*
- * @param activityManager
- * the activity manager to test against
+ * @param activityManager the activity manager to test against
* @return the set of partially enabled categories
* @since 3.2
*/
- public static Set<String> getPartiallyEnabledCategories(
- IActivityManager activityManager) {
+ public static Set<String> getPartiallyEnabledCategories(IActivityManager activityManager) {
Set<String> definedCategoryIds = activityManager.getDefinedCategoryIds();
Set<String> partialCategories = new HashSet<>();
for (String categoryId : definedCategoryIds) {
@@ -486,19 +448,16 @@ public final class WorkbenchActivityHelper {
}
/**
- * Returns whether the given category is partially enabled. A partially
- * enabled category is one in which the number of enabled activites is both
- * non-zero and less than the total number of activities in the category.
+ * Returns whether the given category is partially enabled. A partially enabled
+ * category is one in which the number of enabled activites is both non-zero and
+ * less than the total number of activities in the category.
*
- * @param activityManager
- * the activity manager to test against
- * @param categoryId
- * the category id
+ * @param activityManager the activity manager to test against
+ * @param categoryId the category id
* @return whether the category is enabled
* @since 3.2
*/
- public static boolean isPartiallyEnabled(IActivityManager activityManager,
- String categoryId) {
+ public static boolean isPartiallyEnabled(IActivityManager activityManager, String categoryId) {
Set<String> activityIds = getActivityIdsForCategory(activityManager.getCategory(categoryId));
int foundCount = 0;
for (Object name : activityIds) {
@@ -514,10 +473,8 @@ public final class WorkbenchActivityHelper {
/**
* Return the number of enabled categories that this activity belongs to.
*
- * @param activityManager
- * the activity manager to test against *
- * @param activityId
- * the activity id to query on
+ * @param activityManager the activity manager to test against *
+ * @param activityId the activity id to query on
* @return the set of enabled category ids that this activity belongs to
* @since 3.1
*/
@@ -533,18 +490,15 @@ public final class WorkbenchActivityHelper {
}
/**
- * Returns whether the given category is enabled. A category is enabled if
- * all of its activities are enabled.
+ * Returns whether the given category is enabled. A category is enabled if all
+ * of its activities are enabled.
*
- * @param activityManager
- * the activity manager to test against
- * @param categoryId
- * the category id
+ * @param activityManager the activity manager to test against
+ * @param categoryId the category id
* @return whether the category is enabled
* @since 3.1
*/
- public static boolean isEnabled(IActivityManager activityManager,
- String categoryId) {
+ public static boolean isEnabled(IActivityManager activityManager, String categoryId) {
ICategory category = activityManager.getCategory(categoryId);
if (category.isDefined()) {
@@ -558,19 +512,15 @@ public final class WorkbenchActivityHelper {
}
/**
- * Resolve the collection of category ids to an array of
- * <code>ICategory</code> objects.
+ * Resolve the collection of category ids to an array of <code>ICategory</code>
+ * objects.
*
- * @param activityManager
- * the activity manager to test against
- * @param categoryIds
- * the category ids
- * @return the array of category ids resolved to <code>ICategory</code>
- * objects
+ * @param activityManager the activity manager to test against
+ * @param categoryIds the category ids
+ * @return the array of category ids resolved to <code>ICategory</code> objects
* @since 3.1
*/
- public static ICategory[] resolveCategories(
- IMutableActivityManager activityManager, Set<String> categoryIds) {
+ public static ICategory[] resolveCategories(IMutableActivityManager activityManager, Set<String> categoryIds) {
ICategory[] categories = new ICategory[categoryIds.size()];
String[] categoryIdArray = categoryIds.toArray(new String[categoryIds.size()]);
for (int i = 0; i < categoryIdArray.length; i++) {
@@ -584,7 +534,8 @@ public final class WorkbenchActivityHelper {
* argument that pass the {@link #restrictUseOf(Object)} test.
*
* @param toBeFiltered the input collection
- * @param result the collection to which objects passing the test should be added
+ * @param result the collection to which objects passing the test should
+ * be added
* @return the <code>result</code> collection for convenience
*
* @since 3.4
@@ -603,8 +554,7 @@ public final class WorkbenchActivityHelper {
* Returns an array with those objects of the argument array that pass the
* {@link #restrictUseOf(Object)} test.
*
- * @param array
- * the input array
+ * @param array the input array
* @return a new array of the same type as the argument array, containing
* objects that pass the test
*
@@ -617,8 +567,7 @@ public final class WorkbenchActivityHelper {
list.add(array[i]);
}
}
- return list.toArray((Object[]) Array.newInstance(array.getClass()
- .getComponentType(), list.size()));
+ return list.toArray((Object[]) Array.newInstance(array.getClass().getComponentType(), list.size()));
}
/**
@@ -626,7 +575,8 @@ public final class WorkbenchActivityHelper {
* argument that pass the {@link #filterItem(Object)} test.
*
* @param toBeFiltered the input collection
- * @param result the collection to which objects passing the test should be added
+ * @param result the collection to which objects passing the test should
+ * be added
* @return the <code>result</code> collection for convenience
*
* @since 3.4
@@ -645,8 +595,7 @@ public final class WorkbenchActivityHelper {
* Returns an array with those objects of the argument array that pass the
* {@link #filterItem(Object)} test.
*
- * @param array
- * the input array
+ * @param array the input array
* @return a new array of the same type as the argument array, containing
* objects that pass the test
*
@@ -659,8 +608,7 @@ public final class WorkbenchActivityHelper {
list.add(array[i]);
}
}
- return list.toArray((Object[]) Array.newInstance(array.getClass()
- .getComponentType(), list.size()));
+ return list.toArray((Object[]) Array.newInstance(array.getClass().getComponentType(), list.size()));
}
/**
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/WorkbenchTriggerPointAdvisor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/WorkbenchTriggerPointAdvisor.java
index de6c45ad7fc..3ddc5809274 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/WorkbenchTriggerPointAdvisor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/activities/WorkbenchTriggerPointAdvisor.java
@@ -43,18 +43,17 @@ import org.eclipse.ui.internal.util.Util;
* @see #NO_DETAILS
* @since 3.1
*/
-public class WorkbenchTriggerPointAdvisor implements ITriggerPointAdvisor,
- IExecutableExtension {
+public class WorkbenchTriggerPointAdvisor implements ITriggerPointAdvisor, IExecutableExtension {
/**
- * The string to be used when prompting to proceed with multiple activities.
- * Ie: "Enable the selected activities?"
+ * The string to be used when prompting to proceed with multiple activities. Ie:
+ * "Enable the selected activities?"
*/
public static String PROCEED_MULTI = "proceedMulti"; //$NON-NLS-1$
/**
- * The string to be used when prompting to proceed with a single activity.
- * Ie: "Enable the required activity?"
+ * The string to be used when prompting to proceed with a single activity. Ie:
+ * "Enable the required activity?"
*/
public static String PROCEED_SINGLE = "proceedSingle"; //$NON-NLS-1$
@@ -70,7 +69,6 @@ public class WorkbenchTriggerPointAdvisor implements ITriggerPointAdvisor,
*/
public static String NO_DETAILS = "noDetails"; //$NON-NLS-1$
-
private Properties strings = new Properties();
/**
@@ -84,8 +82,7 @@ public class WorkbenchTriggerPointAdvisor implements ITriggerPointAdvisor,
public Set<String> allow(ITriggerPoint triggerPoint, IIdentifier identifier) {
if (triggerPoint.getBooleanHint(ITriggerPoint.HINT_PRE_UI)) {
- IActivityManager activityManager = PlatformUI.getWorkbench()
- .getActivitySupport().getActivityManager();
+ IActivityManager activityManager = PlatformUI.getWorkbench().getActivitySupport().getActivityManager();
Iterator<String> iterator = identifier.getActivityIds().iterator();
while (iterator.hasNext()) {
String id = iterator.next();
@@ -103,29 +100,26 @@ public class WorkbenchTriggerPointAdvisor implements ITriggerPointAdvisor,
return Collections.EMPTY_SET;
}
- if (!PrefUtil.getInternalPreferenceStore().getBoolean(
- IPreferenceConstants.SHOULD_PROMPT_FOR_ENABLEMENT)) {
- return identifier.getActivityIds();
- }
+ if (!PrefUtil.getInternalPreferenceStore().getBoolean(IPreferenceConstants.SHOULD_PROMPT_FOR_ENABLEMENT)) {
+ return identifier.getActivityIds();
+ }
- //If it's a non-interactive point activate all activities
+ // If it's a non-interactive point activate all activities
if (!triggerPoint.getBooleanHint(ITriggerPoint.HINT_INTERACTIVE)) {
return identifier.getActivityIds();
}
- EnablementDialog dialog = new EnablementDialog(Util.getShellToParentOn(), identifier
- .getActivityIds(), strings);
- if (dialog.open() == Window.OK) {
+ EnablementDialog dialog = new EnablementDialog(Util.getShellToParentOn(), identifier.getActivityIds(), strings);
+ if (dialog.open() == Window.OK) {
Set<String> activities = dialog.getActivitiesToEnable();
- if (dialog.getDontAsk()) {
- PrefUtil.getInternalPreferenceStore().setValue(
- IPreferenceConstants.SHOULD_PROMPT_FOR_ENABLEMENT,
+ if (dialog.getDontAsk()) {
+ PrefUtil.getInternalPreferenceStore().setValue(IPreferenceConstants.SHOULD_PROMPT_FOR_ENABLEMENT,
false);
WorkbenchPlugin.getDefault().savePluginPreferences();
}
- return activities;
- }
+ return activities;
+ }
return null;
}
@@ -140,20 +134,17 @@ public class WorkbenchTriggerPointAdvisor implements ITriggerPointAdvisor,
/**
* This implementation of
* {@link ITriggerPointAdvisor#computeEnablement(IActivityManager, IIdentifier)}
- * calls
- * {@link #doComputeEnablement(IActivityManager, IIdentifier, boolean)} with
- * a boolean argument of <code>false</code>. Subclasses that wish to
+ * calls {@link #doComputeEnablement(IActivityManager, IIdentifier, boolean)}
+ * with a boolean argument of <code>false</code>. Subclasses that wish to
* disable identifiers if there is at least one disabled expression-based
* activity should override this method and call
- * {@link #doComputeEnablement(IActivityManager, IIdentifier, boolean)} with
- * a boolean argument of <code>true</code>.
+ * {@link #doComputeEnablement(IActivityManager, IIdentifier, boolean)} with a
+ * boolean argument of <code>true</code>.
*
* Subclasses may override.
*
- * @param activityManager
- * the activity manager
- * @param identifier
- * the identifier to update
+ * @param activityManager the activity manager
+ * @param identifier the identifier to update
*
* @return <code>true</code> if this identifier should be enabled,
* <code>false</code> otherwise
@@ -169,26 +160,25 @@ public class WorkbenchTriggerPointAdvisor implements ITriggerPointAdvisor,
/**
* Helper method for determining whether an identifier should be enabled.
- * Returns <code>true</code> if there is no applicable activity for the
- * given identifier. Otherwise, if the boolean argument <code>
- * disabledExpressionActivitiesTakePrecedence</code> is
- * <code>false</code>, returns true if any of the applicable activities
- * is enabled. If the boolean argument is <code>true</code>, this method
- * returns <code>false</code> if there is at least one disabled
- * expression-based activity; and it returns <code>true</code> if there
- * are no disabled expression-based activities and there is at least one
- * applicable activity that is enabled.
- * @param activityManager the activity manager
- * @param identifier
- * the identifier to update
+ * Returns <code>true</code> if there is no applicable activity for the given
+ * identifier. Otherwise, if the boolean argument <code>
+ * disabledExpressionActivitiesTakePrecedence</code> is <code>false</code>,
+ * returns true if any of the applicable activities is enabled. If the boolean
+ * argument is <code>true</code>, this method returns <code>false</code> if
+ * there is at least one disabled expression-based activity; and it returns
+ * <code>true</code> if there are no disabled expression-based activities and
+ * there is at least one applicable activity that is enabled.
+ *
+ * @param activityManager the activity manager
+ * @param identifier the identifier to update
* @param disabledExpressionActivitiesTakePrecedence
*
* @return <code>true</code> if this identifier should be enabled,
* <code>false</code> otherwise
* @since 3.4
*/
- protected boolean doComputeEnablement(IActivityManager activityManager,
- IIdentifier identifier, boolean disabledExpressionActivitiesTakePrecedence) {
+ protected boolean doComputeEnablement(IActivityManager activityManager, IIdentifier identifier,
+ boolean disabledExpressionActivitiesTakePrecedence) {
final Set<String> activityIds = identifier.getActivityIds();
if (activityIds.isEmpty()) {
return true;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/ActionBarAdvisor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/ActionBarAdvisor.java
index f76dc63030b..db48ee7d442 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/ActionBarAdvisor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/ActionBarAdvisor.java
@@ -55,153 +55,147 @@ import org.eclipse.ui.internal.handlers.IActionCommandMappingService;
*/
public class ActionBarAdvisor {
- /**
- * Bit flag for {@link #fillActionBars fillActionBars} indicating that the
- * operation is not filling the action bars of an actual workbench window,
- * but rather a proxy (used for perspective customization).
- */
- public static final int FILL_PROXY = 0x01;
-
- /**
- * Bit flag for {@link #fillActionBars fillActionBars} indicating that the
- * operation is supposed to fill (or describe) the workbench window's menu
- * bar.
- */
- public static final int FILL_MENU_BAR = 0x02;
+ /**
+ * Bit flag for {@link #fillActionBars fillActionBars} indicating that the
+ * operation is not filling the action bars of an actual workbench window, but
+ * rather a proxy (used for perspective customization).
+ */
+ public static final int FILL_PROXY = 0x01;
- /**
- * Bit flag for {@link #fillActionBars fillActionBars} indicating that the
- * operation is supposed to fill (or describe) the workbench window's cool
- * bar.
- */
- public static final int FILL_COOL_BAR = 0x04;
+ /**
+ * Bit flag for {@link #fillActionBars fillActionBars} indicating that the
+ * operation is supposed to fill (or describe) the workbench window's menu bar.
+ */
+ public static final int FILL_MENU_BAR = 0x02;
- /**
- * Bit flag for {@link #fillActionBars fillActionBars} indicating that the
- * operation is supposed to fill (or describe) the workbench window's status
- * line.
- */
- public static final int FILL_STATUS_LINE = 0x08;
+ /**
+ * Bit flag for {@link #fillActionBars fillActionBars} indicating that the
+ * operation is supposed to fill (or describe) the workbench window's cool bar.
+ */
+ public static final int FILL_COOL_BAR = 0x04;
+ /**
+ * Bit flag for {@link #fillActionBars fillActionBars} indicating that the
+ * operation is supposed to fill (or describe) the workbench window's status
+ * line.
+ */
+ public static final int FILL_STATUS_LINE = 0x08;
- private IActionBarConfigurer actionBarConfigurer;
+ private IActionBarConfigurer actionBarConfigurer;
- private Map actions = new HashMap();
+ private Map actions = new HashMap();
private boolean menuCreated;
- /**
- * Creates a new action bar advisor to configure a workbench
- * window's action bars via the given action bar configurer.
- *
- * @param configurer the action bar configurer
- */
- public ActionBarAdvisor(IActionBarConfigurer configurer) {
- Assert.isNotNull(configurer);
- actionBarConfigurer = configurer;
- }
+ /**
+ * Creates a new action bar advisor to configure a workbench window's action
+ * bars via the given action bar configurer.
+ *
+ * @param configurer the action bar configurer
+ */
+ public ActionBarAdvisor(IActionBarConfigurer configurer) {
+ Assert.isNotNull(configurer);
+ actionBarConfigurer = configurer;
+ }
- /**
- * Returns the action bar configurer.
- *
- * @return the action bar configurer
- */
- protected IActionBarConfigurer getActionBarConfigurer() {
- return actionBarConfigurer;
- }
+ /**
+ * Returns the action bar configurer.
+ *
+ * @return the action bar configurer
+ */
+ protected IActionBarConfigurer getActionBarConfigurer() {
+ return actionBarConfigurer;
+ }
- /**
- * Configures the action bars using the given action bar configurer.
- * Under normal circumstances, <code>flags</code> does not include
- * <code>FILL_PROXY</code>, meaning this is a request to fill the action
- * bars of the corresponding workbench window; the
- * remaining flags indicate which combination of
- * the menu bar (<code>FILL_MENU_BAR</code>),
- * the tool bar (<code>FILL_COOL_BAR</code>),
- * and the status line (<code>FILL_STATUS_LINE</code>) are to be filled.
- * <p>
- * If <code>flags</code> does include <code>FILL_PROXY</code>, then this
- * is a request to describe the actions bars of the given workbench window
- * (which will already have been filled);
- * again, the remaining flags indicate which combination of the menu bar,
- * the tool bar, and the status line are to be described.
- * The actions included in the proxy action bars can be the same instances
- * as in the actual window's action bars. Calling <code>ActionFactory</code>
- * to create new action instances is not recommended, because these
- * actions internally register listeners with the window and there is no
- * opportunity to dispose of these actions.
- * </p>
- * <p>
- * This method is called just after {@link WorkbenchWindowAdvisor#preWindowOpen()}.
- * Clients must not call this method directly (although super calls are okay).
- * The default implementation calls <code>makeActions</code> if
- * <code>FILL_PROXY</code> is specified, then calls <code>fillMenuBar</code>,
- * <code>fillCoolBar</code>, and <code>fillStatusLine</code>
- * if the corresponding flags are specified.
- * </p>
- * <p>
- * Subclasses may override, but it is recommended that they override the
- * methods mentioned above instead.
- * </p>
- *
- * @param flags bit mask composed from the constants
- * {@link #FILL_MENU_BAR FILL_MENU_BAR},
- * {@link #FILL_COOL_BAR FILL_COOL_BAR},
- * {@link #FILL_STATUS_LINE FILL_STATUS_LINE},
- * and {@link #FILL_PROXY FILL_PROXY}
- */
- public void fillActionBars(int flags) {
- if ((flags & FILL_PROXY) == 0) {
- makeActions(actionBarConfigurer.getWindowConfigurer().getWindow());
- }
- if ((flags & FILL_MENU_BAR) != 0) {
- fillMenuBar(actionBarConfigurer.getMenuManager());
+ /**
+ * Configures the action bars using the given action bar configurer. Under
+ * normal circumstances, <code>flags</code> does not include
+ * <code>FILL_PROXY</code>, meaning this is a request to fill the action bars of
+ * the corresponding workbench window; the remaining flags indicate which
+ * combination of the menu bar (<code>FILL_MENU_BAR</code>), the tool bar
+ * (<code>FILL_COOL_BAR</code>), and the status line
+ * (<code>FILL_STATUS_LINE</code>) are to be filled.
+ * <p>
+ * If <code>flags</code> does include <code>FILL_PROXY</code>, then this is a
+ * request to describe the actions bars of the given workbench window (which
+ * will already have been filled); again, the remaining flags indicate which
+ * combination of the menu bar, the tool bar, and the status line are to be
+ * described. The actions included in the proxy action bars can be the same
+ * instances as in the actual window's action bars. Calling
+ * <code>ActionFactory</code> to create new action instances is not recommended,
+ * because these actions internally register listeners with the window and there
+ * is no opportunity to dispose of these actions.
+ * </p>
+ * <p>
+ * This method is called just after
+ * {@link WorkbenchWindowAdvisor#preWindowOpen()}. Clients must not call this
+ * method directly (although super calls are okay). The default implementation
+ * calls <code>makeActions</code> if <code>FILL_PROXY</code> is specified, then
+ * calls <code>fillMenuBar</code>, <code>fillCoolBar</code>, and
+ * <code>fillStatusLine</code> if the corresponding flags are specified.
+ * </p>
+ * <p>
+ * Subclasses may override, but it is recommended that they override the methods
+ * mentioned above instead.
+ * </p>
+ *
+ * @param flags bit mask composed from the constants {@link #FILL_MENU_BAR
+ * FILL_MENU_BAR}, {@link #FILL_COOL_BAR FILL_COOL_BAR},
+ * {@link #FILL_STATUS_LINE FILL_STATUS_LINE}, and
+ * {@link #FILL_PROXY FILL_PROXY}
+ */
+ public void fillActionBars(int flags) {
+ if ((flags & FILL_PROXY) == 0) {
+ makeActions(actionBarConfigurer.getWindowConfigurer().getWindow());
+ }
+ if ((flags & FILL_MENU_BAR) != 0) {
+ fillMenuBar(actionBarConfigurer.getMenuManager());
menuCreated = true;
- }
- if ((flags & FILL_COOL_BAR) != 0) {
- fillCoolBar(actionBarConfigurer.getCoolBarManager());
- }
- if ((flags & FILL_STATUS_LINE) != 0) {
- fillStatusLine(actionBarConfigurer.getStatusLineManager());
- }
- }
+ }
+ if ((flags & FILL_COOL_BAR) != 0) {
+ fillCoolBar(actionBarConfigurer.getCoolBarManager());
+ }
+ if ((flags & FILL_STATUS_LINE) != 0) {
+ fillStatusLine(actionBarConfigurer.getStatusLineManager());
+ }
+ }
- /**
- * Instantiates the actions used in the fill methods.
- * Use {@link #register(IAction)} to register the action with the key binding service
- * and add it to the list of actions to be disposed when the window is closed.
- *
- * @param window the window containing the action bars
- */
- protected void makeActions(IWorkbenchWindow window) {
- // do nothing
- }
+ /**
+ * Instantiates the actions used in the fill methods. Use
+ * {@link #register(IAction)} to register the action with the key binding
+ * service and add it to the list of actions to be disposed when the window is
+ * closed.
+ *
+ * @param window the window containing the action bars
+ */
+ protected void makeActions(IWorkbenchWindow window) {
+ // do nothing
+ }
- /**
- * Registers the given action with the key binding service
- * (by calling {@link IActionBarConfigurer#registerGlobalAction(IAction)}),
- * and adds it to the list of actions to be disposed when the window is closed.
- * <p>
- * In order to participate in key bindings, the action must have an action
- * definition id (aka command id), and a corresponding command extension.
- * See the <code>org.eclipse.ui.commands</code> extension point documentation
- * for more details.
- * </p>
- *
- * @param action the action to register, this cannot be <code>null</code>
- *
- * @see IAction#setActionDefinitionId(String)
- * @see #disposeAction(IAction)
- */
- protected void register(IAction action) {
- Assert.isNotNull(action, "Action must not be null"); //$NON-NLS-1$
- String id = action.getId();
- Assert.isNotNull(id, "Action must not have null id"); //$NON-NLS-1$
+ /**
+ * Registers the given action with the key binding service (by calling
+ * {@link IActionBarConfigurer#registerGlobalAction(IAction)}), and adds it to
+ * the list of actions to be disposed when the window is closed.
+ * <p>
+ * In order to participate in key bindings, the action must have an action
+ * definition id (aka command id), and a corresponding command extension. See
+ * the <code>org.eclipse.ui.commands</code> extension point documentation for
+ * more details.
+ * </p>
+ *
+ * @param action the action to register, this cannot be <code>null</code>
+ *
+ * @see IAction#setActionDefinitionId(String)
+ * @see #disposeAction(IAction)
+ */
+ protected void register(IAction action) {
+ Assert.isNotNull(action, "Action must not be null"); //$NON-NLS-1$
+ String id = action.getId();
+ Assert.isNotNull(id, "Action must not have null id"); //$NON-NLS-1$
if (action instanceof RetargetAction) {
String definitionId = action.getActionDefinitionId();
if (definitionId != null) {
- IActionCommandMappingService mapping = getActionBarConfigurer()
- .getWindowConfigurer().getWindow()
+ IActionCommandMappingService mapping = getActionBarConfigurer().getWindowConfigurer().getWindow()
.getService(IActionCommandMappingService.class);
if (mapping != null) {
mapping.map(id, definitionId);
@@ -211,78 +205,74 @@ public class ActionBarAdvisor {
getActionBarConfigurer().registerGlobalAction(action);
}
actions.put(id, action);
- }
+ }
- /**
- * Returns the action with the given id, or <code>null</code> if not found.
- *
- * @param id the action id
- * @return the action with the given id, or <code>null</code> if not found
- * @see IAction#getId()
- */
- protected IAction getAction(String id) {
- return (IAction) actions.get(id);
- }
+ /**
+ * Returns the action with the given id, or <code>null</code> if not found.
+ *
+ * @param id the action id
+ * @return the action with the given id, or <code>null</code> if not found
+ * @see IAction#getId()
+ */
+ protected IAction getAction(String id) {
+ return (IAction) actions.get(id);
+ }
- /**
- * Fills the menu bar with the main menus for the window.
- * <p>
- * The default implementation does nothing.
- * Subclasses may override.
- * </p>
- *
- * @param menuBar the menu manager for the menu bar
- */
- protected void fillMenuBar(IMenuManager menuBar) {
- // do nothing
- }
+ /**
+ * Fills the menu bar with the main menus for the window.
+ * <p>
+ * The default implementation does nothing. Subclasses may override.
+ * </p>
+ *
+ * @param menuBar the menu manager for the menu bar
+ */
+ protected void fillMenuBar(IMenuManager menuBar) {
+ // do nothing
+ }
- /**
- * Fills the cool bar with the main toolbars for the window.
- * <p>
- * The default implementation does nothing.
- * Subclasses may override.
- * </p>
- *
- * @param coolBar the cool bar manager
- */
- protected void fillCoolBar(ICoolBarManager coolBar) {
- // do nothing
- }
+ /**
+ * Fills the cool bar with the main toolbars for the window.
+ * <p>
+ * The default implementation does nothing. Subclasses may override.
+ * </p>
+ *
+ * @param coolBar the cool bar manager
+ */
+ protected void fillCoolBar(ICoolBarManager coolBar) {
+ // do nothing
+ }
- /**
- * Fills the status line with the main status line contributions
- * for the window.
- * <p>
- * The default implementation does nothing.
- * Subclasses may override.
- * </p>
- *
- * @param statusLine the status line manager
- */
- protected void fillStatusLine(IStatusLineManager statusLine) {
- // do nothing
- }
+ /**
+ * Fills the status line with the main status line contributions for the window.
+ * <p>
+ * The default implementation does nothing. Subclasses may override.
+ * </p>
+ *
+ * @param statusLine the status line manager
+ */
+ protected void fillStatusLine(IStatusLineManager statusLine) {
+ // do nothing
+ }
- /**
- * Returns whether the menu with the given id is an application menu of the
- * given window. This is used during OLE "in place" editing. Application
- * menus should be preserved during menu merging. All other menus may be
- * removed from the window.
- * <p>
- * The default implementation returns false. Subclasses may override.
- * </p>
- *
- * @param menuId the menu id
- * @return <code>true</code> for application menus, and <code>false</code>
- * for part-specific menus
- */
- public boolean isApplicationMenu(String menuId) {
- // default: not an application menu
- return false;
- }
+ /**
+ * Returns whether the menu with the given id is an application menu of the
+ * given window. This is used during OLE "in place" editing. Application menus
+ * should be preserved during menu merging. All other menus may be removed from
+ * the window.
+ * <p>
+ * The default implementation returns false. Subclasses may override.
+ * </p>
+ *
+ * @param menuId the menu id
+ * @return <code>true</code> for application menus, and <code>false</code> for
+ * part-specific menus
+ */
+ public boolean isApplicationMenu(String menuId) {
+ // default: not an application menu
+ return false;
+ }
- /**
+ /**
* Disposes this action bar advisor. Called when the window is being closed.
* This should dispose any allocated resources and remove any added listeners.
* <p>
@@ -290,53 +280,52 @@ public class ActionBarAdvisor {
* menu manager. Subclasses may extend.
* </p>
*/
- public void dispose() {
- if (menuCreated) {
+ public void dispose() {
+ if (menuCreated) {
IMenuManager menuManager = actionBarConfigurer.getMenuManager();
if (menuManager != null) {
// dispose menu asynchronously to avoid "jumping" UI elements
PlatformUI.getWorkbench().getDisplay().asyncExec(menuManager::dispose);
}
- }
- disposeActions();
- }
+ }
+ disposeActions();
+ }
- /**
- * Disposes all actions added via <code>register(IAction)</code>
- * using <code>disposeAction(IAction)</code>.
- */
- protected void disposeActions() {
- for (Iterator i = actions.values().iterator(); i.hasNext();) {
- IAction action = (IAction) i.next();
- disposeAction(action);
- }
- actions.clear();
- }
+ /**
+ * Disposes all actions added via <code>register(IAction)</code> using
+ * <code>disposeAction(IAction)</code>.
+ */
+ protected void disposeActions() {
+ for (Iterator i = actions.values().iterator(); i.hasNext();) {
+ IAction action = (IAction) i.next();
+ disposeAction(action);
+ }
+ actions.clear();
+ }
- /**
- * Disposes the given action.
- * <p>
- * The default implementation checks whether the action is an instance
- * of <code>ActionFactory.IWorkbenchAction</code> and calls its
- * <code>dispose()</code> method if so.
- * Subclasses may extend.
- * </p>
- *
- * @param action the action to dispose
- */
- protected void disposeAction(IAction action) {
- if (action instanceof ActionFactory.IWorkbenchAction) {
- ((ActionFactory.IWorkbenchAction) action).dispose();
- }
- }
+ /**
+ * Disposes the given action.
+ * <p>
+ * The default implementation checks whether the action is an instance of
+ * <code>ActionFactory.IWorkbenchAction</code> and calls its
+ * <code>dispose()</code> method if so. Subclasses may extend.
+ * </p>
+ *
+ * @param action the action to dispose
+ */
+ protected void disposeAction(IAction action) {
+ if (action instanceof ActionFactory.IWorkbenchAction) {
+ ((ActionFactory.IWorkbenchAction) action).dispose();
+ }
+ }
/**
- * Saves arbitrary application-specific state information
- * for this action bar advisor.
- * <p>
- * The default implementation simply returns an OK status.
- * Subclasses may extend or override.
- * </p>
+ * Saves arbitrary application-specific state information for this action bar
+ * advisor.
+ * <p>
+ * The default implementation simply returns an OK status. Subclasses may extend
+ * or override.
+ * </p>
*
* @param memento the memento in which to save the advisor's state
* @return a status object indicating whether the save was successful
@@ -347,14 +336,14 @@ public class ActionBarAdvisor {
}
/**
- * Restores arbitrary application-specific state information
- * for this action bar advisor.
- * <p>
- * The default implementation simply returns an OK status.
- * Subclasses may extend or override.
- * </p>
+ * Restores arbitrary application-specific state information for this action bar
+ * advisor.
+ * <p>
+ * The default implementation simply returns an OK status. Subclasses may extend
+ * or override.
+ * </p>
*
- * @param memento the memento from which to restore the advisor's state
+ * @param memento the memento from which to restore the advisor's state
* @return a status object indicating whether the restore was successful
* @since 3.1
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/DisplayAccess.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/DisplayAccess.java
index 09cd7e18554..82e1cdc6433 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/DisplayAccess.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/DisplayAccess.java
@@ -26,21 +26,20 @@ public final class DisplayAccess {
/**
* <p>
- * This method allows threads spawned early in the workbench startup process
- * to access the Display via the
+ * This method allows threads spawned early in the workbench startup process to
+ * access the Display via the
* {@link org.eclipse.swt.widgets.Display#asyncExec(Runnable)} and
- * {@link org.eclipse.swt.widgets.Display#syncExec(Runnable)} methods.
- * Without invoking this method from a given thread subsequent calls to the
- * above Display methods will behave as follows:
+ * {@link org.eclipse.swt.widgets.Display#syncExec(Runnable)} methods. Without
+ * invoking this method from a given thread subsequent calls to the above
+ * Display methods will behave as follows:
* </p>
*
* <ul>
* <li>runnables posted to
* {@link org.eclipse.swt.widgets.Display#asyncExec(Runnable)} will not be
* invoked until after the Workbench is fully restored.</li>
- * <li>calls made to
- * {@link org.eclipse.swt.widgets.Display#syncExec(Runnable)} will block
- * until the Workbench is fully restored.</li>
+ * <li>calls made to {@link org.eclipse.swt.widgets.Display#syncExec(Runnable)}
+ * will block until the Workbench is fully restored.</li>
* </ul>
*
* <p>
@@ -50,17 +49,17 @@ public final class DisplayAccess {
* </p>
*
* <p>
- * It is recommended that this method be used from ALL threads that touch
- * the display during the startup process, even those that may have been
- * created in the main application class.
+ * It is recommended that this method be used from ALL threads that touch the
+ * display during the startup process, even those that may have been created in
+ * the main application class.
* </p>
*
* <p>
* This method has no effect after the workbench has been restored.
* </p>
*
- * @throws IllegalStateException
- * thrown if invoked from a thread created by the workbench.
+ * @throws IllegalStateException thrown if invoked from a thread created by the
+ * workbench.
*/
public static void accessDisplayDuringStartup() {
UISynchronizer.overrideThread.set(Boolean.TRUE);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/IActionBarConfigurer.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/IActionBarConfigurer.java
index af16a87e946..348bb861f91 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/IActionBarConfigurer.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/IActionBarConfigurer.java
@@ -19,11 +19,11 @@ import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IStatusLineManager;
/**
- * Interface providing special access for configuring the action bars
- * of a workbench window.
+ * Interface providing special access for configuring the action bars of a
+ * workbench window.
* <p>
- * Note that these objects are only available to the main application
- * (the plug-in that creates and owns the workbench).
+ * Note that these objects are only available to the main application (the
+ * plug-in that creates and owns the workbench).
* </p>
* <p>
* This interface is not intended to be implemented by clients.
@@ -35,51 +35,47 @@ import org.eclipse.jface.action.IStatusLineManager;
*/
public interface IActionBarConfigurer {
- /**
- * Returns the workbench window configurer for the window
- * containing this configurer's action bars.
- *
- * @return the workbench window configurer
- * @since 3.1
- */
- IWorkbenchWindowConfigurer getWindowConfigurer();
+ /**
+ * Returns the workbench window configurer for the window containing this
+ * configurer's action bars.
+ *
+ * @return the workbench window configurer
+ * @since 3.1
+ */
+ IWorkbenchWindowConfigurer getWindowConfigurer();
+ /**
+ * Returns the menu manager for the main menu bar of a workbench window.
+ *
+ * @return the menu manager
+ */
+ IMenuManager getMenuManager();
- /**
- * Returns the menu manager for the main menu bar of a workbench window.
- *
- * @return the menu manager
- */
- IMenuManager getMenuManager();
+ /**
+ * Returns the status line manager of a workbench window.
+ *
+ * @return the status line manager
+ */
+ IStatusLineManager getStatusLineManager();
- /**
- * Returns the status line manager of a workbench window.
- *
- * @return the status line manager
- */
- IStatusLineManager getStatusLineManager();
+ /**
+ * Returns the cool bar manager of the workbench window.
+ *
+ * @return the cool bar manager
+ */
+ ICoolBarManager getCoolBarManager();
- /**
- * Returns the cool bar manager of the workbench window.
- *
- * @return the cool bar manager
- */
- ICoolBarManager getCoolBarManager();
-
- /**
- * Register the action as a global action with a workbench
- * window.
- * <p>
- * For a workbench retarget action
- * ({@link org.eclipse.ui.actions.RetargetAction RetargetAction})
- * to work, it must be registered.
- * You should also register actions that will participate
- * in custom key bindings.
- * </p>
- *
- * @param action the global action
- * @see org.eclipse.ui.actions.RetargetAction
- */
- void registerGlobalAction(IAction action);
+ /**
+ * Register the action as a global action with a workbench window.
+ * <p>
+ * For a workbench retarget action ({@link org.eclipse.ui.actions.RetargetAction
+ * RetargetAction}) to work, it must be registered. You should also register
+ * actions that will participate in custom key bindings.
+ * </p>
+ *
+ * @param action the global action
+ * @see org.eclipse.ui.actions.RetargetAction
+ */
+ void registerGlobalAction(IAction action);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/IWorkbenchConfigurer.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/IWorkbenchConfigurer.java
index b6947dbd48a..b0d1ddb05ba 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/IWorkbenchConfigurer.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/IWorkbenchConfigurer.java
@@ -26,8 +26,8 @@ import org.eclipse.ui.WorkbenchException;
/**
* Interface providing special access for configuring the workbench.
* <p>
- * Note that these objects are only available to the main application
- * (the plug-in that creates and owns the workbench).
+ * Note that these objects are only available to the main application (the
+ * plug-in that creates and owns the workbench).
* </p>
* <p>
* This interface is not intended to be implemented by clients.
@@ -39,50 +39,48 @@ import org.eclipse.ui.WorkbenchException;
*/
public interface IWorkbenchConfigurer {
- /**
- * Restore status code indicating that the saved state
- * could not be restored, but that startup should continue
- * with a reset state.
- *
- * @see #restoreState
- */
- int RESTORE_CODE_RESET = 1;
+ /**
+ * Restore status code indicating that the saved state could not be restored,
+ * but that startup should continue with a reset state.
+ *
+ * @see #restoreState
+ */
+ int RESTORE_CODE_RESET = 1;
- /**
- * Restore status code indicating that the saved state
- * could not be restored, and that the application
- * must exit immediately without modifying any previously
- * saved workbench state.
- */
- int RESTORE_CODE_EXIT = 2;
+ /**
+ * Restore status code indicating that the saved state could not be restored,
+ * and that the application must exit immediately without modifying any
+ * previously saved workbench state.
+ */
+ int RESTORE_CODE_EXIT = 2;
- /**
- * Returns the underlying workbench.
- *
- * @return the workbench
- */
- IWorkbench getWorkbench();
+ /**
+ * Returns the underlying workbench.
+ *
+ * @return the workbench
+ */
+ IWorkbench getWorkbench();
- /**
- * Returns whether the workbench state should be saved on close and
- * restored on subsequent open.
- * <p>
- * The initial value is <code>false</code>.
- * </p>
- *
- * @return <code>true</code> to save and restore workbench state, or
- * <code>false</code> to forget current workbench state on close.
- */
- boolean getSaveAndRestore();
+ /**
+ * Returns whether the workbench state should be saved on close and restored on
+ * subsequent open.
+ * <p>
+ * The initial value is <code>false</code>.
+ * </p>
+ *
+ * @return <code>true</code> to save and restore workbench state, or
+ * <code>false</code> to forget current workbench state on close.
+ */
+ boolean getSaveAndRestore();
- /**
- * Sets whether the workbench state should be saved on close and
- * restored on subsequent open.
- *
- * @param enabled <code>true</code> to save and restore workbench state, or
- * <code>false</code> to forget current workbench state on close.
- */
- void setSaveAndRestore(boolean enabled);
+ /**
+ * Sets whether the workbench state should be saved on close and restored on
+ * subsequent open.
+ *
+ * @param enabled <code>true</code> to save and restore workbench state, or
+ * <code>false</code> to forget current workbench state on close.
+ */
+ void setSaveAndRestore(boolean enabled);
/**
* Restores a workbench window from the given memento.
@@ -90,135 +88,127 @@ public interface IWorkbenchConfigurer {
* @param memento the memento from which to restore the window's state
* @return the configurer for the restored window
* @throws WorkbenchException if an error occurred during the restore
- * @see IWorkbenchWindowConfigurer#saveState(IMemento)
+ * @see IWorkbenchWindowConfigurer#saveState(IMemento)
* @since 3.1
*/
- IWorkbenchWindowConfigurer restoreWorkbenchWindow(IMemento memento)
- throws WorkbenchException;
+ IWorkbenchWindowConfigurer restoreWorkbenchWindow(IMemento memento) throws WorkbenchException;
- /**
- * Returns the workbench window manager.
- *
- * @return the workbench window manager
- *
- * Note:IWorkbenchWindow is implemented using JFace's Window (and therefore uses WindowManager),
- * but this is an implementation detail
- */
- WindowManager getWorkbenchWindowManager();
+ /**
+ * Returns the workbench window manager.
+ *
+ * @return the workbench window manager
+ *
+ * Note:IWorkbenchWindow is implemented using JFace's Window (and
+ * therefore uses WindowManager), but this is an implementation detail
+ */
+ WindowManager getWorkbenchWindowManager();
- /**
- * Declares a workbench image.
- * <p>
- * The workbench remembers the given image descriptor under the given name,
- * and makes the image available to plug-ins via
- * {@link IWorkbench#getSharedImages() IWorkbench.getSharedImages()}.
- * For "shared" images, the workbench remembers the image descriptor and
- * will manages the image object create from it; clients retrieve "shared"
- * images via
- * {@link org.eclipse.ui.ISharedImages#getImage ISharedImages.getImage()}.
- * For the other, "non-shared" images, the workbench remembers only the
- * image descriptor; clients retrieve the image descriptor via
- * {@link org.eclipse.ui.ISharedImages#getImageDescriptor
- * ISharedImages.getImageDescriptor()} and are entirely
- * responsible for managing the image objects they create from it.
- * (This is made confusing by the historical fact that the API interface
- * is called "ISharedImages".)
- * </p>
- *
- * @param symbolicName the symbolic name of the image
- * @param descriptor the image descriptor
- * @param shared <code>true</code> if this is a shared image, and
- * <code>false</code> if this is not a shared image
- * @see org.eclipse.ui.ISharedImages#getImage
- * @see org.eclipse.ui.ISharedImages#getImageDescriptor
- */
- void declareImage(String symbolicName, ImageDescriptor descriptor,
- boolean shared);
+ /**
+ * Declares a workbench image.
+ * <p>
+ * The workbench remembers the given image descriptor under the given name, and
+ * makes the image available to plug-ins via {@link IWorkbench#getSharedImages()
+ * IWorkbench.getSharedImages()}. For "shared" images, the workbench remembers
+ * the image descriptor and will manages the image object create from it;
+ * clients retrieve "shared" images via
+ * {@link org.eclipse.ui.ISharedImages#getImage ISharedImages.getImage()}. For
+ * the other, "non-shared" images, the workbench remembers only the image
+ * descriptor; clients retrieve the image descriptor via
+ * {@link org.eclipse.ui.ISharedImages#getImageDescriptor
+ * ISharedImages.getImageDescriptor()} and are entirely responsible for managing
+ * the image objects they create from it. (This is made confusing by the
+ * historical fact that the API interface is called "ISharedImages".)
+ * </p>
+ *
+ * @param symbolicName the symbolic name of the image
+ * @param descriptor the image descriptor
+ * @param shared <code>true</code> if this is a shared image, and
+ * <code>false</code> if this is not a shared image
+ * @see org.eclipse.ui.ISharedImages#getImage
+ * @see org.eclipse.ui.ISharedImages#getImageDescriptor
+ */
+ void declareImage(String symbolicName, ImageDescriptor descriptor, boolean shared);
- /**
- * Forces the workbench to close due to an emergency. This method should
- * only be called when the workbench is in dire straights and cannot
- * continue, and cannot even risk a normal workbench close (think "out of
- * memory" or "unable to create shell"). When this method is called, an
- * abbreviated workbench shutdown sequence is performed (less critical
- * steps may be skipped). The workbench advisor is still called; however,
- * it must not attempt to communicate with the user. While an emergency
- * close is in progress, <code>emergencyClosing</code> returns
- * <code>true</code>. Workbench advisor methods should always check this
- * flag before communicating with the user.
- *
- * @see #emergencyClosing
- */
- void emergencyClose();
+ /**
+ * Forces the workbench to close due to an emergency. This method should only be
+ * called when the workbench is in dire straights and cannot continue, and
+ * cannot even risk a normal workbench close (think "out of memory" or "unable
+ * to create shell"). When this method is called, an abbreviated workbench
+ * shutdown sequence is performed (less critical steps may be skipped). The
+ * workbench advisor is still called; however, it must not attempt to
+ * communicate with the user. While an emergency close is in progress,
+ * <code>emergencyClosing</code> returns <code>true</code>. Workbench advisor
+ * methods should always check this flag before communicating with the user.
+ *
+ * @see #emergencyClosing
+ */
+ void emergencyClose();
- /**
- * Returns whether the workbench is being closed due to an emergency.
- * When this method returns <code>true</code>, the workbench is in dire
- * straights and cannot continue. Indeed, things are so bad that we cannot
- * even risk a normal workbench close. Workbench advisor methods should
- * always check this flag before attempting to communicate with the user.
- *
- * @return <code>true</code> if the workbench is in the process of being
- * closed under emergency conditions, and <code>false</code> otherwise
- */
- boolean emergencyClosing();
+ /**
+ * Returns whether the workbench is being closed due to an emergency. When this
+ * method returns <code>true</code>, the workbench is in dire straights and
+ * cannot continue. Indeed, things are so bad that we cannot even risk a normal
+ * workbench close. Workbench advisor methods should always check this flag
+ * before attempting to communicate with the user.
+ *
+ * @return <code>true</code> if the workbench is in the process of being closed
+ * under emergency conditions, and <code>false</code> otherwise
+ */
+ boolean emergencyClosing();
- /**
- * Returns an object that can be used to configure the given window.
- *
- * @param window a workbench window
- * @return a workbench window configurer
- */
- IWorkbenchWindowConfigurer getWindowConfigurer(
- IWorkbenchWindow window);
+ /**
+ * Returns an object that can be used to configure the given window.
+ *
+ * @param window a workbench window
+ * @return a workbench window configurer
+ */
+ IWorkbenchWindowConfigurer getWindowConfigurer(IWorkbenchWindow window);
- /**
- * Returns the data associated with the workbench at the given key.
- *
- * @param key the key
- * @return the data, or <code>null</code> if there is no data at the given
- * key
- */
- Object getData(String key);
+ /**
+ * Returns the data associated with the workbench at the given key.
+ *
+ * @param key the key
+ * @return the data, or <code>null</code> if there is no data at the given key
+ */
+ Object getData(String key);
- /**
- * Sets the data associated with the workbench at the given key.
- *
- * @param key the key
- * @param data the data, or <code>null</code> to delete existing data
- */
- void setData(String key, Object data);
+ /**
+ * Sets the data associated with the workbench at the given key.
+ *
+ * @param key the key
+ * @param data the data, or <code>null</code> to delete existing data
+ */
+ void setData(String key, Object data);
- /**
- * Restores the workbench state saved from the previous session, if any.
- * This includes any open windows and their open perspectives, open views
- * and editors, layout information, and any customizations to the open
- * perspectives.
- * <p>
- * This is typically called from the advisor's <code>openWindows()</code>
- * method.
- * </p>
- *
- * @return a status object indicating whether the restore was successful
- * @see #RESTORE_CODE_RESET
- * @see #RESTORE_CODE_EXIT
- * @see WorkbenchAdvisor#openWindows
- */
- IStatus restoreState();
+ /**
+ * Restores the workbench state saved from the previous session, if any. This
+ * includes any open windows and their open perspectives, open views and
+ * editors, layout information, and any customizations to the open perspectives.
+ * <p>
+ * This is typically called from the advisor's <code>openWindows()</code>
+ * method.
+ * </p>
+ *
+ * @return a status object indicating whether the restore was successful
+ * @see #RESTORE_CODE_RESET
+ * @see #RESTORE_CODE_EXIT
+ * @see WorkbenchAdvisor#openWindows
+ */
+ IStatus restoreState();
- /**
- * Opens the first time window, using the default perspective and
- * default page input.
- * <p>
- * This is typically called from the advisor's <code>openWindows()</code>
- * method.
- * </p>
- *
- * @see WorkbenchAdvisor#openWindows
- */
- void openFirstTimeWindow();
+ /**
+ * Opens the first time window, using the default perspective and default page
+ * input.
+ * <p>
+ * This is typically called from the advisor's <code>openWindows()</code>
+ * method.
+ * </p>
+ *
+ * @see WorkbenchAdvisor#openWindows
+ */
+ void openFirstTimeWindow();
- /**
+ /**
* Returns <code>true</code> if the workbench should exit when the last window
* is closed, <code>false</code> if the window should just be closed, leaving
* the workbench (and its event loop) running.
@@ -243,9 +233,9 @@ public interface IWorkbenchConfigurer {
* closed, <code>false</code> if the window should just be closed
* @since 3.1
*/
- boolean getExitOnLastWindowClose();
+ boolean getExitOnLastWindowClose();
- /**
+ /**
* Sets whether the workbench should exit when the last window is closed, or
* whether the window should just be closed, leaving the workbench (and its
* event loop) running.
@@ -253,11 +243,10 @@ public interface IWorkbenchConfigurer {
* For more details, see {@link #getExitOnLastWindowClose()}.
* </p>
*
- * @param enabled
- * <code>true</code> if the workbench should exit when the last
- * window is closed, <code>false</code> if the window should
- * just be closed
+ * @param enabled <code>true</code> if the workbench should exit when the last
+ * window is closed, <code>false</code> if the window should just
+ * be closed
* @since 3.1
*/
- void setExitOnLastWindowClose(boolean enabled);
+ void setExitOnLastWindowClose(boolean enabled);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/IWorkbenchWindowConfigurer.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/IWorkbenchWindowConfigurer.java
index 6089823a84d..27bde9ae680 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/IWorkbenchWindowConfigurer.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/IWorkbenchWindowConfigurer.java
@@ -29,12 +29,12 @@ import org.eclipse.ui.IWorkbenchWindow;
* Interface providing special access for configuring workbench windows.
* <p>
* Window configurer objects are in 1-1 correspondence with the workbench
- * windows they configure. Clients may use <code>get/setData</code> to
- * associate arbitrary state with the window configurer object.
+ * windows they configure. Clients may use <code>get/setData</code> to associate
+ * arbitrary state with the window configurer object.
* </p>
* <p>
- * Note that these objects are only available to the main application
- * (the plug-in that creates and owns the workbench).
+ * Note that these objects are only available to the main application (the
+ * plug-in that creates and owns the workbench).
* </p>
* <p>
* This interface is not intended to be implemented by clients.
@@ -46,121 +46,120 @@ import org.eclipse.ui.IWorkbenchWindow;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IWorkbenchWindowConfigurer {
- /**
- * Returns the underlying workbench window.
- *
- * @return the workbench window
- */
- IWorkbenchWindow getWindow();
+ /**
+ * Returns the underlying workbench window.
+ *
+ * @return the workbench window
+ */
+ IWorkbenchWindow getWindow();
- /**
- * Returns the workbench configurer.
- *
- * @return the workbench configurer
- */
- IWorkbenchConfigurer getWorkbenchConfigurer();
+ /**
+ * Returns the workbench configurer.
+ *
+ * @return the workbench configurer
+ */
+ IWorkbenchConfigurer getWorkbenchConfigurer();
- /**
- * Returns the action bar configurer for this workbench
- * window.
- *
- * @return the action bar configurer
- */
- IActionBarConfigurer getActionBarConfigurer();
+ /**
+ * Returns the action bar configurer for this workbench window.
+ *
+ * @return the action bar configurer
+ */
+ IActionBarConfigurer getActionBarConfigurer();
- /**
- * Returns the title of the underlying workbench window.
- *
- * @return the window title
- */
- String getTitle();
+ /**
+ * Returns the title of the underlying workbench window.
+ *
+ * @return the window title
+ */
+ String getTitle();
- /**
- * Sets the title of the underlying workbench window.
- *
- * @param title the window title
- */
- void setTitle(String title);
+ /**
+ * Sets the title of the underlying workbench window.
+ *
+ * @param title the window title
+ */
+ void setTitle(String title);
- /**
- * Returns whether the underlying workbench window has a menu bar.
- * <p>
- * The initial value is <code>true</code>.
- * </p>
- *
- * @return <code>true</code> for a menu bar, and <code>false</code>
- * for no menu bar
- */
- boolean getShowMenuBar();
+ /**
+ * Returns whether the underlying workbench window has a menu bar.
+ * <p>
+ * The initial value is <code>true</code>.
+ * </p>
+ *
+ * @return <code>true</code> for a menu bar, and <code>false</code> for no menu
+ * bar
+ */
+ boolean getShowMenuBar();
- /**
- * Sets whether the underlying workbench window has a menu bar.
- *
- * @param show <code>true</code> for a menu bar, and <code>false</code>
- * for no menu bar
- */
- void setShowMenuBar(boolean show);
+ /**
+ * Sets whether the underlying workbench window has a menu bar.
+ *
+ * @param show <code>true</code> for a menu bar, and <code>false</code> for no
+ * menu bar
+ */
+ void setShowMenuBar(boolean show);
- /**
- * Returns whether the underlying workbench window has a cool bar.
- * <p>
- * The initial value is <code>true</code>.
- * </p>
- *
- * @return <code>true</code> for a cool bar, and <code>false</code>
- * for no cool bar
- */
- boolean getShowCoolBar();
+ /**
+ * Returns whether the underlying workbench window has a cool bar.
+ * <p>
+ * The initial value is <code>true</code>.
+ * </p>
+ *
+ * @return <code>true</code> for a cool bar, and <code>false</code> for no cool
+ * bar
+ */
+ boolean getShowCoolBar();
- /**
- * Sets whether the underlying workbench window has a cool bar.
- *
- * @param show <code>true</code> for a cool bar, and <code>false</code>
- * for no cool bar
- */
- void setShowCoolBar(boolean show);
+ /**
+ * Sets whether the underlying workbench window has a cool bar.
+ *
+ * @param show <code>true</code> for a cool bar, and <code>false</code> for no
+ * cool bar
+ */
+ void setShowCoolBar(boolean show);
- /**
- * Returns whether the underlying workbench window has a status line.
- * <p>
- * The initial value is <code>true</code>.
- * </p>
- *
- * @return <code>true</code> for a status line, and <code>false</code>
- * for no status line
- */
- boolean getShowStatusLine();
+ /**
+ * Returns whether the underlying workbench window has a status line.
+ * <p>
+ * The initial value is <code>true</code>.
+ * </p>
+ *
+ * @return <code>true</code> for a status line, and <code>false</code> for no
+ * status line
+ */
+ boolean getShowStatusLine();
- /**
- * Sets whether the underlying workbench window has a status line.
- *
- * @param show <code>true</code> for a status line, and <code>false</code>
- * for no status line
- */
- void setShowStatusLine(boolean show);
+ /**
+ * Sets whether the underlying workbench window has a status line.
+ *
+ * @param show <code>true</code> for a status line, and <code>false</code> for
+ * no status line
+ */
+ void setShowStatusLine(boolean show);
- /**
- * Returns whether the underlying workbench window has a perspective bar (the
- * perspective bar provides buttons to quickly switch between perspectives).
- * <p>
- * The initial value is <code>false</code>.
- * </p>
- *
- * @return <code>true</code> for a perspective bar, and <code>false</code>
- * for no perspective bar
- */
- boolean getShowPerspectiveBar();
+ /**
+ * Returns whether the underlying workbench window has a perspective bar (the
+ * perspective bar provides buttons to quickly switch between perspectives).
+ * <p>
+ * The initial value is <code>false</code>.
+ * </p>
+ *
+ * @return <code>true</code> for a perspective bar, and <code>false</code> for
+ * no perspective bar
+ */
+ boolean getShowPerspectiveBar();
- /**
- * Sets whether the underlying workbench window has a perspective bar (the
- * perspective bar provides buttons to quickly switch between perspectives).
- *
- * @param show <code>true</code> for a perspective bar, and
- * <code>false</code> for no perspective bar
- */
- void setShowPerspectiveBar(boolean show);
+ /**
+ * Sets whether the underlying workbench window has a perspective bar (the
+ * perspective bar provides buttons to quickly switch between perspectives).
+ *
+ * @param show <code>true</code> for a perspective bar, and <code>false</code>
+ * for no perspective bar
+ */
+ void setShowPerspectiveBar(boolean show);
- /**
+ /**
* No longer used by the platform
*
* @return <code>true</code> for fast view bars, and <code>false</code> for no
@@ -171,9 +170,10 @@ public interface IWorkbenchWindowConfigurer {
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=485835
* @deprecated discontinued support for fast views
*/
- @Deprecated boolean getShowFastViewBars();
+ @Deprecated
+ boolean getShowFastViewBars();
- /**
+ /**
* No longer used by the platform
*
* @param enable <code>true</code> for fast view bars, and <code>false</code>
@@ -185,136 +185,132 @@ public interface IWorkbenchWindowConfigurer {
*
* @deprecated discontinued support for fast views
*/
- @Deprecated void setShowFastViewBars(boolean enable);
+ @Deprecated
+ void setShowFastViewBars(boolean enable);
- /**
- * Returns whether the underlying workbench window has a progress indicator.
- * <p>
- * The initial value is <code>false</code>.
- * </p>
- *
- * @return <code>true</code> for a progress indicator, and <code>false</code>
- * for no progress indicator
- */
- boolean getShowProgressIndicator();
+ /**
+ * Returns whether the underlying workbench window has a progress indicator.
+ * <p>
+ * The initial value is <code>false</code>.
+ * </p>
+ *
+ * @return <code>true</code> for a progress indicator, and <code>false</code>
+ * for no progress indicator
+ */
+ boolean getShowProgressIndicator();
- /**
- * Sets whether the underlying workbench window has a progress indicator.
- *
- * @param show <code>true</code> for a progress indicator, and <code>false</code>
- * for no progress indicator
- */
- void setShowProgressIndicator(boolean show);
+ /**
+ * Sets whether the underlying workbench window has a progress indicator.
+ *
+ * @param show <code>true</code> for a progress indicator, and
+ * <code>false</code> for no progress indicator
+ */
+ void setShowProgressIndicator(boolean show);
- /**
- * Returns the style bits to use for the window's shell when it is created.
- * The default is <code>SWT.SHELL_TRIM</code>.
- *
- * @return the shell style bits
- */
- int getShellStyle();
+ /**
+ * Returns the style bits to use for the window's shell when it is created. The
+ * default is <code>SWT.SHELL_TRIM</code>.
+ *
+ * @return the shell style bits
+ */
+ int getShellStyle();
- /**
- * Sets the style bits to use for the window's shell when it is created.
- * This method has no effect after the shell is created.
- * That is, it must be called within the <code>preWindowOpen</code>
- * callback on <code>WorkbenchAdvisor</code>.
- * <p>
- * For more details on the applicable shell style bits, see the
- * documentation for {@link org.eclipse.swt.widgets.Shell}.
- * </p>
- *
- * @param shellStyle the shell style bits
- */
- void setShellStyle(int shellStyle);
+ /**
+ * Sets the style bits to use for the window's shell when it is created. This
+ * method has no effect after the shell is created. That is, it must be called
+ * within the <code>preWindowOpen</code> callback on
+ * <code>WorkbenchAdvisor</code>.
+ * <p>
+ * For more details on the applicable shell style bits, see the documentation
+ * for {@link org.eclipse.swt.widgets.Shell}.
+ * </p>
+ *
+ * @param shellStyle the shell style bits
+ */
+ void setShellStyle(int shellStyle);
- /**
- * Returns the size to use for the window's shell when it is created.
- *
- * @return the initial size to use for the shell
- */
- Point getInitialSize();
+ /**
+ * Returns the size to use for the window's shell when it is created.
+ *
+ * @return the initial size to use for the shell
+ */
+ Point getInitialSize();
- /**
- * Sets the size to use for the window's shell when it is created.
- * This method has no effect after the shell is created.
- * That is, it must be called within the <code>preWindowOpen</code>
- * callback on <code>WorkbenchAdvisor</code>.
- *
- * @param initialSize the initial size to use for the shell
- */
- void setInitialSize(Point initialSize);
+ /**
+ * Sets the size to use for the window's shell when it is created. This method
+ * has no effect after the shell is created. That is, it must be called within
+ * the <code>preWindowOpen</code> callback on <code>WorkbenchAdvisor</code>.
+ *
+ * @param initialSize the initial size to use for the shell
+ */
+ void setInitialSize(Point initialSize);
- /**
- * Returns the data associated with this workbench window at the given key.
- *
- * @param key the key
- * @return the data, or <code>null</code> if there is no data at the given
- * key
- */
- Object getData(String key);
+ /**
+ * Returns the data associated with this workbench window at the given key.
+ *
+ * @param key the key
+ * @return the data, or <code>null</code> if there is no data at the given key
+ */
+ Object getData(String key);
- /**
- * Sets the data associated with this workbench window at the given key.
- *
- * @param key the key
- * @param data the data, or <code>null</code> to delete existing data
- */
- void setData(String key, Object data);
+ /**
+ * Sets the data associated with this workbench window at the given key.
+ *
+ * @param key the key
+ * @param data the data, or <code>null</code> to delete existing data
+ */
+ void setData(String key, Object data);
- /**
- * Adds the given drag and drop <code>Transfer</code> type to the ones
- * supported for drag and drop on the editor area of this workbench window.
- * <p>
- * The workbench advisor would ordinarily call this method from the
- * <code>preWindowOpen</code> callback.
- * A newly-created workbench window supports no drag and drop transfer
- * types. Adding <code>EditorInputTransfer.getInstance()</code>
- * enables <code>IEditorInput</code>s to be transferred.
- * </p>
- * <p>
- * Note that drag and drop to the editor area requires adding one or more
- * transfer types (using <code>addEditorAreaTransfer</code>) and
- * configuring a drop target listener
- * (with <code>configureEditorAreaDropListener</code>)
- * capable of handling any of those transfer types.
- * </p>
- *
- * @param transfer a drag and drop transfer object
- * @see #configureEditorAreaDropListener
- * @see org.eclipse.ui.part.EditorInputTransfer
- */
- void addEditorAreaTransfer(Transfer transfer);
+ /**
+ * Adds the given drag and drop <code>Transfer</code> type to the ones supported
+ * for drag and drop on the editor area of this workbench window.
+ * <p>
+ * The workbench advisor would ordinarily call this method from the
+ * <code>preWindowOpen</code> callback. A newly-created workbench window
+ * supports no drag and drop transfer types. Adding
+ * <code>EditorInputTransfer.getInstance()</code> enables
+ * <code>IEditorInput</code>s to be transferred.
+ * </p>
+ * <p>
+ * Note that drag and drop to the editor area requires adding one or more
+ * transfer types (using <code>addEditorAreaTransfer</code>) and configuring a
+ * drop target listener (with <code>configureEditorAreaDropListener</code>)
+ * capable of handling any of those transfer types.
+ * </p>
+ *
+ * @param transfer a drag and drop transfer object
+ * @see #configureEditorAreaDropListener
+ * @see org.eclipse.ui.part.EditorInputTransfer
+ */
+ void addEditorAreaTransfer(Transfer transfer);
- /**
- * Configures the drop target listener for the editor area of this workbench window.
- * <p>
- * The workbench advisor ordinarily calls this method from the
- * <code>preWindowOpen</code> callback.
- * A newly-created workbench window has no configured drop target listener for its
- * editor area.
- * </p>
- * <p>
- * Note that drag and drop to the editor area requires adding one or more
- * transfer types (using <code>addEditorAreaTransfer</code>) and
- * configuring a drop target listener
- * (with <code>configureEditorAreaDropListener</code>)
- * capable of handling any of those transfer types.
- * </p>
- *
- * @param dropTargetListener the drop target listener that will handle
- * requests to drop an object on to the editor area of this window
- *
- * @see #addEditorAreaTransfer
- */
- void configureEditorAreaDropListener(
- DropTargetListener dropTargetListener);
+ /**
+ * Configures the drop target listener for the editor area of this workbench
+ * window.
+ * <p>
+ * The workbench advisor ordinarily calls this method from the
+ * <code>preWindowOpen</code> callback. A newly-created workbench window has no
+ * configured drop target listener for its editor area.
+ * </p>
+ * <p>
+ * Note that drag and drop to the editor area requires adding one or more
+ * transfer types (using <code>addEditorAreaTransfer</code>) and configuring a
+ * drop target listener (with <code>configureEditorAreaDropListener</code>)
+ * capable of handling any of those transfer types.
+ * </p>
+ *
+ * @param dropTargetListener the drop target listener that will handle requests
+ * to drop an object on to the editor area of this
+ * window
+ *
+ * @see #addEditorAreaTransfer
+ */
+ void configureEditorAreaDropListener(DropTargetListener dropTargetListener);
- /**
+ /**
* No longer used by the platform
*
- * @return the menu bar, suitable for setting in the shell
- * extended by clients.
+ * @return the menu bar, suitable for setting in the shell extended by clients.
* @noreference This method is not intended to be referenced by clients.
*
* This method is planned to be deleted, see (
@@ -322,9 +318,10 @@ public interface IWorkbenchWindowConfigurer {
* @deprecated This method is no longer used. Applications now define workbench
* window contents in their application model.
*/
- @Deprecated Menu createMenuBar();
+ @Deprecated
+ Menu createMenuBar();
- /**
+ /**
* No longer used by the platform
*
* @param parent the parent composite
@@ -336,9 +333,10 @@ public interface IWorkbenchWindowConfigurer {
* @deprecated This method is no longer used. Applications now define workbench
* window contents in their application model.
*/
- @Deprecated Control createCoolBarControl(Composite parent);
+ @Deprecated
+ Control createCoolBarControl(Composite parent);
- /**
+ /**
* No longer used by the platform
*
* @param parent the parent composite
@@ -350,9 +348,10 @@ public interface IWorkbenchWindowConfigurer {
* @deprecated This method is no longer used. Applications now define workbench
* window contents in their application model.
*/
- @Deprecated Control createStatusLineControl(Composite parent);
+ @Deprecated
+ Control createStatusLineControl(Composite parent);
- /**
+ /**
* No longer used by the platform
*
* @param parent the parent composite
@@ -365,14 +364,15 @@ public interface IWorkbenchWindowConfigurer {
* @deprecated This method is no longer used. Applications now define workbench
* window contents in their application model.
*/
- @Deprecated Control createPageComposite(Composite parent);
+ @Deprecated
+ Control createPageComposite(Composite parent);
/**
* Saves the current state of the window using the specified memento.
*
* @param memento the memento in which to save the window's state
* @return a status object indicating whether the save was successful
- * @see IWorkbenchConfigurer#restoreWorkbenchWindow(IMemento)
+ * @see IWorkbenchConfigurer#restoreWorkbenchWindow(IMemento)
* @since 3.1
*/
IStatus saveState(IMemento memento);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/WorkbenchAdvisor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/WorkbenchAdvisor.java
index b364d0ee8b0..aa44d1236ed 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/WorkbenchAdvisor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/WorkbenchAdvisor.java
@@ -121,8 +121,8 @@ public abstract class WorkbenchAdvisor {
/**
* Bit flag for {@link #fillActionBars fillActionBars} indicating that the
- * operation is not filling the action bars of an actual workbench window,
- * but rather a proxy (used for perspective customization).
+ * operation is not filling the action bars of an actual workbench window, but
+ * rather a proxy (used for perspective customization).
*
* @deprecated use {@link ActionBarAdvisor#FILL_PROXY instead}
*/
@@ -131,8 +131,7 @@ public abstract class WorkbenchAdvisor {
/**
* Bit flag for {@link #fillActionBars fillActionBars} indicating that the
- * operation is supposed to fill (or describe) the workbench window's menu
- * bar.
+ * operation is supposed to fill (or describe) the workbench window's menu bar.
*
* @deprecated use {@link ActionBarAdvisor#FILL_MENU_BAR instead}
*/
@@ -141,8 +140,7 @@ public abstract class WorkbenchAdvisor {
/**
* Bit flag for {@link #fillActionBars fillActionBars} indicating that the
- * operation is supposed to fill (or describe) the workbench window's cool
- * bar.
+ * operation is supposed to fill (or describe) the workbench window's cool bar.
*
* @deprecated use {@link ActionBarAdvisor#FILL_COOL_BAR instead}
*/
@@ -184,8 +182,7 @@ public abstract class WorkbenchAdvisor {
* For internal use by the workbench only.
* </p>
*
- * @param configurer
- * an object for configuring the workbench
+ * @param configurer an object for configuring the workbench
*/
public final void internalBasicInitialize(IWorkbenchConfigurer configurer) {
if (workbenchConfigurer != null) {
@@ -198,27 +195,26 @@ public abstract class WorkbenchAdvisor {
/**
* Performs arbitrary initialization before the workbench starts running.
* <p>
- * This method is called during workbench initialization prior to any
- * windows being opened. Clients must not call this method directly
- * (although super calls are okay). The default implementation does nothing.
- * Subclasses may override. Typical clients will use the configurer passed
- * in to tweak the workbench. If further tweaking is required in the future,
- * the configurer may be obtained using <code>getWorkbenchConfigurer</code>.
+ * This method is called during workbench initialization prior to any windows
+ * being opened. Clients must not call this method directly (although super
+ * calls are okay). The default implementation does nothing. Subclasses may
+ * override. Typical clients will use the configurer passed in to tweak the
+ * workbench. If further tweaking is required in the future, the configurer may
+ * be obtained using <code>getWorkbenchConfigurer</code>.
* </p>
*
- * @param configurer
- * an object for configuring the workbench
+ * @param configurer an object for configuring the workbench
*/
public void initialize(IWorkbenchConfigurer configurer) {
// do nothing
}
/**
- * Returns the workbench configurer for the advisor. Can be
- * <code>null</code> if the advisor is not initialized yet.
+ * Returns the workbench configurer for the advisor. Can be <code>null</code> if
+ * the advisor is not initialized yet.
*
- * @return the workbench configurer, or <code>null</code> if the advisor
- * is not initialized yet
+ * @return the workbench configurer, or <code>null</code> if the advisor is not
+ * initialized yet
*/
protected IWorkbenchConfigurer getWorkbenchConfigurer() {
return workbenchConfigurer;
@@ -238,13 +234,13 @@ public abstract class WorkbenchAdvisor {
}
/**
- * Performs arbitrary actions just before the first workbench window is
- * opened (or restored).
+ * Performs arbitrary actions just before the first workbench window is opened
+ * (or restored).
* <p>
* This method is called after the workbench has been initialized and just
* before the first window is about to be opened. Clients must not call this
- * method directly (although super calls are okay). The default
- * implementation does nothing. Subclasses may override.
+ * method directly (although super calls are okay). The default implementation
+ * does nothing. Subclasses may override.
* </p>
*/
public void preStartup() {
@@ -252,13 +248,13 @@ public abstract class WorkbenchAdvisor {
}
/**
- * Performs arbitrary actions after the workbench windows have been opened
- * (or restored), but before the main event loop is run.
+ * Performs arbitrary actions after the workbench windows have been opened (or
+ * restored), but before the main event loop is run.
* <p>
- * This method is called just after the windows have been opened. Clients
- * must not call this method directly (although super calls are okay). The
- * default implementation does nothing. Subclasses may override. It is okay
- * to call <code>IWorkbench.close()</code> from this method.
+ * This method is called just after the windows have been opened. Clients must
+ * not call this method directly (although super calls are okay). The default
+ * implementation does nothing. Subclasses may override. It is okay to call
+ * <code>IWorkbench.close()</code> from this method.
* </p>
*/
public void postStartup() {
@@ -266,8 +262,7 @@ public abstract class WorkbenchAdvisor {
}
/**
- * Performs arbitrary finalization before the workbench is about to shut
- * down.
+ * Performs arbitrary finalization before the workbench is about to shut down.
* <p>
* This method is called immediately prior to workbench shutdown before any
* windows have been closed. Clients must not call this method directly
@@ -276,12 +271,11 @@ public abstract class WorkbenchAdvisor {
* </p>
* <p>
* The advisor may veto a regular shutdown by returning <code>false</code>,
- * although this will be ignored if the workbench is being forced to shut
- * down.
+ * although this will be ignored if the workbench is being forced to shut down.
* </p>
*
- * @return <code>true</code> to allow the workbench to proceed with
- * shutdown, <code>false</code> to veto a non-forced shutdown
+ * @return <code>true</code> to allow the workbench to proceed with shutdown,
+ * <code>false</code> to veto a non-forced shutdown
*/
public boolean preShutdown() {
return true;
@@ -290,10 +284,9 @@ public abstract class WorkbenchAdvisor {
/**
* Performs arbitrary finalization after the workbench stops running.
* <p>
- * This method is called during workbench shutdown after all windows have
- * been closed. Clients must not call this method directly (although super
- * calls are okay). The default implementation does nothing. Subclasses may
- * override.
+ * This method is called during workbench shutdown after all windows have been
+ * closed. Clients must not call this method directly (although super calls are
+ * okay). The default implementation does nothing. Subclasses may override.
* </p>
*/
public void postShutdown() {
@@ -301,27 +294,26 @@ public abstract class WorkbenchAdvisor {
}
/**
- * Performs arbitrary actions when the event loop crashes (the code that
- * handles a UI event throws an exception that is not caught).
+ * Performs arbitrary actions when the event loop crashes (the code that handles
+ * a UI event throws an exception that is not caught).
* <p>
- * This method is called when the code handling a UI event throws an
- * exception. In a perfectly functioning application, this method would
- * never be called. In practice, it comes into play when there are bugs in
- * the code that trigger unchecked runtime exceptions. It is also activated
- * when the system runs short of memory, etc. Fatal errors (ThreadDeath) are
- * not passed on to this method, as there is nothing that could be done.
+ * This method is called when the code handling a UI event throws an exception.
+ * In a perfectly functioning application, this method would never be called. In
+ * practice, it comes into play when there are bugs in the code that trigger
+ * unchecked runtime exceptions. It is also activated when the system runs short
+ * of memory, etc. Fatal errors (ThreadDeath) are not passed on to this method,
+ * as there is nothing that could be done.
* </p>
* <p>
- * Clients must not call this method directly (although super calls are
- * okay). The default implementation logs the problem so that it does not go
- * unnoticed. Subclasses may override or extend this method. It is generally
- * a bad idea to override with an empty method, and you should be especially
- * careful when handling Errors.
+ * Clients must not call this method directly (although super calls are okay).
+ * The default implementation logs the problem so that it does not go unnoticed.
+ * Subclasses may override or extend this method. It is generally a bad idea to
+ * override with an empty method, and you should be especially careful when
+ * handling Errors.
* </p>
*
- * @param exception
- * the uncaught exception that was thrown inside the UI event
- * loop
+ * @param exception the uncaught exception that was thrown inside the UI event
+ * loop
*/
public void eventLoopException(Throwable exception) {
// Protection from client doing super(null) call
@@ -330,9 +322,8 @@ public abstract class WorkbenchAdvisor {
}
try {
- StatusManager.getManager().handle(
- new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH,
- "Unhandled event loop exception", exception)); //$NON-NLS-1$
+ StatusManager.getManager().handle(new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH,
+ "Unhandled event loop exception", exception)); //$NON-NLS-1$
if (WorkbenchPlugin.DEBUG) {
exception.printStackTrace();
@@ -349,22 +340,20 @@ public abstract class WorkbenchAdvisor {
}
/**
- * Performs arbitrary work or yields when there are no events to be
- * processed.
+ * Performs arbitrary work or yields when there are no events to be processed.
* <p>
- * This method is called when there are currently no more events on the
- * queue to be processed at the moment.
+ * This method is called when there are currently no more events on the queue to
+ * be processed at the moment.
* </p>
* <p>
- * Clients must not call this method directly (although super calls are
- * okay). The default implementation yields until new events enter the
- * queue. Subclasses may override or extend this method. It is generally a
- * bad idea to override with an empty method. It is okay to call
+ * Clients must not call this method directly (although super calls are okay).
+ * The default implementation yields until new events enter the queue.
+ * Subclasses may override or extend this method. It is generally a bad idea to
+ * override with an empty method. It is okay to call
* <code>IWorkbench.close()</code> from this method.
* </p>
*
- * @param display
- * the main display of the workbench UI
+ * @param display the main display of the workbench UI
*/
public void eventLoopIdle(Display display) {
// default: yield cpu until new events enter the queue
@@ -372,42 +361,38 @@ public abstract class WorkbenchAdvisor {
}
/**
- * Creates a new workbench window advisor for configuring a new workbench
- * window via the given workbench window configurer. Clients should override
- * to provide their own window configurer. This method replaces all the
- * other window and action bar lifecycle methods on the workbench advisor.
+ * Creates a new workbench window advisor for configuring a new workbench window
+ * via the given workbench window configurer. Clients should override to provide
+ * their own window configurer. This method replaces all the other window and
+ * action bar lifecycle methods on the workbench advisor.
* <p>
- * The default implementation creates a window advisor that calls back to
- * the legacy window and action bar lifecycle methods on the workbench
- * advisor, for backwards compatibility with 3.0.
+ * The default implementation creates a window advisor that calls back to the
+ * legacy window and action bar lifecycle methods on the workbench advisor, for
+ * backwards compatibility with 3.0.
* </p>
*
- * @param configurer
- * the workbench window configurer
+ * @param configurer the workbench window configurer
* @return a new workbench window advisor
* @since 3.1
*/
- public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(
- IWorkbenchWindowConfigurer configurer) {
+ public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
return new CompatibilityWorkbenchWindowAdvisor(this, configurer);
}
/**
* Performs arbitrary actions before the given workbench window is opened.
* <p>
- * This method is called before the window's controls have been created.
- * Clients must not call this method directly (although super calls are
- * okay). The default implementation does nothing. Subclasses may override.
- * Typical clients will use the configurer passed in to tweak the workbench
- * window in an application-specific way; however, filling the window's menu
- * bar, tool bar, and status line must be done in
- * {@link #fillActionBars fillActionBars}, which is called immediately
- * after this method is called.
+ * This method is called before the window's controls have been created. Clients
+ * must not call this method directly (although super calls are okay). The
+ * default implementation does nothing. Subclasses may override. Typical clients
+ * will use the configurer passed in to tweak the workbench window in an
+ * application-specific way; however, filling the window's menu bar, tool bar,
+ * and status line must be done in {@link #fillActionBars fillActionBars}, which
+ * is called immediately after this method is called.
* </p>
*
- * @param configurer
- * an object for configuring the particular workbench window
- * being opened
+ * @param configurer an object for configuring the particular workbench window
+ * being opened
*
* @deprecated since 3.1, override
* {@link WorkbenchWindowAdvisor#preWindowOpen()} instead
@@ -421,52 +406,47 @@ public abstract class WorkbenchAdvisor {
/**
* Configures the action bars using the given action bar configurer. Under
* normal circumstances, <code>flags</code> does not include
- * <code>FILL_PROXY</code>, meaning this is a request to fill the
- * actions\ bars of the given workbench window; the remaining flags indicate
- * which combination of the menu bar (<code>FILL_MENU_BAR</code>), the
- * tool bar (<code>FILL_COOL_BAR</code>), and the status line (<code>FILL_STATUS_LINE</code>)
- * are to be filled.
+ * <code>FILL_PROXY</code>, meaning this is a request to fill the actions\ bars
+ * of the given workbench window; the remaining flags indicate which combination
+ * of the menu bar (<code>FILL_MENU_BAR</code>), the tool bar
+ * (<code>FILL_COOL_BAR</code>), and the status line
+ * (<code>FILL_STATUS_LINE</code>) are to be filled.
* <p>
- * If <code>flags</code> does include <code>FILL_PROXY</code>, then
- * this is a request to describe the actions bars of the given workbench
- * window (which will already have been filled); again, the remaining flags
- * indicate which combination of the menu bar, the tool bar, and the status
- * line are to be described. The actions included in the proxy action bars
- * can be the same instances as in the actual window's action bars. Calling
- * <code>ActionFactory</code> to create new action instances is not
- * recommended, because these actions internally register listeners with the
- * window and there is no opportunity to dispose of these actions.
+ * If <code>flags</code> does include <code>FILL_PROXY</code>, then this is a
+ * request to describe the actions bars of the given workbench window (which
+ * will already have been filled); again, the remaining flags indicate which
+ * combination of the menu bar, the tool bar, and the status line are to be
+ * described. The actions included in the proxy action bars can be the same
+ * instances as in the actual window's action bars. Calling
+ * <code>ActionFactory</code> to create new action instances is not recommended,
+ * because these actions internally register listeners with the window and there
+ * is no opportunity to dispose of these actions.
* </p>
* <p>
* This method is called just after {@link #preWindowOpen preWindowOpen}.
- * Clients must not call this method directly (although super calls are
- * okay). The default implementation does nothing. Subclasses may override.
+ * Clients must not call this method directly (although super calls are okay).
+ * The default implementation does nothing. Subclasses may override.
* </p>
*
- * @param window
- * the workbench window
- * @param configurer
- * the action bar configurer object
- * @param flags
- * bit mask composed from the constants
- * {@link #FILL_MENU_BAR FILL_MENU_BAR},
- * {@link #FILL_COOL_BAR FILL_COOL_BAR},
- * {@link #FILL_STATUS_LINE FILL_STATUS_LINE}, and
- * {@link #FILL_PROXY FILL_PROXY} Note: should 1st param be
- * IWorkbenchWindowConfigurer to be more consistent with other
- * methods? Note: suggest adding ActionBuilder as API, to
- * encapsulate the action building outside of the advisor, and to
- * handle the common pattern of hanging onto the action builder
- * in order to properly handle FILL_PROXY
- *
- * @deprecated since 3.1, override
- * {@link ActionBarAdvisor#fillActionBars(int)} instead
+ * @param window the workbench window
+ * @param configurer the action bar configurer object
+ * @param flags bit mask composed from the constants {@link #FILL_MENU_BAR
+ * FILL_MENU_BAR}, {@link #FILL_COOL_BAR FILL_COOL_BAR},
+ * {@link #FILL_STATUS_LINE FILL_STATUS_LINE}, and
+ * {@link #FILL_PROXY FILL_PROXY} Note: should 1st param be
+ * IWorkbenchWindowConfigurer to be more consistent with other
+ * methods? Note: suggest adding ActionBuilder as API, to
+ * encapsulate the action building outside of the advisor, and
+ * to handle the common pattern of hanging onto the action
+ * builder in order to properly handle FILL_PROXY
+ *
+ * @deprecated since 3.1, override {@link ActionBarAdvisor#fillActionBars(int)}
+ * instead
* @see #createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer)
* @see WorkbenchWindowAdvisor#createActionBarAdvisor(IActionBarConfigurer)
*/
@Deprecated
- public void fillActionBars(IWorkbenchWindow window,
- IActionBarConfigurer configurer, int flags) {
+ public void fillActionBars(IWorkbenchWindow window, IActionBarConfigurer configurer, int flags) {
// do nothing by default
}
@@ -474,48 +454,45 @@ public abstract class WorkbenchAdvisor {
* Performs arbitrary actions after the given workbench window has been
* restored, but before it is opened.
* <p>
- * This method is called after a previously-saved window have been
- * recreated. This method is not called when a new window is created from
- * scratch. This method is never called when a workbench is started for the
- * very first time, or when workbench state is not saved or restored.
- * Clients must not call this method directly (although super calls are
- * okay). The default implementation does nothing. Subclasses may override.
- * It is okay to call <code>IWorkbench.close()</code> from this method.
+ * This method is called after a previously-saved window have been recreated.
+ * This method is not called when a new window is created from scratch. This
+ * method is never called when a workbench is started for the very first time,
+ * or when workbench state is not saved or restored. Clients must not call this
+ * method directly (although super calls are okay). The default implementation
+ * does nothing. Subclasses may override. It is okay to call
+ * <code>IWorkbench.close()</code> from this method.
* </p>
*
- * @param configurer
- * an object for configuring the particular workbench window just
- * restored
+ * @param configurer an object for configuring the particular workbench window
+ * just restored
*
* @deprecated since 3.1, override
* {@link WorkbenchWindowAdvisor#postWindowRestore()} instead
* @see #createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer)
*/
@Deprecated
- public void postWindowRestore(IWorkbenchWindowConfigurer configurer)
- throws WorkbenchException {
+ public void postWindowRestore(IWorkbenchWindowConfigurer configurer) throws WorkbenchException {
// do nothing
}
/**
* Opens the introduction componenet.
* <p>
- * Clients must not call this method directly (although super calls are
- * okay). The default implementation opens the intro in the first window
- * provided the preference IWorkbenchPreferences.SHOW_INTRO is
- * <code>true</code>. If an intro is shown then this preference will be
- * set to <code>false</code>. Subsequently, and intro will be shown only
- * if <code>WorkbenchConfigurer.getSaveAndRestore()</code> returns
+ * Clients must not call this method directly (although super calls are okay).
+ * The default implementation opens the intro in the first window provided the
+ * preference IWorkbenchPreferences.SHOW_INTRO is <code>true</code>. If an intro
+ * is shown then this preference will be set to <code>false</code>.
+ * Subsequently, and intro will be shown only if
+ * <code>WorkbenchConfigurer.getSaveAndRestore()</code> returns
* <code>true</code> and the introduction was visible on last shutdown.
* Subclasses may override.
* </p>
*
- * @param configurer
- * configurer an object for configuring the particular workbench
- * window just created
+ * @param configurer configurer an object for configuring the particular
+ * workbench window just created
*
- * @deprecated since 3.1, override
- * {@link WorkbenchWindowAdvisor#openIntro()} instead
+ * @deprecated since 3.1, override {@link WorkbenchWindowAdvisor#openIntro()}
+ * instead
* @see #createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer)
*/
@Deprecated
@@ -526,38 +503,33 @@ public abstract class WorkbenchAdvisor {
introOpened = true;
- boolean showIntro = PrefUtil.getAPIPreferenceStore().getBoolean(
- IWorkbenchPreferenceConstants.SHOW_INTRO);
+ boolean showIntro = PrefUtil.getAPIPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.SHOW_INTRO);
if (!showIntro) {
return;
}
- if (getWorkbenchConfigurer().getWorkbench().getIntroManager()
- .hasIntro()) {
- PrefUtil.getAPIPreferenceStore().setValue(
- IWorkbenchPreferenceConstants.SHOW_INTRO, false);
+ if (getWorkbenchConfigurer().getWorkbench().getIntroManager().hasIntro()) {
+ PrefUtil.getAPIPreferenceStore().setValue(IWorkbenchPreferenceConstants.SHOW_INTRO, false);
PrefUtil.saveAPIPrefs();
- getWorkbenchConfigurer().getWorkbench().getIntroManager()
- .showIntro(configurer.getWindow(), false);
+ getWorkbenchConfigurer().getWorkbench().getIntroManager().showIntro(configurer.getWindow(), false);
}
}
/**
- * Performs arbitrary actions after the given workbench window has been
- * created (possibly after being restored), but has not yet been opened.
+ * Performs arbitrary actions after the given workbench window has been created
+ * (possibly after being restored), but has not yet been opened.
* <p>
- * This method is called after a new window has been created from scratch,
- * or when a previously-saved window has been restored. In the latter case,
- * this method is called after <code>postWindowRestore</code>. Clients
- * must not call this method directly (although super calls are okay). The
- * default implementation does nothing. Subclasses may override.
+ * This method is called after a new window has been created from scratch, or
+ * when a previously-saved window has been restored. In the latter case, this
+ * method is called after <code>postWindowRestore</code>. Clients must not call
+ * this method directly (although super calls are okay). The default
+ * implementation does nothing. Subclasses may override.
* </p>
*
- * @param configurer
- * an object for configuring the particular workbench window just
- * created
+ * @param configurer an object for configuring the particular workbench window
+ * just created
*
* @deprecated since 3.1, override
* {@link WorkbenchWindowAdvisor#postWindowCreate()} instead
@@ -569,19 +541,18 @@ public abstract class WorkbenchAdvisor {
}
/**
- * Performs arbitrary actions after the given workbench window has been
- * opened (possibly after being restored).
+ * Performs arbitrary actions after the given workbench window has been opened
+ * (possibly after being restored).
* <p>
- * This method is called after a window has been opened. This method is
- * called after a new window has been created from scratch, or when a
- * previously-saved window has been restored. Clients must not call this
- * method directly (although super calls are okay). The default
- * implementation does nothing. Subclasses may override.
+ * This method is called after a window has been opened. This method is called
+ * after a new window has been created from scratch, or when a previously-saved
+ * window has been restored. Clients must not call this method directly
+ * (although super calls are okay). The default implementation does nothing.
+ * Subclasses may override.
* </p>
*
- * @param configurer
- * an object for configuring the particular workbench window just
- * opened
+ * @param configurer an object for configuring the particular workbench window
+ * just opened
*
* @deprecated since 3.1, override
* {@link WorkbenchWindowAdvisor#postWindowOpen()} instead
@@ -597,19 +568,18 @@ public abstract class WorkbenchAdvisor {
* closed directly, and possibly veto the close.
* <p>
* This method is called from a ShellListener associated with the workbench
- * window. It is not called when the window is being closed for other
- * reasons. Clients must not call this method directly (although super calls
- * are okay). The default implementation does nothing. Subclasses may
- * override. Typical clients may use the configurer passed in to access the
- * workbench window being closed. If this method returns <code>false</code>,
- * then the user's request to close the shell is ignored. This gives the
- * workbench advisor an opportunity to query the user and/or veto the
- * closing of a window under some circumstances.
+ * window. It is not called when the window is being closed for other reasons.
+ * Clients must not call this method directly (although super calls are okay).
+ * The default implementation does nothing. Subclasses may override. Typical
+ * clients may use the configurer passed in to access the workbench window being
+ * closed. If this method returns <code>false</code>, then the user's request to
+ * close the shell is ignored. This gives the workbench advisor an opportunity
+ * to query the user and/or veto the closing of a window under some
+ * circumstances.
* </p>
*
- * @param configurer
- * an object for configuring the particular workbench window
- * whose shell is being closed
+ * @param configurer an object for configuring the particular workbench window
+ * whose shell is being closed
* @return <code>true</code> to allow the window to close, and
* <code>false</code> to prevent the window from closing
* @see org.eclipse.ui.IWorkbenchWindow#close
@@ -627,16 +597,15 @@ public abstract class WorkbenchAdvisor {
/**
* Performs arbitrary actions after the given workbench window is closed.
* <p>
- * This method is called after the window's controls have been disposed.
- * Clients must not call this method directly (although super calls are
- * okay). The default implementation does nothing. Subclasses may override.
- * Typical clients will use the configurer passed in to tweak the workbench
- * window in an application-specific way.
+ * This method is called after the window's controls have been disposed. Clients
+ * must not call this method directly (although super calls are okay). The
+ * default implementation does nothing. Subclasses may override. Typical clients
+ * will use the configurer passed in to tweak the workbench window in an
+ * application-specific way.
* </p>
*
- * @param configurer
- * an object for configuring the particular workbench window
- * being closed
+ * @param configurer an object for configuring the particular workbench window
+ * being closed
*
* @deprecated since 3.1, override
* {@link WorkbenchWindowAdvisor#postWindowClose()} instead
@@ -649,34 +618,31 @@ public abstract class WorkbenchAdvisor {
/**
* Returns whether the menu with the given id is an application menu of the
- * given window. This is used during OLE "in place" editing. Application
- * menus should be preserved during menu merging. All other menus may be
- * removed from the window.
+ * given window. This is used during OLE "in place" editing. Application menus
+ * should be preserved during menu merging. All other menus may be removed from
+ * the window.
* <p>
* The default implementation returns false. Subclasses may override.
* </p>
*
- * @param configurer
- * an object for configuring the workbench window
- * @param menuId
- * the menu id
- * @return <code>true</code> for application menus, and <code>false</code>
- * for part-specific menus
+ * @param configurer an object for configuring the workbench window
+ * @param menuId the menu id
+ * @return <code>true</code> for application menus, and <code>false</code> for
+ * part-specific menus
*
* @deprecated since 3.1, override
* {@link ActionBarAdvisor#isApplicationMenu(String)} instead
* @see WorkbenchWindowAdvisor#createActionBarAdvisor(IActionBarConfigurer)
*/
@Deprecated
- public boolean isApplicationMenu(IWorkbenchWindowConfigurer configurer,
- String menuId) {
+ public boolean isApplicationMenu(IWorkbenchWindowConfigurer configurer, String menuId) {
// default: not an application menu
return false;
}
/**
- * Returns the default input for newly created workbench pages when the
- * input is not explicitly specified.
+ * Returns the default input for newly created workbench pages when the input is
+ * not explicitly specified.
* <p>
* The default implementation returns <code>null</code>. Subclasses may
* override.
@@ -693,12 +659,12 @@ public abstract class WorkbenchAdvisor {
}
/**
- * Returns the id of the perspective to use for the initial workbench
- * window, or <code>null</code> if no initial perspective should be shown
- * in the initial workbench window.
+ * Returns the id of the perspective to use for the initial workbench window, or
+ * <code>null</code> if no initial perspective should be shown in the initial
+ * workbench window.
* <p>
- * This method is called during startup when the workbench is creating the
- * first new window. Subclasses must implement.
+ * This method is called during startup when the workbench is creating the first
+ * new window. Subclasses must implement.
* </p>
* <p>
* If the {@link IWorkbenchPreferenceConstants#DEFAULT_PERSPECTIVE_ID}
@@ -729,19 +695,17 @@ public abstract class WorkbenchAdvisor {
* Creates the contents of the window.
* <p>
* The default implementation adds a menu bar, a cool bar, a status line, a
- * perspective bar, and a fast view bar. The visibility of these controls
- * can be configured using the <code>setShow*</code> methods on
+ * perspective bar, and a fast view bar. The visibility of these controls can be
+ * configured using the <code>setShow*</code> methods on
* <code>IWorkbenchWindowConfigurer</code>.
* </p>
* <p>
- * Subclasses may override to define custom window contents and layout, but
- * must call <code>IWorkbenchWindowConfigurer.createPageComposite</code>.
+ * Subclasses may override to define custom window contents and layout, but must
+ * call <code>IWorkbenchWindowConfigurer.createPageComposite</code>.
* </p>
*
- * @param configurer
- * the window configurer
- * @param shell
- * the window's shell
+ * @param configurer the window configurer
+ * @param shell the window's shell
* @see IWorkbenchWindowConfigurer#createMenuBar
* @see IWorkbenchWindowConfigurer#createCoolBarControl
* @see IWorkbenchWindowConfigurer#createStatusLineControl
@@ -753,48 +717,49 @@ public abstract class WorkbenchAdvisor {
* @see #createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer)
*/
@Deprecated
- public void createWindowContents(IWorkbenchWindowConfigurer configurer,
- Shell shell) {
+ public void createWindowContents(IWorkbenchWindowConfigurer configurer, Shell shell) {
((WorkbenchWindowConfigurer) configurer).createDefaultContents(shell);
}
private volatile boolean initDone = false;
/**
- * Opens the workbench windows on startup. The default implementation tries
- * to restore the previously saved workbench state using
- * <code>IWorkbenchConfigurer.restoreWorkbenchState()</code>. If there
- * was no previously saved state, or if the restore failed, then a
- * first-time window is opened using
- * <code>IWorkbenchConfigurer.openFirstTimeWindow</code>.
+ * Opens the workbench windows on startup. The default implementation tries to
+ * restore the previously saved workbench state using
+ * <code>IWorkbenchConfigurer.restoreWorkbenchState()</code>. If there was no
+ * previously saved state, or if the restore failed, then a first-time window is
+ * opened using <code>IWorkbenchConfigurer.openFirstTimeWindow</code>.
*
* @return <code>true</code> to proceed with workbench startup, or
* <code>false</code> to exit
*/
public boolean openWindows() {
final Display display = PlatformUI.getWorkbench().getDisplay();
- final boolean result [] = new boolean[1];
+ final boolean result[] = new boolean[1];
- // spawn another init thread. For API compatibility We guarantee this method is called from
+ // spawn another init thread. For API compatibility We guarantee this method is
+ // called from
// the UI thread but it could take enough time to disrupt progress reporting.
- // spawn a new thread to do the grunt work of this initialization and spin the event loop
+ // spawn a new thread to do the grunt work of this initialization and spin the
+ // event loop
// ourselves just like it's done in Workbench.
- final Throwable [] error = new Throwable[1];
+ final Throwable[] error = new Throwable[1];
Thread initThread = new Thread() {
@Override
public void run() {
try {
- //declare us to be a startup thread so that our syncs will be executed
+ // declare us to be a startup thread so that our syncs will be executed
UISynchronizer.startupThread.set(Boolean.TRUE);
- final IWorkbenchConfigurer [] myConfigurer = new IWorkbenchConfigurer[1];
+ final IWorkbenchConfigurer[] myConfigurer = new IWorkbenchConfigurer[1];
StartupThreading.runWithoutExceptions(new StartupRunnable() {
@Override
public void runWithException() throws Throwable {
myConfigurer[0] = getWorkbenchConfigurer();
- }});
+ }
+ });
IStatus status = myConfigurer[0].restoreState();
if (!status.isOK()) {
@@ -809,8 +774,7 @@ public abstract class WorkbenchAdvisor {
result[0] = true;
} catch (Throwable e) {
error[0] = e;
- }
- finally {
+ } finally {
initDone = true;
yield();
try {
@@ -820,8 +784,9 @@ public abstract class WorkbenchAdvisor {
}
display.wake();
}
- }};
- initThread.start();
+ }
+ };
+ initThread.start();
while (true) {
if (!display.readAndDispatch()) {
@@ -832,25 +797,24 @@ public abstract class WorkbenchAdvisor {
}
- // can only be a runtime or error
- if (error[0] instanceof Error)
- throw (Error)error[0];
- else if (error[0] instanceof RuntimeException)
- throw (RuntimeException)error[0];
+ // can only be a runtime or error
+ if (error[0] instanceof Error)
+ throw (Error) error[0];
+ else if (error[0] instanceof RuntimeException)
+ throw (RuntimeException) error[0];
- return result[0];
+ return result[0];
}
/**
* Saves arbitrary application-specific state information for this workbench
* advisor.
* <p>
- * The default implementation simply returns an OK status. Subclasses may
- * extend or override.
+ * The default implementation simply returns an OK status. Subclasses may extend
+ * or override.
* </p>
*
- * @param memento
- * the memento in which to save the advisor's state
+ * @param memento the memento in which to save the advisor's state
* @return a status object indicating whether the save was successful
* @since 3.1
*/
@@ -859,15 +823,14 @@ public abstract class WorkbenchAdvisor {
}
/**
- * Restores arbitrary application-specific state information for this
- * workbench advisor.
+ * Restores arbitrary application-specific state information for this workbench
+ * advisor.
* <p>
- * The default implementation simply returns an OK status. Subclasses may
- * extend or override.
+ * The default implementation simply returns an OK status. Subclasses may extend
+ * or override.
* </p>
*
- * @param memento
- * the memento from which to restore the advisor's state
+ * @param memento the memento from which to restore the advisor's state
* @return a status object indicating whether the restore was successful
* @since 3.1
*/
@@ -876,15 +839,14 @@ public abstract class WorkbenchAdvisor {
}
/**
- * Return the contribution comparator for the particular type of
- * contribution. The default implementation of this class returns a
- * comparator that sorts the items by label.
+ * Return the contribution comparator for the particular type of contribution.
+ * The default implementation of this class returns a comparator that sorts the
+ * items by label.
*
* The contributionType may be one of the constants in
* {@link IContributionService} or it can be a value defined by the user.
*
- * @param contributionType
- * the contribution type
+ * @param contributionType the contribution type
* @return the comparator, must not return <code>null</code>
* @see IContributionService#getComparatorFor(String)
* @since 3.4
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/WorkbenchWindowAdvisor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/WorkbenchWindowAdvisor.java
index d0325852d01..da882031759 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/WorkbenchWindowAdvisor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/WorkbenchWindowAdvisor.java
@@ -66,82 +66,80 @@ import org.eclipse.ui.intro.IIntroManager;
*/
public class WorkbenchWindowAdvisor {
- private IWorkbenchWindowConfigurer windowConfigurer;
+ private IWorkbenchWindowConfigurer windowConfigurer;
- /**
- * Creates a new workbench window advisor for configuring a workbench
- * window via the given workbench window configurer.
- *
- * @param configurer an object for configuring the workbench window
- */
- public WorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
- Assert.isNotNull(configurer);
- this.windowConfigurer = configurer;
- }
+ /**
+ * Creates a new workbench window advisor for configuring a workbench window via
+ * the given workbench window configurer.
+ *
+ * @param configurer an object for configuring the workbench window
+ */
+ public WorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
+ Assert.isNotNull(configurer);
+ this.windowConfigurer = configurer;
+ }
- /**
- * Returns the workbench window configurer.
- *
- * @return the workbench window configurer
- */
- protected IWorkbenchWindowConfigurer getWindowConfigurer() {
- return windowConfigurer;
- }
+ /**
+ * Returns the workbench window configurer.
+ *
+ * @return the workbench window configurer
+ */
+ protected IWorkbenchWindowConfigurer getWindowConfigurer() {
+ return windowConfigurer;
+ }
- /**
- * Performs arbitrary actions before the window is opened.
- * <p>
- * This method is called before the window's controls have been created.
- * Clients must not call this method directly (although super calls are okay).
- * The default implementation does nothing. Subclasses may override.
- * Typical clients will use the window configurer to tweak the
- * workbench window in an application-specific way; however, filling the
- * window's menu bar, tool bar, and status line must be done in
- * {@link ActionBarAdvisor#fillActionBars}, which is called immediately
- * after this method is called.
- * </p>
- */
- public void preWindowOpen() {
- // do nothing
- }
+ /**
+ * Performs arbitrary actions before the window is opened.
+ * <p>
+ * This method is called before the window's controls have been created. Clients
+ * must not call this method directly (although super calls are okay). The
+ * default implementation does nothing. Subclasses may override. Typical clients
+ * will use the window configurer to tweak the workbench window in an
+ * application-specific way; however, filling the window's menu bar, tool bar,
+ * and status line must be done in {@link ActionBarAdvisor#fillActionBars},
+ * which is called immediately after this method is called.
+ * </p>
+ */
+ public void preWindowOpen() {
+ // do nothing
+ }
- /**
- * Creates a new action bar advisor to configure the action bars of the window
- * via the given action bar configurer.
- * The default implementation returns a new instance of {@link ActionBarAdvisor}.
- *
- * @param configurer the action bar configurer for the window
- * @return the action bar advisor for the window
- */
- public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer configurer) {
- return new ActionBarAdvisor(configurer);
- }
+ /**
+ * Creates a new action bar advisor to configure the action bars of the window
+ * via the given action bar configurer. The default implementation returns a new
+ * instance of {@link ActionBarAdvisor}.
+ *
+ * @param configurer the action bar configurer for the window
+ * @return the action bar advisor for the window
+ */
+ public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer configurer) {
+ return new ActionBarAdvisor(configurer);
+ }
- /**
- * Performs arbitrary actions after the window has been restored,
- * but before it is opened.
- * <p>
- * This method is called after a previously-saved window has been
- * recreated. This method is not called when a new window is created from
- * scratch. This method is never called when a workbench is started for the
- * very first time, or when workbench state is not saved or restored.
- * Clients must not call this method directly (although super calls are okay).
- * The default implementation does nothing. Subclasses may override.
- * It is okay to call <code>IWorkbench.close()</code> from this method.
- * </p>
- *
- * @exception WorkbenchException thrown if there are any errors to report
- * from post-restoration of the window
- */
- public void postWindowRestore() throws WorkbenchException {
- // do nothing
- }
+ /**
+ * Performs arbitrary actions after the window has been restored, but before it
+ * is opened.
+ * <p>
+ * This method is called after a previously-saved window has been recreated.
+ * This method is not called when a new window is created from scratch. This
+ * method is never called when a workbench is started for the very first time,
+ * or when workbench state is not saved or restored. Clients must not call this
+ * method directly (although super calls are okay). The default implementation
+ * does nothing. Subclasses may override. It is okay to call
+ * <code>IWorkbench.close()</code> from this method.
+ * </p>
+ *
+ * @exception WorkbenchException thrown if there are any errors to report from
+ * post-restoration of the window
+ */
+ public void postWindowRestore() throws WorkbenchException {
+ // do nothing
+ }
/**
- * Close any empty editor stacks that may have been left open when the
- * Workbench Window shut down. May be called from
- * {@link #postWindowRestore()} in the subclass but is not called by
- * default.
+ * Close any empty editor stacks that may have been left open when the Workbench
+ * Window shut down. May be called from {@link #postWindowRestore()} in the
+ * subclass but is not called by default.
*
* @since 3.7
*/
@@ -150,93 +148,89 @@ public class WorkbenchWindowAdvisor {
// anyway
}
- /**
- * Opens the introduction componenet.
- * <p>
- * Clients must not call this method directly (although super calls are okay).
- * The default implementation opens the intro in the first window provided
- * if the preference IWorkbenchPreferences.SHOW_INTRO is <code>true</code>. If
- * an intro is shown then this preference will be set to <code>false</code>.
- * Subsequently, and intro will be shown only if
- * <code>WorkbenchConfigurer.getSaveAndRestore()</code> returns
- * <code>true</code> and the introduction was visible on last shutdown.
- * Subclasses may override.
- * </p>
- */
- public void openIntro() {
- // TODO: Refactor this into an IIntroManager.openIntro(IWorkbenchWindow) call
+ /**
+ * Opens the introduction componenet.
+ * <p>
+ * Clients must not call this method directly (although super calls are okay).
+ * The default implementation opens the intro in the first window provided if
+ * the preference IWorkbenchPreferences.SHOW_INTRO is <code>true</code>. If an
+ * intro is shown then this preference will be set to <code>false</code>.
+ * Subsequently, and intro will be shown only if
+ * <code>WorkbenchConfigurer.getSaveAndRestore()</code> returns
+ * <code>true</code> and the introduction was visible on last shutdown.
+ * Subclasses may override.
+ * </p>
+ */
+ public void openIntro() {
+ // TODO: Refactor this into an IIntroManager.openIntro(IWorkbenchWindow) call
- // introOpened flag needs to be global
- IWorkbenchConfigurer wbConfig = getWindowConfigurer().getWorkbenchConfigurer();
- final String key = "introOpened"; //$NON-NLS-1$
- Boolean introOpened = (Boolean) wbConfig.getData(key);
- if (introOpened != null && introOpened.booleanValue()) {
+ // introOpened flag needs to be global
+ IWorkbenchConfigurer wbConfig = getWindowConfigurer().getWorkbenchConfigurer();
+ final String key = "introOpened"; //$NON-NLS-1$
+ Boolean introOpened = (Boolean) wbConfig.getData(key);
+ if (introOpened != null && introOpened.booleanValue()) {
return;
}
- wbConfig.setData(key, Boolean.TRUE);
+ wbConfig.setData(key, Boolean.TRUE);
- boolean showIntro = PrefUtil.getAPIPreferenceStore().getBoolean(
- IWorkbenchPreferenceConstants.SHOW_INTRO);
+ boolean showIntro = PrefUtil.getAPIPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.SHOW_INTRO);
- IIntroManager introManager = wbConfig.getWorkbench().getIntroManager();
+ IIntroManager introManager = wbConfig.getWorkbench().getIntroManager();
- boolean hasIntro = introManager.hasIntro();
- boolean isNewIntroContentAvailable = introManager.isNewContentAvailable();
+ boolean hasIntro = introManager.hasIntro();
+ boolean isNewIntroContentAvailable = introManager.isNewContentAvailable();
if (hasIntro && (showIntro || isNewIntroContentAvailable)) {
- PrefUtil.getAPIPreferenceStore().setValue(
- IWorkbenchPreferenceConstants.SHOW_INTRO, false);
+ PrefUtil.getAPIPreferenceStore().setValue(IWorkbenchPreferenceConstants.SHOW_INTRO, false);
PrefUtil.saveAPIPrefs();
- introManager
- .showIntro(getWindowConfigurer().getWindow(), false);
- }
- }
+ introManager.showIntro(getWindowConfigurer().getWindow(), false);
+ }
+ }
- /**
- * Performs arbitrary actions after the window has been created (possibly
- * after being restored), but has not yet been opened.
- * <p>
- * This method is called after the window has been created from scratch,
- * or when it has been restored from a previously-saved window. In the latter case,
- * this method is called after <code>postWindowRestore</code>.
- * Clients must not call this method directly (although super calls are okay).
- * The default implementation does nothing. Subclasses may override.
- * </p>
- */
- public void postWindowCreate() {
- // do nothing
- }
+ /**
+ * Performs arbitrary actions after the window has been created (possibly after
+ * being restored), but has not yet been opened.
+ * <p>
+ * This method is called after the window has been created from scratch, or when
+ * it has been restored from a previously-saved window. In the latter case, this
+ * method is called after <code>postWindowRestore</code>. Clients must not call
+ * this method directly (although super calls are okay). The default
+ * implementation does nothing. Subclasses may override.
+ * </p>
+ */
+ public void postWindowCreate() {
+ // do nothing
+ }
- /**
- * Performs arbitrary actions after the window has been opened (possibly
- * after being restored).
- * <p>
- * This method is called after the window has been opened. This method is
- * called after the window has been created from scratch, or when
- * it has been restored from a previously-saved window.
- * Clients must not call this method directly (although super calls are okay).
- * The default implementation does nothing. Subclasses may override.
- * </p>
- */
- public void postWindowOpen() {
- // do nothing
- }
+ /**
+ * Performs arbitrary actions after the window has been opened (possibly after
+ * being restored).
+ * <p>
+ * This method is called after the window has been opened. This method is called
+ * after the window has been created from scratch, or when it has been restored
+ * from a previously-saved window. Clients must not call this method directly
+ * (although super calls are okay). The default implementation does nothing.
+ * Subclasses may override.
+ * </p>
+ */
+ public void postWindowOpen() {
+ // do nothing
+ }
- /**
- * Performs arbitrary actions as the window's shell is being closed
- * directly, and possibly veto the close.
+ /**
+ * Performs arbitrary actions as the window's shell is being closed directly,
+ * and possibly veto the close.
* <p>
- * This method is called from a ShellListener associated with the window,
- * for example when the user clicks the window's close button. It is not
- * called when the window is being closed for other reasons, such as if the
- * user exits the workbench via the {@link ActionFactory#QUIT} action.
- * Clients must not call this method directly (although super calls are
- * okay). If this method returns <code>false</code>, then the user's
- * request to close the shell is ignored. This gives the workbench advisor
- * an opportunity to query the user and/or veto the closing of a window
- * under some circumstances.
+ * This method is called from a ShellListener associated with the window, for
+ * example when the user clicks the window's close button. It is not called when
+ * the window is being closed for other reasons, such as if the user exits the
+ * workbench via the {@link ActionFactory#QUIT} action. Clients must not call
+ * this method directly (although super calls are okay). If this method returns
+ * <code>false</code>, then the user's request to close the shell is ignored.
+ * This gives the workbench advisor an opportunity to query the user and/or veto
+ * the closing of a window under some circumstances.
* </p>
*
* @return <code>true</code> to allow the window to close, and
@@ -249,46 +243,45 @@ public class WorkbenchWindowAdvisor {
return true;
}
- /**
+ /**
* Performs arbitrary actions after the window is closed.
* <p>
- * This method is called after the window's controls have been disposed.
- * Clients must not call this method directly (although super calls are
- * okay). The default implementation does nothing. Subclasses may override.
+ * This method is called after the window's controls have been disposed. Clients
+ * must not call this method directly (although super calls are okay). The
+ * default implementation does nothing. Subclasses may override.
* </p>
*/
- public void postWindowClose() {
- // do nothing
- }
+ public void postWindowClose() {
+ // do nothing
+ }
- /**
+ /**
* Creates the contents of the window.
* <p>
* The default implementation adds a menu bar, a cool bar, a status line, a
- * perspective bar, and a fast view bar. The visibility of these controls
- * can be configured using the <code>setShow*</code> methods on
+ * perspective bar, and a fast view bar. The visibility of these controls can be
+ * configured using the <code>setShow*</code> methods on
* <code>IWorkbenchWindowConfigurer</code>.
* </p>
* <p>
- * Subclasses may override to define custom window contents and layout, but
- * must call <code>IWorkbenchWindowConfigurer.createPageComposite</code>.
+ * Subclasses may override to define custom window contents and layout, but must
+ * call <code>IWorkbenchWindowConfigurer.createPageComposite</code>.
* </p>
*
- * @param shell
- * the window's shell
+ * @param shell the window's shell
* @see IWorkbenchWindowConfigurer#createMenuBar
* @see IWorkbenchWindowConfigurer#createCoolBarControl
* @see IWorkbenchWindowConfigurer#createStatusLineControl
* @see IWorkbenchWindowConfigurer#createPageComposite
- * @deprecated This method is no longer used. Applications now define
- * workbench window contents in their application model.
+ * @deprecated This method is no longer used. Applications now define workbench
+ * window contents in their application model.
*/
@Deprecated
- public void createWindowContents(Shell shell) {
- ((WorkbenchWindowConfigurer) getWindowConfigurer()).createDefaultContents(shell);
- }
+ public void createWindowContents(Shell shell) {
+ ((WorkbenchWindowConfigurer) getWindowConfigurer()).createDefaultContents(shell);
+ }
- /**
+ /**
* Creates and returns the control to be shown when the window has no open
* pages. If <code>null</code> is returned, the default window background is
* shown.
@@ -297,27 +290,24 @@ public class WorkbenchWindowAdvisor {
* override.
* </p>
*
- * @param parent
- * the parent composite
+ * @param parent the parent composite
* @return the control or <code>null</code>
- * @deprecated This method is no longer used. Applications now define
- * workbench window contents in their application model.
+ * @deprecated This method is no longer used. Applications now define workbench
+ * window contents in their application model.
*/
@Deprecated
public Control createEmptyWindowContents(Composite parent) {
- return null;
- }
+ return null;
+ }
/**
- * Returns <code>true</code> if the given folder in the given perspective
- * should remain visible even after all parts in it have been closed by the
- * user. The default is <code>false</code>. The return value for a certain
- * combination of perspective id and folder id must not change over time.
+ * Returns <code>true</code> if the given folder in the given perspective should
+ * remain visible even after all parts in it have been closed by the user. The
+ * default is <code>false</code>. The return value for a certain combination of
+ * perspective id and folder id must not change over time.
*
- * @param perspectiveId
- * the perspective id
- * @param folderId
- * the folder id
+ * @param perspectiveId the perspective id
+ * @param folderId the folder id
* @return <code>true</code> if the given folder should be durable
*
* @since 3.5
@@ -326,15 +316,14 @@ public class WorkbenchWindowAdvisor {
return false;
}
- /**
- * Disposes any resources allocated by this window advisor.
- * This is the last method called on this window advisor by the workbench.
- * The default implementation does nothing.
- * Subclasses may extend.
- */
- public void dispose() {
- // do nothing.
- }
+ /**
+ * Disposes any resources allocated by this window advisor. This is the last
+ * method called on this window advisor by the workbench. The default
+ * implementation does nothing. Subclasses may extend.
+ */
+ public void dispose() {
+ // do nothing.
+ }
/**
* Saves arbitrary application specific state information.
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/branding/IBundleGroupConstants.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/branding/IBundleGroupConstants.java
index 42d34fe3453..6d5a5e53eb4 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/branding/IBundleGroupConstants.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/branding/IBundleGroupConstants.java
@@ -14,54 +14,53 @@
package org.eclipse.ui.branding;
/**
- * These constants define the set of properties that the UI expects to
- * be available via <code>IBundleGroup.getProperty(String)</code>.
+ * These constants define the set of properties that the UI expects to be
+ * available via <code>IBundleGroup.getProperty(String)</code>.
*
* @since 3.0
* @see org.eclipse.core.runtime.IBundleGroup#getProperty(String)
*/
public interface IBundleGroupConstants {
- /**
- * The text to show in an "about features" dialog.
- */
- String ABOUT_TEXT = "aboutText"; //$NON-NLS-1$
+ /**
+ * The text to show in an "about features" dialog.
+ */
+ String ABOUT_TEXT = "aboutText"; //$NON-NLS-1$
- /**
- * An image which can be shown in an "about features" dialog (32x32).
- * <p>
- * The value is a fully qualified valid URL.
- * </p>
- */
- String FEATURE_IMAGE = "featureImage"; //$NON-NLS-1$
+ /**
+ * An image which can be shown in an "about features" dialog (32x32).
+ * <p>
+ * The value is a fully qualified valid URL.
+ * </p>
+ */
+ String FEATURE_IMAGE = "featureImage"; //$NON-NLS-1$
- /**
- * A help reference for the feature's tips and tricks page (optional).
- */
- String TIPS_AND_TRICKS_HREF = "tipsAndTricksHref"; //$NON-NLS-1$
+ /**
+ * A help reference for the feature's tips and tricks page (optional).
+ */
+ String TIPS_AND_TRICKS_HREF = "tipsAndTricksHref"; //$NON-NLS-1$
- /**
- * The feature's welcome page (special XML-based format).
- * <p>
- * The value is a fully qualified valid URL.
- * </p>
- * Products designed to run "headless" typically would not have such a page.
- */
- String WELCOME_PAGE = "welcomePage"; //$NON-NLS-1$
+ /**
+ * The feature's welcome page (special XML-based format).
+ * <p>
+ * The value is a fully qualified valid URL.
+ * </p>
+ * Products designed to run "headless" typically would not have such a page.
+ */
+ String WELCOME_PAGE = "welcomePage"; //$NON-NLS-1$
- /**
- * The id of a perspective in which to show the welcome page
- * (optional).
- */
- String WELCOME_PERSPECTIVE = "welcomePerspective"; //$NON-NLS-1$
+ /**
+ * The id of a perspective in which to show the welcome page (optional).
+ */
+ String WELCOME_PERSPECTIVE = "welcomePerspective"; //$NON-NLS-1$
- /**
- * The URL of the license page for the feature (optional).
- * <p>
- * The value is a fully qualified valid URL.
- * </p>
- */
- String LICENSE_HREF = "licenseHref"; //$NON-NLS-1$
+ /**
+ * The URL of the license page for the feature (optional).
+ * <p>
+ * The value is a fully qualified valid URL.
+ * </p>
+ */
+ String LICENSE_HREF = "licenseHref"; //$NON-NLS-1$
/**
* The feature's branding bundle id (optional).
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/branding/IProductConstants.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/branding/IProductConstants.java
index cb96c57a208..be1c3c97568 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/branding/IProductConstants.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/branding/IProductConstants.java
@@ -14,52 +14,50 @@
package org.eclipse.ui.branding;
/**
- * These constants define the set of properties that the UI expects to
- * be available via <code>IProduct.getProperty(String)</code>.
+ * These constants define the set of properties that the UI expects to be
+ * available via <code>IProduct.getProperty(String)</code>.
*
* @since 3.0
* @see org.eclipse.core.runtime.IProduct#getProperty(String)
*/
public interface IProductConstants {
- /**
- * The SWT application name, used to initialize the SWT Display.
- * <p>
- * This value is used to refer to the application in .XDefaults
- * files on X server based window systems such as Motif.
- * </p>
- * <p>
- * To obtain a human-readable name for the product, use
- * <code>IProduct.getName()</code>.
- * </p>
- * @see org.eclipse.swt.widgets.Display#setAppName
- */
- String APP_NAME = "appName"; //$NON-NLS-1$
+ /**
+ * The SWT application name, used to initialize the SWT Display.
+ * <p>
+ * This value is used to refer to the application in .XDefaults files on X
+ * server based window systems such as Motif.
+ * </p>
+ * <p>
+ * To obtain a human-readable name for the product, use
+ * <code>IProduct.getName()</code>.
+ * </p>
+ *
+ * @see org.eclipse.swt.widgets.Display#setAppName
+ */
+ String APP_NAME = "appName"; //$NON-NLS-1$
- /**
- * The text to show in an "about" dialog for this product.
- * Products designed to run "headless" typically would not
- * have such text.
- */
- String ABOUT_TEXT = "aboutText"; //$NON-NLS-1$
+ /**
+ * The text to show in an "about" dialog for this product. Products designed to
+ * run "headless" typically would not have such text.
+ */
+ String ABOUT_TEXT = "aboutText"; //$NON-NLS-1$
- /**
- * An image which can be shown in an "about" dialog for this
- * product. Products designed to run "headless" typically would not
- * have such an image.
- * <p>
- * The value is either a fully qualified valid URL or a path relative
- * to the product's defining bundle.
- * </p>
- * <p>
- * A full-sized product image (no larger than 500x330 pixels) is
- * shown without the "aboutText" blurb. A half-sized product image
- * (no larger than 250x330 pixels) is shown with the "aboutText"
- * blurb beside it.
- * </p>
- */
- String ABOUT_IMAGE = "aboutImage"; //$NON-NLS-1$
+ /**
+ * An image which can be shown in an "about" dialog for this product. Products
+ * designed to run "headless" typically would not have such an image.
+ * <p>
+ * The value is either a fully qualified valid URL or a path relative to the
+ * product's defining bundle.
+ * </p>
+ * <p>
+ * A full-sized product image (no larger than 500x330 pixels) is shown without
+ * the "aboutText" blurb. A half-sized product image (no larger than 250x330
+ * pixels) is shown with the "aboutText" blurb beside it.
+ * </p>
+ */
+ String ABOUT_IMAGE = "aboutImage"; //$NON-NLS-1$
- /**
+ /**
* A file for customizing default preference values for a product. The value is
* interpreted as either a URL or a bundle-relative path by the runtime. This is
* not referenced from the workbench.
@@ -74,100 +72,103 @@ public interface IProductConstants {
*
* Where <code>qualifier</code> is typically the bundle id.
*/
- String PREFERENCE_CUSTOMIZATION = "preferenceCustomization"; //$NON-NLS-1$
+ String PREFERENCE_CUSTOMIZATION = "preferenceCustomization"; //$NON-NLS-1$
- /**
- * An image to be used as the window icon for this product (16x16).
- * Products designed to run "headless" typically would not have such an image.
- * <p>
- * The value is either a fully qualified valid URL or a path relative
- * to the product's defining bundle.
- * </p>
- * <p>
- * If the <code>WINDOW_IMAGES</code> property is given, then it supercedes
- * this one.
- * </p>
- * @deprecated use WINDOW_IMAGES instead (see recommendations there)
- */
- @Deprecated String WINDOW_IMAGE = "windowImage"; //$NON-NLS-1$
+ /**
+ * An image to be used as the window icon for this product (16x16). Products
+ * designed to run "headless" typically would not have such an image.
+ * <p>
+ * The value is either a fully qualified valid URL or a path relative to the
+ * product's defining bundle.
+ * </p>
+ * <p>
+ * If the <code>WINDOW_IMAGES</code> property is given, then it supercedes this
+ * one.
+ * </p>
+ *
+ * @deprecated use WINDOW_IMAGES instead (see recommendations there)
+ */
+ @Deprecated
+ String WINDOW_IMAGE = "windowImage"; //$NON-NLS-1$
- /**
- * An array of one or more images to be used for this product. The
- * expectation is that the array will contain the same image rendered
- * at different sizes (16x16 and 32x32).
- * Products designed to run "headless" typically would not have such images.
- * <p>
- * The value is a comma-separated list of paths, where each path is either
- * a fully qualified valid URL or a path relative to the product's defining bundle.
- * </p>
- * <p>
- * If this property is given, then it supercedes <code>WINDOW_IMAGE</code>.
- * </p>
- * <p>
- * It is recommended that products use <code>WINDOW_IMAGES</code> rather than
- * <code>WINDOW_IMAGE</code>, and specify both a 16x16 image and a 32x32 image,
- * to ensure that different sizes of the image are available for different uses
- * in the OS. For example, on Windows, the 16x16 image is used in the corner of
- * the window and in the task tray, but the 32x32 image is used in the Alt+Tab
- * application switcher.
- * </p>
- */
- String WINDOW_IMAGES = "windowImages"; //$NON-NLS-1$
+ /**
+ * An array of one or more images to be used for this product. The expectation
+ * is that the array will contain the same image rendered at different sizes
+ * (16x16 and 32x32). Products designed to run "headless" typically would not
+ * have such images.
+ * <p>
+ * The value is a comma-separated list of paths, where each path is either a
+ * fully qualified valid URL or a path relative to the product's defining
+ * bundle.
+ * </p>
+ * <p>
+ * If this property is given, then it supercedes <code>WINDOW_IMAGE</code>.
+ * </p>
+ * <p>
+ * It is recommended that products use <code>WINDOW_IMAGES</code> rather than
+ * <code>WINDOW_IMAGE</code>, and specify both a 16x16 image and a 32x32 image,
+ * to ensure that different sizes of the image are available for different uses
+ * in the OS. For example, on Windows, the 16x16 image is used in the corner of
+ * the window and in the task tray, but the 32x32 image is used in the Alt+Tab
+ * application switcher.
+ * </p>
+ */
+ String WINDOW_IMAGES = "windowImages"; //$NON-NLS-1$
- /**
- * The product's welcome page (special XML-based format).
- * <p>
- * The value is either a fully qualified valid URL or a path relative
- * to the product's defining bundle.
- * </p>
- * <p>
- * Products designed to run "headless" typically would not have such
- * a page. Use of this property is discouraged in 3.0, the new
- * <code>org.eclipse.ui.intro</code> extension point should be used instead.
- * </p>
- */
- String WELCOME_PAGE = "welcomePage"; //$NON-NLS-1$
+ /**
+ * The product's welcome page (special XML-based format).
+ * <p>
+ * The value is either a fully qualified valid URL or a path relative to the
+ * product's defining bundle.
+ * </p>
+ * <p>
+ * Products designed to run "headless" typically would not have such a page. Use
+ * of this property is discouraged in 3.0, the new
+ * <code>org.eclipse.ui.intro</code> extension point should be used instead.
+ * </p>
+ */
+ String WELCOME_PAGE = "welcomePage"; //$NON-NLS-1$
- /**
- * The rectangle relative to the splash image's top left corner where
- * the progress bar for reporting progress at startup should be shown.
- * Products designed to run "headless" typically would not define this
- * property.
- * <p>
- * The value is a comma-separated list of four integer values, specifying
- * x, y, width, and height of the rectangle in pixel coordinates.
- * </p>
- * @since 3.2
- * @see org.eclipse.ui.IWorkbenchPreferenceConstants#SHOW_PROGRESS_ON_STARTUP
- */
- String STARTUP_PROGRESS_RECT = "startupProgressRect"; //$NON-NLS-1$
+ /**
+ * The rectangle relative to the splash image's top left corner where the
+ * progress bar for reporting progress at startup should be shown. Products
+ * designed to run "headless" typically would not define this property.
+ * <p>
+ * The value is a comma-separated list of four integer values, specifying x, y,
+ * width, and height of the rectangle in pixel coordinates.
+ * </p>
+ *
+ * @since 3.2
+ * @see org.eclipse.ui.IWorkbenchPreferenceConstants#SHOW_PROGRESS_ON_STARTUP
+ */
+ String STARTUP_PROGRESS_RECT = "startupProgressRect"; //$NON-NLS-1$
- /**
- * The rectangle relative to the splash image's top left corner where
- * messages for reporting progress at startup should be shown.
- * Products designed to run "headless" typically would not define this
- * property.
- * <p>
- * The value is a comma-separated list of four integer values, specifying
- * x, y, width, and height of the rectangle in pixel coordinates.
- * </p>
- * @since 3.2
- * @see org.eclipse.ui.IWorkbenchPreferenceConstants#SHOW_PROGRESS_ON_STARTUP
- */
- String STARTUP_MESSAGE_RECT = "startupMessageRect"; //$NON-NLS-1$
+ /**
+ * The rectangle relative to the splash image's top left corner where messages
+ * for reporting progress at startup should be shown. Products designed to run
+ * "headless" typically would not define this property.
+ * <p>
+ * The value is a comma-separated list of four integer values, specifying x, y,
+ * width, and height of the rectangle in pixel coordinates.
+ * </p>
+ *
+ * @since 3.2
+ * @see org.eclipse.ui.IWorkbenchPreferenceConstants#SHOW_PROGRESS_ON_STARTUP
+ */
+ String STARTUP_MESSAGE_RECT = "startupMessageRect"; //$NON-NLS-1$
- /**
- * The foreground color to be used when reporting progress at startup.
- * Products designed to run "headless" typically would not define this
- * property.
- * <p>
- * The value is a six-digit hexadecimal number. The first two digits
- * specify the red component of the color, the next two digits the
- * green component, and the last two digits the blue component.
- * </p>
- * @since 3.2
- * @see org.eclipse.ui.IWorkbenchPreferenceConstants#SHOW_PROGRESS_ON_STARTUP
- */
- String STARTUP_FOREGROUND_COLOR = "startupForegroundColor"; //$NON-NLS-1$
+ /**
+ * The foreground color to be used when reporting progress at startup. Products
+ * designed to run "headless" typically would not define this property.
+ * <p>
+ * The value is a six-digit hexadecimal number. The first two digits specify the
+ * red component of the color, the next two digits the green component, and the
+ * last two digits the blue component.
+ * </p>
+ *
+ * @since 3.2
+ * @see org.eclipse.ui.IWorkbenchPreferenceConstants#SHOW_PROGRESS_ON_STARTUP
+ */
+ String STARTUP_FOREGROUND_COLOR = "startupForegroundColor"; //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/browser/AbstractWebBrowser.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/browser/AbstractWebBrowser.java
index fd267c0dc09..c7f729e2fad 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/browser/AbstractWebBrowser.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/browser/AbstractWebBrowser.java
@@ -26,8 +26,7 @@ public abstract class AbstractWebBrowser implements IWebBrowser {
/**
* The constructor that accepts the unique browser identifier.
*
- * @param id
- * the unique browser identifier
+ * @param id the unique browser identifier
*/
public AbstractWebBrowser(String id) {
this.id = id;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/browser/AbstractWorkbenchBrowserSupport.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/browser/AbstractWorkbenchBrowserSupport.java
index 97f4bf86ad2..1aea5324d50 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/browser/AbstractWorkbenchBrowserSupport.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/browser/AbstractWorkbenchBrowserSupport.java
@@ -22,8 +22,7 @@ import org.eclipse.ui.PartInitException;
*
* @since 3.1
*/
-public abstract class AbstractWorkbenchBrowserSupport implements
- IWorkbenchBrowserSupport {
+public abstract class AbstractWorkbenchBrowserSupport implements IWorkbenchBrowserSupport {
private static final String SHARED_EXTERNAL_BROWSER_ID = "org.eclipse.ui.externalBrowser"; //$NON-NLS-1$
@@ -35,8 +34,7 @@ public abstract class AbstractWorkbenchBrowserSupport implements
@Override
public IWebBrowser getExternalBrowser() throws PartInitException {
- return createBrowser(AS_EXTERNAL, SHARED_EXTERNAL_BROWSER_ID, null,
- null);
+ return createBrowser(AS_EXTERNAL, SHARED_EXTERNAL_BROWSER_ID, null, null);
}
@Override
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/browser/IWebBrowser.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/browser/IWebBrowser.java
index e8fe71765d8..98ab265ac01 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/browser/IWebBrowser.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/browser/IWebBrowser.java
@@ -29,10 +29,10 @@ import org.eclipse.ui.PartInitException;
public interface IWebBrowser {
/**
- * Returns the unique identifier of this browser. If an id has been supplied
- * to the browser support when the instance was created, it will be used.
- * Otherwise, a generated id will be provided to the browser that is
- * guaranteed to be unique.
+ * Returns the unique identifier of this browser. If an id has been supplied to
+ * the browser support when the instance was created, it will be used.
+ * Otherwise, a generated id will be provided to the browser that is guaranteed
+ * to be unique.
*
* @return a unique identifier of this browser instance
*/
@@ -44,11 +44,9 @@ public interface IWebBrowser {
* <b>NOTE</b> This method must be called from the current UI thread
* </p>
*
- * @param url
- * the URL to display
- * @exception PartInitException
- * if the browser fails to navigate to the provided url for
- * any reason
+ * @param url the URL to display
+ * @exception PartInitException if the browser fails to navigate to the provided
+ * url for any reason
*/
void openURL(URL url) throws PartInitException;
@@ -58,8 +56,8 @@ public interface IWebBrowser {
* <b>NOTE</b> This method must be called from the current UI thread
* </p>
*
- * @return <code>true</code> if the browser was closed or <code>false</code>
- * if the operation failed or is not supported.
+ * @return <code>true</code> if the browser was closed or <code>false</code> if
+ * the operation failed or is not supported.
*/
boolean close();
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/browser/IWorkbenchBrowserSupport.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/browser/IWorkbenchBrowserSupport.java
index 399f31efd83..490c1a1407f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/browser/IWorkbenchBrowserSupport.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/browser/IWorkbenchBrowserSupport.java
@@ -55,9 +55,9 @@ import org.eclipse.ui.PartInitException;
public interface IWorkbenchBrowserSupport {
/**
- * Style parameter (value 1&lt;&lt;1) indicating that the address combo and
- * 'Go' button will created for the browser. This style is ignored if the
- * support is forced to open the browser as external.
+ * Style parameter (value 1&lt;&lt;1) indicating that the address combo and 'Go'
+ * button will created for the browser. This style is ignored if the support is
+ * forced to open the browser as external.
*/
int LOCATION_BAR = 1 << 1;
@@ -69,76 +69,70 @@ public interface IWorkbenchBrowserSupport {
int NAVIGATION_BAR = 1 << 2;
/**
- * Style constant (value 1&lt;&lt;3) indicating that status will be tracked
- * and shown for the browser (page loading progress, text messages etc.).
+ * Style constant (value 1&lt;&lt;3) indicating that status will be tracked and
+ * shown for the browser (page loading progress, text messages etc.).
*/
int STATUS = 1 << 3;
/**
- * Style constant (value 1&lt;&lt;4) indicating that the internal web
- * browser will reopen after restarting the workbench (if used). In
- * addition, the URLs will appear in the MRU list.
+ * Style constant (value 1&lt;&lt;4) indicating that the internal web browser
+ * will reopen after restarting the workbench (if used). In addition, the URLs
+ * will appear in the MRU list.
*/
int PERSISTENT = 1 << 4;
/**
- * Style constant (value 1&lt;&lt;5) indicating that the internal web
- * browser will be hosted in a workbench editor area. This is just a hint -
- * implementers of the browser support may not honor it.
+ * Style constant (value 1&lt;&lt;5) indicating that the internal web browser
+ * will be hosted in a workbench editor area. This is just a hint - implementers
+ * of the browser support may not honor it.
*/
int AS_EDITOR = 1 << 5;
/**
- * Style constant (value 1&lt;&lt;6) indicating that the internal web
- * browser will be hosted in a workbench view. This is just a hint -
- * implementers of the browser support may not honor it.
+ * Style constant (value 1&lt;&lt;6) indicating that the internal web browser
+ * will be hosted in a workbench view. This is just a hint - implementers of the
+ * browser support may not honor it.
*/
int AS_VIEW = 1 << 6;
/**
- * Style constant (value 1&lt;&lt;7) indicating that the external web
- * browser must be used even if the implementation supports internal
- * browsers and the user didn't set the preference to external browsers.
+ * Style constant (value 1&lt;&lt;7) indicating that the external web browser
+ * must be used even if the implementation supports internal browsers and the
+ * user didn't set the preference to external browsers.
*/
int AS_EXTERNAL = 1 << 7;
/**
* Creates the new web browser instance. If the user has chosen to use the
- * internal Web browser, the given style bits (see class header for values)
- * will be used to open the browser.
+ * internal Web browser, the given style bits (see class header for values) will
+ * be used to open the browser.
* <p>
* The method will reuse an existing browser instance if the same
- * <code>browserId</code> value is passed to it. A persisted browser
- * instance restored upon startup can be accessed this way. If
- * <code>null</code> is passed as a browserId, a unique id will be
- * generated each time method is called.
+ * <code>browserId</code> value is passed to it. A persisted browser instance
+ * restored upon startup can be accessed this way. If <code>null</code> is
+ * passed as a browserId, a unique id will be generated each time method is
+ * called.
* <p>
- * If the user has chosen not to use the internal browser or it is not
- * available on the current platform, an external browser will be used and
- * all style parameters will be ignored.
+ * If the user has chosen not to use the internal browser or it is not available
+ * on the current platform, an external browser will be used and all style
+ * parameters will be ignored.
* </p>
*
- * @param style
- * the style display constants. Style constants should be
- * bitwise-ORed together.
- * @param browserId
- * if an instance of a browser with the same id is already
- * opened, it will be returned instead of creating a new one.
- * Passing <code>null</code> will create a new instance with a
- * generated id every time.
- * @param name
- * a name used for the presentation of the internal browser
- * @param tooltip
- * a tooltip used for the presentation of the internal browser
+ * @param style the style display constants. Style constants should be
+ * bitwise-ORed together.
+ * @param browserId if an instance of a browser with the same id is already
+ * opened, it will be returned instead of creating a new one.
+ * Passing <code>null</code> will create a new instance with a
+ * generated id every time.
+ * @param name a name used for the presentation of the internal browser
+ * @param tooltip a tooltip used for the presentation of the internal browser
* @return the browser instance that can be used to open the URL. Clients
* intending to reuse the instance for all the URLs should cache the
* instance and call IWebBrowser#openURL() on it. Clients are
* responsible for closing the browser instance when not needed.
- * @exception PartInitException
- * if the operation failed for some reason
+ * @exception PartInitException if the operation failed for some reason
*/
- IWebBrowser createBrowser(int style, String browserId, String name,
- String tooltip) throws PartInitException;
+ IWebBrowser createBrowser(int style, String browserId, String name, String tooltip) throws PartInitException;
/**
* Creates the new web browser instance. This is a simplified method that
@@ -147,44 +141,39 @@ public interface IWorkbenchBrowserSupport {
* <code>createBrowser(id).openURL(url)</code>.
* <p>
*
- * @param browserId
- * if an instance of a browser with the same id is already
- * opened, it will be returned instead of creating a new one.
- * Passing <code>null</code> will create a new instance with a
- * generated id every time.
+ * @param browserId if an instance of a browser with the same id is already
+ * opened, it will be returned instead of creating a new one.
+ * Passing <code>null</code> will create a new instance with a
+ * generated id every time.
* @return the browser instance that can be used to open the URL. Clients
* intending to reuse the instance for all the URLs should cache the
* instance and call IWebBrowser#openURL() on it. Clients are
* responsible for closing the browser instance when not needed.
- * @exception PartInitException
- * if the operation failed for some reason
+ * @exception PartInitException if the operation failed for some reason
*/
IWebBrowser createBrowser(String browserId) throws PartInitException;
/**
- * Returns a shared instance of the external web browser. Clients can use it
- * to share one external browser. The external browser that will be used is
- * subject to browser support implementation. A suggested implementation is
- * to use the operating system's default browser. Implementations that offer
- * users a choice of the web browser should honour the users choice of
- * external browser, with the initial selection being the system default
- * browser.
+ * Returns a shared instance of the external web browser. Clients can use it to
+ * share one external browser. The external browser that will be used is subject
+ * to browser support implementation. A suggested implementation is to use the
+ * operating system's default browser. Implementations that offer users a choice
+ * of the web browser should honour the users choice of external browser, with
+ * the initial selection being the system default browser.
*
* @return the shared instance of the external browser
- * @exception PartInitException
- * if the operation failed for some reason
+ * @exception PartInitException if the operation failed for some reason
*/
IWebBrowser getExternalBrowser() throws PartInitException;
/**
- * Tests whether web browser as an SWT widget can be created in this
- * workbench instance. If this method returns <code>false</code>,
- * <code>createBrowser</code> would ignore browser styles
- * <code>AS_EDITOR</code> and <code>AS_VIEW</code> and always create an
- * external browser.
+ * Tests whether web browser as an SWT widget can be created in this workbench
+ * instance. If this method returns <code>false</code>,
+ * <code>createBrowser</code> would ignore browser styles <code>AS_EDITOR</code>
+ * and <code>AS_VIEW</code> and always create an external browser.
*
- * @return <code>true</code> if internal web browser can be created on
- * this platform, <code>false</code> otherwise.
+ * @return <code>true</code> if internal web browser can be created on this
+ * platform, <code>false</code> otherwise.
*/
boolean isInternalWebBrowserAvailable();
} \ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/AbstractHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/AbstractHandler.java
index 7009ed0aba6..aa1813b6dad 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/AbstractHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/AbstractHandler.java
@@ -39,213 +39,201 @@ import org.eclipse.core.commands.IHandlerAttributes;
*/
@Deprecated
@SuppressWarnings({ "unchecked" })
-public abstract class AbstractHandler extends
- org.eclipse.core.commands.AbstractHandler implements IHandler {
-
- /**
- * Those interested in hearing about changes to this instance of
- * <code>IHandler</code>. This member is null iff there are
- * no listeners attached to this handler. (Most handlers don't
- * have any listeners, and this optimization saves some memory.)
- */
+public abstract class AbstractHandler extends org.eclipse.core.commands.AbstractHandler implements IHandler {
+
+ /**
+ * Those interested in hearing about changes to this instance of
+ * <code>IHandler</code>. This member is null iff there are no listeners
+ * attached to this handler. (Most handlers don't have any listeners, and this
+ * optimization saves some memory.)
+ */
private List<IHandlerListener> handlerListeners;
- /**
- * @see IHandler#addHandlerListener(IHandlerListener)
- */
+ /**
+ * @see IHandler#addHandlerListener(IHandlerListener)
+ */
@Override
@Deprecated
public void addHandlerListener(IHandlerListener handlerListener) {
- if (handlerListener == null) {
+ if (handlerListener == null) {
throw new NullPointerException();
}
- if (handlerListeners == null) {
+ if (handlerListeners == null) {
handlerListeners = new ArrayList<>();
}
- if (!handlerListeners.contains(handlerListener)) {
+ if (!handlerListeners.contains(handlerListener)) {
handlerListeners.add(handlerListener);
}
- }
-
- /**
- * The default implementation does nothing. Subclasses who attach listeners
- * to other objects are encouraged to detach them in this method.
- *
- * @see org.eclipse.ui.commands.IHandler#dispose()
- */
+ }
+
+ /**
+ * The default implementation does nothing. Subclasses who attach listeners to
+ * other objects are encouraged to detach them in this method.
+ *
+ * @see org.eclipse.ui.commands.IHandler#dispose()
+ */
@Override
@Deprecated
- public void dispose() {
- // Do nothing.
- }
+ public void dispose() {
+ // Do nothing.
+ }
@Override
@Deprecated
- public Object execute(final ExecutionEvent event) throws ExecutionException {
- try {
- return execute(event.getParameters());
- } catch (final org.eclipse.ui.commands.ExecutionException e) {
- throw new ExecutionException(e.getMessage(), e.getCause());
- }
- }
-
- /**
- * Fires an event to all registered listeners describing changes to this
- * instance.
- *
- * @param handlerEvent
- * the event describing changes to this instance. Must not be
- * <code>null</code>.
- */
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+ try {
+ return execute(event.getParameters());
+ } catch (final org.eclipse.ui.commands.ExecutionException e) {
+ throw new ExecutionException(e.getMessage(), e.getCause());
+ }
+ }
+
+ /**
+ * Fires an event to all registered listeners describing changes to this
+ * instance.
+ *
+ * @param handlerEvent the event describing changes to this instance. Must not
+ * be <code>null</code>.
+ */
@SuppressWarnings("rawtypes")
@Override
@Deprecated
- protected void fireHandlerChanged(HandlerEvent handlerEvent) {
- super.fireHandlerChanged(handlerEvent);
-
- if (handlerListeners != null) {
- final boolean attributesChanged = handlerEvent.isEnabledChanged()
- || handlerEvent.isHandledChanged();
- final Map previousAttributes;
- if (attributesChanged) {
- previousAttributes = new HashMap();
- previousAttributes.putAll(getAttributeValuesByName());
- if (handlerEvent.isEnabledChanged()) {
- Boolean disabled = !isEnabled() ? Boolean.TRUE: Boolean.FALSE;
- previousAttributes
- .put("enabled", disabled); //$NON-NLS-1$
- }
- if (handlerEvent.isHandledChanged()) {
- Boolean notHandled = !isHandled() ? Boolean.TRUE: Boolean.FALSE;
- previousAttributes.put(
- IHandlerAttributes.ATTRIBUTE_HANDLED, notHandled);
- }
- } else {
- previousAttributes = null;
- }
- final org.eclipse.ui.commands.HandlerEvent legacyEvent = new org.eclipse.ui.commands.HandlerEvent(
- this, attributesChanged, previousAttributes);
-
- for (int i = 0; i < handlerListeners.size(); i++) {
- handlerListeners
- .get(i).handlerChanged(legacyEvent);
- }
- }
- }
+ protected void fireHandlerChanged(HandlerEvent handlerEvent) {
+ super.fireHandlerChanged(handlerEvent);
+
+ if (handlerListeners != null) {
+ final boolean attributesChanged = handlerEvent.isEnabledChanged() || handlerEvent.isHandledChanged();
+ final Map previousAttributes;
+ if (attributesChanged) {
+ previousAttributes = new HashMap();
+ previousAttributes.putAll(getAttributeValuesByName());
+ if (handlerEvent.isEnabledChanged()) {
+ Boolean disabled = !isEnabled() ? Boolean.TRUE : Boolean.FALSE;
+ previousAttributes.put("enabled", disabled); //$NON-NLS-1$
+ }
+ if (handlerEvent.isHandledChanged()) {
+ Boolean notHandled = !isHandled() ? Boolean.TRUE : Boolean.FALSE;
+ previousAttributes.put(IHandlerAttributes.ATTRIBUTE_HANDLED, notHandled);
+ }
+ } else {
+ previousAttributes = null;
+ }
+ final org.eclipse.ui.commands.HandlerEvent legacyEvent = new org.eclipse.ui.commands.HandlerEvent(this,
+ attributesChanged, previousAttributes);
+
+ for (int i = 0; i < handlerListeners.size(); i++) {
+ handlerListeners.get(i).handlerChanged(legacyEvent);
+ }
+ }
+ }
@SuppressWarnings("rawtypes")
@Deprecated
- protected void fireHandlerChanged(
- final org.eclipse.ui.commands.HandlerEvent handlerEvent) {
- if (handlerEvent == null) {
+ protected void fireHandlerChanged(final org.eclipse.ui.commands.HandlerEvent handlerEvent) {
+ if (handlerEvent == null) {
throw new NullPointerException();
}
- if (handlerListeners != null) {
- for (int i = 0; i < handlerListeners.size(); i++) {
- handlerListeners
- .get(i).handlerChanged(handlerEvent);
+ if (handlerListeners != null) {
+ for (int i = 0; i < handlerListeners.size(); i++) {
+ handlerListeners.get(i).handlerChanged(handlerEvent);
+ }
+ }
+
+ if (super.hasListeners()) {
+ final boolean enabledChanged;
+ final boolean handledChanged;
+ if (handlerEvent.haveAttributeValuesByNameChanged()) {
+ Map previousAttributes = handlerEvent.getPreviousAttributeValuesByName();
+
+ Object attribute = previousAttributes.get("enabled"); //$NON-NLS-1$
+ if (attribute instanceof Boolean) {
+ enabledChanged = ((Boolean) attribute).booleanValue();
+ } else {
+ enabledChanged = false;
+ }
+
+ attribute = previousAttributes.get(IHandlerAttributes.ATTRIBUTE_HANDLED);
+ if (attribute instanceof Boolean) {
+ handledChanged = ((Boolean) attribute).booleanValue();
+ } else {
+ handledChanged = false;
+ }
+ } else {
+ enabledChanged = false;
+ handledChanged = true;
}
- }
-
- if (super.hasListeners()) {
- final boolean enabledChanged;
- final boolean handledChanged;
- if (handlerEvent.haveAttributeValuesByNameChanged()) {
- Map previousAttributes = handlerEvent
- .getPreviousAttributeValuesByName();
-
- Object attribute = previousAttributes.get("enabled"); //$NON-NLS-1$
- if (attribute instanceof Boolean) {
- enabledChanged = ((Boolean) attribute).booleanValue();
- } else {
- enabledChanged = false;
- }
-
- attribute = previousAttributes
- .get(IHandlerAttributes.ATTRIBUTE_HANDLED);
- if (attribute instanceof Boolean) {
- handledChanged = ((Boolean) attribute).booleanValue();
- } else {
- handledChanged = false;
- }
- } else {
- enabledChanged = false;
- handledChanged = true;
- }
- final HandlerEvent newEvent = new HandlerEvent(this,
- enabledChanged, handledChanged);
- super.fireHandlerChanged(newEvent);
- }
- }
-
- /**
- * This simply return an empty map. The default implementation has no
- * attributes.
- *
- * @see IHandler#getAttributeValuesByName()
- */
+ final HandlerEvent newEvent = new HandlerEvent(this, enabledChanged, handledChanged);
+ super.fireHandlerChanged(newEvent);
+ }
+ }
+
+ /**
+ * This simply return an empty map. The default implementation has no
+ * attributes.
+ *
+ * @see IHandler#getAttributeValuesByName()
+ */
@Override
@Deprecated
- public Map getAttributeValuesByName() {
- return Collections.EMPTY_MAP;
- }
-
- /**
- * Returns true iff there is one or more IHandlerListeners attached to this
- * AbstractHandler.
- *
- * @return true iff there is one or more IHandlerListeners attached to this
- * AbstractHandler
- * @since 3.1
- */
+ public Map getAttributeValuesByName() {
+ return Collections.EMPTY_MAP;
+ }
+
+ /**
+ * Returns true iff there is one or more IHandlerListeners attached to this
+ * AbstractHandler.
+ *
+ * @return true iff there is one or more IHandlerListeners attached to this
+ * AbstractHandler
+ * @since 3.1
+ */
@Override
@Deprecated
- protected final boolean hasListeners() {
- return super.hasListeners() || handlerListeners != null;
- }
+ protected final boolean hasListeners() {
+ return super.hasListeners() || handlerListeners != null;
+ }
@Override
@Deprecated
- public boolean isEnabled() {
- final Object handled = getAttributeValuesByName().get("enabled"); //$NON-NLS-1$
- if (handled instanceof Boolean) {
- return ((Boolean) handled).booleanValue();
- }
+ public boolean isEnabled() {
+ final Object handled = getAttributeValuesByName().get("enabled"); //$NON-NLS-1$
+ if (handled instanceof Boolean) {
+ return ((Boolean) handled).booleanValue();
+ }
- return false;
- }
+ return false;
+ }
@Override
@Deprecated
- public boolean isHandled() {
- final Object handled = getAttributeValuesByName().get(
- IHandlerAttributes.ATTRIBUTE_HANDLED);
- if (handled instanceof Boolean) {
- return ((Boolean) handled).booleanValue();
- }
-
- return false;
- }
-
- /**
- * @see IHandler#removeHandlerListener(IHandlerListener)
- */
+ public boolean isHandled() {
+ final Object handled = getAttributeValuesByName().get(IHandlerAttributes.ATTRIBUTE_HANDLED);
+ if (handled instanceof Boolean) {
+ return ((Boolean) handled).booleanValue();
+ }
+
+ return false;
+ }
+
+ /**
+ * @see IHandler#removeHandlerListener(IHandlerListener)
+ */
@Override
@Deprecated
public void removeHandlerListener(IHandlerListener handlerListener) {
- if (handlerListener == null) {
+ if (handlerListener == null) {
throw new NullPointerException();
}
- if (handlerListeners == null) {
- return;
- }
+ if (handlerListeners == null) {
+ return;
+ }
- if (handlerListeners != null) {
+ if (handlerListeners != null) {
handlerListeners.remove(handlerListener);
}
- if (handlerListeners.isEmpty()) {
- handlerListeners = null;
- }
- }
+ if (handlerListeners.isEmpty()) {
+ handlerListeners = null;
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ActionHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ActionHandler.java
index d216b958381..f6fb06fb998 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ActionHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ActionHandler.java
@@ -23,8 +23,7 @@ import org.eclipse.swt.widgets.Event;
import org.eclipse.ui.actions.RetargetAction;
/**
- * This class adapts instances of <code>IAction</code> to
- * <code>IHandler</code>.
+ * This class adapts instances of <code>IAction</code> to <code>IHandler</code>.
*
* @since 3.0
* @deprecated Please use the "org.eclipse.core.commands" plug-in instead.
@@ -34,225 +33,213 @@ import org.eclipse.ui.actions.RetargetAction;
@SuppressWarnings("all")
public final class ActionHandler extends AbstractHandler {
- /**
- * The attribute name for the checked property of the wrapped action. This
- * indicates whether the action should be displayed with as a checked check
- * box.
- */
- private static final String ATTRIBUTE_CHECKED = "checked"; //$NON-NLS-1$
-
- /**
- * The attribute name for the enabled property of the wrapped action.
- */
- private static final String ATTRIBUTE_ENABLED = "enabled"; //$NON-NLS-1$
-
- /**
- * <p>
- * The name of the attribute indicating whether the wrapped instance of
- * <code>RetargetAction</code> has a handler.
- * </p>
- */
- private static final String ATTRIBUTE_HANDLED = IHandlerAttributes.ATTRIBUTE_HANDLED;
-
- /**
- * The attribute name for the identifier of the wrapped action. This is the
- * action identifier, and not the command identifier.
- */
- private static final String ATTRIBUTE_ID = "id"; //$NON-NLS-1$
-
- /**
- * The attribute name for the visual style of the wrapped action. The style
- * can be things like a pull-down menu, a check box, a radio button or a
- * push button.
- */
- private static final String ATTRIBUTE_STYLE = "style"; //$NON-NLS-1$
-
- /**
- * The wrapped action. This value is never <code>null</code>.
- */
- private final IAction action;
-
- /**
- * The map of attributes values. The keys are <code>String</code> values
- * of the attribute names (given above). The values can be any type of
- * <code>Object</code>.
- *
- * This map is always null if there are no IHandlerListeners registered.
- *
- */
- private Map attributeValuesByName;
-
- /**
- * The property change listener hooked on to the action. This is initialized
- * when the first listener is attached to this handler, and is removed when
- * the handler is disposed or the last listener is removed.
- */
- private IPropertyChangeListener propertyChangeListener;
-
- /**
- * Creates a new instance of this class given an instance of
- * <code>IAction</code>.
- *
- * @param action
- * the action. Must not be <code>null</code>.
- */
+ /**
+ * The attribute name for the checked property of the wrapped action. This
+ * indicates whether the action should be displayed with as a checked check box.
+ */
+ private static final String ATTRIBUTE_CHECKED = "checked"; //$NON-NLS-1$
+
+ /**
+ * The attribute name for the enabled property of the wrapped action.
+ */
+ private static final String ATTRIBUTE_ENABLED = "enabled"; //$NON-NLS-1$
+
+ /**
+ * <p>
+ * The name of the attribute indicating whether the wrapped instance of
+ * <code>RetargetAction</code> has a handler.
+ * </p>
+ */
+ private static final String ATTRIBUTE_HANDLED = IHandlerAttributes.ATTRIBUTE_HANDLED;
+
+ /**
+ * The attribute name for the identifier of the wrapped action. This is the
+ * action identifier, and not the command identifier.
+ */
+ private static final String ATTRIBUTE_ID = "id"; //$NON-NLS-1$
+
+ /**
+ * The attribute name for the visual style of the wrapped action. The style can
+ * be things like a pull-down menu, a check box, a radio button or a push
+ * button.
+ */
+ private static final String ATTRIBUTE_STYLE = "style"; //$NON-NLS-1$
+
+ /**
+ * The wrapped action. This value is never <code>null</code>.
+ */
+ private final IAction action;
+
+ /**
+ * The map of attributes values. The keys are <code>String</code> values of the
+ * attribute names (given above). The values can be any type of
+ * <code>Object</code>.
+ *
+ * This map is always null if there are no IHandlerListeners registered.
+ *
+ */
+ private Map attributeValuesByName;
+
+ /**
+ * The property change listener hooked on to the action. This is initialized
+ * when the first listener is attached to this handler, and is removed when the
+ * handler is disposed or the last listener is removed.
+ */
+ private IPropertyChangeListener propertyChangeListener;
+
+ /**
+ * Creates a new instance of this class given an instance of
+ * <code>IAction</code>.
+ *
+ * @param action the action. Must not be <code>null</code>.
+ */
@Deprecated
- public ActionHandler(IAction action) {
- if (action == null) {
+ public ActionHandler(IAction action) {
+ if (action == null) {
throw new NullPointerException();
}
- this.action = action;
- }
+ this.action = action;
+ }
- /**
- * @see org.eclipse.ui.commands.IHandler#addHandlerListener(org.eclipse.ui.commands.IHandlerListener)
- * @since 3.1
- */
+ /**
+ * @see org.eclipse.ui.commands.IHandler#addHandlerListener(org.eclipse.ui.commands.IHandlerListener)
+ * @since 3.1
+ */
@Override
@Deprecated
- public void addHandlerListener(IHandlerListener handlerListener) {
- if (!hasListeners()) {
- attachListener();
- }
-
- super.addHandlerListener(handlerListener);
- }
-
- /**
- * When a listener is attached to this handler, then this registers a
- * listener with the underlying action.
- *
- * @since 3.1
- */
- private void attachListener() {
- if (propertyChangeListener == null) {
- attributeValuesByName = getAttributeValuesByNameFromAction();
+ public void addHandlerListener(IHandlerListener handlerListener) {
+ if (!hasListeners()) {
+ attachListener();
+ }
- propertyChangeListener = propertyChangeEvent -> {
- String property = propertyChangeEvent.getProperty();
- if (IAction.ENABLED.equals(property)
- || IAction.CHECKED.equals(property)
- || IHandlerAttributes.ATTRIBUTE_HANDLED
- .equals(property)) {
+ super.addHandlerListener(handlerListener);
+ }
- Map previousAttributeValuesByName = attributeValuesByName;
+ /**
+ * When a listener is attached to this handler, then this registers a listener
+ * with the underlying action.
+ *
+ * @since 3.1
+ */
+ private void attachListener() {
+ if (propertyChangeListener == null) {
attributeValuesByName = getAttributeValuesByNameFromAction();
- if (!attributeValuesByName
- .equals(previousAttributeValuesByName)) {
- fireHandlerChanged(new HandlerEvent(
- ActionHandler.this, true,
- previousAttributeValuesByName));
- }
- }
- };
- }
- this.action.addPropertyChangeListener(propertyChangeListener);
- }
+ propertyChangeListener = propertyChangeEvent -> {
+ String property = propertyChangeEvent.getProperty();
+ if (IAction.ENABLED.equals(property) || IAction.CHECKED.equals(property)
+ || IHandlerAttributes.ATTRIBUTE_HANDLED.equals(property)) {
+
+ Map previousAttributeValuesByName = attributeValuesByName;
+ attributeValuesByName = getAttributeValuesByNameFromAction();
+ if (!attributeValuesByName.equals(previousAttributeValuesByName)) {
+ fireHandlerChanged(new HandlerEvent(ActionHandler.this, true, previousAttributeValuesByName));
+ }
+ }
+ };
+ }
- /**
- * When no more listeners are registered, then this is used to removed the
- * property change listener from the underlying action.
- *
- * @since 3.1
- *
- */
- private void detachListener() {
- this.action.removePropertyChangeListener(propertyChangeListener);
- propertyChangeListener = null;
- attributeValuesByName = null;
- }
+ this.action.addPropertyChangeListener(propertyChangeListener);
+ }
- /**
- * Removes the property change listener from the action.
- *
- * @see org.eclipse.ui.commands.IHandler#dispose()
- */
+ /**
+ * When no more listeners are registered, then this is used to removed the
+ * property change listener from the underlying action.
+ *
+ * @since 3.1
+ *
+ */
+ private void detachListener() {
+ this.action.removePropertyChangeListener(propertyChangeListener);
+ propertyChangeListener = null;
+ attributeValuesByName = null;
+ }
+
+ /**
+ * Removes the property change listener from the action.
+ *
+ * @see org.eclipse.ui.commands.IHandler#dispose()
+ */
@Override
@Deprecated
- public void dispose() {
- if (hasListeners()) {
- action.removePropertyChangeListener(propertyChangeListener);
- }
- }
-
+ public void dispose() {
+ if (hasListeners()) {
+ action.removePropertyChangeListener(propertyChangeListener);
+ }
+ }
@Override
@Deprecated
- public Object execute(Map parameterValuesByName) throws ExecutionException {
- if ((action.getStyle() == IAction.AS_CHECK_BOX)
- || (action.getStyle() == IAction.AS_RADIO_BUTTON)) {
+ public Object execute(Map parameterValuesByName) throws ExecutionException {
+ if ((action.getStyle() == IAction.AS_CHECK_BOX) || (action.getStyle() == IAction.AS_RADIO_BUTTON)) {
action.setChecked(!action.isChecked());
}
- try {
- action.runWithEvent(new Event());
- } catch (Exception e) {
- throw new ExecutionException(
- "While executing the action, an exception occurred", e); //$NON-NLS-1$
- }
- return null;
- }
+ try {
+ action.runWithEvent(new Event());
+ } catch (Exception e) {
+ throw new ExecutionException("While executing the action, an exception occurred", e); //$NON-NLS-1$
+ }
+ return null;
+ }
- /**
- * Returns the action associated with this handler
- *
- * @return the action associated with this handler (not null)
- * @since 3.1
- */
+ /**
+ * Returns the action associated with this handler
+ *
+ * @return the action associated with this handler (not null)
+ * @since 3.1
+ */
@Deprecated
- public IAction getAction() {
- return action;
- }
+ public IAction getAction() {
+ return action;
+ }
@Override
@Deprecated
- public Map getAttributeValuesByName() {
- if (attributeValuesByName == null) {
- return getAttributeValuesByNameFromAction();
- }
+ public Map getAttributeValuesByName() {
+ if (attributeValuesByName == null) {
+ return getAttributeValuesByNameFromAction();
+ }
- return attributeValuesByName;
- }
+ return attributeValuesByName;
+ }
- /**
- * An accessor for the attribute names from the action. This reads out all
- * of the attributes from an action into a local map.
- *
- * @return A map of the attribute values indexed by the attribute name. The
- * attributes names are strings, but the values can by any object.
- *
- */
- private Map getAttributeValuesByNameFromAction() {
- Map map = new HashMap();
- map.put(ATTRIBUTE_CHECKED, action.isChecked() ? Boolean.TRUE
- : Boolean.FALSE);
- map.put(ATTRIBUTE_ENABLED, action.isEnabled() ? Boolean.TRUE
- : Boolean.FALSE);
- boolean handled = true;
- if (action instanceof RetargetAction) {
- RetargetAction retargetAction = (RetargetAction) action;
- handled = retargetAction.getActionHandler() != null;
- }
- map.put(ATTRIBUTE_HANDLED, handled ? Boolean.TRUE : Boolean.FALSE);
- map.put(ATTRIBUTE_ID, action.getId());
+ /**
+ * An accessor for the attribute names from the action. This reads out all of
+ * the attributes from an action into a local map.
+ *
+ * @return A map of the attribute values indexed by the attribute name. The
+ * attributes names are strings, but the values can by any object.
+ *
+ */
+ private Map getAttributeValuesByNameFromAction() {
+ Map map = new HashMap();
+ map.put(ATTRIBUTE_CHECKED, action.isChecked() ? Boolean.TRUE : Boolean.FALSE);
+ map.put(ATTRIBUTE_ENABLED, action.isEnabled() ? Boolean.TRUE : Boolean.FALSE);
+ boolean handled = true;
+ if (action instanceof RetargetAction) {
+ RetargetAction retargetAction = (RetargetAction) action;
+ handled = retargetAction.getActionHandler() != null;
+ }
+ map.put(ATTRIBUTE_HANDLED, handled ? Boolean.TRUE : Boolean.FALSE);
+ map.put(ATTRIBUTE_ID, action.getId());
map.put(ATTRIBUTE_STYLE, Integer.valueOf(action.getStyle()));
- return Collections.unmodifiableMap(map);
- }
+ return Collections.unmodifiableMap(map);
+ }
- /**
- * @see org.eclipse.ui.commands.IHandler#removeHandlerListener(org.eclipse.ui.commands.IHandlerListener)
- * @since 3.1
- */
+ /**
+ * @see org.eclipse.ui.commands.IHandler#removeHandlerListener(org.eclipse.ui.commands.IHandlerListener)
+ * @since 3.1
+ */
@Override
@Deprecated
- public void removeHandlerListener(IHandlerListener handlerListener) {
- super.removeHandlerListener(handlerListener);
+ public void removeHandlerListener(IHandlerListener handlerListener) {
+ super.removeHandlerListener(handlerListener);
- if (!hasListeners()) {
- detachListener();
- }
- }
+ if (!hasListeners()) {
+ detachListener();
+ }
+ }
@Override
@Deprecated
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/CategoryEvent.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/CategoryEvent.java
index ef341c7346c..cfbcf24eb3f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/CategoryEvent.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/CategoryEvent.java
@@ -29,71 +29,67 @@ package org.eclipse.ui.commands;
@Deprecated
public final class CategoryEvent {
- /**
- * The category that has changed; this value is never <code>null</code>.
- */
- private final ICategory category;
+ /**
+ * The category that has changed; this value is never <code>null</code>.
+ */
+ private final ICategory category;
- /**
- * Whether the defined state of the category has changed.
- */
- private final boolean definedChanged;
+ /**
+ * Whether the defined state of the category has changed.
+ */
+ private final boolean definedChanged;
- /**
- * Whether the name of the category has changed.
- */
- private final boolean nameChanged;
+ /**
+ * Whether the name of the category has changed.
+ */
+ private final boolean nameChanged;
- /**
- * Creates a new instance of this class.
- *
- * @param category
- * the instance of the interface that changed.
- * @param definedChanged
- * true, iff the defined property changed.
- * @param nameChanged
- * true, iff the name property changed.
- */
+ /**
+ * Creates a new instance of this class.
+ *
+ * @param category the instance of the interface that changed.
+ * @param definedChanged true, iff the defined property changed.
+ * @param nameChanged true, iff the name property changed.
+ */
@Deprecated
- public CategoryEvent(ICategory category, boolean definedChanged,
- boolean nameChanged) {
- if (category == null) {
+ public CategoryEvent(ICategory category, boolean definedChanged, boolean nameChanged) {
+ if (category == null) {
throw new NullPointerException();
}
- this.category = category;
- this.definedChanged = definedChanged;
- this.nameChanged = nameChanged;
- }
+ this.category = category;
+ this.definedChanged = definedChanged;
+ this.nameChanged = nameChanged;
+ }
- /**
- * Returns the instance of the interface that changed.
- *
- * @return the instance of the interface that changed. Guaranteed not to be
- * <code>null</code>.
- */
+ /**
+ * Returns the instance of the interface that changed.
+ *
+ * @return the instance of the interface that changed. Guaranteed not to be
+ * <code>null</code>.
+ */
@Deprecated
- public ICategory getCategory() {
- return category;
- }
+ public ICategory getCategory() {
+ return category;
+ }
- /**
- * Returns whether or not the defined property changed.
- *
- * @return true, iff the defined property changed.
- */
+ /**
+ * Returns whether or not the defined property changed.
+ *
+ * @return true, iff the defined property changed.
+ */
@Deprecated
- public boolean hasDefinedChanged() {
- return definedChanged;
- }
+ public boolean hasDefinedChanged() {
+ return definedChanged;
+ }
- /**
- * Returns whether or not the name property changed.
- *
- * @return true, iff the name property changed.
- */
+ /**
+ * Returns whether or not the name property changed.
+ *
+ * @return true, iff the name property changed.
+ */
@Deprecated
- public boolean hasNameChanged() {
- return nameChanged;
- }
+ public boolean hasNameChanged() {
+ return nameChanged;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/CommandEvent.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/CommandEvent.java
index 7aa8b6d4d1c..c9b1edb9a36 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/CommandEvent.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/CommandEvent.java
@@ -33,208 +33,203 @@ import org.eclipse.ui.internal.util.Util;
@SuppressWarnings("all")
public final class CommandEvent {
- /**
- * Whether the attributes of the command have changed. These are name and
- * value pairs representing properties of the command.
- */
- private final boolean attributeValuesByNameChanged;
-
- /**
- * Whether the category identifier has changed.
- */
- private final boolean categoryIdChanged;
-
- /**
- * The command that has changed; this value is never <code>null</code>.
- */
- private final ICommand command;
-
- /**
- * Whether the defined state of the command has changed.
- */
- private final boolean definedChanged;
-
- /**
- * Whether the description of the command has changed.
- */
- private final boolean descriptionChanged;
-
- /**
- * Whether the command has either gained or lost a handler.
- */
- private final boolean handledChanged;
-
- /**
- * Whether the key bindings for the command have changed.
- */
- private final boolean keySequenceBindingsChanged;
-
- /**
- * Whether the name of the command has changed.
- */
- private final boolean nameChanged;
-
- /**
- * The map of attributes before the change. This is a map of attribute name
- * (strings) to values (any object).
- */
- private Map previousAttributeValuesByName;
-
- /**
- * Creates a new instance of this class.
- *
- * @param command
- * the instance of the interface that changed.
- * @param attributeValuesByNameChanged
- * true, iff the attributeValuesByName property changed.
- * @param categoryIdChanged
- * true, iff the categoryId property changed.
- * @param definedChanged
- * true, iff the defined property changed.
- * @param descriptionChanged
- * true, iff the description property changed.
- * @param handledChanged
- * true, iff the handled property changed.
- * @param keySequenceBindingsChanged
- * true, iff the keySequenceBindings property changed.
- * @param nameChanged
- * true, iff the name property changed.
- * @param previousAttributeValuesByName
- * the map of previous attribute values by name. This map may be
- * empty. If this map is not empty, it's collection of keys must
- * only contain instances of <code>String</code>. This map
- * must be <code>null</code> if attributeValuesByNameChanged is
- * <code>false</code> and must not be null if
- * attributeValuesByNameChanged is <code>true</code>.
- */
- public CommandEvent(ICommand command, boolean attributeValuesByNameChanged,
- boolean categoryIdChanged, boolean definedChanged,
- boolean descriptionChanged, boolean handledChanged,
- boolean keySequenceBindingsChanged, boolean nameChanged,
- Map previousAttributeValuesByName) {
- if (command == null) {
+ /**
+ * Whether the attributes of the command have changed. These are name and value
+ * pairs representing properties of the command.
+ */
+ private final boolean attributeValuesByNameChanged;
+
+ /**
+ * Whether the category identifier has changed.
+ */
+ private final boolean categoryIdChanged;
+
+ /**
+ * The command that has changed; this value is never <code>null</code>.
+ */
+ private final ICommand command;
+
+ /**
+ * Whether the defined state of the command has changed.
+ */
+ private final boolean definedChanged;
+
+ /**
+ * Whether the description of the command has changed.
+ */
+ private final boolean descriptionChanged;
+
+ /**
+ * Whether the command has either gained or lost a handler.
+ */
+ private final boolean handledChanged;
+
+ /**
+ * Whether the key bindings for the command have changed.
+ */
+ private final boolean keySequenceBindingsChanged;
+
+ /**
+ * Whether the name of the command has changed.
+ */
+ private final boolean nameChanged;
+
+ /**
+ * The map of attributes before the change. This is a map of attribute name
+ * (strings) to values (any object).
+ */
+ private Map previousAttributeValuesByName;
+
+ /**
+ * Creates a new instance of this class.
+ *
+ * @param command the instance of the interface that
+ * changed.
+ * @param attributeValuesByNameChanged true, iff the attributeValuesByName
+ * property changed.
+ * @param categoryIdChanged true, iff the categoryId property
+ * changed.
+ * @param definedChanged true, iff the defined property changed.
+ * @param descriptionChanged true, iff the description property
+ * changed.
+ * @param handledChanged true, iff the handled property changed.
+ * @param keySequenceBindingsChanged true, iff the keySequenceBindings
+ * property changed.
+ * @param nameChanged true, iff the name property changed.
+ * @param previousAttributeValuesByName the map of previous attribute values by
+ * name. This map may be empty. If this map
+ * is not empty, it's collection of keys
+ * must only contain instances of
+ * <code>String</code>. This map must be
+ * <code>null</code> if
+ * attributeValuesByNameChanged is
+ * <code>false</code> and must not be null
+ * if attributeValuesByNameChanged is
+ * <code>true</code>.
+ */
+ public CommandEvent(ICommand command, boolean attributeValuesByNameChanged, boolean categoryIdChanged,
+ boolean definedChanged, boolean descriptionChanged, boolean handledChanged,
+ boolean keySequenceBindingsChanged, boolean nameChanged, Map previousAttributeValuesByName) {
+ if (command == null) {
throw new NullPointerException();
}
- if (!attributeValuesByNameChanged
- && previousAttributeValuesByName != null) {
+ if (!attributeValuesByNameChanged && previousAttributeValuesByName != null) {
throw new IllegalArgumentException();
}
- if (attributeValuesByNameChanged) {
- if (previousAttributeValuesByName == null) {
+ if (attributeValuesByNameChanged) {
+ if (previousAttributeValuesByName == null) {
this.previousAttributeValuesByName = Collections.EMPTY_MAP;
} else {
- this.previousAttributeValuesByName = Util.safeCopy(
- previousAttributeValuesByName, String.class,
+ this.previousAttributeValuesByName = Util.safeCopy(previousAttributeValuesByName, String.class,
Object.class, false, true);
}
- }
-
- this.command = command;
- this.attributeValuesByNameChanged = attributeValuesByNameChanged;
- this.categoryIdChanged = categoryIdChanged;
- this.definedChanged = definedChanged;
- this.descriptionChanged = descriptionChanged;
- this.handledChanged = handledChanged;
- this.keySequenceBindingsChanged = keySequenceBindingsChanged;
- this.nameChanged = nameChanged;
- }
-
- /**
- * Returns the instance of the interface that changed.
- *
- * @return the instance of the interface that changed. Guaranteed not to be
- * <code>null</code>.
- */
+ }
+
+ this.command = command;
+ this.attributeValuesByNameChanged = attributeValuesByNameChanged;
+ this.categoryIdChanged = categoryIdChanged;
+ this.definedChanged = definedChanged;
+ this.descriptionChanged = descriptionChanged;
+ this.handledChanged = handledChanged;
+ this.keySequenceBindingsChanged = keySequenceBindingsChanged;
+ this.nameChanged = nameChanged;
+ }
+
+ /**
+ * Returns the instance of the interface that changed.
+ *
+ * @return the instance of the interface that changed. Guaranteed not to be
+ * <code>null</code>.
+ */
@Deprecated
- public ICommand getCommand() {
- return command;
- }
-
- /**
- * Returns the map of previous attribute values by name.
- *
- * @return the map of previous attribute values by name. This map may be
- * empty. If this map is not empty, it's collection of keys is
- * guaranteed to only contain instances of <code>String</code>.
- * This map is guaranteed to be <code>null</code> if
- * haveAttributeValuesByNameChanged() is <code>false</code> and is
- * guaranteed to not be null if haveAttributeValuesByNameChanged()
- * is <code>true</code>.
- */
+ public ICommand getCommand() {
+ return command;
+ }
+
+ /**
+ * Returns the map of previous attribute values by name.
+ *
+ * @return the map of previous attribute values by name. This map may be empty.
+ * If this map is not empty, it's collection of keys is guaranteed to
+ * only contain instances of <code>String</code>. This map is guaranteed
+ * to be <code>null</code> if haveAttributeValuesByNameChanged() is
+ * <code>false</code> and is guaranteed to not be null if
+ * haveAttributeValuesByNameChanged() is <code>true</code>.
+ */
@Deprecated
- public Map getPreviousAttributeValuesByName() {
- return previousAttributeValuesByName;
- }
-
- /**
- * Returns whether or not the categoryId property changed.
- *
- * @return true, iff the categoryId property changed.
- */
+ public Map getPreviousAttributeValuesByName() {
+ return previousAttributeValuesByName;
+ }
+
+ /**
+ * Returns whether or not the categoryId property changed.
+ *
+ * @return true, iff the categoryId property changed.
+ */
@Deprecated
- public boolean hasCategoryIdChanged() {
- return categoryIdChanged;
- }
-
- /**
- * Returns whether or not the defined property changed.
- *
- * @return true, iff the defined property changed.
- */
+ public boolean hasCategoryIdChanged() {
+ return categoryIdChanged;
+ }
+
+ /**
+ * Returns whether or not the defined property changed.
+ *
+ * @return true, iff the defined property changed.
+ */
@Deprecated
- public boolean hasDefinedChanged() {
- return definedChanged;
- }
-
- /**
- * Returns whether or not the description property changed.
- *
- * @return true, iff the description property changed.
- */
+ public boolean hasDefinedChanged() {
+ return definedChanged;
+ }
+
+ /**
+ * Returns whether or not the description property changed.
+ *
+ * @return true, iff the description property changed.
+ */
@Deprecated
- public boolean hasDescriptionChanged() {
- return descriptionChanged;
- }
-
- /**
- * Returns whether or not the handled property changed.
- *
- * @return true, iff the handled property changed.
- */
+ public boolean hasDescriptionChanged() {
+ return descriptionChanged;
+ }
+
+ /**
+ * Returns whether or not the handled property changed.
+ *
+ * @return true, iff the handled property changed.
+ */
@Deprecated
- public boolean hasHandledChanged() {
- return handledChanged;
- }
-
- /**
- * Returns whether or not the name property changed.
- *
- * @return true, iff the name property changed.
- */
+ public boolean hasHandledChanged() {
+ return handledChanged;
+ }
+
+ /**
+ * Returns whether or not the name property changed.
+ *
+ * @return true, iff the name property changed.
+ */
@Deprecated
- public boolean hasNameChanged() {
- return nameChanged;
- }
-
- /**
- * Returns whether or not the attributeValuesByName property changed.
- *
- * @return true, iff the attributeValuesByName property changed.
- */
+ public boolean hasNameChanged() {
+ return nameChanged;
+ }
+
+ /**
+ * Returns whether or not the attributeValuesByName property changed.
+ *
+ * @return true, iff the attributeValuesByName property changed.
+ */
@Deprecated
- public boolean haveAttributeValuesByNameChanged() {
- return attributeValuesByNameChanged;
- }
-
- /**
- * Returns whether or not the keySequenceBindings property changed.
- *
- * @return true, iff the keySequenceBindings property changed.
- */
+ public boolean haveAttributeValuesByNameChanged() {
+ return attributeValuesByNameChanged;
+ }
+
+ /**
+ * Returns whether or not the keySequenceBindings property changed.
+ *
+ * @return true, iff the keySequenceBindings property changed.
+ */
@Deprecated
- public boolean haveKeySequenceBindingsChanged() {
- return keySequenceBindingsChanged;
- }
+ public boolean haveKeySequenceBindingsChanged() {
+ return keySequenceBindingsChanged;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/CommandException.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/CommandException.java
index 2262760715a..e07937c90fe 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/CommandException.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/CommandException.java
@@ -33,48 +33,44 @@ public abstract class CommandException extends Exception {
*
* @since 3.4
*/
- private static final long serialVersionUID= 1776879459633730964L;
-
+ private static final long serialVersionUID = 1776879459633730964L;
private Throwable cause;
- /**
- * Creates a new instance of this class with the specified detail message.
- *
- * @param message
- * the detail message.
- */
+ /**
+ * Creates a new instance of this class with the specified detail message.
+ *
+ * @param message the detail message.
+ */
@Deprecated
- public CommandException(String message) {
- super(message);
- }
+ public CommandException(String message) {
+ super(message);
+ }
- /**
- * Creates a new instance of this class with the specified detail message
- * and cause.
- *
- * @param message
- * the detail message.
- * @param cause
- * the cause.
- */
+ /**
+ * Creates a new instance of this class with the specified detail message and
+ * cause.
+ *
+ * @param message the detail message.
+ * @param cause the cause.
+ */
@Deprecated
- public CommandException(String message, Throwable cause) {
- super(message);
- // don't pass the cause to super, to allow compilation against JCL Foundation
- this.cause = cause;
- }
+ public CommandException(String message, Throwable cause) {
+ super(message);
+ // don't pass the cause to super, to allow compilation against JCL Foundation
+ this.cause = cause;
+ }
- /**
- * Returns the cause of this throwable or <code>null</code> if the
- * cause is nonexistent or unknown.
- *
- * @return the cause or <code>null</code>
- * @since 3.1
- */
+ /**
+ * Returns the cause of this throwable or <code>null</code> if the cause is
+ * nonexistent or unknown.
+ *
+ * @return the cause or <code>null</code>
+ * @since 3.1
+ */
@Override
@Deprecated
- public Throwable getCause() {
- return cause;
- }
+ public Throwable getCause() {
+ return cause;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/CommandManagerEvent.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/CommandManagerEvent.java
index 05fe1e269d2..f3e267bc5d2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/CommandManagerEvent.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/CommandManagerEvent.java
@@ -32,291 +32,299 @@ import org.eclipse.ui.internal.util.Util;
@SuppressWarnings("all")
public final class CommandManagerEvent {
- /**
- * Whether the set of active contexts has changed.
- */
- private final boolean activeContextIdsChanged;
-
- /**
- * Whether the active key configuration has changed.
- */
- private final boolean activeKeyConfigurationIdChanged;
-
- /**
- * Whether the locale has changed.
- */
- private final boolean activeLocaleChanged;
-
- /**
- * Whether the platform has changed.
- */
- private final boolean activePlatformChanged;
-
- /**
- * Whether the command manager has changed.
- */
- private final ICommandManager commandManager;
-
- /**
- * Whether the list of defined categories has changed.
- */
- private final boolean definedCategoryIdsChanged;
-
- /**
- * Whether the list of defined commands has changed.
- */
- private final boolean definedCommandIdsChanged;
-
- /**
- * Whether the list of defined key configurations has changed.
- */
- private final boolean definedKeyConfigurationIdsChanged;
-
- /**
- * The set of the defined categories before the change occurred. This is a
- * set of strings (category identifiers).
- */
- private final Set previouslyDefinedCategoryIds;
-
- /**
- * The set of the defined commands before the change occurred. This is a
- * set of strings (command identifiers).
- */
- private final Set previouslyDefinedCommandIds;
-
- /**
- * The set of the defined key configurations before the change occurred.
- * This is a set of strings (key configuration identifiers).
- */
- private final Set previouslyDefinedKeyConfigurationIds;
-
- /**
- * Creates a new instance of this class.
- *
- * @param commandManager
- * the instance of the interface that changed.
- * @param activeContextIdsChanged
- * true, iff the activeContextIdsChanged property changed.
- * @param activeKeyConfigurationIdChanged
- * true, iff the activeKeyConfigurationIdChanged property
- * changed.
- * @param activeLocaleChanged
- * true, iff the activeLocaleChanged property changed.
- * @param activePlatformChanged
- * true, iff the activePlatformChanged property changed.
- * @param definedCategoryIdsChanged
- * true, iff the definedCategoryIdsChanged property changed.
- * @param definedCommandIdsChanged
- * true, iff the definedCommandIdsChanged property changed.
- * @param definedKeyConfigurationIdsChanged
- * true, iff the definedKeyConfigurationIdsChanged property
- * changed.
- * @param previouslyDefinedCategoryIds
- * the set of identifiers to previously defined categories. This
- * set may be empty. If this set is not empty, it must only
- * contain instances of <code>String</code>. This set must be
- * <code>null</code> if definedCategoryIdsChanged is
- * <code>false</code> and must not be null if
- * definedCategoryIdsChanged is <code>true</code>.
- * @param previouslyDefinedCommandIds
- * the set of identifiers to previously defined commands. This
- * set may be empty. If this set is not empty, it must only
- * contain instances of <code>String</code>. This set must be
- * <code>null</code> if definedCommandIdsChanged is
- * <code>false</code> and must not be null if
- * definedContextIdsChanged is <code>true</code>.
- * @param previouslyDefinedKeyConfigurationIds
- * the set of identifiers to previously defined key
- * configurations. This set may be empty. If this set is not
- * empty, it must only contain instances of <code>String</code>.
- * This set must be <code>null</code> if
- * definedKeyConfigurationIdsChanged is <code>false</code> and
- * must not be null if definedKeyConfigurationIdsChanged is
- * <code>true</code>.
- */
- public CommandManagerEvent(ICommandManager commandManager,
- boolean activeContextIdsChanged,
- boolean activeKeyConfigurationIdChanged,
- boolean activeLocaleChanged, boolean activePlatformChanged,
- boolean definedCategoryIdsChanged,
- boolean definedCommandIdsChanged,
- boolean definedKeyConfigurationIdsChanged,
- Set previouslyDefinedCategoryIds, Set previouslyDefinedCommandIds,
- Set previouslyDefinedKeyConfigurationIds) {
- if (commandManager == null) {
+ /**
+ * Whether the set of active contexts has changed.
+ */
+ private final boolean activeContextIdsChanged;
+
+ /**
+ * Whether the active key configuration has changed.
+ */
+ private final boolean activeKeyConfigurationIdChanged;
+
+ /**
+ * Whether the locale has changed.
+ */
+ private final boolean activeLocaleChanged;
+
+ /**
+ * Whether the platform has changed.
+ */
+ private final boolean activePlatformChanged;
+
+ /**
+ * Whether the command manager has changed.
+ */
+ private final ICommandManager commandManager;
+
+ /**
+ * Whether the list of defined categories has changed.
+ */
+ private final boolean definedCategoryIdsChanged;
+
+ /**
+ * Whether the list of defined commands has changed.
+ */
+ private final boolean definedCommandIdsChanged;
+
+ /**
+ * Whether the list of defined key configurations has changed.
+ */
+ private final boolean definedKeyConfigurationIdsChanged;
+
+ /**
+ * The set of the defined categories before the change occurred. This is a set
+ * of strings (category identifiers).
+ */
+ private final Set previouslyDefinedCategoryIds;
+
+ /**
+ * The set of the defined commands before the change occurred. This is a set of
+ * strings (command identifiers).
+ */
+ private final Set previouslyDefinedCommandIds;
+
+ /**
+ * The set of the defined key configurations before the change occurred. This is
+ * a set of strings (key configuration identifiers).
+ */
+ private final Set previouslyDefinedKeyConfigurationIds;
+
+ /**
+ * Creates a new instance of this class.
+ *
+ * @param commandManager the instance of the interface
+ * that changed.
+ * @param activeContextIdsChanged true, iff the
+ * activeContextIdsChanged property
+ * changed.
+ * @param activeKeyConfigurationIdChanged true, iff the
+ * activeKeyConfigurationIdChanged
+ * property changed.
+ * @param activeLocaleChanged true, iff the activeLocaleChanged
+ * property changed.
+ * @param activePlatformChanged true, iff the
+ * activePlatformChanged property
+ * changed.
+ * @param definedCategoryIdsChanged true, iff the
+ * definedCategoryIdsChanged
+ * property changed.
+ * @param definedCommandIdsChanged true, iff the
+ * definedCommandIdsChanged property
+ * changed.
+ * @param definedKeyConfigurationIdsChanged true, iff the
+ * definedKeyConfigurationIdsChanged
+ * property changed.
+ * @param previouslyDefinedCategoryIds the set of identifiers to
+ * previously defined categories.
+ * This set may be empty. If this
+ * set is not empty, it must only
+ * contain instances of
+ * <code>String</code>. This set
+ * must be <code>null</code> if
+ * definedCategoryIdsChanged is
+ * <code>false</code> and must not
+ * be null if
+ * definedCategoryIdsChanged is
+ * <code>true</code>.
+ * @param previouslyDefinedCommandIds the set of identifiers to
+ * previously defined commands. This
+ * set may be empty. If this set is
+ * not empty, it must only contain
+ * instances of <code>String</code>.
+ * This set must be
+ * <code>null</code> if
+ * definedCommandIdsChanged is
+ * <code>false</code> and must not
+ * be null if
+ * definedContextIdsChanged is
+ * <code>true</code>.
+ * @param previouslyDefinedKeyConfigurationIds the set of identifiers to
+ * previously defined key
+ * configurations. This set may be
+ * empty. If this set is not empty,
+ * it must only contain instances of
+ * <code>String</code>. This set
+ * must be <code>null</code> if
+ * definedKeyConfigurationIdsChanged
+ * is <code>false</code> and must
+ * not be null if
+ * definedKeyConfigurationIdsChanged
+ * is <code>true</code>.
+ */
+ public CommandManagerEvent(ICommandManager commandManager, boolean activeContextIdsChanged,
+ boolean activeKeyConfigurationIdChanged, boolean activeLocaleChanged, boolean activePlatformChanged,
+ boolean definedCategoryIdsChanged, boolean definedCommandIdsChanged,
+ boolean definedKeyConfigurationIdsChanged, Set previouslyDefinedCategoryIds,
+ Set previouslyDefinedCommandIds, Set previouslyDefinedKeyConfigurationIds) {
+ if (commandManager == null) {
throw new NullPointerException();
}
- if (!definedCategoryIdsChanged && previouslyDefinedCategoryIds != null) {
+ if (!definedCategoryIdsChanged && previouslyDefinedCategoryIds != null) {
throw new IllegalArgumentException();
}
- if (!definedCommandIdsChanged && previouslyDefinedCommandIds != null) {
+ if (!definedCommandIdsChanged && previouslyDefinedCommandIds != null) {
throw new IllegalArgumentException();
}
- if (!definedKeyConfigurationIdsChanged
- && previouslyDefinedKeyConfigurationIds != null) {
+ if (!definedKeyConfigurationIdsChanged && previouslyDefinedKeyConfigurationIds != null) {
throw new IllegalArgumentException();
}
- if (definedCategoryIdsChanged) {
- this.previouslyDefinedCategoryIds = Util.safeCopy(
- previouslyDefinedCategoryIds, String.class);
- } else {
- this.previouslyDefinedCategoryIds = null;
- }
-
- if (definedCommandIdsChanged) {
- this.previouslyDefinedCommandIds = Util.safeCopy(
- previouslyDefinedCommandIds, String.class);
- } else {
- this.previouslyDefinedCommandIds = null;
- }
-
- if (definedKeyConfigurationIdsChanged) {
- this.previouslyDefinedKeyConfigurationIds = Util.safeCopy(
- previouslyDefinedKeyConfigurationIds, String.class);
- } else {
- this.previouslyDefinedKeyConfigurationIds = null;
- }
-
- this.commandManager = commandManager;
- this.activeContextIdsChanged = activeContextIdsChanged;
- this.activeKeyConfigurationIdChanged = activeKeyConfigurationIdChanged;
- this.activeLocaleChanged = activeLocaleChanged;
- this.activePlatformChanged = activePlatformChanged;
- this.definedCategoryIdsChanged = definedCategoryIdsChanged;
- this.definedCommandIdsChanged = definedCommandIdsChanged;
- this.definedKeyConfigurationIdsChanged = definedKeyConfigurationIdsChanged;
- }
-
- /**
- * Returns the instance of the interface that changed.
- *
- * @return the instance of the interface that changed. Guaranteed not to be
- * <code>null</code>.
- */
+ if (definedCategoryIdsChanged) {
+ this.previouslyDefinedCategoryIds = Util.safeCopy(previouslyDefinedCategoryIds, String.class);
+ } else {
+ this.previouslyDefinedCategoryIds = null;
+ }
+
+ if (definedCommandIdsChanged) {
+ this.previouslyDefinedCommandIds = Util.safeCopy(previouslyDefinedCommandIds, String.class);
+ } else {
+ this.previouslyDefinedCommandIds = null;
+ }
+
+ if (definedKeyConfigurationIdsChanged) {
+ this.previouslyDefinedKeyConfigurationIds = Util.safeCopy(previouslyDefinedKeyConfigurationIds,
+ String.class);
+ } else {
+ this.previouslyDefinedKeyConfigurationIds = null;
+ }
+
+ this.commandManager = commandManager;
+ this.activeContextIdsChanged = activeContextIdsChanged;
+ this.activeKeyConfigurationIdChanged = activeKeyConfigurationIdChanged;
+ this.activeLocaleChanged = activeLocaleChanged;
+ this.activePlatformChanged = activePlatformChanged;
+ this.definedCategoryIdsChanged = definedCategoryIdsChanged;
+ this.definedCommandIdsChanged = definedCommandIdsChanged;
+ this.definedKeyConfigurationIdsChanged = definedKeyConfigurationIdsChanged;
+ }
+
+ /**
+ * Returns the instance of the interface that changed.
+ *
+ * @return the instance of the interface that changed. Guaranteed not to be
+ * <code>null</code>.
+ */
@Deprecated
- public ICommandManager getCommandManager() {
- return commandManager;
- }
-
- /**
- * Returns the set of identifiers to previously defined categories.
- *
- * @return the set of identifiers to previously defined categories. This set
- * may be empty. If this set is not empty, it is guaranteed to only
- * contain instances of <code>String</code>. This set is
- * guaranteed to be <code>null</code> if
- * haveDefinedCategoryIdsChanged() is <code>false</code> and is
- * guaranteed to not be null if haveDefinedCategoryIdsChanged() is
- * <code>true</code>.
- */
+ public ICommandManager getCommandManager() {
+ return commandManager;
+ }
+
+ /**
+ * Returns the set of identifiers to previously defined categories.
+ *
+ * @return the set of identifiers to previously defined categories. This set may
+ * be empty. If this set is not empty, it is guaranteed to only contain
+ * instances of <code>String</code>. This set is guaranteed to be
+ * <code>null</code> if haveDefinedCategoryIdsChanged() is
+ * <code>false</code> and is guaranteed to not be null if
+ * haveDefinedCategoryIdsChanged() is <code>true</code>.
+ */
@Deprecated
- public Set getPreviouslyDefinedCategoryIds() {
- return previouslyDefinedCategoryIds;
- }
-
- /**
- * Returns the set of identifiers to previously defined commands.
- *
- * @return the set of identifiers to previously defined commands. This set
- * may be empty. If this set is not empty, it is guaranteed to only
- * contain instances of <code>String</code>. This set is
- * guaranteed to be <code>null</code> if
- * haveDefinedCommandIdsChanged() is <code>false</code> and is
- * guaranteed to not be null if haveDefinedCommandIdsChanged() is
- * <code>true</code>.
- */
+ public Set getPreviouslyDefinedCategoryIds() {
+ return previouslyDefinedCategoryIds;
+ }
+
+ /**
+ * Returns the set of identifiers to previously defined commands.
+ *
+ * @return the set of identifiers to previously defined commands. This set may
+ * be empty. If this set is not empty, it is guaranteed to only contain
+ * instances of <code>String</code>. This set is guaranteed to be
+ * <code>null</code> if haveDefinedCommandIdsChanged() is
+ * <code>false</code> and is guaranteed to not be null if
+ * haveDefinedCommandIdsChanged() is <code>true</code>.
+ */
@Deprecated
- public Set getPreviouslyDefinedCommandIds() {
- return previouslyDefinedCommandIds;
- }
-
- /**
- * Returns the set of identifiers to previously defined key conigurations.
- *
- * @return the set of identifiers to previously defined key configurations.
- * This set may be empty. If this set is not empty, it is guaranteed
- * to only contain instances of <code>String</code>. This set is
- * guaranteed to be <code>null</code> if
- * haveDefinedKeyConfigurationIdsChanged() is <code>false</code>
- * and is guaranteed to not be null if
- * haveDefinedKeyConfigurationIdsChanged() is <code>true</code>.
- */
+ public Set getPreviouslyDefinedCommandIds() {
+ return previouslyDefinedCommandIds;
+ }
+
+ /**
+ * Returns the set of identifiers to previously defined key conigurations.
+ *
+ * @return the set of identifiers to previously defined key configurations. This
+ * set may be empty. If this set is not empty, it is guaranteed to only
+ * contain instances of <code>String</code>. This set is guaranteed to
+ * be <code>null</code> if haveDefinedKeyConfigurationIdsChanged() is
+ * <code>false</code> and is guaranteed to not be null if
+ * haveDefinedKeyConfigurationIdsChanged() is <code>true</code>.
+ */
@Deprecated
- public Set getPreviouslyDefinedKeyConfigurationIds() {
- return previouslyDefinedKeyConfigurationIds;
- }
-
- /**
- * Returns whether or not the activeKeyConfigurationId property changed.
- *
- * @return true, iff the activeKeyConfigurationId property changed.
- */
+ public Set getPreviouslyDefinedKeyConfigurationIds() {
+ return previouslyDefinedKeyConfigurationIds;
+ }
+
+ /**
+ * Returns whether or not the activeKeyConfigurationId property changed.
+ *
+ * @return true, iff the activeKeyConfigurationId property changed.
+ */
@Deprecated
- public boolean hasActiveKeyConfigurationIdChanged() {
- return activeKeyConfigurationIdChanged;
- }
-
- /**
- * Returns whether or not the activeLocale property changed.
- *
- * @return true, iff the activeLocale property changed.
- */
+ public boolean hasActiveKeyConfigurationIdChanged() {
+ return activeKeyConfigurationIdChanged;
+ }
+
+ /**
+ * Returns whether or not the activeLocale property changed.
+ *
+ * @return true, iff the activeLocale property changed.
+ */
@Deprecated
- public boolean hasActiveLocaleChanged() {
- return activeLocaleChanged;
- }
-
- /**
- * Returns whether or not the activePlatform property changed.
- *
- * @return true, iff the activePlatform property changed.
- */
+ public boolean hasActiveLocaleChanged() {
+ return activeLocaleChanged;
+ }
+
+ /**
+ * Returns whether or not the activePlatform property changed.
+ *
+ * @return true, iff the activePlatform property changed.
+ */
@Deprecated
- public boolean hasActivePlatformChanged() {
- return activePlatformChanged;
- }
-
- /**
- * Returns whether or not the activeContextIds property changed.
- *
- * @return true, iff the activeContextIds property changed.
- */
+ public boolean hasActivePlatformChanged() {
+ return activePlatformChanged;
+ }
+
+ /**
+ * Returns whether or not the activeContextIds property changed.
+ *
+ * @return true, iff the activeContextIds property changed.
+ */
@Deprecated
- public boolean haveActiveContextIdsChanged() {
- return activeContextIdsChanged;
- }
-
- /**
- * Returns whether or not the definedCategoryIds property changed.
- *
- * @return true, iff the definedCategoryIds property changed.
- */
+ public boolean haveActiveContextIdsChanged() {
+ return activeContextIdsChanged;
+ }
+
+ /**
+ * Returns whether or not the definedCategoryIds property changed.
+ *
+ * @return true, iff the definedCategoryIds property changed.
+ */
@Deprecated
- public boolean haveDefinedCategoryIdsChanged() {
- return definedCategoryIdsChanged;
- }
-
- /**
- * Returns whether or not the definedCommandIds property changed.
- *
- * @return true, iff the definedCommandIds property changed.
- */
+ public boolean haveDefinedCategoryIdsChanged() {
+ return definedCategoryIdsChanged;
+ }
+
+ /**
+ * Returns whether or not the definedCommandIds property changed.
+ *
+ * @return true, iff the definedCommandIds property changed.
+ */
@Deprecated
- public boolean haveDefinedCommandIdsChanged() {
- return definedCommandIdsChanged;
- }
-
- /**
- * Returns whether or not the definedKeyConfigurationIds property changed.
- *
- * @return true, iff the definedKeyConfigurationIds property changed.
- */
+ public boolean haveDefinedCommandIdsChanged() {
+ return definedCommandIdsChanged;
+ }
+
+ /**
+ * Returns whether or not the definedKeyConfigurationIds property changed.
+ *
+ * @return true, iff the definedKeyConfigurationIds property changed.
+ */
@Deprecated
- public boolean haveDefinedKeyConfigurationIdsChanged() {
- return definedKeyConfigurationIdsChanged;
- }
+ public boolean haveDefinedKeyConfigurationIdsChanged() {
+ return definedKeyConfigurationIdsChanged;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ExecutionException.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ExecutionException.java
index ea672359582..0bc50ecf166 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ExecutionException.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ExecutionException.java
@@ -27,36 +27,33 @@ package org.eclipse.ui.commands;
@SuppressWarnings("all")
public final class ExecutionException extends CommandException {
- /**
- * Generated serial version UID for this class.
- *
- * @since 3.1
- */
- private static final long serialVersionUID = 3258130262767448120L;
+ /**
+ * Generated serial version UID for this class.
+ *
+ * @since 3.1
+ */
+ private static final long serialVersionUID = 3258130262767448120L;
- /**
- * Creates a new instance of this class with the specified detail message
- * and cause.
- *
- * @param message
- * the detail message.
- * @param cause
- * the cause.
- */
- public ExecutionException(String message, Throwable cause) {
- super(message, cause);
- }
+ /**
+ * Creates a new instance of this class with the specified detail message and
+ * cause.
+ *
+ * @param message the detail message.
+ * @param cause the cause.
+ */
+ public ExecutionException(String message, Throwable cause) {
+ super(message, cause);
+ }
- /**
- * Constructs a new instance of <code>ExecutionException</code> using an
- * instance of the new <code>ExecutionException</code>.
- *
- * @param e
- * The exception from which this exception should be created;
- * must not be <code>null</code>.
- * @since 3.1
- */
- public ExecutionException(final org.eclipse.core.commands.ExecutionException e) {
- super(e.getMessage(), e);
- }
+ /**
+ * Constructs a new instance of <code>ExecutionException</code> using an
+ * instance of the new <code>ExecutionException</code>.
+ *
+ * @param e The exception from which this exception should be created; must not
+ * be <code>null</code>.
+ * @since 3.1
+ */
+ public ExecutionException(final org.eclipse.core.commands.ExecutionException e) {
+ super(e.getMessage(), e);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ExtensionParameterValues.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ExtensionParameterValues.java
index 525facc0402..416d92d1e37 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ExtensionParameterValues.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ExtensionParameterValues.java
@@ -52,8 +52,7 @@ import org.eclipse.core.runtime.IExecutableExtension;
*
* @since 3.1
*/
-public final class ExtensionParameterValues implements IParameterValues,
- IExecutableExtension {
+public final class ExtensionParameterValues implements IParameterValues, IExecutableExtension {
/**
* The delimiter between elements if the name-value pairs are specified in a
@@ -73,15 +72,14 @@ public final class ExtensionParameterValues implements IParameterValues,
}
@Override
- public void setInitializationData(final IConfigurationElement config,
- final String propertyName, final Object data) {
+ public void setInitializationData(final IConfigurationElement config, final String propertyName,
+ final Object data) {
if (data == null) {
parameterValues = Collections.EMPTY_MAP;
} else if (data instanceof String) {
parameterValues = new HashMap();
- final StringTokenizer tokenizer = new StringTokenizer(
- (String) data, DELIMITER);
+ final StringTokenizer tokenizer = new StringTokenizer((String) data, DELIMITER);
while (tokenizer.hasMoreTokens()) {
final String name = tokenizer.nextToken();
if (tokenizer.hasMoreTokens()) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/HandlerEvent.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/HandlerEvent.java
index eee789341b6..89717303d0e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/HandlerEvent.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/HandlerEvent.java
@@ -31,117 +31,116 @@ import org.eclipse.ui.internal.util.Util;
@SuppressWarnings("all")
public final class HandlerEvent {
- /**
- * Whether the attributes of the handler changed.
- */
- private final boolean attributeValuesByNameChanged;
+ /**
+ * Whether the attributes of the handler changed.
+ */
+ private final boolean attributeValuesByNameChanged;
- /**
- * The handler that changed; this value is never <code>null</code>.
- */
- private final IHandler handler;
+ /**
+ * The handler that changed; this value is never <code>null</code>.
+ */
+ private final IHandler handler;
- /**
- * This is the cached result of getPreviousAttributeValuesByName. It is
- * computed the first time getPreviousAttributeValuesByName is called.
- */
- private Map previousAttributeValuesByName;
+ /**
+ * This is the cached result of getPreviousAttributeValuesByName. It is computed
+ * the first time getPreviousAttributeValuesByName is called.
+ */
+ private Map previousAttributeValuesByName;
- /**
- * The map of previous attributes, if they changed. If they did not change,
- * then this value is <code>null</code>. The map's keys are the attribute
- * names (strings), and its value are any object.
- *
- * This is the original map passed into the constructor. This object always
- * returns a copy of this map, not the original. However the constructor of
- * this object is called very frequently and the map is rarely requested,
- * so we only copy the map the first time it is requested.
- *
- * @since 3.1
- */
- private final Map originalPreviousAttributeValuesByName;
+ /**
+ * The map of previous attributes, if they changed. If they did not change, then
+ * this value is <code>null</code>. The map's keys are the attribute names
+ * (strings), and its value are any object.
+ *
+ * This is the original map passed into the constructor. This object always
+ * returns a copy of this map, not the original. However the constructor of this
+ * object is called very frequently and the map is rarely requested, so we only
+ * copy the map the first time it is requested.
+ *
+ * @since 3.1
+ */
+ private final Map originalPreviousAttributeValuesByName;
- /**
- * Creates a new instance of this class.
- *
- * @param handler
- * the instance of the interface that changed.
- * @param attributeValuesByNameChanged
- * true, iff the attributeValuesByName property changed.
- * @param previousAttributeValuesByName
- * the map of previous attribute values by name. This map may be
- * empty. If this map is not empty, it's collection of keys must
- * only contain instances of <code>String</code>. This map
- * must be <code>null</code> if attributeValuesByNameChanged is
- * <code>false</code> and must not be null if
- * attributeValuesByNameChanged is <code>true</code>.
- */
+ /**
+ * Creates a new instance of this class.
+ *
+ * @param handler the instance of the interface that
+ * changed.
+ * @param attributeValuesByNameChanged true, iff the attributeValuesByName
+ * property changed.
+ * @param previousAttributeValuesByName the map of previous attribute values by
+ * name. This map may be empty. If this map
+ * is not empty, it's collection of keys
+ * must only contain instances of
+ * <code>String</code>. This map must be
+ * <code>null</code> if
+ * attributeValuesByNameChanged is
+ * <code>false</code> and must not be null
+ * if attributeValuesByNameChanged is
+ * <code>true</code>.
+ */
@Deprecated
- public HandlerEvent(IHandler handler, boolean attributeValuesByNameChanged,
- Map previousAttributeValuesByName) {
- if (handler == null) {
+ public HandlerEvent(IHandler handler, boolean attributeValuesByNameChanged, Map previousAttributeValuesByName) {
+ if (handler == null) {
throw new NullPointerException();
}
- if (!attributeValuesByNameChanged
- && previousAttributeValuesByName != null) {
+ if (!attributeValuesByNameChanged && previousAttributeValuesByName != null) {
throw new IllegalArgumentException();
}
- if (attributeValuesByNameChanged) {
- this.originalPreviousAttributeValuesByName = previousAttributeValuesByName;
- } else {
- this.originalPreviousAttributeValuesByName = null;
- }
+ if (attributeValuesByNameChanged) {
+ this.originalPreviousAttributeValuesByName = previousAttributeValuesByName;
+ } else {
+ this.originalPreviousAttributeValuesByName = null;
+ }
- this.handler = handler;
- this.attributeValuesByNameChanged = attributeValuesByNameChanged;
- }
+ this.handler = handler;
+ this.attributeValuesByNameChanged = attributeValuesByNameChanged;
+ }
- /**
- * Returns the instance of the interface that changed.
- *
- * @return the instance of the interface that changed. Guaranteed not to be
- * <code>null</code>.
- */
+ /**
+ * Returns the instance of the interface that changed.
+ *
+ * @return the instance of the interface that changed. Guaranteed not to be
+ * <code>null</code>.
+ */
@Deprecated
- public IHandler getHandler() {
- return handler;
- }
+ public IHandler getHandler() {
+ return handler;
+ }
- /**
- * Returns the map of previous attribute values by name.
- *
- * @return the map of previous attribute values by name. This map may be
- * empty. If this map is not empty, it's collection of keys is
- * guaranteed to only contain instances of <code>String</code>.
- * This map is guaranteed to be <code>null</code> if
- * haveAttributeValuesByNameChanged() is <code>false</code> and is
- * guaranteed to not be null if haveAttributeValuesByNameChanged()
- * is <code>true</code>.
- */
+ /**
+ * Returns the map of previous attribute values by name.
+ *
+ * @return the map of previous attribute values by name. This map may be empty.
+ * If this map is not empty, it's collection of keys is guaranteed to
+ * only contain instances of <code>String</code>. This map is guaranteed
+ * to be <code>null</code> if haveAttributeValuesByNameChanged() is
+ * <code>false</code> and is guaranteed to not be null if
+ * haveAttributeValuesByNameChanged() is <code>true</code>.
+ */
@Deprecated
- public Map getPreviousAttributeValuesByName() {
- if (originalPreviousAttributeValuesByName == null) {
- return null;
- }
+ public Map getPreviousAttributeValuesByName() {
+ if (originalPreviousAttributeValuesByName == null) {
+ return null;
+ }
- if (previousAttributeValuesByName == null) {
- previousAttributeValuesByName = Util.safeCopy(
- originalPreviousAttributeValuesByName, String.class, Object.class,
- false, true);
- }
+ if (previousAttributeValuesByName == null) {
+ previousAttributeValuesByName = Util.safeCopy(originalPreviousAttributeValuesByName, String.class,
+ Object.class, false, true);
+ }
- return previousAttributeValuesByName;
- }
+ return previousAttributeValuesByName;
+ }
- /**
- * Returns whether or not the attributeValuesByName property changed.
- *
- * @return true, iff the attributeValuesByName property changed.
- */
+ /**
+ * Returns whether or not the attributeValuesByName property changed.
+ *
+ * @return true, iff the attributeValuesByName property changed.
+ */
@Deprecated
- public boolean haveAttributeValuesByNameChanged() {
- return attributeValuesByNameChanged;
- }
+ public boolean haveAttributeValuesByNameChanged() {
+ return attributeValuesByNameChanged;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/HandlerSubmission.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/HandlerSubmission.java
index 3a712e758e1..586b63d6f58 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/HandlerSubmission.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/HandlerSubmission.java
@@ -46,212 +46,203 @@ import org.eclipse.ui.internal.util.Util;
@SuppressWarnings("all")
public final class HandlerSubmission implements Comparable {
- /**
- * The part identifier for the part that should be active before this
- * submission can be considered. This value can be <code>null</code>, which
- * indicates that it should match any part.
- */
- private final String activePartId;
-
- /**
- * The shell that must be active before this submission can be considered.
- * This value can be <code>null</code>, which indicates that it should match
- * any shell.
- */
- private final Shell activeShell;
-
- /**
- * The workbench site that must be active before this submission can be
- * considered. This value can be <code>null</code>, which indicates that it
- * should match an workbench part site.
- */
- private final IWorkbenchPartSite activeWorkbenchPartSite;
-
- /**
- * The identifier for the command which the submitted handler handles. This
- * value cannot be <code>null</code>.
- */
- private final String commandId;
-
- /**
- * The handler being submitted. This value cannot be <code>null</code>.
- */
- private final IHandler handler;
-
- /**
- * The priority for this submission. In the event of all other factors
- * being equal, the priority will be considered in an attempt to resolve
- * conflicts. This value cannot be <code>null</code>.
- */
- private final Priority priority;
-
- /**
- * A lazily computed cache of the string representation of this submission.
- * This value is computed once; before it is computed, it is
- * <code>null</code>.
- */
- private transient String string;
-
- /**
- * Creates a new instance of this class.
- *
- * @param activePartId
- * the identifier of the part that must be active for this
- * request to be considered. May be <code>null</code>.
- * @param activeShell
- * the shell that must be active for this request to be
- * considered. May be <code>null</code>.
- * @param activeWorkbenchPartSite
- * the workbench part site of the part that must be active for
- * this request to be considered. May be <code>null</code>.
- * @param commandId
- * the identifier of the command to be handled. Must not be
- * <code>null</code>.
- * @param handler
- * the handler. Must not be <code>null</code>.
- * @param priority
- * the priority. Must not be <code>null</code>.
- */
+ /**
+ * The part identifier for the part that should be active before this submission
+ * can be considered. This value can be <code>null</code>, which indicates that
+ * it should match any part.
+ */
+ private final String activePartId;
+
+ /**
+ * The shell that must be active before this submission can be considered. This
+ * value can be <code>null</code>, which indicates that it should match any
+ * shell.
+ */
+ private final Shell activeShell;
+
+ /**
+ * The workbench site that must be active before this submission can be
+ * considered. This value can be <code>null</code>, which indicates that it
+ * should match an workbench part site.
+ */
+ private final IWorkbenchPartSite activeWorkbenchPartSite;
+
+ /**
+ * The identifier for the command which the submitted handler handles. This
+ * value cannot be <code>null</code>.
+ */
+ private final String commandId;
+
+ /**
+ * The handler being submitted. This value cannot be <code>null</code>.
+ */
+ private final IHandler handler;
+
+ /**
+ * The priority for this submission. In the event of all other factors being
+ * equal, the priority will be considered in an attempt to resolve conflicts.
+ * This value cannot be <code>null</code>.
+ */
+ private final Priority priority;
+
+ /**
+ * A lazily computed cache of the string representation of this submission. This
+ * value is computed once; before it is computed, it is <code>null</code>.
+ */
+ private transient String string;
+
+ /**
+ * Creates a new instance of this class.
+ *
+ * @param activePartId the identifier of the part that must be active
+ * for this request to be considered. May be
+ * <code>null</code>.
+ * @param activeShell the shell that must be active for this request
+ * to be considered. May be <code>null</code>.
+ * @param activeWorkbenchPartSite the workbench part site of the part that must
+ * be active for this request to be considered.
+ * May be <code>null</code>.
+ * @param commandId the identifier of the command to be handled.
+ * Must not be <code>null</code>.
+ * @param handler the handler. Must not be <code>null</code>.
+ * @param priority the priority. Must not be <code>null</code>.
+ */
@Deprecated
- public HandlerSubmission(String activePartId, Shell activeShell,
- IWorkbenchPartSite activeWorkbenchPartSite, String commandId,
- IHandler handler, Priority priority) {
- if (commandId == null || handler == null || priority == null) {
+ public HandlerSubmission(String activePartId, Shell activeShell, IWorkbenchPartSite activeWorkbenchPartSite,
+ String commandId, IHandler handler, Priority priority) {
+ if (commandId == null || handler == null || priority == null) {
throw new NullPointerException();
}
- this.activePartId = activePartId;
- this.activeShell = activeShell;
- this.activeWorkbenchPartSite = activeWorkbenchPartSite;
- this.commandId = commandId;
- this.handler = handler;
- this.priority = priority;
- }
-
- /**
- * @see Comparable#compareTo(java.lang.Object)
- */
+ this.activePartId = activePartId;
+ this.activeShell = activeShell;
+ this.activeWorkbenchPartSite = activeWorkbenchPartSite;
+ this.commandId = commandId;
+ this.handler = handler;
+ this.priority = priority;
+ }
+
+ /**
+ * @see Comparable#compareTo(java.lang.Object)
+ */
@Override
@Deprecated
- public int compareTo(Object object) {
- HandlerSubmission castedObject = (HandlerSubmission) object;
- int compareTo = Util.compare(activeWorkbenchPartSite,
- castedObject.activeWorkbenchPartSite);
+ public int compareTo(Object object) {
+ HandlerSubmission castedObject = (HandlerSubmission) object;
+ int compareTo = Util.compare(activeWorkbenchPartSite, castedObject.activeWorkbenchPartSite);
- if (compareTo == 0) {
- compareTo = Util.compare(activePartId, castedObject.activePartId);
+ if (compareTo == 0) {
+ compareTo = Util.compare(activePartId, castedObject.activePartId);
- if (compareTo == 0) {
- compareTo = Util.compare(activeShell, castedObject.activeShell);
+ if (compareTo == 0) {
+ compareTo = Util.compare(activeShell, castedObject.activeShell);
- if (compareTo == 0) {
- compareTo = Util.compare(priority, castedObject.priority);
+ if (compareTo == 0) {
+ compareTo = Util.compare(priority, castedObject.priority);
- if (compareTo == 0) {
- compareTo = Util.compare(commandId,
- castedObject.commandId);
+ if (compareTo == 0) {
+ compareTo = Util.compare(commandId, castedObject.commandId);
- if (compareTo == 0) {
- compareTo = Util.compare(handler,
- castedObject.handler);
+ if (compareTo == 0) {
+ compareTo = Util.compare(handler, castedObject.handler);
}
- }
- }
- }
- }
+ }
+ }
+ }
+ }
- return compareTo;
- }
+ return compareTo;
+ }
- /**
- * Returns the identifier of the part that must be active for this request
- * to be considered.
- *
- * @return the identifier of the part that must be active for this request
- * to be considered. May be <code>null</code>.
- */
+ /**
+ * Returns the identifier of the part that must be active for this request to be
+ * considered.
+ *
+ * @return the identifier of the part that must be active for this request to be
+ * considered. May be <code>null</code>.
+ */
@Deprecated
- public String getActivePartId() {
- return activePartId;
- }
-
- /**
- * Returns the shell that must be active for this request to be considered.
- *
- * @return the shell that must be active for this request to be considered.
- * May be <code>null</code>.
- */
+ public String getActivePartId() {
+ return activePartId;
+ }
+
+ /**
+ * Returns the shell that must be active for this request to be considered.
+ *
+ * @return the shell that must be active for this request to be considered. May
+ * be <code>null</code>.
+ */
@Deprecated
- public Shell getActiveShell() {
- return activeShell;
- }
-
- /**
- * Returns the workbench part site of the part that must be active for this
- * request to be considered.
- *
- * @return the workbench part site of the part that must be active for this
- * request to be considered. May be <code>null</code>.
- */
+ public Shell getActiveShell() {
+ return activeShell;
+ }
+
+ /**
+ * Returns the workbench part site of the part that must be active for this
+ * request to be considered.
+ *
+ * @return the workbench part site of the part that must be active for this
+ * request to be considered. May be <code>null</code>.
+ */
@Deprecated
- public IWorkbenchPartSite getActiveWorkbenchPartSite() {
- return activeWorkbenchPartSite;
- }
-
- /**
- * Returns the identifier of the command to be handled.
- *
- * @return the identifier of the command to be handled. Guaranteed not to be
- * <code>null</code>.
- */
+ public IWorkbenchPartSite getActiveWorkbenchPartSite() {
+ return activeWorkbenchPartSite;
+ }
+
+ /**
+ * Returns the identifier of the command to be handled.
+ *
+ * @return the identifier of the command to be handled. Guaranteed not to be
+ * <code>null</code>.
+ */
@Deprecated
- public String getCommandId() {
- return commandId;
- }
-
- /**
- * Returns the handler.
- *
- * @return the handler. Guaranteed not to be <code>null</code>.
- */
+ public String getCommandId() {
+ return commandId;
+ }
+
+ /**
+ * Returns the handler.
+ *
+ * @return the handler. Guaranteed not to be <code>null</code>.
+ */
@Deprecated
- public IHandler getHandler() {
- return handler;
- }
-
- /**
- * Returns the priority.
- *
- * @return the priority. Guaranteed not to be <code>null</code>.
- */
+ public IHandler getHandler() {
+ return handler;
+ }
+
+ /**
+ * Returns the priority.
+ *
+ * @return the priority. Guaranteed not to be <code>null</code>.
+ */
@Deprecated
- public Priority getPriority() {
- return priority;
- }
+ public Priority getPriority() {
+ return priority;
+ }
- /**
- * @see Object#toString()
- */
- @Override
+ /**
+ * @see Object#toString()
+ */
+ @Override
public String toString() {
- if (string == null) {
- final StringBuilder stringBuffer = new StringBuilder();
- stringBuffer.append("[activePartId="); //$NON-NLS-1$
- stringBuffer.append(activePartId);
- stringBuffer.append(",activeShell="); //$NON-NLS-1$
- stringBuffer.append(activeShell);
- stringBuffer.append(",activeWorkbenchSite="); //$NON-NLS-1$
- stringBuffer.append(activeWorkbenchPartSite);
- stringBuffer.append(",commandId="); //$NON-NLS-1$
- stringBuffer.append(commandId);
- stringBuffer.append(",handler="); //$NON-NLS-1$
- stringBuffer.append(handler);
- stringBuffer.append(",priority="); //$NON-NLS-1$
- stringBuffer.append(priority);
- stringBuffer.append(']');
- string = stringBuffer.toString();
- }
+ if (string == null) {
+ final StringBuilder stringBuffer = new StringBuilder();
+ stringBuffer.append("[activePartId="); //$NON-NLS-1$
+ stringBuffer.append(activePartId);
+ stringBuffer.append(",activeShell="); //$NON-NLS-1$
+ stringBuffer.append(activeShell);
+ stringBuffer.append(",activeWorkbenchSite="); //$NON-NLS-1$
+ stringBuffer.append(activeWorkbenchPartSite);
+ stringBuffer.append(",commandId="); //$NON-NLS-1$
+ stringBuffer.append(commandId);
+ stringBuffer.append(",handler="); //$NON-NLS-1$
+ stringBuffer.append(handler);
+ stringBuffer.append(",priority="); //$NON-NLS-1$
+ stringBuffer.append(priority);
+ stringBuffer.append(']');
+ string = stringBuffer.toString();
+ }
- return string;
- }
+ return string;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICategory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICategory.java
index 552af7d98d5..ace7c58b444 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICategory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICategory.java
@@ -23,9 +23,9 @@ package org.eclipse.ui.commands;
* user (e.g., keys preference page) will be grouped by category.
* </p>
* <p>
- * An instance of <code>ICategory</code> is a handle representing a category
- * as defined by the extension point <code>org.eclipse.ui.commands</code>.
- * The identifier of the handle is identifier of the category being represented.
+ * An instance of <code>ICategory</code> is a handle representing a category as
+ * defined by the extension point <code>org.eclipse.ui.commands</code>. The
+ * identifier of the handle is identifier of the category being represented.
* </p>
* <p>
* An instance of <code>ICategory</code> can be obtained from an instance of
@@ -53,91 +53,88 @@ package org.eclipse.ui.commands;
@SuppressWarnings("all")
public interface ICategory extends Comparable {
- /**
- * Registers an instance of <code>ICategoryListener</code> to listen for
- * changes to attributes of this instance.
- *
- * @param categoryListener
- * the instance of <code>ICategoryListener</code> to register.
- * Must not be <code>null</code>. If an attempt is made to
- * register an instance of <code>ICategoryListener</code>
- * which is already registered with this instance, no operation
- * is performed.
- */
+ /**
+ * Registers an instance of <code>ICategoryListener</code> to listen for changes
+ * to attributes of this instance.
+ *
+ * @param categoryListener the instance of <code>ICategoryListener</code> to
+ * register. Must not be <code>null</code>. If an
+ * attempt is made to register an instance of
+ * <code>ICategoryListener</code> which is already
+ * registered with this instance, no operation is
+ * performed.
+ */
@Deprecated
- void addCategoryListener(ICategoryListener categoryListener);
+ void addCategoryListener(ICategoryListener categoryListener);
- /**
- * <p>
- * Returns the description of the category represented by this handle,
- * suitable for display to the user.
- * </p>
- * <p>
- * Notification is sent to all registered listeners if this attribute
- * changes.
- * </p>
- *
- * @return the description of the category represented by this handle.
- * Guaranteed not to be <code>null</code>.
- * @throws NotDefinedException
- * if the category represented by this handle is not defined.
- */
+ /**
+ * <p>
+ * Returns the description of the category represented by this handle, suitable
+ * for display to the user.
+ * </p>
+ * <p>
+ * Notification is sent to all registered listeners if this attribute changes.
+ * </p>
+ *
+ * @return the description of the category represented by this handle.
+ * Guaranteed not to be <code>null</code>.
+ * @throws NotDefinedException if the category represented by this handle is not
+ * defined.
+ */
@Deprecated
- String getDescription() throws NotDefinedException;
+ String getDescription() throws NotDefinedException;
- /**
- * Returns the identifier of this handle.
- *
- * @return the identifier of this handle. Guaranteed not to be <code>null</code>.
- */
+ /**
+ * Returns the identifier of this handle.
+ *
+ * @return the identifier of this handle. Guaranteed not to be
+ * <code>null</code>.
+ */
@Deprecated
- String getId();
+ String getId();
- /**
- * <p>
- * Returns the name of the category represented by this handle, suitable
- * for display to the user.
- * </p>
- * <p>
- * Notification is sent to all registered listeners if this attribute
- * changes.
- * </p>
- *
- * @return the name of the category represented by this handle. Guaranteed
- * not to be <code>null</code>.
- * @throws NotDefinedException
- * if the category represented by this handle is not defined.
- */
+ /**
+ * <p>
+ * Returns the name of the category represented by this handle, suitable for
+ * display to the user.
+ * </p>
+ * <p>
+ * Notification is sent to all registered listeners if this attribute changes.
+ * </p>
+ *
+ * @return the name of the category represented by this handle. Guaranteed not
+ * to be <code>null</code>.
+ * @throws NotDefinedException if the category represented by this handle is not
+ * defined.
+ */
@Deprecated
- String getName() throws NotDefinedException;
+ String getName() throws NotDefinedException;
- /**
- * <p>
- * Returns whether or not the category represented by this handle is
- * defined.
- * </p>
- * <p>
- * Notification is sent to all registered listeners if this attribute
- * changes.
- * </p>
- *
- * @return <code>true</code>, iff the category represented by this
- * handle is defined.
- */
+ /**
+ * <p>
+ * Returns whether or not the category represented by this handle is defined.
+ * </p>
+ * <p>
+ * Notification is sent to all registered listeners if this attribute changes.
+ * </p>
+ *
+ * @return <code>true</code>, iff the category represented by this handle is
+ * defined.
+ */
@Deprecated
- boolean isDefined();
+ boolean isDefined();
- /**
- * Unregisters an instance of <code>ICategoryListener</code> listening
- * for changes to attributes of this instance.
- *
- * @param categoryListener
- * the instance of <code>ICategoryListener</code> to
- * unregister. Must not be <code>null</code>. If an attempt
- * is made to unregister an instance of <code>ICategoryListener</code>
- * which is not already registered with this instance, no
- * operation is performed.
- */
+ /**
+ * Unregisters an instance of <code>ICategoryListener</code> listening for
+ * changes to attributes of this instance.
+ *
+ * @param categoryListener the instance of <code>ICategoryListener</code> to
+ * unregister. Must not be <code>null</code>. If an
+ * attempt is made to unregister an instance of
+ * <code>ICategoryListener</code> which is not already
+ * registered with this instance, no operation is
+ * performed.
+ */
@Deprecated
- void removeCategoryListener(ICategoryListener categoryListener);
+ void removeCategoryListener(ICategoryListener categoryListener);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICategoryListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICategoryListener.java
index aeb65968b17..bb1bbb1099c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICategoryListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICategoryListener.java
@@ -35,14 +35,14 @@ package org.eclipse.ui.commands;
@SuppressWarnings("all")
public interface ICategoryListener {
- /**
- * Notifies that one or more attributes of an instance of
- * <code>ICategory</code> have changed. Specific details are described in
- * the <code>CategoryEvent</code>.
- *
- * @param categoryEvent
- * the category event. Guaranteed not to be <code>null</code>.
- */
+ /**
+ * Notifies that one or more attributes of an instance of <code>ICategory</code>
+ * have changed. Specific details are described in the
+ * <code>CategoryEvent</code>.
+ *
+ * @param categoryEvent the category event. Guaranteed not to be
+ * <code>null</code>.
+ */
@Deprecated
- void categoryChanged(CategoryEvent categoryEvent);
+ void categoryChanged(CategoryEvent categoryEvent);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommand.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommand.java
index 6c7f6fa6b69..6f668ffd8a3 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommand.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommand.java
@@ -50,178 +50,165 @@ import java.util.Map;
@SuppressWarnings("all")
public interface ICommand extends Comparable {
- /**
- * Registers an instance of <code>ICommandListener</code> to listen for
- * changes to attributes of this instance.
- *
- * @param commandListener
- * the instance of <code>ICommandListener</code> to register.
- * Must not be <code>null</code>. If an attempt is made to
- * register an instance of <code>ICommandListener</code> which
- * is already registered with this instance, no operation is
- * performed.
- */
+ /**
+ * Registers an instance of <code>ICommandListener</code> to listen for changes
+ * to attributes of this instance.
+ *
+ * @param commandListener the instance of <code>ICommandListener</code> to
+ * register. Must not be <code>null</code>. If an attempt
+ * is made to register an instance of
+ * <code>ICommandListener</code> which is already
+ * registered with this instance, no operation is
+ * performed.
+ */
@Deprecated
- void addCommandListener(ICommandListener commandListener);
+ void addCommandListener(ICommandListener commandListener);
- /**
- * Executes with the map of parameter values by name.
- *
- * @param parameterValuesByName
- * the map of parameter values by name. Reserved for future use,
- * must be <code>null</code>.
- * @return the result of the execution. Reserved for future use, must be
- * <code>null</code>.
- * @throws ExecutionException
- * if an exception occurred during execution.
- * @throws NotHandledException
- * if this is not handled.
- */
+ /**
+ * Executes with the map of parameter values by name.
+ *
+ * @param parameterValuesByName the map of parameter values by name. Reserved
+ * for future use, must be <code>null</code>.
+ * @return the result of the execution. Reserved for future use, must be
+ * <code>null</code>.
+ * @throws ExecutionException if an exception occurred during execution.
+ * @throws NotHandledException if this is not handled.
+ */
@Deprecated
- Object execute(Map parameterValuesByName) throws ExecutionException,
- NotHandledException;
+ Object execute(Map parameterValuesByName) throws ExecutionException, NotHandledException;
- /**
- * Returns the map of attribute values by name.
- * <p>
- * Notification is sent to all registered listeners if this property
- * changes.
- * </p>
- *
- * @return the map of attribute values by name. This map may be empty, but
- * is guaranteed not to be <code>null</code>. If this map is not
- * empty, its collection of keys is guaranteed to only contain
- * instances of <code>String</code>.
- * @throws NotHandledException
- * if this is not handled.
- */
+ /**
+ * Returns the map of attribute values by name.
+ * <p>
+ * Notification is sent to all registered listeners if this property changes.
+ * </p>
+ *
+ * @return the map of attribute values by name. This map may be empty, but is
+ * guaranteed not to be <code>null</code>. If this map is not empty, its
+ * collection of keys is guaranteed to only contain instances of
+ * <code>String</code>.
+ * @throws NotHandledException if this is not handled.
+ */
@Deprecated
- Map getAttributeValuesByName() throws NotHandledException;
+ Map getAttributeValuesByName() throws NotHandledException;
- /**
- * <p>
- * Returns the identifier of the category of the command represented by this
- * handle.
- * </p>
- * <p>
- * Notification is sent to all registered listeners if this attribute
- * changes.
- * </p>
- *
- * @return the identifier of the category of the command represented by this
- * handle. May be <code>null</code>.
- * @throws NotDefinedException
- * if the command represented by this handle is not defined.
- */
+ /**
+ * <p>
+ * Returns the identifier of the category of the command represented by this
+ * handle.
+ * </p>
+ * <p>
+ * Notification is sent to all registered listeners if this attribute changes.
+ * </p>
+ *
+ * @return the identifier of the category of the command represented by this
+ * handle. May be <code>null</code>.
+ * @throws NotDefinedException if the command represented by this handle is not
+ * defined.
+ */
@Deprecated
- String getCategoryId() throws NotDefinedException;
+ String getCategoryId() throws NotDefinedException;
- /**
- * <p>
- * Returns the description of the command represented by this handle,
- * suitable for display to the user.
- * </p>
- * <p>
- * Notification is sent to all registered listeners if this attribute
- * changes.
- * </p>
- *
- * @return the description of the command represented by this handle.
- * Guaranteed not to be <code>null</code>.
- * @throws NotDefinedException
- * if the command represented by this handle is not defined.
- */
+ /**
+ * <p>
+ * Returns the description of the command represented by this handle, suitable
+ * for display to the user.
+ * </p>
+ * <p>
+ * Notification is sent to all registered listeners if this attribute changes.
+ * </p>
+ *
+ * @return the description of the command represented by this handle. Guaranteed
+ * not to be <code>null</code>.
+ * @throws NotDefinedException if the command represented by this handle is not
+ * defined.
+ */
@Deprecated
- String getDescription() throws NotDefinedException;
+ String getDescription() throws NotDefinedException;
- /**
- * Returns the identifier of this handle.
- *
- * @return the identifier of this handle. Guaranteed not to be
- * <code>null</code>.
- */
+ /**
+ * Returns the identifier of this handle.
+ *
+ * @return the identifier of this handle. Guaranteed not to be
+ * <code>null</code>.
+ */
@Deprecated
- String getId();
+ String getId();
- /**
- * <p>
- * Returns the list of key sequence bindings for this handle. This method
- * will return all key sequence bindings for this handle's identifier,
- * whether or not the command represented by this handle is defined.
- * </p>
- * <p>
- * Notification is sent to all registered listeners if this attribute
- * changes.
- * </p>
- *
- * @return the list of key sequence bindings. This list may be empty, but is
- * guaranteed not to be <code>null</code>. If this list is not
- * empty, it is guaranteed to only contain instances of
- * <code>IKeySequenceBinding</code>.
- */
- List getKeySequenceBindings();
+ /**
+ * <p>
+ * Returns the list of key sequence bindings for this handle. This method will
+ * return all key sequence bindings for this handle's identifier, whether or not
+ * the command represented by this handle is defined.
+ * </p>
+ * <p>
+ * Notification is sent to all registered listeners if this attribute changes.
+ * </p>
+ *
+ * @return the list of key sequence bindings. This list may be empty, but is
+ * guaranteed not to be <code>null</code>. If this list is not empty, it
+ * is guaranteed to only contain instances of
+ * <code>IKeySequenceBinding</code>.
+ */
+ List getKeySequenceBindings();
- /**
- * <p>
- * Returns the name of the command represented by this handle, suitable for
- * display to the user.
- * </p>
- * <p>
- * Notification is sent to all registered listeners if this attribute
- * changes.
- * </p>
- *
- * @return the name of the command represented by this handle. Guaranteed
- * not to be <code>null</code>.
- * @throws NotDefinedException
- * if the command represented by this handle is not defined.
- */
+ /**
+ * <p>
+ * Returns the name of the command represented by this handle, suitable for
+ * display to the user.
+ * </p>
+ * <p>
+ * Notification is sent to all registered listeners if this attribute changes.
+ * </p>
+ *
+ * @return the name of the command represented by this handle. Guaranteed not to
+ * be <code>null</code>.
+ * @throws NotDefinedException if the command represented by this handle is not
+ * defined.
+ */
@Deprecated
- String getName() throws NotDefinedException;
+ String getName() throws NotDefinedException;
- /**
- * <p>
- * Returns whether or not the command represented by this handle is defined.
- * </p>
- * <p>
- * Notification is sent to all registered listeners if this attribute
- * changes.
- * </p>
- *
- * @return <code>true</code>, iff the command represented by this handle
- * is defined.
- */
+ /**
+ * <p>
+ * Returns whether or not the command represented by this handle is defined.
+ * </p>
+ * <p>
+ * Notification is sent to all registered listeners if this attribute changes.
+ * </p>
+ *
+ * @return <code>true</code>, iff the command represented by this handle is
+ * defined.
+ */
@Deprecated
- boolean isDefined();
+ boolean isDefined();
- /**
- * <p>
- * Returns whether or not this command is handled. A command is handled if
- * it currently has an <code>IHandler</code> instance associated with it.
- * A command needs a handler to carry out the {@link ICommand#execute(Map)}
- * method.
- * </p>
- * <p>
- * Notification is sent to all registered listeners if this attribute
- * changes.
- * </p>
- *
- * @return <code>true</code>, iff this command is enabled.
- */
+ /**
+ * <p>
+ * Returns whether or not this command is handled. A command is handled if it
+ * currently has an <code>IHandler</code> instance associated with it. A command
+ * needs a handler to carry out the {@link ICommand#execute(Map)} method.
+ * </p>
+ * <p>
+ * Notification is sent to all registered listeners if this attribute changes.
+ * </p>
+ *
+ * @return <code>true</code>, iff this command is enabled.
+ */
@Deprecated
- boolean isHandled();
+ boolean isHandled();
- /**
- * Unregisters an instance of <code>ICommandListener</code> listening for
- * changes to attributes of this instance.
- *
- * @param commandListener
- * the instance of <code>ICommandListener</code> to unregister.
- * Must not be <code>null</code>. If an attempt is made to
- * unregister an instance of <code>ICommandListener</code>
- * which is not already registered with this instance, no
- * operation is performed.
- */
+ /**
+ * Unregisters an instance of <code>ICommandListener</code> listening for
+ * changes to attributes of this instance.
+ *
+ * @param commandListener the instance of <code>ICommandListener</code> to
+ * unregister. Must not be <code>null</code>. If an
+ * attempt is made to unregister an instance of
+ * <code>ICommandListener</code> which is not already
+ * registered with this instance, no operation is
+ * performed.
+ */
@Deprecated
- void removeCommandListener(ICommandListener commandListener);
+ void removeCommandListener(ICommandListener commandListener);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommandImageService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommandImageService.java
index 26cefda9984..0fdadaae4b1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommandImageService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommandImageService.java
@@ -60,77 +60,69 @@ public interface ICommandImageService extends IDisposable {
int TYPE_DISABLED = CommandImageManager.TYPE_DISABLED;
/**
- * The type of image to display if the mouse is hovering over the command
- * and the command is enabled.
+ * The type of image to display if the mouse is hovering over the command and
+ * the command is enabled.
*/
int TYPE_HOVER = CommandImageManager.TYPE_HOVER;
/**
- * The default image style. This is provided when no style is requested or
- * when the requested style is unavailable. (Value is <b>null</b>)
+ * The default image style. This is provided when no style is requested or when
+ * the requested style is unavailable. (Value is <b>null</b>)
*/
String IMAGE_STYLE_DEFAULT = null;
/**
- * The image style used for commands in a toolbar. This is useful if you
- * want the icon for the command in the toolbar to be different than the one
- * that is displayed with menu items. (Value is <b>toolbar</b>)
+ * The image style used for commands in a toolbar. This is useful if you want
+ * the icon for the command in the toolbar to be different than the one that is
+ * displayed with menu items. (Value is <b>toolbar</b>)
*/
String IMAGE_STYLE_TOOLBAR = "toolbar"; //$NON-NLS-1$
/**
- * Retrieves the default image associated with the given command in the
- * default style.
+ * Retrieves the default image associated with the given command in the default
+ * style.
*
- * @param commandId
- * The identifier to find; must not be <code>null</code>.
- * @return An image appropriate for the given command; may be
- * <code>null</code>.
+ * @param commandId The identifier to find; must not be <code>null</code>.
+ * @return An image appropriate for the given command; may be <code>null</code>.
*/
ImageDescriptor getImageDescriptor(String commandId);
/**
- * Retrieves the image of the given type associated with the given command
- * in the default style.
+ * Retrieves the image of the given type associated with the given command in
+ * the default style.
*
- * @param commandId
- * The identifier to find; must not be <code>null</code>.
+ * @param commandId The identifier to find; must not be <code>null</code>.
*
- * @param type
- * The type of image to retrieve. This value must be one of the
- * <code>TYPE</code> constants defined in this interface.
- * @return An image appropriate for the given command; <code>null</code>
- * if the given image type cannot be found.
+ * @param type The type of image to retrieve. This value must be one of the
+ * <code>TYPE</code> constants defined in this interface.
+ * @return An image appropriate for the given command; <code>null</code> if the
+ * given image type cannot be found.
*/
ImageDescriptor getImageDescriptor(String commandId, int type);
/**
- * Retrieves the image of the given type associated with the given command
- * in the given style.
+ * Retrieves the image of the given type associated with the given command in
+ * the given style.
*
- * @param commandId
- * The identifier to find; must not be <code>null</code>.
- * @param type
- * The type of image to retrieve. This value must be one of the
- * <code>TYPE</code> constants defined in this interface.
- * @param style
- * The style of the image to retrieve; may be <code>null</code>.
- * @return An image appropriate for the given command; <code>null</code>
- * if the given image style and type cannot be found.
+ * @param commandId The identifier to find; must not be <code>null</code>.
+ * @param type The type of image to retrieve. This value must be one of the
+ * <code>TYPE</code> constants defined in this interface.
+ * @param style The style of the image to retrieve; may be
+ * <code>null</code>.
+ * @return An image appropriate for the given command; <code>null</code> if the
+ * given image style and type cannot be found.
*/
- ImageDescriptor getImageDescriptor(String commandId, int type,
- String style);
+ ImageDescriptor getImageDescriptor(String commandId, int type, String style);
/**
- * Retrieves the default image associated with the given command in the
- * given style.
+ * Retrieves the default image associated with the given command in the given
+ * style.
*
- * @param commandId
- * The identifier to find; must not be <code>null</code>.
- * @param style
- * The style of the image to retrieve; may be <code>null</code>.
- * @return An image appropriate for the given command; <code>null</code>
- * if the given image style cannot be found.
+ * @param commandId The identifier to find; must not be <code>null</code>.
+ * @param style The style of the image to retrieve; may be
+ * <code>null</code>.
+ * @return An image appropriate for the given command; <code>null</code> if the
+ * given image style cannot be found.
*/
ImageDescriptor getImageDescriptor(String commandId, String style);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommandListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommandListener.java
index 1e77e720727..4b8e31ff269 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommandListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommandListener.java
@@ -30,13 +30,14 @@ package org.eclipse.ui.commands;
@SuppressWarnings("all")
public interface ICommandListener {
- /**
- * Notifies that one or more properties of an instance of <code>ICommand</code>
- * have changed. Specific details are described in the <code>CommandEvent</code>.
- *
- * @param commandEvent
- * the command event. Guaranteed not to be <code>null</code>.
- */
+ /**
+ * Notifies that one or more properties of an instance of <code>ICommand</code>
+ * have changed. Specific details are described in the
+ * <code>CommandEvent</code>.
+ *
+ * @param commandEvent the command event. Guaranteed not to be
+ * <code>null</code>.
+ */
@Deprecated
- void commandChanged(CommandEvent commandEvent);
+ void commandChanged(CommandEvent commandEvent);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommandManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommandManager.java
index c3175a5719a..ff0e2871019 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommandManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommandManager.java
@@ -39,223 +39,209 @@ import org.eclipse.ui.keys.KeySequence;
@SuppressWarnings("all")
public interface ICommandManager {
- /**
- * Registers an instance of <code>ICommandManagerListener</code> to listen
- * for changes to attributes of this instance.
- *
- * @param commandManagerListener
- * the instance of <code>ICommandManagerListener</code> to
- * register. Must not be <code>null</code>. If an attempt is
- * made to register an instance of
- * <code>ICommandManagerListener</code> which is already
- * registered with this instance, no operation is performed.
- */
- @Deprecated
- void addCommandManagerListener(
- ICommandManagerListener commandManagerListener);
-
- /**
- * Returns the set of identifiers to active contexts.
- * <p>
- * Notification is sent to all registered listeners if this property
- * changes.
- * </p>
- *
- * @return the set of identifiers to active contexts. This set may be
- * empty, but is guaranteed not to be <code>null</code>. If this
- * set is not empty, it is guaranteed to only contain instances of
- * <code>String</code>.
- */
- @Deprecated
- Set getActiveContextIds();
-
- /**
- * Returns the active key configuration.
- * <p>
- * Notification is sent to all registered listeners if this property
- * changes.
- * </p>
- *
- * @return the active key configuration identifier. This set may be empty,
- * but it is guaranteed to not be <code>null</code>. If this set
- * is not empty, it is guaranteed to only contains instances of
- * <code>String</code>.
- */
- @Deprecated
- String getActiveKeyConfigurationId();
-
- /**
- * Returns the active locale. While this property tends to be simply the
- * result of {@link java.util.Locale#getDefault()}, it may also be changed
- * at runtime by different implementations of command manager.
- * <p>
- * Notification is sent to all registered listeners if this property
- * changes.
- * </p>
- *
- * @return the active locale. May be <code>null</code>.
- */
- @Deprecated
- String getActiveLocale();
-
- /**
- * Returns the active platform. While this property tends to be simply the
- * result of {@link org.eclipse.swt.SWT#getPlatform()}, it may also be
- * changed at runtime by different implementations of command manager.
- * <p>
- * Notification is sent to all registered listeners if this property
- * changes.
- * </p>
- *
- * @return the active platform. May be <code>null</code>.
- */
- @Deprecated
- String getActivePlatform();
-
- /**
- * Returns a handle to a category given an identifier.
- *
- * @param categoryId
- * an identifier. Must not be <code>null</code>
- * @return a handle to a category.
- */
- @Deprecated
- ICategory getCategory(String categoryId);
-
- /**
- * Returns a handle to a command given an identifier.
- *
- * @param commandId
- * an identifier. Must not be <code>null</code>
- * @return a handle to a command; never <code>null</code>.
- */
- @Deprecated
- ICommand getCommand(String commandId);
-
- /**
- * <p>
- * Returns the set of identifiers to defined categories.
- * </p>
- * <p>
- * Notification is sent to all registered listeners if this attribute
- * changes.
- * </p>
- *
- * @return the set of identifiers to defined categories. This set may be
- * empty, but is guaranteed not to be <code>null</code>. If this
- * set is not empty, it is guaranteed to only contain instances of
- * <code>String</code>.
- */
- @Deprecated
- Set getDefinedCategoryIds();
-
- /**
- * <p>
- * Returns the set of identifiers to defined commands.
- * </p>
- * <p>
- * Notification is sent to all registered listeners if this attribute
- * changes.
- * </p>
- *
- * @return the set of identifiers to defined commands. This set may be
- * empty, but is guaranteed not to be <code>null</code>. If this
- * set is not empty, it is guaranteed to only contain instances of
- * <code>String</code>.
- */
- @Deprecated
- Set getDefinedCommandIds();
-
- /**
- * <p>
- * Returns the set of identifiers to defined key configurations.
- * </p>
- * <p>
- * Notification is sent to all registered listeners if this attribute
- * changes.
- * </p>
- *
- * @return the set of identifiers to defined key configurations. This set
- * may be empty, but is guaranteed not to be <code>null</code>.
- * If this set is not empty, it is guaranteed to only contain
- * instances of <code>String</code>.
- */
- @Deprecated
- Set getDefinedKeyConfigurationIds();
-
- /**
- * Returns a handle to a key configuration given an identifier.
- *
- * @param keyConfigurationId
- * an identifier. Must not be <code>null</code>
- * @return a handle to a key configuration.
- */
- @Deprecated
- IKeyConfiguration getKeyConfiguration(String keyConfigurationId);
-
- /**
- * Finds all of the commands which have key bindings that start with the
- * given key sequence.
- *
- * @param keySequence
- * The prefix to look for; must not be <code>null</code>.
- * @return A map of all of the matching key sequences (
- * <code>KeySequence</code>) to command identifiers (
- * <code>String</code>). This map may be empty, but it is never
- * <code>null</code>.
- */
- @Deprecated
- Map getPartialMatches(KeySequence keySequence);
-
- /**
- * Finds the command which has the given key sequence as one of its key
- * bindings.
- *
- * @param keySequence
- * The key binding to look for; must not be <code>null</code>.
- * @return The command id for the matching command, if any;
- * <code>null</code> if none.
- */
- @Deprecated
- String getPerfectMatch(KeySequence keySequence);
-
- /**
- * Checks to see whether there are any commands which have key bindings that
- * start with the given key sequence.
- *
- * @param keySequence
- * The prefix to look for; must not be <code>null</code>.
- * @return <code>true</code> if at least one command has a key binding
- * that starts with <code>keySequence</code>;<code>false</code>
- * otherwise.
- */
- @Deprecated
- boolean isPartialMatch(KeySequence keySequence);
-
- /**
- * Checks to see if there is a command with the given key sequence as one of
- * its key bindings.
- *
- * @param keySequence
- * The key binding to look for; must not be <code>null</code>.
- * @return <code>true</code> if a command has a matching key binding;
- * <code>false</code> otherwise.
- */
- @Deprecated
- boolean isPerfectMatch(KeySequence keySequence);
-
- /**
- * Unregisters an instance of <code>ICommandManagerListener</code>
- * listening for changes to attributes of this instance.
- *
- * @param commandManagerListener
- * the instance of <code>ICommandManagerListener</code> to
- * unregister. Must not be <code>null</code>. If an attempt is
- * made to unregister an instance of
- * <code>ICommandManagerListener</code> which is not already
- * registered with this instance, no operation is performed.
- */
- @Deprecated
- void removeCommandManagerListener(
- ICommandManagerListener commandManagerListener);
+ /**
+ * Registers an instance of <code>ICommandManagerListener</code> to listen for
+ * changes to attributes of this instance.
+ *
+ * @param commandManagerListener the instance of
+ * <code>ICommandManagerListener</code> to
+ * register. Must not be <code>null</code>. If an
+ * attempt is made to register an instance of
+ * <code>ICommandManagerListener</code> which is
+ * already registered with this instance, no
+ * operation is performed.
+ */
+ @Deprecated
+ void addCommandManagerListener(ICommandManagerListener commandManagerListener);
+
+ /**
+ * Returns the set of identifiers to active contexts.
+ * <p>
+ * Notification is sent to all registered listeners if this property changes.
+ * </p>
+ *
+ * @return the set of identifiers to active contexts. This set may be empty, but
+ * is guaranteed not to be <code>null</code>. If this set is not empty,
+ * it is guaranteed to only contain instances of <code>String</code>.
+ */
+ @Deprecated
+ Set getActiveContextIds();
+
+ /**
+ * Returns the active key configuration.
+ * <p>
+ * Notification is sent to all registered listeners if this property changes.
+ * </p>
+ *
+ * @return the active key configuration identifier. This set may be empty, but
+ * it is guaranteed to not be <code>null</code>. If this set is not
+ * empty, it is guaranteed to only contains instances of
+ * <code>String</code>.
+ */
+ @Deprecated
+ String getActiveKeyConfigurationId();
+
+ /**
+ * Returns the active locale. While this property tends to be simply the result
+ * of {@link java.util.Locale#getDefault()}, it may also be changed at runtime
+ * by different implementations of command manager.
+ * <p>
+ * Notification is sent to all registered listeners if this property changes.
+ * </p>
+ *
+ * @return the active locale. May be <code>null</code>.
+ */
+ @Deprecated
+ String getActiveLocale();
+
+ /**
+ * Returns the active platform. While this property tends to be simply the
+ * result of {@link org.eclipse.swt.SWT#getPlatform()}, it may also be changed
+ * at runtime by different implementations of command manager.
+ * <p>
+ * Notification is sent to all registered listeners if this property changes.
+ * </p>
+ *
+ * @return the active platform. May be <code>null</code>.
+ */
+ @Deprecated
+ String getActivePlatform();
+
+ /**
+ * Returns a handle to a category given an identifier.
+ *
+ * @param categoryId an identifier. Must not be <code>null</code>
+ * @return a handle to a category.
+ */
+ @Deprecated
+ ICategory getCategory(String categoryId);
+
+ /**
+ * Returns a handle to a command given an identifier.
+ *
+ * @param commandId an identifier. Must not be <code>null</code>
+ * @return a handle to a command; never <code>null</code>.
+ */
+ @Deprecated
+ ICommand getCommand(String commandId);
+
+ /**
+ * <p>
+ * Returns the set of identifiers to defined categories.
+ * </p>
+ * <p>
+ * Notification is sent to all registered listeners if this attribute changes.
+ * </p>
+ *
+ * @return the set of identifiers to defined categories. This set may be empty,
+ * but is guaranteed not to be <code>null</code>. If this set is not
+ * empty, it is guaranteed to only contain instances of
+ * <code>String</code>.
+ */
+ @Deprecated
+ Set getDefinedCategoryIds();
+
+ /**
+ * <p>
+ * Returns the set of identifiers to defined commands.
+ * </p>
+ * <p>
+ * Notification is sent to all registered listeners if this attribute changes.
+ * </p>
+ *
+ * @return the set of identifiers to defined commands. This set may be empty,
+ * but is guaranteed not to be <code>null</code>. If this set is not
+ * empty, it is guaranteed to only contain instances of
+ * <code>String</code>.
+ */
+ @Deprecated
+ Set getDefinedCommandIds();
+
+ /**
+ * <p>
+ * Returns the set of identifiers to defined key configurations.
+ * </p>
+ * <p>
+ * Notification is sent to all registered listeners if this attribute changes.
+ * </p>
+ *
+ * @return the set of identifiers to defined key configurations. This set may be
+ * empty, but is guaranteed not to be <code>null</code>. If this set is
+ * not empty, it is guaranteed to only contain instances of
+ * <code>String</code>.
+ */
+ @Deprecated
+ Set getDefinedKeyConfigurationIds();
+
+ /**
+ * Returns a handle to a key configuration given an identifier.
+ *
+ * @param keyConfigurationId an identifier. Must not be <code>null</code>
+ * @return a handle to a key configuration.
+ */
+ @Deprecated
+ IKeyConfiguration getKeyConfiguration(String keyConfigurationId);
+
+ /**
+ * Finds all of the commands which have key bindings that start with the given
+ * key sequence.
+ *
+ * @param keySequence The prefix to look for; must not be <code>null</code>.
+ * @return A map of all of the matching key sequences (
+ * <code>KeySequence</code>) to command identifiers (
+ * <code>String</code>). This map may be empty, but it is never
+ * <code>null</code>.
+ */
+ @Deprecated
+ Map getPartialMatches(KeySequence keySequence);
+
+ /**
+ * Finds the command which has the given key sequence as one of its key
+ * bindings.
+ *
+ * @param keySequence The key binding to look for; must not be
+ * <code>null</code>.
+ * @return The command id for the matching command, if any; <code>null</code> if
+ * none.
+ */
+ @Deprecated
+ String getPerfectMatch(KeySequence keySequence);
+
+ /**
+ * Checks to see whether there are any commands which have key bindings that
+ * start with the given key sequence.
+ *
+ * @param keySequence The prefix to look for; must not be <code>null</code>.
+ * @return <code>true</code> if at least one command has a key binding that
+ * starts with <code>keySequence</code>;<code>false</code> otherwise.
+ */
+ @Deprecated
+ boolean isPartialMatch(KeySequence keySequence);
+
+ /**
+ * Checks to see if there is a command with the given key sequence as one of its
+ * key bindings.
+ *
+ * @param keySequence The key binding to look for; must not be
+ * <code>null</code>.
+ * @return <code>true</code> if a command has a matching key binding;
+ * <code>false</code> otherwise.
+ */
+ @Deprecated
+ boolean isPerfectMatch(KeySequence keySequence);
+
+ /**
+ * Unregisters an instance of <code>ICommandManagerListener</code> listening for
+ * changes to attributes of this instance.
+ *
+ * @param commandManagerListener the instance of
+ * <code>ICommandManagerListener</code> to
+ * unregister. Must not be <code>null</code>. If
+ * an attempt is made to unregister an instance of
+ * <code>ICommandManagerListener</code> which is
+ * not already registered with this instance, no
+ * operation is performed.
+ */
+ @Deprecated
+ void removeCommandManagerListener(ICommandManagerListener commandManagerListener);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommandManagerListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommandManagerListener.java
index 690ebe0485a..4b082506664 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommandManagerListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommandManagerListener.java
@@ -30,15 +30,14 @@ package org.eclipse.ui.commands;
@SuppressWarnings("all")
public interface ICommandManagerListener {
- /**
- * Notifies that one or more properties of an instance of
- * <code>ICommandManager</code> have changed. Specific details are
- * described in the <code>CommandManagerEvent</code>.
- *
- * @param commandManagerEvent
- * the commandManager event. Guaranteed not to be
- * <code>null</code>.
- */
+ /**
+ * Notifies that one or more properties of an instance of
+ * <code>ICommandManager</code> have changed. Specific details are described in
+ * the <code>CommandManagerEvent</code>.
+ *
+ * @param commandManagerEvent the commandManager event. Guaranteed not to be
+ * <code>null</code>.
+ */
@Deprecated
- void commandManagerChanged(CommandManagerEvent commandManagerEvent);
+ void commandManagerChanged(CommandManagerEvent commandManagerEvent);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommandService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommandService.java
index 87269feebc9..9361d0fb754 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommandService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommandService.java
@@ -63,95 +63,84 @@ public interface ICommandService extends IDisposable {
* Adds an execution listener to the command service. This listener will be
* notified as commands are executed.
* <p>
- * <b>Note:</b> listeners should be removed when no longer necessary. If
- * not, they will be removed when the IServiceLocator used to acquire this
- * service is disposed.
+ * <b>Note:</b> listeners should be removed when no longer necessary. If not,
+ * they will be removed when the IServiceLocator used to acquire this service is
+ * disposed.
* </p>
*
- * @param listener
- * The listener to add; must not be <code>null</code>.
+ * @param listener The listener to add; must not be <code>null</code>.
* @see #removeExecutionListener(IExecutionListener)
*/
void addExecutionListener(IExecutionListener listener);
/**
* Sets the name and description of the category for uncategorized commands.
- * This is the category that will be returned if
- * {@link #getCategory(String)} is called with <code>null</code>.
+ * This is the category that will be returned if {@link #getCategory(String)} is
+ * called with <code>null</code>.
*
- * @param name
- * The name of the category for uncategorized commands; must not
- * be <code>null</code>.
- * @param description
- * The description of the category for uncategorized commands;
- * may be <code>null</code>.
+ * @param name The name of the category for uncategorized commands; must
+ * not be <code>null</code>.
+ * @param description The description of the category for uncategorized
+ * commands; may be <code>null</code>.
* @since 3.2
*/
void defineUncategorizedCategory(String name, String description);
/**
* <p>
- * Returns a {@link ParameterizedCommand} with a command and
- * parameterizations as specified in the provided
- * <code>serializedParameterizedCommand</code> string. The
- * <code>serializedParameterizedCommand</code> must use the format
+ * Returns a {@link ParameterizedCommand} with a command and parameterizations
+ * as specified in the provided <code>serializedParameterizedCommand</code>
+ * string. The <code>serializedParameterizedCommand</code> must use the format
* returned by {@link ParameterizedCommand#serialize()} and described in the
* Javadoc for that method.
* </p>
* <p>
- * If a parameter id encoded in the
- * <code>serializedParameterizedCommand</code> does not exist in the
- * encoded command, that parameter id and value are ignored. A given
- * parameter id should not be used more than once in
- * <code>serializedParameterizedCommand</code>. This will not result in
- * an exception, but the value of the parameter when the command is executed
- * cannot be specified here.
+ * If a parameter id encoded in the <code>serializedParameterizedCommand</code>
+ * does not exist in the encoded command, that parameter id and value are
+ * ignored. A given parameter id should not be used more than once in
+ * <code>serializedParameterizedCommand</code>. This will not result in an
+ * exception, but the value of the parameter when the command is executed cannot
+ * be specified here.
* </p>
* <p>
- * This method will never return <code>null</code>, however it may throw
- * an exception if there is a problem processing the serialization string or
- * the encoded command is undefined.
+ * This method will never return <code>null</code>, however it may throw an
+ * exception if there is a problem processing the serialization string or the
+ * encoded command is undefined.
* </p>
*
- * @param serializedParameterizedCommand
- * a <code>String</code> representing a command id and
- * parameter ids and values
+ * @param serializedParameterizedCommand a <code>String</code> representing a
+ * command id and parameter ids and values
* @return a <code>ParameterizedCommand</code> with the command and
* parameterizations encoded in the
* <code>serializedParameterizedCommand</code>
- * @throws NotDefinedException
- * if the command indicated in
- * <code>serializedParameterizedCommand</code> is not defined
- * @throws SerializationException
- * if there is an error deserializing
- * <code>serializedParameterizedCommand</code>
+ * @throws NotDefinedException if the command indicated in
+ * <code>serializedParameterizedCommand</code> is
+ * not defined
+ * @throws SerializationException if there is an error deserializing
+ * <code>serializedParameterizedCommand</code>
* @see ParameterizedCommand#serialize()
* @see CommandManager#deserialize(String)
* @since 3.2
*/
- ParameterizedCommand deserialize(
- String serializedParameterizedCommand) throws NotDefinedException,
- SerializationException;
+ ParameterizedCommand deserialize(String serializedParameterizedCommand)
+ throws NotDefinedException, SerializationException;
/**
- * Retrieves the category with the given identifier. If no such category
- * exists, then an undefined category with the given id is created.
+ * Retrieves the category with the given identifier. If no such category exists,
+ * then an undefined category with the given id is created.
*
- * @param categoryId
- * The identifier to find. If the category is <code>null</code>,
- * then a category suitable for uncategorized items is defined
- * and returned.
- * @return A category with the given identifier, either defined or
- * undefined.
+ * @param categoryId The identifier to find. If the category is
+ * <code>null</code>, then a category suitable for
+ * uncategorized items is defined and returned.
+ * @return A category with the given identifier, either defined or undefined.
*/
Category getCategory(String categoryId);
/**
- * Retrieves the command with the given identifier. If no such command
- * exists, then an undefined command with the given id is created.
+ * Retrieves the command with the given identifier. If no such command exists,
+ * then an undefined command with the given id is created.
*
- * @param commandId
- * The identifier to find; must not be <code>null</code>.
+ * @param commandId The identifier to find; must not be <code>null</code>.
* @return A command with the given identifier, either defined or undefined.
*/
Command getCommand(String commandId);
@@ -166,28 +155,28 @@ public interface ICommandService extends IDisposable {
Category[] getDefinedCategories();
/**
- * Returns the collection of the identifiers for all of the defined
- * categories in the workbench.
+ * Returns the collection of the identifiers for all of the defined categories
+ * in the workbench.
*
- * @return The collection of category identifiers (<code>String</code>)
- * that are defined; never <code>null</code>, but may be empty.
+ * @return The collection of category identifiers (<code>String</code>) that are
+ * defined; never <code>null</code>, but may be empty.
*/
Collection getDefinedCategoryIds();
/**
- * Returns the collection of the identifiers for all of the defined commands
- * in the workbench.
+ * Returns the collection of the identifiers for all of the defined commands in
+ * the workbench.
*
- * @return The collection of command identifiers (<code>String</code>)
- * that are defined; never <code>null</code>, but may be empty.
+ * @return The collection of command identifiers (<code>String</code>) that are
+ * defined; never <code>null</code>, but may be empty.
*/
Collection getDefinedCommandIds();
/**
* Returns the collection of all of the defined commands in the workbench.
*
- * @return The collection of commands (<code>Command</code>) that are
- * defined; never <code>null</code>, but may be empty.
+ * @return The collection of commands (<code>Command</code>) that are defined;
+ * never <code>null</code>, but may be empty.
* @since 3.2
*/
Command[] getDefinedCommands();
@@ -196,67 +185,65 @@ public interface ICommandService extends IDisposable {
* Returns the collection of the identifiers for all of the defined command
* parameter types in the workbench.
*
- * @return The collection of command parameter type identifiers (<code>String</code>)
- * that are defined; never <code>null</code>, but may be empty.
+ * @return The collection of command parameter type identifiers
+ * (<code>String</code>) that are defined; never <code>null</code>, but
+ * may be empty.
* @since 3.2
*/
Collection getDefinedParameterTypeIds();
/**
- * Returns the collection of all of the defined command parameter types in
- * the workbench.
+ * Returns the collection of all of the defined command parameter types in the
+ * workbench.
*
- * @return The collection of command parameter types (<code>ParameterType</code>)
- * that are defined; never <code>null</code>, but may be empty.
+ * @return The collection of command parameter types
+ * (<code>ParameterType</code>) that are defined; never
+ * <code>null</code>, but may be empty.
* @since 3.2
*/
ParameterType[] getDefinedParameterTypes();
/**
* Gets the help context identifier for a particular command. The command's
- * handler is first checked for a help context identifier. If the handler
- * does not have a help context identifier, then the help context identifier
- * for the command is returned. If neither has a help context identifier,
- * then <code>null</code> is returned.
+ * handler is first checked for a help context identifier. If the handler does
+ * not have a help context identifier, then the help context identifier for the
+ * command is returned. If neither has a help context identifier, then
+ * <code>null</code> is returned.
*
- * @param command
- * The command for which the help context should be retrieved;
- * must not be <code>null</code>.
+ * @param command The command for which the help context should be retrieved;
+ * must not be <code>null</code>.
* @return The help context identifier to use for the given command; may be
* <code>null</code>.
- * @throws NotDefinedException
- * If the given command is not defined.
+ * @throws NotDefinedException If the given command is not defined.
* @since 3.2
*/
String getHelpContextId(Command command) throws NotDefinedException;
/**
* Gets the help context identifier for a particular command. The command's
- * handler is first checked for a help context identifier. If the handler
- * does not have a help context identifier, then the help context identifier
- * for the command is returned. If neither has a help context identifier,
- * then <code>null</code> is returned.
+ * handler is first checked for a help context identifier. If the handler does
+ * not have a help context identifier, then the help context identifier for the
+ * command is returned. If neither has a help context identifier, then
+ * <code>null</code> is returned.
*
- * @param commandId
- * The identifier of the command for which the help context
- * should be retrieved; must not be <code>null</code>.
+ * @param commandId The identifier of the command for which the help context
+ * should be retrieved; must not be <code>null</code>.
* @return The help context identifier to use for the given command; may be
* <code>null</code>.
- * @throws NotDefinedException
- * If the command with the given identifier is not defined.
+ * @throws NotDefinedException If the command with the given identifier is not
+ * defined.
* @since 3.2
*/
String getHelpContextId(String commandId) throws NotDefinedException;
/**
- * Retrieves the command parameter type with the given identifier. If no
- * such parameter type exists, then an undefined parameter type with the
- * given id is created.
+ * Retrieves the command parameter type with the given identifier. If no such
+ * parameter type exists, then an undefined parameter type with the given id is
+ * created.
*
- * @param parameterTypeId
- * The identifier to find; must not be <code>null</code>.
- * @return A command parameter type with the given identifier, either
- * defined or undefined.
+ * @param parameterTypeId The identifier to find; must not be <code>null</code>.
+ * @return A command parameter type with the given identifier, either defined or
+ * undefined.
* @since 3.2
*/
ParameterType getParameterType(String parameterTypeId);
@@ -264,10 +251,10 @@ public interface ICommandService extends IDisposable {
/**
* <p>
* Reads the command information from the registry and the preferences. This
- * will overwrite any of the existing information in the command service.
- * This method is intended to be called during start-up. When this method
- * completes, this command service will reflect the current state of the
- * registry and preference store.
+ * will overwrite any of the existing information in the command service. This
+ * method is intended to be called during start-up. When this method completes,
+ * this command service will reflect the current state of the registry and
+ * preference store.
* </p>
*/
void readRegistry();
@@ -275,78 +262,70 @@ public interface ICommandService extends IDisposable {
/**
* Removes an execution listener from the command service.
*
- * @param listener
- * The listener to remove; must not be <code>null</code>.
+ * @param listener The listener to remove; must not be <code>null</code>.
*/
void removeExecutionListener(IExecutionListener listener);
/**
* Sets the help context identifier to associate with a particular handler.
*
- * @param handler
- * The handler with which to register a help context identifier;
- * must not be <code>null</code>.
- * @param helpContextId
- * The help context identifier to register; may be
- * <code>null</code> if the help context identifier should be
- * removed.
+ * @param handler The handler with which to register a help context
+ * identifier; must not be <code>null</code>.
+ * @param helpContextId The help context identifier to register; may be
+ * <code>null</code> if the help context identifier should
+ * be removed.
* @since 3.2
*/
void setHelpContextId(IHandler handler, String helpContextId);
/**
- * Register that this element accepts callbacks for this parameterized
- * command.
+ * Register that this element accepts callbacks for this parameterized command.
* <p>
- * <b>Note:</b> elements should be removed when no longer necessary. If
- * not, they will be removed when the IServiceLocator used to acquire this
- * service is disposed.
+ * <b>Note:</b> elements should be removed when no longer necessary. If not,
+ * they will be removed when the IServiceLocator used to acquire this service is
+ * disposed.
* </p>
*
- * @param command
- * The parameterized command that is already specialized. Must
- * not be <code>null</code>.
- * @param element
- * The callback to register for this specialized command
- * instance. Must not be <code>null</code>.
- * @return A reference for the registered element that can be used to
- * unregister it.
- * @throws NotDefinedException
- * If the command included in the ParameterizedCommand is not
- * defined, or the element is <code>null</code>.
+ * @param command The parameterized command that is already specialized. Must
+ * not be <code>null</code>.
+ * @param element The callback to register for this specialized command
+ * instance. Must not be <code>null</code>.
+ * @return A reference for the registered element that can be used to unregister
+ * it.
+ * @throws NotDefinedException If the command included in the
+ * ParameterizedCommand is not defined, or the
+ * element is <code>null</code>.
* @since 3.3
* @see #unregisterElement(IElementReference)
*/
- IElementReference registerElementForCommand(
- ParameterizedCommand command, UIElement element)
+ IElementReference registerElementForCommand(ParameterizedCommand command, UIElement element)
throws NotDefinedException;
/**
- * Re-register a callback element provided by the ICommandService. This
- * element reference must not currently be held by the ICommandService. i.e.
- * it must have been removed using
- * {@link #unregisterElement(IElementReference)}.
+ * Re-register a callback element provided by the ICommandService. This element
+ * reference must not currently be held by the ICommandService. i.e. it must
+ * have been removed using {@link #unregisterElement(IElementReference)}.
* <p>
- * <b>Note:</b> elements should be removed when no longer necessary. If
- * not, they will be removed when the IServiceLocator used to acquire this
- * service is disposed.
+ * <b>Note:</b> elements should be removed when no longer necessary. If not,
+ * they will be removed when the IServiceLocator used to acquire this service is
+ * disposed.
* </p>
*
- * @param elementReference
- * The reference to re-register. Must not be <code>null</code>.
+ * @param elementReference The reference to re-register. Must not be
+ * <code>null</code>.
* @since 3.3
* @see #unregisterElement(IElementReference)
*/
void registerElement(IElementReference elementReference);
/**
- * Unregister an element callback. It will be removed from the
- * ICommandService. The same service that is used to register an element for
- * a command <b>must</b> be used to unregister the element.
+ * Unregister an element callback. It will be removed from the ICommandService.
+ * The same service that is used to register an element for a command
+ * <b>must</b> be used to unregister the element.
*
- * @param elementReference
- * The callback reference that was provided by the command
- * service on registration. Must not be <code>null</code>.
+ * @param elementReference The callback reference that was provided by the
+ * command service on registration. Must not be
+ * <code>null</code>.
* @since 3.3
*/
void unregisterElement(IElementReference elementReference);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IElementReference.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IElementReference.java
index 001526a059a..16e4a39b7ce 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IElementReference.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IElementReference.java
@@ -22,8 +22,8 @@ import org.eclipse.ui.menus.UIElement;
* the ICommandService will return a reference for all callbacks that are
* registered. This reference can be used to unregister the specific callback.
* <p>
- * Similar in functionality to an IHandlerActivation. This interface should
- * not be implemented or extended by clients.
+ * Similar in functionality to an IHandlerActivation. This interface should not
+ * be implemented or extended by clients.
* </p>
*
* @since 3.3
@@ -45,9 +45,9 @@ public interface IElementReference {
UIElement getElement();
/**
- * Parameters that help scope this callback registration. For example, it
- * can include parameters from the ParameterizedCommand. Callers should not
- * change the map that is returned.
+ * Parameters that help scope this callback registration. For example, it can
+ * include parameters from the ParameterizedCommand. Callers should not change
+ * the map that is returned.
*
* @return scoping parameters. Will not be <code>null</code>.
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IElementUpdater.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IElementUpdater.java
index 1e6ccd7c7e2..c2a8963585b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IElementUpdater.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IElementUpdater.java
@@ -27,20 +27,18 @@ import org.eclipse.ui.menus.UIElement;
*/
public interface IElementUpdater {
/**
- * Whenever the elements for a command are refreshed, this method is called
- * on the active handler for that command.
+ * Whenever the elements for a command are refreshed, this method is called on
+ * the active handler for that command.
* <p>
- * <b>Note:</b> Handlers must never cache the element, which can disappear
- * or be replaced at any time. Everybody should go through the
- * ICommandService refreshElements(*) method.
+ * <b>Note:</b> Handlers must never cache the element, which can disappear or be
+ * replaced at any time. Everybody should go through the ICommandService
+ * refreshElements(*) method.
* </p>
*
- * @param element
- * An element for a specific UI element. Will not be
- * <code>null</code>.
- * @param parameters
- * Any parameters registered with the callback. Will not be
- * <code>null</code>, but it may be empty.
+ * @param element An element for a specific UI element. Will not be
+ * <code>null</code>.
+ * @param parameters Any parameters registered with the callback. Will not be
+ * <code>null</code>, but it may be empty.
*/
void updateElement(UIElement element, Map parameters);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IHandler.java
index 4102ea12652..0d41f965709 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IHandler.java
@@ -33,64 +33,61 @@ import java.util.Map;
@SuppressWarnings("all")
public interface IHandler {
- /**
- * Registers an instance of <code>IHandlerListener</code> to listen for
- * changes to properties of this instance.
- *
- * @param handlerListener
- * the instance to register. Must not be <code>null</code>. If
- * an attempt is made to register an instance which is already
- * registered with this instance, no operation is performed.
- */
+ /**
+ * Registers an instance of <code>IHandlerListener</code> to listen for changes
+ * to properties of this instance.
+ *
+ * @param handlerListener the instance to register. Must not be
+ * <code>null</code>. If an attempt is made to register
+ * an instance which is already registered with this
+ * instance, no operation is performed.
+ */
@Deprecated
- void addHandlerListener(IHandlerListener handlerListener);
+ void addHandlerListener(IHandlerListener handlerListener);
- /**
- * Disposes of this handler. This method is run once when the object is no
- * longer referenced. This can be used as an opportunity to unhook listeners
- * from other objects.
- */
- @Deprecated void dispose();
+ /**
+ * Disposes of this handler. This method is run once when the object is no
+ * longer referenced. This can be used as an opportunity to unhook listeners
+ * from other objects.
+ */
+ @Deprecated
+ void dispose();
- /**
- * Executes with the map of parameter values by name.
- *
- * @param parameterValuesByName
- * the map of parameter values by name. Reserved for future use,
- * must be <code>null</code>.
- * @return the result of the execution. Reserved for future use, must be
- * <code>null</code>.
- * @throws ExecutionException
- * if an exception occurred during execution.
- */
+ /**
+ * Executes with the map of parameter values by name.
+ *
+ * @param parameterValuesByName the map of parameter values by name. Reserved
+ * for future use, must be <code>null</code>.
+ * @return the result of the execution. Reserved for future use, must be
+ * <code>null</code>.
+ * @throws ExecutionException if an exception occurred during execution.
+ */
@Deprecated
- Object execute(Map parameterValuesByName) throws ExecutionException;
+ Object execute(Map parameterValuesByName) throws ExecutionException;
- /**
- * Returns the map of attribute values by name.
- * <p>
- * Notification is sent to all registered listeners if this property
- * changes.
- * </p>
- *
- * @return the map of attribute values by name. This map may be empty, but
- * is guaranteed not to be <code>null</code>. If this map is not
- * empty, its collection of keys is guaranteed to only contain
- * instances of <code>String</code>.
- */
+ /**
+ * Returns the map of attribute values by name.
+ * <p>
+ * Notification is sent to all registered listeners if this property changes.
+ * </p>
+ *
+ * @return the map of attribute values by name. This map may be empty, but is
+ * guaranteed not to be <code>null</code>. If this map is not empty, its
+ * collection of keys is guaranteed to only contain instances of
+ * <code>String</code>.
+ */
@Deprecated
- Map getAttributeValuesByName();
+ Map getAttributeValuesByName();
- /**
- * Unregisters an instance of <code>IPropertyListener</code> listening for
- * changes to properties of this instance.
- *
- * @param handlerListener
- * the instance to unregister. Must not be <code>null</code>.
- * If an attempt is made to unregister an instance which is not
- * already registered with this instance, no operation is
- * performed.
- */
+ /**
+ * Unregisters an instance of <code>IPropertyListener</code> listening for
+ * changes to properties of this instance.
+ *
+ * @param handlerListener the instance to unregister. Must not be
+ * <code>null</code>. If an attempt is made to unregister
+ * an instance which is not already registered with this
+ * instance, no operation is performed.
+ */
@Deprecated
- void removeHandlerListener(IHandlerListener handlerListener);
+ void removeHandlerListener(IHandlerListener handlerListener);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IHandlerListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IHandlerListener.java
index 3d2a896fe23..cbaf20fc923 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IHandlerListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IHandlerListener.java
@@ -30,14 +30,14 @@ package org.eclipse.ui.commands;
@SuppressWarnings("all")
public interface IHandlerListener {
- /**
- * Notifies that one or more properties of an instance of
- * <code>IHandler</code> have changed. Specific details are described in
- * the <code>HandlerEvent</code>.
- *
- * @param handlerEvent
- * the handler event. Guaranteed not to be <code>null</code>.
- */
+ /**
+ * Notifies that one or more properties of an instance of <code>IHandler</code>
+ * have changed. Specific details are described in the
+ * <code>HandlerEvent</code>.
+ *
+ * @param handlerEvent the handler event. Guaranteed not to be
+ * <code>null</code>.
+ */
@Deprecated
- void handlerChanged(HandlerEvent handlerEvent);
+ void handlerChanged(HandlerEvent handlerEvent);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IKeyConfiguration.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IKeyConfiguration.java
index 298627425f4..320de08b00a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IKeyConfiguration.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IKeyConfiguration.java
@@ -16,22 +16,22 @@ package org.eclipse.ui.commands;
/**
* <p>
- * An instance of <code>IKeyConfiguration</code> is a handle representing a
- * key configuration as defined by the extension point
+ * An instance of <code>IKeyConfiguration</code> is a handle representing a key
+ * configuration as defined by the extension point
* <code>org.eclipse.ui.commands</code>. The identifier of the handle is
* identifier of the key configuration being represented.
* </p>
* <p>
* An instance of <code>IKeyConfiguration</code> can be obtained from an
- * instance of <code>ICommandManager</code> for any identifier, whether or not
- * a key configuration with that identifier defined in the plugin registry.
+ * instance of <code>ICommandManager</code> for any identifier, whether or not a
+ * key configuration with that identifier defined in the plugin registry.
* </p>
* <p>
* The handle-based nature of this API allows it to work well with runtime
* plugin activation and deactivation. If a key configuration is defined, that
* means that its corresponding plug-in is active. If the plug-in is then
- * deactivated, the configuration will still exist but it will be undefined.
- * An attempt to use an undefined key configuration will result in a
+ * deactivated, the configuration will still exist but it will be undefined. An
+ * attempt to use an undefined key configuration will result in a
* <code>NotDefinedException</code> being thrown.
* </p>
* <p>
@@ -43,138 +43,130 @@ package org.eclipse.ui.commands;
* @see ICommandManager
* @see org.eclipse.jface.bindings.Scheme
* @deprecated Please use the bindings support in the "org.eclipse.jface"
- * plug-in instead.
+ * plug-in instead.
* @noimplement This interface is not intended to be implemented by clients.
*/
@Deprecated
@SuppressWarnings("all")
public interface IKeyConfiguration extends Comparable {
- /**
- * Registers an instance of <code>IKeyConfigurationListener</code> to
- * listen for changes to attributes of this instance.
- *
- * @param keyConfigurationListener
- * the instance of <code>IKeyConfigurationListener</code> to
- * register. Must not be <code>null</code>. If an attempt is
- * made to register an instance of <code>IKeyConfigurationListener</code>
- * which is already registered with this instance, no operation
- * is performed.
- */
+ /**
+ * Registers an instance of <code>IKeyConfigurationListener</code> to listen for
+ * changes to attributes of this instance.
+ *
+ * @param keyConfigurationListener the instance of
+ * <code>IKeyConfigurationListener</code> to
+ * register. Must not be <code>null</code>. If
+ * an attempt is made to register an instance of
+ * <code>IKeyConfigurationListener</code> which
+ * is already registered with this instance, no
+ * operation is performed.
+ */
@Deprecated
- void addKeyConfigurationListener(
- IKeyConfigurationListener keyConfigurationListener);
+ void addKeyConfigurationListener(IKeyConfigurationListener keyConfigurationListener);
- /**
- * <p>
- * Returns the description of the key configuration represented by this
- * handle, suitable for display to the user.
- * </p>
- * <p>
- * Notification is sent to all registered listeners if this attribute
- * changes.
- * </p>
- *
- * @return the description of the key configuration represented by this
- * handle. Guaranteed not to be <code>null</code>.
- * @throws NotDefinedException
- * if the key configuration represented by this handle is not
- * defined.
- */
+ /**
+ * <p>
+ * Returns the description of the key configuration represented by this handle,
+ * suitable for display to the user.
+ * </p>
+ * <p>
+ * Notification is sent to all registered listeners if this attribute changes.
+ * </p>
+ *
+ * @return the description of the key configuration represented by this handle.
+ * Guaranteed not to be <code>null</code>.
+ * @throws NotDefinedException if the key configuration represented by this
+ * handle is not defined.
+ */
@Deprecated
- String getDescription() throws NotDefinedException;
+ String getDescription() throws NotDefinedException;
- /**
- * Returns the identifier of this handle.
- *
- * @return the identifier of this handle. Guaranteed not to be
- * <code>null</code>.
- */
+ /**
+ * Returns the identifier of this handle.
+ *
+ * @return the identifier of this handle. Guaranteed not to be
+ * <code>null</code>.
+ */
@Deprecated
- String getId();
+ String getId();
- /**
- * <p>
- * Returns the name of the key configuration represented by this handle,
- * suitable for display to the user.
- * </p>
- * <p>
- * Notification is sent to all registered listeners if this attribute
- * changes.
- * </p>
- *
- * @return the name of the key configuration represented by this handle.
- * Guaranteed not to be <code>null</code>.
- * @throws NotDefinedException
- * if the key configuration represented by this handle is not
- * defined.
- */
+ /**
+ * <p>
+ * Returns the name of the key configuration represented by this handle,
+ * suitable for display to the user.
+ * </p>
+ * <p>
+ * Notification is sent to all registered listeners if this attribute changes.
+ * </p>
+ *
+ * @return the name of the key configuration represented by this handle.
+ * Guaranteed not to be <code>null</code>.
+ * @throws NotDefinedException if the key configuration represented by this
+ * handle is not defined.
+ */
@Deprecated
- String getName() throws NotDefinedException;
+ String getName() throws NotDefinedException;
- /**
- * <p>
- * Returns the identifier of the parent of the key configuration
- * represented by this handle.
- * </p>
- * <p>
- * Notification is sent to all registered listeners if this attribute
- * changes.
- * </p>
- *
- * @return the identifier of the parent of the key configuration
- * represented by this handle. May be <code>null</code>.
- * @throws NotDefinedException
- * if the key configuration represented by this handle is not
- * defined.
- */
+ /**
+ * <p>
+ * Returns the identifier of the parent of the key configuration represented by
+ * this handle.
+ * </p>
+ * <p>
+ * Notification is sent to all registered listeners if this attribute changes.
+ * </p>
+ *
+ * @return the identifier of the parent of the key configuration represented by
+ * this handle. May be <code>null</code>.
+ * @throws NotDefinedException if the key configuration represented by this
+ * handle is not defined.
+ */
@Deprecated
- String getParentId() throws NotDefinedException;
+ String getParentId() throws NotDefinedException;
- /**
- * <p>
- * Returns whether or not this command is active. Instances of
- * <code>ICommand</code> are activated and deactivated by the instance of
- * <code>ICommandManager</code> from whence they were brokered.
- * </p>
- * <p>
- * Notification is sent to all registered listeners if this attribute
- * changes.
- * </p>
- *
- * @return <code>true</code>, iff this command is active.
- */
+ /**
+ * <p>
+ * Returns whether or not this command is active. Instances of
+ * <code>ICommand</code> are activated and deactivated by the instance of
+ * <code>ICommandManager</code> from whence they were brokered.
+ * </p>
+ * <p>
+ * Notification is sent to all registered listeners if this attribute changes.
+ * </p>
+ *
+ * @return <code>true</code>, iff this command is active.
+ */
@Deprecated
- boolean isActive();
+ boolean isActive();
- /**
- * <p>
- * Returns whether or not the key configuration represented by this handle
- * is defined.
- * </p>
- * <p>
- * Notification is sent to all registered listeners if this attribute
- * changes.
- * </p>
- *
- * @return <code>true</code>, iff the key configuration represented by
- * this handle is defined.
- */
+ /**
+ * <p>
+ * Returns whether or not the key configuration represented by this handle is
+ * defined.
+ * </p>
+ * <p>
+ * Notification is sent to all registered listeners if this attribute changes.
+ * </p>
+ *
+ * @return <code>true</code>, iff the key configuration represented by this
+ * handle is defined.
+ */
@Deprecated
- boolean isDefined();
+ boolean isDefined();
- /**
- * Unregisters an instance of <code>IKeyConfigurationListener</code>
- * listening for changes to attributes of this instance.
- *
- * @param keyConfigurationListener
- * the instance of <code>IKeyConfigurationListener</code> to
- * unregister. Must not be <code>null</code>. If an attempt is
- * made to unregister an instance of
- * <code>IKeyConfigurationListener</code> which is not already
- * registered with this instance, no operation is performed.
- */
+ /**
+ * Unregisters an instance of <code>IKeyConfigurationListener</code> listening
+ * for changes to attributes of this instance.
+ *
+ * @param keyConfigurationListener the instance of
+ * <code>IKeyConfigurationListener</code> to
+ * unregister. Must not be <code>null</code>. If
+ * an attempt is made to unregister an instance
+ * of <code>IKeyConfigurationListener</code>
+ * which is not already registered with this
+ * instance, no operation is performed.
+ */
@Deprecated
- void removeKeyConfigurationListener(
- IKeyConfigurationListener keyConfigurationListener);
+ void removeKeyConfigurationListener(IKeyConfigurationListener keyConfigurationListener);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IKeyConfigurationListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IKeyConfigurationListener.java
index 1e3a49d3dd0..148491dca15 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IKeyConfigurationListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IKeyConfigurationListener.java
@@ -16,8 +16,8 @@ package org.eclipse.ui.commands;
/**
* <p>
- * An instance of <code>IKeyConfigurationListener</code> can be used by
- * clients to receive notification of changes to one or more instances of
+ * An instance of <code>IKeyConfigurationListener</code> can be used by clients
+ * to receive notification of changes to one or more instances of
* <code>IKeyConfiguration</code>.
* </p>
* <p>
@@ -29,20 +29,21 @@ package org.eclipse.ui.commands;
* @see IKeyConfiguration#removeKeyConfigurationListener(IKeyConfigurationListener)
* @see org.eclipse.ui.commands.KeyConfigurationEvent
* @deprecated Please use the bindings support in the "org.eclipse.jface"
- * plug-in instead.
+ * plug-in instead.
* @see org.eclipse.jface.bindings.ISchemeListener
*/
@Deprecated
@SuppressWarnings("all")
public interface IKeyConfigurationListener {
- /**
- * Notifies that one or more attributes of an instance of <code>IKeyConfiguration</code>
- * have changed. Specific details are described in the <code>KeyConfigurationEvent</code>.
- *
- * @param keyConfigurationEvent
- * the keyConfiguration event. Guaranteed not to be <code>null</code>.
- */
+ /**
+ * Notifies that one or more attributes of an instance of
+ * <code>IKeyConfiguration</code> have changed. Specific details are described
+ * in the <code>KeyConfigurationEvent</code>.
+ *
+ * @param keyConfigurationEvent the keyConfiguration event. Guaranteed not to be
+ * <code>null</code>.
+ */
@Deprecated
- void keyConfigurationChanged(KeyConfigurationEvent keyConfigurationEvent);
+ void keyConfigurationChanged(KeyConfigurationEvent keyConfigurationEvent);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IKeySequenceBinding.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IKeySequenceBinding.java
index 9ec18bac6ce..90192ee1d02 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IKeySequenceBinding.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IKeySequenceBinding.java
@@ -18,9 +18,8 @@ import org.eclipse.ui.keys.KeySequence;
/**
* <p>
- * An instance of <code>IKeySequenceBinding</code> represents a binding
- * between a command and a key sequence. This is a wrapper for the a key
- * sequence.
+ * An instance of <code>IKeySequenceBinding</code> represents a binding between
+ * a command and a key sequence. This is a wrapper for the a key sequence.
* </p>
* <p>
* This interface is not intended to be extended or implemented by clients.
@@ -29,7 +28,7 @@ import org.eclipse.ui.keys.KeySequence;
* @since 3.0
* @see org.eclipse.ui.commands.ICommand
* @deprecated Please use the bindings support in the "org.eclipse.jface"
- * plug-in instead.
+ * plug-in instead.
* @see org.eclipse.jface.bindings.keys.KeyBinding
* @noimplement This interface is not intended to be implemented by clients.
*/
@@ -37,11 +36,11 @@ import org.eclipse.ui.keys.KeySequence;
@SuppressWarnings("all")
public interface IKeySequenceBinding extends Comparable {
- /**
- * Returns the key sequence represented in this binding.
- *
- * @return the key sequence. Guaranteed not to be <code>null</code>.
- */
+ /**
+ * Returns the key sequence represented in this binding.
+ *
+ * @return the key sequence. Guaranteed not to be <code>null</code>.
+ */
@Deprecated
- KeySequence getKeySequence();
+ KeySequence getKeySequence();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IWorkbenchCommandSupport.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IWorkbenchCommandSupport.java
index 640342d64e6..af94651e8ff 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IWorkbenchCommandSupport.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IWorkbenchCommandSupport.java
@@ -38,27 +38,25 @@ public interface IWorkbenchCommandSupport {
* Adds a single handler submissions for consideration by the workbench. The
* submission indicates to the workbench a set of conditions under which the
* handler should become active. The workbench, however, ultimately decides
- * which handler becomes active (in the event of conflicts or changes in
- * state). This could cause the handlers for one or more commands to change.
+ * which handler becomes active (in the event of conflicts or changes in state).
+ * This could cause the handlers for one or more commands to change.
*
- * @param handlerSubmission
- * The submission to be added; must not be <code>null</code>.
+ * @param handlerSubmission The submission to be added; must not be
+ * <code>null</code>.
*/
@Deprecated
void addHandlerSubmission(HandlerSubmission handlerSubmission);
/**
- * Adds a collection of handler submissions for consideration by the
- * workbench. The submission indicates to the workbench a set of conditions
- * under which the handler should become active. The workbench, however,
- * ultimately decides which handler becomes active (in the event of
- * conflicts or changes in state). This could cause the handlers for one or
- * more commands to change.
+ * Adds a collection of handler submissions for consideration by the workbench.
+ * The submission indicates to the workbench a set of conditions under which the
+ * handler should become active. The workbench, however, ultimately decides
+ * which handler becomes active (in the event of conflicts or changes in state).
+ * This could cause the handlers for one or more commands to change.
*
- * @param handlerSubmissions
- * The submissions to be added; must not be <code>null</code>,
- * and must contain zero or more instances of
- * <code>HandlerSubmission</code>.
+ * @param handlerSubmissions The submissions to be added; must not be
+ * <code>null</code>, and must contain zero or more
+ * instances of <code>HandlerSubmission</code>.
*/
@Deprecated
void addHandlerSubmissions(Collection handlerSubmissions);
@@ -73,27 +71,24 @@ public interface IWorkbenchCommandSupport {
ICommandManager getCommandManager();
/**
- * Removes a single handler submission from consideration by the workbench.
- * The handler submission must be the same as the one added (not just
- * equivalent). This could cause the handlers for one or more commands to
- * change.
+ * Removes a single handler submission from consideration by the workbench. The
+ * handler submission must be the same as the one added (not just equivalent).
+ * This could cause the handlers for one or more commands to change.
*
- * @param handlerSubmission
- * The submission to be removed; must not be <code>null</code>.
+ * @param handlerSubmission The submission to be removed; must not be
+ * <code>null</code>.
*/
@Deprecated
void removeHandlerSubmission(HandlerSubmission handlerSubmission);
/**
- * Removes a single handler submission from consideration by the workbench.
- * The handler submission must be the same as the one added (not just
- * equivalent). This could cause the handlers for one or more commands to
- * change.
+ * Removes a single handler submission from consideration by the workbench. The
+ * handler submission must be the same as the one added (not just equivalent).
+ * This could cause the handlers for one or more commands to change.
*
- * @param handlerSubmissions
- * The submissions to be removed; must not be <code>null</code>,
- * and must contain instances of <code>HandlerSubmission</code>
- * only.
+ * @param handlerSubmissions The submissions to be removed; must not be
+ * <code>null</code>, and must contain instances of
+ * <code>HandlerSubmission</code> only.
*/
@Deprecated
void removeHandlerSubmissions(Collection handlerSubmissions);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/KeyConfigurationEvent.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/KeyConfigurationEvent.java
index 1d12fd3b683..86595cadba4 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/KeyConfigurationEvent.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/KeyConfigurationEvent.java
@@ -24,116 +24,110 @@ package org.eclipse.ui.commands;
* @since 3.0
* @see IKeyConfigurationListener#keyConfigurationChanged(KeyConfigurationEvent)
* @deprecated Please use the bindings support in the "org.eclipse.jface"
- * plug-in instead.
+ * plug-in instead.
* @see org.eclipse.jface.bindings.SchemeEvent
*/
@Deprecated
@SuppressWarnings("all")
public final class KeyConfigurationEvent {
- /**
- * whether the key configuration has become or active or inactive.
- */
- private final boolean activeChanged;
+ /**
+ * whether the key configuration has become or active or inactive.
+ */
+ private final boolean activeChanged;
- /**
- * Whether the key configuration has become defined or undefined.
- */
- private final boolean definedChanged;
+ /**
+ * Whether the key configuration has become defined or undefined.
+ */
+ private final boolean definedChanged;
- /**
- * The key configuration that has changed; this value is never
- * <code>null</code>.
- */
- private final IKeyConfiguration keyConfiguration;
+ /**
+ * The key configuration that has changed; this value is never
+ * <code>null</code>.
+ */
+ private final IKeyConfiguration keyConfiguration;
- /**
- * Whether the name of the key configuration has changed.
- */
- private final boolean nameChanged;
+ /**
+ * Whether the name of the key configuration has changed.
+ */
+ private final boolean nameChanged;
- /**
- * Whether the parent identifier has changed.
- */
- private final boolean parentIdChanged;
+ /**
+ * Whether the parent identifier has changed.
+ */
+ private final boolean parentIdChanged;
- /**
- * Creates a new instance of this class.
- *
- * @param keyConfiguration
- * the instance of the interface that changed.
- * @param activeChanged
- * true, iff the active property changed.
- * @param definedChanged
- * true, iff the defined property changed.
- * @param nameChanged
- * true, iff the name property changed.
- * @param parentIdChanged
- * true, iff the parentId property changed.
- */
+ /**
+ * Creates a new instance of this class.
+ *
+ * @param keyConfiguration the instance of the interface that changed.
+ * @param activeChanged true, iff the active property changed.
+ * @param definedChanged true, iff the defined property changed.
+ * @param nameChanged true, iff the name property changed.
+ * @param parentIdChanged true, iff the parentId property changed.
+ */
@Deprecated
- public KeyConfigurationEvent(IKeyConfiguration keyConfiguration,
- boolean activeChanged, boolean definedChanged, boolean nameChanged,
- boolean parentIdChanged) {
- if (keyConfiguration == null) {
+ public KeyConfigurationEvent(IKeyConfiguration keyConfiguration, boolean activeChanged, boolean definedChanged,
+ boolean nameChanged, boolean parentIdChanged) {
+ if (keyConfiguration == null) {
throw new NullPointerException();
}
- this.keyConfiguration = keyConfiguration;
- this.activeChanged = activeChanged;
- this.definedChanged = definedChanged;
- this.nameChanged = nameChanged;
- this.parentIdChanged = parentIdChanged;
- }
+ this.keyConfiguration = keyConfiguration;
+ this.activeChanged = activeChanged;
+ this.definedChanged = definedChanged;
+ this.nameChanged = nameChanged;
+ this.parentIdChanged = parentIdChanged;
+ }
- /**
- * Returns the instance of the interface that changed.
- *
- * @return the instance of the interface that changed. Guaranteed not to be
- * <code>null</code>.
- */
+ /**
+ * Returns the instance of the interface that changed.
+ *
+ * @return the instance of the interface that changed. Guaranteed not to be
+ * <code>null</code>.
+ */
@Deprecated
- public IKeyConfiguration getKeyConfiguration() {
- return keyConfiguration;
- }
+ public IKeyConfiguration getKeyConfiguration() {
+ return keyConfiguration;
+ }
- /**
- * Returns whether or not the active property changed.
- *
- * @return true, iff the active property changed.
- */
+ /**
+ * Returns whether or not the active property changed.
+ *
+ * @return true, iff the active property changed.
+ */
@Deprecated
- public boolean hasActiveChanged() {
- return activeChanged;
- }
+ public boolean hasActiveChanged() {
+ return activeChanged;
+ }
- /**
- * Returns whether or not the defined property changed.
- *
- * @return true, iff the defined property changed.
- */
+ /**
+ * Returns whether or not the defined property changed.
+ *
+ * @return true, iff the defined property changed.
+ */
@Deprecated
- public boolean hasDefinedChanged() {
- return definedChanged;
- }
+ public boolean hasDefinedChanged() {
+ return definedChanged;
+ }
- /**
- * Returns whether or not the name property changed.
- *
- * @return true, iff the name property changed.
- */
+ /**
+ * Returns whether or not the name property changed.
+ *
+ * @return true, iff the name property changed.
+ */
@Deprecated
- public boolean hasNameChanged() {
- return nameChanged;
- }
+ public boolean hasNameChanged() {
+ return nameChanged;
+ }
- /**
- * Returns whether or not the parentId property changed.
- *
- * @return true, iff the parentId property changed.
- */
+ /**
+ * Returns whether or not the parentId property changed.
+ *
+ * @return true, iff the parentId property changed.
+ */
@Deprecated
- public boolean hasParentIdChanged() {
- return parentIdChanged;
- }
+ public boolean hasParentIdChanged() {
+ return parentIdChanged;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/NotDefinedException.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/NotDefinedException.java
index ae55af43a64..5ebf739e7aa 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/NotDefinedException.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/NotDefinedException.java
@@ -28,36 +28,33 @@ package org.eclipse.ui.commands;
@SuppressWarnings("all")
public final class NotDefinedException extends CommandException {
- /**
- * Generated serial version UID for this class.
- *
- * @since 3.1
- */
- private static final long serialVersionUID = 3257572788998124596L;
+ /**
+ * Generated serial version UID for this class.
+ *
+ * @since 3.1
+ */
+ private static final long serialVersionUID = 3257572788998124596L;
- /**
- * Creates a new instance of this class with the specified detail message.
- *
- * @param s
- * the detail message.
- */
+ /**
+ * Creates a new instance of this class with the specified detail message.
+ *
+ * @param s the detail message.
+ */
@Deprecated
- public NotDefinedException(String s) {
- super(s);
- }
+ public NotDefinedException(String s) {
+ super(s);
+ }
- /**
- * Constructs a legacy <code>NotDefinedException</code> based on the new
- * <code>NotDefinedException</code>.
- *
- * @param e
- * The exception from which this exception should be created;
- * must not be <code>null</code>.
- * @since 3.1
- */
+ /**
+ * Constructs a legacy <code>NotDefinedException</code> based on the new
+ * <code>NotDefinedException</code>.
+ *
+ * @param e The exception from which this exception should be created; must not
+ * be <code>null</code>.
+ * @since 3.1
+ */
@Deprecated
- public NotDefinedException(
- final org.eclipse.core.commands.common.NotDefinedException e) {
- super(e.getMessage(), e);
- }
+ public NotDefinedException(final org.eclipse.core.commands.common.NotDefinedException e) {
+ super(e.getMessage(), e);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/NotHandledException.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/NotHandledException.java
index f6109a669a5..a02024a3995 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/NotHandledException.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/NotHandledException.java
@@ -28,35 +28,33 @@ package org.eclipse.ui.commands;
@SuppressWarnings("all")
public final class NotHandledException extends CommandException {
- /**
- * Generated serial version UID for this class.
- *
- * @since 3.1
- */
- private static final long serialVersionUID = 3256446914827726904L;
+ /**
+ * Generated serial version UID for this class.
+ *
+ * @since 3.1
+ */
+ private static final long serialVersionUID = 3256446914827726904L;
- /**
- * Creates a new instance of this class with the specified detail message.
- *
- * @param s
- * the detail message.
- */
+ /**
+ * Creates a new instance of this class with the specified detail message.
+ *
+ * @param s the detail message.
+ */
@Deprecated
- public NotHandledException(String s) {
- super(s);
- }
+ public NotHandledException(String s) {
+ super(s);
+ }
- /**
- * Constructs a legacy <code>NotHandledException</code> based on the new
- * <code>NotHandledException</code>
- *
- * @param e
- * The exception from which this exception should be created;
- * must not be <code>null</code>.
- * @since 3.1
- */
+ /**
+ * Constructs a legacy <code>NotHandledException</code> based on the new
+ * <code>NotHandledException</code>
+ *
+ * @param e The exception from which this exception should be created; must not
+ * be <code>null</code>.
+ * @since 3.1
+ */
@Deprecated
- public NotHandledException(final org.eclipse.core.commands.NotHandledException e) {
- super(e.getMessage(), e);
- }
+ public NotHandledException(final org.eclipse.core.commands.NotHandledException e) {
+ super(e.getMessage(), e);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/Priority.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/Priority.java
index c280f5006c9..f8167bbc5dd 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/Priority.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/Priority.java
@@ -64,14 +64,14 @@ public final class Priority implements Comparable {
public static final Priority MEDIUM = new Priority(ISources.LEGACY_MEDIUM);
/**
- * The string representation of this priority. This is computed once
- * (lazily). Before it is computed, this value is <code>null</code>.
+ * The string representation of this priority. This is computed once (lazily).
+ * Before it is computed, this value is <code>null</code>.
*/
private transient String string = null;
/**
- * The priority value for this instance. A lesser integer is considered to
- * have a higher priority.
+ * The priority value for this instance. A lesser integer is considered to have
+ * a higher priority.
*/
private int value;
@@ -80,9 +80,8 @@ public final class Priority implements Comparable {
* constructor should only be used internally. Priority instances should be
* retrieved from the static members defined above.
*
- * @param value
- * The priority value; a lesser integer is consider to have a
- * higher priority value.
+ * @param value The priority value; a lesser integer is consider to have a
+ * higher priority value.
*/
private Priority(int value) {
this.value = value;
@@ -100,8 +99,8 @@ public final class Priority implements Comparable {
}
/**
- * The value for this priority. The lesser the value, the higher priority
- * this represents.
+ * The value for this priority. The lesser the value, the higher priority this
+ * represents.
*
* @return The integer priority value.
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/ContextEvent.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/ContextEvent.java
index c30f8fc548e..d3ce78cbdaf 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/ContextEvent.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/ContextEvent.java
@@ -29,101 +29,96 @@ package org.eclipse.ui.contexts;
@Deprecated
public final class ContextEvent {
- /**
- * The context that has changed. This value is never <code>null</code>.
- */
- private final IContext context;
+ /**
+ * The context that has changed. This value is never <code>null</code>.
+ */
+ private final IContext context;
- /**
- * Whether the context has become defined or undefined.
- */
- private final boolean definedChanged;
+ /**
+ * Whether the context has become defined or undefined.
+ */
+ private final boolean definedChanged;
- /**
- * Whether the context has become enabled or disabled.
- */
- private final boolean enabledChanged;
+ /**
+ * Whether the context has become enabled or disabled.
+ */
+ private final boolean enabledChanged;
- /**
- * Whether the name of the context has changed.
- */
- private final boolean nameChanged;
+ /**
+ * Whether the name of the context has changed.
+ */
+ private final boolean nameChanged;
- /**
- * Whether the parent identifier has changed.
- */
- private final boolean parentIdChanged;
+ /**
+ * Whether the parent identifier has changed.
+ */
+ private final boolean parentIdChanged;
- /**
- * Creates a new instance of this class.
- *
- * @param context
- * the instance of the interface that changed.
- * @param definedChanged
- * true, iff the defined property changed.
- * @param enabledChanged
- * true, iff the enabled property changed.
- * @param nameChanged
- * true, iff the name property changed.
- * @param parentIdChanged
- * true, iff the parentId property changed.
- */
- public ContextEvent(IContext context, boolean definedChanged,
- boolean enabledChanged, boolean nameChanged, boolean parentIdChanged) {
- if (context == null) {
+ /**
+ * Creates a new instance of this class.
+ *
+ * @param context the instance of the interface that changed.
+ * @param definedChanged true, iff the defined property changed.
+ * @param enabledChanged true, iff the enabled property changed.
+ * @param nameChanged true, iff the name property changed.
+ * @param parentIdChanged true, iff the parentId property changed.
+ */
+ public ContextEvent(IContext context, boolean definedChanged, boolean enabledChanged, boolean nameChanged,
+ boolean parentIdChanged) {
+ if (context == null) {
throw new NullPointerException();
}
- this.context = context;
- this.definedChanged = definedChanged;
- this.enabledChanged = enabledChanged;
- this.nameChanged = nameChanged;
- this.parentIdChanged = parentIdChanged;
- }
+ this.context = context;
+ this.definedChanged = definedChanged;
+ this.enabledChanged = enabledChanged;
+ this.nameChanged = nameChanged;
+ this.parentIdChanged = parentIdChanged;
+ }
- /**
- * Returns the instance of the interface that changed.
- *
- * @return the instance of the interface that changed. Guaranteed not to be
- * <code>null</code>.
- */
- public IContext getContext() {
- return context;
- }
+ /**
+ * Returns the instance of the interface that changed.
+ *
+ * @return the instance of the interface that changed. Guaranteed not to be
+ * <code>null</code>.
+ */
+ public IContext getContext() {
+ return context;
+ }
- /**
- * Returns whether or not the defined property changed.
- *
- * @return true, iff the defined property changed.
- */
- public boolean hasDefinedChanged() {
- return definedChanged;
- }
+ /**
+ * Returns whether or not the defined property changed.
+ *
+ * @return true, iff the defined property changed.
+ */
+ public boolean hasDefinedChanged() {
+ return definedChanged;
+ }
- /**
- * Returns whether or not the enabled property changed.
- *
- * @return true, iff the enabled property changed.
- */
- public boolean hasEnabledChanged() {
- return enabledChanged;
- }
+ /**
+ * Returns whether or not the enabled property changed.
+ *
+ * @return true, iff the enabled property changed.
+ */
+ public boolean hasEnabledChanged() {
+ return enabledChanged;
+ }
- /**
- * Returns whether or not the name property changed.
- *
- * @return true, iff the name property changed.
- */
- public boolean hasNameChanged() {
- return nameChanged;
- }
+ /**
+ * Returns whether or not the name property changed.
+ *
+ * @return true, iff the name property changed.
+ */
+ public boolean hasNameChanged() {
+ return nameChanged;
+ }
- /**
- * Returns whether or not the parentId property changed.
- *
- * @return true, iff the parentId property changed.
- */
- public boolean hasParentIdChanged() {
- return parentIdChanged;
- }
+ /**
+ * Returns whether or not the parentId property changed.
+ *
+ * @return true, iff the parentId property changed.
+ */
+ public boolean hasParentIdChanged() {
+ return parentIdChanged;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/ContextException.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/ContextException.java
index cc32a5eb1e8..ca569d52e0e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/ContextException.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/ContextException.java
@@ -32,46 +32,42 @@ public abstract class ContextException extends Exception {
*
* @since 3.4
*/
- private static final long serialVersionUID= -5143404124388080211L;
-
+ private static final long serialVersionUID = -5143404124388080211L;
private Throwable cause;
- /**
- * Creates a new instance of this class with the specified detail message.
- *
- * @param message
- * the detail message.
- */
- public ContextException(String message) {
- super(message);
- }
+ /**
+ * Creates a new instance of this class with the specified detail message.
+ *
+ * @param message the detail message.
+ */
+ public ContextException(String message) {
+ super(message);
+ }
- /**
- * Creates a new instance of this class with the specified detail message
- * and cause.
- *
- * @param message
- * the detail message.
- * @param cause
- * the cause.
- */
- public ContextException(String message, Throwable cause) {
- super(message);
- // don't pass the cause to super, to allow compilation against JCL Foundation
- this.cause = cause;
- }
+ /**
+ * Creates a new instance of this class with the specified detail message and
+ * cause.
+ *
+ * @param message the detail message.
+ * @param cause the cause.
+ */
+ public ContextException(String message, Throwable cause) {
+ super(message);
+ // don't pass the cause to super, to allow compilation against JCL Foundation
+ this.cause = cause;
+ }
- /**
- * Returns the cause of this throwable or <code>null</code> if the
- * cause is nonexistent or unknown.
- *
- * @return the cause or <code>null</code>
- * @since 3.1
- */
- @Override
+ /**
+ * Returns the cause of this throwable or <code>null</code> if the cause is
+ * nonexistent or unknown.
+ *
+ * @return the cause or <code>null</code>
+ * @since 3.1
+ */
+ @Override
public Throwable getCause() {
- return cause;
- }
+ return cause;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/ContextManagerEvent.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/ContextManagerEvent.java
index a3662cdbf1c..a9208862ce4 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/ContextManagerEvent.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/ContextManagerEvent.java
@@ -33,149 +33,147 @@ import org.eclipse.ui.internal.util.Util;
@Deprecated
public final class ContextManagerEvent {
- /**
- * The context manager which has changed. This value is never
- * <code>null</code>.
- */
- private final IContextManager contextManager;
-
- /**
- * Whether the set of defined contexts has changed.
- */
- private final boolean definedContextIdsChanged;
-
- /**
- * Whether the set of enabled contexts has changed.
- */
- private final boolean enabledContextIdsChanged;
-
- /**
- * The set of context identifiers (strings) that were defined before the
- * change occurred. If the defined contexts did not changed, then this value
- * is <code>null</code>.
- */
- private final Set previouslyDefinedContextIds;
-
- /**
- * The set of context identifiers (strings) that were enabled before the
- * change occurred. If the enabled contexts did not changed, then this value
- * is <code>null</code>.
- */
- private final Set previouslyEnabledContextIds;
-
- /**
- * Creates a new instance of this class.
- *
- * @param contextManager
- * the instance of the interface that changed.
- * @param definedContextIdsChanged
- * true, iff the definedContextIds property changed.
- * @param enabledContextIdsChanged
- * true, iff the enabledContextIds property changed.
- * @param previouslyDefinedContextIds
- * the set of identifiers to previously defined contexts. This
- * set may be empty. If this set is not empty, it must only
- * contain instances of <code>String</code>. This set must be
- * <code>null</code> if definedContextIdsChanged is
- * <code>false</code> and must not be null if
- * definedContextIdsChanged is <code>true</code>.
- * @param previouslyEnabledContextIds
- * the set of identifiers to previously enabled contexts. This
- * set may be empty. If this set is not empty, it must only
- * contain instances of <code>String</code>. This set must be
- * <code>null</code> if enabledContextIdsChanged is
- * <code>false</code> and must not be null if
- * enabledContextIdsChanged is <code>true</code>.
- */
- public ContextManagerEvent(IContextManager contextManager,
- boolean definedContextIdsChanged, boolean enabledContextIdsChanged,
- Set previouslyDefinedContextIds, Set previouslyEnabledContextIds) {
- if (contextManager == null) {
+ /**
+ * The context manager which has changed. This value is never <code>null</code>.
+ */
+ private final IContextManager contextManager;
+
+ /**
+ * Whether the set of defined contexts has changed.
+ */
+ private final boolean definedContextIdsChanged;
+
+ /**
+ * Whether the set of enabled contexts has changed.
+ */
+ private final boolean enabledContextIdsChanged;
+
+ /**
+ * The set of context identifiers (strings) that were defined before the change
+ * occurred. If the defined contexts did not changed, then this value is
+ * <code>null</code>.
+ */
+ private final Set previouslyDefinedContextIds;
+
+ /**
+ * The set of context identifiers (strings) that were enabled before the change
+ * occurred. If the enabled contexts did not changed, then this value is
+ * <code>null</code>.
+ */
+ private final Set previouslyEnabledContextIds;
+
+ /**
+ * Creates a new instance of this class.
+ *
+ * @param contextManager the instance of the interface that
+ * changed.
+ * @param definedContextIdsChanged true, iff the definedContextIds property
+ * changed.
+ * @param enabledContextIdsChanged true, iff the enabledContextIds property
+ * changed.
+ * @param previouslyDefinedContextIds the set of identifiers to previously
+ * defined contexts. This set may be empty.
+ * If this set is not empty, it must only
+ * contain instances of <code>String</code>.
+ * This set must be <code>null</code> if
+ * definedContextIdsChanged is
+ * <code>false</code> and must not be null if
+ * definedContextIdsChanged is
+ * <code>true</code>.
+ * @param previouslyEnabledContextIds the set of identifiers to previously
+ * enabled contexts. This set may be empty.
+ * If this set is not empty, it must only
+ * contain instances of <code>String</code>.
+ * This set must be <code>null</code> if
+ * enabledContextIdsChanged is
+ * <code>false</code> and must not be null if
+ * enabledContextIdsChanged is
+ * <code>true</code>.
+ */
+ public ContextManagerEvent(IContextManager contextManager, boolean definedContextIdsChanged,
+ boolean enabledContextIdsChanged, Set previouslyDefinedContextIds, Set previouslyEnabledContextIds) {
+ if (contextManager == null) {
throw new NullPointerException();
}
- if (!definedContextIdsChanged && previouslyDefinedContextIds != null) {
+ if (!definedContextIdsChanged && previouslyDefinedContextIds != null) {
throw new IllegalArgumentException();
}
- if (!enabledContextIdsChanged && previouslyEnabledContextIds != null) {
+ if (!enabledContextIdsChanged && previouslyEnabledContextIds != null) {
throw new IllegalArgumentException();
}
- if (definedContextIdsChanged) {
- this.previouslyDefinedContextIds = Util.safeCopy(
- previouslyDefinedContextIds, String.class);
- } else {
- this.previouslyDefinedContextIds = null;
- }
-
- if (enabledContextIdsChanged) {
- this.previouslyEnabledContextIds = Util.safeCopy(
- previouslyEnabledContextIds, String.class);
- } else {
- this.previouslyEnabledContextIds = null;
- }
-
- this.contextManager = contextManager;
- this.definedContextIdsChanged = definedContextIdsChanged;
- this.enabledContextIdsChanged = enabledContextIdsChanged;
- }
-
- /**
- * Returns the instance of the interface that changed.
- *
- * @return the instance of the interface that changed. Guaranteed not to be
- * <code>null</code>.
- */
- public IContextManager getContextManager() {
- return contextManager;
- }
-
- /**
- * Returns the set of identifiers to previously defined contexts.
- *
- * @return the set of identifiers to previously defined contexts. This set
- * may be empty. If this set is not empty, it is guaranteed to only
- * contain instances of <code>String</code>. This set is
- * guaranteed to be <code>null</code> if
- * haveDefinedContextIdsChanged() is <code>false</code> and is
- * guaranteed to not be null if haveDefinedContextIdsChanged() is
- * <code>true</code>.
- */
- public Set getPreviouslyDefinedContextIds() {
- return previouslyDefinedContextIds;
- }
-
- /**
- * Returns the set of identifiers to previously enabled contexts.
- *
- * @return the set of identifiers to previously enabled contexts. This set
- * may be empty. If this set is not empty, it is guaranteed to only
- * contain instances of <code>String</code>. This set is
- * guaranteed to be <code>null</code> if
- * haveEnabledContextIdsChanged() is <code>false</code> and is
- * guaranteed to not be null if haveEnabledContextIdsChanged() is
- * <code>true</code>.
- */
- public Set getPreviouslyEnabledContextIds() {
- return previouslyEnabledContextIds;
- }
-
- /**
- * Returns whether or not the definedContextIds property changed.
- *
- * @return true, iff the definedContextIds property changed.
- */
- public boolean haveDefinedContextIdsChanged() {
- return definedContextIdsChanged;
- }
-
- /**
- * Returns whether or not the enabledContextIds property changed.
- *
- * @return true, iff the enabledContextIds property changed.
- */
- public boolean haveEnabledContextIdsChanged() {
- return enabledContextIdsChanged;
- }
+ if (definedContextIdsChanged) {
+ this.previouslyDefinedContextIds = Util.safeCopy(previouslyDefinedContextIds, String.class);
+ } else {
+ this.previouslyDefinedContextIds = null;
+ }
+
+ if (enabledContextIdsChanged) {
+ this.previouslyEnabledContextIds = Util.safeCopy(previouslyEnabledContextIds, String.class);
+ } else {
+ this.previouslyEnabledContextIds = null;
+ }
+
+ this.contextManager = contextManager;
+ this.definedContextIdsChanged = definedContextIdsChanged;
+ this.enabledContextIdsChanged = enabledContextIdsChanged;
+ }
+
+ /**
+ * Returns the instance of the interface that changed.
+ *
+ * @return the instance of the interface that changed. Guaranteed not to be
+ * <code>null</code>.
+ */
+ public IContextManager getContextManager() {
+ return contextManager;
+ }
+
+ /**
+ * Returns the set of identifiers to previously defined contexts.
+ *
+ * @return the set of identifiers to previously defined contexts. This set may
+ * be empty. If this set is not empty, it is guaranteed to only contain
+ * instances of <code>String</code>. This set is guaranteed to be
+ * <code>null</code> if haveDefinedContextIdsChanged() is
+ * <code>false</code> and is guaranteed to not be null if
+ * haveDefinedContextIdsChanged() is <code>true</code>.
+ */
+ public Set getPreviouslyDefinedContextIds() {
+ return previouslyDefinedContextIds;
+ }
+
+ /**
+ * Returns the set of identifiers to previously enabled contexts.
+ *
+ * @return the set of identifiers to previously enabled contexts. This set may
+ * be empty. If this set is not empty, it is guaranteed to only contain
+ * instances of <code>String</code>. This set is guaranteed to be
+ * <code>null</code> if haveEnabledContextIdsChanged() is
+ * <code>false</code> and is guaranteed to not be null if
+ * haveEnabledContextIdsChanged() is <code>true</code>.
+ */
+ public Set getPreviouslyEnabledContextIds() {
+ return previouslyEnabledContextIds;
+ }
+
+ /**
+ * Returns whether or not the definedContextIds property changed.
+ *
+ * @return true, iff the definedContextIds property changed.
+ */
+ public boolean haveDefinedContextIdsChanged() {
+ return definedContextIdsChanged;
+ }
+
+ /**
+ * Returns whether or not the enabledContextIds property changed.
+ *
+ * @return true, iff the enabledContextIds property changed.
+ */
+ public boolean haveEnabledContextIdsChanged() {
+ return enabledContextIdsChanged;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/EnabledSubmission.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/EnabledSubmission.java
index e443d8c3af0..beca03ac3c6 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/EnabledSubmission.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/EnabledSubmission.java
@@ -45,152 +45,148 @@ import org.eclipse.ui.internal.util.Util;
@Deprecated
public final class EnabledSubmission implements Comparable {
- /**
- * The identifier of the part in which this context should be enabled. If
- * this value is <code>null</code>, this means it should be active in any
- * part.
- */
- private final String activePartId;
-
- /**
- * The shell in which this context should be enabled. If this value is
- * <code>null</code>, this means it should be active in any shell.
- */
- private final Shell activeShell;
-
- /**
- * The part site in which this context should be enabled. If this value is
- * <code>null</code>, this means it should be active in any part site.
- */
- private final IWorkbenchPartSite activeWorkbenchPartSite;
-
- /**
- * The identifier for the context that should be enabled by this
- * submissions. This value should never be <code>null</code>.
- */
- private final String contextId;
-
- /**
- * The cached string representation of this instance. This value is computed
- * lazily on the first call to retrieve the string representation, and the
- * cache is used for all future calls. If this value is <code>null</code>,
- * then the value has not yet been computed.
- */
- private transient String string = null;
-
- /**
- * Creates a new instance of this class.
- *
- * @param activePartId
- * the identifier of the part that must be active for this
- * request to be considered. May be <code>null</code>.
- * @param activeShell
- * the shell that must be active for this request to be
- * considered. May be <code>null</code>.
- * @param activeWorkbenchPartSite
- * the workbench part site of the part that must be active for
- * this request to be considered. May be <code>null</code>.
- * @param contextId
- * the identifier of the context to be enabled. Must not be
- * <code>null</code>.
- */
- public EnabledSubmission(String activePartId, Shell activeShell,
- IWorkbenchPartSite activeWorkbenchPartSite, String contextId) {
- if (contextId == null) {
+ /**
+ * The identifier of the part in which this context should be enabled. If this
+ * value is <code>null</code>, this means it should be active in any part.
+ */
+ private final String activePartId;
+
+ /**
+ * The shell in which this context should be enabled. If this value is
+ * <code>null</code>, this means it should be active in any shell.
+ */
+ private final Shell activeShell;
+
+ /**
+ * The part site in which this context should be enabled. If this value is
+ * <code>null</code>, this means it should be active in any part site.
+ */
+ private final IWorkbenchPartSite activeWorkbenchPartSite;
+
+ /**
+ * The identifier for the context that should be enabled by this submissions.
+ * This value should never be <code>null</code>.
+ */
+ private final String contextId;
+
+ /**
+ * The cached string representation of this instance. This value is computed
+ * lazily on the first call to retrieve the string representation, and the cache
+ * is used for all future calls. If this value is <code>null</code>, then the
+ * value has not yet been computed.
+ */
+ private transient String string = null;
+
+ /**
+ * Creates a new instance of this class.
+ *
+ * @param activePartId the identifier of the part that must be active
+ * for this request to be considered. May be
+ * <code>null</code>.
+ * @param activeShell the shell that must be active for this request
+ * to be considered. May be <code>null</code>.
+ * @param activeWorkbenchPartSite the workbench part site of the part that must
+ * be active for this request to be considered.
+ * May be <code>null</code>.
+ * @param contextId the identifier of the context to be enabled.
+ * Must not be <code>null</code>.
+ */
+ public EnabledSubmission(String activePartId, Shell activeShell, IWorkbenchPartSite activeWorkbenchPartSite,
+ String contextId) {
+ if (contextId == null) {
throw new NullPointerException();
}
- this.activePartId = activePartId;
- this.activeShell = activeShell;
- this.activeWorkbenchPartSite = activeWorkbenchPartSite;
- this.contextId = contextId;
- }
+ this.activePartId = activePartId;
+ this.activeShell = activeShell;
+ this.activeWorkbenchPartSite = activeWorkbenchPartSite;
+ this.contextId = contextId;
+ }
- /**
- * @see Comparable#compareTo(java.lang.Object)
- */
- @Override
+ /**
+ * @see Comparable#compareTo(java.lang.Object)
+ */
+ @Override
public int compareTo(Object object) {
- EnabledSubmission castedObject = (EnabledSubmission) object;
- int compareTo = Util.compare(activeWorkbenchPartSite,
- castedObject.activeWorkbenchPartSite);
+ EnabledSubmission castedObject = (EnabledSubmission) object;
+ int compareTo = Util.compare(activeWorkbenchPartSite, castedObject.activeWorkbenchPartSite);
- if (compareTo == 0) {
- compareTo = Util.compare(activePartId, castedObject.activePartId);
+ if (compareTo == 0) {
+ compareTo = Util.compare(activePartId, castedObject.activePartId);
- if (compareTo == 0) {
- compareTo = Util.compare(activeShell, castedObject.activeShell);
+ if (compareTo == 0) {
+ compareTo = Util.compare(activeShell, castedObject.activeShell);
- if (compareTo == 0) {
+ if (compareTo == 0) {
compareTo = Util.compare(contextId, castedObject.contextId);
}
- }
- }
-
- return compareTo;
- }
-
- /**
- * Returns the identifier of the part that must be active for this request
- * to be considered.
- *
- * @return the identifier of the part that must be active for this request
- * to be considered. May be <code>null</code>.
- */
- public String getActivePartId() {
- return activePartId;
- }
-
- /**
- * Returns the shell that must be active for this request to be considered.
- *
- * @return the shell that must be active for this request to be considered.
- * May be <code>null</code>.
- */
- public Shell getActiveShell() {
- return activeShell;
- }
-
- /**
- * Returns the workbench part site of the part that must be active for this
- * request to be considered.
- *
- * @return the workbench part site of the part that must be active for this
- * request to be considered. May be <code>null</code>.
- */
- public IWorkbenchPartSite getActiveWorkbenchPartSite() {
- return activeWorkbenchPartSite;
- }
-
- /**
- * Returns the identifier of the context to be enabled.
- *
- * @return the identifier of the context to be enabled. Guaranteed not to be
- * <code>null</code>.
- */
- public String getContextId() {
- return contextId;
- }
-
- /**
- * @see Object#toString()
- */
- @Override
+ }
+ }
+
+ return compareTo;
+ }
+
+ /**
+ * Returns the identifier of the part that must be active for this request to be
+ * considered.
+ *
+ * @return the identifier of the part that must be active for this request to be
+ * considered. May be <code>null</code>.
+ */
+ public String getActivePartId() {
+ return activePartId;
+ }
+
+ /**
+ * Returns the shell that must be active for this request to be considered.
+ *
+ * @return the shell that must be active for this request to be considered. May
+ * be <code>null</code>.
+ */
+ public Shell getActiveShell() {
+ return activeShell;
+ }
+
+ /**
+ * Returns the workbench part site of the part that must be active for this
+ * request to be considered.
+ *
+ * @return the workbench part site of the part that must be active for this
+ * request to be considered. May be <code>null</code>.
+ */
+ public IWorkbenchPartSite getActiveWorkbenchPartSite() {
+ return activeWorkbenchPartSite;
+ }
+
+ /**
+ * Returns the identifier of the context to be enabled.
+ *
+ * @return the identifier of the context to be enabled. Guaranteed not to be
+ * <code>null</code>.
+ */
+ public String getContextId() {
+ return contextId;
+ }
+
+ /**
+ * @see Object#toString()
+ */
+ @Override
public String toString() {
- if (string == null) {
- final StringBuilder stringBuffer = new StringBuilder();
- stringBuffer.append("[activePartId="); //$NON-NLS-1$
- stringBuffer.append(activePartId);
- stringBuffer.append(",activeShell="); //$NON-NLS-1$
- stringBuffer.append(activeShell);
- stringBuffer.append(",activeWorkbenchSite="); //$NON-NLS-1$
- stringBuffer.append(activeWorkbenchPartSite);
- stringBuffer.append(",contextId="); //$NON-NLS-1$
- stringBuffer.append(contextId);
- stringBuffer.append(']');
- string = stringBuffer.toString();
- }
-
- return string;
- }
+ if (string == null) {
+ final StringBuilder stringBuffer = new StringBuilder();
+ stringBuffer.append("[activePartId="); //$NON-NLS-1$
+ stringBuffer.append(activePartId);
+ stringBuffer.append(",activeShell="); //$NON-NLS-1$
+ stringBuffer.append(activeShell);
+ stringBuffer.append(",activeWorkbenchSite="); //$NON-NLS-1$
+ stringBuffer.append(activeWorkbenchPartSite);
+ stringBuffer.append(",contextId="); //$NON-NLS-1$
+ stringBuffer.append(contextId);
+ stringBuffer.append(']');
+ string = stringBuffer.toString();
+ }
+
+ return string;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/IContext.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/IContext.java
index 39c96bab09c..6e4745ae4d8 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/IContext.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/IContext.java
@@ -43,83 +43,76 @@ package org.eclipse.ui.contexts;
@Deprecated
public interface IContext extends Comparable {
- /**
- * Registers an instance of <code>IContextListener</code> to listen for
- * changes to properties of this instance.
- *
- * @param contextListener
- * the instance to register. Must not be <code>null</code>. If
- * an attempt is made to register an instance which is already
- * registered with this instance, no operation is performed.
- */
- void addContextListener(IContextListener contextListener);
+ /**
+ * Registers an instance of <code>IContextListener</code> to listen for changes
+ * to properties of this instance.
+ *
+ * @param contextListener the instance to register. Must not be
+ * <code>null</code>. If an attempt is made to register
+ * an instance which is already registered with this
+ * instance, no operation is performed.
+ */
+ void addContextListener(IContextListener contextListener);
- /**
- * Returns the identifier of this instance.
- *
- * @return the identifier of this instance. Guaranteed not to be
- * <code>null</code>.
- */
- String getId();
+ /**
+ * Returns the identifier of this instance.
+ *
+ * @return the identifier of this instance. Guaranteed not to be
+ * <code>null</code>.
+ */
+ String getId();
- /**
- * Returns the name of this instance suitable for display to the user.
- * <p>
- * Notification is sent to all registered listeners if this property
- * changes.
- * </p>
- *
- * @return the name of this instance. Guaranteed not to be <code>null</code>.
- * @throws NotDefinedException
- * if this instance is not defined.
- */
- String getName() throws NotDefinedException;
+ /**
+ * Returns the name of this instance suitable for display to the user.
+ * <p>
+ * Notification is sent to all registered listeners if this property changes.
+ * </p>
+ *
+ * @return the name of this instance. Guaranteed not to be <code>null</code>.
+ * @throws NotDefinedException if this instance is not defined.
+ */
+ String getName() throws NotDefinedException;
- /**
- * Returns the identifier of the parent of this instance.
- * <p>
- * Notification is sent to all registered listeners if this property
- * changes.
- * </p>
- *
- * @return the identifier of the parent of this instance. May be
- * <code>null</code>.
- * @throws NotDefinedException
- * if this instance is not defined.
- */
- String getParentId() throws NotDefinedException;
+ /**
+ * Returns the identifier of the parent of this instance.
+ * <p>
+ * Notification is sent to all registered listeners if this property changes.
+ * </p>
+ *
+ * @return the identifier of the parent of this instance. May be
+ * <code>null</code>.
+ * @throws NotDefinedException if this instance is not defined.
+ */
+ String getParentId() throws NotDefinedException;
- /**
- * Returns whether or not this instance is defined.
- * <p>
- * Notification is sent to all registered listeners if this property
- * changes.
- * </p>
- *
- * @return true, iff this instance is defined.
- */
- boolean isDefined();
+ /**
+ * Returns whether or not this instance is defined.
+ * <p>
+ * Notification is sent to all registered listeners if this property changes.
+ * </p>
+ *
+ * @return true, iff this instance is defined.
+ */
+ boolean isDefined();
- /**
- * Returns whether or not this instance is enabled.
- * <p>
- * Notification is sent to all registered listeners if this property
- * changes.
- * </p>
- *
- * @return true, iff this instance is enabled.
- */
- boolean isEnabled();
+ /**
+ * Returns whether or not this instance is enabled.
+ * <p>
+ * Notification is sent to all registered listeners if this property changes.
+ * </p>
+ *
+ * @return true, iff this instance is enabled.
+ */
+ boolean isEnabled();
- /**
- * Unregisters an instance of <code>IContextListener</code> listening for
- * changes to properties of this instance.
- *
- * @param contextListener
- * the instance to unregister. Must not be <code>null</code>.
- * If an attempt is made to unregister an instance which is not
- * already registered with this instance, no operation is
- * performed.
- */
- void removeContextListener(IContextListener contextListener);
+ /**
+ * Unregisters an instance of <code>IContextListener</code> listening for
+ * changes to properties of this instance.
+ *
+ * @param contextListener the instance to unregister. Must not be
+ * <code>null</code>. If an attempt is made to unregister
+ * an instance which is not already registered with this
+ * instance, no operation is performed.
+ */
+ void removeContextListener(IContextListener contextListener);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/IContextActivation.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/IContextActivation.java
index ad962bb77ab..6f4948f495b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/IContextActivation.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/IContextActivation.java
@@ -35,14 +35,15 @@ import org.eclipse.ui.internal.services.IEvaluationResultCache;
public interface IContextActivation extends IEvaluationResultCache {
/**
- * Clears the cached computation of the <code>isActive</code> method, if
- * any. This method is only intended for internal use. It provides a
- * mechanism by which <code>ISourceProvider</code> events can invalidate
- * state on a <code>IContextActivation</code> instance.
+ * Clears the cached computation of the <code>isActive</code> method, if any.
+ * This method is only intended for internal use. It provides a mechanism by
+ * which <code>ISourceProvider</code> events can invalidate state on a
+ * <code>IContextActivation</code> instance.
*
* @deprecated Use {@link IEvaluationResultCache#clearResult()} instead.
*/
- @Deprecated void clearActive();
+ @Deprecated
+ void clearActive();
/**
* Returns the identifier of the context that is being activated.
@@ -52,9 +53,9 @@ public interface IContextActivation extends IEvaluationResultCache {
String getContextId();
/**
- * Returns the context service from which this activation was requested.
- * This is used to ensure that an activation can only be retracted from the
- * same service which issued it.
+ * Returns the context service from which this activation was requested. This is
+ * used to ensure that an activation can only be retracted from the same service
+ * which issued it.
*
* @return The context service; never <code>null</code>.
*/
@@ -62,17 +63,16 @@ public interface IContextActivation extends IEvaluationResultCache {
/**
* Returns whether this context activation is currently active -- given the
- * current state of the workbench. This method should cache its computation.
- * The cache will be cleared by a call to <code>clearActive</code>.
+ * current state of the workbench. This method should cache its computation. The
+ * cache will be cleared by a call to <code>clearActive</code>.
*
- * @param context
- * The context in which this state should be evaluated; must not
- * be <code>null</code>.
+ * @param context The context in which this state should be evaluated; must not
+ * be <code>null</code>.
* @return <code>true</code> if the activation is currently active;
* <code>false</code> otherwise.
- * @deprecated Use
- * {@link IEvaluationResultCache#evaluate(IEvaluationContext)}
+ * @deprecated Use {@link IEvaluationResultCache#evaluate(IEvaluationContext)}
* instead.
*/
- @Deprecated boolean isActive(IEvaluationContext context);
+ @Deprecated
+ boolean isActive(IEvaluationContext context);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/IContextListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/IContextListener.java
index 8c612e95926..fee20d2a55d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/IContextListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/IContextListener.java
@@ -30,13 +30,13 @@ package org.eclipse.ui.contexts;
@Deprecated
public interface IContextListener {
- /**
- * Notifies that one or more properties of an instance of
- * <code>IContext</code> have changed. Specific details are described in
- * the <code>ContextEvent</code>.
- *
- * @param contextEvent
- * the context event. Guaranteed not to be <code>null</code>.
- */
- void contextChanged(ContextEvent contextEvent);
+ /**
+ * Notifies that one or more properties of an instance of <code>IContext</code>
+ * have changed. Specific details are described in the
+ * <code>ContextEvent</code>.
+ *
+ * @param contextEvent the context event. Guaranteed not to be
+ * <code>null</code>.
+ */
+ void contextChanged(ContextEvent contextEvent);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/IContextManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/IContextManager.java
index 55d024d9e7f..22002f4a540 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/IContextManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/IContextManager.java
@@ -35,69 +35,65 @@ import java.util.SortedSet;
@Deprecated
public interface IContextManager {
- /**
- * Registers an instance of <code>IContextManagerListener</code> to listen
- * for changes to properties of this instance.
- *
- * @param contextManagerListener
- * the instance to register. Must not be <code>null</code>. If
- * an attempt is made to register an instance which is already
- * registered with this instance, no operation is performed.
- */
- void addContextManagerListener(
- IContextManagerListener contextManagerListener);
+ /**
+ * Registers an instance of <code>IContextManagerListener</code> to listen for
+ * changes to properties of this instance.
+ *
+ * @param contextManagerListener the instance to register. Must not be
+ * <code>null</code>. If an attempt is made to
+ * register an instance which is already
+ * registered with this instance, no operation is
+ * performed.
+ */
+ void addContextManagerListener(IContextManagerListener contextManagerListener);
- /**
- * Returns an instance of <code>IContext</code> given an identifier.
- *
- * @param contextId
- * an identifier. Must not be <code>null</code>
- * @return an instance of <code>IContext</code>.
- */
- IContext getContext(String contextId);
+ /**
+ * Returns an instance of <code>IContext</code> given an identifier.
+ *
+ * @param contextId an identifier. Must not be <code>null</code>
+ * @return an instance of <code>IContext</code>.
+ */
+ IContext getContext(String contextId);
- /**
- * Returns the set of identifiers to defined contexts. The set is sorted by
- * the depth of the context within the tree of contexts. So, for example,
- * a child context will always appear before its parent.
- * <p>
- * Notification is sent to all registered listeners if this property
- * changes.
- * </p>
- *
- * @return the set of identifiers to defined contexts. This set may be
- * empty, but is guaranteed not to be <code>null</code>. If this
- * set is not empty, it is guaranteed to only contain instances of
- * <code>String</code>.
- */
- SortedSet getDefinedContextIds();
+ /**
+ * Returns the set of identifiers to defined contexts. The set is sorted by the
+ * depth of the context within the tree of contexts. So, for example, a child
+ * context will always appear before its parent.
+ * <p>
+ * Notification is sent to all registered listeners if this property changes.
+ * </p>
+ *
+ * @return the set of identifiers to defined contexts. This set may be empty,
+ * but is guaranteed not to be <code>null</code>. If this set is not
+ * empty, it is guaranteed to only contain instances of
+ * <code>String</code>.
+ */
+ SortedSet getDefinedContextIds();
- /**
- * Returns the set of identifiers to enabled contexts. The set is sorted by
- * the depth of the context within the tree of contexts. So, for example,
- * a child context will always appear before its parent.
- * <p>
- * Notification is sent to all registered listeners if this property
- * changes.
- * </p>
- *
- * @return the set of identifiers to enabled contexts. This set may be
- * empty, but is guaranteed not to be <code>null</code>. If this
- * set is not empty, it is guaranteed to only contain instances of
- * <code>String</code>.
- */
- SortedSet getEnabledContextIds();
+ /**
+ * Returns the set of identifiers to enabled contexts. The set is sorted by the
+ * depth of the context within the tree of contexts. So, for example, a child
+ * context will always appear before its parent.
+ * <p>
+ * Notification is sent to all registered listeners if this property changes.
+ * </p>
+ *
+ * @return the set of identifiers to enabled contexts. This set may be empty,
+ * but is guaranteed not to be <code>null</code>. If this set is not
+ * empty, it is guaranteed to only contain instances of
+ * <code>String</code>.
+ */
+ SortedSet getEnabledContextIds();
- /**
- * Unregisters an instance of <code>IContextManagerListener</code>
- * listening for changes to properties of this instance.
- *
- * @param contextManagerListener
- * the instance to unregister. Must not be <code>null</code>.
- * If an attempt is made to unregister an instance which is not
- * already registered with this instance, no operation is
- * performed.
- */
- void removeContextManagerListener(
- IContextManagerListener contextManagerListener);
+ /**
+ * Unregisters an instance of <code>IContextManagerListener</code> listening for
+ * changes to properties of this instance.
+ *
+ * @param contextManagerListener the instance to unregister. Must not be
+ * <code>null</code>. If an attempt is made to
+ * unregister an instance which is not already
+ * registered with this instance, no operation is
+ * performed.
+ */
+ void removeContextManagerListener(IContextManagerListener contextManagerListener);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/IContextManagerListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/IContextManagerListener.java
index 0c9b917bbe3..e06638436ed 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/IContextManagerListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/IContextManagerListener.java
@@ -30,14 +30,13 @@ package org.eclipse.ui.contexts;
@Deprecated
public interface IContextManagerListener {
- /**
- * Notifies that one or more properties of an instance of
- * <code>IContextManager</code> have changed. Specific details are
- * described in the <code>ContextManagerEvent</code>.
- *
- * @param contextManagerEvent
- * the context manager event. Guaranteed not to be
- * <code>null</code>.
- */
- void contextManagerChanged(ContextManagerEvent contextManagerEvent);
+ /**
+ * Notifies that one or more properties of an instance of
+ * <code>IContextManager</code> have changed. Specific details are described in
+ * the <code>ContextManagerEvent</code>.
+ *
+ * @param contextManagerEvent the context manager event. Guaranteed not to be
+ * <code>null</code>.
+ */
+ void contextManagerChanged(ContextManagerEvent contextManagerEvent);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/IContextService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/IContextService.java
index 4bd9e83f6c7..4f70eb97cb5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/IContextService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/IContextService.java
@@ -50,185 +50,175 @@ public interface IContextService extends IServiceWithSources {
String CONTEXT_ID_WORKBENCH_MENU = "org.eclipse.ui.contexts.workbenchMenu"; //$NON-NLS-1$
/**
- * The identifier for the context that is active when a shell registered as
- * a dialog.
+ * The identifier for the context that is active when a shell registered as a
+ * dialog.
*/
String CONTEXT_ID_DIALOG = "org.eclipse.ui.contexts.dialog"; //$NON-NLS-1$
/**
- * The identifier for the context that is active when a shell is registered
- * as either a window or a dialog.
+ * The identifier for the context that is active when a shell is registered as
+ * either a window or a dialog.
*/
String CONTEXT_ID_DIALOG_AND_WINDOW = "org.eclipse.ui.contexts.dialogAndWindow"; //$NON-NLS-1$
/**
- * The identifier for the context that is active when a shell is registered
- * as a window.
+ * The identifier for the context that is active when a shell is registered as a
+ * window.
*/
String CONTEXT_ID_WINDOW = "org.eclipse.ui.contexts.window"; //$NON-NLS-1$
/**
- * The type used for registration indicating that the shell should be
- * treated as a dialog. When the given shell is active, the "In Dialogs"
- * context should also be active.
+ * The type used for registration indicating that the shell should be treated as
+ * a dialog. When the given shell is active, the "In Dialogs" context should
+ * also be active.
*/
int TYPE_DIALOG = 0;
/**
- * The type used for registration indicating that the shell should not
- * receive any key bindings be default. When the given shell is active, we
- * should not provide any <code>EnabledSubmission</code> instances for the
- * "In Dialogs" or "In Windows" contexts.
+ * The type used for registration indicating that the shell should not receive
+ * any key bindings be default. When the given shell is active, we should not
+ * provide any <code>EnabledSubmission</code> instances for the "In Dialogs" or
+ * "In Windows" contexts.
*
*/
int TYPE_NONE = 1;
/**
- * The type used for registration indicating that the shell should be
- * treated as a window. When the given shell is active, the "In Windows"
- * context should also be active.
+ * The type used for registration indicating that the shell should be treated as
+ * a window. When the given shell is active, the "In Windows" context should
+ * also be active.
*/
int TYPE_WINDOW = 2;
/**
* <p>
* Activates the given context within the context of this service. If this
- * service was retrieved from the workbench, then this context will be
- * active globally. If the service was retrieved from a nested component,
- * then the context will only be active within that component.
+ * service was retrieved from the workbench, then this context will be active
+ * globally. If the service was retrieved from a nested component, then the
+ * context will only be active within that component.
* </p>
* <p>
* Also, it is guaranteed that the contexts submitted through a particular
- * service will be cleaned up when that services is destroyed. So, for
- * example, a service retrieved from a <code>IWorkbenchPartSite</code>
- * would deactivate all of its contexts when the site is destroyed.
+ * service will be cleaned up when that services is destroyed. So, for example,
+ * a service retrieved from a <code>IWorkbenchPartSite</code> would deactivate
+ * all of its contexts when the site is destroyed.
* </p>
*
- * @param contextId
- * The identifier for the context which should be activated; must
- * not be <code>null</code>.
+ * @param contextId The identifier for the context which should be activated;
+ * must not be <code>null</code>.
* @return A token which can be used to later cancel the activation. Only
* someone with access to this token can cancel the activation. The
- * activation will automatically be cancelled if the context from
- * which this service was retrieved is destroyed.
+ * activation will automatically be cancelled if the context from which
+ * this service was retrieved is destroyed.
*/
IContextActivation activateContext(String contextId);
/**
* <p>
- * Activates the given context within the context of this service. The
- * context becomes active when <code>expression</code> evaluates to
- * <code>true</code>. This is the same as calling
- * {@link #activateContext(String, Expression, boolean)} with global==<code>false</code>.
+ * Activates the given context within the context of this service. The context
+ * becomes active when <code>expression</code> evaluates to <code>true</code>.
+ * This is the same as calling
+ * {@link #activateContext(String, Expression, boolean)} with
+ * global==<code>false</code>.
* </p>
* <p>
* Also, it is guaranteed that the context submitted through a particular
- * service will be cleaned up when that services is destroyed. So, for
- * example, a service retrieved from a <code>IWorkbenchPartSite</code>
- * would deactivate all of its handlers when the site is destroyed.
+ * service will be cleaned up when that services is destroyed. So, for example,
+ * a service retrieved from a <code>IWorkbenchPartSite</code> would deactivate
+ * all of its handlers when the site is destroyed.
* </p>
*
- * @param contextId
- * The identifier for the context which should be activated; must
- * not be <code>null</code>.
- * @param expression
- * This expression must evaluate to <code>true</code> before
- * this context will really become active. The expression may be
- * <code>null</code> if the context should always be active.
+ * @param contextId The identifier for the context which should be activated;
+ * must not be <code>null</code>.
+ * @param expression This expression must evaluate to <code>true</code> before
+ * this context will really become active. The expression may
+ * be <code>null</code> if the context should always be
+ * active.
* @return A token which can be used to later cancel the activation. Only
* someone with access to this token can cancel the activation. The
- * activation will automatically be cancelled if the context from
- * which this service was retrieved is destroyed.
+ * activation will automatically be cancelled if the context from which
+ * this service was retrieved is destroyed.
*
* @see org.eclipse.ui.ISources
* @since 3.2
*/
- IContextActivation activateContext(String contextId,
- Expression expression);
+ IContextActivation activateContext(String contextId, Expression expression);
/**
* <p>
- * Activates the given context within the context of this service. The
- * context becomes active when <code>expression</code> evaluates to
- * <code>true</code>. If global==<code>false</code> then this service
- * must also be the active service to activate the context.
+ * Activates the given context within the context of this service. The context
+ * becomes active when <code>expression</code> evaluates to <code>true</code>.
+ * If global==<code>false</code> then this service must also be the active
+ * service to activate the context.
* </p>
* <p>
* Also, it is guaranteed that the context submitted through a particular
- * service will be cleaned up when that services is destroyed. So, for
- * example, a service retrieved from a <code>IWorkbenchPartSite</code>
- * would deactivate all of its handlers when the site is destroyed.
+ * service will be cleaned up when that services is destroyed. So, for example,
+ * a service retrieved from a <code>IWorkbenchPartSite</code> would deactivate
+ * all of its handlers when the site is destroyed.
* </p>
*
- * @param contextId
- * The identifier for the context which should be activated; must
- * not be <code>null</code>.
- * @param expression
- * This expression must evaluate to <code>true</code> before
- * this context will really become active. The expression may be
- * <code>null</code> if the context should always be active.
- * @param global
- * Indicates that the handler should be activated irrespectively
- * of whether the corresponding workbench component (e.g.,
- * window, part, etc.) is active.
+ * @param contextId The identifier for the context which should be activated;
+ * must not be <code>null</code>.
+ * @param expression This expression must evaluate to <code>true</code> before
+ * this context will really become active. The expression may
+ * be <code>null</code> if the context should always be
+ * active.
+ * @param global Indicates that the handler should be activated
+ * irrespectively of whether the corresponding workbench
+ * component (e.g., window, part, etc.) is active.
* @return A token which can be used to later cancel the activation. Only
* someone with access to this token can cancel the activation. The
- * activation will automatically be cancelled if the context from
- * which this service was retrieved is destroyed.
+ * activation will automatically be cancelled if the context from which
+ * this service was retrieved is destroyed.
*
* @see org.eclipse.ui.ISources
* @since 3.2
*/
- IContextActivation activateContext(String contextId,
- Expression expression, boolean global);
+ IContextActivation activateContext(String contextId, Expression expression, boolean global);
/**
* <p>
- * Activates the given context within the context of this service. The
- * context becomes active when <code>expression</code> evaluates to
- * <code>true</code>.
+ * Activates the given context within the context of this service. The context
+ * becomes active when <code>expression</code> evaluates to <code>true</code>.
* </p>
* <p>
* Also, it is guaranteed that the context submitted through a particular
- * service will be cleaned up when that services is destroyed. So, for
- * example, a service retrieved from a <code>IWorkbenchPartSite</code>
- * would deactivate all of its handlers when the site is destroyed.
+ * service will be cleaned up when that services is destroyed. So, for example,
+ * a service retrieved from a <code>IWorkbenchPartSite</code> would deactivate
+ * all of its handlers when the site is destroyed.
* </p>
*
- * @param contextId
- * The identifier for the context which should be activated; must
- * not be <code>null</code>.
- * @param expression
- * This expression must evaluate to <code>true</code> before
- * this context will really become active. The expression may be
- * <code>null</code> if the context should always be active.
- * @param sourcePriorities
- * The source priorities for the expression.
+ * @param contextId The identifier for the context which should be
+ * activated; must not be <code>null</code>.
+ * @param expression This expression must evaluate to <code>true</code>
+ * before this context will really become active. The
+ * expression may be <code>null</code> if the context
+ * should always be active.
+ * @param sourcePriorities The source priorities for the expression.
* @return A token which can be used to later cancel the activation. Only
* someone with access to this token can cancel the activation. The
- * activation will automatically be cancelled if the context from
- * which this service was retrieved is destroyed.
+ * activation will automatically be cancelled if the context from which
+ * this service was retrieved is destroyed.
*
* @see org.eclipse.ui.ISources
- * @deprecated Use
- * {@link IContextService#activateContext(String, Expression)}
+ * @deprecated Use {@link IContextService#activateContext(String, Expression)}
* instead.
*/
- @Deprecated IContextActivation activateContext(String contextId,
- Expression expression, int sourcePriorities);
+ @Deprecated
+ IContextActivation activateContext(String contextId, Expression expression, int sourcePriorities);
/**
- * Adds a listener to this context service. The listener will be notified
- * when the set of defined contexts changes. This can be used to track the
- * global appearance and disappearance of contexts.
+ * Adds a listener to this context service. The listener will be notified when
+ * the set of defined contexts changes. This can be used to track the global
+ * appearance and disappearance of contexts.
* <p>
- * <b>Note:</b> listeners should be removed when no longer necessary. If
- * not, they will be removed when the IServiceLocator used to acquire this
- * service is disposed.
+ * <b>Note:</b> listeners should be removed when no longer necessary. If not,
+ * they will be removed when the IServiceLocator used to acquire this service is
+ * disposed.
* </p>
*
- * @param listener
- * The listener to attach; must not be <code>null</code>.
+ * @param listener The listener to attach; must not be <code>null</code>.
* @since 3.2
* @see #removeContextManagerListener(IContextManagerListener)
*/
@@ -241,25 +231,23 @@ public interface IContextService extends IServiceWithSources {
* activation with this method. That is, you must have the same
* <code>IContextActivation</code> used to activate the context.
*
- * @param activation
- * The token that was returned from a call to
- * <code>activateContext</code>; must not be <code>null</code>.
+ * @param activation The token that was returned from a call to
+ * <code>activateContext</code>; must not be
+ * <code>null</code>.
*/
void deactivateContext(IContextActivation activation);
/**
* Deactivates the given contexts within the context of this service. If the
* contexts were activated with a different service, then they must be
- * deactivated from that service instead. It is only possible to retract
- * context activations with this method. That is, you must have the same
- * <code>IContextActivation</code> instances used to activate the
- * contexts.
+ * deactivated from that service instead. It is only possible to retract context
+ * activations with this method. That is, you must have the same
+ * <code>IContextActivation</code> instances used to activate the contexts.
*
- * @param activations
- * The tokens that were returned from a call to
- * <code>activateContext</code>. This collection must only
- * contain instances of <code>IContextActivation</code>. The
- * collection must not be <code>null</code>.
+ * @param activations The tokens that were returned from a call to
+ * <code>activateContext</code>. This collection must only
+ * contain instances of <code>IContextActivation</code>. The
+ * collection must not be <code>null</code>.
*/
void deactivateContexts(Collection activations);
@@ -267,19 +255,18 @@ public interface IContextService extends IServiceWithSources {
* Returns the set of active context identifiers.
*
* @return The set of active context identifiers; this value may be
- * <code>null</code> if no active contexts have been set yet. If
- * the set is not <code>null</code>, then it contains only
- * instances of <code>String</code>.
+ * <code>null</code> if no active contexts have been set yet. If the set
+ * is not <code>null</code>, then it contains only instances of
+ * <code>String</code>.
* @since 3.2
*/
Collection getActiveContextIds();
/**
- * Retrieves the context with the given identifier. If no such context
- * exists, then an undefined context with the given id is created.
+ * Retrieves the context with the given identifier. If no such context exists,
+ * then an undefined context with the given id is created.
*
- * @param contextId
- * The identifier to find; must not be <code>null</code>.
+ * @param contextId The identifier to find; must not be <code>null</code>.
* @return A context with the given identifier, either defined or undefined.
*/
Context getContext(String contextId);
@@ -287,28 +274,27 @@ public interface IContextService extends IServiceWithSources {
/**
* Returns the collection of all of the defined contexts in the workbench.
*
- * @return The collection of contexts (<code>Context</code>) that are
- * defined; never <code>null</code>, but may be empty.
+ * @return The collection of contexts (<code>Context</code>) that are defined;
+ * never <code>null</code>, but may be empty.
* @since 3.2
*/
Context[] getDefinedContexts();
/**
- * Returns the collection of the identifiers for all of the defined contexts
- * in the workbench.
+ * Returns the collection of the identifiers for all of the defined contexts in
+ * the workbench.
*
- * @return The collection of context identifiers (<code>String</code>)
- * that are defined; never <code>null</code>, but may be empty.
+ * @return The collection of context identifiers (<code>String</code>) that are
+ * defined; never <code>null</code>, but may be empty.
*/
Collection getDefinedContextIds();
/**
* Returns the shell type for the given shell.
*
- * @param shell
- * The shell for which the type should be determined. If this
- * value is <code>null</code>, then
- * <code>IContextService.TYPE_NONE</code> is returned.
+ * @param shell The shell for which the type should be determined. If this value
+ * is <code>null</code>, then
+ * <code>IContextService.TYPE_NONE</code> is returned.
* @return <code>IContextService.TYPE_WINDOW</code>,
* <code>IContextService.TYPE_DIALOG</code>, or
* <code>IContextService.TYPE_NONE</code>.
@@ -318,10 +304,10 @@ public interface IContextService extends IServiceWithSources {
/**
* <p>
* Reads the context information from the registry and the preferences. This
- * will overwrite any of the existing information in the context service.
- * This method is intended to be called during start-up. When this method
- * completes, this context service will reflect the current state of the
- * registry and preference store.
+ * will overwrite any of the existing information in the context service. This
+ * method is intended to be called during start-up. When this method completes,
+ * this context service will reflect the current state of the registry and
+ * preference store.
* </p>
*/
void readRegistry();
@@ -330,40 +316,36 @@ public interface IContextService extends IServiceWithSources {
* <p>
* Registers a shell to automatically promote or demote some basic types of
* contexts. The "In Dialogs" and "In Windows" contexts are provided by the
- * system. This a convenience method to ensure that these contexts are
- * promoted when the given shell is active.
+ * system. This a convenience method to ensure that these contexts are promoted
+ * when the given shell is active.
* </p>
* <p>
* If a shell is registered as a window, then the "In Windows" context is
- * enabled when that shell is active. If a shell is registered as a dialog
- * -- or is not registered, but has a parent shell -- then the "In Dialogs"
- * context is enabled when that shell is active. If the shell is registered
- * as none -- or is not registered, but has no parent shell -- then the
- * neither of the contexts will be enabled (by us -- someone else can always
- * enabled them).
+ * enabled when that shell is active. If a shell is registered as a dialog -- or
+ * is not registered, but has a parent shell -- then the "In Dialogs" context is
+ * enabled when that shell is active. If the shell is registered as none -- or
+ * is not registered, but has no parent shell -- then the neither of the
+ * contexts will be enabled (by us -- someone else can always enabled them).
* </p>
* <p>
* If the provided shell has already been registered, then this method will
* change the registration.
* </p>
*
- * @param shell
- * The shell to register for key bindings; must not be
- * <code>null</code>.
- * @param type
- * The type of shell being registered. This value must be one of
- * the constants given in this interface.
+ * @param shell The shell to register for key bindings; must not be
+ * <code>null</code>.
+ * @param type The type of shell being registered. This value must be one of
+ * the constants given in this interface.
*
- * @return <code>true</code> if the shell had already been registered (i.e.,
- * the registration has changed); <code>false</code> otherwise.
+ * @return <code>true</code> if the shell had already been registered (i.e., the
+ * registration has changed); <code>false</code> otherwise.
*/
boolean registerShell(Shell shell, int type);
/**
* Removes a listener from this context service.
*
- * @param listener
- * The listener to be removed; must not be <code>null</code>.
+ * @param listener The listener to be removed; must not be <code>null</code>.
* @since 3.2
*/
void removeContextManagerListener(IContextManagerListener listener);
@@ -371,18 +353,17 @@ public interface IContextService extends IServiceWithSources {
/**
* <p>
* Unregisters a shell that was previously registered. After this method
- * completes, the shell will be treated as if it had never been registered
- * at all. If you have registered a shell, you should ensure that this
- * method is called when the shell is disposed. Otherwise, a potential
- * memory leak will exist.
+ * completes, the shell will be treated as if it had never been registered at
+ * all. If you have registered a shell, you should ensure that this method is
+ * called when the shell is disposed. Otherwise, a potential memory leak will
+ * exist.
* </p>
* <p>
- * If the shell was never registered, or if the shell is <code>null</code>,
- * then this method returns <code>false</code> and does nothing.
+ * If the shell was never registered, or if the shell is <code>null</code>, then
+ * this method returns <code>false</code> and does nothing.
*
- * @param shell
- * The shell to be unregistered; does nothing if this value is
- * <code>null</code>.
+ * @param shell The shell to be unregistered; does nothing if this value is
+ * <code>null</code>.
*
* @return <code>true</code> if the shell had been registered;
* <code>false</code> otherwise.
@@ -392,14 +373,13 @@ public interface IContextService extends IServiceWithSources {
/**
* Informs the service that a batch operation has started.
* <p>
- * <b>Note:</b> You must insure that if you call
- * <code>deferUpdates(true)</code> that nothing in your batched operation
- * will prevent the matching call to <code>deferUpdates(false)</code>.
+ * <b>Note:</b> You must insure that if you call <code>deferUpdates(true)</code>
+ * that nothing in your batched operation will prevent the matching call to
+ * <code>deferUpdates(false)</code>.
* </p>
*
- * @param defer
- * true when starting a batch operation false when ending the
- * operation
+ * @param defer true when starting a batch operation false when ending the
+ * operation
*
* @since 3.5
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/IWorkbenchContextSupport.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/IWorkbenchContextSupport.java
index 61af07fb653..93bf1c444b9 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/IWorkbenchContextSupport.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/IWorkbenchContextSupport.java
@@ -38,64 +38,62 @@ import org.eclipse.swt.widgets.Shell;
public interface IWorkbenchContextSupport {
/**
- * The identifier for the context that is active when a shell registered as
- * a dialog.
+ * The identifier for the context that is active when a shell registered as a
+ * dialog.
*/
String CONTEXT_ID_DIALOG = IContextService.CONTEXT_ID_DIALOG;
/**
- * The identifier for the context that is active when a shell is registered
- * as either a window or a dialog.
+ * The identifier for the context that is active when a shell is registered as
+ * either a window or a dialog.
*/
String CONTEXT_ID_DIALOG_AND_WINDOW = IContextService.CONTEXT_ID_DIALOG_AND_WINDOW;
/**
- * The identifier for the context that is active when a shell is registered
- * as a window.
+ * The identifier for the context that is active when a shell is registered as a
+ * window.
*/
String CONTEXT_ID_WINDOW = IContextService.CONTEXT_ID_WINDOW;
/**
- * The type used for registration indicating that the shell should be
- * treated as a dialog. When the given shell is active, the "In Dialogs"
- * context should also be active.
+ * The type used for registration indicating that the shell should be treated as
+ * a dialog. When the given shell is active, the "In Dialogs" context should
+ * also be active.
*/
int TYPE_DIALOG = IContextService.TYPE_DIALOG;
/**
- * The type used for registration indicating that the shell should not
- * receive any key bindings be default. When the given shell is active, we
- * should not provide any <code>EnabledSubmission</code> instances for the
- * "In Dialogs" or "In Windows" contexts.
+ * The type used for registration indicating that the shell should not receive
+ * any key bindings be default. When the given shell is active, we should not
+ * provide any <code>EnabledSubmission</code> instances for the "In Dialogs" or
+ * "In Windows" contexts.
*
*/
int TYPE_NONE = IContextService.TYPE_NONE;
/**
- * The type used for registration indicating that the shell should be
- * treated as a window. When the given shell is active, the "In Windows"
- * context should also be active.
+ * The type used for registration indicating that the shell should be treated as
+ * a window. When the given shell is active, the "In Windows" context should
+ * also be active.
*/
int TYPE_WINDOW = IContextService.TYPE_WINDOW;
/**
* <p>
- * Add a single enabled submission for consideration. An enabled submission
- * is a description of certain criteria under which a particular context
- * should become active. All added submissions will be check when the
- * conditions in the workbench change, and zero or more contexts will be
- * selected as active.
+ * Add a single enabled submission for consideration. An enabled submission is a
+ * description of certain criteria under which a particular context should
+ * become active. All added submissions will be check when the conditions in the
+ * workbench change, and zero or more contexts will be selected as active.
* </p>
* <p>
* Just because an enabled submission is added, it does not mean that the
* corresponding context will become active. The workbench will consider the
- * request, but other factors (such as conflicts) may prevent the context
- * from becoming active.
+ * request, but other factors (such as conflicts) may prevent the context from
+ * becoming active.
* </p>
*
- * @param enabledSubmission
- * The enabled submission to be considered; must not be
- * <code>null</code>.
+ * @param enabledSubmission The enabled submission to be considered; must not be
+ * <code>null</code>.
*/
void addEnabledSubmission(EnabledSubmission enabledSubmission);
@@ -103,22 +101,21 @@ public interface IWorkbenchContextSupport {
* <p>
* Adds zero or more enabled submissions for consideration. An enabled
* submission is a description of certain criteria under which a particular
- * context should become active. All added submissions will be check when
- * the conditions in the workbench change, and zero or more contexts will be
+ * context should become active. All added submissions will be check when the
+ * conditions in the workbench change, and zero or more contexts will be
* selected as active.
* </p>
* <p>
* Just because an enabled submission is added, it does not mean that the
* corresponding context will become active. The workbench will consider the
- * request, but other factors (such as conflicts) may prevent the context
- * from becoming active.
+ * request, but other factors (such as conflicts) may prevent the context from
+ * becoming active.
* </p>
*
- * @param enabledSubmissions
- * The enabled submissions to be considered; must not be
- * <code>null</code>, but may be empty. Every element in the
- * collection must be an instance of
- * <code>EnabledSubmission</code>.
+ * @param enabledSubmissions The enabled submissions to be considered; must not
+ * be <code>null</code>, but may be empty. Every
+ * element in the collection must be an instance of
+ * <code>EnabledSubmission</code>.
*/
void addEnabledSubmissions(Collection enabledSubmissions);
@@ -133,10 +130,9 @@ public interface IWorkbenchContextSupport {
/**
* Returns the shell type for the given shell.
*
- * @param shell
- * The shell for which the type should be determined. If this
- * value is <code>null</code>, then
- * <code>IWorkbenchContextSupport.TYPE_NONE</code> is returned.
+ * @param shell The shell for which the type should be determined. If this value
+ * is <code>null</code>, then
+ * <code>IWorkbenchContextSupport.TYPE_NONE</code> is returned.
* @return <code>IWorkbenchContextSupport.TYPE_WINDOW</code>,
* <code>IWorkbenchContextSupport.TYPE_DIALOG</code>, or
* <code>IWorkbenchContextSupport.TYPE_NONE</code>.
@@ -147,14 +143,14 @@ public interface IWorkbenchContextSupport {
/**
* Tests whether the global key binding architecture is currently active.
*
- * @return <code>true</code> if the key bindings are active;
- * <code>false</code> otherwise.
+ * @return <code>true</code> if the key bindings are active; <code>false</code>
+ * otherwise.
*/
boolean isKeyFilterEnabled();
/**
- * Opens the key assistant dialog positioned near the key binding entry in
- * the status bar.
+ * Opens the key assistant dialog positioned near the key binding entry in the
+ * status bar.
*
* @since 3.1
*/
@@ -164,72 +160,65 @@ public interface IWorkbenchContextSupport {
* <p>
* Registers a shell to automatically promote or demote some basic types of
* contexts. The "In Dialogs" and "In Windows" contexts are provided by the
- * system. This a convenience method to ensure that these contexts are
- * promoted when the given is shell is active.
+ * system. This a convenience method to ensure that these contexts are promoted
+ * when the given is shell is active.
* </p>
* <p>
* If a shell is registered as a window, then the "In Windows" context is
- * enabled when that shell is active. If a shell is registered as a dialog --
- * or is not registered, but has a parent shell -- then the "In Dialogs"
- * context is enabled when that shell is active. If the shell is registered
- * as none -- or is not registered, but has no parent shell -- then the
- * neither of the contexts will be enabled (by us -- someone else can always
- * enabled them).
+ * enabled when that shell is active. If a shell is registered as a dialog -- or
+ * is not registered, but has a parent shell -- then the "In Dialogs" context is
+ * enabled when that shell is active. If the shell is registered as none -- or
+ * is not registered, but has no parent shell -- then the neither of the
+ * contexts will be enabled (by us -- someone else can always enabled them).
* </p>
* <p>
* If the provided shell has already been registered, then this method will
* change the registration.
* </p>
*
- * @param shell
- * The shell to register for key bindings; must not be
- * <code>null</code>.
- * @param type
- * The type of shell being registered. This value must be one of
- * the constants given in this interface.
+ * @param shell The shell to register for key bindings; must not be
+ * <code>null</code>.
+ * @param type The type of shell being registered. This value must be one of
+ * the constants given in this interface.
*
- * @return <code>true</code> if the shell had already been registered
- * (i.e., the registration has changed); <code>false</code>
- * otherwise.
+ * @return <code>true</code> if the shell had already been registered (i.e., the
+ * registration has changed); <code>false</code> otherwise.
*/
boolean registerShell(final Shell shell, final int type);
/**
* <p>
- * Removes a single enabled submission from consideration. Only the same
- * enabled submission will be removed; equivalent submissions will not be
- * removed. Removing an enabled submission does not necessarily mean that
- * the corresponding context will become inactive. It is possible that other
- * parts of the application have requested that the context be enabled.
+ * Removes a single enabled submission from consideration. Only the same enabled
+ * submission will be removed; equivalent submissions will not be removed.
+ * Removing an enabled submission does not necessarily mean that the
+ * corresponding context will become inactive. It is possible that other parts
+ * of the application have requested that the context be enabled.
* </p>
* <p>
- * There is no way to disable a context. It is only possible to not enable
- * it.
+ * There is no way to disable a context. It is only possible to not enable it.
* </p>
*
- * @param enabledSubmission
- * The enabled submission to be removed; must not be
- * <code>null</code>.
+ * @param enabledSubmission The enabled submission to be removed; must not be
+ * <code>null</code>.
*/
void removeEnabledSubmission(EnabledSubmission enabledSubmission);
/**
* <p>
- * Removes a collection of enabled submissions from consideration. Only the
- * same enabled submissions will be removed; equivalent submissions will not
- * be removed. Removing an enabled submission does not necessarily mean that
- * the corresponding context will become inactive. It is possible that other
- * parts of the application have requested that the context be enabled.
+ * Removes a collection of enabled submissions from consideration. Only the same
+ * enabled submissions will be removed; equivalent submissions will not be
+ * removed. Removing an enabled submission does not necessarily mean that the
+ * corresponding context will become inactive. It is possible that other parts
+ * of the application have requested that the context be enabled.
* </p>
* <p>
- * There is no way to disable a context. It is only possible to not enable
- * it.
+ * There is no way to disable a context. It is only possible to not enable it.
* </p>
*
- * @param enabledSubmissions
- * The enabled submissions to be removed; must not be
- * <code>null</code>, but may be empty. The collection must
- * only contain instances of <code>EnabledSubmission</code>.
+ * @param enabledSubmissions The enabled submissions to be removed; must not be
+ * <code>null</code>, but may be empty. The collection
+ * must only contain instances of
+ * <code>EnabledSubmission</code>.
*/
void removeEnabledSubmissions(Collection enabledSubmissions);
@@ -237,35 +226,32 @@ public interface IWorkbenchContextSupport {
* Enables or disables the global key binding architecture. The architecture
* should be enabled by default.
*
- * When enabled, keyboard shortcuts are active, and that key events can
- * trigger commands. This also means that widgets may not see all key events
- * (as they might be trapped as a keyboard shortcut).
+ * When enabled, keyboard shortcuts are active, and that key events can trigger
+ * commands. This also means that widgets may not see all key events (as they
+ * might be trapped as a keyboard shortcut).
*
- * When disabled, no key events will trapped as keyboard shortcuts, and that
- * no commands can be triggered by keyboard events. (Exception: it is
- * possible that someone listening for key events on a widget could trigger
- * a command.)
+ * When disabled, no key events will trapped as keyboard shortcuts, and that no
+ * commands can be triggered by keyboard events. (Exception: it is possible that
+ * someone listening for key events on a widget could trigger a command.)
*
- * @param enabled
- * Whether the key filter should be enabled.
+ * @param enabled Whether the key filter should be enabled.
*/
void setKeyFilterEnabled(final boolean enabled);
/**
* <p>
* Unregisters a shell that was previously registered. After this method
- * completes, the shell will be treated as if it had never been registered
- * at all. If you have registered a shell, you should ensure that this
- * method is called when the shell is disposed. Otherwise, a potential
- * memory leak will exist.
+ * completes, the shell will be treated as if it had never been registered at
+ * all. If you have registered a shell, you should ensure that this method is
+ * called when the shell is disposed. Otherwise, a potential memory leak will
+ * exist.
* </p>
* <p>
- * If the shell was never registered, or if the shell is <code>null</code>,
- * then this method returns <code>false</code> and does nothing.
+ * If the shell was never registered, or if the shell is <code>null</code>, then
+ * this method returns <code>false</code> and does nothing.
*
- * @param shell
- * The shell to be unregistered; does nothing if this value is
- * <code>null</code>.
+ * @param shell The shell to be unregistered; does nothing if this value is
+ * <code>null</code>.
*
* @return <code>true</code> if the shell had been registered;
* <code>false</code> otherwise.
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/NotDefinedException.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/NotDefinedException.java
index bc44881e41c..33b993d7e7a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/NotDefinedException.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/contexts/NotDefinedException.java
@@ -37,8 +37,7 @@ public final class NotDefinedException extends ContextException {
/**
* Creates a new instance of this class with the specified detail message.
*
- * @param message
- * the detail message.
+ * @param message the detail message.
*/
public NotDefinedException(String message) {
super(message);
@@ -47,12 +46,10 @@ public final class NotDefinedException extends ContextException {
/**
* Constructs a new instance of <code>NotDefinedException</code>.
*
- * @param e
- * The exception being thrown; must not be <code>null</code>.
+ * @param e The exception being thrown; must not be <code>null</code>.
* @since 3.1
*/
- public NotDefinedException(
- org.eclipse.core.commands.common.NotDefinedException e) {
+ public NotDefinedException(org.eclipse.core.commands.common.NotDefinedException e) {
super(e.getMessage(), e);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/databinding/WorkbenchObservables.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/databinding/WorkbenchObservables.java
index 813e0d79593..01a5cf83b8b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/databinding/WorkbenchObservables.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/databinding/WorkbenchObservables.java
@@ -48,44 +48,37 @@ import org.eclipse.ui.services.IServiceLocator;
*/
public class WorkbenchObservables {
/**
- * Returns an observable with values of the given target type. If the
- * wrapped observable's value is of the target type, or can be adapted to
- * the target type, this is taken as the value of the returned observable,
- * otherwise <code>null</code>.
+ * Returns an observable with values of the given target type. If the wrapped
+ * observable's value is of the target type, or can be adapted to the target
+ * type, this is taken as the value of the returned observable, otherwise
+ * <code>null</code>.
*
- * @param master
- * the observable whose value should be adapted
- * @param adapter
- * the target type
- * @return an observable with values of the given type, or <code>null</code>
- * if the current value of the given observable does not adapt to
- * the target type
+ * @param master the observable whose value should be adapted
+ * @param adapter the target type
+ * @return an observable with values of the given type, or <code>null</code> if
+ * the current value of the given observable does not adapt to the
+ * target type
*/
public static <T> IObservableValue<T> observeDetailAdaptedValue(IObservableValue<?> master, Class<T> adapter) {
- return observeDetailAdaptedValue(master, adapter, Platform
- .getAdapterManager());
+ return observeDetailAdaptedValue(master, adapter, Platform.getAdapterManager());
}
/**
- * Returns an observable with values of the given target type. If the
- * wrapped observable's value is of the target type, or can be adapted to
- * the target type, this is taken as the value of the returned observable,
- * otherwise <code>null</code>.
+ * Returns an observable with values of the given target type. If the wrapped
+ * observable's value is of the target type, or can be adapted to the target
+ * type, this is taken as the value of the returned observable, otherwise
+ * <code>null</code>.
*
- * @param master
- * the observable whose value should be adapted
- * @param adapter
- * the target type
- * @param adapterManager
- * the adapter manager used to adapt the master value
- * @return an observable with values of the given type, or <code>null</code>
- * if the current value of the given observable does not adapt to
- * the target type
+ * @param master the observable whose value should be adapted
+ * @param adapter the target type
+ * @param adapterManager the adapter manager used to adapt the master value
+ * @return an observable with values of the given type, or <code>null</code> if
+ * the current value of the given observable does not adapt to the
+ * target type
*/
static <T> IObservableValue<T> observeDetailAdaptedValue(IObservableValue<?> master, Class<T> adapter,
IAdapterManager adapterManager) {
- return WorkbenchProperties.adaptedValue(adapter, adapterManager)
- .observeDetail(master);
+ return WorkbenchProperties.adaptedValue(adapter, adapterManager).observeDetail(master);
}
/**
@@ -111,17 +104,15 @@ public class WorkbenchObservables {
public static <T> IObservableValue<T> observeAdaptedSingleSelection(IServiceLocator locator, Class<T> targetType) {
ISelectionService selectionService = locator.getService(ISelectionService.class);
Assert.isNotNull(selectionService);
- return WorkbenchProperties.singleSelection(null, true).value(
- WorkbenchProperties.adaptedValue(targetType)).observe(
- selectionService);
+ return WorkbenchProperties.singleSelection(null, true).value(WorkbenchProperties.adaptedValue(targetType))
+ .observe(selectionService);
}
/**
- * Returns an observable value that tracks the active workbench window for
- * the given workbench.
+ * Returns an observable value that tracks the active workbench window for the
+ * given workbench.
*
- * @param workbench
- * the workbench to get the observable for
+ * @param workbench the workbench to get the observable for
* @return an observable value that tracks the active workbench window
* @since 3.110
*/
@@ -171,8 +162,7 @@ public class WorkbenchObservables {
* Returns an observable value that tracks the active workbench page for the
* given workbench window.
*
- * @param window
- * the workbench window to get the observable for
+ * @param window the workbench window to get the observable for
* @return an observable value that tracks the active workbench page
* @since 3.110
*/
@@ -218,9 +208,8 @@ public class WorkbenchObservables {
* Returns an observable value that tracks the active workbench part for the
* given part service.
*
- * @param partService
- * the part service to get the observable for, e.g. a workbench
- * page
+ * @param partService the part service to get the observable for, e.g. a
+ * workbench page
* @return an observable value that tracks the active workbench part
* @since 3.110
*/
@@ -283,12 +272,11 @@ public class WorkbenchObservables {
}
/**
- * Returns an observable value that tracks the active editor for the given
- * part service.
+ * Returns an observable value that tracks the active editor for the given part
+ * service.
*
- * @param partService
- * the part service to get the observable for, e.g. a workbench
- * page
+ * @param partService the part service to get the observable for, e.g. a
+ * workbench page
* @return an observable value that tracks the active editor
* @since 3.110
*/
@@ -304,8 +292,7 @@ public class WorkbenchObservables {
* Returns an observable value that tracks the editor input for the given
* editor.
*
- * @param editor
- * the editor to get the observable for
+ * @param editor the editor to get the observable for
* @return an observable value that tracks the editor input
* @since 3.110
*/
@@ -357,12 +344,11 @@ public class WorkbenchObservables {
}
/**
- * Sets the value. Must be invoked in the {@link Realm} of the
- * observable. Subclasses must call this method instead of
- * {@link #setValue} or {@link #doSetValue}.
+ * Sets the value. Must be invoked in the {@link Realm} of the observable.
+ * Subclasses must call this method instead of {@link #setValue} or
+ * {@link #doSetValue}.
*
- * @param value
- * the value to set
+ * @param value the value to set
*/
protected final void protectedSetValue(T value) {
checkRealm();
@@ -430,9 +416,8 @@ public class WorkbenchObservables {
protected abstract void stopListening();
/**
- * Subclasses must override this method to provide the object's value
- * that will be used when the value is not set explicitly by
- * {@link #doSetValue(Object)}.
+ * Subclasses must override this method to provide the object's value that will
+ * be used when the value is not set explicitly by {@link #doSetValue(Object)}.
*
* @return the object's value
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/databinding/WorkbenchProperties.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/databinding/WorkbenchProperties.java
index 960658cf7fc..e7eb875c019 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/databinding/WorkbenchProperties.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/databinding/WorkbenchProperties.java
@@ -54,8 +54,7 @@ public class WorkbenchProperties {
* type, or can be adapted to the target type, this is used as the value of
* property, otherwise <code>null</code>.
*
- * @param adapter
- * the adapter class
+ * @param adapter the adapter class
* @return a value property which observes the source object as the adapted
* type.
*/
@@ -65,25 +64,22 @@ public class WorkbenchProperties {
/**
* Returns a value property which observes the source object as the adapted
- * type. If the source object is of the target type, or can be adapted to
- * the target type, this is used as the value of property, otherwise
+ * type. If the source object is of the target type, or can be adapted to the
+ * target type, this is used as the value of property, otherwise
* <code>null</code>.
*
- * @param adapter
- * the adapter class
- * @param adapterManager
- * the adapter manager used to adapt source objects
+ * @param adapter the adapter class
+ * @param adapterManager the adapter manager used to adapt source objects
* @return a value property which observes the source object as the adapted
* type.
*/
- static IValueProperty adaptedValue(final Class adapter,
- final IAdapterManager adapterManager) {
+ static IValueProperty adaptedValue(final Class adapter, final IAdapterManager adapterManager) {
return new AdaptedValueProperty(adapter, adapterManager);
}
/**
- * Returns a property for observing the first element of a structured
- * selection as exposed by {@link ISelectionService}.
+ * Returns a property for observing the first element of a structured selection
+ * as exposed by {@link ISelectionService}.
*
* @return an observable value
*/
@@ -92,26 +88,23 @@ public class WorkbenchProperties {
}
/**
- * Returns a property for observing the first element of a structured
- * selection as exposed by {@link ISelectionService}.
+ * Returns a property for observing the first element of a structured selection
+ * as exposed by {@link ISelectionService}.
*
- * @param partId
- * the part id, or <code>null</code> if the selection can be from
- * any part
- * @param postSelection
- * <code>true</code> if the selection should be delayed for
- * keyboard-triggered selections
+ * @param partId the part id, or <code>null</code> if the selection can
+ * be from any part
+ * @param postSelection <code>true</code> if the selection should be delayed for
+ * keyboard-triggered selections
*
* @return an observable value
*/
- public static IValueProperty singleSelection(String partId,
- boolean postSelection) {
+ public static IValueProperty singleSelection(String partId, boolean postSelection) {
return new SingleSelectionProperty(partId, postSelection);
}
/**
- * Returns a property for observing the elements of a structured selection
- * as exposed by {@link ISelectionService}.
+ * Returns a property for observing the elements of a structured selection as
+ * exposed by {@link ISelectionService}.
*
* @return an observable value
*/
@@ -120,20 +113,17 @@ public class WorkbenchProperties {
}
/**
- * Returns a property for observing the elements of a structured selection
- * as exposed by {@link ISelectionService}.
+ * Returns a property for observing the elements of a structured selection as
+ * exposed by {@link ISelectionService}.
*
- * @param partId
- * the part id, or <code>null</code> if the selection can be from
- * any part
- * @param postSelection
- * <code>true</code> if the selection should be delayed for
- * keyboard-triggered selections
+ * @param partId the part id, or <code>null</code> if the selection can
+ * be from any part
+ * @param postSelection <code>true</code> if the selection should be delayed for
+ * keyboard-triggered selections
*
* @return an observable value
*/
- public static IListProperty multipleSelection(String partId,
- boolean postSelection) {
+ public static IListProperty multipleSelection(String partId, boolean postSelection) {
return new MultiSelectionProperty(partId, postSelection);
}
@@ -141,8 +131,7 @@ public class WorkbenchProperties {
private final Class adapter;
private final IAdapterManager adapterManager;
- private AdaptedValueProperty(Class adapter,
- IAdapterManager adapterManager) {
+ private AdaptedValueProperty(Class adapter, IAdapterManager adapterManager) {
this.adapter = adapter;
this.adapterManager = adapterManager;
}
@@ -165,8 +154,7 @@ public class WorkbenchProperties {
}
@Override
- public INativePropertyListener adaptListener(
- ISimplePropertyListener listener) {
+ public INativePropertyListener adaptListener(ISimplePropertyListener listener) {
return null;
}
}
@@ -181,8 +169,7 @@ public class WorkbenchProperties {
}
@Override
- public INativePropertyListener adaptListener(
- ISimplePropertyListener listener) {
+ public INativePropertyListener adaptListener(ISimplePropertyListener listener) {
return new SelectionServiceListener(this, listener, partId, post);
}
@@ -221,8 +208,7 @@ public class WorkbenchProperties {
}
@Override
- public INativePropertyListener adaptListener(
- ISimplePropertyListener listener) {
+ public INativePropertyListener adaptListener(ISimplePropertyListener listener) {
return new SelectionServiceListener(this, listener, partId, post);
}
@@ -240,8 +226,7 @@ public class WorkbenchProperties {
selection = ((ISelectionService) source).getSelection();
}
if (selection instanceof IStructuredSelection) {
- return new ArrayList(((IStructuredSelection) selection)
- .toList());
+ return new ArrayList(((IStructuredSelection) selection).toList());
}
return Collections.EMPTY_LIST;
}
@@ -252,13 +237,12 @@ public class WorkbenchProperties {
}
}
- static class SelectionServiceListener extends NativePropertyListener
- implements ISelectionListener {
+ static class SelectionServiceListener extends NativePropertyListener implements ISelectionListener {
private final String partId;
private final boolean post;
- public SelectionServiceListener(IProperty property,
- ISimplePropertyListener wrapped, String partID, boolean post) {
+ public SelectionServiceListener(IProperty property, ISimplePropertyListener wrapped, String partID,
+ boolean post) {
super(property, wrapped);
this.partId = partID;
this.post = post;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/AbstractElementListSelectionDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/AbstractElementListSelectionDialog.java
index dae7e5c7d83..c800eb0b00b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/AbstractElementListSelectionDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/AbstractElementListSelectionDialog.java
@@ -42,147 +42,156 @@ import org.eclipse.ui.PlatformUI;
*/
public abstract class AbstractElementListSelectionDialog extends SelectionStatusDialog {
- private ILabelProvider fRenderer;
+ private ILabelProvider fRenderer;
- private boolean fIgnoreCase = true;
+ private boolean fIgnoreCase = true;
- private boolean fIsMultipleSelection = false;
+ private boolean fIsMultipleSelection = false;
- private boolean fMatchEmptyString = true;
+ private boolean fMatchEmptyString = true;
- private boolean fAllowDuplicates = true;
+ private boolean fAllowDuplicates = true;
- private Label fMessage;
+ private Label fMessage;
- protected FilteredList fFilteredList;
+ protected FilteredList fFilteredList;
- private Text fFilterText;
+ private Text fFilterText;
- private ISelectionStatusValidator fValidator;
+ private ISelectionStatusValidator fValidator;
- private String fFilter = null;
+ private String fFilter = null;
- private String fEmptyListMessage = ""; //$NON-NLS-1$
+ private String fEmptyListMessage = ""; //$NON-NLS-1$
- private String fEmptySelectionMessage = ""; //$NON-NLS-1$
+ private String fEmptySelectionMessage = ""; //$NON-NLS-1$
- private int fWidth = 60;
+ private int fWidth = 60;
- private int fHeight = 18;
+ private int fHeight = 18;
- private Object[] fSelection = new Object[0];
+ private Object[] fSelection = new Object[0];
- /**
- * Constructs a list selection dialog.
- * @param parent The parent for the list.
- * @param renderer ILabelProvider for the list
- */
+ /**
+ * Constructs a list selection dialog.
+ *
+ * @param parent The parent for the list.
+ * @param renderer ILabelProvider for the list
+ */
protected AbstractElementListSelectionDialog(Shell parent, ILabelProvider renderer) {
- super(parent);
- fRenderer = renderer;
- }
-
- /**
- * Handles default selection (double click).
- * By default, the OK button is pressed.
- */
- protected void handleDefaultSelected() {
- if (validateCurrentSelection()) {
+ super(parent);
+ fRenderer = renderer;
+ }
+
+ /**
+ * Handles default selection (double click). By default, the OK button is
+ * pressed.
+ */
+ protected void handleDefaultSelected() {
+ if (validateCurrentSelection()) {
buttonPressed(IDialogConstants.OK_ID);
}
- }
-
- /**
- * Specifies if sorting, filtering and folding is case sensitive.
- * @param ignoreCase
- */
- public void setIgnoreCase(boolean ignoreCase) {
- fIgnoreCase = ignoreCase;
- }
-
- /**
- * Returns if sorting, filtering and folding is case sensitive.
- * @return boolean
- */
- public boolean isCaseIgnored() {
- return fIgnoreCase;
- }
-
- /**
- * Specifies whether everything or nothing should be filtered on
- * empty filter string.
- * @param matchEmptyString boolean
- */
- public void setMatchEmptyString(boolean matchEmptyString) {
- fMatchEmptyString = matchEmptyString;
- }
-
- /**
- * Specifies if multiple selection is allowed.
- * @param multipleSelection
- */
- public void setMultipleSelection(boolean multipleSelection) {
- fIsMultipleSelection = multipleSelection;
- }
-
- /**
- * Specifies whether duplicate entries are displayed or not.
- * @param allowDuplicates
- */
- public void setAllowDuplicates(boolean allowDuplicates) {
- fAllowDuplicates = allowDuplicates;
- }
-
- /**
- * Sets the list size in unit of characters.
- * @param width the width of the list.
- * @param height the height of the list.
- */
- public void setSize(int width, int height) {
- fWidth = width;
- fHeight = height;
- }
-
- /**
- * Sets the message to be displayed if the list is empty.
- * @param message the message to be displayed.
- */
- public void setEmptyListMessage(String message) {
- fEmptyListMessage = message;
- }
-
- /**
- * Sets the message to be displayed if the selection is empty.
- * @param message the message to be displayed.
- */
- public void setEmptySelectionMessage(String message) {
- fEmptySelectionMessage = message;
- }
-
- /**
- * Sets an optional validator to check if the selection is valid.
- * The validator is invoked whenever the selection changes.
- * @param validator the validator to validate the selection.
- */
- public void setValidator(ISelectionStatusValidator validator) {
- fValidator = validator;
- }
-
- /**
+ }
+
+ /**
+ * Specifies if sorting, filtering and folding is case sensitive.
+ *
+ * @param ignoreCase
+ */
+ public void setIgnoreCase(boolean ignoreCase) {
+ fIgnoreCase = ignoreCase;
+ }
+
+ /**
+ * Returns if sorting, filtering and folding is case sensitive.
+ *
+ * @return boolean
+ */
+ public boolean isCaseIgnored() {
+ return fIgnoreCase;
+ }
+
+ /**
+ * Specifies whether everything or nothing should be filtered on empty filter
+ * string.
+ *
+ * @param matchEmptyString boolean
+ */
+ public void setMatchEmptyString(boolean matchEmptyString) {
+ fMatchEmptyString = matchEmptyString;
+ }
+
+ /**
+ * Specifies if multiple selection is allowed.
+ *
+ * @param multipleSelection
+ */
+ public void setMultipleSelection(boolean multipleSelection) {
+ fIsMultipleSelection = multipleSelection;
+ }
+
+ /**
+ * Specifies whether duplicate entries are displayed or not.
+ *
+ * @param allowDuplicates
+ */
+ public void setAllowDuplicates(boolean allowDuplicates) {
+ fAllowDuplicates = allowDuplicates;
+ }
+
+ /**
+ * Sets the list size in unit of characters.
+ *
+ * @param width the width of the list.
+ * @param height the height of the list.
+ */
+ public void setSize(int width, int height) {
+ fWidth = width;
+ fHeight = height;
+ }
+
+ /**
+ * Sets the message to be displayed if the list is empty.
+ *
+ * @param message the message to be displayed.
+ */
+ public void setEmptyListMessage(String message) {
+ fEmptyListMessage = message;
+ }
+
+ /**
+ * Sets the message to be displayed if the selection is empty.
+ *
+ * @param message the message to be displayed.
+ */
+ public void setEmptySelectionMessage(String message) {
+ fEmptySelectionMessage = message;
+ }
+
+ /**
+ * Sets an optional validator to check if the selection is valid. The validator
+ * is invoked whenever the selection changes.
+ *
+ * @param validator the validator to validate the selection.
+ */
+ public void setValidator(ISelectionStatusValidator validator) {
+ fValidator = validator;
+ }
+
+ /**
* Sets the elements of the list (widget).
*
- * @param elements
- * the elements of the list.
+ * @param elements the elements of the list.
*/
- protected void setListElements(Object[] elements) {
- Assert.isNotNull(fFilteredList);
- fFilteredList.setElements(elements);
+ protected void setListElements(Object[] elements) {
+ Assert.isNotNull(fFilteredList);
+ fFilteredList.setElements(elements);
handleElementsChanged();
- }
+ }
- /**
- * This method is called when the elements of the backing list are changed
- * to refresh the standard dialog widgets.
+ /**
+ * This method is called when the elements of the backing list are changed to
+ * refresh the standard dialog widgets.
*
* @since 3.8
*/
@@ -199,302 +208,303 @@ public abstract class AbstractElementListSelectionDialog extends SelectionStatus
/**
* Sets the filter pattern.
*
- * @param filter
- * the filter pattern.
+ * @param filter the filter pattern.
*/
- public void setFilter(String filter) {
- if (fFilterText == null) {
+ public void setFilter(String filter) {
+ if (fFilterText == null) {
fFilter = filter;
} else {
fFilterText.setText(filter);
}
- }
+ }
- /**
+ /**
* Returns the current filter pattern.
*
* @return returns the current filter pattern or <code>null</code> if filter was
* not set.
*/
- public String getFilter() {
- if (fFilteredList == null) {
+ public String getFilter() {
+ if (fFilteredList == null) {
return fFilter;
}
return fFilteredList.getFilter();
- }
-
- /**
- * Returns the indices referring the current selection.
- * To be called within open().
- * @return returns the indices of the current selection.
- */
- protected int[] getSelectionIndices() {
- Assert.isNotNull(fFilteredList);
- return fFilteredList.getSelectionIndices();
- }
-
- /**
- * Returns an index referring the first current selection.
- * To be called within open().
- * @return returns the indices of the current selection.
- */
- protected int getSelectionIndex() {
- Assert.isNotNull(fFilteredList);
- return fFilteredList.getSelectionIndex();
- }
-
- /**
- * Sets the selection referenced by an array of elements.
- * Empty or null array removes selection.
- * To be called within open().
- * @param selection the indices of the selection.
- */
- protected void setSelection(Object[] selection) {
- Assert.isNotNull(fFilteredList);
- fFilteredList.setSelection(selection);
- }
-
- /**
- * Returns an array of the currently selected elements.
- * To be called within or after open().
- * @return returns an array of the currently selected elements.
- */
- protected Object[] getSelectedElements() {
- Assert.isNotNull(fFilteredList);
- return fFilteredList.getSelection();
- }
-
- /**
- * Returns all elements which are folded together to one entry in the list.
- * @param index the index selecting the entry in the list.
- * @return returns an array of elements folded together.
- */
- public Object[] getFoldedElements(int index) {
- Assert.isNotNull(fFilteredList);
- return fFilteredList.getFoldedElements(index);
- }
-
- /**
- * Creates the message text widget and sets layout data.
- * @param composite the parent composite of the message area.
- */
- @Override
+ }
+
+ /**
+ * Returns the indices referring the current selection. To be called within
+ * open().
+ *
+ * @return returns the indices of the current selection.
+ */
+ protected int[] getSelectionIndices() {
+ Assert.isNotNull(fFilteredList);
+ return fFilteredList.getSelectionIndices();
+ }
+
+ /**
+ * Returns an index referring the first current selection. To be called within
+ * open().
+ *
+ * @return returns the indices of the current selection.
+ */
+ protected int getSelectionIndex() {
+ Assert.isNotNull(fFilteredList);
+ return fFilteredList.getSelectionIndex();
+ }
+
+ /**
+ * Sets the selection referenced by an array of elements. Empty or null array
+ * removes selection. To be called within open().
+ *
+ * @param selection the indices of the selection.
+ */
+ protected void setSelection(Object[] selection) {
+ Assert.isNotNull(fFilteredList);
+ fFilteredList.setSelection(selection);
+ }
+
+ /**
+ * Returns an array of the currently selected elements. To be called within or
+ * after open().
+ *
+ * @return returns an array of the currently selected elements.
+ */
+ protected Object[] getSelectedElements() {
+ Assert.isNotNull(fFilteredList);
+ return fFilteredList.getSelection();
+ }
+
+ /**
+ * Returns all elements which are folded together to one entry in the list.
+ *
+ * @param index the index selecting the entry in the list.
+ * @return returns an array of elements folded together.
+ */
+ public Object[] getFoldedElements(int index) {
+ Assert.isNotNull(fFilteredList);
+ return fFilteredList.getFoldedElements(index);
+ }
+
+ /**
+ * Creates the message text widget and sets layout data.
+ *
+ * @param composite the parent composite of the message area.
+ */
+ @Override
protected Label createMessageArea(Composite composite) {
- Label label = super.createMessageArea(composite);
-
- GridData data = new GridData();
- data.grabExcessVerticalSpace = false;
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- data.verticalAlignment = GridData.BEGINNING;
- label.setLayoutData(data);
-
- fMessage = label;
-
- return label;
- }
-
- /**
- * Handles a selection changed event.
- * By default, the current selection is validated.
- */
- protected void handleSelectionChanged() {
- validateCurrentSelection();
- }
-
- /**
- * Validates the current selection and updates the status line
- * accordingly.
- * @return boolean <code>true</code> if the current selection is
- * valid.
- */
- protected boolean validateCurrentSelection() {
- Assert.isNotNull(fFilteredList);
-
- IStatus status;
- Object[] elements = getSelectedElements();
-
- if (elements.length > 0) {
- if (fValidator != null) {
- status = fValidator.validate(elements);
- } else {
- status = new Status(IStatus.OK, PlatformUI.PLUGIN_ID,
- IStatus.OK, "", //$NON-NLS-1$
- null);
- }
- } else {
- if (fFilteredList.isEmpty()) {
- status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID,
- IStatus.ERROR, fEmptyListMessage, null);
- } else {
- status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID,
- IStatus.ERROR, fEmptySelectionMessage, null);
- }
- }
-
- updateStatus(status);
-
- return status.isOK();
- }
-
- @Override
+ Label label = super.createMessageArea(composite);
+
+ GridData data = new GridData();
+ data.grabExcessVerticalSpace = false;
+ data.grabExcessHorizontalSpace = true;
+ data.horizontalAlignment = GridData.FILL;
+ data.verticalAlignment = GridData.BEGINNING;
+ label.setLayoutData(data);
+
+ fMessage = label;
+
+ return label;
+ }
+
+ /**
+ * Handles a selection changed event. By default, the current selection is
+ * validated.
+ */
+ protected void handleSelectionChanged() {
+ validateCurrentSelection();
+ }
+
+ /**
+ * Validates the current selection and updates the status line accordingly.
+ *
+ * @return boolean <code>true</code> if the current selection is valid.
+ */
+ protected boolean validateCurrentSelection() {
+ Assert.isNotNull(fFilteredList);
+
+ IStatus status;
+ Object[] elements = getSelectedElements();
+
+ if (elements.length > 0) {
+ if (fValidator != null) {
+ status = fValidator.validate(elements);
+ } else {
+ status = new Status(IStatus.OK, PlatformUI.PLUGIN_ID, IStatus.OK, "", //$NON-NLS-1$
+ null);
+ }
+ } else {
+ if (fFilteredList.isEmpty()) {
+ status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.ERROR, fEmptyListMessage, null);
+ } else {
+ status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.ERROR, fEmptySelectionMessage, null);
+ }
+ }
+
+ updateStatus(status);
+
+ return status.isOK();
+ }
+
+ @Override
protected void cancelPressed() {
- setResult(null);
- super.cancelPressed();
- }
-
- /**
- * Creates a filtered list.
- * @param parent the parent composite.
- * @return returns the filtered list widget.
- */
- protected FilteredList createFilteredList(Composite parent) {
- int flags = SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL
- | (fIsMultipleSelection ? SWT.MULTI : SWT.SINGLE);
-
- FilteredList list = new FilteredList(parent, flags, fRenderer,
- fIgnoreCase, fAllowDuplicates, fMatchEmptyString);
-
- GridData data = new GridData();
- data.widthHint = convertWidthInCharsToPixels(fWidth);
- data.heightHint = convertHeightInCharsToPixels(fHeight);
- data.grabExcessVerticalSpace = true;
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- data.verticalAlignment = GridData.FILL;
- list.setLayoutData(data);
- list.setFont(parent.getFont());
- list.setFilter((fFilter == null ? "" : fFilter)); //$NON-NLS-1$
-
- list.addSelectionListener(new SelectionListener() {
- @Override
+ setResult(null);
+ super.cancelPressed();
+ }
+
+ /**
+ * Creates a filtered list.
+ *
+ * @param parent the parent composite.
+ * @return returns the filtered list widget.
+ */
+ protected FilteredList createFilteredList(Composite parent) {
+ int flags = SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | (fIsMultipleSelection ? SWT.MULTI : SWT.SINGLE);
+
+ FilteredList list = new FilteredList(parent, flags, fRenderer, fIgnoreCase, fAllowDuplicates,
+ fMatchEmptyString);
+
+ GridData data = new GridData();
+ data.widthHint = convertWidthInCharsToPixels(fWidth);
+ data.heightHint = convertHeightInCharsToPixels(fHeight);
+ data.grabExcessVerticalSpace = true;
+ data.grabExcessHorizontalSpace = true;
+ data.horizontalAlignment = GridData.FILL;
+ data.verticalAlignment = GridData.FILL;
+ list.setLayoutData(data);
+ list.setFont(parent.getFont());
+ list.setFilter((fFilter == null ? "" : fFilter)); //$NON-NLS-1$
+
+ list.addSelectionListener(new SelectionListener() {
+ @Override
public void widgetDefaultSelected(SelectionEvent e) {
- handleDefaultSelected();
- }
+ handleDefaultSelected();
+ }
- @Override
+ @Override
public void widgetSelected(SelectionEvent e) {
- handleWidgetSelected();
- }
- });
-
- fFilteredList = list;
-
- return list;
- }
-
- // 3515
- private void handleWidgetSelected() {
- Object[] newSelection = fFilteredList.getSelection();
-
- if (newSelection.length != fSelection.length) {
- fSelection = newSelection;
- handleSelectionChanged();
- } else {
- for (int i = 0; i != newSelection.length; i++) {
- if (!newSelection[i].equals(fSelection[i])) {
- fSelection = newSelection;
- handleSelectionChanged();
- break;
- }
- }
- }
- }
-
- protected Text createFilterText(Composite parent) {
- Text text = new Text(parent, SWT.BORDER);
-
- GridData data = new GridData();
- data.grabExcessVerticalSpace = false;
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- data.verticalAlignment = GridData.BEGINNING;
- text.setLayoutData(data);
- text.setFont(parent.getFont());
-
- text.setText((fFilter == null ? "" : fFilter)); //$NON-NLS-1$
-
- Listener listener = e -> fFilteredList.setFilter(fFilterText.getText());
- text.addListener(SWT.Modify, listener);
-
- text.addKeyListener(new KeyListener() {
- @Override
+ handleWidgetSelected();
+ }
+ });
+
+ fFilteredList = list;
+
+ return list;
+ }
+
+ // 3515
+ private void handleWidgetSelected() {
+ Object[] newSelection = fFilteredList.getSelection();
+
+ if (newSelection.length != fSelection.length) {
+ fSelection = newSelection;
+ handleSelectionChanged();
+ } else {
+ for (int i = 0; i != newSelection.length; i++) {
+ if (!newSelection[i].equals(fSelection[i])) {
+ fSelection = newSelection;
+ handleSelectionChanged();
+ break;
+ }
+ }
+ }
+ }
+
+ protected Text createFilterText(Composite parent) {
+ Text text = new Text(parent, SWT.BORDER);
+
+ GridData data = new GridData();
+ data.grabExcessVerticalSpace = false;
+ data.grabExcessHorizontalSpace = true;
+ data.horizontalAlignment = GridData.FILL;
+ data.verticalAlignment = GridData.BEGINNING;
+ text.setLayoutData(data);
+ text.setFont(parent.getFont());
+
+ text.setText((fFilter == null ? "" : fFilter)); //$NON-NLS-1$
+
+ Listener listener = e -> fFilteredList.setFilter(fFilterText.getText());
+ text.addListener(SWT.Modify, listener);
+
+ text.addKeyListener(new KeyListener() {
+ @Override
public void keyPressed(KeyEvent e) {
- if (e.keyCode == SWT.ARROW_DOWN) {
+ if (e.keyCode == SWT.ARROW_DOWN) {
fFilteredList.setFocus();
}
- }
+ }
- @Override
+ @Override
public void keyReleased(KeyEvent e) {
- }
- });
+ }
+ });
- fFilterText = text;
+ fFilterText = text;
- return text;
- }
+ return text;
+ }
- @Override
+ @Override
public int open() {
- super.open();
- return getReturnCode();
- }
+ super.open();
+ return getReturnCode();
+ }
- private void access$superCreate() {
- super.create();
- }
+ private void access$superCreate() {
+ super.create();
+ }
- @Override
+ @Override
public void create() {
- BusyIndicator.showWhile(null, () -> {
- access$superCreate();
+ BusyIndicator.showWhile(null, () -> {
+ access$superCreate();
- Assert.isNotNull(fFilteredList);
+ Assert.isNotNull(fFilteredList);
- if (fFilteredList.isEmpty()) {
- handleEmptyList();
- } else {
- validateCurrentSelection();
- fFilterText.selectAll();
- fFilterText.setFocus();
- }
+ if (fFilteredList.isEmpty()) {
+ handleEmptyList();
+ } else {
+ validateCurrentSelection();
+ fFilterText.selectAll();
+ fFilterText.setFocus();
+ }
});
- }
+ }
- /**
- * Handles empty list by disabling widgets.
- */
- protected void handleEmptyList() {
+ /**
+ * Handles empty list by disabling widgets.
+ */
+ protected void handleEmptyList() {
fMessage.setEnabled(false);
fFilterText.setEnabled(false);
fFilteredList.setEnabled(false);
- updateOkState();
- }
-
- /**
- * Update the enablement of the OK button based on whether or not there
- * is a selection.
- *
- */
- protected void updateOkState() {
- Button okButton = getOkButton();
- if (okButton != null) {
+ updateOkState();
+ }
+
+ /**
+ * Update the enablement of the OK button based on whether or not there is a
+ * selection.
+ *
+ */
+ protected void updateOkState() {
+ Button okButton = getOkButton();
+ if (okButton != null) {
okButton.setEnabled(getSelectedElements().length != 0);
}
- }
-
- /**
- * Gets the optional validator used to check if the selection is valid.
- * The validator is invoked whenever the selection changes.
- * @return the validator to validate the selection, or <code>null</code>
- * if no validator has been set.
- *
- * @since 3.5
- */
- protected ISelectionStatusValidator getValidator() {
- return fValidator;
- }
+ }
+
+ /**
+ * Gets the optional validator used to check if the selection is valid. The
+ * validator is invoked whenever the selection changes.
+ *
+ * @return the validator to validate the selection, or <code>null</code> if no
+ * validator has been set.
+ *
+ * @since 3.5
+ */
+ protected ISelectionStatusValidator getValidator() {
+ return fValidator;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CheckedTreeSelectionDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CheckedTreeSelectionDialog.java
index 1a5b41f2c01..3cb734e5ccc 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CheckedTreeSelectionDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CheckedTreeSelectionDialog.java
@@ -52,67 +52,59 @@ import org.eclipse.ui.internal.WorkbenchMessages;
* @since 2.0
*/
public class CheckedTreeSelectionDialog extends SelectionStatusDialog {
- private CheckboxTreeViewer fViewer;
+ private CheckboxTreeViewer fViewer;
- private ILabelProvider fLabelProvider;
+ private ILabelProvider fLabelProvider;
- private ITreeContentProvider fContentProvider;
+ private ITreeContentProvider fContentProvider;
- private ISelectionStatusValidator fValidator = null;
+ private ISelectionStatusValidator fValidator = null;
- private ViewerComparator fComparator;
+ private ViewerComparator fComparator;
- private String fEmptyListMessage = WorkbenchMessages.CheckedTreeSelectionDialog_nothing_available;
+ private String fEmptyListMessage = WorkbenchMessages.CheckedTreeSelectionDialog_nothing_available;
- private IStatus fCurrStatus = new Status(IStatus.OK, PlatformUI.PLUGIN_ID,
- 0, "", null); //$NON-NLS-1$
+ private IStatus fCurrStatus = new Status(IStatus.OK, PlatformUI.PLUGIN_ID, 0, "", null); //$NON-NLS-1$
- private List fFilters;
+ private List fFilters;
- private Object fInput;
+ private Object fInput;
- private boolean fIsEmpty;
+ private boolean fIsEmpty;
- private int fWidth = 60;
+ private int fWidth = 60;
- private int fHeight = 18;
+ private int fHeight = 18;
- private boolean fContainerMode;
+ private boolean fContainerMode;
- private Object[] fExpandedElements;
+ private Object[] fExpandedElements;
private int fStyle = SWT.BORDER;
- /**
- * Constructs an instance of <code>ElementTreeSelectionDialog</code>.
- *
- * @param parent
- * The shell to parent from.
- * @param labelProvider
- * the label provider to render the entries
- * @param contentProvider
- * the content provider to evaluate the tree structure
- */
- public CheckedTreeSelectionDialog(Shell parent,
- ILabelProvider labelProvider, ITreeContentProvider contentProvider) {
+ /**
+ * Constructs an instance of <code>ElementTreeSelectionDialog</code>.
+ *
+ * @param parent The shell to parent from.
+ * @param labelProvider the label provider to render the entries
+ * @param contentProvider the content provider to evaluate the tree structure
+ */
+ public CheckedTreeSelectionDialog(Shell parent, ILabelProvider labelProvider,
+ ITreeContentProvider contentProvider) {
this(parent, labelProvider, contentProvider, SWT.BORDER);
- }
+ }
/**
* Constructs an instance of <code>ElementTreeSelectionDialog</code>.
*
- * @param parent
- * The shell to parent from.
- * @param labelProvider
- * the label provider to render the entries
- * @param contentProvider
- * the content provider to evaluate the tree structure
- * @param style
- * the style of the tree
+ * @param parent The shell to parent from.
+ * @param labelProvider the label provider to render the entries
+ * @param contentProvider the content provider to evaluate the tree structure
+ * @param style the style of the tree
* @since 3.105
*/
- public CheckedTreeSelectionDialog(Shell parent, ILabelProvider labelProvider,
- ITreeContentProvider contentProvider, int style) {
+ public CheckedTreeSelectionDialog(Shell parent, ILabelProvider labelProvider, ITreeContentProvider contentProvider,
+ int style) {
super(parent);
fLabelProvider = labelProvider;
fContentProvider = contentProvider;
@@ -123,38 +115,35 @@ public class CheckedTreeSelectionDialog extends SelectionStatusDialog {
fStyle = style;
}
- /**
- * If set, the checked /gray state of containers (inner nodes) is derived
- * from the checked state of its leaf nodes.
- *
- * @param containerMode
- * The containerMode to set
- */
- public void setContainerMode(boolean containerMode) {
- fContainerMode = containerMode;
- }
-
- /**
- * Sets the initial selection. Convenience method.
- *
- * @param selection
- * the initial selection.
- */
- public void setInitialSelection(Object selection) {
+ /**
+ * If set, the checked /gray state of containers (inner nodes) is derived from
+ * the checked state of its leaf nodes.
+ *
+ * @param containerMode The containerMode to set
+ */
+ public void setContainerMode(boolean containerMode) {
+ fContainerMode = containerMode;
+ }
+
+ /**
+ * Sets the initial selection. Convenience method.
+ *
+ * @param selection the initial selection.
+ */
+ public void setInitialSelection(Object selection) {
setInitialSelections(selection);
- }
-
- /**
- * Sets the message to be displayed if the list is empty.
- *
- * @param message
- * the message to be displayed.
- */
- public void setEmptyListMessage(String message) {
- fEmptyListMessage = message;
- }
-
- /**
+ }
+
+ /**
+ * Sets the message to be displayed if the list is empty.
+ *
+ * @param message the message to be displayed.
+ */
+ public void setEmptyListMessage(String message) {
+ fEmptyListMessage = message;
+ }
+
+ /**
* Sets the sorter used by the tree viewer.
*
* @param sorter
@@ -162,17 +151,16 @@ public class CheckedTreeSelectionDialog extends SelectionStatusDialog {
* {@link CheckedTreeSelectionDialog#setComparator(ViewerComparator)}
* instead
*/
- @Deprecated
+ @Deprecated
public void setSorter(ViewerSorter sorter) {
- fComparator = sorter;
- }
+ fComparator = sorter;
+ }
- /**
- * Set the style used for the creation of the Tree. Changing this will only
- * have an effect up to the time the Tree is created.
+ /**
+ * Set the style used for the creation of the Tree. Changing this will only have
+ * an effect up to the time the Tree is created.
*
- * @param style
- * the style of the tree
+ * @param style the style of the tree
* @since 3.105
*/
public void setStyle(int style) {
@@ -185,239 +173,225 @@ public class CheckedTreeSelectionDialog extends SelectionStatusDialog {
* @param comparator
* @since 3.3
*/
- public void setComparator(ViewerComparator comparator){
- fComparator = comparator;
- }
-
- /**
- * Adds a filter to the tree viewer.
- *
- * @param filter
- * a filter.
- */
- public void addFilter(ViewerFilter filter) {
- if (fFilters == null) {
+ public void setComparator(ViewerComparator comparator) {
+ fComparator = comparator;
+ }
+
+ /**
+ * Adds a filter to the tree viewer.
+ *
+ * @param filter a filter.
+ */
+ public void addFilter(ViewerFilter filter) {
+ if (fFilters == null) {
fFilters = new ArrayList(4);
}
- fFilters.add(filter);
- }
-
- /**
- * Sets an optional validator to check if the selection is valid. The
- * validator is invoked whenever the selection changes.
- *
- * @param validator
- * the validator to validate the selection.
- */
- public void setValidator(ISelectionStatusValidator validator) {
- fValidator = validator;
- }
-
- /**
- * Sets the tree input.
- *
- * @param input
- * the tree input.
- */
- public void setInput(Object input) {
- fInput = input;
- }
-
- /**
- * Expands elements in the tree.
- *
- * @param elements
- * The elements that will be expanded.
- */
- public void setExpandedElements(Object[] elements) {
- fExpandedElements = elements;
- }
-
- /**
- * Sets the size of the tree in unit of characters.
- *
- * @param width
- * the width of the tree.
- * @param height
- * the height of the tree.
- */
- public void setSize(int width, int height) {
- fWidth = width;
- fHeight = height;
- }
-
- /**
- * Validate the receiver and update the status with the result.
- *
- */
- protected void updateOKStatus() {
- if (!fIsEmpty) {
- if (fValidator != null) {
- fCurrStatus = fValidator.validate(fViewer.getCheckedElements());
- updateStatus(fCurrStatus);
- } else if (!fCurrStatus.isOK()) {
- fCurrStatus = new Status(IStatus.OK, PlatformUI.PLUGIN_ID,
- IStatus.OK, "", //$NON-NLS-1$
- null);
- }
- } else {
- fCurrStatus = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID,
- IStatus.OK, fEmptyListMessage, null);
- }
- updateStatus(fCurrStatus);
- }
-
- @Override
+ fFilters.add(filter);
+ }
+
+ /**
+ * Sets an optional validator to check if the selection is valid. The validator
+ * is invoked whenever the selection changes.
+ *
+ * @param validator the validator to validate the selection.
+ */
+ public void setValidator(ISelectionStatusValidator validator) {
+ fValidator = validator;
+ }
+
+ /**
+ * Sets the tree input.
+ *
+ * @param input the tree input.
+ */
+ public void setInput(Object input) {
+ fInput = input;
+ }
+
+ /**
+ * Expands elements in the tree.
+ *
+ * @param elements The elements that will be expanded.
+ */
+ public void setExpandedElements(Object[] elements) {
+ fExpandedElements = elements;
+ }
+
+ /**
+ * Sets the size of the tree in unit of characters.
+ *
+ * @param width the width of the tree.
+ * @param height the height of the tree.
+ */
+ public void setSize(int width, int height) {
+ fWidth = width;
+ fHeight = height;
+ }
+
+ /**
+ * Validate the receiver and update the status with the result.
+ *
+ */
+ protected void updateOKStatus() {
+ if (!fIsEmpty) {
+ if (fValidator != null) {
+ fCurrStatus = fValidator.validate(fViewer.getCheckedElements());
+ updateStatus(fCurrStatus);
+ } else if (!fCurrStatus.isOK()) {
+ fCurrStatus = new Status(IStatus.OK, PlatformUI.PLUGIN_ID, IStatus.OK, "", //$NON-NLS-1$
+ null);
+ }
+ } else {
+ fCurrStatus = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.OK, fEmptyListMessage, null);
+ }
+ updateStatus(fCurrStatus);
+ }
+
+ @Override
public int open() {
- fIsEmpty = evaluateIfTreeEmpty(fInput);
- super.open();
- return getReturnCode();
- }
-
- private void access$superCreate() {
- super.create();
- }
-
- /**
- * Handles cancel button pressed event.
- */
- @Override
+ fIsEmpty = evaluateIfTreeEmpty(fInput);
+ super.open();
+ return getReturnCode();
+ }
+
+ private void access$superCreate() {
+ super.create();
+ }
+
+ /**
+ * Handles cancel button pressed event.
+ */
+ @Override
protected void cancelPressed() {
- setResult(null);
- super.cancelPressed();
- }
-
- /*
- * @see SelectionStatusDialog#computeResult()
- */
- @Override
+ setResult(null);
+ super.cancelPressed();
+ }
+
+ /*
+ * @see SelectionStatusDialog#computeResult()
+ */
+ @Override
protected void computeResult() {
- setResult(Arrays.asList(fViewer.getCheckedElements()));
- }
+ setResult(Arrays.asList(fViewer.getCheckedElements()));
+ }
- @Override
+ @Override
public void create() {
- BusyIndicator.showWhile(null, () -> {
- access$superCreate();
- fViewer.setCheckedElements(getInitialElementSelections()
- .toArray());
- if (fExpandedElements != null) {
- fViewer.setExpandedElements(fExpandedElements);
- }
- updateOKStatus();
+ BusyIndicator.showWhile(null, () -> {
+ access$superCreate();
+ fViewer.setCheckedElements(getInitialElementSelections().toArray());
+ if (fExpandedElements != null) {
+ fViewer.setExpandedElements(fExpandedElements);
+ }
+ updateOKStatus();
});
- }
+ }
- @Override
+ @Override
protected Control createDialogArea(Composite parent) {
- Composite composite = (Composite) super.createDialogArea(parent);
- Label messageLabel = createMessageArea(composite);
- CheckboxTreeViewer treeViewer = createTreeViewer(composite);
- Control buttonComposite = createSelectionButtons(composite);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.widthHint = convertWidthInCharsToPixels(fWidth);
- data.heightHint = convertHeightInCharsToPixels(fHeight);
- Tree treeWidget = treeViewer.getTree();
- treeWidget.setLayoutData(data);
- treeWidget.setFont(parent.getFont());
- if (fIsEmpty) {
- messageLabel.setEnabled(false);
- treeWidget.setEnabled(false);
- buttonComposite.setEnabled(false);
- }
- return composite;
- }
-
- /**
- * Creates the tree viewer.
- *
- * @param parent
- * the parent composite
- * @return the tree viewer
- */
- protected CheckboxTreeViewer createTreeViewer(Composite parent) {
- if (fContainerMode) {
+ Composite composite = (Composite) super.createDialogArea(parent);
+ Label messageLabel = createMessageArea(composite);
+ CheckboxTreeViewer treeViewer = createTreeViewer(composite);
+ Control buttonComposite = createSelectionButtons(composite);
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.widthHint = convertWidthInCharsToPixels(fWidth);
+ data.heightHint = convertHeightInCharsToPixels(fHeight);
+ Tree treeWidget = treeViewer.getTree();
+ treeWidget.setLayoutData(data);
+ treeWidget.setFont(parent.getFont());
+ if (fIsEmpty) {
+ messageLabel.setEnabled(false);
+ treeWidget.setEnabled(false);
+ buttonComposite.setEnabled(false);
+ }
+ return composite;
+ }
+
+ /**
+ * Creates the tree viewer.
+ *
+ * @param parent the parent composite
+ * @return the tree viewer
+ */
+ protected CheckboxTreeViewer createTreeViewer(Composite parent) {
+ if (fContainerMode) {
fViewer = new ContainerCheckedTreeViewer(parent, fStyle);
- } else {
+ } else {
fViewer = new CheckboxTreeViewer(parent, fStyle);
- }
- fViewer.setContentProvider(fContentProvider);
- fViewer.setLabelProvider(fLabelProvider);
- fViewer.addCheckStateListener(event -> updateOKStatus());
- fViewer.setComparator(fComparator);
- if (fFilters != null) {
- for (int i = 0; i != fFilters.size(); i++) {
+ }
+ fViewer.setContentProvider(fContentProvider);
+ fViewer.setLabelProvider(fLabelProvider);
+ fViewer.addCheckStateListener(event -> updateOKStatus());
+ fViewer.setComparator(fComparator);
+ if (fFilters != null) {
+ for (int i = 0; i != fFilters.size(); i++) {
fViewer.addFilter((ViewerFilter) fFilters.get(i));
}
- }
- fViewer.setInput(fInput);
- return fViewer;
- }
-
- /**
- * Returns the tree viewer.
- *
- * @return the tree viewer
- */
- protected CheckboxTreeViewer getTreeViewer() {
- return fViewer;
- }
-
- /**
- * Adds the selection and deselection buttons to the dialog.
- *
- * @param composite
- * the parent composite
- * @return Composite the composite the buttons were created in.
- */
- protected Composite createSelectionButtons(Composite composite) {
- Composite buttonComposite = new Composite(composite, SWT.RIGHT);
- GridLayout layout = new GridLayout();
- layout.numColumns = 0;
+ }
+ fViewer.setInput(fInput);
+ return fViewer;
+ }
+
+ /**
+ * Returns the tree viewer.
+ *
+ * @return the tree viewer
+ */
+ protected CheckboxTreeViewer getTreeViewer() {
+ return fViewer;
+ }
+
+ /**
+ * Adds the selection and deselection buttons to the dialog.
+ *
+ * @param composite the parent composite
+ * @return Composite the composite the buttons were created in.
+ */
+ protected Composite createSelectionButtons(Composite composite) {
+ Composite buttonComposite = new Composite(composite, SWT.RIGHT);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 0;
layout.marginWidth = 0;
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
buttonComposite.setLayout(layout);
- buttonComposite.setFont(composite.getFont());
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END
- | GridData.GRAB_HORIZONTAL);
- data.grabExcessHorizontalSpace = true;
- buttonComposite.setLayoutData(data);
- Button selectButton = createButton(buttonComposite,
- IDialogConstants.SELECT_ALL_ID, WorkbenchMessages.CheckedTreeSelectionDialog_select_all,
- false);
- SelectionListener listener = widgetSelectedAdapter(e -> {
- Object[] viewerElements = fContentProvider.getElements(fInput);
- if (fContainerMode) {
+ buttonComposite.setFont(composite.getFont());
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.GRAB_HORIZONTAL);
+ data.grabExcessHorizontalSpace = true;
+ buttonComposite.setLayoutData(data);
+ Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID,
+ WorkbenchMessages.CheckedTreeSelectionDialog_select_all, false);
+ SelectionListener listener = widgetSelectedAdapter(e -> {
+ Object[] viewerElements = fContentProvider.getElements(fInput);
+ if (fContainerMode) {
fViewer.setCheckedElements(viewerElements);
} else {
- for (Object viewerElement : viewerElements) {
+ for (Object viewerElement : viewerElements) {
fViewer.setSubtreeChecked(viewerElement, true);
}
- }
- updateOKStatus();
+ }
+ updateOKStatus();
});
- selectButton.addSelectionListener(listener);
- Button deselectButton = createButton(buttonComposite,
- IDialogConstants.DESELECT_ALL_ID, WorkbenchMessages.CheckedTreeSelectionDialog_deselect_all,
- false);
- listener = widgetSelectedAdapter(e -> {
- fViewer.setCheckedElements(new Object[0]);
- updateOKStatus();
+ selectButton.addSelectionListener(listener);
+ Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID,
+ WorkbenchMessages.CheckedTreeSelectionDialog_deselect_all, false);
+ listener = widgetSelectedAdapter(e -> {
+ fViewer.setCheckedElements(new Object[0]);
+ updateOKStatus();
});
- deselectButton.addSelectionListener(listener);
- return buttonComposite;
- }
-
- private boolean evaluateIfTreeEmpty(Object input) {
- Object[] elements = fContentProvider.getElements(input);
- if (elements.length > 0) {
- if (fFilters != null) {
- for (int i = 0; i < fFilters.size(); i++) {
- ViewerFilter curr = (ViewerFilter) fFilters.get(i);
- elements = curr.filter(fViewer, input, elements);
- }
- }
- }
- return elements.length == 0;
- }
+ deselectButton.addSelectionListener(listener);
+ return buttonComposite;
+ }
+
+ private boolean evaluateIfTreeEmpty(Object input) {
+ Object[] elements = fContentProvider.getElements(input);
+ if (elements.length > 0) {
+ if (fFilters != null) {
+ for (int i = 0; i < fFilters.size(); i++) {
+ ViewerFilter curr = (ViewerFilter) fFilters.get(i);
+ elements = curr.filter(fViewer, input, elements);
+ }
+ }
+ }
+ return elements.length == 0;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ContainerCheckedTreeViewer.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ContainerCheckedTreeViewer.java
index e7873375770..b1226978308 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ContainerCheckedTreeViewer.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ContainerCheckedTreeViewer.java
@@ -28,72 +28,77 @@ import org.eclipse.swt.widgets.Widget;
/**
* CheckboxTreeViewer with special behaviour of the checked / gray state on
- * container (non-leaf) nodes:
- * The grayed state is used to visualize the checked state of its children.
- * Containers are checked and non-gray if all contained leafs are checked. The
- * container is grayed if some but not all leafs are checked.
+ * container (non-leaf) nodes: The grayed state is used to visualize the checked
+ * state of its children. Containers are checked and non-gray if all contained
+ * leafs are checked. The container is grayed if some but not all leafs are
+ * checked.
+ *
* @since 3.1
*/
public class ContainerCheckedTreeViewer extends CheckboxTreeViewer {
- /**
- * Constructor for ContainerCheckedTreeViewer.
- * @see CheckboxTreeViewer#CheckboxTreeViewer(Composite)
- */
- public ContainerCheckedTreeViewer(Composite parent) {
- super(parent);
- initViewer();
- }
+ /**
+ * Constructor for ContainerCheckedTreeViewer.
+ *
+ * @see CheckboxTreeViewer#CheckboxTreeViewer(Composite)
+ */
+ public ContainerCheckedTreeViewer(Composite parent) {
+ super(parent);
+ initViewer();
+ }
- /**
- * Constructor for ContainerCheckedTreeViewer.
- * @see CheckboxTreeViewer#CheckboxTreeViewer(Composite,int)
- */
- public ContainerCheckedTreeViewer(Composite parent, int style) {
- super(parent, style);
- initViewer();
- }
+ /**
+ * Constructor for ContainerCheckedTreeViewer.
+ *
+ * @see CheckboxTreeViewer#CheckboxTreeViewer(Composite,int)
+ */
+ public ContainerCheckedTreeViewer(Composite parent, int style) {
+ super(parent, style);
+ initViewer();
+ }
- /**
- * Constructor for ContainerCheckedTreeViewer.
- * @see CheckboxTreeViewer#CheckboxTreeViewer(Tree)
- */
- public ContainerCheckedTreeViewer(Tree tree) {
- super(tree);
- initViewer();
- }
+ /**
+ * Constructor for ContainerCheckedTreeViewer.
+ *
+ * @see CheckboxTreeViewer#CheckboxTreeViewer(Tree)
+ */
+ public ContainerCheckedTreeViewer(Tree tree) {
+ super(tree);
+ initViewer();
+ }
- private void initViewer() {
- setUseHashlookup(true);
- addCheckStateListener(event -> doCheckStateChanged(event.getElement()));
- addTreeListener(new ITreeViewerListener() {
- @Override
+ private void initViewer() {
+ setUseHashlookup(true);
+ addCheckStateListener(event -> doCheckStateChanged(event.getElement()));
+ addTreeListener(new ITreeViewerListener() {
+ @Override
public void treeCollapsed(TreeExpansionEvent event) {
- }
+ }
- @Override
+ @Override
public void treeExpanded(TreeExpansionEvent event) {
- Widget item = findItem(event.getElement());
- if (item instanceof TreeItem) {
- initializeItem((TreeItem) item);
- }
- }
- });
- }
+ Widget item = findItem(event.getElement());
+ if (item instanceof TreeItem) {
+ initializeItem((TreeItem) item);
+ }
+ }
+ });
+ }
/**
* Update element after a checkstate change.
+ *
* @param element
*/
- protected void doCheckStateChanged(Object element) {
- Widget item = findItem(element);
- if (item instanceof TreeItem) {
- TreeItem treeItem = (TreeItem) item;
- treeItem.setGrayed(false);
- updateChildrenItems(treeItem);
- updateParentItems(treeItem.getParentItem());
- }
- }
+ protected void doCheckStateChanged(Object element) {
+ Widget item = findItem(element);
+ if (item instanceof TreeItem) {
+ TreeItem treeItem = (TreeItem) item;
+ treeItem.setGrayed(false);
+ updateChildrenItems(treeItem);
+ updateParentItems(treeItem.getParentItem());
+ }
+ }
/**
* Update elements after a checkstate change. This is identical to
@@ -103,8 +108,8 @@ public class ContainerCheckedTreeViewer extends CheckboxTreeViewer {
*
* @param elements tree elements
*/
- private void doCheckStateChanged(Object[] elements) {
- HashSet<TreeItem> parents = new HashSet<>();
+ private void doCheckStateChanged(Object[] elements) {
+ HashSet<TreeItem> parents = new HashSet<>();
for (Object element : elements) {
Widget item = findItem(element);
if (item instanceof TreeItem) {
@@ -121,45 +126,44 @@ public class ContainerCheckedTreeViewer extends CheckboxTreeViewer {
for (TreeItem parent : parents) {
updateParentItems(parent);
}
- }
+ }
- /**
- * The item has expanded. Updates the checked state of its children.
- */
- private void initializeItem(TreeItem item) {
- if (item.getChecked() && !item.getGrayed()) {
- updateChildrenItems(item);
- }
- }
+ /**
+ * The item has expanded. Updates the checked state of its children.
+ */
+ private void initializeItem(TreeItem item) {
+ if (item.getChecked() && !item.getGrayed()) {
+ updateChildrenItems(item);
+ }
+ }
- /**
- * Updates the check state of all created children
- */
- private void updateChildrenItems(TreeItem parent) {
- Item[] children = getChildren(parent);
- boolean state = parent.getChecked();
- for (Item element : children) {
- TreeItem curr = (TreeItem) element;
- if (curr.getData() != null
- && ((curr.getChecked() != state) || curr.getGrayed())) {
- curr.setChecked(state);
- curr.setGrayed(false);
- updateChildrenItems(curr);
- }
- }
- }
+ /**
+ * Updates the check state of all created children
+ */
+ private void updateChildrenItems(TreeItem parent) {
+ Item[] children = getChildren(parent);
+ boolean state = parent.getChecked();
+ for (Item element : children) {
+ TreeItem curr = (TreeItem) element;
+ if (curr.getData() != null && ((curr.getChecked() != state) || curr.getGrayed())) {
+ curr.setChecked(state);
+ curr.setGrayed(false);
+ updateChildrenItems(curr);
+ }
+ }
+ }
- /**
- * Updates the check / gray state of all parent items
- */
- private void updateParentItems(TreeItem item) {
- if (item != null) {
- Item[] children = getChildren(item);
- boolean containsChecked = false;
- boolean containsUnchecked = false;
- for (Item element : children) {
- TreeItem curr = (TreeItem) element;
- boolean currChecked = curr.getChecked();
+ /**
+ * Updates the check / gray state of all parent items
+ */
+ private void updateParentItems(TreeItem item) {
+ if (item != null) {
+ Item[] children = getChildren(item);
+ boolean containsChecked = false;
+ boolean containsUnchecked = false;
+ for (Item element : children) {
+ TreeItem curr = (TreeItem) element;
+ boolean currChecked = curr.getChecked();
containsChecked |= currChecked;
// avoid fetching the grayed state, if we already found at least one grayed item
if (!containsUnchecked) {
@@ -169,48 +173,45 @@ public class ContainerCheckedTreeViewer extends CheckboxTreeViewer {
if (containsChecked && containsUnchecked) {
break;
}
- }
-
- // avoid accessing the widget, if there are no updates
- boolean updated = false;
- boolean checked = item.getChecked();
- if (checked != containsChecked) {
- item.setChecked(containsChecked);
- updated = true;
- }
- boolean grayed = item.getGrayed();
- boolean newGrayed = containsChecked && containsUnchecked;
- if (grayed != newGrayed) {
- item.setGrayed(newGrayed);
- updated = true;
- }
+ }
- // if this item did not change, no further parent will change
- if (updated) {
- updateParentItems(item.getParentItem());
- }
- }
- }
+ // avoid accessing the widget, if there are no updates
+ boolean updated = false;
+ boolean checked = item.getChecked();
+ if (checked != containsChecked) {
+ item.setChecked(containsChecked);
+ updated = true;
+ }
+ boolean grayed = item.getGrayed();
+ boolean newGrayed = containsChecked && containsUnchecked;
+ if (grayed != newGrayed) {
+ item.setGrayed(newGrayed);
+ updated = true;
+ }
+ // if this item did not change, no further parent will change
+ if (updated) {
+ updateParentItems(item.getParentItem());
+ }
+ }
+ }
- @Override
+ @Override
public boolean setChecked(Object element, boolean state) {
- if (super.setChecked(element, state)) {
- doCheckStateChanged(element);
- return true;
- }
- return false;
- }
-
+ if (super.setChecked(element, state)) {
+ doCheckStateChanged(element);
+ return true;
+ }
+ return false;
+ }
- @Override
+ @Override
public void setCheckedElements(Object[] elements) {
Object[] oldCheckedElements = getCheckedElements();
- super.setCheckedElements(elements);
+ super.setCheckedElements(elements);
-
- Control tree = getControl();
- try {
+ Control tree = getControl();
+ try {
tree.setRedraw(false);
if (oldCheckedElements.length > 0) {
// calculate intersection of previously and newly checked elements to avoid
@@ -223,53 +224,51 @@ public class ContainerCheckedTreeViewer extends CheckboxTreeViewer {
} else {
doCheckStateChanged(elements);
}
- }
- finally {
- tree.setRedraw(true);
- }
- }
-
+ } finally {
+ tree.setRedraw(true);
+ }
+ }
- @Override
+ @Override
protected void setExpanded(Item item, boolean expand) {
- super.setExpanded(item, expand);
- if (expand && item instanceof TreeItem) {
- initializeItem((TreeItem) item);
- }
- }
-
+ super.setExpanded(item, expand);
+ if (expand && item instanceof TreeItem) {
+ initializeItem((TreeItem) item);
+ }
+ }
- @Override
+ @Override
public Object[] getCheckedElements() {
- Object[] checked = super.getCheckedElements();
- // add all items that are children of a checked node but not created yet
- ArrayList result = new ArrayList();
- for (Object curr : checked) {
- result.add(curr);
- Widget item = findItem(curr);
- if (item != null) {
- Item[] children = getChildren(item);
- // check if contains the dummy node
- if (children.length == 1 && children[0].getData() == null) {
- // not yet created
- collectChildren(curr, result);
- }
- }
- }
- return result.toArray();
- }
+ Object[] checked = super.getCheckedElements();
+ // add all items that are children of a checked node but not created yet
+ ArrayList result = new ArrayList();
+ for (Object curr : checked) {
+ result.add(curr);
+ Widget item = findItem(curr);
+ if (item != null) {
+ Item[] children = getChildren(item);
+ // check if contains the dummy node
+ if (children.length == 1 && children[0].getData() == null) {
+ // not yet created
+ collectChildren(curr, result);
+ }
+ }
+ }
+ return result.toArray();
+ }
/**
* Recursively add the filtered children of element to the result.
+ *
* @param element
* @param result
*/
- private void collectChildren(Object element, ArrayList result) {
- Object[] filteredChildren = getFilteredChildren(element);
- for (Object curr : filteredChildren) {
- result.add(curr);
- collectChildren(curr, result);
- }
- }
+ private void collectChildren(Object element, ArrayList result) {
+ Object[] filteredChildren = getFilteredChildren(element);
+ for (Object curr : filteredChildren) {
+ result.add(curr);
+ collectChildren(curr, result);
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/EditorSelectionDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/EditorSelectionDialog.java
index d728104da69..cdf19e8af69 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/EditorSelectionDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/EditorSelectionDialog.java
@@ -69,7 +69,6 @@ import org.eclipse.ui.internal.registry.FileEditorMapping;
import org.eclipse.ui.progress.IProgressService;
import org.eclipse.ui.statushandlers.StatusManager;
-
/**
* This class is used to allow the user to select a dialog from the set of
* internal and external editors.
@@ -186,13 +185,11 @@ public class EditorSelectionDialog extends Dialog {
/**
* Create an instance of this class.
*
- * @param parentShell
- * the parent shell
+ * @param parentShell the parent shell
*/
public EditorSelectionDialog(Shell parentShell) {
super(parentShell);
- resourceManager = new LocalResourceManager(JFaceResources.getResources(parentShell
- .getDisplay()));
+ resourceManager = new LocalResourceManager(JFaceResources.getResources(parentShell.getDisplay()));
}
/**
@@ -221,18 +218,16 @@ public class EditorSelectionDialog extends Dialog {
protected void configureShell(Shell shell) {
super.configureShell(shell);
shell.setText(WorkbenchMessages.EditorSelection_title);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(shell,
- IWorkbenchHelpContextIds.EDITOR_SELECTION_DIALOG);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(shell, IWorkbenchHelpContextIds.EDITOR_SELECTION_DIALOG);
}
/**
- * Creates and returns the contents of the upper part of the dialog (above
- * the button bar).
+ * Creates and returns the contents of the upper part of the dialog (above the
+ * button bar).
*
* Subclasses should overide.
*
- * @param parent
- * the parent composite to contain the dialog area
+ * @param parent the parent composite to contain the dialog area
* @return the dialog area control
*/
@Override
@@ -303,13 +298,11 @@ public class EditorSelectionDialog extends Dialog {
});
browseExternalEditorsButton = new Button(contents, SWT.PUSH);
- browseExternalEditorsButton
- .setText(WorkbenchMessages.EditorSelection_browse);
+ browseExternalEditorsButton.setText(WorkbenchMessages.EditorSelection_browse);
browseExternalEditorsButton.addListener(SWT.Selection, listener);
data = new GridData();
int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- data.widthHint = Math.max(widthHint, browseExternalEditorsButton
- .computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
+ data.widthHint = Math.max(widthHint, browseExternalEditorsButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
data.horizontalSpan = 2;
browseExternalEditorsButton.setLayoutData(data);
browseExternalEditorsButton.setFont(font);
@@ -339,7 +332,8 @@ public class EditorSelectionDialog extends Dialog {
initializeSuggestion();
restoreWidgetValues(); // Place buttons to the appropriate state
- // Run async to restore selection on *visible* dialog - otherwise three won't scroll
+ // Run async to restore selection on *visible* dialog - otherwise three won't
+ // scroll
PlatformUI.getWorkbench().getDisplay().asyncExec(() -> {
if (editorTable.isDisposed()) {
return;
@@ -347,7 +341,7 @@ public class EditorSelectionDialog extends Dialog {
fillEditorTable();
updateEnableState();
});
- return contents;
+ return contents;
}
private String getFileType() {
@@ -416,10 +410,8 @@ public class EditorSelectionDialog extends Dialog {
* Return the dialog store to cache values into
*/
protected IDialogSettings getDialogSettings() {
- IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault()
- .getDialogSettings();
- IDialogSettings section = workbenchSettings
- .getSection("EditorSelectionDialog");//$NON-NLS-1$
+ IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
+ IDialogSettings section = workbenchSettings.getSection("EditorSelectionDialog");//$NON-NLS-1$
if (section == null) {
section = workbenchSettings.addNewSection("EditorSelectionDialog");//$NON-NLS-1$
}
@@ -448,8 +440,8 @@ public class EditorSelectionDialog extends Dialog {
if (cause instanceof CoreException) {
status = ((CoreException) cause).getStatus();
} else {
- status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID,
- "Error while retrieving native editors", cause); //$NON-NLS-1$
+ status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, "Error while retrieving native editors", //$NON-NLS-1$
+ cause);
}
StatusManager.getManager().handle(status);
} catch (InterruptedException e) {
@@ -461,11 +453,10 @@ public class EditorSelectionDialog extends Dialog {
}
/**
- * Returns an array of editors which have been filtered according to the
- * array of editors in the editorsToFilter instance variable.
+ * Returns an array of editors which have been filtered according to the array
+ * of editors in the editorsToFilter instance variable.
*
- * @param editors
- * an array of editors to filter
+ * @param editors an array of editors to filter
* @return a filtered array of editors
*/
protected IEditorDescriptor[] filterEditors(IEditorDescriptor[] editors) {
@@ -498,8 +489,7 @@ public class EditorSelectionDialog extends Dialog {
*/
protected IEditorDescriptor[] getInternalEditors() {
if (internalEditors == null) {
- EditorRegistry reg = (EditorRegistry) WorkbenchPlugin.getDefault()
- .getEditorRegistry();
+ EditorRegistry reg = (EditorRegistry) WorkbenchPlugin.getDefault().getEditorRegistry();
internalEditors = reg.getSortedEditorsFromPlugins();
internalEditors = filterEditors(internalEditors);
}
@@ -516,20 +506,18 @@ public class EditorSelectionDialog extends Dialog {
}
protected void promptForExternalEditor() {
- FileDialog dialog = new FileDialog(getShell(), SWT.OPEN
- | SWT.PRIMARY_MODAL | SWT.SHEET);
+ FileDialog dialog = new FileDialog(getShell(), SWT.OPEN | SWT.PRIMARY_MODAL | SWT.SHEET);
dialog.setFilterExtensions(Executable_Filters);
String result = dialog.open();
if (result != null) {
EditorDescriptor editor = EditorDescriptor.createForProgram(result);
/*
- * add to our collection of cached external editors in case the user
- * flips back and forth between internal/external
+ * add to our collection of cached external editors in case the user flips back
+ * and forth between internal/external
*/
IEditorDescriptor[] newEditors = new IEditorDescriptor[externalEditors.length + 1];
- System.arraycopy(externalEditors, 0, newEditors, 0,
- externalEditors.length);
+ System.arraycopy(externalEditors, 0, newEditors, 0, externalEditors.length);
newEditors[newEditors.length - 1] = editor;
externalEditors = newEditors;
editorTableViewer.setInput(externalEditors);
@@ -580,9 +568,9 @@ public class EditorSelectionDialog extends Dialog {
}
/**
- * Use the dialog store to restore widget values to the values that they
- * held last time this wizard was used to completion, if the previous file
- * has same extension.
+ * Use the dialog store to restore widget values to the values that they held
+ * last time this wizard was used to completion, if the previous file has same
+ * extension.
*/
protected void restoreWidgetValues() {
IDialogSettings settings = getDialogSettings();
@@ -684,19 +672,16 @@ public class EditorSelectionDialog extends Dialog {
/**
* Set the message displayed by this message dialog
*
- * @param aMessage
- * the message
+ * @param aMessage the message
*/
public void setMessage(String aMessage) {
message = aMessage;
}
/**
- * Set the file name which can be used to store the selected editor
- * preference
+ * Set the file name which can be used to store the selected editor preference
*
- * @param fileName
- * the file name
+ * @param fileName the file name
* @since 3.107
*/
public void setFileName(String fileName) {
@@ -706,8 +691,7 @@ public class EditorSelectionDialog extends Dialog {
/**
* Set the editors which will not appear in the dialog.
*
- * @param editors
- * an array of editors
+ * @param editors an array of editors
*/
public void setEditorsToFilter(IEditorDescriptor[] editors) {
editorsToFilter = editors;
@@ -724,10 +708,8 @@ public class EditorSelectionDialog extends Dialog {
@Override
protected void createButtonsForButtonBar(Composite parent) {
- okButton = createButton(parent, IDialogConstants.OK_ID,
- IDialogConstants.OK_LABEL, true);
- createButton(parent, IDialogConstants.CANCEL_ID,
- IDialogConstants.CANCEL_LABEL, false);
+ okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
+ createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
// initially there is no selection so OK button should not be enabled
okButton.setEnabled(false);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ElementListSelectionDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ElementListSelectionDialog.java
index f9e3734140f..a18864b5f5e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ElementListSelectionDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ElementListSelectionDialog.java
@@ -26,42 +26,44 @@ import org.eclipse.swt.widgets.Shell;
*/
public class ElementListSelectionDialog extends AbstractElementListSelectionDialog {
- private Object[] fElements;
+ private Object[] fElements;
- /**
- * Creates a list selection dialog.
- * @param parent the parent widget.
- * @param renderer the label renderer.
- */
- public ElementListSelectionDialog(Shell parent, ILabelProvider renderer) {
- super(parent, renderer);
- }
+ /**
+ * Creates a list selection dialog.
+ *
+ * @param parent the parent widget.
+ * @param renderer the label renderer.
+ */
+ public ElementListSelectionDialog(Shell parent, ILabelProvider renderer) {
+ super(parent, renderer);
+ }
- /**
- * Sets the elements of the list.
- * @param elements the elements of the list.
- */
- public void setElements(Object[] elements) {
- fElements = elements;
- }
+ /**
+ * Sets the elements of the list.
+ *
+ * @param elements the elements of the list.
+ */
+ public void setElements(Object[] elements) {
+ fElements = elements;
+ }
- @Override
+ @Override
protected void computeResult() {
- setResult(Arrays.asList(getSelectedElements()));
- }
+ setResult(Arrays.asList(getSelectedElements()));
+ }
- @Override
+ @Override
protected Control createDialogArea(Composite parent) {
- Composite contents = (Composite) super.createDialogArea(parent);
+ Composite contents = (Composite) super.createDialogArea(parent);
- createMessageArea(contents);
- createFilterText(contents);
- createFilteredList(contents);
+ createMessageArea(contents);
+ createFilterText(contents);
+ createFilteredList(contents);
- setListElements(fElements);
+ setListElements(fElements);
- setSelection(getInitialElementSelections().toArray());
+ setSelection(getInitialElementSelections().toArray());
- return contents;
- }
+ return contents;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ElementTreeSelectionDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ElementTreeSelectionDialog.java
index c09b02b033c..6d41f26939c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ElementTreeSelectionDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ElementTreeSelectionDialog.java
@@ -53,360 +53,364 @@ import org.eclipse.ui.internal.WorkbenchMessages;
*/
public class ElementTreeSelectionDialog extends SelectionStatusDialog {
- private TreeViewer fViewer;
+ private TreeViewer fViewer;
private IBaseLabelProvider fLabelProvider;
- private ITreeContentProvider fContentProvider;
+ private ITreeContentProvider fContentProvider;
- private ISelectionStatusValidator fValidator = null;
+ private ISelectionStatusValidator fValidator = null;
- private ViewerComparator fComparator;
+ private ViewerComparator fComparator;
- private boolean fAllowMultiple = true;
+ private boolean fAllowMultiple = true;
- private boolean fDoubleClickSelects = true;
+ private boolean fDoubleClickSelects = true;
- private String fEmptyListMessage = WorkbenchMessages.ElementTreeSelectionDialog_nothing_available;
+ private String fEmptyListMessage = WorkbenchMessages.ElementTreeSelectionDialog_nothing_available;
- private IStatus fCurrStatus = new Status(IStatus.OK, PlatformUI.PLUGIN_ID,
- IStatus.OK, "", null); //$NON-NLS-1$
+ private IStatus fCurrStatus = new Status(IStatus.OK, PlatformUI.PLUGIN_ID, IStatus.OK, "", null); //$NON-NLS-1$
- private List fFilters;
+ private List fFilters;
- private Object fInput;
+ private Object fInput;
- private boolean fIsEmpty;
+ private boolean fIsEmpty;
- private int fWidth = 60;
+ private int fWidth = 60;
- private int fHeight = 18;
+ private int fHeight = 18;
- /**
- * Constructs an instance of <code>ElementTreeSelectionDialog</code>.
- * @param parent The parent shell for the dialog
- * @param labelProvider the label provider to render the entries
- * @param contentProvider the content provider to evaluate the tree structure
- */
- public ElementTreeSelectionDialog(Shell parent,
- ILabelProvider labelProvider, ITreeContentProvider contentProvider) {
+ /**
+ * Constructs an instance of <code>ElementTreeSelectionDialog</code>.
+ *
+ * @param parent The parent shell for the dialog
+ * @param labelProvider the label provider to render the entries
+ * @param contentProvider the content provider to evaluate the tree structure
+ */
+ public ElementTreeSelectionDialog(Shell parent, ILabelProvider labelProvider,
+ ITreeContentProvider contentProvider) {
this(parent, (IBaseLabelProvider) labelProvider, contentProvider);
}
/**
* Constructs an instance of <code>ElementTreeSelectionDialog</code>.
*
- * @param parent
- * The parent shell for the dialog
- * @param labelProvider
- * the label provider to render the entries. It must be
- * compatible with the Viewerreturned from
- * {@link #doCreateTreeViewer(Composite, int)}
- * @param contentProvider
- * the content provider to evaluate the tree structure
+ * @param parent The parent shell for the dialog
+ * @param labelProvider the label provider to render the entries. It must be
+ * compatible with the Viewerreturned from
+ * {@link #doCreateTreeViewer(Composite, int)}
+ * @param contentProvider the content provider to evaluate the tree structure
* @since 3.106
*/
public ElementTreeSelectionDialog(Shell parent, IBaseLabelProvider labelProvider,
ITreeContentProvider contentProvider) {
- super(parent);
+ super(parent);
- fLabelProvider = labelProvider;
- fContentProvider = contentProvider;
+ fLabelProvider = labelProvider;
+ fContentProvider = contentProvider;
- setResult(new ArrayList(0));
- setStatusLineAboveButtons(true);
- }
+ setResult(new ArrayList(0));
+ setStatusLineAboveButtons(true);
+ }
- /**
- * Sets the initial selection.
- * Convenience method.
- * @param selection the initial selection.
- */
- public void setInitialSelection(Object selection) {
+ /**
+ * Sets the initial selection. Convenience method.
+ *
+ * @param selection the initial selection.
+ */
+ public void setInitialSelection(Object selection) {
setInitialSelections(selection);
- }
-
- /**
- * Sets the message to be displayed if the list is empty.
- * @param message the message to be displayed.
- */
- public void setEmptyListMessage(String message) {
- fEmptyListMessage = message;
- }
-
- /**
- * Specifies if multiple selection is allowed.
- * @param allowMultiple
- */
- public void setAllowMultiple(boolean allowMultiple) {
- fAllowMultiple = allowMultiple;
- }
-
- /**
- * Specifies if default selected events (double click) are created.
- * @param doubleClickSelects
- */
- public void setDoubleClickSelects(boolean doubleClickSelects) {
- fDoubleClickSelects = doubleClickSelects;
- }
-
- /**
- * Sets the sorter used by the tree viewer.
- * @param sorter
- * @deprecated as of 3.3, use {@link ElementTreeSelectionDialog#setComparator(ViewerComparator)} instead
- */
- @Deprecated
+ }
+
+ /**
+ * Sets the message to be displayed if the list is empty.
+ *
+ * @param message the message to be displayed.
+ */
+ public void setEmptyListMessage(String message) {
+ fEmptyListMessage = message;
+ }
+
+ /**
+ * Specifies if multiple selection is allowed.
+ *
+ * @param allowMultiple
+ */
+ public void setAllowMultiple(boolean allowMultiple) {
+ fAllowMultiple = allowMultiple;
+ }
+
+ /**
+ * Specifies if default selected events (double click) are created.
+ *
+ * @param doubleClickSelects
+ */
+ public void setDoubleClickSelects(boolean doubleClickSelects) {
+ fDoubleClickSelects = doubleClickSelects;
+ }
+
+ /**
+ * Sets the sorter used by the tree viewer.
+ *
+ * @param sorter
+ * @deprecated as of 3.3, use
+ * {@link ElementTreeSelectionDialog#setComparator(ViewerComparator)}
+ * instead
+ */
+ @Deprecated
public void setSorter(ViewerSorter sorter) {
- fComparator = sorter;
- }
-
- /**
- * Sets the comparator used by the tree viewer.
- * @param comparator
- * @since 3.3
- */
- public void setComparator(ViewerComparator comparator){
- fComparator = comparator;
- }
-
- /**
- * Adds a filter to the tree viewer.
- * @param filter a filter.
- */
- public void addFilter(ViewerFilter filter) {
- if (fFilters == null) {
+ fComparator = sorter;
+ }
+
+ /**
+ * Sets the comparator used by the tree viewer.
+ *
+ * @param comparator
+ * @since 3.3
+ */
+ public void setComparator(ViewerComparator comparator) {
+ fComparator = comparator;
+ }
+
+ /**
+ * Adds a filter to the tree viewer.
+ *
+ * @param filter a filter.
+ */
+ public void addFilter(ViewerFilter filter) {
+ if (fFilters == null) {
fFilters = new ArrayList(4);
}
- fFilters.add(filter);
- }
-
- /**
- * Sets an optional validator to check if the selection is valid.
- * The validator is invoked whenever the selection changes.
- * @param validator the validator to validate the selection.
- */
- public void setValidator(ISelectionStatusValidator validator) {
- fValidator = validator;
- }
-
- /**
- * Sets the tree input.
- * @param input the tree input.
- */
- public void setInput(Object input) {
- fInput = input;
- }
-
- /**
- * Sets the size of the tree in unit of characters.
- * @param width the width of the tree.
- * @param height the height of the tree.
- */
- public void setSize(int width, int height) {
- fWidth = width;
- fHeight = height;
- }
-
- /**
- * Validate the receiver and update the ok status.
- *
- */
- protected void updateOKStatus() {
- if (!fIsEmpty) {
- if (fValidator != null) {
- fCurrStatus = fValidator.validate(getResult());
- updateStatus(fCurrStatus);
- } else {
- fCurrStatus = new Status(IStatus.OK, PlatformUI.PLUGIN_ID,
- IStatus.OK, "", //$NON-NLS-1$
- null);
- }
- } else {
- fCurrStatus = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID,
- IStatus.ERROR, fEmptyListMessage, null);
- }
- updateStatus(fCurrStatus);
- }
-
- @Override
+ fFilters.add(filter);
+ }
+
+ /**
+ * Sets an optional validator to check if the selection is valid. The validator
+ * is invoked whenever the selection changes.
+ *
+ * @param validator the validator to validate the selection.
+ */
+ public void setValidator(ISelectionStatusValidator validator) {
+ fValidator = validator;
+ }
+
+ /**
+ * Sets the tree input.
+ *
+ * @param input the tree input.
+ */
+ public void setInput(Object input) {
+ fInput = input;
+ }
+
+ /**
+ * Sets the size of the tree in unit of characters.
+ *
+ * @param width the width of the tree.
+ * @param height the height of the tree.
+ */
+ public void setSize(int width, int height) {
+ fWidth = width;
+ fHeight = height;
+ }
+
+ /**
+ * Validate the receiver and update the ok status.
+ *
+ */
+ protected void updateOKStatus() {
+ if (!fIsEmpty) {
+ if (fValidator != null) {
+ fCurrStatus = fValidator.validate(getResult());
+ updateStatus(fCurrStatus);
+ } else {
+ fCurrStatus = new Status(IStatus.OK, PlatformUI.PLUGIN_ID, IStatus.OK, "", //$NON-NLS-1$
+ null);
+ }
+ } else {
+ fCurrStatus = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.ERROR, fEmptyListMessage, null);
+ }
+ updateStatus(fCurrStatus);
+ }
+
+ @Override
public int open() {
- fIsEmpty = evaluateIfTreeEmpty(fInput);
- super.open();
- return getReturnCode();
- }
-
- private void access$superCreate() {
- super.create();
- }
-
- /**
- * Handles cancel button pressed event.
- */
- @Override
+ fIsEmpty = evaluateIfTreeEmpty(fInput);
+ super.open();
+ return getReturnCode();
+ }
+
+ private void access$superCreate() {
+ super.create();
+ }
+
+ /**
+ * Handles cancel button pressed event.
+ */
+ @Override
protected void cancelPressed() {
- setResult(null);
- super.cancelPressed();
- }
+ setResult(null);
+ super.cancelPressed();
+ }
- @Override
+ @Override
protected void computeResult() {
setResult(fViewer.getStructuredSelection().toList());
- }
+ }
- @Override
+ @Override
public void create() {
- BusyIndicator.showWhile(null, () -> {
- access$superCreate();
- fViewer.setSelection(new StructuredSelection(
- getInitialElementSelections()), true);
- updateOKStatus();
+ BusyIndicator.showWhile(null, () -> {
+ access$superCreate();
+ fViewer.setSelection(new StructuredSelection(getInitialElementSelections()), true);
+ updateOKStatus();
});
- }
+ }
- @Override
+ @Override
protected Control createDialogArea(Composite parent) {
- Composite composite = (Composite) super.createDialogArea(parent);
-
- Label messageLabel = createMessageArea(composite);
- TreeViewer treeViewer = createTreeViewer(composite);
-
- GridData data = new GridData(GridData.FILL_BOTH);
- data.widthHint = convertWidthInCharsToPixels(fWidth);
- data.heightHint = convertHeightInCharsToPixels(fHeight);
-
- Tree treeWidget = treeViewer.getTree();
- treeWidget.setLayoutData(data);
- treeWidget.setFont(parent.getFont());
-
- if (fIsEmpty) {
- messageLabel.setEnabled(false);
- treeWidget.setEnabled(false);
- }
-
- return composite;
- }
-
- /**
- * Creates and initializes the tree viewer.
- *
- * @param parent the parent composite
- * @return the tree viewer
- * @see #doCreateTreeViewer(Composite, int)
- */
- protected TreeViewer createTreeViewer(Composite parent) {
- int style = SWT.BORDER | (fAllowMultiple ? SWT.MULTI : SWT.SINGLE);
-
- fViewer = doCreateTreeViewer(parent, style);
- fViewer.setContentProvider(fContentProvider);
- fViewer.setLabelProvider(fLabelProvider);
- fViewer.addSelectionChangedListener(event -> {
+ Composite composite = (Composite) super.createDialogArea(parent);
+
+ Label messageLabel = createMessageArea(composite);
+ TreeViewer treeViewer = createTreeViewer(composite);
+
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.widthHint = convertWidthInCharsToPixels(fWidth);
+ data.heightHint = convertHeightInCharsToPixels(fHeight);
+
+ Tree treeWidget = treeViewer.getTree();
+ treeWidget.setLayoutData(data);
+ treeWidget.setFont(parent.getFont());
+
+ if (fIsEmpty) {
+ messageLabel.setEnabled(false);
+ treeWidget.setEnabled(false);
+ }
+
+ return composite;
+ }
+
+ /**
+ * Creates and initializes the tree viewer.
+ *
+ * @param parent the parent composite
+ * @return the tree viewer
+ * @see #doCreateTreeViewer(Composite, int)
+ */
+ protected TreeViewer createTreeViewer(Composite parent) {
+ int style = SWT.BORDER | (fAllowMultiple ? SWT.MULTI : SWT.SINGLE);
+
+ fViewer = doCreateTreeViewer(parent, style);
+ fViewer.setContentProvider(fContentProvider);
+ fViewer.setLabelProvider(fLabelProvider);
+ fViewer.addSelectionChangedListener(event -> {
access$setResult(event.getStructuredSelection().toList());
- updateOKStatus();
+ updateOKStatus();
});
- fViewer.setComparator(fComparator);
- if (fFilters != null) {
- for (int i = 0; i != fFilters.size(); i++) {
+ fViewer.setComparator(fComparator);
+ if (fFilters != null) {
+ for (int i = 0; i != fFilters.size(); i++) {
fViewer.addFilter((ViewerFilter) fFilters.get(i));
}
- }
+ }
- if (fDoubleClickSelects) {
- Tree tree = fViewer.getTree();
- tree.addSelectionListener(widgetDefaultSelectedAdapter(e -> {
- updateOKStatus();
- if (fCurrStatus.isOK()) {
+ if (fDoubleClickSelects) {
+ Tree tree = fViewer.getTree();
+ tree.addSelectionListener(widgetDefaultSelectedAdapter(e -> {
+ updateOKStatus();
+ if (fCurrStatus.isOK()) {
access$superButtonPressed(IDialogConstants.OK_ID);
}
}));
- }
- fViewer.addDoubleClickListener(event -> {
- updateOKStatus();
-
- //If it is not OK or if double click does not
- //select then expand
- if (!(fDoubleClickSelects && fCurrStatus.isOK())) {
- ISelection selection = event.getSelection();
- if (selection instanceof IStructuredSelection) {
- Object item = ((IStructuredSelection) selection)
- .getFirstElement();
- if (fViewer.getExpandedState(item)) {
+ }
+ fViewer.addDoubleClickListener(event -> {
+ updateOKStatus();
+
+ // If it is not OK or if double click does not
+ // select then expand
+ if (!(fDoubleClickSelects && fCurrStatus.isOK())) {
+ ISelection selection = event.getSelection();
+ if (selection instanceof IStructuredSelection) {
+ Object item = ((IStructuredSelection) selection).getFirstElement();
+ if (fViewer.getExpandedState(item)) {
fViewer.collapseToLevel(item, 1);
} else {
fViewer.expandToLevel(item, 1);
}
- }
- }
+ }
+ }
});
- fViewer.setInput(fInput);
+ fViewer.setInput(fInput);
- return fViewer;
- }
+ return fViewer;
+ }
- /**
- * Creates the tree viewer.
- *
- * @param parent the parent composite
- * @param style the {@link SWT} style bits
- * @return the tree viewer
- * @since 3.4
+ /**
+ * Creates the tree viewer.
+ *
+ * @param parent the parent composite
+ * @param style the {@link SWT} style bits
+ * @return the tree viewer
+ * @since 3.4
*/
protected TreeViewer doCreateTreeViewer(Composite parent, int style) {
return new TreeViewer(new Tree(parent, style));
}
/**
- * Returns the tree viewer.
- *
- * @return the tree viewer
- */
- protected TreeViewer getTreeViewer() {
- return fViewer;
- }
-
- private boolean evaluateIfTreeEmpty(Object input) {
- Object[] elements = fContentProvider.getElements(input);
- if (elements.length > 0) {
- if (fFilters != null) {
- for (int i = 0; i < fFilters.size(); i++) {
- ViewerFilter curr = (ViewerFilter) fFilters.get(i);
- elements = curr.filter(fViewer, input, elements);
- }
- }
- }
- return elements.length == 0;
- }
-
- /**
- * Set the result using the super class implementation of
- * buttonPressed.
- * @param id
- * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
- */
- protected void access$superButtonPressed(int id) {
- super.buttonPressed(id);
- }
-
- /**
- * Set the result using the super class implementation of
- * setResult.
- * @param result
- * @see SelectionStatusDialog#setResult(int, Object)
- */
- protected void access$setResult(List result) {
- super.setResult(result);
- }
-
- @Override
+ * Returns the tree viewer.
+ *
+ * @return the tree viewer
+ */
+ protected TreeViewer getTreeViewer() {
+ return fViewer;
+ }
+
+ private boolean evaluateIfTreeEmpty(Object input) {
+ Object[] elements = fContentProvider.getElements(input);
+ if (elements.length > 0) {
+ if (fFilters != null) {
+ for (int i = 0; i < fFilters.size(); i++) {
+ ViewerFilter curr = (ViewerFilter) fFilters.get(i);
+ elements = curr.filter(fViewer, input, elements);
+ }
+ }
+ }
+ return elements.length == 0;
+ }
+
+ /**
+ * Set the result using the super class implementation of buttonPressed.
+ *
+ * @param id
+ * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
+ */
+ protected void access$superButtonPressed(int id) {
+ super.buttonPressed(id);
+ }
+
+ /**
+ * Set the result using the super class implementation of setResult.
+ *
+ * @param result
+ * @see SelectionStatusDialog#setResult(int, Object)
+ */
+ protected void access$setResult(List result) {
+ super.setResult(result);
+ }
+
+ @Override
protected void handleShellCloseEvent() {
- super.handleShellCloseEvent();
+ super.handleShellCloseEvent();
- //Handle the closing of the shell by selecting the close icon
- if (getReturnCode() == CANCEL) {
+ // Handle the closing of the shell by selecting the close icon
+ if (getReturnCode() == CANCEL) {
setResult(null);
}
- }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FileEditorMappingContentProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FileEditorMappingContentProvider.java
index 384ac3681eb..0ab421e923e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FileEditorMappingContentProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FileEditorMappingContentProvider.java
@@ -17,35 +17,35 @@ import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.ui.IFileEditorMapping;
/**
- * A content provider for displaying of <code>IFileEditorMapping</code>
- * objects in viewers.
+ * A content provider for displaying of <code>IFileEditorMapping</code> objects
+ * in viewers.
* <p>
* This class has a singleton instance,
- * <code>FileEditorMappingContentProvider.INSTANCE</code>,
- * which can be used any place this kind of content provider is needed.
+ * <code>FileEditorMappingContentProvider.INSTANCE</code>, which can be used any
+ * place this kind of content provider is needed.
* </p>
*
* @see org.eclipse.jface.viewers.IContentProvider
*/
public class FileEditorMappingContentProvider implements IStructuredContentProvider {
- /**
- * Singleton instance accessor.
- */
- public static final FileEditorMappingContentProvider INSTANCE = new FileEditorMappingContentProvider();
+ /**
+ * Singleton instance accessor.
+ */
+ public static final FileEditorMappingContentProvider INSTANCE = new FileEditorMappingContentProvider();
- /**
- * Creates an instance of this class. The private visibility of this
- * constructor ensures that this class is only usable as a singleton.
- */
- private FileEditorMappingContentProvider() {
- super();
- }
+ /**
+ * Creates an instance of this class. The private visibility of this constructor
+ * ensures that this class is only usable as a singleton.
+ */
+ private FileEditorMappingContentProvider() {
+ super();
+ }
- @Override
+ @Override
public Object[] getElements(Object element) {
- IFileEditorMapping[] array = (IFileEditorMapping[]) element;
- return array == null ? new Object[0] : array;
- }
+ IFileEditorMapping[] array = (IFileEditorMapping[]) element;
+ return array == null ? new Object[0] : array;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FileEditorMappingLabelProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FileEditorMappingLabelProvider.java
index 850ee361814..efe9fd077a2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FileEditorMappingLabelProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FileEditorMappingLabelProvider.java
@@ -24,12 +24,12 @@ import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IFileEditorMapping;
/**
- * A label provider for displaying of <code>IFileEditorMapping</code>
- * objects in viewers.
+ * A label provider for displaying of <code>IFileEditorMapping</code> objects in
+ * viewers.
* <p>
* This class has a singleton instance,
- * <code>FileEditorMappingLabelProvider.INSTANCE</code>,
- * which can be used any place this kind of label provider is needed.
+ * <code>FileEditorMappingLabelProvider.INSTANCE</code>, which can be used any
+ * place this kind of label provider is needed.
* </p>
* <p>
* The singleton instance hangs on to images, which get freed up when
@@ -38,75 +38,73 @@ import org.eclipse.ui.IFileEditorMapping;
*
* @see org.eclipse.jface.viewers.ILabelProvider
*/
-public class FileEditorMappingLabelProvider extends LabelProvider implements
- ITableLabelProvider {
+public class FileEditorMappingLabelProvider extends LabelProvider implements ITableLabelProvider {
- /**
- * Singleton instance accessor.
- */
- public static final FileEditorMappingLabelProvider INSTANCE = new FileEditorMappingLabelProvider();
+ /**
+ * Singleton instance accessor.
+ */
+ public static final FileEditorMappingLabelProvider INSTANCE = new FileEditorMappingLabelProvider();
- /**
- * Images that will require disposal.
- */
- private List imagesToDispose = new ArrayList();
+ /**
+ * Images that will require disposal.
+ */
+ private List imagesToDispose = new ArrayList();
- /**
- * Creates an instance of this class. The private visibility of this
- * constructor ensures that this class is only usable as a singleton.
- */
- private FileEditorMappingLabelProvider() {
- super();
- }
+ /**
+ * Creates an instance of this class. The private visibility of this constructor
+ * ensures that this class is only usable as a singleton.
+ */
+ private FileEditorMappingLabelProvider() {
+ super();
+ }
- @Override
+ @Override
public void dispose() {
- super.dispose();
- for (Iterator e = imagesToDispose.iterator(); e.hasNext();) {
- ((Image) e.next()).dispose();
- }
- imagesToDispose.clear();
- }
+ super.dispose();
+ for (Iterator e = imagesToDispose.iterator(); e.hasNext();) {
+ ((Image) e.next()).dispose();
+ }
+ imagesToDispose.clear();
+ }
- /**
- * The <code>ResourceTypeEditorMappingLabelProvider</code> implementation of this
- * <code>ITableLabelProvider</code> method creates and returns an new image. The
- * image is remembered internally and will be deallocated by
- * <code>dispose</code>.
- */
- @Override
+ /**
+ * The <code>ResourceTypeEditorMappingLabelProvider</code> implementation of
+ * this <code>ITableLabelProvider</code> method creates and returns an new
+ * image. The image is remembered internally and will be deallocated by
+ * <code>dispose</code>.
+ */
+ @Override
public Image getColumnImage(Object element, int row) {
- return getImage(element);
- }
+ return getImage(element);
+ }
- @Override
+ @Override
public String getColumnText(Object element, int row) {
- return getText(element);
- }
+ return getText(element);
+ }
- /**
- * The <code>ResourceTypeEditorMappingLabelProvider</code> implementation of this
- * <code>ILabelProvider</code> method creates and returns an new image. The image
- * is remembered internally and will be deallocated by <code>dispose</code>.
- */
- @Override
+ /**
+ * The <code>ResourceTypeEditorMappingLabelProvider</code> implementation of
+ * this <code>ILabelProvider</code> method creates and returns an new image. The
+ * image is remembered internally and will be deallocated by
+ * <code>dispose</code>.
+ */
+ @Override
public Image getImage(Object element) {
- if (element instanceof IFileEditorMapping) {
- Image image = ((IFileEditorMapping) element).getImageDescriptor()
- .createImage();
- imagesToDispose.add(image);
- return image;
- }
- return null;
- }
+ if (element instanceof IFileEditorMapping) {
+ Image image = ((IFileEditorMapping) element).getImageDescriptor().createImage();
+ imagesToDispose.add(image);
+ return image;
+ }
+ return null;
+ }
- @Override
+ @Override
public String getText(Object element) {
- if (element instanceof IFileEditorMapping) {
- return TextProcessor.process(((IFileEditorMapping) element)
- .getLabel(), "*."); //$NON-NLS-1$
+ if (element instanceof IFileEditorMapping) {
+ return TextProcessor.process(((IFileEditorMapping) element).getLabel(), "*."); //$NON-NLS-1$
}
return null;
- }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FileSystemElement.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FileSystemElement.java
index 70d80865dc0..2440d327382 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FileSystemElement.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FileSystemElement.java
@@ -37,233 +37,228 @@ import org.eclipse.ui.model.IWorkbenchAdapter;
* IWorkbenchAdapter adapter used for navigation and display in the workbench.
*/
public class FileSystemElement implements IAdaptable {
- private String name;
+ private String name;
- private Object fileSystemObject;
+ private Object fileSystemObject;
- /*
- * Wait until a child is added to initialize the receiver's lists. Doing so
- * minimizes the amount of memory that is allocated when a large directory
- * structure is being processed.
- */
- private AdaptableList folders = null;
+ /*
+ * Wait until a child is added to initialize the receiver's lists. Doing so
+ * minimizes the amount of memory that is allocated when a large directory
+ * structure is being processed.
+ */
+ private AdaptableList folders = null;
- private AdaptableList files = null;
+ private AdaptableList files = null;
- private boolean isDirectory = false;
+ private boolean isDirectory = false;
- private FileSystemElement parent;
+ private FileSystemElement parent;
- private IWorkbenchAdapter workbenchAdapter = new IWorkbenchAdapter() {
- /**
- * Answer the children property of this element
- */
- @Override
+ private IWorkbenchAdapter workbenchAdapter = new IWorkbenchAdapter() {
+ /**
+ * Answer the children property of this element
+ */
+ @Override
public Object[] getChildren(Object o) {
- return getFolders().getChildren(o);
- }
+ return getFolders().getChildren(o);
+ }
- /**
- * Returns the parent of this element
- */
- @Override
+ /**
+ * Returns the parent of this element
+ */
+ @Override
public Object getParent(Object o) {
- return parent;
- }
+ return parent;
+ }
- /**
- * Returns an appropriate label for this file system element.
- */
- @Override
+ /**
+ * Returns an appropriate label for this file system element.
+ */
+ @Override
public String getLabel(Object o) {
- return name;
- }
+ return name;
+ }
- /**
- * Returns an image descriptor for this file system element
- */
- @Override
+ /**
+ * Returns an image descriptor for this file system element
+ */
+ @Override
public ImageDescriptor getImageDescriptor(Object object) {
- if (isDirectory()) {
- return WorkbenchImages
- .getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER);
- }
+ if (isDirectory()) {
+ return WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER);
+ }
return WorkbenchPlugin.getDefault().getEditorRegistry().getImageDescriptor(name);
// TODO: what are the implications for content types? Should I guess?
- }
- };
+ }
+ };
- /**
- * Creates a new <code>FileSystemElement</code> and initializes it and its
- * parent if applicable.
- *
- * @param name
- * The name of the element
- * @param parent
- * The parent element. May be <code>null</code>
- * @param isDirectory
- * if <code>true</code> this is representing a directory,
- * otherwise it is a file.
- */
- public FileSystemElement(String name, FileSystemElement parent,
- boolean isDirectory) {
- this.name = name;
- this.parent = parent;
- this.isDirectory = isDirectory;
- if (parent != null) {
+ /**
+ * Creates a new <code>FileSystemElement</code> and initializes it and its
+ * parent if applicable.
+ *
+ * @param name The name of the element
+ * @param parent The parent element. May be <code>null</code>
+ * @param isDirectory if <code>true</code> this is representing a directory,
+ * otherwise it is a file.
+ */
+ public FileSystemElement(String name, FileSystemElement parent, boolean isDirectory) {
+ this.name = name;
+ this.parent = parent;
+ this.isDirectory = isDirectory;
+ if (parent != null) {
parent.addChild(this);
}
- }
+ }
- /**
- * Adds the passed child to this object's collection of children.
- *
- * @param child
- * FileSystemElement
- */
- public void addChild(FileSystemElement child) {
- if (child.isDirectory()) {
- if (folders == null) {
+ /**
+ * Adds the passed child to this object's collection of children.
+ *
+ * @param child FileSystemElement
+ */
+ public void addChild(FileSystemElement child) {
+ if (child.isDirectory()) {
+ if (folders == null) {
folders = new AdaptableList(1);
}
- folders.add(child);
- } else {
- if (files == null) {
+ folders.add(child);
+ } else {
+ if (files == null) {
files = new AdaptableList(1);
}
- files.add(child);
- }
- }
+ files.add(child);
+ }
+ }
- /**
- * Returns the adapter
- */
+ /**
+ * Returns the adapter
+ */
@Override
public <T> T getAdapter(Class<T> adapter) {
- if (adapter == IWorkbenchAdapter.class) {
+ if (adapter == IWorkbenchAdapter.class) {
return adapter.cast(workbenchAdapter);
- }
- //defer to the platform
- return Platform.getAdapterManager().getAdapter(this, adapter);
- }
+ }
+ // defer to the platform
+ return Platform.getAdapterManager().getAdapter(this, adapter);
+ }
- /**
- * Returns the extension of this element's filename.
- *
- * @return The extension or an empty string if there is no extension.
- */
- public String getFileNameExtension() {
- int lastDot = name.lastIndexOf('.');
- return lastDot < 0 ? "" : name.substring(lastDot + 1); //$NON-NLS-1$
- }
+ /**
+ * Returns the extension of this element's filename.
+ *
+ * @return The extension or an empty string if there is no extension.
+ */
+ public String getFileNameExtension() {
+ int lastDot = name.lastIndexOf('.');
+ return lastDot < 0 ? "" : name.substring(lastDot + 1); //$NON-NLS-1$
+ }
- /**
- * Answer the files property of this element. Answer an empty list if the
- * files property is null. This method should not be used to add children to
- * the receiver. Use addChild(FileSystemElement) instead.
- *
- * @return AdaptableList The list of files parented by the receiver.
- */
- public AdaptableList getFiles() {
- if (files == null) {
- // lazily initialize (can't share result since it's modifiable)
- files = new AdaptableList(0);
- }
- return files;
- }
+ /**
+ * Answer the files property of this element. Answer an empty list if the files
+ * property is null. This method should not be used to add children to the
+ * receiver. Use addChild(FileSystemElement) instead.
+ *
+ * @return AdaptableList The list of files parented by the receiver.
+ */
+ public AdaptableList getFiles() {
+ if (files == null) {
+ // lazily initialize (can't share result since it's modifiable)
+ files = new AdaptableList(0);
+ }
+ return files;
+ }
- /**
- * Returns the file system object property of this element
- *
- * @return the file system object
- */
- public Object getFileSystemObject() {
- return fileSystemObject;
- }
+ /**
+ * Returns the file system object property of this element
+ *
+ * @return the file system object
+ */
+ public Object getFileSystemObject() {
+ return fileSystemObject;
+ }
- /**
- * Returns a list of the folders that are immediate children of this folder.
- * Answer an empty list if the folders property is null. This method should
- * not be used to add children to the receiver. Use
- * addChild(FileSystemElement) instead.
- *
- * @return AdapatableList The list of folders parented by the receiver.
- */
- public AdaptableList getFolders() {
- if (folders == null) {
- // lazily initialize (can't share result since it's modifiable)
- folders = new AdaptableList(0);
- }
- return folders;
- }
+ /**
+ * Returns a list of the folders that are immediate children of this folder.
+ * Answer an empty list if the folders property is null. This method should not
+ * be used to add children to the receiver. Use addChild(FileSystemElement)
+ * instead.
+ *
+ * @return AdapatableList The list of folders parented by the receiver.
+ */
+ public AdaptableList getFolders() {
+ if (folders == null) {
+ // lazily initialize (can't share result since it's modifiable)
+ folders = new AdaptableList(0);
+ }
+ return folders;
+ }
- /**
- * Return the parent of this element.
- *
- * @return the parent file system element, or <code>null</code> if this is
- * the root
- */
- public FileSystemElement getParent() {
- return this.parent;
- }
+ /**
+ * Return the parent of this element.
+ *
+ * @return the parent file system element, or <code>null</code> if this is the
+ * root
+ */
+ public FileSystemElement getParent() {
+ return this.parent;
+ }
- /**
- * @return boolean <code>true</code> if this element represents a
- * directory, and <code>false</code> otherwise.
- */
- public boolean isDirectory() {
- return isDirectory;
- }
+ /**
+ * @return boolean <code>true</code> if this element represents a directory, and
+ * <code>false</code> otherwise.
+ */
+ public boolean isDirectory() {
+ return isDirectory;
+ }
- /**
- * Removes a sub-folder from this file system element.
- * @param child The child to remove.
- */
- public void removeFolder(FileSystemElement child) {
- if (folders == null) {
+ /**
+ * Removes a sub-folder from this file system element.
+ *
+ * @param child The child to remove.
+ */
+ public void removeFolder(FileSystemElement child) {
+ if (folders == null) {
return;
}
- folders.remove(child);
- child.setParent(null);
- }
+ folders.remove(child);
+ child.setParent(null);
+ }
- /**
- * Set the file system object property of this element
- *
- * @param value
- * the file system object
- */
- public void setFileSystemObject(Object value) {
- fileSystemObject = value;
- }
+ /**
+ * Set the file system object property of this element
+ *
+ * @param value the file system object
+ */
+ public void setFileSystemObject(Object value) {
+ fileSystemObject = value;
+ }
- /**
- * Sets the parent of this file system element.
- * @param element The new parent.
- */
- public void setParent(FileSystemElement element) {
- parent = element;
- }
+ /**
+ * Sets the parent of this file system element.
+ *
+ * @param element The new parent.
+ */
+ public void setParent(FileSystemElement element) {
+ parent = element;
+ }
- /**
- * For debugging purposes only.
- */
- @Override
+ /**
+ * For debugging purposes only.
+ */
+ @Override
public String toString() {
- StringBuilder buf = new StringBuilder();
- if (isDirectory()) {
- buf.append("Folder(");//$NON-NLS-1$
- } else {
- buf.append("File(");//$NON-NLS-1$
- }
- buf.append(name).append(")");//$NON-NLS-1$
- if (!isDirectory()) {
- return buf.toString();
- }
- buf.append(" folders: ");//$NON-NLS-1$
- buf.append(folders);
- buf.append(" files: ");//$NON-NLS-1$
- buf.append(files);
- return buf.toString();
- }
+ StringBuilder buf = new StringBuilder();
+ if (isDirectory()) {
+ buf.append("Folder(");//$NON-NLS-1$
+ } else {
+ buf.append("File(");//$NON-NLS-1$
+ }
+ buf.append(name).append(")");//$NON-NLS-1$
+ if (!isDirectory()) {
+ return buf.toString();
+ }
+ buf.append(" folders: ");//$NON-NLS-1$
+ buf.append(folders);
+ buf.append(" files: ");//$NON-NLS-1$
+ buf.append(files);
+ return buf.toString();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FilteredItemsSelectionDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FilteredItemsSelectionDialog.java
index 9631496189a..c45bd4e77ea 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FilteredItemsSelectionDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FilteredItemsSelectionDialog.java
@@ -148,14 +148,14 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
public static final int NONE = 0;
/**
- * Pattern input field selection where caret is at the beginning (used only
- * for initial pattern).
+ * Pattern input field selection where caret is at the beginning (used only for
+ * initial pattern).
*/
public static final int CARET_BEGINNING = 1;
/**
- * Represents a full selection in the pattern input field (used only for
- * initial pattern).
+ * Represents a full selection in the pattern input field (used only for initial
+ * pattern).
*/
public static final int FULL_SELECTION = 2;
@@ -166,9 +166,9 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
private DetailsContentViewer details;
/**
- * It is a duplicate of a field in the CLabel class in DetailsContentViewer.
- * It is maintained, because the <code>setDetailsLabelProvider()</code>
- * could be called before content area is created.
+ * It is a duplicate of a field in the CLabel class in DetailsContentViewer. It
+ * is maintained, because the <code>setDetailsLabelProvider()</code> could be
+ * called before content area is created.
*/
private ILabelProvider detailsLabelProvider;
@@ -229,11 +229,9 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Creates a new instance of the class.
*
- * @param shell
- * shell to parent the dialog on
- * @param multi
- * indicates whether dialog allows to select more than one
- * position in its list of items
+ * @param shell shell to parent the dialog on
+ * @param multi indicates whether dialog allows to select more than one position
+ * in its list of items
*/
public FilteredItemsSelectionDialog(Shell shell, boolean multi) {
super(shell);
@@ -242,8 +240,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
filterJob = new FilterJob();
contentProvider = new ContentProvider();
refreshCacheJob = new RefreshCacheJob();
- itemsListSeparator = new ItemsListSeparator(
- WorkbenchMessages.FilteredItemsSelectionDialog_separatorLabel);
+ itemsListSeparator = new ItemsListSeparator(WorkbenchMessages.FilteredItemsSelectionDialog_separatorLabel);
selectionMode = NONE;
}
@@ -251,8 +248,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
* Creates a new instance of the class. Created dialog won't allow to select
* more than one item.
*
- * @param shell
- * shell to parent the dialog on
+ * @param shell shell to parent the dialog on
*/
public FilteredItemsSelectionDialog(Shell shell) {
this(shell, false);
@@ -261,24 +257,22 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Adds viewer filter to the dialog items list.
*
- * @param filter
- * the new filter
+ * @param filter the new filter
*/
protected void addListFilter(ViewerFilter filter) {
contentProvider.addFilter(filter);
}
/**
- * Sets a new label provider for items in the list. If the label provider
- * also implements {@link
- * org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider
- * .IStyledLabelProvider}, the style text labels provided by it will be used
- * provided that the corresponding preference is set.
+ * Sets a new label provider for items in the list. If the label provider also
+ * implements
+ * {@link org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider .IStyledLabelProvider},
+ * the style text labels provided by it will be used provided that the
+ * corresponding preference is set.
*
* @see IWorkbenchPreferenceConstants#USE_COLORED_LABELS
*
- * @param listLabelProvider
- * the label provider for items in the list
+ * @param listLabelProvider the label provider for items in the list
*/
public void setListLabelProvider(ILabelProvider listLabelProvider) {
getItemsListLabelProvider().setProvider(listLabelProvider);
@@ -296,13 +290,11 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Sets the label decorator for selected items in the list.
*
- * @param listSelectionLabelDecorator
- * the label decorator for selected items in the list
+ * @param listSelectionLabelDecorator the label decorator for selected items in
+ * the list
*/
- public void setListSelectionLabelDecorator(
- ILabelDecorator listSelectionLabelDecorator) {
- getItemsListLabelProvider().setSelectionDecorator(
- listSelectionLabelDecorator);
+ public void setListSelectionLabelDecorator(ILabelDecorator listSelectionLabelDecorator) {
+ getItemsListLabelProvider().setSelectionDecorator(listSelectionLabelDecorator);
}
/**
@@ -312,8 +304,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
*/
private ItemsListLabelProvider getItemsListLabelProvider() {
if (itemsListLabelProvider == null) {
- itemsListLabelProvider = new ItemsListLabelProvider(
- new LabelProvider(), null);
+ itemsListLabelProvider = new ItemsListLabelProvider(new LabelProvider(), null);
}
return itemsListLabelProvider;
}
@@ -323,15 +314,13 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
*
* For a single selection, the element sent to
* {@link ILabelProvider#getImage(Object)} and
- * {@link ILabelProvider#getText(Object)} is the selected object, for
- * multiple selection a {@link String} with amount of selected items is the
- * element.
+ * {@link ILabelProvider#getText(Object)} is the selected object, for multiple
+ * selection a {@link String} with amount of selected items is the element.
*
- * @see #getSelectedItems() getSelectedItems() can be used to retrieve
- * selected items and get the items count.
+ * @see #getSelectedItems() getSelectedItems() can be used to retrieve selected
+ * items and get the items count.
*
- * @param detailsLabelProvider
- * the label provider for the details field
+ * @param detailsLabelProvider the label provider for the details field
*/
public void setDetailsLabelProvider(ILabelProvider detailsLabelProvider) {
this.detailsLabelProvider = detailsLabelProvider;
@@ -354,11 +343,10 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
}
/**
- * Restores dialog using persisted settings. The default implementation
- * restores the status of the details line and the selection history.
+ * Restores dialog using persisted settings. The default implementation restores
+ * the status of the details line and the selection history.
*
- * @param settings
- * settings used to restore dialog
+ * @param settings settings used to restore dialog
*/
protected void restoreDialog(IDialogSettings settings) {
boolean toggleStatusLine = true;
@@ -374,20 +362,12 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
String setting = settings.get(HISTORY_SETTINGS);
if (setting != null) {
try {
- IMemento memento = XMLMemento.createReadRoot(new StringReader(
- setting));
+ IMemento memento = XMLMemento.createReadRoot(new StringReader(setting));
this.contentProvider.loadHistory(memento);
} catch (WorkbenchException e) {
// Simply don't restore the settings
- StatusManager
- .getManager()
- .handle(
- new Status(
- IStatus.ERROR,
- PlatformUI.PLUGIN_ID,
- IStatus.ERROR,
- WorkbenchMessages.FilteredItemsSelectionDialog_restoreError,
- e));
+ StatusManager.getManager().handle(new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.ERROR,
+ WorkbenchMessages.FilteredItemsSelectionDialog_restoreError, e));
}
}
}
@@ -398,8 +378,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
this.refreshCacheJob.cancel();
this.refreshProgressMessageJob.cancel();
if (showViewHandler != null) {
- IHandlerService service = PlatformUI
- .getWorkbench().getService(IHandlerService.class);
+ IHandlerService service = PlatformUI.getWorkbench().getService(IHandlerService.class);
service.deactivateHandler(showViewHandler);
showViewHandler.getHandler().dispose();
showViewHandler = null;
@@ -415,8 +394,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Stores dialog settings.
*
- * @param settings
- * settings used to store dialog
+ * @param settings settings used to store dialog
*/
protected void storeDialog(IDialogSettings settings) {
settings.put(SHOW_STATUS_LINE, toggleStatusLineAction.isChecked());
@@ -429,15 +407,8 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
settings.put(HISTORY_SETTINGS, writer.getBuffer().toString());
} catch (IOException e) {
// Simply don't store the settings
- StatusManager
- .getManager()
- .handle(
- new Status(
- IStatus.ERROR,
- PlatformUI.PLUGIN_ID,
- IStatus.ERROR,
- WorkbenchMessages.FilteredItemsSelectionDialog_storeError,
- e));
+ StatusManager.getManager().handle(new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.ERROR,
+ WorkbenchMessages.FilteredItemsSelectionDialog_storeError, e));
}
}
@@ -457,8 +428,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
header.setLayout(layout);
Label headerLabel = new Label(header, SWT.NONE);
- headerLabel.setText((getMessage() != null && getMessage().trim()
- .length() > 0) ? getMessage()
+ headerLabel.setText((getMessage() != null && getMessage().trim().length() > 0) ? getMessage()
: WorkbenchMessages.FilteredItemsSelectionDialog_patternLabel);
headerLabel.addTraverseListener(e -> {
if (e.detail == SWT.TRAVERSE_MNEMONIC && e.doit) {
@@ -491,8 +461,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
labels.setLayout(layout);
Label listLabel = new Label(labels, SWT.NONE);
- listLabel
- .setText(WorkbenchMessages.FilteredItemsSelectionDialog_listLabel);
+ listLabel.setText(WorkbenchMessages.FilteredItemsSelectionDialog_listLabel);
listLabel.addTraverseListener(e -> {
if (e.detail == SWT.TRAVERSE_MNEMONIC && e.doit) {
@@ -526,18 +495,15 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
}
});
- toolItem.setImage(WorkbenchImages
- .getImage(IWorkbenchGraphicConstants.IMG_LCL_VIEW_MENU));
- toolItem
- .setToolTipText(WorkbenchMessages.FilteredItemsSelectionDialog_menu);
+ toolItem.setImage(WorkbenchImages.getImage(IWorkbenchGraphicConstants.IMG_LCL_VIEW_MENU));
+ toolItem.setToolTipText(WorkbenchMessages.FilteredItemsSelectionDialog_menu);
toolItem.addSelectionListener(widgetSelectedAdapter(e -> showViewMenu()));
menuManager = new MenuManager();
fillViewMenu(menuManager);
- IHandlerService service = PlatformUI.getWorkbench()
- .getService(IHandlerService.class);
+ IHandlerService service = PlatformUI.getWorkbench().getService(IHandlerService.class);
IHandler handler = new AbstractHandler() {
@Override
public Object execute(ExecutionEvent event) {
@@ -545,16 +511,14 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
return null;
}
};
- showViewHandler = service.activateHandler(
- IWorkbenchCommandConstants.WINDOW_SHOW_VIEW_MENU, handler,
+ showViewHandler = service.activateHandler(IWorkbenchCommandConstants.WINDOW_SHOW_VIEW_MENU, handler,
new ActiveShellExpression(getShell()));
}
/**
* Fills the menu of the dialog.
*
- * @param menuManager
- * the menu manager
+ * @param menuManager the menu manager
*/
protected void fillViewMenu(IMenuManager menuManager) {
toggleStatusLineAction = new ToggleStatusLineAction();
@@ -570,28 +534,30 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
menu.setVisible(true);
}
- /**
- * Hook that allows to add actions to the context menu.
+ /**
+ * Hook that allows to add actions to the context menu.
* <p>
- * Subclasses may extend in order to add other actions.</p>
- *
- * @param menuManager the context menu manager
- * @since 3.5
- */
+ * Subclasses may extend in order to add other actions.
+ * </p>
+ *
+ * @param menuManager the context menu manager
+ * @since 3.5
+ */
protected void fillContextMenu(IMenuManager menuManager) {
List<?> selectedElements = list.getStructuredSelection().toList();
- Object item= null;
+ Object item = null;
for (Iterator<?> it = selectedElements.iterator(); it.hasNext();) {
- item= it.next();
+ item = it.next();
if (item instanceof ItemsListSeparator || !isHistoryElement(item)) {
return;
}
}
if (selectedElements.size() > 0) {
- removeHistoryItemAction.setText(WorkbenchMessages.FilteredItemsSelectionDialog_removeItemsFromHistoryAction);
+ removeHistoryItemAction
+ .setText(WorkbenchMessages.FilteredItemsSelectionDialog_removeItemsFromHistoryAction);
menuManager.add(removeHistoryActionContributionItem);
@@ -607,15 +573,14 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
contextMenuManager.addMenuListener(manager -> fillContextMenu(manager));
final Table table = list.getTable();
- Menu menu= contextMenuManager.createContextMenu(table);
+ Menu menu = contextMenuManager.createContextMenu(table);
table.setMenu(menu);
}
/**
* Creates an extra content area, which will be located above the details.
*
- * @param parent
- * parent to create the dialog widgets in
+ * @param parent parent to create the dialog widgets in
* @return an extra content area
*/
protected abstract Control createExtendedContentArea(Composite parent);
@@ -640,8 +605,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
pattern.getAccessible().addAccessibleListener(new AccessibleAdapter() {
@Override
public void getName(AccessibleEvent e) {
- e.result = LegacyActionTools.removeMnemonics(headerLabel
- .getText());
+ e.result = LegacyActionTools.removeMnemonics(headerLabel.getText());
}
});
gd = new GridData(GridData.FILL_HORIZONTAL);
@@ -649,25 +613,22 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
final Label listLabel = createLabels(content);
- list = new TableViewer(content, (multi ? SWT.MULTI : SWT.SINGLE)
- | SWT.BORDER | SWT.V_SCROLL | SWT.VIRTUAL);
- list.getTable().getAccessible().addAccessibleListener(
- new AccessibleAdapter() {
- @Override
- public void getName(AccessibleEvent e) {
- if (e.childID == ACC.CHILDID_SELF) {
- e.result = LegacyActionTools
- .removeMnemonics(listLabel.getText());
- }
- }
- });
+ list = new TableViewer(content, (multi ? SWT.MULTI : SWT.SINGLE) | SWT.BORDER | SWT.V_SCROLL | SWT.VIRTUAL);
+ list.getTable().getAccessible().addAccessibleListener(new AccessibleAdapter() {
+ @Override
+ public void getName(AccessibleEvent e) {
+ if (e.childID == ACC.CHILDID_SELF) {
+ e.result = LegacyActionTools.removeMnemonics(listLabel.getText());
+ }
+ }
+ });
list.setContentProvider(contentProvider);
list.setLabelProvider(getItemsListLabelProvider());
list.setInput(new Object[0]);
list.setItemCount(contentProvider.getNumberOfElements());
gd = new GridData(GridData.FILL_BOTH);
applyDialogFont(list.getTable());
- gd.heightHint= list.getTable().getItemHeight() * 15;
+ gd.heightHint = list.getTable().getItemHeight() * 15;
list.getTable().setLayoutData(gd);
createPopupMenu();
@@ -698,17 +659,14 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
if (e.keyCode == SWT.DEL) {
- List<?> selectedElements = ((StructuredSelection) list
- .getSelection()).toList();
+ List<?> selectedElements = ((StructuredSelection) list.getSelection()).toList();
Object item = null;
boolean isSelectedHistory = true;
- for (Iterator<?> it = selectedElements.iterator(); it
- .hasNext();) {
+ for (Iterator<?> it = selectedElements.iterator(); it.hasNext();) {
item = it.next();
- if (item instanceof ItemsListSeparator
- || !isHistoryElement(item)) {
+ if (item instanceof ItemsListSeparator || !isHistoryElement(item)) {
isSelectedHistory = false;
break;
}
@@ -718,8 +676,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
}
- if (e.keyCode == SWT.ARROW_UP && (e.stateMask & SWT.SHIFT) != 0
- && (e.stateMask & SWT.CTRL) != 0) {
+ if (e.keyCode == SWT.ARROW_UP && (e.stateMask & SWT.SHIFT) != 0 && (e.stateMask & SWT.CTRL) != 0) {
IStructuredSelection selection = list.getStructuredSelection();
if (selection.size() == 1) {
@@ -727,23 +684,17 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
if (element.equals(list.getElementAt(0))) {
pattern.setFocus();
}
- if (list.getElementAt(list.getTable()
- .getSelectionIndex() - 1) instanceof ItemsListSeparator)
- list.getTable().setSelection(
- list.getTable().getSelectionIndex() - 1);
+ if (list.getElementAt(list.getTable().getSelectionIndex() - 1) instanceof ItemsListSeparator)
+ list.getTable().setSelection(list.getTable().getSelectionIndex() - 1);
list.getTable().notifyListeners(SWT.Selection, new Event());
}
}
- if (e.keyCode == SWT.ARROW_DOWN
- && (e.stateMask & SWT.SHIFT) != 0
- && (e.stateMask & SWT.CTRL) != 0) {
+ if (e.keyCode == SWT.ARROW_DOWN && (e.stateMask & SWT.SHIFT) != 0 && (e.stateMask & SWT.CTRL) != 0) {
- if (list
- .getElementAt(list.getTable().getSelectionIndex() + 1) instanceof ItemsListSeparator)
- list.getTable().setSelection(
- list.getTable().getSelectionIndex() + 1);
+ if (list.getElementAt(list.getTable().getSelectionIndex() + 1) instanceof ItemsListSeparator)
+ list.getTable().setSelection(list.getTable().getSelectionIndex() + 1);
list.getTable().notifyListeners(SWT.Selection, new Event());
}
@@ -783,9 +734,9 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
}
/**
- * This method is a hook for subclasses to override default dialog behavior.
- * The <code>handleDoubleClick()</code> method handles double clicks on
- * the list of filtered elements.
+ * This method is a hook for subclasses to override default dialog behavior. The
+ * <code>handleDoubleClick()</code> method handles double clicks on the list of
+ * filtered elements.
* <p>
* Current implementation makes double-clicking on the list do the same as
* pressing <code>OK</code> button on the dialog.
@@ -795,8 +746,8 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
}
/**
- * Refreshes the details field according to the current selection in the
- * items list.
+ * Refreshes the details field according to the current selection in the items
+ * list.
*/
private void refreshDetails() {
StructuredSelection selection = getSelectedItems();
@@ -809,11 +760,8 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
details.setInput(selection.getFirstElement());
break;
default:
- details
- .setInput(NLS
- .bind(
- WorkbenchMessages.FilteredItemsSelectionDialog_nItemsSelected,
- Integer.valueOf(selection.size())));
+ details.setInput(NLS.bind(WorkbenchMessages.FilteredItemsSelectionDialog_nItemsSelected,
+ Integer.valueOf(selection.size())));
break;
}
@@ -823,31 +771,26 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
* Handle selection in the items list by updating labels of selected and
* unselected items and refresh the details field using the selection.
*
- * @param selection
- * the new selection
+ * @param selection the new selection
*/
protected void handleSelected(StructuredSelection selection) {
- IStatus status = new Status(IStatus.OK, PlatformUI.PLUGIN_ID,
- IStatus.OK, EMPTY_STRING, null);
+ IStatus status = new Status(IStatus.OK, PlatformUI.PLUGIN_ID, IStatus.OK, EMPTY_STRING, null);
Object[] lastSelection = currentSelection;
currentSelection = selection.toArray();
if (selection.isEmpty()) {
- status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID,
- IStatus.ERROR, EMPTY_STRING, null);
+ status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.ERROR, EMPTY_STRING, null);
- if (lastSelection != null
- && getListSelectionLabelDecorator() != null) {
+ if (lastSelection != null && getListSelectionLabelDecorator() != null) {
list.update(lastSelection, null);
}
currentSelection = null;
} else {
- status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID,
- IStatus.ERROR, EMPTY_STRING, null);
+ status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.ERROR, EMPTY_STRING, null);
List<?> items = selection.toList();
@@ -865,8 +808,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
tempStatus = validateItem(item);
if (tempStatus.isOK()) {
- status = new Status(IStatus.OK, PlatformUI.PLUGIN_ID,
- IStatus.OK, EMPTY_STRING, null);
+ status = new Status(IStatus.OK, PlatformUI.PLUGIN_ID, IStatus.OK, EMPTY_STRING, null);
} else {
status = tempStatus;
// if any selected element is not valid status is set to
@@ -875,8 +817,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
}
}
- if (lastSelection != null
- && getListSelectionLabelDecorator() != null) {
+ if (lastSelection != null && getListSelectionLabelDecorator() != null) {
list.update(lastSelection, null);
}
@@ -914,8 +855,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
public void refresh() {
if (list != null && !list.getTable().isDisposed()) {
- List<?> lastRefreshSelection = ((StructuredSelection) list
- .getSelection()).toList();
+ List<?> lastRefreshSelection = ((StructuredSelection) list.getSelection()).toList();
list.getTable().deselectAll();
list.setItemCount(contentProvider.getNumberOfElements());
@@ -923,10 +863,8 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
if (list.getTable().getItemCount() > 0) {
// preserve previous selection
- if (refreshWithLastSelection && lastRefreshSelection != null
- && lastRefreshSelection.size() > 0) {
- list.setSelection(new StructuredSelection(
- lastRefreshSelection));
+ if (refreshWithLastSelection && lastRefreshSelection != null && lastRefreshSelection.size() > 0) {
+ list.setSelection(new StructuredSelection(lastRefreshSelection));
} else {
refreshWithLastSelection = true;
list.getTable().setSelection(0);
@@ -952,23 +890,20 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
}
/**
- * Notifies the content provider - fires filtering of content provider
- * elements. During the filtering, a separator between history and workspace
- * matches is added.
+ * Notifies the content provider - fires filtering of content provider elements.
+ * During the filtering, a separator between history and workspace matches is
+ * added.
* <p>
* This is a long running operation and should be called in a job.
*
- * @param checkDuplicates
- * <code>true</code> if data concerning elements duplication
- * should be computed - it takes much more time than the standard
- * filtering
- * @param monitor
- * a progress monitor or <code>null</code> if no monitor is
- * available
+ * @param checkDuplicates <code>true</code> if data concerning elements
+ * duplication should be computed - it takes much more
+ * time than the standard filtering
+ * @param monitor a progress monitor or <code>null</code> if no monitor
+ * is available
*/
public void reloadCache(boolean checkDuplicates, IProgressMonitor monitor) {
- if (list != null && !list.getTable().isDisposed()
- && contentProvider != null) {
+ if (list != null && !list.getTable().isDisposed() && contentProvider != null) {
contentProvider.reloadCache(checkDuplicates, monitor);
}
}
@@ -985,8 +920,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
* Schedules progress message refresh.
*/
public void scheduleProgressMessageRefresh() {
- if (filterJob.getState() != Job.RUNNING
- && refreshProgressMessageJob.getState() != Job.RUNNING)
+ if (filterJob.getState() != Job.RUNNING && refreshProgressMessageJob.getState() != Job.RUNNING)
refreshProgressMessageJob.scheduleProgressRefresh(null);
}
@@ -1012,7 +946,9 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
}
/*
- * @see org.eclipse.ui.dialogs.SelectionStatusDialog#updateStatus(org.eclipse.core.runtime.IStatus)
+ * @see
+ * org.eclipse.ui.dialogs.SelectionStatusDialog#updateStatus(org.eclipse.core.
+ * runtime.IStatus)
*/
@Override
protected void updateStatus(IStatus status) {
@@ -1025,19 +961,17 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
*/
@Override
protected void okPressed() {
- if (status != null
- && (status.isOK() || status.getCode() == IStatus.INFO)) {
+ if (status != null && (status.isOK() || status.getCode() == IStatus.INFO)) {
super.okPressed();
}
}
/**
* Sets the initial pattern used by the filter. This text is copied into the
- * selection input on the dialog. A full selection is used in the pattern
- * input field.
+ * selection input on the dialog. A full selection is used in the pattern input
+ * field.
*
- * @param text
- * initial pattern for the filter
+ * @param text initial pattern for the filter
* @see FilteredItemsSelectionDialog#FULL_SELECTION
*/
public void setInitialPattern(String text) {
@@ -1046,15 +980,13 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Sets the initial pattern used by the filter. This text is copied into the
- * selection input on the dialog. The <code>selectionMode</code> is used
- * to choose selection type for the input field.
+ * selection input on the dialog. The <code>selectionMode</code> is used to
+ * choose selection type for the input field.
*
- * @param text
- * initial pattern for the filter
- * @param selectionMode
- * one of: {@link FilteredItemsSelectionDialog#NONE},
- * {@link FilteredItemsSelectionDialog#CARET_BEGINNING},
- * {@link FilteredItemsSelectionDialog#FULL_SELECTION}
+ * @param text initial pattern for the filter
+ * @param selectionMode one of: {@link FilteredItemsSelectionDialog#NONE},
+ * {@link FilteredItemsSelectionDialog#CARET_BEGINNING},
+ * {@link FilteredItemsSelectionDialog#FULL_SELECTION}
*/
public void setInitialPattern(String text, int selectionMode) {
this.initialPatternText = text;
@@ -1064,8 +996,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Gets initial pattern.
*
- * @return initial pattern, or <code>null</code> if initial pattern is not
- * set
+ * @return initial pattern, or <code>null</code> if initial pattern is not set
*/
protected String getInitialPattern() {
return this.initialPatternText;
@@ -1101,12 +1032,11 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
}
/**
- * Validates the item. When items on the items list are selected or
- * deselected, it validates each item in the selection and the dialog status
- * depends on all validations.
+ * Validates the item. When items on the items list are selected or deselected,
+ * it validates each item in the selection and the dialog status depends on all
+ * validations.
*
- * @param item
- * an item to be checked
+ * @param item an item to be checked
* @return status of the dialog to be set
*/
protected abstract IStatus validateItem(Object item);
@@ -1114,15 +1044,15 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Creates an instance of a filter.
*
- * @return a filter for items on the items list. Can be <code>null</code>,
- * no filtering will be applied then, causing no item to be shown in
- * the list.
+ * @return a filter for items on the items list. Can be <code>null</code>, no
+ * filtering will be applied then, causing no item to be shown in the
+ * list.
*/
protected abstract ItemsFilter createFilter();
/**
- * Applies the filter created by <code>createFilter()</code> method to the
- * items list. When new filter is different than previous one it will cause
+ * Applies the filter created by <code>createFilter()</code> method to the items
+ * list. When new filter is different than previous one it will cause
* refiltering.
*/
protected void applyFilter() {
@@ -1148,8 +1078,8 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Returns comparator to sort items inside content provider. Returned object
* will be probably created as an anonymous class. Parameters passed to the
- * <code>compare(java.lang.Object, java.lang.Object)</code> are going to
- * be the same type as the one used in the content provider.
+ * <code>compare(java.lang.Object, java.lang.Object)</code> are going to be the
+ * same type as the one used in the content provider.
*
* @return comparator to sort items content provider
*/
@@ -1158,26 +1088,23 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Fills the content provider with matching items.
*
- * @param contentProvider
- * collector to add items to.
- * {@link FilteredItemsSelectionDialog.AbstractContentProvider#add(Object, FilteredItemsSelectionDialog.ItemsFilter)}
- * only adds items that pass the given <code>itemsFilter</code>.
- * @param itemsFilter
- * the items filter
- * @param progressMonitor
- * must be used to report search progress. The state of this
- * progress monitor reflects the state of the filtering process.
+ * @param contentProvider collector to add items to.
+ * {@link FilteredItemsSelectionDialog.AbstractContentProvider#add(Object, FilteredItemsSelectionDialog.ItemsFilter)}
+ * only adds items that pass the given
+ * <code>itemsFilter</code>.
+ * @param itemsFilter the items filter
+ * @param progressMonitor must be used to report search progress. The state of
+ * this progress monitor reflects the state of the
+ * filtering process.
* @throws CoreException
*/
- protected abstract void fillContentProvider(
- AbstractContentProvider contentProvider, ItemsFilter itemsFilter,
+ protected abstract void fillContentProvider(AbstractContentProvider contentProvider, ItemsFilter itemsFilter,
IProgressMonitor progressMonitor) throws CoreException;
/**
* Removes selected items from history.
*
- * @param items
- * items to be removed
+ * @param items items to be removed
*/
private void removeSelectedItems(List<?> items) {
for (Iterator<?> iter = items.iterator(); iter.hasNext();) {
@@ -1191,8 +1118,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Removes an item from history.
*
- * @param item
- * an item to remove
+ * @param item an item to remove
* @return removed item
*/
protected Object removeHistoryItem(Object item) {
@@ -1202,8 +1128,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Adds item to history.
*
- * @param item
- * the item to be added
+ * @param item the item to be added
*/
protected void accessedHistoryItem(Object item) {
contentProvider.addHistoryElement(item);
@@ -1221,8 +1146,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Returns the history of selected elements.
*
- * @return history of selected elements, or <code>null</code> if it is not
- * set
+ * @return history of selected elements, or <code>null</code> if it is not set
*/
protected SelectionHistory getSelectionHistory() {
return this.contentProvider.getSelectionHistory();
@@ -1231,8 +1155,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Sets new history.
*
- * @param selectionHistory
- * the history
+ * @param selectionHistory the history
*/
protected void setSelectionHistory(SelectionHistory selectionHistory) {
if (this.contentProvider != null)
@@ -1242,8 +1165,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Indicates whether the given item is a history item.
*
- * @param item
- * the item to be investigated
+ * @param item the item to be investigated
* @return <code>true</code> if the given item exists in history,
* <code>false</code> otherwise
*/
@@ -1254,8 +1176,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Indicates whether the given item is a duplicate.
*
- * @param item
- * the item to be investigated
+ * @param item the item to be investigated
* @return <code>true</code> if the item is duplicate, <code>false</code>
* otherwise
*/
@@ -1266,8 +1187,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Sets separator label
*
- * @param separatorLabel
- * the label showed on separator
+ * @param separatorLabel the label showed on separator
*/
public void setSeparatorLabel(String separatorLabel) {
this.itemsListSeparator = new ItemsListSeparator(separatorLabel);
@@ -1276,12 +1196,11 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Returns name for then given object.
*
- * @param item
- * an object from the content provider. Subclasses should pay
- * attention to the passed argument. They should either only pass
- * objects of a known type (one used in content provider) or make
- * sure that passed parameter is the expected one (by type
- * checking like <code>instanceof</code> inside the method).
+ * @param item an object from the content provider. Subclasses should pay
+ * attention to the passed argument. They should either only pass
+ * objects of a known type (one used in content provider) or make
+ * sure that passed parameter is the expected one (by type checking
+ * like <code>instanceof</code> inside the method).
* @return name of the given item
*/
public abstract String getElementName(Object item);
@@ -1292,9 +1211,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
* Creates a new instance of the class.
*/
public ToggleStatusLineAction() {
- super(
- WorkbenchMessages.FilteredItemsSelectionDialog_toggleStatusAction,
- IAction.AS_CHECK_BOX);
+ super(WorkbenchMessages.FilteredItemsSelectionDialog_toggleStatusAction, IAction.AS_CHECK_BOX);
}
@Override
@@ -1309,12 +1226,12 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
* <p>
* Standard invocation scenario:
* <ol>
- * <li>filtering job (<code>FilterJob</code> class extending
- * <code>Job</code> class)</li>
- * <li>cache refresh without checking for duplicates (<code>RefreshCacheJob</code>
- * class extending <code>Job</code> class)</li>
- * <li>UI refresh (<code>RefreshJob</code> class extending
- * <code>UIJob</code> class)</li>
+ * <li>filtering job (<code>FilterJob</code> class extending <code>Job</code>
+ * class)</li>
+ * <li>cache refresh without checking for duplicates
+ * (<code>RefreshCacheJob</code> class extending <code>Job</code> class)</li>
+ * <li>UI refresh (<code>RefreshJob</code> class extending <code>UIJob</code>
+ * class)</li>
* <li>cache refresh with checking for duplicates (<cod>CacheRefreshJob</code>
* class extending <code>Job</code> class)</li>
* <li>UI refresh (<code>RefreshJob</code> class extending <code>UIJob</code>
@@ -1322,12 +1239,12 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
* </ol>
* The scenario is rather complicated, but it had to be applied, because:
* <ul>
- * <li> refreshing cache is rather a long action and cannot be run in the UI -
+ * <li>refreshing cache is rather a long action and cannot be run in the UI -
* cannot be run in a UIJob</li>
- * <li> refreshing cache checking for duplicates is twice as long as
- * refreshing cache without checking for duplicates; results of the search
- * could be displayed earlier</li>
- * <li> refreshing the UI have to be run in a UIJob</li>
+ * <li>refreshing cache checking for duplicates is twice as long as refreshing
+ * cache without checking for duplicates; results of the search could be
+ * displayed earlier</li>
+ * <li>refreshing the UI have to be run in a UIJob</li>
* </ul>
*
* @see org.eclipse.ui.dialogs.FilteredItemsSelectionDialog.FilterJob
@@ -1340,8 +1257,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
* Creates a new instance of the class.
*/
public RefreshJob() {
- super(FilteredItemsSelectionDialog.this.getParentShell()
- .getDisplay(),
+ super(FilteredItemsSelectionDialog.this.getParentShell().getDisplay(),
WorkbenchMessages.FilteredItemsSelectionDialog_refreshJob);
setSystem(true);
}
@@ -1349,15 +1265,13 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
if (monitor.isCanceled())
- return new Status(IStatus.OK, WorkbenchPlugin.PI_WORKBENCH,
- IStatus.OK, EMPTY_STRING, null);
+ return new Status(IStatus.OK, WorkbenchPlugin.PI_WORKBENCH, IStatus.OK, EMPTY_STRING, null);
if (FilteredItemsSelectionDialog.this != null) {
FilteredItemsSelectionDialog.this.refresh();
}
- return new Status(IStatus.OK, PlatformUI.PLUGIN_ID, IStatus.OK,
- EMPTY_STRING, null);
+ return new Status(IStatus.OK, PlatformUI.PLUGIN_ID, IStatus.OK, EMPTY_STRING, null);
}
}
@@ -1365,8 +1279,8 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Refreshes the progress message cyclically with 500 milliseconds delay.
* <code>RefreshProgressMessageJob</code> is strictly connected with
- * <code>GranualProgressMonitor</code> and use it to to get progress
- * message and to decide about break of cyclical refresh.
+ * <code>GranualProgressMonitor</code> and use it to to get progress message and
+ * to decide about break of cyclical refresh.
*/
private class RefreshProgressMessageJob extends UIJob {
@@ -1376,9 +1290,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
* Creates a new instance of the class.
*/
public RefreshProgressMessageJob() {
- super(
- FilteredItemsSelectionDialog.this.getParentShell()
- .getDisplay(),
+ super(FilteredItemsSelectionDialog.this.getParentShell().getDisplay(),
WorkbenchMessages.FilteredItemsSelectionDialog_progressRefreshJob);
setSystem(true);
}
@@ -1387,29 +1299,24 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
public IStatus runInUIThread(IProgressMonitor monitor) {
if (!progressLabel.isDisposed())
- progressLabel.setText(progressMonitor != null ? progressMonitor
- .getMessage() : EMPTY_STRING);
+ progressLabel.setText(progressMonitor != null ? progressMonitor.getMessage() : EMPTY_STRING);
if (progressMonitor == null || progressMonitor.isDone()) {
- return new Status(IStatus.CANCEL, PlatformUI.PLUGIN_ID,
- IStatus.CANCEL, EMPTY_STRING, null);
+ return new Status(IStatus.CANCEL, PlatformUI.PLUGIN_ID, IStatus.CANCEL, EMPTY_STRING, null);
}
// Schedule cyclical with 500 milliseconds delay
schedule(500);
- return new Status(IStatus.OK, PlatformUI.PLUGIN_ID, IStatus.OK,
- EMPTY_STRING, null);
+ return new Status(IStatus.OK, PlatformUI.PLUGIN_ID, IStatus.OK, EMPTY_STRING, null);
}
/**
* Schedule progress refresh job.
*
- * @param progressMonitor
- * used during refresh progress label
+ * @param progressMonitor used during refresh progress label
*/
- public void scheduleProgressRefresh(
- GranualProgressMonitor progressMonitor) {
+ public void scheduleProgressRefresh(GranualProgressMonitor progressMonitor) {
this.progressMonitor = progressMonitor;
// Schedule with initial delay to avoid flickering when the user
// types quickly
@@ -1433,8 +1340,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
* Creates a new instance of the class.
*/
public RefreshCacheJob() {
- super(
- WorkbenchMessages.FilteredItemsSelectionDialog_cacheRefreshJob);
+ super(WorkbenchMessages.FilteredItemsSelectionDialog_cacheRefreshJob);
setSystem(true);
}
@@ -1449,23 +1355,19 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
@Override
protected IStatus run(IProgressMonitor monitor) {
if (monitor.isCanceled()) {
- return new Status(IStatus.CANCEL, WorkbenchPlugin.PI_WORKBENCH,
- IStatus.CANCEL, EMPTY_STRING, null);
+ return new Status(IStatus.CANCEL, WorkbenchPlugin.PI_WORKBENCH, IStatus.CANCEL, EMPTY_STRING, null);
}
if (FilteredItemsSelectionDialog.this != null) {
- GranualProgressMonitor wrappedMonitor = new GranualProgressMonitor(
- monitor);
- FilteredItemsSelectionDialog.this.reloadCache(true,
- wrappedMonitor);
+ GranualProgressMonitor wrappedMonitor = new GranualProgressMonitor(monitor);
+ FilteredItemsSelectionDialog.this.reloadCache(true, wrappedMonitor);
}
if (!monitor.isCanceled()) {
refreshJob.schedule();
}
- return new Status(IStatus.OK, PlatformUI.PLUGIN_ID, IStatus.OK,
- EMPTY_STRING, null);
+ return new Status(IStatus.OK, PlatformUI.PLUGIN_ID, IStatus.OK, EMPTY_STRING, null);
}
@@ -1483,8 +1385,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
* Creates a new instance of the class.
*/
public RemoveHistoryItemAction() {
- super(
- WorkbenchMessages.FilteredItemsSelectionDialog_removeItemsFromHistoryAction);
+ super(WorkbenchMessages.FilteredItemsSelectionDialog_removeItemsFromHistoryAction);
}
@Override
@@ -1509,13 +1410,12 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Creates a new instance of the class.
*
- * @param provider
- * the label provider for all items, not <code>null</code>
- * @param selectionDecorator
- * the decorator for selected items, can be <code>null</code>
+ * @param provider the label provider for all items, not
+ * <code>null</code>
+ * @param selectionDecorator the decorator for selected items, can be
+ * <code>null</code>
*/
- public ItemsListLabelProvider(ILabelProvider provider,
- ILabelDecorator selectionDecorator) {
+ public ItemsListLabelProvider(ILabelProvider provider, ILabelDecorator selectionDecorator) {
Assert.isNotNull(provider);
this.provider = provider;
this.selectionDecorator = selectionDecorator;
@@ -1532,8 +1432,8 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Sets new selection decorator.
*
- * @param newSelectionDecorator
- * new label decorator for selected items in the list
+ * @param newSelectionDecorator new label decorator for selected items in the
+ * list
*/
public void setSelectionDecorator(ILabelDecorator newSelectionDecorator) {
if (selectionDecorator != null) {
@@ -1560,9 +1460,8 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Sets new label provider.
*
- * @param newProvider
- * new label provider for items in the list, not
- * <code>null</code>
+ * @param newProvider new label provider for items in the list, not
+ * <code>null</code>
*/
public void setProvider(ILabelProvider newProvider) {
Assert.isNotNull(newProvider);
@@ -1577,8 +1476,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
private Image getImage(Object element) {
if (element instanceof ItemsListSeparator) {
- return WorkbenchImages
- .getImage(IWorkbenchGraphicConstants.IMG_OBJ_SEPARATOR);
+ return WorkbenchImages.getImage(IWorkbenchGraphicConstants.IMG_OBJ_SEPARATOR);
}
return provider.getImage(element);
@@ -1622,11 +1520,9 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
public void update(ViewerCell cell) {
Object element = cell.getElement();
- if (!(element instanceof ItemsListSeparator)
- && provider instanceof IStyledLabelProvider) {
+ if (!(element instanceof ItemsListSeparator) && provider instanceof IStyledLabelProvider) {
IStyledLabelProvider styledLabelProvider = (IStyledLabelProvider) provider;
- StyledString styledString = getStyledText(element,
- styledLabelProvider);
+ StyledString styledString = getStyledText(element, styledLabelProvider);
cell.setText(styledString.getString());
cell.setStyleRanges(styledString.getStyleRanges());
@@ -1647,8 +1543,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
int borderWidth = list.getTable().computeTrim(0, 0, 0, 0).width;
- int imageWidth = WorkbenchImages.getImage(
- IWorkbenchGraphicConstants.IMG_OBJ_SEPARATOR).getBounds().width;
+ int imageWidth = WorkbenchImages.getImage(IWorkbenchGraphicConstants.IMG_OBJ_SEPARATOR).getBounds().width;
int width = rect.width - borderWidth - imageWidth;
@@ -1696,8 +1591,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
if (provider.isLabelProperty(element, property)) {
return true;
}
- if (selectionDecorator != null
- && selectionDecorator.isLabelProperty(element, property)) {
+ if (selectionDecorator != null && selectionDecorator.isLabelProperty(element, property)) {
return true;
}
return false;
@@ -1720,8 +1614,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
private Color getForeground(Object element) {
if (element instanceof ItemsListSeparator) {
- return Display.getCurrent().getSystemColor(
- SWT.COLOR_WIDGET_NORMAL_SHADOW);
+ return Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
}
if (provider instanceof IColorProvider) {
return ((IColorProvider) provider).getForeground(element);
@@ -1748,8 +1641,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
}
/**
- * Used in ItemsListContentProvider, separates history and non-history
- * items.
+ * Used in ItemsListContentProvider, separates history and non-history items.
*/
private static class ItemsListSeparator {
@@ -1758,8 +1650,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Creates a new instance of the class.
*
- * @param name
- * the name of the separator
+ * @param name the name of the separator
*/
public ItemsListSeparator(String name) {
this.name = name;
@@ -1776,10 +1667,10 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
}
/**
- * GranualProgressMonitor is used for monitoring progress of filtering
- * process. It is used by <code>RefreshProgressMessageJob</code> to
- * refresh progress message. State of this monitor illustrates state of
- * filtering or cache refreshing process.
+ * GranualProgressMonitor is used for monitoring progress of filtering process.
+ * It is used by <code>RefreshProgressMessageJob</code> to refresh progress
+ * message. State of this monitor illustrates state of filtering or cache
+ * refreshing process.
*
*/
private class GranualProgressMonitor extends ProgressMonitorWrapper {
@@ -1797,8 +1688,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Creates instance of <code>GranualProgressMonitor</code>.
*
- * @param monitor
- * progress to be wrapped
+ * @param monitor progress to be wrapped
*/
public GranualProgressMonitor(IProgressMonitor monitor) {
super(monitor);
@@ -1868,20 +1758,14 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
message = subName == null ? "" : subName; //$NON-NLS-1$
} else {
message = subName == null ? name
- : NLS
- .bind(
- WorkbenchMessages.FilteredItemsSelectionDialog_subtaskProgressMessage,
- new Object[] { name, subName });
+ : NLS.bind(WorkbenchMessages.FilteredItemsSelectionDialog_subtaskProgressMessage,
+ new Object[] { name, subName });
}
if (totalWork == 0)
return message;
- return NLS
- .bind(
- WorkbenchMessages.FilteredItemsSelectionDialog_taskProgressMessage,
- new Object[] {
- message,
- Integer.valueOf((int) ((worked * 100) / totalWork)) });
+ return NLS.bind(WorkbenchMessages.FilteredItemsSelectionDialog_taskProgressMessage,
+ new Object[] { message, Integer.valueOf((int) ((worked * 100) / totalWork)) });
}
@@ -1916,8 +1800,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
contentProvider.addHistoryItems(itemsFilter);
- if (!(lastCompletedFilter != null && lastCompletedFilter
- .isSubFilter(this.itemsFilter)))
+ if (!(lastCompletedFilter != null && lastCompletedFilter.isSubFilter(this.itemsFilter)))
contentProvider.refresh();
filterJob.schedule();
@@ -1928,16 +1811,16 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
}
/**
- * Filters items in indicated set and history. During filtering, it
- * refreshes the dialog (progress monitor and elements list).
+ * Filters items in indicated set and history. During filtering, it refreshes
+ * the dialog (progress monitor and elements list).
*
- * Depending on the filter, <code>FilterJob</code> decides which kind of
- * search will be run inside <code>filterContent</code>. If the last
- * filtering is done (last completed filter), is not null, and the new
- * filter is a sub-filter ({@link FilteredItemsSelectionDialog.ItemsFilter#isSubFilter(FilteredItemsSelectionDialog.ItemsFilter)})
- * of the last, then <code>FilterJob</code> only filters in the cache. If
- * it is the first filtering or the new filter isn't a sub-filter of the
- * last one, a full search is run.
+ * Depending on the filter, <code>FilterJob</code> decides which kind of search
+ * will be run inside <code>filterContent</code>. If the last filtering is done
+ * (last completed filter), is not null, and the new filter is a sub-filter
+ * ({@link FilteredItemsSelectionDialog.ItemsFilter#isSubFilter(FilteredItemsSelectionDialog.ItemsFilter)})
+ * of the last, then <code>FilterJob</code> only filters in the cache. If it is
+ * the first filtering or the new filter isn't a sub-filter of the last one, a
+ * full search is run.
*/
private class FilterJob extends Job {
@@ -1964,8 +1847,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
* Executes job using the given filtering progress monitor. A hook for
* subclasses.
*
- * @param monitor
- * progress monitor
+ * @param monitor progress monitor
* @return result of the execution
*/
protected IStatus doRun(GranualProgressMonitor monitor) {
@@ -1973,12 +1855,8 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
internalRun(monitor);
} catch (CoreException e) {
cancel();
- return new Status(
- IStatus.ERROR,
- PlatformUI.PLUGIN_ID,
- IStatus.ERROR,
- WorkbenchMessages.FilteredItemsSelectionDialog_jobError,
- e);
+ return new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.ERROR,
+ WorkbenchMessages.FilteredItemsSelectionDialog_jobError, e);
}
return Status.OK_STATUS;
}
@@ -1989,8 +1867,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
* @param monitor
* @throws CoreException
*/
- private void internalRun(GranualProgressMonitor monitor)
- throws CoreException {
+ private void internalRun(GranualProgressMonitor monitor) throws CoreException {
try {
if (monitor.isCanceled())
return;
@@ -2013,21 +1890,15 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Filters items.
*
- * @param monitor
- * for monitoring progress
+ * @param monitor for monitoring progress
* @throws CoreException
*/
- protected void filterContent(GranualProgressMonitor monitor)
- throws CoreException {
+ protected void filterContent(GranualProgressMonitor monitor) throws CoreException {
- if (lastCompletedFilter != null
- && lastCompletedFilter.isSubFilter(this.itemsFilter)) {
+ if (lastCompletedFilter != null && lastCompletedFilter.isSubFilter(this.itemsFilter)) {
int length = lastCompletedResult.size() / 500;
- monitor
- .beginTask(
- WorkbenchMessages.FilteredItemsSelectionDialog_cacheSearchJob_taskName,
- length);
+ monitor.beginTask(WorkbenchMessages.FilteredItemsSelectionDialog_cacheSearchJob_taskName, length);
for (int pos = 0; pos < lastCompletedResult.size(); pos++) {
@@ -2047,8 +1918,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
lastCompletedResult = null;
SubMonitor subMonitor = SubMonitor.convert(monitor,
- WorkbenchMessages.FilteredItemsSelectionDialog_searchJob_taskName,
- 100);
+ WorkbenchMessages.FilteredItemsSelectionDialog_searchJob_taskName, 100);
fillContentProvider(contentProvider, itemsFilter, subMonitor.split(95));
@@ -2064,9 +1934,9 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
}
/**
- * History stores a list of key, object pairs. The list is bounded at a
- * certain size. If the list exceeds this size the oldest element is removed
- * from the list. An element can be added/renewed with a call to
+ * History stores a list of key, object pairs. The list is bounded at a certain
+ * size. If the list exceeds this size the oldest element is removed from the
+ * list. An element can be added/renewed with a call to
* <code>accessed(Object)</code>.
* <p>
* The history can be stored to/loaded from an XML file.
@@ -2117,8 +1987,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Adds object to history.
*
- * @param object
- * the item to be added to the history
+ * @param object the item to be added to the history
*/
public synchronized void accessed(Object object) {
historyList.remove(object);
@@ -2128,10 +1997,9 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Returns <code>true</code> if history contains object.
*
- * @param object
- * the item for which check will be executed
- * @return <code>true</code> if history contains object
- * <code>false</code> in other way
+ * @param object the item for which check will be executed
+ * @return <code>true</code> if history contains object <code>false</code> in
+ * other way
*/
public synchronized boolean contains(Object object) {
return historyList.contains(object);
@@ -2149,10 +2017,8 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Remove element from history.
*
- * @param element
- * to remove form the history
- * @return <code>true</code> if this list contained the specified
- * element
+ * @param element to remove form the history
+ * @return <code>true</code> if this list contained the specified element
*/
public synchronized boolean remove(Object element) {
return historyList.remove(element);
@@ -2161,20 +2027,17 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Load history elements from memento.
*
- * @param memento
- * memento from which the history will be retrieved
+ * @param memento memento from which the history will be retrieved
*/
public void load(IMemento memento) {
- XMLMemento historyMemento = (XMLMemento) memento
- .getChild(rootNodeName);
+ XMLMemento historyMemento = (XMLMemento) memento.getChild(rootNodeName);
if (historyMemento == null) {
return;
}
- IMemento[] mementoElements = historyMemento
- .getChildren(infoNodeName);
+ IMemento[] mementoElements = historyMemento.getChildren(infoNodeName);
for (IMemento mementoElement : mementoElements) {
Object object = restoreItemFromMemento(mementoElement);
if (object != null) {
@@ -2186,8 +2049,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Save history elements to memento.
*
- * @param memento
- * memento to which the history will be added
+ * @param memento memento to which the history will be added
*/
public void save(IMemento memento) {
@@ -2195,8 +2057,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
Object[] items = getHistoryItems();
for (Object item : items) {
- IMemento elementMemento = historyMemento
- .createChild(infoNodeName);
+ IMemento elementMemento = historyMemento.createChild(infoNodeName);
storeItemToMemento(item, elementMemento);
}
@@ -2214,8 +2075,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Creates an object using given memento.
*
- * @param memento
- * memento used for creating new object
+ * @param memento memento used for creating new object
*
* @return the restored object
*/
@@ -2224,18 +2084,16 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Store object in <code>IMemento</code>.
*
- * @param item
- * the item to store
- * @param memento
- * the memento to store to
+ * @param item the item to store
+ * @param memento the memento to store to
*/
protected abstract void storeItemToMemento(Object item, IMemento memento);
}
/**
- * Filters elements using SearchPattern by comparing the names of items with
- * the filter pattern.
+ * Filters elements using SearchPattern by comparing the names of items with the
+ * filter pattern.
*/
protected abstract class ItemsFilter {
@@ -2251,8 +2109,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Creates new instance of ItemsFilter.
*
- * @param searchPattern
- * the pattern to be used when filtering
+ * @param searchPattern the pattern to be used when filtering
*/
public ItemsFilter(SearchPattern searchPattern) {
patternMatcher = searchPattern;
@@ -2265,20 +2122,18 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Check if the given filter is a sub-filter of this filter. The default
- * implementation checks if the <code>SearchPattern</code> from the
- * given filter is a sub-pattern of the one from this filter.
+ * implementation checks if the <code>SearchPattern</code> from the given filter
+ * is a sub-pattern of the one from this filter.
* <p>
* <i>WARNING: This method is <b>not</b> defined in reading order, i.e.
- * <code>a.isSubFilter(b)</code> is <code>true</code> iff
- * <code>b</code> is a sub-filter of <code>a</code>, and not
- * vice-versa. </i>
+ * <code>a.isSubFilter(b)</code> is <code>true</code> iff <code>b</code> is a
+ * sub-filter of <code>a</code>, and not vice-versa. </i>
* </p>
*
- * @param filter
- * the filter to be checked, or <code>null</code>
- * @return <code>true</code> if the given filter is sub-filter of this
- * filter, <code>false</code> if the given filter isn't a
- * sub-filter or is <code>null</code>
+ * @param filter the filter to be checked, or <code>null</code>
+ * @return <code>true</code> if the given filter is sub-filter of this filter,
+ * <code>false</code> if the given filter isn't a sub-filter or is
+ * <code>null</code>
*
* @see org.eclipse.ui.dialogs.SearchPattern#isSubPattern(org.eclipse.ui.dialogs.SearchPattern)
*/
@@ -2290,21 +2145,19 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
}
/**
- * Checks whether the provided filter is equal to the current filter.
- * The default implementation checks if <code>SearchPattern</code>
- * from current filter is equal to the one from provided filter.
+ * Checks whether the provided filter is equal to the current filter. The
+ * default implementation checks if <code>SearchPattern</code> from current
+ * filter is equal to the one from provided filter.
*
- * @param filter
- * filter to be checked, or <code>null</code>
- * @return <code>true</code> if the given filter is equal to current
- * filter, <code>false</code> if given filter isn't equal to
- * current one or if it is <code>null</code>
+ * @param filter filter to be checked, or <code>null</code>
+ * @return <code>true</code> if the given filter is equal to current filter,
+ * <code>false</code> if given filter isn't equal to current one or if
+ * it is <code>null</code>
*
* @see org.eclipse.ui.dialogs.SearchPattern#equalsPattern(org.eclipse.ui.dialogs.SearchPattern)
*/
public boolean equalsFilter(ItemsFilter filter) {
- if (filter != null
- && filter.patternMatcher.equalsPattern(this.patternMatcher)) {
+ if (filter != null && filter.patternMatcher.equalsPattern(this.patternMatcher)) {
return true;
}
return false;
@@ -2336,8 +2189,8 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
*
* @return an implementation-specific match rule
*
- * @see SearchPattern#getMatchRule() for match rules returned by the
- * default implementation
+ * @see SearchPattern#getMatchRule() for match rules returned by the default
+ * implementation
*/
public int getMatchRule() {
return patternMatcher.getMatchRule();
@@ -2346,8 +2199,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Matches text with filter.
*
- * @param text
- * the text to match with the filter
+ * @param text the text to match with the filter
* @return <code>true</code> if text matches with filter pattern,
* <code>false</code> otherwise
*/
@@ -2356,14 +2208,13 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
}
/**
- * General method for matching raw name pattern. Checks whether current
- * pattern is prefix of name provided item.
+ * General method for matching raw name pattern. Checks whether current pattern
+ * is prefix of name provided item.
*
- * @param item
- * item to check
- * @return <code>true</code> if current pattern is a prefix of name
- * provided item, <code>false</code> if item's name is shorter
- * than prefix or sequences of characters don't match.
+ * @param item item to check
+ * @return <code>true</code> if current pattern is a prefix of name provided
+ * item, <code>false</code> if item's name is shorter than prefix or
+ * sequences of characters don't match.
*/
public boolean matchesRawNamePattern(Object item) {
String prefix = patternMatcher.getPattern();
@@ -2378,8 +2229,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
return false;
}
for (int i = prefixLength - 1; i >= 0; i--) {
- if (Character.toLowerCase(prefix.charAt(i)) != Character
- .toLowerCase(text.charAt(i)))
+ if (Character.toLowerCase(prefix.charAt(i)) != Character.toLowerCase(text.charAt(i)))
return false;
}
return true;
@@ -2399,8 +2249,8 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
* removed.
*
* @param item
- * @return <code>true</code> if item is consistent, <code>false</code>
- * if item is inconsistent
+ * @return <code>true</code> if item is consistent, <code>false</code> if item
+ * is inconsistent
*/
public abstract boolean isConsistentItem(Object item);
@@ -2412,13 +2262,11 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
*/
protected abstract class AbstractContentProvider {
/**
- * Adds the item to the content provider iff the filter matches the
- * item. Otherwise does nothing.
+ * Adds the item to the content provider iff the filter matches the item.
+ * Otherwise does nothing.
*
- * @param item
- * the item to add
- * @param itemsFilter
- * the filter
+ * @param item the item to add
+ * @param itemsFilter the filter
*
* @see FilteredItemsSelectionDialog.ItemsFilter#matchItem(Object)
*/
@@ -2429,20 +2277,19 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
* Collects filtered elements. Contains one synchronized, sorted set for
* collecting filtered elements. All collected elements are sorted using
* comparator. Comparator is returned by getElementComparator() method.
- * Implementation of <code>ItemsFilter</code> is used to filter elements.
- * The key function of filter used in to filtering is
+ * Implementation of <code>ItemsFilter</code> is used to filter elements. The
+ * key function of filter used in to filtering is
* <code>matchElement(Object item)</code>.
* <p>
- * The <code>ContentProvider</code> class also provides item filtering
- * methods. The filtering has been moved from the standard TableView
+ * The <code>ContentProvider</code> class also provides item filtering methods.
+ * The filtering has been moved from the standard TableView
* <code>getFilteredItems()</code> method to content provider, because
- * <code>ILazyContentProvider</code> and virtual tables are used. This
- * class is responsible for adding a separator below history items and
- * marking each items as duplicate if its name repeats more than once on the
- * filtered list.
+ * <code>ILazyContentProvider</code> and virtual tables are used. This class is
+ * responsible for adding a separator below history items and marking each items
+ * as duplicate if its name repeats more than once on the filtered list.
*/
- private class ContentProvider extends AbstractContentProvider implements
- IStructuredContentProvider, ILazyContentProvider {
+ private class ContentProvider extends AbstractContentProvider
+ implements IStructuredContentProvider, ILazyContentProvider {
private SelectionHistory selectionHistory;
@@ -2481,13 +2328,12 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
private List<Object> lastSortedItems;
/**
- * Used for <code>getFilteredItems()</code> method canceling (when the
- * job that invoked the method was canceled).
+ * Used for <code>getFilteredItems()</code> method canceling (when the job that
+ * invoked the method was canceled).
* <p>
- * Method canceling could be based (only) on monitor canceling
- * unfortunately sometimes the method <code>getFilteredElements()</code>
- * could be run with a null monitor, the <code>reset</code> flag have
- * to be left intact.
+ * Method canceling could be based (only) on monitor canceling unfortunately
+ * sometimes the method <code>getFilteredElements()</code> could be run with a
+ * null monitor, the <code>reset</code> flag have to be left intact.
*/
private boolean reset;
@@ -2498,15 +2344,13 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
this.items = Collections.synchronizedSet(new HashSet<>(2048));
this.duplicates = Collections.synchronizedSet(new HashSet<>(256));
this.lastFilteredItems = new ArrayList<>();
- this.lastSortedItems = Collections.synchronizedList(new ArrayList<>(
- 2048));
+ this.lastSortedItems = Collections.synchronizedList(new ArrayList<>(2048));
}
/**
* Sets selection history.
*
- * @param selectionHistory
- * The selectionHistory to set.
+ * @param selectionHistory The selectionHistory to set.
*/
public void setSelectionHistory(SelectionHistory selectionHistory) {
this.selectionHistory = selectionHistory;
@@ -2589,8 +2433,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Removes items from history and refreshes the view.
*
- * @param item
- * to remove
+ * @param item to remove
*
* @return removed item
*/
@@ -2612,8 +2455,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Adds item to history and refresh view.
*
- * @param item
- * to add
+ * @param item to add
*/
public void addHistoryElement(Object item) {
if (this.selectionHistory != null)
@@ -2643,11 +2485,9 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Sets/unsets given item as duplicate.
*
- * @param item
- * item to change
+ * @param item item to change
*
- * @param isDuplicate
- * duplicate flag
+ * @param isDuplicate duplicate flag
*/
public void setDuplicateElement(Object item, boolean isDuplicate) {
if (this.items.contains(item)) {
@@ -2661,8 +2501,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Indicates whether given item is a duplicate.
*
- * @param item
- * item to check
+ * @param item item to check
* @return <code>true</code> if item is duplicate
*/
public boolean isDuplicateElement(Object item) {
@@ -2672,8 +2511,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Load history from memento.
*
- * @param memento
- * memento from which the history will be retrieved
+ * @param memento memento from which the history will be retrieved
*/
public void loadHistory(IMemento memento) {
if (this.selectionHistory != null) {
@@ -2684,8 +2522,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Save history to memento.
*
- * @param memento
- * memento to which the history will be added
+ * @param memento memento to which the history will be added
*/
public void saveHistory(IMemento memento) {
if (this.selectionHistory != null) {
@@ -2715,8 +2552,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
* @param itemsFilter
*/
public void rememberResult(ItemsFilter itemsFilter) {
- List<Object> itemsList = Collections.synchronizedList(Arrays
- .asList(getSortedItems()));
+ List<Object> itemsList = Collections.synchronizedList(Arrays.asList(getSortedItems()));
// synchronization
if (itemsFilter == filter) {
lastCompletedFilter = itemsFilter;
@@ -2745,24 +2581,21 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
@Override
public void updateElement(int index) {
- FilteredItemsSelectionDialog.this.list.replace((lastFilteredItems
- .size() > index) ? lastFilteredItems.get(index) : null,
- index);
+ FilteredItemsSelectionDialog.this.list
+ .replace((lastFilteredItems.size() > index) ? lastFilteredItems.get(index) : null, index);
}
/**
- * Main method responsible for getting the filtered items and checking
- * for duplicates. It is based on the
+ * Main method responsible for getting the filtered items and checking for
+ * duplicates. It is based on the
* {@link FilteredItemsSelectionDialog.ContentProvider#getFilteredItems(Object, IProgressMonitor)}.
*
- * @param checkDuplicates
- * <code>true</code> if data concerning elements
- * duplication should be computed - it takes much more time
- * than standard filtering
+ * @param checkDuplicates <code>true</code> if data concerning elements
+ * duplication should be computed - it takes much more
+ * time than standard filtering
*
- * @param monitor
- * progress monitor
+ * @param monitor progress monitor
*/
public void reloadCache(boolean checkDuplicates, IProgressMonitor monitor) {
reset = false;
@@ -2818,23 +2651,18 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
* Returns an array of items filtered using the provided
* <code>ViewerFilter</code>s with a separator added.
*
- * @param parent
- * the parent
- * @param monitor
- * progress monitor, can be <code>null</code>
+ * @param parent the parent
+ * @param monitor progress monitor, can be <code>null</code>
* @return an array of filtered items
*/
- protected Object[] getFilteredItems(Object parent,
- IProgressMonitor monitor) {
+ protected Object[] getFilteredItems(Object parent, IProgressMonitor monitor) {
int ticks = 100;
if (monitor == null) {
monitor = new NullProgressMonitor();
}
- monitor
- .beginTask(
- WorkbenchMessages.FilteredItemsSelectionDialog_cacheRefreshJob_getFilteredElements,
- ticks);
+ monitor.beginTask(WorkbenchMessages.FilteredItemsSelectionDialog_cacheRefreshJob_getFilteredElements,
+ ticks);
if (filters != null) {
ticks /= (filters.size() + 2);
} else {
@@ -2911,13 +2739,12 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
}
/**
- * Adds a filter to this content provider. For an example usage of such
- * filters look at the project <code>org.eclipse.ui.ide</code>, class
+ * Adds a filter to this content provider. For an example usage of such filters
+ * look at the project <code>org.eclipse.ui.ide</code>, class
* <code>org.eclipse.ui.dialogs.FilteredResourcesSelectionDialog.CustomWorkingSetFilter</code>.
*
*
- * @param filter
- * the filter to be added
+ * @param filter the filter to be added
*/
public void addFilter(ViewerFilter filter) {
if (filters == null) {
@@ -2932,29 +2759,27 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
}
/**
- * DetailsContentViewer objects are wrappers for labels.
- * DetailsContentViewer provides means to change label's image and text when
- * the attached LabelProvider is updated.
+ * DetailsContentViewer objects are wrappers for labels. DetailsContentViewer
+ * provides means to change label's image and text when the attached
+ * LabelProvider is updated.
*/
private class DetailsContentViewer extends ContentViewer {
private CLabel label;
/**
- * Unfortunately, it was impossible to delegate displaying border to
- * label. The <code>ViewForm</code> is used because
- * <code>CLabel</code> displays shadow when border is present.
+ * Unfortunately, it was impossible to delegate displaying border to label. The
+ * <code>ViewForm</code> is used because <code>CLabel</code> displays shadow
+ * when border is present.
*/
private ViewForm viewForm;
/**
- * Constructs a new instance of this class given its parent and a style
- * value describing its behavior and appearance.
+ * Constructs a new instance of this class given its parent and a style value
+ * describing its behavior and appearance.
*
- * @param parent
- * the parent component
- * @param style
- * SWT style bits
+ * @param parent the parent component
+ * @param style SWT style bits
*/
public DetailsContentViewer(Composite parent, int style) {
viewForm = new ViewForm(parent, style);
@@ -2970,8 +2795,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Shows/hides the content viewer.
*
- * @param visible
- * if the content viewer should be visible.
+ * @param visible if the content viewer should be visible.
*/
public void setVisible(boolean visible) {
viewForm.setVisible(visible);
@@ -2995,8 +2819,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
}
@Override
- protected void handleLabelProviderChanged(
- LabelProviderChangedEvent event) {
+ protected void handleLabelProviderChanged(LabelProviderChangedEvent event) {
if (event != null) {
refresh(event.getElements());
}
@@ -3018,8 +2841,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
Object input = this.getInput();
if (input != null) {
ILabelProvider labelProvider = (ILabelProvider) getLabelProvider();
- doRefresh(labelProvider.getText(input), labelProvider
- .getImage(input));
+ doRefresh(labelProvider.getText(input), labelProvider.getImage(input));
} else {
doRefresh(null, null);
}
@@ -3028,13 +2850,11 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Sets the given text and image to the label.
*
- * @param text
- * the new text or null
- * @param image
- * the new image
+ * @param text the new text or null
+ * @param image the new image
*/
private void doRefresh(String text, Image image) {
- if ( text != null ) {
+ if (text != null) {
text = LegacyActionTools.escapeMnemonics(text);
}
label.setText(text);
@@ -3049,8 +2869,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
/**
* Refreshes the label if currently chosen element is on the list.
*
- * @param objs
- * list of changed object
+ * @param objs list of changed object
*/
private void refresh(Object[] objs) {
if (objs == null || getInput() == null) {
@@ -3073,7 +2892,7 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
final String filterPattern;
final Comparator<Object> itemsComparator;
- HistoryComparator(){
+ HistoryComparator() {
itemsComparator = getItemsComparator();
if (currentlyCompletingFilter != null) {
filterPattern = currentlyCompletingFilter.getPattern();
@@ -3117,15 +2936,14 @@ public abstract class FilteredItemsSelectionDialog extends SelectionStatusDialog
}
-
/**
- * Get the control where the search pattern is entered. Any filtering should
- * be done using an {@link ItemsFilter}. This control should only be
- * accessed for listeners that wish to handle events that do not affect
- * filtering such as custom traversal.
+ * Get the control where the search pattern is entered. Any filtering should be
+ * done using an {@link ItemsFilter}. This control should only be accessed for
+ * listeners that wish to handle events that do not affect filtering such as
+ * custom traversal.
*
- * @return Control or <code>null</code> if the pattern control has not
- * been created.
+ * @return Control or <code>null</code> if the pattern control has not been
+ * created.
*/
public Control getPatternControl() {
return pattern;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FilteredList.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FilteredList.java
index e601758e941..5d44493e99d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FilteredList.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FilteredList.java
@@ -55,25 +55,19 @@ public class FilteredList extends Composite {
/**
* Sets the filter.
*
- * @param pattern
- * the filter pattern.
- * @param ignoreCase
- * a flag indicating whether pattern matching is case
- * insensitive or not.
- * @param ignoreWildCards
- * a flag indicating whether wildcard characters are
- * interpreted or not.
+ * @param pattern the filter pattern.
+ * @param ignoreCase a flag indicating whether pattern matching is case
+ * insensitive or not.
+ * @param ignoreWildCards a flag indicating whether wildcard characters are
+ * interpreted or not.
*/
- void setFilter(String pattern, boolean ignoreCase,
- boolean ignoreWildCards);
+ void setFilter(String pattern, boolean ignoreCase, boolean ignoreWildCards);
/**
- * @param element
- * The element to test against.
+ * @param element The element to test against.
* @return <code>true</code> if the object matches the pattern,
- * <code>false</code> otherwise. <code>setFilter()</code>
- * must have been called at least once prior to a call to this
- * method.
+ * <code>false</code> otherwise. <code>setFilter()</code> must have been
+ * called at least once prior to a call to this method.
*/
boolean match(Object element);
}
@@ -82,10 +76,8 @@ public class FilteredList extends Composite {
private StringMatcher fMatcher;
@Override
- public void setFilter(String pattern, boolean ignoreCase,
- boolean ignoreWildCards) {
- fMatcher = new StringMatcher(pattern + '*', ignoreCase,
- ignoreWildCards);
+ public void setFilter(String pattern, boolean ignoreCase, boolean ignoreWildCards) {
+ fMatcher = new StringMatcher(pattern + '*', ignoreCase, ignoreWildCards);
}
@Override
@@ -195,12 +187,10 @@ public class FilteredList extends Composite {
Label rightLabel = (Label) right;
int value;
if (fComparator == null) {
- value = labelIgnoreCase ? leftLabel.string
- .compareToIgnoreCase(rightLabel.string)
+ value = labelIgnoreCase ? leftLabel.string.compareToIgnoreCase(rightLabel.string)
: leftLabel.string.compareTo(rightLabel.string);
} else {
- value = fComparator
- .compare(leftLabel.string, rightLabel.string);
+ value = fComparator.compare(leftLabel.string, rightLabel.string);
}
if (value != 0) {
return value;
@@ -211,8 +201,7 @@ public class FilteredList extends Composite {
} else if (rightLabel.image == null) {
return +1;
} else {
- return fImages.indexOf(leftLabel.image)
- - fImages.indexOf(rightLabel.image);
+ return fImages.indexOf(leftLabel.image) - fImages.indexOf(rightLabel.image);
}
}
}
@@ -220,22 +209,16 @@ public class FilteredList extends Composite {
/**
* Constructs a new filtered list.
*
- * @param parent
- * the parent composite
- * @param style
- * the widget style
- * @param labelProvider
- * the label renderer
- * @param ignoreCase
- * specifies whether sorting and folding is case sensitive
- * @param allowDuplicates
- * specifies whether folding of duplicates is desired
- * @param matchEmptyString
- * specifies whether empty filter strings should filter
- * everything or nothing
+ * @param parent the parent composite
+ * @param style the widget style
+ * @param labelProvider the label renderer
+ * @param ignoreCase specifies whether sorting and folding is case
+ * sensitive
+ * @param allowDuplicates specifies whether folding of duplicates is desired
+ * @param matchEmptyString specifies whether empty filter strings should filter
+ * everything or nothing
*/
- public FilteredList(Composite parent, int style,
- ILabelProvider labelProvider, boolean ignoreCase,
+ public FilteredList(Composite parent, int style, ILabelProvider labelProvider, boolean ignoreCase,
boolean allowDuplicates, boolean matchEmptyString) {
super(parent, SWT.NONE);
GridLayout layout = new GridLayout();
@@ -261,8 +244,7 @@ public class FilteredList extends Composite {
/**
* Sets the list of elements.
*
- * @param elements
- * the elements to be shown in the list.
+ * @param elements the elements to be shown in the list.
*/
public void setElements(Object[] elements) {
if (elements == null) {
@@ -294,8 +276,8 @@ public class FilteredList extends Composite {
/**
* Tests if the list (before folding and filtering) is empty.
*
- * @return returns <code>true</code> if the list is empty,
- * <code>false</code> otherwise.
+ * @return returns <code>true</code> if the list is empty, <code>false</code>
+ * otherwise.
*/
public boolean isEmpty() {
return (fElements == null) || (fElements.length == 0);
@@ -324,8 +306,7 @@ public class FilteredList extends Composite {
/**
* Adds a selection listener to the list.
*
- * @param listener
- * the selection listener to be added.
+ * @param listener the selection listener to be added.
*/
public void addSelectionListener(SelectionListener listener) {
fList.addSelectionListener(listener);
@@ -334,8 +315,7 @@ public class FilteredList extends Composite {
/**
* Removes a selection listener from the list.
*
- * @param listener
- * the selection listener to be removed.
+ * @param listener the selection listener to be removed.
*/
public void removeSelectionListener(SelectionListener listener) {
fList.removeSelectionListener(listener);
@@ -344,8 +324,7 @@ public class FilteredList extends Composite {
/**
* Sets the selection of the list. Empty or null array removes selection.
*
- * @param selection
- * an array of indices specifying the selection.
+ * @param selection an array of indices specifying the selection.
*/
public void setSelection(int[] selection) {
if (selection == null || selection.length == 0) {
@@ -386,8 +365,7 @@ public class FilteredList extends Composite {
/**
* Sets the selection of the list. Empty or null array removes selection.
*
- * @param elements
- * the array of elements to be selected.
+ * @param elements the array of elements to be selected.
*/
public void setSelection(Object[] elements) {
if (elements == null || elements.length == 0) {
@@ -402,8 +380,7 @@ public class FilteredList extends Composite {
for (int i = 0; i != elements.length; i++) {
int j;
for (j = 0; j != fFoldedCount; j++) {
- int max = (j == fFoldedCount - 1) ? fFilteredCount
- : fFoldedIndices[j + 1];
+ int max = (j == fFoldedCount - 1) ? fFilteredCount : fFoldedIndices[j + 1];
int l;
for (l = fFoldedIndices[j]; l != max; l++) {
// found matching element?
@@ -425,10 +402,9 @@ public class FilteredList extends Composite {
}
/**
- * Returns an array of the selected elements. The type of the elements
- * returned in the list are the same as the ones passed with
- * <code>setElements</code>. The array does not contain the rendered
- * strings.
+ * Returns an array of the selected elements. The type of the elements returned
+ * in the list are the same as the ones passed with <code>setElements</code>.
+ * The array does not contain the rendered strings.
*
* @return returns the array of selected elements.
*/
@@ -445,11 +421,9 @@ public class FilteredList extends Composite {
}
/**
- * Sets the filter pattern. Current only prefix filter patterns are
- * supported.
+ * Sets the filter pattern. Current only prefix filter patterns are supported.
*
- * @param filter
- * the filter pattern.
+ * @param filter the filter pattern.
*/
public void setFilter(String filter) {
fFilter = (filter == null) ? "" : filter; //$NON-NLS-1$
@@ -478,18 +452,16 @@ public class FilteredList extends Composite {
/**
* Returns all elements which are folded together to one entry in the list.
*
- * @param index
- * the index selecting the entry in the list.
- * @return returns an array of elements folded together, <code>null</code>
- * if index is out of range.
+ * @param index the index selecting the entry in the list.
+ * @return returns an array of elements folded together, <code>null</code> if
+ * index is out of range.
*/
public Object[] getFoldedElements(int index) {
if ((index < 0) || (index >= fFoldedCount)) {
return null;
}
int start = fFoldedIndices[index];
- int count = (index == fFoldedCount - 1) ? fFilteredCount - start
- : fFoldedIndices[index + 1] - start;
+ int count = (index == fFoldedCount - 1) ? fFilteredCount - start : fFoldedIndices[index + 1] - start;
Object[] elements = new Object[count];
for (int i = 0; i != count; i++) {
elements[i] = fElements[fFilteredIndices[start + i]];
@@ -498,9 +470,9 @@ public class FilteredList extends Composite {
}
/*
- * Folds duplicate entries. Two elements are considered as a pair of
- * duplicates if they coiincide in the rendered string and image. @return
- * returns the number of elements after folding.
+ * Folds duplicate entries. Two elements are considered as a pair of duplicates
+ * if they coiincide in the rendered string and image. @return returns the
+ * number of elements after folding.
*/
private int fold() {
if (fAllowDuplicates) {
@@ -528,8 +500,7 @@ public class FilteredList extends Composite {
* elements after filtering.
*/
private int filter() {
- if (((fFilter == null) || (fFilter.length() == 0))
- && !fMatchEmptyString) {
+ if (((fFilter == null) || (fFilter.length() == 0)) && !fMatchEmptyString) {
return 0;
}
fFilterMatcher.setFilter(fFilter.trim(), fIgnoreCase, false);
@@ -560,8 +531,7 @@ public class FilteredList extends Composite {
* Create a new instance of a job used to update the table.
*
* @param table
- * @param count
- * The number of items to update per running.
+ * @param count The number of items to update per running.
*/
public TableUpdateJob(Table table, int count) {
super(WorkbenchMessages.FilteredList_UpdateJobName);
@@ -570,70 +540,70 @@ public class FilteredList extends Composite {
fCount = count;
}
-@Override
-public IStatus runInUIThread(IProgressMonitor monitor) {
- if (fTable.isDisposed()) {
+ @Override
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ if (fTable.isDisposed()) {
return Status.CANCEL_STATUS;
}
- int itemCount = fTable.getItemCount();
-
- // Remove excess items
- if (fCount < itemCount) {
- fTable.setRedraw(false);
- fTable.remove(fCount, itemCount - 1);
- fTable.setRedraw(true);
- itemCount = fTable.getItemCount();
- }
- // table empty -> no selection
- if (fCount == 0) {
- fTable.notifyListeners(SWT.Selection, new Event());
- return Status.OK_STATUS;
- }
- // How many we are going to do this time.
- int iterations = Math.min(10, fCount - currentIndex);
- for (int i = 0; i < iterations; i++) {
- if (monitor.isCanceled()) {
+ int itemCount = fTable.getItemCount();
+
+ // Remove excess items
+ if (fCount < itemCount) {
+ fTable.setRedraw(false);
+ fTable.remove(fCount, itemCount - 1);
+ fTable.setRedraw(true);
+ itemCount = fTable.getItemCount();
+ }
+ // table empty -> no selection
+ if (fCount == 0) {
+ fTable.notifyListeners(SWT.Selection, new Event());
+ return Status.OK_STATUS;
+ }
+ // How many we are going to do this time.
+ int iterations = Math.min(10, fCount - currentIndex);
+ for (int i = 0; i < iterations; i++) {
+ if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
- final TableItem item = (currentIndex < itemCount) ? fTable
- .getItem(currentIndex)
- : new TableItem(fTable, SWT.NONE);
- final Label label = fLabels[fFilteredIndices[fFoldedIndices[currentIndex]]];
- item.setText(label.string);
- item.setImage(label.image);
- currentIndex++;
- }
- if (monitor.isCanceled()) {
+ final TableItem item = (currentIndex < itemCount) ? fTable.getItem(currentIndex)
+ : new TableItem(fTable, SWT.NONE);
+ final Label label = fLabels[fFilteredIndices[fFoldedIndices[currentIndex]]];
+ item.setText(label.string);
+ item.setImage(label.image);
+ currentIndex++;
+ }
+ if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
- if (currentIndex < fCount) {
+ if (currentIndex < fCount) {
schedule(100);
} else {
- if (indicesToSelect == null) {
- // Make a default selection in the table if there is none.
- // If a selection has already been made, honor it.
- // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=112146
- if (fCount > 0) {
- if (fTable.getSelectionIndices().length == 0) {
- defaultSelect();
- } else {
- // There is a selection, but it likely hasn't changed since the
- // job started. Force a selection notification, since the
- // items represented by the selection have changed.
+ if (indicesToSelect == null) {
+ // Make a default selection in the table if there is none.
+ // If a selection has already been made, honor it.
+ // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=112146
+ if (fCount > 0) {
+ if (fTable.getSelectionIndices().length == 0) {
+ defaultSelect();
+ } else {
+ // There is a selection, but it likely hasn't changed since the
+ // job started. Force a selection notification, since the
+ // items represented by the selection have changed.
// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=119456
- fTable.notifyListeners(SWT.Selection, new Event());
- }
- }
- } else {
- // Set the selection as indicated.
- selectAndNotify(indicesToSelect);
- }
- // This flag signifies that the selection can now be directly
- // updated in the widget.
- readyForSelection = true;
- }
- return Status.OK_STATUS;
- }
+ fTable.notifyListeners(SWT.Selection, new Event());
+ }
+ }
+ } else {
+ // Set the selection as indicated.
+ selectAndNotify(indicesToSelect);
+ }
+ // This flag signifies that the selection can now be directly
+ // updated in the widget.
+ readyForSelection = true;
+ }
+ return Status.OK_STATUS;
+ }
+
/**
* Update the selection for the supplied indices.
*
@@ -682,11 +652,10 @@ public IStatus runInUIThread(IProgressMonitor monitor) {
}
/**
- * Sets whether or not duplicates are allowed. If this value is set the
- * items should be set again for this value to take effect.
+ * Sets whether or not duplicates are allowed. If this value is set the items
+ * should be set again for this value to take effect.
*
- * @param allowDuplicates
- * <code>true</code> indicates duplicates are allowed
+ * @param allowDuplicates <code>true</code> indicates duplicates are allowed
*/
public void setAllowDuplicates(boolean allowDuplicates) {
this.fAllowDuplicates = allowDuplicates;
@@ -705,8 +674,7 @@ public IStatus runInUIThread(IProgressMonitor monitor) {
* Sets whether or not case should be ignored If this value is set the items
* should be set again for this value to take effect.
*
- * @param ignoreCase
- * <code>true</code> if case should be ignored
+ * @param ignoreCase <code>true</code> if case should be ignored
*/
public void setIgnoreCase(boolean ignoreCase) {
this.fIgnoreCase = ignoreCase;
@@ -727,9 +695,8 @@ public IStatus runInUIThread(IProgressMonitor monitor) {
* this value is set the items should be set again for this value to take
* effect.
*
- * @param matchEmptyString
- * <code>true</code> for the empty string to match all items,
- * <code>false</code> to match none
+ * @param matchEmptyString <code>true</code> for the empty string to match all
+ * items, <code>false</code> to match none
*/
public void setMatchEmptyString(boolean matchEmptyString) {
this.fMatchEmptyString = matchEmptyString;
@@ -745,27 +712,28 @@ public IStatus runInUIThread(IProgressMonitor monitor) {
}
/**
- * Sets the label provider. If this value is set the items should be set
- * again for this value to take effect.
+ * Sets the label provider. If this value is set the items should be set again
+ * for this value to take effect.
*
- * @param labelProvider
- * the label provider
+ * @param labelProvider the label provider
*/
public void setLabelProvider(ILabelProvider labelProvider) {
this.fLabelProvider = labelProvider;
}
/**
- * Returns the accessible object for the receiver.
- * If this is the first time this object is requested,
- * then the object is created and returned.
+ * Returns the accessible object for the receiver. If this is the first time
+ * this object is requested, then the object is created and returned.
*
* @return the accessible object
*
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
+ * @exception SWTException
+ * <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been
+ * disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from
+ * the thread that created the receiver</li>
+ * </ul>
*
* @see Accessible#addAccessibleListener
* @see Accessible#addAccessibleControlListener
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FilteredTree.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FilteredTree.java
index 1d9c21c5123..f01130fe6fe 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FilteredTree.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FilteredTree.java
@@ -75,15 +75,15 @@ public class FilteredTree extends Composite {
/**
* The filter text widget to be used by this tree. This value may be
- * <code>null</code> if there is no filter widget, or if the controls have
- * not yet been created.
+ * <code>null</code> if there is no filter widget, or if the controls have not
+ * yet been created.
*/
protected Text filterText;
/**
* The control representing the clear button for the filter text entry. This
- * value may be <code>null</code> if no such button exists, or if the
- * controls have not yet been created.
+ * value may be <code>null</code> if no such button exists, or if the controls
+ * have not yet been created.
* <p>
* <strong>Note:</strong> As of 3.5, this is not used if the new look is chosen.
* </p>
@@ -92,8 +92,8 @@ public class FilteredTree extends Composite {
/**
* The control representing the clear button for the filter text entry. This
- * value may be <code>null</code> if no such button exists, or if the
- * controls have not yet been created.
+ * value may be <code>null</code> if no such button exists, or if the controls
+ * have not yet been created.
* <p>
* <strong>Note:</strong> This is only used if the new look is chosen.
* </p>
@@ -102,7 +102,6 @@ public class FilteredTree extends Composite {
*/
protected Control clearButtonControl;
-
/**
* The viewer for the filtered tree. This value should never be
* <code>null</code> after the widget creation methods are complete.
@@ -110,8 +109,8 @@ public class FilteredTree extends Composite {
protected TreeViewer treeViewer;
/**
- * The Composite on which the filter controls are created. This is used to
- * set the background color of the filter controls to match the surrounding
+ * The Composite on which the filter controls are created. This is used to set
+ * the background color of the filter controls to match the surrounding
* controls.
*/
protected Composite filterComposite;
@@ -161,9 +160,9 @@ public class FilteredTree extends Composite {
private boolean useNewLook = false;
/**
- * Tells whether this filtetered tree is used to make quick selections. In
- * this mode the first match in the tree is automatically selected while
- * filtering and the 'Enter' key is not used to move the focus to the tree.
+ * Tells whether this filtetered tree is used to make quick selections. In this
+ * mode the first match in the tree is automatically selected while filtering
+ * and the 'Enter' key is not used to move the focus to the tree.
*
* @since 3.105
*/
@@ -177,12 +176,11 @@ public class FilteredTree extends Composite {
/**
* Image descriptor for disabled clear button.
*/
- private static final String DISABLED_CLEAR_ICON= "org.eclipse.ui.internal.dialogs.DCLEAR_ICON"; //$NON-NLS-1$
+ private static final String DISABLED_CLEAR_ICON = "org.eclipse.ui.internal.dialogs.DCLEAR_ICON"; //$NON-NLS-1$
/**
- * Maximum time spent expanding the tree after the filter text has been
- * updated (this is only used if we were able to at least expand the visible
- * nodes)
+ * Maximum time spent expanding the tree after the filter text has been updated
+ * (this is only used if we were able to at least expand the visible nodes)
*/
private static final long SOFT_MAX_EXPAND_TIME = 200;
@@ -190,14 +188,13 @@ public class FilteredTree extends Composite {
* Get image descriptors for the clear button.
*/
static {
- ImageDescriptor descriptor = AbstractUIPlugin
- .imageDescriptorFromPlugin(PlatformUI.PLUGIN_ID,
- "$nl$/icons/full/etool16/clear_co.png"); //$NON-NLS-1$
+ ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(PlatformUI.PLUGIN_ID,
+ "$nl$/icons/full/etool16/clear_co.png"); //$NON-NLS-1$
if (descriptor != null) {
JFaceResources.getImageRegistry().put(CLEAR_ICON, descriptor);
}
- descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(
- PlatformUI.PLUGIN_ID, "$nl$/icons/full/dtool16/clear_co.png"); //$NON-NLS-1$
+ descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(PlatformUI.PLUGIN_ID,
+ "$nl$/icons/full/dtool16/clear_co.png"); //$NON-NLS-1$
if (descriptor != null) {
JFaceResources.getImageRegistry().put(DISABLED_CLEAR_ICON, descriptor);
}
@@ -206,16 +203,13 @@ public class FilteredTree extends Composite {
/**
* Create a new instance of the receiver.
*
- * @param parent
- * the parent <code>Composite</code>
- * @param treeStyle
- * the style bits for the <code>Tree</code>
- * @param filter
- * the filter to be used
+ * @param parent the parent <code>Composite</code>
+ * @param treeStyle the style bits for the <code>Tree</code>
+ * @param filter the filter to be used
*
* @deprecated As of 3.5, replaced by
- * {@link #FilteredTree(Composite, int, PatternFilter, boolean)} where using the new
- * look is encouraged
+ * {@link #FilteredTree(Composite, int, PatternFilter, boolean)}
+ * where using the new look is encouraged
*/
@Deprecated
public FilteredTree(Composite parent, int treeStyle, PatternFilter filter) {
@@ -227,36 +221,31 @@ public class FilteredTree extends Composite {
/**
* Create a new instance of the receiver.
*
- * @param parent
- * the parent <code>Composite</code>
- * @param treeStyle
- * the style bits for the <code>Tree</code>
- * @param filter
- * the filter to be used
- * @param useNewLook
- * <code>true</code> if the new 3.5 look should be used
+ * @param parent the parent <code>Composite</code>
+ * @param treeStyle the style bits for the <code>Tree</code>
+ * @param filter the filter to be used
+ * @param useNewLook <code>true</code> if the new 3.5 look should be used
* @since 3.5
*/
public FilteredTree(Composite parent, int treeStyle, PatternFilter filter, boolean useNewLook) {
super(parent, SWT.NONE);
this.parent = parent;
- this.useNewLook= useNewLook;
+ this.useNewLook = useNewLook;
init(treeStyle, filter);
}
/**
- * Create a new instance of the receiver. Subclasses that wish to override
- * the default creation behavior may use this constructor, but must ensure
- * that the <code>init(composite, int, PatternFilter)</code> method is
- * called in the overriding constructor.
+ * Create a new instance of the receiver. Subclasses that wish to override the
+ * default creation behavior may use this constructor, but must ensure that the
+ * <code>init(composite, int, PatternFilter)</code> method is called in the
+ * overriding constructor.
*
- * @param parent
- * the parent <code>Composite</code>
+ * @param parent the parent <code>Composite</code>
* @see #init(int, PatternFilter)
*
* @since 3.3
- * @deprecated As of 3.5, replaced by {@link #FilteredTree(Composite, boolean)} where using the
- * look is encouraged
+ * @deprecated As of 3.5, replaced by {@link #FilteredTree(Composite, boolean)}
+ * where using the look is encouraged
*/
@Deprecated
protected FilteredTree(Composite parent) {
@@ -265,15 +254,13 @@ public class FilteredTree extends Composite {
}
/**
- * Create a new instance of the receiver. Subclasses that wish to override
- * the default creation behavior may use this constructor, but must ensure
- * that the <code>init(composite, int, PatternFilter)</code> method is
- * called in the overriding constructor.
+ * Create a new instance of the receiver. Subclasses that wish to override the
+ * default creation behavior may use this constructor, but must ensure that the
+ * <code>init(composite, int, PatternFilter)</code> method is called in the
+ * overriding constructor.
*
- * @param parent
- * the parent <code>Composite</code>
- * @param useNewLook
- * <code>true</code> if the new 3.5 look should be used
+ * @param parent the parent <code>Composite</code>
+ * @param useNewLook <code>true</code> if the new 3.5 look should be used
* @see #init(int, PatternFilter)
*
* @since 3.5
@@ -287,17 +274,15 @@ public class FilteredTree extends Composite {
/**
* Create the filtered tree.
*
- * @param treeStyle
- * the style bits for the <code>Tree</code>
- * @param filter
- * the filter to be used
+ * @param treeStyle the style bits for the <code>Tree</code>
+ * @param filter the filter to be used
*
* @since 3.3
*/
protected void init(int treeStyle, PatternFilter filter) {
patternFilter = filter;
- showFilterControls = PlatformUI.getPreferenceStore().getBoolean(
- IWorkbenchPreferenceConstants.SHOW_FILTERED_TEXTS);
+ showFilterControls = PlatformUI.getPreferenceStore()
+ .getBoolean(IWorkbenchPreferenceConstants.SHOW_FILTERED_TEXTS);
createControl(parent, treeStyle);
createRefreshJob();
setInitialText(WorkbenchMessages.FilteredTree_FilterMessage);
@@ -323,20 +308,19 @@ public class FilteredTree extends Composite {
if (showFilterControls) {
if (!useNewLook || useNativeSearchField(parent)) {
- filterComposite= new Composite(this, SWT.NONE);
+ filterComposite = new Composite(this, SWT.NONE);
} else {
- filterComposite= new Composite(this, SWT.BORDER);
+ filterComposite = new Composite(this, SWT.BORDER);
filterComposite.setBackground(getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
}
- GridLayout filterLayout= new GridLayout(2, false);
- filterLayout.marginHeight= 0;
- filterLayout.marginWidth= 0;
+ GridLayout filterLayout = new GridLayout(2, false);
+ filterLayout.marginHeight = 0;
+ filterLayout.marginWidth = 0;
filterComposite.setLayout(filterLayout);
filterComposite.setFont(parent.getFont());
createFilterControls(filterComposite);
- filterComposite.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING,
- true, false));
+ filterComposite.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
}
treeComposite = new Composite(this, SWT.NONE);
@@ -368,14 +352,12 @@ public class FilteredTree extends Composite {
return useNativeSearchField.booleanValue();
}
-
/**
* Create the filter controls. By default, a text and corresponding tool bar
* button that clears the contents of the text is created. Subclasses may
* override.
*
- * @param parent
- * parent <code>Composite</code> of the filter controls
+ * @param parent parent <code>Composite</code> of the filter controls
* @return the <code>Composite</code> that contains the filter controls
*/
protected Composite createFilterControls(Composite parent) {
@@ -402,10 +384,8 @@ public class FilteredTree extends Composite {
* Subclasses should override {@link #doCreateTreeViewer(Composite, int)}
* instead of overriding this method.
*
- * @param parent
- * parent <code>Composite</code>
- * @param style
- * SWT style bits used to create the tree
+ * @param parent parent <code>Composite</code>
+ * @param style SWT style bits used to create the tree
* @return the tree
*/
protected Control createTreeControl(Composite parent, int style) {
@@ -423,10 +403,8 @@ public class FilteredTree extends Composite {
/**
* Creates the tree viewer. Subclasses may override.
*
- * @param parent
- * the parent composite
- * @param style
- * SWT style bits used to create the tree viewer
+ * @param parent the parent composite
+ * @param style SWT style bits used to create the tree viewer
* @return the tree viewer
*
* @since 3.3
@@ -465,8 +443,8 @@ public class FilteredTree extends Composite {
}
/**
- * Creates a workbench job that will refresh the tree based on the current filter text.
- * Subclasses may override.
+ * Creates a workbench job that will refresh the tree based on the current
+ * filter text. Subclasses may override.
*
* @return a workbench job that can be scheduled to refresh the tree
*
@@ -485,16 +463,14 @@ public class FilteredTree extends Composite {
return Status.OK_STATUS;
}
- boolean initial = initialText != null
- && initialText.equals(text);
+ boolean initial = initialText != null && initialText.equals(text);
if (initial) {
patternFilter.setPattern(null);
} else if (text != null) {
patternFilter.setPattern(text);
}
- Control redrawFalseControl = treeComposite != null ? treeComposite
- : treeViewer.getControl();
+ Control redrawFalseControl = treeComposite != null ? treeComposite : treeViewer.getControl();
try {
// don't want the user to see updates that will be made to
// the tree
@@ -506,8 +482,7 @@ public class FilteredTree extends Composite {
TreeItem[] is = treeViewer.getTree().getItems();
for (TreeItem item : is) {
if (item.getExpanded()) {
- treeViewer.setExpandedState(item.getData(),
- false);
+ treeViewer.setExpandedState(item.getData(), false);
}
}
}
@@ -515,22 +490,17 @@ public class FilteredTree extends Composite {
if (text.length() > 0 && !initial) {
/*
- * Expand elements one at a time. After each is
- * expanded, check to see if the filter text has been
- * modified. If it has, then cancel the refresh job so
- * the user doesn't have to endure expansion of all the
- * nodes.
+ * Expand elements one at a time. After each is expanded, check to see if the
+ * filter text has been modified. If it has, then cancel the refresh job so the
+ * user doesn't have to endure expansion of all the nodes.
*/
TreeItem[] items = getViewer().getTree().getItems();
int treeHeight = getViewer().getTree().getBounds().height;
- int numVisibleItems = treeHeight
- / getViewer().getTree().getItemHeight();
- long stopTime = SOFT_MAX_EXPAND_TIME
- + System.currentTimeMillis();
+ int numVisibleItems = treeHeight / getViewer().getTree().getItemHeight();
+ long stopTime = SOFT_MAX_EXPAND_TIME + System.currentTimeMillis();
boolean cancel = false;
if (items.length > 0
- && recursiveExpand(items, monitor, stopTime,
- new int[] { numVisibleItems })) {
+ && recursiveExpand(items, monitor, stopTime, new int[] { numVisibleItems })) {
cancel = true;
}
@@ -549,8 +519,7 @@ public class FilteredTree extends Composite {
} finally {
// done updating the tree - set redraw back to true
TreeItem[] items = getViewer().getTree().getItems();
- if (items.length > 0
- && getViewer().getTree().getSelectionCount() == 0) {
+ if (items.length > 0 && getViewer().getTree().getSelectionCount() == 0) {
treeViewer.getTree().setTopItem(items[0]);
}
if (quickSelectionMode)
@@ -561,8 +530,8 @@ public class FilteredTree extends Composite {
}
/**
- * Returns true if the job should be canceled (because of timeout or
- * actual cancellation).
+ * Returns true if the job should be canceled (because of timeout or actual
+ * cancellation).
*
* @param items
* @param monitor
@@ -570,15 +539,13 @@ public class FilteredTree extends Composite {
* @param numItemsLeft
* @return true if canceled
*/
- private boolean recursiveExpand(TreeItem[] items,
- IProgressMonitor monitor, long cancelTime,
+ private boolean recursiveExpand(TreeItem[] items, IProgressMonitor monitor, long cancelTime,
int[] numItemsLeft) {
boolean canceled = false;
for (int i = 0; !canceled && i < items.length; i++) {
TreeItem item = items[i];
boolean visible = numItemsLeft[0]-- >= 0;
- if (monitor.isCanceled()
- || (!visible && System.currentTimeMillis() > cancelTime)) {
+ if (monitor.isCanceled() || (!visible && System.currentTimeMillis() > cancelTime)) {
canceled = true;
} else {
Object itemData = item.getData();
@@ -590,8 +557,7 @@ public class FilteredTree extends Composite {
}
TreeItem[] children = item.getItems();
if (items.length > 0) {
- canceled = recursiveExpand(children, monitor,
- cancelTime, numItemsLeft);
+ canceled = recursiveExpand(children, monitor, cancelTime, numItemsLeft);
}
}
}
@@ -613,63 +579,57 @@ public class FilteredTree extends Composite {
/**
* Creates the filter text and adds listeners. This method calls
- * {@link #doCreateFilterText(Composite)} to create the text control.
- * Subclasses should override {@link #doCreateFilterText(Composite)} instead
- * of overriding this method.
+ * {@link #doCreateFilterText(Composite)} to create the text control. Subclasses
+ * should override {@link #doCreateFilterText(Composite)} instead of overriding
+ * this method.
*
- * @param parent
- * <code>Composite</code> of the filter text
+ * @param parent <code>Composite</code> of the filter text
*/
protected void createFilterText(Composite parent) {
filterText = doCreateFilterText(parent);
- filterText.getAccessible().addAccessibleListener(
- new AccessibleAdapter() {
- @Override
- public void getName(AccessibleEvent e) {
- String filterTextString = filterText.getText();
- if (filterTextString.length() == 0
- || filterTextString.equals(initialText)) {
- e.result = initialText;
- } else {
- e.result = NLS
- .bind(
- WorkbenchMessages.FilteredTree_AccessibleListenerFiltered,
- new String[] {
- filterTextString,
- String
- .valueOf(getFilteredItemsCount()) });
- }
- }
+ filterText.getAccessible().addAccessibleListener(new AccessibleAdapter() {
+ @Override
+ public void getName(AccessibleEvent e) {
+ String filterTextString = filterText.getText();
+ if (filterTextString.length() == 0 || filterTextString.equals(initialText)) {
+ e.result = initialText;
+ } else {
+ e.result = NLS.bind(WorkbenchMessages.FilteredTree_AccessibleListenerFiltered,
+ new String[] { filterTextString, String.valueOf(getFilteredItemsCount()) });
+ }
+ }
- /**
- * Return the number of filtered items
- * @return int
- */
- private int getFilteredItemsCount() {
- int total = 0;
- TreeItem[] items = getViewer().getTree().getItems();
- for (TreeItem item : items) {
- total += itemCount(item);
+ /**
+ * Return the number of filtered items
+ *
+ * @return int
+ */
+ private int getFilteredItemsCount() {
+ int total = 0;
+ TreeItem[] items = getViewer().getTree().getItems();
+ for (TreeItem item : items) {
+ total += itemCount(item);
- }
- return total;
- }
+ }
+ return total;
+ }
- /**
- * Return the count of treeItem and it's children to infinite depth.
- * @param treeItem
- * @return int
- */
- private int itemCount(TreeItem treeItem) {
- int count = 1;
- TreeItem[] children = treeItem.getItems();
- for (TreeItem element : children) {
- count += itemCount(element);
+ /**
+ * Return the count of treeItem and it's children to infinite depth.
+ *
+ * @param treeItem
+ * @return int
+ */
+ private int itemCount(TreeItem treeItem) {
+ int count = 1;
+ TreeItem[] children = treeItem.getItems();
+ for (TreeItem element : children) {
+ count += itemCount(element);
- }
- return count;
- }
- });
+ }
+ return count;
+ }
+ });
filterText.addFocusListener(new FocusAdapter() {
@Override
@@ -679,11 +639,10 @@ public class FilteredTree extends Composite {
* Running in an asyncExec because the selectAll() does not appear to work when
* using mouse to give focus to text.
*/
- Display display= filterText.getDisplay();
+ Display display = filterText.getDisplay();
display.asyncExec(() -> {
if (!filterText.isDisposed()) {
- if (getInitialText().equals(
- filterText.getText().trim())) {
+ if (getInitialText().equals(filterText.getText().trim())) {
filterText.selectAll();
}
}
@@ -709,7 +668,8 @@ public class FilteredTree extends Composite {
@Override
public void mouseDown(MouseEvent e) {
if (filterText.getText().equals(initialText)) {
- // XXX: We cannot call clearText() due to https://bugs.eclipse.org/bugs/show_bug.cgi?id=260664
+ // XXX: We cannot call clearText() due to
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=260664
setFilterText(""); //$NON-NLS-1$
textChanged();
}
@@ -752,7 +712,7 @@ public class FilteredTree extends Composite {
}));
}
- GridData gridData= new GridData(SWT.FILL, SWT.CENTER, true, false);
+ GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
// if the text widget supported cancel then it will have it's own
// integrated button. We can take all of the space.
if ((filterText.getStyle() & SWT.ICON_CANCEL) != 0)
@@ -763,9 +723,8 @@ public class FilteredTree extends Composite {
/**
* Updates the selection in the tree, based on the filter text.
*
- * @param setFocus
- * <code>true</code> if the focus should be set on the tree,
- * <code>false</code> otherwise
+ * @param setFocus <code>true</code> if the focus should be set on the tree,
+ * <code>false</code> otherwise
* @since 3.105
*/
protected void updateTreeSelection(boolean setFocus) {
@@ -797,16 +756,14 @@ public class FilteredTree extends Composite {
* Creates the text control for entering the filter text. Subclasses may
* override.
*
- * @param parent
- * the parent composite
+ * @param parent the parent composite
* @return the text widget
*
* @since 3.3
*/
protected Text doCreateFilterText(Composite parent) {
if (!useNewLook || useNativeSearchField(parent)) {
- return new Text(parent, SWT.SINGLE | SWT.BORDER | SWT.SEARCH
- | SWT.ICON_CANCEL);
+ return new Text(parent, SWT.SINGLE | SWT.BORDER | SWT.SEARCH | SWT.ICON_CANCEL);
}
return new Text(parent, SWT.SINGLE);
}
@@ -820,8 +777,7 @@ public class FilteredTree extends Composite {
*/
protected void textChanged() {
narrowingDown = previousFilterText == null
- || previousFilterText
- .equals(WorkbenchMessages.FilteredTree_FilterMessage)
+ || previousFilterText.equals(WorkbenchMessages.FilteredTree_FilterMessage)
|| getFilterString().startsWith(previousFilterText);
previousFilterText = getFilterString();
// cancel currently running job first, to prevent unnecessary redraw
@@ -830,8 +786,8 @@ public class FilteredTree extends Composite {
}
/**
- * Return the time delay that should be used when scheduling the
- * filter refresh job. Subclasses may override.
+ * Return the time delay that should be used when scheduling the filter refresh
+ * job. Subclasses may override.
*
* @return a time delay in milliseconds before the job should run
*
@@ -844,8 +800,7 @@ public class FilteredTree extends Composite {
/**
* Set the background for the widgets that support the filter text area.
*
- * @param background
- * background <code>Color</code> to set
+ * @param background background <code>Color</code> to set
*/
@Override
public void setBackground(Color background) {
@@ -861,29 +816,26 @@ public class FilteredTree extends Composite {
/**
* Create the button that clears the text.
*
- * @param parent
- * parent <code>Composite</code> of toolbar button
+ * @param parent parent <code>Composite</code> of toolbar button
*/
private void createClearTextOld(Composite parent) {
// only create the button if the text widget doesn't support one
// natively
if ((filterText.getStyle() & SWT.ICON_CANCEL) == 0) {
- filterToolBar= new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL);
+ filterToolBar = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL);
filterToolBar.createControl(parent);
- IAction clearTextAction= new Action("", IAction.AS_PUSH_BUTTON) {//$NON-NLS-1$
+ IAction clearTextAction = new Action("", IAction.AS_PUSH_BUTTON) {//$NON-NLS-1$
@Override
public void run() {
clearText();
}
};
+ clearTextAction.setToolTipText(WorkbenchMessages.FilteredTree_ClearToolTip);
+ clearTextAction.setImageDescriptor(JFaceResources.getImageRegistry().getDescriptor(CLEAR_ICON));
clearTextAction
- .setToolTipText(WorkbenchMessages.FilteredTree_ClearToolTip);
- clearTextAction.setImageDescriptor(JFaceResources
- .getImageRegistry().getDescriptor(CLEAR_ICON));
- clearTextAction.setDisabledImageDescriptor(JFaceResources
-.getImageRegistry().getDescriptor(DISABLED_CLEAR_ICON));
+ .setDisabledImageDescriptor(JFaceResources.getImageRegistry().getDescriptor(DISABLED_CLEAR_ICON));
filterToolBar.add(clearTextAction);
}
@@ -898,11 +850,12 @@ public class FilteredTree extends Composite {
// only create the button if the text widget doesn't support one
// natively
if ((filterText.getStyle() & SWT.ICON_CANCEL) == 0) {
- final Image inactiveImage= JFaceResources.getImageRegistry().getDescriptor(DISABLED_CLEAR_ICON).createImage();
- final Image activeImage= JFaceResources.getImageRegistry().getDescriptor(CLEAR_ICON).createImage();
- final Image pressedImage= new Image(getDisplay(), activeImage, SWT.IMAGE_GRAY);
+ final Image inactiveImage = JFaceResources.getImageRegistry().getDescriptor(DISABLED_CLEAR_ICON)
+ .createImage();
+ final Image activeImage = JFaceResources.getImageRegistry().getDescriptor(CLEAR_ICON).createImage();
+ final Image pressedImage = new Image(getDisplay(), activeImage, SWT.IMAGE_GRAY);
- final Label clearButton= new Label(parent, SWT.NONE);
+ final Label clearButton = new Label(parent, SWT.NONE);
clearButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
clearButton.setImage(inactiveImage);
clearButton.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
@@ -913,14 +866,14 @@ public class FilteredTree extends Composite {
@Override
public void mouseDown(MouseEvent e) {
clearButton.setImage(pressedImage);
- fMoveListener= new MouseMoveListener() {
- private boolean fMouseInButton= true;
+ fMoveListener = new MouseMoveListener() {
+ private boolean fMouseInButton = true;
@Override
public void mouseMove(MouseEvent e) {
- boolean mouseInButton= isMouseInButton(e);
+ boolean mouseInButton = isMouseInButton(e);
if (mouseInButton != fMouseInButton) {
- fMouseInButton= mouseInButton;
+ fMouseInButton = mouseInButton;
clearButton.setImage(mouseInButton ? pressedImage : inactiveImage);
}
}
@@ -932,8 +885,8 @@ public class FilteredTree extends Composite {
public void mouseUp(MouseEvent e) {
if (fMoveListener != null) {
clearButton.removeMouseMoveListener(fMoveListener);
- fMoveListener= null;
- boolean mouseInButton= isMouseInButton(e);
+ fMoveListener = null;
+ boolean mouseInButton = isMouseInButton(e);
clearButton.setImage(mouseInButton ? activeImage : inactiveImage);
if (mouseInButton) {
clearText();
@@ -967,21 +920,19 @@ public class FilteredTree extends Composite {
activeImage.dispose();
pressedImage.dispose();
});
- clearButton.getAccessible().addAccessibleListener(
- new AccessibleAdapter() {
- @Override
- public void getName(AccessibleEvent e) {
- e.result= WorkbenchMessages.FilteredTree_AccessibleListenerClearButton;
- }
+ clearButton.getAccessible().addAccessibleListener(new AccessibleAdapter() {
+ @Override
+ public void getName(AccessibleEvent e) {
+ e.result = WorkbenchMessages.FilteredTree_AccessibleListenerClearButton;
+ }
});
- clearButton.getAccessible().addAccessibleControlListener(
- new AccessibleControlAdapter() {
- @Override
- public void getRole(AccessibleControlEvent e) {
- e.detail= ACC.ROLE_PUSHBUTTON;
- }
+ clearButton.getAccessible().addAccessibleControlListener(new AccessibleControlAdapter() {
+ @Override
+ public void getRole(AccessibleControlEvent e) {
+ e.detail = ACC.ROLE_PUSHBUTTON;
+ }
});
- this.clearButtonControl= clearButton;
+ this.clearButtonControl = clearButton;
}
}
@@ -1048,8 +999,7 @@ public class FilteredTree extends Composite {
* provided, so this method only need be called if overriding the default
* initial text is desired.
*
- * @param text
- * initial text to appear in text field
+ * @param text initial text to appear in text field
*/
public void setInitialText(String text) {
initialText = text;
@@ -1074,15 +1024,14 @@ public class FilteredTree extends Composite {
/**
* Sets whether this filtered tree is used to make quick selections. In this
- * mode the first match in the tree is automatically selected while
- * filtering and the 'Enter' key is not used to move the focus to the tree.
+ * mode the first match in the tree is automatically selected while filtering
+ * and the 'Enter' key is not used to move the focus to the tree.
* <p>
* By default, this is set to <code>false</code>.
* </p>
*
- * @param enabled
- * <code>true</code> if this filtered tree is used to make quick
- * selections, <code>false</code> otherwise
+ * @param enabled <code>true</code> if this filtered tree is used to make quick
+ * selections, <code>false</code> otherwise
* @since 3.105
*/
public void setQuickSelectionMode(boolean enabled) {
@@ -1109,21 +1058,17 @@ public class FilteredTree extends Composite {
}
/**
- * Return a bold font if the given element matches the given pattern.
- * Clients can opt to call this method from a Viewer's label provider to get
- * a bold font for which to highlight the given element in the tree.
+ * Return a bold font if the given element matches the given pattern. Clients
+ * can opt to call this method from a Viewer's label provider to get a bold font
+ * for which to highlight the given element in the tree.
*
- * @param element
- * element for which a match should be determined
- * @param tree
- * FilteredTree in which the element resides
- * @param filter
- * PatternFilter which determines a match
+ * @param element element for which a match should be determined
+ * @param tree FilteredTree in which the element resides
+ * @param filter PatternFilter which determines a match
*
* @return bold font
*/
- public static Font getBoldFont(Object element, FilteredTree tree,
- PatternFilter filter) {
+ public static Font getBoldFont(Object element, FilteredTree tree, PatternFilter filter) {
String filterText = tree.getFilterString();
if (filterText == null) {
@@ -1134,26 +1079,23 @@ public class FilteredTree extends Composite {
String initialText = tree.getInitialText();
if (!filterText.equals("") && !filterText.equals(initialText)) {//$NON-NLS-1$
if (tree.getPatternFilter() != filter) {
- boolean initial= initialText != null
- && initialText.equals(filterText);
+ boolean initial = initialText != null && initialText.equals(filterText);
if (initial) {
filter.setPattern(null);
} else if (filterText != null) {
filter.setPattern(filterText);
}
}
- if (filter.isElementVisible(tree.getViewer(), element)
- && filter.isLeafMatch(tree.getViewer(), element)) {
- return JFaceResources.getFontRegistry().getBold(
- JFaceResources.DIALOG_FONT);
+ if (filter.isElementVisible(tree.getViewer(), element) && filter.isLeafMatch(tree.getViewer(), element)) {
+ return JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT);
}
}
return null;
}
/**
- * Custom tree viewer subclass that clears the caches in patternFilter on
- * any change to the tree. See bug 187200.
+ * Custom tree viewer subclass that clears the caches in patternFilter on any
+ * change to the tree. See bug 187200.
*
* @since 3.3
*
@@ -1187,8 +1129,7 @@ public class FilteredTree extends Composite {
}
@Override
- public void insert(Object parentElementOrTreePath, Object element,
- int position) {
+ public void insert(Object parentElementOrTreePath, Object element, int position) {
getPatternFilter().clearCaches();
super.insert(parentElementOrTreePath, element, position);
}
@@ -1236,8 +1177,7 @@ public class FilteredTree extends Composite {
}
@Override
- public void replace(Object parentElementOrTreePath, int index,
- Object element) {
+ public void replace(Object parentElementOrTreePath, int index, Object element) {
getPatternFilter().clearCaches();
super.replace(parentElementOrTreePath, index, element);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/IOverwriteQuery.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/IOverwriteQuery.java
index b76e43348ad..d4764c0b503 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/IOverwriteQuery.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/IOverwriteQuery.java
@@ -14,48 +14,51 @@
package org.eclipse.ui.dialogs;
/**
- * Implementors of this interface answer one of the prescribed return codes
- * when asked whether to overwrite a certain path string (which could
- * represent a resource path, a file system path, etc).
+ * Implementors of this interface answer one of the prescribed return codes when
+ * asked whether to overwrite a certain path string (which could represent a
+ * resource path, a file system path, etc).
*/
public interface IOverwriteQuery {
- /**
- * Return code indicating the operation should be canceled.
- */
- String CANCEL = "CANCEL"; //$NON-NLS-1$
+ /**
+ * Return code indicating the operation should be canceled.
+ */
+ String CANCEL = "CANCEL"; //$NON-NLS-1$
- /**
- * Return code indicating the entity should not be overwritten,
- * but operation should not be canceled.
- */
- String NO = "NO"; //$NON-NLS-1$
+ /**
+ * Return code indicating the entity should not be overwritten, but operation
+ * should not be canceled.
+ */
+ String NO = "NO"; //$NON-NLS-1$
- /**
- * Return code indicating the entity should be overwritten.
- */
- String YES = "YES"; //$NON-NLS-1$
+ /**
+ * Return code indicating the entity should be overwritten.
+ */
+ String YES = "YES"; //$NON-NLS-1$
- /**
- * Return code indicating the entity should be overwritten,
- * and all subsequent entities should be overwritten without prompting.
- */
- String ALL = "ALL"; //$NON-NLS-1$
+ /**
+ * Return code indicating the entity should be overwritten, and all subsequent
+ * entities should be overwritten without prompting.
+ */
+ String ALL = "ALL"; //$NON-NLS-1$
- /**
- * Return code indicating the entity should not be overwritten,
- * and all subsequent entities should not be overwritten without prompting.
- */
- String NO_ALL = "NOALL"; //$NON-NLS-1$
+ /**
+ * Return code indicating the entity should not be overwritten, and all
+ * subsequent entities should not be overwritten without prompting.
+ */
+ String NO_ALL = "NOALL"; //$NON-NLS-1$
- /**
- * Returns one of the return code constants declared on this interface,
- * indicating whether the entity represented by the passed String should be overwritten.
- * <p>
- * This method may be called from a non-UI thread, in which case this method must run the query
- * in a sync exec in the UI thread, if it needs to query the user.
- * </p>
- * @param pathString the path representing the entity to be overwritten
- * @return one of the return code constants declared on this interface
- */
- String queryOverwrite(String pathString);
+ /**
+ * Returns one of the return code constants declared on this interface,
+ * indicating whether the entity represented by the passed String should be
+ * overwritten.
+ * <p>
+ * This method may be called from a non-UI thread, in which case this method
+ * must run the query in a sync exec in the UI thread, if it needs to query the
+ * user.
+ * </p>
+ *
+ * @param pathString the path representing the entity to be overwritten
+ * @return one of the return code constants declared on this interface
+ */
+ String queryOverwrite(String pathString);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ISelectionStatusValidator.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ISelectionStatusValidator.java
index 308f71494ef..33649166e9f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ISelectionStatusValidator.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ISelectionStatusValidator.java
@@ -22,11 +22,12 @@ import org.eclipse.core.runtime.IStatus;
*/
public interface ISelectionStatusValidator {
- /**
- * Validates an array of elements and returns the resulting status.
- * @param selection The elements to validate
- * @return The resulting status
- */
- IStatus validate(Object[] selection);
+ /**
+ * Validates an array of elements and returns the resulting status.
+ *
+ * @param selection The elements to validate
+ * @return The resulting status
+ */
+ IStatus validate(Object[] selection);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ISelectionValidator.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ISelectionValidator.java
index 410d02a5588..10ea8406b19 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ISelectionValidator.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ISelectionValidator.java
@@ -21,14 +21,15 @@ package org.eclipse.ui.dialogs;
* </p>
*/
public interface ISelectionValidator {
- /**
- * Returns a string indicating whether the given selection is valid. If the
- * result is <code>null</code>, the selection is considered to be valid; if the result is
- * non-empty, it contains the error message to be displayed to the user.
- *
- * @param selection the selection to be validated
- * @return the error message, or <code>null</code> indicating
- * that the value is valid
- */
- String isValid(Object selection);
+ /**
+ * Returns a string indicating whether the given selection is valid. If the
+ * result is <code>null</code>, the selection is considered to be valid; if the
+ * result is non-empty, it contains the error message to be displayed to the
+ * user.
+ *
+ * @param selection the selection to be validated
+ * @return the error message, or <code>null</code> indicating that the value is
+ * valid
+ */
+ String isValid(Object selection);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/IWorkingSetEditWizard.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/IWorkingSetEditWizard.java
index f9320d894ce..e5f491cd583 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/IWorkingSetEditWizard.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/IWorkingSetEditWizard.java
@@ -17,9 +17,9 @@ import org.eclipse.jface.wizard.IWizard;
import org.eclipse.ui.IWorkingSet;
/**
- * A working set edit wizard allows editing a working set using
- * the IWorkingSetPage associated with the working set.
- * See the org.eclipse.ui.workingSets extension point for details.
+ * A working set edit wizard allows editing a working set using the
+ * IWorkingSetPage associated with the working set. See the
+ * org.eclipse.ui.workingSets extension point for details.
* <p>
* Use org.eclipse.ui.IWorkingSetManager#createWorkingSetEditWizard(IWorkingSet)
* to create an instance of this wizard.
@@ -27,15 +27,16 @@ import org.eclipse.ui.IWorkingSet;
* <p>
* This interface is not intended to be implemented by clients.
* </p>
+ *
* @see org.eclipse.ui.IWorkingSetManager
* @since 2.1
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IWorkingSetEditWizard extends IWizard {
- /**
- * Returns the working set edited in the wizard.
- *
- * @return the working set edited in the wizard.
- */
- IWorkingSet getSelection();
+ /**
+ * Returns the working set edited in the wizard.
+ *
+ * @return the working set edited in the wizard.
+ */
+ IWorkingSet getSelection();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/IWorkingSetNewWizard.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/IWorkingSetNewWizard.java
index 0c6e873048c..018a6bbc514 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/IWorkingSetNewWizard.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/IWorkingSetNewWizard.java
@@ -17,15 +17,16 @@ import org.eclipse.jface.wizard.IWizard;
import org.eclipse.ui.IWorkingSet;
/**
- * A working set new wizard allows creating new working sets using
- * a plug-in specific working set page.
+ * A working set new wizard allows creating new working sets using a plug-in
+ * specific working set page.
* <p>
- * Use org.eclipse.ui.IWorkingSetManager#createWorkingSetNewWizard(String[] workingSetIds)
- * to create an instance of this wizard.
+ * Use org.eclipse.ui.IWorkingSetManager#createWorkingSetNewWizard(String[]
+ * workingSetIds) to create an instance of this wizard.
* </p>
* <p>
* This interface is not intended to be implemented by clients.
* </p>
+ *
* @see org.eclipse.ui.IWorkingSetManager
* @see org.eclipse.ui.dialogs.IWorkingSetPage
*
@@ -34,12 +35,12 @@ import org.eclipse.ui.IWorkingSet;
*/
public interface IWorkingSetNewWizard extends IWizard {
- /**
- * Returns the new working set. Returns <code>null</code> if the wizard has
- * been cancelled.
- *
- * @return the new working set or <code>null</code> if the wizard has been
- * cancelled.
- */
- IWorkingSet getSelection();
+ /**
+ * Returns the new working set. Returns <code>null</code> if the wizard has been
+ * cancelled.
+ *
+ * @return the new working set or <code>null</code> if the wizard has been
+ * cancelled.
+ */
+ IWorkingSet getSelection();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/IWorkingSetPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/IWorkingSetPage.java
index c7651d2c1ca..18a294bd61a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/IWorkingSetPage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/IWorkingSetPage.java
@@ -17,15 +17,13 @@ import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.ui.IWorkingSet;
/**
- * A working set page allows the user to edit an existing
- * working set and create a new working set.
+ * A working set page allows the user to edit an existing working set and create
+ * a new working set.
* <p>
- * Clients should implement this interface and include the
- * name of their class in an extension contributed to the
- * workbench's working set extension point
- * (named <code>"org.eclipse.ui.workingSets"</code>) if they
- * want to provide a special wizard page for a particular
- * working set element type.
+ * Clients should implement this interface and include the name of their class
+ * in an extension contributed to the workbench's working set extension point
+ * (named <code>"org.eclipse.ui.workingSets"</code>) if they want to provide a
+ * special wizard page for a particular working set element type.
* </p>
* <p>
* Clients implementing this interface may subclass from
@@ -35,34 +33,30 @@ import org.eclipse.ui.IWorkingSet;
* @since 2.0
*/
public interface IWorkingSetPage extends IWizardPage {
- /**
- * Called when the working set wizard is closed by selecting
- * the finish button.
- * Implementers may store the page result (new/changed working
- * set returned in getSelection) here.
- */
- void finish();
+ /**
+ * Called when the working set wizard is closed by selecting the finish button.
+ * Implementers may store the page result (new/changed working set returned in
+ * getSelection) here.
+ */
+ void finish();
- /**
- * Returns the working set edited or created on the page
- * after the wizard has closed.
- * Returns the working set that was initially set using
- * <code>setSelection</code>if the wizard has not been
- * closed yet.
- * Implementors should return the object set in setSelection
- * instead of making a copy and returning the changed copy.
- *
- * @return the working set edited or created on the page.
- */
- IWorkingSet getSelection();
+ /**
+ * Returns the working set edited or created on the page after the wizard has
+ * closed. Returns the working set that was initially set using
+ * <code>setSelection</code>if the wizard has not been closed yet. Implementors
+ * should return the object set in setSelection instead of making a copy and
+ * returning the changed copy.
+ *
+ * @return the working set edited or created on the page.
+ */
+ IWorkingSet getSelection();
- /**
- * Sets the working set edited on the page.
- * Implementors should not make a copy of this working set.
- * The passed object can be edited as is and should be
- * returned in getSelection().
- *
- * @param workingSet the working set edited on the page.
- */
- void setSelection(IWorkingSet workingSet);
+ /**
+ * Sets the working set edited on the page. Implementors should not make a copy
+ * of this working set. The passed object can be edited as is and should be
+ * returned in getSelection().
+ *
+ * @param workingSet the working set edited on the page.
+ */
+ void setSelection(IWorkingSet workingSet);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/IWorkingSetSelectionDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/IWorkingSetSelectionDialog.java
index 894168d4cd8..54d80afb962 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/IWorkingSetSelectionDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/IWorkingSetSelectionDialog.java
@@ -16,8 +16,8 @@ package org.eclipse.ui.dialogs;
import org.eclipse.ui.IWorkingSet;
/**
- * A working set selection dialog displays the list of working
- * sets available in the workbench.
+ * A working set selection dialog displays the list of working sets available in
+ * the workbench.
* <p>
* Use org.eclipse.ui.IWorkingSetManager#createWorkingSetSelectionDialog(Shell)
* to create an instance of this dialog.
@@ -25,34 +25,34 @@ import org.eclipse.ui.IWorkingSet;
* <p>
* This interface is not intended to be implemented by clients.
* </p>
+ *
* @see org.eclipse.ui.IWorkingSetManager
* @since 2.0
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IWorkingSetSelectionDialog {
- /**
- * Returns the working sets selected in the dialog or
- * <code>null</code> if the dialog was canceled.
- *
- * @return the working sets selected in the dialog.
- */
- IWorkingSet[] getSelection();
+ /**
+ * Returns the working sets selected in the dialog or <code>null</code> if the
+ * dialog was canceled.
+ *
+ * @return the working sets selected in the dialog.
+ */
+ IWorkingSet[] getSelection();
- /**
- * Displays the working set selection dialog.
- *
- * @return Window.OK if the dialog closes with the working
- * set selection confirmed.
- * Window.CANCEL if the dialog closes with the working set
- * selection dismissed.
- * @see org.eclipse.jface.window.Window
- */
- int open();
+ /**
+ * Displays the working set selection dialog.
+ *
+ * @return Window.OK if the dialog closes with the working set selection
+ * confirmed. Window.CANCEL if the dialog closes with the working set
+ * selection dismissed.
+ * @see org.eclipse.jface.window.Window
+ */
+ int open();
- /**
- * Sets the working sets that are initially selected in the dialog.
- *
- * @param workingSets the working sets to select in the dialog.
- */
- void setSelection(IWorkingSet[] workingSets);
+ /**
+ * Sets the working sets that are initially selected in the dialog.
+ *
+ * @param workingSets the working sets to select in the dialog.
+ */
+ void setSelection(IWorkingSet[] workingSets);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ListDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ListDialog.java
index e4501dba32f..c93a412a2ce 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ListDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ListDialog.java
@@ -35,155 +35,152 @@ import org.eclipse.swt.widgets.Table;
* @since 2.1
*/
public class ListDialog extends SelectionDialog {
- private IStructuredContentProvider fContentProvider;
-
- private ILabelProvider fLabelProvider;
-
- private Object fInput;
-
- private TableViewer fTableViewer;
-
- private boolean fAddCancelButton = true;
-
- private int widthInChars = 55;
-
- private int heightInChars = 15;
-
- /**
- * Create a new instance of the receiver with parent shell of parent.
- * @param parent
- */
- public ListDialog(Shell parent) {
- super(parent);
- }
-
- /**
- * @param input The input for the list.
- */
- public void setInput(Object input) {
- fInput = input;
- }
-
- /**
- * @param sp The content provider for the list.
- */
- public void setContentProvider(IStructuredContentProvider sp) {
- fContentProvider = sp;
- }
-
- /**
- * @param lp The labelProvider for the list.
- */
- public void setLabelProvider(ILabelProvider lp) {
- fLabelProvider = lp;
- }
-
- /**
- *@param addCancelButton if <code>true</code> there will be a cancel
- * button.
- */
- public void setAddCancelButton(boolean addCancelButton) {
- fAddCancelButton = addCancelButton;
- }
-
- /**
- * @return the TableViewer for the receiver.
- */
- public TableViewer getTableViewer() {
- return fTableViewer;
- }
-
- @Override
+ private IStructuredContentProvider fContentProvider;
+
+ private ILabelProvider fLabelProvider;
+
+ private Object fInput;
+
+ private TableViewer fTableViewer;
+
+ private boolean fAddCancelButton = true;
+
+ private int widthInChars = 55;
+
+ private int heightInChars = 15;
+
+ /**
+ * Create a new instance of the receiver with parent shell of parent.
+ *
+ * @param parent
+ */
+ public ListDialog(Shell parent) {
+ super(parent);
+ }
+
+ /**
+ * @param input The input for the list.
+ */
+ public void setInput(Object input) {
+ fInput = input;
+ }
+
+ /**
+ * @param sp The content provider for the list.
+ */
+ public void setContentProvider(IStructuredContentProvider sp) {
+ fContentProvider = sp;
+ }
+
+ /**
+ * @param lp The labelProvider for the list.
+ */
+ public void setLabelProvider(ILabelProvider lp) {
+ fLabelProvider = lp;
+ }
+
+ /**
+ * @param addCancelButton if <code>true</code> there will be a cancel button.
+ */
+ public void setAddCancelButton(boolean addCancelButton) {
+ fAddCancelButton = addCancelButton;
+ }
+
+ /**
+ * @return the TableViewer for the receiver.
+ */
+ public TableViewer getTableViewer() {
+ return fTableViewer;
+ }
+
+ @Override
protected void createButtonsForButtonBar(Composite parent) {
- if (!fAddCancelButton) {
- createButton(parent, IDialogConstants.OK_ID,
- IDialogConstants.OK_LABEL, true);
+ if (!fAddCancelButton) {
+ createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
} else {
super.createButtonsForButtonBar(parent);
}
- }
+ }
- @Override
+ @Override
protected Control createDialogArea(Composite container) {
- Composite parent = (Composite) super.createDialogArea(container);
- createMessageArea(parent);
- fTableViewer = new TableViewer(parent, getTableStyle());
- fTableViewer.setContentProvider(fContentProvider);
- fTableViewer.setLabelProvider(fLabelProvider);
- fTableViewer.setInput(fInput);
- fTableViewer.addDoubleClickListener(event -> {
- if (fAddCancelButton) {
+ Composite parent = (Composite) super.createDialogArea(container);
+ createMessageArea(parent);
+ fTableViewer = new TableViewer(parent, getTableStyle());
+ fTableViewer.setContentProvider(fContentProvider);
+ fTableViewer.setLabelProvider(fLabelProvider);
+ fTableViewer.setInput(fInput);
+ fTableViewer.addDoubleClickListener(event -> {
+ if (fAddCancelButton) {
okPressed();
}
});
- List initialSelection = getInitialElementSelections();
- if (initialSelection != null) {
- fTableViewer
- .setSelection(new StructuredSelection(initialSelection));
+ List initialSelection = getInitialElementSelections();
+ if (initialSelection != null) {
+ fTableViewer.setSelection(new StructuredSelection(initialSelection));
}
- GridData gd = new GridData(GridData.FILL_BOTH);
- gd.heightHint = convertHeightInCharsToPixels(heightInChars);
- gd.widthHint = convertWidthInCharsToPixels(widthInChars);
- Table table = fTableViewer.getTable();
- table.setLayoutData(gd);
- table.setFont(container.getFont());
- return parent;
- }
-
- /**
- * Return the style flags for the table viewer.
- * @return int
- */
- protected int getTableStyle() {
- return SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER;
- }
-
- /*
- * Overrides method from Dialog
- */
- @Override
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.heightHint = convertHeightInCharsToPixels(heightInChars);
+ gd.widthHint = convertWidthInCharsToPixels(widthInChars);
+ Table table = fTableViewer.getTable();
+ table.setLayoutData(gd);
+ table.setFont(container.getFont());
+ return parent;
+ }
+
+ /**
+ * Return the style flags for the table viewer.
+ *
+ * @return int
+ */
+ protected int getTableStyle() {
+ return SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER;
+ }
+
+ /*
+ * Overrides method from Dialog
+ */
+ @Override
protected void okPressed() {
- // Build a list of selected children.
+ // Build a list of selected children.
IStructuredSelection selection = fTableViewer.getStructuredSelection();
- setResult(selection.toList());
- super.okPressed();
- }
-
- /**
- * Returns the initial height of the dialog in number of characters.
- *
- * @return the initial height of the dialog in number of characters
- */
- public int getHeightInChars() {
- return heightInChars;
- }
-
- /**
- * Returns the initial width of the dialog in number of characters.
- *
- * @return the initial width of the dialog in number of characters
- */
- public int getWidthInChars() {
- return widthInChars;
- }
-
- /**
- * Sets the initial height of the dialog in number of characters.
- *
- * @param heightInChars
- * the initialheight of the dialog in number of characters
- */
- public void setHeightInChars(int heightInChars) {
- this.heightInChars = heightInChars;
- }
-
- /**
- * Sets the initial width of the dialog in number of characters.
- *
- * @param widthInChars
- * the initial width of the dialog in number of characters
- */
- public void setWidthInChars(int widthInChars) {
- this.widthInChars = widthInChars;
- }
+ setResult(selection.toList());
+ super.okPressed();
+ }
+
+ /**
+ * Returns the initial height of the dialog in number of characters.
+ *
+ * @return the initial height of the dialog in number of characters
+ */
+ public int getHeightInChars() {
+ return heightInChars;
+ }
+
+ /**
+ * Returns the initial width of the dialog in number of characters.
+ *
+ * @return the initial width of the dialog in number of characters
+ */
+ public int getWidthInChars() {
+ return widthInChars;
+ }
+
+ /**
+ * Sets the initial height of the dialog in number of characters.
+ *
+ * @param heightInChars the initialheight of the dialog in number of characters
+ */
+ public void setHeightInChars(int heightInChars) {
+ this.heightInChars = heightInChars;
+ }
+
+ /**
+ * Sets the initial width of the dialog in number of characters.
+ *
+ * @param widthInChars the initial width of the dialog in number of characters
+ */
+ public void setWidthInChars(int widthInChars) {
+ this.widthInChars = widthInChars;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ListSelectionDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ListSelectionDialog.java
index f700ba4be11..7ffac18cfe5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ListSelectionDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ListSelectionDialog.java
@@ -59,162 +59,160 @@ import org.eclipse.ui.internal.WorkbenchMessages;
* @noextend This class is not intended to be subclassed by clients.
*/
public class ListSelectionDialog extends SelectionDialog {
- // the root element to populate the viewer with
- private Object inputElement;
-
- // providers for populating this dialog
- private ILabelProvider labelProvider;
-
- private IStructuredContentProvider contentProvider;
-
- // the visual selection widget group
- CheckboxTableViewer listViewer;
-
- // sizing constants
- private static final int SIZING_SELECTION_WIDGET_HEIGHT = 250;
-
- private static final int SIZING_SELECTION_WIDGET_WIDTH = 300;
-
- /**
- * Creates a list selection dialog.
- *
- * @param parentShell the parent shell
- * @param input the root element to populate this dialog with
- * @param contentProvider the content provider for navigating the model
- * @param labelProvider the label provider for displaying model elements
- * @param message the message to be displayed at the top of this dialog, or
- * <code>null</code> to display a default message
- */
- public ListSelectionDialog(Shell parentShell, Object input,
- IStructuredContentProvider contentProvider,
- ILabelProvider labelProvider, String message) {
- super(parentShell);
- setTitle(WorkbenchMessages.ListSelection_title);
- inputElement = input;
- this.contentProvider = contentProvider;
- this.labelProvider = labelProvider;
- if (message != null) {
+ // the root element to populate the viewer with
+ private Object inputElement;
+
+ // providers for populating this dialog
+ private ILabelProvider labelProvider;
+
+ private IStructuredContentProvider contentProvider;
+
+ // the visual selection widget group
+ CheckboxTableViewer listViewer;
+
+ // sizing constants
+ private static final int SIZING_SELECTION_WIDGET_HEIGHT = 250;
+
+ private static final int SIZING_SELECTION_WIDGET_WIDTH = 300;
+
+ /**
+ * Creates a list selection dialog.
+ *
+ * @param parentShell the parent shell
+ * @param input the root element to populate this dialog with
+ * @param contentProvider the content provider for navigating the model
+ * @param labelProvider the label provider for displaying model elements
+ * @param message the message to be displayed at the top of this dialog,
+ * or <code>null</code> to display a default message
+ */
+ public ListSelectionDialog(Shell parentShell, Object input, IStructuredContentProvider contentProvider,
+ ILabelProvider labelProvider, String message) {
+ super(parentShell);
+ setTitle(WorkbenchMessages.ListSelection_title);
+ inputElement = input;
+ this.contentProvider = contentProvider;
+ this.labelProvider = labelProvider;
+ if (message != null) {
setMessage(message);
} else {
setMessage(WorkbenchMessages.ListSelection_message);
}
- }
-
- /**
- * Add the selection and deselection buttons to the dialog.
- * @param composite org.eclipse.swt.widgets.Composite
- */
- private void addSelectionButtons(Composite composite) {
- Composite buttonComposite = new Composite(composite, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 0;
+ }
+
+ /**
+ * Add the selection and deselection buttons to the dialog.
+ *
+ * @param composite org.eclipse.swt.widgets.Composite
+ */
+ private void addSelectionButtons(Composite composite) {
+ Composite buttonComposite = new Composite(composite, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 0;
layout.marginWidth = 0;
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- buttonComposite.setLayout(layout);
- buttonComposite.setLayoutData(new GridData(SWT.END, SWT.TOP, true, false));
+ buttonComposite.setLayout(layout);
+ buttonComposite.setLayoutData(new GridData(SWT.END, SWT.TOP, true, false));
- Button selectButton = createButton(buttonComposite,
- IDialogConstants.SELECT_ALL_ID, SELECT_ALL_TITLE, false);
+ Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID, SELECT_ALL_TITLE, false);
- SelectionListener listener = widgetSelectedAdapter(e -> listViewer.setAllChecked(true));
- selectButton.addSelectionListener(listener);
+ SelectionListener listener = widgetSelectedAdapter(e -> listViewer.setAllChecked(true));
+ selectButton.addSelectionListener(listener);
- Button deselectButton = createButton(buttonComposite,
- IDialogConstants.DESELECT_ALL_ID, DESELECT_ALL_TITLE, false);
+ Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, DESELECT_ALL_TITLE,
+ false);
- listener = widgetSelectedAdapter(e -> listViewer.setAllChecked(false));
- deselectButton.addSelectionListener(listener);
- }
+ listener = widgetSelectedAdapter(e -> listViewer.setAllChecked(false));
+ deselectButton.addSelectionListener(listener);
+ }
- /**
- * Visually checks the previously-specified elements in this dialog's list
- * viewer.
- */
- private void checkInitialSelections() {
- Iterator itemsToCheck = getInitialElementSelections().iterator();
+ /**
+ * Visually checks the previously-specified elements in this dialog's list
+ * viewer.
+ */
+ private void checkInitialSelections() {
+ Iterator itemsToCheck = getInitialElementSelections().iterator();
- while (itemsToCheck.hasNext()) {
+ while (itemsToCheck.hasNext()) {
listViewer.setChecked(itemsToCheck.next(), true);
}
- }
+ }
- @Override
+ @Override
protected void configureShell(Shell shell) {
- super.configureShell(shell);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(shell,
- IWorkbenchHelpContextIds.LIST_SELECTION_DIALOG);
- }
+ super.configureShell(shell);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(shell, IWorkbenchHelpContextIds.LIST_SELECTION_DIALOG);
+ }
- @Override
+ @Override
protected Control createDialogArea(Composite parent) {
- // page group
- Composite composite = (Composite) super.createDialogArea(parent);
+ // page group
+ Composite composite = (Composite) super.createDialogArea(parent);
- initializeDialogUnits(composite);
+ initializeDialogUnits(composite);
- createMessageArea(composite);
+ createMessageArea(composite);
- listViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT;
- data.widthHint = SIZING_SELECTION_WIDGET_WIDTH;
- listViewer.getTable().setLayoutData(data);
+ listViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER);
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT;
+ data.widthHint = SIZING_SELECTION_WIDGET_WIDTH;
+ listViewer.getTable().setLayoutData(data);
- listViewer.setLabelProvider(labelProvider);
- listViewer.setContentProvider(contentProvider);
+ listViewer.setLabelProvider(labelProvider);
+ listViewer.setContentProvider(contentProvider);
- addSelectionButtons(composite);
+ addSelectionButtons(composite);
- initializeViewer();
+ initializeViewer();
- // initialize page
- if (!getInitialElementSelections().isEmpty()) {
+ // initialize page
+ if (!getInitialElementSelections().isEmpty()) {
checkInitialSelections();
}
- Dialog.applyDialogFont(composite);
-
- return composite;
- }
-
- /**
- * Returns the viewer used to show the list.
- *
- * @return the viewer, or <code>null</code> if not yet created
- */
- protected CheckboxTableViewer getViewer() {
- return listViewer;
- }
-
- /**
- * Initializes this dialog's viewer after it has been laid out.
- */
- private void initializeViewer() {
- listViewer.setInput(inputElement);
- }
-
- /**
- * The <code>ListSelectionDialog</code> implementation of this
- * <code>Dialog</code> method builds a list of the selected elements for later
- * retrieval by the client and closes this dialog.
- */
- @Override
+ Dialog.applyDialogFont(composite);
+
+ return composite;
+ }
+
+ /**
+ * Returns the viewer used to show the list.
+ *
+ * @return the viewer, or <code>null</code> if not yet created
+ */
+ protected CheckboxTableViewer getViewer() {
+ return listViewer;
+ }
+
+ /**
+ * Initializes this dialog's viewer after it has been laid out.
+ */
+ private void initializeViewer() {
+ listViewer.setInput(inputElement);
+ }
+
+ /**
+ * The <code>ListSelectionDialog</code> implementation of this
+ * <code>Dialog</code> method builds a list of the selected elements for later
+ * retrieval by the client and closes this dialog.
+ */
+ @Override
protected void okPressed() {
- // Get the input children.
- Object[] children = contentProvider.getElements(inputElement);
+ // Get the input children.
+ Object[] children = contentProvider.getElements(inputElement);
- // Build a list of selected children.
- if (children != null) {
- ArrayList list = new ArrayList();
- for (Object element : children) {
- if (listViewer.getChecked(element)) {
+ // Build a list of selected children.
+ if (children != null) {
+ ArrayList list = new ArrayList();
+ for (Object element : children) {
+ if (listViewer.getChecked(element)) {
list.add(element);
}
- }
- setResult(list);
- }
+ }
+ setResult(list);
+ }
- super.okPressed();
- }
+ super.okPressed();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/PatternFilter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/PatternFilter.java
index 3aeefed5cc9..6457b58473c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/PatternFilter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/PatternFilter.java
@@ -39,91 +39,90 @@ public class PatternFilter extends ViewerFilter {
/*
* Cache of filtered elements in the tree
*/
- private Map cache = new HashMap();
+ private Map cache = new HashMap();
- /*
- * Maps parent elements to TRUE or FALSE
- */
- private Map foundAnyCache = new HashMap();
+ /*
+ * Maps parent elements to TRUE or FALSE
+ */
+ private Map foundAnyCache = new HashMap();
- private boolean useCache = false;
+ private boolean useCache = false;
/**
- * Whether to include a leading wildcard for all provided patterns. A
- * trailing wildcard is always included.
+ * Whether to include a leading wildcard for all provided patterns. A trailing
+ * wildcard is always included.
*/
private boolean includeLeadingWildcard = false;
/**
* The string pattern matcher used for this pattern filter.
*/
- private StringMatcher matcher;
+ private StringMatcher matcher;
- private boolean useEarlyReturnIfMatcherIsNull = true;
+ private boolean useEarlyReturnIfMatcherIsNull = true;
- private static Object[] EMPTY = new Object[0];
+ private static Object[] EMPTY = new Object[0];
- @Override
+ @Override
public Object[] filter(Viewer viewer, Object parent, Object[] elements) {
- // we don't want to optimize if we've extended the filter ... this
- // needs to be addressed in 3.4
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=186404
- if (matcher == null && useEarlyReturnIfMatcherIsNull) {
+ // we don't want to optimize if we've extended the filter ... this
+ // needs to be addressed in 3.4
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=186404
+ if (matcher == null && useEarlyReturnIfMatcherIsNull) {
return elements;
}
- if (!useCache) {
- return super.filter(viewer, parent, elements);
- }
+ if (!useCache) {
+ return super.filter(viewer, parent, elements);
+ }
- Object[] filtered = (Object[]) cache.get(parent);
- if (filtered == null) {
- Boolean foundAny = (Boolean) foundAnyCache.get(parent);
- if (foundAny != null && !foundAny.booleanValue()) {
- filtered = EMPTY;
- } else {
- filtered = super.filter(viewer, parent, elements);
- }
- cache.put(parent, filtered);
- }
- return filtered;
- }
+ Object[] filtered = (Object[]) cache.get(parent);
+ if (filtered == null) {
+ Boolean foundAny = (Boolean) foundAnyCache.get(parent);
+ if (foundAny != null && !foundAny.booleanValue()) {
+ filtered = EMPTY;
+ } else {
+ filtered = super.filter(viewer, parent, elements);
+ }
+ cache.put(parent, filtered);
+ }
+ return filtered;
+ }
- /**
- * Returns true if any of the elements makes it through the filter.
- * This method uses caching if enabled; the computation is done in
- * computeAnyVisible.
- *
- * @param viewer
- * @param parent
- * @param elements the elements (must not be an empty array)
- * @return true if any of the elements makes it through the filter.
- */
- private boolean isAnyVisible(Viewer viewer, Object parent, Object[] elements) {
- if (matcher == null) {
- return true;
- }
+ /**
+ * Returns true if any of the elements makes it through the filter. This method
+ * uses caching if enabled; the computation is done in computeAnyVisible.
+ *
+ * @param viewer
+ * @param parent
+ * @param elements the elements (must not be an empty array)
+ * @return true if any of the elements makes it through the filter.
+ */
+ private boolean isAnyVisible(Viewer viewer, Object parent, Object[] elements) {
+ if (matcher == null) {
+ return true;
+ }
- if (!useCache) {
- return computeAnyVisible(viewer, elements);
- }
+ if (!useCache) {
+ return computeAnyVisible(viewer, elements);
+ }
- Object[] filtered = (Object[]) cache.get(parent);
- if (filtered != null) {
- return filtered.length > 0;
- }
- Boolean foundAny = (Boolean) foundAnyCache.get(parent);
- if (foundAny == null) {
- foundAny = computeAnyVisible(viewer, elements) ? Boolean.TRUE : Boolean.FALSE;
- foundAnyCache.put(parent, foundAny);
- }
- return foundAny.booleanValue();
- }
+ Object[] filtered = (Object[]) cache.get(parent);
+ if (filtered != null) {
+ return filtered.length > 0;
+ }
+ Boolean foundAny = (Boolean) foundAnyCache.get(parent);
+ if (foundAny == null) {
+ foundAny = computeAnyVisible(viewer, elements) ? Boolean.TRUE : Boolean.FALSE;
+ foundAnyCache.put(parent, foundAny);
+ }
+ return foundAny.booleanValue();
+ }
/**
* Returns true if any of the elements makes it through the filter.
*
- * @param viewer the viewer
+ * @param viewer the viewer
* @param elements the elements to test
* @return <code>true</code> if any of the elements makes it through the filter
*/
@@ -136,42 +135,38 @@ public class PatternFilter extends ViewerFilter {
return elementFound;
}
- @Override
- public final boolean select(Viewer viewer, Object parentElement,
- Object element) {
- return isElementVisible(viewer, element);
- }
+ @Override
+ public final boolean select(Viewer viewer, Object parentElement, Object element) {
+ return isElementVisible(viewer, element);
+ }
- /**
- * Sets whether a leading wildcard should be attached to each pattern
- * string.
+ /**
+ * Sets whether a leading wildcard should be attached to each pattern string.
*
- * @param includeLeadingWildcard
- * Whether a leading wildcard should be added.
+ * @param includeLeadingWildcard Whether a leading wildcard should be added.
*/
- public final void setIncludeLeadingWildcard(
- final boolean includeLeadingWildcard) {
+ public final void setIncludeLeadingWildcard(final boolean includeLeadingWildcard) {
this.includeLeadingWildcard = includeLeadingWildcard;
}
- /**
- * The pattern string for which this filter should select
- * elements in the viewer.
- *
- * @param patternString
- */
- public void setPattern(String patternString) {
- // these 2 strings allow the PatternFilter to be extended in
- // 3.3 - https://bugs.eclipse.org/bugs/show_bug.cgi?id=186404
- if ("org.eclipse.ui.keys.optimization.true".equals(patternString)) { //$NON-NLS-1$
- useEarlyReturnIfMatcherIsNull = true;
- return;
- } else if ("org.eclipse.ui.keys.optimization.false".equals(patternString)) { //$NON-NLS-1$
- useEarlyReturnIfMatcherIsNull = false;
- return;
- }
- clearCaches();
- if (patternString == null || patternString.equals("")) { //$NON-NLS-1$
+ /**
+ * The pattern string for which this filter should select elements in the
+ * viewer.
+ *
+ * @param patternString
+ */
+ public void setPattern(String patternString) {
+ // these 2 strings allow the PatternFilter to be extended in
+ // 3.3 - https://bugs.eclipse.org/bugs/show_bug.cgi?id=186404
+ if ("org.eclipse.ui.keys.optimization.true".equals(patternString)) { //$NON-NLS-1$
+ useEarlyReturnIfMatcherIsNull = true;
+ return;
+ } else if ("org.eclipse.ui.keys.optimization.false".equals(patternString)) { //$NON-NLS-1$
+ useEarlyReturnIfMatcherIsNull = false;
+ return;
+ }
+ clearCaches();
+ if (patternString == null || patternString.equals("")) { //$NON-NLS-1$
matcher = null;
} else {
String pattern = patternString;
@@ -182,74 +177,73 @@ public class PatternFilter extends ViewerFilter {
}
matcher = new StringMatcher(pattern, true, false);
}
- }
+ }
/**
- * Clears the caches used for optimizing this filter. Needs to be called whenever
- * the tree content changes.
+ * Clears the caches used for optimizing this filter. Needs to be called
+ * whenever the tree content changes.
*/
/* package */ void clearCaches() {
cache.clear();
- foundAnyCache.clear();
+ foundAnyCache.clear();
}
- /**
- * Answers whether the given String matches the pattern.
- *
- * @param string the String to test
- *
- * @return whether the string matches the pattern
- */
- private boolean match(String string) {
- if (matcher == null) {
+ /**
+ * Answers whether the given String matches the pattern.
+ *
+ * @param string the String to test
+ *
+ * @return whether the string matches the pattern
+ */
+ private boolean match(String string) {
+ if (matcher == null) {
return true;
}
- return matcher.match(string);
- }
+ return matcher.match(string);
+ }
- /**
- * Answers whether the given element is a valid selection in
- * the filtered tree. For example, if a tree has items that
- * are categorized, the category itself may not be a valid
- * selection since it is used merely to organize the elements.
- *
- * @param element
- * @return true if this element is eligible for automatic selection
- */
- public boolean isElementSelectable(Object element){
- return element != null;
- }
+ /**
+ * Answers whether the given element is a valid selection in the filtered tree.
+ * For example, if a tree has items that are categorized, the category itself
+ * may not be a valid selection since it is used merely to organize the
+ * elements.
+ *
+ * @param element
+ * @return true if this element is eligible for automatic selection
+ */
+ public boolean isElementSelectable(Object element) {
+ return element != null;
+ }
- /**
- * Answers whether the given element in the given viewer matches
- * the filter pattern. This is a default implementation that will
- * show a leaf element in the tree based on whether the provided
- * filter text matches the text of the given element's text, or that
- * of it's children (if the element has any).
- *
- * Subclasses may override this method.
- *
- * @param viewer the tree viewer in which the element resides
- * @param element the element in the tree to check for a match
- *
- * @return true if the element matches the filter pattern
- */
- public boolean isElementVisible(Viewer viewer, Object element){
- return isParentMatch(viewer, element) || isLeafMatch(viewer, element);
- }
+ /**
+ * Answers whether the given element in the given viewer matches the filter
+ * pattern. This is a default implementation that will show a leaf element in
+ * the tree based on whether the provided filter text matches the text of the
+ * given element's text, or that of it's children (if the element has any).
+ *
+ * Subclasses may override this method.
+ *
+ * @param viewer the tree viewer in which the element resides
+ * @param element the element in the tree to check for a match
+ *
+ * @return true if the element matches the filter pattern
+ */
+ public boolean isElementVisible(Viewer viewer, Object element) {
+ return isParentMatch(viewer, element) || isLeafMatch(viewer, element);
+ }
- /**
- * Check if the parent (category) is a match to the filter text. The default
- * behavior returns true if the element has at least one child element that is
- * a match with the filter text.
- *
- * Subclasses may override this method.
- *
- * @param viewer the viewer that contains the element
- * @param element the tree element to check
- * @return true if the given element has children that matches the filter text
- */
- protected boolean isParentMatch(Viewer viewer, Object element){
+ /**
+ * Check if the parent (category) is a match to the filter text. The default
+ * behavior returns true if the element has at least one child element that is a
+ * match with the filter text.
+ *
+ * Subclasses may override this method.
+ *
+ * @param viewer the viewer that contains the element
+ * @param element the tree element to check
+ * @return true if the given element has children that matches the filter text
+ */
+ protected boolean isParentMatch(Viewer viewer, Object element) {
if (viewer instanceof AbstractTreeViewer
&& ((AbstractTreeViewer) viewer).getContentProvider() instanceof ITreeContentProvider) {
Object[] children = ((ITreeContentProvider) ((AbstractTreeViewer) viewer).getContentProvider())
@@ -257,44 +251,42 @@ public class PatternFilter extends ViewerFilter {
return children != null && children.length > 0 && isAnyVisible(viewer, element, children);
}
- return false;
- }
+ return false;
+ }
- /**
- * Check if the current (leaf) element is a match with the filter text.
- * The default behavior checks that the label of the element is a match.
- *
- * Subclasses should override this method.
- *
- * @param viewer the viewer that contains the element
- * @param element the tree element to check
- * @return true if the given element's label matches the filter text
- */
- protected boolean isLeafMatch(Viewer viewer, Object element){
- String labelText = ((ILabelProvider) ((ContentViewer) viewer)
- .getLabelProvider()).getText(element);
+ /**
+ * Check if the current (leaf) element is a match with the filter text. The
+ * default behavior checks that the label of the element is a match.
+ *
+ * Subclasses should override this method.
+ *
+ * @param viewer the viewer that contains the element
+ * @param element the tree element to check
+ * @return true if the given element's label matches the filter text
+ */
+ protected boolean isLeafMatch(Viewer viewer, Object element) {
+ String labelText = ((ILabelProvider) ((ContentViewer) viewer).getLabelProvider()).getText(element);
- if(labelText == null) {
+ if (labelText == null) {
return false;
}
- return wordMatches(labelText);
- }
+ return wordMatches(labelText);
+ }
/**
- * Return whether or not if any of the words in text satisfy the
- * match critera.
+ * Return whether or not if any of the words in text satisfy the match critera.
*
* @param text the text to match
- * @return boolean <code>true</code> if one of the words in text
- * satisifes the match criteria.
+ * @return boolean <code>true</code> if one of the words in text satisifes the
+ * match criteria.
*/
protected boolean wordMatches(String text) {
if (text == null) {
return false;
}
- //If the whole text matches we are all set
- if(match(text)) {
+ // If the whole text matches we are all set
+ if (match(text)) {
return true;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/PreferenceLinkArea.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/PreferenceLinkArea.java
index 6a9d95a84bb..0a75e21c244 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/PreferenceLinkArea.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/PreferenceLinkArea.java
@@ -36,71 +36,63 @@ import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
*/
public class PreferenceLinkArea extends Object {
- private Link pageLink;
+ private Link pageLink;
- /**
- * Create a new instance of the receiver
- *
- * @param parent
- * the parent Composite
- * @param style
- * the SWT style
- * @param pageId
- * the page id
- * @param message
- * the message to use as text. If this message has {0} in
- * its value it will be bound with the displayed name of
- * the preference page. This message must be well formed
- * html if you wish to link to another page.
- * @param pageContainer -
- * The container another page will be opened in.
- * @param pageData -
- * The data to apply to the page.
- */
- public PreferenceLinkArea(Composite parent, int style, final String pageId,
- String message, final IWorkbenchPreferenceContainer pageContainer,
- final Object pageData) {
- pageLink = new Link(parent, style);
+ /**
+ * Create a new instance of the receiver
+ *
+ * @param parent the parent Composite
+ * @param style the SWT style
+ * @param pageId the page id
+ * @param message the message to use as text. If this message has {0} in
+ * its value it will be bound with the displayed name of
+ * the preference page. This message must be well formed
+ * html if you wish to link to another page.
+ * @param pageContainer - The container another page will be opened in.
+ * @param pageData - The data to apply to the page.
+ */
+ public PreferenceLinkArea(Composite parent, int style, final String pageId, String message,
+ final IWorkbenchPreferenceContainer pageContainer, final Object pageData) {
+ pageLink = new Link(parent, style);
- IPreferenceNode node = getPreferenceNode(pageId);
- String result;
- if (node == null) {
- result = NLS.bind(
- WorkbenchMessages.PreferenceNode_NotFound, pageId);
+ IPreferenceNode node = getPreferenceNode(pageId);
+ String result;
+ if (node == null) {
+ result = NLS.bind(WorkbenchMessages.PreferenceNode_NotFound, pageId);
} else {
result = MessageFormat.format(message, node.getLabelText());
- //Only add the selection listener if the node is found
- pageLink.addSelectionListener(widgetSelectedAdapter(e -> pageContainer.openPage(pageId, pageData)));
- }
- pageLink.setText(result);
+ // Only add the selection listener if the node is found
+ pageLink.addSelectionListener(widgetSelectedAdapter(e -> pageContainer.openPage(pageId, pageData)));
+ }
+ pageLink.setText(result);
- }
+ }
- /**
- * Get the preference node with pageId.
- *
- * @param pageId
- * @return IPreferenceNode
- */
- private IPreferenceNode getPreferenceNode(String pageId) {
- Iterator iterator = PlatformUI.getWorkbench().getPreferenceManager()
- .getElements(PreferenceManager.PRE_ORDER).iterator();
- while (iterator.hasNext()) {
- IPreferenceNode next = (IPreferenceNode) iterator.next();
- if (next.getId().equals(pageId)) {
+ /**
+ * Get the preference node with pageId.
+ *
+ * @param pageId
+ * @return IPreferenceNode
+ */
+ private IPreferenceNode getPreferenceNode(String pageId) {
+ Iterator iterator = PlatformUI.getWorkbench().getPreferenceManager().getElements(PreferenceManager.PRE_ORDER)
+ .iterator();
+ while (iterator.hasNext()) {
+ IPreferenceNode next = (IPreferenceNode) iterator.next();
+ if (next.getId().equals(pageId)) {
return next;
}
- }
- return null;
- }
+ }
+ return null;
+ }
- /**
- * Return the control for the receiver.
- *
- * @return Control
- */
- public Control getControl() {
- return pageLink;
- }
+ /**
+ * Return the control for the receiver.
+ *
+ * @return Control
+ */
+ public Control getControl() {
+ return pageLink;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/PreferencesUtil.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/PreferencesUtil.java
index c457cc3b775..a609152acf8 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/PreferencesUtil.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/PreferencesUtil.java
@@ -38,17 +38,18 @@ public final class PreferencesUtil {
/**
* Constant denoting no option.
+ *
* @since 3.5
*/
public static final int OPTION_NONE = 0;
/**
- * Constant for configuring a preferences or properties dialog in which the
- * user cannot "unfilter" to show a larger set of pages than was passed to
- * {@link #createPreferenceDialogOn(Shell, String, String[], Object, int)}
- * or
+ * Constant for configuring a preferences or properties dialog in which the user
+ * cannot "unfilter" to show a larger set of pages than was passed to
+ * {@link #createPreferenceDialogOn(Shell, String, String[], Object, int)} or
* {@link #createPropertyDialogOn(Shell, IAdaptable, String, String[], Object, int)}
* .
+ *
* @since 3.5
*/
public static final int OPTION_FILTER_LOCKED = 1;
@@ -56,16 +57,12 @@ public final class PreferencesUtil {
/**
* Apply the data to the first page if there is any.
*
- * @param data
- * The data to be applied
- * @param displayedIds
- * The ids to filter to.
- * @param dialog
- * The dialog to apply to.
+ * @param data The data to be applied
+ * @param displayedIds The ids to filter to.
+ * @param dialog The dialog to apply to.
* @param options
*/
- private static void applyOptions(Object data, String[] displayedIds,
- FilteredPreferenceDialog dialog, int options) {
+ private static void applyOptions(Object data, String[] displayedIds, FilteredPreferenceDialog dialog, int options) {
if (data != null) {
dialog.setPageData(data);
IPreferencePage page = dialog.getCurrentPage();
@@ -84,115 +81,104 @@ public final class PreferencesUtil {
}
/**
- * Creates a workbench preference dialog and selects particular preference
- * page. If there is already a preference dialog open this dialog is used
- * and its selection is set to the page with id preferencePageId. Show the
- * other pages as filtered results using whatever filtering criteria the
- * search uses. It is the responsibility of the caller to then call
- * <code>open()</code>. The call to <code>open()</code> will not return
- * until the dialog closes, so this is the last chance to manipulate the
- * dialog.
+ * Creates a workbench preference dialog and selects particular preference page.
+ * If there is already a preference dialog open this dialog is used and its
+ * selection is set to the page with id preferencePageId. Show the other pages
+ * as filtered results using whatever filtering criteria the search uses. It is
+ * the responsibility of the caller to then call <code>open()</code>. The call
+ * to <code>open()</code> will not return until the dialog closes, so this is
+ * the last chance to manipulate the dialog.
*
- * @param shell
- * The Shell to parent the dialog off of if it is not already
- * created. May be <code>null</code> in which case the active
- * workbench window will be used if available.
- * @param preferencePageId
- * The identifier of the preference page to open; may be
- * <code>null</code>. If it is <code>null</code>, then the
- * preference page is not selected or modified in any way.
- * @param displayedIds
- * The ids of the other pages to be displayed using the same
- * filtering criterea as search. If this is <code>null</code>,
- * then the all preference pages are shown.
- * @param data
- * Data that will be passed to all of the preference pages to be
- * applied as specified within the page as they are created. If
- * the data is <code>null</code> nothing will be called.
+ * @param shell The Shell to parent the dialog off of if it is not
+ * already created. May be <code>null</code> in which
+ * case the active workbench window will be used if
+ * available.
+ * @param preferencePageId The identifier of the preference page to open; may be
+ * <code>null</code>. If it is <code>null</code>, then
+ * the preference page is not selected or modified in
+ * any way.
+ * @param displayedIds The ids of the other pages to be displayed using the
+ * same filtering criterea as search. If this is
+ * <code>null</code>, then the all preference pages are
+ * shown.
+ * @param data Data that will be passed to all of the preference
+ * pages to be applied as specified within the page as
+ * they are created. If the data is <code>null</code>
+ * nothing will be called.
*
* @return a preference dialog.
* @since 3.1
* @see PreferenceDialog#PreferenceDialog(Shell, PreferenceManager)
*/
- public static PreferenceDialog createPreferenceDialogOn(Shell shell,
- String preferencePageId, String[] displayedIds, Object data) {
- return createPreferenceDialogOn(shell, preferencePageId, displayedIds, data,
- OPTION_NONE);
+ public static PreferenceDialog createPreferenceDialogOn(Shell shell, String preferencePageId, String[] displayedIds,
+ Object data) {
+ return createPreferenceDialogOn(shell, preferencePageId, displayedIds, data, OPTION_NONE);
}
/**
- * Creates a workbench preference dialog to a particular preference page.
- * Show the other pages as filtered results using whatever filtering
- * criteria the search uses. It is the responsibility of the caller to then
- * call <code>open()</code>. The call to <code>open()</code> will not
- * return until the dialog closes, so this is the last chance to manipulate
- * the dialog.
+ * Creates a workbench preference dialog to a particular preference page. Show
+ * the other pages as filtered results using whatever filtering criteria the
+ * search uses. It is the responsibility of the caller to then call
+ * <code>open()</code>. The call to <code>open()</code> will not return until
+ * the dialog closes, so this is the last chance to manipulate the dialog.
*
- * @param shell
- * The shell to use to parent the dialog if required.
- * @param propertyPageId
- * The identifier of the preference page to open; may be
- * <code>null</code>. If it is <code>null</code>, then the
- * dialog is opened with no selected page.
- * @param element
- * IAdaptable An adaptable element to open the dialog on.
- * @param displayedIds
- * The ids of the other pages to be displayed using the same
- * filtering criterea as search. If this is <code>null</code>,
- * then the all preference pages are shown.
- * @param data
- * Data that will be passed to all of the preference pages to be
- * applied as specified within the page as they are created. If
- * the data is <code>null</code> nothing will be called.
+ * @param shell The shell to use to parent the dialog if required.
+ * @param propertyPageId The identifier of the preference page to open; may be
+ * <code>null</code>. If it is <code>null</code>, then the
+ * dialog is opened with no selected page.
+ * @param element IAdaptable An adaptable element to open the dialog on.
+ * @param displayedIds The ids of the other pages to be displayed using the
+ * same filtering criterea as search. If this is
+ * <code>null</code>, then the all preference pages are
+ * shown.
+ * @param data Data that will be passed to all of the preference pages
+ * to be applied as specified within the page as they are
+ * created. If the data is <code>null</code> nothing will
+ * be called.
*
* @return A preference dialog showing properties for the selection or
* <code>null</code> if it could not be created.
* @since 3.1
*/
- public static PreferenceDialog createPropertyDialogOn(Shell shell,
- final IAdaptable element, String propertyPageId,
+ public static PreferenceDialog createPropertyDialogOn(Shell shell, final IAdaptable element, String propertyPageId,
String[] displayedIds, Object data) {
- return createPropertyDialogOn(shell, element, propertyPageId, displayedIds, data,
- OPTION_NONE);
+ return createPropertyDialogOn(shell, element, propertyPageId, displayedIds, data, OPTION_NONE);
}
/**
- * Creates a workbench preference dialog and selects particular preference
- * page. If there is already a preference dialog open this dialog is used
- * and its selection is set to the page with id preferencePageId. Show the
- * other pages as filtered results using whatever filtering criteria the
- * search uses. It is the responsibility of the caller to then call
- * <code>open()</code>. The call to <code>open()</code> will not return
- * until the dialog closes, so this is the last chance to manipulate the
- * dialog.
+ * Creates a workbench preference dialog and selects particular preference page.
+ * If there is already a preference dialog open this dialog is used and its
+ * selection is set to the page with id preferencePageId. Show the other pages
+ * as filtered results using whatever filtering criteria the search uses. It is
+ * the responsibility of the caller to then call <code>open()</code>. The call
+ * to <code>open()</code> will not return until the dialog closes, so this is
+ * the last chance to manipulate the dialog.
*
- * @param shell
- * The Shell to parent the dialog off of if it is not already
- * created. May be <code>null</code> in which case the active
- * workbench window will be used if available.
- * @param preferencePageId
- * The identifier of the preference page to open; may be
- * <code>null</code>. If it is <code>null</code>, then the
- * preference page is not selected or modified in any way.
- * @param displayedIds
- * The ids of the other pages to be displayed using the same
- * filtering criterea as search. If this is <code>null</code>,
- * then the all preference pages are shown.
- * @param data
- * Data that will be passed to all of the preference pages to be
- * applied as specified within the page as they are created. If
- * the data is <code>null</code> nothing will be called.
- * @param options
- * a bitwise OR of option constants
+ * @param shell The Shell to parent the dialog off of if it is not
+ * already created. May be <code>null</code> in which
+ * case the active workbench window will be used if
+ * available.
+ * @param preferencePageId The identifier of the preference page to open; may be
+ * <code>null</code>. If it is <code>null</code>, then
+ * the preference page is not selected or modified in
+ * any way.
+ * @param displayedIds The ids of the other pages to be displayed using the
+ * same filtering criterea as search. If this is
+ * <code>null</code>, then the all preference pages are
+ * shown.
+ * @param data Data that will be passed to all of the preference
+ * pages to be applied as specified within the page as
+ * they are created. If the data is <code>null</code>
+ * nothing will be called.
+ * @param options a bitwise OR of option constants
*
* @return a preference dialog.
* @since 3.5
* @see PreferenceDialog#PreferenceDialog(Shell, PreferenceManager)
*/
- public static PreferenceDialog createPreferenceDialogOn(Shell shell,
- String preferencePageId, String[] displayedIds, Object data, int options) {
- FilteredPreferenceDialog dialog = WorkbenchPreferenceDialog
- .createDialogOn(shell, preferencePageId);
+ public static PreferenceDialog createPreferenceDialogOn(Shell shell, String preferencePageId, String[] displayedIds,
+ Object data, int options) {
+ FilteredPreferenceDialog dialog = WorkbenchPreferenceDialog.createDialogOn(shell, preferencePageId);
applyOptions(data, displayedIds, dialog, options);
@@ -200,42 +186,35 @@ public final class PreferencesUtil {
}
/**
- * Creates a workbench preference dialog to a particular preference page.
- * Show the other pages as filtered results using whatever filtering
- * criteria the search uses. It is the responsibility of the caller to then
- * call <code>open()</code>. The call to <code>open()</code> will not return
- * until the dialog closes, so this is the last chance to manipulate the
- * dialog.
+ * Creates a workbench preference dialog to a particular preference page. Show
+ * the other pages as filtered results using whatever filtering criteria the
+ * search uses. It is the responsibility of the caller to then call
+ * <code>open()</code>. The call to <code>open()</code> will not return until
+ * the dialog closes, so this is the last chance to manipulate the dialog.
*
- * @param shell
- * The shell to use to parent the dialog if required.
- * @param propertyPageId
- * The identifier of the preference page to open; may be
- * <code>null</code>. If it is <code>null</code>, then the dialog
- * is opened with no selected page.
- * @param element
- * IAdaptable An adaptable element to open the dialog on.
- * @param displayedIds
- * The ids of the other pages to be displayed using the same
- * filtering criteria as search. If this is <code>null</code>,
- * then the all preference pages are shown.
- * @param data
- * Data that will be passed to all of the preference pages to be
- * applied as specified within the page as they are created. If
- * the data is <code>null</code> nothing will be called.
- * @param options
- * a bitwise OR of option constants
+ * @param shell The shell to use to parent the dialog if required.
+ * @param propertyPageId The identifier of the preference page to open; may be
+ * <code>null</code>. If it is <code>null</code>, then the
+ * dialog is opened with no selected page.
+ * @param element IAdaptable An adaptable element to open the dialog on.
+ * @param displayedIds The ids of the other pages to be displayed using the
+ * same filtering criteria as search. If this is
+ * <code>null</code>, then the all preference pages are
+ * shown.
+ * @param data Data that will be passed to all of the preference pages
+ * to be applied as specified within the page as they are
+ * created. If the data is <code>null</code> nothing will
+ * be called.
+ * @param options a bitwise OR of option constants
*
* @return A preference dialog showing properties for the selection or
* <code>null</code> if it could not be created.
* @since 3.5
*/
- public static PreferenceDialog createPropertyDialogOn(Shell shell,
- final IAdaptable element, String propertyPageId,
+ public static PreferenceDialog createPropertyDialogOn(Shell shell, final IAdaptable element, String propertyPageId,
String[] displayedIds, Object data, int options) {
- FilteredPreferenceDialog dialog = PropertyDialog.createDialogOn(shell,
- propertyPageId, element);
+ FilteredPreferenceDialog dialog = PropertyDialog.createDialogOn(shell, propertyPageId, element);
if (dialog == null) {
return null;
@@ -248,41 +227,34 @@ public final class PreferencesUtil {
}
/**
- * Creates a workbench preference dialog to a particular preference page.
- * Show the other pages as filtered results using whatever filtering
- * criteria the search uses. It is the responsibility of the caller to then
- * call <code>open()</code>. The call to <code>open()</code> will not return
- * until the dialog closes, so this is the last chance to manipulate the
- * dialog.
+ * Creates a workbench preference dialog to a particular preference page. Show
+ * the other pages as filtered results using whatever filtering criteria the
+ * search uses. It is the responsibility of the caller to then call
+ * <code>open()</code>. The call to <code>open()</code> will not return until
+ * the dialog closes, so this is the last chance to manipulate the dialog.
*
- * @param shell
- * The shell to use to parent the dialog if required.
- * @param propertyPageId
- * The identifier of the preference page to open; may be
- * <code>null</code>. If it is <code>null</code>, then the dialog
- * is opened with no selected page.
- * @param element
- * An element to open the dialog on.
- * @param displayedIds
- * The IDs of the other pages to be displayed using the same
- * filtering criteria as search. If this is <code>null</code>,
- * then the all preference pages are shown.
- * @param data
- * Data that will be passed to all of the preference pages to be
- * applied as specified within the page as they are created. If
- * the data is <code>null</code> nothing will be called.
- * @param options
- * a bitwise OR of option constants
+ * @param shell The shell to use to parent the dialog if required.
+ * @param propertyPageId The identifier of the preference page to open; may be
+ * <code>null</code>. If it is <code>null</code>, then the
+ * dialog is opened with no selected page.
+ * @param element An element to open the dialog on.
+ * @param displayedIds The IDs of the other pages to be displayed using the
+ * same filtering criteria as search. If this is
+ * <code>null</code>, then the all preference pages are
+ * shown.
+ * @param data Data that will be passed to all of the preference pages
+ * to be applied as specified within the page as they are
+ * created. If the data is <code>null</code> nothing will
+ * be called.
+ * @param options a bitwise OR of option constants
*
* @return A preference dialog showing properties for the selection or
* <code>null</code> if it could not be created.
* @since 3.6
*/
- public static PreferenceDialog createPropertyDialogOn(Shell shell,
- final Object element, String propertyPageId, String[] displayedIds,
- Object data, int options) {
- FilteredPreferenceDialog dialog = PropertyDialog.createDialogOn(shell,
- propertyPageId, element);
+ public static PreferenceDialog createPropertyDialogOn(Shell shell, final Object element, String propertyPageId,
+ String[] displayedIds, Object data, int options) {
+ FilteredPreferenceDialog dialog = PropertyDialog.createDialogOn(shell, propertyPageId, element);
if (dialog == null)
return null;
applyOptions(data, displayedIds, dialog, options);
@@ -293,36 +265,34 @@ public final class PreferencesUtil {
* Indicates whether the specified element has at least one property page
* contributor.
*
- * @param element
- * an adapter element of a property page
+ * @param element an adapter element of a property page
* @return true for having at least one contributor; false otherwise
* @since 3.4
*/
public static boolean hasPropertiesContributors(Object element) {
if (element == null || !(element instanceof IAdaptable))
return false;
- Collection contributors = PropertyPageContributorManager.getManager()
- .getApplicableContributors(element);
+ Collection contributors = PropertyPageContributorManager.getManager().getApplicableContributors(element);
return contributors != null && contributors.size() > 0;
}
/**
* Return all of the properties page contributors for an element.
+ *
* @param element
* @return {@link IPreferenceNode}[]
* @since 3.4
*/
public static IPreferenceNode[] propertiesContributorsFor(Object element) {
PropertyPageManager pageManager = new PropertyPageManager();
- if (element == null) {
+ if (element == null) {
return null;
}
// load pages for the selection
// fill the manager with contributions from the matching contributors
- PropertyPageContributorManager.getManager().contribute(pageManager,
- element);
+ PropertyPageContributorManager.getManager().contribute(pageManager, element);
// testing if there are pages in the manager
- List pages = pageManager.getElements(PreferenceManager.PRE_ORDER);
+ List pages = pageManager.getElements(PreferenceManager.PRE_ORDER);
IPreferenceNode[] nodes = new IPreferenceNode[pages.size()];
pages.toArray(nodes);
return nodes;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/PropertyDialogAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/PropertyDialogAction.java
index cfd9969481b..9a9cc926c47 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/PropertyDialogAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/PropertyDialogAction.java
@@ -48,55 +48,50 @@ import org.eclipse.ui.internal.dialogs.PropertyPageContributorManager;
* action can simply be added to the pop-up menu. In the event of no applicable
* pages, the action will just open an appropriate message dialog.
* </p>
+ *
* @noextend This class is not intended to be subclassed by clients.
*/
public class PropertyDialogAction extends SelectionProviderAction {
- /**
- * Provides the shell in which to open the property dialog.
- */
- private IShellProvider shellProvider;
+ /**
+ * Provides the shell in which to open the property dialog.
+ */
+ private IShellProvider shellProvider;
/**
* The id of the page to open up on.
*/
private String initialPageId;
-
/**
- * Creates a new action for opening a property dialog on the elements from
- * the given selection provider.
- *
- * @param shell
- * the shell in which the dialog will open
- * @param provider
- * the selection provider whose elements the property dialog will
- * describe
- * @deprecated use PropertyDialogAction(IShellProvider, ISelectionProvider)
+ * Creates a new action for opening a property dialog on the elements from the
+ * given selection provider.
+ *
+ * @param shell the shell in which the dialog will open
+ * @param provider the selection provider whose elements the property dialog
+ * will describe
+ * @deprecated use PropertyDialogAction(IShellProvider, ISelectionProvider)
*/
@Deprecated
public PropertyDialogAction(Shell shell, ISelectionProvider provider) {
- this(new SameShellProvider(shell), provider);
+ this(new SameShellProvider(shell), provider);
}
- /**
- * Creates a new action for opening a property dialog on the elements from
- * the given selection provider.
- *
- * @param shell
- * provides the shell in which the dialog will open
- * @param provider
- * the selection provider whose elements the property dialog will
- * describe
- * @since 3.1
- */
- public PropertyDialogAction(IShellProvider shell, ISelectionProvider provider) {
- super(provider, WorkbenchMessages.PropertyDialog_text);
- Assert.isNotNull(shell);
- this.shellProvider = shell;
- setToolTipText(WorkbenchMessages.PropertyDialog_toolTip);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
- IWorkbenchHelpContextIds.PROPERTY_DIALOG_ACTION);
- }
+ /**
+ * Creates a new action for opening a property dialog on the elements from the
+ * given selection provider.
+ *
+ * @param shell provides the shell in which the dialog will open
+ * @param provider the selection provider whose elements the property dialog
+ * will describe
+ * @since 3.1
+ */
+ public PropertyDialogAction(IShellProvider shell, ISelectionProvider provider) {
+ super(provider, WorkbenchMessages.PropertyDialog_text);
+ Assert.isNotNull(shell);
+ this.shellProvider = shell;
+ setToolTipText(WorkbenchMessages.PropertyDialog_toolTip);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.PROPERTY_DIALOG_ACTION);
+ }
/**
* Returns whether the provided selection has pages registered in the property
@@ -110,14 +105,14 @@ public class PropertyDialogAction extends SelectionProviderAction {
}
/**
- * Returns whether this action is actually applicable to the current
- * selection. If this action is disabled, it will return <code>false</code>
- * without further calculation. If it is enabled, it will check with the
- * workbench's property page manager to see if there are any property pages
- * registered for the selected element's type.
+ * Returns whether this action is actually applicable to the current selection.
+ * If this action is disabled, it will return <code>false</code> without further
+ * calculation. If it is enabled, it will check with the workbench's property
+ * page manager to see if there are any property pages registered for the
+ * selected element's type.
* <p>
- * This method is generally too expensive to use when updating the enabled
- * state of the action on each selection change.
+ * This method is generally too expensive to use when updating the enabled state
+ * of the action on each selection change.
* </p>
*
* @return <code>true</code> if the selection is not empty and there are
@@ -134,15 +129,14 @@ public class PropertyDialogAction extends SelectionProviderAction {
/**
* Returns whether this action is applicable to the current selection. This
* checks that the selection is not empty, and checks with the workbench's
- * property page manager to see if there are any property pages registered
- * for the selected element's type.
+ * property page manager to see if there are any property pages registered for
+ * the selected element's type.
* <p>
- * This method is generally too expensive to use when updating the enabled
- * state of the action on each selection change.
+ * This method is generally too expensive to use when updating the enabled state
+ * of the action on each selection change.
* </p>
*
- * @param selection
- * The selection to test
+ * @param selection The selection to test
* @return <code>true</code> if the selection is of not empty and there are
* property pages for the selected element, and <code>false</code>
* otherwise
@@ -151,7 +145,6 @@ public class PropertyDialogAction extends SelectionProviderAction {
return !selection.isEmpty() && hasPropertyPagesFor(selection);
}
-
@Override
public void run() {
@@ -165,19 +158,17 @@ public class PropertyDialogAction extends SelectionProviderAction {
* Create the dialog for the receiver. If no pages are found, an informative
* message dialog is presented instead.
*
- * @return PreferenceDialog or <code>null</code> if no applicable pages
- * are found.
+ * @return PreferenceDialog or <code>null</code> if no applicable pages are
+ * found.
* @since 3.1
*/
public PreferenceDialog createDialog() {
if (getStructuredSelection().isEmpty())
return null;
- return PropertyDialog
- .createDialogOn(shellProvider.getShell(), initialPageId, getStructuredSelection());
+ return PropertyDialog.createDialogOn(shellProvider.getShell(), initialPageId, getStructuredSelection());
}
-
@Override
public void selectionChanged(IStructuredSelection selection) {
setEnabled(!selection.isEmpty());
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/PropertyPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/PropertyPage.java
index c79f05d2591..c39ac9a5613 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/PropertyPage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/PropertyPage.java
@@ -23,8 +23,8 @@ import org.eclipse.ui.IWorkbenchPropertyPageMulti;
* <code>IWorkbenchPropertyPage</code>). The implementation is a JFace
* preference page with an adaptable element.
* <p>
- * Property pages that support multiple selected objects should
- * implement {@link IWorkbenchPropertyPageMulti} instead.
+ * Property pages that support multiple selected objects should implement
+ * {@link IWorkbenchPropertyPageMulti} instead.
* <p>
* Subclasses must implement the <code>createContents</code> framework method to
* supply the property page's main control.
@@ -34,9 +34,10 @@ import org.eclipse.ui.IWorkbenchPropertyPageMulti;
* compute the size of the page's control.
* </p>
* <p>
- * Subclasses may override the <code>performOk</code>, <code>performApply</code>,<code>performDefaults</code>, <code>performCancel</code>, and
- * <code>performHelp</code> framework methods to react to the standard button
- * events.
+ * Subclasses may override the <code>performOk</code>,
+ * <code>performApply</code>,<code>performDefaults</code>,
+ * <code>performCancel</code>, and <code>performHelp</code> framework methods to
+ * react to the standard button events.
* </p>
* <p>
* Subclasses may call the <code>noDefaultAndApplyButton</code> framework method
@@ -48,30 +49,29 @@ import org.eclipse.ui.IWorkbenchPropertyPageMulti;
* @see IWorkbenchPropertyPageMulti
*/
public abstract class PropertyPage extends PreferencePage implements IWorkbenchPropertyPage {
- /**
- * The element.
- */
- private IAdaptable element;
+ /**
+ * The element.
+ */
+ private IAdaptable element;
- /**
- * Creates a new property page.
- */
- public PropertyPage() {
- }
+ /**
+ * Creates a new property page.
+ */
+ public PropertyPage() {
+ }
- @Override
+ @Override
public IAdaptable getElement() {
- return element;
- }
+ return element;
+ }
- /**
- * Sets the element that owns properties shown on this page.
- *
- * @param element
- * the element
- */
- @Override
+ /**
+ * Sets the element that owns properties shown on this page.
+ *
+ * @param element the element
+ */
+ @Override
public void setElement(IAdaptable element) {
- this.element = element;
- }
+ this.element = element;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/SearchPattern.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/SearchPattern.java
index e857e65f2e5..4f431e43c8e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/SearchPattern.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/SearchPattern.java
@@ -31,8 +31,8 @@ public class SearchPattern {
// Rules for pattern matching: (exact, prefix, pattern) [ | case sensitive]
/**
- * Match rule: The search pattern matches exactly the search result, that
- * is, the source of the search result equals the search pattern. Search pattern
+ * Match rule: The search pattern matches exactly the search result, that is,
+ * the source of the search result equals the search pattern. Search pattern
* should start from lowerCase char.
*/
public static final int RULE_EXACT_MATCH = 0;
@@ -43,17 +43,16 @@ public class SearchPattern {
public static final int RULE_PREFIX_MATCH = 0x0001;
/**
- * Match rule: The search pattern contains one or more wild cards ('*' or
- * '?'). A '*' wild-card can replace 0 or more characters in the search
- * result. A '?' wild-card replaces exactly 1 character in the search
- * result.
+ * Match rule: The search pattern contains one or more wild cards ('*' or '?').
+ * A '*' wild-card can replace 0 or more characters in the search result. A '?'
+ * wild-card replaces exactly 1 character in the search result.
*/
public static final int RULE_PATTERN_MATCH = 0x0002;
/**
- * Match rule: The search pattern matches the search result only if cases
- * are the same. Can be combined with previous rules, e.g.
- * {@link #RULE_EXACT_MATCH} | {@link #RULE_CASE_SENSITIVE}
+ * Match rule: The search pattern matches the search result only if cases are
+ * the same. Can be combined with previous rules, e.g. {@link #RULE_EXACT_MATCH}
+ * | {@link #RULE_CASE_SENSITIVE}
*/
public static final int RULE_CASE_SENSITIVE = 0x0008;
@@ -67,25 +66,25 @@ public class SearchPattern {
* Examples:
* <ul>
* <li><code>NPE</code> type string pattern will match
- * <code>NullPointerException</code> and
- * <code>NpPermissionException</code> types,</li>
+ * <code>NullPointerException</code> and <code>NpPermissionException</code>
+ * types,</li>
* <li><code>NuPoEx</code> type string pattern will only match
* <code>NullPointerException</code> type.</li>
* </ul>
*
*
* <br>
- * Can be combined with {@link #RULE_PREFIX_MATCH} match rule. For example,
- * when prefix match rule is combined with Camel Case match rule,
- * <code>"nPE"</code> pattern will match <code>nPException</code>. <br>
- * Match rule {@link #RULE_PATTERN_MATCH} may also be combined but both
- * rules will not be used simultaneously as they are mutually exclusive.
- * Used match rule depends on whether string pattern contains specific
- * pattern characters (e.g. '*' or '?') or not. If it does, then only
- * Pattern match rule will be used, otherwise only Camel Case match will be
- * used. For example, with <code>"NPE"</code> string pattern, search will
- * only use Camel Case match rule, but with <code>N*P*E*</code> string
- * pattern, it will use only Pattern match rule.
+ * Can be combined with {@link #RULE_PREFIX_MATCH} match rule. For example, when
+ * prefix match rule is combined with Camel Case match rule, <code>"nPE"</code>
+ * pattern will match <code>nPException</code>. <br>
+ * Match rule {@link #RULE_PATTERN_MATCH} may also be combined but both rules
+ * will not be used simultaneously as they are mutually exclusive. Used match
+ * rule depends on whether string pattern contains specific pattern characters
+ * (e.g. '*' or '?') or not. If it does, then only Pattern match rule will be
+ * used, otherwise only Camel Case match will be used. For example, with
+ * <code>"NPE"</code> string pattern, search will only use Camel Case match
+ * rule, but with <code>N*P*E*</code> string pattern, it will use only Pattern
+ * match rule.
*
*/
public static final int RULE_CAMELCASE_MATCH = 0x0080;
@@ -114,28 +113,28 @@ public class SearchPattern {
*
*/
public SearchPattern() {
- this(RULE_EXACT_MATCH | RULE_PREFIX_MATCH | RULE_PATTERN_MATCH
- | RULE_CAMELCASE_MATCH | RULE_BLANK_MATCH);
+ this(RULE_EXACT_MATCH | RULE_PREFIX_MATCH | RULE_PATTERN_MATCH | RULE_CAMELCASE_MATCH | RULE_BLANK_MATCH);
}
/**
- * Creates a search pattern with the rule to apply for matching index keys.
- * It can be exact match, prefix match, pattern match or camelCase match.
- * Rule can also be combined with a case sensitivity flag.
- *
- * @param allowedRules
- * one of {@link #RULE_EXACT_MATCH}, {@link #RULE_PREFIX_MATCH},
- * {@link #RULE_PATTERN_MATCH}, {@link #RULE_CASE_SENSITIVE},
- * {@link #RULE_CAMELCASE_MATCH} combined with one of following
- * values: {@link #RULE_EXACT_MATCH}, {@link #RULE_PREFIX_MATCH},
- * {@link #RULE_PATTERN_MATCH} or {@link #RULE_CAMELCASE_MATCH}.
- * e.g. {@link #RULE_EXACT_MATCH} | {@link #RULE_CASE_SENSITIVE}
- * if an exact and case sensitive match is requested,
- * {@link #RULE_PREFIX_MATCH} if a prefix non case sensitive
- * match is requested or {@link #RULE_EXACT_MATCH} if a non case
- * sensitive and erasure match is requested.<br>
- * Note also that default behavior for generic types/methods
- * search is to find exact matches.
+ * Creates a search pattern with the rule to apply for matching index keys. It
+ * can be exact match, prefix match, pattern match or camelCase match. Rule can
+ * also be combined with a case sensitivity flag.
+ *
+ * @param allowedRules one of {@link #RULE_EXACT_MATCH},
+ * {@link #RULE_PREFIX_MATCH}, {@link #RULE_PATTERN_MATCH},
+ * {@link #RULE_CASE_SENSITIVE},
+ * {@link #RULE_CAMELCASE_MATCH} combined with one of
+ * following values: {@link #RULE_EXACT_MATCH},
+ * {@link #RULE_PREFIX_MATCH}, {@link #RULE_PATTERN_MATCH}
+ * or {@link #RULE_CAMELCASE_MATCH}. e.g.
+ * {@link #RULE_EXACT_MATCH} | {@link #RULE_CASE_SENSITIVE}
+ * if an exact and case sensitive match is requested,
+ * {@link #RULE_PREFIX_MATCH} if a prefix non case sensitive
+ * match is requested or {@link #RULE_EXACT_MATCH} if a non
+ * case sensitive and erasure match is requested.<br>
+ * Note also that default behavior for generic types/methods
+ * search is to find exact matches.
*/
public SearchPattern(int allowedRules) {
this.allowedRules = allowedRules;
@@ -151,8 +150,7 @@ public class SearchPattern {
}
/**
- * @param stringPattern
- * The stringPattern to set.
+ * @param stringPattern The stringPattern to set.
*/
public void setPattern(String stringPattern) {
this.initialPattern = stringPattern;
@@ -183,7 +181,7 @@ public class SearchPattern {
return true;
}
//$FALL-THROUGH$
- default:
+ default:
return startsWithIgnoreCase(text, stringPattern);
}
}
@@ -233,8 +231,8 @@ public class SearchPattern {
/**
* @param text
* @param prefix
- * @return true if text starts with given prefix, ignoring case false in
- * other way
+ * @return true if text starts with given prefix, ignoring case false in other
+ * way
*/
private boolean startsWithIgnoreCase(String text, String prefix) {
int textLength = text.length();
@@ -242,31 +240,30 @@ public class SearchPattern {
if (textLength < prefixLength)
return false;
for (int i = prefixLength - 1; i >= 0; i--) {
- if (Character.toLowerCase(prefix.charAt(i)) != Character
- .toLowerCase(text.charAt(i)))
+ if (Character.toLowerCase(prefix.charAt(i)) != Character.toLowerCase(text.charAt(i)))
return false;
}
return true;
}
/**
- * Answers true if the pattern matches the given name using CamelCase rules,
- * or false otherwise. CamelCase matching does NOT accept explicit
- * wild-cards '*' and '?' and is inherently case sensitive. <br>
- * CamelCase denotes the convention of writing compound names without
- * spaces, and capitalizing every term. This function recognizes both upper
- * and lower CamelCase, depending whether the leading character is
- * capitalized or not. The leading part of an upper CamelCase pattern is
- * assumed to contain a sequence of capitals which are appearing in the
- * matching name; e.g. 'NPE' will match 'NullPointerException', but not
- * 'NewPerfData'. A lower CamelCase pattern uses a lowercase first
- * character. In Java, type names follow the upper CamelCase convention,
- * whereas method or field names follow the lower CamelCase convention. <br>
- * The pattern may contain lowercase characters, which will be match in a
- * case sensitive way. These characters must appear in sequence in the name.
- * For instance, 'NPExcep' will match 'NullPointerException', but not
- * 'NullPointerExCEPTION' or 'NuPoEx' will match 'NullPointerException', but
- * not 'NoPointerException'. <br>
+ * Answers true if the pattern matches the given name using CamelCase rules, or
+ * false otherwise. CamelCase matching does NOT accept explicit wild-cards '*'
+ * and '?' and is inherently case sensitive. <br>
+ * CamelCase denotes the convention of writing compound names without spaces,
+ * and capitalizing every term. This function recognizes both upper and lower
+ * CamelCase, depending whether the leading character is capitalized or not. The
+ * leading part of an upper CamelCase pattern is assumed to contain a sequence
+ * of capitals which are appearing in the matching name; e.g. 'NPE' will match
+ * 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern uses
+ * a lowercase first character. In Java, type names follow the upper CamelCase
+ * convention, whereas method or field names follow the lower CamelCase
+ * convention. <br>
+ * The pattern may contain lowercase characters, which will be match in a case
+ * sensitive way. These characters must appear in sequence in the name. For
+ * instance, 'NPExcep' will match 'NullPointerException', but not
+ * 'NullPointerExCEPTION' or 'NuPoEx' will match 'NullPointerException', but not
+ * 'NoPointerException'. <br>
* <br>
* Examples:
* <ol>
@@ -299,10 +296,8 @@ public class SearchPattern {
* </li>
* </ol>
*
- * @param pattern
- * the given pattern
- * @param name
- * the given name
+ * @param pattern the given pattern
+ * @param name the given name
* @return true if the pattern matches the given name, false otherwise
*
*/
@@ -312,31 +307,29 @@ public class SearchPattern {
if (name == null)
return false; // null name cannot match
- return camelCaseMatch(pattern, 0, pattern.length(), name, 0, name
- .length());
+ return camelCaseMatch(pattern, 0, pattern.length(), name, 0, name.length());
}
/**
* Answers true if a sub-pattern matches the subpart of the given name using
* CamelCase rules, or false otherwise. CamelCase matching does NOT accept
- * explicit wild-cards '*' and '?' and is inherently case sensitive. Can
- * match only subset of name/pattern, considering end positions as
- * non-inclusive. The subpattern is defined by the patternStart and
- * patternEnd positions. <br>
- * CamelCase denotes the convention of writing compound names without
- * spaces, and capitalizing every term. This function recognizes both upper
- * and lower CamelCase, depending whether the leading character is
- * capitalized or not. The leading part of an upper CamelCase pattern is
- * assumed to contain a sequence of capitals which are appearing in the
- * matching name; e.g. 'NPE' will match 'NullPointerException', but not
- * 'NewPerfData'. A lower CamelCase pattern uses a lowercase first
- * character. In Java, type names follow the upper CamelCase convention,
- * whereas method or field names follow the lower CamelCase convention. <br>
- * The pattern may contain lowercase characters, which will be match in a
- * case sensitive way. These characters must appear in sequence in the name.
- * For instance, 'NPExcep' will match 'NullPointerException', but not
- * 'NullPointerExCEPTION' or 'NuPoEx' will match 'NullPointerException', but
- * not 'NoPointerException'. <br>
+ * explicit wild-cards '*' and '?' and is inherently case sensitive. Can match
+ * only subset of name/pattern, considering end positions as non-inclusive. The
+ * subpattern is defined by the patternStart and patternEnd positions. <br>
+ * CamelCase denotes the convention of writing compound names without spaces,
+ * and capitalizing every term. This function recognizes both upper and lower
+ * CamelCase, depending whether the leading character is capitalized or not. The
+ * leading part of an upper CamelCase pattern is assumed to contain a sequence
+ * of capitals which are appearing in the matching name; e.g. 'NPE' will match
+ * 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern uses
+ * a lowercase first character. In Java, type names follow the upper CamelCase
+ * convention, whereas method or field names follow the lower CamelCase
+ * convention. <br>
+ * The pattern may contain lowercase characters, which will be match in a case
+ * sensitive way. These characters must appear in sequence in the name. For
+ * instance, 'NPExcep' will match 'NullPointerException', but not
+ * 'NullPointerExCEPTION' or 'NuPoEx' will match 'NullPointerException', but not
+ * 'NoPointerException'. <br>
* <br>
* Examples:
* <ol>
@@ -407,23 +400,17 @@ public class SearchPattern {
* </li>
* </ol>
*
- * @param pattern
- * the given pattern
- * @param patternStart
- * the start index of the pattern, inclusive
- * @param patternEnd
- * the end index of the pattern, exclusive
- * @param name
- * the given name
- * @param nameStart
- * the start index of the name, inclusive
- * @param nameEnd
- * the end index of the name, exclusive
- * @return true if a sub-pattern matches the subpart of the given name,
- * false otherwise
+ * @param pattern the given pattern
+ * @param patternStart the start index of the pattern, inclusive
+ * @param patternEnd the end index of the pattern, exclusive
+ * @param name the given name
+ * @param nameStart the start index of the name, inclusive
+ * @param nameEnd the end index of the name, exclusive
+ * @return true if a sub-pattern matches the subpart of the given name, false
+ * otherwise
*/
- private boolean camelCaseMatch(String pattern, int patternStart,
- int patternEnd, String name, int nameStart, int nameEnd) {
+ private boolean camelCaseMatch(String pattern, int patternStart, int patternEnd, String name, int nameStart,
+ int nameEnd) {
if (name == null)
return false; // null name cannot match
if (pattern == null)
@@ -445,10 +432,9 @@ public class SearchPattern {
int patternLength = patternEnd;
- if (pattern.charAt(patternEnd - 1) == END_SYMBOL || pattern.charAt(patternEnd - 1) == BLANK )
+ if (pattern.charAt(patternEnd - 1) == END_SYMBOL || pattern.charAt(patternEnd - 1) == BLANK)
patternLength = patternEnd - 1;
-
char patternChar, nameChar;
int iPattern = patternStart;
int iName = nameStart;
@@ -459,7 +445,7 @@ public class SearchPattern {
iPattern++;
iName++;
- if (iPattern == patternEnd) {
+ if (iPattern == patternEnd) {
// We have exhausted pattern, so it's a match
return true;
}
@@ -502,13 +488,15 @@ public class SearchPattern {
}
if (Character.isDigit(nameChar)) {
- // nameChar is digit => break if the digit is current pattern character otherwise consume it
- if (patternChar == nameChar) break;
+ // nameChar is digit => break if the digit is current pattern character
+ // otherwise consume it
+ if (patternChar == nameChar)
+ break;
iName++;
} else if (!isNameCharAllowed(nameChar)) {
// nameChar is lowercase
iName++;
- // nameChar is uppercase...
+ // nameChar is uppercase...
} else if (patternChar != nameChar) {
// .. and it does not match patternChar, so it's not a match
return false;
@@ -524,23 +512,22 @@ public class SearchPattern {
}
/**
- * Checks pattern's character is allowed for specified set. It could be
- * override if you want change logic of camelCaseMatch methods.
+ * Checks pattern's character is allowed for specified set. It could be override
+ * if you want change logic of camelCaseMatch methods.
*
* @param patternChar
* @return true if patternChar is in set of allowed characters for pattern
*/
protected boolean isPatternCharAllowed(char patternChar) {
- return patternChar == END_SYMBOL || patternChar == BLANK
- || Character.isUpperCase(patternChar) || Character.isDigit(patternChar);
+ return patternChar == END_SYMBOL || patternChar == BLANK || Character.isUpperCase(patternChar)
+ || Character.isDigit(patternChar);
}
/**
- * Checks character of element's name is allowed for specified set. It could
- * be override if you want change logic of camelCaseMatch methods.
+ * Checks character of element's name is allowed for specified set. It could be
+ * override if you want change logic of camelCaseMatch methods.
*
- * @param nameChar -
- * name of searched element
+ * @param nameChar - name of searched element
* @return if nameChar is in set of allowed characters for name of element
*/
protected boolean isNameCharAllowed(char nameChar) {
@@ -554,9 +541,9 @@ public class SearchPattern {
*
* @return one of RULE_EXACT_MATCH, RULE_PREFIX_MATCH, RULE_PATTERN_MATCH,
* RULE_CAMELCASE_MATCH, combined with RULE_CASE_SENSITIVE, e.g.
- * RULE_EXACT_MATCH | RULE_CASE_SENSITIVE if an exact and case
- * sensitive match is requested, or RULE_PREFIX_MATCH if a prefix
- * non case sensitive match is requested.
+ * RULE_EXACT_MATCH | RULE_CASE_SENSITIVE if an exact and case sensitive
+ * match is requested, or RULE_PREFIX_MATCH if a prefix non case
+ * sensitive match is requested.
*/
public final int getMatchRule() {
return this.matchRule;
@@ -566,17 +553,19 @@ public class SearchPattern {
* Validate compatibility between given string pattern and match rule. <br>
* Optimized (ie. returned match rule is modified) combinations are:
* <ul>
- * <li>{@link #RULE_PATTERN_MATCH} without any '*' or '?' in string pattern: pattern match bit
- * is unset,</li>
- * <li>{@link #RULE_PATTERN_MATCH} and {@link #RULE_PREFIX_MATCH} bits simultaneously set:
- * prefix match bit is unset,</li>
- * <li>{@link #RULE_PATTERN_MATCH} and {@link #RULE_CAMELCASE_MATCH} bits simultaneously set:
- * camel case match bit is unset,</li>
- * <li>{@link #RULE_CAMELCASE_MATCH} with invalid combination of uppercase and lowercase
- * characters: camel case match bit is unset and replaced with prefix match pattern,</li>
- * <li>{@link #RULE_CAMELCASE_MATCH} combined with {@link #RULE_PREFIX_MATCH} and
- * {@link #RULE_CASE_SENSITIVE} bits is reduced to only {@link #RULE_CAMELCASE_MATCH} as Camel
- * Case search is already prefix and case sensitive,</li>
+ * <li>{@link #RULE_PATTERN_MATCH} without any '*' or '?' in string pattern:
+ * pattern match bit is unset,</li>
+ * <li>{@link #RULE_PATTERN_MATCH} and {@link #RULE_PREFIX_MATCH} bits
+ * simultaneously set: prefix match bit is unset,</li>
+ * <li>{@link #RULE_PATTERN_MATCH} and {@link #RULE_CAMELCASE_MATCH} bits
+ * simultaneously set: camel case match bit is unset,</li>
+ * <li>{@link #RULE_CAMELCASE_MATCH} with invalid combination of uppercase and
+ * lowercase characters: camel case match bit is unset and replaced with prefix
+ * match pattern,</li>
+ * <li>{@link #RULE_CAMELCASE_MATCH} combined with {@link #RULE_PREFIX_MATCH}
+ * and {@link #RULE_CASE_SENSITIVE} bits is reduced to only
+ * {@link #RULE_CAMELCASE_MATCH} as Camel Case search is already prefix and case
+ * sensitive,</li>
* </ul>
* <br>
* Rejected (ie. returned match rule -1) combinations are:
@@ -585,7 +574,7 @@ public class SearchPattern {
* </ul>
*
* @param stringPattern The string pattern
- * @param matchRule The match rule
+ * @param matchRule The match rule
* @return Optimized valid match rule or -1 if an incompatibility was detected.
*/
private int validateMatchRule(String stringPattern, int matchRule) {
@@ -639,8 +628,7 @@ public class SearchPattern {
/**
* Check if character is valid camelCase character
*
- * @param ch
- * character to be validated
+ * @param ch character to be validated
* @return true if character is valid
*/
protected boolean isValidCamelCaseChar(char ch) {
@@ -650,43 +638,37 @@ public class SearchPattern {
/**
* Tells whether the given <code>SearchPattern</code> equals this pattern.
*
- * @param pattern
- * pattern to be checked
+ * @param pattern pattern to be checked
* @return true if the given pattern equals this search pattern
*/
public boolean equalsPattern(SearchPattern pattern) {
- return trimWildcardCharacters(pattern.initialPattern).equals(
- trimWildcardCharacters(this.initialPattern));
+ return trimWildcardCharacters(pattern.initialPattern).equals(trimWildcardCharacters(this.initialPattern));
}
/**
- * Tells whether the given <code>SearchPattern</code> is a sub-pattern of
- * this pattern.
+ * Tells whether the given <code>SearchPattern</code> is a sub-pattern of this
+ * pattern.
* <p>
* <i>WARNING: This method is <b>not</b> defined in reading order, i.e.
- * <code>a.isSubPattern(b)</code> is <code>true</code> iff
- * <code>b</code> is a sub-pattern of <code>a</code>, and not vice-versa.
- * </i>
+ * <code>a.isSubPattern(b)</code> is <code>true</code> iff <code>b</code> is a
+ * sub-pattern of <code>a</code>, and not vice-versa. </i>
* </p>
*
- * @param pattern
- * pattern to be checked
+ * @param pattern pattern to be checked
* @return true if the given pattern is a sub pattern of this search pattern
*/
public boolean isSubPattern(SearchPattern pattern) {
- return trimWildcardCharacters(pattern.initialPattern).startsWith(
- trimWildcardCharacters(this.initialPattern));
+ return trimWildcardCharacters(pattern.initialPattern).startsWith(trimWildcardCharacters(this.initialPattern));
}
/**
* Trims sequences of '*' characters
*
- * @param pattern
- * string to be trimmed
+ * @param pattern string to be trimmed
* @return trimmed pattern
*/
private String trimWildcardCharacters(String pattern) {
- return Util.replaceAll(pattern, "\\*+", "\\*"); //$NON-NLS-1$ //$NON-NLS-2$ }
+ return Util.replaceAll(pattern, "\\*+", "\\*"); //$NON-NLS-1$ //$NON-NLS-2$ }
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/SelectionDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/SelectionDialog.java
index e38f0a062a8..c1fd1e44451 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/SelectionDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/SelectionDialog.java
@@ -28,8 +28,8 @@ import org.eclipse.ui.internal.WorkbenchMessages;
/**
* The abstract implementation of a selection dialog. It can be primed with
- * initial selections (<code>setInitialSelections</code>), and returns the
- * final selection (via <code>getResult</code>) after completion.
+ * initial selections (<code>setInitialSelections</code>), and returns the final
+ * selection (via <code>getResult</code>) after completion.
* <p>
* Clients may subclass this dialog to inherit its selection facilities.
* </p>
@@ -62,8 +62,7 @@ public abstract class SelectionDialog extends TrayDialog {
* Creates a dialog instance. Note that the dialog will have no visual
* representation (no widgets) until it is told to open.
*
- * @param parentShell
- * the parent shell
+ * @param parentShell the parent shell
*/
protected SelectionDialog(Shell parentShell) {
super(parentShell);
@@ -86,12 +85,11 @@ public abstract class SelectionDialog extends TrayDialog {
/**
* Creates the message area for this dialog.
* <p>
- * This method is provided to allow subclasses to decide where the message
- * will appear on the screen.
+ * This method is provided to allow subclasses to decide where the message will
+ * appear on the screen.
* </p>
*
- * @param composite
- * the parent composite
+ * @param composite the parent composite
* @return the message label
*/
protected Label createMessageArea(Composite composite) {
@@ -138,30 +136,27 @@ public abstract class SelectionDialog extends TrayDialog {
/**
* Returns the ok button.
*
- * @return the ok button or <code>null</code> if the button is not created
- * yet.
+ * @return the ok button or <code>null</code> if the button is not created yet.
*/
public Button getOkButton() {
return getButton(IDialogConstants.OK_ID);
}
/**
- * Returns the list of selections made by the user, or <code>null</code>
- * if the selection was canceled.
+ * Returns the list of selections made by the user, or <code>null</code> if the
+ * selection was canceled.
*
- * @return the array of selected elements, or <code>null</code> if Cancel
- * was pressed
+ * @return the array of selected elements, or <code>null</code> if Cancel was
+ * pressed
*/
public Object[] getResult() {
return result;
}
/**
- * Sets the initial selection in this selection dialog to the given
- * elements.
+ * Sets the initial selection in this selection dialog to the given elements.
*
- * @param selectedElements
- * the array of elements to select
+ * @param selectedElements the array of elements to select
*/
public void setInitialSelections(Object... selectedElements) {
initialSelections = new ArrayList(selectedElements.length);
@@ -171,11 +166,9 @@ public abstract class SelectionDialog extends TrayDialog {
}
/**
- * Sets the initial selection in this selection dialog to the given
- * elements.
+ * Sets the initial selection in this selection dialog to the given elements.
*
- * @param selectedElements
- * the List of elements to select
+ * @param selectedElements the List of elements to select
*/
public void setInitialElementSelections(List selectedElements) {
initialSelections = selectedElements;
@@ -184,20 +177,18 @@ public abstract class SelectionDialog extends TrayDialog {
/**
* Sets the message for this dialog.
*
- * @param message
- * the message
+ * @param message the message
*/
public void setMessage(String message) {
this.message = message;
}
/**
- * Set the selections made by the user, or <code>null</code> if the
- * selection was canceled.
+ * Set the selections made by the user, or <code>null</code> if the selection
+ * was canceled.
*
- * @param newResult
- * list of selected elements, or <code>null</code> if Cancel
- * was pressed
+ * @param newResult list of selected elements, or <code>null</code> if Cancel
+ * was pressed
*/
protected void setResult(List newResult) {
if (newResult == null) {
@@ -209,14 +200,13 @@ public abstract class SelectionDialog extends TrayDialog {
}
/**
- * Set the selections made by the user, or <code>null</code> if the
- * selection was canceled.
+ * Set the selections made by the user, or <code>null</code> if the selection
+ * was canceled.
* <p>
* The selections may accessed using <code>getResult</code>.
* </p>
*
- * @param newResult -
- * the new values
+ * @param newResult - the new values
* @since 2.0
*/
protected void setSelectionResult(Object[] newResult) {
@@ -226,8 +216,7 @@ public abstract class SelectionDialog extends TrayDialog {
/**
* Sets the title for this dialog.
*
- * @param title
- * the title
+ * @param title the title
*/
public void setTitle(String title) {
this.title = title;
@@ -236,17 +225,15 @@ public abstract class SelectionDialog extends TrayDialog {
/**
* Set the dialog settings that should be used to save the bounds of this
* dialog. This method is provided so that clients that directly use
- * SelectionDialogs without subclassing them may specify how the bounds of
- * the dialog are to be saved.
+ * SelectionDialogs without subclassing them may specify how the bounds of the
+ * dialog are to be saved.
*
- * @param settings
- * the {@link IDialogSettings} that should be used to store the
- * bounds of the dialog
+ * @param settings the {@link IDialogSettings} that should be used to store the
+ * bounds of the dialog
*
- * @param strategy
- * the integer constant specifying how the bounds are saved.
- * Specified using {@link Dialog#DIALOG_PERSISTLOCATION}
- * and {@link Dialog#DIALOG_PERSISTSIZE}.
+ * @param strategy the integer constant specifying how the bounds are saved.
+ * Specified using {@link Dialog#DIALOG_PERSISTLOCATION} and
+ * {@link Dialog#DIALOG_PERSISTSIZE}.
*
* @since 3.2
*
@@ -259,14 +246,13 @@ public abstract class SelectionDialog extends TrayDialog {
}
/**
- * Gets the dialog settings that should be used for remembering the bounds
- * of the dialog, according to the dialog bounds strategy. Overridden to
- * provide the dialog settings that were set using
+ * Gets the dialog settings that should be used for remembering the bounds of
+ * the dialog, according to the dialog bounds strategy. Overridden to provide
+ * the dialog settings that were set using
* {@link #setDialogBoundsSettings(IDialogSettings, int)}.
*
- * @return the dialog settings used to store the dialog's location and/or
- * size, or <code>null</code> if the dialog's bounds should not be
- * stored.
+ * @return the dialog settings used to store the dialog's location and/or size,
+ * or <code>null</code> if the dialog's bounds should not be stored.
*
* @since 3.2
*
@@ -280,8 +266,8 @@ public abstract class SelectionDialog extends TrayDialog {
/**
* Get the integer constant that describes the strategy for persisting the
- * dialog bounds. Overridden to provide the dialog bounds strategy that was
- * set using {@link #setDialogBoundsSettings(IDialogSettings, int)}.
+ * dialog bounds. Overridden to provide the dialog bounds strategy that was set
+ * using {@link #setDialogBoundsSettings(IDialogSettings, int)}.
*
* @return the constant describing the strategy for persisting the dialog
* bounds.
@@ -297,11 +283,11 @@ public abstract class SelectionDialog extends TrayDialog {
return dialogBoundsStrategy;
}
- /**
+ /**
* @since 3.4
*/
- @Override
+ @Override
protected boolean isResizable() {
- return true;
- }
+ return true;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/SelectionStatusDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/SelectionStatusDialog.java
index 376b6124cef..ebb391a7073 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/SelectionStatusDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/SelectionStatusDialog.java
@@ -31,165 +31,170 @@ import org.eclipse.ui.internal.MessageLine;
/**
* An abstract base class for dialogs with a status bar and ok/cancel buttons.
- * The status message must be passed over as StatusInfo object and can be
- * an error, warning or ok. The OK button is enabled or disabled depending
- * on the status.
+ * The status message must be passed over as StatusInfo object and can be an
+ * error, warning or ok. The OK button is enabled or disabled depending on the
+ * status.
*
* @since 2.0
*/
public abstract class SelectionStatusDialog extends SelectionDialog {
- private MessageLine fStatusLine;
-
- private IStatus fLastStatus;
-
- private Image fImage;
-
- private boolean fStatusLineAboveButtons = false;
-
- /**
- * Creates an instance of a <code>SelectionStatusDialog</code>.
- * @param parent
- */
- public SelectionStatusDialog(Shell parent) {
- super(parent);
- }
-
- /**
- * Controls whether status line appears to the left of the buttons (default)
- * or above them.
- *
- * @param aboveButtons if <code>true</code> status line is placed above buttons; if
- * <code>false</code> to the right
- */
- public void setStatusLineAboveButtons(boolean aboveButtons) {
- fStatusLineAboveButtons = aboveButtons;
- }
-
- /**
- * Sets the image for this dialog.
- * @param image the image.
- */
- public void setImage(Image image) {
- fImage = image;
- }
-
- /**
- * Returns the first element from the list of results. Returns <code>null</code>
- * if no element has been selected.
- *
- * @return the first result element if one exists. Otherwise <code>null</code> is
- * returned.
- */
- public Object getFirstResult() {
- Object[] result = getResult();
- if (result == null || result.length == 0) {
+ private MessageLine fStatusLine;
+
+ private IStatus fLastStatus;
+
+ private Image fImage;
+
+ private boolean fStatusLineAboveButtons = false;
+
+ /**
+ * Creates an instance of a <code>SelectionStatusDialog</code>.
+ *
+ * @param parent
+ */
+ public SelectionStatusDialog(Shell parent) {
+ super(parent);
+ }
+
+ /**
+ * Controls whether status line appears to the left of the buttons (default) or
+ * above them.
+ *
+ * @param aboveButtons if <code>true</code> status line is placed above buttons;
+ * if <code>false</code> to the right
+ */
+ public void setStatusLineAboveButtons(boolean aboveButtons) {
+ fStatusLineAboveButtons = aboveButtons;
+ }
+
+ /**
+ * Sets the image for this dialog.
+ *
+ * @param image the image.
+ */
+ public void setImage(Image image) {
+ fImage = image;
+ }
+
+ /**
+ * Returns the first element from the list of results. Returns <code>null</code>
+ * if no element has been selected.
+ *
+ * @return the first result element if one exists. Otherwise <code>null</code>
+ * is returned.
+ */
+ public Object getFirstResult() {
+ Object[] result = getResult();
+ if (result == null || result.length == 0) {
return null;
}
- return result[0];
- }
-
- /**
- * Sets a result element at the given position.
- * @param position
- * @param element
- */
- protected void setResult(int position, Object element) {
- Object[] result = getResult();
- result[position] = element;
- setResult(Arrays.asList(result));
- }
-
- /**
- * Compute the result and return it.
- */
- protected abstract void computeResult();
-
- @Override
+ return result[0];
+ }
+
+ /**
+ * Sets a result element at the given position.
+ *
+ * @param position
+ * @param element
+ */
+ protected void setResult(int position, Object element) {
+ Object[] result = getResult();
+ result[position] = element;
+ setResult(Arrays.asList(result));
+ }
+
+ /**
+ * Compute the result and return it.
+ */
+ protected abstract void computeResult();
+
+ @Override
protected void configureShell(Shell shell) {
- super.configureShell(shell);
- if (fImage != null) {
+ super.configureShell(shell);
+ if (fImage != null) {
shell.setImage(fImage);
}
- }
-
- /**
- * Update the dialog's status line to reflect the given status. It is safe to call
- * this method before the dialog has been opened.
- * @param status
- */
- protected void updateStatus(IStatus status) {
- fLastStatus = status;
- if (fStatusLine != null && !fStatusLine.isDisposed()) {
- updateButtonsEnableState(status);
- fStatusLine.setErrorStatus(status);
- }
- }
-
- /**
- * Update the status of the ok button to reflect the given status. Subclasses
- * may override this method to update additional buttons.
- * @param status
- */
- protected void updateButtonsEnableState(IStatus status) {
- Button okButton = getOkButton();
- if (okButton != null && !okButton.isDisposed()) {
+ }
+
+ /**
+ * Update the dialog's status line to reflect the given status. It is safe to
+ * call this method before the dialog has been opened.
+ *
+ * @param status
+ */
+ protected void updateStatus(IStatus status) {
+ fLastStatus = status;
+ if (fStatusLine != null && !fStatusLine.isDisposed()) {
+ updateButtonsEnableState(status);
+ fStatusLine.setErrorStatus(status);
+ }
+ }
+
+ /**
+ * Update the status of the ok button to reflect the given status. Subclasses
+ * may override this method to update additional buttons.
+ *
+ * @param status
+ */
+ protected void updateButtonsEnableState(IStatus status) {
+ Button okButton = getOkButton();
+ if (okButton != null && !okButton.isDisposed()) {
okButton.setEnabled(!status.matches(IStatus.ERROR));
}
- }
+ }
- @Override
+ @Override
protected void okPressed() {
- computeResult();
- super.okPressed();
- }
+ computeResult();
+ super.okPressed();
+ }
- @Override
+ @Override
public void create() {
- super.create();
- if (fLastStatus != null) {
+ super.create();
+ if (fLastStatus != null) {
updateStatus(fLastStatus);
}
- }
+ }
- @Override
+ @Override
protected Control createButtonBar(Composite parent) {
- Font font = parent.getFont();
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- if (!fStatusLineAboveButtons) {
- layout.numColumns = 2;
- }
- layout.marginHeight = 0;
- layout.marginLeft = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.marginWidth = 0;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- composite.setFont(font);
-
- if (!fStatusLineAboveButtons && isHelpAvailable()) {
- createHelpControl(composite);
- }
- fStatusLine = new MessageLine(composite);
- fStatusLine.setAlignment(SWT.LEFT);
- GridData statusData = new GridData(GridData.FILL_HORIZONTAL);
- fStatusLine.setErrorStatus(null);
- fStatusLine.setFont(font);
- if (fStatusLineAboveButtons && isHelpAvailable()) {
- statusData.horizontalSpan = 2;
- createHelpControl(composite);
- }
- fStatusLine.setLayoutData(statusData);
+ Font font = parent.getFont();
+ Composite composite = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ if (!fStatusLineAboveButtons) {
+ layout.numColumns = 2;
+ }
+ layout.marginHeight = 0;
+ layout.marginLeft = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
+ layout.marginWidth = 0;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ composite.setFont(font);
+
+ if (!fStatusLineAboveButtons && isHelpAvailable()) {
+ createHelpControl(composite);
+ }
+ fStatusLine = new MessageLine(composite);
+ fStatusLine.setAlignment(SWT.LEFT);
+ GridData statusData = new GridData(GridData.FILL_HORIZONTAL);
+ fStatusLine.setErrorStatus(null);
+ fStatusLine.setFont(font);
+ if (fStatusLineAboveButtons && isHelpAvailable()) {
+ statusData.horizontalSpan = 2;
+ createHelpControl(composite);
+ }
+ fStatusLine.setLayoutData(statusData);
/*
- * Create the rest of the button bar, but tell it not to
- * create a help button (we've already created it).
+ * Create the rest of the button bar, but tell it not to create a help button
+ * (we've already created it).
*/
boolean helpAvailable = isHelpAvailable();
setHelpAvailable(false);
super.createButtonBar(composite);
setHelpAvailable(helpAvailable);
- return composite;
- }
+ return composite;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/TwoArrayQuickSorter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/TwoArrayQuickSorter.java
index 3bb2fee70a1..f72c15f09ff 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/TwoArrayQuickSorter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/TwoArrayQuickSorter.java
@@ -18,107 +18,109 @@ import java.util.Comparator;
import org.eclipse.core.runtime.Assert;
/**
- * Quick sort to sort key-value pairs. The keys and arrays are specified
- * in separate arrays.
+ * Quick sort to sort key-value pairs. The keys and arrays are specified in
+ * separate arrays.
*
* @since 2.0
*/
/* package */class TwoArrayQuickSorter {
- private Comparator fComparator;
+ private Comparator fComparator;
- /**
- * Default comparator.
- */
- public static final class StringComparator implements Comparator {
- private boolean fIgnoreCase;
+ /**
+ * Default comparator.
+ */
+ public static final class StringComparator implements Comparator {
+ private boolean fIgnoreCase;
- StringComparator(boolean ignoreCase) {
- fIgnoreCase = ignoreCase;
- }
+ StringComparator(boolean ignoreCase) {
+ fIgnoreCase = ignoreCase;
+ }
- @Override
+ @Override
public int compare(Object left, Object right) {
- return fIgnoreCase ? ((String) left)
- .compareToIgnoreCase((String) right) : ((String) left)
- .compareTo((String) right);
- }
- }
-
- /**
- * Creates a sorter with default string comparator.
- * The keys are assumed to be strings.
- * @param ignoreCase specifies whether sorting is case sensitive or not.
- */
- public TwoArrayQuickSorter(boolean ignoreCase) {
- fComparator = new StringComparator(ignoreCase);
- }
-
- /**
- * Creates a sorter with a comparator.
- * @param comparator the comparator to order the elements. The comparator must not be <code>null</code>.
- */
- public TwoArrayQuickSorter(Comparator comparator) {
- fComparator = comparator;
- }
-
- /**
- * Sorts keys and values in parallel.
- * @param keys the keys to use for sorting.
- * @param values the values associated with the keys.
- */
- public void sort(Object[] keys, Object[] values) {
- if ((keys == null) || (values == null)) {
- Assert.isTrue(false, "Either keys or values in null"); //$NON-NLS-1$
- return;
- }
-
- if (keys.length <= 1) {
+ return fIgnoreCase ? ((String) left).compareToIgnoreCase((String) right)
+ : ((String) left).compareTo((String) right);
+ }
+ }
+
+ /**
+ * Creates a sorter with default string comparator. The keys are assumed to be
+ * strings.
+ *
+ * @param ignoreCase specifies whether sorting is case sensitive or not.
+ */
+ public TwoArrayQuickSorter(boolean ignoreCase) {
+ fComparator = new StringComparator(ignoreCase);
+ }
+
+ /**
+ * Creates a sorter with a comparator.
+ *
+ * @param comparator the comparator to order the elements. The comparator must
+ * not be <code>null</code>.
+ */
+ public TwoArrayQuickSorter(Comparator comparator) {
+ fComparator = comparator;
+ }
+
+ /**
+ * Sorts keys and values in parallel.
+ *
+ * @param keys the keys to use for sorting.
+ * @param values the values associated with the keys.
+ */
+ public void sort(Object[] keys, Object[] values) {
+ if ((keys == null) || (values == null)) {
+ Assert.isTrue(false, "Either keys or values in null"); //$NON-NLS-1$
+ return;
+ }
+
+ if (keys.length <= 1) {
return;
}
- internalSort(keys, values, 0, keys.length - 1);
- }
+ internalSort(keys, values, 0, keys.length - 1);
+ }
- private void internalSort(Object[] keys, Object[] values, int left,
- int right) {
- int original_left = left;
- int original_right = right;
+ private void internalSort(Object[] keys, Object[] values, int left, int right) {
+ int original_left = left;
+ int original_right = right;
- Object mid = keys[(left + right) / 2];
- do {
- while (fComparator.compare(keys[left], mid) < 0) {
+ Object mid = keys[(left + right) / 2];
+ do {
+ while (fComparator.compare(keys[left], mid) < 0) {
left++;
}
- while (fComparator.compare(mid, keys[right]) < 0) {
+ while (fComparator.compare(mid, keys[right]) < 0) {
right--;
}
- if (left <= right) {
- swap(keys, left, right);
- swap(values, left, right);
- left++;
- right--;
- }
- } while (left <= right);
+ if (left <= right) {
+ swap(keys, left, right);
+ swap(values, left, right);
+ left++;
+ right--;
+ }
+ } while (left <= right);
- if (original_left < right) {
+ if (original_left < right) {
internalSort(keys, values, original_left, right);
}
- if (left < original_right) {
+ if (left < original_right) {
internalSort(keys, values, left, original_right);
}
- }
-
- /*
- * Swaps x[a] with x[b].
- */
- private static final void swap(Object x[], int a, int b) {
- Object t = x[a];
- x[a] = x[b];
- x[b] = t;
- }
+ }
+
+ /*
+ * Swaps x[a] with x[b].
+ */
+ private static final void swap(Object x[], int a, int b) {
+ Object t = x[a];
+ x[a] = x[b];
+ x[b] = t;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/TwoPaneElementSelector.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/TwoPaneElementSelector.java
index 6ad132fa014..843c427ffbe 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/TwoPaneElementSelector.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/TwoPaneElementSelector.java
@@ -35,7 +35,6 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.viewers.ILabelProvider;
-
/**
* A list selection dialog with two panes. Duplicated entries will be folded
* together and are displayed in the lower pane (qualifier).
@@ -43,190 +42,180 @@ import org.eclipse.jface.viewers.ILabelProvider;
* @since 2.0
*/
public class TwoPaneElementSelector extends AbstractElementListSelectionDialog {
- private String fUpperListLabel;
-
- private String fLowerListLabel;
-
- /**
- * The comparator used to sort the list in the lower pane.
- * @since 3.5
- */
- private Comparator fLowerListComparator = null;
-
- private ILabelProvider fQualifierRenderer;
-
- private Object[] fElements = new Object[0];
-
- private Table fLowerList;
-
- private Object[] fQualifierElements;
-
- /**
- * Creates the two pane element selector.
- *
- * @param parent
- * the parent shell.
- * @param elementRenderer
- * the element renderer.
- * @param qualifierRenderer
- * the qualifier renderer.
- */
- public TwoPaneElementSelector(Shell parent, ILabelProvider elementRenderer,
- ILabelProvider qualifierRenderer) {
- super(parent, elementRenderer);
- setSize(50, 15);
- setAllowDuplicates(false);
- fQualifierRenderer = qualifierRenderer;
- }
-
- /**
- * Sets the upper list label. If the label is <code>null</code> (default),
- * no label is created.
- *
- * @param label
- */
- public void setUpperListLabel(String label) {
- fUpperListLabel = label;
- }
-
- /**
- * Sets the lower list label.
- *
- * @param label
- * String or <code>null</code>. If the label is
- * <code>null</code> (default), no label is created.
- */
- public void setLowerListLabel(String label) {
- fLowerListLabel = label;
- }
-
- /**
- * Sets the comparator used to sort the list in the lower pane.
- * <p>
- * Note: the comparator might want to honor
- * {@link AbstractElementListSelectionDialog#isCaseIgnored()}.
- * </p>
- *
- * @param comparator
- * a Comparator or <code>null</code> if <code>String</code>'s
- * comparison methods should be used
- * @since 3.5
- */
- public void setLowerListComparator(Comparator comparator) {
- fLowerListComparator = comparator;
- }
-
- /**
- * Sets the elements to be displayed.
- *
- * @param elements
- * the elements to be displayed.
- */
- public void setElements(Object[] elements) {
- fElements = elements;
- }
-
- /*
- * @see Dialog#createDialogArea(Composite)
- */
- @Override
+ private String fUpperListLabel;
+
+ private String fLowerListLabel;
+
+ /**
+ * The comparator used to sort the list in the lower pane.
+ *
+ * @since 3.5
+ */
+ private Comparator fLowerListComparator = null;
+
+ private ILabelProvider fQualifierRenderer;
+
+ private Object[] fElements = new Object[0];
+
+ private Table fLowerList;
+
+ private Object[] fQualifierElements;
+
+ /**
+ * Creates the two pane element selector.
+ *
+ * @param parent the parent shell.
+ * @param elementRenderer the element renderer.
+ * @param qualifierRenderer the qualifier renderer.
+ */
+ public TwoPaneElementSelector(Shell parent, ILabelProvider elementRenderer, ILabelProvider qualifierRenderer) {
+ super(parent, elementRenderer);
+ setSize(50, 15);
+ setAllowDuplicates(false);
+ fQualifierRenderer = qualifierRenderer;
+ }
+
+ /**
+ * Sets the upper list label. If the label is <code>null</code> (default), no
+ * label is created.
+ *
+ * @param label
+ */
+ public void setUpperListLabel(String label) {
+ fUpperListLabel = label;
+ }
+
+ /**
+ * Sets the lower list label.
+ *
+ * @param label String or <code>null</code>. If the label is <code>null</code>
+ * (default), no label is created.
+ */
+ public void setLowerListLabel(String label) {
+ fLowerListLabel = label;
+ }
+
+ /**
+ * Sets the comparator used to sort the list in the lower pane.
+ * <p>
+ * Note: the comparator might want to honor
+ * {@link AbstractElementListSelectionDialog#isCaseIgnored()}.
+ * </p>
+ *
+ * @param comparator a Comparator or <code>null</code> if <code>String</code>'s
+ * comparison methods should be used
+ * @since 3.5
+ */
+ public void setLowerListComparator(Comparator comparator) {
+ fLowerListComparator = comparator;
+ }
+
+ /**
+ * Sets the elements to be displayed.
+ *
+ * @param elements the elements to be displayed.
+ */
+ public void setElements(Object[] elements) {
+ fElements = elements;
+ }
+
+ /*
+ * @see Dialog#createDialogArea(Composite)
+ */
+ @Override
public Control createDialogArea(Composite parent) {
- Composite contents = (Composite) super.createDialogArea(parent);
- createMessageArea(contents);
- createFilterText(contents);
- createLabel(contents, fUpperListLabel);
- createFilteredList(contents);
- createLabel(contents, fLowerListLabel);
- createLowerList(contents);
- setListElements(fElements);
- List initialSelections = getInitialElementSelections();
- if (!initialSelections.isEmpty()) {
- Object element = initialSelections.get(0);
- setSelection(new Object[] { element });
- setLowerSelectedElement(element);
- }
- return contents;
- }
-
- /**
- * Creates a label if name was not <code>null</code>.
- *
- * @param parent
- * the parent composite.
- * @param name
- * the name of the label.
- * @return returns a label if a name was given, <code>null</code>
- * otherwise.
- */
- protected Label createLabel(Composite parent, String name) {
- if (name == null) {
+ Composite contents = (Composite) super.createDialogArea(parent);
+ createMessageArea(contents);
+ createFilterText(contents);
+ createLabel(contents, fUpperListLabel);
+ createFilteredList(contents);
+ createLabel(contents, fLowerListLabel);
+ createLowerList(contents);
+ setListElements(fElements);
+ List initialSelections = getInitialElementSelections();
+ if (!initialSelections.isEmpty()) {
+ Object element = initialSelections.get(0);
+ setSelection(new Object[] { element });
+ setLowerSelectedElement(element);
+ }
+ return contents;
+ }
+
+ /**
+ * Creates a label if name was not <code>null</code>.
+ *
+ * @param parent the parent composite.
+ * @param name the name of the label.
+ * @return returns a label if a name was given, <code>null</code> otherwise.
+ */
+ protected Label createLabel(Composite parent, String name) {
+ if (name == null) {
return null;
}
- Label label = new Label(parent, SWT.NONE);
- label.setText(name);
- label.setFont(parent.getFont());
- return label;
- }
-
- /**
- * Creates the list widget and sets layout data.
- *
- * @param parent
- * the parent composite.
- * @return returns the list table widget.
- */
- protected Table createLowerList(Composite parent) {
- Table list = new Table(parent, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
- list.addListener(SWT.Selection, evt -> handleLowerSelectionChanged());
- list.addListener(SWT.MouseDoubleClick, evt -> handleDefaultSelected());
- list.addDisposeListener(e -> fQualifierRenderer.dispose());
- GridData data = new GridData();
- data.widthHint = convertWidthInCharsToPixels(50);
- data.heightHint = convertHeightInCharsToPixels(5);
- data.grabExcessVerticalSpace = true;
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- data.verticalAlignment = GridData.FILL;
- list.setLayoutData(data);
- list.setFont(parent.getFont());
- fLowerList = list;
- return list;
- }
-
- /**
- * @see SelectionStatusDialog#computeResult()
- */
- @Override
+ Label label = new Label(parent, SWT.NONE);
+ label.setText(name);
+ label.setFont(parent.getFont());
+ return label;
+ }
+
+ /**
+ * Creates the list widget and sets layout data.
+ *
+ * @param parent the parent composite.
+ * @return returns the list table widget.
+ */
+ protected Table createLowerList(Composite parent) {
+ Table list = new Table(parent, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
+ list.addListener(SWT.Selection, evt -> handleLowerSelectionChanged());
+ list.addListener(SWT.MouseDoubleClick, evt -> handleDefaultSelected());
+ list.addDisposeListener(e -> fQualifierRenderer.dispose());
+ GridData data = new GridData();
+ data.widthHint = convertWidthInCharsToPixels(50);
+ data.heightHint = convertHeightInCharsToPixels(5);
+ data.grabExcessVerticalSpace = true;
+ data.grabExcessHorizontalSpace = true;
+ data.horizontalAlignment = GridData.FILL;
+ data.verticalAlignment = GridData.FILL;
+ list.setLayoutData(data);
+ list.setFont(parent.getFont());
+ fLowerList = list;
+ return list;
+ }
+
+ /**
+ * @see SelectionStatusDialog#computeResult()
+ */
+ @Override
protected void computeResult() {
- Object[] results = new Object[] { getLowerSelectedElement() };
- setResult(Arrays.asList(results));
- }
-
- /**
- * @see AbstractElementListSelectionDialog#handleDefaultSelected()
- */
- @Override
+ Object[] results = new Object[] { getLowerSelectedElement() };
+ setResult(Arrays.asList(results));
+ }
+
+ /**
+ * @see AbstractElementListSelectionDialog#handleDefaultSelected()
+ */
+ @Override
protected void handleDefaultSelected() {
- if (validateCurrentSelection() && (getLowerSelectedElement() != null)) {
+ if (validateCurrentSelection() && (getLowerSelectedElement() != null)) {
buttonPressed(IDialogConstants.OK_ID);
}
- }
+ }
- /**
- * @see AbstractElementListSelectionDialog#handleSelectionChanged()
- */
- @Override
+ /**
+ * @see AbstractElementListSelectionDialog#handleSelectionChanged()
+ */
+ @Override
protected void handleSelectionChanged() {
- handleUpperSelectionChanged();
- }
+ handleUpperSelectionChanged();
+ }
- private void handleUpperSelectionChanged() {
- int indices[] = getSelectionIndices();
- fLowerList.removeAll();
+ private void handleUpperSelectionChanged() {
+ int indices[] = getSelectionIndices();
+ fLowerList.removeAll();
int elementCount = 0;
- List elements= new ArrayList(indices.length * 5);
- for (int index : indices) {
- Object[] foldedElements= getFoldedElements(index);
+ List elements = new ArrayList(indices.length * 5);
+ for (int index : indices) {
+ Object[] foldedElements = getFoldedElements(index);
if (foldedElements != null) {
elementCount = elementCount + foldedElements.length;
elements.add(getFoldedElements(index));
@@ -237,7 +226,7 @@ public class TwoPaneElementSelector extends AbstractElementListSelectionDialog {
int destPos = 0;
Iterator iterator = elements.iterator();
while (iterator.hasNext()) {
- Object[] objects= (Object[])iterator.next();
+ Object[] objects = (Object[]) iterator.next();
System.arraycopy(objects, 0, fQualifierElements, destPos, objects.length);
destPos = destPos + objects.length;
}
@@ -247,98 +236,100 @@ public class TwoPaneElementSelector extends AbstractElementListSelectionDialog {
updateLowerListWidget(new Object[] {});
}
- validateCurrentSelection();
- }
+ validateCurrentSelection();
+ }
- private void handleLowerSelectionChanged() {
- validateCurrentSelection();
- }
+ private void handleLowerSelectionChanged() {
+ validateCurrentSelection();
+ }
- /**
- * Selects an element in the lower pane.
- * @param element
- */
- protected void setLowerSelectedElement(Object element) {
- if (fQualifierElements == null) {
+ /**
+ * Selects an element in the lower pane.
+ *
+ * @param element
+ */
+ protected void setLowerSelectedElement(Object element) {
+ if (fQualifierElements == null) {
return;
}
- // find matching index
- int i;
- for (i = 0; i != fQualifierElements.length; i++) {
+ // find matching index
+ int i;
+ for (i = 0; i != fQualifierElements.length; i++) {
if (fQualifierElements[i].equals(element)) {
break;
}
}
- // set selection
- if (i != fQualifierElements.length) {
+ // set selection
+ if (i != fQualifierElements.length) {
fLowerList.setSelection(i);
}
- }
-
- /**
- * Returns the selected element from the lower pane.
- * @return Object
- */
- protected Object getLowerSelectedElement() {
- int index = fLowerList.getSelectionIndex();
- if (index >= 0) {
+ }
+
+ /**
+ * Returns the selected element from the lower pane.
+ *
+ * @return Object
+ */
+ protected Object getLowerSelectedElement() {
+ int index = fLowerList.getSelectionIndex();
+ if (index >= 0) {
return fQualifierElements[index];
}
- return null;
- }
-
- private void updateLowerListWidget(Object[] elements) {
- int length = elements.length;
- String[] qualifiers = new String[length];
- for (int i = 0; i != length; i++){
- String text = fQualifierRenderer.getText(elements[i]);
- if(text == null) {
+ return null;
+ }
+
+ private void updateLowerListWidget(Object[] elements) {
+ int length = elements.length;
+ String[] qualifiers = new String[length];
+ for (int i = 0; i != length; i++) {
+ String text = fQualifierRenderer.getText(elements[i]);
+ if (text == null) {
text = ""; //$NON-NLS-1$
}
- qualifiers[i] = text;
- }
-
- TwoArrayQuickSorter sorter;
- if (fLowerListComparator == null) {
- sorter = new TwoArrayQuickSorter(isCaseIgnored());
- } else {
- sorter = new TwoArrayQuickSorter(fLowerListComparator);
- }
-
- sorter.sort(qualifiers, elements);
- for (int i = 0; i != length; i++) {
- TableItem item = new TableItem(fLowerList, SWT.NONE);
- item.setText(qualifiers[i]);
- item.setImage(fQualifierRenderer.getImage(elements[i]));
- }
- if (fLowerList.getItemCount() > 0) {
+ qualifiers[i] = text;
+ }
+
+ TwoArrayQuickSorter sorter;
+ if (fLowerListComparator == null) {
+ sorter = new TwoArrayQuickSorter(isCaseIgnored());
+ } else {
+ sorter = new TwoArrayQuickSorter(fLowerListComparator);
+ }
+
+ sorter.sort(qualifiers, elements);
+ for (int i = 0; i != length; i++) {
+ TableItem item = new TableItem(fLowerList, SWT.NONE);
+ item.setText(qualifiers[i]);
+ item.setImage(fQualifierRenderer.getImage(elements[i]));
+ }
+ if (fLowerList.getItemCount() > 0) {
fLowerList.setSelection(0);
}
- }
+ }
- /*
- * @see AbstractElementListSelectionDialog#handleEmptyList()
- */
- @Override
+ /*
+ * @see AbstractElementListSelectionDialog#handleEmptyList()
+ */
+ @Override
protected void handleEmptyList() {
- super.handleEmptyList();
- fLowerList.setEnabled(false);
- }
-
- /**
- * @see AbstractElementListSelectionDialog#validateCurrentSelection()
- * @since 3.5
- */
- @Override
+ super.handleEmptyList();
+ fLowerList.setEnabled(false);
+ }
+
+ /**
+ * @see AbstractElementListSelectionDialog#validateCurrentSelection()
+ * @since 3.5
+ */
+ @Override
protected boolean validateCurrentSelection() {
- ISelectionStatusValidator validator = getValidator();
- Object lowerSelection = getLowerSelectedElement();
-
- if (validator != null && lowerSelection != null) {
- IStatus status = validator.validate(new Object [] {lowerSelection});
- updateStatus(status);
- return status.isOK();
- }
- return super.validateCurrentSelection();
- }
+ ISelectionStatusValidator validator = getValidator();
+ Object lowerSelection = getLowerSelectedElement();
+
+ if (validator != null && lowerSelection != null) {
+ IStatus status = validator.validate(new Object[] { lowerSelection });
+ updateStatus(status);
+ return status.isOK();
+ }
+ return super.validateCurrentSelection();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/TypeFilteringDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/TypeFilteringDialog.java
index 1f582291e96..edff88df398 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/TypeFilteringDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/TypeFilteringDialog.java
@@ -50,247 +50,240 @@ import org.eclipse.ui.internal.registry.EditorRegistry;
* file editor.
*/
public class TypeFilteringDialog extends SelectionDialog {
- Button addTypesButton;
+ Button addTypesButton;
- Collection initialSelections;
+ Collection initialSelections;
- // the visual selection widget group
- CheckboxTableViewer listViewer;
+ // the visual selection widget group
+ CheckboxTableViewer listViewer;
- // sizing constants
- private static final int SIZING_SELECTION_WIDGET_HEIGHT = 250;
+ // sizing constants
+ private static final int SIZING_SELECTION_WIDGET_HEIGHT = 250;
- private static final int SIZING_SELECTION_WIDGET_WIDTH = 300;
+ private static final int SIZING_SELECTION_WIDGET_WIDTH = 300;
- private static final String TYPE_DELIMITER = WorkbenchMessages.TypesFiltering_typeDelimiter;
+ private static final String TYPE_DELIMITER = WorkbenchMessages.TypesFiltering_typeDelimiter;
- //Define a title for the filter entry field.
- private String filterTitle = WorkbenchMessages.TypesFiltering_otherExtensions;
+ // Define a title for the filter entry field.
+ private String filterTitle = WorkbenchMessages.TypesFiltering_otherExtensions;
- Text userDefinedText;
+ Text userDefinedText;
- IFileEditorMapping[] currentInput;
+ IFileEditorMapping[] currentInput;
- /**
- * Creates a type filtering dialog using the supplied entries. Set the
- * initial selections to those whose extensions match the preselections.
- * @param parentShell The shell to parent the dialog from.
- * @param preselections
- * of String - a Collection of String to define the preselected
- * types
- */
- public TypeFilteringDialog(Shell parentShell, Collection preselections) {
- super(parentShell);
- setTitle(WorkbenchMessages.TypesFiltering_title);
- this.initialSelections = preselections;
- setMessage(WorkbenchMessages.TypesFiltering_message);
+ /**
+ * Creates a type filtering dialog using the supplied entries. Set the initial
+ * selections to those whose extensions match the preselections.
+ *
+ * @param parentShell The shell to parent the dialog from.
+ * @param preselections of String - a Collection of String to define the
+ * preselected types
+ */
+ public TypeFilteringDialog(Shell parentShell, Collection preselections) {
+ super(parentShell);
+ setTitle(WorkbenchMessages.TypesFiltering_title);
+ this.initialSelections = preselections;
+ setMessage(WorkbenchMessages.TypesFiltering_message);
setShellStyle(getShellStyle() | SWT.SHEET);
- }
+ }
- /**
- * Creates a type filtering dialog using the supplied entries. Set the
- * initial selections to those whose extensions match the preselections.
- *
- * @param parentShell The shell to parent the dialog from.
- * @param preselections
- * of String - a Collection of String to define the preselected
- * types
- * @param filterText -
- * the title of the text entry field for other extensions.
- */
- public TypeFilteringDialog(Shell parentShell, Collection preselections,
- String filterText) {
- this(parentShell, preselections);
- this.filterTitle = filterText;
- }
+ /**
+ * Creates a type filtering dialog using the supplied entries. Set the initial
+ * selections to those whose extensions match the preselections.
+ *
+ * @param parentShell The shell to parent the dialog from.
+ * @param preselections of String - a Collection of String to define the
+ * preselected types
+ * @param filterText - the title of the text entry field for other
+ * extensions.
+ */
+ public TypeFilteringDialog(Shell parentShell, Collection preselections, String filterText) {
+ this(parentShell, preselections);
+ this.filterTitle = filterText;
+ }
- /**
- * Add the selection and deselection buttons to the dialog.
- *
- * @param composite
- * org.eclipse.swt.widgets.Composite
- */
- private void addSelectionButtons(Composite composite) {
- Composite buttonComposite = new Composite(composite, SWT.RIGHT);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- buttonComposite.setLayout(layout);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END
- | GridData.GRAB_HORIZONTAL);
- data.grabExcessHorizontalSpace = true;
- composite.setData(data);
- Button selectButton = createButton(buttonComposite,
- IDialogConstants.SELECT_ALL_ID, WorkbenchMessages.WizardTransferPage_selectAll, false);
- SelectionListener listener = widgetSelectedAdapter(e -> listViewer.setAllChecked(true));
- selectButton.addSelectionListener(listener);
- Button deselectButton = createButton(buttonComposite,
- IDialogConstants.DESELECT_ALL_ID, WorkbenchMessages.WizardTransferPage_deselectAll, false);
- listener = widgetSelectedAdapter(e -> listViewer.setAllChecked(false));
- deselectButton.addSelectionListener(listener);
- }
+ /**
+ * Add the selection and deselection buttons to the dialog.
+ *
+ * @param composite org.eclipse.swt.widgets.Composite
+ */
+ private void addSelectionButtons(Composite composite) {
+ Composite buttonComposite = new Composite(composite, SWT.RIGHT);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ buttonComposite.setLayout(layout);
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.GRAB_HORIZONTAL);
+ data.grabExcessHorizontalSpace = true;
+ composite.setData(data);
+ Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID,
+ WorkbenchMessages.WizardTransferPage_selectAll, false);
+ SelectionListener listener = widgetSelectedAdapter(e -> listViewer.setAllChecked(true));
+ selectButton.addSelectionListener(listener);
+ Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID,
+ WorkbenchMessages.WizardTransferPage_deselectAll, false);
+ listener = widgetSelectedAdapter(e -> listViewer.setAllChecked(false));
+ deselectButton.addSelectionListener(listener);
+ }
- /**
- * Add the currently-specified extensions to result.
- * @param result
- */
- private void addUserDefinedEntries(List result) {
- StringTokenizer tokenizer = new StringTokenizer(userDefinedText
- .getText(), TYPE_DELIMITER);
- //Allow the *. and . prefix and strip out the extension
- while (tokenizer.hasMoreTokens()) {
- String currentExtension = tokenizer.nextToken().trim();
- if (!currentExtension.equals("")) { //$NON-NLS-1$
- if (currentExtension.startsWith("*.")) { //$NON-NLS-1$
+ /**
+ * Add the currently-specified extensions to result.
+ *
+ * @param result
+ */
+ private void addUserDefinedEntries(List result) {
+ StringTokenizer tokenizer = new StringTokenizer(userDefinedText.getText(), TYPE_DELIMITER);
+ // Allow the *. and . prefix and strip out the extension
+ while (tokenizer.hasMoreTokens()) {
+ String currentExtension = tokenizer.nextToken().trim();
+ if (!currentExtension.equals("")) { //$NON-NLS-1$
+ if (currentExtension.startsWith("*.")) { //$NON-NLS-1$
result.add(currentExtension.substring(2));
} else {
- if (currentExtension.startsWith(".")) { //$NON-NLS-1$
+ if (currentExtension.startsWith(".")) { //$NON-NLS-1$
result.add(currentExtension.substring(1));
} else {
result.add(currentExtension);
}
- }
- }
- }
- }
+ }
+ }
+ }
+ }
- /**
- * Visually checks the previously-specified elements in this dialog's list
- * viewer.
- */
- private void checkInitialSelections() {
- IFileEditorMapping editorMappings[] = ((EditorRegistry) PlatformUI
- .getWorkbench().getEditorRegistry()).getUnifiedMappings();
- ArrayList selectedMappings = new ArrayList();
- for (IFileEditorMapping mapping : editorMappings) {
- //Check for both extension and label matches
- if (this.initialSelections.contains(mapping.getExtension())) {
- listViewer.setChecked(mapping, true);
- selectedMappings.add(mapping.getExtension());
- } else {
- if (this.initialSelections.contains(mapping.getLabel())) {
- listViewer.setChecked(mapping, true);
- selectedMappings.add(mapping.getLabel());
- }
- }
- }
- //Now add in the ones not selected to the user defined list
- Iterator initialIterator = this.initialSelections.iterator();
- StringBuilder entries = new StringBuilder();
- while (initialIterator.hasNext()) {
- String nextExtension = (String) initialIterator.next();
- if (!selectedMappings.contains(nextExtension)) {
- if (entries.length() != 0) {
+ /**
+ * Visually checks the previously-specified elements in this dialog's list
+ * viewer.
+ */
+ private void checkInitialSelections() {
+ IFileEditorMapping editorMappings[] = ((EditorRegistry) PlatformUI.getWorkbench().getEditorRegistry())
+ .getUnifiedMappings();
+ ArrayList selectedMappings = new ArrayList();
+ for (IFileEditorMapping mapping : editorMappings) {
+ // Check for both extension and label matches
+ if (this.initialSelections.contains(mapping.getExtension())) {
+ listViewer.setChecked(mapping, true);
+ selectedMappings.add(mapping.getExtension());
+ } else {
+ if (this.initialSelections.contains(mapping.getLabel())) {
+ listViewer.setChecked(mapping, true);
+ selectedMappings.add(mapping.getLabel());
+ }
+ }
+ }
+ // Now add in the ones not selected to the user defined list
+ Iterator initialIterator = this.initialSelections.iterator();
+ StringBuilder entries = new StringBuilder();
+ while (initialIterator.hasNext()) {
+ String nextExtension = (String) initialIterator.next();
+ if (!selectedMappings.contains(nextExtension)) {
+ if (entries.length() != 0) {
entries.append(',');
- }
- entries.append(nextExtension);
- }
- }
- this.userDefinedText.setText(entries.toString());
- }
+ }
+ entries.append(nextExtension);
+ }
+ }
+ this.userDefinedText.setText(entries.toString());
+ }
- @Override
+ @Override
protected void configureShell(Shell shell) {
- super.configureShell(shell);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(shell,
- IWorkbenchHelpContextIds.TYPE_FILTERING_DIALOG);
- }
+ super.configureShell(shell);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(shell, IWorkbenchHelpContextIds.TYPE_FILTERING_DIALOG);
+ }
- @Override
+ @Override
protected Control createDialogArea(Composite parent) {
- // page group
- Composite composite = (Composite) super.createDialogArea(parent);
- createMessageArea(composite);
- listViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT;
- data.widthHint = SIZING_SELECTION_WIDGET_WIDTH;
- listViewer.getTable().setLayoutData(data);
- listViewer.getTable().setFont(parent.getFont());
- listViewer.setLabelProvider(FileEditorMappingLabelProvider.INSTANCE);
+ // page group
+ Composite composite = (Composite) super.createDialogArea(parent);
+ createMessageArea(composite);
+ listViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER);
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT;
+ data.widthHint = SIZING_SELECTION_WIDGET_WIDTH;
+ listViewer.getTable().setLayoutData(data);
+ listViewer.getTable().setFont(parent.getFont());
+ listViewer.setLabelProvider(FileEditorMappingLabelProvider.INSTANCE);
listViewer.setContentProvider(ArrayContentProvider.getInstance());
- listViewer.setComparator(new ViewerComparator());
- addSelectionButtons(composite);
- createUserEntryGroup(composite);
- initializeViewer();
- // initialize page
- if (this.initialSelections != null && !this.initialSelections.isEmpty()) {
+ listViewer.setComparator(new ViewerComparator());
+ addSelectionButtons(composite);
+ createUserEntryGroup(composite);
+ initializeViewer();
+ // initialize page
+ if (this.initialSelections != null && !this.initialSelections.isEmpty()) {
checkInitialSelections();
}
- return composite;
- }
+ return composite;
+ }
- /**
- * Create the group that shows the user defined entries for the dialog.
- *
- * @param parent
- * the parent this is being created in.
- */
- private void createUserEntryGroup(Composite parent) {
- Font font = parent.getFont();
- // destination specification group
- Composite userDefinedGroup = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- userDefinedGroup.setLayout(layout);
- userDefinedGroup.setLayoutData(new GridData(
- GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- Label fTitle = new Label(userDefinedGroup, SWT.NONE);
- fTitle.setFont(font);
- fTitle.setText(filterTitle);
- // user defined entry field
- userDefinedText = new Text(userDefinedGroup, SWT.SINGLE | SWT.BORDER);
- userDefinedText.setFont(font);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL
- | GridData.GRAB_HORIZONTAL);
- userDefinedText.setLayoutData(data);
- }
+ /**
+ * Create the group that shows the user defined entries for the dialog.
+ *
+ * @param parent the parent this is being created in.
+ */
+ private void createUserEntryGroup(Composite parent) {
+ Font font = parent.getFont();
+ // destination specification group
+ Composite userDefinedGroup = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ userDefinedGroup.setLayout(layout);
+ userDefinedGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
+ Label fTitle = new Label(userDefinedGroup, SWT.NONE);
+ fTitle.setFont(font);
+ fTitle.setText(filterTitle);
+ // user defined entry field
+ userDefinedText = new Text(userDefinedGroup, SWT.SINGLE | SWT.BORDER);
+ userDefinedText.setFont(font);
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
+ userDefinedText.setLayoutData(data);
+ }
- /**
- * Return the input to the dialog.
- * @return IFileEditorMapping[]
- */
- private IFileEditorMapping[] getInput() {
- //Filter the mappings to be just those with a wildcard extension
- if (currentInput == null) {
- List wildcardEditors = new ArrayList();
- IFileEditorMapping[] allMappings = ((EditorRegistry)PlatformUI.getWorkbench()
- .getEditorRegistry()).getUnifiedMappings();
- for (IFileEditorMapping allMapping : allMappings) {
- if (allMapping.getName().equals("*")) { //$NON-NLS-1$
+ /**
+ * Return the input to the dialog.
+ *
+ * @return IFileEditorMapping[]
+ */
+ private IFileEditorMapping[] getInput() {
+ // Filter the mappings to be just those with a wildcard extension
+ if (currentInput == null) {
+ List wildcardEditors = new ArrayList();
+ IFileEditorMapping[] allMappings = ((EditorRegistry) PlatformUI.getWorkbench().getEditorRegistry())
+ .getUnifiedMappings();
+ for (IFileEditorMapping allMapping : allMappings) {
+ if (allMapping.getName().equals("*")) { //$NON-NLS-1$
wildcardEditors.add(allMapping);
}
- }
- currentInput = new IFileEditorMapping[wildcardEditors.size()];
- wildcardEditors.toArray(currentInput);
- }
- return currentInput;
- }
+ }
+ currentInput = new IFileEditorMapping[wildcardEditors.size()];
+ wildcardEditors.toArray(currentInput);
+ }
+ return currentInput;
+ }
- /**
- * Initializes this dialog's viewer after it has been laid out.
- */
- private void initializeViewer() {
- listViewer.setInput(getInput());
- }
+ /**
+ * Initializes this dialog's viewer after it has been laid out.
+ */
+ private void initializeViewer() {
+ listViewer.setInput(getInput());
+ }
- /**
- * The <code>TypeFilteringDialog</code> implementation of this
- * <code>Dialog</code> method builds a list of the selected elements for
- * later retrieval by the client and closes this dialog.
- */
- @Override
+ /**
+ * The <code>TypeFilteringDialog</code> implementation of this
+ * <code>Dialog</code> method builds a list of the selected elements for later
+ * retrieval by the client and closes this dialog.
+ */
+ @Override
protected void okPressed() {
- // Get the input children.
- IFileEditorMapping[] children = getInput();
- List list = new ArrayList();
- // Build a list of selected children.
- for (IFileEditorMapping element : children) {
- if (listViewer.getChecked(element)) {
+ // Get the input children.
+ IFileEditorMapping[] children = getInput();
+ List list = new ArrayList();
+ // Build a list of selected children.
+ for (IFileEditorMapping element : children) {
+ if (listViewer.getChecked(element)) {
list.add(element.getExtension());
}
- }
- addUserDefinedEntries(list);
- setResult(list);
- super.okPressed();
- }
+ }
+ addUserDefinedEntries(list);
+ setResult(list);
+ super.okPressed();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WorkingSetConfigurationBlock.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WorkingSetConfigurationBlock.java
index 92ddef1b4d1..7b62d99056a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WorkingSetConfigurationBlock.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WorkingSetConfigurationBlock.java
@@ -68,19 +68,15 @@ public class WorkingSetConfigurationBlock {
* Filters the given working sets such that the following is true: for each
* IWorkingSet s in result: s.getId() is element of workingSetIds
*
- * @param workingSets
- * the array to filter
- * @param workingSetIds
- * the acceptable working set ids
+ * @param workingSets the array to filter
+ * @param workingSetIds the acceptable working set ids
* @return the filtered elements
*/
- public static IWorkingSet[] filter(IWorkingSet[] workingSets,
- String[] workingSetIds) {
+ public static IWorkingSet[] filter(IWorkingSet[] workingSets, String[] workingSetIds) {
// create a copy so we can sort the array without mucking it up for clients.
String[] workingSetIdsCopy = new String[workingSetIds.length];
- System.arraycopy(workingSetIds, 0, workingSetIdsCopy, 0,
- workingSetIds.length);
+ System.arraycopy(workingSetIds, 0, workingSetIdsCopy, 0, workingSetIds.length);
Arrays.sort(workingSetIdsCopy);
List<IWorkingSet> result = new ArrayList<>();
@@ -124,10 +120,8 @@ public class WorkingSetConfigurationBlock {
/**
* Create a new instance of this working set block using default labels.
*
- * @param settings
- * to store/load the selection history
- * @param workingSetIds
- * working set ids from which the user can choose
+ * @param settings to store/load the selection history
+ * @param workingSetIds working set ids from which the user can choose
* @since 3.108
*/
public WorkingSetConfigurationBlock(IDialogSettings settings, String... workingSetIds) {
@@ -165,30 +159,25 @@ public class WorkingSetConfigurationBlock {
* @param selectLabel the label to use for the select button. May be
* <code>null</code> to use the default value.
*/
- public WorkingSetConfigurationBlock(String[] workingSetIds, IDialogSettings settings, String enableButtonLabel, String comboLabel, String selectLabel) {
+ public WorkingSetConfigurationBlock(String[] workingSetIds, IDialogSettings settings, String enableButtonLabel,
+ String comboLabel, String selectLabel) {
this(settings, enableButtonLabel, null, comboLabel, selectLabel, workingSetIds);
}
-
/**
* Create a new instance of this working set block using custom labels.
*
- * @param settings
- * to store/load the selection history
- * @param enableButtonLabel
- * the label to use for the checkable enablement button. May be
- * <code>null</code> to use the default value.
- * @param newButtonLabel
- * the label to use for the new button. May be <code>null</code>
- * to use the default value.
- * @param comboLabel
- * the label to use for the recent working set combo. May be
- * <code>null</code> to use the default value.
- * @param selectLabel
- * the label to use for the select button. May be
- * <code>null</code> to use the default value.
- * @param workingSetIds
- * working set ids from which the user can choose
+ * @param settings to store/load the selection history
+ * @param enableButtonLabel the label to use for the checkable enablement
+ * button. May be <code>null</code> to use the default
+ * value.
+ * @param newButtonLabel the label to use for the new button. May be
+ * <code>null</code> to use the default value.
+ * @param comboLabel the label to use for the recent working set combo.
+ * May be <code>null</code> to use the default value.
+ * @param selectLabel the label to use for the select button. May be
+ * <code>null</code> to use the default value.
+ * @param workingSetIds working set ids from which the user can choose
* @since 3.108
*/
public WorkingSetConfigurationBlock(IDialogSettings settings, String enableButtonLabel, String newButtonLabel,
@@ -205,7 +194,8 @@ public class WorkingSetConfigurationBlock {
this.enableButtonLabel = enableButtonLabel == null ? WorkbenchMessages.WorkingSetGroup_EnableWorkingSet_button
: enableButtonLabel;
this.newButtonLabel = newButtonLabel == null
- ? WorkbenchMessages.WorkingSetConfigurationBlock_NewWorkingSet_button : newButtonLabel;
+ ? WorkbenchMessages.WorkingSetConfigurationBlock_NewWorkingSet_button
+ : newButtonLabel;
this.comboLabel = comboLabel == null ? WorkbenchMessages.WorkingSetConfigurationBlock_WorkingSetText_name
: comboLabel;
this.selectLabel = selectLabel == null ? WorkbenchMessages.WorkingSetConfigurationBlock_SelectWorkingSet_button
@@ -215,11 +205,9 @@ public class WorkingSetConfigurationBlock {
/**
* Set the current selection in the workbench.
*
- * @param selection
- * the selection to present in the UI or <b>null</b>
- * @deprecated use
- * {@link #setWorkingSets(IWorkingSet[])} and {@link #findApplicableWorkingSets(IStructuredSelection)}
- * instead.
+ * @param selection the selection to present in the UI or <b>null</b>
+ * @deprecated use {@link #setWorkingSets(IWorkingSet[])} and
+ * {@link #findApplicableWorkingSets(IStructuredSelection)} instead.
*/
@Deprecated
public void setSelection(IStructuredSelection selection) {
@@ -234,8 +222,7 @@ public class WorkingSetConfigurationBlock {
* Set the current selection of working sets. This array will be filtered to
* contain only working sets that are applicable to this instance.
*
- * @param workingSets
- * the working sets
+ * @param workingSets the working sets
*/
public void setWorkingSets(IWorkingSet... workingSets) {
selectedWorkingSets = filterWorkingSets(Arrays.asList(workingSets));
@@ -245,16 +232,14 @@ public class WorkingSetConfigurationBlock {
}
/**
- * Retrieves a working set from the given <code>selection</code> or an
- * empty array if no working set could be retrieved. This selection is
- * filtered based on the criteria used to construct this instance.
+ * Retrieves a working set from the given <code>selection</code> or an empty
+ * array if no working set could be retrieved. This selection is filtered based
+ * on the criteria used to construct this instance.
*
- * @param selection
- * the selection to retrieve the working set from
+ * @param selection the selection to retrieve the working set from
* @return the selected working set or an empty array
*/
- public IWorkingSet[] findApplicableWorkingSets(
- IStructuredSelection selection) {
+ public IWorkingSet[] findApplicableWorkingSets(IStructuredSelection selection) {
if (selection == null) {
return EMPTY_WORKING_SET_ARRAY;
}
@@ -263,18 +248,16 @@ public class WorkingSetConfigurationBlock {
}
/**
- * Prune a list of working sets such that they all match the criteria set
- * out by this block.
+ * Prune a list of working sets such that they all match the criteria set out by
+ * this block.
*
- * @param elements
- * the elements to filter
+ * @param elements the elements to filter
* @return the filtered elements
*/
private IWorkingSet[] filterWorkingSets(Collection<?> elements) {
List<IWorkingSet> result = new ArrayList<>();
for (Object element : elements) {
- if (element instanceof IWorkingSet
- && verifyWorkingSet((IWorkingSet) element)) {
+ if (element instanceof IWorkingSet && verifyWorkingSet((IWorkingSet) element)) {
result.add((IWorkingSet) element);
}
}
@@ -282,23 +265,20 @@ public class WorkingSetConfigurationBlock {
}
/**
- * Verifies that the given working set is suitable for selection in this
- * block.
+ * Verifies that the given working set is suitable for selection in this block.
*
- * @param workingSetCandidate
- * the candidate to test
+ * @param workingSetCandidate the candidate to test
* @return whether it is suitable
*/
private boolean verifyWorkingSet(IWorkingSet workingSetCandidate) {
return !workingSetCandidate.isAggregateWorkingSet()
- && Arrays.binarySearch(workingSetTypeIds, workingSetCandidate
- .getId()) >= 0 ;
+ && Arrays.binarySearch(workingSetTypeIds, workingSetCandidate.getId()) >= 0;
}
/**
- * Return the currently selected working sets. If the controls representing
- * this block are disabled this array will be empty regardless of the
- * currently selected values.
+ * Return the currently selected working sets. If the controls representing this
+ * block are disabled this array will be empty regardless of the currently
+ * selected values.
*
* @return the selected working sets
*/
@@ -320,8 +300,7 @@ public class WorkingSetConfigurationBlock {
composite.setLayout(new GridLayout(3, false));
enableButton = new Button(composite, SWT.CHECK);
- enableButton
- .setText(enableButtonLabel);
+ enableButton.setText(enableButtonLabel);
GridData enableData = new GridData(SWT.FILL, SWT.CENTER, true, false);
enableData.horizontalSpan = 2;
enableButton.setLayoutData(enableData);
@@ -333,8 +312,7 @@ public class WorkingSetConfigurationBlock {
newButton.addSelectionListener(widgetSelectedAdapter(e -> createNewWorkingSet(newButton.getShell())));
workingSetLabel = new Label(composite, SWT.NONE);
- workingSetLabel
- .setText(comboLabel);
+ workingSetLabel.setText(comboLabel);
workingSetCombo = new Combo(composite, SWT.READ_ONLY | SWT.BORDER);
GridData textData = new GridData(SWT.FILL, SWT.CENTER, true, false);
@@ -342,8 +320,7 @@ public class WorkingSetConfigurationBlock {
workingSetCombo.setLayoutData(textData);
selectButton = new Button(composite, SWT.PUSH);
- selectButton
- .setText(selectLabel);
+ selectButton.setText(selectLabel);
setButtonLayoutData(selectButton);
selectButton.addSelectionListener(widgetSelectedAdapter(e -> {
SimpleWorkingSetSelectionDialog dialog = new SimpleWorkingSetSelectionDialog(parent.getShell(),
@@ -401,9 +378,7 @@ public class WorkingSetConfigurationBlock {
private void updateEnableState(boolean enabled) {
workingSetLabel.setEnabled(enabled);
- workingSetCombo
- .setEnabled(enabled
- && (selectedWorkingSets.length > 0 || getHistoryEntries().length > 0));
+ workingSetCombo.setEnabled(enabled && (selectedWorkingSets.length > 0 || getHistoryEntries().length > 0));
selectButton.setEnabled(enabled);
}
@@ -435,8 +410,7 @@ public class WorkingSetConfigurationBlock {
}
private String[] getHistoryEntries() {
- String[] history = selectionHistory
- .toArray(new String[selectionHistory.size()]);
+ String[] history = selectionHistory.toArray(new String[selectionHistory.size()]);
Arrays.sort(history, (o1, o2) -> Collator.getInstance().compare(o1, o2));
return history;
}
@@ -459,27 +433,24 @@ public class WorkingSetConfigurationBlock {
// copied from org.eclipse.jdt.internal.ui.text.JavaCommentScanner
private String[] split(String value, String delimiters) {
- StringTokenizer tokenizer= new StringTokenizer(value, delimiters);
- int size= tokenizer.countTokens();
- String[] tokens= new String[size];
- int i= 0;
+ StringTokenizer tokenizer = new StringTokenizer(value, delimiters);
+ int size = tokenizer.countTokens();
+ String[] tokens = new String[size];
+ int i = 0;
while (i < size) {
- tokens[i++]= tokenizer.nextToken();
+ tokens[i++] = tokenizer.nextToken();
}
return tokens;
}
private void updateSelectedWorkingSets() {
- String item = workingSetCombo.getItem(workingSetCombo
- .getSelectionIndex());
+ String item = workingSetCombo.getItem(workingSetCombo.getSelectionIndex());
String[] workingSetNames = split(item, ", "); //$NON-NLS-1$
- IWorkingSetManager workingSetManager = PlatformUI.getWorkbench()
- .getWorkingSetManager();
+ IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager();
selectedWorkingSets = new IWorkingSet[workingSetNames.length];
for (int i = 0; i < workingSetNames.length; i++) {
- IWorkingSet set = workingSetManager
- .getWorkingSet(workingSetNames[i]);
+ IWorkingSet set = workingSetManager.getWorkingSet(workingSetNames[i]);
Assert.isNotNull(set);
selectedWorkingSets[i] = set;
}
@@ -491,8 +462,7 @@ public class WorkingSetConfigurationBlock {
List<String> subList = selectionHistory.subList(0, MAX_HISTORY_SIZE);
history = subList.toArray(new String[subList.size()]);
} else {
- history = selectionHistory
- .toArray(new String[selectionHistory.size()]);
+ history = selectionHistory.toArray(new String[selectionHistory.size()]);
}
settings.put(WORKINGSET_SELECTION_HISTORY, history);
}
@@ -507,14 +477,12 @@ public class WorkingSetConfigurationBlock {
Set<String> workingSetIdsSet = new HashSet<>(Arrays.asList(workingSetIds));
- IWorkingSetManager workingSetManager = PlatformUI.getWorkbench()
- .getWorkingSetManager();
+ IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager();
for (String string : strings) {
String[] workingSetNames = split(string, ", "); //$NON-NLS-1$
boolean valid = true;
for (int j = 0; j < workingSetNames.length && valid; j++) {
- IWorkingSet workingSet = workingSetManager
- .getWorkingSet(workingSetNames[j]);
+ IWorkingSet workingSet = workingSetManager.getWorkingSet(workingSetNames[j]);
if (workingSet == null) {
valid = false;
} else if (!workingSetIdsSet.contains(workingSet.getId())) {
@@ -540,11 +508,11 @@ public class WorkingSetConfigurationBlock {
FontMetrics fontMetrics = gc.getFontMetrics();
gc.dispose();
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- int widthHint = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.BUTTON_WIDTH);
- Point minSize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
- data.widthHint = Math.max(widthHint, minSize.x);
- button.setLayoutData(data);
- return data;
- }
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ int widthHint = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.BUTTON_WIDTH);
+ Point minSize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
+ data.widthHint = Math.max(widthHint, minSize.x);
+ button.setLayoutData(data);
+ return data;
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WorkingSetGroup.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WorkingSetGroup.java
index d6c150783e6..a307a212f0b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WorkingSetGroup.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WorkingSetGroup.java
@@ -37,29 +37,22 @@ public final class WorkingSetGroup {
/**
* Create a new instance of this class.
*
- * @param composite
- * parent composite
- * @param currentSelection
- * the initial working set selection to pass to the
- * {@link WorkingSetConfigurationBlock}
- * @param workingSetTypes
- * the types of working sets that can be selected by the
- * {@link WorkingSetConfigurationBlock}
+ * @param composite parent composite
+ * @param currentSelection the initial working set selection to pass to the
+ * {@link WorkingSetConfigurationBlock}
+ * @param workingSetTypes the types of working sets that can be selected by the
+ * {@link WorkingSetConfigurationBlock}
*/
- public WorkingSetGroup(Composite composite,
- IStructuredSelection currentSelection, String[] workingSetTypes) {
+ public WorkingSetGroup(Composite composite, IStructuredSelection currentSelection, String[] workingSetTypes) {
Group workingSetGroup = new Group(composite, SWT.NONE);
workingSetGroup.setFont(composite.getFont());
- workingSetGroup
- .setText(WorkbenchMessages.WorkingSetGroup_WorkingSets_group);
- workingSetGroup.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true,
- false));
+ workingSetGroup.setText(WorkbenchMessages.WorkingSetGroup_WorkingSets_group);
+ workingSetGroup.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
workingSetGroup.setLayout(new GridLayout(1, false));
workingSetBlock = new WorkingSetConfigurationBlock(WorkbenchPlugin.getDefault().getDialogSettings(),
workingSetTypes);
- workingSetBlock.setWorkingSets(workingSetBlock
- .findApplicableWorkingSets(currentSelection));
+ workingSetBlock.setWorkingSets(workingSetBlock.findApplicableWorkingSets(currentSelection));
workingSetBlock.createContent(workingSetGroup);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/YesNoCancelListSelectionDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/YesNoCancelListSelectionDialog.java
index 26e4e35a5b5..9d50a5c4404 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/YesNoCancelListSelectionDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/YesNoCancelListSelectionDialog.java
@@ -29,81 +29,75 @@ import org.eclipse.ui.internal.IWorkbenchHelpContextIds;
*/
@Deprecated
public class YesNoCancelListSelectionDialog extends ListSelectionDialog {
- /**
- *
- * Create a list selection dialog with a possible Yes/No or Cancel result.
- *
- * @param parentShell
- * @param input
- * @param contentProvider
- * @param labelProvider
- * @param message
- * @deprecated see class comment
- */
- @Deprecated
- public YesNoCancelListSelectionDialog(
- org.eclipse.swt.widgets.Shell parentShell,
- Object input,
- org.eclipse.jface.viewers.IStructuredContentProvider contentProvider,
- org.eclipse.jface.viewers.ILabelProvider labelProvider,
- String message) {
- super(parentShell, input, contentProvider, labelProvider, message);
- }
+ /**
+ *
+ * Create a list selection dialog with a possible Yes/No or Cancel result.
+ *
+ * @param parentShell
+ * @param input
+ * @param contentProvider
+ * @param labelProvider
+ * @param message
+ * @deprecated see class comment
+ */
+ @Deprecated
+ public YesNoCancelListSelectionDialog(org.eclipse.swt.widgets.Shell parentShell, Object input,
+ org.eclipse.jface.viewers.IStructuredContentProvider contentProvider,
+ org.eclipse.jface.viewers.ILabelProvider labelProvider, String message) {
+ super(parentShell, input, contentProvider, labelProvider, message);
+ }
- @Override
+ @Override
protected void buttonPressed(int buttonId) {
- switch (buttonId) {
- case IDialogConstants.YES_ID: {
- yesPressed();
- return;
- }
- case IDialogConstants.NO_ID: {
- noPressed();
- return;
- }
- case IDialogConstants.CANCEL_ID: {
- cancelPressed();
- return;
- }
- }
- }
+ switch (buttonId) {
+ case IDialogConstants.YES_ID: {
+ yesPressed();
+ return;
+ }
+ case IDialogConstants.NO_ID: {
+ noPressed();
+ return;
+ }
+ case IDialogConstants.CANCEL_ID: {
+ cancelPressed();
+ return;
+ }
+ }
+ }
- @Override
+ @Override
protected void configureShell(Shell shell) {
- super.configureShell(shell);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(shell,
- IWorkbenchHelpContextIds.YES_NO_CANCEL_LIST_SELECTION_DIALOG);
- }
+ super.configureShell(shell);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(shell,
+ IWorkbenchHelpContextIds.YES_NO_CANCEL_LIST_SELECTION_DIALOG);
+ }
- @Override
+ @Override
protected void createButtonsForButtonBar(Composite parent) {
- createButton(parent, IDialogConstants.YES_ID,
- IDialogConstants.YES_LABEL, true);
- createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL,
- false);
- createButton(parent, IDialogConstants.CANCEL_ID,
- IDialogConstants.CANCEL_LABEL, false);
- }
+ createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, true);
+ createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, false);
+ createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
+ }
- /**
- * Notifies that the no button of this dialog has been pressed.
- * <p>
- * The <code>Dialog</code> implementation of this framework method sets
- * this dialog's return code to <code>IDialogConstants.NO_ID</code> and
- * closes the dialog. Subclasses may override if desired.
- * </p>
- */
- protected void noPressed() {
- setReturnCode(IDialogConstants.NO_ID);
- close();
- }
+ /**
+ * Notifies that the no button of this dialog has been pressed.
+ * <p>
+ * The <code>Dialog</code> implementation of this framework method sets this
+ * dialog's return code to <code>IDialogConstants.NO_ID</code> and closes the
+ * dialog. Subclasses may override if desired.
+ * </p>
+ */
+ protected void noPressed() {
+ setReturnCode(IDialogConstants.NO_ID);
+ close();
+ }
- /**
- * Notifies that the yes button of this dialog has been pressed. Do the same
- * as an OK but set the return code to YES_ID instead.
- */
- protected void yesPressed() {
- okPressed();
- setReturnCode(IDialogConstants.YES_ID);
- }
+ /**
+ * Notifies that the yes button of this dialog has been pressed. Do the same as
+ * an OK but set the return code to YES_ID instead.
+ */
+ protected void yesPressed() {
+ okPressed();
+ setReturnCode(IDialogConstants.YES_ID);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dnd/IDragAndDropService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dnd/IDragAndDropService.java
index b45fcffe428..97f9a80fb30 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dnd/IDragAndDropService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dnd/IDragAndDropService.java
@@ -38,34 +38,30 @@ import org.eclipse.swt.widgets.Control;
public interface IDragAndDropService {
/**
* Causes a drop target to be added to the given control that respects the
- * existing site's drop behaviour in addition to the behaviour being
- * specified for the given control.
+ * existing site's drop behaviour in addition to the behaviour being specified
+ * for the given control.
* <p>
* If a transfer type specified for the control matches one used by the site
- * then the control's listener is called (the client is overriding the
- * existing site behaviour which will no longer work).
+ * then the control's listener is called (the client is overriding the existing
+ * site behaviour which will no longer work).
* </p>
* <p>
* NOTE: Site authors <b>must</b> use this method to add drop behaviour;
- * directly adding drop targets using SWT onto a site will cause the
- * standard site behaviour (i.e. dragging files / markers into the
- * EditorSite...) to not work when that editor is active.
+ * directly adding drop targets using SWT onto a site will cause the standard
+ * site behaviour (i.e. dragging files / markers into the EditorSite...) to not
+ * work when that editor is active.
* </p>
* <p>
- * Note that this method may be used more than once should the part author
- * wish to register different drop targets for internal controls (i.e. to
- * support internal DnD).
+ * Note that this method may be used more than once should the part author wish
+ * to register different drop targets for internal controls (i.e. to support
+ * internal DnD).
* </p>
* <p>
*
- * @param control
- * The control to add the drop behaviour to
- * @param ops
- * The Drop operations used by this target
- * @param transfers
- * The TransferTypes used by this target
- * @param listener
- * The listener controlling the target's behaviour
+ * @param control The control to add the drop behaviour to
+ * @param ops The Drop operations used by this target
+ * @param transfers The TransferTypes used by this target
+ * @param listener The listener controlling the target's behaviour
*/
void addMergedDropTarget(Control control, int ops, Transfer[] transfers, DropTargetListener listener);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/fieldassist/ContentAssistCommandAdapter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/fieldassist/ContentAssistCommandAdapter.java
index ca36341b579..9b49b8f8ce0 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/fieldassist/ContentAssistCommandAdapter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/fieldassist/ContentAssistCommandAdapter.java
@@ -38,11 +38,12 @@ import org.eclipse.ui.keys.IBindingService;
/**
* ContentAssistCommandAdapter extends {@link ContentProposalAdapter} to invoke
- * content proposals using a specified {@link org.eclipse.core.commands.Command}.
- * The ability to specify a {@link org.eclipse.jface.bindings.keys.KeyStroke}
- * that explicitly invokes content proposals is hidden by this class, and
- * instead the String id of a command is used. If no command id is specified by
- * the client, then the default workbench content assist command is used.
+ * content proposals using a specified
+ * {@link org.eclipse.core.commands.Command}. The ability to specify a
+ * {@link org.eclipse.jface.bindings.keys.KeyStroke} that explicitly invokes
+ * content proposals is hidden by this class, and instead the String id of a
+ * command is used. If no command id is specified by the client, then the
+ * default workbench content assist command is used.
* <p>
* As of 3.3, ContentAssistCommandAdapter can be optionally configured to
* install the content assist decoration on its control.
@@ -60,10 +61,11 @@ public class ContentAssistCommandAdapter extends ContentProposalAdapter {
* The command id used for content assist. (value
* <code>"org.eclipse.ui.edit.text.contentAssist.proposals"</code>)
*
- * @deprecated As of 3.5, replaced by {@link IWorkbenchCommandConstants#EDIT_CONTENT_ASSIST}
+ * @deprecated As of 3.5, replaced by
+ * {@link IWorkbenchCommandConstants#EDIT_CONTENT_ASSIST}
*/
@Deprecated
- public static final String CONTENT_PROPOSAL_COMMAND= IWorkbenchCommandConstants.EDIT_CONTENT_ASSIST;
+ public static final String CONTENT_PROPOSAL_COMMAND = IWorkbenchCommandConstants.EDIT_CONTENT_ASSIST;
// Default autoactivation delay in milliseconds
// TODO: This should eventually be controlled by
@@ -85,82 +87,78 @@ public class ContentAssistCommandAdapter extends ContentProposalAdapter {
private ControlDecoration decoration;
/**
- * Construct a content proposal adapter that can assist the user with
- * choosing content for the field. No visual indicator of content assist is
- * shown.
+ * Construct a content proposal adapter that can assist the user with choosing
+ * content for the field. No visual indicator of content assist is shown.
*
- * @param control
- * the control for which the adapter is providing content assist.
- * May not be <code>null</code>.
- * @param controlContentAdapter
- * the <code>IControlContentAdapter</code> used to obtain and
- * update the control's contents as proposals are accepted. May
- * not be <code>null</code>.
- * @param proposalProvider
- * the <code>IContentProposalProvider</code> used to obtain
- * content proposals for this control, or <code>null</code> if
- * no content proposal is available.
- * @param commandId
- * the String id of the command that will invoke the content
- * assistant. If not supplied, the default value will be
- * "org.eclipse.ui.edit.text.contentAssist.proposals".
- * @param autoActivationCharacters
- * An array of characters that trigger auto-activation of content
- * proposal. If specified, these characters will trigger
- * auto-activation of the proposal popup, regardless of the
- * specified command id.
+ * @param control the control for which the adapter is
+ * providing content assist. May not be
+ * <code>null</code>.
+ * @param controlContentAdapter the <code>IControlContentAdapter</code> used
+ * to obtain and update the control's contents
+ * as proposals are accepted. May not be
+ * <code>null</code>.
+ * @param proposalProvider the <code>IContentProposalProvider</code>
+ * used to obtain content proposals for this
+ * control, or <code>null</code> if no content
+ * proposal is available.
+ * @param commandId the String id of the command that will invoke
+ * the content assistant. If not supplied, the
+ * default value will be
+ * "org.eclipse.ui.edit.text.contentAssist.proposals".
+ * @param autoActivationCharacters An array of characters that trigger
+ * auto-activation of content proposal. If
+ * specified, these characters will trigger
+ * auto-activation of the proposal popup,
+ * regardless of the specified command id.
*/
- public ContentAssistCommandAdapter(Control control,
- IControlContentAdapter controlContentAdapter,
- IContentProposalProvider proposalProvider, String commandId,
- char[] autoActivationCharacters) {
- this(control, controlContentAdapter, proposalProvider, commandId,
- autoActivationCharacters, false);
+ public ContentAssistCommandAdapter(Control control, IControlContentAdapter controlContentAdapter,
+ IContentProposalProvider proposalProvider, String commandId, char[] autoActivationCharacters) {
+ this(control, controlContentAdapter, proposalProvider, commandId, autoActivationCharacters, false);
}
/**
- * Construct a content proposal adapter that can assist the user with
- * choosing content for the field.
+ * Construct a content proposal adapter that can assist the user with choosing
+ * content for the field.
*
- * @param control
- * the control for which the adapter is providing content assist.
- * May not be <code>null</code>.
- * @param controlContentAdapter
- * the <code>IControlContentAdapter</code> used to obtain and
- * update the control's contents as proposals are accepted. May
- * not be <code>null</code>.
- * @param proposalProvider
- * the <code>IContentProposalProvider</code> used to obtain
- * content proposals for this control, or <code>null</code> if
- * no content proposal is available.
- * @param commandId
- * the String id of the command that will invoke the content
- * assistant. If not supplied, the default value will be
- * "org.eclipse.ui.edit.text.contentAssist.proposals".
- * @param autoActivationCharacters
- * An array of characters that trigger auto-activation of content
- * proposal. If specified, these characters will trigger
- * auto-activation of the proposal popup, regardless of the
- * specified command id.
- * @param installDecoration
- * A boolean that specifies whether a content assist control
- * decoration should be installed. The client is responsible for
- * ensuring that adequate space is reserved for the decoration.
- * Clients that want more fine-grained control of the
- * decoration's location or appearance should use
- * <code>false</code> for this parameter, creating their own
- * {@link ControlDecoration} and managing it directly.
+ * @param control the control for which the adapter is
+ * providing content assist. May not be
+ * <code>null</code>.
+ * @param controlContentAdapter the <code>IControlContentAdapter</code> used
+ * to obtain and update the control's contents
+ * as proposals are accepted. May not be
+ * <code>null</code>.
+ * @param proposalProvider the <code>IContentProposalProvider</code>
+ * used to obtain content proposals for this
+ * control, or <code>null</code> if no content
+ * proposal is available.
+ * @param commandId the String id of the command that will invoke
+ * the content assistant. If not supplied, the
+ * default value will be
+ * "org.eclipse.ui.edit.text.contentAssist.proposals".
+ * @param autoActivationCharacters An array of characters that trigger
+ * auto-activation of content proposal. If
+ * specified, these characters will trigger
+ * auto-activation of the proposal popup,
+ * regardless of the specified command id.
+ * @param installDecoration A boolean that specifies whether a content
+ * assist control decoration should be
+ * installed. The client is responsible for
+ * ensuring that adequate space is reserved for
+ * the decoration. Clients that want more
+ * fine-grained control of the decoration's
+ * location or appearance should use
+ * <code>false</code> for this parameter,
+ * creating their own {@link ControlDecoration}
+ * and managing it directly.
* @since 3.3
*/
- public ContentAssistCommandAdapter(Control control,
- IControlContentAdapter controlContentAdapter,
- IContentProposalProvider proposalProvider, String commandId,
- char[] autoActivationCharacters, boolean installDecoration) {
- super(control, controlContentAdapter, proposalProvider, null,
- autoActivationCharacters);
+ public ContentAssistCommandAdapter(Control control, IControlContentAdapter controlContentAdapter,
+ IContentProposalProvider proposalProvider, String commandId, char[] autoActivationCharacters,
+ boolean installDecoration) {
+ super(control, controlContentAdapter, proposalProvider, null, autoActivationCharacters);
this.commandId = commandId;
if (commandId == null) {
- this.commandId= IWorkbenchCommandConstants.EDIT_CONTENT_ASSIST;
+ this.commandId = IWorkbenchCommandConstants.EDIT_CONTENT_ASSIST;
}
// If no autoactivation characters were specified, set them to the empty
@@ -173,8 +171,7 @@ public class ContentAssistCommandAdapter extends ContentProposalAdapter {
setAutoActivationDelay(DEFAULT_AUTO_ACTIVATION_DELAY);
// Cache the handler service so we don't have to retrieve it each time
- this.handlerService = PlatformUI.getWorkbench()
- .getService(IHandlerService.class);
+ this.handlerService = PlatformUI.getWorkbench().getService(IHandlerService.class);
// Add listeners to the control to manage activation of the handler
addListeners(control);
@@ -196,8 +193,8 @@ public class ContentAssistCommandAdapter extends ContentProposalAdapter {
}
/*
- * Add the listeners needed in order to activate the content assist command
- * on the control.
+ * Add the listeners needed in order to activate the content assist command on
+ * the control.
*/
private void addListeners(Control control) {
control.addFocusListener(new FocusListener() {
@@ -219,8 +216,7 @@ public class ContentAssistCommandAdapter extends ContentProposalAdapter {
}
/**
- * Return the string command ID of the command used to invoke content
- * assist.
+ * Return the string command ID of the command used to invoke content assist.
*
* @return the command ID of the command that invokes content assist.
*/
@@ -230,8 +226,8 @@ public class ContentAssistCommandAdapter extends ContentProposalAdapter {
/*
* Return the field decoration that should be used to indicate that content
- * assist is available for a field. Ensure that the decoration text includes
- * the correct key binding.
+ * assist is available for a field. Ensure that the decoration text includes the
+ * correct key binding.
*
* @return the {@link FieldDecoration} that should be used to show content
* assist.
@@ -246,23 +242,16 @@ public class ContentAssistCommandAdapter extends ContentProposalAdapter {
// If there is not one, base ours on the standard JFace one.
if (dec == null) {
- FieldDecoration originalDec = registry
- .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);
+ FieldDecoration originalDec = registry.getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);
- registry.registerFieldDecoration(decId, null, originalDec
- .getImage());
+ registry.registerFieldDecoration(decId, null, originalDec.getImage());
dec = registry.getFieldDecoration(decId);
}
// Always update the decoration text since the key binding may
// have changed since it was last retrieved.
- IBindingService bindingService = PlatformUI
- .getWorkbench().getService(IBindingService.class);
- dec
- .setDescription(NLS
- .bind(
- WorkbenchMessages.ContentAssist_Cue_Description_Key,
- bindingService
- .getBestActiveBindingFormattedFor(getCommandId())));
+ IBindingService bindingService = PlatformUI.getWorkbench().getService(IBindingService.class);
+ dec.setDescription(NLS.bind(WorkbenchMessages.ContentAssist_Cue_Description_Key,
+ bindingService.getBestActiveBindingFormattedFor(getCommandId())));
// Now return the field decoration
return dec;
@@ -289,8 +278,7 @@ public class ContentAssistCommandAdapter extends ContentProposalAdapter {
private void activateHandler() {
if (activeHandler == null) {
- activeHandler = handlerService.activateHandler(commandId,
- proposalHandler);
+ activeHandler = handlerService.activateHandler(commandId, proposalHandler);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/fieldassist/ContentAssistField.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/fieldassist/ContentAssistField.java
index 90a092e3669..4ec0897abc1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/fieldassist/ContentAssistField.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/fieldassist/ContentAssistField.java
@@ -52,40 +52,35 @@ public class ContentAssistField extends DecoratedField {
* Construct a content assist field that shows a content assist cue and can
* assist the user with choosing content for the field.
*
- * @param parent
- * the parent of the decorated field.
- * @param style
- * the desired style bits for the field.
- * @param controlCreator
- * the IControlCreator used to specify the specific kind of
- * control that is to be decorated.
- * @param controlContentAdapter
- * the <code>IControlContentAdapter</code> used to obtain and
- * update the control's contents as proposals are accepted. May
- * not be <code>null</code>.
- * @param proposalProvider
- * the <code>IContentProposalProvider</code> used to obtain
- * content proposals for this control, or <code>null</code> if
- * no content proposal is available.
- * @param commandId
- * the String id of the command that will invoke the content
- * assistant. If not supplied, the default value will be
- * "org.eclipse.ui.edit.text.contentAssist.proposals".
- * @param autoActivationCharacters
- * An array of characters that trigger auto-activation of content
- * proposal. If specified, these characters will trigger
- * auto-activation of the proposal popup, regardless of the
- * specified command id.
+ * @param parent the parent of the decorated field.
+ * @param style the desired style bits for the field.
+ * @param controlCreator the IControlCreator used to specify the
+ * specific kind of control that is to be
+ * decorated.
+ * @param controlContentAdapter the <code>IControlContentAdapter</code> used
+ * to obtain and update the control's contents
+ * as proposals are accepted. May not be
+ * <code>null</code>.
+ * @param proposalProvider the <code>IContentProposalProvider</code>
+ * used to obtain content proposals for this
+ * control, or <code>null</code> if no content
+ * proposal is available.
+ * @param commandId the String id of the command that will invoke
+ * the content assistant. If not supplied, the
+ * default value will be
+ * "org.eclipse.ui.edit.text.contentAssist.proposals".
+ * @param autoActivationCharacters An array of characters that trigger
+ * auto-activation of content proposal. If
+ * specified, these characters will trigger
+ * auto-activation of the proposal popup,
+ * regardless of the specified command id.
*/
- public ContentAssistField(Composite parent, int style,
- IControlCreator controlCreator,
- IControlContentAdapter controlContentAdapter,
- IContentProposalProvider proposalProvider, String commandId,
+ public ContentAssistField(Composite parent, int style, IControlCreator controlCreator,
+ IControlContentAdapter controlContentAdapter, IContentProposalProvider proposalProvider, String commandId,
char[] autoActivationCharacters) {
super(parent, style, controlCreator);
- adapter = new ContentAssistCommandAdapter(getControl(),
- controlContentAdapter, proposalProvider, commandId,
+ adapter = new ContentAssistCommandAdapter(getControl(), controlContentAdapter, proposalProvider, commandId,
autoActivationCharacters);
addFieldDecoration(getFieldDecoration(), SWT.LEFT | SWT.TOP, true);
@@ -93,13 +88,11 @@ public class ContentAssistField extends DecoratedField {
}
/**
- * Set the boolean flag that determines whether the content assist is
- * enabled.
+ * Set the boolean flag that determines whether the content assist is enabled.
*
- * @param enabled
- * <code>true</code> if content assist is enabled and
- * responding to user input, <code>false</code> if it is
- * ignoring user input.
+ * @param enabled <code>true</code> if content assist is enabled and responding
+ * to user input, <code>false</code> if it is ignoring user
+ * input.
*
*/
public void setEnabled(boolean enabled) {
@@ -124,21 +117,16 @@ public class ContentAssistField extends DecoratedField {
// If there is not one, base ours on the standard JFace one.
if (dec == null) {
- FieldDecoration originalDec = registry
- .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);
+ FieldDecoration originalDec = registry.getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);
- registry.registerFieldDecoration(decId, null, originalDec
- .getImage());
+ registry.registerFieldDecoration(decId, null, originalDec.getImage());
dec = registry.getFieldDecoration(decId);
}
// Always update the decoration text since the key binding may
// have changed since it was last retrieved.
- IBindingService bindingService = PlatformUI
- .getWorkbench().getService(IBindingService.class);
- dec.setDescription(NLS.bind(
- WorkbenchMessages.ContentAssist_Cue_Description_Key,
- bindingService.getBestActiveBindingFormattedFor(adapter
- .getCommandId())));
+ IBindingService bindingService = PlatformUI.getWorkbench().getService(IBindingService.class);
+ dec.setDescription(NLS.bind(WorkbenchMessages.ContentAssist_Cue_Description_Key,
+ bindingService.getBestActiveBindingFormattedFor(adapter.getCommandId())));
// Now return the field decoration
return dec;
@@ -146,8 +134,8 @@ public class ContentAssistField extends DecoratedField {
/**
* Return the ContentAssistCommandAdapter installed on the receiver. This
- * adapter is provided so that clients can configure the adapter if the
- * default values are not appropriate.
+ * adapter is provided so that clients can configure the adapter if the default
+ * values are not appropriate.
*
* @return the ContentAssistCommandAdapter installed on the field.
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/CollapseAllHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/CollapseAllHandler.java
index b4b9f7a619a..a0ada51f08a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/CollapseAllHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/CollapseAllHandler.java
@@ -54,8 +54,7 @@ public class CollapseAllHandler extends AbstractHandler {
/**
* Create the handler for this tree viewer.
*
- * @param viewer
- * The viewer to collapse. Must not be <code>null</code>.
+ * @param viewer The viewer to collapse. Must not be <code>null</code>.
*/
public CollapseAllHandler(AbstractTreeViewer viewer) {
Assert.isNotNull(viewer);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/ExpandAllHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/ExpandAllHandler.java
index 96c2afdbb02..bde6d0c4da0 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/ExpandAllHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/ExpandAllHandler.java
@@ -15,6 +15,7 @@
******************************************************************************/
package org.eclipse.ui.handlers;
+
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.runtime.Assert;
@@ -55,8 +56,7 @@ public class ExpandAllHandler extends AbstractHandler {
/**
* Create the handler for this tree viewer.
*
- * @param viewer
- * The viewer to expand. Must not be <code>null</code>.
+ * @param viewer The viewer to expand. Must not be <code>null</code>.
*/
public ExpandAllHandler(AbstractTreeViewer viewer) {
Assert.isNotNull(viewer);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/HandlerUtil.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/HandlerUtil.java
index 2d728f01e41..9ac3d5d1518 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/HandlerUtil.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/HandlerUtil.java
@@ -43,31 +43,26 @@ import org.eclipse.ui.IWorkbenchWindow;
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public class HandlerUtil {
- private static void noVariableFound(ExecutionEvent event, String name)
- throws ExecutionException {
+ private static void noVariableFound(ExecutionEvent event, String name) throws ExecutionException {
throw new ExecutionException("No " + name //$NON-NLS-1$
+ " found while executing " + event.getCommand().getId()); //$NON-NLS-1$
}
- private static void incorrectTypeFound(ExecutionEvent event, String name,
- Class expectedType, Class wrongType) throws ExecutionException {
+ private static void incorrectTypeFound(ExecutionEvent event, String name, Class expectedType, Class wrongType)
+ throws ExecutionException {
throw new ExecutionException("Incorrect type for " //$NON-NLS-1$
- + name
- + " found while executing " //$NON-NLS-1$
- + event.getCommand().getId()
- + ", expected " + expectedType.getName() //$NON-NLS-1$
+ + name + " found while executing " //$NON-NLS-1$
+ + event.getCommand().getId() + ", expected " + expectedType.getName() //$NON-NLS-1$
+ " found " + wrongType.getName()); //$NON-NLS-1$
}
/**
* Extract the variable.
*
- * @param event
- * The execution event that contains the application context
- * @param name
- * The variable name to extract.
- * @return The object from the application context, or <code>null</code>
- * if it could not be found.
+ * @param event The execution event that contains the application context
+ * @param name The variable name to extract.
+ * @return The object from the application context, or <code>null</code> if it
+ * could not be found.
*/
public static Object getVariable(ExecutionEvent event, String name) {
if (event.getApplicationContext() instanceof IEvaluationContext) {
@@ -80,17 +75,13 @@ public class HandlerUtil {
/**
* Extract the variable.
*
- * @param event
- * The execution event that contains the application context
- * @param name
- * The variable name to extract.
+ * @param event The execution event that contains the application context
+ * @param name The variable name to extract.
* @return The object from the application context. Will not return
* <code>null</code>.
- * @throws ExecutionException
- * if the variable is not found.
+ * @throws ExecutionException if the variable is not found.
*/
- public static Object getVariableChecked(ExecutionEvent event, String name)
- throws ExecutionException {
+ public static Object getVariableChecked(ExecutionEvent event, String name) throws ExecutionException {
Object o = getVariable(event, name);
if (o == null) {
noVariableFound(event, name);
@@ -101,12 +92,10 @@ public class HandlerUtil {
/**
* Extract the variable.
*
- * @param context
- * The IEvaluationContext or <code>null</code>
- * @param name
- * The variable name to extract.
- * @return The object from the application context, or <code>null</code>
- * if it could not be found.
+ * @param context The IEvaluationContext or <code>null</code>
+ * @param name The variable name to extract.
+ * @return The object from the application context, or <code>null</code> if it
+ * could not be found.
* @since 3.4
*/
public static Object getVariable(Object context, String name) {
@@ -120,8 +109,7 @@ public class HandlerUtil {
/**
* Return the active contexts.
*
- * @param event
- * The execution event that contains the application context
+ * @param event The execution event that contains the application context
* @return a collection of String contextIds, or <code>null</code>.
*/
public static Collection getActiveContexts(ExecutionEvent event) {
@@ -135,19 +123,14 @@ public class HandlerUtil {
/**
* Return the active contexts.
*
- * @param event
- * The execution event that contains the application context
- * @return a collection of String contextIds. Will not return
- * <code>null</code>.
- * @throws ExecutionException
- * If the context variable is not found.
+ * @param event The execution event that contains the application context
+ * @return a collection of String contextIds. Will not return <code>null</code>.
+ * @throws ExecutionException If the context variable is not found.
*/
- public static Collection getActiveContextsChecked(ExecutionEvent event)
- throws ExecutionException {
+ public static Collection getActiveContextsChecked(ExecutionEvent event) throws ExecutionException {
Object o = getVariableChecked(event, ISources.ACTIVE_CONTEXT_NAME);
if (!(o instanceof Collection)) {
- incorrectTypeFound(event, ISources.ACTIVE_CONTEXT_NAME,
- Collection.class, o.getClass());
+ incorrectTypeFound(event, ISources.ACTIVE_CONTEXT_NAME, Collection.class, o.getClass());
}
return (Collection) o;
}
@@ -156,8 +139,7 @@ public class HandlerUtil {
* Return the active shell. Is not necessarily the active workbench window
* shell.
*
- * @param event
- * The execution event that contains the application context
+ * @param event The execution event that contains the application context
* @return the active shell, or <code>null</code>.
*/
public static Shell getActiveShell(ExecutionEvent event) {
@@ -172,14 +154,11 @@ public class HandlerUtil {
* Return the active shell. Is not necessarily the active workbench window
* shell.
*
- * @param event
- * The execution event that contains the application context
+ * @param event The execution event that contains the application context
* @return the active shell. Will not return <code>null</code>.
- * @throws ExecutionException
- * If the active shell variable is not found.
+ * @throws ExecutionException If the active shell variable is not found.
*/
- public static Shell getActiveShellChecked(ExecutionEvent event)
- throws ExecutionException {
+ public static Shell getActiveShellChecked(ExecutionEvent event) throws ExecutionException {
Object o = getVariableChecked(event, ISources.ACTIVE_SHELL_NAME);
if (!(o instanceof Shell)) {
incorrectTypeFound(event, ISources.ACTIVE_SHELL_NAME, Shell.class, o.getClass());
@@ -190,8 +169,7 @@ public class HandlerUtil {
/**
* Return the active workbench window.
*
- * @param event
- * The execution event that contains the application context
+ * @param event The execution event that contains the application context
* @return the active workbench window, or <code>null</code>.
*/
public static IWorkbenchWindow getActiveWorkbenchWindow(ExecutionEvent event) {
@@ -205,14 +183,12 @@ public class HandlerUtil {
/**
* Return the active workbench window.
*
- * @param event
- * The execution event that contains the application context
+ * @param event The execution event that contains the application context
* @return the active workbench window. Will not return <code>null</code>.
- * @throws ExecutionException
- * If the active workbench window variable is not found.
+ * @throws ExecutionException If the active workbench window variable is not
+ * found.
*/
- public static IWorkbenchWindow getActiveWorkbenchWindowChecked(
- ExecutionEvent event) throws ExecutionException {
+ public static IWorkbenchWindow getActiveWorkbenchWindowChecked(ExecutionEvent event) throws ExecutionException {
Object o = getVariableChecked(event, ISources.ACTIVE_WORKBENCH_WINDOW_NAME);
if (!(o instanceof IWorkbenchWindow)) {
incorrectTypeFound(event, ISources.ACTIVE_WORKBENCH_WINDOW_NAME, IWorkbenchWindow.class, o.getClass());
@@ -223,8 +199,7 @@ public class HandlerUtil {
/**
* Return the active editor.
*
- * @param event
- * The execution event that contains the application context
+ * @param event The execution event that contains the application context
* @return the active editor, or <code>null</code>.
*/
public static IEditorPart getActiveEditor(ExecutionEvent event) {
@@ -238,14 +213,11 @@ public class HandlerUtil {
/**
* Return the active editor.
*
- * @param event
- * The execution event that contains the application context
+ * @param event The execution event that contains the application context
* @return the active editor. Will not return <code>null</code>.
- * @throws ExecutionException
- * If the active editor variable is not found.
+ * @throws ExecutionException If the active editor variable is not found.
*/
- public static IEditorPart getActiveEditorChecked(ExecutionEvent event)
- throws ExecutionException {
+ public static IEditorPart getActiveEditorChecked(ExecutionEvent event) throws ExecutionException {
Object o = getVariableChecked(event, ISources.ACTIVE_EDITOR_NAME);
if (!(o instanceof IEditorPart)) {
incorrectTypeFound(event, ISources.ACTIVE_EDITOR_NAME, IEditorPart.class, o.getClass());
@@ -256,8 +228,7 @@ public class HandlerUtil {
/**
* Return the part id of the active editor.
*
- * @param event
- * The execution event that contains the application context
+ * @param event The execution event that contains the application context
* @return the part id of the active editor, or <code>null</code>.
*/
public static String getActiveEditorId(ExecutionEvent event) {
@@ -271,15 +242,11 @@ public class HandlerUtil {
/**
* Return the part id of the active editor.
*
- * @param event
- * The execution event that contains the application context
- * @return the part id of the active editor. Will not return
- * <code>null</code>.
- * @throws ExecutionException
- * If the active editor id variable is not found.
+ * @param event The execution event that contains the application context
+ * @return the part id of the active editor. Will not return <code>null</code>.
+ * @throws ExecutionException If the active editor id variable is not found.
*/
- public static String getActiveEditorIdChecked(ExecutionEvent event)
- throws ExecutionException {
+ public static String getActiveEditorIdChecked(ExecutionEvent event) throws ExecutionException {
Object o = getVariableChecked(event, ISources.ACTIVE_EDITOR_ID_NAME);
if (!(o instanceof String)) {
incorrectTypeFound(event, ISources.ACTIVE_EDITOR_ID_NAME, String.class, o.getClass());
@@ -290,8 +257,7 @@ public class HandlerUtil {
/**
* Return the input of the active editor.
*
- * @param event
- * The execution event that contains the application context
+ * @param event The execution event that contains the application context
* @return the input of the active editor, or <code>null</code>.
* @since 3.7
*/
@@ -306,16 +272,12 @@ public class HandlerUtil {
/**
* Return the input of the active editor.
*
- * @param event
- * The execution event that contains the application context
- * @return the input of the active editor. Will not return <code>null</code>
- * .
- * @throws ExecutionException
- * If the active editor input variable is not found.
+ * @param event The execution event that contains the application context
+ * @return the input of the active editor. Will not return <code>null</code> .
+ * @throws ExecutionException If the active editor input variable is not found.
* @since 3.7
*/
- public static IEditorInput getActiveEditorInputChecked(ExecutionEvent event)
- throws ExecutionException {
+ public static IEditorInput getActiveEditorInputChecked(ExecutionEvent event) throws ExecutionException {
Object o = getVariableChecked(event, ISources.ACTIVE_EDITOR_INPUT_NAME);
if (!(o instanceof IEditorInput)) {
incorrectTypeFound(event, ISources.ACTIVE_EDITOR_INPUT_NAME, IEditorInput.class, o.getClass());
@@ -326,8 +288,7 @@ public class HandlerUtil {
/**
* Return the active part.
*
- * @param event
- * The execution event that contains the application context
+ * @param event The execution event that contains the application context
* @return the active part, or <code>null</code>.
*/
public static IWorkbenchPart getActivePart(ExecutionEvent event) {
@@ -341,14 +302,11 @@ public class HandlerUtil {
/**
* Return the active part.
*
- * @param event
- * The execution event that contains the application context
+ * @param event The execution event that contains the application context
* @return the active part. Will not return <code>null</code>.
- * @throws ExecutionException
- * If the active part variable is not found.
+ * @throws ExecutionException If the active part variable is not found.
*/
- public static IWorkbenchPart getActivePartChecked(ExecutionEvent event)
- throws ExecutionException {
+ public static IWorkbenchPart getActivePartChecked(ExecutionEvent event) throws ExecutionException {
Object o = getVariableChecked(event, ISources.ACTIVE_PART_NAME);
if (!(o instanceof IWorkbenchPart)) {
incorrectTypeFound(event, ISources.ACTIVE_PART_NAME, IWorkbenchPart.class, o.getClass());
@@ -359,8 +317,7 @@ public class HandlerUtil {
/**
* Return the part id of the active part.
*
- * @param event
- * The execution event that contains the application context
+ * @param event The execution event that contains the application context
* @return the part id of the active part, or <code>null</code>.
*/
public static String getActivePartId(ExecutionEvent event) {
@@ -374,14 +331,11 @@ public class HandlerUtil {
/**
* Return the part id of the active part.
*
- * @param event
- * The execution event that contains the application context
+ * @param event The execution event that contains the application context
* @return the part id of the active part. Will not return <code>null</code>.
- * @throws ExecutionException
- * If the active part id variable is not found.
+ * @throws ExecutionException If the active part id variable is not found.
*/
- public static String getActivePartIdChecked(ExecutionEvent event)
- throws ExecutionException {
+ public static String getActivePartIdChecked(ExecutionEvent event) throws ExecutionException {
Object o = getVariableChecked(event, ISources.ACTIVE_PART_ID_NAME);
if (!(o instanceof String)) {
incorrectTypeFound(event, ISources.ACTIVE_PART_ID_NAME, String.class, o.getClass());
@@ -392,8 +346,7 @@ public class HandlerUtil {
/**
* Return the active part site.
*
- * @param event
- * The execution event that contains the application context
+ * @param event The execution event that contains the application context
* @return the active part site, or <code>null</code>.
*/
public static IWorkbenchSite getActiveSite(ExecutionEvent event) {
@@ -407,14 +360,11 @@ public class HandlerUtil {
/**
* Return the active part site.
*
- * @param event
- * The execution event that contains the application context
+ * @param event The execution event that contains the application context
* @return the active part site. Will not return <code>null</code>.
- * @throws ExecutionException
- * If the active part site variable is not found.
+ * @throws ExecutionException If the active part site variable is not found.
*/
- public static IWorkbenchSite getActiveSiteChecked(ExecutionEvent event)
- throws ExecutionException {
+ public static IWorkbenchSite getActiveSiteChecked(ExecutionEvent event) throws ExecutionException {
Object o = getVariableChecked(event, ISources.ACTIVE_SITE_NAME);
if (!(o instanceof IWorkbenchSite)) {
incorrectTypeFound(event, ISources.ACTIVE_SITE_NAME, IWorkbenchSite.class, o.getClass());
@@ -425,8 +375,7 @@ public class HandlerUtil {
/**
* Return the current selection.
*
- * @param event
- * The execution event that contains the application context
+ * @param event The execution event that contains the application context
* @return the current selection, or <code>null</code>.
*/
public static ISelection getCurrentSelection(ExecutionEvent event) {
@@ -438,11 +387,11 @@ public class HandlerUtil {
}
/**
- * Return the current structured selection, or <code>StructuredSelection.EMPTY</code>
- * if the current selection is not a structured selection or <code>null</code>.
+ * Return the current structured selection, or
+ * <code>StructuredSelection.EMPTY</code> if the current selection is not a
+ * structured selection or <code>null</code>.
*
- * @param event
- * The execution event that contains the application context
+ * @param event The execution event that contains the application context
* @return the current IStructuredSelection, or
* <code>StructuredSelection.EMPTY</code>.
* @since 3.108
@@ -459,16 +408,12 @@ public class HandlerUtil {
/**
* Return the current selection.
*
- * @param event
- * The execution event that contains the application context
+ * @param event The execution event that contains the application context
* @return the current selection. Will not return <code>null</code>.
- * @throws ExecutionException
- * If the current selection variable is not found.
+ * @throws ExecutionException If the current selection variable is not found.
*/
- public static ISelection getCurrentSelectionChecked(ExecutionEvent event)
- throws ExecutionException {
- Object o = getVariableChecked(event,
- ISources.ACTIVE_CURRENT_SELECTION_NAME);
+ public static ISelection getCurrentSelectionChecked(ExecutionEvent event) throws ExecutionException {
+ Object o = getVariableChecked(event, ISources.ACTIVE_CURRENT_SELECTION_NAME);
if (!(o instanceof ISelection)) {
incorrectTypeFound(event, ISources.ACTIVE_CURRENT_SELECTION_NAME, ISelection.class, o.getClass());
}
@@ -479,8 +424,7 @@ public class HandlerUtil {
* Return the menu IDs that were applied to the registered context menu. For
* example, #CompilationUnitEditorContext.
*
- * @param event
- * The execution event that contains the application context
+ * @param event The execution event that contains the application context
* @return the menu IDs, or <code>null</code>.
*/
public static Collection getActiveMenus(ExecutionEvent event) {
@@ -495,14 +439,11 @@ public class HandlerUtil {
* Return the menu IDs that were applied to the registered context menu. For
* example, #CompilationUnitEditorContext.
*
- * @param event
- * The execution event that contains the application context
+ * @param event The execution event that contains the application context
* @return the menu IDs. Will not return <code>null</code>.
- * @throws ExecutionException
- * If the active menus variable is not found.
+ * @throws ExecutionException If the active menus variable is not found.
*/
- public static Collection getActiveMenusChecked(ExecutionEvent event)
- throws ExecutionException {
+ public static Collection getActiveMenusChecked(ExecutionEvent event) throws ExecutionException {
Object o = getVariableChecked(event, ISources.ACTIVE_MENU_NAME);
if (!(o instanceof Collection)) {
incorrectTypeFound(event, ISources.ACTIVE_MENU_NAME, Collection.class, o.getClass());
@@ -514,8 +455,7 @@ public class HandlerUtil {
* Return the active menu selection. The active menu is a registered context
* menu.
*
- * @param event
- * The execution event that contains the application context
+ * @param event The execution event that contains the application context
* @return the active menu selection, or <code>null</code>.
*/
public static ISelection getActiveMenuSelection(ExecutionEvent event) {
@@ -530,16 +470,13 @@ public class HandlerUtil {
* Return the active menu selection. The active menu is a registered context
* menu.
*
- * @param event
- * The execution event that contains the application context
+ * @param event The execution event that contains the application context
* @return the active menu selection. Will not return <code>null</code>.
- * @throws ExecutionException
- * If the active menu selection variable is not found.
+ * @throws ExecutionException If the active menu selection variable is not
+ * found.
*/
- public static ISelection getActiveMenuSelectionChecked(ExecutionEvent event)
- throws ExecutionException {
- Object o = getVariableChecked(event,
- ISources.ACTIVE_MENU_SELECTION_NAME);
+ public static ISelection getActiveMenuSelectionChecked(ExecutionEvent event) throws ExecutionException {
+ Object o = getVariableChecked(event, ISources.ACTIVE_MENU_SELECTION_NAME);
if (!(o instanceof ISelection)) {
incorrectTypeFound(event, ISources.ACTIVE_MENU_SELECTION_NAME, ISelection.class, o.getClass());
}
@@ -550,8 +487,7 @@ public class HandlerUtil {
* Return the active menu editor input, if available. The active menu is a
* registered context menu.
*
- * @param event
- * The execution event that contains the application context
+ * @param event The execution event that contains the application context
* @return the active menu editor, or <code>null</code>.
*/
public static ISelection getActiveMenuEditorInput(ExecutionEvent event) {
@@ -563,20 +499,17 @@ public class HandlerUtil {
}
/**
- * Return the active menu editor input. The active menu is a registered
- * context menu. Some context menus do not include the editor input which
- * will throw an exception.
+ * Return the active menu editor input. The active menu is a registered context
+ * menu. Some context menus do not include the editor input which will throw an
+ * exception.
*
- * @param event
- * The execution event that contains the application context
+ * @param event The execution event that contains the application context
* @return the active menu editor input. Will not return <code>null</code>.
- * @throws ExecutionException
- * If the active menu editor input variable is not found.
+ * @throws ExecutionException If the active menu editor input variable is not
+ * found.
*/
- public static ISelection getActiveMenuEditorInputChecked(
- ExecutionEvent event) throws ExecutionException {
- Object o = getVariableChecked(event,
- ISources.ACTIVE_MENU_EDITOR_INPUT_NAME);
+ public static ISelection getActiveMenuEditorInputChecked(ExecutionEvent event) throws ExecutionException {
+ Object o = getVariableChecked(event, ISources.ACTIVE_MENU_EDITOR_INPUT_NAME);
if (!(o instanceof ISelection)) {
incorrectTypeFound(event, ISources.ACTIVE_MENU_EDITOR_INPUT_NAME, ISelection.class, o.getClass());
}
@@ -586,8 +519,7 @@ public class HandlerUtil {
/**
* Return the ShowInContext selection.
*
- * @param event
- * The execution event that contains the application context
+ * @param event The execution event that contains the application context
* @return the show in selection, or <code>null</code>.
* @since 3.4
*/
@@ -602,19 +534,15 @@ public class HandlerUtil {
/**
* Return the ShowInContext selection. Will not return <code>null</code>.
*
- * @param event
- * The execution event that contains the application context
+ * @param event The execution event that contains the application context
* @return the show in selection, or <code>null</code>.
- * @throws ExecutionException
- * If the show in selection variable is not found.
+ * @throws ExecutionException If the show in selection variable is not found.
* @since 3.4
*/
- public static ISelection getShowInSelectionChecked(ExecutionEvent event)
- throws ExecutionException {
+ public static ISelection getShowInSelectionChecked(ExecutionEvent event) throws ExecutionException {
Object o = getVariableChecked(event, ISources.SHOW_IN_SELECTION);
if (!(o instanceof ISelection)) {
- incorrectTypeFound(event, ISources.SHOW_IN_SELECTION,
- ISelection.class, o.getClass());
+ incorrectTypeFound(event, ISources.SHOW_IN_SELECTION, ISelection.class, o.getClass());
}
return (ISelection) o;
}
@@ -622,8 +550,7 @@ public class HandlerUtil {
/**
* Return the ShowInContext input.
*
- * @param event
- * The execution event that contains the application context
+ * @param event The execution event that contains the application context
* @return the show in input, or <code>null</code>.
* @since 3.4
*/
@@ -635,15 +562,12 @@ public class HandlerUtil {
/**
* Return the ShowInContext input. Will not return <code>null</code>.
*
- * @param event
- * The execution event that contains the application context
+ * @param event The execution event that contains the application context
* @return the show in input, or <code>null</code>.
- * @throws ExecutionException
- * If the show in input variable is not found.
+ * @throws ExecutionException If the show in input variable is not found.
* @since 3.4
*/
- public static Object getShowInInputChecked(ExecutionEvent event)
- throws ExecutionException {
+ public static Object getShowInInputChecked(ExecutionEvent event) throws ExecutionException {
Object var = getVariableChecked(event, ISources.SHOW_IN_INPUT);
return var;
}
@@ -654,16 +578,16 @@ public class HandlerUtil {
* @param command The command whose state needs to be toggled
* @return the original value before toggling
*
- * @throws ExecutionException
- * When the command doesn't contain the toggle state or when the state doesn't contain a boolean value
+ * @throws ExecutionException When the command doesn't contain the toggle state
+ * or when the state doesn't contain a boolean value
*
* @since 3.5
*/
public static boolean toggleCommandState(Command command) throws ExecutionException {
State state = command.getState(RegistryToggleState.STATE_ID);
- if(state == null)
+ if (state == null)
throw new ExecutionException("The command does not have a toggle state"); //$NON-NLS-1$
- if(!(state.getValue() instanceof Boolean))
+ if (!(state.getValue() instanceof Boolean))
throw new ExecutionException("The command's toggle state doesn't contain a boolean value"); //$NON-NLS-1$
boolean oldValue = ((Boolean) state.getValue()).booleanValue();
@@ -675,23 +599,19 @@ public class HandlerUtil {
* Checks whether the radio state of the command is same as the radio state
* parameter's value
*
- * @param event
- * The execution event that contains the application context
+ * @param event The execution event that contains the application context
* @return <code>true</code> whe the values are same, <code>false</code>
* otherwise
*
- * @throws ExecutionException
- * When the command doesn't have the radio state or the event
- * doesn't have the radio state parameter
+ * @throws ExecutionException When the command doesn't have the radio state or
+ * the event doesn't have the radio state parameter
* @since 3.5
*/
- public static boolean matchesRadioState(ExecutionEvent event)
- throws ExecutionException {
+ public static boolean matchesRadioState(ExecutionEvent event) throws ExecutionException {
String parameter = event.getParameter(RadioState.PARAMETER_ID);
if (parameter == null)
- throw new ExecutionException(
- "The event does not have the radio state parameter"); //$NON-NLS-1$
+ throw new ExecutionException("The event does not have the radio state parameter"); //$NON-NLS-1$
Command command = event.getCommand();
State state = command.getState(RadioState.STATE_ID);
@@ -706,17 +626,13 @@ public class HandlerUtil {
/**
* Updates the radio state of the command to the given value
*
- * @param command
- * the command whose state should be updated
- * @param newState
- * the new state
+ * @param command the command whose state should be updated
+ * @param newState the new state
*
- * @throws ExecutionException
- * When the command doesn't have a radio state
+ * @throws ExecutionException When the command doesn't have a radio state
* @since 3.5
*/
- public static void updateRadioState(Command command, String newState)
- throws ExecutionException {
+ public static void updateRadioState(Command command, String newState) throws ExecutionException {
State state = command.getState(RadioState.STATE_ID);
if (state == null)
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/IHandlerActivation.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/IHandlerActivation.java
index 144f7180237..9d8f4fdafff 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/IHandlerActivation.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/IHandlerActivation.java
@@ -43,14 +43,15 @@ public interface IHandlerActivation extends IEvaluationResultCache, Comparable {
int ROOT_DEPTH = 1;
/**
- * Clears the cached computation of the <code>isActive</code> method, if
- * any. This method is only intended for internal use. It provides a
- * mechanism by which <code>ISourceProvider</code> events can invalidate
- * state on a <code>IHandlerActivation</code> instance.
+ * Clears the cached computation of the <code>isActive</code> method, if any.
+ * This method is only intended for internal use. It provides a mechanism by
+ * which <code>ISourceProvider</code> events can invalidate state on a
+ * <code>IHandlerActivation</code> instance.
*
* @deprecated Use {@link IEvaluationResultCache#clearResult()} instead.
*/
- @Deprecated void clearActive();
+ @Deprecated
+ void clearActive();
/**
* Returns the identifier of the command whose handler is being activated.
@@ -60,10 +61,10 @@ public interface IHandlerActivation extends IEvaluationResultCache, Comparable {
String getCommandId();
/**
- * Returns the depth at which this activation was created within the
- * services hierarchy. The root of the hierarchy is at a depth of
- * <code>1</code>. This is used as the final tie-breaker in the event
- * that no other method can be used to determine a winner.
+ * Returns the depth at which this activation was created within the services
+ * hierarchy. The root of the hierarchy is at a depth of <code>1</code>. This is
+ * used as the final tie-breaker in the event that no other method can be used
+ * to determine a winner.
*
* @return The depth at which the handler was inserted into the services
* hierarchy; should be a positive integer.
@@ -79,9 +80,9 @@ public interface IHandlerActivation extends IEvaluationResultCache, Comparable {
IHandler getHandler();
/**
- * Returns the handler service from which this activation was requested.
- * This is used to ensure that an activation can only be retracted from the
- * same service which issued it.
+ * Returns the handler service from which this activation was requested. This is
+ * used to ensure that an activation can only be retracted from the same service
+ * which issued it.
*
* @return The handler service; never <code>null</code>.
*/
@@ -89,17 +90,16 @@ public interface IHandlerActivation extends IEvaluationResultCache, Comparable {
/**
* Returns whether this handler activation is currently active -- given the
- * current state of the workbench. This method should cache its computation.
- * The cache will be cleared by a call to <code>clearActive</code>.
+ * current state of the workbench. This method should cache its computation. The
+ * cache will be cleared by a call to <code>clearActive</code>.
*
- * @param context
- * The context in which this state should be evaluated; must not
- * be <code>null</code>.
+ * @param context The context in which this state should be evaluated; must not
+ * be <code>null</code>.
* @return <code>true</code> if the activation is currently active;
* <code>false</code> otherwise.
- * @deprecated Use
- * {@link IEvaluationResultCache#evaluate(IEvaluationContext)}
+ * @deprecated Use {@link IEvaluationResultCache#evaluate(IEvaluationContext)}
* instead.
*/
- @Deprecated boolean isActive(IEvaluationContext context);
+ @Deprecated
+ boolean isActive(IEvaluationContext context);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/IHandlerService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/IHandlerService.java
index d5f0f58ac63..fbc8ff2067a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/IHandlerService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/IHandlerService.java
@@ -54,21 +54,20 @@ public interface IHandlerService extends IServiceWithSources {
/**
* <p>
- * Activates the given handler from a child service. This is used by slave
- * and nested services to promote handler activations up to the root. By
- * using this method, it is possible for handlers coming from a more nested
- * component to override the nested component.
+ * Activates the given handler from a child service. This is used by slave and
+ * nested services to promote handler activations up to the root. By using this
+ * method, it is possible for handlers coming from a more nested component to
+ * override the nested component.
* </p>
*
- * @param activation
- * The activation that is local to the child service; must not be
- * <code>null</code>.
+ * @param activation The activation that is local to the child service; must not
+ * be <code>null</code>.
* @return A token which can be used to later cancel the activation. Only
* someone with access to this token can cancel the activation. The
* activation will automatically be cancelled if the service locator
* context from which this service was retrieved is destroyed. This
- * activation is local to this service (i.e., it is not the
- * activation that is passed as a parameter).
+ * activation is local to this service (i.e., it is not the activation
+ * that is passed as a parameter).
* @since 3.2
*/
IHandlerActivation activateHandler(IHandlerActivation activation);
@@ -76,151 +75,136 @@ public interface IHandlerService extends IServiceWithSources {
/**
* <p>
* Activates the given handler within the context of this service. If this
- * service was retrieved from the workbench, then this handler will be
- * active globally. If the service was retrieved from a nested component,
- * then the handler will only be active within that component.
+ * service was retrieved from the workbench, then this handler will be active
+ * globally. If the service was retrieved from a nested component, then the
+ * handler will only be active within that component.
* </p>
* <p>
* Also, it is guaranteed that the handlers submitted through a particular
- * service will be cleaned up when that services is destroyed. So, for
- * example, a service retrieved from a <code>IWorkbenchPartSite</code>
- * would deactivate all of its handlers when the site is destroyed.
+ * service will be cleaned up when that services is destroyed. So, for example,
+ * a service retrieved from a <code>IWorkbenchPartSite</code> would deactivate
+ * all of its handlers when the site is destroyed.
* </p>
*
- * @param commandId
- * The identifier for the command which this handler handles;
- * must not be <code>null</code>.
- * @param handler
- * The handler to activate; must not be <code>null</code>.
+ * @param commandId The identifier for the command which this handler handles;
+ * must not be <code>null</code>.
+ * @param handler The handler to activate; must not be <code>null</code>.
* @return A token which can be used to later cancel the activation. Only
* someone with access to this token can cancel the activation. The
- * activation will automatically be cancelled if the context from
- * which this service was retrieved is destroyed.
+ * activation will automatically be cancelled if the context from which
+ * this service was retrieved is destroyed.
*/
IHandlerActivation activateHandler(String commandId, IHandler handler);
/**
* <p>
- * Activates the given handler within the context of this service. The
- * handler becomes active when <code>expression</code> evaluates to
- * <code>true</code>. This is the same as calling
+ * Activates the given handler within the context of this service. The handler
+ * becomes active when <code>expression</code> evaluates to <code>true</code>.
+ * This is the same as calling
* {@link #activateHandler(String, IHandler, Expression, boolean)} with
* global==false.
* </p>
* <p>
* Also, it is guaranteed that the handlers submitted through a particular
- * service will be cleaned up when that service is destroyed. So, for
- * example, a service retrieved from a <code>IWorkbenchPartSite</code>
- * would deactivate all of its handlers when the site is destroyed.
+ * service will be cleaned up when that service is destroyed. So, for example, a
+ * service retrieved from a <code>IWorkbenchPartSite</code> would deactivate all
+ * of its handlers when the site is destroyed.
* </p>
*
- * @param commandId
- * The identifier for the command which this handler handles;
- * must not be <code>null</code>.
- * @param handler
- * The handler to activate; must not be <code>null</code>.
- * @param expression
- * This expression must evaluate to <code>true</code> before
- * this handler will really become active. The expression may be
- * <code>null</code> if the handler should always be active.
+ * @param commandId The identifier for the command which this handler handles;
+ * must not be <code>null</code>.
+ * @param handler The handler to activate; must not be <code>null</code>.
+ * @param expression This expression must evaluate to <code>true</code> before
+ * this handler will really become active. The expression may
+ * be <code>null</code> if the handler should always be
+ * active.
* @return A token which can be used to later cancel the activation. Only
* someone with access to this token can cancel the activation. The
- * activation will automatically be cancelled if the context from
- * which this service was retrieved is destroyed.
+ * activation will automatically be cancelled if the context from which
+ * this service was retrieved is destroyed.
*
* @see org.eclipse.ui.ISources
* @since 3.2
*/
- IHandlerActivation activateHandler(String commandId,
- IHandler handler, Expression expression);
+ IHandlerActivation activateHandler(String commandId, IHandler handler, Expression expression);
/**
* <p>
- * Activates the given handler within the context of this service. The
- * handler becomes active when <code>expression</code> evaluates to
- * <code>true</code>. if global==<code>false</code>, then this
- * handler service must also be the active service to active the handler.
- * For example, the handler service on a part is active when that part is
- * active.
+ * Activates the given handler within the context of this service. The handler
+ * becomes active when <code>expression</code> evaluates to <code>true</code>.
+ * if global==<code>false</code>, then this handler service must also be the
+ * active service to active the handler. For example, the handler service on a
+ * part is active when that part is active.
* </p>
* <p>
* Also, it is guaranteed that the handlers submitted through a particular
- * service will be cleaned up when that services is destroyed. So, for
- * example, a service retrieved from a <code>IWorkbenchPartSite</code>
- * would deactivate all of its handlers when the site is destroyed.
+ * service will be cleaned up when that services is destroyed. So, for example,
+ * a service retrieved from a <code>IWorkbenchPartSite</code> would deactivate
+ * all of its handlers when the site is destroyed.
* </p>
*
- * @param commandId
- * The identifier for the command which this handler handles;
- * must not be <code>null</code>.
- * @param handler
- * The handler to activate; must not be <code>null</code>.
- * @param expression
- * This expression must evaluate to <code>true</code> before
- * this handler will really become active. The expression may be
- * <code>null</code> if the handler should always be active.
- * @param global
- * Indicates that the handler should be activated irrespectively
- * of whether the corresponding workbench component (e.g.,
- * window, part, etc.) is active.
+ * @param commandId The identifier for the command which this handler handles;
+ * must not be <code>null</code>.
+ * @param handler The handler to activate; must not be <code>null</code>.
+ * @param expression This expression must evaluate to <code>true</code> before
+ * this handler will really become active. The expression may
+ * be <code>null</code> if the handler should always be
+ * active.
+ * @param global Indicates that the handler should be activated
+ * irrespectively of whether the corresponding workbench
+ * component (e.g., window, part, etc.) is active.
* @return A token which can be used to later cancel the activation. Only
* someone with access to this token can cancel the activation. The
- * activation will automatically be cancelled if the context from
- * which this service was retrieved is destroyed.
+ * activation will automatically be cancelled if the context from which
+ * this service was retrieved is destroyed.
*
* @see org.eclipse.ui.ISources
* @since 3.2
*/
- IHandlerActivation activateHandler(String commandId,
- IHandler handler, Expression expression, boolean global);
+ IHandlerActivation activateHandler(String commandId, IHandler handler, Expression expression, boolean global);
/**
* <p>
- * Activates the given handler within the context of this service. The
- * handler becomes active when <code>expression</code> evaluates to
- * <code>true</code>.
+ * Activates the given handler within the context of this service. The handler
+ * becomes active when <code>expression</code> evaluates to <code>true</code>.
* </p>
* <p>
* Also, it is guaranteed that the handlers submitted through a particular
- * service will be cleaned up when that services is destroyed. So, for
- * example, a service retrieved from a <code>IWorkbenchPartSite</code>
- * would deactivate all of its handlers when the site is destroyed.
+ * service will be cleaned up when that services is destroyed. So, for example,
+ * a service retrieved from a <code>IWorkbenchPartSite</code> would deactivate
+ * all of its handlers when the site is destroyed.
* </p>
*
- * @param commandId
- * The identifier for the command which this handler handles;
- * must not be <code>null</code>.
- * @param handler
- * The handler to activate; must not be <code>null</code>.
- * @param expression
- * This expression must evaluate to <code>true</code> before
- * this handler will really become active. The expression may be
- * <code>null</code> if the handler should always be active.
- * @param sourcePriorities
- * The source priorities for the expression.
+ * @param commandId The identifier for the command which this handler
+ * handles; must not be <code>null</code>.
+ * @param handler The handler to activate; must not be
+ * <code>null</code>.
+ * @param expression This expression must evaluate to <code>true</code>
+ * before this handler will really become active. The
+ * expression may be <code>null</code> if the handler
+ * should always be active.
+ * @param sourcePriorities The source priorities for the expression.
* @return A token which can be used to later cancel the activation. Only
* someone with access to this token can cancel the activation. The
- * activation will automatically be cancelled if the context from
- * which this service was retrieved is destroyed.
+ * activation will automatically be cancelled if the context from which
+ * this service was retrieved is destroyed.
*
* @see org.eclipse.ui.ISources
* @deprecated Use
* {@link IHandlerService#activateHandler(String, IHandler, Expression)}
* instead.
*/
- @Deprecated IHandlerActivation activateHandler(String commandId,
- IHandler handler, Expression expression, int sourcePriorities);
+ @Deprecated
+ IHandlerActivation activateHandler(String commandId, IHandler handler, Expression expression, int sourcePriorities);
/**
- * Creates an execution event based on an SWT event. This execution event
- * can then be passed to a command for execution.
+ * Creates an execution event based on an SWT event. This execution event can
+ * then be passed to a command for execution.
*
- * @param command
- * The command for which an execution event should be created;
- * must not be <code>null</code>.
- * @param event
- * The SWT event triggering the command execution; may be
- * <code>null</code>.
+ * @param command The command for which an execution event should be created;
+ * must not be <code>null</code>.
+ * @param event The SWT event triggering the command execution; may be
+ * <code>null</code>.
* @return An execution event suitable for calling
* {@link Command#executeWithChecks(ExecutionEvent)}.
* @since 3.2
@@ -230,166 +214,147 @@ public interface IHandlerService extends IServiceWithSources {
/**
* Creates a parameterized execution event based on an SWT event and a
- * parameterized command. This execution event can then be passed to a
- * command for execution.
+ * parameterized command. This execution event can then be passed to a command
+ * for execution.
*
- * @param command
- * The parameterized command for which an execution event should
- * be created; must not be <code>null</code>.
- * @param event
- * The SWT event triggering the command execution; may be
- * <code>null</code>.
+ * @param command The parameterized command for which an execution event should
+ * be created; must not be <code>null</code>.
+ * @param event The SWT event triggering the command execution; may be
+ * <code>null</code>.
* @return An execution event suitable for calling
* {@link Command#executeWithChecks(ExecutionEvent)}.
* @since 3.2
* @see ParameterizedCommand#getCommand()
* @see Command#executeWithChecks(ExecutionEvent)
*/
- ExecutionEvent createExecutionEvent(ParameterizedCommand command,
- Event event);
+ ExecutionEvent createExecutionEvent(ParameterizedCommand command, Event event);
/**
* Deactivates the given handler within the context of this service. If the
- * handler was activated with a different service, then it must be
- * deactivated from that service instead. It is only possible to retract a
- * handler activation with this method. That is, you must have the same
+ * handler was activated with a different service, then it must be deactivated
+ * from that service instead. It is only possible to retract a handler
+ * activation with this method. That is, you must have the same
* <code>IHandlerActivation</code> used to activate the handler.
*
- * @param activation
- * The token that was returned from a call to
- * <code>activateHandler</code>; must not be <code>null</code>.
+ * @param activation The token that was returned from a call to
+ * <code>activateHandler</code>; must not be
+ * <code>null</code>.
*/
void deactivateHandler(IHandlerActivation activation);
/**
* Deactivates the given handlers within the context of this service. If the
- * handler was activated with a different service, then it must be
- * deactivated from that service instead. It is only possible to retract a
- * handler activation with this method. That is, you must have the same
+ * handler was activated with a different service, then it must be deactivated
+ * from that service instead. It is only possible to retract a handler
+ * activation with this method. That is, you must have the same
* <code>IHandlerActivation</code> used to activate the handler.
*
- * @param activations
- * The tokens that were returned from a call to
- * <code>activateHandler</code>. This collection must only
- * contain instances of <code>IHandlerActivation</code>. The
- * collection must not be <code>null</code>.
+ * @param activations The tokens that were returned from a call to
+ * <code>activateHandler</code>. This collection must only
+ * contain instances of <code>IHandlerActivation</code>. The
+ * collection must not be <code>null</code>.
*/
void deactivateHandlers(Collection activations);
/**
* Executes the command with the given identifier and no parameters.
*
- * @param commandId
- * The identifier of the command to execute; must not be
- * <code>null</code>.
- * @param event
- * The SWT event triggering the command execution; may be
- * <code>null</code>.
+ * @param commandId The identifier of the command to execute; must not be
+ * <code>null</code>.
+ * @param event The SWT event triggering the command execution; may be
+ * <code>null</code>.
* @return The return value from the execution; may be <code>null</code>.
- * @throws ExecutionException
- * If the handler has problems executing this command.
- * @throws NotDefinedException
- * If the command you are trying to execute is not defined.
- * @throws NotEnabledException
- * If the command you are trying to execute is not enabled.
- * @throws NotHandledException
- * If there is no handler.
+ * @throws ExecutionException If the handler has problems executing this
+ * command.
+ * @throws NotDefinedException If the command you are trying to execute is not
+ * defined.
+ * @throws NotEnabledException If the command you are trying to execute is not
+ * enabled.
+ * @throws NotHandledException If there is no handler.
* @since 3.2
* @see Command#executeWithChecks(ExecutionEvent)
*/
Object executeCommand(String commandId, Event event)
- throws ExecutionException, NotDefinedException,
- NotEnabledException, NotHandledException;
+ throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException;
/**
* Executes the given parameterized command.
*
- * @param command
- * The parameterized command to be executed; must not be
- * <code>null</code>.
- * @param event
- * The SWT event triggering the command execution; may be
- * <code>null</code>.
+ * @param command The parameterized command to be executed; must not be
+ * <code>null</code>.
+ * @param event The SWT event triggering the command execution; may be
+ * <code>null</code>.
* @return The return value from the execution; may be <code>null</code>.
- * @throws ExecutionException
- * If the handler has problems executing this command.
- * @throws NotDefinedException
- * If the command you are trying to execute is not defined.
- * @throws NotEnabledException
- * If the command you are trying to execute is not enabled.
- * @throws NotHandledException
- * If there is no handler.
+ * @throws ExecutionException If the handler has problems executing this
+ * command.
+ * @throws NotDefinedException If the command you are trying to execute is not
+ * defined.
+ * @throws NotEnabledException If the command you are trying to execute is not
+ * enabled.
+ * @throws NotHandledException If there is no handler.
* @since 3.2
* @see Command#executeWithChecks(ExecutionEvent)
*/
Object executeCommand(ParameterizedCommand command, Event event)
- throws ExecutionException, NotDefinedException,
- NotEnabledException, NotHandledException;
+ throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException;
/**
- * Executes the given parameterized command in the provided context. It
- * takes care of finding the correct active handler given the context, calls
+ * Executes the given parameterized command in the provided context. It takes
+ * care of finding the correct active handler given the context, calls
* {@link IHandler2#setEnabled(Object)} to update the enabled state if
* supported, and executes with that handler.
*
- * @param command
- * The parameterized command to be executed; must not be
- * <code>null</code>.
- * @param event
- * The SWT event triggering the command execution; may be
- * <code>null</code>.
- * @param context
- * the evaluation context to run against. Must not be
- * <code>null</code>
+ * @param command The parameterized command to be executed; must not be
+ * <code>null</code>.
+ * @param event The SWT event triggering the command execution; may be
+ * <code>null</code>.
+ * @param context the evaluation context to run against. Must not be
+ * <code>null</code>
* @return The return value from the execution; may be <code>null</code>.
- * @throws ExecutionException
- * If the handler has problems executing this command.
- * @throws NotDefinedException
- * If the command you are trying to execute is not defined.
- * @throws NotEnabledException
- * If the command you are trying to execute is not enabled.
- * @throws NotHandledException
- * If there is no handler.
+ * @throws ExecutionException If the handler has problems executing this
+ * command.
+ * @throws NotDefinedException If the command you are trying to execute is not
+ * defined.
+ * @throws NotEnabledException If the command you are trying to execute is not
+ * enabled.
+ * @throws NotHandledException If there is no handler.
* @since 3.4
* @see Command#executeWithChecks(ExecutionEvent)
* @see #createContextSnapshot(boolean)
*/
- Object executeCommandInContext(ParameterizedCommand command,
- Event event, IEvaluationContext context) throws ExecutionException,
- NotDefinedException, NotEnabledException, NotHandledException;
+ Object executeCommandInContext(ParameterizedCommand command, Event event, IEvaluationContext context)
+ throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException;
/**
* This method creates a copy of the application context returned by
* {@link #getCurrentState()}.
*
- * @param includeSelection
- * if <code>true</code>, include the default variable and
- * selection variables
- * @return an context filled with the current set of variables. If selection
- * is not included, the default variable is an empty collection
+ * @param includeSelection if <code>true</code>, include the default variable
+ * and selection variables
+ * @return an context filled with the current set of variables. If selection is
+ * not included, the default variable is an empty collection
* @since 3.4
*/
IEvaluationContext createContextSnapshot(boolean includeSelection);
/**
- * Returns an evaluation context representing the current state of the
- * world. This is equivalent to the application context required by
+ * Returns an evaluation context representing the current state of the world.
+ * This is equivalent to the application context required by
* {@link ExecutionEvent}.
*
* @return the current state of the application; never <code>null</code>.
* @see ParameterizedCommand#executeWithChecks(Object, Object)
- * @see ExecutionEvent#ExecutionEvent(Command, java.util.Map, Object,
- * Object)
+ * @see ExecutionEvent#ExecutionEvent(Command, java.util.Map, Object, Object)
* @see org.eclipse.ui.services.IEvaluationService
*/
IEvaluationContext getCurrentState();
/**
* <p>
- * Reads the handler information from the registry. This will overwrite any
- * of the existing information in the handler service. This method is
- * intended to be called during start-up. When this method completes, this
- * handler service will reflect the current state of the registry.
+ * Reads the handler information from the registry. This will overwrite any of
+ * the existing information in the handler service. This method is intended to
+ * be called during start-up. When this method completes, this handler service
+ * will reflect the current state of the registry.
* </p>
*/
void readRegistry();
@@ -397,13 +362,11 @@ public interface IHandlerService extends IServiceWithSources {
/**
* Sets the help context identifier to associate with a particular handler.
*
- * @param handler
- * The handler with which to register a help context identifier;
- * must not be <code>null</code>.
- * @param helpContextId
- * The help context identifier to register; may be
- * <code>null</code> if the help context identifier should be
- * removed.
+ * @param handler The handler with which to register a help context
+ * identifier; must not be <code>null</code>.
+ * @param helpContextId The help context identifier to register; may be
+ * <code>null</code> if the help context identifier should
+ * be removed.
* @since 3.2
*/
void setHelpContextId(IHandler handler, String helpContextId);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/RadioState.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/RadioState.java
index b48c4734257..b95b20d1c15 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/RadioState.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/RadioState.java
@@ -42,8 +42,7 @@ import org.eclipse.jface.preference.IPreferenceStore;
* @see HandlerUtil#matchesRadioState(org.eclipse.core.commands.ExecutionEvent)
* @since 3.5
*/
-public final class RadioState extends PersistentState implements
- IExecutableExtension {
+public final class RadioState extends PersistentState implements IExecutableExtension {
/**
* The state ID for a radio state understood by the system.
@@ -60,8 +59,7 @@ public final class RadioState extends PersistentState implements
}
@Override
- public void setInitializationData(IConfigurationElement config,
- String propertyName, Object data) {
+ public void setInitializationData(IConfigurationElement config, String propertyName, Object data) {
boolean shouldPersist = true; // persist by default
if (data instanceof String) {
@@ -74,8 +72,7 @@ public final class RadioState extends PersistentState implements
}
final Object persistedObject = parameters.get("persisted"); //$NON-NLS-1$
- if (persistedObject instanceof String
- && "false".equalsIgnoreCase(((String) persistedObject))) //$NON-NLS-1$
+ if (persistedObject instanceof String && "false".equalsIgnoreCase(((String) persistedObject))) //$NON-NLS-1$
shouldPersist = false;
}
setShouldPersist(shouldPersist);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/RegistryRadioState.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/RegistryRadioState.java
index b569bddd8db..ea6fec5c10f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/RegistryRadioState.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/RegistryRadioState.java
@@ -32,12 +32,12 @@ import org.eclipse.jface.commands.RadioState;
* <code>default</code>, which is the default value for this item;
* <code>persisted</code>, which is whether the state should be persisted
* between sessions; <code>id</code>, which is the identifier of the group to
- * which this radio handler belongs. The <code>default</code> parameter
- * defaults to <code>false</code>, and the <code>persisted</code> parameter
- * defaults to <code>true</code>. If only one parameter is passed (i.e.,
- * using the class name followed by a colon), then it is assumed to be the
- * <code>id</code> parameter. The <code>id</code> is required for this class
- * to function properly.
+ * which this radio handler belongs. The <code>default</code> parameter defaults
+ * to <code>false</code>, and the <code>persisted</code> parameter defaults to
+ * <code>true</code>. If only one parameter is passed (i.e., using the class
+ * name followed by a colon), then it is assumed to be the <code>id</code>
+ * parameter. The <code>id</code> is required for this class to function
+ * properly.
* </p>
* <p>
* Clients may instantiate this class, but must not extend.
@@ -45,16 +45,13 @@ import org.eclipse.jface.commands.RadioState;
*
* @since 3.2
*/
-public final class RegistryRadioState extends RadioState implements
- IExecutableExtension {
+public final class RegistryRadioState extends RadioState implements IExecutableExtension {
/**
- * Reads the <code>default</code> parameter from the given string. This
- * converts the string to a boolean, using <code>true</code> as the
- * default.
+ * Reads the <code>default</code> parameter from the given string. This converts
+ * the string to a boolean, using <code>true</code> as the default.
*
- * @param defaultString
- * The string to parse; may be <code>null</code>.
+ * @param defaultString The string to parse; may be <code>null</code>.
*/
private void readDefault(final String defaultString) {
if ("true".equalsIgnoreCase(defaultString)) { //$NON-NLS-1$
@@ -64,11 +61,9 @@ public final class RegistryRadioState extends RadioState implements
/**
* Reads the <code>persisted</code> parameter from the given string. This
- * converts the string to a boolean, using <code>true</code> as the
- * default.
+ * converts the string to a boolean, using <code>true</code> as the default.
*
- * @param persistedString
- * The string to parse; may be <code>null</code>.
+ * @param persistedString The string to parse; may be <code>null</code>.
*/
private void readPersisted(final String persistedString) {
if ("false".equalsIgnoreCase(persistedString)) { //$NON-NLS-1$
@@ -79,9 +74,8 @@ public final class RegistryRadioState extends RadioState implements
}
@Override
- public void setInitializationData(
- final IConfigurationElement configurationElement,
- final String propertyName, final Object data) {
+ public void setInitializationData(final IConfigurationElement configurationElement, final String propertyName,
+ final Object data) {
if (data instanceof String) {
// This is the default value.
setRadioGroupIdentifier((String) data);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/RegistryToggleState.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/RegistryToggleState.java
index 27fae3da198..2f75f2f675f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/RegistryToggleState.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/RegistryToggleState.java
@@ -41,23 +41,20 @@ import org.eclipse.jface.commands.ToggleState;
*
* @since 3.2
*/
-public final class RegistryToggleState extends ToggleState implements
- IExecutableExtension {
+public final class RegistryToggleState extends ToggleState implements IExecutableExtension {
/**
* The state ID for a toggle state understood by the system.
*
* @since 3.5
*/
- public static final String STATE_ID = "org.eclipse.ui.commands.toggleState"; //$NON-NLS-1$
+ public static final String STATE_ID = "org.eclipse.ui.commands.toggleState"; //$NON-NLS-1$
/**
- * Reads the <code>default</code> parameter from the given string. This
- * converts the string to a boolean, using <code>true</code> as the
- * default.
+ * Reads the <code>default</code> parameter from the given string. This converts
+ * the string to a boolean, using <code>true</code> as the default.
*
- * @param defaultString
- * The string to parse; may be <code>null</code>.
+ * @param defaultString The string to parse; may be <code>null</code>.
*/
private void readDefault(final String defaultString) {
if ("true".equalsIgnoreCase(defaultString)) { //$NON-NLS-1$
@@ -67,24 +64,21 @@ public final class RegistryToggleState extends ToggleState implements
/**
* Reads the <code>persisted</code> parameter from the given string. This
- * converts the string to a boolean, using <code>true</code> as the
- * default.
+ * converts the string to a boolean, using <code>true</code> as the default.
*
- * @param persistedString
- * The string to parse; may be <code>null</code>.
+ * @param persistedString The string to parse; may be <code>null</code>.
*/
private void readPersisted(final String persistedString) {
if ("false".equalsIgnoreCase(persistedString)) { //$NON-NLS-1$
setShouldPersist(false);
- }else {
+ } else {
setShouldPersist(true);
}
}
@Override
- public void setInitializationData(
- final IConfigurationElement configurationElement,
- final String propertyName, final Object data) {
+ public void setInitializationData(final IConfigurationElement configurationElement, final String propertyName,
+ final Object data) {
if (data instanceof String) {
// This is the default value.
readDefault((String) data);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/ShowPerspectiveHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/ShowPerspectiveHandler.java
index 8d8810ccb67..785b295ce51 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/ShowPerspectiveHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/ShowPerspectiveHandler.java
@@ -43,17 +43,13 @@ import org.eclipse.ui.internal.dialogs.SelectPerspectiveDialog;
*/
public final class ShowPerspectiveHandler extends AbstractHandler {
-
@Override
- public Object execute(final ExecutionEvent event)
- throws ExecutionException {
- IWorkbenchWindow window = HandlerUtil
- .getActiveWorkbenchWindowChecked(event);
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+ IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
// Get the view identifier, if any.
final Map parameters = event.getParameters();
- final Object value = parameters
- .get(IWorkbenchCommandConstants.PERSPECTIVES_SHOW_PERSPECTIVE_PARM_ID);
+ final Object value = parameters.get(IWorkbenchCommandConstants.PERSPECTIVES_SHOW_PERSPECTIVE_PARM_ID);
final String newWindow = (String) parameters
.get(IWorkbenchCommandConstants.PERSPECTIVES_SHOW_PERSPECTIVE_PARM_NEWWINDOW);
@@ -73,35 +69,29 @@ public final class ShowPerspectiveHandler extends AbstractHandler {
/**
* Opens the specified perspective in a new window.
*
- * @param perspectiveId
- * The perspective to open; must not be <code>null</code>
- * @throws ExecutionException
- * If the perspective could not be opened.
+ * @param perspectiveId The perspective to open; must not be <code>null</code>
+ * @throws ExecutionException If the perspective could not be opened.
*/
- private void openNewWindowPerspective(String perspectiveId,
- IWorkbenchWindow activeWorkbenchWindow) throws ExecutionException {
+ private void openNewWindowPerspective(String perspectiveId, IWorkbenchWindow activeWorkbenchWindow)
+ throws ExecutionException {
final IWorkbench workbench = PlatformUI.getWorkbench();
try {
IAdaptable input = ((Workbench) workbench).getDefaultPageInput();
workbench.openWorkbenchWindow(perspectiveId, input);
} catch (WorkbenchException e) {
ErrorDialog.openError(activeWorkbenchWindow.getShell(),
- WorkbenchMessages.ChangeToPerspectiveMenu_errorTitle, e
- .getMessage(), e.getStatus());
+ WorkbenchMessages.ChangeToPerspectiveMenu_errorTitle, e.getMessage(), e.getStatus());
}
}
/**
* Opens a view selection dialog, allowing the user to chose a view.
*
- * @throws ExecutionException
- * If the perspective could not be opened.
+ * @throws ExecutionException If the perspective could not be opened.
*/
- private void openOther(final IWorkbenchWindow activeWorkbenchWindow)
- throws ExecutionException {
- final SelectPerspectiveDialog dialog = new SelectPerspectiveDialog(
- activeWorkbenchWindow.getShell(), WorkbenchPlugin.getDefault()
- .getPerspectiveRegistry());
+ private void openOther(final IWorkbenchWindow activeWorkbenchWindow) throws ExecutionException {
+ final SelectPerspectiveDialog dialog = new SelectPerspectiveDialog(activeWorkbenchWindow.getShell(),
+ WorkbenchPlugin.getDefault().getPerspectiveRegistry());
dialog.open();
if (dialog.getReturnCode() == Window.CANCEL) {
return;
@@ -127,19 +117,16 @@ public final class ShowPerspectiveHandler extends AbstractHandler {
/**
* Opens the perspective with the given identifier.
*
- * @param perspectiveId
- * The perspective to open; must not be <code>null</code>
- * @throws ExecutionException
- * If the perspective could not be opened.
+ * @param perspectiveId The perspective to open; must not be <code>null</code>
+ * @throws ExecutionException If the perspective could not be opened.
*/
- private void openPerspective(final String perspectiveId,
- final IWorkbenchWindow activeWorkbenchWindow)
+ private void openPerspective(final String perspectiveId, final IWorkbenchWindow activeWorkbenchWindow)
throws ExecutionException {
final IWorkbench workbench = PlatformUI.getWorkbench();
final IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
- IPerspectiveDescriptor desc = activeWorkbenchWindow.getWorkbench()
- .getPerspectiveRegistry().findPerspectiveWithId(perspectiveId);
+ IPerspectiveDescriptor desc = activeWorkbenchWindow.getWorkbench().getPerspectiveRegistry()
+ .findPerspectiveWithId(perspectiveId);
if (desc == null) {
throw new ExecutionException("Perspective " + perspectiveId //$NON-NLS-1$
+ " cannot be found."); //$NON-NLS-1$
@@ -149,8 +136,7 @@ public final class ShowPerspectiveHandler extends AbstractHandler {
if (activePage != null) {
activePage.setPerspective(desc);
} else {
- IAdaptable input = ((Workbench) workbench)
- .getDefaultPageInput();
+ IAdaptable input = ((Workbench) workbench).getDefaultPageInput();
activeWorkbenchWindow.openPage(perspectiveId, input);
}
} catch (WorkbenchException e) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/ShowViewHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/ShowViewHandler.java
index da781e28877..37cc9820787 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/ShowViewHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/ShowViewHandler.java
@@ -47,24 +47,25 @@ import org.eclipse.ui.statushandlers.StatusManager;
*/
public final class ShowViewHandler extends AbstractHandler {
+ /**
+ * Creates a new ShowViewHandler that will open the view in its default
+ * location.
+ */
+ public ShowViewHandler() {
+ }
- /**
- * Creates a new ShowViewHandler that will open the view in its default location.
- */
- public ShowViewHandler() {
- }
-
- /**
- * Creates a new ShowViewHandler that will optionally force the view to become
- * a fast view.
- *
- * @param makeFast if true, the view will be moved to the fast view bar (even if it already
- * exists elsewhere). If false, the view will be shown in its default location. Calling with
- * false is equivalent to using the default constructor.
- */
- public ShowViewHandler(boolean makeFast) {
+ /**
+ * Creates a new ShowViewHandler that will optionally force the view to become a
+ * fast view.
+ *
+ * @param makeFast if true, the view will be moved to the fast view bar (even if
+ * it already exists elsewhere). If false, the view will be
+ * shown in its default location. Calling with false is
+ * equivalent to using the default constructor.
+ */
+ public ShowViewHandler(boolean makeFast) {
- }
+ }
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
@@ -117,15 +118,14 @@ public final class ShowViewHandler extends AbstractHandler {
/**
* Opens the view with the given descriptor.
*
- * @param viewDescriptor
- * The view to open; must not be <code>null</code>
+ * @param viewDescriptor The view to open; must not be <code>null</code>
*/
private static void openView(IWorkbenchWindow window, final MPartDescriptor viewDescriptor,
EPartService partService) {
/*
* TODO: see bug 483699: the code below duplicates the code in
- * org.eclipse.ui.internal.quickaccess.ViewElement#execute() and should
- * be refactored to some user friendly API
+ * org.eclipse.ui.internal.quickaccess.ViewElement#execute() and should be
+ * refactored to some user friendly API
*/
String viewId = viewDescriptor.getElementId();
if (CompatibilityPart.COMPATIBILITY_VIEW_URI.equals(viewDescriptor.getContributionURI())) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/help/AbstractHelpUI.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/help/AbstractHelpUI.java
index 964bb5959c6..715212c7ffc 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/help/AbstractHelpUI.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/help/AbstractHelpUI.java
@@ -20,12 +20,12 @@ import org.eclipse.help.IContext;
/**
* Abstract base class for the help system UI.
* <p>
- * The Eclipse platform provides an extension point (<code>"org.eclipse.ui.helpSupport"</code>)
- * for plugging in a help system UI. The help system UI is an optional
- * component; applications may provide a UI for presenting help to the user by
- * implementing a subclass and including the name of their class in the
- * <code>&lt;config&gt;</code> element in an extension to the
- * <code>"org.eclipse.ui.helpSupport"</code> extension point.
+ * The Eclipse platform provides an extension point
+ * (<code>"org.eclipse.ui.helpSupport"</code>) for plugging in a help system UI.
+ * The help system UI is an optional component; applications may provide a UI
+ * for presenting help to the user by implementing a subclass and including the
+ * name of their class in the <code>&lt;config&gt;</code> element in an
+ * extension to the <code>"org.eclipse.ui.helpSupport"</code> extension point.
* </p>
* <p>
* Note that the standard implementation of the help system UI is provided by
@@ -45,8 +45,8 @@ public abstract class AbstractHelpUI {
public abstract void displayHelp();
/**
- * Displays the help search facility. For backward compatibility, the
- * default implementation does nothing.
+ * Displays the help search facility. For backward compatibility, the default
+ * implementation does nothing.
*
* @since 3.1
*/
@@ -55,8 +55,8 @@ public abstract class AbstractHelpUI {
}
/**
- * Displays the dynamic help for the active context. For backward
- * compatibility, the default implementation does nothing.
+ * Displays the dynamic help for the active context. For backward compatibility,
+ * the default implementation does nothing.
*
* @since 3.1
*/
@@ -68,8 +68,7 @@ public abstract class AbstractHelpUI {
* Starts the help search using the help search facility. For backward
* compatibility, the default implementation does nothing.
*
- * @param expression
- * the search expression
+ * @param expression the search expression
* @since 3.1
*/
public void search(String expression) {
@@ -77,20 +76,17 @@ public abstract class AbstractHelpUI {
}
/**
- * Resolves the help resource href according to the help system
- * implementation.
+ * Resolves the help resource href according to the help system implementation.
*
- * @param href
- * the help resource
- * @param documentOnly
- * if <code>true</code>, the resulting URL must point at the
- * document referenced by href. Otherwise, it can be a URL that
- * contains additional elements like navigation that the help
- * system adds to the document.
- * @return the fully resolved URL of the help resource or <code>null</code>
- * if not supported. Help systems that use application servers
- * typically return URLs with http: protocol. Simple help system
- * implementations can return URLs with file: protocol.
+ * @param href the help resource
+ * @param documentOnly if <code>true</code>, the resulting URL must point at the
+ * document referenced by href. Otherwise, it can be a URL
+ * that contains additional elements like navigation that
+ * the help system adds to the document.
+ * @return the fully resolved URL of the help resource or <code>null</code> if
+ * not supported. Help systems that use application servers typically
+ * return URLs with http: protocol. Simple help system implementations
+ * can return URLs with file: protocol.
*
* @since 3.1
*/
@@ -101,18 +97,15 @@ public abstract class AbstractHelpUI {
/**
* Displays context-sensitive help for the given context.
* <p>
- * (x,y) coordinates specify the location where the context sensitive help
- * UI will be presented. These coordinates are screen-relative (ie: (0,0) is
- * the top left-most screen corner). The platform is responsible for calling
- * this method and supplying the appropriate location.
+ * (x,y) coordinates specify the location where the context sensitive help UI
+ * will be presented. These coordinates are screen-relative (ie: (0,0) is the
+ * top left-most screen corner). The platform is responsible for calling this
+ * method and supplying the appropriate location.
* </p>
*
- * @param context
- * the context to display
- * @param x
- * horizontal position
- * @param y
- * verifical position
+ * @param context the context to display
+ * @param x horizontal position
+ * @param y verifical position
*/
public abstract void displayContext(IContext context, int x, int y);
@@ -120,20 +113,19 @@ public abstract class AbstractHelpUI {
* Displays help content for the help resource with the given URL.
* <p>
* This method is called by the platform to launch the help system UI,
- * displaying the documentation identified by the <code>href</code>
- * parameter.
+ * displaying the documentation identified by the <code>href</code> parameter.
* </p>
* <p>
* The help system makes no guarantee that all the help resources can be
* displayed or how they are displayed.
* </p>
*
- * @param href
- * the URL of the help resource.
- * <p>
- * Valid href are as described in
- * {@link org.eclipse.help.IHelpResource#getHref() IHelpResource.getHref()}
- * </p>
+ * @param href the URL of the help resource.
+ * <p>
+ * Valid href are as described in
+ * {@link org.eclipse.help.IHelpResource#getHref()
+ * IHelpResource.getHref()}
+ * </p>
*/
public abstract void displayHelpResource(String href);
@@ -141,8 +133,8 @@ public abstract class AbstractHelpUI {
* Returns whether the context-sensitive help window is currently being
* displayed.
*
- * @return <code>true</code> if the context-sensitive help window is
- * currently being displayed, <code>false</code> if not
+ * @return <code>true</code> if the context-sensitive help window is currently
+ * being displayed, <code>false</code> if not
*/
public abstract boolean isContextHelpDisplayed();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/help/IWorkbenchHelpSystem.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/help/IWorkbenchHelpSystem.java
index a80875ae147..a4fd87f7219 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/help/IWorkbenchHelpSystem.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/help/IWorkbenchHelpSystem.java
@@ -72,32 +72,27 @@ public interface IWorkbenchHelpSystem {
* Ignored if no help UI is available.
* </p>
*
- * @param expression
- * the search expression. The actual syntax rules of the
- * expression are dependent on the active
- * help system. Refer to the help system
- * documentation for more details.
+ * @param expression the search expression. The actual syntax rules of the
+ * expression are dependent on the active help system. Refer
+ * to the help system documentation for more details.
*/
void search(String expression);
/**
* Displays context-sensitive help for the given context.
* <p>
- * (x,y) coordinates specify the location where the context sensitive help
- * UI will be presented. These coordinates are screen-relative (ie: (0,0) is
- * the top left-most screen corner). The platform is responsible for calling
- * this method and supplying the appropriate location.
+ * (x,y) coordinates specify the location where the context sensitive help UI
+ * will be presented. These coordinates are screen-relative (ie: (0,0) is the
+ * top left-most screen corner). The platform is responsible for calling this
+ * method and supplying the appropriate location.
* </p>
* <p>
* Ignored if no help UI is available.
* </p>
*
- * @param context
- * the context to display
- * @param x
- * horizontal position
- * @param y
- * vertical position
+ * @param context the context to display
+ * @param x horizontal position
+ * @param y vertical position
*/
void displayContext(IContext context, int x, int y);
@@ -105,8 +100,7 @@ public interface IWorkbenchHelpSystem {
* Displays help content for the help resource with the given URL.
* <p>
* This method is called by the platform to launch the help system UI,
- * displaying the documentation identified by the <code>href</code>
- * parameter.
+ * displaying the documentation identified by the <code>href</code> parameter.
* </p>
* <p>
* The help system makes no guarantee that all the help resources can be
@@ -116,12 +110,12 @@ public interface IWorkbenchHelpSystem {
* Ignored if no help UI is available.
* </p>
*
- * @param href
- * the URL of the help resource.
- * <p>
- * Valid href are as described in
- * {@link org.eclipse.help.IHelpResource#getHref() IHelpResource.getHref()}
- * </p>
+ * @param href the URL of the help resource.
+ * <p>
+ * Valid href are as described in
+ * {@link org.eclipse.help.IHelpResource#getHref()
+ * IHelpResource.getHref()}
+ * </p>
*/
void displayHelpResource(String href);
@@ -131,8 +125,7 @@ public interface IWorkbenchHelpSystem {
* May only be called from a UI thread.
* <p>
*
- * @param helpContextId
- * the id of the context to display
+ * @param helpContextId the id of the context to display
*/
void displayHelp(String helpContextId);
@@ -142,58 +135,49 @@ public interface IWorkbenchHelpSystem {
* May only be called from a UI thread.
* <p>
*
- * @param context
- * the context to display
+ * @param context the context to display
*/
void displayHelp(IContext context);
/**
* Returns whether the context-sensitive help window is currently being
- * displayed. Returns <code>false</code> if the help UI has not been
- * activated yet.
+ * displayed. Returns <code>false</code> if the help UI has not been activated
+ * yet.
*
- * @return <code>true</code> if the context-sensitive help window is
- * currently being displayed, <code>false</code> otherwise
+ * @return <code>true</code> if the context-sensitive help window is currently
+ * being displayed, <code>false</code> otherwise
*/
boolean isContextHelpDisplayed();
/**
* Sets the given help id on the given action.
*
- * @param action
- * the action on which to register the id
- * @param helpContextId
- * the id to use when F1 help is invoked
+ * @param action the action on which to register the id
+ * @param helpContextId the id to use when F1 help is invoked
*/
void setHelp(IAction action, String helpContextId);
/**
* Sets the given help id on the given control.
*
- * @param control
- * the control on which to register the id
- * @param helpContextId
- * the id to use when F1 help is invoked
+ * @param control the control on which to register the id
+ * @param helpContextId the id to use when F1 help is invoked
*/
void setHelp(Control control, String helpContextId);
/**
* Sets the given help id on the given menu.
*
- * @param menu
- * the menu on which to register the id
- * @param helpContextId
- * the id to use when F1 help is invoked
+ * @param menu the menu on which to register the id
+ * @param helpContextId the id to use when F1 help is invoked
*/
void setHelp(Menu menu, String helpContextId);
/**
* Sets the given help id on the given menu item.
*
- * @param item
- * the menu item on which to register the id
- * @param helpContextId
- * the id to use when F1 help is invoked
+ * @param item the menu item on which to register the id
+ * @param helpContextId the id to use when F1 help is invoked
*/
void setHelp(MenuItem item, String helpContextId);
@@ -203,12 +187,11 @@ public interface IWorkbenchHelpSystem {
* already have a protocol will be unchanged.
*
* @param href
- * @param documentOnly if <code>true</code>, the resulting URL must point
- * at the document referenced by href. Otherwise, it can be a URL that
- * contains additional elements like navigation that the help system
- * adds to the document.
- * @return the resolved URL or <code>null</code> if no help UI is
- * available.
+ * @param documentOnly if <code>true</code>, the resulting URL must point at the
+ * document referenced by href. Otherwise, it can be a URL
+ * that contains additional elements like navigation that
+ * the help system adds to the document.
+ * @return the resolved URL or <code>null</code> if no help UI is available.
*/
URL resolve(String href, boolean documentOnly);
} \ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractEvaluationHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractEvaluationHandler.java
index 1dfca0bb197..7f431a99b39 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractEvaluationHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractEvaluationHandler.java
@@ -35,16 +35,14 @@ public abstract class AbstractEvaluationHandler extends AbstractEnabledHandler {
protected IEvaluationService getEvaluationService() {
if (evaluationService == null) {
- evaluationService = PlatformUI.getWorkbench()
- .getService(IEvaluationService.class);
+ evaluationService = PlatformUI.getWorkbench().getService(IEvaluationService.class);
}
return evaluationService;
}
protected void registerEnablement() {
- enablementRef = getEvaluationService().addEvaluationListener(
- getEnabledWhenExpression(), getEnablementListener(),
- PROP_ENABLED);
+ enablementRef = getEvaluationService().addEvaluationListener(getEnabledWhenExpression(),
+ getEnablementListener(), PROP_ENABLED);
}
protected abstract Expression getEnabledWhenExpression();
@@ -57,8 +55,7 @@ public abstract class AbstractEvaluationHandler extends AbstractEnabledHandler {
enablementListener = event -> {
if (event.getProperty() == PROP_ENABLED) {
if (event.getNewValue() instanceof Boolean) {
- setEnabled(((Boolean) event.getNewValue())
- .booleanValue());
+ setEnabled(((Boolean) event.getNewValue()).booleanValue());
} else {
setEnabled(false);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractWorkingSet.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractWorkingSet.java
index 35ad263ef51..edb1d9e7c64 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractWorkingSet.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractWorkingSet.java
@@ -47,7 +47,7 @@ public abstract class AbstractWorkingSet implements IAdaptable, IWorkingSet, Clo
private String label;
- //Workspace wide unique id for workingsets
+ // Workspace wide unique id for workingsets
private String uniqueId;
private static int counter;
@@ -61,7 +61,7 @@ public abstract class AbstractWorkingSet implements IAdaptable, IWorkingSet, Clo
/**
* Create a new instance of this class
*
- * @param name the unique name for this working set
+ * @param name the unique name for this working set
* @param label the user-friendly name for this working set
*/
public AbstractWorkingSet(String name, String label) {
@@ -73,46 +73,44 @@ public abstract class AbstractWorkingSet implements IAdaptable, IWorkingSet, Clo
}
/**
- * Returns the receiver if the requested type is either IWorkingSet
- * or IPersistableElement.
+ * Returns the receiver if the requested type is either IWorkingSet or
+ * IPersistableElement.
*
* @param adapter the requested type
- * @return the receiver if the requested type is either IWorkingSet
- * or IPersistableElement.
+ * @return the receiver if the requested type is either IWorkingSet or
+ * IPersistableElement.
*/
@Override
public <T> T getAdapter(Class<T> adapter) {
- if (adapter == IWorkingSet.class
- || adapter == IPersistableElement.class) {
+ if (adapter == IWorkingSet.class || adapter == IPersistableElement.class) {
return adapter.cast(this);
- }
- return Platform.getAdapterManager().getAdapter(this, adapter);
+ }
+ return Platform.getAdapterManager().getAdapter(this, adapter);
}
@Override
public String getName() {
- return name;
+ return name;
}
@Override
public void setName(String newName) {
- Assert.isNotNull(newName, "Working set name must not be null"); //$NON-NLS-1$
+ Assert.isNotNull(newName, "Working set name must not be null"); //$NON-NLS-1$
if (manager != null) {
IWorkingSet wSet = manager.getWorkingSet(newName);
if (wSet != this) {
- Assert.isTrue(wSet == null,
- "working set with same name already registered"); //$NON-NLS-1$
+ Assert.isTrue(wSet == null, "working set with same name already registered"); //$NON-NLS-1$
}
- }
+ }
- AbstractWorkingSet oldWorkingSet = clone();
- name = newName;
+ AbstractWorkingSet oldWorkingSet = clone();
+ name = newName;
- fireWorkingSetChanged(IWorkingSetManager.CHANGE_WORKING_SET_NAME_CHANGE, oldWorkingSet);
+ fireWorkingSetChanged(IWorkingSetManager.CHANGE_WORKING_SET_NAME_CHANGE, oldWorkingSet);
- if (labelBoundToName) {
- setLabel(newName);
- }
+ if (labelBoundToName) {
+ setLabel(newName);
+ }
}
/**
@@ -122,43 +120,40 @@ public abstract class AbstractWorkingSet implements IAdaptable, IWorkingSet, Clo
*/
public void connect(IWorkingSetManager manager) {
Assert.isTrue(this.manager == null, "A working set can only be connected to one manager"); //$NON-NLS-1$
- this.manager= manager;
+ this.manager = manager;
}
/**
* Disconnect this working set from its manager, if any.
*/
public void disconnect() {
- this.manager= null;
+ this.manager = null;
}
protected void fireWorkingSetChanged(String property, Object oldValue) {
- AbstractWorkingSetManager receiver= manager != null
- ? (AbstractWorkingSetManager)manager
- : (AbstractWorkingSetManager)WorkbenchPlugin.getDefault().getWorkingSetManager();
+ AbstractWorkingSetManager receiver = manager != null ? (AbstractWorkingSetManager) manager
+ : (AbstractWorkingSetManager) WorkbenchPlugin.getDefault().getWorkingSetManager();
receiver.workingSetChanged(this, property, oldValue);
}
/**
* Create a copy of the elements to store in the receiver.
*
- * @param elements the elements to store a copy of in the
- * receiver.
+ * @param elements the elements to store a copy of in the receiver.
*/
protected void internalSetElements(IAdaptable[] newElements) {
- Assert.isNotNull(newElements,
- "Working set elements array must not be null"); //$NON-NLS-1$
+ Assert.isNotNull(newElements, "Working set elements array must not be null"); //$NON-NLS-1$
- elements = new ArrayList(newElements.length);
- for (IAdaptable newElement : newElements) {
- elements.add(newElement);
- }
+ elements = new ArrayList(newElements.length);
+ for (IAdaptable newElement : newElements) {
+ elements.add(newElement);
+ }
}
@Override
public IAdaptable[] getElements() {
- ArrayList list = getElementsArray();
- return (IAdaptable[]) list.toArray(new IAdaptable[list.size()]);
+ ArrayList list = getElementsArray();
+ return (IAdaptable[]) list.toArray(new IAdaptable[list.size()]);
}
/**
@@ -168,11 +163,11 @@ public abstract class AbstractWorkingSet implements IAdaptable, IWorkingSet, Clo
* @return the elements array list
*/
protected ArrayList getElementsArray() {
- if (elements == null) {
- restoreWorkingSet();
- workingSetMemento = null;
- }
- return elements;
+ if (elements == null) {
+ restoreWorkingSet();
+ workingSetMemento = null;
+ }
+ return elements;
}
abstract void restoreWorkingSet();
@@ -183,7 +178,7 @@ public abstract class AbstractWorkingSet implements IAdaptable, IWorkingSet, Clo
@Override
public String getFactoryId() {
- return FACTORY_ID;
+ return FACTORY_ID;
}
@Override
@@ -196,7 +191,7 @@ public abstract class AbstractWorkingSet implements IAdaptable, IWorkingSet, Clo
AbstractWorkingSet oldWorkingSet = clone();
this.label = label == null ? getName() : label;
- labelBoundToName = Util.equals(label, name); // rebind the label to the name
+ labelBoundToName = Util.equals(label, name); // rebind the label to the name
fireWorkingSetChanged(IWorkingSetManager.CHANGE_WORKING_SET_LABEL_CHANGE, oldWorkingSet);
}
@@ -206,17 +201,16 @@ public abstract class AbstractWorkingSet implements IAdaptable, IWorkingSet, Clo
return getElementsArray().isEmpty();
}
- @Override
+ @Override
public final ImageDescriptor getImage() {
- return getImageDescriptor();
- }
-
+ return getImageDescriptor();
+ }
- /*package*/String getUniqueId() {
+ /* package */String getUniqueId() {
return uniqueId;
}
- /*package*/void setUniqueId(String uniqueId) {
+ /* package */void setUniqueId(String uniqueId) {
this.uniqueId = uniqueId;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractWorkingSetManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractWorkingSetManager.java
index 52932bb9bd9..96311a10cf2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractWorkingSetManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractWorkingSetManager.java
@@ -79,23 +79,22 @@ import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleEvent;
import org.osgi.framework.BundleListener;
-
/**
* Abstract implementation of <code>IWorkingSetManager</code>.
*/
-public abstract class AbstractWorkingSetManager extends EventManager implements
- IWorkingSetManager, BundleListener, IExtensionChangeHandler {
+public abstract class AbstractWorkingSetManager extends EventManager
+ implements IWorkingSetManager, BundleListener, IExtensionChangeHandler {
static abstract class WorkingSetRunnable implements ISafeRunnable {
@Override
public void handleException(Throwable exception) {
- StatusManager.getManager().handle(
- StatusUtil.newStatus(PlatformUI.PLUGIN_ID, exception));
+ StatusManager.getManager().handle(StatusUtil.newStatus(PlatformUI.PLUGIN_ID, exception));
}
}
- private SortedSet<AbstractWorkingSet> workingSets = new TreeSet<>((o1, o2) -> o1.getUniqueId().compareTo(o2.getUniqueId()));
+ private SortedSet<AbstractWorkingSet> workingSets = new TreeSet<>(
+ (o1, o2) -> o1.getUniqueId().compareTo(o2.getUniqueId()));
private List<IWorkingSet> recentWorkingSets = new ArrayList<>();
@@ -108,14 +107,17 @@ public abstract class AbstractWorkingSetManager extends EventManager implements
@Override
public void add(IWorkingSet workingSet) {
}
+
@Override
public boolean remove(IWorkingSet workingSet) {
return true;
}
+
@Override
public boolean contains(IWorkingSet workingSet) {
return true;
}
+
@Override
public void dispose() {
}
@@ -135,15 +137,12 @@ public abstract class AbstractWorkingSetManager extends EventManager implements
/**
* Returns the descriptors for the given editable working set ids. If an id
- * refers to a missing descriptor, or one that is non-editable, it is
- * skipped. If <code>null</code> is passed, all editable descriptors are
- * returned.
+ * refers to a missing descriptor, or one that is non-editable, it is skipped.
+ * If <code>null</code> is passed, all editable descriptors are returned.
*
- * @param supportedWorkingSetIds
- * the ids for the working set descriptors, or <code>null</code>
- * for all editable descriptors
- * @return the descriptors corresponding to the given editable working set
- * ids
+ * @param supportedWorkingSetIds the ids for the working set descriptors, or
+ * <code>null</code> for all editable descriptors
+ * @return the descriptors corresponding to the given editable working set ids
*/
private static WorkingSetDescriptor[] getSupportedEditableDescriptors(String[] supportedWorkingSetIds) {
WorkingSetRegistry registry = WorkbenchPlugin.getDefault().getWorkingSetRegistry();
@@ -160,11 +159,11 @@ public abstract class AbstractWorkingSetManager extends EventManager implements
return result.toArray(new WorkingSetDescriptor[result.size()]);
}
- protected AbstractWorkingSetManager(BundleContext context) {
- bundleContext= context;
- bundleContext.addBundleListener(this);
- PlatformUI.getWorkbench().getExtensionTracker().registerHandler(this, ExtensionTracker
- .createExtensionPointFilter(getExtensionPointFilter()));
+ protected AbstractWorkingSetManager(BundleContext context) {
+ bundleContext = context;
+ bundleContext.addBundleListener(this);
+ PlatformUI.getWorkbench().getExtensionTracker().registerHandler(this,
+ ExtensionTracker.createExtensionPointFilter(getExtensionPointFilter()));
}
/**
@@ -174,8 +173,7 @@ public abstract class AbstractWorkingSetManager extends EventManager implements
* @since 3.3
*/
private IExtensionPoint getExtensionPointFilter() {
- return Platform.getExtensionRegistry().getExtensionPoint(
- PlatformUI.PLUGIN_ID,
+ return Platform.getExtensionRegistry().getExtensionPoint(PlatformUI.PLUGIN_ID,
IWorkbenchRegistryConstants.PL_WORKINGSETS);
}
@@ -201,34 +199,35 @@ public abstract class AbstractWorkingSetManager extends EventManager implements
}
}
- //---- working set creation -----------------------------------------------------
+ // ---- working set creation
+ // -----------------------------------------------------
- @Override
+ @Override
public IWorkingSet createWorkingSet(String name, IAdaptable[] elements) {
- return new WorkingSet(name, name, elements);
- }
+ return new WorkingSet(name, name, elements);
+ }
- @Override
- public IWorkingSet createAggregateWorkingSet(String name, String label,
- IWorkingSet[] components) {
+ @Override
+ public IWorkingSet createAggregateWorkingSet(String name, String label, IWorkingSet[] components) {
return new AggregateWorkingSet(name, label, components);
}
- @Override
+ @Override
public IWorkingSet createWorkingSet(IMemento memento) {
- return restoreWorkingSet(memento);
- }
+ return restoreWorkingSet(memento);
+ }
- //---- working set management ---------------------------------------------------
+ // ---- working set management
+ // ---------------------------------------------------
- @Override
+ @Override
public void addWorkingSet(IWorkingSet workingSet) {
IWorkingSet wSet = getWorkingSet(workingSet.getName());
- Assert.isTrue(wSet==null,"working set with same name already registered"); //$NON-NLS-1$
- internalAddWorkingSet(workingSet);
- }
+ Assert.isTrue(wSet == null, "working set with same name already registered"); //$NON-NLS-1$
+ internalAddWorkingSet(workingSet);
+ }
- private void internalAddWorkingSet(IWorkingSet workingSet) {
+ private void internalAddWorkingSet(IWorkingSet workingSet) {
AbstractWorkingSet abstractWorkingSet = (AbstractWorkingSet) workingSet;
workingSets.add(abstractWorkingSet);
abstractWorkingSet.connect(this);
@@ -236,17 +235,17 @@ public abstract class AbstractWorkingSetManager extends EventManager implements
firePropertyChange(CHANGE_WORKING_SET_ADD, null, workingSet);
}
- protected boolean internalRemoveWorkingSet(IWorkingSet workingSet) {
- boolean workingSetRemoved = workingSets.remove(workingSet);
- boolean recentWorkingSetRemoved = recentWorkingSets.remove(workingSet);
+ protected boolean internalRemoveWorkingSet(IWorkingSet workingSet) {
+ boolean workingSetRemoved = workingSets.remove(workingSet);
+ boolean recentWorkingSetRemoved = recentWorkingSets.remove(workingSet);
- if (workingSetRemoved) {
- ((AbstractWorkingSet)workingSet).disconnect();
- removeFromUpdater(workingSet);
- firePropertyChange(CHANGE_WORKING_SET_REMOVE, workingSet, null);
- }
- return workingSetRemoved || recentWorkingSetRemoved;
- }
+ if (workingSetRemoved) {
+ ((AbstractWorkingSet) workingSet).disconnect();
+ removeFromUpdater(workingSet);
+ firePropertyChange(CHANGE_WORKING_SET_REMOVE, workingSet, null);
+ }
+ return workingSetRemoved || recentWorkingSetRemoved;
+ }
@Override
public IWorkingSet[] getWorkingSets() {
@@ -281,30 +280,29 @@ public abstract class AbstractWorkingSetManager extends EventManager implements
return null;
}
- // ---- recent working set management --------------------------------------
+ // ---- recent working set management --------------------------------------
- @Override
+ @Override
public IWorkingSet[] getRecentWorkingSets() {
- return recentWorkingSets.toArray(new IWorkingSet[recentWorkingSets.size()]);
- }
-
- /**
- * Adds the specified working set to the list of recently used
- * working sets.
- *
- * @param workingSet working set to added to the list of recently
- * used working sets.
- */
- protected void internalAddRecentWorkingSet(IWorkingSet workingSet) {
- if (!workingSet.isVisible()) {
- return;
- }
- recentWorkingSets.remove(workingSet);
- recentWorkingSets.add(0, workingSet);
+ return recentWorkingSets.toArray(new IWorkingSet[recentWorkingSets.size()]);
+ }
+
+ /**
+ * Adds the specified working set to the list of recently used working sets.
+ *
+ * @param workingSet working set to added to the list of recently used working
+ * sets.
+ */
+ protected void internalAddRecentWorkingSet(IWorkingSet workingSet) {
+ if (!workingSet.isVisible()) {
+ return;
+ }
+ recentWorkingSets.remove(workingSet);
+ recentWorkingSets.add(0, workingSet);
sizeRecentWorkingSets();
- }
+ }
- //---- equals and hash code -----------------------------------------------
+ // ---- equals and hash code -----------------------------------------------
/**
* Tests the receiver and the object for equality
@@ -328,52 +326,48 @@ public abstract class AbstractWorkingSetManager extends EventManager implements
return other.workingSets.equals(workingSets);
}
- /**
- * Returns the hash code.
- *
- * @return the hash code.
- */
- @Override
+ /**
+ * Returns the hash code.
+ *
+ * @return the hash code.
+ */
+ @Override
public int hashCode() {
- return workingSets.hashCode();
- }
+ return workingSets.hashCode();
+ }
- //---- property listeners -------------------------------------------------
+ // ---- property listeners -------------------------------------------------
- @Override
+ @Override
public void addPropertyChangeListener(IPropertyChangeListener listener) {
- addListenerObject(listener);
- }
+ addListenerObject(listener);
+ }
- @Override
+ @Override
public void removePropertyChangeListener(IPropertyChangeListener listener) {
- removeListenerObject(listener);
- }
-
- /**
- * Notify property change listeners about a change to the list of
- * working sets.
- *
- * @param changeId one of
- * IWorkingSetManager#CHANGE_WORKING_SET_ADD
- * IWorkingSetManager#CHANGE_WORKING_SET_REMOVE
- * IWorkingSetManager#CHANGE_WORKING_SET_CONTENT_CHANGE
- * IWorkingSetManager#CHANGE_WORKING_SET_NAME_CHANGE
- * @param oldValue the removed working set or null if a working set
- * was added or changed.
- * @param newValue the new or changed working set or null if a working
- * set was removed.
- */
- protected void firePropertyChange(String changeId, Object oldValue,
- Object newValue) {
- final Object[] listeners = getListeners();
-
- if (listeners.length == 0) {
+ removeListenerObject(listener);
+ }
+
+ /**
+ * Notify property change listeners about a change to the list of working sets.
+ *
+ * @param changeId one of IWorkingSetManager#CHANGE_WORKING_SET_ADD
+ * IWorkingSetManager#CHANGE_WORKING_SET_REMOVE
+ * IWorkingSetManager#CHANGE_WORKING_SET_CONTENT_CHANGE
+ * IWorkingSetManager#CHANGE_WORKING_SET_NAME_CHANGE
+ * @param oldValue the removed working set or null if a working set was added or
+ * changed.
+ * @param newValue the new or changed working set or null if a working set was
+ * removed.
+ */
+ protected void firePropertyChange(String changeId, Object oldValue, Object newValue) {
+ final Object[] listeners = getListeners();
+
+ if (listeners.length == 0) {
return;
}
- final PropertyChangeEvent event = new PropertyChangeEvent(this,
- changeId, oldValue, newValue);
+ final PropertyChangeEvent event = new PropertyChangeEvent(this, changeId, oldValue, newValue);
Runnable notifier = () -> {
for (Object listener : listeners) {
final IPropertyChangeListener propertyChangeListener = (IPropertyChangeListener) listener;
@@ -405,35 +399,32 @@ public abstract class AbstractWorkingSetManager extends EventManager implements
* Fires a property change event for the changed working set. Should only be
* called by org.eclipse.ui.internal.WorkingSet.
*
- * @param changedWorkingSet
- * the working set that has changed
- * @param propertyChangeId
- * the changed property. one of
- * CHANGE_WORKING_SET_CONTENT_CHANGE,
- * CHANGE_WORKING_SET_LABEL_CHANGE, and
- * CHANGE_WORKING_SET_NAME_CHANGE
- * @param oldValue
- * the old value
+ * @param changedWorkingSet the working set that has changed
+ * @param propertyChangeId the changed property. one of
+ * CHANGE_WORKING_SET_CONTENT_CHANGE,
+ * CHANGE_WORKING_SET_LABEL_CHANGE, and
+ * CHANGE_WORKING_SET_NAME_CHANGE
+ * @param oldValue the old value
*/
- public void workingSetChanged(IWorkingSet changedWorkingSet,
- String propertyChangeId, Object oldValue) {
+ public void workingSetChanged(IWorkingSet changedWorkingSet, String propertyChangeId, Object oldValue) {
firePropertyChange(propertyChangeId, oldValue, changedWorkingSet);
}
- // ---- Persistence
+ // ---- Persistence
// ----------------------------------------------------------------
- /**
- * Saves all persistable working sets in the persistence store.
- *
- * @param memento the persistence store
- * @see IPersistableElement
- */
- public void saveWorkingSetState(IMemento memento) {
+ /**
+ * Saves all persistable working sets in the persistence store.
+ *
+ * @param memento the persistence store
+ * @see IPersistableElement
+ */
+ public void saveWorkingSetState(IMemento memento) {
Iterator<AbstractWorkingSet> iterator = workingSets.iterator();
- // break the sets into aggregates and non aggregates. The aggregates should be saved after the non-aggregates
- // so that on restoration all necessary aggregate components can be found.
+ // break the sets into aggregates and non aggregates. The aggregates should be
+ // saved after the non-aggregates
+ // so that on restoration all necessary aggregate components can be found.
ArrayList<IWorkingSet> standardSets = new ArrayList<>();
ArrayList<IWorkingSet> aggregateSets = new ArrayList<>();
@@ -446,18 +437,18 @@ public abstract class AbstractWorkingSetManager extends EventManager implements
}
}
- saveWorkingSetState(memento, standardSets);
- saveWorkingSetState(memento, aggregateSets);
- }
+ saveWorkingSetState(memento, standardSets);
+ saveWorkingSetState(memento, aggregateSets);
+ }
/**
* @param memento the memento to save to
- * @param list the working sets to save
+ * @param list the working sets to save
* @since 3.2
*/
private void saveWorkingSetState(final IMemento memento, List list) {
for (Iterator i = list.iterator(); i.hasNext();) {
- final IPersistableElement persistable = (IWorkingSet) i.next();
+ final IPersistableElement persistable = (IWorkingSet) i.next();
SafeRunner.run(new WorkingSetRunnable() {
@Override
@@ -465,26 +456,24 @@ public abstract class AbstractWorkingSetManager extends EventManager implements
// create a dummy node to write too - the write could fail so we
// shouldn't soil the final memento until we're sure it succeeds.
XMLMemento dummy = XMLMemento.createWriteRoot(IWorkbenchConstants.TAG_WORKING_SET);
- dummy.putString(IWorkbenchConstants.TAG_FACTORY_ID,
- persistable.getFactoryId());
+ dummy.putString(IWorkbenchConstants.TAG_FACTORY_ID, persistable.getFactoryId());
persistable.saveState(dummy);
// if the dummy was created successfully copy it to the real output
- IMemento workingSetMemento = memento
- .createChild(IWorkbenchConstants.TAG_WORKING_SET);
+ IMemento workingSetMemento = memento.createChild(IWorkbenchConstants.TAG_WORKING_SET);
workingSetMemento.putMemento(dummy);
}
});
- }
+ }
}
- /**
- * Recreates all working sets from the persistence store
- * and adds them to the receiver.
- *
- * @param memento the persistence store
- */
+ /**
+ * Recreates all working sets from the persistence store and adds them to the
+ * receiver.
+ *
+ * @param memento the persistence store
+ */
protected void restoreWorkingSetState(IMemento memento) {
for (IMemento child : memento.getChildren(IWorkbenchConstants.TAG_WORKING_SET)) {
AbstractWorkingSet workingSet = (AbstractWorkingSet) restoreWorkingSet(child);
@@ -494,30 +483,26 @@ public abstract class AbstractWorkingSetManager extends EventManager implements
}
}
- /**
- * Recreates a working set from the persistence store.
- *
- * @param memento the persistence store
- * @return the working set created from the memento or null if
- * creation failed.
- */
- protected IWorkingSet restoreWorkingSet(final IMemento memento) {
- String factoryID = memento
- .getString(IWorkbenchConstants.TAG_FACTORY_ID);
-
- if (factoryID == null) {
- // if the factory id was not set in the memento
- // then assume that the memento was created using
- // IMemento.saveState, and should be restored using WorkingSetFactory
- factoryID = AbstractWorkingSet.FACTORY_ID;
- }
- final IElementFactory factory = PlatformUI.getWorkbench().getElementFactory(
- factoryID);
- if (factory == null) {
- WorkbenchPlugin
- .log("Unable to restore working set - cannot instantiate factory: " + factoryID); //$NON-NLS-1$
- return null;
- }
+ /**
+ * Recreates a working set from the persistence store.
+ *
+ * @param memento the persistence store
+ * @return the working set created from the memento or null if creation failed.
+ */
+ protected IWorkingSet restoreWorkingSet(final IMemento memento) {
+ String factoryID = memento.getString(IWorkbenchConstants.TAG_FACTORY_ID);
+
+ if (factoryID == null) {
+ // if the factory id was not set in the memento
+ // then assume that the memento was created using
+ // IMemento.saveState, and should be restored using WorkingSetFactory
+ factoryID = AbstractWorkingSet.FACTORY_ID;
+ }
+ final IElementFactory factory = PlatformUI.getWorkbench().getElementFactory(factoryID);
+ if (factory == null) {
+ WorkbenchPlugin.log("Unable to restore working set - cannot instantiate factory: " + factoryID); //$NON-NLS-1$
+ return null;
+ }
final IAdaptable[] adaptable = new IAdaptable[1];
SafeRunner.run(new WorkingSetRunnable() {
@@ -526,122 +511,113 @@ public abstract class AbstractWorkingSetManager extends EventManager implements
adaptable[0] = factory.createElement(memento);
}
});
- if (adaptable[0] == null) {
- WorkbenchPlugin
- .log("Unable to restore working set - cannot instantiate working set: " + factoryID); //$NON-NLS-1$
- return null;
- }
- if ((adaptable[0] instanceof IWorkingSet) == false) {
- WorkbenchPlugin
- .log("Unable to restore working set - element is not an IWorkingSet: " + factoryID); //$NON-NLS-1$
- return null;
- }
- return (IWorkingSet) adaptable[0];
- }
-
- /**
- * Saves the list of most recently used working sets in the persistence
- * store.
- *
- * @param memento the persistence store
- */
- protected void saveMruList(IMemento memento) {
- Iterator iterator = recentWorkingSets.iterator();
-
- while (iterator.hasNext()) {
- IWorkingSet workingSet = (IWorkingSet) iterator.next();
- IMemento mruMemento = memento
- .createChild(IWorkbenchConstants.TAG_MRU_LIST);
-
- mruMemento.putString(IWorkbenchConstants.TAG_NAME, workingSet
- .getName());
- }
- }
-
- /**
- * Restores the list of most recently used working sets from the
- * persistence store.
- *
- * @param memento the persistence store
- */
- protected void restoreMruList(IMemento memento) {
- IMemento[] mruWorkingSets = memento
- .getChildren(IWorkbenchConstants.TAG_MRU_LIST);
-
- for (int i = mruWorkingSets.length - 1; i >= 0; i--) {
- String workingSetName = mruWorkingSets[i]
- .getString(IWorkbenchConstants.TAG_NAME);
- if (workingSetName != null) {
- IWorkingSet workingSet = getWorkingSet(workingSetName);
- if (workingSet != null) {
- internalAddRecentWorkingSet(workingSet);
- }
- }
- }
- }
-
- //---- user interface support -----------------------------------------------------
-
- /**
- * @see org.eclipse.ui.IWorkingSetManager#createWorkingSetEditWizard(org.eclipse.ui.IWorkingSet)
- * @since 2.1
- */
- @Override
- public IWorkingSetEditWizard createWorkingSetEditWizard(
- IWorkingSet workingSet) {
- String editPageId = workingSet.getId();
- WorkingSetRegistry registry = WorkbenchPlugin.getDefault()
- .getWorkingSetRegistry();
- IWorkingSetPage editPage = null;
-
- if (editPageId != null) {
- editPage = registry.getWorkingSetPage(editPageId);
- }
-
- // the following block kind of defeats IWorkingSet.isEditable() and it
+ if (adaptable[0] == null) {
+ WorkbenchPlugin.log("Unable to restore working set - cannot instantiate working set: " + factoryID); //$NON-NLS-1$
+ return null;
+ }
+ if ((adaptable[0] instanceof IWorkingSet) == false) {
+ WorkbenchPlugin.log("Unable to restore working set - element is not an IWorkingSet: " + factoryID); //$NON-NLS-1$
+ return null;
+ }
+ return (IWorkingSet) adaptable[0];
+ }
+
+ /**
+ * Saves the list of most recently used working sets in the persistence store.
+ *
+ * @param memento the persistence store
+ */
+ protected void saveMruList(IMemento memento) {
+ Iterator iterator = recentWorkingSets.iterator();
+
+ while (iterator.hasNext()) {
+ IWorkingSet workingSet = (IWorkingSet) iterator.next();
+ IMemento mruMemento = memento.createChild(IWorkbenchConstants.TAG_MRU_LIST);
+
+ mruMemento.putString(IWorkbenchConstants.TAG_NAME, workingSet.getName());
+ }
+ }
+
+ /**
+ * Restores the list of most recently used working sets from the persistence
+ * store.
+ *
+ * @param memento the persistence store
+ */
+ protected void restoreMruList(IMemento memento) {
+ IMemento[] mruWorkingSets = memento.getChildren(IWorkbenchConstants.TAG_MRU_LIST);
+
+ for (int i = mruWorkingSets.length - 1; i >= 0; i--) {
+ String workingSetName = mruWorkingSets[i].getString(IWorkbenchConstants.TAG_NAME);
+ if (workingSetName != null) {
+ IWorkingSet workingSet = getWorkingSet(workingSetName);
+ if (workingSet != null) {
+ internalAddRecentWorkingSet(workingSet);
+ }
+ }
+ }
+ }
+
+ // ---- user interface support
+ // -----------------------------------------------------
+
+ /**
+ * @see org.eclipse.ui.IWorkingSetManager#createWorkingSetEditWizard(org.eclipse.ui.IWorkingSet)
+ * @since 2.1
+ */
+ @Override
+ public IWorkingSetEditWizard createWorkingSetEditWizard(IWorkingSet workingSet) {
+ String editPageId = workingSet.getId();
+ WorkingSetRegistry registry = WorkbenchPlugin.getDefault().getWorkingSetRegistry();
+ IWorkingSetPage editPage = null;
+
+ if (editPageId != null) {
+ editPage = registry.getWorkingSetPage(editPageId);
+ }
+
+ // the following block kind of defeats IWorkingSet.isEditable() and it
// doesn't make sense for there to be a default page in such a case.
- if (editPage == null) {
+ if (editPage == null) {
editPage = registry.getDefaultWorkingSetPage();
if (editPage == null) {
return null;
}
}
- WorkingSetEditWizard editWizard = new WorkingSetEditWizard(editPage);
- editWizard.setSelection(workingSet);
- return editWizard;
- }
+ WorkingSetEditWizard editWizard = new WorkingSetEditWizard(editPage);
+ editWizard.setSelection(workingSet);
+ return editWizard;
+ }
- /**
- * @deprecated use createWorkingSetSelectionDialog(parent, true) instead
- */
- @Deprecated
+ /**
+ * @deprecated use createWorkingSetSelectionDialog(parent, true) instead
+ */
+ @Deprecated
@Override
- public IWorkingSetSelectionDialog createWorkingSetSelectionDialog(
- Shell parent) {
- return createWorkingSetSelectionDialog(parent, true);
- }
-
- @Override
- public IWorkingSetSelectionDialog createWorkingSetSelectionDialog(
- Shell parent, boolean multi) {
- return createWorkingSetSelectionDialog(parent, multi, null);
- }
-
- /**
+ public IWorkingSetSelectionDialog createWorkingSetSelectionDialog(Shell parent) {
+ return createWorkingSetSelectionDialog(parent, true);
+ }
+
+ @Override
+ public IWorkingSetSelectionDialog createWorkingSetSelectionDialog(Shell parent, boolean multi) {
+ return createWorkingSetSelectionDialog(parent, multi, null);
+ }
+
+ /**
* {@inheritDoc}
*/
- @Override
+ @Override
public IWorkingSetNewWizard createWorkingSetNewWizard(String[] workingSetIds) {
- WorkingSetDescriptor[] descriptors= getSupportedEditableDescriptors(workingSetIds);
- if (descriptors.length == 0) {
+ WorkingSetDescriptor[] descriptors = getSupportedEditableDescriptors(workingSetIds);
+ if (descriptors.length == 0) {
return null;
}
- return new WorkingSetNewWizard(descriptors);
-}
+ return new WorkingSetNewWizard(descriptors);
+ }
- //---- working set delta handling -------------------------------------------------
+ // ---- working set delta handling
+ // -------------------------------------------------
@Override
public void bundleChanged(BundleEvent event) {
@@ -707,8 +683,8 @@ public abstract class AbstractWorkingSetManager extends EventManager implements
}
private static List<WorkingSetDescriptor> getUniqueDescriptors(String symbolicName) {
- final List<WorkingSetDescriptor> descriptors = WorkbenchPlugin.getDefault()
- .getWorkingSetRegistry().getUpdaterDescriptorsForNamespace(symbolicName);
+ final List<WorkingSetDescriptor> descriptors = WorkbenchPlugin.getDefault().getWorkingSetRegistry()
+ .getUpdaterDescriptorsForNamespace(symbolicName);
// Note: WorkingSetRegistry never contains descriptors with same id
return descriptors;
}
@@ -716,31 +692,32 @@ public abstract class AbstractWorkingSetManager extends EventManager implements
private List<IWorkingSet> getWorkingSetsForId(String id) {
List<IWorkingSet> result = new ArrayList<>();
for (IWorkingSet ws : workingSets) {
- if (id.equals(ws.getId())) {
+ if (id.equals(ws.getId())) {
result.add(ws);
}
}
- return result;
+ return result;
}
- private void addToUpdater(final IWorkingSet workingSet) {
- WorkingSetDescriptor descriptor= WorkbenchPlugin.getDefault()
- .getWorkingSetRegistry().getWorkingSetDescriptor(workingSet.getId());
- if (descriptor == null || !descriptor.isUpdaterClassLoaded()) {
+ private void addToUpdater(final IWorkingSet workingSet) {
+ WorkingSetDescriptor descriptor = WorkbenchPlugin.getDefault().getWorkingSetRegistry()
+ .getWorkingSetDescriptor(workingSet.getId());
+ if (descriptor == null || !descriptor.isUpdaterClassLoaded()) {
return;
}
- synchronized(updaters) {
- final IWorkingSetUpdater updater= getUpdater(descriptor);
- SafeRunner.run(new WorkingSetRunnable() {
+ synchronized (updaters) {
+ final IWorkingSetUpdater updater = getUpdater(descriptor);
+ SafeRunner.run(new WorkingSetRunnable() {
@Override
public void run() throws Exception {
if (!updater.contains(workingSet)) {
updater.add(workingSet);
}
- }});
+ }
+ });
}
- }
+ }
private IWorkingSetUpdater getUpdater(WorkingSetDescriptor descriptor) {
IWorkingSetUpdater updater = updaters.get(descriptor.getId());
@@ -788,10 +765,11 @@ public abstract class AbstractWorkingSetManager extends EventManager implements
}
}
- @Override
- public IWorkingSetSelectionDialog createWorkingSetSelectionDialog(Shell parent, boolean multi, String[] workingsSetIds) {
- return new WorkingSetSelectionDialog(parent, multi, workingsSetIds);
- }
+ @Override
+ public IWorkingSetSelectionDialog createWorkingSetSelectionDialog(Shell parent, boolean multi,
+ String[] workingsSetIds) {
+ return new WorkingSetSelectionDialog(parent, multi, workingsSetIds);
+ }
/**
* Save the state to the state file.
@@ -800,8 +778,7 @@ public abstract class AbstractWorkingSetManager extends EventManager implements
* @throws IOException
*/
public void saveState(File stateFile) throws IOException {
- XMLMemento memento = XMLMemento
- .createWriteRoot(IWorkbenchConstants.TAG_WORKING_SET_MANAGER);
+ XMLMemento memento = XMLMemento.createWriteRoot(IWorkbenchConstants.TAG_WORKING_SET_MANAGER);
saveWorkingSetState(memento);
saveMruList(memento);
@@ -814,7 +791,8 @@ public abstract class AbstractWorkingSetManager extends EventManager implements
@Override
public void addExtension(IExtensionTracker tracker, IExtension extension) {
- // nothing - this is handled lazily. These items are only created as needed by the getUpdater() and getElementAdapter() methods
+ // nothing - this is handled lazily. These items are only created as needed by
+ // the getUpdater() and getElementAdapter() methods
}
@@ -822,7 +800,7 @@ public abstract class AbstractWorkingSetManager extends EventManager implements
public void removeExtension(IExtension extension, Object[] objects) {
for (Object object : objects) {
if (object instanceof IWorkingSetUpdater) {
- removeUpdater((IWorkingSetUpdater)object);
+ removeUpdater((IWorkingSetUpdater) object);
}
if (object instanceof IWorkingSetElementAdapter) {
@@ -837,8 +815,7 @@ public abstract class AbstractWorkingSetManager extends EventManager implements
* @param elementAdapter
* @since 3.3
*/
- private void removeElementAdapter(
- final IWorkingSetElementAdapter elementAdapter) {
+ private void removeElementAdapter(final IWorkingSetElementAdapter elementAdapter) {
SafeRunner.run(new WorkingSetRunnable() {
@Override
@@ -883,17 +860,16 @@ public abstract class AbstractWorkingSetManager extends EventManager implements
@Override
public void run() throws Exception {
- IAdaptable[] adaptedNewElements = workingSet
- .adaptElements(new IAdaptable[] { element });
+ IAdaptable[] adaptedNewElements = workingSet.adaptElements(new IAdaptable[] { element });
if (adaptedNewElements.length == 1) {
IAdaptable[] elements = workingSet.getElements();
IAdaptable[] newElements = new IAdaptable[elements.length + 1];
- System.arraycopy(elements, 0, newElements, 0,
- elements.length);
+ System.arraycopy(elements, 0, newElements, 0, elements.length);
newElements[newElements.length - 1] = adaptedNewElements[0];
workingSet.setElements(newElements);
}
- }});
+ }
+ });
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionDescriptor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionDescriptor.java
index 429d0c0a282..5e9cb6c3241 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionDescriptor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionDescriptor.java
@@ -27,359 +27,343 @@ import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants;
import org.eclipse.ui.plugin.AbstractUIPlugin;
/**
- * When 'action' tag is found in the registry, an object of this
- * class is created. It creates the appropriate action object
- * and captures information that is later used to add this action
- * object into menu/tool bar. This class is reused for
- * global (workbench) menu/tool bar, popup menu actions,
- * as well as view's pulldown and local tool bar.
+ * When 'action' tag is found in the registry, an object of this class is
+ * created. It creates the appropriate action object and captures information
+ * that is later used to add this action object into menu/tool bar. This class
+ * is reused for global (workbench) menu/tool bar, popup menu actions, as well
+ * as view's pulldown and local tool bar.
*/
public class ActionDescriptor implements IPluginContribution {
- private PluginAction action;
+ private PluginAction action;
- private String toolbarId;
+ private String toolbarId;
- private String menuPath;
+ private String menuPath;
- private String id;
+ private String id;
- private String pluginId;
+ private String pluginId;
- private String menuGroup;
+ private String menuGroup;
- private String toolbarGroupId;
+ private String toolbarGroupId;
private int mode = 0;
- /**
- * Popup constant. Value <code>0x1</code>.
- */
- public static final int T_POPUP = 0x1;
-
- /**
- * View constant. Value <code>0x2</code>.
- */
- public static final int T_VIEW = 0x2;
-
- /**
- * Workbench constant. Value <code>0x3</code>.
- */
- public static final int T_WORKBENCH = 0x3;
-
- /**
- * Editor constant. Value <code>0x4</code>.
- */
- public static final int T_EDITOR = 0x4;
-
- /**
- * Workbench pulldown constant. Value <code>0x5</code>.
- */
- public static final int T_WORKBENCH_PULLDOWN = 0x5;
-
- /**
- * Push style constant. Value <code>push</code>.
- */
- public static final String STYLE_PUSH = "push"; //$NON-NLS-1$
-
- /**
- * Radio style constant. Value <code>radio</code>.
- */
- public static final String STYLE_RADIO = "radio"; //$NON-NLS-1$
-
- /***
- * Toggle style constant. Value <code>toggle</code>.
- */
- public static final String STYLE_TOGGLE = "toggle"; //$NON-NLS-1$
-
- /**
- * Pulldown style constant. Value <code>pulldown</code>.
- */
- public static final String STYLE_PULLDOWN = "pulldown"; //$NON-NLS-1$
-
- /**
- * Creates a new descriptor with the specified target.
- *
- * @param actionElement the configuration element
- * @param targetType the type of action
- */
- public ActionDescriptor(IConfigurationElement actionElement, int targetType) {
- this(actionElement, targetType, null);
- }
-
- /**
- * Creates a new descriptor with the target and destination workbench part
- * it will go into.
- *
- * @param actionElement the configuration element
- * @param targetType the type of action
- * @param target the target object
- */
- public ActionDescriptor(IConfigurationElement actionElement,
- int targetType, Object target) {
- // Load attributes.
- id = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
+ /**
+ * Popup constant. Value <code>0x1</code>.
+ */
+ public static final int T_POPUP = 0x1;
+
+ /**
+ * View constant. Value <code>0x2</code>.
+ */
+ public static final int T_VIEW = 0x2;
+
+ /**
+ * Workbench constant. Value <code>0x3</code>.
+ */
+ public static final int T_WORKBENCH = 0x3;
+
+ /**
+ * Editor constant. Value <code>0x4</code>.
+ */
+ public static final int T_EDITOR = 0x4;
+
+ /**
+ * Workbench pulldown constant. Value <code>0x5</code>.
+ */
+ public static final int T_WORKBENCH_PULLDOWN = 0x5;
+
+ /**
+ * Push style constant. Value <code>push</code>.
+ */
+ public static final String STYLE_PUSH = "push"; //$NON-NLS-1$
+
+ /**
+ * Radio style constant. Value <code>radio</code>.
+ */
+ public static final String STYLE_RADIO = "radio"; //$NON-NLS-1$
+
+ /***
+ * Toggle style constant. Value <code>toggle</code>.
+ */
+ public static final String STYLE_TOGGLE = "toggle"; //$NON-NLS-1$
+
+ /**
+ * Pulldown style constant. Value <code>pulldown</code>.
+ */
+ public static final String STYLE_PULLDOWN = "pulldown"; //$NON-NLS-1$
+
+ /**
+ * Creates a new descriptor with the specified target.
+ *
+ * @param actionElement the configuration element
+ * @param targetType the type of action
+ */
+ public ActionDescriptor(IConfigurationElement actionElement, int targetType) {
+ this(actionElement, targetType, null);
+ }
+
+ /**
+ * Creates a new descriptor with the target and destination workbench part it
+ * will go into.
+ *
+ * @param actionElement the configuration element
+ * @param targetType the type of action
+ * @param target the target object
+ */
+ public ActionDescriptor(IConfigurationElement actionElement, int targetType, Object target) {
+ // Load attributes.
+ id = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
pluginId = actionElement.getContributor().getName();
- String label = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_LABEL);
- String tooltip = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_TOOLTIP);
- String helpContextId = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_HELP_CONTEXT_ID);
- String mpath = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_MENUBAR_PATH);
- String tpath = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_TOOLBAR_PATH);
- String style = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_STYLE);
- String icon = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_ICON);
- String hoverIcon = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_HOVERICON);
- String disabledIcon = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_DISABLEDICON);
- String description = actionElement.getAttribute(IWorkbenchRegistryConstants.TAG_DESCRIPTION);
- String accelerator = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_ACCELERATOR);
- if ("FORCE_TEXT".equals(actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_MODE))) { //$NON-NLS-1$
- mode = ActionContributionItem.MODE_FORCE_TEXT;
- }
-
- // Verify input.
- if (label == null) {
- WorkbenchPlugin
- .log("Invalid action declaration (label == null): " + id); //$NON-NLS-1$
- label = WorkbenchMessages.ActionDescriptor_invalidLabel;
- }
-
- // Calculate menu and toolbar paths.
- String mgroup = null;
- String tgroup = null;
- if (mpath != null) {
- int loc = mpath.lastIndexOf('/');
- if (loc != -1) {
- mgroup = mpath.substring(loc + 1);
- mpath = mpath.substring(0, loc);
- } else {
- mgroup = mpath;
- mpath = null;
- }
- }
- if (targetType == T_POPUP && mgroup == null) {
+ String label = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_LABEL);
+ String tooltip = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_TOOLTIP);
+ String helpContextId = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_HELP_CONTEXT_ID);
+ String mpath = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_MENUBAR_PATH);
+ String tpath = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_TOOLBAR_PATH);
+ String style = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_STYLE);
+ String icon = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_ICON);
+ String hoverIcon = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_HOVERICON);
+ String disabledIcon = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_DISABLEDICON);
+ String description = actionElement.getAttribute(IWorkbenchRegistryConstants.TAG_DESCRIPTION);
+ String accelerator = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_ACCELERATOR);
+ if ("FORCE_TEXT".equals(actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_MODE))) { //$NON-NLS-1$
+ mode = ActionContributionItem.MODE_FORCE_TEXT;
+ }
+
+ // Verify input.
+ if (label == null) {
+ WorkbenchPlugin.log("Invalid action declaration (label == null): " + id); //$NON-NLS-1$
+ label = WorkbenchMessages.ActionDescriptor_invalidLabel;
+ }
+
+ // Calculate menu and toolbar paths.
+ String mgroup = null;
+ String tgroup = null;
+ if (mpath != null) {
+ int loc = mpath.lastIndexOf('/');
+ if (loc != -1) {
+ mgroup = mpath.substring(loc + 1);
+ mpath = mpath.substring(0, loc);
+ } else {
+ mgroup = mpath;
+ mpath = null;
+ }
+ }
+ if (targetType == T_POPUP && mgroup == null) {
mgroup = IWorkbenchActionConstants.MB_ADDITIONS;
}
- if (tpath != null) {
- int loc = tpath.lastIndexOf('/');
- if (loc != -1) {
- tgroup = tpath.substring(loc + 1);
- tpath = tpath.substring(0, loc);
- } else {
- tgroup = tpath;
- tpath = null;
- }
- }
- menuPath = mpath;
- menuGroup = mgroup;
- if ((tpath != null) && tpath.equals("Normal")) { //$NON-NLS-1$
+ if (tpath != null) {
+ int loc = tpath.lastIndexOf('/');
+ if (loc != -1) {
+ tgroup = tpath.substring(loc + 1);
+ tpath = tpath.substring(0, loc);
+ } else {
+ tgroup = tpath;
+ tpath = null;
+ }
+ }
+ menuPath = mpath;
+ menuGroup = mgroup;
+ if ((tpath != null) && tpath.equals("Normal")) { //$NON-NLS-1$
tpath = ""; //$NON-NLS-1$
}
- toolbarId = tpath;
- toolbarGroupId = tgroup;
+ toolbarId = tpath;
+ toolbarGroupId = tgroup;
- // Create action.
- action = createAction(targetType, actionElement, target, style);
- if (action.getText() == null) {
+ // Create action.
+ action = createAction(targetType, actionElement, target, style);
+ if (action.getText() == null) {
action.setText(label);
}
- if (action.getToolTipText() == null && tooltip != null) {
+ if (action.getToolTipText() == null && tooltip != null) {
action.setToolTipText(tooltip);
}
- if (helpContextId != null) {
- String fullID = helpContextId;
- if (helpContextId.indexOf('.') == -1) {
+ if (helpContextId != null) {
+ String fullID = helpContextId;
+ if (helpContextId.indexOf('.') == -1) {
// For backward compatibility we auto qualify the id if it is not
- // qualified)
- fullID = actionElement.getContributor().getName()
- + "." + helpContextId;//$NON-NLS-1$
+ // qualified)
+ fullID = actionElement.getContributor().getName() + "." + helpContextId;//$NON-NLS-1$
}
- PlatformUI.getWorkbench().getHelpSystem().setHelp(action, fullID);
- }
- if (description != null) {
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(action, fullID);
+ }
+ if (description != null) {
action.setDescription(description);
}
- if (style != null) {
- // Since 2.1, the "state" and "pulldown" attributes means something different
- // when the new "style" attribute has been set. See doc for more info.
- String state = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_STATE);
- if (state != null) {
- if (style.equals(STYLE_RADIO) || style.equals(STYLE_TOGGLE)) {
+ if (style != null) {
+ // Since 2.1, the "state" and "pulldown" attributes means something different
+ // when the new "style" attribute has been set. See doc for more info.
+ String state = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_STATE);
+ if (state != null) {
+ if (style.equals(STYLE_RADIO) || style.equals(STYLE_TOGGLE)) {
action.setChecked(state.equals("true"));//$NON-NLS-1$
}
- }
- } else {
- // Keep for backward compatibility for actions not using the
- // new style attribute.
- String state = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_STATE);
- if (state != null) {
- action.setChecked(state.equals("true"));//$NON-NLS-1$
- }
- }
-
- String extendingPluginId = actionElement.getDeclaringExtension()
- .getContributor().getName();
-
- if (icon != null) {
- action.setImageDescriptor(AbstractUIPlugin
- .imageDescriptorFromPlugin(extendingPluginId, icon));
- }
- if (hoverIcon != null) {
- action.setHoverImageDescriptor(AbstractUIPlugin
- .imageDescriptorFromPlugin(extendingPluginId, hoverIcon));
- }
- if (disabledIcon != null) {
- action
- .setDisabledImageDescriptor(AbstractUIPlugin
- .imageDescriptorFromPlugin(extendingPluginId,
- disabledIcon));
- }
-
- if (accelerator != null) {
+ }
+ } else {
+ // Keep for backward compatibility for actions not using the
+ // new style attribute.
+ String state = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_STATE);
+ if (state != null) {
+ action.setChecked(state.equals("true"));//$NON-NLS-1$
+ }
+ }
+
+ String extendingPluginId = actionElement.getDeclaringExtension().getContributor().getName();
+
+ if (icon != null) {
+ action.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(extendingPluginId, icon));
+ }
+ if (hoverIcon != null) {
+ action.setHoverImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(extendingPluginId, hoverIcon));
+ }
+ if (disabledIcon != null) {
+ action.setDisabledImageDescriptor(
+ AbstractUIPlugin.imageDescriptorFromPlugin(extendingPluginId, disabledIcon));
+ }
+
+ if (accelerator != null) {
processAccelerator(action, accelerator);
}
- }
-
- /**
- * Creates an instance of PluginAction. Depending on the target part,
- * subclasses of this class may be created.
- */
- private PluginAction createAction(int targetType,
- IConfigurationElement actionElement, Object target, String style) {
- int actionStyle = IAction.AS_UNSPECIFIED;
- if (style != null) {
- if (style.equals(STYLE_RADIO)) {
- actionStyle = IAction.AS_RADIO_BUTTON;
- } else if (style.equals(STYLE_TOGGLE)) {
- actionStyle = IAction.AS_CHECK_BOX;
- } else if (style.equals(STYLE_PULLDOWN)) {
- actionStyle = IAction.AS_DROP_DOWN_MENU;
- } else if (style.equals(STYLE_PUSH)) {
- actionStyle = IAction.AS_PUSH_BUTTON;
- }
- }
-
- switch (targetType) {
- case T_VIEW:
- return new ViewPluginAction(actionElement, (IViewPart) target, id,
- actionStyle);
- case T_EDITOR:
- return new EditorPluginAction(actionElement, (IEditorPart) target,
- id, actionStyle);
- case T_WORKBENCH:
- return new WWinPluginAction(actionElement,
- (IWorkbenchWindow) target, id, actionStyle);
- case T_WORKBENCH_PULLDOWN:
- actionStyle = IAction.AS_DROP_DOWN_MENU;
- return new WWinPluginPulldown(actionElement,
- (IWorkbenchWindow) target, id, actionStyle);
- case T_POPUP:
- return new ObjectPluginAction(actionElement, id, actionStyle);
- default:
- WorkbenchPlugin.log("Unknown Action Type: " + targetType);//$NON-NLS-1$
- return null;
- }
- }
-
- /**
- * Returns the action object held in this descriptor.
- *
- * @return the action
- */
- public PluginAction getAction() {
- return action;
- }
-
- /**
- * Returns action's id as defined in the registry.
- *
- * @return the id
- */
- public String getId() {
- return id;
- }
-
- /**
- * Returns named slot (group) in the menu where this action
- * should be added.
- *
- * @return the menu group
- */
- public String getMenuGroup() {
- return menuGroup;
- }
-
- /**
- * Returns menu path where this action should be added. If null,
- * the action will not be added into the menu.
- *
- * @return the menubar path
- */
- public String getMenuPath() {
- return menuPath;
- }
-
- /**
- * Returns the named slot (group) in the tool bar where this
- * action should be added.
- *
- * @return the toolbar group id
- */
- public String getToolbarGroupId() {
- return toolbarGroupId;
- }
-
- /**
- * Returns id of the tool bar where this action should be added.
- * If null, action will not be added to the tool bar.
- *
- * @return the toolbar id
- */
- public String getToolbarId() {
- return toolbarId;
- }
-
- /**
- * For debugging only.
- */
- @Override
+ }
+
+ /**
+ * Creates an instance of PluginAction. Depending on the target part, subclasses
+ * of this class may be created.
+ */
+ private PluginAction createAction(int targetType, IConfigurationElement actionElement, Object target,
+ String style) {
+ int actionStyle = IAction.AS_UNSPECIFIED;
+ if (style != null) {
+ if (style.equals(STYLE_RADIO)) {
+ actionStyle = IAction.AS_RADIO_BUTTON;
+ } else if (style.equals(STYLE_TOGGLE)) {
+ actionStyle = IAction.AS_CHECK_BOX;
+ } else if (style.equals(STYLE_PULLDOWN)) {
+ actionStyle = IAction.AS_DROP_DOWN_MENU;
+ } else if (style.equals(STYLE_PUSH)) {
+ actionStyle = IAction.AS_PUSH_BUTTON;
+ }
+ }
+
+ switch (targetType) {
+ case T_VIEW:
+ return new ViewPluginAction(actionElement, (IViewPart) target, id, actionStyle);
+ case T_EDITOR:
+ return new EditorPluginAction(actionElement, (IEditorPart) target, id, actionStyle);
+ case T_WORKBENCH:
+ return new WWinPluginAction(actionElement, (IWorkbenchWindow) target, id, actionStyle);
+ case T_WORKBENCH_PULLDOWN:
+ actionStyle = IAction.AS_DROP_DOWN_MENU;
+ return new WWinPluginPulldown(actionElement, (IWorkbenchWindow) target, id, actionStyle);
+ case T_POPUP:
+ return new ObjectPluginAction(actionElement, id, actionStyle);
+ default:
+ WorkbenchPlugin.log("Unknown Action Type: " + targetType);//$NON-NLS-1$
+ return null;
+ }
+ }
+
+ /**
+ * Returns the action object held in this descriptor.
+ *
+ * @return the action
+ */
+ public PluginAction getAction() {
+ return action;
+ }
+
+ /**
+ * Returns action's id as defined in the registry.
+ *
+ * @return the id
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Returns named slot (group) in the menu where this action should be added.
+ *
+ * @return the menu group
+ */
+ public String getMenuGroup() {
+ return menuGroup;
+ }
+
+ /**
+ * Returns menu path where this action should be added. If null, the action will
+ * not be added into the menu.
+ *
+ * @return the menubar path
+ */
+ public String getMenuPath() {
+ return menuPath;
+ }
+
+ /**
+ * Returns the named slot (group) in the tool bar where this action should be
+ * added.
+ *
+ * @return the toolbar group id
+ */
+ public String getToolbarGroupId() {
+ return toolbarGroupId;
+ }
+
+ /**
+ * Returns id of the tool bar where this action should be added. If null, action
+ * will not be added to the tool bar.
+ *
+ * @return the toolbar id
+ */
+ public String getToolbarId() {
+ return toolbarId;
+ }
+
+ /**
+ * For debugging only.
+ */
+ @Override
public String toString() {
- return "ActionDescriptor(" + id + ")";//$NON-NLS-2$//$NON-NLS-1$
- }
+ return "ActionDescriptor(" + id + ")";//$NON-NLS-2$//$NON-NLS-1$
+ }
- /**
- * Process the accelerator definition. If it is a number
- * then process the code directly - if not then parse it
- * and create the code
- */
- private void processAccelerator(IAction action, String acceleratorText) {
+ /**
+ * Process the accelerator definition. If it is a number then process the code
+ * directly - if not then parse it and create the code
+ */
+ private void processAccelerator(IAction action, String acceleratorText) {
- if (acceleratorText.length() == 0) {
+ if (acceleratorText.length() == 0) {
return;
}
- //Is it a numeric definition?
- if (Character.isDigit(acceleratorText.charAt(0))) {
- try {
- action.setAccelerator(Integer.valueOf(acceleratorText)
- .intValue());
- } catch (NumberFormatException e) {
- WorkbenchPlugin.log("Invalid accelerator declaration for action: " + id, e); //$NON-NLS-1$
- }
- } else {
+ // Is it a numeric definition?
+ if (Character.isDigit(acceleratorText.charAt(0))) {
+ try {
+ action.setAccelerator(Integer.valueOf(acceleratorText).intValue());
+ } catch (NumberFormatException e) {
+ WorkbenchPlugin.log("Invalid accelerator declaration for action: " + id, e); //$NON-NLS-1$
+ }
+ } else {
action.setAccelerator(Action.convertAccelerator(acceleratorText));
}
- }
+ }
- @Override
+ @Override
public String getLocalId() {
- return getId();
- }
+ return getId();
+ }
- @Override
+ @Override
public String getPluginId() {
- return pluginId;
- }
+ return pluginId;
+ }
- public int getMode() {
- return mode;
- }
+ public int getMode() {
+ return mode;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionExpression.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionExpression.java
index d6b61c36a68..cd80d166b58 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionExpression.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionExpression.java
@@ -36,22 +36,20 @@ public class ActionExpression {
private static abstract class AbstractExpression {
/**
- * The hash code for this object. This value is computed lazily, and
- * marked as invalid when one of the values on which it is based
- * changes.
+ * The hash code for this object. This value is computed lazily, and marked as
+ * invalid when one of the values on which it is based changes.
*/
protected transient int expressionHashCode = HASH_CODE_NOT_COMPUTED;
/**
- * Extract the object class tests from the expression. This allows
- * clients (e.g. the decorator manager) to handle object class testing
- * in a more optimized way. This method extracts the objectClass test
- * from the expression and returns the object classes. The expression is
- * not changed and a <code>null</code> is returned if no object class
- * is found.
+ * Extract the object class tests from the expression. This allows clients (e.g.
+ * the decorator manager) to handle object class testing in a more optimized
+ * way. This method extracts the objectClass test from the expression and
+ * returns the object classes. The expression is not changed and a
+ * <code>null</code> is returned if no object class is found.
*
- * @return String[] the object class names or <code>null</code> if
- * none was found.
+ * @return String[] the object class names or <code>null</code> if none was
+ * found.
*/
public String[] extractObjectClasses() {
return null;
@@ -60,39 +58,34 @@ public class ActionExpression {
/**
* Returns whether the expression is valid for the given object.
*
- * @param object
- * the object to validate against (can be <code>null</code>)
+ * @param object the object to validate against (can be <code>null</code>)
* @return boolean whether the expression is valid for the object.
*/
public abstract boolean isEnabledFor(Object object);
/**
- * Returns whether or not the receiver is potentially valid for the
- * object via just the extension type. Currently the only supported
- * expression type is <code>EXP_TYPE_OBJECT_CLASS</code>.
+ * Returns whether or not the receiver is potentially valid for the object via
+ * just the extension type. Currently the only supported expression type is
+ * <code>EXP_TYPE_OBJECT_CLASS</code>.
*
- * @param object
- * the object to validate against (can be <code>null</code>)
- * @param expressionType
- * the expression type to consider
- * @return boolean whether the expression is potentially valid for the
- * object.
+ * @param object the object to validate against (can be
+ * <code>null</code>)
+ * @param expressionType the expression type to consider
+ * @return boolean whether the expression is potentially valid for the object.
*/
- public boolean isEnabledForExpression(Object object,
- String expressionType) {
+ public boolean isEnabledForExpression(Object object, String expressionType) {
return false;
}
/**
- * Return the value of the expression type that the receiver is enabled
- * for. If the receiver is not enabled for the expressionType then
- * return <code>null</code>.
+ * Return the value of the expression type that the receiver is enabled for. If
+ * the receiver is not enabled for the expressionType then return
+ * <code>null</code>.
*
- * @param expressionType
- * the expression type to consider
- * @return Collection of String if there are values for this expression
- * or <code>null</code> if this is not possible in the
- * receiver or any of it's children
+ * @param expressionType the expression type to consider
+ * @return Collection of String if there are values for this expression or
+ * <code>null</code> if this is not possible in the receiver or any of
+ * it's children
*/
public Collection valuesForExpression(String expressionType) {
return null;
@@ -102,17 +95,15 @@ public class ActionExpression {
private static class AndExpression extends CompositeExpression {
/**
- * Creates and populates the expression from the attributes and sub-
- * elements of the configuration element.
+ * Creates and populates the expression from the attributes and sub- elements of
+ * the configuration element.
*
- * @param element
- * The element that will be used to determine the expressions
- * for And.
- * @throws IllegalStateException
- * if the expression tag is not defined in the schema.
+ * @param element The element that will be used to determine the expressions for
+ * And.
+ * @throws IllegalStateException if the expression tag is not defined in the
+ * schema.
*/
- public AndExpression(IConfigurationElement element)
- throws IllegalStateException {
+ public AndExpression(IConfigurationElement element) throws IllegalStateException {
super(element);
}
@@ -139,30 +130,26 @@ public class ActionExpression {
}
}
- private static abstract class CompositeExpression extends
- AbstractExpression {
+ private static abstract class CompositeExpression extends AbstractExpression {
/**
*
*/
protected ArrayList list;
/**
- * Creates and populates the expression from the attributes and sub-
- * elements of the configuration element.
+ * Creates and populates the expression from the attributes and sub- elements of
+ * the configuration element.
*
- * @param element
- * The composite element we will create the expression from.
- * @throws IllegalStateException
- * if the expression tag is not defined in the schema.
+ * @param element The composite element we will create the expression from.
+ * @throws IllegalStateException if the expression tag is not defined in the
+ * schema.
*/
- public CompositeExpression(IConfigurationElement element)
- throws IllegalStateException {
+ public CompositeExpression(IConfigurationElement element) throws IllegalStateException {
super();
IConfigurationElement[] children = element.getChildren();
if (children.length == 0) {
- throw new IllegalStateException(
- "Composite expression cannot be empty"); //$NON-NLS-1$
+ throw new IllegalStateException("Composite expression cannot be empty"); //$NON-NLS-1$
}
list = new ArrayList(children.length);
@@ -219,8 +206,7 @@ public class ActionExpression {
}
@Override
- public boolean isEnabledForExpression(Object object,
- String expressionType) {
+ public boolean isEnabledForExpression(Object object, String expressionType) {
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
AbstractExpression next = (AbstractExpression) iterator.next();
@@ -254,17 +240,15 @@ public class ActionExpression {
private static class NotExpression extends SingleExpression {
/**
- * Creates and populates the expression from the attributes and sub-
- * elements of the configuration element.
+ * Creates and populates the expression from the attributes and sub- elements of
+ * the configuration element.
*
- * @param element
- * The element that will be used to create the definition for
- * the receiver.
- * @throws IllegalStateException
- * if the expression tag is not defined in the schema.
+ * @param element The element that will be used to create the definition for the
+ * receiver.
+ * @throws IllegalStateException if the expression tag is not defined in the
+ * schema.
*/
- public NotExpression(IConfigurationElement element)
- throws IllegalStateException {
+ public NotExpression(IConfigurationElement element) throws IllegalStateException {
super(element);
}
@@ -280,29 +264,26 @@ public class ActionExpression {
private boolean extracted;
/**
- * Creates and populates the expression from the attributes and sub-
- * elements of the configuration element.
+ * Creates and populates the expression from the attributes and sub- elements of
+ * the configuration element.
*
- * @param element
- * The element that will be used to determine the expressions
- * for objectClass.
- * @throws IllegalStateException
- * if the expression tag is not defined in the schema.
+ * @param element The element that will be used to determine the expressions for
+ * objectClass.
+ * @throws IllegalStateException if the expression tag is not defined in the
+ * schema.
*/
- public ObjectClassExpression(IConfigurationElement element)
- throws IllegalStateException {
+ public ObjectClassExpression(IConfigurationElement element) throws IllegalStateException {
super();
className = element.getAttribute(ATT_NAME);
if (className == null) {
- throw new IllegalStateException(
- "Object class expression missing name attribute"); //$NON-NLS-1$
+ throw new IllegalStateException("Object class expression missing name attribute"); //$NON-NLS-1$
}
}
/**
- * Create an ObjectClass expression based on the className. Added for
- * backwards compatibility.
+ * Create an ObjectClass expression based on the className. Added for backwards
+ * compatibility.
*
* @param className
*/
@@ -312,19 +293,17 @@ public class ActionExpression {
if (className != null) {
this.className = className;
} else {
- throw new IllegalStateException(
- "Object class expression must have class name"); //$NON-NLS-1$
+ throw new IllegalStateException("Object class expression must have class name"); //$NON-NLS-1$
}
}
/**
- * Check the interfaces the whole way up. If one of them matches
- * className return <code>true</code>.
+ * Check the interfaces the whole way up. If one of them matches className
+ * return <code>true</code>.
*
- * @param interfaceToCheck
- * The interface whose name we are testing against.
- * @return <code>true</code> if one of the interfaces in the hierarchy
- * matches className, <code>false</code> otherwise.
+ * @param interfaceToCheck The interface whose name we are testing against.
+ * @return <code>true</code> if one of the interfaces in the hierarchy matches
+ * className, <code>false</code> otherwise.
*/
private boolean checkInterfaceHierarchy(Class interfaceToCheck) {
if (interfaceToCheck.getName().equals(className)) {
@@ -343,8 +322,7 @@ public class ActionExpression {
public final boolean equals(final Object object) {
if (object instanceof ObjectClassExpression) {
final ObjectClassExpression that = (ObjectClassExpression) object;
- return Util.equals(this.className, that.className)
- && Util.equals(this.extracted, that.extracted);
+ return Util.equals(this.className, that.className) && Util.equals(this.extracted, that.extracted);
}
return false;
@@ -364,8 +342,7 @@ public class ActionExpression {
@Override
public final int hashCode() {
if (expressionHashCode == HASH_CODE_NOT_COMPUTED) {
- expressionHashCode = HASH_INITIAL * HASH_FACTOR
- + Util.hashCode(className);
+ expressionHashCode = HASH_INITIAL * HASH_FACTOR + Util.hashCode(className);
expressionHashCode = expressionHashCode * HASH_FACTOR + Util.hashCode(extracted);
if (expressionHashCode == HASH_CODE_NOT_COMPUTED) {
expressionHashCode++;
@@ -406,8 +383,7 @@ public class ActionExpression {
}
@Override
- public boolean isEnabledForExpression(Object object,
- String expressionType) {
+ public boolean isEnabledForExpression(Object object, String expressionType) {
if (expressionType.equals(EXP_TYPE_OBJECT_CLASS)) {
return isEnabledFor(object);
}
@@ -421,24 +397,21 @@ public class ActionExpression {
private String value;
/**
- * Creates and populates the expression from the attributes and sub-
- * elements of the configuration element.
+ * Creates and populates the expression from the attributes and sub- elements of
+ * the configuration element.
*
- * @param element
- * The element that will be used to determine the expressions
- * for objectState.
- * @throws IllegalStateException
- * if the expression tag is not defined in the schema.
+ * @param element The element that will be used to determine the expressions for
+ * objectState.
+ * @throws IllegalStateException if the expression tag is not defined in the
+ * schema.
*/
- public ObjectStateExpression(IConfigurationElement element)
- throws IllegalStateException {
+ public ObjectStateExpression(IConfigurationElement element) throws IllegalStateException {
super();
name = element.getAttribute(ATT_NAME);
value = element.getAttribute(ATT_VALUE);
if (name == null || value == null) {
- throw new IllegalStateException(
- "Object state expression missing attribute"); //$NON-NLS-1$
+ throw new IllegalStateException("Object state expression missing attribute"); //$NON-NLS-1$
}
}
@@ -446,8 +419,7 @@ public class ActionExpression {
public final boolean equals(final Object object) {
if (object instanceof ObjectStateExpression) {
final ObjectStateExpression that = (ObjectStateExpression) object;
- return Util.equals(this.name, that.name)
- && Util.equals(this.value, that.value);
+ return Util.equals(this.name, that.name) && Util.equals(this.value, that.value);
}
return false;
@@ -530,17 +502,15 @@ public class ActionExpression {
private static class OrExpression extends CompositeExpression {
/**
- * Creates and populates the expression from the attributes and sub-
- * elements of the configuration element.
+ * Creates and populates the expression from the attributes and sub- elements of
+ * the configuration element.
*
- * @param element
- * The element that will be used to determine the expressions
- * for Or.
- * @throws IllegalStateException
- * if the expression tag is not defined in the schema.
+ * @param element The element that will be used to determine the expressions for
+ * Or.
+ * @throws IllegalStateException if the expression tag is not defined in the
+ * schema.
*/
- public OrExpression(IConfigurationElement element)
- throws IllegalStateException {
+ public OrExpression(IConfigurationElement element) throws IllegalStateException {
super(element);
}
@@ -573,24 +543,21 @@ public class ActionExpression {
private String value;
/**
- * Creates and populates the expression from the attributes and sub-
- * elements of the configuration element.
+ * Creates and populates the expression from the attributes and sub- elements of
+ * the configuration element.
*
- * @param element
- * The element that will be used to determine the expressions
- * for pluginState.
- * @throws IllegalStateException
- * if the expression tag is not defined in the schema.
+ * @param element The element that will be used to determine the expressions for
+ * pluginState.
+ * @throws IllegalStateException if the expression tag is not defined in the
+ * schema.
*/
- public PluginStateExpression(IConfigurationElement element)
- throws IllegalStateException {
+ public PluginStateExpression(IConfigurationElement element) throws IllegalStateException {
super();
id = element.getAttribute(ATT_ID);
value = element.getAttribute(ATT_VALUE);
if (id == null || value == null) {
- throw new IllegalStateException(
- "Plugin state expression missing attribute"); //$NON-NLS-1$
+ throw new IllegalStateException("Plugin state expression missing attribute"); //$NON-NLS-1$
}
}
@@ -598,8 +565,7 @@ public class ActionExpression {
public final boolean equals(final Object object) {
if (object instanceof PluginStateExpression) {
final PluginStateExpression that = (PluginStateExpression) object;
- return Util.equals(this.id, that.id)
- && Util.equals(this.value, that.value);
+ return Util.equals(this.id, that.id) && Util.equals(this.value, that.value);
}
return false;
@@ -644,41 +610,35 @@ public class ActionExpression {
/**
* Create a single expression from the abstract definition.
*
- * @param expression
- * The expression that will be the child of the new single
- * expression.
- * @throws IllegalStateException
- * if the expression tag is not defined in the schema.
+ * @param expression The expression that will be the child of the new single
+ * expression.
+ * @throws IllegalStateException if the expression tag is not defined in the
+ * schema.
*/
- public SingleExpression(AbstractExpression expression)
- throws IllegalStateException {
+ public SingleExpression(AbstractExpression expression) throws IllegalStateException {
super();
if (expression != null) {
child = expression;
} else {
- throw new IllegalStateException(
- "Single expression must contain 1 expression"); //$NON-NLS-1$
+ throw new IllegalStateException("Single expression must contain 1 expression"); //$NON-NLS-1$
}
}
/**
- * Creates and populates the expression from the attributes and sub-
- * elements of the configuration element.
+ * Creates and populates the expression from the attributes and sub- elements of
+ * the configuration element.
*
- * @param element
- * The element to create the expression from.
- * @throws IllegalStateException
- * if the expression tag is not defined in the schema.
+ * @param element The element to create the expression from.
+ * @throws IllegalStateException if the expression tag is not defined in the
+ * schema.
*/
- public SingleExpression(IConfigurationElement element)
- throws IllegalStateException {
+ public SingleExpression(IConfigurationElement element) throws IllegalStateException {
super();
IConfigurationElement[] children = element.getChildren();
if (children.length != 1) {
- throw new IllegalStateException(
- "Single expression does not contain only 1 expression"); //$NON-NLS-1$
+ throw new IllegalStateException("Single expression does not contain only 1 expression"); //$NON-NLS-1$
}
child = createExpression(children[0]);
}
@@ -720,8 +680,7 @@ public class ActionExpression {
}
@Override
- public boolean isEnabledForExpression(Object object,
- String expressionType) {
+ public boolean isEnabledForExpression(Object object, String expressionType) {
return child.isEnabledForExpression(object, expressionType);
}
@@ -738,24 +697,21 @@ public class ActionExpression {
private String value;
/**
- * Creates and populates the expression from the attributes and sub-
- * elements of the configuration element.
+ * Creates and populates the expression from the attributes and sub- elements of
+ * the configuration element.
*
- * @param element
- * The element that will be used to determine the expressions
- * for systemProperty.
- * @throws IllegalStateException
- * if the expression tag is not defined in the schema.
+ * @param element The element that will be used to determine the expressions for
+ * systemProperty.
+ * @throws IllegalStateException if the expression tag is not defined in the
+ * schema.
*/
- public SystemPropertyExpression(IConfigurationElement element)
- throws IllegalStateException {
+ public SystemPropertyExpression(IConfigurationElement element) throws IllegalStateException {
super();
name = element.getAttribute(ATT_NAME);
value = element.getAttribute(ATT_VALUE);
if (name == null || value == null) {
- throw new IllegalStateException(
- "System property expression missing attribute"); //$NON-NLS-1$
+ throw new IllegalStateException("System property expression missing attribute"); //$NON-NLS-1$
}
}
@@ -772,8 +728,7 @@ public class ActionExpression {
public final boolean equals(final Object object) {
if (object instanceof SystemPropertyExpression) {
final SystemPropertyExpression that = (SystemPropertyExpression) object;
- return Util.equals(this.name, that.name)
- && Util.equals(this.value, that.value);
+ return Util.equals(this.name, that.name) && Util.equals(this.value, that.value);
}
return false;
@@ -846,8 +801,8 @@ public class ActionExpression {
public static final String EXP_TYPE_SYSTEM_PROPERTY = "systemProperty"; //$NON-NLS-1$
/**
- * The constant integer hash code value meaning the hash code has not yet
- * been computed.
+ * The constant integer hash code value meaning the hash code has not yet been
+ * computed.
*/
private static final int HASH_CODE_NOT_COMPUTED = -1;
@@ -859,8 +814,7 @@ public class ActionExpression {
/**
* The seed for the hash code for all schemes.
*/
- private static final int HASH_INITIAL = ActionExpression.class.getName()
- .hashCode();
+ private static final int HASH_INITIAL = ActionExpression.class.getName().hashCode();
private static final String PLUGIN_ACTIVATED = "activated"; //$NON-NLS-1$
@@ -870,15 +824,13 @@ public class ActionExpression {
* Create an expression from the attributes and sub-elements of the
* configuration element.
*
- * @param element
- * The IConfigurationElement with a tag defined in the public
- * constants.
+ * @param element The IConfigurationElement with a tag defined in the public
+ * constants.
* @return AbstractExpression based on the definition
- * @throws IllegalStateException
- * if the expression tag is not defined in the schema.
+ * @throws IllegalStateException if the expression tag is not defined in the
+ * schema.
*/
- private static AbstractExpression createExpression(
- IConfigurationElement element) throws IllegalStateException {
+ private static AbstractExpression createExpression(IConfigurationElement element) throws IllegalStateException {
String tag = element.getName();
if (tag.equals(EXP_TYPE_OR)) {
return new OrExpression(element);
@@ -902,13 +854,12 @@ public class ActionExpression {
return new SystemPropertyExpression(element);
}
- throw new IllegalStateException(
- "Action expression unrecognized element: " + tag); //$NON-NLS-1$
+ throw new IllegalStateException("Action expression unrecognized element: " + tag); //$NON-NLS-1$
}
/**
- * The hash code for this object. This value is computed lazily, and marked
- * as invalid when one of the values on which it is based changes.
+ * The hash code for this object. This value is computed lazily, and marked as
+ * invalid when one of the values on which it is based changes.
*/
private transient int hashCode = HASH_CODE_NOT_COMPUTED;
@@ -917,8 +868,7 @@ public class ActionExpression {
/**
* Creates an action expression for the given configuration element.
*
- * @param element
- * The element to build the expression from.
+ * @param element The element to build the expression from.
*/
public ActionExpression(IConfigurationElement element) {
try {
@@ -930,19 +880,18 @@ public class ActionExpression {
}
/**
- * Create an instance of the receiver with the given expression type and
- * value. Currently the only supported expression type is
+ * Create an instance of the receiver with the given expression type and value.
+ * Currently the only supported expression type is
* <code>EXP_TYPE_OBJECT_CLASS</code>.
*
- * @param expressionType
- * The expression constant we are creating an instance of.
- * @param expressionValue
- * The name of the class we are creating an expression for.
+ * @param expressionType The expression constant we are creating an instance
+ * of.
+ * @param expressionValue The name of the class we are creating an expression
+ * for.
*/
public ActionExpression(String expressionType, String expressionValue) {
if (expressionType.equals(EXP_TYPE_OBJECT_CLASS)) {
- root = new SingleExpression(new ObjectClassExpression(
- expressionValue));
+ root = new SingleExpression(new ObjectClassExpression(expressionValue));
}
}
@@ -957,11 +906,11 @@ public class ActionExpression {
}
/**
- * Extract the object class test from the expression. This allows clients
- * (e.g. the decorator manager) to handle object class testing in a more
- * optimized way. This method removes the objectClass test from the
- * expression and returns the object class. The expression is not changed
- * and a <code>null</code> is returned if no object class is found.
+ * Extract the object class test from the expression. This allows clients (e.g.
+ * the decorator manager) to handle object class testing in a more optimized
+ * way. This method removes the objectClass test from the expression and returns
+ * the object class. The expression is not changed and a <code>null</code> is
+ * returned if no object class is found.
*
* @return the object class or <code>null</code> if none was found.
*/
@@ -989,8 +938,7 @@ public class ActionExpression {
* Returns whether the expression is valid for all elements of the given
* selection.
*
- * @param selection
- * the structured selection to use
+ * @param selection the structured selection to use
* @return boolean whether the expression is valid for the selection.
*/
public boolean isEnabledFor(IStructuredSelection selection) {
@@ -1014,8 +962,7 @@ public class ActionExpression {
/**
* Returns whether the expression is valid for the given object.
*
- * @param object
- * the object to validate against (can be <code>null</code>)
+ * @param object the object to validate against (can be <code>null</code>)
* @return boolean whether the expression is valid for the object.
*/
public boolean isEnabledFor(Object object) {
@@ -1026,16 +973,14 @@ public class ActionExpression {
}
/**
- * Returns whether or not the receiver is potentially valid for the object
- * via just the extension type. Currently the only supported expression type
- * is <code>EXP_TYPE_OBJECT_CLASS</code>.
+ * Returns whether or not the receiver is potentially valid for the object via
+ * just the extension type. Currently the only supported expression type is
+ * <code>EXP_TYPE_OBJECT_CLASS</code>.
*
- * @param object
- * the object to validate against (can be <code>null</code>)
- * @param expressionType
- * the expression type to consider
- * @return boolean whether the expression is potentially valid for the
- * object.
+ * @param object the object to validate against (can be
+ * <code>null</code>)
+ * @param expressionType the expression type to consider
+ * @return boolean whether the expression is potentially valid for the object.
*/
public boolean isEnabledForExpression(Object object, String expressionType) {
if (root == null) {
@@ -1045,15 +990,14 @@ public class ActionExpression {
}
/**
- * Return the values of the expression type that the receiver is enabled
- * for. If the receiver is not enabled for the expressionType then return
+ * Return the values of the expression type that the receiver is enabled for. If
+ * the receiver is not enabled for the expressionType then return
* <code>null</code>.
*
- * @param expressionType
- * the expression type to consider
+ * @param expressionType the expression type to consider
* @return Collection if there are values for this expression or
- * <code>null</code> if this is not possible in the receiver or
- * any of it's children
+ * <code>null</code> if this is not possible in the receiver or any of
+ * it's children
*/
public Collection valuesForExpression(String expressionType) {
return root.valuesForExpression(expressionType);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionPresentation.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionPresentation.java
index 72976c0b259..9696f178834 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionPresentation.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionPresentation.java
@@ -30,191 +30,183 @@ import org.eclipse.ui.internal.registry.IActionSetDescriptor;
* Manage the configurable actions for one window.
*/
public class ActionPresentation {
- private WorkbenchWindow window;
+ private WorkbenchWindow window;
- private HashMap mapDescToRec = new HashMap(3);
+ private HashMap mapDescToRec = new HashMap(3);
- private HashMap invisibleBars = new HashMap(3);
+ private HashMap invisibleBars = new HashMap(3);
private static class SetRec {
- public SetRec(IActionSet set,
- SubActionBars bars) {
- this.set = set;
- this.bars = bars;
- }
-
- public IActionSet set;
-
- public SubActionBars bars;
- }
-
- /**
- * ActionPresentation constructor comment.
- */
- public ActionPresentation(WorkbenchWindow window) {
- super();
- this.window = window;
- }
-
- /**
- * Remove all action sets.
- */
- public void clearActionSets() {
- // Get all of the action sets -- both visible and invisible.
- final List oldList = new ArrayList();
- oldList.addAll(mapDescToRec.keySet());
- oldList.addAll(invisibleBars.keySet());
-
- Iterator iter = oldList.iterator();
- while (iter.hasNext()) {
- IActionSetDescriptor desc = (IActionSetDescriptor) iter.next();
- removeActionSet(desc);
- }
- }
-
- /**
- * Destroy an action set.
- */
- public void removeActionSet(IActionSetDescriptor desc) {
- SetRec rec = (SetRec) mapDescToRec.remove(desc);
- if (rec == null) {
- rec = (SetRec) invisibleBars.remove(desc);
- }
- if (rec != null) {
- IActionSet set = rec.set;
- SubActionBars bars = rec.bars;
- if (bars != null) {
- bars.dispose();
- }
- if (set != null) {
- set.dispose();
- }
- }
- }
-
- /**
- * Sets the list of visible action set.
- */
- public void setActionSets(IActionSetDescriptor[] newArray) {
- // Convert array to list.
- HashSet newList = new HashSet();
-
- for (IActionSetDescriptor descriptor : newArray) {
- newList.add(descriptor);
- }
- List oldList = new ArrayList(mapDescToRec.keySet());
-
- // Remove obsolete actions.
- Iterator iter = oldList.iterator();
- while (iter.hasNext()) {
- IActionSetDescriptor desc = (IActionSetDescriptor) iter.next();
- if (!newList.contains(desc)) {
- SetRec rec = (SetRec) mapDescToRec.get(desc);
- if (rec != null) {
- mapDescToRec.remove(desc);
- IActionSet set = rec.set;
- SubActionBars bars = rec.bars;
- if (bars != null) {
- SetRec invisibleRec = new SetRec(set, bars);
- invisibleBars.put(desc, invisibleRec);
- bars.deactivate();
- }
- }
- }
- }
-
- // Add new actions.
- ArrayList sets = new ArrayList();
+ public SetRec(IActionSet set, SubActionBars bars) {
+ this.set = set;
+ this.bars = bars;
+ }
+
+ public IActionSet set;
+
+ public SubActionBars bars;
+ }
+
+ /**
+ * ActionPresentation constructor comment.
+ */
+ public ActionPresentation(WorkbenchWindow window) {
+ super();
+ this.window = window;
+ }
+
+ /**
+ * Remove all action sets.
+ */
+ public void clearActionSets() {
+ // Get all of the action sets -- both visible and invisible.
+ final List oldList = new ArrayList();
+ oldList.addAll(mapDescToRec.keySet());
+ oldList.addAll(invisibleBars.keySet());
+
+ Iterator iter = oldList.iterator();
+ while (iter.hasNext()) {
+ IActionSetDescriptor desc = (IActionSetDescriptor) iter.next();
+ removeActionSet(desc);
+ }
+ }
+
+ /**
+ * Destroy an action set.
+ */
+ public void removeActionSet(IActionSetDescriptor desc) {
+ SetRec rec = (SetRec) mapDescToRec.remove(desc);
+ if (rec == null) {
+ rec = (SetRec) invisibleBars.remove(desc);
+ }
+ if (rec != null) {
+ IActionSet set = rec.set;
+ SubActionBars bars = rec.bars;
+ if (bars != null) {
+ bars.dispose();
+ }
+ if (set != null) {
+ set.dispose();
+ }
+ }
+ }
+
+ /**
+ * Sets the list of visible action set.
+ */
+ public void setActionSets(IActionSetDescriptor[] newArray) {
+ // Convert array to list.
+ HashSet newList = new HashSet();
+
+ for (IActionSetDescriptor descriptor : newArray) {
+ newList.add(descriptor);
+ }
+ List oldList = new ArrayList(mapDescToRec.keySet());
+
+ // Remove obsolete actions.
+ Iterator iter = oldList.iterator();
+ while (iter.hasNext()) {
+ IActionSetDescriptor desc = (IActionSetDescriptor) iter.next();
+ if (!newList.contains(desc)) {
+ SetRec rec = (SetRec) mapDescToRec.get(desc);
+ if (rec != null) {
+ mapDescToRec.remove(desc);
+ IActionSet set = rec.set;
+ SubActionBars bars = rec.bars;
+ if (bars != null) {
+ SetRec invisibleRec = new SetRec(set, bars);
+ invisibleBars.put(desc, invisibleRec);
+ bars.deactivate();
+ }
+ }
+ }
+ }
+
+ // Add new actions.
+ ArrayList sets = new ArrayList();
for (IActionSetDescriptor desc : newArray) {
- if (!mapDescToRec.containsKey(desc)) {
- try {
- SetRec rec;
- // If the action bars and sets have already been created
- // then
- // reuse those action sets
- if (invisibleBars.containsKey(desc)) {
- rec = (SetRec) invisibleBars.get(desc);
- if (rec.bars != null) {
- rec.bars.activate();
- }
- invisibleBars.remove(desc);
- } else {
- IActionSet set = desc.createActionSet();
- SubActionBars bars = new ActionSetActionBars(window
- .getActionBars(), window,
- (IActionBarConfigurer2) window.getWindowConfigurer()
- .getActionBarConfigurer(), desc.getId());
- rec = new SetRec(set, bars);
- set.init(window, bars);
- sets.add(set);
-
- // only register against the tracker once - check for
- // other registrations against the provided extension
- Object[] existingRegistrations = window
- .getExtensionTracker().getObjects(
- desc.getConfigurationElement()
- .getDeclaringExtension());
- if (existingRegistrations.length == 0
- || !containsRegistration(existingRegistrations,
- desc)) {
- //register the set with the page tracker
- //this will be cleaned up by WorkbenchWindow listener
- window.getExtensionTracker().registerObject(
- desc.getConfigurationElement().getDeclaringExtension(),
- desc, IExtensionTracker.REF_WEAK);
- }
- }
- mapDescToRec.put(desc, rec);
- } catch (CoreException e) {
- WorkbenchPlugin
- .log("Unable to create ActionSet: " + desc.getId(), e);//$NON-NLS-1$
- }
- }
- }
- // We process action sets in two passes for coolbar purposes. First we
- // process base contributions
- // (i.e., actions that the action set contributes to its toolbar), then
- // we process adjunct contributions
- // (i.e., actions that the action set contributes to other toolbars).
- // This type of processing is
- // necessary in order to maintain group order within a coolitem.
- PluginActionSetBuilder.processActionSets(sets, window);
-
- iter = sets.iterator();
- while (iter.hasNext()) {
- PluginActionSet set = (PluginActionSet) iter.next();
- set.getBars().activate();
- }
- }
-
- /**
- * Return whether the array contains the given action set.
- *
- * @param existingRegistrations the array to check
- * @param set the set to look for
- * @return whether the set is in the array
- * @since 3.1
- */
- private boolean containsRegistration(Object[] existingRegistrations, IActionSetDescriptor set) {
- for (Object existingRegistration : existingRegistrations) {
- if (existingRegistration == set) {
+ if (!mapDescToRec.containsKey(desc)) {
+ try {
+ SetRec rec;
+ // If the action bars and sets have already been created
+ // then
+ // reuse those action sets
+ if (invisibleBars.containsKey(desc)) {
+ rec = (SetRec) invisibleBars.get(desc);
+ if (rec.bars != null) {
+ rec.bars.activate();
+ }
+ invisibleBars.remove(desc);
+ } else {
+ IActionSet set = desc.createActionSet();
+ SubActionBars bars = new ActionSetActionBars(window.getActionBars(), window,
+ (IActionBarConfigurer2) window.getWindowConfigurer().getActionBarConfigurer(),
+ desc.getId());
+ rec = new SetRec(set, bars);
+ set.init(window, bars);
+ sets.add(set);
+
+ // only register against the tracker once - check for
+ // other registrations against the provided extension
+ Object[] existingRegistrations = window.getExtensionTracker()
+ .getObjects(desc.getConfigurationElement().getDeclaringExtension());
+ if (existingRegistrations.length == 0 || !containsRegistration(existingRegistrations, desc)) {
+ // register the set with the page tracker
+ // this will be cleaned up by WorkbenchWindow listener
+ window.getExtensionTracker().registerObject(
+ desc.getConfigurationElement().getDeclaringExtension(), desc,
+ IExtensionTracker.REF_WEAK);
+ }
+ }
+ mapDescToRec.put(desc, rec);
+ } catch (CoreException e) {
+ WorkbenchPlugin.log("Unable to create ActionSet: " + desc.getId(), e);//$NON-NLS-1$
+ }
+ }
+ }
+ // We process action sets in two passes for coolbar purposes. First we
+ // process base contributions
+ // (i.e., actions that the action set contributes to its toolbar), then
+ // we process adjunct contributions
+ // (i.e., actions that the action set contributes to other toolbars).
+ // This type of processing is
+ // necessary in order to maintain group order within a coolitem.
+ PluginActionSetBuilder.processActionSets(sets, window);
+
+ iter = sets.iterator();
+ while (iter.hasNext()) {
+ PluginActionSet set = (PluginActionSet) iter.next();
+ set.getBars().activate();
+ }
+ }
+
+ /**
+ * Return whether the array contains the given action set.
+ *
+ * @param existingRegistrations the array to check
+ * @param set the set to look for
+ * @return whether the set is in the array
+ * @since 3.1
+ */
+ private boolean containsRegistration(Object[] existingRegistrations, IActionSetDescriptor set) {
+ for (Object existingRegistration : existingRegistrations) {
+ if (existingRegistration == set) {
return true;
}
- }
- return false;
- }
-
- /**
- */
- public IActionSet[] getActionSets() {
- Collection setRecCollection = mapDescToRec.values();
- IActionSet result[] = new IActionSet[setRecCollection.size()];
- int i = 0;
- for (Iterator iterator = setRecCollection.iterator(); iterator
- .hasNext(); i++) {
+ }
+ return false;
+ }
+
+ /**
+ */
+ public IActionSet[] getActionSets() {
+ Collection setRecCollection = mapDescToRec.values();
+ IActionSet result[] = new IActionSet[setRecCollection.size()];
+ int i = 0;
+ for (Iterator iterator = setRecCollection.iterator(); iterator.hasNext(); i++) {
result[i] = ((SetRec) iterator.next()).set;
}
- return result;
- }
+ return result;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetActionBars.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetActionBars.java
index 63a4c9b062f..c0b816b30db 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetActionBars.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetActionBars.java
@@ -46,21 +46,21 @@ public class ActionSetActionBars extends SubActionBars2 {
private IToolBarContributionItem toolBarContributionItem = null;
/**
- * Constructs a new action bars object
- */
- public ActionSetActionBars(IActionBars2 parent, IServiceLocator serviceLocator, IActionBarConfigurer2 actionBarConfigurer, String actionSetId) {
- super(parent, serviceLocator);
+ * Constructs a new action bars object
+ */
+ public ActionSetActionBars(IActionBars2 parent, IServiceLocator serviceLocator,
+ IActionBarConfigurer2 actionBarConfigurer, String actionSetId) {
+ super(parent, serviceLocator);
this.actionSetId = actionSetId;
- this.actionBarConfigurer = actionBarConfigurer;
- }
+ this.actionBarConfigurer = actionBarConfigurer;
+ }
/**
- * Adds to the list all the actions that are part of this action set but
- * belong to different cool bar items.
+ * Adds to the list all the actions that are part of this action set but belong
+ * to different cool bar items.
*
- * @param item
- * the item defined in this actionset but in a different tool Bar
- * contribution item
+ * @param item the item defined in this actionset but in a different tool Bar
+ * contribution item
*/
/* package */void addAdjunctContribution(IContributionItem item) {
adjunctContributions.add(item);
@@ -105,8 +105,7 @@ public class ActionSetActionBars extends SubActionBars2 {
// remove items from this action set that are in other action bars
for (int i = 0; i < adjunctContributions.size(); i++) {
- ContributionItem item = (ContributionItem) adjunctContributions
- .get(i);
+ ContributionItem item = (ContributionItem) adjunctContributions.get(i);
IContributionManager parent = item.getParent();
if (parent != null) {
parent.remove(item);
@@ -123,19 +122,14 @@ public class ActionSetActionBars extends SubActionBars2 {
* Returns the contribution item that the given contribution item should be
* inserted after.
*
- * @param startId
- * the location to start looking alphabetically.
- * @param itemId
- * the target item id.
- * @param mgr
- * the contribution manager.
- * @return the contribution item that the given items should be returned
- * after.
+ * @param startId the location to start looking alphabetically.
+ * @param itemId the target item id.
+ * @param mgr the contribution manager.
+ * @return the contribution item that the given items should be returned after.
*
* @since 3.0
*/
- private IContributionItem findAlphabeticalOrder(String startId,
- String itemId, IContributionManager mgr) {
+ private IContributionItem findAlphabeticalOrder(String startId, String itemId, IContributionManager mgr) {
IContributionItem[] items = mgr.getItems();
int insertIndex = 0;
@@ -186,16 +180,14 @@ public class ActionSetActionBars extends SubActionBars2 {
if (coolBarManager == null) {
return null;
}
- return actionBarConfigurer.createToolBarManager();
+ return actionBarConfigurer.createToolBarManager();
}
/**
- * Returns the correct tool bar for the given action id. If this action is
- * an adjunct type the it returns the toolbar manager from the cool bar
- * manager.
+ * Returns the correct tool bar for the given action id. If this action is an
+ * adjunct type the it returns the toolbar manager from the cool bar manager.
*
- * @param id
- * the id of the action
+ * @param id the id of the action
* @return the tool bar manager
*/
public IToolBarManager getToolBarManager(String actionId) {
@@ -244,21 +236,18 @@ public class ActionSetActionBars extends SubActionBars2 {
// we don't create one for an adjunct type because another action
// set action bars contains one
- IContributionItem toolBarContributionItem = actionBarConfigurer
- .createToolBarContributionItem(coolItemToolBarMgr,
- toolBarId);
+ IContributionItem toolBarContributionItem = actionBarConfigurer
+ .createToolBarContributionItem(coolItemToolBarMgr, toolBarId);
toolBarContributionItem.setParent(coolItemToolBarMgr);
toolBarContributionItem.setVisible(getActive());
coolItemToolBarMgr.markDirty();
// Now add the tool bar contribution Item to the cool bar manager
- IContributionItem refItem = findAlphabeticalOrder(
- IWorkbenchActionConstants.MB_ADDITIONS, toolBarId,
+ IContributionItem refItem = findAlphabeticalOrder(IWorkbenchActionConstants.MB_ADDITIONS, toolBarId,
coolBarManager);
if (refItem != null) {
- coolBarManager.insertAfter(refItem.getId(),
- toolBarContributionItem);
+ coolBarManager.insertAfter(refItem.getId(), toolBarContributionItem);
} else {
coolBarManager.add(toolBarContributionItem);
}
@@ -313,8 +302,7 @@ public class ActionSetActionBars extends SubActionBars2 {
IContributionItem item = (IContributionItem) i.next();
if (item instanceof ContributionItem) {
item.setVisible(set);
- IContributionManager manager = ((ContributionItem) item)
- .getParent();
+ IContributionManager manager = ((ContributionItem) item).getParent();
manager.markDirty();
manager.update(false);
if (!coolBarManager.isDirty()) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetContributionItem.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetContributionItem.java
index 1e66b29dad6..04000e710dc 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetContributionItem.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetContributionItem.java
@@ -17,40 +17,38 @@ import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.SubContributionItem;
/**
- * This class marks a sub contribution item as belonging to
- * an action set.
+ * This class marks a sub contribution item as belonging to an action set.
*/
-public class ActionSetContributionItem extends SubContributionItem implements
- IActionSetContributionItem {
+public class ActionSetContributionItem extends SubContributionItem implements IActionSetContributionItem {
- /**
- * The action set id.
- */
- private String actionSetId;
+ /**
+ * The action set id.
+ */
+ private String actionSetId;
- /**
- * Constructs a new item
- */
- public ActionSetContributionItem(IContributionItem item, String actionSetId) {
- super(item);
- this.actionSetId = actionSetId;
- }
+ /**
+ * Constructs a new item
+ */
+ public ActionSetContributionItem(IContributionItem item, String actionSetId) {
+ super(item);
+ this.actionSetId = actionSetId;
+ }
- /**
- * Returns the action set id.
- */
- @Override
+ /**
+ * Returns the action set id.
+ */
+ @Override
public String getActionSetId() {
- return actionSetId;
- }
+ return actionSetId;
+ }
- /**
- * Sets the action set id.
- */
- @Override
+ /**
+ * Sets the action set id.
+ */
+ @Override
public void setActionSetId(String newActionSetId) {
- actionSetId = newActionSetId;
- }
+ actionSetId = newActionSetId;
+ }
@Override
public String toString() {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetManager.java
index 9ca1e4112f7..864b6b36d21 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetManager.java
@@ -43,41 +43,41 @@ import org.eclipse.ui.services.IServiceLocator;
*/
public class ActionSetManager {
- private static class ActionSetRec {
- int showCount;
+ private static class ActionSetRec {
+ int showCount;
- int maskCount;
+ int maskCount;
- public boolean isVisible() {
- return maskCount == 0 && showCount > 0;
- }
+ public boolean isVisible() {
+ return maskCount == 0 && showCount > 0;
+ }
- public boolean isEmpty() {
- return maskCount == 0 && showCount == 0;
- }
- }
+ public boolean isEmpty() {
+ return maskCount == 0 && showCount == 0;
+ }
+ }
- private HashMap actionSets = new HashMap();
- private HashSet visibleItems = new HashSet();
+ private HashMap actionSets = new HashMap();
+ private HashSet visibleItems = new HashSet();
- public static final int PROP_VISIBLE = 0;
- public static final int PROP_HIDDEN = 1;
- public static final int CHANGE_MASK = 0;
- public static final int CHANGE_UNMASK = 1;
- public static final int CHANGE_SHOW = 2;
- public static final int CHANGE_HIDE = 3;
+ public static final int PROP_VISIBLE = 0;
+ public static final int PROP_HIDDEN = 1;
+ public static final int CHANGE_MASK = 0;
+ public static final int CHANGE_UNMASK = 1;
+ public static final int CHANGE_SHOW = 2;
+ public static final int CHANGE_HIDE = 3;
private ListenerList<IPropertyListener> listeners = new ListenerList<>();
private IPropertyListener contextListener;
private Map activationsById = new HashMap();
private IContextService contextService;
- public ActionSetManager(IServiceLocator locator) {
- contextService = locator.getService(IContextService.class);
+ public ActionSetManager(IServiceLocator locator) {
+ contextService = locator.getService(IContextService.class);
addListener(getContextListener());
- }
+ }
- /**
+ /**
* @return
*/
private IPropertyListener getContextListener() {
@@ -87,11 +87,9 @@ public class ActionSetManager {
IActionSetDescriptor desc = (IActionSetDescriptor) source;
String id = desc.getId();
if (propId == PROP_VISIBLE) {
- activationsById.put(id, contextService
- .activateContext(id));
+ activationsById.put(id, contextService.activateContext(id));
} else if (propId == PROP_HIDDEN) {
- IContextActivation act = (IContextActivation) activationsById
- .remove(id);
+ IContextActivation act = (IContextActivation) activationsById.remove(id);
if (act != null) {
contextService.deactivateContext(act);
}
@@ -103,100 +101,104 @@ public class ActionSetManager {
}
public void addListener(IPropertyListener l) {
- listeners.add(l);
- }
+ listeners.add(l);
+ }
- public void removeListener(IPropertyListener l) {
- listeners.remove(l);
- }
+ public void removeListener(IPropertyListener l) {
+ listeners.remove(l);
+ }
- private void firePropertyChange(IActionSetDescriptor descriptor, int id) {
+ private void firePropertyChange(IActionSetDescriptor descriptor, int id) {
for (IPropertyListener listener : listeners) {
- listener.propertyChanged(descriptor, id);
- }
- }
-
- private ActionSetRec getRec(IActionSetDescriptor descriptor) {
- ActionSetRec rec = (ActionSetRec)actionSets.get(descriptor);
-
- if (rec == null) {
- rec = new ActionSetRec();
- actionSets.put(descriptor, rec);
- }
-
- return rec;
- }
-
- public void showAction(IActionSetDescriptor descriptor) {
- ActionSetRec rec = getRec(descriptor);
-
- boolean wasVisible = rec.isVisible();
- rec.showCount++;
- if (!wasVisible && rec.isVisible()) {
- visibleItems.add(descriptor);
- firePropertyChange(descriptor, PROP_VISIBLE);
- if (rec.isEmpty()) {
- actionSets.remove(descriptor);
- }
- }
- }
-
- public void hideAction(IActionSetDescriptor descriptor) {
- ActionSetRec rec = getRec(descriptor);
-
- boolean wasVisible = rec.isVisible();
- rec.showCount--;
- if (wasVisible && !rec.isVisible()) {
- visibleItems.remove(descriptor);
- firePropertyChange(descriptor, PROP_HIDDEN);
- if (rec.isEmpty()) {
- actionSets.remove(descriptor);
- }
- }
- }
-
- public void maskAction(IActionSetDescriptor descriptor) {
- ActionSetRec rec = getRec(descriptor);
-
- boolean wasVisible = rec.isVisible();
- rec.maskCount++;
- if (wasVisible && !rec.isVisible()) {
- visibleItems.remove(descriptor);
- firePropertyChange(descriptor, PROP_HIDDEN);
- if (rec.isEmpty()) {
- actionSets.remove(descriptor);
- }
- }
- }
-
- public void unmaskAction(IActionSetDescriptor descriptor) {
- ActionSetRec rec = getRec(descriptor);
-
- boolean wasVisible = rec.isVisible();
- rec.maskCount--;
- if (!wasVisible && rec.isVisible()) {
- visibleItems.add(descriptor);
- firePropertyChange(descriptor, PROP_VISIBLE);
- if (rec.isEmpty()) {
- actionSets.remove(descriptor);
- }
- }
- }
-
- public Collection getVisibleItems() {
- return visibleItems;
- }
-
- public void change(IActionSetDescriptor descriptor, int changeType) {
- switch(changeType) {
- case CHANGE_SHOW:
- showAction(descriptor); break;
- case CHANGE_HIDE:
- hideAction(descriptor); break;
- case CHANGE_MASK:
- maskAction(descriptor); break;
- case CHANGE_UNMASK:
- unmaskAction(descriptor); break;
- }
- }
+ listener.propertyChanged(descriptor, id);
+ }
+ }
+
+ private ActionSetRec getRec(IActionSetDescriptor descriptor) {
+ ActionSetRec rec = (ActionSetRec) actionSets.get(descriptor);
+
+ if (rec == null) {
+ rec = new ActionSetRec();
+ actionSets.put(descriptor, rec);
+ }
+
+ return rec;
+ }
+
+ public void showAction(IActionSetDescriptor descriptor) {
+ ActionSetRec rec = getRec(descriptor);
+
+ boolean wasVisible = rec.isVisible();
+ rec.showCount++;
+ if (!wasVisible && rec.isVisible()) {
+ visibleItems.add(descriptor);
+ firePropertyChange(descriptor, PROP_VISIBLE);
+ if (rec.isEmpty()) {
+ actionSets.remove(descriptor);
+ }
+ }
+ }
+
+ public void hideAction(IActionSetDescriptor descriptor) {
+ ActionSetRec rec = getRec(descriptor);
+
+ boolean wasVisible = rec.isVisible();
+ rec.showCount--;
+ if (wasVisible && !rec.isVisible()) {
+ visibleItems.remove(descriptor);
+ firePropertyChange(descriptor, PROP_HIDDEN);
+ if (rec.isEmpty()) {
+ actionSets.remove(descriptor);
+ }
+ }
+ }
+
+ public void maskAction(IActionSetDescriptor descriptor) {
+ ActionSetRec rec = getRec(descriptor);
+
+ boolean wasVisible = rec.isVisible();
+ rec.maskCount++;
+ if (wasVisible && !rec.isVisible()) {
+ visibleItems.remove(descriptor);
+ firePropertyChange(descriptor, PROP_HIDDEN);
+ if (rec.isEmpty()) {
+ actionSets.remove(descriptor);
+ }
+ }
+ }
+
+ public void unmaskAction(IActionSetDescriptor descriptor) {
+ ActionSetRec rec = getRec(descriptor);
+
+ boolean wasVisible = rec.isVisible();
+ rec.maskCount--;
+ if (!wasVisible && rec.isVisible()) {
+ visibleItems.add(descriptor);
+ firePropertyChange(descriptor, PROP_VISIBLE);
+ if (rec.isEmpty()) {
+ actionSets.remove(descriptor);
+ }
+ }
+ }
+
+ public Collection getVisibleItems() {
+ return visibleItems;
+ }
+
+ public void change(IActionSetDescriptor descriptor, int changeType) {
+ switch (changeType) {
+ case CHANGE_SHOW:
+ showAction(descriptor);
+ break;
+ case CHANGE_HIDE:
+ hideAction(descriptor);
+ break;
+ case CHANGE_MASK:
+ maskAction(descriptor);
+ break;
+ case CHANGE_UNMASK:
+ unmaskAction(descriptor);
+ break;
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetMenuManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetMenuManager.java
index 904a7f0fdf6..b9e9424b63a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetMenuManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetMenuManager.java
@@ -19,46 +19,46 @@ import org.eclipse.jface.action.SubContributionItem;
import org.eclipse.jface.action.SubMenuManager;
/**
- * An <code>EditorMenuManager</code> is used to sort the contributions
- * made by an editor so that they always appear after the action sets.
+ * An <code>EditorMenuManager</code> is used to sort the contributions made by
+ * an editor so that they always appear after the action sets.
*/
public class ActionSetMenuManager extends SubMenuManager {
- private String actionSetId;
+ private String actionSetId;
- /**
- * Constructs a new editor manager.
- */
- public ActionSetMenuManager(IMenuManager mgr, String actionSetId) {
- super(mgr);
- this.actionSetId = actionSetId;
- }
+ /**
+ * Constructs a new editor manager.
+ */
+ public ActionSetMenuManager(IMenuManager mgr, String actionSetId) {
+ super(mgr);
+ this.actionSetId = actionSetId;
+ }
/**
* Returns the item passed to us, not the wrapper. In the case of menu's not
* added by this manager, ensure that we return a wrapper for the menu.
*/
- @Override
+ @Override
public IContributionItem find(String id) {
- IContributionItem item = getParentMenuManager().find(id);
- if (item instanceof SubContributionItem) {
+ IContributionItem item = getParentMenuManager().find(id);
+ if (item instanceof SubContributionItem) {
// Return the item passed to us, not the wrapper.
- item = unwrap(item);
+ item = unwrap(item);
}
- if (item instanceof IMenuManager) {
- // if it is a menu manager wrap it before returning
- IMenuManager menu = (IMenuManager) item;
- if (menu instanceof SubMenuManager) {
+ if (item instanceof IMenuManager) {
+ // if it is a menu manager wrap it before returning
+ IMenuManager menu = (IMenuManager) item;
+ if (menu instanceof SubMenuManager) {
// it it is already wrapped then remover the wrapper and
- // rewrap. We have a table of wrappers so we reuse wrappers
- // we create.
- menu = (IMenuManager) ((SubMenuManager) menu).getParent();
+ // rewrap. We have a table of wrappers so we reuse wrappers
+ // we create.
+ menu = (IMenuManager) ((SubMenuManager) menu).getParent();
}
- item = getWrapper(menu);
- }
+ item = getWrapper(menu);
+ }
- return item;
- }
+ return item;
+ }
/**
* @return Returns the actionSetId.
@@ -67,20 +67,20 @@ public class ActionSetMenuManager extends SubMenuManager {
return actionSetId;
}
- @Override
+ @Override
public IContributionItem[] getItems() {
- return getParentMenuManager().getItems();
- }
+ return getParentMenuManager().getItems();
+ }
- @Override
+ @Override
protected SubContributionItem wrap(IContributionItem item) {
- return new ActionSetContributionItem(item, actionSetId);
- }
+ return new ActionSetContributionItem(item, actionSetId);
+ }
- @Override
+ @Override
protected SubMenuManager wrapMenu(IMenuManager menu) {
- return new ActionSetMenuManager(menu, actionSetId);
- }
+ return new ActionSetMenuManager(menu, actionSetId);
+ }
@Override
public String toString() {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetSeparator.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetSeparator.java
index 7f4989b64f0..04f7b9083f3 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetSeparator.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetSeparator.java
@@ -21,62 +21,61 @@ import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
/**
- * This class represents a pseudo-group defined by an action set.
- * It is not a real group ( aka GroupMarker ) because that would interfere with
- * the pre-existing groups in a menu or toolbar.
+ * This class represents a pseudo-group defined by an action set. It is not a
+ * real group ( aka GroupMarker ) because that would interfere with the
+ * pre-existing groups in a menu or toolbar.
*/
-public class ActionSetSeparator extends ContributionItem implements
- IActionSetContributionItem {
- private String actionSetId;
+public class ActionSetSeparator extends ContributionItem implements IActionSetContributionItem {
+ private String actionSetId;
- /**
- * Constructs a new group marker.
- */
- public ActionSetSeparator(String groupName, String newActionSetId) {
- super(groupName);
- actionSetId = newActionSetId;
- }
+ /**
+ * Constructs a new group marker.
+ */
+ public ActionSetSeparator(String groupName, String newActionSetId) {
+ super(groupName);
+ actionSetId = newActionSetId;
+ }
- @Override
+ @Override
public void fill(Menu menu, int index) {
- if (index >= 0) {
+ if (index >= 0) {
new MenuItem(menu, SWT.SEPARATOR, index);
} else {
new MenuItem(menu, SWT.SEPARATOR);
}
- }
+ }
- @Override
+ @Override
public void fill(ToolBar toolbar, int index) {
- if (index >= 0) {
+ if (index >= 0) {
new ToolItem(toolbar, SWT.SEPARATOR, index);
} else {
new ToolItem(toolbar, SWT.SEPARATOR);
}
- }
+ }
- /**
- * Returns the action set id.
- */
- @Override
+ /**
+ * Returns the action set id.
+ */
+ @Override
public String getActionSetId() {
- return actionSetId;
- }
+ return actionSetId;
+ }
- /**
- * The <code>Separator</code> implementation of this <code>IContributionItem</code>
- * method returns <code>true</code>
- */
- @Override
+ /**
+ * The <code>Separator</code> implementation of this
+ * <code>IContributionItem</code> method returns <code>true</code>
+ */
+ @Override
public boolean isSeparator() {
- return true;
- }
+ return true;
+ }
- /**
- * Sets the action set id.
- */
- @Override
+ /**
+ * Sets the action set id.
+ */
+ @Override
public void setActionSetId(String newActionSetId) {
- actionSetId = newActionSetId;
- }
+ actionSetId = newActionSetId;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetsEvent.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetsEvent.java
index 3d6dd67fae8..d6c9fd57630 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetsEvent.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetsEvent.java
@@ -49,8 +49,8 @@ public final class ActionSetsEvent {
/**
* Constructs a new instance of {@link ActionSetsEvent}.
*
- * @param newActionSets
- * The action sets that are now active; may be <code>null</code>.
+ * @param newActionSets The action sets that are now active; may be
+ * <code>null</code>.
*/
ActionSetsEvent(final IActionSetDescriptor[] newActionSets) {
this.newActionSets = newActionSets;
@@ -65,4 +65,3 @@ public final class ActionSetsEvent {
return newActionSets;
}
}
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActivateEditorHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActivateEditorHandler.java
index 8ea1fb7a955..3ec23e4efc3 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActivateEditorHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActivateEditorHandler.java
@@ -47,8 +47,7 @@ public class ActivateEditorHandler extends AbstractEvaluationHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- IWorkbenchWindow window = HandlerUtil
- .getActiveWorkbenchWindowChecked(event);
+ IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
IWorkbenchPage page = window.getActivePage();
if (page != null) {
IEditorPart part = HandlerUtil.getActiveEditor(event);
@@ -73,10 +72,8 @@ public class ActivateEditorHandler extends AbstractEvaluationHandler {
if (enabledWhen == null) {
enabledWhen = new Expression() {
@Override
- public EvaluationResult evaluate(IEvaluationContext context)
- throws CoreException {
- IWorkbenchWindow window = InternalHandlerUtil
- .getActiveWorkbenchWindow(context);
+ public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
+ IWorkbenchWindow window = InternalHandlerUtil.getActiveWorkbenchWindow(context);
if (window != null) {
if (window.getActivePage() != null) {
return EvaluationResult.TRUE;
@@ -87,8 +84,7 @@ public class ActivateEditorHandler extends AbstractEvaluationHandler {
@Override
public void collectExpressionInfo(ExpressionInfo info) {
- info
- .addVariableNameAccess(ISources.ACTIVE_WORKBENCH_WINDOW_NAME);
+ info.addVariableNameAccess(ISources.ACTIVE_WORKBENCH_WINDOW_NAME);
}
};
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActiveEditorAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActiveEditorAction.java
index 3c217114688..86d5dc56fd1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActiveEditorAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActiveEditorAction.java
@@ -20,178 +20,174 @@ import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
/**
- * The abstract superclass for actions that depend on the active editor.
- * This implementation tracks the active editor (see <code>getActiveEditor</code>)
- * and updates the availability of the action when an editor becomes
- * active.
+ * The abstract superclass for actions that depend on the active editor. This
+ * implementation tracks the active editor (see <code>getActiveEditor</code>)
+ * and updates the availability of the action when an editor becomes active.
* <p>
* Subclasses must implement the following <code>IAction</code> method:
* <ul>
- * <li><code>run</code> - to do the action's work</li>
+ * <li><code>run</code> - to do the action's work</li>
* </ul>
* </p>
* <p>
* Subclasses may extend any of the <code>IPartListener</code> methods if the
* action availablity needs to be recalculated:
* <ul>
- * <li><code>partActivated</code></li>
- * <li><code>partDeactivated</code></li>
- * <li><code>partOpened</code></li>
- * <li><code>partClosed</code></li>
- * <li><code>partBroughtToTop</code></li>
+ * <li><code>partActivated</code></li>
+ * <li><code>partDeactivated</code></li>
+ * <li><code>partOpened</code></li>
+ * <li><code>partClosed</code></li>
+ * <li><code>partBroughtToTop</code></li>
* </ul>
* </p>
* <p>
* Subclasses may extend any of the <code>IPageListener</code> methods if the
* action availablity needs to be recalculated:
* <ul>
- * <li><code>pageActivated</code></li>
- * <li><code>pageClosed</code></li>
- * <li><code>pageOpened</code></li>
+ * <li><code>pageActivated</code></li>
+ * <li><code>pageClosed</code></li>
+ * <li><code>pageOpened</code></li>
* </ul>
* </p>
* <p>
* This method implements the <code>IPartListener</code> and
* <code>IPageListener</code>interfaces, and automatically registers listeners
- * so that it can keep its enablement state up to date. Ordinarily, the
- * window's references to these listeners will be dropped automatically when
- * the window closes. However, if the client needs to get rid of an action
- * while the window is still open, the client must call
- * {@link IWorkbenchAction#dispose dispose} to give the action an
- * opportunity to deregister its listeners and to perform any other cleanup.
+ * so that it can keep its enablement state up to date. Ordinarily, the window's
+ * references to these listeners will be dropped automatically when the window
+ * closes. However, if the client needs to get rid of an action while the window
+ * is still open, the client must call {@link IWorkbenchAction#dispose dispose}
+ * to give the action an opportunity to deregister its listeners and to perform
+ * any other cleanup.
* </p>
*/
public abstract class ActiveEditorAction extends PageEventAction {
- private IEditorPart activeEditor;
-
- /**
- * Creates a new action with the given text.
- *
- * @param text the string used as the text for the action,
- * or <code>null</code> if there is no text
- * @param window the workbench window this action is
- * registered with.
- */
- protected ActiveEditorAction(String text, IWorkbenchWindow window) {
- super(text, window);
- updateState();
- }
-
- /**
- * Notification that the active editor tracked
- * by the action is being activated.
- *
- * Subclasses may override.
- */
- protected void editorActivated(IEditorPart part) {
- }
-
- /**
- * Notification that the active editor tracked
- * by the action is being deactivated.
- *
- * Subclasses may override.
- */
- protected void editorDeactivated(IEditorPart part) {
- }
-
- /**
- * Return the active editor
- *
- * @return the page's active editor, and <code>null</code>
- * if no active editor or no active page.
- */
- public final IEditorPart getActiveEditor() {
- return activeEditor;
- }
-
- @Override
+ private IEditorPart activeEditor;
+
+ /**
+ * Creates a new action with the given text.
+ *
+ * @param text the string used as the text for the action, or
+ * <code>null</code> if there is no text
+ * @param window the workbench window this action is registered with.
+ */
+ protected ActiveEditorAction(String text, IWorkbenchWindow window) {
+ super(text, window);
+ updateState();
+ }
+
+ /**
+ * Notification that the active editor tracked by the action is being activated.
+ *
+ * Subclasses may override.
+ */
+ protected void editorActivated(IEditorPart part) {
+ }
+
+ /**
+ * Notification that the active editor tracked by the action is being
+ * deactivated.
+ *
+ * Subclasses may override.
+ */
+ protected void editorDeactivated(IEditorPart part) {
+ }
+
+ /**
+ * Return the active editor
+ *
+ * @return the page's active editor, and <code>null</code> if no active editor
+ * or no active page.
+ */
+ public final IEditorPart getActiveEditor() {
+ return activeEditor;
+ }
+
+ @Override
public void pageActivated(IWorkbenchPage page) {
- super.pageActivated(page);
- updateActiveEditor();
- updateState();
- }
+ super.pageActivated(page);
+ updateActiveEditor();
+ updateState();
+ }
- @Override
+ @Override
public void pageClosed(IWorkbenchPage page) {
- super.pageClosed(page);
- updateActiveEditor();
- updateState();
- }
+ super.pageClosed(page);
+ updateActiveEditor();
+ updateState();
+ }
- @Override
+ @Override
public void partActivated(IWorkbenchPart part) {
- super.partActivated(part);
- if (part instanceof IEditorPart) {
- updateActiveEditor();
- updateState();
- }
- }
-
- @Override
+ super.partActivated(part);
+ if (part instanceof IEditorPart) {
+ updateActiveEditor();
+ updateState();
+ }
+ }
+
+ @Override
public void partBroughtToTop(IWorkbenchPart part) {
- super.partBroughtToTop(part);
- if (part instanceof IEditorPart) {
- updateActiveEditor();
- updateState();
- }
- }
-
- @Override
+ super.partBroughtToTop(part);
+ if (part instanceof IEditorPart) {
+ updateActiveEditor();
+ updateState();
+ }
+ }
+
+ @Override
public void partClosed(IWorkbenchPart part) {
- super.partClosed(part);
- if (part instanceof IEditorPart) {
- updateActiveEditor();
- updateState();
- }
- }
-
- @Override
+ super.partClosed(part);
+ if (part instanceof IEditorPart) {
+ updateActiveEditor();
+ updateState();
+ }
+ }
+
+ @Override
public void partDeactivated(IWorkbenchPart part) {
- super.partDeactivated(part);
- if (part instanceof IEditorPart) {
- updateActiveEditor();
- updateState();
- }
- }
-
- /**
- * Set the active editor
- */
- private void setActiveEditor(IEditorPart part) {
- if (activeEditor == part) {
- return;
- }
- if (activeEditor != null) {
- editorDeactivated(activeEditor);
- }
- activeEditor = part;
- if (activeEditor != null) {
- editorActivated(activeEditor);
- }
- }
-
- /**
- * Update the active editor based on the current
- * active page.
- */
- private void updateActiveEditor() {
- if (getActivePage() == null) {
- setActiveEditor(null);
- } else {
- setActiveEditor(getActivePage().getActiveEditor());
- }
- }
-
- /**
- * Update the state of the action. By default, the action
- * is enabled if there is an active editor.
- *
- * Subclasses may override or extend this method.
- */
- protected void updateState() {
- setEnabled(getActiveEditor() != null);
- }
+ super.partDeactivated(part);
+ if (part instanceof IEditorPart) {
+ updateActiveEditor();
+ updateState();
+ }
+ }
+
+ /**
+ * Set the active editor
+ */
+ private void setActiveEditor(IEditorPart part) {
+ if (activeEditor == part) {
+ return;
+ }
+ if (activeEditor != null) {
+ editorDeactivated(activeEditor);
+ }
+ activeEditor = part;
+ if (activeEditor != null) {
+ editorActivated(activeEditor);
+ }
+ }
+
+ /**
+ * Update the active editor based on the current active page.
+ */
+ private void updateActiveEditor() {
+ if (getActivePage() == null) {
+ setActiveEditor(null);
+ } else {
+ setActiveEditor(getActivePage().getActiveEditor());
+ }
+ }
+
+ /**
+ * Update the state of the action. By default, the action is enabled if there is
+ * an active editor.
+ *
+ * Subclasses may override or extend this method.
+ */
+ protected void updateState() {
+ setEnabled(getActiveEditor() != null);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActivityPersistanceHelper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActivityPersistanceHelper.java
index 38ecc68463c..6185e2968de 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActivityPersistanceHelper.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActivityPersistanceHelper.java
@@ -36,25 +36,24 @@ import org.eclipse.ui.activities.NotDefinedException;
*/
final class ActivityPersistanceHelper {
- /**
- * Prefix for all activity preferences
- */
- protected static final String PREFIX = "UIActivities."; //$NON-NLS-1$
-
- /**
- * Singleton instance.
- */
- private static ActivityPersistanceHelper singleton;
-
- /**
- * The listener that responds to changes in the <code>IActivityManager</code>
- */
- private final IActivityManagerListener activityManagerListener = new IActivityManagerListener() {
-
- @Override
- public void activityManagerChanged(
- ActivityManagerEvent activityManagerEvent) {
- //process newly defined activities.
+ /**
+ * Prefix for all activity preferences
+ */
+ protected static final String PREFIX = "UIActivities."; //$NON-NLS-1$
+
+ /**
+ * Singleton instance.
+ */
+ private static ActivityPersistanceHelper singleton;
+
+ /**
+ * The listener that responds to changes in the <code>IActivityManager</code>
+ */
+ private final IActivityManagerListener activityManagerListener = new IActivityManagerListener() {
+
+ @Override
+ public void activityManagerChanged(ActivityManagerEvent activityManagerEvent) {
+ // process newly defined activities.
if (activityManagerEvent.haveDefinedActivityIdsChanged()) {
Set<String> delta = new HashSet<>(activityManagerEvent.getActivityManager().getDefinedActivityIds());
delta.removeAll(activityManagerEvent.getPreviouslyDefinedActivityIds());
@@ -62,163 +61,158 @@ final class ActivityPersistanceHelper {
// state
loadEnabledStates(activityManagerEvent.getActivityManager().getEnabledActivityIds(), delta);
}
- if (activityManagerEvent.haveEnabledActivityIdsChanged()) {
+ if (activityManagerEvent.haveEnabledActivityIdsChanged()) {
saveEnabledStates();
}
- }
- };
+ }
+ };
- /**
- * The listener that responds to preference changes
- */
- private final IPropertyChangeListener propertyChangeListener = new IPropertyChangeListener() {
+ /**
+ * The listener that responds to preference changes
+ */
+ private final IPropertyChangeListener propertyChangeListener = new IPropertyChangeListener() {
- @Override
+ @Override
public void propertyChange(PropertyChangeEvent event) {
- // dont process property events if we're in the process of
- // serializing state.
- if (!saving && event.getProperty().startsWith(PREFIX)) {
- String activityId = event.getProperty().substring(PREFIX.length());
- IWorkbenchActivitySupport support = PlatformUI.getWorkbench().getActivitySupport();
- IActivityManager activityManager = support.getActivityManager();
-
- boolean enabled = Boolean.parseBoolean(event.getNewValue().toString());
- // if we're turning an activity off we'll need to create its dependency tree to ensuure that all dependencies are also disabled.
+ // dont process property events if we're in the process of
+ // serializing state.
+ if (!saving && event.getProperty().startsWith(PREFIX)) {
+ String activityId = event.getProperty().substring(PREFIX.length());
+ IWorkbenchActivitySupport support = PlatformUI.getWorkbench().getActivitySupport();
+ IActivityManager activityManager = support.getActivityManager();
+
+ boolean enabled = Boolean.parseBoolean(event.getNewValue().toString());
+ // if we're turning an activity off we'll need to create its dependency tree to
+ // ensuure that all dependencies are also disabled.
Set<String> set = new HashSet<>(activityManager.getEnabledActivityIds());
- if (enabled == false) {
+ if (enabled == false) {
Set<String> dependencies = buildDependencies(activityManager, activityId);
- set.removeAll(dependencies);
- }
- else {
- set.add(activityId);
- }
- support.setEnabledActivityIds(set);
- }
- }
- };
-
- /**
- * Whether we are currently saving the state of activities to the preference
- * store.
- */
- protected boolean saving = false;
-
- /**
- * Get the singleton instance of this class.
- *
- * @return the singleton instance of this class.
- */
- public static ActivityPersistanceHelper getInstance() {
- if (singleton == null) {
- singleton = new ActivityPersistanceHelper();
- }
- return singleton;
- }
-
- /**
- * Returns a set of activity IDs that depend on the provided ID in order to be enabled.
- *
- * @param activityManager the activity manager to query
- * @param activityId the activity whos dependencies should be added
- * @return a set of activity IDs
- */
+ set.removeAll(dependencies);
+ } else {
+ set.add(activityId);
+ }
+ support.setEnabledActivityIds(set);
+ }
+ }
+ };
+
+ /**
+ * Whether we are currently saving the state of activities to the preference
+ * store.
+ */
+ protected boolean saving = false;
+
+ /**
+ * Get the singleton instance of this class.
+ *
+ * @return the singleton instance of this class.
+ */
+ public static ActivityPersistanceHelper getInstance() {
+ if (singleton == null) {
+ singleton = new ActivityPersistanceHelper();
+ }
+ return singleton;
+ }
+
+ /**
+ * Returns a set of activity IDs that depend on the provided ID in order to be
+ * enabled.
+ *
+ * @param activityManager the activity manager to query
+ * @param activityId the activity whos dependencies should be added
+ * @return a set of activity IDs
+ */
protected Set<String> buildDependencies(IActivityManager activityManager, String activityId) {
Set<String> set = new HashSet<>();
for (Iterator<String> i = activityManager.getDefinedActivityIds().iterator(); i.hasNext();) {
- IActivity activity = activityManager.getActivity(i.next());
+ IActivity activity = activityManager.getActivity(i.next());
for (Iterator<IActivityRequirementBinding> j = activity.getActivityRequirementBindings().iterator(); j
.hasNext();) {
- IActivityRequirementBinding binding = j.next();
- if (activityId.equals(binding.getRequiredActivityId())) {
- set.addAll(buildDependencies(activityManager, activity.getId()));
- }
- }
- }
- set.add(activityId);
- return set;
- }
-
- /**
- * Create a new <code>ActivityPersistanceHelper</code> which will restore
- * previously enabled activity states.
- */
- private ActivityPersistanceHelper() {
- loadEnabledStates();
- hookListeners();
- }
-
- /**
- * Hook the listener that will respond to any activity state changes.
- */
- private void hookListeners() {
- IWorkbenchActivitySupport support = PlatformUI.getWorkbench()
- .getActivitySupport();
-
- IActivityManager activityManager = support.getActivityManager();
-
- activityManager.addActivityManagerListener(activityManagerListener);
-
- IPreferenceStore store = WorkbenchPlugin.getDefault()
- .getPreferenceStore();
-
- store.addPropertyChangeListener(propertyChangeListener);
- }
-
- /**
- * Hook the listener that will respond to any activity state changes.
- */
- private void unhookListeners() {
- IWorkbenchActivitySupport support = PlatformUI.getWorkbench()
- .getActivitySupport();
-
- IActivityManager activityManager = support.getActivityManager();
-
- activityManager.removeActivityManagerListener(activityManagerListener);
-
- IPreferenceStore store = WorkbenchPlugin.getDefault()
- .getPreferenceStore();
-
- store.removePropertyChangeListener(propertyChangeListener);
- }
-
- /**
- * Create the preference key for the activity.
- *
- * @param activityId the activity id.
- * @return String a preference key representing the activity.
- */
- private String createPreferenceKey(String activityId) {
- return PREFIX + activityId;
- }
-
- /**
- * Loads the enabled states from the preference store.
- */
- void loadEnabledStates() {
- loadEnabledStates(Collections.EMPTY_SET, PlatformUI.getWorkbench()
- .getActivitySupport().getActivityManager()
- .getDefinedActivityIds());
- }
-
- /**
- * Load the enabled states for the given activity IDs.
- *
- * @param previouslyEnabledActivities the activity states to maintain. This set must be writabe.
- * @param activityIdsToProcess the activity ids to process
- */
+ IActivityRequirementBinding binding = j.next();
+ if (activityId.equals(binding.getRequiredActivityId())) {
+ set.addAll(buildDependencies(activityManager, activity.getId()));
+ }
+ }
+ }
+ set.add(activityId);
+ return set;
+ }
+
+ /**
+ * Create a new <code>ActivityPersistanceHelper</code> which will restore
+ * previously enabled activity states.
+ */
+ private ActivityPersistanceHelper() {
+ loadEnabledStates();
+ hookListeners();
+ }
+
+ /**
+ * Hook the listener that will respond to any activity state changes.
+ */
+ private void hookListeners() {
+ IWorkbenchActivitySupport support = PlatformUI.getWorkbench().getActivitySupport();
+
+ IActivityManager activityManager = support.getActivityManager();
+
+ activityManager.addActivityManagerListener(activityManagerListener);
+
+ IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
+
+ store.addPropertyChangeListener(propertyChangeListener);
+ }
+
+ /**
+ * Hook the listener that will respond to any activity state changes.
+ */
+ private void unhookListeners() {
+ IWorkbenchActivitySupport support = PlatformUI.getWorkbench().getActivitySupport();
+
+ IActivityManager activityManager = support.getActivityManager();
+
+ activityManager.removeActivityManagerListener(activityManagerListener);
+
+ IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
+
+ store.removePropertyChangeListener(propertyChangeListener);
+ }
+
+ /**
+ * Create the preference key for the activity.
+ *
+ * @param activityId the activity id.
+ * @return String a preference key representing the activity.
+ */
+ private String createPreferenceKey(String activityId) {
+ return PREFIX + activityId;
+ }
+
+ /**
+ * Loads the enabled states from the preference store.
+ */
+ void loadEnabledStates() {
+ loadEnabledStates(Collections.EMPTY_SET,
+ PlatformUI.getWorkbench().getActivitySupport().getActivityManager().getDefinedActivityIds());
+ }
+
+ /**
+ * Load the enabled states for the given activity IDs.
+ *
+ * @param previouslyEnabledActivities the activity states to maintain. This set
+ * must be writabe.
+ * @param activityIdsToProcess the activity ids to process
+ */
protected void loadEnabledStates(Set<String> previouslyEnabledActivities, Set<String> activityIdsToProcess) {
- if (activityIdsToProcess.isEmpty()) {
+ if (activityIdsToProcess.isEmpty()) {
return;
}
Set<String> enabledActivities = new HashSet<>(previouslyEnabledActivities);
- IPreferenceStore store = WorkbenchPlugin.getDefault()
- .getPreferenceStore();
+ IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
- IWorkbenchActivitySupport support = PlatformUI.getWorkbench()
- .getActivitySupport();
+ IWorkbenchActivitySupport support = PlatformUI.getWorkbench().getActivitySupport();
- IActivityManager activityManager = support.getActivityManager();
+ IActivityManager activityManager = support.getActivityManager();
for (String activityId : activityIdsToProcess) {
String preferenceKey = createPreferenceKey(activityId);
@@ -245,15 +239,15 @@ final class ActivityPersistanceHelper {
}
}
- support.setEnabledActivityIds(enabledActivities);
- }
+ support.setEnabledActivityIds(enabledActivities);
+ }
- /**
- * Save the enabled states in the preference store.
- */
- protected void saveEnabledStates() {
- try {
- saving = true;
+ /**
+ * Save the enabled states in the preference store.
+ */
+ protected void saveEnabledStates() {
+ try {
+ saving = true;
IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
@@ -268,18 +262,17 @@ final class ActivityPersistanceHelper {
store.setValue(createPreferenceKey(activity.getId()), activity.isEnabled());
}
- WorkbenchPlugin.getDefault().savePluginPreferences();
- }
- finally {
- saving = false;
- }
- }
-
- /**
- * Save the enabled state of all activities.
- */
- public void shutdown() {
- unhookListeners();
- saveEnabledStates();
- }
+ WorkbenchPlugin.getDefault().savePluginPreferences();
+ } finally {
+ saving = false;
+ }
+ }
+
+ /**
+ * Save the enabled state of all activities.
+ */
+ public void shutdown() {
+ unhookListeners();
+ saveEnabledStates();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AggregateWorkingSet.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AggregateWorkingSet.java
index d77ea221cae..601a0a1effb 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AggregateWorkingSet.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AggregateWorkingSet.java
@@ -32,8 +32,7 @@ import org.eclipse.ui.internal.util.Util;
*
* @since 3.2
*/
-public class AggregateWorkingSet extends AbstractWorkingSet implements
- IAggregateWorkingSet, IPropertyChangeListener {
+public class AggregateWorkingSet extends AbstractWorkingSet implements IAggregateWorkingSet, IPropertyChangeListener {
private IWorkingSet[] components;
@@ -48,8 +47,7 @@ public class AggregateWorkingSet extends AbstractWorkingSet implements
* @param label
* @param components
*/
- public AggregateWorkingSet(String name, String label,
- IWorkingSet[] components) {
+ public AggregateWorkingSet(String name, String label, IWorkingSet[] components) {
super(name, label);
IWorkingSet[] componentCopy = new IWorkingSet[components.length];
@@ -68,8 +66,7 @@ public class AggregateWorkingSet extends AbstractWorkingSet implements
super(name, label);
workingSetMemento = memento;
if (workingSetMemento != null) {
- String uniqueId = workingSetMemento
- .getString(IWorkbenchConstants.TAG_ID);
+ String uniqueId = workingSetMemento.getString(IWorkbenchConstants.TAG_ID);
if (uniqueId != null) {
setUniqueId(uniqueId);
}
@@ -86,16 +83,16 @@ public class AggregateWorkingSet extends AbstractWorkingSet implements
}
/**
- * Takes the elements from all component working sets and sets them to be
- * the elements of this working set. Any duplicates are trimmed.
+ * Takes the elements from all component working sets and sets them to be the
+ * elements of this working set. Any duplicates are trimmed.
*
* @param fireEvent whether a working set change event should be fired
*/
private void constructElements(boolean fireEvent) {
if (inElementConstruction) {
String msg = NLS.bind(WorkbenchMessages.ProblemCyclicDependency, getName());
- WorkbenchPlugin.log(msg);
- throw new IllegalStateException(msg);
+ WorkbenchPlugin.log(msg);
+ throw new IllegalStateException(msg);
}
inElementConstruction = true;
try {
@@ -121,8 +118,7 @@ public class AggregateWorkingSet extends AbstractWorkingSet implements
}
internalSetElements(elements.toArray(new IAdaptable[elements.size()]));
if (fireEvent) {
- fireWorkingSetChanged(
- IWorkingSetManager.CHANGE_WORKING_SET_CONTENT_CHANGE, null);
+ fireWorkingSetChanged(IWorkingSetManager.CHANGE_WORKING_SET_CONTENT_CHANGE, null);
}
} finally {
inElementConstruction = false;
@@ -136,8 +132,7 @@ public class AggregateWorkingSet extends AbstractWorkingSet implements
@Override
public ImageDescriptor getImageDescriptor() {
- return WorkbenchImages
- .getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJ_WORKING_SETS);
+ return WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJ_WORKING_SETS);
}
/**
@@ -178,8 +173,7 @@ public class AggregateWorkingSet extends AbstractWorkingSet implements
memento.putString(IWorkbenchConstants.TAG_NAME, getName());
memento.putString(IWorkbenchConstants.TAG_LABEL, getLabel());
memento.putString(IWorkbenchConstants.TAG_ID, getUniqueId());
- memento.putString(AbstractWorkingSet.TAG_AGGREGATE, Boolean.TRUE
- .toString());
+ memento.putString(AbstractWorkingSet.TAG_AGGREGATE, Boolean.TRUE.toString());
for (IWorkingSet workingSet : getComponentsInternal()) {
memento.createChild(IWorkbenchConstants.TAG_WORKING_SET, workingSet.getName());
@@ -231,14 +225,11 @@ public class AggregateWorkingSet extends AbstractWorkingSet implements
IWorkingSet set = localComponents[i];
if (set.equals(event.getOldValue())) {
IWorkingSet[] newComponents = new IWorkingSet[localComponents.length - 1];
- Util
- .arrayCopyWithRemoval(localComponents,
- newComponents, i);
+ Util.arrayCopyWithRemoval(localComponents, newComponents, i);
setComponents(newComponents);
}
}
- } else if (property
- .equals(IWorkingSetManager.CHANGE_WORKING_SET_CONTENT_CHANGE)) {
+ } else if (property.equals(IWorkingSetManager.CHANGE_WORKING_SET_CONTENT_CHANGE)) {
IWorkingSet[] localComponents = getComponentsInternal();
for (IWorkingSet set : localComponents) {
if (set.equals(event.getNewValue())) {
@@ -255,8 +246,7 @@ public class AggregateWorkingSet extends AbstractWorkingSet implements
if (manager == null) {
throw new IllegalStateException();
}
- IMemento[] workingSetReferences = workingSetMemento
- .getChildren(IWorkbenchConstants.TAG_WORKING_SET);
+ IMemento[] workingSetReferences = workingSetMemento.getChildren(IWorkbenchConstants.TAG_WORKING_SET);
ArrayList list = new ArrayList(workingSetReferences.length);
for (IMemento memento : workingSetReferences) {
@@ -266,8 +256,7 @@ public class AggregateWorkingSet extends AbstractWorkingSet implements
list.add(set);
}
}
- internalSetComponents((IWorkingSet[]) list
- .toArray(new IWorkingSet[list.size()]));
+ internalSetComponents((IWorkingSet[]) list.toArray(new IWorkingSet[list.size()]));
constructElements(false);
}
@@ -297,7 +286,7 @@ public class AggregateWorkingSet extends AbstractWorkingSet implements
if (localComponents == null || localComponents.length == 0) {
return false;
}
- for (int i= 0; i < localComponents.length; i++) {
+ for (int i = 0; i < localComponents.length; i++) {
if (!localComponents[i].isSelfUpdating()) {
return false;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AnimationEngine.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AnimationEngine.java
index fb07b250e65..9db388e30fe 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AnimationEngine.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AnimationEngine.java
@@ -27,9 +27,10 @@ import org.eclipse.ui.internal.tweaklets.Tweaklets;
import org.eclipse.ui.internal.util.PrefUtil;
/**
- * This job creates an Animation Engine that uses an Animation Feedback to render
- * the animation. To begin the animation, instantiate this
- * object then call schedule().
+ * This job creates an Animation Engine that uses an Animation Feedback to
+ * render the animation. To begin the animation, instantiate this object then
+ * call schedule().
+ *
* @since 3.3
*
*/
@@ -51,20 +52,20 @@ public class AnimationEngine extends Job {
private AnimationFeedbackBase feedbackRenderer;
private int duration;
- public AnimationEngine(AnimationFeedbackBase animationFeedback,
- int durationIn) {
+ public AnimationEngine(AnimationFeedbackBase animationFeedback, int durationIn) {
this(animationFeedback, durationIn, 0);
}
/**
* Creates an Animation that will run for the given number of milliseconds.
*
- * @param animationFeedback provides renderStep(), initialize() and jobInit() methods
- * @param durationIn number of milliseconds over which the animation will run
- * @param sleepAmountIn number of milliseconds to slow/delay the animation
+ * @param animationFeedback provides renderStep(), initialize() and jobInit()
+ * methods
+ * @param durationIn number of milliseconds over which the animation will
+ * run
+ * @param sleepAmountIn number of milliseconds to slow/delay the animation
*/
- public AnimationEngine(AnimationFeedbackBase animationFeedback,
- int durationIn, long sleepAmountIn) {
+ public AnimationEngine(AnimationFeedbackBase animationFeedback, int durationIn, long sleepAmountIn) {
super(WorkbenchMessages.RectangleAnimation_Animating_Rectangle);
sleepAmount = sleepAmountIn;
feedbackRenderer = animationFeedback;
@@ -72,8 +73,7 @@ public class AnimationEngine extends Job {
// if animations aren't on this is a NO-OP
IPreferenceStore preferenceStore = PrefUtil.getAPIPreferenceStore();
- enableAnimations = preferenceStore
- .getBoolean(IWorkbenchPreferenceConstants.ENABLE_ANIMATIONS);
+ enableAnimations = preferenceStore.getBoolean(IWorkbenchPreferenceConstants.ENABLE_ANIMATIONS);
if (!enableAnimations) {
return;
}
@@ -143,13 +143,13 @@ public class AnimationEngine extends Job {
}
double amount = 0.0;
switch (timingStyle) {
- case TICK_TIMER:
- amount = (double) (curTime - startTime) / (double) duration;
- break;
+ case TICK_TIMER:
+ amount = (double) (curTime - startTime) / (double) duration;
+ break;
- // For testing purposes
- case FRAME_COUNT:
- amount = (double) frameCount / (double) duration;
+ // For testing purposes
+ case FRAME_COUNT:
+ amount = (double) frameCount / (double) duration;
}
if (amount > 1.0)
@@ -160,7 +160,8 @@ public class AnimationEngine extends Job {
@Override
protected IStatus run(IProgressMonitor monitor) {
- // We use preference value to indicate that the animation should be skipped on this platform.
+ // We use preference value to indicate that the animation should be skipped on
+ // this platform.
if (!enableAnimations) {
return Status.OK_STATUS;
}
@@ -208,8 +209,7 @@ public class AnimationEngine extends Job {
}
public static void createTweakedAnimation(Shell shell, int duration, Rectangle start, Rectangle end) {
- RectangleAnimationFeedbackBase feedback = ((Animations) Tweaklets
- .get(Animations.KEY)).createFeedback(shell);
+ RectangleAnimationFeedbackBase feedback = ((Animations) Tweaklets.get(Animations.KEY)).createFeedback(shell);
feedback.addStartRect(start);
feedback.addEndRect(end);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AnimationFeedbackBase.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AnimationFeedbackBase.java
index 99fc510a56e..22ac646cdc5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AnimationFeedbackBase.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AnimationFeedbackBase.java
@@ -17,10 +17,9 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Shell;
/**
- * AnimationFeedBackBase is an abstract class which provides renderStep(), jobInit() and
- * initialize() methods for AnimationEngine.
- * Its the base class for all the
- * animationFeedbacks
+ * AnimationFeedBackBase is an abstract class which provides renderStep(),
+ * jobInit() and initialize() methods for AnimationEngine. Its the base class
+ * for all the animationFeedbacks
*
* @since 3.3
*
@@ -45,16 +44,15 @@ public abstract class AnimationFeedbackBase {
}
/**
- * Perform any initialization you want to do -prior- to the Job actually
- * gets scheduled.
+ * Perform any initialization you want to do -prior- to the Job actually gets
+ * scheduled.
*
* @param animationEngine The engine we're hosted in.
*/
public abstract void initialize(AnimationEngine animationEngine);
/**
- * Its a draw method. All the code to render an animation goes in this
- * method.
+ * Its a draw method. All the code to render an animation goes in this method.
*
* @param engine
*/
@@ -62,7 +60,8 @@ public abstract class AnimationFeedbackBase {
/**
* Perform any initialization you want to have happen -before- the animation
- * starts. Subclasses may subclass but not override (i.e. you have to call super).
+ * starts. Subclasses may subclass but not override (i.e. you have to call
+ * super).
*
* @param engine The AnimationEngine hosting the feedback
* @return 'true' iff the animation is capable of running
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/BindingToModelProcessor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/BindingToModelProcessor.java
index ce301ae54c9..05438586380 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/BindingToModelProcessor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/BindingToModelProcessor.java
@@ -54,13 +54,11 @@ public class BindingToModelProcessor {
CommandManager commandManager = context.get(CommandManager.class);
if (commandManager == null) {
- WorkbenchPlugin
- .log("Command manager was null in org.eclipse.ui.internal.BindingToModelProcessor"); //$NON-NLS-1$
+ WorkbenchPlugin.log("Command manager was null in org.eclipse.ui.internal.BindingToModelProcessor"); //$NON-NLS-1$
}
ContextManager contextManager = context.get(ContextManager.class);
if (contextManager == null) {
- WorkbenchPlugin
- .log("Context manager was null in org.eclipse.ui.internal.BindingToModelProcessor"); //$NON-NLS-1$
+ WorkbenchPlugin.log("Context manager was null in org.eclipse.ui.internal.BindingToModelProcessor"); //$NON-NLS-1$
}
BindingManager bindingManager = new BindingManager(contextManager, commandManager);
context.set(BindingManager.class, bindingManager);
@@ -68,11 +66,9 @@ public class BindingToModelProcessor {
persistence.read();
// we'll make this available, although I doubt we have a use for it
- application.getTags().add(
- EBindingService.ACTIVE_SCHEME_TAG + ':' + bindingManager.getActiveScheme().getId());
+ application.getTags().add(EBindingService.ACTIVE_SCHEME_TAG + ':' + bindingManager.getActiveScheme().getId());
- Collection<?> activeBindingsForScheme = bindingManager
- .getActiveBindingsDisregardingContextFlat();
+ Collection<?> activeBindingsForScheme = bindingManager.getActiveBindingsDisregardingContextFlat();
for (Object obj : activeBindingsForScheme) {
Binding binding = (Binding) obj;
@@ -97,7 +93,6 @@ public class BindingToModelProcessor {
public final void addBinding(final MApplication application, final Binding binding) {
-
MBindingTable table = tables.get(binding.getContextId());
if (table == null) {
table = createTable(application, binding.getContextId());
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/BrandingProperties.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/BrandingProperties.java
index 0136d4f07a9..05ef43f3934 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/BrandingProperties.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/BrandingProperties.java
@@ -30,101 +30,91 @@ import org.osgi.framework.Bundle;
*/
public abstract class BrandingProperties {
- /**
- * Create an url from the argument absolute or relative path. The bundle
- * parameter is used as the base for relative paths and is allowed to be
- * null.
- *
- * @param value
- * the absolute or relative path
- * @param definingBundle
- * bundle to be used for relative paths (may be null)
- * @return
- */
- public static URL getUrl(String value, Bundle definingBundle) {
- try {
- if (value != null) {
+ /**
+ * Create an url from the argument absolute or relative path. The bundle
+ * parameter is used as the base for relative paths and is allowed to be null.
+ *
+ * @param value the absolute or relative path
+ * @param definingBundle bundle to be used for relative paths (may be null)
+ * @return
+ */
+ public static URL getUrl(String value, Bundle definingBundle) {
+ try {
+ if (value != null) {
return new URL(value);
}
- } catch (MalformedURLException e) {
- if (definingBundle != null) {
+ } catch (MalformedURLException e) {
+ if (definingBundle != null) {
return FileLocator.find(definingBundle, new Path(value));
}
- }
+ }
- return null;
- }
+ return null;
+ }
- /**
- * Create a descriptor from the argument absolute or relative path to an
- * image file. bundle parameter is used as the base for relative paths and
- * is allowed to be null.
- *
- * @param value
- * the absolute or relative path
- * @param definingBundle
- * bundle to be used for relative paths (may be null)
- * @return
- */
- public static ImageDescriptor getImage(String value, Bundle definingBundle) {
- URL url = getUrl(value, definingBundle);
- return url == null ? null : ImageDescriptor.createFromURL(url);
- }
+ /**
+ * Create a descriptor from the argument absolute or relative path to an image
+ * file. bundle parameter is used as the base for relative paths and is allowed
+ * to be null.
+ *
+ * @param value the absolute or relative path
+ * @param definingBundle bundle to be used for relative paths (may be null)
+ * @return
+ */
+ public static ImageDescriptor getImage(String value, Bundle definingBundle) {
+ URL url = getUrl(value, definingBundle);
+ return url == null ? null : ImageDescriptor.createFromURL(url);
+ }
- /**
- * Returns a array of URL for the given property or <code>null</code>.
- * The property value should be a comma separated list of urls (either
- * absolute or relative to the argument bundle). Tokens that do not
- * represent a valid url will be represented with a null entry in the
- * returned array.
- *
- * @param value
- * value of a property that contains a comma-separated list of
- * product relative urls
- * @param definingBundle
- * bundle to be used as base for relative paths (may be null)
- * @return a URL for the given property, or <code>null</code>
- */
- public static URL[] getURLs(String value, Bundle definingBundle) {
- if (value == null) {
+ /**
+ * Returns a array of URL for the given property or <code>null</code>. The
+ * property value should be a comma separated list of urls (either absolute or
+ * relative to the argument bundle). Tokens that do not represent a valid url
+ * will be represented with a null entry in the returned array.
+ *
+ * @param value value of a property that contains a comma-separated
+ * list of product relative urls
+ * @param definingBundle bundle to be used as base for relative paths (may be
+ * null)
+ * @return a URL for the given property, or <code>null</code>
+ */
+ public static URL[] getURLs(String value, Bundle definingBundle) {
+ if (value == null) {
return null;
}
- StringTokenizer tokens = new StringTokenizer(value, ","); //$NON-NLS-1$
- ArrayList array = new ArrayList(10);
- while (tokens.hasMoreTokens()) {
+ StringTokenizer tokens = new StringTokenizer(value, ","); //$NON-NLS-1$
+ ArrayList array = new ArrayList(10);
+ while (tokens.hasMoreTokens()) {
array.add(getUrl(tokens.nextToken().trim(), definingBundle));
}
- return (URL[]) array.toArray(new URL[array.size()]);
- }
+ return (URL[]) array.toArray(new URL[array.size()]);
+ }
- /**
- * Returns an array of image descriptors for the given property, or
- * <code>null</code>. The property value should be a comma separated list
- * of image paths. Each path should either be absolute or relative to the
- * optional bundle parameter.
- *
- * @param value
- * value of a property that contains a comma-separated list of
- * product relative urls describing images
- * @param definingBundle
- * bundle to be used for relative paths (may be null)
- * @return an array of image descriptors for the given property, or
- * <code>null</code>
- */
- public static ImageDescriptor[] getImages(String value,
- Bundle definingBundle) {
- URL[] urls = getURLs(value, definingBundle);
- if (urls == null || urls.length <= 0) {
+ /**
+ * Returns an array of image descriptors for the given property, or
+ * <code>null</code>. The property value should be a comma separated list of
+ * image paths. Each path should either be absolute or relative to the optional
+ * bundle parameter.
+ *
+ * @param value value of a property that contains a comma-separated
+ * list of product relative urls describing images
+ * @param definingBundle bundle to be used for relative paths (may be null)
+ * @return an array of image descriptors for the given property, or
+ * <code>null</code>
+ */
+ public static ImageDescriptor[] getImages(String value, Bundle definingBundle) {
+ URL[] urls = getURLs(value, definingBundle);
+ if (urls == null || urls.length <= 0) {
return null;
}
- ImageDescriptor[] images = new ImageDescriptor[urls.length];
- for (int i = 0; i < images.length; ++i) {
+ ImageDescriptor[] images = new ImageDescriptor[urls.length];
+ for (int i = 0; i < images.length; ++i) {
images[i] = ImageDescriptor.createFromURL(urls[i]);
}
- return images;
- }
+ return images;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/BundleGroupProperties.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/BundleGroupProperties.java
index a381068421e..50c137a8aa4 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/BundleGroupProperties.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/BundleGroupProperties.java
@@ -29,148 +29,148 @@ import org.eclipse.ui.branding.IBundleGroupConstants;
* @see org.eclipse.ui.branding.IBundleGroupConstants
* @since 3.0
*/
-public class BundleGroupProperties extends BrandingProperties implements
- IBundleGroupConstants {
+public class BundleGroupProperties extends BrandingProperties implements IBundleGroupConstants {
- private final IBundleGroup bundleGroup;
+ private final IBundleGroup bundleGroup;
- private ImageDescriptor featureImageDescriptor;
+ private ImageDescriptor featureImageDescriptor;
- private URL featureImageUrl;
+ private URL featureImageUrl;
- private String tipsAndTricksHref;
+ private String tipsAndTricksHref;
- private URL welcomePageUrl;
+ private URL welcomePageUrl;
- private String welcomePerspective;
+ private String welcomePerspective;
- private URL licenseUrl;
+ private URL licenseUrl;
- private String featureLabel;
+ private String featureLabel;
- private String featureId;
+ private String featureId;
- private String providerName;
+ private String providerName;
- private String versionId;
+ private String versionId;
private String brandingId;
private String brandingVersion;
- /**
- * This instance will return properties from the given bundle group. The properties are
- * retrieved in a lazy fashion and cached for later retrieval.
- * @param bundleGroup must not be null
- */
- public BundleGroupProperties(IBundleGroup bundleGroup) {
- if (bundleGroup == null) {
+ /**
+ * This instance will return properties from the given bundle group. The
+ * properties are retrieved in a lazy fashion and cached for later retrieval.
+ *
+ * @param bundleGroup must not be null
+ */
+ public BundleGroupProperties(IBundleGroup bundleGroup) {
+ if (bundleGroup == null) {
throw new IllegalArgumentException();
}
- this.bundleGroup = bundleGroup;
- }
-
- /**
- * An image which can be shown in an "about features" dialog (32x32).
- */
- public ImageDescriptor getFeatureImage() {
- if (featureImageDescriptor == null) {
+ this.bundleGroup = bundleGroup;
+ }
+
+ /**
+ * An image which can be shown in an "about features" dialog (32x32).
+ */
+ public ImageDescriptor getFeatureImage() {
+ if (featureImageDescriptor == null) {
featureImageDescriptor = getFeatureImage(bundleGroup);
}
- return featureImageDescriptor;
- }
-
- /**
- * The URL to an image which can be shown in an "about features" dialog (32x32).
- */
- public URL getFeatureImageUrl() {
- if (featureImageUrl == null) {
+ return featureImageDescriptor;
+ }
+
+ /**
+ * The URL to an image which can be shown in an "about features" dialog (32x32).
+ */
+ public URL getFeatureImageUrl() {
+ if (featureImageUrl == null) {
featureImageUrl = getFeatureImageUrl(bundleGroup);
}
- return featureImageUrl;
- }
-
- /**
- * A help reference for the feature's tips and tricks page (optional).
- */
- public String getTipsAndTricksHref() {
- if (tipsAndTricksHref == null) {
+ return featureImageUrl;
+ }
+
+ /**
+ * A help reference for the feature's tips and tricks page (optional).
+ */
+ public String getTipsAndTricksHref() {
+ if (tipsAndTricksHref == null) {
tipsAndTricksHref = getTipsAndTricksHref(bundleGroup);
}
- return tipsAndTricksHref;
- }
-
- /**
- * A URL for the feature's welcome page (special XML-based format) ($nl$/
- * prefix to permit locale-specific translations of entire file). Products
- * designed to run "headless" typically would not have such a page.
- */
- public URL getWelcomePageUrl() {
- if (welcomePageUrl == null) {
+ return tipsAndTricksHref;
+ }
+
+ /**
+ * A URL for the feature's welcome page (special XML-based format) ($nl$/ prefix
+ * to permit locale-specific translations of entire file). Products designed to
+ * run "headless" typically would not have such a page.
+ */
+ public URL getWelcomePageUrl() {
+ if (welcomePageUrl == null) {
welcomePageUrl = getWelcomePageUrl(bundleGroup);
}
- return welcomePageUrl;
- }
-
- /**
- * The id of a perspective in which to show the welcome page (optional).
- */
- public String getWelcomePerspective() {
- if (welcomePerspective == null) {
+ return welcomePageUrl;
+ }
+
+ /**
+ * The id of a perspective in which to show the welcome page (optional).
+ */
+ public String getWelcomePerspective() {
+ if (welcomePerspective == null) {
welcomePerspective = getWelcomePerspective(bundleGroup);
}
- return welcomePerspective;
- }
-
- /**
- * A URL for the feature's license page.
- */
- public URL getLicenseUrl() {
- if (licenseUrl == null) {
+ return welcomePerspective;
+ }
+
+ /**
+ * A URL for the feature's license page.
+ */
+ public URL getLicenseUrl() {
+ if (licenseUrl == null) {
licenseUrl = getLicenseUrl(bundleGroup);
}
- return licenseUrl;
- }
-
- /**
- * Returns a label for the feature plugn, or <code>null</code>.
- */
- public String getFeatureLabel() {
- if (featureLabel == null) {
+ return licenseUrl;
+ }
+
+ /**
+ * Returns a label for the feature plugn, or <code>null</code>.
+ */
+ public String getFeatureLabel() {
+ if (featureLabel == null) {
featureLabel = getFeatureLabel(bundleGroup);
}
- return featureLabel;
- }
-
- /**
- * Returns the id for this bundleGroup.
- */
- public String getFeatureId() {
- if (featureId == null) {
+ return featureLabel;
+ }
+
+ /**
+ * Returns the id for this bundleGroup.
+ */
+ public String getFeatureId() {
+ if (featureId == null) {
featureId = getFeatureId(bundleGroup);
}
- return featureId;
- }
-
- /**
- * Returns the provider name.
- */
- public String getProviderName() {
- if (providerName == null) {
+ return featureId;
+ }
+
+ /**
+ * Returns the provider name.
+ */
+ public String getProviderName() {
+ if (providerName == null) {
providerName = getProviderName(bundleGroup);
}
- return providerName;
- }
-
- /**
- * Returns the feature version id.
- */
- public String getFeatureVersion() {
- if (versionId == null) {
+ return providerName;
+ }
+
+ /**
+ * Returns the feature version id.
+ */
+ public String getFeatureVersion() {
+ if (versionId == null) {
versionId = getFeatureVersion(bundleGroup);
}
- return versionId;
- }
+ return versionId;
+ }
/**
* @return the branding plugin id, or <code>null</code>
@@ -192,78 +192,78 @@ public class BundleGroupProperties extends BrandingProperties implements
return brandingVersion;
}
- /**
- * An image which can be shown in an "about features" dialog (32x32).
- */
- public static ImageDescriptor getFeatureImage(IBundleGroup bundleGroup) {
- return getImage(bundleGroup.getProperty(FEATURE_IMAGE), null);
- }
-
- /**
- * The URL to an image which can be shown in an "about features" dialog (32x32).
- */
- public static URL getFeatureImageUrl(IBundleGroup bundleGroup) {
- return getUrl(bundleGroup.getProperty(FEATURE_IMAGE), null);
- }
-
- /**
- * A help reference for the feature's tips and tricks page (optional).
- */
- public static String getTipsAndTricksHref(IBundleGroup bundleGroup) {
- return bundleGroup.getProperty(TIPS_AND_TRICKS_HREF);
- }
-
- /**
- * A URL for the feature's welcome page (special XML-based format) ($nl$/
- * prefix to permit locale-specific translations of entire file). Products
- * designed to run "headless" typically would not have such a page.
- */
- public static URL getWelcomePageUrl(IBundleGroup bundleGroup) {
- return getUrl(bundleGroup.getProperty(WELCOME_PAGE), null);
- }
-
- /**
- * The id of a perspective in which to show the welcome page (optional).
- */
- public static String getWelcomePerspective(IBundleGroup bundleGroup) {
- String property = bundleGroup.getProperty(WELCOME_PERSPECTIVE);
- return property == null ? null : property;
- }
-
- /**
- * A URL for the feature's license page.
- */
- public static URL getLicenseUrl(IBundleGroup bundleGroup) {
- return getUrl(bundleGroup.getProperty(LICENSE_HREF), null);
- }
-
- /**
- * Returns a label for the feature plugn, or <code>null</code>.
- */
- public static String getFeatureLabel(IBundleGroup bundleGroup) {
- return bundleGroup.getName();
- }
-
- /**
- * Returns the id for this bundleGroup.
- */
- public static String getFeatureId(IBundleGroup bundleGroup) {
- return bundleGroup.getIdentifier();
- }
-
- /**
- * Returns the provider name.
- */
- public static String getProviderName(IBundleGroup bundleGroup) {
- return bundleGroup.getProviderName();
- }
-
- /**
- * Returns the feature version id.
- */
- public static String getFeatureVersion(IBundleGroup bundleGroup) {
- return bundleGroup.getVersion();
- }
+ /**
+ * An image which can be shown in an "about features" dialog (32x32).
+ */
+ public static ImageDescriptor getFeatureImage(IBundleGroup bundleGroup) {
+ return getImage(bundleGroup.getProperty(FEATURE_IMAGE), null);
+ }
+
+ /**
+ * The URL to an image which can be shown in an "about features" dialog (32x32).
+ */
+ public static URL getFeatureImageUrl(IBundleGroup bundleGroup) {
+ return getUrl(bundleGroup.getProperty(FEATURE_IMAGE), null);
+ }
+
+ /**
+ * A help reference for the feature's tips and tricks page (optional).
+ */
+ public static String getTipsAndTricksHref(IBundleGroup bundleGroup) {
+ return bundleGroup.getProperty(TIPS_AND_TRICKS_HREF);
+ }
+
+ /**
+ * A URL for the feature's welcome page (special XML-based format) ($nl$/ prefix
+ * to permit locale-specific translations of entire file). Products designed to
+ * run "headless" typically would not have such a page.
+ */
+ public static URL getWelcomePageUrl(IBundleGroup bundleGroup) {
+ return getUrl(bundleGroup.getProperty(WELCOME_PAGE), null);
+ }
+
+ /**
+ * The id of a perspective in which to show the welcome page (optional).
+ */
+ public static String getWelcomePerspective(IBundleGroup bundleGroup) {
+ String property = bundleGroup.getProperty(WELCOME_PERSPECTIVE);
+ return property == null ? null : property;
+ }
+
+ /**
+ * A URL for the feature's license page.
+ */
+ public static URL getLicenseUrl(IBundleGroup bundleGroup) {
+ return getUrl(bundleGroup.getProperty(LICENSE_HREF), null);
+ }
+
+ /**
+ * Returns a label for the feature plugn, or <code>null</code>.
+ */
+ public static String getFeatureLabel(IBundleGroup bundleGroup) {
+ return bundleGroup.getName();
+ }
+
+ /**
+ * Returns the id for this bundleGroup.
+ */
+ public static String getFeatureId(IBundleGroup bundleGroup) {
+ return bundleGroup.getIdentifier();
+ }
+
+ /**
+ * Returns the provider name.
+ */
+ public static String getProviderName(IBundleGroup bundleGroup) {
+ return bundleGroup.getProviderName();
+ }
+
+ /**
+ * Returns the feature version id.
+ */
+ public static String getFeatureVersion(IBundleGroup bundleGroup) {
+ return bundleGroup.getVersion();
+ }
/**
* A Feature's branding plugin id.
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ChangeToPerspectiveMenu.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ChangeToPerspectiveMenu.java
index eb36bf5a6dc..4a4b2ce33e4 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ChangeToPerspectiveMenu.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ChangeToPerspectiveMenu.java
@@ -37,28 +37,26 @@ import org.eclipse.ui.internal.util.PrefUtil;
import org.eclipse.ui.statushandlers.StatusManager;
/**
- * Change the perspective of the active page in the window
- * to the selected one.
+ * Change the perspective of the active page in the window to the selected one.
*/
public class ChangeToPerspectiveMenu extends PerspectiveMenu {
- /**
- * Constructor for ChangeToPerspectiveMenu.
- *
- * @param window the workbench window this action applies to
- * @param id the menu id
- */
- public ChangeToPerspectiveMenu(IWorkbenchWindow window, String id) {
- super(window, id);
- // indicate that a open perspectives submenu has been created
+ /**
+ * Constructor for ChangeToPerspectiveMenu.
+ *
+ * @param window the workbench window this action applies to
+ * @param id the menu id
+ */
+ public ChangeToPerspectiveMenu(IWorkbenchWindow window, String id) {
+ super(window, id);
+ // indicate that a open perspectives submenu has been created
if (window instanceof WorkbenchWindow) {
- ((WorkbenchWindow) window)
- .addSubmenu(WorkbenchWindow.OPEN_PERSPECTIVE_SUBMENU);
+ ((WorkbenchWindow) window).addSubmenu(WorkbenchWindow.OPEN_PERSPECTIVE_SUBMENU);
}
- showActive(true);
- }
+ showActive(true);
+ }
- @Override
+ @Override
protected void run(IPerspectiveDescriptor desc) {
IPreferenceStore store = PrefUtil.getInternalPreferenceStore();
int mode = store.getInt(IPreferenceConstants.OPEN_PERSP_MODE);
@@ -68,50 +66,37 @@ public class ChangeToPerspectiveMenu extends PerspectiveMenu {
persp = page.getPerspective();
}
- IHandlerService handlerService = getWindow()
- .getService(IHandlerService.class);
- ICommandService commandService = getWindow()
- .getService(ICommandService.class);
+ IHandlerService handlerService = getWindow().getService(IHandlerService.class);
+ ICommandService commandService = getWindow().getService(ICommandService.class);
- Command command = commandService
- .getCommand(IWorkbenchCommandConstants.PERSPECTIVES_SHOW_PERSPECTIVE);
+ Command command = commandService.getCommand(IWorkbenchCommandConstants.PERSPECTIVES_SHOW_PERSPECTIVE);
Map parameters = new HashMap();
- parameters
- .put(
- IWorkbenchCommandConstants.PERSPECTIVES_SHOW_PERSPECTIVE_PARM_ID,
- desc.getId());
+ parameters.put(IWorkbenchCommandConstants.PERSPECTIVES_SHOW_PERSPECTIVE_PARM_ID, desc.getId());
// Only open a new window if user preference is set and the window
// has an active perspective.
if (IPreferenceConstants.OPM_NEW_WINDOW == mode && persp != null) {
- //Call the handler!
- //Set up the param for newWindow!
- parameters
- .put(
- "org.eclipse.ui.perspectives.showPerspective.newWindow", "true"); //$NON-NLS-1$//$NON-NLS-2$
+ // Call the handler!
+ // Set up the param for newWindow!
+ parameters.put("org.eclipse.ui.perspectives.showPerspective.newWindow", "true"); //$NON-NLS-1$//$NON-NLS-2$
}
- ParameterizedCommand pCommand = ParameterizedCommand.generateCommand(
- command, parameters);
+ ParameterizedCommand pCommand = ParameterizedCommand.generateCommand(command, parameters);
try {
handlerService.executeCommand(pCommand, null);
} catch (ExecutionException e) {
- StatusManager.getManager().handle(
- new Status(IStatus.WARNING, WorkbenchPlugin.PI_WORKBENCH,
- "Failed to execute " + IWorkbenchCommandConstants.PERSPECTIVES_SHOW_PERSPECTIVE, e)); //$NON-NLS-1$
+ StatusManager.getManager().handle(new Status(IStatus.WARNING, WorkbenchPlugin.PI_WORKBENCH,
+ "Failed to execute " + IWorkbenchCommandConstants.PERSPECTIVES_SHOW_PERSPECTIVE, e)); //$NON-NLS-1$
} catch (NotDefinedException e) {
- StatusManager.getManager().handle(
- new Status(IStatus.WARNING, WorkbenchPlugin.PI_WORKBENCH,
- "Failed to execute " + IWorkbenchCommandConstants.PERSPECTIVES_SHOW_PERSPECTIVE, e)); //$NON-NLS-1$
+ StatusManager.getManager().handle(new Status(IStatus.WARNING, WorkbenchPlugin.PI_WORKBENCH,
+ "Failed to execute " + IWorkbenchCommandConstants.PERSPECTIVES_SHOW_PERSPECTIVE, e)); //$NON-NLS-1$
} catch (NotEnabledException e) {
- StatusManager.getManager().handle(
- new Status(IStatus.WARNING, WorkbenchPlugin.PI_WORKBENCH,
- "Failed to execute " + IWorkbenchCommandConstants.PERSPECTIVES_SHOW_PERSPECTIVE, e)); //$NON-NLS-1$
+ StatusManager.getManager().handle(new Status(IStatus.WARNING, WorkbenchPlugin.PI_WORKBENCH,
+ "Failed to execute " + IWorkbenchCommandConstants.PERSPECTIVES_SHOW_PERSPECTIVE, e)); //$NON-NLS-1$
} catch (NotHandledException e) {
- StatusManager.getManager().handle(
- new Status(IStatus.WARNING, WorkbenchPlugin.PI_WORKBENCH,
- "Failed to execute " + IWorkbenchCommandConstants.PERSPECTIVES_SHOW_PERSPECTIVE, e)); //$NON-NLS-1$
+ StatusManager.getManager().handle(new Status(IStatus.WARNING, WorkbenchPlugin.PI_WORKBENCH,
+ "Failed to execute " + IWorkbenchCommandConstants.PERSPECTIVES_SHOW_PERSPECTIVE, e)); //$NON-NLS-1$
}
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CloseAllHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CloseAllHandler.java
index 275b4f09e90..cec6f9029e3 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CloseAllHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CloseAllHandler.java
@@ -46,8 +46,7 @@ public class CloseAllHandler extends AbstractEvaluationHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- IWorkbenchWindow window = HandlerUtil
- .getActiveWorkbenchWindowChecked(event);
+ IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
IWorkbenchPage page = window.getActivePage();
if (page != null) {
page.closeAllEditors(true);
@@ -61,8 +60,7 @@ public class CloseAllHandler extends AbstractEvaluationHandler {
if (enabledWhen == null) {
enabledWhen = new Expression() {
@Override
- public EvaluationResult evaluate(IEvaluationContext context)
- throws CoreException {
+ public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
IWorkbenchPart part = InternalHandlerUtil.getActivePart(context);
Object perspective = InternalHandlerUtil.getVariable(context,
ISources.ACTIVE_WORKBENCH_WINDOW_ACTIVE_PERSPECTIVE_NAME);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CloseAllSavedAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CloseAllSavedAction.java
index 32b26401a7e..b7c54a584b8 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CloseAllSavedAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CloseAllSavedAction.java
@@ -25,112 +25,111 @@ import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
/**
- * Closes all editors except ones with unsaved changes.
+ * Closes all editors except ones with unsaved changes.
*/
-public class CloseAllSavedAction extends PageEventAction implements
- IPropertyListener {
+public class CloseAllSavedAction extends PageEventAction implements IPropertyListener {
- /**
- * List of parts (element type: <code>IWorkbenchPart</code>)
- * against which this class has outstanding property listeners registered.
- */
- private List partsWithListeners = new ArrayList(1);
+ /**
+ * List of parts (element type: <code>IWorkbenchPart</code>) against which this
+ * class has outstanding property listeners registered.
+ */
+ private List partsWithListeners = new ArrayList(1);
- /**
- * Create an instance of this class.
- * @param window the window
- */
- public CloseAllSavedAction(IWorkbenchWindow window) {
- super(WorkbenchMessages.CloseAllSavedAction_text, window);
- setToolTipText(WorkbenchMessages.CloseAllSavedAction_toolTip);
- // @issue Should create a ID in IWorkbenchActionConstants when it becames API?
- setId("closeAllSaved"); //$NON-NLS-1$
- updateState();
- window.getWorkbench().getHelpSystem().setHelp(this,
- IWorkbenchHelpContextIds.CLOSE_ALL_SAVED_ACTION);
- setActionDefinitionId("org.eclipse.ui.file.closeAllSaved"); //$NON-NLS-1$
- }
+ /**
+ * Create an instance of this class.
+ *
+ * @param window the window
+ */
+ public CloseAllSavedAction(IWorkbenchWindow window) {
+ super(WorkbenchMessages.CloseAllSavedAction_text, window);
+ setToolTipText(WorkbenchMessages.CloseAllSavedAction_toolTip);
+ // @issue Should create a ID in IWorkbenchActionConstants when it becames API?
+ setId("closeAllSaved"); //$NON-NLS-1$
+ updateState();
+ window.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.CLOSE_ALL_SAVED_ACTION);
+ setActionDefinitionId("org.eclipse.ui.file.closeAllSaved"); //$NON-NLS-1$
+ }
- @Override
+ @Override
public void pageActivated(IWorkbenchPage page) {
- super.pageActivated(page);
- updateState();
- }
+ super.pageActivated(page);
+ updateState();
+ }
- @Override
+ @Override
public void pageClosed(IWorkbenchPage page) {
- super.pageClosed(page);
- updateState();
- }
+ super.pageClosed(page);
+ updateState();
+ }
- @Override
+ @Override
public void partClosed(IWorkbenchPart part) {
- super.partClosed(part);
- if (part instanceof IEditorPart) {
- part.removePropertyListener(this);
- partsWithListeners.remove(part);
- updateState();
- }
- }
+ super.partClosed(part);
+ if (part instanceof IEditorPart) {
+ part.removePropertyListener(this);
+ partsWithListeners.remove(part);
+ updateState();
+ }
+ }
- @Override
+ @Override
public void partOpened(IWorkbenchPart part) {
- super.partOpened(part);
- if (part instanceof IEditorPart) {
- part.addPropertyListener(this);
- partsWithListeners.add(part);
- updateState();
- }
- }
+ super.partOpened(part);
+ if (part instanceof IEditorPart) {
+ part.addPropertyListener(this);
+ partsWithListeners.add(part);
+ updateState();
+ }
+ }
- @Override
+ @Override
public void propertyChanged(Object source, int propID) {
- if (source instanceof IEditorPart) {
- if (propID == IEditorPart.PROP_DIRTY) {
- updateState();
- }
- }
- }
+ if (source instanceof IEditorPart) {
+ if (propID == IEditorPart.PROP_DIRTY) {
+ updateState();
+ }
+ }
+ }
- @Override
+ @Override
public void run() {
- if (getWorkbenchWindow() == null) {
- // action has been dispose
- return;
- }
- IWorkbenchPage page = getActivePage();
- if (page != null) {
- ((WorkbenchPage) page).closeAllSavedEditors();
- }
- }
+ if (getWorkbenchWindow() == null) {
+ // action has been dispose
+ return;
+ }
+ IWorkbenchPage page = getActivePage();
+ if (page != null) {
+ ((WorkbenchPage) page).closeAllSavedEditors();
+ }
+ }
- /**
- * Enable the action if there at least one editor open.
- */
- private void updateState() {
- IWorkbenchPage page = getActivePage();
- if (page == null) {
- setEnabled(false);
- return;
- }
- IEditorReference editors[] = page.getEditorReferences();
- for (int i = 0; i < editors.length; i++) {
- if (!editors[i].isDirty()) {
- setEnabled(true);
- return;
- }
- }
- setEnabled(false);
- }
+ /**
+ * Enable the action if there at least one editor open.
+ */
+ private void updateState() {
+ IWorkbenchPage page = getActivePage();
+ if (page == null) {
+ setEnabled(false);
+ return;
+ }
+ IEditorReference editors[] = page.getEditorReferences();
+ for (int i = 0; i < editors.length; i++) {
+ if (!editors[i].isDirty()) {
+ setEnabled(true);
+ return;
+ }
+ }
+ setEnabled(false);
+ }
- @Override
+ @Override
public void dispose() {
- super.dispose();
- for (Iterator it = partsWithListeners.iterator(); it.hasNext();) {
- IWorkbenchPart part = (IWorkbenchPart) it.next();
- part.removePropertyListener(this);
- }
- partsWithListeners.clear();
- }
+ super.dispose();
+ for (Iterator it = partsWithListeners.iterator(); it.hasNext();) {
+ IWorkbenchPart part = (IWorkbenchPart) it.next();
+ part.removePropertyListener(this);
+ }
+ partsWithListeners.clear();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CloseEditorHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CloseEditorHandler.java
index fd6e536dc59..1e4c981ba69 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CloseEditorHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CloseEditorHandler.java
@@ -45,8 +45,7 @@ public class CloseEditorHandler extends AbstractEvaluationHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- IWorkbenchWindow window = HandlerUtil
- .getActiveWorkbenchWindowChecked(event);
+ IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
IEditorPart part = HandlerUtil.getActiveEditorChecked(event);
window.getActivePage().closeEditor(part, true);
@@ -58,10 +57,8 @@ public class CloseEditorHandler extends AbstractEvaluationHandler {
if (enabledWhen == null) {
enabledWhen = new Expression() {
@Override
- public EvaluationResult evaluate(IEvaluationContext context)
- throws CoreException {
- IEditorPart part = InternalHandlerUtil
- .getActiveEditor(context);
+ public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
+ IEditorPart part = InternalHandlerUtil.getActiveEditor(context);
if (part != null) {
return EvaluationResult.TRUE;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CloseOthersHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CloseOthersHandler.java
index 28993a12a79..3edf0bd396f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CloseOthersHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CloseOthersHandler.java
@@ -45,21 +45,18 @@ public class CloseOthersHandler extends AbstractEvaluationHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- IWorkbenchWindow window = HandlerUtil
- .getActiveWorkbenchWindowChecked(event);
+ IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
IWorkbenchPage page = window.getActivePage();
if (page != null) {
IEditorReference[] refArray = page.getEditorReferences();
if (refArray != null && refArray.length > 1) {
IEditorReference[] otherEditors = new IEditorReference[refArray.length - 1];
- IEditorReference activeEditor = (IEditorReference) page
- .getReference(page.getActiveEditor());
+ IEditorReference activeEditor = (IEditorReference) page.getReference(page.getActiveEditor());
for (int i = 0; i < refArray.length; i++) {
if (refArray[i] != activeEditor)
continue;
System.arraycopy(refArray, 0, otherEditors, 0, i);
- System.arraycopy(refArray, i + 1, otherEditors, i,
- refArray.length - 1 - i);
+ System.arraycopy(refArray, i + 1, otherEditors, i, refArray.length - 1 - i);
break;
}
page.closeEditors(otherEditors, true);
@@ -74,15 +71,12 @@ public class CloseOthersHandler extends AbstractEvaluationHandler {
if (enabledWhen == null) {
enabledWhen = new Expression() {
@Override
- public EvaluationResult evaluate(IEvaluationContext context)
- throws CoreException {
- IWorkbenchWindow window = InternalHandlerUtil
- .getActiveWorkbenchWindow(context);
+ public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
+ IWorkbenchWindow window = InternalHandlerUtil.getActiveWorkbenchWindow(context);
if (window != null) {
IWorkbenchPage page = window.getActivePage();
if (page != null) {
- IEditorReference[] refArray = page
- .getEditorReferences();
+ IEditorReference[] refArray = page.getEditorReferences();
if (refArray != null && refArray.length > 1) {
return EvaluationResult.TRUE;
@@ -94,8 +88,7 @@ public class CloseOthersHandler extends AbstractEvaluationHandler {
@Override
public void collectExpressionInfo(ExpressionInfo info) {
- info
- .addVariableNameAccess(ISources.ACTIVE_WORKBENCH_WINDOW_NAME);
+ info.addVariableNameAccess(ISources.ACTIVE_WORKBENCH_WINDOW_NAME);
}
};
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CommandToModelProcessor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CommandToModelProcessor.java
index 505479a4a1e..afaf2b893a0 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CommandToModelProcessor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CommandToModelProcessor.java
@@ -83,7 +83,8 @@ public class CommandToModelProcessor {
final MCommand mCommand = commands.get(cmd.getId());
if (mCommand != null) {
try {
- // This is needed to set the command name and description using the correct locale.
+ // This is needed to set the command name and description using the correct
+ // locale.
String cmdName = cmd.getName();
if (!cmdName.equals(mCommand.getCommandName())) {
mCommand.setCommandName(cmdName);
@@ -110,8 +111,6 @@ public class CommandToModelProcessor {
}
}
-
-
/**
* @param commandManager
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ConfigurationInfo.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ConfigurationInfo.java
index 6eff000768c..b3f34f51373 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ConfigurationInfo.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ConfigurationInfo.java
@@ -42,8 +42,8 @@ import com.ibm.icu.text.DateFormat;
public final class ConfigurationInfo {
/**
- * Return the build id for this instance. This may be <code>null</code> in
- * the event that this property is undefined.
+ * Return the build id for this instance. This may be <code>null</code> in the
+ * event that this property is undefined.
*
* @return the build id or <code>null</code>
*/
@@ -52,15 +52,15 @@ public final class ConfigurationInfo {
}
/**
- * Return a multi-line String that describes the current configuration. This
- * may include but is not limited to system properties, installed bundles,
- * and installed features. The specific format of this message is undefined
- * and may change at any time.
+ * Return a multi-line String that describes the current configuration. This may
+ * include but is not limited to system properties, installed bundles, and
+ * installed features. The specific format of this message is undefined and may
+ * change at any time.
*
* <p>
* The contents of this String are in part constructed via
- * {@link ISystemSummarySection} that are registered with this running
- * instance of the workbench.
+ * {@link ISystemSummarySection} that are registered with this running instance
+ * of the workbench.
* </p>
*
* @return the configuration info
@@ -69,9 +69,7 @@ public final class ConfigurationInfo {
StringWriter out = new StringWriter();
PrintWriter writer = new PrintWriter(out);
writer.println(NLS.bind(WorkbenchMessages.SystemSummary_timeStamp,
- DateFormat
- .getDateTimeInstance(DateFormat.FULL, DateFormat.FULL)
- .format(new Date())));
+ DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL).format(new Date())));
ConfigurationInfo.appendExtensions(writer);
writer.close();
@@ -83,25 +81,21 @@ public final class ConfigurationInfo {
* extension point.
*/
private static void appendExtensions(PrintWriter writer) {
- IConfigurationElement[] configElements = getSortedExtensions(Platform
- .getExtensionRegistry().getConfigurationElementsFor(
- PlatformUI.PLUGIN_ID,
+ IConfigurationElement[] configElements = getSortedExtensions(
+ Platform.getExtensionRegistry().getConfigurationElementsFor(PlatformUI.PLUGIN_ID,
IWorkbenchRegistryConstants.PL_SYSTEM_SUMMARY_SECTIONS));
for (IConfigurationElement element : configElements) {
Object obj = null;
try {
- obj = WorkbenchPlugin.createExtension(element,
- IWorkbenchConstants.TAG_CLASS);
+ obj = WorkbenchPlugin.createExtension(element, IWorkbenchConstants.TAG_CLASS);
} catch (CoreException e) {
- WorkbenchPlugin.log(
- "could not create class attribute for extension", //$NON-NLS-1$
+ WorkbenchPlugin.log("could not create class attribute for extension", //$NON-NLS-1$
e.getStatus());
}
writer.println();
- writer.println(NLS.bind(
- WorkbenchMessages.SystemSummary_sectionTitle, element
- .getAttribute("sectionTitle"))); //$NON-NLS-1$
+ writer.println(
+ NLS.bind(WorkbenchMessages.SystemSummary_sectionTitle, element.getAttribute("sectionTitle"))); //$NON-NLS-1$
if (obj instanceof ISystemSummarySection) {
ISystemSummarySection logSection = (ISystemSummarySection) obj;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ContextToModelProcessor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ContextToModelProcessor.java
index aa22fad4812..91a2928cb75 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ContextToModelProcessor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ContextToModelProcessor.java
@@ -35,7 +35,6 @@ import org.eclipse.ui.internal.contexts.ContextPersistence;
public class ContextToModelProcessor {
private Map<String, MBindingContext> contexts = new HashMap<>();
-
@Execute
void process(MApplication application, IEclipseContext context) {
gatherContexts(application.getRootContext());
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolBarToTrimManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolBarToTrimManager.java
index 039baac4537..e7417bd8b80 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolBarToTrimManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolBarToTrimManager.java
@@ -102,14 +102,14 @@ public class CoolBarToTrimManager extends ContributionManager implements ICoolBa
private IContributionManagerOverrides toolbarOverrides;
/**
- * Field to indicate whether the trim bars have been added to the window's
- * model or not. They should only ever be added once.
+ * Field to indicate whether the trim bars have been added to the window's model
+ * or not. They should only ever be added once.
*/
private boolean trimBarsAdded;
private EModelService modelService;
- public CoolBarToTrimManager(MApplication app, MTrimmedWindow window,
- List<MTrimElement> workbenchTrimElements, IRendererFactory rf) {
+ public CoolBarToTrimManager(MApplication app, MTrimmedWindow window, List<MTrimElement> workbenchTrimElements,
+ IRendererFactory rf) {
application = app;
this.window = window;
rendererFactory = rf;
@@ -189,8 +189,7 @@ public class CoolBarToTrimManager extends ContributionManager implements ICoolBa
return;
}
for (MTrimElement toolBar : topTrim.getChildren()) {
- if (item.getId().equals(toolBar.getElementId())
- && toolBar.getTags().contains(TOOLBAR_SEPARATOR)) {
+ if (item.getId().equals(toolBar.getElementId()) && toolBar.getTags().contains(TOOLBAR_SEPARATOR)) {
// already in the coolbar
return;
}
@@ -771,7 +770,7 @@ public class CoolBarToTrimManager extends ContributionManager implements ICoolBa
private Boolean getOverridenVisibility(IContributionItem item, IContributionManager manager) {
IContributionManagerOverrides overrides = manager.getOverrides();
return overrides == null ? null : overrides.getVisible(item);
- }
+ }
/**
* Computes real item visibility considering possibly overridden state from
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CycleBaseHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CycleBaseHandler.java
index 03268d4e047..c2172893678 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CycleBaseHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CycleBaseHandler.java
@@ -67,15 +67,14 @@ import org.eclipse.ui.keys.IBindingService;
*
*/
-public abstract class CycleBaseHandler extends AbstractHandler implements
- IExecutableExtension {
+public abstract class CycleBaseHandler extends AbstractHandler implements IExecutableExtension {
private Object selection;
protected IWorkbenchWindow window;
// true to go to next and false to go to previous part
protected boolean gotoDirection;
/**
- * The list of key bindings for the backward command when it is open. This
- * value is <code>null</code> if the dialog is not open.
+ * The list of key bindings for the backward command when it is open. This value
+ * is <code>null</code> if the dialog is not open.
*/
private TriggerSequence[] backwardTriggerSequences = null;
@@ -83,12 +82,11 @@ public abstract class CycleBaseHandler extends AbstractHandler implements
protected ParameterizedCommand commandForward = null;
/**
- * The list of key bindings for the forward command when it is open. This
- * value is <code>null</code> if the dialog is not open.
+ * The list of key bindings for the forward command when it is open. This value
+ * is <code>null</code> if the dialog is not open.
*/
private TriggerSequence[] forwardTriggerSequences = null;
-
/**
* Add all items to the dialog in the activation order
*/
@@ -116,7 +114,7 @@ public abstract class CycleBaseHandler extends AbstractHandler implements
window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
IWorkbenchPage page = window.getActivePage();
- IWorkbenchPart activePart= page.getActivePart();
+ IWorkbenchPart activePart = page.getActivePart();
getTriggers();
openDialog((WorkbenchPage) page, activePart);
clearTriggers();
@@ -160,13 +158,13 @@ public abstract class CycleBaseHandler extends AbstractHandler implements
default:
int i;
if (gotoDirection) {
- i= getCurrentItemIndex() + 1;
+ i = getCurrentItemIndex() + 1;
if (i >= tableItemCount)
- i= 0;
+ i = 0;
} else {
- i= getCurrentItemIndex() - 1;
+ i = getCurrentItemIndex() - 1;
if (i < 0)
- i= tableItemCount - 1;
+ i = tableItemCount - 1;
}
table.setSelection(i);
}
@@ -176,12 +174,10 @@ public abstract class CycleBaseHandler extends AbstractHandler implements
dialog.pack();
Rectangle tableBounds = table.getBounds();
- tableBounds.height = Math.min(tableBounds.height, table.getItemHeight()
- * MAX_ITEMS);
+ tableBounds.height = Math.min(tableBounds.height, table.getItemHeight() * MAX_ITEMS);
table.setBounds(tableBounds);
- dialog.setBounds(dialog.computeTrim(tableBounds.x, tableBounds.y,
- tableBounds.width, tableBounds.height));
+ dialog.setBounds(dialog.computeTrim(tableBounds.x, tableBounds.y, tableBounds.width, tableBounds.height));
tc.setWidth(table.getClientArea().width);
table.setFocus();
@@ -205,8 +201,7 @@ public abstract class CycleBaseHandler extends AbstractHandler implements
if (table.equals(e.getSource())) {
TableItem tableItem = table.getItem(new Point(e.x, e.y));
if (fLastItem == null ^ tableItem == null) {
- table.setCursor(tableItem == null ? null : table.getDisplay().getSystemCursor(
- SWT.CURSOR_HAND));
+ table.setCursor(tableItem == null ? null : table.getDisplay().getSystemCursor(SWT.CURSOR_HAND));
}
if (tableItem != null) {
if (!tableItem.equals(fLastItem)) {
@@ -222,8 +217,7 @@ public abstract class CycleBaseHandler extends AbstractHandler implements
setDialogLocation(dialog, activePart);
- final IContextService contextService = window
- .getWorkbench().getService(IContextService.class);
+ final IContextService contextService = window.getWorkbench().getService(IContextService.class);
try {
dialog.open();
addMouseListener(table, dialog);
@@ -255,26 +249,19 @@ public abstract class CycleBaseHandler extends AbstractHandler implements
Rectangle parentBounds = dialog.getParent().getBounds();
// the bounds of the monitor that contains the currently active part.
- Rectangle monitorBounds = activePart == null ? display
-.getPrimaryMonitor().getBounds()
- : ((Control) ((PartSite) activePart.getSite()).getModel().getWidget()).getMonitor()
- .getBounds();
+ Rectangle monitorBounds = activePart == null ? display.getPrimaryMonitor().getBounds()
+ : ((Control) ((PartSite) activePart.getSite()).getModel().getWidget()).getMonitor().getBounds();
// Place it in the center of its parent;
- dialogBounds.x = parentBounds.x
- + ((parentBounds.width - dialogBounds.width) / 2);
- dialogBounds.y = parentBounds.y
- + ((parentBounds.height - dialogBounds.height) / 2);
+ dialogBounds.x = parentBounds.x + ((parentBounds.width - dialogBounds.width) / 2);
+ dialogBounds.y = parentBounds.y + ((parentBounds.height - dialogBounds.height) / 2);
if (!monitorBounds.contains(dialogBounds.x, dialogBounds.y)
- || !monitorBounds.contains(dialogBounds.x + dialogBounds.width,
- dialogBounds.y + dialogBounds.height)) {
+ || !monitorBounds.contains(dialogBounds.x + dialogBounds.width, dialogBounds.y + dialogBounds.height)) {
// Place it in the center of the monitor if it is not visible
// when placed in the center of its parent.
// Ensure the origin is visible on the screen.
- dialogBounds.x = Math.max(0,
- monitorBounds.x + (monitorBounds.width - dialogBounds.width) / 2);
- dialogBounds.y = Math.max(0,
- monitorBounds.y + (monitorBounds.height - dialogBounds.height) / 2);
+ dialogBounds.x = Math.max(0, monitorBounds.x + (monitorBounds.width - dialogBounds.width) / 2);
+ dialogBounds.y = Math.max(0, monitorBounds.y + (monitorBounds.height - dialogBounds.height) / 2);
}
dialog.setLocation(dialogBounds.x, dialogBounds.y);
@@ -289,19 +276,16 @@ public abstract class CycleBaseHandler extends AbstractHandler implements
}
/**
- * Fetch the key bindings for the forward and backward commands. They will
- * not change while the dialog is open, but the context will. Bug 55581.
+ * Fetch the key bindings for the forward and backward commands. They will not
+ * change while the dialog is open, but the context will. Bug 55581.
*/
protected void getTriggers() {
commandForward = getForwardCommand();
commandBackward = getBackwardCommand();
- final IBindingService bindingService = window
- .getWorkbench().getService(IBindingService.class);
- forwardTriggerSequences = bindingService
- .getActiveBindingsFor(commandForward);
- backwardTriggerSequences = bindingService
- .getActiveBindingsFor(commandBackward);
+ final IBindingService bindingService = window.getWorkbench().getService(IBindingService.class);
+ forwardTriggerSequences = bindingService.getActiveBindingsFor(commandForward);
+ backwardTriggerSequences = bindingService.getActiveBindingsFor(commandBackward);
}
protected void addKeyListener(final Table table, final Shell dialog) {
@@ -314,10 +298,8 @@ public abstract class CycleBaseHandler extends AbstractHandler implements
public void keyPressed(KeyEvent e) {
int keyCode = e.keyCode;
char character = e.character;
- int accelerator = SWTKeySupport
- .convertEventToUnmodifiedAccelerator(e);
- KeyStroke keyStroke = SWTKeySupport
- .convertAcceleratorToKeyStroke(accelerator);
+ int accelerator = SWTKeySupport.convertEventToUnmodifiedAccelerator(e);
+ KeyStroke keyStroke = SWTKeySupport.convertAcceleratorToKeyStroke(accelerator);
boolean acceleratorForward = false;
boolean acceleratorBackward = false;
@@ -329,12 +311,9 @@ public abstract class CycleBaseHandler extends AbstractHandler implements
final TriggerSequence triggerSequence = forwardTriggerSequences[i];
// Compare the last key stroke of the binding.
- final Trigger[] triggers = triggerSequence
- .getTriggers();
+ final Trigger[] triggers = triggerSequence.getTriggers();
final int triggersLength = triggers.length;
- if ((triggersLength > 0)
- && (triggers[triggersLength - 1]
- .equals(keyStroke))) {
+ if ((triggersLength > 0) && (triggers[triggersLength - 1].equals(keyStroke))) {
acceleratorForward = true;
break;
}
@@ -349,12 +328,9 @@ public abstract class CycleBaseHandler extends AbstractHandler implements
final TriggerSequence triggerSequence = backwardTriggerSequences[i];
// Compare the last key stroke of the binding.
- final Trigger[] triggers = triggerSequence
- .getTriggers();
+ final Trigger[] triggers = triggerSequence.getTriggers();
final int triggersLength = triggers.length;
- if ((triggersLength > 0)
- && (triggers[triggersLength - 1]
- .equals(keyStroke))) {
+ if ((triggersLength > 0) && (triggers[triggersLength - 1].equals(keyStroke))) {
acceleratorBackward = true;
break;
}
@@ -377,12 +353,9 @@ public abstract class CycleBaseHandler extends AbstractHandler implements
}
int index = table.getSelectionIndex();
- table.setSelection(index >= 1 ? index - 1 : table
- .getItemCount() - 1);
- } else if (keyCode != SWT.ALT && keyCode != SWT.COMMAND
- && keyCode != SWT.CTRL && keyCode != SWT.SHIFT
- && keyCode != SWT.ARROW_DOWN && keyCode != SWT.ARROW_UP
- && keyCode != SWT.ARROW_LEFT
+ table.setSelection(index >= 1 ? index - 1 : table.getItemCount() - 1);
+ } else if (keyCode != SWT.ALT && keyCode != SWT.COMMAND && keyCode != SWT.CTRL && keyCode != SWT.SHIFT
+ && keyCode != SWT.ARROW_DOWN && keyCode != SWT.ARROW_UP && keyCode != SWT.ARROW_LEFT
&& keyCode != SWT.ARROW_RIGHT) {
cancel(dialog);
}
@@ -395,12 +368,9 @@ public abstract class CycleBaseHandler extends AbstractHandler implements
int keyCode = e.keyCode;
int stateMask = e.stateMask;
- final IPreferenceStore store = WorkbenchPlugin.getDefault()
- .getPreferenceStore();
- final boolean stickyCycle = store
- .getBoolean(IPreferenceConstants.STICKY_CYCLE);
- if ((!stickyCycle && (firstKey || quickReleaseMode))
- && keyCode == stateMask) {
+ final IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
+ final boolean stickyCycle = store.getBoolean(IPreferenceConstants.STICKY_CYCLE);
+ if ((!stickyCycle && (firstKey || quickReleaseMode)) && keyCode == stateMask) {
ok(dialog, table);
}
}
@@ -410,9 +380,8 @@ public abstract class CycleBaseHandler extends AbstractHandler implements
/**
* Adds a listener to the given table that blocks all traversal operations.
*
- * @param table
- * The table to which the traversal suppression should be added;
- * must not be <code>null</code>.
+ * @param table The table to which the traversal suppression should be added;
+ * must not be <code>null</code>.
*/
protected final void addTraverseListener(final Table table) {
table.addTraverseListener(event -> event.doit = false);
@@ -421,10 +390,8 @@ public abstract class CycleBaseHandler extends AbstractHandler implements
/**
* Activate the selected item.
*
- * @param page
- * the page
- * @param selectedItem
- * the selected item
+ * @param page the page
+ * @param selectedItem the selected item
*/
protected void activate(IWorkbenchPage page, Object selectedItem) {
if (selectedItem != null) {
@@ -439,17 +406,16 @@ public abstract class CycleBaseHandler extends AbstractHandler implements
page.setEditorAreaVisible(true);
}
if (selectedItem instanceof IWorkbenchPartReference) {
- IWorkbenchPart part = ((IWorkbenchPartReference) selectedItem)
- .getPart(true);
+ IWorkbenchPart part = ((IWorkbenchPartReference) selectedItem).getPart(true);
if (part != null) {
page.activate(part);
}
// the if conditions below do not need to be checked then
return;
}
- if (selectedItem instanceof IPerspectiveDescriptor){
- IPerspectiveDescriptor persp = (IPerspectiveDescriptor) selectedItem;
- page.setPerspective(persp);
+ if (selectedItem instanceof IPerspectiveDescriptor) {
+ IPerspectiveDescriptor persp = (IPerspectiveDescriptor) selectedItem;
+ page.setPerspective(persp);
IWorkbenchPart activePart = page.getActivePart();
if (activePart != null) {
activePart.setFocus();
@@ -522,8 +488,8 @@ public abstract class CycleBaseHandler extends AbstractHandler implements
}
@Override
- public void setInitializationData(IConfigurationElement config,
- String propertyName, Object data) throws CoreException {
+ public void setInitializationData(IConfigurationElement config, String propertyName, Object data)
+ throws CoreException {
gotoDirection = "true".equals(data); //$NON-NLS-1$
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CyclePerspectiveHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CyclePerspectiveHandler.java
index c154775316e..68aaabfc43b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CyclePerspectiveHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CyclePerspectiveHandler.java
@@ -36,8 +36,7 @@ import org.eclipse.ui.model.PerspectiveLabelProvider;
* @since 3.3
*/
public class CyclePerspectiveHandler extends FilteredTableBaseHandler {
- private PerspectiveLabelProvider labelProvider = new PerspectiveLabelProvider(
- false);
+ private PerspectiveLabelProvider labelProvider = new PerspectiveLabelProvider(false);
@Override
protected Object getInput(WorkbenchPage page) {
@@ -69,7 +68,7 @@ public class CyclePerspectiveHandler extends FilteredTableBaseHandler {
@Override
public void dispose() {
- if (labelProvider!=null) {
+ if (labelProvider != null) {
labelProvider.dispose();
labelProvider = null;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CycleViewHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CycleViewHandler.java
index faf9563f5b0..1570c6d0556 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CycleViewHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CycleViewHandler.java
@@ -54,9 +54,9 @@ public class CycleViewHandler extends FilteredTableBaseHandler {
EModelService modelService = page.getWorkbenchWindow().getService(EModelService.class);
MPerspective currentPerspective = page.getCurrentPerspective();
- List<MPart> parts = modelService.findElements(currentPerspective, null, MPart.class, null,
- EModelService.PRESENTATION).stream().filter((p) -> !(p.getObject() instanceof SplitHost))
- .collect(Collectors.toList());
+ List<MPart> parts = modelService
+ .findElements(currentPerspective, null, MPart.class, null, EModelService.PRESENTATION).stream()
+ .filter((p) -> !(p.getObject() instanceof SplitHost)).collect(Collectors.toList());
AtomicBoolean includeEditor = new AtomicBoolean(true);
@@ -97,8 +97,8 @@ public class CycleViewHandler extends FilteredTableBaseHandler {
}
/**
- * Adds the {@link IWorkbenchPartReference} contained in part's transient
- * data, if exists.
+ * Adds the {@link IWorkbenchPartReference} contained in part's transient data,
+ * if exists.
*/
protected void addExistingReference(List<IWorkbenchPartReference> refs, MPart part) {
Object tData = part.getTransientData().get(IWorkbenchPartReference.class.getName());
@@ -118,8 +118,7 @@ public class CycleViewHandler extends FilteredTableBaseHandler {
return getParametrizedCommand(IWorkbenchCommandConstants.WINDOW_NEXT_VIEW);
}
- private ParameterizedCommand getParametrizedCommand(String workbenchCommand)
- {
+ private ParameterizedCommand getParametrizedCommand(String workbenchCommand) {
final ICommandService commandService = window.getWorkbench().getService(ICommandService.class);
final Command command = commandService.getCommand(workbenchCommand);
ParameterizedCommand parameterizedCommand = new ParameterizedCommand(command, null);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DefaultSaveable.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DefaultSaveable.java
index 49b40330846..17cd87e5f1a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DefaultSaveable.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DefaultSaveable.java
@@ -28,8 +28,8 @@ import org.eclipse.ui.PartInitException;
import org.eclipse.ui.Saveable;
/**
- * A default {@link Saveable} implementation that wrappers a regular
- * workbench part (one that does not itself adapt to Saveable).
+ * A default {@link Saveable} implementation that wrappers a regular workbench
+ * part (one that does not itself adapt to Saveable).
*
* @since 3.2
*/
@@ -40,8 +40,7 @@ public class DefaultSaveable extends Saveable {
/**
* Creates a new DefaultSaveable.
*
- * @param part
- * the part represented by this model
+ * @param part the part represented by this model
*/
public DefaultSaveable(IWorkbenchPart part) {
this.part = part;
@@ -118,8 +117,7 @@ public class DefaultSaveable extends Saveable {
if (part instanceof IViewPart) {
IViewPart viewPart = (IViewPart) part;
try {
- page.showView(viewPart.getViewSite().getId(), viewPart
- .getViewSite().getSecondaryId(),
+ page.showView(viewPart.getViewSite().getId(), viewPart.getViewSite().getSecondaryId(),
IWorkbenchPage.VIEW_ACTIVATE);
} catch (PartInitException e) {
return false;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DirtyPerspectiveMarker.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DirtyPerspectiveMarker.java
index f790d17fa45..541ac37f917 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DirtyPerspectiveMarker.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DirtyPerspectiveMarker.java
@@ -34,8 +34,7 @@ public class DirtyPerspectiveMarker {
@Override
public boolean equals(Object o) {
if (o instanceof DirtyPerspectiveMarker) {
- return perspectiveId
- .equals(((DirtyPerspectiveMarker) o).perspectiveId);
+ return perspectiveId.equals(((DirtyPerspectiveMarker) o).perspectiveId);
}
return false;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DragCursors.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DragCursors.java
index 92aa872bbbe..76f3c01b5ab 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DragCursors.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DragCursors.java
@@ -25,155 +25,133 @@ import org.eclipse.ui.ISharedImages;
* Provides the set of cursors used for drag-and-drop.
*/
public class DragCursors {
- public static final int INVALID = 0;
-
- public static final int LEFT = 1;
-
- public static final int RIGHT = 2;
-
- public static final int TOP = 3;
-
- public static final int BOTTOM = 4;
-
- public static final int CENTER = 5;
-
- public static final int OFFSCREEN = 6;
-
- public static final int FASTVIEW = 7;
-
- private static final Cursor cursors[] = new Cursor[8];
-
- public static int positionToDragCursor(int swtPositionConstant) {
- switch (swtPositionConstant) {
- case SWT.LEFT:
- return LEFT;
- case SWT.RIGHT:
- return RIGHT;
- case SWT.TOP:
- return TOP;
- case SWT.BOTTOM:
- return BOTTOM;
- case SWT.CENTER:
- return CENTER;
- }
-
- return INVALID;
- }
-
- /**
- * Converts a drag cursor (LEFT, RIGHT, TOP, BOTTOM, CENTER) into an SWT constant
- * (SWT.LEFT, SWT.RIGHT, SWT.TOP, SWT.BOTTOM, SWT.CENTER)
- *
- * @param dragCursorId
- * @return an SWT.* constant
- */
- public static int dragCursorToSwtConstant(int dragCursorId) {
- switch (dragCursorId) {
- case LEFT:
- return SWT.LEFT;
- case RIGHT:
- return SWT.RIGHT;
- case TOP:
- return SWT.TOP;
- case BOTTOM:
- return SWT.BOTTOM;
- case CENTER:
- return SWT.CENTER;
- }
-
- return SWT.DEFAULT;
- }
+ public static final int INVALID = 0;
+
+ public static final int LEFT = 1;
+
+ public static final int RIGHT = 2;
+
+ public static final int TOP = 3;
+
+ public static final int BOTTOM = 4;
+
+ public static final int CENTER = 5;
+
+ public static final int OFFSCREEN = 6;
+
+ public static final int FASTVIEW = 7;
+
+ private static final Cursor cursors[] = new Cursor[8];
+
+ public static int positionToDragCursor(int swtPositionConstant) {
+ switch (swtPositionConstant) {
+ case SWT.LEFT:
+ return LEFT;
+ case SWT.RIGHT:
+ return RIGHT;
+ case SWT.TOP:
+ return TOP;
+ case SWT.BOTTOM:
+ return BOTTOM;
+ case SWT.CENTER:
+ return CENTER;
+ }
+
+ return INVALID;
+ }
+
+ /**
+ * Converts a drag cursor (LEFT, RIGHT, TOP, BOTTOM, CENTER) into an SWT
+ * constant (SWT.LEFT, SWT.RIGHT, SWT.TOP, SWT.BOTTOM, SWT.CENTER)
+ *
+ * @param dragCursorId
+ * @return an SWT.* constant
+ */
+ public static int dragCursorToSwtConstant(int dragCursorId) {
+ switch (dragCursorId) {
+ case LEFT:
+ return SWT.LEFT;
+ case RIGHT:
+ return SWT.RIGHT;
+ case TOP:
+ return SWT.TOP;
+ case BOTTOM:
+ return SWT.BOTTOM;
+ case CENTER:
+ return SWT.CENTER;
+ }
+
+ return SWT.DEFAULT;
+ }
+
+ /**
+ * Return the cursor for a drop scenario, as identified by code. Code must be
+ * one of INVALID, LEFT, RIGHT, TOP, etc. If the code is not found default to
+ * INVALID.
+ *
+ * @param code the code
+ * @return the cursor
+ */
+ public static Cursor getCursor(int code) {
+ Display display = Display.getCurrent();
+ if (cursors[code] == null) {
+ ImageDescriptor source = null;
+ ImageDescriptor mask = null;
+ switch (code) {
+ case LEFT:
+ source = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJS_DND_LEFT_SOURCE);
+ mask = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJS_DND_LEFT_MASK);
+ cursors[LEFT] = new Cursor(display, source.getImageData(), mask.getImageData(), 16, 16);
+ break;
+ case RIGHT:
+ source = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJS_DND_RIGHT_SOURCE);
+ mask = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJS_DND_RIGHT_MASK);
+ cursors[RIGHT] = new Cursor(display, source.getImageData(), mask.getImageData(), 16, 16);
+ break;
+ case TOP:
+ source = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJS_DND_TOP_SOURCE);
+ mask = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJS_DND_TOP_MASK);
+ cursors[TOP] = new Cursor(display, source.getImageData(), mask.getImageData(), 16, 16);
+ break;
+ case BOTTOM:
+ source = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJS_DND_BOTTOM_SOURCE);
+ mask = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJS_DND_BOTTOM_MASK);
+ cursors[BOTTOM] = new Cursor(display, source.getImageData(), mask.getImageData(), 16, 16);
+ break;
+ case CENTER:
+ source = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJS_DND_STACK_SOURCE);
+ mask = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJS_DND_STACK_MASK);
+ cursors[CENTER] = new Cursor(display, source.getImageData(), mask.getImageData(), 16, 16);
+ break;
+ case OFFSCREEN:
+ source = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJS_DND_OFFSCREEN_SOURCE);
+ mask = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJS_DND_OFFSCREEN_MASK);
+ cursors[OFFSCREEN] = new Cursor(display, source.getImageData(), mask.getImageData(), 16, 16);
+ break;
+ case FASTVIEW:
+ source = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJS_DND_TOFASTVIEW_SOURCE);
+ mask = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJS_DND_TOFASTVIEW_MASK);
+ cursors[FASTVIEW] = new Cursor(Display.getCurrent(), source.getImageData(), mask.getImageData(), 16,
+ 16);
+ break;
+ default:
+ case INVALID:
+ source = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJS_DND_INVALID_SOURCE);
+ mask = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJS_DND_INVALID_MASK);
+ cursors[INVALID] = new Cursor(display, source.getImageData(), mask.getImageData(), 16, 16);
+ break;
+ }
+ }
+ return cursors[code];
+ }
/**
- * Return the cursor for a drop scenario, as identified by code. Code must be one of INVALID,
- * LEFT, RIGHT, TOP, etc. If the code is not found default to INVALID.
- *
- * @param code the code
- * @return the cursor
+ * Disposes all drag-and-drop cursors.
*/
- public static Cursor getCursor(int code) {
- Display display = Display.getCurrent();
- if (cursors[code] == null) {
- ImageDescriptor source = null;
- ImageDescriptor mask = null;
- switch (code) {
- case LEFT:
- source = WorkbenchImages
- .getImageDescriptor(ISharedImages.IMG_OBJS_DND_LEFT_SOURCE);
- mask = WorkbenchImages
- .getImageDescriptor(ISharedImages.IMG_OBJS_DND_LEFT_MASK);
- cursors[LEFT] = new Cursor(display, source.getImageData(), mask
- .getImageData(), 16, 16);
- break;
- case RIGHT:
- source = WorkbenchImages
- .getImageDescriptor(ISharedImages.IMG_OBJS_DND_RIGHT_SOURCE);
- mask = WorkbenchImages
- .getImageDescriptor(ISharedImages.IMG_OBJS_DND_RIGHT_MASK);
- cursors[RIGHT] = new Cursor(display, source.getImageData(),
- mask.getImageData(), 16, 16);
- break;
- case TOP:
- source = WorkbenchImages
- .getImageDescriptor(ISharedImages.IMG_OBJS_DND_TOP_SOURCE);
- mask = WorkbenchImages
- .getImageDescriptor(ISharedImages.IMG_OBJS_DND_TOP_MASK);
- cursors[TOP] = new Cursor(display, source.getImageData(), mask
- .getImageData(), 16, 16);
- break;
- case BOTTOM:
- source = WorkbenchImages
- .getImageDescriptor(ISharedImages.IMG_OBJS_DND_BOTTOM_SOURCE);
- mask = WorkbenchImages
- .getImageDescriptor(ISharedImages.IMG_OBJS_DND_BOTTOM_MASK);
- cursors[BOTTOM] = new Cursor(display, source.getImageData(),
- mask.getImageData(), 16, 16);
- break;
- case CENTER:
- source = WorkbenchImages
- .getImageDescriptor(ISharedImages.IMG_OBJS_DND_STACK_SOURCE);
- mask = WorkbenchImages
- .getImageDescriptor(ISharedImages.IMG_OBJS_DND_STACK_MASK);
- cursors[CENTER] = new Cursor(display, source.getImageData(),
- mask.getImageData(), 16, 16);
- break;
- case OFFSCREEN:
- source = WorkbenchImages
- .getImageDescriptor(ISharedImages.IMG_OBJS_DND_OFFSCREEN_SOURCE);
- mask = WorkbenchImages
- .getImageDescriptor(ISharedImages.IMG_OBJS_DND_OFFSCREEN_MASK);
- cursors[OFFSCREEN] = new Cursor(display, source.getImageData(),
- mask.getImageData(), 16, 16);
- break;
- case FASTVIEW:
- source = WorkbenchImages
- .getImageDescriptor(ISharedImages.IMG_OBJS_DND_TOFASTVIEW_SOURCE);
- mask = WorkbenchImages
- .getImageDescriptor(ISharedImages.IMG_OBJS_DND_TOFASTVIEW_MASK);
- cursors[FASTVIEW] = new Cursor(Display.getCurrent(), source
- .getImageData(), mask.getImageData(), 16, 16);
- break;
- default:
- case INVALID:
- source = WorkbenchImages
- .getImageDescriptor(ISharedImages.IMG_OBJS_DND_INVALID_SOURCE);
- mask = WorkbenchImages
- .getImageDescriptor(ISharedImages.IMG_OBJS_DND_INVALID_MASK);
- cursors[INVALID] = new Cursor(display, source.getImageData(),
- mask.getImageData(), 16, 16);
- break;
- }
- }
- return cursors[code];
- }
-
- /**
- * Disposes all drag-and-drop cursors.
- */
- public static void dispose() {
- for (int idx = 0; idx < cursors.length; idx++) {
- cursors[idx].dispose();
- cursors[idx] = null;
- }
- }
+ public static void dispose() {
+ for (int idx = 0; idx < cursors.length; idx++) {
+ cursors[idx].dispose();
+ cursors[idx] = null;
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DragHandle.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DragHandle.java
index 3ef613338de..d27882c5bc8 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DragHandle.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DragHandle.java
@@ -28,105 +28,105 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
public class DragHandle extends Composite implements PaintListener {
- Image handleImage;
- ImageDescriptor descriptor;
- private boolean isHorizontal;
+ Image handleImage;
+ ImageDescriptor descriptor;
+ private boolean isHorizontal;
- private static int margin = 2;
+ private static int margin = 2;
-public DragHandle(Composite parent) {
- super(parent, SWT.NONE);
+ public DragHandle(Composite parent) {
+ super(parent, SWT.NONE);
- addPaintListener(this);
+ addPaintListener(this);
- descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(WorkbenchPlugin.PI_WORKBENCH, "icons/misc/handle.png"); //$NON-NLS-1$
+ descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(WorkbenchPlugin.PI_WORKBENCH, "icons/misc/handle.png"); //$NON-NLS-1$
- handleImage = new Image(parent.getDisplay(), 4, 4);
- GC context = new GC(handleImage);
- context.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- context.drawPoint(0,0);
- context.drawPoint(2,0);
- context.drawPoint(3,0);
- context.drawPoint(3,1);
- context.drawPoint(0,2);
- context.drawPoint(3,2);
- context.drawPoint(0,3);
- context.drawPoint(1,3);
- context.drawPoint(2,3);
- context.drawPoint(3,3);
+ handleImage = new Image(parent.getDisplay(), 4, 4);
+ GC context = new GC(handleImage);
+ context.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
+ context.drawPoint(0, 0);
+ context.drawPoint(2, 0);
+ context.drawPoint(3, 0);
+ context.drawPoint(3, 1);
+ context.drawPoint(0, 2);
+ context.drawPoint(3, 2);
+ context.drawPoint(0, 3);
+ context.drawPoint(1, 3);
+ context.drawPoint(2, 3);
+ context.drawPoint(3, 3);
- context.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));
- context.drawPoint(1,0);
- context.drawPoint(0,1);
+ context.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));
+ context.drawPoint(1, 0);
+ context.drawPoint(0, 1);
- context.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW));
- context.drawPoint(1,1);
+ context.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW));
+ context.drawPoint(1, 1);
- context.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW));
- context.drawPoint(1,2);
- context.drawPoint(2,1);
- context.drawPoint(2,2);
+ context.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW));
+ context.drawPoint(1, 2);
+ context.drawPoint(2, 1);
+ context.drawPoint(2, 2);
- context.dispose();
+ context.dispose();
setCursor(parent.getDisplay().getSystemCursor(SWT.CURSOR_SIZEALL));
-}
-
-@Override
-public void paintControl(PaintEvent e) {
- Point size = getSize();
-
- if (handleImage != null) {
- Rectangle ibounds = handleImage.getBounds();
-
-
- int x = ((size.x - 2 * margin) % ibounds.width) / 2 + margin;
- int y = ((size.y - 2 * margin) % ibounds.height) / 2 + margin;
-
- for (;;) {
- e.gc.drawImage(handleImage, x, y);
- if (isHorizontal) {
- x += ibounds.width;
- if (x + ibounds.width > size.x - margin) {
- break;
- }
- } else {
- y += ibounds.height;
- if (y + ibounds.height > size.y - margin) {
- break;
+ }
+
+ @Override
+ public void paintControl(PaintEvent e) {
+ Point size = getSize();
+
+ if (handleImage != null) {
+ Rectangle ibounds = handleImage.getBounds();
+
+ int x = ((size.x - 2 * margin) % ibounds.width) / 2 + margin;
+ int y = ((size.y - 2 * margin) % ibounds.height) / 2 + margin;
+
+ for (;;) {
+ e.gc.drawImage(handleImage, x, y);
+ if (isHorizontal) {
+ x += ibounds.width;
+ if (x + ibounds.width > size.x - margin) {
+ break;
+ }
+ } else {
+ y += ibounds.height;
+ if (y + ibounds.height > size.y - margin) {
+ break;
+ }
}
- }
- }
- }
-}
-@Override
-public Point computeSize(int wHint, int hHint, boolean changed) {
- Point result = new Point(wHint, hHint);
-
- Rectangle ibounds = handleImage.getBounds();
-
- if (wHint == SWT.DEFAULT) {
- result.x = ibounds.width + 2 * margin;
- }
-
- if (hHint == SWT.DEFAULT) {
- result.y = ibounds.height + 2 * margin;
- }
-
- return result;
-}
-
-public void setHorizontal(boolean isHorizontal) {
- this.isHorizontal = isHorizontal;
-}
-
-@Override
-public void dispose() {
- if (isDisposed()) {
- return;
- }
- super.dispose();
- handleImage.dispose();
- JFaceResources.getResources().destroyImage(descriptor);
-}
+ }
+ }
+ }
+
+ @Override
+ public Point computeSize(int wHint, int hHint, boolean changed) {
+ Point result = new Point(wHint, hHint);
+
+ Rectangle ibounds = handleImage.getBounds();
+
+ if (wHint == SWT.DEFAULT) {
+ result.x = ibounds.width + 2 * margin;
+ }
+
+ if (hHint == SWT.DEFAULT) {
+ result.y = ibounds.height + 2 * margin;
+ }
+
+ return result;
+ }
+
+ public void setHorizontal(boolean isHorizontal) {
+ this.isHorizontal = isHorizontal;
+ }
+
+ @Override
+ public void dispose() {
+ if (isDisposed()) {
+ return;
+ }
+ super.dispose();
+ handleImage.dispose();
+ JFaceResources.getResources().destroyImage(descriptor);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/E4PartWrapper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/E4PartWrapper.java
index d6201bfd249..5cba60b79d0 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/E4PartWrapper.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/E4PartWrapper.java
@@ -66,4 +66,3 @@ public class E4PartWrapper extends ViewPart {
}
}
}
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EarlyStartupRunnable.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EarlyStartupRunnable.java
index 2d52a609df8..1f16ff6c614 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EarlyStartupRunnable.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EarlyStartupRunnable.java
@@ -32,17 +32,16 @@ import org.eclipse.ui.internal.misc.UIStats;
*/
public class EarlyStartupRunnable extends SafeRunnable {
- private IExtension extension;
+ private IExtension extension;
- /**
- * @param extension
- * must not be null
- */
- public EarlyStartupRunnable(IExtension extension) {
- this.extension = extension;
- }
+ /**
+ * @param extension must not be null
+ */
+ public EarlyStartupRunnable(IExtension extension) {
+ this.extension = extension;
+ }
- @Override
+ @Override
public void run() throws Exception {
IConfigurationElement[] configElements = extension.getConfigurationElements();
if (configElements.length == 0) {
@@ -50,29 +49,29 @@ public class EarlyStartupRunnable extends SafeRunnable {
extension.getContributor().getName() + "' does not provide a valid '" //$NON-NLS-1$
+ IWorkbenchConstants.TAG_STARTUP + "' element."); //$NON-NLS-1$
}
- // look for the startup tag in each element and run the extension
- for (IConfigurationElement element : configElements) {
- if (element != null&& element.getName().equals(IWorkbenchConstants.TAG_STARTUP)) {
- runEarlyStartup(WorkbenchPlugin.createExtension(element, IWorkbenchConstants.TAG_CLASS));
- }
- }
- }
+ // look for the startup tag in each element and run the extension
+ for (IConfigurationElement element : configElements) {
+ if (element != null && element.getName().equals(IWorkbenchConstants.TAG_STARTUP)) {
+ runEarlyStartup(WorkbenchPlugin.createExtension(element, IWorkbenchConstants.TAG_CLASS));
+ }
+ }
+ }
private void missingStartupElementMessage(String message) {
IStatus status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0, message, null);
WorkbenchPlugin.log(status);
}
- @Override
+ @Override
public void handleException(Throwable exception) {
IStatus status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0,
"Unable to execute early startup code for the org.eclipse.ui.IStartup extension contributed by the '" //$NON-NLS-1$
+ extension.getContributor().getName() + "' plug-in.", //$NON-NLS-1$
- exception);
+ exception);
WorkbenchPlugin.log(status);
- }
+ }
- private void runEarlyStartup(Object executableExtension) {
+ private void runEarlyStartup(Object executableExtension) {
if (executableExtension instanceof IStartup) {
String methodName = executableExtension.getClass().getName() + ".earlyStartup"; //$NON-NLS-1$
try {
@@ -82,15 +81,14 @@ public class EarlyStartupRunnable extends SafeRunnable {
UIStats.end(UIStats.EARLY_STARTUP, executableExtension, methodName);
}
} else {
- String message = executableExtension == null ?
- "The org.eclipse.ui.IStartup extension from '" + extension.getContributor().getName() //$NON-NLS-1$
- + "' does not provide a valid class attribute." : //$NON-NLS-1$
- MessageFormat.format("Startup class {0} must implement org.eclipse.ui.IStartup", //$NON-NLS-1$
+ String message = executableExtension == null
+ ? "The org.eclipse.ui.IStartup extension from '" + extension.getContributor().getName() //$NON-NLS-1$
+ + "' does not provide a valid class attribute." //$NON-NLS-1$
+ : MessageFormat.format("Startup class {0} must implement org.eclipse.ui.IStartup", //$NON-NLS-1$
executableExtension.getClass().getName());
- IStatus status =
- new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0, message, null);
+ IStatus status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0, message, null);
WorkbenchPlugin.log(status);
- }
- }
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorActionBars.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorActionBars.java
index f3b6bd8e4a0..ef55797cb4f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorActionBars.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorActionBars.java
@@ -62,9 +62,8 @@ public class EditorActionBars extends SubActionBars2 {
@Override
public Boolean getEnabled(IContributionItem item) {
- if (((item instanceof ActionContributionItem) && (((ActionContributionItem) item)
- .getAction() instanceof RetargetAction))
- || enabledAllowed) {
+ if (((item instanceof ActionContributionItem)
+ && (((ActionContributionItem) item).getAction() instanceof RetargetAction)) || enabledAllowed) {
return null;
}
return Boolean.FALSE;
@@ -82,10 +81,10 @@ public class EditorActionBars extends SubActionBars2 {
}
/**
- * A switch controlling verbose debugging options surrounding the disposal
- * of tool bar contribution items. There have been problems in the past with
- * reusing disposed items, and leaking memory by failing to drop references
- * to disposed items.
+ * A switch controlling verbose debugging options surrounding the disposal of
+ * tool bar contribution items. There have been problems in the past with
+ * reusing disposed items, and leaking memory by failing to drop references to
+ * disposed items.
*/
private static final boolean DEBUG_TOOLBAR_DISPOSAL = Policy.DEBUG_TOOLBAR_DISPOSAL;
@@ -165,10 +164,10 @@ public class EditorActionBars extends SubActionBars2 {
}
/*
- * Dispose of the contribution item, but also make sure that no one else
- * is holding on to it. In this case, go through the SubCoolBarManager
- * to its parent (the real CoolBarManager), and replace the reference
- * with a placeholder.
+ * Dispose of the contribution item, but also make sure that no one else is
+ * holding on to it. In this case, go through the SubCoolBarManager to its
+ * parent (the real CoolBarManager), and replace the reference with a
+ * placeholder.
*/
if (toolBarContributionItem != null) {
// Create a placeholder and place it in the cool bar manager.
@@ -180,14 +179,13 @@ public class EditorActionBars extends SubActionBars2 {
CoolBarToTrimManager trimManager = (CoolBarToTrimManager) manager;
trimManager.remove(toolBarContributionItem);
} else if (manager instanceof ContributionManager) {
- final IContributionItem replacementItem = new PlaceholderContributionItem(
- toolBarContributionItem);
- boolean succeeded = ((ContributionManager) manager).replaceItem(replacementItem
- .getId(), replacementItem);
+ final IContributionItem replacementItem = new PlaceholderContributionItem(toolBarContributionItem);
+ boolean succeeded = ((ContributionManager) manager).replaceItem(replacementItem.getId(),
+ replacementItem);
if (!succeeded && DEBUG_TOOLBAR_DISPOSAL) {
System.out.println("FAILURE WHILE DISPOSING EditorActionBars"); //$NON-NLS-1$
- System.out
- .println("Could not replace " + replacementItem.getId() + " in the contribution manager."); //$NON-NLS-1$ //$NON-NLS-2$
+ System.out.println(
+ "Could not replace " + replacementItem.getId() + " in the contribution manager."); //$NON-NLS-1$ //$NON-NLS-2$
}
} else if (DEBUG_TOOLBAR_DISPOSAL) {
System.out.println("FAILURE WHILE DISPOSING EditorActionBars"); //$NON-NLS-1$
@@ -242,9 +240,9 @@ public class EditorActionBars extends SubActionBars2 {
}
/**
- * Returns the tool bar manager. If items are added or removed from the
- * manager be sure to call <code>updateActionBars</code>. Overridden to
- * support CoolBars.
+ * Returns the tool bar manager. If items are added or removed from the manager
+ * be sure to call <code>updateActionBars</code>. Overridden to support
+ * CoolBars.
*
* @return the tool bar manager
*/
@@ -271,24 +269,20 @@ public class EditorActionBars extends SubActionBars2 {
coolItemToolBarMgr = new ToolBarManager2(SWT.FLAT);
toolBarContributionItem = new ToolBarContributionItem2(coolItemToolBarMgr, type);
// Add editor item to group
- coolBarManager.prependToGroup(IWorkbenchActionConstants.GROUP_EDITOR,
- toolBarContributionItem);
+ coolBarManager.prependToGroup(IWorkbenchActionConstants.GROUP_EDITOR, toolBarContributionItem);
}
} else {
coolItemToolBarMgr = new ToolBarManager2(SWT.FLAT);
if ((coolBarManager instanceof ContributionManager)
&& (foundItem instanceof PlaceholderContributionItem)) {
PlaceholderContributionItem placeholder = (PlaceholderContributionItem) foundItem;
- toolBarContributionItem = createToolBarContributionItem(coolItemToolBarMgr,
- placeholder);
+ toolBarContributionItem = createToolBarContributionItem(coolItemToolBarMgr, placeholder);
// Restore from a placeholder
- ((ContributionManager) coolBarManager).replaceItem(type,
- toolBarContributionItem);
+ ((ContributionManager) coolBarManager).replaceItem(type, toolBarContributionItem);
} else {
toolBarContributionItem = new ToolBarContributionItem2(coolItemToolBarMgr, type);
// Add editor item to group
- coolBarManager.prependToGroup(IWorkbenchActionConstants.GROUP_EDITOR,
- toolBarContributionItem);
+ coolBarManager.prependToGroup(IWorkbenchActionConstants.GROUP_EDITOR, toolBarContributionItem);
}
}
((ContributionManager) coolItemToolBarMgr).setOverrides(new Overrides());
@@ -300,13 +294,12 @@ public class EditorActionBars extends SubActionBars2 {
}
/*
- * Creates a new tool bar contribution item on the given manager -- using
- * the stored data to initialize some of its properties.
+ * Creates a new tool bar contribution item on the given manager -- using the
+ * stored data to initialize some of its properties.
*/
IToolBarContributionItem createToolBarContributionItem(final IToolBarManager manager,
PlaceholderContributionItem item) {
- IToolBarContributionItem toolBarContributionItem = new ToolBarContributionItem2(manager,
- item.getId());
+ IToolBarContributionItem toolBarContributionItem = new ToolBarContributionItem2(manager, item.getId());
toolBarContributionItem.setCurrentHeight(item.getHeight());
toolBarContributionItem.setCurrentWidth(item.getWidth());
toolBarContributionItem.setMinimumItemsToShow(item.getMinimumItemsToShow());
@@ -316,8 +309,8 @@ public class EditorActionBars extends SubActionBars2 {
/**
* Returns whether the contribution list is visible. If the visibility is
- * <code>true</code> then each item within the manager appears within the
- * parent manager. Otherwise, the items are not visible.
+ * <code>true</code> then each item within the manager appears within the parent
+ * manager. Otherwise, the items are not visible.
*
* @return <code>true</code> if the manager is visible
*/
@@ -329,10 +322,9 @@ public class EditorActionBars extends SubActionBars2 {
}
/**
- * Sets the target part for the action bars. For views this is ignored
- * because each view has its own action vector. For editors this is
- * important because the action vector is shared by editors of the same
- * type.
+ * Sets the target part for the action bars. For views this is ignored because
+ * each view has its own action vector. For editors this is important because
+ * the action vector is shared by editors of the same type.
*/
@Override
public void partChanged(IWorkbenchPart part) {
@@ -358,10 +350,9 @@ public class EditorActionBars extends SubActionBars2 {
/**
* Activate / Deactivate the contributions.
*
- * Workaround for flashing when editor contributes many menu/tool
- * contributions. In this case, the force visibility flag determines if the
- * contributions should be actually made visible/hidden or just change the
- * enablement state.
+ * Workaround for flashing when editor contributes many menu/tool contributions.
+ * In this case, the force visibility flag determines if the contributions
+ * should be actually made visible/hidden or just change the enablement state.
*/
private void setActive(boolean set, boolean forceVisibility) {
basicSetActive(set);
@@ -386,8 +377,7 @@ public class EditorActionBars extends SubActionBars2 {
/**
* Sets the enablement ability of all the items contributed by the editor.
*
- * @param enabledAllowed
- * <code>true</code> if the items may enable
+ * @param enabledAllowed <code>true</code> if the items may enable
* @since 2.0
*/
private void setEnabledAllowed(boolean enabledAllowed) {
@@ -412,12 +402,11 @@ public class EditorActionBars extends SubActionBars2 {
}
/**
- * Sets the visibility of the manager. If the visibility is
- * <code>true</code> then each item within the manager appears within the
- * parent manager. Otherwise, the items are not visible.
+ * Sets the visibility of the manager. If the visibility is <code>true</code>
+ * then each item within the manager appears within the parent manager.
+ * Otherwise, the items are not visible.
*
- * @param visible
- * the new visibility
+ * @param visible the new visibility
*/
private void setVisible(boolean visible) {
if (toolBarContributionItem != null) {
@@ -429,22 +418,20 @@ public class EditorActionBars extends SubActionBars2 {
}
/**
- * Sets the visibility of the manager. If the visibility is
- * <code>true</code> then each item within the manager appears within the
- * parent manager. Otherwise, the items are not visible if force visibility
- * is <code>true</code>, or grayed out if force visibility is
- * <code>false</code>
+ * Sets the visibility of the manager. If the visibility is <code>true</code>
+ * then each item within the manager appears within the parent manager.
+ * Otherwise, the items are not visible if force visibility is
+ * <code>true</code>, or grayed out if force visibility is <code>false</code>
* <p>
- * This is a workaround for the layout flashing when editors contribute
- * large amounts of items.
+ * This is a workaround for the layout flashing when editors contribute large
+ * amounts of items.
* </p>
*
- * @param visible
- * the new visibility
- * @param forceVisibility
- * <code>true</code> to change the visibility or
- * <code>false</code> to change just the enablement state. This
- * parameter is ignored if visible is <code>true</code>.
+ * @param visible the new visibility
+ * @param forceVisibility <code>true</code> to change the visibility or
+ * <code>false</code> to change just the enablement
+ * state. This parameter is ignored if visible is
+ * <code>true</code>.
*/
private void setVisible(boolean visible, boolean forceVisibility) {
if (visible) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorActionBuilder.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorActionBuilder.java
index d525c90d06e..6aa49d0f86a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorActionBuilder.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorActionBuilder.java
@@ -24,113 +24,106 @@ import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants;
/**
- * This class reads the registry for extensions that plug into
- * 'editorActions' extension point.
+ * This class reads the registry for extensions that plug into 'editorActions'
+ * extension point.
*/
public class EditorActionBuilder extends PluginActionBuilder {
- private static final String TAG_CONTRIBUTION_TYPE = "editorContribution"; //$NON-NLS-1$
+ private static final String TAG_CONTRIBUTION_TYPE = "editorContribution"; //$NON-NLS-1$
- /**
- * The constructor.
- */
- public EditorActionBuilder() {
- }
+ /**
+ * The constructor.
+ */
+ public EditorActionBuilder() {
+ }
- @Override
- protected ActionDescriptor createActionDescriptor(
- IConfigurationElement element) {
- return new ActionDescriptor(element, ActionDescriptor.T_EDITOR);
- }
+ @Override
+ protected ActionDescriptor createActionDescriptor(IConfigurationElement element) {
+ return new ActionDescriptor(element, ActionDescriptor.T_EDITOR);
+ }
- @Override
+ @Override
protected BasicContribution createContribution() {
- return new EditorContribution();
- }
+ return new EditorContribution();
+ }
- /**
- * Reads and apply all external contributions for this editor's ID
- * registered in 'editorActions' extension point.
- */
- public IEditorActionBarContributor readActionExtensions(
- IEditorDescriptor desc) {
- ExternalContributor ext = null;
- readContributions(desc.getId(), TAG_CONTRIBUTION_TYPE,
- IWorkbenchRegistryConstants.PL_EDITOR_ACTIONS);
- if (cache != null) {
- ext = new ExternalContributor(cache);
- cache = null;
- }
- return ext;
- }
+ /**
+ * Reads and apply all external contributions for this editor's ID registered in
+ * 'editorActions' extension point.
+ */
+ public IEditorActionBarContributor readActionExtensions(IEditorDescriptor desc) {
+ ExternalContributor ext = null;
+ readContributions(desc.getId(), TAG_CONTRIBUTION_TYPE, IWorkbenchRegistryConstants.PL_EDITOR_ACTIONS);
+ if (cache != null) {
+ ext = new ExternalContributor(cache);
+ cache = null;
+ }
+ return ext;
+ }
- /**
- * Helper class to collect the menus and actions defined within a
- * contribution element.
- */
- private static class EditorContribution extends BasicContribution {
- @Override
+ /**
+ * Helper class to collect the menus and actions defined within a contribution
+ * element.
+ */
+ private static class EditorContribution extends BasicContribution {
+ @Override
public void dispose() {
disposeActions();
super.dispose();
- }
+ }
- public void editorChanged(IEditorPart editor) {
- if (actions != null) {
- for (int i = 0; i < actions.size(); i++) {
- ActionDescriptor ad = (ActionDescriptor) actions.get(i);
- EditorPluginAction action = (EditorPluginAction) ad
- .getAction();
- action.editorChanged(editor);
- }
- }
- }
- }
+ public void editorChanged(IEditorPart editor) {
+ if (actions != null) {
+ for (int i = 0; i < actions.size(); i++) {
+ ActionDescriptor ad = (ActionDescriptor) actions.get(i);
+ EditorPluginAction action = (EditorPluginAction) ad.getAction();
+ action.editorChanged(editor);
+ }
+ }
+ }
+ }
- /**
- * Helper class that will populate the menu and toobar with the external
- * editor contributions.
- */
- public static class ExternalContributor implements
- IEditorActionBarContributor {
- private ArrayList cache;
+ /**
+ * Helper class that will populate the menu and toobar with the external editor
+ * contributions.
+ */
+ public static class ExternalContributor implements IEditorActionBarContributor {
+ private ArrayList cache;
- public ExternalContributor(ArrayList cache) {
- this.cache = cache;
- }
+ public ExternalContributor(ArrayList cache) {
+ this.cache = cache;
+ }
- @Override
+ @Override
public void dispose() {
- for (int i = 0; i < cache.size(); i++) {
- ((EditorContribution) cache.get(i)).dispose();
- }
- }
+ for (int i = 0; i < cache.size(); i++) {
+ ((EditorContribution) cache.get(i)).dispose();
+ }
+ }
- public ActionDescriptor[] getExtendedActions() {
- ArrayList results = new ArrayList();
- for (int i = 0; i < cache.size(); i++) {
- EditorContribution ec = (EditorContribution) cache.get(i);
- if (ec.actions != null) {
+ public ActionDescriptor[] getExtendedActions() {
+ ArrayList results = new ArrayList();
+ for (int i = 0; i < cache.size(); i++) {
+ EditorContribution ec = (EditorContribution) cache.get(i);
+ if (ec.actions != null) {
results.addAll(ec.actions);
}
- }
- return (ActionDescriptor[]) results
- .toArray(new ActionDescriptor[results.size()]);
- }
+ }
+ return (ActionDescriptor[]) results.toArray(new ActionDescriptor[results.size()]);
+ }
- @Override
+ @Override
public void init(IActionBars bars, IWorkbenchPage page) {
- for (int i = 0; i < cache.size(); i++) {
- ((EditorContribution) cache.get(i)).contribute(bars
- .getMenuManager(), false, bars.getToolBarManager(),
- true);
- }
- }
+ for (int i = 0; i < cache.size(); i++) {
+ ((EditorContribution) cache.get(i)).contribute(bars.getMenuManager(), false, bars.getToolBarManager(),
+ true);
+ }
+ }
- @Override
+ @Override
public void setActiveEditor(IEditorPart editor) {
- for (int i = 0; i < cache.size(); i++) {
- ((EditorContribution) cache.get(i)).editorChanged(editor);
- }
- }
- }
+ for (int i = 0; i < cache.size(); i++) {
+ ((EditorContribution) cache.get(i)).editorChanged(editor);
+ }
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorHistory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorHistory.java
index 44e376a1d7d..8e9d4d362ea 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorHistory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorHistory.java
@@ -23,137 +23,136 @@ import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IMemento;
/**
- * This class is used to record "open editor" actions as they
- * happen. The input and type of each editor are recorded so that
- * the user can reopen an item from the recently used files list.
+ * This class is used to record "open editor" actions as they happen. The input
+ * and type of each editor are recorded so that the user can reopen an item from
+ * the recently used files list.
*/
public class EditorHistory {
- /**
- * The maximum of entries in the history.
- */
+ /**
+ * The maximum of entries in the history.
+ */
public static final int MAX_SIZE = 20;
- /**
- * The list of editor entries, in FIFO order.
- */
- private ArrayList fifoList = new ArrayList(MAX_SIZE);
+ /**
+ * The list of editor entries, in FIFO order.
+ */
+ private ArrayList fifoList = new ArrayList(MAX_SIZE);
- /**
- * Constructs a new history.
- */
- public EditorHistory() {
- super();
- }
+ /**
+ * Constructs a new history.
+ */
+ public EditorHistory() {
+ super();
+ }
- /**
- * Adds an item to the history. Added in fifo fashion.
- */
- public void add(IEditorInput input, IEditorDescriptor desc) {
+ /**
+ * Adds an item to the history. Added in fifo fashion.
+ */
+ public void add(IEditorInput input, IEditorDescriptor desc) {
if (input != null && input.exists()) {
add(new EditorHistoryItem(input, desc), 0);
}
- }
+ }
- /**
- * Adds an item to the history.
- */
- private void add(EditorHistoryItem newItem, int index) {
- // Remove the item if it already exists so that it will be put
- // at the top of the list.
- if (newItem.isRestored()) {
- remove(newItem.getInput());
- }
+ /**
+ * Adds an item to the history.
+ */
+ private void add(EditorHistoryItem newItem, int index) {
+ // Remove the item if it already exists so that it will be put
+ // at the top of the list.
+ if (newItem.isRestored()) {
+ remove(newItem.getInput());
+ }
- // Remove the oldest one
- if (fifoList.size() == MAX_SIZE) {
- fifoList.remove(MAX_SIZE - 1);
- }
+ // Remove the oldest one
+ if (fifoList.size() == MAX_SIZE) {
+ fifoList.remove(MAX_SIZE - 1);
+ }
- // Add the new item.
- fifoList.add(index < MAX_SIZE ? index : MAX_SIZE - 1, newItem);
- }
+ // Add the new item.
+ fifoList.add(index < MAX_SIZE ? index : MAX_SIZE - 1, newItem);
+ }
- /**
- * Returns an array of editor history items. The items are returned in order
- * of most recent first.
- */
- public EditorHistoryItem[] getItems() {
- refresh();
- EditorHistoryItem[] array = new EditorHistoryItem[fifoList.size()];
- fifoList.toArray(array);
- return array;
- }
+ /**
+ * Returns an array of editor history items. The items are returned in order of
+ * most recent first.
+ */
+ public EditorHistoryItem[] getItems() {
+ refresh();
+ EditorHistoryItem[] array = new EditorHistoryItem[fifoList.size()];
+ fifoList.toArray(array);
+ return array;
+ }
- /**
- * Refresh the editor list. Any stale items are removed.
- * Only restored items are considered.
- */
- public void refresh() {
- Iterator iter = fifoList.iterator();
- while (iter.hasNext()) {
- EditorHistoryItem item = (EditorHistoryItem) iter.next();
- if (item.isRestored()) {
- IEditorInput input = item.getInput();
- if (input != null && !input.exists()) {
+ /**
+ * Refresh the editor list. Any stale items are removed. Only restored items are
+ * considered.
+ */
+ public void refresh() {
+ Iterator iter = fifoList.iterator();
+ while (iter.hasNext()) {
+ EditorHistoryItem item = (EditorHistoryItem) iter.next();
+ if (item.isRestored()) {
+ IEditorInput input = item.getInput();
+ if (input != null && !input.exists()) {
iter.remove();
}
- }
- }
- }
+ }
+ }
+ }
- /**
- * Removes the given history item.
- */
- public void remove(EditorHistoryItem item) {
- fifoList.remove(item);
- }
+ /**
+ * Removes the given history item.
+ */
+ public void remove(EditorHistoryItem item) {
+ fifoList.remove(item);
+ }
- /**
- * Removes all traces of an editor input from the history.
- */
- public void remove(IEditorInput input) {
- if (input == null) {
- return;
- }
- Iterator iter = fifoList.iterator();
- while (iter.hasNext()) {
- EditorHistoryItem item = (EditorHistoryItem) iter.next();
- if (item.matches(input)) {
- iter.remove();
- }
- }
- }
+ /**
+ * Removes all traces of an editor input from the history.
+ */
+ public void remove(IEditorInput input) {
+ if (input == null) {
+ return;
+ }
+ Iterator iter = fifoList.iterator();
+ while (iter.hasNext()) {
+ EditorHistoryItem item = (EditorHistoryItem) iter.next();
+ if (item.matches(input)) {
+ iter.remove();
+ }
+ }
+ }
- /**
- * Restore the most-recently-used history from the given memento.
- *
- * @param memento the memento to restore the mru history from
- */
- public IStatus restoreState(IMemento memento) {
+ /**
+ * Restore the most-recently-used history from the given memento.
+ *
+ * @param memento the memento to restore the mru history from
+ */
+ public IStatus restoreState(IMemento memento) {
for (IMemento childMemento : memento.getChildren(IWorkbenchConstants.TAG_FILE)) {
EditorHistoryItem item = new EditorHistoryItem(childMemento);
- if (!"".equals(item.getName()) || !"".equals(item.getToolTipText())) { //$NON-NLS-1$ //$NON-NLS-2$
- add(item, fifoList.size());
- }
- }
- return Status.OK_STATUS;
- }
+ if (!"".equals(item.getName()) || !"".equals(item.getToolTipText())) { //$NON-NLS-1$ //$NON-NLS-2$
+ add(item, fifoList.size());
+ }
+ }
+ return Status.OK_STATUS;
+ }
- /**
- * Save the most-recently-used history in the given memento.
- *
- * @param memento the memento to save the mru history in
- */
- public IStatus saveState(IMemento memento) {
- Iterator iterator = fifoList.iterator();
- while (iterator.hasNext()) {
- EditorHistoryItem item = (EditorHistoryItem) iterator.next();
- if (item.canSave()) {
- IMemento itemMemento = memento
- .createChild(IWorkbenchConstants.TAG_FILE);
- item.saveState(itemMemento);
- }
- }
- return Status.OK_STATUS;
- }
+ /**
+ * Save the most-recently-used history in the given memento.
+ *
+ * @param memento the memento to save the mru history in
+ */
+ public IStatus saveState(IMemento memento) {
+ Iterator iterator = fifoList.iterator();
+ while (iterator.hasNext()) {
+ EditorHistoryItem item = (EditorHistoryItem) iterator.next();
+ if (item.canSave()) {
+ IMemento itemMemento = memento.createChild(IWorkbenchConstants.TAG_FILE);
+ item.saveState(itemMemento);
+ }
+ }
+ return Status.OK_STATUS;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorHistoryItem.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorHistoryItem.java
index de272850d3e..b190bd83f91 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorHistoryItem.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorHistoryItem.java
@@ -31,213 +31,199 @@ import org.eclipse.ui.PlatformUI;
*/
public class EditorHistoryItem {
- private IEditorInput input;
-
- private IEditorDescriptor descriptor;
-
- private IMemento memento;
-
- /**
- * Constructs a new item.
- */
- public EditorHistoryItem(IEditorInput input, IEditorDescriptor descriptor) {
- this.input = input;
- this.descriptor = descriptor;
- }
-
- /**
- * Constructs a new item from a memento.
- */
- public EditorHistoryItem(IMemento memento) {
- this.memento = memento;
- }
-
- /**
- * Returns the editor descriptor.
- *
- * @return the editor descriptor.
- */
- public IEditorDescriptor getDescriptor() {
- return descriptor;
- }
-
- /**
- * Returns the editor input.
- *
- * @return the editor input.
- */
- public IEditorInput getInput() {
- return input;
- }
-
- /**
- * Returns whether this item has been restored from the memento.
- */
- public boolean isRestored() {
- return memento == null;
- }
-
- /**
- * Returns the name of this item, either from the input if restored,
- * otherwise from the memento.
- */
- public String getName() {
- if (isRestored() && getInput() != null) {
- return getInput().getName();
- } else if (memento != null) {
- String name = memento.getString(IWorkbenchConstants.TAG_NAME);
- if (name != null) {
- return name;
- }
- }
- return ""; //$NON-NLS-1$
- }
-
- /**
- * Returns the tooltip text of this item, either from the input if restored,
- * otherwise from the memento.
- */
- public String getToolTipText() {
- if (isRestored() && getInput() != null) {
- return getInput().getToolTipText();
- } else if (memento != null) {
- String name = memento.getString(IWorkbenchConstants.TAG_TOOLTIP);
- if (name != null) {
- return name;
- }
- }
- return ""; //$NON-NLS-1$
- }
-
- /**
- * Returns whether this item matches the given editor input.
- */
- public boolean matches(IEditorInput input) {
- if (isRestored()) {
+ private IEditorInput input;
+
+ private IEditorDescriptor descriptor;
+
+ private IMemento memento;
+
+ /**
+ * Constructs a new item.
+ */
+ public EditorHistoryItem(IEditorInput input, IEditorDescriptor descriptor) {
+ this.input = input;
+ this.descriptor = descriptor;
+ }
+
+ /**
+ * Constructs a new item from a memento.
+ */
+ public EditorHistoryItem(IMemento memento) {
+ this.memento = memento;
+ }
+
+ /**
+ * Returns the editor descriptor.
+ *
+ * @return the editor descriptor.
+ */
+ public IEditorDescriptor getDescriptor() {
+ return descriptor;
+ }
+
+ /**
+ * Returns the editor input.
+ *
+ * @return the editor input.
+ */
+ public IEditorInput getInput() {
+ return input;
+ }
+
+ /**
+ * Returns whether this item has been restored from the memento.
+ */
+ public boolean isRestored() {
+ return memento == null;
+ }
+
+ /**
+ * Returns the name of this item, either from the input if restored, otherwise
+ * from the memento.
+ */
+ public String getName() {
+ if (isRestored() && getInput() != null) {
+ return getInput().getName();
+ } else if (memento != null) {
+ String name = memento.getString(IWorkbenchConstants.TAG_NAME);
+ if (name != null) {
+ return name;
+ }
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ /**
+ * Returns the tooltip text of this item, either from the input if restored,
+ * otherwise from the memento.
+ */
+ public String getToolTipText() {
+ if (isRestored() && getInput() != null) {
+ return getInput().getToolTipText();
+ } else if (memento != null) {
+ String name = memento.getString(IWorkbenchConstants.TAG_TOOLTIP);
+ if (name != null) {
+ return name;
+ }
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ /**
+ * Returns whether this item matches the given editor input.
+ */
+ public boolean matches(IEditorInput input) {
+ if (isRestored()) {
return input.equals(getInput());
}
- // if not restored, compare name, tool tip text and factory id,
- // avoiding as much work as possible
- if (!getName().equals(input.getName())) {
+ // if not restored, compare name, tool tip text and factory id,
+ // avoiding as much work as possible
+ if (!getName().equals(input.getName())) {
return false;
}
- if (!getToolTipText().equals(input.getToolTipText())) {
+ if (!getToolTipText().equals(input.getToolTipText())) {
return false;
}
- IPersistableElement persistable = input.getPersistable();
- String inputId = persistable == null ? null : persistable
- .getFactoryId();
- String myId = getFactoryId();
- return myId == null ? inputId == null : myId.equals(inputId);
- }
-
- /**
- * Returns the factory id of this item, either from the input if restored,
- * otherwise from the memento.
- * Returns <code>null</code> if there is no factory id.
- */
- public String getFactoryId() {
- if (isRestored()) {
- if (input != null) {
- IPersistableElement persistable = input.getPersistable();
- if (persistable != null) {
- return persistable.getFactoryId();
- }
- }
- } else if (memento != null) {
- return memento.getString(IWorkbenchConstants.TAG_FACTORY_ID);
- }
- return null;
- }
-
- /**
- * Restores the object state from the memento.
- */
- public IStatus restoreState() {
- Assert.isTrue(!isRestored());
-
- IStatus result = Status.OK_STATUS;
- IMemento memento = this.memento;
- this.memento = null;
-
- String factoryId = memento
- .getString(IWorkbenchConstants.TAG_FACTORY_ID);
- if (factoryId == null) {
- WorkbenchPlugin
- .log("Unable to restore mru list - no input factory ID.");//$NON-NLS-1$
- return result;
- }
- IElementFactory factory = PlatformUI.getWorkbench().getElementFactory(
- factoryId);
- if (factory == null) {
- return result;
- }
- IMemento persistableMemento = memento
- .getChild(IWorkbenchConstants.TAG_PERSISTABLE);
- if (persistableMemento == null) {
- WorkbenchPlugin
- .log("Unable to restore mru list - no input element state: " + factoryId);//$NON-NLS-1$
- return result;
- }
- IAdaptable adaptable = factory.createElement(persistableMemento);
- if (adaptable == null || (adaptable instanceof IEditorInput) == false) {
- return result;
- }
- input = (IEditorInput) adaptable;
- // Get the editor descriptor.
- String editorId = memento.getString(IWorkbenchConstants.TAG_ID);
- if (editorId != null) {
- IEditorRegistry registry = WorkbenchPlugin.getDefault()
- .getEditorRegistry();
- descriptor = registry.findEditor(editorId);
- }
- return result;
- }
-
- /**
- * Returns whether this history item can be saved.
- */
- public boolean canSave() {
- return !isRestored()
- || (getInput() != null && getInput().getPersistable() != null);
- }
-
- /**
- * Saves the object state in the given memento.
- *
- * @param memento the memento to save the object state in
- */
- public IStatus saveState(IMemento memento) {
- if (!isRestored()) {
- memento.putMemento(this.memento);
- } else if (input != null) {
-
- IPersistableElement persistable = input.getPersistable();
- if (persistable != null) {
- /*
- * Store IPersistable of the IEditorInput in a separate section
- * since it could potentially use a tag already used in the parent
- * memento and thus overwrite data.
- */
- IMemento persistableMemento = memento
- .createChild(IWorkbenchConstants.TAG_PERSISTABLE);
- persistable.saveState(persistableMemento);
- memento.putString(IWorkbenchConstants.TAG_FACTORY_ID,
- persistable.getFactoryId());
- if (descriptor != null && descriptor.getId() != null) {
- memento.putString(IWorkbenchConstants.TAG_ID, descriptor
- .getId());
- }
- // save the name and tooltip separately so they can be restored
- // without having to instantiate the input, which can activate plugins
- memento
- .putString(IWorkbenchConstants.TAG_NAME, input
- .getName());
- memento.putString(IWorkbenchConstants.TAG_TOOLTIP, input
- .getToolTipText());
- }
- }
- return Status.OK_STATUS;
- }
+ IPersistableElement persistable = input.getPersistable();
+ String inputId = persistable == null ? null : persistable.getFactoryId();
+ String myId = getFactoryId();
+ return myId == null ? inputId == null : myId.equals(inputId);
+ }
+
+ /**
+ * Returns the factory id of this item, either from the input if restored,
+ * otherwise from the memento. Returns <code>null</code> if there is no factory
+ * id.
+ */
+ public String getFactoryId() {
+ if (isRestored()) {
+ if (input != null) {
+ IPersistableElement persistable = input.getPersistable();
+ if (persistable != null) {
+ return persistable.getFactoryId();
+ }
+ }
+ } else if (memento != null) {
+ return memento.getString(IWorkbenchConstants.TAG_FACTORY_ID);
+ }
+ return null;
+ }
+
+ /**
+ * Restores the object state from the memento.
+ */
+ public IStatus restoreState() {
+ Assert.isTrue(!isRestored());
+
+ IStatus result = Status.OK_STATUS;
+ IMemento memento = this.memento;
+ this.memento = null;
+
+ String factoryId = memento.getString(IWorkbenchConstants.TAG_FACTORY_ID);
+ if (factoryId == null) {
+ WorkbenchPlugin.log("Unable to restore mru list - no input factory ID.");//$NON-NLS-1$
+ return result;
+ }
+ IElementFactory factory = PlatformUI.getWorkbench().getElementFactory(factoryId);
+ if (factory == null) {
+ return result;
+ }
+ IMemento persistableMemento = memento.getChild(IWorkbenchConstants.TAG_PERSISTABLE);
+ if (persistableMemento == null) {
+ WorkbenchPlugin.log("Unable to restore mru list - no input element state: " + factoryId);//$NON-NLS-1$
+ return result;
+ }
+ IAdaptable adaptable = factory.createElement(persistableMemento);
+ if (adaptable == null || (adaptable instanceof IEditorInput) == false) {
+ return result;
+ }
+ input = (IEditorInput) adaptable;
+ // Get the editor descriptor.
+ String editorId = memento.getString(IWorkbenchConstants.TAG_ID);
+ if (editorId != null) {
+ IEditorRegistry registry = WorkbenchPlugin.getDefault().getEditorRegistry();
+ descriptor = registry.findEditor(editorId);
+ }
+ return result;
+ }
+
+ /**
+ * Returns whether this history item can be saved.
+ */
+ public boolean canSave() {
+ return !isRestored() || (getInput() != null && getInput().getPersistable() != null);
+ }
+
+ /**
+ * Saves the object state in the given memento.
+ *
+ * @param memento the memento to save the object state in
+ */
+ public IStatus saveState(IMemento memento) {
+ if (!isRestored()) {
+ memento.putMemento(this.memento);
+ } else if (input != null) {
+
+ IPersistableElement persistable = input.getPersistable();
+ if (persistable != null) {
+ /*
+ * Store IPersistable of the IEditorInput in a separate section since it could
+ * potentially use a tag already used in the parent memento and thus overwrite
+ * data.
+ */
+ IMemento persistableMemento = memento.createChild(IWorkbenchConstants.TAG_PERSISTABLE);
+ persistable.saveState(persistableMemento);
+ memento.putString(IWorkbenchConstants.TAG_FACTORY_ID, persistable.getFactoryId());
+ if (descriptor != null && descriptor.getId() != null) {
+ memento.putString(IWorkbenchConstants.TAG_ID, descriptor.getId());
+ }
+ // save the name and tooltip separately so they can be restored
+ // without having to instantiate the input, which can activate plugins
+ memento.putString(IWorkbenchConstants.TAG_NAME, input.getName());
+ memento.putString(IWorkbenchConstants.TAG_TOOLTIP, input.getToolTipText());
+ }
+ }
+ return Status.OK_STATUS;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorMenuManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorMenuManager.java
index 7a310faf892..02d3f9bc529 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorMenuManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorMenuManager.java
@@ -26,98 +26,94 @@ import org.eclipse.jface.action.SubMenuManager;
import org.eclipse.ui.actions.RetargetAction;
/**
- * An <code>EditorMenuManager</code> is used to sort the contributions
- * made by an editor so that they always appear after the action sets.
+ * An <code>EditorMenuManager</code> is used to sort the contributions made by
+ * an editor so that they always appear after the action sets.
*/
public class EditorMenuManager extends SubMenuManager {
- private ArrayList wrappers;
+ private ArrayList wrappers;
- private boolean enabledAllowed = true;
+ private boolean enabledAllowed = true;
- private class Overrides implements IContributionManagerOverrides {
- /**
- * Indicates that the items of this manager are allowed to enable;
- * <code>true</code> by default.
- */
- public void updateEnabledAllowed() {
- // update the items in the map
+ private class Overrides implements IContributionManagerOverrides {
+ /**
+ * Indicates that the items of this manager are allowed to enable;
+ * <code>true</code> by default.
+ */
+ public void updateEnabledAllowed() {
+ // update the items in the map
for (IContributionItem item : EditorMenuManager.super.getItems()) {
- item.update(IContributionManagerOverrides.P_ENABLED);
- }
- // update the wrapped menus
- if (wrappers != null) {
- for (int i = 0; i < wrappers.size(); i++) {
- EditorMenuManager manager = (EditorMenuManager) wrappers
- .get(i);
- manager.setEnabledAllowed(enabledAllowed);
- }
- }
- }
-
- @Override
+ item.update(IContributionManagerOverrides.P_ENABLED);
+ }
+ // update the wrapped menus
+ if (wrappers != null) {
+ for (int i = 0; i < wrappers.size(); i++) {
+ EditorMenuManager manager = (EditorMenuManager) wrappers.get(i);
+ manager.setEnabledAllowed(enabledAllowed);
+ }
+ }
+ }
+
+ @Override
public Boolean getEnabled(IContributionItem item) {
- if (((item instanceof ActionContributionItem) && (((ActionContributionItem) item)
- .getAction() instanceof RetargetAction))
- || enabledAllowed) {
+ if (((item instanceof ActionContributionItem)
+ && (((ActionContributionItem) item).getAction() instanceof RetargetAction)) || enabledAllowed) {
return null;
}
return Boolean.FALSE;
- }
+ }
- @Override
+ @Override
public Integer getAccelerator(IContributionItem item) {
- if (getEnabled(item) == null) {
- return getParentMenuManager().getOverrides().getAccelerator(
- item);
+ if (getEnabled(item) == null) {
+ return getParentMenuManager().getOverrides().getAccelerator(item);
}
// no acclerator if the item is disabled
return Integer.valueOf(0);
- }
+ }
- @Override
+ @Override
public String getAcceleratorText(IContributionItem item) {
- return getParentMenuManager().getOverrides().getAcceleratorText(
- item);
- }
+ return getParentMenuManager().getOverrides().getAcceleratorText(item);
+ }
- @Override
+ @Override
public String getText(IContributionItem item) {
- return getParentMenuManager().getOverrides().getText(item);
- }
+ return getParentMenuManager().getOverrides().getText(item);
+ }
- @Override
+ @Override
public Boolean getVisible(IContributionItem item) {
- return getParentMenuManager().getOverrides().getVisible(item);
- }
- }
+ return getParentMenuManager().getOverrides().getVisible(item);
+ }
+ }
- private Overrides overrides = new Overrides();
+ private Overrides overrides = new Overrides();
- /**
- * Constructs a new editor manager.
- */
+ /**
+ * Constructs a new editor manager.
+ */
public EditorMenuManager(IMenuManager mgr) {
- super(mgr);
- }
+ super(mgr);
+ }
- @Override
+ @Override
public IContributionItem[] getItems() {
- return getParentMenuManager().getItems();
- }
+ return getParentMenuManager().getItems();
+ }
- @Override
+ @Override
public IContributionManagerOverrides getOverrides() {
- return overrides;
- }
+ return overrides;
+ }
/*
* Inserts the new item after any action set contributions which may exist
* within the toolbar to ensure a consistent order for actions.
*/
- @Override
+ @Override
public void prependToGroup(String groupName, IContributionItem item) {
- insertAfter(groupName, item);
- }
+ insertAfter(groupName, item);
+ }
@Override
public void appendToGroup(String groupName, IContributionItem item) {
@@ -129,96 +125,98 @@ public class EditorMenuManager extends SubMenuManager {
}
}
- /**
- * Sets the visibility of the manager. If the visibility is <code>true</code>
- * then each item within the manager appears within the parent manager.
- * Otherwise, the items are not visible.
- * <p>
- * If force visibility is <code>true</code>, or grayed out if force visibility is <code>false</code>
- * <p>
- * This is a workaround for the layout flashing when editors contribute
- * large amounts of items.</p>
- *
- * @param visible the new visibility
- * @param forceVisibility whether to change the visibility or just the
- * enablement state.
- */
- public void setVisible(boolean visible, boolean forceVisibility) {
- if (visible) {
- if (forceVisibility) {
- // Make the items visible
- if (!enabledAllowed) {
+ /**
+ * Sets the visibility of the manager. If the visibility is <code>true</code>
+ * then each item within the manager appears within the parent manager.
+ * Otherwise, the items are not visible.
+ * <p>
+ * If force visibility is <code>true</code>, or grayed out if force visibility
+ * is <code>false</code>
+ * <p>
+ * This is a workaround for the layout flashing when editors contribute large
+ * amounts of items.
+ * </p>
+ *
+ * @param visible the new visibility
+ * @param forceVisibility whether to change the visibility or just the
+ * enablement state.
+ */
+ public void setVisible(boolean visible, boolean forceVisibility) {
+ if (visible) {
+ if (forceVisibility) {
+ // Make the items visible
+ if (!enabledAllowed) {
setEnabledAllowed(true);
}
- } else {
- if (enabledAllowed) {
+ } else {
+ if (enabledAllowed) {
setEnabledAllowed(false);
}
- }
- if (!isVisible()) {
+ }
+ if (!isVisible()) {
setVisible(true);
}
- } else {
- if (forceVisibility) {
+ } else {
+ if (forceVisibility) {
// Remove the editor menu items
- setVisible(false);
+ setVisible(false);
} else {
// Disable the editor menu items.
- setEnabledAllowed(false);
+ setEnabledAllowed(false);
}
- }
- }
-
- /**
- * Sets the enablement ability of all the items contributed by the editor.
- *
- * @param enabledAllowed <code>true</code> if the items may enable
- * @since 2.0
- */
- public void setEnabledAllowed(boolean enabledAllowed) {
- if (this.enabledAllowed == enabledAllowed) {
+ }
+ }
+
+ /**
+ * Sets the enablement ability of all the items contributed by the editor.
+ *
+ * @param enabledAllowed <code>true</code> if the items may enable
+ * @since 2.0
+ */
+ public void setEnabledAllowed(boolean enabledAllowed) {
+ if (this.enabledAllowed == enabledAllowed) {
return;
}
- this.enabledAllowed = enabledAllowed;
- overrides.updateEnabledAllowed();
- }
+ this.enabledAllowed = enabledAllowed;
+ overrides.updateEnabledAllowed();
+ }
- @Override
+ @Override
protected SubMenuManager wrapMenu(IMenuManager menu) {
- if (wrappers == null) {
+ if (wrappers == null) {
wrappers = new ArrayList();
}
EditorMenuManager manager = new EditorMenuManager(menu);
- wrappers.add(manager);
- return manager;
- }
+ wrappers.add(manager);
+ return manager;
+ }
- protected IAction[] getAllContributedActions() {
- HashSet set = new HashSet();
- getAllContributedActions(set);
- return (IAction[]) set.toArray(new IAction[set.size()]);
- }
+ protected IAction[] getAllContributedActions() {
+ HashSet set = new HashSet();
+ getAllContributedActions(set);
+ return (IAction[]) set.toArray(new IAction[set.size()]);
+ }
- protected void getAllContributedActions(HashSet set) {
+ protected void getAllContributedActions(HashSet set) {
for (IContributionItem item : super.getItems()) {
getAllContributedActions(set, item);
}
- if (wrappers == null) {
+ if (wrappers == null) {
return;
}
- for (Iterator iter = wrappers.iterator(); iter.hasNext();) {
- EditorMenuManager element = (EditorMenuManager) iter.next();
- element.getAllContributedActions(set);
- }
- }
-
- protected void getAllContributedActions(HashSet set, IContributionItem item) {
- if (item instanceof MenuManager) {
+ for (Iterator iter = wrappers.iterator(); iter.hasNext();) {
+ EditorMenuManager element = (EditorMenuManager) iter.next();
+ element.getAllContributedActions(set);
+ }
+ }
+
+ protected void getAllContributedActions(HashSet set, IContributionItem item) {
+ if (item instanceof MenuManager) {
for (IContributionItem subItem : ((MenuManager) item).getItems()) {
getAllContributedActions(set, subItem);
}
- } else if (item instanceof ActionContributionItem) {
- set.add(((ActionContributionItem) item).getAction());
- }
- }
+ } else if (item instanceof ActionContributionItem) {
+ set.add(((ActionContributionItem) item).getAction());
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorPluginAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorPluginAction.java
index 08fe18bf7e0..91171453e47 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorPluginAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorPluginAction.java
@@ -20,69 +20,66 @@ import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.WorkbenchException;
/**
- * Extends PartPluginAction for usage in editor parts. Objects
- * of this class are created by reading the registry (extension point "editorActions").
+ * Extends PartPluginAction for usage in editor parts. Objects of this class are
+ * created by reading the registry (extension point "editorActions").
*/
public final class EditorPluginAction extends PartPluginAction {
- private IEditorPart currentEditor;
+ private IEditorPart currentEditor;
- /**
- * This class adds the requirement that action delegates
- * loaded on demand implement IViewActionDelegate
- */
- public EditorPluginAction(IConfigurationElement actionElement,
- IEditorPart part, String id, int style) {
- super(actionElement, id, style);
- if (part != null) {
+ /**
+ * This class adds the requirement that action delegates loaded on demand
+ * implement IViewActionDelegate
+ */
+ public EditorPluginAction(IConfigurationElement actionElement, IEditorPart part, String id, int style) {
+ super(actionElement, id, style);
+ if (part != null) {
editorChanged(part);
}
- }
+ }
- @Override
- protected IActionDelegate validateDelegate(Object obj)
- throws WorkbenchException {
- if (obj instanceof IEditorActionDelegate) {
+ @Override
+ protected IActionDelegate validateDelegate(Object obj) throws WorkbenchException {
+ if (obj instanceof IEditorActionDelegate) {
return (IEditorActionDelegate) obj;
}
throw new WorkbenchException("Action must implement IEditorActionDelegate"); //$NON-NLS-1$
- }
+ }
- @Override
+ @Override
protected void initDelegate() {
- super.initDelegate();
- ((IEditorActionDelegate) getDelegate()).setActiveEditor(this,
- currentEditor);
- }
+ super.initDelegate();
+ ((IEditorActionDelegate) getDelegate()).setActiveEditor(this, currentEditor);
+ }
- /**
- * Handles editor change by re-registering for selection
- * changes and updating IEditorActionDelegate.
- */
- public void editorChanged(IEditorPart part) {
- if (currentEditor != null) {
+ /**
+ * Handles editor change by re-registering for selection changes and updating
+ * IEditorActionDelegate.
+ */
+ public void editorChanged(IEditorPart part) {
+ if (currentEditor != null) {
unregisterSelectionListener(currentEditor);
}
- currentEditor = part;
+ currentEditor = part;
- if (getDelegate() == null && isOkToCreateDelegate()) {
+ if (getDelegate() == null && isOkToCreateDelegate()) {
createDelegate();
}
- if (getDelegate() != null) {
+ if (getDelegate() != null) {
((IEditorActionDelegate) getDelegate()).setActiveEditor(this, part);
}
- if (part != null) {
+ if (part != null) {
registerSelectionListener(part);
}
- }
+ }
@Override
public void dispose() {
- if (currentEditor != null) {
- unregisterSelectionListener(currentEditor);
+ if (currentEditor != null) {
+ unregisterSelectionListener(currentEditor);
currentEditor = null;
- }
+ }
super.dispose();
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorReference.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorReference.java
index 98629a35ad6..bac78ca8bbb 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorReference.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorReference.java
@@ -64,8 +64,8 @@ public class EditorReference extends WorkbenchPartReference implements IEditorRe
private final IMemento editorState;
private final String factoryId;
- public EditorReference(IEclipseContext windowContext, IWorkbenchPage page, MPart part,
- IEditorInput input, EditorDescriptor descriptor, IMemento editorState) {
+ public EditorReference(IEclipseContext windowContext, IWorkbenchPage page, MPart part, IEditorInput input,
+ EditorDescriptor descriptor, IMemento editorState) {
super(windowContext, page, part);
this.input = input;
this.descriptor = descriptor;
@@ -73,37 +73,34 @@ public class EditorReference extends WorkbenchPartReference implements IEditorRe
String factory = null;
if (descriptor == null) {
- String memento = getModel().getPersistedState().get(MEMENTO_KEY);
- if (memento == null) {
+ String memento = getModel().getPersistedState().get(MEMENTO_KEY);
+ if (memento == null) {
+ descriptorId = EditorRegistry.EMPTY_EDITOR_ID;
+ } else {
+ XMLMemento createReadRoot;
+ try {
+ createReadRoot = XMLMemento.createReadRoot(new StringReader(memento));
+ } catch (WorkbenchException e) {
+ WorkbenchPlugin.log(e);
descriptorId = EditorRegistry.EMPTY_EDITOR_ID;
- } else {
- XMLMemento createReadRoot;
- try {
- createReadRoot = XMLMemento
- .createReadRoot(new StringReader(memento));
- } catch (WorkbenchException e) {
- WorkbenchPlugin.log(e);
- descriptorId = EditorRegistry.EMPTY_EDITOR_ID;
- factoryId = null;
- return;
- }
- IEditorRegistry registry = getPage().getWorkbenchWindow().getWorkbench()
- .getEditorRegistry();
- descriptorId = createReadRoot.getString(IWorkbenchConstants.TAG_ID);
- this.descriptor = (EditorDescriptor) registry.findEditor(descriptorId);
+ factoryId = null;
+ return;
+ }
+ IEditorRegistry registry = getPage().getWorkbenchWindow().getWorkbench().getEditorRegistry();
+ descriptorId = createReadRoot.getString(IWorkbenchConstants.TAG_ID);
+ this.descriptor = (EditorDescriptor) registry.findEditor(descriptorId);
- boolean pinnedVal = "true".equals(createReadRoot.getString(IWorkbenchConstants.TAG_PINNED)); //$NON-NLS-1$
- setPinned(pinnedVal);
+ boolean pinnedVal = "true".equals(createReadRoot.getString(IWorkbenchConstants.TAG_PINNED)); //$NON-NLS-1$
+ setPinned(pinnedVal);
- String ttip = createReadRoot.getString(IWorkbenchConstants.TAG_TOOLTIP);
- part.getTransientData().put(IPresentationEngine.OVERRIDE_TITLE_TOOL_TIP_KEY,
- ttip);
+ String ttip = createReadRoot.getString(IWorkbenchConstants.TAG_TOOLTIP);
+ part.getTransientData().put(IPresentationEngine.OVERRIDE_TITLE_TOOL_TIP_KEY, ttip);
- IMemento inputMem = createReadRoot.getChild(IWorkbenchConstants.TAG_INPUT);
- if (inputMem != null) {
- factory = inputMem.getString(IWorkbenchConstants.TAG_FACTORY_ID);
- }
+ IMemento inputMem = createReadRoot.getChild(IWorkbenchConstants.TAG_INPUT);
+ if (inputMem != null) {
+ factory = inputMem.getString(IWorkbenchConstants.TAG_FACTORY_ID);
}
+ }
} else {
descriptorId = this.descriptor.getId();
}
@@ -170,8 +167,7 @@ public class EditorReference extends WorkbenchPartReference implements IEditorRe
if (!properties.isEmpty()) {
IMemento propBag = editorMem.createChild(IWorkbenchConstants.TAG_PROPERTIES);
for (Map.Entry<String, String> entry : properties.entrySet()) {
- IMemento p = propBag.createChild(IWorkbenchConstants.TAG_PROPERTY,
- entry.getKey());
+ IMemento p = propBag.createChild(IWorkbenchConstants.TAG_PROPERTY, entry.getKey());
p.putTextData(entry.getValue());
}
}
@@ -224,8 +220,7 @@ public class EditorReference extends WorkbenchPartReference implements IEditorRe
public String getName() {
IEditorPart editor = getEditor(false);
if (input == null) {
- return editor == null ? getModel().getLocalizedLabel() : editor.getEditorInput()
- .getName();
+ return editor == null ? getModel().getLocalizedLabel() : editor.getEditorInput().getName();
}
return editor == null ? input.getName() : editor.getEditorInput().getName();
}
@@ -249,8 +244,7 @@ public class EditorReference extends WorkbenchPartReference implements IEditorRe
return createInput(editorMem);
}
- public static IEditorInput createInput(IMemento editorMem)
- throws PartInitException {
+ public static IEditorInput createInput(IMemento editorMem) throws PartInitException {
String editorId = editorMem.getString(IWorkbenchConstants.TAG_ID);
IMemento inputMem = editorMem.getChild(IWorkbenchConstants.TAG_INPUT);
@@ -262,28 +256,25 @@ public class EditorReference extends WorkbenchPartReference implements IEditorRe
factoryID = inputMem.getString(IWorkbenchConstants.TAG_FACTORY_ID);
}
if (factoryID == null) {
- throw new PartInitException(NLS.bind(
- WorkbenchMessages.EditorManager_no_input_factory_ID, editorId, editorName));
+ throw new PartInitException(
+ NLS.bind(WorkbenchMessages.EditorManager_no_input_factory_ID, editorId, editorName));
}
IAdaptable input = null;
IElementFactory factory = PlatformUI.getWorkbench().getElementFactory(factoryID);
if (factory == null) {
- throw new PartInitException(NLS.bind(
- WorkbenchMessages.EditorManager_bad_element_factory, new Object[] { factoryID,
- editorId, editorName }));
+ throw new PartInitException(NLS.bind(WorkbenchMessages.EditorManager_bad_element_factory,
+ new Object[] { factoryID, editorId, editorName }));
}
// Get the input element.
input = factory.createElement(inputMem);
if (input == null) {
- throw new PartInitException(NLS.bind(
- WorkbenchMessages.EditorManager_create_element_returned_null, new Object[] {
- factoryID, editorId, editorName }));
+ throw new PartInitException(NLS.bind(WorkbenchMessages.EditorManager_create_element_returned_null,
+ new Object[] { factoryID, editorId, editorName }));
}
if (!(input instanceof IEditorInput)) {
- throw new PartInitException(NLS.bind(
- WorkbenchMessages.EditorManager_wrong_createElement_result, new Object[] {
- factoryID, editorId, editorName }));
+ throw new PartInitException(NLS.bind(WorkbenchMessages.EditorManager_wrong_createElement_result,
+ new Object[] { factoryID, editorId, editorName }));
}
return (IEditorInput) input;
}
@@ -306,8 +297,7 @@ public class EditorReference extends WorkbenchPartReference implements IEditorRe
input = new NullEditorInput();
} else {
try {
- XMLMemento createReadRoot = XMLMemento
- .createReadRoot(new StringReader(memento));
+ XMLMemento createReadRoot = XMLMemento.createReadRoot(new StringReader(memento));
input = restoreInput(createReadRoot);
} catch (WorkbenchException e) {
throw new PartInitException(e.getStatus());
@@ -332,17 +322,16 @@ public class EditorReference extends WorkbenchPartReference implements IEditorRe
return descriptor.createEditor();
} catch (CoreException e) {
IStatus status = e.getStatus();
- throw new PartInitException(new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH,
- status.getCode(), status.getMessage(), e));
+ throw new PartInitException(
+ new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, status.getCode(), status.getMessage(), e));
}
}
@Override
IWorkbenchPart createErrorPart() {
- IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, NLS.bind(
- WorkbenchMessages.EditorManager_missing_editor_descriptor, descriptorId), new Exception());
- IEditorRegistry registry = getPage().getWorkbenchWindow().getWorkbench()
- .getEditorRegistry();
+ IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH,
+ NLS.bind(WorkbenchMessages.EditorManager_missing_editor_descriptor, descriptorId), new Exception());
+ IEditorRegistry registry = getPage().getWorkbenchWindow().getWorkbench().getEditorRegistry();
descriptor = (EditorDescriptor) registry.findEditor(EditorRegistry.EMPTY_EDITOR_ID);
return createErrorPart(status);
}
@@ -383,10 +372,8 @@ public class EditorReference extends WorkbenchPartReference implements IEditorRe
String mementoString = getModel().getPersistedState().get(MEMENTO_KEY);
if (mementoString != null) {
try {
- IMemento createReadRoot = XMLMemento.createReadRoot(new StringReader(
- mementoString));
- IMemento editorStateMemento = createReadRoot
- .getChild(IWorkbenchConstants.TAG_EDITOR_STATE);
+ IMemento createReadRoot = XMLMemento.createReadRoot(new StringReader(mementoString));
+ IMemento editorStateMemento = createReadRoot.getChild(IWorkbenchConstants.TAG_EDITOR_STATE);
if (editorStateMemento != null) {
((IPersistableEditor) part).restoreState(editorStateMemento);
}
@@ -412,9 +399,9 @@ public class EditorReference extends WorkbenchPartReference implements IEditorRe
private static HashMap<String, Set<EditorActionBars>> actionCache = new HashMap<>();
/*
- * Creates the action bars for an editor. Editors of the same type should
- * share a single editor action bar, so this implementation may return an
- * existing action bar vector.
+ * Creates the action bars for an editor. Editors of the same type should share
+ * a single editor action bar, so this implementation may return an existing
+ * action bar vector.
*/
private static EditorActionBars createEditorActionBars(WorkbenchPage page, EditorDescriptor desc) {
// Get the editor type.
@@ -469,8 +456,8 @@ public class EditorReference extends WorkbenchPartReference implements IEditorRe
set.remove(actionBars);
}
// refresh the cool bar manager before disposing of a cool item
- ICoolBarManager2 coolBar = (ICoolBarManager2) ((WorkbenchWindow) actionBars.getPage()
- .getWorkbenchWindow()).getCoolBarManager2();
+ ICoolBarManager2 coolBar = (ICoolBarManager2) ((WorkbenchWindow) actionBars.getPage().getWorkbenchWindow())
+ .getCoolBarManager2();
if (coolBar != null) {
coolBar.refresh();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorSite.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorSite.java
index dc60df5e405..3d76c00cc87 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorSite.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorSite.java
@@ -32,23 +32,22 @@ import org.eclipse.ui.dnd.IDragAndDropService;
* An editor container manages the services for an editor.
*/
public class EditorSite extends PartSite implements IEditorSite {
- /* package */ //static final int PROP_REUSE_EDITOR = -0x101;
+ /* package */
+ // static final int PROP_REUSE_EDITOR = -0x101;
+ // private ListenerList propChangeListeners = new ListenerList(1);
- //private ListenerList propChangeListeners = new ListenerList(1);
+ private SubActionBars ab = null;
- private SubActionBars ab = null;
-
- /**
- * Constructs an EditorSite for an editor.
- */
- public EditorSite(MPart model, IWorkbenchPart part, IWorkbenchPartReference ref,
- IConfigurationElement element) {
+ /**
+ * Constructs an EditorSite for an editor.
+ */
+ public EditorSite(MPart model, IWorkbenchPart part, IWorkbenchPartReference ref, IConfigurationElement element) {
super(model, part, ref, element);
// Initialize the services specific to this editor site.
- initializeDefaultServices();
- }
+ initializeDefaultServices();
+ }
/**
* Initialize the local services.
@@ -61,105 +60,101 @@ public class EditorSite extends PartSite implements IEditorSite {
serviceLocator.registerService(IEditorPart.class, getPart());
}
- @Override
+ @Override
public void setActionBars(SubActionBars bars) {
- super.setActionBars(bars);
+ super.setActionBars(bars);
- if (bars instanceof IActionBars2) {
- ab = new SubActionBars2((IActionBars2)bars, this);
- } else {
- ab = new SubActionBars(bars, this);
- }
- }
+ if (bars instanceof IActionBars2) {
+ ab = new SubActionBars2((IActionBars2) bars, this);
+ } else {
+ ab = new SubActionBars(bars, this);
+ }
+ }
- @Override
+ @Override
public void activateActionBars(boolean forceVisibility) {
- if (ab != null) {
- ab.activate(forceVisibility);
- }
- super.activateActionBars(forceVisibility);
- }
+ if (ab != null) {
+ ab.activate(forceVisibility);
+ }
+ super.activateActionBars(forceVisibility);
+ }
- @Override
+ @Override
public void deactivateActionBars(boolean forceHide) {
- if (ab != null) {
- ab.deactivate(forceHide);
- }
- super.deactivateActionBars(forceHide);
- }
-
- /**
- * Returns the editor action bar contributor for this editor.
- * <p>
- * An action contributor is responsable for the creation of actions.
- * By design, this contributor is used for one or more editors of the same type.
- * Thus, the contributor returned by this method is not owned completely
- * by the editor. It is shared.
- * </p>
- *
- * @return the editor action bar contributor
- */
- @Override
+ if (ab != null) {
+ ab.deactivate(forceHide);
+ }
+ super.deactivateActionBars(forceHide);
+ }
+
+ /**
+ * Returns the editor action bar contributor for this editor.
+ * <p>
+ * An action contributor is responsable for the creation of actions. By design,
+ * this contributor is used for one or more editors of the same type. Thus, the
+ * contributor returned by this method is not owned completely by the editor. It
+ * is shared.
+ * </p>
+ *
+ * @return the editor action bar contributor
+ */
+ @Override
public IEditorActionBarContributor getActionBarContributor() {
- EditorActionBars bars = (EditorActionBars) getActionBars();
- if (bars != null) {
+ EditorActionBars bars = (EditorActionBars) getActionBars();
+ if (bars != null) {
return bars.getEditorContributor();
}
- return null;
- }
+ return null;
+ }
- /**
- * Returns the extension editor action bar contributor for this editor.
- */
- public IEditorActionBarContributor getExtensionActionBarContributor() {
- EditorActionBars bars = (EditorActionBars) getActionBars();
- if (bars != null) {
+ /**
+ * Returns the extension editor action bar contributor for this editor.
+ */
+ public IEditorActionBarContributor getExtensionActionBarContributor() {
+ EditorActionBars bars = (EditorActionBars) getActionBars();
+ if (bars != null) {
return bars.getExtensionContributor();
}
- return null;
- }
+ return null;
+ }
- /**
- * Returns the editor
- */
- public IEditorPart getEditorPart() {
- return (IEditorPart) getPart();
- }
+ /**
+ * Returns the editor
+ */
+ public IEditorPart getEditorPart() {
+ return (IEditorPart) getPart();
+ }
- @Override
+ @Override
protected String getInitialScopeId() {
- return "org.eclipse.ui.textEditorScope"; //$NON-NLS-1$
- }
+ return "org.eclipse.ui.textEditorScope"; //$NON-NLS-1$
+ }
- @Override
+ @Override
public void dispose() {
- if (ab != null) {
- ab.dispose();
+ if (ab != null) {
+ ab.dispose();
ab = null;
- }
+ }
super.dispose();
- }
-
- @Override
- public final void registerContextMenu(final MenuManager menuManager,
- final ISelectionProvider selectionProvider,
- final boolean includeEditorInput) {
- registerContextMenu(getId(), menuManager, selectionProvider,
- includeEditorInput);
- }
-
- @Override
- public final void registerContextMenu(final String menuId,
- final MenuManager menuManager,
- final ISelectionProvider selectionProvider,
- final boolean includeEditorInput) {
- if (menuExtenders == null) {
- menuExtenders = new ArrayList(1);
- }
-
- PartSite.registerContextMenu(menuId, menuManager, selectionProvider, includeEditorInput,
- getPart(), getModel().getContext(), menuExtenders);
- }
+ }
+
+ @Override
+ public final void registerContextMenu(final MenuManager menuManager, final ISelectionProvider selectionProvider,
+ final boolean includeEditorInput) {
+ registerContextMenu(getId(), menuManager, selectionProvider, includeEditorInput);
+ }
+
+ @Override
+ public final void registerContextMenu(final String menuId, final MenuManager menuManager,
+ final ISelectionProvider selectionProvider, final boolean includeEditorInput) {
+ if (menuExtenders == null) {
+ menuExtenders = new ArrayList(1);
+ }
+
+ PartSite.registerContextMenu(menuId, menuManager, selectionProvider, includeEditorInput, getPart(),
+ getModel().getContext(), menuExtenders);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorSiteDragAndDropServiceImpl.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorSiteDragAndDropServiceImpl.java
index 4d07168ac75..0805415cf09 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorSiteDragAndDropServiceImpl.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorSiteDragAndDropServiceImpl.java
@@ -31,32 +31,39 @@ import org.eclipse.ui.services.IDisposable;
/**
* Implementation for the <code>IDragAndDropService</code> to be used from
* <code>EditorSite</code>'s.
- * </p><p>
- * Adds a drop target to the given control that merges the site's
- * drop behaviour with that specified by the <code>addMergedDropTarget</code> call.
- * </p><p>
+ * </p>
+ * <p>
+ * Adds a drop target to the given control that merges the site's drop behaviour
+ * with that specified by the <code>addMergedDropTarget</code> call.
+ * </p>
+ * <p>
* The current implementation is only defined for EditorSite's and merges the
* given drop handling with the existing EditorSashContainer's behaviour.
- * </p><p>
- * NOTE: There is no cleanup (i.e. 'dispose') handling necessary for merged
- * Drop Targets but the hooks are put into place to maintain the consistency
- * of the implementation pattern.
* </p>
+ * <p>
+ * NOTE: There is no cleanup (i.e. 'dispose') handling necessary for merged Drop
+ * Targets but the hooks are put into place to maintain the consistency of the
+ * implementation pattern.
+ * </p>
+ *
* @since 3.3
*
*/
public class EditorSiteDragAndDropServiceImpl implements IDragAndDropService, IDisposable {
- // Key used to store/retrieve the MergedDropTarget instance from the real DropTarget
+ // Key used to store/retrieve the MergedDropTarget instance from the real
+ // DropTarget
private static String MDT_KEY = "MDT"; //$NON-NLS-1$
/**
* Implementation of a DropTarget wrapper that will either delegate to the
- * <code>primaryListener</code> if the event's <code>currentDataType</code>
- * can be handled by it; otherwise the event is forwarded on to the
- * listener specified by <code>secondaryListener</code>.
- * </p><p>
+ * <code>primaryListener</code> if the event's <code>currentDataType</code> can
+ * be handled by it; otherwise the event is forwarded on to the listener
+ * specified by <code>secondaryListener</code>.
+ * </p>
+ * <p>
* NOTE: we should perhaps refactor this out into an external class
* </p>
+ *
* @since 3.3
*
*/
@@ -71,8 +78,7 @@ public class EditorSiteDragAndDropServiceImpl implements IDragAndDropService, ID
private DropTargetListener primaryListener;
private int primaryOps;
- public MergedDropTarget(Control control,
- int priOps, Transfer[] priTransfers, DropTargetListener priListener,
+ public MergedDropTarget(Control control, int priOps, Transfer[] priTransfers, DropTargetListener priListener,
int secOps, Transfer[] secTransfers, DropTargetListener secListener) {
realDropTarget = new DropTarget(control, priOps | secOps);
realDropTarget.setData(MDT_KEY, this);
@@ -83,12 +89,12 @@ public class EditorSiteDragAndDropServiceImpl implements IDragAndDropService, ID
primaryOps = priOps;
// Cache the editor area's current transfers & listener
- secondaryTransfers = secTransfers;
- secondaryListener = secListener;
- secondaryOps = secOps;
+ secondaryTransfers = secTransfers;
+ secondaryListener = secListener;
+ secondaryOps = secOps;
// Combine the two sets of transfers into one array
- Transfer[] allTransfers = new Transfer[secondaryTransfers.length+primaryTransfers.length];
+ Transfer[] allTransfers = new Transfer[secondaryTransfers.length + primaryTransfers.length];
int curTransfer = 0;
for (Transfer primaryTransfer : primaryTransfers) {
allTransfers[curTransfer++] = primaryTransfer;
@@ -105,22 +111,27 @@ public class EditorSiteDragAndDropServiceImpl implements IDragAndDropService, ID
public void dragEnter(DropTargetEvent event) {
getAppropriateListener(event, true).dragEnter(event);
}
+
@Override
public void dragLeave(DropTargetEvent event) {
getAppropriateListener(event, false).dragLeave(event);
}
+
@Override
public void dragOperationChanged(DropTargetEvent event) {
getAppropriateListener(event, true).dragOperationChanged(event);
}
+
@Override
public void dragOver(DropTargetEvent event) {
getAppropriateListener(event, true).dragOver(event);
}
+
@Override
public void drop(DropTargetEvent event) {
getAppropriateListener(event, true).drop(event);
}
+
@Override
public void dropAccept(DropTargetEvent event) {
getAppropriateListener(event, true).dropAccept(event);
@@ -150,7 +161,7 @@ public class EditorSiteDragAndDropServiceImpl implements IDragAndDropService, ID
}
private boolean isSupportedOperation(int dropOps, int eventDetail) {
- return ((dropOps | DND.DROP_DEFAULT) & eventDetail) != 0;
+ return ((dropOps | DND.DROP_DEFAULT) & eventDetail) != 0;
}
}
@@ -158,23 +169,22 @@ public class EditorSiteDragAndDropServiceImpl implements IDragAndDropService, ID
List addedListeners = new ArrayList();
@Override
- public void addMergedDropTarget(Control control, int ops, Transfer[] transfers,
- DropTargetListener listener) {
- // First we have to remove any existing drop target from the control
+ public void addMergedDropTarget(Control control, int ops, Transfer[] transfers, DropTargetListener listener) {
+ // First we have to remove any existing drop target from the control
removeMergedDropTarget(control);
// Capture the editor area's current ops, transfers & listener
int editorSiteOps = DND.DROP_DEFAULT | DND.DROP_COPY | DND.DROP_LINK;
WorkbenchWindow ww = (WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- WorkbenchWindowConfigurer winConfigurer = ww.getWindowConfigurer();
- Transfer[] editorSiteTransfers = winConfigurer.getTransfers();
- DropTargetListener editorSiteListener = winConfigurer.getDropTargetListener();
-
- // Create a new 'merged' drop Listener using combination of the desired
- // transfers and the ones used by the EditorArea
- MergedDropTarget newTarget = new MergedDropTarget(control, ops, transfers, listener,
- editorSiteOps, editorSiteTransfers, editorSiteListener);
+ WorkbenchWindowConfigurer winConfigurer = ww.getWindowConfigurer();
+ Transfer[] editorSiteTransfers = winConfigurer.getTransfers();
+ DropTargetListener editorSiteListener = winConfigurer.getDropTargetListener();
+
+ // Create a new 'merged' drop Listener using combination of the desired
+ // transfers and the ones used by the EditorArea
+ MergedDropTarget newTarget = new MergedDropTarget(control, ops, transfers, listener, editorSiteOps,
+ editorSiteTransfers, editorSiteListener);
addedListeners.add(newTarget);
newTarget.realDropTarget.addDisposeListener(e -> {
@@ -184,8 +194,8 @@ public class EditorSiteDragAndDropServiceImpl implements IDragAndDropService, ID
}
/**
- * This method will return the current drop target for the control
- * (whether or not it was created using this service.
+ * This method will return the current drop target for the control (whether or
+ * not it was created using this service.
*
* @param control The control to get the drop target for
* @return The DropTarget for that control (could be null
@@ -195,7 +205,7 @@ public class EditorSiteDragAndDropServiceImpl implements IDragAndDropService, ID
return null;
Object curDT = control.getData(DND.DROP_TARGET_KEY);
- return (DropTarget)curDT;
+ return (DropTarget) curDT;
}
@Override
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ExceptionHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ExceptionHandler.java
index 6c1115ffa25..965d4a82284 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ExceptionHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ExceptionHandler.java
@@ -16,57 +16,56 @@ package org.eclipse.ui.internal;
import org.eclipse.jface.window.Window;
/**
- * This handler will pass along to the workbench advisor exceptions
- * and errors thrown while running the event loop. However, the
- * <code>ThreadDeath</code> error is simply thrown again, and is not
- * passed along.
+ * This handler will pass along to the workbench advisor exceptions and errors
+ * thrown while running the event loop. However, the <code>ThreadDeath</code>
+ * error is simply thrown again, and is not passed along.
*/
public final class ExceptionHandler implements Window.IExceptionHandler {
- private static final ExceptionHandler instance = new ExceptionHandler();
+ private static final ExceptionHandler instance = new ExceptionHandler();
- /**
- * Returns the singleton exception handler.
- *
- * @return the singleton exception handler
- */
- public static ExceptionHandler getInstance() {
- return instance;
- }
+ /**
+ * Returns the singleton exception handler.
+ *
+ * @return the singleton exception handler
+ */
+ public static ExceptionHandler getInstance() {
+ return instance;
+ }
- private int exceptionCount = 0; // To avoid recursive errors
+ private int exceptionCount = 0; // To avoid recursive errors
- private ExceptionHandler() {
- // prevents instantiation
- }
+ private ExceptionHandler() {
+ // prevents instantiation
+ }
- @Override
+ @Override
public void handleException(Throwable t) {
- try {
- // Ignore ThreadDeath error as its normal to get this when thread dies
- if (t instanceof ThreadDeath) {
- throw (ThreadDeath) t;
- }
+ try {
+ // Ignore ThreadDeath error as its normal to get this when thread dies
+ if (t instanceof ThreadDeath) {
+ throw (ThreadDeath) t;
+ }
- // Check to avoid recursive errors
- exceptionCount++;
- if (exceptionCount > 2) {
- if (t instanceof RuntimeException) {
+ // Check to avoid recursive errors
+ exceptionCount++;
+ if (exceptionCount > 2) {
+ if (t instanceof RuntimeException) {
throw (RuntimeException) t;
} else if (t instanceof Error) {
throw (Error) t;
} else {
throw new RuntimeException(t);
}
- }
+ }
- // Let the advisor handle this now
- Workbench wb = Workbench.getInstance();
- if (wb != null) {
- wb.getAdvisor().eventLoopException(t);
- }
- } finally {
- exceptionCount--;
- }
- }
+ // Let the advisor handle this now
+ Workbench wb = Workbench.getInstance();
+ if (wb != null) {
+ wb.getAdvisor().eventLoopException(t);
+ }
+ } finally {
+ exceptionCount--;
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ExtensionEventHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ExtensionEventHandler.java
index be722740d96..6cfa3f36ed2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ExtensionEventHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ExtensionEventHandler.java
@@ -43,193 +43,176 @@ import org.eclipse.ui.themes.IThemeManager;
class ExtensionEventHandler implements IRegistryChangeListener {
- private Workbench workbench;
+ private Workbench workbench;
- private List changeList = new ArrayList(10);
+ private List changeList = new ArrayList(10);
- public ExtensionEventHandler(Workbench workbench) {
- this.workbench = workbench;
- }
+ public ExtensionEventHandler(Workbench workbench) {
+ this.workbench = workbench;
+ }
- @Override
+ @Override
public void registryChanged(IRegistryChangeEvent event) {
- try {
- IExtensionDelta delta[] = event
- .getExtensionDeltas(WorkbenchPlugin.PI_WORKBENCH);
- IExtension ext;
- IExtensionPoint extPt;
- IWorkbenchWindow[] win = PlatformUI.getWorkbench()
- .getWorkbenchWindows();
- if (win.length == 0) {
+ try {
+ IExtensionDelta delta[] = event.getExtensionDeltas(WorkbenchPlugin.PI_WORKBENCH);
+ IExtension ext;
+ IExtensionPoint extPt;
+ IWorkbenchWindow[] win = PlatformUI.getWorkbench().getWorkbenchWindows();
+ if (win.length == 0) {
return;
}
- Display display = win[0].getShell().getDisplay();
- if (display == null) {
+ Display display = win[0].getShell().getDisplay();
+ if (display == null) {
return;
}
- ArrayList appearList = new ArrayList(5);
- ArrayList revokeList = new ArrayList(5);
- String id = null;
- int numPerspectives = 0;
- int numActionSetPartAssoc = 0;
-
- // push action sets and perspectives to the top because incoming
- // actionSetPartAssociations and perspectiveExtensions may depend upon
- // them for their bindings.
- for (IExtensionDelta extensionDelta : delta) {
- id = extensionDelta.getExtensionPoint().getSimpleIdentifier();
- if (extensionDelta.getKind() == IExtensionDelta.ADDED) {
- if (id.equals(IWorkbenchRegistryConstants.PL_ACTION_SETS)) {
+ ArrayList appearList = new ArrayList(5);
+ ArrayList revokeList = new ArrayList(5);
+ String id = null;
+ int numPerspectives = 0;
+ int numActionSetPartAssoc = 0;
+
+ // push action sets and perspectives to the top because incoming
+ // actionSetPartAssociations and perspectiveExtensions may depend upon
+ // them for their bindings.
+ for (IExtensionDelta extensionDelta : delta) {
+ id = extensionDelta.getExtensionPoint().getSimpleIdentifier();
+ if (extensionDelta.getKind() == IExtensionDelta.ADDED) {
+ if (id.equals(IWorkbenchRegistryConstants.PL_ACTION_SETS)) {
appearList.add(0, extensionDelta);
} else if (!id.equals(IWorkbenchRegistryConstants.PL_PERSPECTIVES)
- && !id.equals(IWorkbenchRegistryConstants.PL_VIEWS)
- && !id.equals(IWorkbenchRegistryConstants.PL_ACTION_SETS)) {
- appearList.add(appearList.size() - numPerspectives,
- extensionDelta);
+ && !id.equals(IWorkbenchRegistryConstants.PL_VIEWS)
+ && !id.equals(IWorkbenchRegistryConstants.PL_ACTION_SETS)) {
+ appearList.add(appearList.size() - numPerspectives, extensionDelta);
}
- } else {
- if (extensionDelta.getKind() == IExtensionDelta.REMOVED) {
- if (id
- .equals(IWorkbenchRegistryConstants.PL_ACTION_SET_PART_ASSOCIATIONS)) {
- revokeList.add(0, extensionDelta);
- numActionSetPartAssoc++;
- } else if (id
- .equals(IWorkbenchRegistryConstants.PL_PERSPECTIVES)) {
+ } else {
+ if (extensionDelta.getKind() == IExtensionDelta.REMOVED) {
+ if (id.equals(IWorkbenchRegistryConstants.PL_ACTION_SET_PART_ASSOCIATIONS)) {
+ revokeList.add(0, extensionDelta);
+ numActionSetPartAssoc++;
+ } else if (id.equals(IWorkbenchRegistryConstants.PL_PERSPECTIVES)) {
revokeList.add(numActionSetPartAssoc, extensionDelta);
} else {
revokeList.add(extensionDelta);
}
- }
- }
- }
- Iterator iter = appearList.iterator();
- IExtensionDelta extDelta = null;
- while (iter.hasNext()) {
- extDelta = (IExtensionDelta) iter.next();
- extPt = extDelta.getExtensionPoint();
- ext = extDelta.getExtension();
- asyncAppear(display, extPt, ext);
- }
- // Suspend support for removing a plug-in until this is more stable
- // iter = revokeList.iterator();
- // while(iter.hasNext()) {
- // extDelta = (IExtensionDelta) iter.next();
- // extPt = extDelta.getExtensionPoint();
- // ext = extDelta.getExtension();
- // asyncRevoke(display, extPt, ext);
- // }
-
- resetCurrentPerspective(display);
- } finally {
- //ensure the list is cleared for the next pass through
- changeList.clear();
- }
-
- }
-
- private void asyncAppear(Display display, final IExtensionPoint extpt,
- final IExtension ext) {
- Runnable run = () -> appear(extpt, ext);
- display.syncExec(run);
- }
-
- private void appear(IExtensionPoint extPt, IExtension ext) {
- String name = extPt.getSimpleIdentifier();
- if (name.equalsIgnoreCase(IWorkbenchRegistryConstants.PL_FONT_DEFINITIONS)) {
- loadFontDefinitions(ext);
- return;
- }
- if (name.equalsIgnoreCase(IWorkbenchRegistryConstants.PL_THEMES)) {
- loadThemes(ext);
- return;
- }
- }
-
- /**
- * @param ext
- */
- private void loadFontDefinitions(IExtension ext) {
- ThemeRegistryReader reader = new ThemeRegistryReader();
- reader.setRegistry((ThemeRegistry) WorkbenchPlugin.getDefault()
- .getThemeRegistry());
+ }
+ }
+ }
+ Iterator iter = appearList.iterator();
+ IExtensionDelta extDelta = null;
+ while (iter.hasNext()) {
+ extDelta = (IExtensionDelta) iter.next();
+ extPt = extDelta.getExtensionPoint();
+ ext = extDelta.getExtension();
+ asyncAppear(display, extPt, ext);
+ }
+ // Suspend support for removing a plug-in until this is more stable
+ // iter = revokeList.iterator();
+ // while(iter.hasNext()) {
+ // extDelta = (IExtensionDelta) iter.next();
+ // extPt = extDelta.getExtensionPoint();
+ // ext = extDelta.getExtension();
+ // asyncRevoke(display, extPt, ext);
+ // }
+
+ resetCurrentPerspective(display);
+ } finally {
+ // ensure the list is cleared for the next pass through
+ changeList.clear();
+ }
+
+ }
+
+ private void asyncAppear(Display display, final IExtensionPoint extpt, final IExtension ext) {
+ Runnable run = () -> appear(extpt, ext);
+ display.syncExec(run);
+ }
+
+ private void appear(IExtensionPoint extPt, IExtension ext) {
+ String name = extPt.getSimpleIdentifier();
+ if (name.equalsIgnoreCase(IWorkbenchRegistryConstants.PL_FONT_DEFINITIONS)) {
+ loadFontDefinitions(ext);
+ return;
+ }
+ if (name.equalsIgnoreCase(IWorkbenchRegistryConstants.PL_THEMES)) {
+ loadThemes(ext);
+ return;
+ }
+ }
+
+ /**
+ * @param ext
+ */
+ private void loadFontDefinitions(IExtension ext) {
+ ThemeRegistryReader reader = new ThemeRegistryReader();
+ reader.setRegistry((ThemeRegistry) WorkbenchPlugin.getDefault().getThemeRegistry());
for (IConfigurationElement configElement : ext.getConfigurationElements()) {
reader.readElement(configElement);
}
- Collection fonts = reader.getFontDefinitions();
- FontDefinition[] fontDefs = (FontDefinition[]) fonts
- .toArray(new FontDefinition[fonts.size()]);
- ThemeElementHelper.populateRegistry(workbench.getThemeManager()
- .getTheme(IThemeManager.DEFAULT_THEME), fontDefs, PrefUtil
- .getInternalPreferenceStore());
- }
-
- //TODO: confirm
- private void loadThemes(IExtension ext) {
- ThemeRegistryReader reader = new ThemeRegistryReader();
- ThemeRegistry registry = (ThemeRegistry) WorkbenchPlugin.getDefault()
- .getThemeRegistry();
- reader.setRegistry(registry);
+ Collection fonts = reader.getFontDefinitions();
+ FontDefinition[] fontDefs = (FontDefinition[]) fonts.toArray(new FontDefinition[fonts.size()]);
+ ThemeElementHelper.populateRegistry(workbench.getThemeManager().getTheme(IThemeManager.DEFAULT_THEME), fontDefs,
+ PrefUtil.getInternalPreferenceStore());
+ }
+
+ // TODO: confirm
+ private void loadThemes(IExtension ext) {
+ ThemeRegistryReader reader = new ThemeRegistryReader();
+ ThemeRegistry registry = (ThemeRegistry) WorkbenchPlugin.getDefault().getThemeRegistry();
+ reader.setRegistry(registry);
for (IConfigurationElement configElement : ext.getConfigurationElements()) {
reader.readElement(configElement);
}
- Collection colors = reader.getColorDefinitions();
- ColorDefinition[] colorDefs = (ColorDefinition[]) colors
- .toArray(new ColorDefinition[colors.size()]);
+ Collection colors = reader.getColorDefinitions();
+ ColorDefinition[] colorDefs = (ColorDefinition[]) colors.toArray(new ColorDefinition[colors.size()]);
- ITheme theme = workbench.getThemeManager().getTheme(
- IThemeManager.DEFAULT_THEME);
- ThemeElementHelper.populateRegistry(theme, colorDefs, PrefUtil
- .getInternalPreferenceStore());
+ ITheme theme = workbench.getThemeManager().getTheme(IThemeManager.DEFAULT_THEME);
+ ThemeElementHelper.populateRegistry(theme, colorDefs, PrefUtil.getInternalPreferenceStore());
- Collection fonts = reader.getFontDefinitions();
- FontDefinition[] fontDefs = (FontDefinition[]) fonts
- .toArray(new FontDefinition[fonts.size()]);
- ThemeElementHelper.populateRegistry(theme, fontDefs, PrefUtil
- .getInternalPreferenceStore());
+ Collection fonts = reader.getFontDefinitions();
+ FontDefinition[] fontDefs = (FontDefinition[]) fonts.toArray(new FontDefinition[fonts.size()]);
+ ThemeElementHelper.populateRegistry(theme, fontDefs, PrefUtil.getInternalPreferenceStore());
- Map data = reader.getData();
- registry.addData(data);
- }
+ Map data = reader.getData();
+ registry.addData(data);
+ }
- private void resetCurrentPerspective(Display display) {
- if (changeList.isEmpty()) {
+ private void resetCurrentPerspective(Display display) {
+ if (changeList.isEmpty()) {
return;
}
- final StringBuilder message = new StringBuilder(
- ExtensionEventHandlerMessages.ExtensionEventHandler_following_changes);
+ final StringBuilder message = new StringBuilder(
+ ExtensionEventHandlerMessages.ExtensionEventHandler_following_changes);
- for (Iterator i = changeList.iterator(); i.hasNext();) {
- message.append(i.next());
- }
+ for (Iterator i = changeList.iterator(); i.hasNext();) {
+ message.append(i.next());
+ }
- message.append(ExtensionEventHandlerMessages.ExtensionEventHandler_need_to_reset);
+ message.append(ExtensionEventHandlerMessages.ExtensionEventHandler_need_to_reset);
- display.asyncExec(() -> {
- Shell parentShell = null;
- IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
- if (window == null) {
- if (workbench.getWorkbenchWindowCount() == 0) {
+ display.asyncExec(() -> {
+ Shell parentShell = null;
+ IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
+ if (window == null) {
+ if (workbench.getWorkbenchWindowCount() == 0) {
return;
}
- window = workbench.getWorkbenchWindows()[0];
- }
+ window = workbench.getWorkbenchWindows()[0];
+ }
- parentShell = window.getShell();
+ parentShell = window.getShell();
- if (MessageDialog
- .openQuestion(
- parentShell,
- ExtensionEventHandlerMessages.ExtensionEventHandler_reset_perspective, message.toString())) {
- IWorkbenchPage page = window.getActivePage();
- if (page == null) {
+ if (MessageDialog.openQuestion(parentShell,
+ ExtensionEventHandlerMessages.ExtensionEventHandler_reset_perspective, message.toString())) {
+ IWorkbenchPage page = window.getActivePage();
+ if (page == null) {
return;
}
- page.resetPerspective();
- }
+ page.resetPerspective();
+ }
});
- }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ExtensionEventHandlerMessages.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ExtensionEventHandlerMessages.java
index 2e0fb12e978..cc876685be7 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ExtensionEventHandlerMessages.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ExtensionEventHandlerMessages.java
@@ -24,7 +24,6 @@ public class ExtensionEventHandlerMessages extends NLS {
public static String ExtensionEventHandler_need_to_reset;
public static String ExtensionEventHandler_reset_perspective;
-
static {
// load message values from bundle file
NLS.initializeMessages(BUNDLE_NAME, ExtensionEventHandlerMessages.class);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/FaderAnimationFeedback.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/FaderAnimationFeedback.java
index 7cd6bffb12d..07130fd9780 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/FaderAnimationFeedback.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/FaderAnimationFeedback.java
@@ -20,18 +20,18 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
/**
- * Creates an animation effect where the Shell's image is captured and
- * over-lain (in its own shell) on top of the real one. This image
- * masks the changes to the 'real' shell and then the covering image
- * fades to transparent, revealing the new state.
+ * Creates an animation effect where the Shell's image is captured and over-lain
+ * (in its own shell) on top of the real one. This image masks the changes to
+ * the 'real' shell and then the covering image fades to transparent, revealing
+ * the new state.
*
- * This provides a nice cross-fade effect for operations like a
- * perspective change (where the overall effect on the shell is large.
+ * This provides a nice cross-fade effect for operations like a perspective
+ * change (where the overall effect on the shell is large.
*
* @since 3.3
*
*/
-public class FaderAnimationFeedback extends AnimationFeedbackBase {
+public class FaderAnimationFeedback extends AnimationFeedbackBase {
private Image backingStore;
public FaderAnimationFeedback(Shell parentShell) {
@@ -66,7 +66,7 @@ public class FaderAnimationFeedback extends AnimationFeedbackBase {
@Override
public void renderStep(AnimationEngine engine) {
- getAnimationShell().setAlpha((int) (255 - (engine.amount()*255)));
+ getAnimationShell().setAlpha((int) (255 - (engine.amount() * 255)));
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/FilteredTableBaseHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/FilteredTableBaseHandler.java
index 4136e3350ce..5bbe44cdac3 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/FilteredTableBaseHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/FilteredTableBaseHandler.java
@@ -84,8 +84,7 @@ import org.eclipse.ui.model.PerspectiveLabelProvider;
*
*/
-public abstract class FilteredTableBaseHandler extends AbstractHandler implements
- IExecutableExtension {
+public abstract class FilteredTableBaseHandler extends AbstractHandler implements IExecutableExtension {
private static final String EMPTY_STRING = ""; //$NON-NLS-1$
@@ -101,8 +100,8 @@ public abstract class FilteredTableBaseHandler extends AbstractHandler implement
protected boolean gotoDirection;
/**
- * The list of key bindings for the backward command when it is open. This
- * value is <code>null</code> if the dialog is not open.
+ * The list of key bindings for the backward command when it is open. This value
+ * is <code>null</code> if the dialog is not open.
*/
private TriggerSequence[] backwardTriggerSequences = null;
@@ -110,12 +109,11 @@ public abstract class FilteredTableBaseHandler extends AbstractHandler implement
protected ParameterizedCommand commandForward = null;
/**
- * The list of key bindings for the forward command when it is open. This
- * value is <code>null</code> if the dialog is not open.
+ * The list of key bindings for the forward command when it is open. This value
+ * is <code>null</code> if the dialog is not open.
*/
private TriggerSequence[] forwardTriggerSequences = null;
-
/**
* Get the index of the current item (not valid if there are no items).
*/
@@ -127,7 +125,7 @@ public abstract class FilteredTableBaseHandler extends AbstractHandler implement
public Object execute(ExecutionEvent event) throws ExecutionException {
window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
page = (WorkbenchPage) window.getActivePage();
- IWorkbenchPart activePart= page.getActivePart();
+ IWorkbenchPart activePart = page.getActivePart();
getTriggers();
openDialog(page, activePart);
clearTriggers();
@@ -175,9 +173,9 @@ public abstract class FilteredTableBaseHandler extends AbstractHandler implement
text.setBackground(getBackground());
} else {
/*
- * For issues with dark theme, don't use
- * table.setHeaderVisible(true); and table.setLinesVisible(true);
- * see: https://bugs.eclipse.org/bugs/attachment.cgi?id=264527
+ * For issues with dark theme, don't use table.setHeaderVisible(true); and
+ * table.setLinesVisible(true); see:
+ * https://bugs.eclipse.org/bugs/attachment.cgi?id=264527
*/
labelTitle = new Label(composite, SWT.NONE);
labelTitle.setText(getTableHeader(activePart));
@@ -228,12 +226,12 @@ public abstract class FilteredTableBaseHandler extends AbstractHandler implement
int i;
int currentItemIndex = getCurrentItemIndex();
if (gotoDirection) {
- i= currentItemIndex + 1;
+ i = currentItemIndex + 1;
if (i >= tableItemCount) {
i = 0;
}
} else {
- i= currentItemIndex - 1;
+ i = currentItemIndex - 1;
if (i < 0) {
i = tableItemCount - 1;
}
@@ -277,9 +275,7 @@ public abstract class FilteredTableBaseHandler extends AbstractHandler implement
if (table.equals(e.getSource())) {
TableItem tableItem = table.getItem(new Point(e.x, e.y));
if (fLastItem == null ^ tableItem == null) {
- table.setCursor(tableItem == null ? null
- : table.getDisplay().getSystemCursor(
- SWT.CURSOR_HAND));
+ table.setCursor(tableItem == null ? null : table.getDisplay().getSystemCursor(SWT.CURSOR_HAND));
}
if (tableItem != null) {
if (!tableItem.equals(fLastItem)) {
@@ -295,8 +291,7 @@ public abstract class FilteredTableBaseHandler extends AbstractHandler implement
setDialogLocation(dialog, activePart);
- final IContextService contextService = window
- .getWorkbench().getService(IContextService.class);
+ final IContextService contextService = window.getWorkbench().getService(IContextService.class);
try {
dialog.open();
addMouseListener(table, dialog);
@@ -331,9 +326,9 @@ public abstract class FilteredTableBaseHandler extends AbstractHandler implement
}
/**
- * {@link FocusListener} for active controls. When the focus event is
- * complete, the listener check if focus is still on one of the active
- * components. If not, closes the dialog.
+ * {@link FocusListener} for active controls. When the focus event is complete,
+ * the listener check if focus is still on one of the active components. If not,
+ * closes the dialog.
*
*/
private FocusAdapter fAdapter = new FocusAdapter() {
@@ -369,20 +364,15 @@ public abstract class FilteredTableBaseHandler extends AbstractHandler implement
: ((Control) ((PartSite) activePart.getSite()).getModel().getWidget()).getMonitor().getBounds();
// Place it in the center of its parent;
- dialogBounds.x = parentBounds.x
- + ((parentBounds.width - dialogBounds.width) / 2);
- dialogBounds.y = parentBounds.y
- + ((parentBounds.height - dialogBounds.height) / 2);
+ dialogBounds.x = parentBounds.x + ((parentBounds.width - dialogBounds.width) / 2);
+ dialogBounds.y = parentBounds.y + ((parentBounds.height - dialogBounds.height) / 2);
if (!monitorBounds.contains(dialogBounds.x, dialogBounds.y)
- || !monitorBounds.contains(dialogBounds.x + dialogBounds.width,
- dialogBounds.y + dialogBounds.height)) {
+ || !monitorBounds.contains(dialogBounds.x + dialogBounds.width, dialogBounds.y + dialogBounds.height)) {
// Place it in the center of the monitor if it is not visible
// when placed in the center of its parent.
// Ensure the origin is visible on the screen.
- dialogBounds.x = Math.max(0,
- monitorBounds.x + (monitorBounds.width - dialogBounds.width) / 2);
- dialogBounds.y = Math.max(0,
- monitorBounds.y + (monitorBounds.height - dialogBounds.height) / 2);
+ dialogBounds.x = Math.max(0, monitorBounds.x + (monitorBounds.width - dialogBounds.width) / 2);
+ dialogBounds.y = Math.max(0, monitorBounds.y + (monitorBounds.height - dialogBounds.height) / 2);
}
dialog.setLocation(dialogBounds.x, dialogBounds.y);
@@ -397,19 +387,16 @@ public abstract class FilteredTableBaseHandler extends AbstractHandler implement
}
/**
- * Fetch the key bindings for the forward and backward commands. They will
- * not change while the dialog is open, but the context will. Bug 55581.
+ * Fetch the key bindings for the forward and backward commands. They will not
+ * change while the dialog is open, but the context will. Bug 55581.
*/
protected void getTriggers() {
commandForward = getForwardCommand();
commandBackward = getBackwardCommand();
- final IBindingService bindingService = window
- .getWorkbench().getService(IBindingService.class);
- forwardTriggerSequences = bindingService
- .getActiveBindingsFor(commandForward);
- backwardTriggerSequences = bindingService
- .getActiveBindingsFor(commandBackward);
+ final IBindingService bindingService = window.getWorkbench().getService(IBindingService.class);
+ forwardTriggerSequences = bindingService.getActiveBindingsFor(commandForward);
+ backwardTriggerSequences = bindingService.getActiveBindingsFor(commandBackward);
}
private KeyStroke computeKeyStroke(KeyEvent e) {
@@ -516,9 +503,10 @@ public abstract class FilteredTableBaseHandler extends AbstractHandler implement
});
}
- protected Color getForeground(){
+ protected Color getForeground() {
return dialog.getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND);
}
+
protected Color getBackground() {
return dialog.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND);
}
@@ -562,12 +550,9 @@ public abstract class FilteredTableBaseHandler extends AbstractHandler implement
} else if (keyCode == SWT.DEL && isFiltered()) {
e.doit = false;
deleteSelectedItem();
- } else if (keyCode != SWT.ALT && keyCode != SWT.COMMAND
- && keyCode != SWT.CTRL && keyCode != SWT.SHIFT
- && keyCode != SWT.ARROW_DOWN && keyCode != SWT.ARROW_UP
- && keyCode != SWT.PAGE_DOWN && keyCode != SWT.PAGE_UP
- && keyCode != SWT.ARROW_LEFT
- && keyCode != SWT.ARROW_RIGHT) {
+ } else if (keyCode != SWT.ALT && keyCode != SWT.COMMAND && keyCode != SWT.CTRL && keyCode != SWT.SHIFT
+ && keyCode != SWT.ARROW_DOWN && keyCode != SWT.ARROW_UP && keyCode != SWT.PAGE_DOWN
+ && keyCode != SWT.PAGE_UP && keyCode != SWT.ARROW_LEFT && keyCode != SWT.ARROW_RIGHT) {
if (!isFiltered()) {
cancel(dialog);
} else {
@@ -581,8 +566,7 @@ public abstract class FilteredTableBaseHandler extends AbstractHandler implement
} else if (s.matches(RE_TEXT)) {
// alphanumeric, add to text
text.append(Character.toString(e.character));
- }
- else {
+ } else {
cancel(dialog);
}
}
@@ -605,12 +589,9 @@ public abstract class FilteredTableBaseHandler extends AbstractHandler implement
int keyCode = e.keyCode;
int stateMask = e.stateMask;
- final IPreferenceStore store = WorkbenchPlugin.getDefault()
- .getPreferenceStore();
- final boolean stickyCycle = store
- .getBoolean(IPreferenceConstants.STICKY_CYCLE);
- if (!isFiltered() && (!stickyCycle && (firstKey || quickReleaseMode))
- && keyCode == stateMask) {
+ final IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
+ final boolean stickyCycle = store.getBoolean(IPreferenceConstants.STICKY_CYCLE);
+ if (!isFiltered() && (!stickyCycle && (firstKey || quickReleaseMode)) && keyCode == stateMask) {
ok(dialog, table);
}
}
@@ -696,9 +677,8 @@ public abstract class FilteredTableBaseHandler extends AbstractHandler implement
/**
* Adds a listener to the given table that blocks all traversal operations.
*
- * @param table
- * The table to which the traversal suppression should be added;
- * must not be <code>null</code>.
+ * @param table The table to which the traversal suppression should be added;
+ * must not be <code>null</code>.
*/
protected final void addTraverseListener(final Table table) {
table.addTraverseListener(event -> event.doit = false);
@@ -707,10 +687,8 @@ public abstract class FilteredTableBaseHandler extends AbstractHandler implement
/**
* Activate the selected item.
*
- * @param page
- * the page
- * @param selectedItem
- * the selected item
+ * @param page the page
+ * @param selectedItem the selected item
*/
protected void activate(IWorkbenchPage page, Object selectedItem) {
if (selectedItem != null) {
@@ -725,17 +703,16 @@ public abstract class FilteredTableBaseHandler extends AbstractHandler implement
page.setEditorAreaVisible(true);
}
if (selectedItem instanceof IWorkbenchPartReference) {
- IWorkbenchPart part = ((IWorkbenchPartReference) selectedItem)
- .getPart(true);
+ IWorkbenchPart part = ((IWorkbenchPartReference) selectedItem).getPart(true);
if (part != null) {
page.activate(part);
}
// the if conditions below do not need to be checked then
return;
}
- if (selectedItem instanceof IPerspectiveDescriptor){
- IPerspectiveDescriptor persp = (IPerspectiveDescriptor) selectedItem;
- page.setPerspective(persp);
+ if (selectedItem instanceof IPerspectiveDescriptor) {
+ IPerspectiveDescriptor persp = (IPerspectiveDescriptor) selectedItem;
+ page.setPerspective(persp);
IWorkbenchPart activePart = page.getActivePart();
if (activePart != null) {
activePart.setFocus();
@@ -836,9 +813,8 @@ public abstract class FilteredTableBaseHandler extends AbstractHandler implement
}
/**
- * Sets the label provider for the only column visible in the table.
- * Subclasses can override this method to style the table, using a
- * StyledCellLabelProvider.
+ * Sets the label provider for the only column visible in the table. Subclasses
+ * can override this method to style the table, using a StyledCellLabelProvider.
*
* @param tableViewerColumn
* @return
@@ -899,8 +875,8 @@ public abstract class FilteredTableBaseHandler extends AbstractHandler implement
protected abstract ParameterizedCommand getForwardCommand();
/**
- * Get TableHeader, return title for non-filtered lists. By default returns
- * an empty String. Subclasses can use the active part to detect the type of
+ * Get TableHeader, return title for non-filtered lists. By default returns an
+ * empty String. Subclasses can use the active part to detect the type of
* object.
*/
protected String getTableHeader(IWorkbenchPart activePart) {
@@ -924,8 +900,8 @@ public abstract class FilteredTableBaseHandler extends AbstractHandler implement
}
@Override
- public void setInitializationData(IConfigurationElement config,
- String propertyName, Object data) throws CoreException {
+ public void setInitializationData(IConfigurationElement config, String propertyName, Object data)
+ throws CoreException {
// true by default, but depends on data
gotoDirection = data == null || "true".equals(data); //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/HeapStatus.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/HeapStatus.java
index 3cb586188bf..7850260cf5b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/HeapStatus.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/HeapStatus.java
@@ -43,7 +43,8 @@ import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.util.PrefUtil;
/**
- * The Heap Status control, which shows the heap usage statistics in the window trim.
+ * The Heap Status control, which shows the heap usage statistics in the window
+ * trim.
*
* @since 3.1
*/
@@ -52,19 +53,20 @@ public class HeapStatus extends Composite {
private boolean armed;
private Image gcImage;
private Image disabledGcImage;
- private Color bgCol, usedMemCol, lowMemCol, freeMemCol, topLeftCol, bottomRightCol, sepCol, textCol, markCol, armCol;
- private Canvas canvas;
+ private Color bgCol, usedMemCol, lowMemCol, freeMemCol, topLeftCol, bottomRightCol, sepCol, textCol, markCol,
+ armCol;
+ private Canvas canvas;
private IPreferenceStore prefStore;
private int updateInterval;
private boolean showMax;
- private long totalMem;
- private long prevTotalMem = -1L;
- private long prevUsedMem = -1L;
- private boolean hasChanged;
- private long usedMem;
- private long mark = -1;
- // start with 12x12
- private Rectangle imgBounds = new Rectangle(0,0,12,12);
+ private long totalMem;
+ private long prevTotalMem = -1L;
+ private long prevUsedMem = -1L;
+ private boolean hasChanged;
+ private long usedMem;
+ private long mark = -1;
+ // start with 12x12
+ private Rectangle imgBounds = new Rectangle(0, 0, 12, 12);
private long maxMem = Long.MAX_VALUE;
private boolean maxMemKnown;
private float lowMemThreshold = 0.05f;
@@ -73,54 +75,52 @@ public class HeapStatus extends Composite {
protected volatile boolean isInGC = false;
- private final Runnable timer = new Runnable() {
- @Override
+ private final Runnable timer = new Runnable() {
+ @Override
public void run() {
- if (!isDisposed()) {
- updateStats();
- if (hasChanged) {
- if (updateTooltip) {
- updateToolTip();
- }
- redraw();
- hasChanged = false;
- }
- getDisplay().timerExec(updateInterval, this);
- }
- }
- };
-
- private final IPropertyChangeListener prefListener = event -> {
+ if (!isDisposed()) {
+ updateStats();
+ if (hasChanged) {
+ if (updateTooltip) {
+ updateToolTip();
+ }
+ redraw();
+ hasChanged = false;
+ }
+ getDisplay().timerExec(updateInterval, this);
+ }
+ }
+ };
+
+ private final IPropertyChangeListener prefListener = event -> {
if (IHeapStatusConstants.PREF_UPDATE_INTERVAL.equals(event.getProperty())) {
setUpdateIntervalInMS(prefStore.getInt(IHeapStatusConstants.PREF_UPDATE_INTERVAL));
- }
- else if (IHeapStatusConstants.PREF_SHOW_MAX.equals(event.getProperty())) {
+ } else if (IHeapStatusConstants.PREF_SHOW_MAX.equals(event.getProperty())) {
showMax = prefStore.getBoolean(IHeapStatusConstants.PREF_SHOW_MAX);
}
};
- /**
- * Creates a new heap status control with the given parent, and using
- * the given preference store to obtain settings such as the refresh
- * interval.
- *
- * @param parent the parent composite
- * @param prefStore the preference store
- */
+ /**
+ * Creates a new heap status control with the given parent, and using the given
+ * preference store to obtain settings such as the refresh interval.
+ *
+ * @param parent the parent composite
+ * @param prefStore the preference store
+ */
public HeapStatus(Composite parent, IPreferenceStore prefStore) {
super(parent, SWT.NONE);
maxMem = getMaxMem();
maxMemKnown = maxMem != Long.MAX_VALUE;
- this.prefStore = prefStore;
- prefStore.addPropertyChangeListener(prefListener);
+ this.prefStore = prefStore;
+ prefStore.addPropertyChangeListener(prefListener);
- setUpdateIntervalInMS(prefStore.getInt(IHeapStatusConstants.PREF_UPDATE_INTERVAL));
- showMax = prefStore.getBoolean(IHeapStatusConstants.PREF_SHOW_MAX);
+ setUpdateIntervalInMS(prefStore.getInt(IHeapStatusConstants.PREF_UPDATE_INTERVAL));
+ showMax = prefStore.getBoolean(IHeapStatusConstants.PREF_SHOW_MAX);
- canvas = new Canvas(this, SWT.NONE);
- canvas.setToolTipText(WorkbenchMessages.HeapStatus_buttonToolTip);
+ canvas = new Canvas(this, SWT.NONE);
+ canvas.setToolTipText(WorkbenchMessages.HeapStatus_buttonToolTip);
ImageDescriptor imageDesc = WorkbenchImages.getWorkbenchImageDescriptor("elcl16/trash.png"); //$NON-NLS-1$
Display display = getDisplay();
@@ -131,8 +131,8 @@ public class HeapStatus extends Composite {
}
usedMemCol = new Color(display, 160, 160, 160); // gray
- lowMemCol = new Color(display, 255, 70, 70); // medium red
- freeMemCol = new Color(display, 255, 190, 125); // light orange
+ lowMemCol = new Color(display, 255, 70, 70); // medium red
+ freeMemCol = new Color(display, 255, 190, 125); // light orange
sepCol = topLeftCol = armCol = usedMemCol;
bgCol = display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
bottomRightCol = display.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW);
@@ -140,74 +140,73 @@ public class HeapStatus extends Composite {
createContextMenu();
- Listener listener = event -> {
- switch (event.type) {
- case SWT.Dispose:
- doDispose();
- break;
- case SWT.Resize:
- Rectangle rect = getClientArea();
- canvas.setBounds(rect.width - imgBounds.width - 1, 1, imgBounds.width, rect.height - 2);
- break;
- case SWT.Paint:
- if (event.widget == HeapStatus.this) {
- paintComposite(event.gc);
- }
- else if (event.widget == canvas) {
- paintButton(event.gc);
- }
- break;
- case SWT.MouseUp:
- if (event.button == 1) {
+ Listener listener = event -> {
+ switch (event.type) {
+ case SWT.Dispose:
+ doDispose();
+ break;
+ case SWT.Resize:
+ Rectangle rect = getClientArea();
+ canvas.setBounds(rect.width - imgBounds.width - 1, 1, imgBounds.width, rect.height - 2);
+ break;
+ case SWT.Paint:
+ if (event.widget == HeapStatus.this) {
+ paintComposite(event.gc);
+ } else if (event.widget == canvas) {
+ paintButton(event.gc);
+ }
+ break;
+ case SWT.MouseUp:
+ if (event.button == 1) {
if (!isInGC) {
arm(false);
gc();
}
- }
- break;
- case SWT.MouseDown:
- if (event.button == 1) {
- if (event.widget == HeapStatus.this) {
+ }
+ break;
+ case SWT.MouseDown:
+ if (event.button == 1) {
+ if (event.widget == HeapStatus.this) {
setMark();
} else if (event.widget == canvas) {
if (!isInGC)
arm(true);
}
- }
- break;
- case SWT.MouseEnter:
- HeapStatus.this.updateTooltip = true;
- updateToolTip();
- break;
- case SWT.MouseExit:
- if (event.widget == HeapStatus.this) {
- HeapStatus.this.updateTooltip = false;
+ }
+ break;
+ case SWT.MouseEnter:
+ HeapStatus.this.updateTooltip = true;
+ updateToolTip();
+ break;
+ case SWT.MouseExit:
+ if (event.widget == HeapStatus.this) {
+ HeapStatus.this.updateTooltip = false;
} else if (event.widget == canvas) {
arm(false);
}
- break;
- }
+ break;
+ }
};
- addListener(SWT.Dispose, listener);
- addListener(SWT.MouseDown, listener);
- addListener(SWT.Paint, listener);
- addListener(SWT.Resize, listener);
- addListener(SWT.MouseEnter, listener);
- addListener(SWT.MouseExit, listener);
- canvas.addListener(SWT.MouseDown, listener);
- canvas.addListener(SWT.MouseExit, listener);
- canvas.addListener(SWT.MouseUp, listener);
- canvas.addListener(SWT.Paint, listener);
+ addListener(SWT.Dispose, listener);
+ addListener(SWT.MouseDown, listener);
+ addListener(SWT.Paint, listener);
+ addListener(SWT.Resize, listener);
+ addListener(SWT.MouseEnter, listener);
+ addListener(SWT.MouseExit, listener);
+ canvas.addListener(SWT.MouseDown, listener);
+ canvas.addListener(SWT.MouseExit, listener);
+ canvas.addListener(SWT.MouseUp, listener);
+ canvas.addListener(SWT.Paint, listener);
// make sure stats are updated before first paint
updateStats();
- getDisplay().asyncExec(() -> {
+ getDisplay().asyncExec(() -> {
if (!isDisposed()) {
getDisplay().timerExec(updateInterval, timer);
}
});
- }
+ }
@Override
public void setBackground(Color color) {
@@ -246,9 +245,9 @@ public class HeapStatus extends Composite {
if (o instanceof Long) {
max = ((Long) o).longValue();
}
- }
- catch (Exception e) {
- // ignore if method missing or if there are other failures trying to determine the max
+ } catch (Exception e) {
+ // ignore if method missing or if there are other failures trying to determine
+ // the max
}
return max;
}
@@ -258,8 +257,8 @@ public class HeapStatus extends Composite {
}
private void doDispose() {
- prefStore.removePropertyChangeListener(prefListener);
- if (gcImage != null) {
+ prefStore.removePropertyChangeListener(prefListener);
+ if (gcImage != null) {
gcImage.dispose();
}
if (disabledGcImage != null) {
@@ -269,86 +268,86 @@ public class HeapStatus extends Composite {
if (usedMemCol != null) {
usedMemCol.dispose();
}
- if (lowMemCol != null) {
+ if (lowMemCol != null) {
lowMemCol.dispose();
}
- if (freeMemCol != null) {
+ if (freeMemCol != null) {
freeMemCol.dispose();
}
}
@Override
public Point computeSize(int wHint, int hHint, boolean changed) {
- GC gc = new GC(this);
- Point p = gc.textExtent(WorkbenchMessages.HeapStatus_widthStr);
- int height = imgBounds.height;
- // choose the largest of
- // - Text height + margins
- // - Image height + margins
- // - Default Trim heightin
- height = Math.max(height, p.y) + 4;
- height = Math.max(TrimUtil.TRIM_DEFAULT_HEIGHT, height);
- gc.dispose();
+ GC gc = new GC(this);
+ Point p = gc.textExtent(WorkbenchMessages.HeapStatus_widthStr);
+ int height = imgBounds.height;
+ // choose the largest of
+ // - Text height + margins
+ // - Image height + margins
+ // - Default Trim heightin
+ height = Math.max(height, p.y) + 4;
+ height = Math.max(TrimUtil.TRIM_DEFAULT_HEIGHT, height);
+ gc.dispose();
return new Point(p.x + 15, height);
}
- private void arm(boolean armed) {
- if (this.armed == armed) {
+ private void arm(boolean armed) {
+ if (this.armed == armed) {
return;
}
- this.armed = armed;
- canvas.redraw();
- }
+ this.armed = armed;
+ canvas.redraw();
+ }
private void gcRunning(boolean isInGC) {
if (this.isInGC == isInGC) {
return;
}
this.isInGC = isInGC;
- canvas.redraw();
+ canvas.redraw();
+ }
+
+ /**
+ * Creates the context menu
+ */
+ private void createContextMenu() {
+ MenuManager menuMgr = new MenuManager();
+ menuMgr.setRemoveAllWhenShown(true);
+ menuMgr.addMenuListener(menuMgr1 -> fillMenu(menuMgr1));
+ Menu menu = menuMgr.createContextMenu(this);
+ setMenu(menu);
}
- /**
- * Creates the context menu
- */
- private void createContextMenu() {
- MenuManager menuMgr = new MenuManager();
- menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(menuMgr1 -> fillMenu(menuMgr1));
- Menu menu = menuMgr.createContextMenu(this);
- setMenu(menu);
- }
-
- private void fillMenu(IMenuManager menuMgr) {
- menuMgr.add(new SetMarkAction());
- menuMgr.add(new ClearMarkAction());
- menuMgr.add(new ShowMaxAction());
- menuMgr.add(new CloseHeapStatusAction());
+ private void fillMenu(IMenuManager menuMgr) {
+ menuMgr.add(new SetMarkAction());
+ menuMgr.add(new ClearMarkAction());
+ menuMgr.add(new ShowMaxAction());
+ menuMgr.add(new CloseHeapStatusAction());
// if (isKyrsoftViewAvailable()) {
// menuMgr.add(new ShowKyrsoftViewAction());
// }
- }
-
- /**
- * Sets the mark to the current usedMem level.
- */
- private void setMark() {
- updateStats(); // get up-to-date stats before taking the mark
- mark = usedMem;
- hasChanged = true;
- redraw();
- }
-
- /**
- * Clears the mark.
- */
- private void clearMark() {
- mark = -1;
- hasChanged = true;
- redraw();
- }
-
- private void gc() {
+ }
+
+ /**
+ * Sets the mark to the current usedMem level.
+ */
+ private void setMark() {
+ updateStats(); // get up-to-date stats before taking the mark
+ mark = usedMem;
+ hasChanged = true;
+ redraw();
+ }
+
+ /**
+ * Clears the mark.
+ */
+ private void clearMark() {
+ mark = -1;
+ hasChanged = true;
+ redraw();
+ }
+
+ private void gc() {
gcRunning(true);
Thread t = new Thread() {
@Override
@@ -362,17 +361,17 @@ public class HeapStatus extends Composite {
}
};
t.start();
- }
+ }
- private void busyGC() {
- for (int i = 0; i < 2; ++i) {
- System.gc();
- System.runFinalization();
- }
- }
+ private void busyGC() {
+ for (int i = 0; i < 2; ++i) {
+ System.gc();
+ System.runFinalization();
+ }
+ }
- private void paintButton(GC gc) {
- Rectangle rect = canvas.getClientArea();
+ private void paintButton(GC gc) {
+ Rectangle rect = canvas.getClientArea();
if (isInGC) {
if (disabledGcImage != null) {
int buttonY = (rect.height - imgBounds.height) / 2 + rect.y;
@@ -380,229 +379,230 @@ public class HeapStatus extends Composite {
}
return;
}
- if (armed) {
- gc.setBackground(armCol);
- gc.fillRectangle(rect.x, rect.y, rect.width, rect.height);
- }
- if (gcImage != null) {
+ if (armed) {
+ gc.setBackground(armCol);
+ gc.fillRectangle(rect.x, rect.y, rect.width, rect.height);
+ }
+ if (gcImage != null) {
int by = (rect.height - imgBounds.height) / 2 + rect.y; // button y
gc.drawImage(gcImage, rect.x, by);
- }
- }
+ }
+ }
- private void paintComposite(GC gc) {
+ private void paintComposite(GC gc) {
if (showMax && maxMemKnown) {
paintCompositeMaxKnown(gc);
} else {
paintCompositeMaxUnknown(gc);
}
- }
-
- private void paintCompositeMaxUnknown(GC gc) {
- Rectangle rect = getClientArea();
- int x = rect.x;
- int y = rect.y;
- int w = rect.width;
- int h = rect.height;
- int bw = imgBounds.width; // button width
- int dx = x + w - bw - 2; // divider x
- int sw = w - bw - 3; // status width
- int uw = (int) (sw * usedMem / totalMem); // used mem width
- int ux = x + 1 + uw; // used mem right edge
- if (bgCol != null) {
+ }
+
+ private void paintCompositeMaxUnknown(GC gc) {
+ Rectangle rect = getClientArea();
+ int x = rect.x;
+ int y = rect.y;
+ int w = rect.width;
+ int h = rect.height;
+ int bw = imgBounds.width; // button width
+ int dx = x + w - bw - 2; // divider x
+ int sw = w - bw - 3; // status width
+ int uw = (int) (sw * usedMem / totalMem); // used mem width
+ int ux = x + 1 + uw; // used mem right edge
+ if (bgCol != null) {
gc.setBackground(bgCol);
}
- gc.fillRectangle(rect);
- gc.setForeground(sepCol);
+ gc.fillRectangle(rect);
+ gc.setForeground(sepCol);
gc.drawLine(dx, y, dx, y + h);
gc.drawLine(ux, y, ux, y + h);
- gc.setForeground(topLeftCol);
- gc.drawLine(x, y, x+w, y);
- gc.drawLine(x, y, x, y+h);
+ gc.setForeground(topLeftCol);
+ gc.drawLine(x, y, x + w, y);
+ gc.drawLine(x, y, x, y + h);
gc.setForeground(bottomRightCol);
- gc.drawLine(x+w-1, y, x+w-1, y+h);
- gc.drawLine(x, y+h-1, x+w, y+h-1);
+ gc.drawLine(x + w - 1, y, x + w - 1, y + h);
+ gc.drawLine(x, y + h - 1, x + w, y + h - 1);
gc.setBackground(usedMemCol);
- gc.fillRectangle(x + 1, y + 1, uw, h - 2);
-
- String s = NLS.bind(WorkbenchMessages.HeapStatus_status, convertToMegString(usedMem), convertToMegString(totalMem));
- Point p = gc.textExtent(s);
- int sx = (rect.width - 15 - p.x) / 2 + rect.x + 1;
- int sy = (rect.height - 2 - p.y) / 2 + rect.y + 1;
- gc.setForeground(textCol);
- gc.drawString(s, sx, sy, true);
-
- // draw an I-shaped bar in the foreground colour for the mark (if present)
- if (mark != -1) {
- int ssx = (int) (sw * mark / totalMem) + x + 1;
- paintMark(gc, ssx, y, h);
- }
- }
-
- private void paintCompositeMaxKnown(GC gc) {
- Rectangle rect = getClientArea();
- int x = rect.x;
- int y = rect.y;
- int w = rect.width;
- int h = rect.height;
- int bw = imgBounds.width; // button width
- int dx = x + w - bw - 2; // divider x
- int sw = w - bw - 3; // status width
- int uw = (int) (sw * usedMem / maxMem); // used mem width
- int ux = x + 1 + uw; // used mem right edge
- int tw = (int) (sw * totalMem / maxMem); // current total mem width
- int tx = x + 1 + tw; // current total mem right edge
+ gc.fillRectangle(x + 1, y + 1, uw, h - 2);
+
+ String s = NLS.bind(WorkbenchMessages.HeapStatus_status, convertToMegString(usedMem),
+ convertToMegString(totalMem));
+ Point p = gc.textExtent(s);
+ int sx = (rect.width - 15 - p.x) / 2 + rect.x + 1;
+ int sy = (rect.height - 2 - p.y) / 2 + rect.y + 1;
+ gc.setForeground(textCol);
+ gc.drawString(s, sx, sy, true);
+
+ // draw an I-shaped bar in the foreground colour for the mark (if present)
+ if (mark != -1) {
+ int ssx = (int) (sw * mark / totalMem) + x + 1;
+ paintMark(gc, ssx, y, h);
+ }
+ }
+
+ private void paintCompositeMaxKnown(GC gc) {
+ Rectangle rect = getClientArea();
+ int x = rect.x;
+ int y = rect.y;
+ int w = rect.width;
+ int h = rect.height;
+ int bw = imgBounds.width; // button width
+ int dx = x + w - bw - 2; // divider x
+ int sw = w - bw - 3; // status width
+ int uw = (int) (sw * usedMem / maxMem); // used mem width
+ int ux = x + 1 + uw; // used mem right edge
+ int tw = (int) (sw * totalMem / maxMem); // current total mem width
+ int tx = x + 1 + tw; // current total mem right edge
if (bgCol != null) {
gc.setBackground(bgCol);
}
- gc.fillRectangle(rect);
- gc.setForeground(sepCol);
+ gc.fillRectangle(rect);
+ gc.setForeground(sepCol);
gc.drawLine(dx, y, dx, y + h);
gc.drawLine(ux, y, ux, y + h);
gc.drawLine(tx, y, tx, y + h);
- gc.setForeground(topLeftCol);
- gc.drawLine(x, y, x+w, y);
- gc.drawLine(x, y, x, y+h);
+ gc.setForeground(topLeftCol);
+ gc.drawLine(x, y, x + w, y);
+ gc.drawLine(x, y, x, y + h);
gc.setForeground(bottomRightCol);
- gc.drawLine(x+w-1, y, x+w-1, y+h);
- gc.drawLine(x, y+h-1, x+w, y+h-1);
-
- if (lowMemThreshold != 0 && ((double)(maxMem - usedMem) / (double)maxMem < lowMemThreshold)) {
- gc.setBackground(lowMemCol);
- } else {
- gc.setBackground(usedMemCol);
- }
- gc.fillRectangle(x + 1, y + 1, uw, h - 2);
-
- gc.setBackground(freeMemCol);
- gc.fillRectangle(ux + 1, y + 1, tx - (ux + 1), h - 2);
-
- // paint line for low memory threshold
- if (showLowMemThreshold && lowMemThreshold != 0) {
- gc.setForeground(lowMemCol);
- int thresholdX = x + 1 + (int) (sw * (1.0 - lowMemThreshold));
- gc.drawLine(thresholdX, y + 1, thresholdX, y + h - 2);
- }
-
- String s = NLS.bind(WorkbenchMessages.HeapStatus_status,
- convertToMegString(usedMem), convertToMegString(totalMem));
- Point p = gc.textExtent(s);
- int sx = (rect.width - 15 - p.x) / 2 + rect.x + 1;
- int sy = (rect.height - 2 - p.y) / 2 + rect.y + 1;
- gc.setForeground(textCol);
- gc.drawString(s, sx, sy, true);
-
- // draw an I-shaped bar in the foreground colour for the mark (if present)
- if (mark != -1) {
- int ssx = (int) (sw * mark / maxMem) + x + 1;
- paintMark(gc, ssx, y, h);
- }
- }
+ gc.drawLine(x + w - 1, y, x + w - 1, y + h);
+ gc.drawLine(x, y + h - 1, x + w, y + h - 1);
+
+ if (lowMemThreshold != 0 && ((double) (maxMem - usedMem) / (double) maxMem < lowMemThreshold)) {
+ gc.setBackground(lowMemCol);
+ } else {
+ gc.setBackground(usedMemCol);
+ }
+ gc.fillRectangle(x + 1, y + 1, uw, h - 2);
+
+ gc.setBackground(freeMemCol);
+ gc.fillRectangle(ux + 1, y + 1, tx - (ux + 1), h - 2);
+
+ // paint line for low memory threshold
+ if (showLowMemThreshold && lowMemThreshold != 0) {
+ gc.setForeground(lowMemCol);
+ int thresholdX = x + 1 + (int) (sw * (1.0 - lowMemThreshold));
+ gc.drawLine(thresholdX, y + 1, thresholdX, y + h - 2);
+ }
+
+ String s = NLS.bind(WorkbenchMessages.HeapStatus_status, convertToMegString(usedMem),
+ convertToMegString(totalMem));
+ Point p = gc.textExtent(s);
+ int sx = (rect.width - 15 - p.x) / 2 + rect.x + 1;
+ int sy = (rect.height - 2 - p.y) / 2 + rect.y + 1;
+ gc.setForeground(textCol);
+ gc.drawString(s, sx, sy, true);
+
+ // draw an I-shaped bar in the foreground colour for the mark (if present)
+ if (mark != -1) {
+ int ssx = (int) (sw * mark / maxMem) + x + 1;
+ paintMark(gc, ssx, y, h);
+ }
+ }
private void paintMark(GC gc, int x, int y, int h) {
- gc.setForeground(markCol);
- gc.drawLine(x, y+1, x, y+h-2);
- gc.drawLine(x-1, y+1, x+1, y+1);
- gc.drawLine(x-1, y+h-2, x+1, y+h-2);
+ gc.setForeground(markCol);
+ gc.drawLine(x, y + 1, x, y + h - 2);
+ gc.drawLine(x - 1, y + 1, x + 1, y + 1);
+ gc.drawLine(x - 1, y + h - 2, x + 1, y + h - 2);
+ }
+
+ private void updateStats() {
+ Runtime runtime = Runtime.getRuntime();
+ totalMem = runtime.totalMemory();
+ long freeMem = runtime.freeMemory();
+ usedMem = totalMem - freeMem;
+
+ if (convertToMeg(prevUsedMem) != convertToMeg(usedMem)) {
+ prevUsedMem = usedMem;
+ this.hasChanged = true;
+ }
+
+ if (prevTotalMem != totalMem) {
+ prevTotalMem = totalMem;
+ this.hasChanged = true;
+ }
+ }
+
+ private void updateToolTip() {
+ String usedStr = convertToMegString(usedMem);
+ String totalStr = convertToMegString(totalMem);
+ String maxStr = maxMemKnown ? convertToMegString(maxMem) : WorkbenchMessages.HeapStatus_maxUnknown;
+ String markStr = mark == -1 ? WorkbenchMessages.HeapStatus_noMark : convertToMegString(mark);
+ String toolTip = NLS.bind(WorkbenchMessages.HeapStatus_memoryToolTip,
+ new Object[] { usedStr, totalStr, maxStr, markStr });
+ if (!toolTip.equals(getToolTipText())) {
+ setToolTipText(toolTip);
+ }
}
- private void updateStats() {
- Runtime runtime = Runtime.getRuntime();
- totalMem = runtime.totalMemory();
- long freeMem = runtime.freeMemory();
- usedMem = totalMem - freeMem;
-
- if (convertToMeg(prevUsedMem) != convertToMeg(usedMem)) {
- prevUsedMem = usedMem;
- this.hasChanged = true;
- }
-
- if (prevTotalMem != totalMem) {
- prevTotalMem = totalMem;
- this.hasChanged = true;
- }
- }
-
- private void updateToolTip() {
- String usedStr = convertToMegString(usedMem);
- String totalStr = convertToMegString(totalMem);
- String maxStr = maxMemKnown ? convertToMegString(maxMem) : WorkbenchMessages.HeapStatus_maxUnknown;
- String markStr = mark == -1 ? WorkbenchMessages.HeapStatus_noMark : convertToMegString(mark);
- String toolTip = NLS.bind(WorkbenchMessages.HeapStatus_memoryToolTip, new Object[] { usedStr, totalStr, maxStr, markStr });
- if (!toolTip.equals(getToolTipText())) {
- setToolTipText(toolTip);
- }
- }
-
- /**
- * Converts the given number of bytes to a printable number of megabytes (rounded up).
- */
- private String convertToMegString(long numBytes) {
+ /**
+ * Converts the given number of bytes to a printable number of megabytes
+ * (rounded up).
+ */
+ private String convertToMegString(long numBytes) {
return NLS.bind(WorkbenchMessages.HeapStatus_meg, Long.valueOf(convertToMeg(numBytes)));
- }
+ }
- /**
- * Converts the given number of bytes to the corresponding number of megabytes (rounded up).
- */
+ /**
+ * Converts the given number of bytes to the corresponding number of megabytes
+ * (rounded up).
+ */
private long convertToMeg(long numBytes) {
return (numBytes + (512 * 1024)) / (1024 * 1024);
}
+ class SetMarkAction extends Action {
+ SetMarkAction() {
+ super(WorkbenchMessages.SetMarkAction_text);
+ }
- class SetMarkAction extends Action {
- SetMarkAction() {
- super(WorkbenchMessages.SetMarkAction_text);
- }
-
- @Override
+ @Override
public void run() {
- setMark();
- }
- }
+ setMark();
+ }
+ }
- class ClearMarkAction extends Action {
- ClearMarkAction() {
- super(WorkbenchMessages.ClearMarkAction_text);
- }
+ class ClearMarkAction extends Action {
+ ClearMarkAction() {
+ super(WorkbenchMessages.ClearMarkAction_text);
+ }
- @Override
+ @Override
public void run() {
- clearMark();
- }
- }
-
- class ShowMaxAction extends Action {
- ShowMaxAction() {
- super(WorkbenchMessages.ShowMaxAction_text, IAction.AS_CHECK_BOX);
- setEnabled(maxMemKnown);
- setChecked(showMax);
- }
-
- @Override
+ clearMark();
+ }
+ }
+
+ class ShowMaxAction extends Action {
+ ShowMaxAction() {
+ super(WorkbenchMessages.ShowMaxAction_text, IAction.AS_CHECK_BOX);
+ setEnabled(maxMemKnown);
+ setChecked(showMax);
+ }
+
+ @Override
public void run() {
- prefStore.setValue(IHeapStatusConstants.PREF_SHOW_MAX, isChecked());
- redraw();
- }
- }
+ prefStore.setValue(IHeapStatusConstants.PREF_SHOW_MAX, isChecked());
+ redraw();
+ }
+ }
- static class CloseHeapStatusAction extends Action{
+ static class CloseHeapStatusAction extends Action {
- CloseHeapStatusAction(){
- super(WorkbenchMessages.WorkbenchWindow_close );
- }
+ CloseHeapStatusAction() {
+ super(WorkbenchMessages.WorkbenchWindow_close);
+ }
- @Override
- public void run(){
- WorkbenchWindow wbw = (WorkbenchWindow) PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow();
+ @Override
+ public void run() {
+ WorkbenchWindow wbw = (WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (wbw != null) {
wbw.showHeapStatus(false);
PrefUtil.getAPIPreferenceStore().setValue(IWorkbenchPreferenceConstants.SHOW_MEMORY_MONITOR, false);
}
- }
- }
+ }
+ }
}
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IActionSetContributionItem.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IActionSetContributionItem.java
index 5a8e8787bd1..2b876f7d0e2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IActionSetContributionItem.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IActionSetContributionItem.java
@@ -14,18 +14,18 @@
package org.eclipse.ui.internal;
/**
- * This interface should be implemented by all contribution items
- * defined by an action set.
+ * This interface should be implemented by all contribution items defined by an
+ * action set.
*/
public interface IActionSetContributionItem {
- /**
- * Returns the action set id.
- */
- String getActionSetId();
+ /**
+ * Returns the action set id.
+ */
+ String getActionSetId();
- /**
- * Sets the action set id.
- */
- void setActionSetId(String newActionSetId);
+ /**
+ * Sets the action set id.
+ */
+ void setActionSetId(String newActionSetId);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IChangeListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IChangeListener.java
index a9259d1103b..cd2928b3989 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IChangeListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IChangeListener.java
@@ -14,14 +14,12 @@
package org.eclipse.ui.internal;
/**
- * Interface that can receive change notifiecations
- * from a Model object
+ * Interface that can receive change notifiecations from a Model object
*/
public interface IChangeListener {
- /**
- * Called with false when the listener is first
- * attached to the model, and called with true
- * every time the model's state changes.
- */
- void update(boolean changed);
+ /**
+ * Called with false when the listener is first attached to the model, and
+ * called with true every time the model's state changes.
+ */
+ void update(boolean changed);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IHeapStatusConstants.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IHeapStatusConstants.java
index 6f4ce261218..8371d7d3f1a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IHeapStatusConstants.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IHeapStatusConstants.java
@@ -24,11 +24,11 @@ public interface IHeapStatusConstants {
/**
* Preference key for the update interval (value in milliseconds).
*/
- String PREF_UPDATE_INTERVAL = "HeapStatus.updateInterval"; //$NON-NLS-1$
+ String PREF_UPDATE_INTERVAL = "HeapStatus.updateInterval"; //$NON-NLS-1$
- /**
- * Preference key for whether to show max heap, if available (value is boolean).
- */
- String PREF_SHOW_MAX = "HeapStatus.showMax"; //$NON-NLS-1$
+ /**
+ * Preference key for whether to show max heap, if available (value is boolean).
+ */
+ String PREF_SHOW_MAX = "HeapStatus.showMax"; //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IObjectActionContributor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IObjectActionContributor.java
index e6848a69b84..0936d6ada85 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IObjectActionContributor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IObjectActionContributor.java
@@ -20,39 +20,36 @@ import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.ui.IWorkbenchPart;
/**
- * This interface must be implemented in order to contribute
- * to context (pop-up) menu for an object. Classes
- * that implement this interface must register
- * with the popup menu manager.
+ * This interface must be implemented in order to contribute to context (pop-up)
+ * menu for an object. Classes that implement this interface must register with
+ * the popup menu manager.
*/
public interface IObjectActionContributor extends IObjectContributor {
- /**
- * Implement this method to add actions that deal with the currently
- * selected object or objects. Actions should be added to the
- * provided menu object. Current selection can be obtained from
- * the given selection provider.
- *
- * @return <code>true</code> if any contributions were made, and <code>false</code> otherwise.
- */
- boolean contributeObjectActions(IWorkbenchPart part,
- IMenuManager menu, ISelectionProvider selProv,
- List actionIdOverrides);
+ /**
+ * Implement this method to add actions that deal with the currently selected
+ * object or objects. Actions should be added to the provided menu object.
+ * Current selection can be obtained from the given selection provider.
+ *
+ * @return <code>true</code> if any contributions were made, and
+ * <code>false</code> otherwise.
+ */
+ boolean contributeObjectActions(IWorkbenchPart part, IMenuManager menu, ISelectionProvider selProv,
+ List actionIdOverrides);
- /**
- * Implement this method to add menus that deal with the currently
- * selected object or objects. Menus should be added to the
- * provided menu object. Current selection can be obtained from
- * the given selection provider.
- *
- * @return <code>true</code> if any contributions were made, and <code>false</code> otherwise.
- */
- boolean contributeObjectMenus(IMenuManager menu,
- ISelectionProvider selProv);
+ /**
+ * Implement this method to add menus that deal with the currently selected
+ * object or objects. Menus should be added to the provided menu object. Current
+ * selection can be obtained from the given selection provider.
+ *
+ * @return <code>true</code> if any contributions were made, and
+ * <code>false</code> otherwise.
+ */
+ boolean contributeObjectMenus(IMenuManager menu, ISelectionProvider selProv);
- /**
- * Contribute to the list the action identifiers from other contributions that
- * this contribution wants to override. Actions of these identifiers will
- * not be contributed.
- */
- void contributeObjectActionIdOverrides(List actionIdOverrides);
+ /**
+ * Contribute to the list the action identifiers from other contributions that
+ * this contribution wants to override. Actions of these identifiers will not be
+ * contributed.
+ */
+ void contributeObjectActionIdOverrides(List actionIdOverrides);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IObjectContributor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IObjectContributor.java
index aa18b341e13..d7b7dd7072b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IObjectContributor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IObjectContributor.java
@@ -14,31 +14,29 @@
package org.eclipse.ui.internal;
/**
- * Objects of classes that implement this interface
- * can be registered for certain object type
- * in the IObjectContributorManager. Unlike with extenders,
- * all the matching contributors will be processed
- * in a sequence.
- * <p>By implementing 'isApplicableTo' method,
- * a contributor can tell the manager to skip it
- * if the object is of the desired type, but its
- * other properties do not match additional
- * requirements imposed by the contributor.
+ * Objects of classes that implement this interface can be registered for
+ * certain object type in the IObjectContributorManager. Unlike with extenders,
+ * all the matching contributors will be processed in a sequence.
+ * <p>
+ * By implementing 'isApplicableTo' method, a contributor can tell the manager
+ * to skip it if the object is of the desired type, but its other properties do
+ * not match additional requirements imposed by the contributor.
*
*/
public interface IObjectContributor {
- /**
- * Returns true if this contributor should be considered
- * for the given object.
- * @param object the object to text
- * @return boolean
- */
- boolean isApplicableTo(Object object);
+ /**
+ * Returns true if this contributor should be considered for the given object.
+ *
+ * @param object the object to text
+ * @return boolean
+ */
+ boolean isApplicableTo(Object object);
- /**
- * Return whether or not the receiver can adapt to IResource.
- * @return boolean
- */
- boolean canAdapt();
+ /**
+ * Return whether or not the receiver can adapt to IResource.
+ *
+ * @return boolean
+ */
+ boolean canAdapt();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IPreferenceConstants.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IPreferenceConstants.java
index 4d754eee0c3..0fdb15a463a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IPreferenceConstants.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IPreferenceConstants.java
@@ -25,14 +25,14 @@ package org.eclipse.ui.internal;
*/
public interface IPreferenceConstants {
- //Boolean: true = single click opens editor; false = double click opens
- // it.
+ // Boolean: true = single click opens editor; false = double click opens
+ // it.
String OPEN_ON_SINGLE_CLICK = "OPEN_ON_SINGLE_CLICK"; //$NON-NLS-1$
- //Boolean: true = select on hover;
+ // Boolean: true = select on hover;
String SELECT_ON_HOVER = "SELECT_ON_HOVER"; //$NON-NLS-1$
- //Boolean: true = open after delay
+ // Boolean: true = open after delay
String OPEN_AFTER_DELAY = "OPEN_AFTER_DELAY"; //$NON-NLS-1$
// Boolean: true = bidi support enabled; false = bidi support disabled
@@ -49,28 +49,28 @@ public interface IPreferenceConstants {
// String: Unicode locale extensions
String NL_EXTENSIONS = "NL_EXTENSIONS"; //$NON-NLS-1$
- //Do we show color icons in toolbars?
+ // Do we show color icons in toolbars?
String COLOR_ICONS = "COLOR_ICONS"; //$NON-NLS-1$
- //mappings for type/extension to an editor
+ // mappings for type/extension to an editor
String EDITORS = "editors"; //$NON-NLS-1$
String RESOURCES = "resourcetypes"; //$NON-NLS-1$
- //saving perspective layouts
+ // saving perspective layouts
String PERSPECTIVES = "perspectives"; //$NON-NLS-1$
- // (int) If > 0, an editor will be reused once 'N' editors are opened.
+ // (int) If > 0, an editor will be reused once 'N' editors are opened.
String REUSE_EDITORS = "REUSE_OPEN_EDITORS"; //$NON-NLS-1$
- //On/Off option for the two preceding options.
+ // On/Off option for the two preceding options.
String REUSE_EDITORS_BOOLEAN = "REUSE_OPEN_EDITORS_BOOLEAN"; //$NON-NLS-1$
- // (int) N recently viewed files will be listed in the File->Open Recent
- // menu.
+ // (int) N recently viewed files will be listed in the File->Open Recent
+ // menu.
String RECENT_FILES = "RECENT_FILES"; //$NON-NLS-1$
- // (int) Mode for opening a new perspective
+ // (int) Mode for opening a new perspective
String OPEN_PERSP_MODE = "OPEN_PERSPECTIVE_MODE"; //$NON-NLS-1$
int OPM_ACTIVE_PAGE = 0;
@@ -78,33 +78,33 @@ public interface IPreferenceConstants {
// int OPM_NEW_PAGE = 1;
int OPM_NEW_WINDOW = 2;
- //Identifier for enabled decorators
+ // Identifier for enabled decorators
String ENABLED_DECORATORS = "ENABLED_DECORATORS"; //$NON-NLS-1$
- //Boolean: true = keep cycle part dialog open when keys released
+ // Boolean: true = keep cycle part dialog open when keys released
String STICKY_CYCLE = "STICKY_CYCLE"; //$NON-NLS-1$
- //List of plugins but that extends "startup" extension point but are
- // overriden by the user.
- //String of plugin unique ids separated by ";"
+ // List of plugins but that extends "startup" extension point but are
+ // overriden by the user.
+ // String of plugin unique ids separated by ";"
String PLUGINS_NOT_ACTIVATED_ON_STARTUP = "PLUGINS_NOT_ACTIVATED_ON_STARTUP"; //$NON-NLS-1$
- //Separator for PLUGINS_NOT_ACTIVATED_ON_STARTUP
+ // Separator for PLUGINS_NOT_ACTIVATED_ON_STARTUP
char SEPARATOR = ';';
- //Preference key for default editors
+ // Preference key for default editors
String DEFAULT_EDITORS = "defaultEditors"; //$NON-NLS-1$
- //Preference key for default editors
+ // Preference key for default editors
String DEFAULT_EDITORS_CACHE = "defaultEditorsCache"; //$NON-NLS-1$
- //Tab width = tab height * scalar value
+ // Tab width = tab height * scalar value
String EDITOR_TAB_WIDTH = "EDITOR_TAB_WIDTH"; //$NON-NLS-1$
- //Boolean: true = show Editors drop down button on CTabFolder
+ // Boolean: true = show Editors drop down button on CTabFolder
String EDITORLIST_PULLDOWN_ACTIVE = "EDITORLIST_PULLDOWN_ACTIVE"; //$NON-NLS-1$
- // Selection scope for EditorList
+ // Selection scope for EditorList
String EDITORLIST_SELECTION_SCOPE = "EDITORLIST_SELECTION_SCOPE"; //$NON-NLS-1$
int EDITORLIST_SET_WINDOW_SCOPE = 0;
@@ -113,7 +113,7 @@ public interface IPreferenceConstants {
int EDITORLIST_SET_TAB_GROUP_SCOPE = 2;
- // Sort criteria for EditorList
+ // Sort criteria for EditorList
String EDITORLIST_SORT_CRITERIA = "EDITORLIST_SORT_CRITERIA"; //$NON-NLS-1$
int EDITORLIST_NAME_SORT = 0;
@@ -123,95 +123,93 @@ public interface IPreferenceConstants {
// Max entries shown in the progress view (see DetailedProgressViewer)
String MAX_PROGRESS_ENTRIES = "MAX_PROGRESS_ENTRIES"; //$NON-NLS-1$
- /**
- * Boolean; true = EditorList displays full path
- */
+ /**
+ * Boolean; true = EditorList displays full path
+ */
String EDITORLIST_DISPLAY_FULL_NAME = "EDITORLIST_DISPLAY_FULL_NAME"; //$NON-NLS-1$
-
- /**
- * Workbench preference id for determining whether the user has chosen to
- * override some of the settings in the current presentation.
- * <p>
- * The default value for this preference is: <code>false</code> (prompt)
- * </p>
- *
- * @since 3.2
- */
+ /**
+ * Workbench preference id for determining whether the user has chosen to
+ * override some of the settings in the current presentation.
+ * <p>
+ * The default value for this preference is: <code>false</code> (prompt)
+ * </p>
+ *
+ * @since 3.2
+ */
String OVERRIDE_PRESENTATION = "overridepresentation"; // $//$NON-NLS-1$
- /**
- * <p>
- * The key for the preference indicating which tab is selected in the keys
- * preference page when last okay was pressed. This value should never
- * really be directly edited by a user.
- * </p>
- * <p>
- * This preference is an <code>int</code> value. The default value is
- * <code>0</code>.
- * </p>
- *
- * @since 3.1
- */
+ /**
+ * <p>
+ * The key for the preference indicating which tab is selected in the keys
+ * preference page when last okay was pressed. This value should never really be
+ * directly edited by a user.
+ * </p>
+ * <p>
+ * This preference is an <code>int</code> value. The default value is
+ * <code>0</code>.
+ * </p>
+ *
+ * @since 3.1
+ */
String KEYS_PREFERENCE_SELECTED_TAB = "KEYS_PREFERENCE_SELECTED_TAB"; //$NON-NLS-1$
- /**
- * <p>
- * The key for the preference indicating whether multi-stroke key sequences
- * should provide assistance to the user. This means that if the user pauses
- * after pressing the first key, a window will open showing the possible
- * completions.
- * </p>
- * <p>
- * This preference is a <code>boolean</code> value. The default value is
- * <code>false</code>.
- * </p>
- *
- * @since 3.0
- */
+ /**
+ * <p>
+ * The key for the preference indicating whether multi-stroke key sequences
+ * should provide assistance to the user. This means that if the user pauses
+ * after pressing the first key, a window will open showing the possible
+ * completions.
+ * </p>
+ * <p>
+ * This preference is a <code>boolean</code> value. The default value is
+ * <code>false</code>.
+ * </p>
+ *
+ * @since 3.0
+ */
String MULTI_KEY_ASSIST = "MULTI_KEY_ASSIST"; //$NON-NLS-1$
- /**
- * <p>
- * The key for the preference indicating how long the assist window should
- * wait before opening. This is a value in milliseconds -- from the time the
- * first key in a multi-key is received by the system, to the time the
- * assist window should appear.
- * </p>
- * <p>
- * This preference is an <code>int</code> value. The default value is
- * <code>1000</code>.
- * </p>
- *
- * @since 3.0
- */
+ /**
+ * <p>
+ * The key for the preference indicating how long the assist window should wait
+ * before opening. This is a value in milliseconds -- from the time the first
+ * key in a multi-key is received by the system, to the time the assist window
+ * should appear.
+ * </p>
+ * <p>
+ * This preference is an <code>int</code> value. The default value is
+ * <code>1000</code>.
+ * </p>
+ *
+ * @since 3.0
+ */
String MULTI_KEY_ASSIST_TIME = "MULTI_KEY_ASSIST_TIME"; //$NON-NLS-1$
- /**
- * Workbench preference to use the new IPersistableEditor interface
- * throughout the workbench new editor/open editor calls.
- *
- * @since 3.3
- */
+ /**
+ * Workbench preference to use the new IPersistableEditor interface throughout
+ * the workbench new editor/open editor calls.
+ *
+ * @since 3.3
+ */
String USE_IPERSISTABLE_EDITORS = "USE_IPERSISTABLE_EDITORS"; //$NON-NLS-1$
- /**
- * Preference to show user jobs in a dialog.
- */
+ /**
+ * Preference to show user jobs in a dialog.
+ */
String RUN_IN_BACKGROUND = "RUN_IN_BACKGROUND"; //$NON-NLS-1$
- /**
- * Workbench preference id for determining whether the user will be prompted
- * for activity enablement. If this is false then activities are enabled
- * automatically. If it is true, then the user is only prompted for
- * activities that they have not already declared a disinterest in via the
- * prompt dialog.
- * <p>
- * The default value for this preference is: <code>true</code> (prompt)
- * </p>
- *
- * @since 3.0
- */
+ /**
+ * Workbench preference id for determining whether the user will be prompted for
+ * activity enablement. If this is false then activities are enabled
+ * automatically. If it is true, then the user is only prompted for activities
+ * that they have not already declared a disinterest in via the prompt dialog.
+ * <p>
+ * The default value for this preference is: <code>true</code> (prompt)
+ * </p>
+ *
+ * @since 3.0
+ */
String SHOULD_PROMPT_FOR_ENABLEMENT = "shouldPromptForEnablement"; //$NON-NLS-1$
/**
@@ -228,14 +226,14 @@ public interface IPreferenceConstants {
*/
String PERSPECTIVEBAR_VISIBLE = "perspectiveBarVisible"; //$NON-NLS-1$
- /**
- * Preference that restores the 3.2 startup threading behavior. This
- * essentially means that there will be no restrictions on what runnables
- * will be processed via the UI synchronizer.
+ /**
+ * Preference that restores the 3.2 startup threading behavior. This essentially
+ * means that there will be no restrictions on what runnables will be processed
+ * via the UI synchronizer.
*
* <p>
- * This preference will likely disappear in 3.5 in favor of a proper
- * solution to bug 219913.
+ * This preference will likely disappear in 3.5 in favor of a proper solution to
+ * bug 219913.
* </p>
*
* @since 3.4
@@ -244,8 +242,7 @@ public interface IPreferenceConstants {
/**
* Preference value that specifies the time interval in minutes between
- * workbench auto-saves. If the value is zero it disables workbench
- * auto-save.
+ * workbench auto-saves. If the value is zero it disables workbench auto-save.
*
* @since 3.105
*/
@@ -253,13 +250,13 @@ public interface IPreferenceConstants {
/**
* This preference is the threshold value to determine whether a document is
- * large or not. When the user tries to open a file larger than the
- * threshold, then EditorSelectionDialog will be opened, suggesting the user
- * to open with an external editor.
+ * large or not. When the user tries to open a file larger than the threshold,
+ * then EditorSelectionDialog will be opened, suggesting the user to open with
+ * an external editor.
* <p>
- * This preference is a <code>long</code> value that represents the
- * threshold in bytes. The default value is <code>0</code> meaning no
- * prompting on editor opening.
+ * This preference is a <code>long</code> value that represents the threshold in
+ * bytes. The default value is <code>0</code> meaning no prompting on editor
+ * opening.
* </p>
*
* @since 3.7
@@ -277,8 +274,8 @@ public interface IPreferenceConstants {
String SAVE_AUTOMATICALLY = "SAVE_AUTOMATICALLY"; //$NON-NLS-1$
/**
- * Preference value that specifies the time interval in seconds between
- * editors auto-saves.
+ * Preference value that specifies the time interval in seconds between editors
+ * auto-saves.
* <p>
* The integer default value for this preference is: <code>60</code>.
* </p>
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IReorderListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IReorderListener.java
index 43bd61798a7..a0997d5afad 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IReorderListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IReorderListener.java
@@ -13,9 +13,9 @@
*******************************************************************************/
package org.eclipse.ui.internal;
-
/**
- * Simple interface for informing clients of reordering of an object in an ordered list.
+ * Simple interface for informing clients of reordering of an object in an
+ * ordered list.
*
*/
interface IReorderListener {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ISelectionConversionService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ISelectionConversionService.java
index 3e8e974402a..290a08e80db 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ISelectionConversionService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ISelectionConversionService.java
@@ -32,18 +32,16 @@ public interface ISelectionConversionService {
/**
* Attempt to convert the elements in the passed selection into resources by
- * asking each for its IResource property (iff it isn't already a resource).
- * If all elements in the initial selection can be converted to resources
- * then answer a new selection containing these resources; otherwise answer
- * an empty selection.
+ * asking each for its IResource property (iff it isn't already a resource). If
+ * all elements in the initial selection can be converted to resources then
+ * answer a new selection containing these resources; otherwise answer an empty
+ * selection.
*
- * @param originalSelection
- * the original selection; must not be <code>null</code>.
+ * @param originalSelection the original selection; must not be
+ * <code>null</code>.
* @return the converted selection or an empty selection; never
* <code>null</code>.
*/
- IStructuredSelection convertToResources(
- IStructuredSelection originalSelection);
+ IStructuredSelection convertToResources(IStructuredSelection originalSelection);
}
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IWorkbenchConstants.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IWorkbenchConstants.java
index 5e071983a1b..3f9e26c34b3 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IWorkbenchConstants.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IWorkbenchConstants.java
@@ -22,50 +22,48 @@ import org.eclipse.ui.PlatformUI;
*/
public interface IWorkbenchConstants {
- /**
- * @deprecated
- */
- @Deprecated
+ /**
+ * @deprecated
+ */
+ @Deprecated
String ACCELERATOR_CONFIGURATION_ID = "acceleratorConfigurationId"; //$NON-NLS-1$
- /**
- * @deprecated
- */
- @Deprecated
+ /**
+ * @deprecated
+ */
+ @Deprecated
String DEFAULT_ACCELERATOR_CONFIGURATION_ID = "org.eclipse.ui.defaultAcceleratorConfiguration"; //$NON-NLS-1$
- /**
- * @deprecated
- */
- @Deprecated
+ /**
+ * @deprecated
+ */
+ @Deprecated
String DEFAULT_ACCELERATOR_SCOPE_ID = "org.eclipse.ui.globalScope"; //$NON-NLS-1$
// ID of the MPerspectiveStack in the IDE e4 model
String PERSPECTIVE_STACK_ID = "org.eclipse.ui.ide.perspectivestack"; //$NON-NLS-1$
- //mappings for type/extension to an editor - backward compatibility only.
+ // mappings for type/extension to an editor - backward compatibility only.
String EDITOR_FILE_NAME = "editors.xml"; //$NON-NLS-1$
String RESOURCE_TYPE_FILE_NAME = "resourcetypes.xml"; //$NON-NLS-1$
- // Filename containing the workbench's preferences
+ // Filename containing the workbench's preferences
String PREFERENCE_BUNDLE_FILE_NAME = "workbench.ini"; //$NON-NLS-1$
- // Identifier for visible view parts.
+ // Identifier for visible view parts.
String WORKBENCH_VISIBLE_VIEW_ID = "Workbench.visibleViewID"; //$NON-NLS-1$
- // Identifier of workbench info properties page
- String WORKBENCH_PROPERTIES_PAGE_INFO = PlatformUI.PLUGIN_ID
- + ".propertypages.info.file"; //$NON-NLS-1$
+ // Identifier of workbench info properties page
+ String WORKBENCH_PROPERTIES_PAGE_INFO = PlatformUI.PLUGIN_ID + ".propertypages.info.file"; //$NON-NLS-1$
- // Various editor.
- String OLE_EDITOR_ID = PlatformUI.PLUGIN_ID
- + ".OleEditor"; //$NON-NLS-1$
+ // Various editor.
+ String OLE_EDITOR_ID = PlatformUI.PLUGIN_ID + ".OleEditor"; //$NON-NLS-1$
- // Default view category.
+ // Default view category.
String DEFAULT_CATEGORY_ID = PlatformUI.PLUGIN_ID;
- // Persistance tags.
+ // Persistance tags.
String TRUE = "true"; //$NON-NLS-1$
String FALSE = "false"; //$NON-NLS-1$
@@ -228,10 +226,10 @@ public interface IWorkbenchConstants {
String TAG_PLUGIN = "plugin"; //$NON-NLS-1$
- /** deprecated - use TAG_OPEN_MODE */
+ /** deprecated - use TAG_OPEN_MODE */
String TAG_INTERNAL = "internal"; //$NON-NLS-1$
- /** deprecated - use TAG_OPEN_MODE */
+ /** deprecated - use TAG_OPEN_MODE */
String TAG_OPEN_IN_PLACE = "open_in_place"; //$NON-NLS-1$
String TAG_PROGRAM_NAME = "program_name"; //$NON-NLS-1$
@@ -352,10 +350,10 @@ public interface IWorkbenchConstants {
String TAG_TRIM_ITEM = "trimItem"; //$NON-NLS-1$
- //Fonts
+ // Fonts
String SMALL_FONT = "org.eclipse.ui.smallFont"; //$NON-NLS-1$
- //Colors
+ // Colors
String COLOR_HIGHLIGHT = "org.eclipse.ui.highlight"; //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IWorkbenchGraphicConstants.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IWorkbenchGraphicConstants.java
index bd840d01551..b5501c57e15 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IWorkbenchGraphicConstants.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IWorkbenchGraphicConstants.java
@@ -14,8 +14,8 @@
package org.eclipse.ui.internal;
/**
- * This class defines constants for looking up resources that are available
- * only within the Eclipse UI and Eclipse UI Standard Components projects.
+ * This class defines constants for looking up resources that are available only
+ * within the Eclipse UI and Eclipse UI Standard Components projects.
*/
public interface IWorkbenchGraphicConstants {
@@ -35,16 +35,15 @@ public interface IWorkbenchGraphicConstants {
String IMG_ETOOL_TIPS_AND_TRICKS = "IMG_ETOOL_TIPS_AND_TRICKS"; //$NON-NLS-1$
-
- //Fast view enabled and disabled icons
+ // Fast view enabled and disabled icons
String IMG_ETOOL_NEW_FASTVIEW = "IMG_ETOOL_NEW_FASTVIEW"; //$NON-NLS-1$
String IMG_DTOOL_NEW_FASTVIEW = "IMG_DTOOL_NEW_FASTVIEW"; //$NON-NLS-1$
- // TrimStack buttons
+ // TrimStack buttons
String IMG_ETOOL_RESTORE_TRIMPART = "IMG_ETOOL_RESTORE_TRIMPART"; //$NON-NLS-1$
String IMG_ETOOL_EDITOR_TRIMPART = "IMG_ETOOL_EDITOR_TRIMPART"; //$NON-NLS-1$
- // local toolbars
+ // local toolbars
String IMG_LCL_CLOSE_VIEW = "IMG_LCL_CLOSE_VIEW"; //$NON-NLS-1$
@@ -78,7 +77,7 @@ public interface IWorkbenchGraphicConstants {
String IMG_LCL_VIEW_MENU_THIN = "IMG_LCL_VIEW_MENU_THIN"; //$NON-NLS-1$
- //wizard images
+ // wizard images
String IMG_WIZBAN_NEW_WIZ = "IMG_WIZBAN_NEW_WIZ"; //$NON-NLS-1$
String IMG_WIZBAN_EXPORT_WIZ = "IMG_WIZBAN_EXPORT_WIZ"; //$NON-NLS-1$
@@ -93,75 +92,75 @@ public interface IWorkbenchGraphicConstants {
String IMG_VIEW_DEFAULTVIEW_MISC = "IMG_VIEW_DEFAULTVIEW_MISC"; //$NON-NLS-1$
- /**
- * Identifies an activity category.
- *
- * @since 3.0
- */
+ /**
+ * Identifies an activity category.
+ *
+ * @since 3.0
+ */
String IMG_OBJ_ACTIVITY_CATEGORY = "IMG_OBJ_ACTIVITY_CATEGORY"; //$NON-NLS-1$
- /**
- * Identifies an activity.
- *
- * @since 3.0
- */
+ /**
+ * Identifies an activity.
+ *
+ * @since 3.0
+ */
String IMG_OBJ_ACTIVITY = "IMG_OBJ_ACTIVITY"; //$NON-NLS-1$
- /**
- * Identifies a font.
- *
- * @since 3.0
- */
+ /**
+ * Identifies a font.
+ *
+ * @since 3.0
+ */
String IMG_OBJ_FONT = "IMG_OBJ_FONT"; //$NON-NLS-1$
- /**
- * Identifies a theme category.
- *
- * @since 3.0
- */
+ /**
+ * Identifies a theme category.
+ *
+ * @since 3.0
+ */
String IMG_OBJ_THEME_CATEGORY = "IMG_OBJ_THEME_CATEGORY"; //$NON-NLS-1$
- /**
- * Generic working set icon.
- *
- * @since 3.2
- */
+ /**
+ * Generic working set icon.
+ *
+ * @since 3.2
+ */
String IMG_OBJ_WORKING_SETS = "IMG_OBJ_WORKING_SETS"; //$NON-NLS-1$
- /**
- * Separator icon for selection dialogs.
- */
+ /**
+ * Separator icon for selection dialogs.
+ */
String IMG_OBJ_SEPARATOR = "IMG_OBJ_SEPARATOR"; //$NON-NLS-1$
- /**
- * Default icon for Quick Access nodes.
- */
+ /**
+ * Default icon for Quick Access nodes.
+ */
String IMG_OBJ_NODE = "IMG_OBJ_NODE"; //$NON-NLS-1$
- /**
- * Default icon for Quick Access elements.
- */
+ /**
+ * Default icon for Quick Access elements.
+ */
String IMG_OBJ_ELEMENT = "IMG_OBJ_ELEMENT"; //$NON-NLS-1$
- /**
- * Icon for signed objects (such as bundles).
- *
- * @since 3.3
- */
+ /**
+ * Icon for signed objects (such as bundles).
+ *
+ * @since 3.3
+ */
String IMG_OBJ_SIGNED_YES = "IMG_OBJ_SIGNED_YES"; //$NON-NLS-1$
/**
- * Icon for unsigned objects (such as bundles).
- *
- * @since 3.3
- */
+ * Icon for unsigned objects (such as bundles).
+ *
+ * @since 3.3
+ */
String IMG_OBJ_SIGNED_NO = "IMG_OBJ_SIGNED_NO"; //$NON-NLS-1$
/**
- * Icon for objects whos signing state is not known (such as bundles).
- *
- * @since 3.3
- */
+ * Icon for objects whos signing state is not known (such as bundles).
+ *
+ * @since 3.3
+ */
String IMG_OBJ_SIGNED_UNKNOWN = "IMG_OBJ_SIGNED_UNKNOWN"; //$NON-NLS-1$
String IMG_PREF_IMPORT = "IMG_PREF_IMPORT"; //$NON-NLS-1$
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IWorkbenchHelpContextIds.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IWorkbenchHelpContextIds.java
index 5cffcbd49fd..29d29f1ab25 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IWorkbenchHelpContextIds.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IWorkbenchHelpContextIds.java
@@ -36,14 +36,11 @@ public interface IWorkbenchHelpContextIds {
// Actions
- String DOCK_ON_PERSPECTIVE_ACTION = PREFIX
- + "dock_on_perspective_action_context"; //$NON-NLS-1$
+ String DOCK_ON_PERSPECTIVE_ACTION = PREFIX + "dock_on_perspective_action_context"; //$NON-NLS-1$
- String SHOW_TEXT_PERSPECTIVE_ACTION = PREFIX
- + "show_text_perspective_action_context"; //$NON-NLS-1$
+ String SHOW_TEXT_PERSPECTIVE_ACTION = PREFIX + "show_text_perspective_action_context"; //$NON-NLS-1$
- String PROPERTY_DIALOG_ACTION = PREFIX
- + "property_dialog_action_context"; //$NON-NLS-1$
+ String PROPERTY_DIALOG_ACTION = PREFIX + "property_dialog_action_context"; //$NON-NLS-1$
String NEW_ACTION = PREFIX + "new_action_context"; //$NON-NLS-1$
@@ -51,295 +48,206 @@ public interface IWorkbenchHelpContextIds {
String EXPORT_ACTION = PREFIX + "export_action_context"; //$NON-NLS-1$
- String SAVE_PERSPECTIVE_ACTION = PREFIX
- + "save_perspective_action_context"; //$NON-NLS-1$
+ String SAVE_PERSPECTIVE_ACTION = PREFIX + "save_perspective_action_context"; //$NON-NLS-1$
- String SAVE_AS_ACTION = PREFIX
- + "save_as_action_context"; //$NON-NLS-1$
+ String SAVE_AS_ACTION = PREFIX + "save_as_action_context"; //$NON-NLS-1$
- String SAVE_ALL_ACTION = PREFIX
- + "save_all_action_context"; //$NON-NLS-1$
+ String SAVE_ALL_ACTION = PREFIX + "save_all_action_context"; //$NON-NLS-1$
String SAVE_ACTION = PREFIX + "save_action_context"; //$NON-NLS-1$
String ABOUT_ACTION = PREFIX + "about_action_context"; //$NON-NLS-1$
- String CLOSE_ALL_ACTION = PREFIX
- + "close_all_action_context"; //$NON-NLS-1$
+ String CLOSE_ALL_ACTION = PREFIX + "close_all_action_context"; //$NON-NLS-1$
- String CLOSE_OTHERS_ACTION = PREFIX
- + "close_others_action_context"; //$NON-NLS-1$
+ String CLOSE_OTHERS_ACTION = PREFIX + "close_others_action_context"; //$NON-NLS-1$
- String LOCK_TOOLBAR_ACTION = PREFIX
- + "lock_toolbar_action_context"; //$NON-NLS-1$
+ String LOCK_TOOLBAR_ACTION = PREFIX + "lock_toolbar_action_context"; //$NON-NLS-1$
- String CLOSE_PAGE_ACTION = PREFIX
- + "close_page_action_context"; //$NON-NLS-1$
+ String CLOSE_PAGE_ACTION = PREFIX + "close_page_action_context"; //$NON-NLS-1$
- String CLOSE_PART_ACTION = PREFIX
- + "close_part_action_context"; //$NON-NLS-1$
+ String CLOSE_PART_ACTION = PREFIX + "close_part_action_context"; //$NON-NLS-1$
- String EDIT_ACTION_SETS_ACTION = PREFIX
- + "edit_action_sets_action_context"; //$NON-NLS-1$
+ String EDIT_ACTION_SETS_ACTION = PREFIX + "edit_action_sets_action_context"; //$NON-NLS-1$
- String DELETE_RETARGET_ACTION = PREFIX
- + "delete_retarget_action_context"; //$NON-NLS-1$
+ String DELETE_RETARGET_ACTION = PREFIX + "delete_retarget_action_context"; //$NON-NLS-1$
- String CLOSE_ALL_PAGES_ACTION = PREFIX
- + "close_all_pages_action_context"; //$NON-NLS-1$
+ String CLOSE_ALL_PAGES_ACTION = PREFIX + "close_all_pages_action_context"; //$NON-NLS-1$
- String OPEN_NEW_WINDOW_ACTION = PREFIX
- + "open_new_window_action_context"; //$NON-NLS-1$
+ String OPEN_NEW_WINDOW_ACTION = PREFIX + "open_new_window_action_context"; //$NON-NLS-1$
- String OPEN_PREFERENCES_ACTION = PREFIX
- + "open_preferences_action_context"; //$NON-NLS-1$
+ String OPEN_PREFERENCES_ACTION = PREFIX + "open_preferences_action_context"; //$NON-NLS-1$
String QUIT_ACTION = PREFIX + "quit_action_context"; //$NON-NLS-1$
- String RESET_PERSPECTIVE_ACTION = PREFIX
- + "reset_perspective_action_context"; //$NON-NLS-1$
+ String RESET_PERSPECTIVE_ACTION = PREFIX + "reset_perspective_action_context"; //$NON-NLS-1$
- String TOGGLE_EDITORS_VISIBILITY_ACTION = PREFIX
- + "target_editors_visibility_action_context"; //$NON-NLS-1$
+ String TOGGLE_EDITORS_VISIBILITY_ACTION = PREFIX + "target_editors_visibility_action_context"; //$NON-NLS-1$
- String SHOW_VIEW_ACTION = PREFIX
- + "show_view_action_context"; //$NON-NLS-1$
+ String SHOW_VIEW_ACTION = PREFIX + "show_view_action_context"; //$NON-NLS-1$
- String SHOW_VIEW_OTHER_ACTION = PREFIX
- + "show_view_other_action_context"; //$NON-NLS-1$
+ String SHOW_VIEW_OTHER_ACTION = PREFIX + "show_view_other_action_context"; //$NON-NLS-1$
- String OPEN_PERSPECTIVE_ACTION = PREFIX
- + "open_perspective_action_context"; //$NON-NLS-1$
+ String OPEN_PERSPECTIVE_ACTION = PREFIX + "open_perspective_action_context"; //$NON-NLS-1$
- String CLOSE_ALL_SAVED_ACTION = PREFIX
- + "close_all_saved_action_context"; //$NON-NLS-1$
+ String CLOSE_ALL_SAVED_ACTION = PREFIX + "close_all_saved_action_context"; //$NON-NLS-1$
- String SHOW_VIEW_MENU_ACTION = PREFIX
- + "show_view_menu_action_context"; //$NON-NLS-1$
+ String SHOW_VIEW_MENU_ACTION = PREFIX + "show_view_menu_action_context"; //$NON-NLS-1$
- String WORKBENCH_EDITORS_ACTION = PREFIX
- + "workbench_editors_action_context"; //$NON-NLS-1$
+ String WORKBENCH_EDITORS_ACTION = PREFIX + "workbench_editors_action_context"; //$NON-NLS-1$
- String CELL_CUT_ACTION = PREFIX
- + "cell_cut_action_context"; //$NON-NLS-1$
+ String CELL_CUT_ACTION = PREFIX + "cell_cut_action_context"; //$NON-NLS-1$
- String CELL_COPY_ACTION = PREFIX
- + "cell_copy_action_context"; //$NON-NLS-1$
+ String CELL_COPY_ACTION = PREFIX + "cell_copy_action_context"; //$NON-NLS-1$
- String CELL_PASTE_ACTION = PREFIX
- + "cell_paste_action_context"; //$NON-NLS-1$
+ String CELL_PASTE_ACTION = PREFIX + "cell_paste_action_context"; //$NON-NLS-1$
- String CELL_DELETE_ACTION = PREFIX
- + "cell_delete_action_context"; //$NON-NLS-1$
+ String CELL_DELETE_ACTION = PREFIX + "cell_delete_action_context"; //$NON-NLS-1$
- String CELL_FIND_ACTION = PREFIX
- + "cell_find_action_context"; //$NON-NLS-1$
+ String CELL_FIND_ACTION = PREFIX + "cell_find_action_context"; //$NON-NLS-1$
- String CELL_SELECT_ALL_ACTION = PREFIX
- + "cell_select_all_action_context"; //$NON-NLS-1$
+ String CELL_SELECT_ALL_ACTION = PREFIX + "cell_select_all_action_context"; //$NON-NLS-1$
- String CELL_UNDO_ACTION = PREFIX
- + "cell_undo_action_context"; //$NON-NLS-1$
+ String CELL_UNDO_ACTION = PREFIX + "cell_undo_action_context"; //$NON-NLS-1$
- String CELL_REDO_ACTION = PREFIX
- + "cell_redo_action_context"; //$NON-NLS-1$
+ String CELL_REDO_ACTION = PREFIX + "cell_redo_action_context"; //$NON-NLS-1$
- String SHOW_PART_PANE_MENU_ACTION = PREFIX
- + "show_part_pane_menu_action_context"; //$NON-NLS-1$
+ String SHOW_PART_PANE_MENU_ACTION = PREFIX + "show_part_pane_menu_action_context"; //$NON-NLS-1$
- String CYCLE_PART_FORWARD_ACTION = PREFIX
- + "cycle_part_forward_action_context"; //$NON-NLS-1$
+ String CYCLE_PART_FORWARD_ACTION = PREFIX + "cycle_part_forward_action_context"; //$NON-NLS-1$
- String CYCLE_PART_BACKWARD_ACTION = PREFIX
- + "cycle_part_backward_action_context"; //$NON-NLS-1$
+ String CYCLE_PART_BACKWARD_ACTION = PREFIX + "cycle_part_backward_action_context"; //$NON-NLS-1$
- String CYCLE_EDITOR_FORWARD_ACTION = PREFIX
- + "cycle_editor_forward_action_context"; //$NON-NLS-1$
+ String CYCLE_EDITOR_FORWARD_ACTION = PREFIX + "cycle_editor_forward_action_context"; //$NON-NLS-1$
- String CYCLE_EDITOR_BACKWARD_ACTION = PREFIX
- + "cycle_editor_backward_action_context"; //$NON-NLS-1$
+ String CYCLE_EDITOR_BACKWARD_ACTION = PREFIX + "cycle_editor_backward_action_context"; //$NON-NLS-1$
- String CYCLE_PERSPECTIVE_FORWARD_ACTION = PREFIX
- + "cycle_perspective_forward_action_context"; //$NON-NLS-1$
+ String CYCLE_PERSPECTIVE_FORWARD_ACTION = PREFIX + "cycle_perspective_forward_action_context"; //$NON-NLS-1$
- String CYCLE_PERSPECTIVE_BACKWARD_ACTION = PREFIX
- + "cycle_perspective_backward_action_context"; //$NON-NLS-1$
+ String CYCLE_PERSPECTIVE_BACKWARD_ACTION = PREFIX + "cycle_perspective_backward_action_context"; //$NON-NLS-1$
- String ACTIVATE_EDITOR_ACTION = PREFIX
- + "activate_editor_action_context"; //$NON-NLS-1$
+ String ACTIVATE_EDITOR_ACTION = PREFIX + "activate_editor_action_context"; //$NON-NLS-1$
- String MAXIMIZE_PART_ACTION = PREFIX
- + "maximize_part_action_context"; //$NON-NLS-1$
+ String MAXIMIZE_PART_ACTION = PREFIX + "maximize_part_action_context"; //$NON-NLS-1$
- String MINIMIZE_PART_ACTION = PREFIX
- + "minimize_part_action_context"; //$NON-NLS-1$
+ String MINIMIZE_PART_ACTION = PREFIX + "minimize_part_action_context"; //$NON-NLS-1$
- String SELECT_WORKING_SET_ACTION = PREFIX
- + "select_working_set_action_context"; //$NON-NLS-1$
+ String SELECT_WORKING_SET_ACTION = PREFIX + "select_working_set_action_context"; //$NON-NLS-1$
- String CLEAR_WORKING_SET_ACTION = PREFIX
- + "clear_working_set_action_context"; //$NON-NLS-1$
+ String CLEAR_WORKING_SET_ACTION = PREFIX + "clear_working_set_action_context"; //$NON-NLS-1$
- String EDIT_WORKING_SET_ACTION = PREFIX
- + "edit_working_set_action_context"; //$NON-NLS-1$
+ String EDIT_WORKING_SET_ACTION = PREFIX + "edit_working_set_action_context"; //$NON-NLS-1$
- String SHOW_IN_ACTION = PREFIX
- + "show_in_action_context"; //$NON-NLS-1$
+ String SHOW_IN_ACTION = PREFIX + "show_in_action_context"; //$NON-NLS-1$
- String NAVIGATION_HISTORY_FORWARD = PREFIX
- + "navigation_history_forward"; //$NON-NLS-1$
+ String NAVIGATION_HISTORY_FORWARD = PREFIX + "navigation_history_forward"; //$NON-NLS-1$
- String NAVIGATION_HISTORY_BACKWARD = PREFIX
- + "navigation_history_backward"; //$NON-NLS-1$
+ String NAVIGATION_HISTORY_BACKWARD = PREFIX + "navigation_history_backward"; //$NON-NLS-1$
- String HELP_CONTENTS_ACTION = PREFIX
- + "help_contents_action_context"; //$NON-NLS-1$
+ String HELP_CONTENTS_ACTION = PREFIX + "help_contents_action_context"; //$NON-NLS-1$
- String HELP_SEARCH_ACTION = PREFIX
- + "help_search_action_context"; //$NON-NLS-1$
+ String HELP_SEARCH_ACTION = PREFIX + "help_search_action_context"; //$NON-NLS-1$
- String DYNAMIC_HELP_ACTION = PREFIX
- + "dynamic_help_action_context"; //$NON-NLS-1$
+ String DYNAMIC_HELP_ACTION = PREFIX + "dynamic_help_action_context"; //$NON-NLS-1$
String INTRO_ACTION = PREFIX + "intro_action_context"; //$NON-NLS-1$
// // Dialogs
String ABOUT_DIALOG = PREFIX + "about_dialog_context"; //$NON-NLS-1$
- String ABOUT_PLUGINS_DIALOG = PREFIX
- + "about_plugins_dialog_context"; //$NON-NLS-1$
+ String ABOUT_PLUGINS_DIALOG = PREFIX + "about_plugins_dialog_context"; //$NON-NLS-1$
- String ABOUT_FEATURES_PLUGINS_DIALOG = PREFIX
- + "about_features_plugins_dialog_context"; //$NON-NLS-1$
+ String ABOUT_FEATURES_PLUGINS_DIALOG = PREFIX + "about_features_plugins_dialog_context"; //$NON-NLS-1$
- String ABOUT_FEATURES_DIALOG = PREFIX
- + "about_features_dialog_context"; //$NON-NLS-1$
+ String ABOUT_FEATURES_DIALOG = PREFIX + "about_features_dialog_context"; //$NON-NLS-1$
- String SYSTEM_SUMMARY_DIALOG = PREFIX
- + "system_summary_dialog_context"; //$NON-NLS-1$
+ String SYSTEM_SUMMARY_DIALOG = PREFIX + "system_summary_dialog_context"; //$NON-NLS-1$
- String ACTION_SET_SELECTION_DIALOG = PREFIX
- + "action_set_selection_dialog_context"; //$NON-NLS-1$
+ String ACTION_SET_SELECTION_DIALOG = PREFIX + "action_set_selection_dialog_context"; //$NON-NLS-1$
- String EDITOR_SELECTION_DIALOG = PREFIX
- + "editor_selection_dialog_context"; //$NON-NLS-1$
+ String EDITOR_SELECTION_DIALOG = PREFIX + "editor_selection_dialog_context"; //$NON-NLS-1$
- String FILE_EXTENSION_DIALOG = PREFIX
- + "file_extension_dialog_context"; //$NON-NLS-1$
+ String FILE_EXTENSION_DIALOG = PREFIX + "file_extension_dialog_context"; //$NON-NLS-1$
- String PREFERENCE_DIALOG = PREFIX
- + "preference_dialog_context"; //$NON-NLS-1$
+ String PREFERENCE_DIALOG = PREFIX + "preference_dialog_context"; //$NON-NLS-1$
- String PROBLEMS_VIEW = PREFIX
- + "problem_view_context";//$NON-NLS-1$
+ String PROBLEMS_VIEW = PREFIX + "problem_view_context";//$NON-NLS-1$
- String PROPERTY_DIALOG = PREFIX
- + "property_dialog_context"; //$NON-NLS-1$
+ String PROPERTY_DIALOG = PREFIX + "property_dialog_context"; //$NON-NLS-1$
- String SAVE_PERSPECTIVE_DIALOG = PREFIX
- + "save_perspective_dialog_context"; //$NON-NLS-1$
+ String SAVE_PERSPECTIVE_DIALOG = PREFIX + "save_perspective_dialog_context"; //$NON-NLS-1$
- String SELECT_PERSPECTIVE_DIALOG = PREFIX
- + "select_perspective_dialog_context"; //$NON-NLS-1$
+ String SELECT_PERSPECTIVE_DIALOG = PREFIX + "select_perspective_dialog_context"; //$NON-NLS-1$
- String SHOW_VIEW_DIALOG = PREFIX
- + "show_view_dialog_context"; //$NON-NLS-1$
+ String SHOW_VIEW_DIALOG = PREFIX + "show_view_dialog_context"; //$NON-NLS-1$
- String TYPE_FILTERING_DIALOG = PREFIX
- + "type_filtering_dialog_context"; //$NON-NLS-1$
+ String TYPE_FILTERING_DIALOG = PREFIX + "type_filtering_dialog_context"; //$NON-NLS-1$
- String LIST_SELECTION_DIALOG = PREFIX
- + "list_selection_dialog_context"; //$NON-NLS-1$
+ String LIST_SELECTION_DIALOG = PREFIX + "list_selection_dialog_context"; //$NON-NLS-1$
- String YES_NO_CANCEL_LIST_SELECTION_DIALOG = PREFIX
- + "yes_no_cancel_list_selection_dialog_context"; //$NON-NLS-1$
+ String YES_NO_CANCEL_LIST_SELECTION_DIALOG = PREFIX + "yes_no_cancel_list_selection_dialog_context"; //$NON-NLS-1$
- String WORKING_SET_SELECTION_DIALOG = PREFIX
- + "working_set_selection_dialog_context"; //$NON-NLS-1$
+ String WORKING_SET_SELECTION_DIALOG = PREFIX + "working_set_selection_dialog_context"; //$NON-NLS-1$
- String WORKBENCH_EDITORS_DIALOG = PREFIX
- + "workbench_editors_dialog"; //$NON-NLS-1$
+ String WORKBENCH_EDITORS_DIALOG = PREFIX + "workbench_editors_dialog"; //$NON-NLS-1$
// // Editors
- String FILE_EDITORS_PREFERENCE_PAGE = PREFIX
- + "file_editors_preference_page_context"; //$NON-NLS-1$
+ String FILE_EDITORS_PREFERENCE_PAGE = PREFIX + "file_editors_preference_page_context"; //$NON-NLS-1$
- String PERSPECTIVES_PREFERENCE_PAGE = PREFIX
- + "perspectives_preference_page_context"; //$NON-NLS-1$
+ String PERSPECTIVES_PREFERENCE_PAGE = PREFIX + "perspectives_preference_page_context"; //$NON-NLS-1$
- String VIEWS_PREFERENCE_PAGE = PREFIX
- + "views_preference_page_context"; //$NON-NLS-1$
+ String VIEWS_PREFERENCE_PAGE = PREFIX + "views_preference_page_context"; //$NON-NLS-1$
- String FONTS_PREFERENCE_PAGE = PREFIX
- + "font_preference_page_context"; //$NON-NLS-1$
+ String FONTS_PREFERENCE_PAGE = PREFIX + "font_preference_page_context"; //$NON-NLS-1$
- String KEYS_PREFERENCE_PAGE = PREFIX
- + "keys_preference_page_context"; //$NON-NLS-1$
+ String KEYS_PREFERENCE_PAGE = PREFIX + "keys_preference_page_context"; //$NON-NLS-1$
String LINK_HANDLERS_PREFERENCE_PAGE = PREFIX + "link_handlers_page_context"; //$NON-NLS-1$
- String WORKBENCH_EDITOR_PREFERENCE_PAGE = PREFIX
- + "workbench_editor_preference_page_context"; //$NON-NLS-1$
+ String WORKBENCH_EDITOR_PREFERENCE_PAGE = PREFIX + "workbench_editor_preference_page_context"; //$NON-NLS-1$
- String CONTENT_TYPES_PREFERENCE_PAGE = PREFIX
- + "content_types_preference_page_context"; //$NON-NLS-1$
+ String CONTENT_TYPES_PREFERENCE_PAGE = PREFIX + "content_types_preference_page_context"; //$NON-NLS-1$
- String WORKBENCH_PREFERENCE_PAGE = PREFIX
- + "workbench_preference_page_context"; //$NON-NLS-1$
+ String WORKBENCH_PREFERENCE_PAGE = PREFIX + "workbench_preference_page_context"; //$NON-NLS-1$
- String GLOBALIZATION_PREFERENCE_PAGE = PREFIX
- + "globalization_preference_page_context"; //$NON-NLS-1$
+ String GLOBALIZATION_PREFERENCE_PAGE = PREFIX + "globalization_preference_page_context"; //$NON-NLS-1$
- String DECORATORS_PREFERENCE_PAGE = PREFIX
- + "decorators_preference_page_context"; //$NON-NLS-1$
+ String DECORATORS_PREFERENCE_PAGE = PREFIX + "decorators_preference_page_context"; //$NON-NLS-1$
- String STARTUP_PREFERENCE_PAGE = PREFIX
- + "startup_preference_page_context"; //$NON-NLS-1$
+ String STARTUP_PREFERENCE_PAGE = PREFIX + "startup_preference_page_context"; //$NON-NLS-1$
- String WORKSPACES_PREFERENCE_PAGE = PREFIX
- + "workspaces_preference_page_context"; //$NON-NLS-1$
+ String WORKSPACES_PREFERENCE_PAGE = PREFIX + "workspaces_preference_page_context"; //$NON-NLS-1$
String RESPONSIVE_UI = PREFIX + "responsive_ui_context"; //$NON-NLS-1$
// // Windows
- String DETACHED_WINDOW = PREFIX
- + "detached_window_context"; //$NON-NLS-1$
+ String DETACHED_WINDOW = PREFIX + "detached_window_context"; //$NON-NLS-1$
- String WORKBENCH_WINDOW = PREFIX
- + "workbench_window_context"; //$NON-NLS-1$
+ String WORKBENCH_WINDOW = PREFIX + "workbench_window_context"; //$NON-NLS-1$
// // Wizard pages
- String NEW_WIZARD_SELECTION_WIZARD_PAGE = PREFIX
- + "new_wizard_selection_wizard_page_context"; //$NON-NLS-1$
+ String NEW_WIZARD_SELECTION_WIZARD_PAGE = PREFIX + "new_wizard_selection_wizard_page_context"; //$NON-NLS-1$
- String EXPORT_WIZARD_SELECTION_WIZARD_PAGE = PREFIX
- + "export_wizard_selection_wizard_page_context"; //$NON-NLS-1$
+ String EXPORT_WIZARD_SELECTION_WIZARD_PAGE = PREFIX + "export_wizard_selection_wizard_page_context"; //$NON-NLS-1$
- String IMPORT_WIZARD_SELECTION_WIZARD_PAGE = PREFIX
- + "import_wizard_selection_wizard_page_context"; //$NON-NLS-1$
+ String IMPORT_WIZARD_SELECTION_WIZARD_PAGE = PREFIX + "import_wizard_selection_wizard_page_context"; //$NON-NLS-1$
- String WORKING_SET_TYPE_PAGE = PREFIX
- + "working_set_type_page"; //$NON-NLS-1$
+ String WORKING_SET_TYPE_PAGE = PREFIX + "working_set_type_page"; //$NON-NLS-1$
// Wizards
String NEW_WIZARD = PREFIX + "new_wizard_context"; //$NON-NLS-1$
- String NEW_WIZARD_SHORTCUT = PREFIX
- + "new_wizard_shortcut_context"; //$NON-NLS-1$
+ String NEW_WIZARD_SHORTCUT = PREFIX + "new_wizard_shortcut_context"; //$NON-NLS-1$
String IMPORT_WIZARD = PREFIX + "import_wizard_context"; //$NON-NLS-1$
String EXPORT_WIZARD = PREFIX + "export_wizard_context"; //$NON-NLS-1$
- String WORKING_SET_NEW_WIZARD = PREFIX
- + "working_set_new_wizard_context"; //$NON-NLS-1$
+ String WORKING_SET_NEW_WIZARD = PREFIX + "working_set_new_wizard_context"; //$NON-NLS-1$
- String WORKING_SET_EDIT_WIZARD = PREFIX
- + "working_set_edit_wizard_context"; //$NON-NLS-1$
+ String WORKING_SET_EDIT_WIZARD = PREFIX + "working_set_edit_wizard_context"; //$NON-NLS-1$
- String CAPABILITY_PREFERENCE_PAGE = PREFIX
- + "capabilities_preference_page_context"; //$NON-NLS-1$
- String TOGGLE_COOLBAR_ACTION = PREFIX
- + "toggle_coolbar_action"; //$NON-NLS-1$
+ String CAPABILITY_PREFERENCE_PAGE = PREFIX + "capabilities_preference_page_context"; //$NON-NLS-1$
+ String TOGGLE_COOLBAR_ACTION = PREFIX + "toggle_coolbar_action"; //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IWorkbenchThemeConstants.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IWorkbenchThemeConstants.java
index 3a679d7141f..7c7d36c39e1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IWorkbenchThemeConstants.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IWorkbenchThemeConstants.java
@@ -19,39 +19,39 @@ package org.eclipse.ui.internal;
* @since 3.0
*/
public interface IWorkbenchThemeConstants {
- String TAB_TEXT_FONT = "org.eclipse.ui.workbench.TAB_TEXT_FONT"; //$NON-NLS-1$
+ String TAB_TEXT_FONT = "org.eclipse.ui.workbench.TAB_TEXT_FONT"; //$NON-NLS-1$
- String ACTIVE_TAB_TEXT_COLOR = "org.eclipse.ui.workbench.ACTIVE_TAB_TEXT_COLOR"; //$NON-NLS-1$
+ String ACTIVE_TAB_TEXT_COLOR = "org.eclipse.ui.workbench.ACTIVE_TAB_TEXT_COLOR"; //$NON-NLS-1$
- String ACTIVE_NOFOCUS_TAB_TEXT_COLOR = "org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_TEXT_COLOR"; //$NON-NLS-1$
+ String ACTIVE_NOFOCUS_TAB_TEXT_COLOR = "org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_TEXT_COLOR"; //$NON-NLS-1$
- String INACTIVE_TAB_TEXT_COLOR = "org.eclipse.ui.workbench.INACTIVE_TAB_TEXT_COLOR"; //$NON-NLS-1$
+ String INACTIVE_TAB_TEXT_COLOR = "org.eclipse.ui.workbench.INACTIVE_TAB_TEXT_COLOR"; //$NON-NLS-1$
- String ACTIVE_TAB_BG_START = "org.eclipse.ui.workbench.ACTIVE_TAB_BG_START"; //$NON-NLS-1$
+ String ACTIVE_TAB_BG_START = "org.eclipse.ui.workbench.ACTIVE_TAB_BG_START"; //$NON-NLS-1$
- String ACTIVE_TAB_BG_END = "org.eclipse.ui.workbench.ACTIVE_TAB_BG_END"; //$NON-NLS-1$
+ String ACTIVE_TAB_BG_END = "org.eclipse.ui.workbench.ACTIVE_TAB_BG_END"; //$NON-NLS-1$
- String ACTIVE_TAB_HIGHLIGHT = "org.eclipse.ui.workbench.ACTIVE_TAB_HIGHLIGHT"; //$NON-NLS-1$
+ String ACTIVE_TAB_HIGHLIGHT = "org.eclipse.ui.workbench.ACTIVE_TAB_HIGHLIGHT"; //$NON-NLS-1$
- String ACTIVE_TAB_HIGHLIGHT_START = "org.eclipse.ui.workbench.ACTIVE_TAB_HIGHLIGHT_START"; //$NON-NLS-1$
+ String ACTIVE_TAB_HIGHLIGHT_START = "org.eclipse.ui.workbench.ACTIVE_TAB_HIGHLIGHT_START"; //$NON-NLS-1$
- String ACTIVE_NOFOCUS_TAB_BG_START = "org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_BG_START"; //$NON-NLS-1$
+ String ACTIVE_NOFOCUS_TAB_BG_START = "org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_BG_START"; //$NON-NLS-1$
- String ACTIVE_NOFOCUS_TAB_BG_END = "org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_BG_END"; //$NON-NLS-1$
+ String ACTIVE_NOFOCUS_TAB_BG_END = "org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_BG_END"; //$NON-NLS-1$
- String INACTIVE_TAB_BG_START = "org.eclipse.ui.workbench.INACTIVE_TAB_BG_START"; //$NON-NLS-1$
+ String INACTIVE_TAB_BG_START = "org.eclipse.ui.workbench.INACTIVE_TAB_BG_START"; //$NON-NLS-1$
- String INACTIVE_TAB_BG_END = "org.eclipse.ui.workbench.INACTIVE_TAB_BG_END"; //$NON-NLS-1$
+ String INACTIVE_TAB_BG_END = "org.eclipse.ui.workbench.INACTIVE_TAB_BG_END"; //$NON-NLS-1$
- String ACTIVE_TAB_PERCENT = "org.eclipse.ui.workbench.ACTIVE_TAB_PERCENT"; //$NON-NLS-1$
+ String ACTIVE_TAB_PERCENT = "org.eclipse.ui.workbench.ACTIVE_TAB_PERCENT"; //$NON-NLS-1$
- String ACTIVE_NOFOCUS_TAB_PERCENT = "org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_PERCENT"; //$NON-NLS-1$
+ String ACTIVE_NOFOCUS_TAB_PERCENT = "org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_PERCENT"; //$NON-NLS-1$
- String INACTIVE_TAB_PERCENT = "org.eclipse.ui.workbench.INACTIVE_TAB_PERCENT"; //$NON-NLS-1$
+ String INACTIVE_TAB_PERCENT = "org.eclipse.ui.workbench.INACTIVE_TAB_PERCENT"; //$NON-NLS-1$
- String ACTIVE_TAB_VERTICAL = "org.eclipse.ui.workbench.ACTIVE_TAB_VERTICAL"; //$NON-NLS-1$
+ String ACTIVE_TAB_VERTICAL = "org.eclipse.ui.workbench.ACTIVE_TAB_VERTICAL"; //$NON-NLS-1$
- String ACTIVE_NOFOCUS_TAB_VERTICAL = "org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_VERTICAL"; //$NON-NLS-1$
+ String ACTIVE_NOFOCUS_TAB_VERTICAL = "org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_VERTICAL"; //$NON-NLS-1$
- String INACTIVE_TAB_VERTICAL = "org.eclipse.ui.workbench.INACTIVE_TAB_VERTICAL"; //$NON-NLS-1$
+ String INACTIVE_TAB_VERTICAL = "org.eclipse.ui.workbench.INACTIVE_TAB_VERTICAL"; //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ImageCycleFeedbackBase.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ImageCycleFeedbackBase.java
index 58e9c33dff0..76e8eaeddbf 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ImageCycleFeedbackBase.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ImageCycleFeedbackBase.java
@@ -54,8 +54,7 @@ public abstract class ImageCycleFeedbackBase extends AnimationFeedbackBase {
/**
*
* @param parentShell
- * @param images :
- * an array of images
+ * @param images : an array of images
*/
public ImageCycleFeedbackBase(Shell parentShell, Image[] images) {
super(parentShell);
@@ -111,8 +110,7 @@ public abstract class ImageCycleFeedbackBase extends AnimationFeedbackBase {
image = images[imageDataIndex];
imageData = image.getImageData();
- offScreenImageGC.drawImage(image, 0, 0, imageData.width,
- imageData.height, imageData.x, imageData.y,
+ offScreenImageGC.drawImage(image, 0, 0, imageData.width, imageData.height, imageData.x, imageData.y,
imageData.width, imageData.height);
final Image finalImage = image;
@@ -120,8 +118,8 @@ public abstract class ImageCycleFeedbackBase extends AnimationFeedbackBase {
display.syncExec(() -> showImage(finalImage));
/*
- * Sleep for the specified delay time (adding commonly-used
- * slow-down fudge factors).
+ * Sleep for the specified delay time (adding commonly-used slow-down fudge
+ * factors).
*/
// try {
// Thread.sleep(30);
@@ -130,8 +128,7 @@ public abstract class ImageCycleFeedbackBase extends AnimationFeedbackBase {
if (images == null)
return;
} catch (SWTException ex) {
- IStatus status = StatusUtil.newStatus(WorkbenchPlugin.PI_WORKBENCH,
- ex);
+ IStatus status = StatusUtil.newStatus(WorkbenchPlugin.PI_WORKBENCH, ex);
StatusManager.getManager().handle(status);
}
}
@@ -142,8 +139,7 @@ public abstract class ImageCycleFeedbackBase extends AnimationFeedbackBase {
image = images[imageDataIndex];
imageData = image.getImageData();
/*
- * Create an off-screen image to draw on, and fill it with the shell
- * background.
+ * Create an off-screen image to draw on, and fill it with the shell background.
*/
offScreenImage = new Image(display, imageData.width, imageData.height);
@@ -155,9 +151,8 @@ public abstract class ImageCycleFeedbackBase extends AnimationFeedbackBase {
* Create the first image and draw it on the off-screen image.
*/
- offScreenImageGC.drawImage(image, 0, 0, imageData.width,
- imageData.height, imageData.x, imageData.y, imageData.width,
- imageData.height);
+ offScreenImageGC.drawImage(image, 0, 0, imageData.width, imageData.height, imageData.x, imageData.y,
+ imageData.width, imageData.height);
return offScreenImage;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IntModel.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IntModel.java
index e087738c1b4..d8edc15aabe 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IntModel.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IntModel.java
@@ -19,36 +19,36 @@ package org.eclipse.ui.internal;
* the integer changes.
*/
public class IntModel extends Model {
- public IntModel(int initialValue) {
+ public IntModel(int initialValue) {
super(Integer.valueOf(initialValue));
- }
+ }
- /**
- * Sets the value of the integer and notifies all
- * change listeners except for the one that caused the change.
- *
- * @param newValue the new value of the integer
- */
- public void set(int newValue, IChangeListener source) {
+ /**
+ * Sets the value of the integer and notifies all change listeners except for
+ * the one that caused the change.
+ *
+ * @param newValue the new value of the integer
+ */
+ public void set(int newValue, IChangeListener source) {
setState(Integer.valueOf(newValue), source);
- }
+ }
- /**
- * Sets the value of the integer and notifies all change listeners
- * of the change.
- *
- * @param newValue the new value of the integer
- */
- public void set(int newValue) {
+ /**
+ * Sets the value of the integer and notifies all change listeners of the
+ * change.
+ *
+ * @param newValue the new value of the integer
+ */
+ public void set(int newValue) {
setState(Integer.valueOf(newValue), null);
- }
+ }
- /**
- * Returns the value of the integer.
- *
- * @return the value of the integer
- */
- public int get() {
- return ((Integer) getState()).intValue();
- }
+ /**
+ * Returns the value of the integer.
+ *
+ * @return the value of the integer
+ */
+ public int get() {
+ return ((Integer) getState()).intValue();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/InternalHandlerUtil.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/InternalHandlerUtil.java
index 5cccd56cb8f..b9004532aa8 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/InternalHandlerUtil.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/InternalHandlerUtil.java
@@ -44,12 +44,10 @@ public class InternalHandlerUtil {
/**
* Extract the variable.
*
- * @param appContext
- * The application context
- * @param name
- * The variable name to extract.
- * @return The object from the application context, or <code>null</code>
- * if it could not be found.
+ * @param appContext The application context
+ * @param name The variable name to extract.
+ * @return The object from the application context, or <code>null</code> if it
+ * could not be found.
*/
public static Object getVariable(Object appContext, String name) {
if (appContext instanceof IEvaluationContext) {
@@ -61,8 +59,8 @@ public class InternalHandlerUtil {
/**
* Return the active contexts.
*
- * @param appContext
- * The execution appContext that contains the application context
+ * @param appContext The execution appContext that contains the application
+ * context
* @return a collection of String contextIds, or <code>null</code>.
*/
public static Collection getActiveContexts(Object appContext) {
@@ -77,8 +75,8 @@ public class InternalHandlerUtil {
* Return the active shell. Is not necessarily the active workbench window
* shell.
*
- * @param appContext
- * The execution appContext that contains the application context
+ * @param appContext The execution appContext that contains the application
+ * context
* @return the active shell, or <code>null</code>.
*/
public static Shell getActiveShell(Object appContext) {
@@ -92,13 +90,12 @@ public class InternalHandlerUtil {
/**
* Return the active workbench window.
*
- * @param appContext
- * The execution appContext that contains the application context
+ * @param appContext The execution appContext that contains the application
+ * context
* @return the active workbench window, or <code>null</code>.
*/
public static IWorkbenchWindow getActiveWorkbenchWindow(Object appContext) {
- Object o = getVariable(appContext,
- ISources.ACTIVE_WORKBENCH_WINDOW_NAME);
+ Object o = getVariable(appContext, ISources.ACTIVE_WORKBENCH_WINDOW_NAME);
if (o instanceof IWorkbenchWindow) {
return (IWorkbenchWindow) o;
}
@@ -108,8 +105,8 @@ public class InternalHandlerUtil {
/**
* Return the active editor.
*
- * @param appContext
- * The execution appContext that contains the application context
+ * @param appContext The execution appContext that contains the application
+ * context
* @return the active editor, or <code>null</code>.
*/
public static IEditorPart getActiveEditor(Object appContext) {
@@ -123,8 +120,8 @@ public class InternalHandlerUtil {
/**
* Return the part id of the active editor.
*
- * @param appContext
- * The execution appContext that contains the application context
+ * @param appContext The execution appContext that contains the application
+ * context
* @return the part id of the active editor, or <code>null</code>.
*/
public static String getActiveEditorId(Object appContext) {
@@ -138,8 +135,8 @@ public class InternalHandlerUtil {
/**
* Return the active part.
*
- * @param appContext
- * The execution appContext that contains the application context
+ * @param appContext The execution appContext that contains the application
+ * context
* @return the active part, or <code>null</code>.
*/
public static IWorkbenchPart getActivePart(Object appContext) {
@@ -153,8 +150,8 @@ public class InternalHandlerUtil {
/**
* Return the part id of the active part.
*
- * @param appContext
- * The execution appContext that contains the application context
+ * @param appContext The execution appContext that contains the application
+ * context
* @return the part id of the active part, or <code>null</code>.
*/
public static String getActivePartId(Object appContext) {
@@ -168,8 +165,8 @@ public class InternalHandlerUtil {
/**
* Return the active part site.
*
- * @param appContext
- * The execution appContext that contains the application context
+ * @param appContext The execution appContext that contains the application
+ * context
* @return the active part site, or <code>null</code>.
*/
public static IWorkbenchSite getActiveSite(Object appContext) {
@@ -183,13 +180,12 @@ public class InternalHandlerUtil {
/**
* Return the current selection.
*
- * @param appContext
- * The execution appContext that contains the application context
+ * @param appContext The execution appContext that contains the application
+ * context
* @return the current selection, or <code>null</code>.
*/
public static ISelection getCurrentSelection(Object appContext) {
- Object o = getVariable(appContext,
- ISources.ACTIVE_CURRENT_SELECTION_NAME);
+ Object o = getVariable(appContext, ISources.ACTIVE_CURRENT_SELECTION_NAME);
if (o instanceof ISelection) {
return (ISelection) o;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/JFaceUtil.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/JFaceUtil.java
index 0cf9b9f5ee5..e4f8f66afd4 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/JFaceUtil.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/JFaceUtil.java
@@ -49,8 +49,7 @@ final class JFaceUtil {
// Pass all errors and warnings to the status handling facility
// and the rest to the main runtime log
Policy.setLog(status -> {
- if (status.getSeverity() == IStatus.WARNING
- || status.getSeverity() == IStatus.ERROR) {
+ if (status.getSeverity() == IStatus.WARNING || status.getSeverity() == IStatus.ERROR) {
StatusManager.getManager().handle(status);
} else {
WorkbenchPlugin.log(status);
@@ -68,18 +67,29 @@ final class JFaceUtil {
// Get all debug options from Platform
if ("true".equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/debug"))) { //$NON-NLS-1$ //$NON-NLS-2$
- Policy.DEBUG_DIALOG_NO_PARENT = "true".equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/debug/dialog/noparent")); //$NON-NLS-1$ //$NON-NLS-2$
+ Policy.DEBUG_DIALOG_NO_PARENT = "true" //$NON-NLS-1$
+ .equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/debug/dialog/noparent")); //$NON-NLS-1$
Policy.TRACE_ACTIONS = "true".equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/trace/actions")); //$NON-NLS-1$ //$NON-NLS-2$
- Policy.TRACE_TOOLBAR = "true".equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/trace/toolbarDisposal")); //$NON-NLS-1$ //$NON-NLS-2$
- InternalPolicy.DEBUG_LOG_REENTRANT_VIEWER_CALLS = "true".equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/debug/viewers/reentrantViewerCalls")); //$NON-NLS-1$ //$NON-NLS-2$
- InternalPolicy.DEBUG_LOG_EQUAL_VIEWER_ELEMENTS = "true".equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/debug/viewers/equalElements")); //$NON-NLS-1$ //$NON-NLS-2$
- InternalPolicy.DEBUG_BIDI_UTILS = "true".equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/debug/bidiUtils")); //$NON-NLS-1$ //$NON-NLS-2$
- InternalPolicy.DEBUG_TRACE_URL_IMAGE_DESCRIPTOR = "true".equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/debug/trace/URLImageDescriptor")); //$NON-NLS-1$ //$NON-NLS-2$
- InternalPolicy.DEBUG_LOG_URL_IMAGE_DESCRIPTOR_MISSING_2x = "true".equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/debug/logURLImageDescriptorMissing2x")); //$NON-NLS-1$ //$NON-NLS-2$
- InternalPolicy.DEBUG_LOAD_URL_IMAGE_DESCRIPTOR_DIRECTLY = "true".equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/debug/loadURLImageDescriptorDirectly")); //$NON-NLS-1$ //$NON-NLS-2$
- // loadURLImageDescriptor2x is "true" by default and should stay "true" when absent in the debug options file:
- InternalPolicy.DEBUG_LOAD_URL_IMAGE_DESCRIPTOR_2x = !"false".equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/debug/loadURLImageDescriptor2x")); //$NON-NLS-1$ //$NON-NLS-2$
- InternalPolicy.DEBUG_LOAD_URL_IMAGE_DESCRIPTOR_2x_PNG_FOR_GIF = "true".equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/debug/loadURLImageDescriptor2xPngForGif")); //$NON-NLS-1$ //$NON-NLS-2$
+ Policy.TRACE_TOOLBAR = "true" //$NON-NLS-1$
+ .equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/trace/toolbarDisposal")); //$NON-NLS-1$
+ InternalPolicy.DEBUG_LOG_REENTRANT_VIEWER_CALLS = "true" //$NON-NLS-1$
+ .equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/debug/viewers/reentrantViewerCalls")); //$NON-NLS-1$
+ InternalPolicy.DEBUG_LOG_EQUAL_VIEWER_ELEMENTS = "true" //$NON-NLS-1$
+ .equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/debug/viewers/equalElements")); //$NON-NLS-1$
+ InternalPolicy.DEBUG_BIDI_UTILS = "true" //$NON-NLS-1$
+ .equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/debug/bidiUtils")); //$NON-NLS-1$
+ InternalPolicy.DEBUG_TRACE_URL_IMAGE_DESCRIPTOR = "true" //$NON-NLS-1$
+ .equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/debug/trace/URLImageDescriptor")); //$NON-NLS-1$
+ InternalPolicy.DEBUG_LOG_URL_IMAGE_DESCRIPTOR_MISSING_2x = "true" //$NON-NLS-1$
+ .equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/debug/logURLImageDescriptorMissing2x")); //$NON-NLS-1$
+ InternalPolicy.DEBUG_LOAD_URL_IMAGE_DESCRIPTOR_DIRECTLY = "true" //$NON-NLS-1$
+ .equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/debug/loadURLImageDescriptorDirectly")); //$NON-NLS-1$
+ // loadURLImageDescriptor2x is "true" by default and should stay "true" when
+ // absent in the debug options file:
+ InternalPolicy.DEBUG_LOAD_URL_IMAGE_DESCRIPTOR_2x = !"false" //$NON-NLS-1$
+ .equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/debug/loadURLImageDescriptor2x")); //$NON-NLS-1$
+ InternalPolicy.DEBUG_LOAD_URL_IMAGE_DESCRIPTOR_2x_PNG_FOR_GIF = "true".equalsIgnoreCase( //$NON-NLS-1$
+ Platform.getDebugOption(Policy.JFACE + "/debug/loadURLImageDescriptor2xPngForGif")); //$NON-NLS-1$
}
}
@@ -88,7 +98,8 @@ final class JFaceUtil {
* as soon as the workbench preference store becomes available.
*/
public static void initializeJFacePreferences() {
- IEclipsePreferences rootNode = (IEclipsePreferences) Platform.getPreferencesService().getRootNode().node(InstanceScope.SCOPE);
+ IEclipsePreferences rootNode = (IEclipsePreferences) Platform.getPreferencesService().getRootNode()
+ .node(InstanceScope.SCOPE);
final String workbenchName = WorkbenchPlugin.getDefault().getBundle().getSymbolicName();
rootNode.addNodeChangeListener(new IEclipsePreferences.INodeChangeListener() {
@@ -97,9 +108,11 @@ final class JFaceUtil {
if (!event.getChild().name().equals(workbenchName)) {
return;
}
- ((IEclipsePreferences) event.getChild()).addPreferenceChangeListener(PlatformUIPreferenceListener.getSingleton());
+ ((IEclipsePreferences) event.getChild())
+ .addPreferenceChangeListener(PlatformUIPreferenceListener.getSingleton());
}
+
@Override
public void removed(NodeChangeEvent event) {
// Nothing to do here
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/KeyBindingService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/KeyBindingService.java
index 75eda9a2660..0beb247dcd2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/KeyBindingService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/KeyBindingService.java
@@ -46,27 +46,26 @@ import org.eclipse.ui.internal.handlers.CommandLegacyActionWrapper;
* @since 2.0
*/
public final class KeyBindingService implements INestableKeyBindingService {
- /**
- * Whether this key binding service has been disposed. A disposed key
- * binding service should not be used again.
- */
- private boolean disposed;
+ /**
+ * Whether this key binding service has been disposed. A disposed key binding
+ * service should not be used again.
+ */
+ private boolean disposed;
private final Map<IWorkbenchSite, IKeyBindingService> nestedServices = new HashMap<>();
- /**
- * The set of context identifiers enabled in this key binding service (not
- * counting any nested services). This set may be empty, but it is never
- * <code>null</code>.
- */
+ /**
+ * The set of context identifiers enabled in this key binding service (not
+ * counting any nested services). This set may be empty, but it is never
+ * <code>null</code>.
+ */
private Set<String> enabledContextIds = Collections.EMPTY_SET;
-
- /**
- * The site within the workbench at which this service is provided. This
- * value should not be <code>null</code>.
- */
- private IWorkbenchPartSite workbenchPartSite;
+ /**
+ * The site within the workbench at which this service is provided. This value
+ * should not be <code>null</code>.
+ */
+ private IWorkbenchPartSite workbenchPartSite;
private KeyBindingService parent;
@@ -74,38 +73,34 @@ public final class KeyBindingService implements INestableKeyBindingService {
private Map<IAction, IHandlerActivation> actionToProxy = new HashMap<>();
- /**
- * Constructs a new instance of <code>KeyBindingService</code> on a given
- * workbench site. This instance is not nested.
- *
- * @param workbenchPartSite
- * The site for which this service will be responsible; should
- * not be <code>null</code>.
- */
- public KeyBindingService(IWorkbenchPartSite workbenchPartSite) {
- this(workbenchPartSite, null);
- }
-
- /**
- * Constructs a new instance of <code>KeyBindingService</code> on a given
- * workbench site.
- *
- * @param workbenchPartSite
- * The site for which this service will be responsible; should
- * not be <code>null</code>.
- * @param parent
- * The parent key binding service, if any; <code>null</code> if
- * none.
- */
- KeyBindingService(IWorkbenchPartSite workbenchPartSite,
- KeyBindingService parent) {
- this.workbenchPartSite = workbenchPartSite;
+ /**
+ * Constructs a new instance of <code>KeyBindingService</code> on a given
+ * workbench site. This instance is not nested.
+ *
+ * @param workbenchPartSite The site for which this service will be responsible;
+ * should not be <code>null</code>.
+ */
+ public KeyBindingService(IWorkbenchPartSite workbenchPartSite) {
+ this(workbenchPartSite, null);
+ }
+
+ /**
+ * Constructs a new instance of <code>KeyBindingService</code> on a given
+ * workbench site.
+ *
+ * @param workbenchPartSite The site for which this service will be responsible;
+ * should not be <code>null</code>.
+ * @param parent The parent key binding service, if any;
+ * <code>null</code> if none.
+ */
+ KeyBindingService(IWorkbenchPartSite workbenchPartSite, KeyBindingService parent) {
+ this.workbenchPartSite = workbenchPartSite;
this.parent = parent;
- }
+ }
- @Override
+ @Override
public boolean activateKeyBindingService(IWorkbenchSite nestedSite) {
- if (disposed) {
+ if (disposed) {
return false;
}
@@ -133,13 +128,13 @@ public final class KeyBindingService implements INestableKeyBindingService {
if (service != null) {
activateNestedService(service);
}
- return true;
- }
+ return true;
+ }
private void activateNestedService(IKeyBindingService service) {
/*
- * If I have a parent, and I'm the active service, then deactivate so
- * that I can make changes.
+ * If I have a parent, and I'm the active service, then deactivate so that I can
+ * make changes.
*/
boolean active = false;
boolean haveParent = (parent != null);
@@ -158,7 +153,7 @@ public final class KeyBindingService implements INestableKeyBindingService {
return;
}
- if (haveParent) {
+ if (haveParent) {
if (active) {
parent.activateNestedService(this);
}
@@ -190,7 +185,7 @@ public final class KeyBindingService implements INestableKeyBindingService {
return;
}
- // Don't do anything if there is no active service.
+ // Don't do anything if there is no active service.
if (activeService == null) {
return;
}
@@ -214,9 +209,9 @@ public final class KeyBindingService implements INestableKeyBindingService {
cs.deactivateContext(id);
}
/*
- * Remove all of the nested handler submissions. The handlers here
- * weren't created by this instance (but by the nest instance), and
- * hence can't be disposed here.
+ * Remove all of the nested handler submissions. The handlers here weren't
+ * created by this instance (but by the nest instance), and hence can't be
+ * disposed here.
*/
IHandlerService hs = ((KeyBindingService) activeService).workbenchPartSite
.getService(IHandlerService.class);
@@ -232,34 +227,31 @@ public final class KeyBindingService implements INestableKeyBindingService {
}
}
- /**
- * Disposes this key binding service. This clears out all of the submissions
- * held by this service, and its nested services.
- */
+ /**
+ * Disposes this key binding service. This clears out all of the submissions
+ * held by this service, and its nested services.
+ */
public void dispose() {
if (!disposed) {
disposed = true;
deactivateNestedService();
- EContextService cs = workbenchPartSite
- .getService(EContextService.class);
+ EContextService cs = workbenchPartSite.getService(EContextService.class);
for (String id : enabledContextIds) {
cs.deactivateContext(id);
}
enabledContextIds.clear();
/*
- * Remove all of the nested handler submissions. The handlers here
- * weren't created by this instance (but by the nest instance), and
- * hence can't be disposed here.
+ * Remove all of the nested handler submissions. The handlers here weren't
+ * created by this instance (but by the nest instance), and hence can't be
+ * disposed here.
*/
- IHandlerService hs = workbenchPartSite
- .getService(IHandlerService.class);
+ IHandlerService hs = workbenchPartSite.getService(IHandlerService.class);
hs.deactivateHandlers(actionToProxy.values());
actionToProxy.clear();
}
}
-
@Override
public IKeyBindingService getKeyBindingService(IWorkbenchSite nestedSite) {
if (disposed) {
@@ -286,43 +278,42 @@ public final class KeyBindingService implements INestableKeyBindingService {
return service;
}
- @Override
+ @Override
public String[] getScopes() {
- if (disposed) {
+ if (disposed) {
return null;
}
- // Build the list of active scopes
+ // Build the list of active scopes
final Set<String> activeScopes = new HashSet<>();
- activeScopes.addAll(enabledContextIds);
+ activeScopes.addAll(enabledContextIds);
if (activeService instanceof KeyBindingService) {
activeScopes.addAll(((KeyBindingService) activeService).enabledContextIds);
}
return activeScopes.toArray(new String[activeScopes.size()]);
- }
+ }
- @Override
+ @Override
public void registerAction(IAction action) {
- if (disposed) {
+ if (disposed) {
return;
}
- if (action instanceof CommandLegacyActionWrapper) {
- // this is a registration of a fake action for an already
+ if (action instanceof CommandLegacyActionWrapper) {
+ // this is a registration of a fake action for an already
// registered handler
- WorkbenchPlugin
- .log("Cannot register a CommandLegacyActionWrapper back into the system"); //$NON-NLS-1$
+ WorkbenchPlugin.log("Cannot register a CommandLegacyActionWrapper back into the system"); //$NON-NLS-1$
return;
- }
+ }
- if (action instanceof CommandAction) {
+ if (action instanceof CommandAction) {
// we unfortunately had to allow these out into the wild, but they
// still must not feed back into the system
return;
- }
+ }
- unregisterAction(action);
+ unregisterAction(action);
IWorkbenchPartSite partSite = workbenchPartSite;
if (parent != null) {
@@ -344,13 +335,12 @@ public final class KeyBindingService implements INestableKeyBindingService {
}
}
- IHandlerService hs = workbenchPartSite
- .getService(IHandlerService.class);
+ IHandlerService hs = workbenchPartSite.getService(IHandlerService.class);
actionToProxy.put(action, hs.activateHandler(commandId, new ActionHandler(action),
new LegacyHandlerSubmissionExpression(null, partSite.getShell(), partSite)));
}
- }
+ }
@Override
public boolean removeKeyBindingService(IWorkbenchSite nestedSite) {
@@ -370,9 +360,9 @@ public final class KeyBindingService implements INestableKeyBindingService {
return true;
}
- @Override
+ @Override
public void setScopes(String[] scopes) {
- if (disposed) {
+ if (disposed) {
return;
}
Set<String> oldContextIds = enabledContextIds;
@@ -384,15 +374,15 @@ public final class KeyBindingService implements INestableKeyBindingService {
if (!enabledContextIds.contains(id)) {
cs.deactivateContext(id);
}
- }
+ }
for (String id : enabledContextIds) {
if (!oldContextIds.contains(id)) {
cs.activateContext(id);
}
}
- }
+ }
- /**
+ /**
* @param cs
* @param scopes
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LegacyAnimationFeedback.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LegacyAnimationFeedback.java
index 80fd7bc3f4f..d75d6d2e3a5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LegacyAnimationFeedback.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LegacyAnimationFeedback.java
@@ -23,8 +23,8 @@ import org.eclipse.swt.graphics.Region;
import org.eclipse.swt.widgets.Shell;
/**
- * Creates an animation feedback that will morph the start rectangle to the end rectangle
- * for AnimationEngine.
+ * Creates an animation feedback that will morph the start rectangle to the end
+ * rectangle for AnimationEngine.
*
* @since 3.3
*
@@ -34,8 +34,7 @@ public class LegacyAnimationFeedback extends RectangleAnimationFeedbackBase {
private Region shellRegion;
- public LegacyAnimationFeedback(Shell parentShell, Rectangle start,
- Rectangle end) {
+ public LegacyAnimationFeedback(Shell parentShell, Rectangle start, Rectangle end) {
super(parentShell, start, end);
}
@@ -83,8 +82,8 @@ public class LegacyAnimationFeedback extends RectangleAnimationFeedbackBase {
}
/**
- * Perform any initialization you want to have happen -before- the
- * amination starts
+ * Perform any initialization you want to have happen -before- the amination
+ * starts
*/
@Override
public boolean jobInit(AnimationEngine engine) {
@@ -92,8 +91,7 @@ public class LegacyAnimationFeedback extends RectangleAnimationFeedbackBase {
return false;
// Compute the shell's bounds
- Rectangle shellBounds = Geometry.copy((Rectangle) getStartRects()
- .get(0));
+ Rectangle shellBounds = Geometry.copy((Rectangle) getStartRects().get(0));
Iterator startIter = getStartRects().iterator();
Iterator endIter = getEndRects().iterator();
while (startIter.hasNext()) {
@@ -105,7 +103,7 @@ public class LegacyAnimationFeedback extends RectangleAnimationFeedbackBase {
// the timer once it is visible.
getAnimationShell().setVisible(true);
- return true; // OK to go...
+ return true; // OK to go...
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LegacyResourceSupport.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LegacyResourceSupport.java
index f42ca1f1f24..800faf4faf2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LegacyResourceSupport.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LegacyResourceSupport.java
@@ -26,358 +26,366 @@ import org.eclipse.ui.internal.util.BundleUtility;
import org.osgi.framework.Bundle;
/**
- * Provides access to resource-specific classes, needed to provide
- * backwards compatibility for resource-specific functions which
- * could not be moved up from the generic workbench layer to the
- * IDE layer.
+ * Provides access to resource-specific classes, needed to provide backwards
+ * compatibility for resource-specific functions which could not be moved up
+ * from the generic workbench layer to the IDE layer.
*/
public final class LegacyResourceSupport {
- private static String[] resourceClassNames = {
- "org.eclipse.core.resources.IResource", //$NON-NLS-1$
- "org.eclipse.core.resources.IContainer", //$NON-NLS-1$
- "org.eclipse.core.resources.IFolder", //$NON-NLS-1$
- "org.eclipse.core.resources.IProject", //$NON-NLS-1$
- "org.eclipse.core.resources.IFile", //$NON-NLS-1$
+ private static String[] resourceClassNames = { "org.eclipse.core.resources.IResource", //$NON-NLS-1$
+ "org.eclipse.core.resources.IContainer", //$NON-NLS-1$
+ "org.eclipse.core.resources.IFolder", //$NON-NLS-1$
+ "org.eclipse.core.resources.IProject", //$NON-NLS-1$
+ "org.eclipse.core.resources.IFile", //$NON-NLS-1$
};
- /**
- * Cached value of
- * <code>Class.forName("org.eclipse.core.resources.IResource")</code>;
- * <code>null</code> if not initialized or not present.
- * @since 3.0
- */
- private static Class iresourceClass = null;
-
- /**
- * Cached value of
- * <code>Class.forName("org.eclipse.core.resources.IFile")</code>;
- * <code>null</code> if not initialized or not present.
- * @since 3.1
- */
- private static Class ifileClass;
-
- /**
- * Cached value of
- * <code>Class.forName("org.eclipse.ui.IContributorResourceAdapter")</code>;
- * <code>null</code> if not initialized or not present.
- * @since 3.0
- */
- private static Class icontributorResourceAdapterClass = null;
-
- /**
- * Cached value of </code> org.eclipse.ui.IContributorResourceAdapter.getAdaptedResource(IAdaptable) </code>
- * <code>null</code> if not initialized or not present.
- *
- * @since 3.3
- */
- private static Method getAdaptedResourceMethod = null;
-
- /**
- * Cached value of </code> org.eclipse.ui.IContributorResourceAdapter2.getAdaptedResourceMapping(IAdaptable) </code>
- * <code>null</code> if not initialized or not present.
- *
- * @since 3.3
- */
- private static Method getAdaptedResourceMappingMethod = null;
-
- /**
- * Cached value of
- * <code>Class.forName("org.eclipse.ui.ide.IContributorResourceAdapter2")</code>;
- * <code>null</code> if not initialized or not present.
- * @since 3.1
- */
- private static Class icontributorResourceAdapter2Class = null;
-
- /**
- * Cached value of
- * <code>Class.forName("org.eclipse.ui.internal.ide.DefaultContributorResourceAdapter")</code>;
- * <code>null</code> if not initialized or not present.
- * @since 3.0
- */
- private static Class defaultContributorResourceAdapterClass = null;
-
- /**
- * Cached value for reflective result of <code>DefaultContributorRessourceAdapter.getDefault()</code>.
- * <code>null</code> if not initialized or not present.
- *
- * @since 3.3
- */
- private static Object defaultContributorResourceAdapter = null;
-
- /**
- * Cached value of
- * <code>Class.forName("org.eclipse.core.resources.mapping.ResourceMappingr")</code>;
- * <code>null</code> if not initialized or not present.
- * @since 3.0
- */
- private static Class resourceMappingClass = null;
-
- /**
- * Indicates whether the IDE plug-in (which supplies the
- * resource contribution adapters) is even around.
- */
- private static boolean resourceAdapterPossible = true;
-
-
- /**
- * Returns <code>IFile.class</code> or <code>null</code> if the
- * class is not available.
- * <p>
- * This method exists to avoid explicit references from the generic
- * workbench to the resources plug-in.
- * </p>
- *
- * @return <code>IFile.class</code> or <code>null</code> if class
- * not available
- * @since 3.1
- */
- public static Class getFileClass() {
- if (ifileClass != null) {
- // tried before and succeeded
- return ifileClass;
- }
- Class c = loadClass("org.eclipse.core.resources", "org.eclipse.core.resources.IFile"); //$NON-NLS-1$ //$NON-NLS-2$
- if (c != null) {
- // The class was found so record it
- ifileClass = c;
- }
- return c;
- }
-
- /**
- * Returns <code>IResource.class</code> or <code>null</code> if the
- * class is not available.
- * <p>
- * This method exists to avoid explicit references from the generic
- * workbench to the resources plug-in.
- * </p>
- *
- * @return <code>IResource.class</code> or <code>null</code> if class
- * not available
- * @since 3.0
- */
- public static Class getResourceClass() {
- if (iresourceClass != null) {
- // tried before and succeeded
- return iresourceClass;
- }
- Class c = loadClass("org.eclipse.core.resources", "org.eclipse.core.resources.IResource"); //$NON-NLS-1$ //$NON-NLS-2$
- if (c != null) {
- // The class was found so record it
- iresourceClass = c;
- }
- return c;
- }
-
- /**
- * Returns <code>ResourceMapping.class</code> or <code>null</code> if the
- * class is not available.
- * <p>
- * This method exists to avoid explicit references from the generic
- * workbench to the resources plug-in.
- * </p>
- *
- * @return <code>ResourceMapping.class</code> or <code>null</code> if class
- * not available
- * @since 3.1
- */
- public static Class getResourceMappingClass() {
- if (resourceMappingClass != null) {
- // tried before and succeeded
- return resourceMappingClass;
- }
- Class c = loadClass("org.eclipse.core.resources", "org.eclipse.core.resources.mapping.ResourceMapping"); //$NON-NLS-1$ //$NON-NLS-2$
- if (c != null) {
- // The class was found so record it
- resourceMappingClass = c;
- }
- return c;
- }
-
- /**
- * Returns <code>IContributorResourceAdapter.class</code> or
- * <code>null</code> if the class is not available.
- * <p>
- * This method exists to avoid explicit references from the generic
- * workbench to the IDE plug-in.
- * </p>
- *
- * @return <code>IContributorResourceAdapter.class</code> or
- * <code>null</code> if class not available
- * @since 3.0
- */
- public static Class getIContributorResourceAdapterClass() {
- if (icontributorResourceAdapterClass != null) {
- // tried before and succeeded
- return icontributorResourceAdapterClass;
- }
- Class c = loadClass("org.eclipse.ui.ide", "org.eclipse.ui.IContributorResourceAdapter"); //$NON-NLS-1$ //$NON-NLS-2$
- if (c != null) {
- // The class was found so record it
- icontributorResourceAdapterClass = c;
- }
- return c;
- }
-
- /**
- * Returns <code>IContributorResourceAdapter2.class</code> or
- * <code>null</code> if the class is not available.
- * <p>
- * This method exists to avoid explicit references from the generic
- * workbench to the IDE plug-in.
- * </p>
- *
- * @return <code>IContributorResourceAdapter.class</code> or
- * <code>null</code> if class not available
- * @since 3.1
- */
- public static Class getIContributorResourceAdapter2Class() {
- if (icontributorResourceAdapter2Class != null) {
- // tried before and succeeded
- return icontributorResourceAdapter2Class;
- }
- Class c = loadClass("org.eclipse.ui.ide", "org.eclipse.ui.ide.IContributorResourceAdapter2"); //$NON-NLS-1$ //$NON-NLS-2$
- if (c != null) {
- // The class was found so record it
- icontributorResourceAdapter2Class = c;
- }
- return c;
- }
-
- private static Class loadClass(String bundleName, String className) {
- if (!resourceAdapterPossible) {
- // tried before and failed
- return null;
- }
- Bundle bundle = Platform.getBundle(bundleName);
- if (bundle == null) {
- // Required plug-in is not around
- // assume that it will never be around
- resourceAdapterPossible = false;
- return null;
- }
- // Required plug-in is around
- // it's not our job to activate the plug-in
- if (!BundleUtility.isActivated(bundle)) {
- // assume it might come alive later
- resourceAdapterPossible = true;
- return null;
- }
- try {
- return bundle.loadClass(className);
- } catch (ClassNotFoundException e) {
- // unable to load the class - sounds pretty serious
- // treat as if the plug-in were unavailable
- resourceAdapterPossible = false;
- return null;
- }
- }
-
- /**
- * Returns <code>DefaultContributorResourceAdapter.class</code> or
- * <code>null</code> if the class is not available.
- * <p>
- * This method exists to avoid explicit references from the generic
- * workbench to the IDE plug-in.
- * </p>
- *
- * @return <code>DefaultContributorResourceAdapter.class</code> or
- * <code>null</code> if class not available
- * @since 3.0
- */
- public static Class getDefaultContributorResourceAdapterClass() {
- if (defaultContributorResourceAdapterClass != null) {
- // tried before and succeeded
- return defaultContributorResourceAdapterClass;
- }
- Class c = loadClass("org.eclipse.ui.ide", "org.eclipse.ui.internal.ide.DefaultContributorResourceAdapter"); //$NON-NLS-1$ //$NON-NLS-2$
- if (c != null) {
- // The class was found so record it
- defaultContributorResourceAdapterClass = c;
- }
- return c;
- }
+ /**
+ * Cached value of
+ * <code>Class.forName("org.eclipse.core.resources.IResource")</code>;
+ * <code>null</code> if not initialized or not present.
+ *
+ * @since 3.0
+ */
+ private static Class iresourceClass = null;
+
+ /**
+ * Cached value of
+ * <code>Class.forName("org.eclipse.core.resources.IFile")</code>;
+ * <code>null</code> if not initialized or not present.
+ *
+ * @since 3.1
+ */
+ private static Class ifileClass;
+
+ /**
+ * Cached value of
+ * <code>Class.forName("org.eclipse.ui.IContributorResourceAdapter")</code>;
+ * <code>null</code> if not initialized or not present.
+ *
+ * @since 3.0
+ */
+ private static Class icontributorResourceAdapterClass = null;
+
+ /**
+ * Cached value of </code>
+ * org.eclipse.ui.IContributorResourceAdapter.getAdaptedResource(IAdaptable)
+ * </code> <code>null</code> if not initialized or not present.
+ *
+ * @since 3.3
+ */
+ private static Method getAdaptedResourceMethod = null;
+
+ /**
+ * Cached value of </code>
+ * org.eclipse.ui.IContributorResourceAdapter2.getAdaptedResourceMapping(IAdaptable)
+ * </code> <code>null</code> if not initialized or not present.
+ *
+ * @since 3.3
+ */
+ private static Method getAdaptedResourceMappingMethod = null;
+
+ /**
+ * Cached value of
+ * <code>Class.forName("org.eclipse.ui.ide.IContributorResourceAdapter2")</code>;
+ * <code>null</code> if not initialized or not present.
+ *
+ * @since 3.1
+ */
+ private static Class icontributorResourceAdapter2Class = null;
+
+ /**
+ * Cached value of
+ * <code>Class.forName("org.eclipse.ui.internal.ide.DefaultContributorResourceAdapter")</code>;
+ * <code>null</code> if not initialized or not present.
+ *
+ * @since 3.0
+ */
+ private static Class defaultContributorResourceAdapterClass = null;
+
+ /**
+ * Cached value for reflective result of
+ * <code>DefaultContributorRessourceAdapter.getDefault()</code>.
+ * <code>null</code> if not initialized or not present.
+ *
+ * @since 3.3
+ */
+ private static Object defaultContributorResourceAdapter = null;
+
+ /**
+ * Cached value of
+ * <code>Class.forName("org.eclipse.core.resources.mapping.ResourceMappingr")</code>;
+ * <code>null</code> if not initialized or not present.
+ *
+ * @since 3.0
+ */
+ private static Class resourceMappingClass = null;
+
+ /**
+ * Indicates whether the IDE plug-in (which supplies the resource contribution
+ * adapters) is even around.
+ */
+ private static boolean resourceAdapterPossible = true;
+
+ /**
+ * Returns <code>IFile.class</code> or <code>null</code> if the class is not
+ * available.
+ * <p>
+ * This method exists to avoid explicit references from the generic workbench to
+ * the resources plug-in.
+ * </p>
+ *
+ * @return <code>IFile.class</code> or <code>null</code> if class not available
+ * @since 3.1
+ */
+ public static Class getFileClass() {
+ if (ifileClass != null) {
+ // tried before and succeeded
+ return ifileClass;
+ }
+ Class c = loadClass("org.eclipse.core.resources", "org.eclipse.core.resources.IFile"); //$NON-NLS-1$ //$NON-NLS-2$
+ if (c != null) {
+ // The class was found so record it
+ ifileClass = c;
+ }
+ return c;
+ }
+
+ /**
+ * Returns <code>IResource.class</code> or <code>null</code> if the class is not
+ * available.
+ * <p>
+ * This method exists to avoid explicit references from the generic workbench to
+ * the resources plug-in.
+ * </p>
+ *
+ * @return <code>IResource.class</code> or <code>null</code> if class not
+ * available
+ * @since 3.0
+ */
+ public static Class getResourceClass() {
+ if (iresourceClass != null) {
+ // tried before and succeeded
+ return iresourceClass;
+ }
+ Class c = loadClass("org.eclipse.core.resources", "org.eclipse.core.resources.IResource"); //$NON-NLS-1$ //$NON-NLS-2$
+ if (c != null) {
+ // The class was found so record it
+ iresourceClass = c;
+ }
+ return c;
+ }
+
+ /**
+ * Returns <code>ResourceMapping.class</code> or <code>null</code> if the class
+ * is not available.
+ * <p>
+ * This method exists to avoid explicit references from the generic workbench to
+ * the resources plug-in.
+ * </p>
+ *
+ * @return <code>ResourceMapping.class</code> or <code>null</code> if class not
+ * available
+ * @since 3.1
+ */
+ public static Class getResourceMappingClass() {
+ if (resourceMappingClass != null) {
+ // tried before and succeeded
+ return resourceMappingClass;
+ }
+ Class c = loadClass("org.eclipse.core.resources", "org.eclipse.core.resources.mapping.ResourceMapping"); //$NON-NLS-1$ //$NON-NLS-2$
+ if (c != null) {
+ // The class was found so record it
+ resourceMappingClass = c;
+ }
+ return c;
+ }
+
+ /**
+ * Returns <code>IContributorResourceAdapter.class</code> or <code>null</code>
+ * if the class is not available.
+ * <p>
+ * This method exists to avoid explicit references from the generic workbench to
+ * the IDE plug-in.
+ * </p>
+ *
+ * @return <code>IContributorResourceAdapter.class</code> or <code>null</code>
+ * if class not available
+ * @since 3.0
+ */
+ public static Class getIContributorResourceAdapterClass() {
+ if (icontributorResourceAdapterClass != null) {
+ // tried before and succeeded
+ return icontributorResourceAdapterClass;
+ }
+ Class c = loadClass("org.eclipse.ui.ide", "org.eclipse.ui.IContributorResourceAdapter"); //$NON-NLS-1$ //$NON-NLS-2$
+ if (c != null) {
+ // The class was found so record it
+ icontributorResourceAdapterClass = c;
+ }
+ return c;
+ }
+
+ /**
+ * Returns <code>IContributorResourceAdapter2.class</code> or <code>null</code>
+ * if the class is not available.
+ * <p>
+ * This method exists to avoid explicit references from the generic workbench to
+ * the IDE plug-in.
+ * </p>
+ *
+ * @return <code>IContributorResourceAdapter.class</code> or <code>null</code>
+ * if class not available
+ * @since 3.1
+ */
+ public static Class getIContributorResourceAdapter2Class() {
+ if (icontributorResourceAdapter2Class != null) {
+ // tried before and succeeded
+ return icontributorResourceAdapter2Class;
+ }
+ Class c = loadClass("org.eclipse.ui.ide", "org.eclipse.ui.ide.IContributorResourceAdapter2"); //$NON-NLS-1$ //$NON-NLS-2$
+ if (c != null) {
+ // The class was found so record it
+ icontributorResourceAdapter2Class = c;
+ }
+ return c;
+ }
+
+ private static Class loadClass(String bundleName, String className) {
+ if (!resourceAdapterPossible) {
+ // tried before and failed
+ return null;
+ }
+ Bundle bundle = Platform.getBundle(bundleName);
+ if (bundle == null) {
+ // Required plug-in is not around
+ // assume that it will never be around
+ resourceAdapterPossible = false;
+ return null;
+ }
+ // Required plug-in is around
+ // it's not our job to activate the plug-in
+ if (!BundleUtility.isActivated(bundle)) {
+ // assume it might come alive later
+ resourceAdapterPossible = true;
+ return null;
+ }
+ try {
+ return bundle.loadClass(className);
+ } catch (ClassNotFoundException e) {
+ // unable to load the class - sounds pretty serious
+ // treat as if the plug-in were unavailable
+ resourceAdapterPossible = false;
+ return null;
+ }
+ }
+
+ /**
+ * Returns <code>DefaultContributorResourceAdapter.class</code> or
+ * <code>null</code> if the class is not available.
+ * <p>
+ * This method exists to avoid explicit references from the generic workbench to
+ * the IDE plug-in.
+ * </p>
+ *
+ * @return <code>DefaultContributorResourceAdapter.class</code> or
+ * <code>null</code> if class not available
+ * @since 3.0
+ */
+ public static Class getDefaultContributorResourceAdapterClass() {
+ if (defaultContributorResourceAdapterClass != null) {
+ // tried before and succeeded
+ return defaultContributorResourceAdapterClass;
+ }
+ Class c = loadClass("org.eclipse.ui.ide", "org.eclipse.ui.internal.ide.DefaultContributorResourceAdapter"); //$NON-NLS-1$ //$NON-NLS-2$
+ if (c != null) {
+ // The class was found so record it
+ defaultContributorResourceAdapterClass = c;
+ }
+ return c;
+ }
private static Object getDefaultContributorResourceAdapter() {
- if (defaultContributorResourceAdapter != null) {
- return defaultContributorResourceAdapter;
- }
+ if (defaultContributorResourceAdapter != null) {
+ return defaultContributorResourceAdapter;
+ }
// reflective equivalent of
- // resourceAdapter = DefaultContributorResourceAdapter.getDefault();
+ // resourceAdapter = DefaultContributorResourceAdapter.getDefault();
- Class c = LegacyResourceSupport.getDefaultContributorResourceAdapterClass();
- if (c != null) {
- try {
+ Class c = LegacyResourceSupport.getDefaultContributorResourceAdapterClass();
+ if (c != null) {
+ try {
Method m = c.getDeclaredMethod("getDefault");//$NON-NLS-1$
defaultContributorResourceAdapter = m.invoke(null);
- return defaultContributorResourceAdapter;
- } catch (SecurityException e) {
- // shouldn't happen - but play it safe
- } catch (NoSuchMethodException e) {
- // shouldn't happen - but play it safe
- } catch (IllegalArgumentException e) {
- // shouldn't happen - but play it safe
- } catch (IllegalAccessException e) {
- // shouldn't happen - but play it safe
- } catch (InvocationTargetException e) {
- // shouldn't happen - but play it safe
- }
+ return defaultContributorResourceAdapter;
+ } catch (SecurityException e) {
+ // shouldn't happen - but play it safe
+ } catch (NoSuchMethodException e) {
+ // shouldn't happen - but play it safe
+ } catch (IllegalArgumentException e) {
+ // shouldn't happen - but play it safe
+ } catch (IllegalAccessException e) {
+ // shouldn't happen - but play it safe
+ } catch (InvocationTargetException e) {
+ // shouldn't happen - but play it safe
+ }
+
+ }
+
+ return null;
+ }
+ /**
+ * Returns <code>true</code> if the provided type name is an
+ * <code>IResource</code>, and <code>false</code> otherwise.
+ *
+ * @param objectClassName
+ * @return <code>true</code> if the provided type name is an
+ * <code>IResource</code>, and <code>false</code> otherwise.
+ *
+ * @since 3.1
+ */
+ public static boolean isResourceType(String objectClassName) {
+ for (String resourceClassName : resourceClassNames) {
+ if (resourceClassName.equals(objectClassName)) {
+ return true;
}
+ }
+ return false;
+ }
- return null;
+ /**
+ * Returns <code>true</code> if the provided type name is an
+ * <code>"org.eclipse.core.resources.mapping.ResourceMapping"</code>, and
+ * <code>false</code> otherwise.
+ *
+ * @param objectClassName
+ * @return <code>true</code> if the provided type name is an
+ * <code>"org.eclipse.core.resources.mapping.ResourceMapping"</code>,
+ * and <code>false</code> otherwise.
+ *
+ * @since 3.1
+ */
+ public static boolean isResourceMappingType(String objectClassName) {
+ return objectClassName.equals("org.eclipse.core.resources.mapping.ResourceMapping"); //$NON-NLS-1$
+ }
- }
-
- /**
- * Returns <code>true</code> if the provided type name is an
- * <code>IResource</code>, and <code>false</code> otherwise.
- * @param objectClassName
- * @return <code>true</code> if the provided type name is an
- * <code>IResource</code>, and <code>false</code> otherwise.
- *
- * @since 3.1
- */
- public static boolean isResourceType(String objectClassName) {
- for (String resourceClassName : resourceClassNames) {
- if (resourceClassName.equals(objectClassName)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Returns <code>true</code> if the provided type name is an
- * <code>"org.eclipse.core.resources.mapping.ResourceMapping"</code>, and <code>false</code> otherwise.
- * @param objectClassName
- * @return <code>true</code> if the provided type name is an
- * <code>"org.eclipse.core.resources.mapping.ResourceMapping"</code>, and <code>false</code> otherwise.
- *
- * @since 3.1
- */
- public static boolean isResourceMappingType(String objectClassName) {
- return objectClassName.equals("org.eclipse.core.resources.mapping.ResourceMapping"); //$NON-NLS-1$
- }
-
- /**
- * Returns the class search order starting with <code>extensibleClass</code>.
- * The search order is defined in this class' comment.
- *
- * @since 3.1
- */
- private static boolean isInstanceOf(Class clazz, String type) {
+ /**
+ * Returns the class search order starting with <code>extensibleClass</code>.
+ * The search order is defined in this class' comment.
+ *
+ * @since 3.1
+ */
+ private static boolean isInstanceOf(Class clazz, String type) {
if (clazz.getName().equals(type)) {
return true;
}
- Class superClass= clazz.getSuperclass();
+ Class superClass = clazz.getSuperclass();
if (superClass != null && isInstanceOf(superClass, type)) {
return true;
}
- Class[] interfaces= clazz.getInterfaces();
+ Class[] interfaces = clazz.getInterfaces();
for (Class currentInterface : interfaces) {
if (isInstanceOf(currentInterface, type)) {
return true;
@@ -386,18 +394,19 @@ public final class LegacyResourceSupport {
return false;
}
- /**
- * Returns the adapted resource using the <code>IContributorResourceAdapter</code>
- * registered for the given object. If the Resources plug-in is not loaded
- * the object can not be adapted.
- *
- * @param object the object to adapt to <code>IResource</code>.
- * @return returns the adapted resource using the <code>IContributorResourceAdapter</code>
- * or <code>null</code> if the Resources plug-in is not loaded.
- *
- * @since 3.1
- */
- public static Object getAdaptedContributorResource(Object object) {
+ /**
+ * Returns the adapted resource using the
+ * <code>IContributorResourceAdapter</code> registered for the given object. If
+ * the Resources plug-in is not loaded the object can not be adapted.
+ *
+ * @param object the object to adapt to <code>IResource</code>.
+ * @return returns the adapted resource using the
+ * <code>IContributorResourceAdapter</code> or <code>null</code> if the
+ * Resources plug-in is not loaded.
+ *
+ * @since 3.1
+ */
+ public static Object getAdaptedContributorResource(Object object) {
Class resourceClass = LegacyResourceSupport.getResourceClass();
if (resourceClass == null) {
return null;
@@ -413,40 +422,41 @@ public final class LegacyResourceSupport {
}
Object resourceAdapter = adaptable.getAdapter(contributorResourceAdapterClass);
if (resourceAdapter == null) {
- resourceAdapter = LegacyResourceSupport.getDefaultContributorResourceAdapter();
- if (resourceAdapter == null) {
+ resourceAdapter = LegacyResourceSupport.getDefaultContributorResourceAdapter();
+ if (resourceAdapter == null) {
return null;
}
}
// reflective equivalent of
- // result = ((IContributorResourceAdapter) resourceAdapter).getAdaptedResource(adaptable);
+ // result = ((IContributorResourceAdapter)
+ // resourceAdapter).getAdaptedResource(adaptable);
- Method m = getContributorResourceAdapterGetAdaptedResourceMethod();
- if (m != null) {
- try {
+ Method m = getContributorResourceAdapterGetAdaptedResourceMethod();
+ if (m != null) {
+ try {
return m.invoke(resourceAdapter, adaptable);
- } catch (IllegalArgumentException e) {
- // shouldn't happen - but play it safe
- } catch (IllegalAccessException e) {
- // shouldn't happen - but play it safe
- } catch (InvocationTargetException e) {
- // shouldn't happen - but play it safe
- }
+ } catch (IllegalArgumentException e) {
+ // shouldn't happen - but play it safe
+ } catch (IllegalAccessException e) {
+ // shouldn't happen - but play it safe
+ } catch (InvocationTargetException e) {
+ // shouldn't happen - but play it safe
}
+ }
}
return null;
}
- private static Method getContributorResourceAdapterGetAdaptedResourceMethod() {
- if (getAdaptedResourceMethod != null) {
- return getAdaptedResourceMethod;
- }
+ private static Method getContributorResourceAdapterGetAdaptedResourceMethod() {
+ if (getAdaptedResourceMethod != null) {
+ return getAdaptedResourceMethod;
+ }
- Class c = getIContributorResourceAdapterClass();
- if (c != null) {
- try {
- getAdaptedResourceMethod = c.getDeclaredMethod("getAdaptedResource", new Class[]{IAdaptable.class}); //$NON-NLS-1$
+ Class c = getIContributorResourceAdapterClass();
+ if (c != null) {
+ try {
+ getAdaptedResourceMethod = c.getDeclaredMethod("getAdaptedResource", new Class[] { IAdaptable.class }); //$NON-NLS-1$
return getAdaptedResourceMethod;
} catch (SecurityException e) {
// shouldn't happen - but play it safe
@@ -454,21 +464,21 @@ public final class LegacyResourceSupport {
// shouldn't happen - but play it safe
}
- }
+ }
- return null;
+ return null;
}
+ private static Method getContributorResourceAdapter2GetAdaptedResourceMappingMethod() {
+ if (getAdaptedResourceMappingMethod != null) {
+ return getAdaptedResourceMappingMethod;
+ }
- private static Method getContributorResourceAdapter2GetAdaptedResourceMappingMethod() {
- if (getAdaptedResourceMappingMethod != null) {
- return getAdaptedResourceMappingMethod;
- }
-
- Class c = getIContributorResourceAdapter2Class();
- if (c != null) {
- try {
- getAdaptedResourceMappingMethod = c.getDeclaredMethod("getAdaptedResourceMapping", new Class[]{IAdaptable.class}); //$NON-NLS-1$
+ Class c = getIContributorResourceAdapter2Class();
+ if (c != null) {
+ try {
+ getAdaptedResourceMappingMethod = c.getDeclaredMethod("getAdaptedResourceMapping", //$NON-NLS-1$
+ new Class[] { IAdaptable.class });
return getAdaptedResourceMappingMethod;
} catch (SecurityException e) {
// do nothing - play it safe
@@ -476,106 +486,111 @@ public final class LegacyResourceSupport {
// do nothing - play it safe
}
- }
+ }
- return null;
+ return null;
}
/**
- * Returns the adapted resource mapping using the <code>IContributorResourceAdapter2</code>
- * registered for the given object. If the Resources plug-in is not loaded
- * the object can not be adapted.
- *
- * @param object the object to adapt to <code>ResourceMapping</code>.
- * @return returns the adapted resource using the <code>IContributorResourceAdapter2</code>
- * or <code>null</code> if the Resources plug-in is not loaded.
- *
- * @since 3.1
- */
- public static Object getAdaptedContributorResourceMapping(Object object) {
- Class resourceMappingClass = LegacyResourceSupport.getResourceMappingClass();
- if (resourceMappingClass == null) {
- return null;
- }
- if (resourceMappingClass.isInstance(object)) {
- return null;
- }
- if (object instanceof IAdaptable) {
- IAdaptable adaptable = (IAdaptable) object;
- Class contributorResourceAdapterClass = LegacyResourceSupport.getIContributorResourceAdapterClass();
- if (contributorResourceAdapterClass == null) {
- return adaptable.getAdapter(resourceMappingClass);
- }
- Class contributorResourceAdapter2Class = LegacyResourceSupport.getIContributorResourceAdapter2Class();
- if (contributorResourceAdapter2Class == null) {
- return adaptable.getAdapter(resourceMappingClass);
- }
- Object resourceAdapter = adaptable.getAdapter(contributorResourceAdapterClass);
- Object resourceMappingAdapter;
+ * Returns the adapted resource mapping using the
+ * <code>IContributorResourceAdapter2</code> registered for the given object. If
+ * the Resources plug-in is not loaded the object can not be adapted.
+ *
+ * @param object the object to adapt to <code>ResourceMapping</code>.
+ * @return returns the adapted resource using the
+ * <code>IContributorResourceAdapter2</code> or <code>null</code> if the
+ * Resources plug-in is not loaded.
+ *
+ * @since 3.1
+ */
+ public static Object getAdaptedContributorResourceMapping(Object object) {
+ Class resourceMappingClass = LegacyResourceSupport.getResourceMappingClass();
+ if (resourceMappingClass == null) {
+ return null;
+ }
+ if (resourceMappingClass.isInstance(object)) {
+ return null;
+ }
+ if (object instanceof IAdaptable) {
+ IAdaptable adaptable = (IAdaptable) object;
+ Class contributorResourceAdapterClass = LegacyResourceSupport.getIContributorResourceAdapterClass();
+ if (contributorResourceAdapterClass == null) {
+ return adaptable.getAdapter(resourceMappingClass);
+ }
+ Class contributorResourceAdapter2Class = LegacyResourceSupport.getIContributorResourceAdapter2Class();
+ if (contributorResourceAdapter2Class == null) {
+ return adaptable.getAdapter(resourceMappingClass);
+ }
+ Object resourceAdapter = adaptable.getAdapter(contributorResourceAdapterClass);
+ Object resourceMappingAdapter;
if (resourceAdapter != null && contributorResourceAdapter2Class.isInstance(resourceAdapter)) {
- // The registered adapter also handles resource mappings
- resourceMappingAdapter = resourceAdapter;
- } else {
- // Either there is no registered adapter or it doesn't handle resource mappings.
- // In this case, we will use the default contribution adapter
- resourceMappingAdapter = getDefaultContributorResourceAdapter();
- if (resourceMappingAdapter == null) {
- return null;
- }
- }
-
+ // The registered adapter also handles resource mappings
+ resourceMappingAdapter = resourceAdapter;
+ } else {
+ // Either there is no registered adapter or it doesn't handle resource mappings.
+ // In this case, we will use the default contribution adapter
+ resourceMappingAdapter = getDefaultContributorResourceAdapter();
+ if (resourceMappingAdapter == null) {
+ return null;
+ }
+ }
- // reflective equivalent of
- // result = ((IContributorResourceAdapter2) resourceAdapter).getAdaptedResource(adaptable);
+ // reflective equivalent of
+ // result = ((IContributorResourceAdapter2)
+ // resourceAdapter).getAdaptedResource(adaptable);
- Method m = getContributorResourceAdapter2GetAdaptedResourceMappingMethod();
- if (m != null) {
+ Method m = getContributorResourceAdapter2GetAdaptedResourceMappingMethod();
+ if (m != null) {
try {
Object result = m.invoke(resourceMappingAdapter, adaptable);
if (result != null) {
- return result;
- }
+ return result;
+ }
} catch (IllegalArgumentException e) {
- // shouldn't happen - but play it safe
+ // shouldn't happen - but play it safe
} catch (IllegalAccessException e) {
- // shouldn't happen - but play it safe
+ // shouldn't happen - but play it safe
} catch (InvocationTargetException e) {
- // shouldn't happen - but play it safe
+ // shouldn't happen - but play it safe
}
- }
-
-
- // If we get here, that means that the object in question doesn't adapt to resource mapping
- // and it's contributed adapter doesn't do the adaptation either.
- // Before we fail, we will attempt to adapt the object to IResource and then to ResourceMapping
- Object r = getAdaptedContributorResource(object);
- if (r != null) {
- return Platform.getAdapterManager().getAdapter(r, resourceMappingClass);
- }
-
- // we've exhausted every avenue so just return null
- return null;
- }
- // Fallback to querying the adapter manager directly when the object isn't an IAdaptable
- return Platform.getAdapterManager().getAdapter(object, resourceMappingClass);
- }
-
- /**
- * Adapts a selection to the given objectClass considering the Legacy resource
- * support. Non resource objectClasses are adapted using the <code>IAdapterManager</code>
- * and this may load the plug-in that contributes the adapter factory.
- * <p>
- * The returned selection will only contain elements successfully adapted.
- * </p>
- * @param selection the selection to adapt
- * @param objectClass the class name to adapt the selection to
- * @return an adapted selection
- *
- * @since 3.1
- */
- public static IStructuredSelection adaptSelection(IStructuredSelection selection, String objectClass) {
+ }
+
+ // If we get here, that means that the object in question doesn't adapt to
+ // resource mapping
+ // and it's contributed adapter doesn't do the adaptation either.
+ // Before we fail, we will attempt to adapt the object to IResource and then to
+ // ResourceMapping
+ Object r = getAdaptedContributorResource(object);
+ if (r != null) {
+ return Platform.getAdapterManager().getAdapter(r, resourceMappingClass);
+ }
+
+ // we've exhausted every avenue so just return null
+ return null;
+ }
+ // Fallback to querying the adapter manager directly when the object isn't an
+ // IAdaptable
+ return Platform.getAdapterManager().getAdapter(object, resourceMappingClass);
+ }
+
+ /**
+ * Adapts a selection to the given objectClass considering the Legacy resource
+ * support. Non resource objectClasses are adapted using the
+ * <code>IAdapterManager</code> and this may load the plug-in that contributes
+ * the adapter factory.
+ * <p>
+ * The returned selection will only contain elements successfully adapted.
+ * </p>
+ *
+ * @param selection the selection to adapt
+ * @param objectClass the class name to adapt the selection to
+ * @return an adapted selection
+ *
+ * @since 3.1
+ */
+ public static IStructuredSelection adaptSelection(IStructuredSelection selection, String objectClass) {
List newSelection = new ArrayList(10);
for (Iterator it = selection.iterator(); it.hasNext();) {
Object element = it.next();
@@ -587,22 +602,24 @@ public final class LegacyResourceSupport {
return new StructuredSelection(newSelection);
}
- /**
- * Adapts an object to a specified objectClass considering the Legacy resource
- * support. Non resource objectClasses are adapted using the <code>IAdapterManager</code>
- * and this may load the plug-in that contributes the adapter factory.
- * <p>
- * The returned selection will be of the same size as the original, and elements that could
- * not be adapted are added to the returned selection as is.
- * </p>
- * @param element the element to adapt
- * @param objectClass the class name to adapt the selection to
- * @return an adapted element or <code>null</code> if the
- * element could not be adapted.
- *
- * @since 3.1
- */
- public static Object getAdapter(Object element, String objectClass) {
+ /**
+ * Adapts an object to a specified objectClass considering the Legacy resource
+ * support. Non resource objectClasses are adapted using the
+ * <code>IAdapterManager</code> and this may load the plug-in that contributes
+ * the adapter factory.
+ * <p>
+ * The returned selection will be of the same size as the original, and elements
+ * that could not be adapted are added to the returned selection as is.
+ * </p>
+ *
+ * @param element the element to adapt
+ * @param objectClass the class name to adapt the selection to
+ * @return an adapted element or <code>null</code> if the element could not be
+ * adapted.
+ *
+ * @since 3.1
+ */
+ public static Object getAdapter(Object element, String objectClass) {
Object adaptedElement = null;
if (isInstanceOf(element.getClass(), objectClass)) {
adaptedElement = element;
@@ -610,15 +627,16 @@ public final class LegacyResourceSupport {
// Handle IResource
if (LegacyResourceSupport.isResourceType(objectClass)) {
adaptedElement = getAdaptedResource(element);
- } else if (LegacyResourceSupport.isResourceMappingType(objectClass)) {
- adaptedElement = getAdaptedResourceMapping(element);
- if (adaptedElement == null) {
- // The object doesn't adapt directly so check if it adapts transitively
- Object resource = getAdaptedResource(element);
- if (resource != null) {
- adaptedElement =( (IAdaptable)resource).getAdapter(LegacyResourceSupport.getResourceMappingClass());
- }
- }
+ } else if (LegacyResourceSupport.isResourceMappingType(objectClass)) {
+ adaptedElement = getAdaptedResourceMapping(element);
+ if (adaptedElement == null) {
+ // The object doesn't adapt directly so check if it adapts transitively
+ Object resource = getAdaptedResource(element);
+ if (resource != null) {
+ adaptedElement = ((IAdaptable) resource)
+ .getAdapter(LegacyResourceSupport.getResourceMappingClass());
+ }
+ }
} else {
// Handle all other types by using the adapter factory.
adaptedElement = Platform.getAdapterManager().loadAdapter(element, objectClass);
@@ -628,19 +646,20 @@ public final class LegacyResourceSupport {
}
/**
- * Adapt the given element to an <code>IResource</code> using the following
- * search order:
- * <ol>
- * <li> using the IContributorResourceAdapter registered for the given element, or
- * <li> directly asking the element if it adapts.
- * </ol>
- *
- * @param element the element to adapt
- * @return an <code>IResource</code> instance if the element could be adapted or <code>null</code>
- * otherwise.
- * @since 3.1
- */
- public static Object getAdaptedResource(Object element) {
+ * Adapt the given element to an <code>IResource</code> using the following
+ * search order:
+ * <ol>
+ * <li>using the IContributorResourceAdapter registered for the given element,
+ * or
+ * <li>directly asking the element if it adapts.
+ * </ol>
+ *
+ * @param element the element to adapt
+ * @return an <code>IResource</code> instance if the element could be adapted or
+ * <code>null</code> otherwise.
+ * @since 3.1
+ */
+ public static Object getAdaptedResource(Object element) {
Class resourceClass = LegacyResourceSupport.getResourceClass();
Object adaptedValue = null;
if (resourceClass != null) {
@@ -653,37 +672,38 @@ public final class LegacyResourceSupport {
return adaptedValue;
}
- /**
- * Adapt the given element to an <code>ResourceMapping</code> using the following
- * search order:
- * <ol>
- * <li> using the IContributorResourceAdapter2 registered for the given element, or
- * <li> directly asking the element if it adapts.
- * </ol>
- *
- * @param element the element to adapt
- * @return an <code>ResourceMapping</code> instance if the element could be adapted or <code>null</code>
- * otherwise.
- * @since 3.1
- */
- public static Object getAdaptedResourceMapping(Object element) {
- Class resourceMappingClass = LegacyResourceSupport.getResourceMappingClass();
- Object adaptedValue = null;
- if (resourceMappingClass != null) {
- if (resourceMappingClass.isInstance(element)) {
- adaptedValue = element;
- } else {
- adaptedValue = LegacyResourceSupport.getAdaptedContributorResourceMapping(element);
- }
- }
- return adaptedValue;
- }
-
- /**
- * Prevents construction
- */
- private LegacyResourceSupport() {
- // do nothing
- }
+ /**
+ * Adapt the given element to an <code>ResourceMapping</code> using the
+ * following search order:
+ * <ol>
+ * <li>using the IContributorResourceAdapter2 registered for the given element,
+ * or
+ * <li>directly asking the element if it adapts.
+ * </ol>
+ *
+ * @param element the element to adapt
+ * @return an <code>ResourceMapping</code> instance if the element could be
+ * adapted or <code>null</code> otherwise.
+ * @since 3.1
+ */
+ public static Object getAdaptedResourceMapping(Object element) {
+ Class resourceMappingClass = LegacyResourceSupport.getResourceMappingClass();
+ Object adaptedValue = null;
+ if (resourceMappingClass != null) {
+ if (resourceMappingClass.isInstance(element)) {
+ adaptedValue = element;
+ } else {
+ adaptedValue = LegacyResourceSupport.getAdaptedContributorResourceMapping(element);
+ }
+ }
+ return adaptedValue;
+ }
+
+ /**
+ * Prevents construction
+ */
+ private LegacyResourceSupport() {
+ // do nothing
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LegacyTrim.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LegacyTrim.java
index a0796deb5a1..c3b2ffd327e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LegacyTrim.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LegacyTrim.java
@@ -46,8 +46,8 @@ public class LegacyTrim {
parent = new Composite(parent, SWT.NONE);
parent.setLayout(new RowLayout());
- widget = (IWorkbenchWidget) Util.safeLoadExecutableExtension(ice,
- IWorkbenchRegistryConstants.ATT_CLASS, IWorkbenchWidget.class);
+ widget = (IWorkbenchWidget) Util.safeLoadExecutableExtension(ice, IWorkbenchRegistryConstants.ATT_CLASS,
+ IWorkbenchWidget.class);
widget.init(iwbw);
if (widget instanceof AbstractTrimWidget) {
((AbstractTrimWidget) widget).fill(parent, SWT.DEFAULT, getSide(toolControl));
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LocalWorkingSetManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LocalWorkingSetManager.java
index f152632a8f8..6197011840c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LocalWorkingSetManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LocalWorkingSetManager.java
@@ -19,7 +19,6 @@ import org.eclipse.ui.IMemento;
import org.eclipse.ui.IWorkingSet;
import org.osgi.framework.BundleContext;
-
public class LocalWorkingSetManager extends AbstractWorkingSetManager implements ILocalWorkingSetManager {
public LocalWorkingSetManager(BundleContext context) {
@@ -47,8 +46,8 @@ public class LocalWorkingSetManager extends AbstractWorkingSetManager implements
*/
@Override
public void saveState(IMemento memento) {
- saveWorkingSetState(memento);
- saveMruList(memento);
+ saveWorkingSetState(memento);
+ saveMruList(memento);
}
/**
@@ -58,7 +57,7 @@ public class LocalWorkingSetManager extends AbstractWorkingSetManager implements
public void restoreState(IMemento memento) {
Assert.isNotNull(memento);
Assert.isTrue(getWorkingSets().length == 0);
- restoreWorkingSetState(memento);
- restoreMruList(memento);
+ restoreWorkingSetState(memento);
+ restoreMruList(memento);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/MessageLine.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/MessageLine.java
index 5ab3715c87b..61e2209ec1e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/MessageLine.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/MessageLine.java
@@ -27,51 +27,48 @@ import org.eclipse.ui.PlatformUI;
*/
public class MessageLine extends CLabel {
- /**
- * Creates a new message line as a child of the given parent.
- */
- public MessageLine(Composite parent) {
- this(parent, SWT.LEFT);
- }
+ /**
+ * Creates a new message line as a child of the given parent.
+ */
+ public MessageLine(Composite parent) {
+ this(parent, SWT.LEFT);
+ }
- /**
- * Creates a new message line as a child of the parent and with the given SWT stylebits.
- */
- public MessageLine(Composite parent, int style) {
- super(parent, style);
- }
+ /**
+ * Creates a new message line as a child of the parent and with the given SWT
+ * stylebits.
+ */
+ public MessageLine(Composite parent, int style) {
+ super(parent, style);
+ }
- private Image findImage(IStatus status) {
- if (status.isOK()) {
- return null;
- } else if (status.matches(IStatus.ERROR)) {
- return PlatformUI.getWorkbench().getSharedImages().getImage(
- ISharedImages.IMG_OBJS_ERROR_TSK);
- } else if (status.matches(IStatus.WARNING)) {
- return PlatformUI.getWorkbench().getSharedImages().getImage(
- ISharedImages.IMG_OBJS_WARN_TSK);
- } else if (status.matches(IStatus.INFO)) {
- return PlatformUI.getWorkbench().getSharedImages().getImage(
- ISharedImages.IMG_OBJS_INFO_TSK);
- }
- return null;
- }
+ private Image findImage(IStatus status) {
+ if (status.isOK()) {
+ return null;
+ } else if (status.matches(IStatus.ERROR)) {
+ return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
+ } else if (status.matches(IStatus.WARNING)) {
+ return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_WARN_TSK);
+ } else if (status.matches(IStatus.INFO)) {
+ return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_INFO_TSK);
+ }
+ return null;
+ }
- /**
- * Sets the message and image to the given status.
- * <code>null</code> is a valid argument and will set the empty text and no image
- */
- public void setErrorStatus(IStatus status) {
- if (status != null) {
- String message = status.getMessage();
- if (message != null && message.length() > 0) {
- setText(message);
- setImage(findImage(status));
- return;
- }
- }
+ /**
+ * Sets the message and image to the given status. <code>null</code> is a valid
+ * argument and will set the empty text and no image
+ */
+ public void setErrorStatus(IStatus status) {
+ if (status != null) {
+ String message = status.getMessage();
+ if (message != null && message.length() > 0) {
+ setText(message);
+ setImage(findImage(status));
+ return;
+ }
+ }
setText(""); //$NON-NLS-1$
- setImage(null);
+ setImage(null);
}
}
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Model.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Model.java
index ef01448567f..39698cafc86 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Model.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Model.java
@@ -23,87 +23,87 @@ import java.util.List;
*/
public class Model {
- /**
- * Current state of the model
- */
- private Object state;
+ /**
+ * Current state of the model
+ */
+ private Object state;
- /**
- * Set of objects that will be notified about state changes
- */
- private List views = new ArrayList(1);
+ /**
+ * Set of objects that will be notified about state changes
+ */
+ private List views = new ArrayList(1);
- /**
- * Creates a new model with the given initial state.
- *
- * @param initialState
- */
- public Model(Object initialState) {
- state = initialState;
- }
+ /**
+ * Creates a new model with the given initial state.
+ *
+ * @param initialState
+ */
+ public Model(Object initialState) {
+ state = initialState;
+ }
- /**
- * Returns the current state of the model.
- *
- * @return the current model state
- */
- public Object getState() {
- return state;
- }
+ /**
+ * Returns the current state of the model.
+ *
+ * @return the current model state
+ */
+ public Object getState() {
+ return state;
+ }
- /**
- * Sets the current state of the model.
- *
- * @param newState the new state of the model
- * @param toOmit change listener that should be omitted from change notifications (or null if all
- * listeners should be notified).
- */
- public void setState(Object newState, IChangeListener toOmit) {
- if (areEqual(newState, state)) {
- return;
- }
+ /**
+ * Sets the current state of the model.
+ *
+ * @param newState the new state of the model
+ * @param toOmit change listener that should be omitted from change
+ * notifications (or null if all listeners should be notified).
+ */
+ public void setState(Object newState, IChangeListener toOmit) {
+ if (areEqual(newState, state)) {
+ return;
+ }
- state = newState;
+ state = newState;
- Iterator iter = views.iterator();
- while (iter.hasNext()) {
- IChangeListener next = (IChangeListener) iter.next();
+ Iterator iter = views.iterator();
+ while (iter.hasNext()) {
+ IChangeListener next = (IChangeListener) iter.next();
- if (next != toOmit) {
- next.update(true);
- }
- }
- }
+ if (next != toOmit) {
+ next.update(true);
+ }
+ }
+ }
- private boolean areEqual(Object o1, Object o2) {
- if (o1 == null) {
- return o2 == null;
- }
- if (o2 == null) {
- return false;
- }
+ private boolean areEqual(Object o1, Object o2) {
+ if (o1 == null) {
+ return o2 == null;
+ }
+ if (o2 == null) {
+ return false;
+ }
- return o1.equals(o2);
- }
+ return o1.equals(o2);
+ }
- /**
- * Adds the given listener to the set of listeners that will be
- * notified when the state changes.
- *
- * @param toAdd
- */
- public void addChangeListener(IChangeListener changeListener) {
- changeListener.update(false);
- views.add(changeListener);
- }
+ /**
+ * Adds the given listener to the set of listeners that will be notified when
+ * the state changes.
+ *
+ * @param toAdd
+ */
+ public void addChangeListener(IChangeListener changeListener) {
+ changeListener.update(false);
+ views.add(changeListener);
+ }
- /**
- * Stops this model from sending change events from the given listener.
- *
- * @param toRemove
- */
- public void removeChangeListener(IChangeListener changeListener) {
- views.remove(changeListener);
- }
+ /**
+ * Stops this model from sending change events from the given listener.
+ *
+ * @param toRemove
+ */
+ public void removeChangeListener(IChangeListener changeListener) {
+ views.remove(changeListener);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NavigationHistory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NavigationHistory.java
index c76f4dde37b..3c3ba6f44aa 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NavigationHistory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NavigationHistory.java
@@ -39,69 +39,70 @@ import org.eclipse.ui.internal.StartupThreading.StartupRunnable;
*/
public class NavigationHistory implements INavigationHistory {
- private static final boolean DEBUG= false;
+ private static final boolean DEBUG = false;
private static final int CAPACITY = 50;
- private NavigationHistoryAction backwardAction;
+ private NavigationHistoryAction backwardAction;
- private NavigationHistoryAction forwardAction;
+ private NavigationHistoryAction forwardAction;
- private int ignoreEntries;
+ private int ignoreEntries;
- private ArrayList history = new ArrayList(CAPACITY);
+ private ArrayList history = new ArrayList(CAPACITY);
- Map perTabHistoryMap = new HashMap();
+ Map perTabHistoryMap = new HashMap();
- private ArrayList editors = new ArrayList(CAPACITY);
+ private ArrayList editors = new ArrayList(CAPACITY);
- private IWorkbenchPage page;
+ private IWorkbenchPage page;
- private int activeEntry = 0;
+ private int activeEntry = 0;
/**
- * Creates a new NavigationHistory to keep the NavigationLocation entries of the specified page.
+ * Creates a new NavigationHistory to keep the NavigationLocation entries of the
+ * specified page.
*
* @param page the workbench page
*/
- public NavigationHistory(final IWorkbenchPage page) {
- this.page = page;
- page.addPartListener(new IPartListener2() {
- @Override
+ public NavigationHistory(final IWorkbenchPage page) {
+ this.page = page;
+ page.addPartListener(new IPartListener2() {
+ @Override
public void partActivated(IWorkbenchPartReference partRef) {
- }
+ }
- @Override
+ @Override
public void partBroughtToTop(IWorkbenchPartReference partRef) {
- }
+ }
- @Override
+ @Override
public void partDeactivated(IWorkbenchPartReference partRef) {
- }
+ }
- @Override
+ @Override
public void partOpened(IWorkbenchPartReference partRef) {
- }
+ }
- @Override
+ @Override
public void partHidden(IWorkbenchPartReference partRef) {
- }
+ }
- @Override
+ @Override
public void partVisible(IWorkbenchPartReference partRef) {
- }
+ }
- @Override
+ @Override
public void partClosed(IWorkbenchPartReference partRef) {
- if (isPerTabHistoryEnabled() && partRef instanceof EditorReference) {
- if (!((EditorReference)partRef).isDisposed()) {
+ if (isPerTabHistoryEnabled() && partRef instanceof EditorReference) {
+ if (!((EditorReference) partRef).isDisposed()) {
Object editorTabCookie = ((EditorReference) partRef).getModel().getWidget();
- disposeHistoryForTab(editorTabCookie);
- updateActions();
- }
- }
+ disposeHistoryForTab(editorTabCookie);
+ updateActions();
+ }
+ }
updateNavigationHistory(partRef, true);
- }
+ }
@Override
public void partInputChanged(IWorkbenchPartReference partRef) {
@@ -109,636 +110,595 @@ public class NavigationHistory implements INavigationHistory {
}
private void updateNavigationHistory(IWorkbenchPartReference partRef, boolean partClosed) {
- if (partRef != null && partRef.getPart(false) instanceof IEditorPart) {
- IEditorPart editor = (IEditorPart) partRef.getPart(false);
- IEditorInput input = editor.getEditorInput();
- String id = editor.getSite().getId();
- Iterator e = editors.iterator();
- NavigationHistoryEditorInfo info = null;
- NavigationHistoryEditorInfo currentInfo = null;
- NavigationHistoryEntry current = getEntry(activeEntry);
- if (current != null) {
+ if (partRef != null && partRef.getPart(false) instanceof IEditorPart) {
+ IEditorPart editor = (IEditorPart) partRef.getPart(false);
+ IEditorInput input = editor.getEditorInput();
+ String id = editor.getSite().getId();
+ Iterator e = editors.iterator();
+ NavigationHistoryEditorInfo info = null;
+ NavigationHistoryEditorInfo currentInfo = null;
+ NavigationHistoryEntry current = getEntry(activeEntry);
+ if (current != null) {
currentInfo = current.editorInfo;
}
- while (e.hasNext()) {
- info = (NavigationHistoryEditorInfo) e.next();
- if (id.equals(info.editorID)
- && input.equals(info.editorInput)) {
- if (partClosed && info != currentInfo) {
+ while (e.hasNext()) {
+ info = (NavigationHistoryEditorInfo) e.next();
+ if (id.equals(info.editorID) && input.equals(info.editorInput)) {
+ if (partClosed && info != currentInfo) {
info.handlePartClosed();
}
- break;
- }
+ break;
+ }
info = null;
- }
- if (info == null) {
+ }
+ if (info == null) {
return;
}
- boolean isEntryDisposed = false;
- e = history.iterator();
- int i = 0;
- while (e.hasNext()) {
- NavigationHistoryEntry entry = (NavigationHistoryEntry) e
- .next();
- if (entry.editorInfo == info) {
+ boolean isEntryDisposed = false;
+ e = history.iterator();
+ int i = 0;
+ while (e.hasNext()) {
+ NavigationHistoryEntry entry = (NavigationHistoryEntry) e.next();
+ if (entry.editorInfo == info) {
if (!entry.handlePartClosed()) {
- // update the active entry since we are removing an item
- if (i < activeEntry) {
- activeEntry--;
- } else if (i == activeEntry) {
- if (i != 0) {
+ // update the active entry since we are removing an item
+ if (i < activeEntry) {
+ activeEntry--;
+ } else if (i == activeEntry) {
+ if (i != 0) {
activeEntry--;
}
- } else {
- // activeEntry is before item we deleted
- i++;
- }
- isEntryDisposed = true;
- e.remove();
- disposeEntry(entry);
- } else {
- i++;
- }
+ } else {
+ // activeEntry is before item we deleted
+ i++;
+ }
+ isEntryDisposed = true;
+ e.remove();
+ disposeEntry(entry);
+ } else {
+ i++;
+ }
}
- }
-
- /*
- * Promote the entry of the last closed editor to be the active
- * one, see: https://bugs.eclipse.org/bugs/show_bug.cgi?id=154431
- */
- if (!isEntryDisposed && page.getActiveEditor() == null && activeEntry < history.size())
- activeEntry++;
-
- updateActions();
- }
- }
- });
- }
-
- private Display getDisplay() {
- return page.getWorkbenchWindow().getShell().getDisplay();
- }
-
- private boolean isPerTabHistoryEnabled() {
+ }
+
+ /*
+ * Promote the entry of the last closed editor to be the active one, see:
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=154431
+ */
+ if (!isEntryDisposed && page.getActiveEditor() == null && activeEntry < history.size())
+ activeEntry++;
+
+ updateActions();
+ }
+ }
+ });
+ }
+
+ private Display getDisplay() {
+ return page.getWorkbenchWindow().getShell().getDisplay();
+ }
+
+ private boolean isPerTabHistoryEnabled() {
return false;
- }
+ }
- /*
- * Adds an editor to the editor history without getting its location.
- */
- public void markEditor(final IEditorPart part) {
- if (ignoreEntries > 0 || part == null) {
+ /*
+ * Adds an editor to the editor history without getting its location.
+ */
+ public void markEditor(final IEditorPart part) {
+ if (ignoreEntries > 0 || part == null) {
return;
}
- /* Ignore all entries until the async exec runs. Workaround to avoid
- * extra entry when using Open Declaration (F3) that opens another editor. */
- ignoreEntries++;
- getDisplay().asyncExec(() -> {
- if (--ignoreEntries == 0) {
- if (part.getEditorSite() instanceof EditorSite) {
+ /*
+ * Ignore all entries until the async exec runs. Workaround to avoid extra entry
+ * when using Open Declaration (F3) that opens another editor.
+ */
+ ignoreEntries++;
+ getDisplay().asyncExec(() -> {
+ if (--ignoreEntries == 0) {
+ if (part.getEditorSite() instanceof EditorSite) {
EditorSite site = (EditorSite) part.getEditorSite();
Control c = (Control) site.getModel().getWidget();
- if (c == null || c.isDisposed()) {
+ if (c == null || c.isDisposed()) {
return;
}
- NavigationHistoryEntry e = getEntry(activeEntry);
- if (e != null
- && part.getEditorInput() != e.editorInfo.editorInput) {
+ NavigationHistoryEntry e = getEntry(activeEntry);
+ if (e != null && part.getEditorInput() != e.editorInfo.editorInput) {
updateEntry(e);
}
- addEntry(part);
- }
- }
+ addEntry(part);
+ }
+ }
});
- }
+ }
- @Override
+ @Override
public void markLocation(IEditorPart part) {
- addEntry(part);
- }
-
- /*
- * Return the backward history entries. Return in restore order (i.e., the
- * first entry is the entry that would become active if the "Backward" action
- * was executed).
- * <p>
- * (Called by NavigationHistoryAction)
- * </p>
- */
- NavigationHistoryEntry[] getBackwardEntries() {
- if (isPerTabHistoryEnabled()) {
- return getEntriesForTab(false);
- }
- int length = activeEntry;
- NavigationHistoryEntry[] entries = new NavigationHistoryEntry[length];
- for (int i = 0; i < activeEntry; i++) {
- entries[activeEntry - 1 - i] = getEntry(i);
- }
- return entries;
- }
-
- /*
- * Return the forward history entries. Return in restore order (i.e., the first
- * entry is the entry that would become active if the "Forward" action was
- * executed).
- * <p>
- * (Called by NavigationHistoryAction)
- * </p>
- */
- NavigationHistoryEntry[] getForwardEntries() {
- if (isPerTabHistoryEnabled()) {
- return getEntriesForTab(true);
- }
- int length = history.size() - activeEntry - 1;
- length = Math.max(0, length);
- NavigationHistoryEntry[] entries = new NavigationHistoryEntry[length];
- for (int i = activeEntry + 1; i < history.size(); i++) {
- entries[i - activeEntry - 1] = getEntry(i);
- }
- return entries;
- }
-
- @Override
+ addEntry(part);
+ }
+
+ /*
+ * Return the backward history entries. Return in restore order (i.e., the first
+ * entry is the entry that would become active if the "Backward" action was
+ * executed). <p> (Called by NavigationHistoryAction) </p>
+ */
+ NavigationHistoryEntry[] getBackwardEntries() {
+ if (isPerTabHistoryEnabled()) {
+ return getEntriesForTab(false);
+ }
+ int length = activeEntry;
+ NavigationHistoryEntry[] entries = new NavigationHistoryEntry[length];
+ for (int i = 0; i < activeEntry; i++) {
+ entries[activeEntry - 1 - i] = getEntry(i);
+ }
+ return entries;
+ }
+
+ /*
+ * Return the forward history entries. Return in restore order (i.e., the first
+ * entry is the entry that would become active if the "Forward" action was
+ * executed). <p> (Called by NavigationHistoryAction) </p>
+ */
+ NavigationHistoryEntry[] getForwardEntries() {
+ if (isPerTabHistoryEnabled()) {
+ return getEntriesForTab(true);
+ }
+ int length = history.size() - activeEntry - 1;
+ length = Math.max(0, length);
+ NavigationHistoryEntry[] entries = new NavigationHistoryEntry[length];
+ for (int i = activeEntry + 1; i < history.size(); i++) {
+ entries[i - activeEntry - 1] = getEntry(i);
+ }
+ return entries;
+ }
+
+ @Override
public INavigationLocation[] getLocations() {
- INavigationLocation result[] = new INavigationLocation[history.size()];
- for (int i = 0; i < result.length; i++) {
- NavigationHistoryEntry e = (NavigationHistoryEntry) history.get(i);
- result[i] = e.location;
- }
- return result;
- }
-
- @Override
+ INavigationLocation result[] = new INavigationLocation[history.size()];
+ for (int i = 0; i < result.length; i++) {
+ NavigationHistoryEntry e = (NavigationHistoryEntry) history.get(i);
+ result[i] = e.location;
+ }
+ return result;
+ }
+
+ @Override
public INavigationLocation getCurrentLocation() {
- NavigationHistoryEntry entry = getEntry(activeEntry);
- return entry == null ? null : entry.location;
- }
-
- /**
- * Disposes this NavigationHistory and all entries.
- */
- public void dispose() {
- disposeHistoryForTabs();
- Iterator e = history.iterator();
- while (e.hasNext()) {
- NavigationHistoryEntry entry = (NavigationHistoryEntry) e.next();
- disposeEntry(entry);
- }
- }
-
- /**
- * Keeps a reference to the forward action to update its state
- * whenever needed.
- * <p>
- * (Called by NavigationHistoryAction)
- * </p>
- */
- void setForwardAction(NavigationHistoryAction action) {
- forwardAction = action;
- updateActions();
- }
-
- /**
- * Keeps a reference to the backward action to update its state
- * whenever needed.
- * <p>
- * (Called by NavigationHistoryAction)
- * </p>
- */
- void setBackwardAction(NavigationHistoryAction action) {
- backwardAction = action;
- updateActions();
- }
-
- /*
- * Returns the history entry indexed by <code>index</code>
- */
- private NavigationHistoryEntry getEntry(int index) {
- if (0 <= index && index < history.size()) {
+ NavigationHistoryEntry entry = getEntry(activeEntry);
+ return entry == null ? null : entry.location;
+ }
+
+ /**
+ * Disposes this NavigationHistory and all entries.
+ */
+ public void dispose() {
+ disposeHistoryForTabs();
+ Iterator e = history.iterator();
+ while (e.hasNext()) {
+ NavigationHistoryEntry entry = (NavigationHistoryEntry) e.next();
+ disposeEntry(entry);
+ }
+ }
+
+ /**
+ * Keeps a reference to the forward action to update its state whenever needed.
+ * <p>
+ * (Called by NavigationHistoryAction)
+ * </p>
+ */
+ void setForwardAction(NavigationHistoryAction action) {
+ forwardAction = action;
+ updateActions();
+ }
+
+ /**
+ * Keeps a reference to the backward action to update its state whenever needed.
+ * <p>
+ * (Called by NavigationHistoryAction)
+ * </p>
+ */
+ void setBackwardAction(NavigationHistoryAction action) {
+ backwardAction = action;
+ updateActions();
+ }
+
+ /*
+ * Returns the history entry indexed by <code>index</code>
+ */
+ private NavigationHistoryEntry getEntry(int index) {
+ if (0 <= index && index < history.size()) {
return (NavigationHistoryEntry) history.get(index);
}
- return null;
- }
-
- /*
- * Adds the specified entry to the history.
- */
- private void add(NavigationHistoryEntry entry) {
- removeForwardEntries();
- if (history.size() == CAPACITY) {
- NavigationHistoryEntry e = (NavigationHistoryEntry) history
- .remove(0);
- disposeEntry(e);
- }
- history.add(entry);
- activeEntry = history.size() - 1;
- }
-
- /*
- * Remove all entries after the active entry.
- */
- private void removeForwardEntries() {
- int length = history.size();
- for (int i = activeEntry + 1; i < length; i++) {
- NavigationHistoryEntry e = (NavigationHistoryEntry) history
- .remove(activeEntry + 1);
- disposeEntry(e);
- }
- }
-
- /*
- * Adds a location to the history.
- */
- private void addEntry(IEditorPart part) {
- if (ignoreEntries > 0 || part == null) {
+ return null;
+ }
+
+ /*
+ * Adds the specified entry to the history.
+ */
+ private void add(NavigationHistoryEntry entry) {
+ removeForwardEntries();
+ if (history.size() == CAPACITY) {
+ NavigationHistoryEntry e = (NavigationHistoryEntry) history.remove(0);
+ disposeEntry(e);
+ }
+ history.add(entry);
+ activeEntry = history.size() - 1;
+ }
+
+ /*
+ * Remove all entries after the active entry.
+ */
+ private void removeForwardEntries() {
+ int length = history.size();
+ for (int i = activeEntry + 1; i < length; i++) {
+ NavigationHistoryEntry e = (NavigationHistoryEntry) history.remove(activeEntry + 1);
+ disposeEntry(e);
+ }
+ }
+
+ /*
+ * Adds a location to the history.
+ */
+ private void addEntry(IEditorPart part) {
+ if (ignoreEntries > 0 || part == null) {
return;
}
- if (isPerTabHistoryEnabled()) {
- markLocationForTab(part);
- }
- INavigationLocation location = null;
- if (part instanceof INavigationLocationProvider) {
- location = ((INavigationLocationProvider) part)
- .createNavigationLocation();
- }
-
- NavigationHistoryEntry current = getEntry(activeEntry);
- if (current != null && current.editorInfo.memento != null) {
- current.editorInfo.restoreEditor();
- checkDuplicates(current.editorInfo);
- }
- NavigationHistoryEntry e = createEntry(page, part, location);
- if (current == null) {
- add(e);
- } else {
- if (e.mergeInto(current)) {
- disposeEntry(e);
- removeForwardEntries();
- } else {
- add(e);
- }
- }
- printEntries("added entry"); //$NON-NLS-1$
- updateActions();
- }
-
- /*
- * Prints all the entries in the console. For debug only.
- */
- private void printEntries(String label) {
- if (DEBUG) {
- System.out.println("+++++ " + label + "+++++ "); //$NON-NLS-1$ //$NON-NLS-2$
- int size = history.size();
- for (int i = 0; i < size; i++) {
- String append = activeEntry == i ? ">>" : ""; //$NON-NLS-1$ //$NON-NLS-2$
- System.out.println(append
- + "Index: " + i + " " + history.get(i)); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- }
-
- /*
- * Returns true if the forward action can be performed otherwise returns false.
- * <p>
- * (Called by NavigationHistoryAction)
- * </p>
- */
- /* package */boolean canForward() {
- if (isPerTabHistoryEnabled()) {
- return hasEntriesForTab(true);
- }
- return (0 <= activeEntry + 1) && (activeEntry + 1 < history.size());
- }
-
- /*
- * Returns true if the backward action can be performed otherwise returns false.
- * <p>
- * (Called by NavigationHistoryAction)
- * </p>
- */
- /* package */boolean canBackward() {
- if (isPerTabHistoryEnabled()) {
- return hasEntriesForTab(false);
- }
- return (0 <= activeEntry - 1) && (activeEntry - 1 < history.size());
- }
-
- /*
- * Update the actions enable/disable and tooltip state.
- */
- private void updateActions() {
- if (backwardAction != null) {
+ if (isPerTabHistoryEnabled()) {
+ markLocationForTab(part);
+ }
+ INavigationLocation location = null;
+ if (part instanceof INavigationLocationProvider) {
+ location = ((INavigationLocationProvider) part).createNavigationLocation();
+ }
+
+ NavigationHistoryEntry current = getEntry(activeEntry);
+ if (current != null && current.editorInfo.memento != null) {
+ current.editorInfo.restoreEditor();
+ checkDuplicates(current.editorInfo);
+ }
+ NavigationHistoryEntry e = createEntry(page, part, location);
+ if (current == null) {
+ add(e);
+ } else {
+ if (e.mergeInto(current)) {
+ disposeEntry(e);
+ removeForwardEntries();
+ } else {
+ add(e);
+ }
+ }
+ printEntries("added entry"); //$NON-NLS-1$
+ updateActions();
+ }
+
+ /*
+ * Prints all the entries in the console. For debug only.
+ */
+ private void printEntries(String label) {
+ if (DEBUG) {
+ System.out.println("+++++ " + label + "+++++ "); //$NON-NLS-1$ //$NON-NLS-2$
+ int size = history.size();
+ for (int i = 0; i < size; i++) {
+ String append = activeEntry == i ? ">>" : ""; //$NON-NLS-1$ //$NON-NLS-2$
+ System.out.println(append + "Index: " + i + " " + history.get(i)); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ }
+
+ /*
+ * Returns true if the forward action can be performed otherwise returns false.
+ * <p> (Called by NavigationHistoryAction) </p>
+ */
+ /* package */boolean canForward() {
+ if (isPerTabHistoryEnabled()) {
+ return hasEntriesForTab(true);
+ }
+ return (0 <= activeEntry + 1) && (activeEntry + 1 < history.size());
+ }
+
+ /*
+ * Returns true if the backward action can be performed otherwise returns false.
+ * <p> (Called by NavigationHistoryAction) </p>
+ */
+ /* package */boolean canBackward() {
+ if (isPerTabHistoryEnabled()) {
+ return hasEntriesForTab(false);
+ }
+ return (0 <= activeEntry - 1) && (activeEntry - 1 < history.size());
+ }
+
+ /*
+ * Update the actions enable/disable and tooltip state.
+ */
+ private void updateActions() {
+ if (backwardAction != null) {
backwardAction.update();
}
- if (forwardAction != null) {
+ if (forwardAction != null) {
forwardAction.update();
}
- }
+ }
- /*
- * Restore the specified entry
- */
- private void gotoEntry(NavigationHistoryEntry entry) {
- if (entry == null) {
+ /*
+ * Restore the specified entry
+ */
+ private void gotoEntry(NavigationHistoryEntry entry) {
+ if (entry == null) {
return;
}
- try {
- ignoreEntries++;
- if (entry.editorInfo.memento != null) {
- entry.editorInfo.restoreEditor();
- checkDuplicates(entry.editorInfo);
- }
- entry.restoreLocation();
- updateActions();
- printEntries("goto entry"); //$NON-NLS-1$
- } finally {
- ignoreEntries--;
- }
- }
-
- /*
- * update the active entry
- */
- private void updateEntry(NavigationHistoryEntry activeEntry) {
- if (activeEntry == null || activeEntry.location == null) {
+ try {
+ ignoreEntries++;
+ if (entry.editorInfo.memento != null) {
+ entry.editorInfo.restoreEditor();
+ checkDuplicates(entry.editorInfo);
+ }
+ entry.restoreLocation();
+ updateActions();
+ printEntries("goto entry"); //$NON-NLS-1$
+ } finally {
+ ignoreEntries--;
+ }
+ }
+
+ /*
+ * update the active entry
+ */
+ private void updateEntry(NavigationHistoryEntry activeEntry) {
+ if (activeEntry == null || activeEntry.location == null) {
return;
}
- activeEntry.location.update();
- printEntries("updateEntry"); //$NON-NLS-1$
- }
-
- /*
- * Perform the forward action by getting the next location and restoring
- * its context.
- * <p>
- * (Called by NavigationHistoryAction)
- * </p>
- */
- void forward() {
- if (isPerTabHistoryEnabled()) {
- forwardForTab();
- return;
- }
- if (canForward()) {
+ activeEntry.location.update();
+ printEntries("updateEntry"); //$NON-NLS-1$
+ }
+
+ /*
+ * Perform the forward action by getting the next location and restoring its
+ * context. <p> (Called by NavigationHistoryAction) </p>
+ */
+ void forward() {
+ if (isPerTabHistoryEnabled()) {
+ forwardForTab();
+ return;
+ }
+ if (canForward()) {
shiftEntry(true);
}
- }
-
- /*
- * Perform the backward action by getting the previous location and restoring
- * its context.
- * <p>
- * (Called by NavigationHistoryAction)
- * </p>
- */
- void backward() {
- if (isPerTabHistoryEnabled()) {
- backwardForTab();
- return;
- }
- if (canBackward()) {
+ }
+
+ /*
+ * Perform the backward action by getting the previous location and restoring
+ * its context. <p> (Called by NavigationHistoryAction) </p>
+ */
+ void backward() {
+ if (isPerTabHistoryEnabled()) {
+ backwardForTab();
+ return;
+ }
+ if (canBackward()) {
shiftEntry(false);
}
- }
+ }
- /*
- * Shift the history back or forward
- */
- private void shiftEntry(boolean forward) {
- updateEntry(getEntry(activeEntry));
- if (forward) {
+ /*
+ * Shift the history back or forward
+ */
+ private void shiftEntry(boolean forward) {
+ updateEntry(getEntry(activeEntry));
+ if (forward) {
activeEntry++;
} else {
activeEntry--;
}
- NavigationHistoryEntry entry = getEntry(activeEntry);
- if (entry != null) {
+ NavigationHistoryEntry entry = getEntry(activeEntry);
+ if (entry != null) {
gotoEntry(entry);
}
- }
-
- /*
- * Shift the history to the given entry.
- * <p>
- * (Called by NavigationHistoryAction)
- * </p>
- */
- void shiftCurrentEntry(NavigationHistoryEntry entry, boolean forward) {
- if (isPerTabHistoryEnabled()) {
- gotoEntryForTab(entry, forward);
- return;
- }
- updateEntry(getEntry(activeEntry));
- activeEntry = history.indexOf(entry);
- gotoEntry(entry);
- }
-
- /**
- * Save the state of this history into the memento.
- */
- void saveState(IMemento memento) {
- NavigationHistoryEntry cEntry = getEntry(activeEntry);
- if (cEntry == null || !cEntry.editorInfo.isPersistable()) {
+ }
+
+ /*
+ * Shift the history to the given entry. <p> (Called by NavigationHistoryAction)
+ * </p>
+ */
+ void shiftCurrentEntry(NavigationHistoryEntry entry, boolean forward) {
+ if (isPerTabHistoryEnabled()) {
+ gotoEntryForTab(entry, forward);
return;
}
+ updateEntry(getEntry(activeEntry));
+ activeEntry = history.indexOf(entry);
+ gotoEntry(entry);
+ }
- ArrayList editors = (ArrayList) this.editors.clone();
- for (Iterator iter = editors.iterator(); iter.hasNext();) {
- NavigationHistoryEditorInfo info = (NavigationHistoryEditorInfo) iter
- .next();
- if (!info.isPersistable()) {
+ /**
+ * Save the state of this history into the memento.
+ */
+ void saveState(IMemento memento) {
+ NavigationHistoryEntry cEntry = getEntry(activeEntry);
+ if (cEntry == null || !cEntry.editorInfo.isPersistable()) {
+ return;
+ }
+
+ ArrayList editors = (ArrayList) this.editors.clone();
+ for (Iterator iter = editors.iterator(); iter.hasNext();) {
+ NavigationHistoryEditorInfo info = (NavigationHistoryEditorInfo) iter.next();
+ if (!info.isPersistable()) {
iter.remove();
}
- }
- IMemento editorsMem = memento
- .createChild(IWorkbenchConstants.TAG_EDITORS);
- for (Iterator iter = editors.iterator(); iter.hasNext();) {
- NavigationHistoryEditorInfo info = (NavigationHistoryEditorInfo) iter
- .next();
- info.saveState(editorsMem
- .createChild(IWorkbenchConstants.TAG_EDITOR));
- }
-
- ArrayList list = new ArrayList(history.size());
- int size = history.size();
- for (int i = 0; i < size; i++) {
- NavigationHistoryEntry entry = (NavigationHistoryEntry) history
- .get(i);
- if (entry.editorInfo.isPersistable()) {
+ }
+ IMemento editorsMem = memento.createChild(IWorkbenchConstants.TAG_EDITORS);
+ for (Iterator iter = editors.iterator(); iter.hasNext();) {
+ NavigationHistoryEditorInfo info = (NavigationHistoryEditorInfo) iter.next();
+ info.saveState(editorsMem.createChild(IWorkbenchConstants.TAG_EDITOR));
+ }
+
+ ArrayList list = new ArrayList(history.size());
+ int size = history.size();
+ for (int i = 0; i < size; i++) {
+ NavigationHistoryEntry entry = (NavigationHistoryEntry) history.get(i);
+ if (entry.editorInfo.isPersistable()) {
list.add(entry);
}
- }
- size = list.size();
- for (int i = 0; i < size; i++) {
- NavigationHistoryEntry entry = (NavigationHistoryEntry) list.get(i);
- IMemento childMem = memento
- .createChild(IWorkbenchConstants.TAG_ITEM);
- if (entry == cEntry) {
+ }
+ size = list.size();
+ for (int i = 0; i < size; i++) {
+ NavigationHistoryEntry entry = (NavigationHistoryEntry) list.get(i);
+ IMemento childMem = memento.createChild(IWorkbenchConstants.TAG_ITEM);
+ if (entry == cEntry) {
childMem.putString(IWorkbenchConstants.TAG_ACTIVE, "true"); //$NON-NLS-1$
}
- entry.saveState(childMem, list);
- childMem.putInteger(IWorkbenchConstants.TAG_INDEX, editors
- .indexOf(entry.editorInfo));
- }
- }
-
- /**
- * Restore the state of this history from the memento.
- */
- void restoreState(IMemento memento) {
- IMemento editorsMem = memento.getChild(IWorkbenchConstants.TAG_EDITORS);
- IMemento items[] = memento.getChildren(IWorkbenchConstants.TAG_ITEM);
- if (items.length == 0 || editorsMem == null) {
- if (page.getActiveEditor() != null) {
+ entry.saveState(childMem, list);
+ childMem.putInteger(IWorkbenchConstants.TAG_INDEX, editors.indexOf(entry.editorInfo));
+ }
+ }
+
+ /**
+ * Restore the state of this history from the memento.
+ */
+ void restoreState(IMemento memento) {
+ IMemento editorsMem = memento.getChild(IWorkbenchConstants.TAG_EDITORS);
+ IMemento items[] = memento.getChildren(IWorkbenchConstants.TAG_ITEM);
+ if (items.length == 0 || editorsMem == null) {
+ if (page.getActiveEditor() != null) {
markLocation(page.getActiveEditor());
}
- return;
- }
-
- IMemento children[] = editorsMem
- .getChildren(IWorkbenchConstants.TAG_EDITOR);
- NavigationHistoryEditorInfo editorsInfo[] = new NavigationHistoryEditorInfo[children.length];
- for (int i = 0; i < editorsInfo.length; i++) {
- editorsInfo[i] = new NavigationHistoryEditorInfo(children[i]);
- editors.add(editorsInfo[i]);
- }
-
- for (int i = 0; i < items.length; i++) {
- IMemento item = items[i];
- int index = item.getInteger(IWorkbenchConstants.TAG_INDEX)
- .intValue();
- NavigationHistoryEditorInfo info = editorsInfo[index];
- info.refCount++;
- NavigationHistoryEntry entry = new NavigationHistoryEntry(info,
- page, null, null);
- history.add(entry);
- entry.restoreState(item);
- if (item.getString(IWorkbenchConstants.TAG_ACTIVE) != null) {
+ return;
+ }
+
+ IMemento children[] = editorsMem.getChildren(IWorkbenchConstants.TAG_EDITOR);
+ NavigationHistoryEditorInfo editorsInfo[] = new NavigationHistoryEditorInfo[children.length];
+ for (int i = 0; i < editorsInfo.length; i++) {
+ editorsInfo[i] = new NavigationHistoryEditorInfo(children[i]);
+ editors.add(editorsInfo[i]);
+ }
+
+ for (int i = 0; i < items.length; i++) {
+ IMemento item = items[i];
+ int index = item.getInteger(IWorkbenchConstants.TAG_INDEX).intValue();
+ NavigationHistoryEditorInfo info = editorsInfo[index];
+ info.refCount++;
+ NavigationHistoryEntry entry = new NavigationHistoryEntry(info, page, null, null);
+ history.add(entry);
+ entry.restoreState(item);
+ if (item.getString(IWorkbenchConstants.TAG_ACTIVE) != null) {
activeEntry = i;
}
- }
+ }
- final NavigationHistoryEntry entry = getEntry(activeEntry);
- if (entry != null && entry.editorInfo.editorInput != null) {
- if (page.getActiveEditor() == page
- .findEditor(entry.editorInfo.editorInput)) {
- StartupThreading.runWithoutExceptions(new StartupRunnable() {
+ final NavigationHistoryEntry entry = getEntry(activeEntry);
+ if (entry != null && entry.editorInfo.editorInput != null) {
+ if (page.getActiveEditor() == page.findEditor(entry.editorInfo.editorInput)) {
+ StartupThreading.runWithoutExceptions(new StartupRunnable() {
@Override
public void runWithException() throws Throwable {
gotoEntry(entry);
- }});
- }
- }
- }
-
- public NavigationHistoryEntry createEntry(IWorkbenchPage page,
- IEditorPart part, INavigationLocation location) {
- String editorID = part.getSite().getId();
- IEditorInput editorInput = part.getEditorInput();
- NavigationHistoryEditorInfo info = null;
- for (Iterator iter = editors.iterator(); iter.hasNext();) {
- info = (NavigationHistoryEditorInfo) iter.next();
- if (editorID.equals(info.editorID)
- && editorInput.equals(info.editorInput)) {
- info.refCount++;
- break;
- }
- info= null;
- }
- if (info == null) {
- info = new NavigationHistoryEditorInfo(part);
- info.refCount++;
- editors.add(info);
- }
- return new NavigationHistoryEntry(info, page, part, location);
- }
-
- public void disposeEntry(NavigationHistoryEntry entry) {
- if (entry.editorInfo == null) {
+ }
+ });
+ }
+ }
+ }
+
+ public NavigationHistoryEntry createEntry(IWorkbenchPage page, IEditorPart part, INavigationLocation location) {
+ String editorID = part.getSite().getId();
+ IEditorInput editorInput = part.getEditorInput();
+ NavigationHistoryEditorInfo info = null;
+ for (Iterator iter = editors.iterator(); iter.hasNext();) {
+ info = (NavigationHistoryEditorInfo) iter.next();
+ if (editorID.equals(info.editorID) && editorInput.equals(info.editorInput)) {
+ info.refCount++;
+ break;
+ }
+ info = null;
+ }
+ if (info == null) {
+ info = new NavigationHistoryEditorInfo(part);
+ info.refCount++;
+ editors.add(info);
+ }
+ return new NavigationHistoryEntry(info, page, part, location);
+ }
+
+ public void disposeEntry(NavigationHistoryEntry entry) {
+ if (entry.editorInfo == null) {
return;
}
- entry.editorInfo.refCount--;
- if (entry.editorInfo.refCount == 0) {
+ entry.editorInfo.refCount--;
+ if (entry.editorInfo.refCount == 0) {
editors.remove(entry.editorInfo);
}
- entry.dispose();
- }
+ entry.dispose();
+ }
- void checkDuplicates(NavigationHistoryEditorInfo info) {
- NavigationHistoryEditorInfo dup = null;
- if (info.editorInput == null) {
+ void checkDuplicates(NavigationHistoryEditorInfo info) {
+ NavigationHistoryEditorInfo dup = null;
+ if (info.editorInput == null) {
return;
}
- for (Iterator iter = editors.iterator(); iter.hasNext();) {
- dup = (NavigationHistoryEditorInfo) iter.next();
- if (info != dup && info.editorID.equals(dup.editorID)
- && info.editorInput.equals(dup.editorInput)) {
+ for (Iterator iter = editors.iterator(); iter.hasNext();) {
+ dup = (NavigationHistoryEditorInfo) iter.next();
+ if (info != dup && info.editorID.equals(dup.editorID) && info.editorInput.equals(dup.editorInput)) {
break;
}
- dup= null;
- }
- if (dup == null) {
+ dup = null;
+ }
+ if (dup == null) {
return;
}
- for (Iterator iter = history.iterator(); iter.hasNext();) {
- NavigationHistoryEntry entry = (NavigationHistoryEntry) iter.next();
- if (entry.editorInfo == dup) {
- entry.editorInfo = info;
- info.refCount++;
- }
- }
- editors.remove(dup);
- }
-
- /*********************************************************/
- /*** new per-tab history code ***/
- /*********************************************************/
-
-
- private static class PerTabHistory {
- LinkedList backwardEntries = new LinkedList();
- NavigationHistoryEntry currentEntry = null;
- LinkedList forwardEntries = new LinkedList();
- }
-
- private void setNewCurrentEntryForTab(PerTabHistory perTabHistory, NavigationHistoryEntry entry) {
- if (perTabHistory.currentEntry != null) {
- perTabHistory.backwardEntries.addFirst(perTabHistory.currentEntry);
- }
- perTabHistory.currentEntry = entry;
- removeEntriesForTab(perTabHistory.forwardEntries);
- }
-
- private Object getCookieForTab(IEditorPart part) {
- if (part != null) {
- IWorkbenchPartSite site = part.getSite();
- if (site instanceof PartSite) {
- PartSite partSite = (PartSite) site;
- WorkbenchPartReference ref = (WorkbenchPartReference) partSite.getPartReference();
- if (!ref.isDisposed()) {
+ for (Iterator iter = history.iterator(); iter.hasNext();) {
+ NavigationHistoryEntry entry = (NavigationHistoryEntry) iter.next();
+ if (entry.editorInfo == dup) {
+ entry.editorInfo = info;
+ info.refCount++;
+ }
+ }
+ editors.remove(dup);
+ }
+
+ /*********************************************************/
+ /*** new per-tab history code ***/
+ /*********************************************************/
+
+ private static class PerTabHistory {
+ LinkedList backwardEntries = new LinkedList();
+ NavigationHistoryEntry currentEntry = null;
+ LinkedList forwardEntries = new LinkedList();
+ }
+
+ private void setNewCurrentEntryForTab(PerTabHistory perTabHistory, NavigationHistoryEntry entry) {
+ if (perTabHistory.currentEntry != null) {
+ perTabHistory.backwardEntries.addFirst(perTabHistory.currentEntry);
+ }
+ perTabHistory.currentEntry = entry;
+ removeEntriesForTab(perTabHistory.forwardEntries);
+ }
+
+ private Object getCookieForTab(IEditorPart part) {
+ if (part != null) {
+ IWorkbenchPartSite site = part.getSite();
+ if (site instanceof PartSite) {
+ PartSite partSite = (PartSite) site;
+ WorkbenchPartReference ref = (WorkbenchPartReference) partSite.getPartReference();
+ if (!ref.isDisposed()) {
return partSite.getModel().getWidget();
- }
- }
- }
- return null;
- }
-
- private void markLocationForTab(IEditorPart part) {
- if (part instanceof ErrorEditorPart) {
- updateActions();
- return;
- }
+ }
+ }
+ }
+ return null;
+ }
+
+ private void markLocationForTab(IEditorPart part) {
+ if (part instanceof ErrorEditorPart) {
+ updateActions();
+ return;
+ }
Object tabCookie = getCookieForTab(part);
if (tabCookie != null) {
INavigationLocation location = null;
if (part instanceof INavigationLocationProvider) {
- location = ((INavigationLocationProvider) part)
- .createNavigationLocation();
+ location = ((INavigationLocationProvider) part).createNavigationLocation();
}
- PerTabHistory perTabHistory = (PerTabHistory) perTabHistoryMap
- .get(tabCookie);
+ PerTabHistory perTabHistory = (PerTabHistory) perTabHistoryMap.get(tabCookie);
if (perTabHistory == null) {
perTabHistory = new PerTabHistory();
perTabHistoryMap.put(tabCookie, perTabHistory);
@@ -759,23 +719,23 @@ public class NavigationHistory implements INavigationHistory {
updateActions();
}
- public void updateCookieForTab(Object oldCookie, Object newCookie) {
- if (newCookie.equals(oldCookie)) {
- return;
- }
- PerTabHistory perTabHistory = (PerTabHistory) perTabHistoryMap.remove(oldCookie);
- if (perTabHistory != null) {
- perTabHistoryMap.put(newCookie, perTabHistory);
- }
- }
-
- private void gotoEntryForTab(NavigationHistoryEntry target, boolean forward) {
- Object editorTabCookie = getCookieForTab(page.getActiveEditor());
- if (editorTabCookie!=null) {
- PerTabHistory perTabHistory = (PerTabHistory) perTabHistoryMap.get(editorTabCookie);
- if (perTabHistory != null) {
- LinkedList source = forward ? perTabHistory.forwardEntries : perTabHistory.backwardEntries;
- LinkedList destination = forward ? perTabHistory.backwardEntries : perTabHistory.forwardEntries;
+ public void updateCookieForTab(Object oldCookie, Object newCookie) {
+ if (newCookie.equals(oldCookie)) {
+ return;
+ }
+ PerTabHistory perTabHistory = (PerTabHistory) perTabHistoryMap.remove(oldCookie);
+ if (perTabHistory != null) {
+ perTabHistoryMap.put(newCookie, perTabHistory);
+ }
+ }
+
+ private void gotoEntryForTab(NavigationHistoryEntry target, boolean forward) {
+ Object editorTabCookie = getCookieForTab(page.getActiveEditor());
+ if (editorTabCookie != null) {
+ PerTabHistory perTabHistory = (PerTabHistory) perTabHistoryMap.get(editorTabCookie);
+ if (perTabHistory != null) {
+ LinkedList source = forward ? perTabHistory.forwardEntries : perTabHistory.backwardEntries;
+ LinkedList destination = forward ? perTabHistory.backwardEntries : perTabHistory.forwardEntries;
if (perTabHistory.currentEntry != null) {
if (perTabHistory.currentEntry.location != null) {
perTabHistory.currentEntry.location.update();
@@ -783,140 +743,136 @@ public class NavigationHistory implements INavigationHistory {
destination.addFirst(perTabHistory.currentEntry);
}
NavigationHistoryEntry newCurrent = null;
- while (!source.isEmpty() && newCurrent==null) {
- NavigationHistoryEntry entry = (NavigationHistoryEntry) source
- .removeFirst();
- if (entry.equals(target)) {
- newCurrent = entry;
- } else {
- destination.addFirst(entry);
- }
- }
- Assert.isTrue(newCurrent != null);
- perTabHistory.currentEntry = newCurrent;
- try {
- ignoreEntries++;
- if (newCurrent.editorInfo.memento != null) {
- newCurrent.editorInfo.restoreEditor();
- checkDuplicates(newCurrent.editorInfo);
- }
- newCurrent.restoreLocation();
- updateActions();
- } finally {
- ignoreEntries--;
- }
- }
- }
- }
+ while (!source.isEmpty() && newCurrent == null) {
+ NavigationHistoryEntry entry = (NavigationHistoryEntry) source.removeFirst();
+ if (entry.equals(target)) {
+ newCurrent = entry;
+ } else {
+ destination.addFirst(entry);
+ }
+ }
+ Assert.isTrue(newCurrent != null);
+ perTabHistory.currentEntry = newCurrent;
+ try {
+ ignoreEntries++;
+ if (newCurrent.editorInfo.memento != null) {
+ newCurrent.editorInfo.restoreEditor();
+ checkDuplicates(newCurrent.editorInfo);
+ }
+ newCurrent.restoreLocation();
+ updateActions();
+ } finally {
+ ignoreEntries--;
+ }
+ }
+ }
+ }
private void forwardForTab() {
- Object editorTabCookie = getCookieForTab(page.getActiveEditor());
- if (editorTabCookie!=null) {
- PerTabHistory perTabHistory = (PerTabHistory) perTabHistoryMap.get(editorTabCookie);
- if (perTabHistory != null && !perTabHistory.forwardEntries.isEmpty()) {
- NavigationHistoryEntry newCurrent = (NavigationHistoryEntry) perTabHistory.forwardEntries
+ Object editorTabCookie = getCookieForTab(page.getActiveEditor());
+ if (editorTabCookie != null) {
+ PerTabHistory perTabHistory = (PerTabHistory) perTabHistoryMap.get(editorTabCookie);
+ if (perTabHistory != null && !perTabHistory.forwardEntries.isEmpty()) {
+ NavigationHistoryEntry newCurrent = (NavigationHistoryEntry) perTabHistory.forwardEntries.removeFirst();
+ if (perTabHistory.currentEntry != null) {
+ final INavigationLocation location = perTabHistory.currentEntry.location;
+ if (location != null) {
+ location.update();
+ }
+ perTabHistory.backwardEntries.addFirst(perTabHistory.currentEntry);
+ }
+ perTabHistory.currentEntry = newCurrent;
+ try {
+ ignoreEntries++;
+ if (newCurrent.editorInfo.memento != null) {
+ newCurrent.editorInfo.restoreEditor();
+ checkDuplicates(newCurrent.editorInfo);
+ }
+ newCurrent.restoreLocation();
+ updateActions();
+ } finally {
+ ignoreEntries--;
+ }
+ }
+ }
+ }
+
+ private void backwardForTab() {
+ Object editorTabCookie = getCookieForTab(page.getActiveEditor());
+ if (editorTabCookie != null) {
+ PerTabHistory perTabHistory = (PerTabHistory) perTabHistoryMap.get(editorTabCookie);
+ if (perTabHistory != null && !perTabHistory.backwardEntries.isEmpty()) {
+ NavigationHistoryEntry newCurrent = (NavigationHistoryEntry) perTabHistory.backwardEntries
.removeFirst();
- if (perTabHistory.currentEntry != null) {
- final INavigationLocation location = perTabHistory.currentEntry.location;
- if (location!=null) {
- location.update();
- }
- perTabHistory.backwardEntries.addFirst(perTabHistory.currentEntry);
- }
- perTabHistory.currentEntry = newCurrent;
- try {
- ignoreEntries++;
- if (newCurrent.editorInfo.memento != null) {
- newCurrent.editorInfo.restoreEditor();
- checkDuplicates(newCurrent.editorInfo);
- }
- newCurrent.restoreLocation();
- updateActions();
- } finally {
- ignoreEntries--;
- }
- }
- }
- }
-
- private void backwardForTab() {
- Object editorTabCookie = getCookieForTab(page.getActiveEditor());
- if (editorTabCookie!=null) {
- PerTabHistory perTabHistory = (PerTabHistory) perTabHistoryMap.get(editorTabCookie);
- if (perTabHistory != null && !perTabHistory.backwardEntries.isEmpty()) {
- NavigationHistoryEntry newCurrent = (NavigationHistoryEntry) perTabHistory.backwardEntries
- .removeFirst();
- if (perTabHistory.currentEntry != null) {
- perTabHistory.currentEntry.location.update();
- perTabHistory.forwardEntries.addFirst(perTabHistory.currentEntry);
- }
- perTabHistory.currentEntry = newCurrent;
- try {
- ignoreEntries++;
- if (newCurrent.editorInfo.memento != null) {
- newCurrent.editorInfo.restoreEditor();
- checkDuplicates(newCurrent.editorInfo);
- }
- newCurrent.restoreLocation();
- updateActions();
- } finally {
- ignoreEntries--;
- }
- }
- }
- }
-
- private boolean hasEntriesForTab(boolean forward) {
- Object editorTabCookie = getCookieForTab(page.getActiveEditor());
- if (editorTabCookie!=null) {
- PerTabHistory perTabHistory = (PerTabHistory) perTabHistoryMap.get(editorTabCookie);
- if (perTabHistory != null) {
- LinkedList entries = forward ? perTabHistory.forwardEntries : perTabHistory.backwardEntries;
- return !entries.isEmpty();
- }
- }
- return false;
- }
+ if (perTabHistory.currentEntry != null) {
+ perTabHistory.currentEntry.location.update();
+ perTabHistory.forwardEntries.addFirst(perTabHistory.currentEntry);
+ }
+ perTabHistory.currentEntry = newCurrent;
+ try {
+ ignoreEntries++;
+ if (newCurrent.editorInfo.memento != null) {
+ newCurrent.editorInfo.restoreEditor();
+ checkDuplicates(newCurrent.editorInfo);
+ }
+ newCurrent.restoreLocation();
+ updateActions();
+ } finally {
+ ignoreEntries--;
+ }
+ }
+ }
+ }
+
+ private boolean hasEntriesForTab(boolean forward) {
+ Object editorTabCookie = getCookieForTab(page.getActiveEditor());
+ if (editorTabCookie != null) {
+ PerTabHistory perTabHistory = (PerTabHistory) perTabHistoryMap.get(editorTabCookie);
+ if (perTabHistory != null) {
+ LinkedList entries = forward ? perTabHistory.forwardEntries : perTabHistory.backwardEntries;
+ return !entries.isEmpty();
+ }
+ }
+ return false;
+ }
/**
* Returns entries in restore order.
*
- * @param forward <code>true</code> for forward and <code>false</code> for backward history
+ * @param forward <code>true</code> for forward and <code>false</code> for
+ * backward history
* @return the navigation history entries
*/
- private NavigationHistoryEntry[] getEntriesForTab(boolean forward) {
+ private NavigationHistoryEntry[] getEntriesForTab(boolean forward) {
Object editorTabCookie = getCookieForTab(page.getActiveEditor());
if (editorTabCookie != null) {
- PerTabHistory perTabHistory = (PerTabHistory) perTabHistoryMap
- .get(editorTabCookie);
+ PerTabHistory perTabHistory = (PerTabHistory) perTabHistoryMap.get(editorTabCookie);
if (perTabHistory != null) {
- LinkedList entries = forward ? perTabHistory.forwardEntries
- : perTabHistory.backwardEntries;
- return (NavigationHistoryEntry[]) entries
- .toArray(new NavigationHistoryEntry[entries.size()]);
+ LinkedList entries = forward ? perTabHistory.forwardEntries : perTabHistory.backwardEntries;
+ return (NavigationHistoryEntry[]) entries.toArray(new NavigationHistoryEntry[entries.size()]);
}
}
return new NavigationHistoryEntry[0];
}
- private void disposeHistoryForTabs() {
- Object[] keys = perTabHistoryMap.keySet().toArray();
- for (Object key : keys) {
+ private void disposeHistoryForTabs() {
+ Object[] keys = perTabHistoryMap.keySet().toArray();
+ for (Object key : keys) {
disposeHistoryForTab(key);
}
- }
+ }
- void disposeHistoryForTab(Object editorTabCookie) {
- PerTabHistory perTabHistory = (PerTabHistory) perTabHistoryMap.remove(editorTabCookie);
- if (perTabHistory != null) {
- if (perTabHistory.currentEntry != null) {
- disposeEntry(perTabHistory.currentEntry);
- perTabHistory.currentEntry = null;
- }
- removeEntriesForTab(perTabHistory.backwardEntries);
- removeEntriesForTab(perTabHistory.forwardEntries);
- }
- }
+ void disposeHistoryForTab(Object editorTabCookie) {
+ PerTabHistory perTabHistory = (PerTabHistory) perTabHistoryMap.remove(editorTabCookie);
+ if (perTabHistory != null) {
+ if (perTabHistory.currentEntry != null) {
+ disposeEntry(perTabHistory.currentEntry);
+ perTabHistory.currentEntry = null;
+ }
+ removeEntriesForTab(perTabHistory.backwardEntries);
+ removeEntriesForTab(perTabHistory.forwardEntries);
+ }
+ }
private void removeEntriesForTab(LinkedList entries) {
for (Iterator it = entries.iterator(); it.hasNext();) {
@@ -927,19 +883,19 @@ public class NavigationHistory implements INavigationHistory {
}
public boolean updateActive(IEditorPart editor) {
- NavigationHistoryEntry e = getEntry(activeEntry);
- if (e == null)
- return false;
- // 1) check if editor ID matches
- IWorkbenchPartSite site = editor.getSite();
- if (site == null) // might happen if site has not being initialized yet
- return false;
- String editorID = site.getId();
- if (editorID == null) // should not happen for an editor
- return false;
- if (!editorID.equals(e.editorInfo.editorID))
- return false;
- // 2) check that input matches
+ NavigationHistoryEntry e = getEntry(activeEntry);
+ if (e == null)
+ return false;
+ // 1) check if editor ID matches
+ IWorkbenchPartSite site = editor.getSite();
+ if (site == null) // might happen if site has not being initialized yet
+ return false;
+ String editorID = site.getId();
+ if (editorID == null) // should not happen for an editor
+ return false;
+ if (!editorID.equals(e.editorInfo.editorID))
+ return false;
+ // 2) check that input matches
IEditorInput input = editor.getEditorInput();
if (input == null)
return false;
@@ -947,5 +903,5 @@ public class NavigationHistory implements INavigationHistory {
return false;
updateEntry(e);
return true;
- }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NavigationHistoryAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NavigationHistoryAction.java
index 32f481be98d..31c27720e6c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NavigationHistoryAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NavigationHistoryAction.java
@@ -32,8 +32,8 @@ import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
/**
- * The <code>NavigationHistoryAction</code> moves navigation history
- * back and forward.
+ * The <code>NavigationHistoryAction</code> moves navigation history back and
+ * forward.
*/
public class NavigationHistoryAction extends PageEventAction {
@@ -41,42 +41,42 @@ public class NavigationHistoryAction extends PageEventAction {
private boolean forward;
- private Menu historyMenu;
+ private Menu historyMenu;
- private int MAX_HISTORY_LENGTH = 9;
+ private int MAX_HISTORY_LENGTH = 9;
- private class MenuCreator implements IMenuCreator {
- @Override
+ private class MenuCreator implements IMenuCreator {
+ @Override
public void dispose() {
- }
+ }
- @Override
+ @Override
public Menu getMenu(Menu parent) {
- setMenu(new Menu(parent));
- fillMenu(historyMenu);
- initMenu();
- return historyMenu;
- }
+ setMenu(new Menu(parent));
+ fillMenu(historyMenu);
+ initMenu();
+ return historyMenu;
+ }
- @Override
+ @Override
public Menu getMenu(Control parent) {
- setMenu(new Menu(parent));
- fillMenu(historyMenu);
- initMenu();
- return historyMenu;
- }
+ setMenu(new Menu(parent));
+ fillMenu(historyMenu);
+ initMenu();
+ return historyMenu;
+ }
- }
+ }
- private void setMenu(Menu menu) {
- historyMenu = menu;
- }
+ private void setMenu(Menu menu) {
+ historyMenu = menu;
+ }
- private void initMenu() {
- historyMenu.addMenuListener(new MenuAdapter() {
- @Override
+ private void initMenu() {
+ historyMenu.addMenuListener(new MenuAdapter() {
+ @Override
public void menuShown(MenuEvent e) {
- if (recreateMenu) {
+ if (recreateMenu) {
Menu m = (Menu) e.widget;
MenuItem[] items = m.getItems();
for (MenuItem item : items) {
@@ -85,183 +85,180 @@ public class NavigationHistoryAction extends PageEventAction {
fillMenu(m);
}
}
- });
- }
+ });
+ }
- private void fillMenu(Menu menu) {
- IWorkbenchPage page = getWorkbenchWindow().getActivePage();
- if (page == null) {
- return;
- }
+ private void fillMenu(Menu menu) {
+ IWorkbenchPage page = getWorkbenchWindow().getActivePage();
+ if (page == null) {
+ return;
+ }
- final NavigationHistory history = (NavigationHistory) getWorkbenchWindow()
- .getActivePage().getNavigationHistory();
- NavigationHistoryEntry[] entries;
- if (forward) {
- entries = history.getForwardEntries();
- } else {
- entries = history.getBackwardEntries();
- }
- int entriesCount[] = new int[entries.length];
- for (int i = 0; i < entriesCount.length; i++) {
- entriesCount[i] = 1;
- }
- entries = collapseEntries(entries, entriesCount);
- for (int i = 0; i < entries.length; i++) {
- if (i > MAX_HISTORY_LENGTH) {
- break;
- }
- String text = entries[i].getHistoryText();
- if (text != null) {
- MenuItem item = new MenuItem(menu, SWT.NONE);
- item.setData(entries[i]);
- if (entriesCount[i] > 1) {
+ final NavigationHistory history = (NavigationHistory) getWorkbenchWindow().getActivePage()
+ .getNavigationHistory();
+ NavigationHistoryEntry[] entries;
+ if (forward) {
+ entries = history.getForwardEntries();
+ } else {
+ entries = history.getBackwardEntries();
+ }
+ int entriesCount[] = new int[entries.length];
+ for (int i = 0; i < entriesCount.length; i++) {
+ entriesCount[i] = 1;
+ }
+ entries = collapseEntries(entries, entriesCount);
+ for (int i = 0; i < entries.length; i++) {
+ if (i > MAX_HISTORY_LENGTH) {
+ break;
+ }
+ String text = entries[i].getHistoryText();
+ if (text != null) {
+ MenuItem item = new MenuItem(menu, SWT.NONE);
+ item.setData(entries[i]);
+ if (entriesCount[i] > 1) {
text = NLS.bind(WorkbenchMessages.NavigationHistoryAction_locations, text,
Integer.valueOf(entriesCount[i]));
- }
- item.setText(text);
+ }
+ item.setText(text);
item.addSelectionListener(widgetSelectedAdapter(
e -> history.shiftCurrentEntry((NavigationHistoryEntry) e.widget.getData(), forward)));
- }
- }
- recreateMenu = false;
- }
+ }
+ }
+ recreateMenu = false;
+ }
- @Override
+ @Override
public void dispose() {
- super.dispose();
- if (historyMenu != null) {
- for (int i = 0; i < historyMenu.getItemCount(); i++) {
- MenuItem menuItem = historyMenu.getItem(i);
- menuItem.dispose();
- }
- historyMenu.dispose();
- historyMenu = null;
- }
- }
+ super.dispose();
+ if (historyMenu != null) {
+ for (int i = 0; i < historyMenu.getItemCount(); i++) {
+ MenuItem menuItem = historyMenu.getItem(i);
+ menuItem.dispose();
+ }
+ historyMenu.dispose();
+ historyMenu = null;
+ }
+ }
- /**
+ /**
* Create a new instance of <code>NavigationHistoryAction</code>
*
- * @param window
- * the workbench window this action applies to
- * @param forward
- * if this action should move history forward of backward
+ * @param window the workbench window this action applies to
+ * @param forward if this action should move history forward of backward
*/
- public NavigationHistoryAction(IWorkbenchWindow window, boolean forward) {
- super("", window); //$NON-NLS-1$
- ISharedImages sharedImages = window.getWorkbench().getSharedImages();
- if (forward) {
- setText(WorkbenchMessages.NavigationHistoryAction_forward_text);
- setToolTipText(WorkbenchMessages.NavigationHistoryAction_forward_toolTip);
- window.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.NAVIGATION_HISTORY_FORWARD);
- setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD));
- setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD_DISABLED));
- setActionDefinitionId(IWorkbenchCommandConstants.NAVIGATE_FORWARD_HISTORY);
- } else {
- setText(WorkbenchMessages.NavigationHistoryAction_backward_text);
- setToolTipText(WorkbenchMessages.NavigationHistoryAction_backward_toolTip);
- window.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.NAVIGATION_HISTORY_BACKWARD);
- setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_BACK));
- setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_BACK_DISABLED));
- setActionDefinitionId(IWorkbenchCommandConstants.NAVIGATE_BACKWARD_HISTORY);
- }
- setEnabled(false);
- this.forward = forward;
- setMenuCreator(new MenuCreator());
- }
+ public NavigationHistoryAction(IWorkbenchWindow window, boolean forward) {
+ super("", window); //$NON-NLS-1$
+ ISharedImages sharedImages = window.getWorkbench().getSharedImages();
+ if (forward) {
+ setText(WorkbenchMessages.NavigationHistoryAction_forward_text);
+ setToolTipText(WorkbenchMessages.NavigationHistoryAction_forward_toolTip);
+ window.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.NAVIGATION_HISTORY_FORWARD);
+ setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD));
+ setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD_DISABLED));
+ setActionDefinitionId(IWorkbenchCommandConstants.NAVIGATE_FORWARD_HISTORY);
+ } else {
+ setText(WorkbenchMessages.NavigationHistoryAction_backward_text);
+ setToolTipText(WorkbenchMessages.NavigationHistoryAction_backward_toolTip);
+ window.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.NAVIGATION_HISTORY_BACKWARD);
+ setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_BACK));
+ setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_BACK_DISABLED));
+ setActionDefinitionId(IWorkbenchCommandConstants.NAVIGATE_BACKWARD_HISTORY);
+ }
+ setEnabled(false);
+ this.forward = forward;
+ setMenuCreator(new MenuCreator());
+ }
- @Override
+ @Override
public void pageClosed(IWorkbenchPage page) {
- super.pageClosed(page);
- setEnabled(false);
- }
+ super.pageClosed(page);
+ setEnabled(false);
+ }
- private NavigationHistoryEntry[] collapseEntries(
- NavigationHistoryEntry[] entries, int entriesCount[]) {
+ private NavigationHistoryEntry[] collapseEntries(NavigationHistoryEntry[] entries, int entriesCount[]) {
ArrayList<NavigationHistoryEntry> allEntries = new ArrayList<>(Arrays.asList(entries));
- NavigationHistoryEntry previousEntry = null;
- int i = -1;
- for (Iterator<NavigationHistoryEntry> iter = allEntries.iterator(); iter.hasNext();) {
- NavigationHistoryEntry entry = iter.next();
- if (previousEntry != null) {
- String text = previousEntry.getHistoryText();
- if (text != null) {
- if (text.equals(entry.getHistoryText())
- && previousEntry.editorInfo == entry.editorInfo) {
- iter.remove();
- entriesCount[i]++;
- continue;
- }
- }
- }
- previousEntry = entry;
- i++;
- }
- entries = new NavigationHistoryEntry[allEntries.size()];
- return allEntries.toArray(entries);
- }
+ NavigationHistoryEntry previousEntry = null;
+ int i = -1;
+ for (Iterator<NavigationHistoryEntry> iter = allEntries.iterator(); iter.hasNext();) {
+ NavigationHistoryEntry entry = iter.next();
+ if (previousEntry != null) {
+ String text = previousEntry.getHistoryText();
+ if (text != null) {
+ if (text.equals(entry.getHistoryText()) && previousEntry.editorInfo == entry.editorInfo) {
+ iter.remove();
+ entriesCount[i]++;
+ continue;
+ }
+ }
+ }
+ previousEntry = entry;
+ i++;
+ }
+ entries = new NavigationHistoryEntry[allEntries.size()];
+ return allEntries.toArray(entries);
+ }
- @Override
+ @Override
public void pageActivated(IWorkbenchPage page) {
- super.pageActivated(page);
- NavigationHistory nh = (NavigationHistory) page.getNavigationHistory();
- if (forward) {
- nh.setForwardAction(this);
- } else {
- nh.setBackwardAction(this);
- }
- }
+ super.pageActivated(page);
+ NavigationHistory nh = (NavigationHistory) page.getNavigationHistory();
+ if (forward) {
+ nh.setForwardAction(this);
+ } else {
+ nh.setBackwardAction(this);
+ }
+ }
- @Override
+ @Override
public void run() {
- if (getWorkbenchWindow() == null) {
- // action has been disposed
- return;
- }
- IWorkbenchPage page = getActivePage();
- if (page != null) {
- NavigationHistory nh = (NavigationHistory) page.getNavigationHistory();
- if (forward) {
- nh.forward();
- } else {
- nh.backward();
- }
- recreateMenu = true;
- }
- }
+ if (getWorkbenchWindow() == null) {
+ // action has been disposed
+ return;
+ }
+ IWorkbenchPage page = getActivePage();
+ if (page != null) {
+ NavigationHistory nh = (NavigationHistory) page.getNavigationHistory();
+ if (forward) {
+ nh.forward();
+ } else {
+ nh.backward();
+ }
+ recreateMenu = true;
+ }
+ }
- public void update() {
- // Set the enabled state of the action and set the tool tip text. The tool tip
- // text is set to reflect the item that one will move back/forward to.
- WorkbenchPage page = (WorkbenchPage) getActivePage();
- if (page == null) {
+ public void update() {
+ // Set the enabled state of the action and set the tool tip text. The tool tip
+ // text is set to reflect the item that one will move back/forward to.
+ WorkbenchPage page = (WorkbenchPage) getActivePage();
+ if (page == null) {
return;
}
- NavigationHistory history = (NavigationHistory) page
- .getNavigationHistory();
- NavigationHistoryEntry[] entries;
- if (forward) {
- setEnabled(history.canForward());
- entries = history.getForwardEntries();
- if (entries.length > 0) {
- NavigationHistoryEntry entry = entries[0];
- String text = NLS.bind(WorkbenchMessages.NavigationHistoryAction_forward_toolTipName, entry.getHistoryText() );
- setToolTipText(text);
- } else {
- setToolTipText(WorkbenchMessages.NavigationHistoryAction_forward_toolTip);
- }
- } else {
- setEnabled(history.canBackward());
- entries = history.getBackwardEntries();
- if (entries.length > 0) {
- NavigationHistoryEntry entry = entries[0];
- String text = NLS.bind(WorkbenchMessages.NavigationHistoryAction_backward_toolTipName, entry.getHistoryText() );
- setToolTipText(text);
- } else {
- setToolTipText(WorkbenchMessages.NavigationHistoryAction_backward_toolTip);
- }
- }
- recreateMenu = true;
- }
+ NavigationHistory history = (NavigationHistory) page.getNavigationHistory();
+ NavigationHistoryEntry[] entries;
+ if (forward) {
+ setEnabled(history.canForward());
+ entries = history.getForwardEntries();
+ if (entries.length > 0) {
+ NavigationHistoryEntry entry = entries[0];
+ String text = NLS.bind(WorkbenchMessages.NavigationHistoryAction_forward_toolTipName,
+ entry.getHistoryText());
+ setToolTipText(text);
+ } else {
+ setToolTipText(WorkbenchMessages.NavigationHistoryAction_forward_toolTip);
+ }
+ } else {
+ setEnabled(history.canBackward());
+ entries = history.getBackwardEntries();
+ if (entries.length > 0) {
+ NavigationHistoryEntry entry = entries[0];
+ String text = NLS.bind(WorkbenchMessages.NavigationHistoryAction_backward_toolTipName,
+ entry.getHistoryText());
+ setToolTipText(text);
+ } else {
+ setToolTipText(WorkbenchMessages.NavigationHistoryAction_backward_toolTip);
+ }
+ }
+ recreateMenu = true;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NavigationHistoryEditorInfo.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NavigationHistoryEditorInfo.java
index 2068319ba58..810d44f151f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NavigationHistoryEditorInfo.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NavigationHistoryEditorInfo.java
@@ -23,80 +23,75 @@ import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.XMLMemento;
/**
- * Keeps the info to save, restore or identify and editor.
- * Instances of this class are shared between history entries and there should be
- * only one instance making reference to the same editor.
+ * Keeps the info to save, restore or identify and editor. Instances of this
+ * class are shared between history entries and there should be only one
+ * instance making reference to the same editor.
*/
public class NavigationHistoryEditorInfo {
- String editorID;
+ String editorID;
- IEditorInput editorInput;
+ IEditorInput editorInput;
- int refCount = 0;
+ int refCount = 0;
- IMemento memento;
+ IMemento memento;
- NavigationHistoryEditorInfo(IEditorPart part) {
- editorID = part.getSite().getId();
- editorInput = part.getEditorInput();
- }
+ NavigationHistoryEditorInfo(IEditorPart part) {
+ editorID = part.getSite().getId();
+ editorInput = part.getEditorInput();
+ }
- NavigationHistoryEditorInfo(IMemento memento) {
- this.memento = memento;
- }
+ NavigationHistoryEditorInfo(IMemento memento) {
+ this.memento = memento;
+ }
- boolean isPersistable() {
- if (editorInput != null) {
- IPersistableElement persistable = editorInput.getPersistable();
- return persistable != null;
- }
- return memento != null;
- }
+ boolean isPersistable() {
+ if (editorInput != null) {
+ IPersistableElement persistable = editorInput.getPersistable();
+ return persistable != null;
+ }
+ return memento != null;
+ }
- void handlePartClosed() {
- if (!isPersistable()) {
+ void handlePartClosed() {
+ if (!isPersistable()) {
return;
}
- if (memento == null) {
- IPersistableElement persistable = editorInput.getPersistable();
- memento = XMLMemento
- .createWriteRoot(IWorkbenchConstants.TAG_EDITOR);
- memento.putString(IWorkbenchConstants.TAG_ID, editorID);
- memento.putString(IWorkbenchConstants.TAG_FACTORY_ID, persistable
- .getFactoryId());
- persistable.saveState(memento);
- }
- editorID = null;
- editorInput = null;
- }
+ if (memento == null) {
+ IPersistableElement persistable = editorInput.getPersistable();
+ memento = XMLMemento.createWriteRoot(IWorkbenchConstants.TAG_EDITOR);
+ memento.putString(IWorkbenchConstants.TAG_ID, editorID);
+ memento.putString(IWorkbenchConstants.TAG_FACTORY_ID, persistable.getFactoryId());
+ persistable.saveState(memento);
+ }
+ editorID = null;
+ editorInput = null;
+ }
- void restoreEditor() {
- if (memento == null) {
+ void restoreEditor() {
+ if (memento == null) {
return;
}
- String factoryID = memento
- .getString(IWorkbenchConstants.TAG_FACTORY_ID);
- IElementFactory factory = PlatformUI.getWorkbench().getElementFactory(
- factoryID);
- if (factory != null) {
- IAdaptable element = factory.createElement(memento);
- if (element instanceof IEditorInput) {
- editorInput = (IEditorInput) element;
- editorID = memento.getString(IWorkbenchConstants.TAG_ID);
- }
- }
- memento = null;
- }
+ String factoryID = memento.getString(IWorkbenchConstants.TAG_FACTORY_ID);
+ IElementFactory factory = PlatformUI.getWorkbench().getElementFactory(factoryID);
+ if (factory != null) {
+ IAdaptable element = factory.createElement(memento);
+ if (element instanceof IEditorInput) {
+ editorInput = (IEditorInput) element;
+ editorID = memento.getString(IWorkbenchConstants.TAG_ID);
+ }
+ }
+ memento = null;
+ }
- void saveState(IMemento mem) {
- if (editorInput != null) {
- IPersistableElement persistable = editorInput.getPersistable();
- mem.putString(IWorkbenchConstants.TAG_ID, editorID);
- mem.putString(IWorkbenchConstants.TAG_FACTORY_ID, persistable
- .getFactoryId());
- persistable.saveState(mem);
- } else if (memento != null) {
- mem.putMemento(memento);
- }
- }
+ void saveState(IMemento mem) {
+ if (editorInput != null) {
+ IPersistableElement persistable = editorInput.getPersistable();
+ mem.putString(IWorkbenchConstants.TAG_ID, editorID);
+ mem.putString(IWorkbenchConstants.TAG_FACTORY_ID, persistable.getFactoryId());
+ persistable.saveState(mem);
+ } else if (memento != null) {
+ mem.putMemento(memento);
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NavigationHistoryEntry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NavigationHistoryEntry.java
index 9a1b968606b..eb75738116f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NavigationHistoryEntry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NavigationHistoryEntry.java
@@ -28,162 +28,155 @@ import org.eclipse.ui.XMLMemento;
*/
public class NavigationHistoryEntry {
- private IWorkbenchPage page;
-
- NavigationHistoryEditorInfo editorInfo;
-
- String historyText;
-
- /* Both may be set at the same time. */
- INavigationLocation location;
-
- private IMemento locationMemento;
-
- /**
- * Constructs a new HistoryEntry and intializes its editor input and editor id.
- */
- public NavigationHistoryEntry(NavigationHistoryEditorInfo editorInfo,
- IWorkbenchPage page, IEditorPart part, INavigationLocation location) {
- this.editorInfo = editorInfo;
- this.page = page;
- this.location = location;
- if (location != null) {
- historyText = location.getText();
- }
- // ensure that the historyText is initialized to something
- if (historyText == null || historyText.length() == 0) {
- if (part != null) {
+ private IWorkbenchPage page;
+
+ NavigationHistoryEditorInfo editorInfo;
+
+ String historyText;
+
+ /* Both may be set at the same time. */
+ INavigationLocation location;
+
+ private IMemento locationMemento;
+
+ /**
+ * Constructs a new HistoryEntry and intializes its editor input and editor id.
+ */
+ public NavigationHistoryEntry(NavigationHistoryEditorInfo editorInfo, IWorkbenchPage page, IEditorPart part,
+ INavigationLocation location) {
+ this.editorInfo = editorInfo;
+ this.page = page;
+ this.location = location;
+ if (location != null) {
+ historyText = location.getText();
+ }
+ // ensure that the historyText is initialized to something
+ if (historyText == null || historyText.length() == 0) {
+ if (part != null) {
historyText = part.getTitle();
}
- }
- }
-
- /**
- * Restores the state of the entry and the location if needed and then
- * restores the location.
- */
- void restoreLocation() {
- if (editorInfo.editorInput != null && editorInfo.editorID != null) {
- try {
- IEditorPart editor = page.openEditor(editorInfo.editorInput,
- editorInfo.editorID, true);
- if (location == null) {
- if (editor instanceof INavigationLocationProvider) {
- location = ((INavigationLocationProvider) editor)
- .createEmptyNavigationLocation();
+ }
+ }
+
+ /**
+ * Restores the state of the entry and the location if needed and then restores
+ * the location.
+ */
+ void restoreLocation() {
+ if (editorInfo.editorInput != null && editorInfo.editorID != null) {
+ try {
+ IEditorPart editor = page.openEditor(editorInfo.editorInput, editorInfo.editorID, true);
+ if (location == null) {
+ if (editor instanceof INavigationLocationProvider) {
+ location = ((INavigationLocationProvider) editor).createEmptyNavigationLocation();
}
- }
-
- if (location != null) {
- if (locationMemento != null) {
- location.setInput(editorInfo.editorInput);
- location.restoreState(locationMemento);
- locationMemento = null;
- }
- location.restoreLocation();
- }
- } catch (PartInitException e) {
- // ignore for now
- }
- }
- }
-
- /**
- * Return the label to display in the history drop down list. Use the
- * history entry text if the location has not been restored yet.
- */
- String getHistoryText() {
- if (location != null) {
- // location exists or has been restored, use its text.
- // Also update the historyText so that this value will
- // be saved. Doing so handles cases where getText() value
- // may be dynamic.
- String text = location.getText();
- if ((text == null) || text.equals("")) { //$NON-NLS-1$
- text = historyText;
- } else {
- historyText = text;
- }
- return text;
- }
+ }
+
+ if (location != null) {
+ if (locationMemento != null) {
+ location.setInput(editorInfo.editorInput);
+ location.restoreState(locationMemento);
+ locationMemento = null;
+ }
+ location.restoreLocation();
+ }
+ } catch (PartInitException e) {
+ // ignore for now
+ }
+ }
+ }
+
+ /**
+ * Return the label to display in the history drop down list. Use the history
+ * entry text if the location has not been restored yet.
+ */
+ String getHistoryText() {
+ if (location != null) {
+ // location exists or has been restored, use its text.
+ // Also update the historyText so that this value will
+ // be saved. Doing so handles cases where getText() value
+ // may be dynamic.
+ String text = location.getText();
+ if ((text == null) || text.equals("")) { //$NON-NLS-1$
+ text = historyText;
+ } else {
+ historyText = text;
+ }
+ return text;
+ }
return historyText;
- }
-
- /**
- * Saves the state of this entry and its location.
- * Returns true if possible otherwise returns false.
- */
- boolean handlePartClosed() {
- if (!editorInfo.isPersistable()) {
+ }
+
+ /**
+ * Saves the state of this entry and its location. Returns true if possible
+ * otherwise returns false.
+ */
+ boolean handlePartClosed() {
+ if (!editorInfo.isPersistable()) {
return false;
}
- if (location != null) {
- locationMemento = XMLMemento
- .createWriteRoot(IWorkbenchConstants.TAG_POSITION);
- location.saveState(locationMemento);
- location.releaseState();
- }
- return true;
- }
-
- /**
- * Saves the state of this entry and its location.
- */
- void saveState(IMemento mem, ArrayList entries) {
- mem.putString(IWorkbenchConstants.TAG_HISTORY_LABEL, getHistoryText());
- if (locationMemento != null) {
- IMemento childMem = mem
- .createChild(IWorkbenchConstants.TAG_POSITION);
- childMem.putMemento(locationMemento);
- } else if (location != null) {
- IMemento childMem = mem
- .createChild(IWorkbenchConstants.TAG_POSITION);
- location.saveState(childMem);
- }
- }
-
- /**
- * Restore the state of this entry.
- */
- void restoreState(IMemento mem) {
- historyText = mem.getString(IWorkbenchConstants.TAG_HISTORY_LABEL);
- locationMemento = mem.getChild(IWorkbenchConstants.TAG_POSITION);
- }
-
- @Override
+ if (location != null) {
+ locationMemento = XMLMemento.createWriteRoot(IWorkbenchConstants.TAG_POSITION);
+ location.saveState(locationMemento);
+ location.releaseState();
+ }
+ return true;
+ }
+
+ /**
+ * Saves the state of this entry and its location.
+ */
+ void saveState(IMemento mem, ArrayList entries) {
+ mem.putString(IWorkbenchConstants.TAG_HISTORY_LABEL, getHistoryText());
+ if (locationMemento != null) {
+ IMemento childMem = mem.createChild(IWorkbenchConstants.TAG_POSITION);
+ childMem.putMemento(locationMemento);
+ } else if (location != null) {
+ IMemento childMem = mem.createChild(IWorkbenchConstants.TAG_POSITION);
+ location.saveState(childMem);
+ }
+ }
+
+ /**
+ * Restore the state of this entry.
+ */
+ void restoreState(IMemento mem) {
+ historyText = mem.getString(IWorkbenchConstants.TAG_HISTORY_LABEL);
+ locationMemento = mem.getChild(IWorkbenchConstants.TAG_POSITION);
+ }
+
+ @Override
public String toString() {
- return "Input<" + editorInfo.editorInput + "> Details<" + location + ">"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- /**
- * Disposes this entry and its location.
- */
- void dispose() {
- if (location != null) {
+ return "Input<" + editorInfo.editorInput + "> Details<" + location + ">"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ /**
+ * Disposes this entry and its location.
+ */
+ void dispose() {
+ if (location != null) {
location.dispose();
}
- editorInfo = null;
- }
-
- /**
- * Merges this entry into the current entry. Returns true
- * if the merge was possible otherwise returns false.
- */
- boolean mergeInto(NavigationHistoryEntry currentEntry) {
- if (editorInfo.editorInput != null
- && editorInfo.editorInput
- .equals(currentEntry.editorInfo.editorInput)) {
- if (location != null) {
- if (currentEntry.location == null) {
- currentEntry.location = location;
- location = null;
- return true;
- }
+ editorInfo = null;
+ }
+
+ /**
+ * Merges this entry into the current entry. Returns true if the merge was
+ * possible otherwise returns false.
+ */
+ boolean mergeInto(NavigationHistoryEntry currentEntry) {
+ if (editorInfo.editorInput != null && editorInfo.editorInput.equals(currentEntry.editorInfo.editorInput)) {
+ if (location != null) {
+ if (currentEntry.location == null) {
+ currentEntry.location = location;
+ location = null;
+ return true;
+ }
return location.mergeInto(currentEntry.location);
- } else if (currentEntry.location == null) {
- return true;
- }
- }
- return false;
- }
+ } else if (currentEntry.location == null) {
+ return true;
+ }
+ }
+ return false;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectActionContributor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectActionContributor.java
index 81ad136d364..5aba529427d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectActionContributor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectActionContributor.java
@@ -40,365 +40,350 @@ import org.eclipse.ui.model.IWorkbenchAdapter;
* This class describes the object contribution element within the popup menu
* action registry.
*/
-public class ObjectActionContributor extends PluginActionBuilder implements
- IObjectActionContributor, IAdaptable {
+public class ObjectActionContributor extends PluginActionBuilder implements IObjectActionContributor, IAdaptable {
- private static final String P_TRUE = "true"; //$NON-NLS-1$
+ private static final String P_TRUE = "true"; //$NON-NLS-1$
- private IConfigurationElement config;
+ private IConfigurationElement config;
- private boolean configRead = false;
+ private boolean configRead = false;
- private boolean adaptable = false;
+ private boolean adaptable = false;
- private String objectClass;
+ private String objectClass;
- /**
- * The constructor.
- *
- * @param config the element
- */
- public ObjectActionContributor(IConfigurationElement config) {
- this.config = config;
- this.adaptable = P_TRUE.equalsIgnoreCase(config
- .getAttribute(IWorkbenchRegistryConstants.ATT_ADAPTABLE));
- this.objectClass = config.getAttribute(IWorkbenchRegistryConstants.ATT_OBJECTCLASS);
- }
+ /**
+ * The constructor.
+ *
+ * @param config the element
+ */
+ public ObjectActionContributor(IConfigurationElement config) {
+ this.config = config;
+ this.adaptable = P_TRUE.equalsIgnoreCase(config.getAttribute(IWorkbenchRegistryConstants.ATT_ADAPTABLE));
+ this.objectClass = config.getAttribute(IWorkbenchRegistryConstants.ATT_OBJECTCLASS);
+ }
- @Override
+ @Override
public boolean canAdapt() {
- return adaptable;
- }
-
- /**
- * Return the object class for this contributor.
- *
- * @return the object class
- */
+ return adaptable;
+ }
+
+ /**
+ * Return the object class for this contributor.
+ *
+ * @return the object class
+ */
public String getObjectClass() {
return objectClass;
}
- @Override
+ @Override
public void contributeObjectActionIdOverrides(List actionIdOverrides) {
- if (!configRead) {
+ if (!configRead) {
readConfigElement();
}
- // Easy case out if no actions
- if (currentContribution.actions != null) {
- for (int i = 0; i < currentContribution.actions.size(); i++) {
- ActionDescriptor ad = (ActionDescriptor) currentContribution.actions
- .get(i);
- String id = ad.getAction().getOverrideActionId();
- if (id != null) {
+ // Easy case out if no actions
+ if (currentContribution.actions != null) {
+ for (int i = 0; i < currentContribution.actions.size(); i++) {
+ ActionDescriptor ad = (ActionDescriptor) currentContribution.actions.get(i);
+ String id = ad.getAction().getOverrideActionId();
+ if (id != null) {
actionIdOverrides.add(id);
}
- }
- }
- }
-
- /**
- * Contributes actions applicable for the current selection.
- */
- @Override
- public boolean contributeObjectActions(final IWorkbenchPart part,
- IMenuManager menu, ISelectionProvider selProv,
- List actionIdOverrides) {
- if (!configRead) {
+ }
+ }
+ }
+
+ /**
+ * Contributes actions applicable for the current selection.
+ */
+ @Override
+ public boolean contributeObjectActions(final IWorkbenchPart part, IMenuManager menu, ISelectionProvider selProv,
+ List actionIdOverrides) {
+ if (!configRead) {
readConfigElement();
}
- // Easy case out if no actions
- if (currentContribution.actions == null) {
+ // Easy case out if no actions
+ if (currentContribution.actions == null) {
return false;
}
- // Get a structured selection.
- ISelection sel = selProv.getSelection();
- if ((sel == null) || !(sel instanceof IStructuredSelection)) {
+ // Get a structured selection.
+ ISelection sel = selProv.getSelection();
+ if ((sel == null) || !(sel instanceof IStructuredSelection)) {
return false;
}
- IStructuredSelection ssel = (IStructuredSelection) sel;
-
- if(canAdapt()) {
- IStructuredSelection newSelection = LegacyResourceSupport.adaptSelection(ssel, getObjectClass());
- if(newSelection.size() != ssel.size()) {
- if (Policy.DEBUG_CONTRIBUTIONS) {
- WorkbenchPlugin.log("Error adapting selection to " + getObjectClass() + //$NON-NLS-1$
- ". Contribution " + getID(config) + " is being ignored"); //$NON-NLS-1$ //$NON-NLS-2$
+ IStructuredSelection ssel = (IStructuredSelection) sel;
+
+ if (canAdapt()) {
+ IStructuredSelection newSelection = LegacyResourceSupport.adaptSelection(ssel, getObjectClass());
+ if (newSelection.size() != ssel.size()) {
+ if (Policy.DEBUG_CONTRIBUTIONS) {
+ WorkbenchPlugin.log("Error adapting selection to " + getObjectClass() + //$NON-NLS-1$
+ ". Contribution " + getID(config) + " is being ignored"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return false;
}
- return false;
- }
- ssel = newSelection;
- }
-
- final IStructuredSelection selection = ssel;
-
- // Generate menu.
- for (int i = 0; i < currentContribution.actions.size(); i++) {
- ActionDescriptor ad = (ActionDescriptor) currentContribution.actions
- .get(i);
- if (!actionIdOverrides.contains(ad.getId())) {
- currentContribution.contributeMenuAction(ad, menu, true);
- // Update action for the current selection and part.
- if (ad.getAction() instanceof ObjectPluginAction) {
- final ObjectPluginAction action = (ObjectPluginAction) ad
- .getAction();
- ISafeRunnable runnable = new ISafeRunnable() {
+ ssel = newSelection;
+ }
+
+ final IStructuredSelection selection = ssel;
+
+ // Generate menu.
+ for (int i = 0; i < currentContribution.actions.size(); i++) {
+ ActionDescriptor ad = (ActionDescriptor) currentContribution.actions.get(i);
+ if (!actionIdOverrides.contains(ad.getId())) {
+ currentContribution.contributeMenuAction(ad, menu, true);
+ // Update action for the current selection and part.
+ if (ad.getAction() instanceof ObjectPluginAction) {
+ final ObjectPluginAction action = (ObjectPluginAction) ad.getAction();
+ ISafeRunnable runnable = new ISafeRunnable() {
@Override
public void handleException(Throwable exception) {
- WorkbenchPlugin.log("Failed to update action " //$NON-NLS-1$
+ WorkbenchPlugin.log("Failed to update action " //$NON-NLS-1$
+ action.getId(), exception);
}
@Override
public void run() throws Exception {
- action.setActivePart(part);
- action.selectionChanged(selection);
+ action.setActivePart(part);
+ action.selectionChanged(selection);
}
- };
- SafeRunner.run(runnable);
- }
- }
- }
- return true;
- }
-
- /**
+ };
+ SafeRunner.run(runnable);
+ }
+ }
+ }
+ return true;
+ }
+
+ /**
* Contributes menus applicable for the current selection.
*/
- @Override
- public boolean contributeObjectMenus(IMenuManager menu,
- ISelectionProvider selProv) {
- if (!configRead) {
+ @Override
+ public boolean contributeObjectMenus(IMenuManager menu, ISelectionProvider selProv) {
+ if (!configRead) {
readConfigElement();
}
- // Easy case out if no menus
- if (currentContribution.menus == null) {
+ // Easy case out if no menus
+ if (currentContribution.menus == null) {
return false;
}
- // Get a structured selection.
- ISelection sel = selProv.getSelection();
- if ((sel == null) || !(sel instanceof IStructuredSelection)) {
+ // Get a structured selection.
+ ISelection sel = selProv.getSelection();
+ if ((sel == null) || !(sel instanceof IStructuredSelection)) {
return false;
}
- // Generate menu.
- for (int i = 0; i < currentContribution.menus.size(); i++) {
- IConfigurationElement menuElement = (IConfigurationElement) currentContribution.menus
- .get(i);
- currentContribution.contributeMenu(menuElement, menu, true);
- }
- return true;
- }
-
- @Override
- protected ActionDescriptor createActionDescriptor(
- IConfigurationElement element) {
- return new ActionDescriptor(element, ActionDescriptor.T_POPUP);
- }
-
- @Override
+ // Generate menu.
+ for (int i = 0; i < currentContribution.menus.size(); i++) {
+ IConfigurationElement menuElement = (IConfigurationElement) currentContribution.menus.get(i);
+ currentContribution.contributeMenu(menuElement, menu, true);
+ }
+ return true;
+ }
+
+ @Override
+ protected ActionDescriptor createActionDescriptor(IConfigurationElement element) {
+ return new ActionDescriptor(element, ActionDescriptor.T_POPUP);
+ }
+
+ @Override
protected BasicContribution createContribution() {
- return new ObjectContribution();
- }
-
- /**
- * Returns true if name filter is not specified for the contribution
- * or the current selection matches the filter.
- */
- @Override
+ return new ObjectContribution();
+ }
+
+ /**
+ * Returns true if name filter is not specified for the contribution or the
+ * current selection matches the filter.
+ */
+ @Override
public boolean isApplicableTo(Object object) {
- if (!configRead) {
+ if (!configRead) {
readConfigElement();
}
- // Perform all tests with an instance of the objectClass and not
- // the actual selected object.
- if (canAdapt()) {
+ // Perform all tests with an instance of the objectClass and not
+ // the actual selected object.
+ if (canAdapt()) {
Object adapted = LegacyResourceSupport.getAdapter(object, getObjectClass());
if (adapted == null) {
if (Policy.DEBUG_CONTRIBUTIONS) {
- WorkbenchPlugin
- .log("Error adapting " + object.getClass().getName() + //$NON-NLS-1$
- " to " //$NON-NLS-1$
- + getObjectClass()
- + ". Contribution " + getID(config) + " is being ignored"); //$NON-NLS-1$ //$NON-NLS-2$
+ WorkbenchPlugin.log("Error adapting " + object.getClass().getName() + //$NON-NLS-1$
+ " to " //$NON-NLS-1$
+ + getObjectClass() + ". Contribution " + getID(config) + " is being ignored"); //$NON-NLS-1$ //$NON-NLS-2$
}
} else {
object = adapted;
}
}
- if (!testName(object)) {
+ if (!testName(object)) {
return false;
}
- return ((ObjectContribution) currentContribution)
- .isApplicableTo(object);
- }
-
- /**
- * Reads the configuration element and all the children.
- * This creates an action descriptor for every action in the extension.
- */
- private void readConfigElement() {
- currentContribution = createContribution();
- readElementChildren(config);
- configRead = true;
- }
-
- @Override
+ return ((ObjectContribution) currentContribution).isApplicableTo(object);
+ }
+
+ /**
+ * Reads the configuration element and all the children. This creates an action
+ * descriptor for every action in the extension.
+ */
+ private void readConfigElement() {
+ currentContribution = createContribution();
+ readElementChildren(config);
+ configRead = true;
+ }
+
+ @Override
protected boolean readElement(IConfigurationElement element) {
- String tag = element.getName();
-
- // Found visibility sub-element
- if (tag.equals(IWorkbenchRegistryConstants.TAG_VISIBILITY)) {
- ((ObjectContribution) currentContribution)
- .setVisibilityTest(element);
- return true;
- }
-
- // Found filter sub-element
- if (tag.equals(IWorkbenchRegistryConstants.TAG_FILTER)) {
- ((ObjectContribution) currentContribution).addFilterTest(element);
- return true;
- }
-
- if (tag.equals(IWorkbenchRegistryConstants.TAG_ENABLEMENT)) {
- ((ObjectContribution) currentContribution)
- .setEnablementTest(element);
- return true;
- }
-
- return super.readElement(element);
- }
-
- /**
- * Returns whether the current selection matches the contribution name filter.
- */
- private boolean testName(Object object) {
- String nameFilter = config.getAttribute(IWorkbenchRegistryConstants.ATT_NAME_FILTER);
- if (nameFilter == null) {
+ String tag = element.getName();
+
+ // Found visibility sub-element
+ if (tag.equals(IWorkbenchRegistryConstants.TAG_VISIBILITY)) {
+ ((ObjectContribution) currentContribution).setVisibilityTest(element);
+ return true;
+ }
+
+ // Found filter sub-element
+ if (tag.equals(IWorkbenchRegistryConstants.TAG_FILTER)) {
+ ((ObjectContribution) currentContribution).addFilterTest(element);
return true;
}
- String objectName = null;
- IWorkbenchAdapter de = Adapters.adapt(object, IWorkbenchAdapter.class);
- if (de != null) {
+
+ if (tag.equals(IWorkbenchRegistryConstants.TAG_ENABLEMENT)) {
+ ((ObjectContribution) currentContribution).setEnablementTest(element);
+ return true;
+ }
+
+ return super.readElement(element);
+ }
+
+ /**
+ * Returns whether the current selection matches the contribution name filter.
+ */
+ private boolean testName(Object object) {
+ String nameFilter = config.getAttribute(IWorkbenchRegistryConstants.ATT_NAME_FILTER);
+ if (nameFilter == null) {
+ return true;
+ }
+ String objectName = null;
+ IWorkbenchAdapter de = Adapters.adapt(object, IWorkbenchAdapter.class);
+ if (de != null) {
objectName = de.getLabel(object);
}
- if (objectName == null) {
- objectName = object.toString();
- }
- return SelectionEnabler.verifyNameMatch(objectName, nameFilter);
- }
-
- /**
- * Helper class to collect the menus and actions defined within a
- * contribution element.
- */
- private static class ObjectContribution extends BasicContribution {
- private ObjectFilterTest filterTest;
-
- private ActionExpression visibilityTest;
-
- private Expression enablement;
-
- /**
- * Add a filter test.
- *
- * @param element the element
- */
- public void addFilterTest(IConfigurationElement element) {
- if (filterTest == null) {
+ if (objectName == null) {
+ objectName = object.toString();
+ }
+ return SelectionEnabler.verifyNameMatch(objectName, nameFilter);
+ }
+
+ /**
+ * Helper class to collect the menus and actions defined within a contribution
+ * element.
+ */
+ private static class ObjectContribution extends BasicContribution {
+ private ObjectFilterTest filterTest;
+
+ private ActionExpression visibilityTest;
+
+ private Expression enablement;
+
+ /**
+ * Add a filter test.
+ *
+ * @param element the element
+ */
+ public void addFilterTest(IConfigurationElement element) {
+ if (filterTest == null) {
filterTest = new ObjectFilterTest();
}
- filterTest.addFilterElement(element);
- }
-
- /**
- * Set the visibility test.
- *
- * @param element the element
- */
- public void setVisibilityTest(IConfigurationElement element) {
- visibilityTest = new ActionExpression(element);
- }
-
- /**
- * Set the enablement test.
- *
- * @param element the element
- */
- public void setEnablementTest(IConfigurationElement element) {
- try {
- enablement = ExpressionConverter.getDefault().perform(element);
- } catch (CoreException e) {
- WorkbenchPlugin.log(e);
- }
- }
-
- /**
- * Returns true if name filter is not specified for the contribution
- * or the current selection matches the filter.
- *
- * @param object the object to test
- * @return whether we're applicable
- */
- public boolean isApplicableTo(Object object) {
- boolean result = true;
- if (visibilityTest != null) {
- result = result && visibilityTest.isEnabledFor(object);
- if (!result) {
+ filterTest.addFilterElement(element);
+ }
+
+ /**
+ * Set the visibility test.
+ *
+ * @param element the element
+ */
+ public void setVisibilityTest(IConfigurationElement element) {
+ visibilityTest = new ActionExpression(element);
+ }
+
+ /**
+ * Set the enablement test.
+ *
+ * @param element the element
+ */
+ public void setEnablementTest(IConfigurationElement element) {
+ try {
+ enablement = ExpressionConverter.getDefault().perform(element);
+ } catch (CoreException e) {
+ WorkbenchPlugin.log(e);
+ }
+ }
+
+ /**
+ * Returns true if name filter is not specified for the contribution or the
+ * current selection matches the filter.
+ *
+ * @param object the object to test
+ * @return whether we're applicable
+ */
+ public boolean isApplicableTo(Object object) {
+ boolean result = true;
+ if (visibilityTest != null) {
+ result = result && visibilityTest.isEnabledFor(object);
+ if (!result) {
return result;
}
- } else if (filterTest != null) {
- result = result && filterTest.matches(object, true);
- if (!result) {
+ } else if (filterTest != null) {
+ result = result && filterTest.matches(object, true);
+ if (!result) {
return result;
}
- }
- if (enablement != null) {
- try {
- IEvaluationContext context = new EvaluationContext(null,
- object);
- context.setAllowPluginActivation(true);
- context.addVariable("selection", object); //$NON-NLS-1$
- context.addVariable("org.eclipse.core.runtime.Platform", Platform.class); //$NON-NLS-1$
- EvaluationResult evalResult = enablement.evaluate(context);
- if (evalResult == EvaluationResult.FALSE) {
+ }
+ if (enablement != null) {
+ try {
+ IEvaluationContext context = new EvaluationContext(null, object);
+ context.setAllowPluginActivation(true);
+ context.addVariable("selection", object); //$NON-NLS-1$
+ context.addVariable("org.eclipse.core.runtime.Platform", Platform.class); //$NON-NLS-1$
+ EvaluationResult evalResult = enablement.evaluate(context);
+ if (evalResult == EvaluationResult.FALSE) {
return false;
}
- } catch (CoreException e) {
- enablement = null;
- WorkbenchPlugin.log(e);
- result = false;
- }
- }
- return result;
- }
- }
-
- /**
- * Debugging helper that will print out the contribution names for this
- * contributor.
- */
- @Override
+ } catch (CoreException e) {
+ enablement = null;
+ WorkbenchPlugin.log(e);
+ result = false;
+ }
+ }
+ return result;
+ }
+ }
+
+ /**
+ * Debugging helper that will print out the contribution names for this
+ * contributor.
+ */
+ @Override
public String toString() {
- StringBuilder buffer = new StringBuilder();
- IConfigurationElement[] children = config.getChildren();
- for (IConfigurationElement element : children) {
+ StringBuilder buffer = new StringBuilder();
+ IConfigurationElement[] children = config.getChildren();
+ for (IConfigurationElement element : children) {
String label = element.getAttribute(IWorkbenchRegistryConstants.ATT_LABEL);
- if(label != null) {
+ if (label != null) {
buffer.append(label);
buffer.append('\n');
}
}
- return buffer.toString();
- }
+ return buffer.toString();
+ }
@Override
public <T> T getAdapter(Class<T> adapter) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectActionContributorManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectActionContributorManager.java
index 2654b12b89e..66168153699 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectActionContributorManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectActionContributorManager.java
@@ -28,118 +28,115 @@ import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants;
/**
- * This manager is used to populate a popup menu manager with actions
- * for a given type.
+ * This manager is used to populate a popup menu manager with actions for a
+ * given type.
*/
public class ObjectActionContributorManager extends ObjectContributorManager {
- private static ObjectActionContributorManager sharedInstance;
+ private static ObjectActionContributorManager sharedInstance;
- /**
- * PopupMenuManager constructor.
- */
- public ObjectActionContributorManager() {
- super();
- loadContributors();
- }
+ /**
+ * PopupMenuManager constructor.
+ */
+ public ObjectActionContributorManager() {
+ super();
+ loadContributors();
+ }
- /**
+ /**
* Contributes submenus and/or actions applicable to the selection in the
* provided viewer into the provided popup menu.
*
- * @param part
- * the part being contributed to
- * @param popupMenu
- * the menu being contributed to
- * @param selProv
- * the selection provider
- * @param alreadyContributed
- * the set of contributors that already contributed to the menu
+ * @param part the part being contributed to
+ * @param popupMenu the menu being contributed to
+ * @param selProv the selection provider
+ * @param alreadyContributed the set of contributors that already contributed to
+ * the menu
* @return whether anything was contributed
*/
- public boolean contributeObjectActions(IWorkbenchPart part, IMenuManager popupMenu,
- ISelectionProvider selProv, Set<IObjectActionContributor> alreadyContributed) {
- // Get a selection.
- ISelection selection = selProv.getSelection();
- if (selection == null) {
+ public boolean contributeObjectActions(IWorkbenchPart part, IMenuManager popupMenu, ISelectionProvider selProv,
+ Set<IObjectActionContributor> alreadyContributed) {
+ // Get a selection.
+ ISelection selection = selProv.getSelection();
+ if (selection == null) {
return false;
}
- // Convert the selection into an element vector.
- // According to the dictionary, a selection is "one that
- // is selected", or "a collection of selected things".
- // In reflection of this, we deal with one or a collection.
- List elements = null;
- if (selection instanceof IStructuredSelection) {
- elements = ((IStructuredSelection) selection).toList();
- } else {
- elements = new ArrayList(1);
- elements.add(selection);
- }
+ // Convert the selection into an element vector.
+ // According to the dictionary, a selection is "one that
+ // is selected", or "a collection of selected things".
+ // In reflection of this, we deal with one or a collection.
+ List elements = null;
+ if (selection instanceof IStructuredSelection) {
+ elements = ((IStructuredSelection) selection).toList();
+ } else {
+ elements = new ArrayList(1);
+ elements.add(selection);
+ }
List<IObjectActionContributor> contributors = getContributors(elements);
contributors.removeAll(alreadyContributed);
- if (contributors.isEmpty()) {
+ if (contributors.isEmpty()) {
return false;
}
- // First pass, add the menus and collect the overrides. Prune from the
- // list any non-applicable contributions.
- boolean actualContributions = false;
- ArrayList overrides = new ArrayList(4);
+ // First pass, add the menus and collect the overrides. Prune from the
+ // list any non-applicable contributions.
+ boolean actualContributions = false;
+ ArrayList overrides = new ArrayList(4);
for (Iterator<IObjectActionContributor> it = contributors.iterator(); it.hasNext();) {
IObjectActionContributor contributor = it.next();
- if (!isApplicableTo(elements, contributor)) {
- it.remove();
- continue;
- }
- if (contributor.contributeObjectMenus(popupMenu, selProv)) {
+ if (!isApplicableTo(elements, contributor)) {
+ it.remove();
+ continue;
+ }
+ if (contributor.contributeObjectMenus(popupMenu, selProv)) {
actualContributions = true;
alreadyContributed.add(contributor);
}
- contributor.contributeObjectActionIdOverrides(overrides);
- }
+ contributor.contributeObjectActionIdOverrides(overrides);
+ }
- // Second pass, add the contributions that are applicable to
- // the selection.
+ // Second pass, add the contributions that are applicable to
+ // the selection.
for (IObjectActionContributor contributor : contributors) {
- if (contributor.contributeObjectActions(part, popupMenu, selProv,
- overrides)) {
+ if (contributor.contributeObjectActions(part, popupMenu, selProv, overrides)) {
actualContributions = true;
alreadyContributed.add(contributor);
}
- }
- return actualContributions;
- }
+ }
+ return actualContributions;
+ }
- /**
- * Returns the shared instance of this manager.
- * @return the shared instance of this manager
- */
- public static ObjectActionContributorManager getManager() {
- if (sharedInstance == null) {
- sharedInstance = new ObjectActionContributorManager();
- }
- return sharedInstance;
- }
+ /**
+ * Returns the shared instance of this manager.
+ *
+ * @return the shared instance of this manager
+ */
+ public static ObjectActionContributorManager getManager() {
+ if (sharedInstance == null) {
+ sharedInstance = new ObjectActionContributorManager();
+ }
+ return sharedInstance;
+ }
- /**
- * Loads the contributors from the workbench's registry.
- */
- private void loadContributors() {
- ObjectActionContributorReader reader = new ObjectActionContributorReader();
- reader.readPopupContributors(this);
- }
+ /**
+ * Loads the contributors from the workbench's registry.
+ */
+ private void loadContributors() {
+ ObjectActionContributorReader reader = new ObjectActionContributorReader();
+ reader.readPopupContributors(this);
+ }
@Override
public void addExtension(IExtensionTracker tracker, IExtension addedExtension) {
- IConfigurationElement[] addedElements = addedExtension.getConfigurationElements();
- for (IConfigurationElement addedElement : addedElements) {
- ObjectActionContributorReader reader = new ObjectActionContributorReader();
- reader.setManager(this);
- reader.readElement(addedElement);
- }
- }
+ IConfigurationElement[] addedElements = addedExtension.getConfigurationElements();
+ for (IConfigurationElement addedElement : addedElements) {
+ ObjectActionContributorReader reader = new ObjectActionContributorReader();
+ reader.setManager(this);
+ reader.readElement(addedElement);
+ }
+ }
@Override
protected String getExtensionPointFilter() {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectActionContributorReader.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectActionContributorReader.java
index 9b1bc913862..72e710eae46 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectActionContributorReader.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectActionContributorReader.java
@@ -21,63 +21,61 @@ import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants;
import org.eclipse.ui.internal.registry.RegistryReader;
/**
- * This reader loads the popup menu manager with all the
- * popup menu contributors found in the workbench registry.
+ * This reader loads the popup menu manager with all the popup menu contributors
+ * found in the workbench registry.
*/
public class ObjectActionContributorReader extends RegistryReader {
- private ObjectActionContributorManager manager;
+ private ObjectActionContributorManager manager;
- /**
- * Creates popup menu contributor from this element.
- */
- protected void processObjectContribution(IConfigurationElement element) {
- String objectClassName = element.getAttribute(IWorkbenchRegistryConstants.ATT_OBJECTCLASS);
- if (objectClassName == null) {
- logMissingAttribute(element, IWorkbenchRegistryConstants.ATT_OBJECTCLASS);
- return;
- }
+ /**
+ * Creates popup menu contributor from this element.
+ */
+ protected void processObjectContribution(IConfigurationElement element) {
+ String objectClassName = element.getAttribute(IWorkbenchRegistryConstants.ATT_OBJECTCLASS);
+ if (objectClassName == null) {
+ logMissingAttribute(element, IWorkbenchRegistryConstants.ATT_OBJECTCLASS);
+ return;
+ }
- IObjectContributor contributor = new ObjectActionContributor(element);
- manager.registerContributor(contributor, objectClassName);
- }
+ IObjectContributor contributor = new ObjectActionContributor(element);
+ manager.registerContributor(contributor, objectClassName);
+ }
- /**
- * Implements abstract method to handle configuration elements.
- */
- @Override
+ /**
+ * Implements abstract method to handle configuration elements.
+ */
+ @Override
protected boolean readElement(IConfigurationElement element) {
- String tagName = element.getName();
- if (tagName.equals(IWorkbenchRegistryConstants.TAG_OBJECT_CONTRIBUTION)) {
- processObjectContribution(element);
- return true;
- }
- if (tagName.equals(IWorkbenchRegistryConstants.TAG_VIEWER_CONTRIBUTION)) {
- return true;
- }
+ String tagName = element.getName();
+ if (tagName.equals(IWorkbenchRegistryConstants.TAG_OBJECT_CONTRIBUTION)) {
+ processObjectContribution(element);
+ return true;
+ }
+ if (tagName.equals(IWorkbenchRegistryConstants.TAG_VIEWER_CONTRIBUTION)) {
+ return true;
+ }
- return false;
- }
+ return false;
+ }
- /**
- * Reads the registry and registers popup menu contributors
- * found there.
- *
- * @param mng the manager to read into
- */
- public void readPopupContributors(ObjectActionContributorManager mng) {
- setManager(mng);
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- readRegistry(registry, PlatformUI.PLUGIN_ID,
- IWorkbenchRegistryConstants.PL_POPUP_MENU);
- }
+ /**
+ * Reads the registry and registers popup menu contributors found there.
+ *
+ * @param mng the manager to read into
+ */
+ public void readPopupContributors(ObjectActionContributorManager mng) {
+ setManager(mng);
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ readRegistry(registry, PlatformUI.PLUGIN_ID, IWorkbenchRegistryConstants.PL_POPUP_MENU);
+ }
- /**
- * Set the manager to read into.
- *
- * @param mng the manager
- */
- public void setManager(ObjectActionContributorManager mng) {
- manager = mng;
- }
+ /**
+ * Set the manager to read into.
+ *
+ * @param mng the manager
+ */
+ public void setManager(ObjectActionContributorManager mng) {
+ manager = mng;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectContributorManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectContributorManager.java
index ff53d763d0c..aa642213a63 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectContributorManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectContributorManager.java
@@ -38,20 +38,19 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.PlatformUI;
/**
- * This class is a default implementation of <code>IObjectContributorManager</code>.
- * It provides fast merging of contributions with the following semantics:
+ * This class is a default implementation of
+ * <code>IObjectContributorManager</code>. It provides fast merging of
+ * contributions with the following semantics:
* <ul>
- * <li> All of the matching contributors will be invoked per property lookup
- * <li> The search order from a class with the definition<br>
- * <code>class X extends Y implements A, B</code><br>
- * is as follows:
- * <il>
- * <li>the target's class: X
- * <li>X's superclasses in order to <code>Object</code>
- * <li>a depth-first traversal of the target class's interaces in the order
- * returned by <code>getInterfaces()</code> (in the example, A and
- * its superinterfaces then B and its superinterfaces)
- * </il>
+ * <li>All of the matching contributors will be invoked per property lookup
+ * <li>The search order from a class with the definition<br>
+ * <code>class X extends Y implements A, B</code><br>
+ * is as follows: <il>
+ * <li>the target's class: X
+ * <li>X's superclasses in order to <code>Object</code>
+ * <li>a depth-first traversal of the target class's interaces in the order
+ * returned by <code>getInterfaces()</code> (in the example, A and its
+ * superinterfaces then B and its superinterfaces) </il>
* </ul>
*
* @see IObjectContributor
@@ -75,43 +74,48 @@ public abstract class ObjectContributorManager implements IExtensionChangeHandle
IObjectContributor contributor;
}
- /** Table of contributors. */
- protected Map contributors;
+ /** Table of contributors. */
+ protected Map contributors;
- /** Cache of object class contributor search paths; <code>null</code> if none. */
- protected Map objectLookup;
+ /**
+ * Cache of object class contributor search paths; <code>null</code> if none.
+ */
+ protected Map objectLookup;
- /** Cache of resource adapter class contributor search paths; <code>null</code> if none. */
- protected Map resourceAdapterLookup;
+ /**
+ * Cache of resource adapter class contributor search paths; <code>null</code>
+ * if none.
+ */
+ protected Map resourceAdapterLookup;
- /** Cache of adaptable class contributor search paths; <code>null</code> if none. */
- protected Map adaptableLookup;
+ /**
+ * Cache of adaptable class contributor search paths; <code>null</code> if none.
+ */
+ protected Map adaptableLookup;
- protected Set contributorRecordSet;
+ protected Set contributorRecordSet;
- /**
- * Constructs a new contributor manager.
- */
- public ObjectContributorManager() {
- contributors = new Hashtable(5);
- contributorRecordSet = new HashSet(5);
- objectLookup = null;
- resourceAdapterLookup = null;
- adaptableLookup = null;
- String extensionPointId = getExtensionPointFilter();
- if (extensionPointId != null) {
- IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(
- PlatformUI.PLUGIN_ID, extensionPointId);
- IExtensionTracker tracker = PlatformUI.getWorkbench()
- .getExtensionTracker();
- tracker.registerHandler(this, ExtensionTracker
- .createExtensionPointFilter(extensionPoint));
+ /**
+ * Constructs a new contributor manager.
+ */
+ public ObjectContributorManager() {
+ contributors = new Hashtable(5);
+ contributorRecordSet = new HashSet(5);
+ objectLookup = null;
+ resourceAdapterLookup = null;
+ adaptableLookup = null;
+ String extensionPointId = getExtensionPointFilter();
+ if (extensionPointId != null) {
+ IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(PlatformUI.PLUGIN_ID,
+ extensionPointId);
+ IExtensionTracker tracker = PlatformUI.getWorkbench().getExtensionTracker();
+ tracker.registerHandler(this, ExtensionTracker.createExtensionPointFilter(extensionPoint));
}
- }
+ }
- /**
- * Return the extension point id (local to org.eclipse.ui) that this manager
- * is associated with. Default implementation returns null, which implies no
+ /**
+ * Return the extension point id (local to org.eclipse.ui) that this manager is
+ * associated with. Default implementation returns null, which implies no
* relationship with a particular extension.
*
* @return the extension point id
@@ -122,300 +126,287 @@ public abstract class ObjectContributorManager implements IExtensionChangeHandle
}
/**
- * Adds contributors for the given types to the result list.
- */
- private void addContributorsFor(List types, List result) {
- for (Iterator classes = types.iterator(); classes.hasNext();) {
- Class clazz = (Class) classes.next();
- List contributorList = (List) contributors.get(clazz.getName());
- if (contributorList != null) {
+ * Adds contributors for the given types to the result list.
+ */
+ private void addContributorsFor(List types, List result) {
+ for (Iterator classes = types.iterator(); classes.hasNext();) {
+ Class clazz = (Class) classes.next();
+ List contributorList = (List) contributors.get(clazz.getName());
+ if (contributorList != null) {
result.addAll(contributorList);
}
- }
- }
-
- /**
- * Returns the class search order starting with <code>extensibleClass</code>.
- * The search order is defined in this class' comment.
- */
- protected final List computeClassOrder(Class extensibleClass) {
- ArrayList result = new ArrayList(4);
- Class clazz = extensibleClass;
- while (clazz != null) {
- result.add(clazz);
- clazz = clazz.getSuperclass();
- }
- return result;
- }
-
- /**
- * Returns the interface search order for the class hierarchy described
- * by <code>classList</code>.
- * The search order is defined in this class' comment.
- */
- protected final List computeInterfaceOrder(List classList) {
- ArrayList result = new ArrayList(4);
- Map seen = new HashMap(4);
- for (Iterator list = classList.iterator(); list.hasNext();) {
- Class[] interfaces = ((Class) list.next()).getInterfaces();
- internalComputeInterfaceOrder(interfaces, result, seen);
- }
- return result;
- }
-
- /**
- * Flushes the cache of contributor search paths. This is generally required
- * whenever a contributor is added or removed.
- * <p>
- * It is likely easier to just toss the whole cache rather than trying to be
- * smart and remove only those entries affected.
- */
- public void flushLookup() {
- objectLookup = null;
- resourceAdapterLookup = null;
- adaptableLookup = null;
- }
-
- /**
- * Cache the real adapter class contributor search path.
- */
- private void cacheResourceAdapterLookup(Class adapterClass, List results) {
- if (resourceAdapterLookup == null) {
+ }
+ }
+
+ /**
+ * Returns the class search order starting with <code>extensibleClass</code>.
+ * The search order is defined in this class' comment.
+ */
+ protected final List computeClassOrder(Class extensibleClass) {
+ ArrayList result = new ArrayList(4);
+ Class clazz = extensibleClass;
+ while (clazz != null) {
+ result.add(clazz);
+ clazz = clazz.getSuperclass();
+ }
+ return result;
+ }
+
+ /**
+ * Returns the interface search order for the class hierarchy described by
+ * <code>classList</code>. The search order is defined in this class' comment.
+ */
+ protected final List computeInterfaceOrder(List classList) {
+ ArrayList result = new ArrayList(4);
+ Map seen = new HashMap(4);
+ for (Iterator list = classList.iterator(); list.hasNext();) {
+ Class[] interfaces = ((Class) list.next()).getInterfaces();
+ internalComputeInterfaceOrder(interfaces, result, seen);
+ }
+ return result;
+ }
+
+ /**
+ * Flushes the cache of contributor search paths. This is generally required
+ * whenever a contributor is added or removed.
+ * <p>
+ * It is likely easier to just toss the whole cache rather than trying to be
+ * smart and remove only those entries affected.
+ */
+ public void flushLookup() {
+ objectLookup = null;
+ resourceAdapterLookup = null;
+ adaptableLookup = null;
+ }
+
+ /**
+ * Cache the real adapter class contributor search path.
+ */
+ private void cacheResourceAdapterLookup(Class adapterClass, List results) {
+ if (resourceAdapterLookup == null) {
resourceAdapterLookup = new HashMap();
}
- resourceAdapterLookup.put(adapterClass, results);
- }
+ resourceAdapterLookup.put(adapterClass, results);
+ }
- /**
- * Cache the real adapter class contributor search path.
- */
- private void cacheAdaptableLookup(String adapterClass, List results) {
- if (adaptableLookup == null) {
+ /**
+ * Cache the real adapter class contributor search path.
+ */
+ private void cacheAdaptableLookup(String adapterClass, List results) {
+ if (adaptableLookup == null) {
adaptableLookup = new HashMap();
}
- adaptableLookup.put(adapterClass, results);
- }
+ adaptableLookup.put(adapterClass, results);
+ }
- /**
- * Cache the object class contributor search path.
- */
- private void cacheObjectLookup(Class objectClass, List results) {
- if (objectLookup == null) {
+ /**
+ * Cache the object class contributor search path.
+ */
+ private void cacheObjectLookup(Class objectClass, List results) {
+ if (objectLookup == null) {
objectLookup = new HashMap();
}
- objectLookup.put(objectClass, results);
- }
-
- /**
- * Get the contributions registered to this manager.
- *
- * @return an unmodifiable <code>Collection</code> containing all registered
- * contributions. The objects in this <code>Collection</code> will be
- * <code>List</code>s containing the actual contributions.
- * @since 3.0
- */
- public Collection getContributors() {
- return Collections.unmodifiableCollection(contributors.values());
- }
-
- /**
- * Return the list of contributors for the supplied class.
- */
- protected List addContributorsFor(Class objectClass) {
-
- List classList = computeClassOrder(objectClass);
- List result = new ArrayList();
- addContributorsFor(classList, result);
- classList = computeInterfaceOrder(classList); // interfaces
- addContributorsFor(classList, result);
- return result;
- }
-
- /**
- * Returns true if contributors exist in the manager for
- * this object and any of it's super classes, interfaces, or
- * adapters.
- *
- * @param object the object to test
- * @return whether the object has contributors
- */
- public boolean hasContributorsFor(Object object) {
-
- List contributors = getContributors(object);
- return contributors.size() > 0;
- }
-
- /**
- * Add interface Class objects to the result list based
- * on the class hierarchy. Interfaces will be searched
- * based on their position in the result list.
- */
- private void internalComputeInterfaceOrder(Class[] interfaces, List result,
- Map seen) {
- List newInterfaces = new ArrayList(seen.size());
- for (Class currentInterface : interfaces) {
- if (seen.get(currentInterface) == null) {
- result.add(currentInterface);
- seen.put(currentInterface, currentInterface);
- newInterfaces.add(currentInterface);
- }
- }
- for (Iterator newList = newInterfaces.iterator(); newList.hasNext();) {
- internalComputeInterfaceOrder(((Class) newList.next())
- .getInterfaces(), result, seen);
- }
- }
-
- /**
+ objectLookup.put(objectClass, results);
+ }
+
+ /**
+ * Get the contributions registered to this manager.
+ *
+ * @return an unmodifiable <code>Collection</code> containing all registered
+ * contributions. The objects in this <code>Collection</code> will be
+ * <code>List</code>s containing the actual contributions.
+ * @since 3.0
+ */
+ public Collection getContributors() {
+ return Collections.unmodifiableCollection(contributors.values());
+ }
+
+ /**
+ * Return the list of contributors for the supplied class.
+ */
+ protected List addContributorsFor(Class objectClass) {
+
+ List classList = computeClassOrder(objectClass);
+ List result = new ArrayList();
+ addContributorsFor(classList, result);
+ classList = computeInterfaceOrder(classList); // interfaces
+ addContributorsFor(classList, result);
+ return result;
+ }
+
+ /**
+ * Returns true if contributors exist in the manager for this object and any of
+ * it's super classes, interfaces, or adapters.
+ *
+ * @param object the object to test
+ * @return whether the object has contributors
+ */
+ public boolean hasContributorsFor(Object object) {
+
+ List contributors = getContributors(object);
+ return contributors.size() > 0;
+ }
+
+ /**
+ * Add interface Class objects to the result list based on the class hierarchy.
+ * Interfaces will be searched based on their position in the result list.
+ */
+ private void internalComputeInterfaceOrder(Class[] interfaces, List result, Map seen) {
+ List newInterfaces = new ArrayList(seen.size());
+ for (Class currentInterface : interfaces) {
+ if (seen.get(currentInterface) == null) {
+ result.add(currentInterface);
+ seen.put(currentInterface, currentInterface);
+ newInterfaces.add(currentInterface);
+ }
+ }
+ for (Iterator newList = newInterfaces.iterator(); newList.hasNext();) {
+ internalComputeInterfaceOrder(((Class) newList.next()).getInterfaces(), result, seen);
+ }
+ }
+
+ /**
* Return whether the given contributor is applicable to all elements in the
* selection.
*
- * @param selection
- * the selection
- * @param contributor
- * the contributor
+ * @param selection the selection
+ * @param contributor the contributor
* @return whether it is applicable
*/
- public boolean isApplicableTo(IStructuredSelection selection,
- IObjectContributor contributor) {
- Iterator elements = selection.iterator();
- while (elements.hasNext()) {
- if (contributor.isApplicableTo(elements.next()) == false) {
+ public boolean isApplicableTo(IStructuredSelection selection, IObjectContributor contributor) {
+ Iterator elements = selection.iterator();
+ while (elements.hasNext()) {
+ if (contributor.isApplicableTo(elements.next()) == false) {
return false;
}
- }
- return true;
- }
+ }
+ return true;
+ }
- /**
+ /**
* Return whether the given contributor is applicable to all elements in the
* list.
*
- * @param list
- * the selection
- * @param contributor
- * the contributor
+ * @param list the selection
+ * @param contributor the contributor
* @return whether it is applicable
*/
- public boolean isApplicableTo(List list, IObjectContributor contributor) {
- Iterator elements = list.iterator();
- while (elements.hasNext()) {
- if (contributor.isApplicableTo(elements.next()) == false) {
+ public boolean isApplicableTo(List list, IObjectContributor contributor) {
+ Iterator elements = list.iterator();
+ while (elements.hasNext()) {
+ if (contributor.isApplicableTo(elements.next()) == false) {
return false;
}
- }
- return true;
- }
-
- /**
- * Register a contributor.
- *
- * @param contributor the contributor
- * @param targetType the target type
- */
- public void registerContributor(IObjectContributor contributor,
- String targetType) {
- List contributorList = (List) contributors.get(targetType);
- if (contributorList == null) {
- contributorList = new ArrayList(5);
- contributors.put(targetType, contributorList);
- }
- contributorList.add(contributor);
- flushLookup();
-
- IConfigurationElement element = Adapters.adapt(contributor, IConfigurationElement.class);
-
- //hook the object listener
- if (element != null) {
- ContributorRecord contributorRecord = new ContributorRecord(
- contributor, targetType);
+ }
+ return true;
+ }
+
+ /**
+ * Register a contributor.
+ *
+ * @param contributor the contributor
+ * @param targetType the target type
+ */
+ public void registerContributor(IObjectContributor contributor, String targetType) {
+ List contributorList = (List) contributors.get(targetType);
+ if (contributorList == null) {
+ contributorList = new ArrayList(5);
+ contributors.put(targetType, contributorList);
+ }
+ contributorList.add(contributor);
+ flushLookup();
+
+ IConfigurationElement element = Adapters.adapt(contributor, IConfigurationElement.class);
+
+ // hook the object listener
+ if (element != null) {
+ ContributorRecord contributorRecord = new ContributorRecord(contributor, targetType);
contributorRecordSet.add(contributorRecord);
- PlatformUI.getWorkbench().getExtensionTracker().registerObject(
- element.getDeclaringExtension(), contributorRecord,
- IExtensionTracker.REF_WEAK);
- }
- }
-
- /**
- * Unregister all contributors.
- */
- public void unregisterAllContributors() {
- contributors = new Hashtable(5);
- flushLookup();
- }
-
- /**
- * Unregister a contributor from the target type.
- *
- * @param contributor the contributor
- * @param targetType the target type
- */
- public void unregisterContributor(IObjectContributor contributor,
- String targetType) {
- List contributorList = (List) contributors.get(targetType);
- if (contributorList == null) {
+ PlatformUI.getWorkbench().getExtensionTracker().registerObject(element.getDeclaringExtension(),
+ contributorRecord, IExtensionTracker.REF_WEAK);
+ }
+ }
+
+ /**
+ * Unregister all contributors.
+ */
+ public void unregisterAllContributors() {
+ contributors = new Hashtable(5);
+ flushLookup();
+ }
+
+ /**
+ * Unregister a contributor from the target type.
+ *
+ * @param contributor the contributor
+ * @param targetType the target type
+ */
+ public void unregisterContributor(IObjectContributor contributor, String targetType) {
+ List contributorList = (List) contributors.get(targetType);
+ if (contributorList == null) {
return;
}
- contributorList.remove(contributor);
- if (contributorList.isEmpty()) {
+ contributorList.remove(contributor);
+ if (contributorList.isEmpty()) {
contributors.remove(targetType);
}
- flushLookup();
- }
-
+ flushLookup();
+ }
- /**
- * Unregister all contributors for the target type.
- *
- * @param targetType the target type
- */
- public void unregisterContributors(String targetType) {
- contributors.remove(targetType);
- flushLookup();
- }
+ /**
+ * Unregister all contributors for the target type.
+ *
+ * @param targetType the target type
+ */
+ public void unregisterContributors(String targetType) {
+ contributors.remove(targetType);
+ flushLookup();
+ }
- protected List getContributors(Object object) {
- // Determine is the object is a resource
- Object resource = LegacyResourceSupport.getAdaptedContributorResource(object);
+ protected List getContributors(Object object) {
+ // Determine is the object is a resource
+ Object resource = LegacyResourceSupport.getAdaptedContributorResource(object);
- // Fetch the unique adapters
- List adapters = new ArrayList(Arrays.asList(Platform.getAdapterManager().computeAdapterTypes(object.getClass())));
- removeCommonAdapters(adapters, Arrays.asList(new Class[] {object.getClass()}));
+ // Fetch the unique adapters
+ List adapters = new ArrayList(
+ Arrays.asList(Platform.getAdapterManager().computeAdapterTypes(object.getClass())));
+ removeCommonAdapters(adapters, Arrays.asList(new Class[] { object.getClass() }));
- List contributors = new ArrayList();
+ List contributors = new ArrayList();
- // Calculate the contributors for this object class
- addAll(contributors, getObjectContributors(object.getClass()));
- // Calculate the contributors for resource classes
- if(resource != null) {
+ // Calculate the contributors for this object class
+ addAll(contributors, getObjectContributors(object.getClass()));
+ // Calculate the contributors for resource classes
+ if (resource != null) {
addAll(contributors, getResourceContributors(resource.getClass()));
}
- // Calculate the contributors for each adapter type
- if(adapters != null) {
- for (Iterator it = adapters.iterator(); it.hasNext();) {
+ // Calculate the contributors for each adapter type
+ if (adapters != null) {
+ for (Iterator it = adapters.iterator(); it.hasNext();) {
String adapter = (String) it.next();
addAll(contributors, getAdaptableContributors(adapter));
}
- }
-
- // Remove duplicates. Note: this -must- maintain the element order to preserve menu order.
- contributors = removeDups(contributors);
-
- return contributors.isEmpty() ? Collections.EMPTY_LIST : new ArrayList(contributors);
- }
-
- /**
- * Returns the contributions for the given class. This considers
- * contributors on any super classes and interfaces.
- *
- * @param objectClass the class to search for contributions.
- * @return the contributions for the given class. This considers
- * contributors on any super classes and interfaces.
- *
- * @since 3.1
- */
- protected List getObjectContributors(Class objectClass) {
+ }
+
+ // Remove duplicates. Note: this -must- maintain the element order to preserve
+ // menu order.
+ contributors = removeDups(contributors);
+
+ return contributors.isEmpty() ? Collections.EMPTY_LIST : new ArrayList(contributors);
+ }
+
+ /**
+ * Returns the contributions for the given class. This considers contributors on
+ * any super classes and interfaces.
+ *
+ * @param objectClass the class to search for contributions.
+ * @return the contributions for the given class. This considers contributors on
+ * any super classes and interfaces.
+ *
+ * @since 3.1
+ */
+ protected List getObjectContributors(Class objectClass) {
List objectList = null;
// Lookup the results in the cache first.
if (objectLookup != null) {
@@ -425,8 +416,7 @@ public abstract class ObjectContributorManager implements IExtensionChangeHandle
objectList = addContributorsFor(objectClass);
if (objectList.isEmpty()) {
objectList = Collections.EMPTY_LIST;
- }
- else {
+ } else {
objectList = Collections.unmodifiableList(objectList);
}
cacheObjectLookup(objectClass, objectList);
@@ -434,17 +424,17 @@ public abstract class ObjectContributorManager implements IExtensionChangeHandle
return objectList;
}
- /**
- * Returns the contributions for the given <code>IResource</code>class.
- * This considers contributors on any super classes and interfaces. This
- * will only return contributions that are adaptable.
- *
- * @param resourceClass the class to search for contributions.
- * @return the contributions for the given class. This considers
- * adaptable contributors on any super classes and interfaces.
- *
- * @since 3.1
- */
+ /**
+ * Returns the contributions for the given <code>IResource</code>class. This
+ * considers contributors on any super classes and interfaces. This will only
+ * return contributions that are adaptable.
+ *
+ * @param resourceClass the class to search for contributions.
+ * @return the contributions for the given class. This considers adaptable
+ * contributors on any super classes and interfaces.
+ *
+ * @since 3.1
+ */
protected List getResourceContributors(Class resourceClass) {
List resourceList = null;
if (resourceAdapterLookup != null) {
@@ -462,15 +452,15 @@ public abstract class ObjectContributorManager implements IExtensionChangeHandle
return resourceList;
}
- /**
- * Returns the contributions for the given type name.
- *
- * @param adapterType the class to search for contributions.
- * @return the contributions for the given class. This considers
- * contributors to this specific type.
- *
- * @since 3.1
- */
+ /**
+ * Returns the contributions for the given type name.
+ *
+ * @param adapterType the class to search for contributions.
+ * @return the contributions for the given class. This considers contributors to
+ * this specific type.
+ *
+ * @since 3.1
+ */
protected List getAdaptableContributors(String adapterType) {
List adaptableList = null;
// Lookup the results in the cache first, there are two caches
@@ -482,10 +472,10 @@ public abstract class ObjectContributorManager implements IExtensionChangeHandle
if (adaptableList == null) {
// ignore resource adapters because these must be adapted via the
// IContributorResourceAdapter.
- if (LegacyResourceSupport.isResourceType(adapterType) || LegacyResourceSupport.isResourceMappingType(adapterType)) {
+ if (LegacyResourceSupport.isResourceType(adapterType)
+ || LegacyResourceSupport.isResourceMappingType(adapterType)) {
adaptableList = Collections.EMPTY_LIST;
- }
- else {
+ } else {
adaptableList = (List) contributors.get(adapterType);
if (adaptableList == null || adaptableList.isEmpty()) {
adaptableList = Collections.EMPTY_LIST;
@@ -499,14 +489,15 @@ public abstract class ObjectContributorManager implements IExtensionChangeHandle
}
/**
- * Prunes from the list of adapters type names that are in the class
- * search order of every class in <code>results</code>.
+ * Prunes from the list of adapters type names that are in the class search
+ * order of every class in <code>results</code>.
+ *
* @param adapters
* @param results
* @since 3.1
*/
protected void removeCommonAdapters(List adapters, List results) {
- for (Iterator it = results.iterator(); it.hasNext();) {
+ for (Iterator it = results.iterator(); it.hasNext();) {
Class clazz = ((Class) it.next());
List commonTypes = computeCombinedOrder(clazz);
for (Iterator it2 = commonTypes.iterator(); it2.hasNext();) {
@@ -514,35 +505,35 @@ public abstract class ObjectContributorManager implements IExtensionChangeHandle
adapters.remove(type.getName());
}
}
- }
-
- /**
- * Returns the class search order starting with <code>extensibleClass</code>.
- * The search order is defined in this class' comment.
- */
- protected List computeCombinedOrder(Class inputClass) {
- List result = new ArrayList(4);
- Class clazz = inputClass;
- while (clazz != null) {
- // add the class
- result.add(clazz);
- // add all the interfaces it implements
- Class[] interfaces = clazz.getInterfaces();
- for (Class currentInterface : interfaces) {
- result.add(currentInterface);
- }
- // get the superclass
- clazz = clazz.getSuperclass();
- }
- return result;
- }
+ }
+
+ /**
+ * Returns the class search order starting with <code>extensibleClass</code>.
+ * The search order is defined in this class' comment.
+ */
+ protected List computeCombinedOrder(Class inputClass) {
+ List result = new ArrayList(4);
+ Class clazz = inputClass;
+ while (clazz != null) {
+ // add the class
+ result.add(clazz);
+ // add all the interfaces it implements
+ Class[] interfaces = clazz.getInterfaces();
+ for (Class currentInterface : interfaces) {
+ result.add(currentInterface);
+ }
+ // get the superclass
+ clazz = clazz.getSuperclass();
+ }
+ return result;
+ }
private List filterOnlyAdaptableContributors(List contributors) {
List adaptableContributors = null;
for (Iterator it = contributors.iterator(); it.hasNext();) {
IObjectContributor c = (IObjectContributor) it.next();
- if(c.canAdapt()) {
- if(adaptableContributors == null) {
+ if (c.canAdapt()) {
+ if (adaptableContributors == null) {
adaptableContributors = new ArrayList();
}
adaptableContributors.add(c);
@@ -551,91 +542,91 @@ public abstract class ObjectContributorManager implements IExtensionChangeHandle
return adaptableContributors == null ? Collections.EMPTY_LIST : adaptableContributors;
}
- @Override
+ @Override
public void removeExtension(IExtension source, Object[] objects) {
- for (Object object : objects) {
- if (object instanceof ContributorRecord) {
- ContributorRecord contributorRecord = (ContributorRecord) object;
- unregisterContributor((contributorRecord).contributor, (contributorRecord).objectClassName);
- contributorRecordSet.remove(contributorRecord);
- }
- }
- }
-
- /**
- * Remove listeners and dispose of this manager.
- *
- * @since 3.1
- */
- public void dispose() {
- if(getExtensionPointFilter() != null) {
+ for (Object object : objects) {
+ if (object instanceof ContributorRecord) {
+ ContributorRecord contributorRecord = (ContributorRecord) object;
+ unregisterContributor((contributorRecord).contributor, (contributorRecord).objectClassName);
+ contributorRecordSet.remove(contributorRecord);
+ }
+ }
+ }
+
+ /**
+ * Remove listeners and dispose of this manager.
+ *
+ * @since 3.1
+ */
+ public void dispose() {
+ if (getExtensionPointFilter() != null) {
PlatformUI.getWorkbench().getExtensionTracker().unregisterHandler(this);
}
- }
-
- /**
- * Returns the list of contributors that are interested in the
- * given list of model elements.
- * @param elements a list of model elements (<code>Object</code>)
- * @return the list of interested contributors (<code>IObjectContributor</code>)
- */
- protected List getContributors(List elements) {
- // Calculate the common class, interfaces, and adapters registered
- // via the IAdapterManager.
- List commonAdapters = new ArrayList();
- List commonClasses = getCommonClasses(elements, commonAdapters);
-
- // Get the resource class. It will be null if any of the
- // elements are resources themselves or do not adapt to
- // IResource.
- Class resourceClass = getCommonResourceClass(elements);
- Class resourceMappingClass = getResourceMappingClass(elements);
-
- // Get the contributors.
-
- List contributors = new ArrayList();
-
- // Add the resource contributions to avoid duplication
- if (resourceClass != null) {
- addAll(contributors, getResourceContributors(resourceClass));
- }
- if (commonClasses != null && !commonClasses.isEmpty()) {
- for (int i = 0; i < commonClasses.size(); i++) {
- List results = getObjectContributors((Class) commonClasses
- .get(i));
- addAll(contributors, results);
- }
- }
- // Add the resource mappings explicitly to avoid possible duplication
- if (resourceMappingClass == null) {
- // Still show the menus if the object is not adaptable but the adapter manager
- // has an entry for it
- resourceMappingClass = LegacyResourceSupport
- .getResourceMappingClass();
- if (resourceMappingClass != null
- && commonAdapters.contains(resourceMappingClass.getName())) {
- addAll(contributors, getResourceContributors(resourceMappingClass));
- }
- } else {
- contributors.addAll(getResourceContributors(resourceMappingClass));
- }
- if (!commonAdapters.isEmpty()) {
- for (Iterator it = commonAdapters.iterator(); it.hasNext();) {
- String adapter = (String) it.next();
- addAll(contributors, getAdaptableContributors(adapter));
- }
- }
-
- // Remove duplicates. Note: this -must- maintain the element order to preserve menu order.
- contributors = removeDups(contributors);
-
- return contributors.isEmpty() ? Collections.EMPTY_LIST : new ArrayList(contributors);
- }
-
- /**
- * Adds all items in toAdd to the given collection. Optimized to avoid creating an iterator.
- * This assumes that toAdd is efficient to index (i.e. it's an ArrayList or some other RandomAccessList),
- * which is the case for all uses in this class.
+ }
+
+ /**
+ * Returns the list of contributors that are interested in the given list of
+ * model elements.
+ *
+ * @param elements a list of model elements (<code>Object</code>)
+ * @return the list of interested contributors (<code>IObjectContributor</code>)
+ */
+ protected List getContributors(List elements) {
+ // Calculate the common class, interfaces, and adapters registered
+ // via the IAdapterManager.
+ List commonAdapters = new ArrayList();
+ List commonClasses = getCommonClasses(elements, commonAdapters);
+
+ // Get the resource class. It will be null if any of the
+ // elements are resources themselves or do not adapt to
+ // IResource.
+ Class resourceClass = getCommonResourceClass(elements);
+ Class resourceMappingClass = getResourceMappingClass(elements);
+
+ // Get the contributors.
+
+ List contributors = new ArrayList();
+
+ // Add the resource contributions to avoid duplication
+ if (resourceClass != null) {
+ addAll(contributors, getResourceContributors(resourceClass));
+ }
+ if (commonClasses != null && !commonClasses.isEmpty()) {
+ for (int i = 0; i < commonClasses.size(); i++) {
+ List results = getObjectContributors((Class) commonClasses.get(i));
+ addAll(contributors, results);
+ }
+ }
+ // Add the resource mappings explicitly to avoid possible duplication
+ if (resourceMappingClass == null) {
+ // Still show the menus if the object is not adaptable but the adapter manager
+ // has an entry for it
+ resourceMappingClass = LegacyResourceSupport.getResourceMappingClass();
+ if (resourceMappingClass != null && commonAdapters.contains(resourceMappingClass.getName())) {
+ addAll(contributors, getResourceContributors(resourceMappingClass));
+ }
+ } else {
+ contributors.addAll(getResourceContributors(resourceMappingClass));
+ }
+ if (!commonAdapters.isEmpty()) {
+ for (Iterator it = commonAdapters.iterator(); it.hasNext();) {
+ String adapter = (String) it.next();
+ addAll(contributors, getAdaptableContributors(adapter));
+ }
+ }
+
+ // Remove duplicates. Note: this -must- maintain the element order to preserve
+ // menu order.
+ contributors = removeDups(contributors);
+
+ return contributors.isEmpty() ? Collections.EMPTY_LIST : new ArrayList(contributors);
+ }
+
+ /**
+ * Adds all items in toAdd to the given collection. Optimized to avoid creating
+ * an iterator. This assumes that toAdd is efficient to index (i.e. it's an
+ * ArrayList or some other RandomAccessList), which is the case for all uses in
+ * this class.
*/
private static void addAll(Collection collection, List toAdd) {
for (int i = 0, size = toAdd.size(); i < size; ++i) {
@@ -643,158 +634,160 @@ public abstract class ObjectContributorManager implements IExtensionChangeHandle
}
}
- /**
- * Removes duplicates from the given list, preserving order.
- */
- private static List removeDups(List list) {
- if (list.size() <= 1) {
- return list;
- }
- HashSet set = new HashSet(list);
- if (set.size() == list.size()) {
- return list;
- }
- ArrayList result = new ArrayList(set.size());
- for (Iterator i = list.iterator(); i.hasNext();) {
- Object o = i.next();
- if (set.remove(o)) {
- result.add(o);
- }
- }
- return result;
- }
-
- /**
- * Returns the common denominator class, interfaces, and adapters
- * for the given collection of objects.
- */
- private List getCommonClasses(List objects, List commonAdapters) {
- if (objects == null || objects.isEmpty()) {
+ /**
+ * Removes duplicates from the given list, preserving order.
+ */
+ private static List removeDups(List list) {
+ if (list.size() <= 1) {
+ return list;
+ }
+ HashSet set = new HashSet(list);
+ if (set.size() == list.size()) {
+ return list;
+ }
+ ArrayList result = new ArrayList(set.size());
+ for (Iterator i = list.iterator(); i.hasNext();) {
+ Object o = i.next();
+ if (set.remove(o)) {
+ result.add(o);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Returns the common denominator class, interfaces, and adapters for the given
+ * collection of objects.
+ */
+ private List getCommonClasses(List objects, List commonAdapters) {
+ if (objects == null || objects.isEmpty()) {
return null;
}
- // Optimization: if n==1 (or if all objects are of the same class), then the common class is the object's class,
- // and the common adapters are the adapters cached for that class in the adapter manager
- // See bug 177592 for more details.
- if (allSameClass(objects)) {
-
- Class clazz = objects.get(0).getClass();
- commonAdapters.addAll(Arrays.asList(Platform.getAdapterManager().computeAdapterTypes(clazz)));
- List result = new ArrayList(1);
- result.add(clazz);
- return result;
- }
-
- // Compute all the super classes, interfaces, and adapters
- // for the first element.
- List classes = computeClassOrder(objects.get(0).getClass());
- List adapters = computeAdapterOrder(classes);
- List interfaces = computeInterfaceOrder(classes);
-
- // Cache of all types found in the selection - this is needed
- // to compute common adapters.
- List lastCommonTypes = new ArrayList();
-
- boolean classesEmpty = classes.isEmpty();
- boolean interfacesEmpty = interfaces.isEmpty();
-
- // Traverse the selection if there is more than one element selected.
- for (int i = 1; i < objects.size(); i++) {
- // Compute all the super classes for the current element
- List otherClasses = computeClassOrder(objects.get(i).getClass());
- if (!classesEmpty) {
- classesEmpty = extractCommonClasses(classes, otherClasses);
- }
-
- // Compute all the interfaces for the current element
- // and all of its super classes.
- List otherInterfaces = computeInterfaceOrder(otherClasses);
- if (!interfacesEmpty) {
- interfacesEmpty = extractCommonClasses(interfaces,
- otherInterfaces);
- }
-
- // Compute all the adapters provided for the calculated
- // classes and interfaces for this element.
- List classesAndInterfaces = new ArrayList(otherClasses);
- if (otherInterfaces != null) {
+ // Optimization: if n==1 (or if all objects are of the same class), then the
+ // common class is the object's class,
+ // and the common adapters are the adapters cached for that class in the adapter
+ // manager
+ // See bug 177592 for more details.
+ if (allSameClass(objects)) {
+
+ Class clazz = objects.get(0).getClass();
+ commonAdapters.addAll(Arrays.asList(Platform.getAdapterManager().computeAdapterTypes(clazz)));
+ List result = new ArrayList(1);
+ result.add(clazz);
+ return result;
+ }
+
+ // Compute all the super classes, interfaces, and adapters
+ // for the first element.
+ List classes = computeClassOrder(objects.get(0).getClass());
+ List adapters = computeAdapterOrder(classes);
+ List interfaces = computeInterfaceOrder(classes);
+
+ // Cache of all types found in the selection - this is needed
+ // to compute common adapters.
+ List lastCommonTypes = new ArrayList();
+
+ boolean classesEmpty = classes.isEmpty();
+ boolean interfacesEmpty = interfaces.isEmpty();
+
+ // Traverse the selection if there is more than one element selected.
+ for (int i = 1; i < objects.size(); i++) {
+ // Compute all the super classes for the current element
+ List otherClasses = computeClassOrder(objects.get(i).getClass());
+ if (!classesEmpty) {
+ classesEmpty = extractCommonClasses(classes, otherClasses);
+ }
+
+ // Compute all the interfaces for the current element
+ // and all of its super classes.
+ List otherInterfaces = computeInterfaceOrder(otherClasses);
+ if (!interfacesEmpty) {
+ interfacesEmpty = extractCommonClasses(interfaces, otherInterfaces);
+ }
+
+ // Compute all the adapters provided for the calculated
+ // classes and interfaces for this element.
+ List classesAndInterfaces = new ArrayList(otherClasses);
+ if (otherInterfaces != null) {
classesAndInterfaces.addAll(otherInterfaces);
}
- List otherAdapters = computeAdapterOrder(classesAndInterfaces);
-
- // Compute common adapters
- // Note here that an adapter can match a class or interface, that is
- // that an element in the selection may not adapt to a type but instead
- // be of that type.
- // If the selected classes doesn't have adapters, keep
- // adapters that match the given classes types (classes and interfaces).
- if (otherAdapters.isEmpty() && !adapters.isEmpty()) {
- removeNonCommonAdapters(adapters, classesAndInterfaces);
- } else {
- if (adapters.isEmpty()) {
- removeNonCommonAdapters(otherAdapters, lastCommonTypes);
- if (!otherAdapters.isEmpty()) {
+ List otherAdapters = computeAdapterOrder(classesAndInterfaces);
+
+ // Compute common adapters
+ // Note here that an adapter can match a class or interface, that is
+ // that an element in the selection may not adapt to a type but instead
+ // be of that type.
+ // If the selected classes doesn't have adapters, keep
+ // adapters that match the given classes types (classes and interfaces).
+ if (otherAdapters.isEmpty() && !adapters.isEmpty()) {
+ removeNonCommonAdapters(adapters, classesAndInterfaces);
+ } else {
+ if (adapters.isEmpty()) {
+ removeNonCommonAdapters(otherAdapters, lastCommonTypes);
+ if (!otherAdapters.isEmpty()) {
adapters.addAll(otherAdapters);
}
- } else {
- // Remove any adapters of the first element that
- // are not in the current element's adapter list.
- for (Iterator it = adapters.iterator(); it.hasNext();) {
- String adapter = (String) it.next();
- if (!otherAdapters.contains(adapter)) {
- it.remove();
- }
- }
- }
- }
-
- // Remember the common search order up to now, this is
- // used to match adapters against common classes or interfaces.
- lastCommonTypes.clear();
- lastCommonTypes.addAll(classes);
- lastCommonTypes.addAll(interfaces);
-
- if (interfacesEmpty && classesEmpty && adapters.isEmpty()) {
- // As soon as we detect nothing in common, just exit.
- return null;
- }
- }
-
- // Once the common classes, interfaces, and adapters are
- // calculated, let's prune the lists to remove duplicates.
- ArrayList results = new ArrayList(4);
- ArrayList superClasses = new ArrayList(4);
- if (!classesEmpty) {
- for (int j = 0; j < classes.size(); j++) {
- if (classes.get(j) != null) {
- superClasses.add(classes.get(j));
- }
- }
- // Just keep the first super class
- if (!superClasses.isEmpty()) {
- results.add(superClasses.get(0));
- }
- }
-
- if (!interfacesEmpty) {
- removeCommonInterfaces(superClasses, interfaces, results);
- }
-
- // Remove adapters already included as common classes
- if (!adapters.isEmpty()) {
- removeCommonAdapters(adapters, results);
- commonAdapters.addAll(adapters);
- }
- return results;
- }
-
- /**
- * Returns <code>true</code> if all objects in the given list are of the same class,
- * <code>false</code> otherwise.
+ } else {
+ // Remove any adapters of the first element that
+ // are not in the current element's adapter list.
+ for (Iterator it = adapters.iterator(); it.hasNext();) {
+ String adapter = (String) it.next();
+ if (!otherAdapters.contains(adapter)) {
+ it.remove();
+ }
+ }
+ }
+ }
+
+ // Remember the common search order up to now, this is
+ // used to match adapters against common classes or interfaces.
+ lastCommonTypes.clear();
+ lastCommonTypes.addAll(classes);
+ lastCommonTypes.addAll(interfaces);
+
+ if (interfacesEmpty && classesEmpty && adapters.isEmpty()) {
+ // As soon as we detect nothing in common, just exit.
+ return null;
+ }
+ }
+
+ // Once the common classes, interfaces, and adapters are
+ // calculated, let's prune the lists to remove duplicates.
+ ArrayList results = new ArrayList(4);
+ ArrayList superClasses = new ArrayList(4);
+ if (!classesEmpty) {
+ for (int j = 0; j < classes.size(); j++) {
+ if (classes.get(j) != null) {
+ superClasses.add(classes.get(j));
+ }
+ }
+ // Just keep the first super class
+ if (!superClasses.isEmpty()) {
+ results.add(superClasses.get(0));
+ }
+ }
+
+ if (!interfacesEmpty) {
+ removeCommonInterfaces(superClasses, interfaces, results);
+ }
+
+ // Remove adapters already included as common classes
+ if (!adapters.isEmpty()) {
+ removeCommonAdapters(adapters, results);
+ commonAdapters.addAll(adapters);
+ }
+ return results;
+ }
+
+ /**
+ * Returns <code>true</code> if all objects in the given list are of the same
+ * class, <code>false</code> otherwise.
*/
private boolean allSameClass(List objects) {
int size = objects.size();
- if (size <= 1) return true;
+ if (size <= 1)
+ return true;
Class clazz = objects.get(0).getClass();
for (int i = 1; i < size; ++i) {
if (!objects.get(i).getClass().equals(clazz)) {
@@ -805,199 +798,191 @@ public abstract class ObjectContributorManager implements IExtensionChangeHandle
}
private boolean extractCommonClasses(List classes, List otherClasses) {
- boolean classesEmpty = true;
- if (otherClasses.isEmpty()) {
- // When no super classes, then it is obvious there
- // are no common super classes with the first element
- // so clear its list.
- classes.clear();
- } else {
- // Remove any super classes of the first element that
- // are not in the current element's super classes list.
- for (int j = 0; j < classes.size(); j++) {
- if (classes.get(j) != null) {
- classesEmpty = false; // TODO: should this only be set if item not nulled out?
- if (!otherClasses.contains(classes.get(j))) {
- classes.set(j, null);
- }
- }
- }
- }
- return classesEmpty;
- }
-
- private void removeNonCommonAdapters(List adapters, List classes) {
- for (int i = 0; i < classes.size(); i++) {
- Object o = classes.get(i);
- if (o != null) {
- Class clazz = (Class) o;
- String name = clazz.getName();
- if (adapters.contains(name)) {
+ boolean classesEmpty = true;
+ if (otherClasses.isEmpty()) {
+ // When no super classes, then it is obvious there
+ // are no common super classes with the first element
+ // so clear its list.
+ classes.clear();
+ } else {
+ // Remove any super classes of the first element that
+ // are not in the current element's super classes list.
+ for (int j = 0; j < classes.size(); j++) {
+ if (classes.get(j) != null) {
+ classesEmpty = false; // TODO: should this only be set if item not nulled out?
+ if (!otherClasses.contains(classes.get(j))) {
+ classes.set(j, null);
+ }
+ }
+ }
+ }
+ return classesEmpty;
+ }
+
+ private void removeNonCommonAdapters(List adapters, List classes) {
+ for (int i = 0; i < classes.size(); i++) {
+ Object o = classes.get(i);
+ if (o != null) {
+ Class clazz = (Class) o;
+ String name = clazz.getName();
+ if (adapters.contains(name)) {
return;
}
- }
- }
- adapters.clear();
- }
-
- private void removeCommonInterfaces(List superClasses, List types,
- List results) {
- List dropInterfaces = null;
- if (!superClasses.isEmpty()) {
- dropInterfaces = computeInterfaceOrder(superClasses);
- }
- for (int j = 0; j < types.size(); j++) {
- if (types.get(j) != null) {
- if (dropInterfaces != null
- && !dropInterfaces.contains(types.get(j))) {
- results.add(types.get(j));
- }
- }
- }
- }
-
- private List computeAdapterOrder(List classList) {
- Set result = new HashSet(4);
- IAdapterManager adapterMgr = Platform.getAdapterManager();
- for (Iterator list = classList.iterator(); list.hasNext();) {
- Class clazz = ((Class) list.next());
+ }
+ }
+ adapters.clear();
+ }
+
+ private void removeCommonInterfaces(List superClasses, List types, List results) {
+ List dropInterfaces = null;
+ if (!superClasses.isEmpty()) {
+ dropInterfaces = computeInterfaceOrder(superClasses);
+ }
+ for (int j = 0; j < types.size(); j++) {
+ if (types.get(j) != null) {
+ if (dropInterfaces != null && !dropInterfaces.contains(types.get(j))) {
+ results.add(types.get(j));
+ }
+ }
+ }
+ }
+
+ private List computeAdapterOrder(List classList) {
+ Set result = new HashSet(4);
+ IAdapterManager adapterMgr = Platform.getAdapterManager();
+ for (Iterator list = classList.iterator(); list.hasNext();) {
+ Class clazz = ((Class) list.next());
for (String adapter : adapterMgr.computeAdapterTypes(clazz)) {
- if (!result.contains(adapter)) {
- result.add(adapter);
- }
- }
- }
- return new ArrayList(result);
- }
-
- /**
- * Returns the common denominator resource class for the given
- * collection of objects.
- * Do not return a resource class if the objects are resources
- * themselves so as to prevent double registration of actions.
- */
- private Class getCommonResourceClass(List objects) {
- if (objects == null || objects.isEmpty()) {
- return null;
- }
- Class resourceClass = LegacyResourceSupport.getResourceClass();
- if (resourceClass == null) {
- // resources plug-in not loaded - no resources. period.
- return null;
- }
-
- List testList = new ArrayList(objects.size());
-
- for (int i = 0; i < objects.size(); i++) {
- Object object = objects.get(i);
-
- if (object instanceof IAdaptable) {
- if (resourceClass.isInstance(object)) {
- continue;
- }
-
- Object resource = LegacyResourceSupport
- .getAdaptedContributorResource(object);
-
- if (resource == null) {
- //Not a resource and does not adapt. No common resource class
- return null;
- }
- testList.add(resource);
- } else {
- return null;
- }
- }
-
- return getCommonClass(testList);
- }
-
- /**
- * Return the ResourceMapping class if the elements all adapt to it.
- */
- private Class getResourceMappingClass(List objects) {
- if (objects == null || objects.isEmpty()) {
- return null;
- }
- Class resourceMappingClass = LegacyResourceSupport
- .getResourceMappingClass();
- if (resourceMappingClass == null) {
- // resources plug-in not loaded - no resources. period.
- return null;
- }
-
- for (int i = 0; i < objects.size(); i++) {
- Object object = objects.get(i);
-
- if (object instanceof IAdaptable) {
- if (resourceMappingClass.isInstance(object)) {
- continue;
- }
-
- Object resourceMapping = LegacyResourceSupport
- .getAdaptedContributorResourceMapping(object);
-
- if (resourceMapping == null) {
- //Not a resource and does not adapt. No common resource class
- return null;
- }
- } else {
- return null;
- }
- }
- // If we get here then all objects adapt to ResourceMapping
- return resourceMappingClass;
- }
-
- /**
- * Returns the common denominator class for the given
- * collection of objects.
- */
- private Class getCommonClass(List objects) {
- if (objects == null || objects.isEmpty()) {
+ if (!result.contains(adapter)) {
+ result.add(adapter);
+ }
+ }
+ }
+ return new ArrayList(result);
+ }
+
+ /**
+ * Returns the common denominator resource class for the given collection of
+ * objects. Do not return a resource class if the objects are resources
+ * themselves so as to prevent double registration of actions.
+ */
+ private Class getCommonResourceClass(List objects) {
+ if (objects == null || objects.isEmpty()) {
+ return null;
+ }
+ Class resourceClass = LegacyResourceSupport.getResourceClass();
+ if (resourceClass == null) {
+ // resources plug-in not loaded - no resources. period.
return null;
}
- Class commonClass = objects.get(0).getClass();
- // try easy
- if (objects.size() == 1) {
+
+ List testList = new ArrayList(objects.size());
+
+ for (int i = 0; i < objects.size(); i++) {
+ Object object = objects.get(i);
+
+ if (object instanceof IAdaptable) {
+ if (resourceClass.isInstance(object)) {
+ continue;
+ }
+
+ Object resource = LegacyResourceSupport.getAdaptedContributorResource(object);
+
+ if (resource == null) {
+ // Not a resource and does not adapt. No common resource class
+ return null;
+ }
+ testList.add(resource);
+ } else {
+ return null;
+ }
+ }
+
+ return getCommonClass(testList);
+ }
+
+ /**
+ * Return the ResourceMapping class if the elements all adapt to it.
+ */
+ private Class getResourceMappingClass(List objects) {
+ if (objects == null || objects.isEmpty()) {
+ return null;
+ }
+ Class resourceMappingClass = LegacyResourceSupport.getResourceMappingClass();
+ if (resourceMappingClass == null) {
+ // resources plug-in not loaded - no resources. period.
+ return null;
+ }
+
+ for (int i = 0; i < objects.size(); i++) {
+ Object object = objects.get(i);
+
+ if (object instanceof IAdaptable) {
+ if (resourceMappingClass.isInstance(object)) {
+ continue;
+ }
+
+ Object resourceMapping = LegacyResourceSupport.getAdaptedContributorResourceMapping(object);
+
+ if (resourceMapping == null) {
+ // Not a resource and does not adapt. No common resource class
+ return null;
+ }
+ } else {
+ return null;
+ }
+ }
+ // If we get here then all objects adapt to ResourceMapping
+ return resourceMappingClass;
+ }
+
+ /**
+ * Returns the common denominator class for the given collection of objects.
+ */
+ private Class getCommonClass(List objects) {
+ if (objects == null || objects.isEmpty()) {
+ return null;
+ }
+ Class commonClass = objects.get(0).getClass();
+ // try easy
+ if (objects.size() == 1) {
return commonClass;
- // try harder
+ // try harder
}
- for (int i = 1; i < objects.size(); i++) {
- Object object = objects.get(i);
- Class newClass = object.getClass();
- // try the short cut
- if (newClass.equals(commonClass)) {
+ for (int i = 1; i < objects.size(); i++) {
+ Object object = objects.get(i);
+ Class newClass = object.getClass();
+ // try the short cut
+ if (newClass.equals(commonClass)) {
continue;
}
- // compute common class
- commonClass = getCommonClass(commonClass, newClass);
- // give up
- if (commonClass == null) {
+ // compute common class
+ commonClass = getCommonClass(commonClass, newClass);
+ // give up
+ if (commonClass == null) {
return null;
}
- }
- return commonClass;
- }
-
- /**
- * Returns the common denominator class for
- * two input classes.
- */
- private Class getCommonClass(Class class1, Class class2) {
- List list1 = computeCombinedOrder(class1);
- List list2 = computeCombinedOrder(class2);
- for (int i = 0; i < list1.size(); i++) {
- for (int j = 0; j < list2.size(); j++) {
- Class candidate1 = (Class) list1.get(i);
- Class candidate2 = (Class) list2.get(j);
- if (candidate1.equals(candidate2)) {
+ }
+ return commonClass;
+ }
+
+ /**
+ * Returns the common denominator class for two input classes.
+ */
+ private Class getCommonClass(Class class1, Class class2) {
+ List list1 = computeCombinedOrder(class1);
+ List list2 = computeCombinedOrder(class2);
+ for (int i = 0; i < list1.size(); i++) {
+ for (int j = 0; j < list2.size(); j++) {
+ Class candidate1 = (Class) list1.get(i);
+ Class candidate2 = (Class) list2.get(j);
+ if (candidate1.equals(candidate2)) {
return candidate1;
}
- }
- }
- // no common class
- return null;
- }
+ }
+ }
+ // no common class
+ return null;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectFilterTest.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectFilterTest.java
index 18a755955fb..1dcd2a47a04 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectFilterTest.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectFilterTest.java
@@ -20,87 +20,85 @@ import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.ui.IActionFilter;
/**
- * An ObjectFilterTest is used to read an object filter from XML,
- * and evaluate the results for a given object.
+ * An ObjectFilterTest is used to read an object filter from XML, and evaluate
+ * the results for a given object.
*/
public class ObjectFilterTest {
private HashMap<String, String> filterElements;
- /**
- * Create a new object filter.
- */
- public ObjectFilterTest() {
- // do nothing
- }
+ /**
+ * Create a new object filter.
+ */
+ public ObjectFilterTest() {
+ // do nothing
+ }
- /**
- * Add a filter element to the test. This element must contain
- * a name value filter pair, as defined by the
- * <code>org.eclipse.ui.actionFilters</code> extension point.
- */
- public boolean addFilterElement(IConfigurationElement element) {
- String name = element.getAttribute("name");//$NON-NLS-1$
- if (name == null) {
+ /**
+ * Add a filter element to the test. This element must contain a name value
+ * filter pair, as defined by the <code>org.eclipse.ui.actionFilters</code>
+ * extension point.
+ */
+ public boolean addFilterElement(IConfigurationElement element) {
+ String name = element.getAttribute("name");//$NON-NLS-1$
+ if (name == null) {
return false;
}
- // Get positive property.
- String value = element.getAttribute("value");//$NON-NLS-1$
- if (value == null) {
+ // Get positive property.
+ String value = element.getAttribute("value");//$NON-NLS-1$
+ if (value == null) {
return false;
}
- if (filterElements == null) {
+ if (filterElements == null) {
filterElements = new HashMap();
}
- filterElements.put(name, value);
- return true;
- }
+ filterElements.put(name, value);
+ return true;
+ }
/**
* Returns whether the object filter correctly matches a given object. The
* results will be <code>true</code> if there is a filter match.
* <p>
- * If <code>adaptable is true</code>, the result will also be
- * <code>true</code> if the object is a wrapper for a resource, and the
- * resource produces a filter match.
+ * If <code>adaptable is true</code>, the result will also be <code>true</code>
+ * if the object is a wrapper for a resource, and the resource produces a filter
+ * match.
* </p>
*
- * @param object
- * the object to examine
+ * @param object the object to examine
* @returns <code>true</code> if there is a filter match.
*/
- public boolean matches(Object object, boolean adaptable) {
- // Optimize it.
- if (filterElements == null) {
+ public boolean matches(Object object, boolean adaptable) {
+ // Optimize it.
+ if (filterElements == null) {
return true;
}
- // Try out the object.
- if (this.preciselyMatches(object)) {
+ // Try out the object.
+ if (this.preciselyMatches(object)) {
return true;
}
- return false;
- }
+ return false;
+ }
- /**
- * Returns whether the object filter correctly matches a given object.
- */
- private boolean preciselyMatches(Object object) {
- // Get the action filter.
- IActionFilter filter = Adapters.adapt(object, IActionFilter.class);
- if (filter == null) {
+ /**
+ * Returns whether the object filter correctly matches a given object.
+ */
+ private boolean preciselyMatches(Object object) {
+ // Get the action filter.
+ IActionFilter filter = Adapters.adapt(object, IActionFilter.class);
+ if (filter == null) {
return false;
}
- // Run the action filter.
+ // Run the action filter.
for (Entry<String, String> entry : filterElements.entrySet()) {
String name = entry.getKey();
String value = entry.getValue();
- if (!filter.testAttribute(object, name, value)) {
+ if (!filter.testAttribute(object, name, value)) {
return false;
}
- }
- return true;
- }
+ }
+ return true;
+ }
}
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectPluginAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectPluginAction.java
index aed9a36b7ab..2089feb78a7 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectPluginAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectPluginAction.java
@@ -35,14 +35,14 @@ import org.eclipse.ui.part.MultiPageEditorPart;
*/
public class ObjectPluginAction extends PluginAction implements IPartListener2 {
/**
- * The configuration element attribute for the identifier of the action
- * which this action is intended to override (i.e., replace).
+ * The configuration element attribute for the identifier of the action which
+ * this action is intended to override (i.e., replace).
*/
public static final String ATT_OVERRIDE_ACTION_ID = "overrideActionId";//$NON-NLS-1$
- private String overrideActionId;
+ private String overrideActionId;
- private IWorkbenchPart activePart;
+ private IWorkbenchPart activePart;
@Override
public void partActivated(IWorkbenchPartReference partRef) {
@@ -97,35 +97,30 @@ public class ObjectPluginAction extends PluginAction implements IPartListener2 {
public void partVisible(IWorkbenchPartReference partRef) {
}
- /**
+ /**
* Constructs a new ObjectPluginAction.
*
- * @param actionElement
- * The configuration element used to construct this action; must
- * not be <code>null</code>.
- * @param id
- * The identifier for this action; must not be <code>null</code>.
- * @param style
- * The style bits
+ * @param actionElement The configuration element used to construct this action;
+ * must not be <code>null</code>.
+ * @param id The identifier for this action; must not be
+ * <code>null</code>.
+ * @param style The style bits
*/
- public ObjectPluginAction(IConfigurationElement actionElement, String id,
- int style) {
- super(actionElement, id, style);
- overrideActionId = actionElement.getAttribute(ATT_OVERRIDE_ACTION_ID);
- }
+ public ObjectPluginAction(IConfigurationElement actionElement, String id, int style) {
+ super(actionElement, id, style);
+ overrideActionId = actionElement.getAttribute(ATT_OVERRIDE_ACTION_ID);
+ }
- @Override
+ @Override
protected void initDelegate() {
- super.initDelegate();
+ super.initDelegate();
final IActionDelegate actionDelegate = getDelegate();
- if (actionDelegate instanceof IObjectActionDelegate
- && activePart != null) {
+ if (actionDelegate instanceof IObjectActionDelegate && activePart != null) {
final IObjectActionDelegate objectActionDelegate = (IObjectActionDelegate) actionDelegate;
final ISafeRunnable runnable = new ISafeRunnable() {
@Override
public void run() throws Exception {
- objectActionDelegate.setActivePart(ObjectPluginAction.this,
- activePart);
+ objectActionDelegate.setActivePart(ObjectPluginAction.this, activePart);
}
@Override
@@ -137,18 +132,17 @@ public class ObjectPluginAction extends PluginAction implements IPartListener2 {
}
}
- /**
+ /**
* Sets the active part for the delegate.
* <p>
- * This method will be called every time the action appears in a popup menu.
- * The targetPart may change with each invocation.
+ * This method will be called every time the action appears in a popup menu. The
+ * targetPart may change with each invocation.
* </p>
*
- * @param targetPart
- * the new part target
+ * @param targetPart the new part target
*/
- public void setActivePart(IWorkbenchPart targetPart) {
- if (activePart != targetPart) {
+ public void setActivePart(IWorkbenchPart targetPart) {
+ if (activePart != targetPart) {
if (activePart != null) {
stopPartListening();
}
@@ -156,15 +150,14 @@ public class ObjectPluginAction extends PluginAction implements IPartListener2 {
targetPart.getSite().getPage().addPartListener(this);
}
}
- activePart = targetPart;
- IActionDelegate delegate = getDelegate();
- if (delegate instanceof IObjectActionDelegate && activePart != null) {
+ activePart = targetPart;
+ IActionDelegate delegate = getDelegate();
+ if (delegate instanceof IObjectActionDelegate && activePart != null) {
final IObjectActionDelegate objectActionDelegate = (IObjectActionDelegate) delegate;
final ISafeRunnable runnable = new ISafeRunnable() {
@Override
public void run() throws Exception {
- objectActionDelegate.setActivePart(ObjectPluginAction.this,
- activePart);
+ objectActionDelegate.setActivePart(ObjectPluginAction.this, activePart);
}
@Override
@@ -176,24 +169,24 @@ public class ObjectPluginAction extends PluginAction implements IPartListener2 {
}
}
- /**
- * Returns the action identifier this action overrides.
- *
- * @return the action identifier to override or <code>null</code>
- */
- @Override
+ /**
+ * Returns the action identifier this action overrides.
+ *
+ * @return the action identifier to override or <code>null</code>
+ */
+ @Override
public String getOverrideActionId() {
- return overrideActionId;
- }
+ return overrideActionId;
+ }
- @Override
+ @Override
public void dispose() {
- if (activePart!=null) {
+ if (activePart != null) {
stopPartListening();
- activePart = null;
- }
- super.dispose();
- }
+ activePart = null;
+ }
+ super.dispose();
+ }
private void stopPartListening() {
if (activePart != null) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/OpenPerspectivePropertyTester.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/OpenPerspectivePropertyTester.java
index 456650d1634..1a605dd8c83 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/OpenPerspectivePropertyTester.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/OpenPerspectivePropertyTester.java
@@ -28,8 +28,7 @@ public class OpenPerspectivePropertyTester extends PropertyTester {
private static final String PROPERTY_IS_PERSPECTIVE_OPEN = "isPerspectiveOpen"; //$NON-NLS-1$
@Override
- public boolean test(Object receiver, String property, Object[] args,
- Object expectedValue) {
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
if (args.length == 0 && receiver instanceof WorkbenchWindow) {
final WorkbenchWindow window = (WorkbenchWindow) receiver;
if (PROPERTY_IS_PERSPECTIVE_OPEN.equals(property)) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/OpenPreferencesAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/OpenPreferencesAction.java
index 1ec4e08b32a..2f163e1bf45 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/OpenPreferencesAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/OpenPreferencesAction.java
@@ -26,22 +26,23 @@ import org.eclipse.ui.dialogs.PreferencesUtil;
public class OpenPreferencesAction extends Action implements ActionFactory.IWorkbenchAction {
/**
- * The workbench window; or <code>null</code> if this
- * action has been <code>dispose</code>d.
+ * The workbench window; or <code>null</code> if this action has been
+ * <code>dispose</code>d.
*/
private IWorkbenchWindow workbenchWindow;
/**
- * Create a new <code>OpenPreferenceAction</code>
- * This default constructor allows the the action to be called from the welcome page.
+ * Create a new <code>OpenPreferenceAction</code> This default constructor
+ * allows the the action to be called from the welcome page.
*/
public OpenPreferencesAction() {
this(PlatformUI.getWorkbench().getActiveWorkbenchWindow());
}
/**
- * Create a new <code>OpenPreferenceAction</code> and initialize it
- * from the given resource bundle.
+ * Create a new <code>OpenPreferenceAction</code> and initialize it from the
+ * given resource bundle.
+ *
* @param window
*/
public OpenPreferencesAction(IWorkbenchWindow window) {
@@ -52,8 +53,7 @@ public class OpenPreferencesAction extends Action implements ActionFactory.IWork
this.workbenchWindow = window;
// @issue action id not set
setToolTipText(WorkbenchMessages.OpenPreferences_toolTip);
- window.getWorkbench().getHelpSystem().setHelp(this,
- IWorkbenchHelpContextIds.OPEN_PREFERENCES_ACTION);
+ window.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.OPEN_PREFERENCES_ACTION);
}
@Override
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/OverlayIcon.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/OverlayIcon.java
index 11140ff95a6..7acc9b762bc 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/OverlayIcon.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/OverlayIcon.java
@@ -24,71 +24,70 @@ import org.eclipse.ui.internal.util.Util;
*/
public class OverlayIcon extends CompositeImageDescriptor {
- // the size of the OverlayIcon
- private Point fSize = null;
+ // the size of the OverlayIcon
+ private Point fSize = null;
- // the main image
- private ImageDescriptor fBase = null;
+ // the main image
+ private ImageDescriptor fBase = null;
- // the additional image (a pin for example)
- private ImageDescriptor fOverlay = null;
+ // the additional image (a pin for example)
+ private ImageDescriptor fOverlay = null;
- /**
- * @param base the main image
- * @param overlay the additional image (a pin for example)
- * @param size the size of the OverlayIcon
- */
- public OverlayIcon(ImageDescriptor base, ImageDescriptor overlay, Point size) {
- fBase = base;
- fOverlay = overlay;
- fSize = size;
- }
+ /**
+ * @param base the main image
+ * @param overlay the additional image (a pin for example)
+ * @param size the size of the OverlayIcon
+ */
+ public OverlayIcon(ImageDescriptor base, ImageDescriptor overlay, Point size) {
+ fBase = base;
+ fOverlay = overlay;
+ fSize = size;
+ }
- @Override
+ @Override
protected void drawCompositeImage(int width, int height) {
- ImageData bg;
- if (fBase == null || (bg = fBase.getImageData()) == null) {
+ ImageData bg;
+ if (fBase == null || (bg = fBase.getImageData()) == null) {
bg = DEFAULT_IMAGE_DATA;
}
- drawImage(bg, 0, 0);
+ drawImage(bg, 0, 0);
- if (fOverlay != null) {
+ if (fOverlay != null) {
drawTopRight(fOverlay);
}
- }
+ }
- /**
- * @param overlay the additional image (a pin for example)
- * to be drawn on top of the main image
- */
- protected void drawTopRight(ImageDescriptor overlay) {
- if (overlay == null) {
+ /**
+ * @param overlay the additional image (a pin for example) to be drawn on top of
+ * the main image
+ */
+ protected void drawTopRight(ImageDescriptor overlay) {
+ if (overlay == null) {
return;
}
- int x = getSize().x;
- ImageData id = overlay.getImageData();
- x -= id.width;
- drawImage(id, x, 0);
- }
+ int x = getSize().x;
+ ImageData id = overlay.getImageData();
+ x -= id.width;
+ drawImage(id, x, 0);
+ }
- @Override
+ @Override
protected Point getSize() {
- return fSize;
- }
+ return fSize;
+ }
- @Override
+ @Override
public int hashCode() {
- return Util.hashCode(fBase) * 17 + Util.hashCode(fOverlay);
- }
+ return Util.hashCode(fBase) * 17 + Util.hashCode(fOverlay);
+ }
- @Override
+ @Override
public boolean equals(Object obj) {
- if (!(obj instanceof OverlayIcon)) {
+ if (!(obj instanceof OverlayIcon)) {
return false;
}
- OverlayIcon overlayIcon = (OverlayIcon) obj;
- return Util.equals(this.fBase, overlayIcon.fBase)
- && Util.equals(this.fOverlay, overlayIcon.fOverlay)
- && Util.equals(this.fSize, overlayIcon.fSize);
- }
+ OverlayIcon overlayIcon = (OverlayIcon) obj;
+ return Util.equals(this.fBase, overlayIcon.fBase) && Util.equals(this.fOverlay, overlayIcon.fOverlay)
+ && Util.equals(this.fSize, overlayIcon.fSize);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PageEventAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PageEventAction.java
index bd13942e3c6..f09912550a5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PageEventAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PageEventAction.java
@@ -23,150 +23,146 @@ import org.eclipse.ui.actions.PartEventAction;
/**
* The abstract superclass for actions that listen to page activation and
* open/close events. This implementation tracks the active page (see
- * <code>getActivePage</code>) and provides a convenient place to monitor
- * page lifecycle events that could affect the availability of the action.
+ * <code>getActivePage</code>) and provides a convenient place to monitor page
+ * lifecycle events that could affect the availability of the action.
* <p>
* Subclasses must implement the following <code>IAction</code> method:
* <ul>
- * <li><code>run</code> - to do the action's work</li>
+ * <li><code>run</code> - to do the action's work</li>
* </ul>
* </p>
* <p>
* Subclasses may extend any of the <code>IPartListener</code> methods if the
* action availablity needs to be recalculated:
* <ul>
- * <li><code>partActivated</code></li>
- * <li><code>partDeactivated</code></li>
- * <li><code>partOpened</code></li>
- * <li><code>partClosed</code></li>
- * <li><code>partBroughtToTop</code></li>
+ * <li><code>partActivated</code></li>
+ * <li><code>partDeactivated</code></li>
+ * <li><code>partOpened</code></li>
+ * <li><code>partClosed</code></li>
+ * <li><code>partBroughtToTop</code></li>
* </ul>
* </p>
* <p>
* Subclasses may extend any of the <code>IPageListener</code> methods if the
* action availablity needs to be recalculated:
* <ul>
- * <li><code>pageActivated</code></li>
- * <li><code>pageClosed</code></li>
- * <li><code>pageOpened</code></li>
+ * <li><code>pageActivated</code></li>
+ * <li><code>pageClosed</code></li>
+ * <li><code>pageOpened</code></li>
* </ul>
* </p>
* <p>
* This method implements the <code>IPartListener</code> and
* <code>IPageListener</code>interfaces, and automatically registers listeners
- * so that it can keep its enablement state up to date. Ordinarily, the
- * window's references to these listeners will be dropped automatically when
- * the window closes. However, if the client needs to get rid of an action
- * while the window is still open, the client must call
- * {@link IWorkbenchAction#dispose dispose} to give the action an
- * opportunity to deregister its listeners and to perform any other cleanup.
+ * so that it can keep its enablement state up to date. Ordinarily, the window's
+ * references to these listeners will be dropped automatically when the window
+ * closes. However, if the client needs to get rid of an action while the window
+ * is still open, the client must call {@link IWorkbenchAction#dispose dispose}
+ * to give the action an opportunity to deregister its listeners and to perform
+ * any other cleanup.
* </p>
*/
-public abstract class PageEventAction extends PartEventAction implements
- IPageListener, ActionFactory.IWorkbenchAction {
- /**
- * The active page, or <code>null</code> if none.
- */
- private IWorkbenchPage activePage;
+public abstract class PageEventAction extends PartEventAction implements IPageListener, ActionFactory.IWorkbenchAction {
+ /**
+ * The active page, or <code>null</code> if none.
+ */
+ private IWorkbenchPage activePage;
- /**
- * The workbench window this action is registered with.
- */
- private IWorkbenchWindow workbenchWindow;
+ /**
+ * The workbench window this action is registered with.
+ */
+ private IWorkbenchWindow workbenchWindow;
- /**
- * Creates a new action with the given text. Register this
- * action with the workbench window for page lifecycle
- * events.
- *
- * @param text the string used as the text for the action,
- * or <code>null</code> if there is no text
- * @param window the workbench window this action is
- * registered with
- */
- protected PageEventAction(String text, IWorkbenchWindow window) {
- super(text);
- if (window == null) {
- throw new IllegalArgumentException();
- }
- this.workbenchWindow = window;
- this.activePage = window.getActivePage();
- this.workbenchWindow.addPageListener(this);
- this.workbenchWindow.getPartService().addPartListener(this);
- }
+ /**
+ * Creates a new action with the given text. Register this action with the
+ * workbench window for page lifecycle events.
+ *
+ * @param text the string used as the text for the action, or
+ * <code>null</code> if there is no text
+ * @param window the workbench window this action is registered with
+ */
+ protected PageEventAction(String text, IWorkbenchWindow window) {
+ super(text);
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ this.workbenchWindow = window;
+ this.activePage = window.getActivePage();
+ this.workbenchWindow.addPageListener(this);
+ this.workbenchWindow.getPartService().addPartListener(this);
+ }
- /**
- * Returns the currently active page in the workbench window.
- *
- * @return currently active page in the workbench window,
- * or <code>null</code> in none
- */
- public final IWorkbenchPage getActivePage() {
- return activePage;
- }
+ /**
+ * Returns the currently active page in the workbench window.
+ *
+ * @return currently active page in the workbench window, or <code>null</code>
+ * in none
+ */
+ public final IWorkbenchPage getActivePage() {
+ return activePage;
+ }
- /**
- * Returns the workbench window this action applies to.
- *
- * @return the workbench window, or <code>null</code> if this action has been
- * disposed
- */
- public final IWorkbenchWindow getWorkbenchWindow() {
- return workbenchWindow;
- }
+ /**
+ * Returns the workbench window this action applies to.
+ *
+ * @return the workbench window, or <code>null</code> if this action has been
+ * disposed
+ */
+ public final IWorkbenchWindow getWorkbenchWindow() {
+ return workbenchWindow;
+ }
- /**
- * The <code>PageEventAction</code> implementation of this
- * <code>IPageListener</code> method records that the given page is active.
- * Subclasses may extend this method if action availability has to be
- * recalculated.
- */
- @Override
+ /**
+ * The <code>PageEventAction</code> implementation of this
+ * <code>IPageListener</code> method records that the given page is active.
+ * Subclasses may extend this method if action availability has to be
+ * recalculated.
+ */
+ @Override
public void pageActivated(IWorkbenchPage page) {
- this.activePage = page;
- }
+ this.activePage = page;
+ }
- /**
- * The <code>PageEventAction</code> implementation of this
- * <code>IPageListener</code> method clears the active page if it just closed.
- * Subclasses may extend this method if action availability has to be
- * recalculated.
- */
- @Override
+ /**
+ * The <code>PageEventAction</code> implementation of this
+ * <code>IPageListener</code> method clears the active page if it just closed.
+ * Subclasses may extend this method if action availability has to be
+ * recalculated.
+ */
+ @Override
public void pageClosed(IWorkbenchPage page) {
- if (page == activePage) {
- activePage = null;
- }
- }
+ if (page == activePage) {
+ activePage = null;
+ }
+ }
- /**
- * The <code>PageEventAction</code> implementation of this
- * <code>IPageListener</code> method does nothing. Subclasses should extend
- * this method if action availability has to be recalculated.
- */
- @Override
+ /**
+ * The <code>PageEventAction</code> implementation of this
+ * <code>IPageListener</code> method does nothing. Subclasses should extend this
+ * method if action availability has to be recalculated.
+ */
+ @Override
public void pageOpened(IWorkbenchPage page) {
- // do nothing
- }
+ // do nothing
+ }
- /**
- * The <code>PageEventAction</code> implementation of this
- * <code>ActionFactory.IWorkbenchAction</code> method
- * deregisters the part and page listener adding by the constructor.
- * Subclasses should extend this method to do additional
- * cleanup.
- *
- * @since 3.0
- */
- @Override
+ /**
+ * The <code>PageEventAction</code> implementation of this
+ * <code>ActionFactory.IWorkbenchAction</code> method deregisters the part and
+ * page listener adding by the constructor. Subclasses should extend this method
+ * to do additional cleanup.
+ *
+ * @since 3.0
+ */
+ @Override
public void dispose() {
- if (workbenchWindow == null) {
- // action has already been disposed
- return;
- }
+ if (workbenchWindow == null) {
+ // action has already been disposed
+ return;
+ }
super.partDeactivated(null);
- workbenchWindow.removePageListener(this);
- workbenchWindow.getPartService().removePartListener(this);
- workbenchWindow = null;
- }
+ workbenchWindow.removePageListener(this);
+ workbenchWindow.getPartService().removePartListener(this);
+ workbenchWindow = null;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PageListenerList.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PageListenerList.java
index 61dbafeb5ee..c31c76e9602 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PageListenerList.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PageListenerList.java
@@ -25,89 +25,89 @@ import org.eclipse.ui.internal.misc.UIStats;
*/
public class PageListenerList extends EventManager {
- /**
- * PartNotifier constructor comment.
- */
- public PageListenerList() {
- super();
- }
+ /**
+ * PartNotifier constructor comment.
+ */
+ public PageListenerList() {
+ super();
+ }
- /**
- * Adds an IPartListener to the part service.
- */
- public void addPageListener(IPageListener l) {
- addListenerObject(l);
- }
+ /**
+ * Adds an IPartListener to the part service.
+ */
+ public void addPageListener(IPageListener l) {
+ addListenerObject(l);
+ }
- /**
- * Calls a page listener with associated performance event instrumentation
- *
- * @param runnable
- * @param listener
- * @param page
- * @param description
- */
- private void fireEvent(SafeRunnable runnable, IPageListener listener, IWorkbenchPage page, String description) {
- String label = null;//for debugging
- if (UIStats.isDebugging(UIStats.NOTIFY_PAGE_LISTENERS)) {
- label = description + page.getLabel();
- UIStats.start(UIStats.NOTIFY_PAGE_LISTENERS, label);
- }
- SafeRunner.run(runnable);
- if (UIStats.isDebugging(UIStats.NOTIFY_PAGE_LISTENERS)) {
+ /**
+ * Calls a page listener with associated performance event instrumentation
+ *
+ * @param runnable
+ * @param listener
+ * @param page
+ * @param description
+ */
+ private void fireEvent(SafeRunnable runnable, IPageListener listener, IWorkbenchPage page, String description) {
+ String label = null;// for debugging
+ if (UIStats.isDebugging(UIStats.NOTIFY_PAGE_LISTENERS)) {
+ label = description + page.getLabel();
+ UIStats.start(UIStats.NOTIFY_PAGE_LISTENERS, label);
+ }
+ SafeRunner.run(runnable);
+ if (UIStats.isDebugging(UIStats.NOTIFY_PAGE_LISTENERS)) {
UIStats.end(UIStats.NOTIFY_PAGE_LISTENERS, listener, label);
}
}
- /**
- * Notifies the listener that a part has been activated.
- */
- public void firePageActivated(final IWorkbenchPage page) {
+ /**
+ * Notifies the listener that a part has been activated.
+ */
+ public void firePageActivated(final IWorkbenchPage page) {
for (Object listener : getListeners()) {
final IPageListener pageListener = (IPageListener) listener;
- fireEvent(new SafeRunnable() {
- @Override
+ fireEvent(new SafeRunnable() {
+ @Override
public void run() {
pageListener.pageActivated(page);
- }
+ }
}, pageListener, page, "activated::"); //$NON-NLS-1$
- }
- }
+ }
+ }
- /**
- * Notifies the listener that a part has been closed
- */
- public void firePageClosed(final IWorkbenchPage page) {
+ /**
+ * Notifies the listener that a part has been closed
+ */
+ public void firePageClosed(final IWorkbenchPage page) {
for (Object listener : getListeners()) {
final IPageListener pageListener = (IPageListener) listener;
- fireEvent(new SafeRunnable() {
- @Override
+ fireEvent(new SafeRunnable() {
+ @Override
public void run() {
pageListener.pageClosed(page);
- }
+ }
}, pageListener, page, "closed::"); //$NON-NLS-1$
- }
- }
+ }
+ }
- /**
- * Notifies the listener that a part has been opened.
- */
- public void firePageOpened(final IWorkbenchPage page) {
+ /**
+ * Notifies the listener that a part has been opened.
+ */
+ public void firePageOpened(final IWorkbenchPage page) {
for (Object listener : getListeners()) {
final IPageListener pageListener = (IPageListener) listener;
- fireEvent(new SafeRunnable() {
- @Override
+ fireEvent(new SafeRunnable() {
+ @Override
public void run() {
pageListener.pageOpened(page);
- }
+ }
}, pageListener, page, "opened::"); //$NON-NLS-1$
- }
- }
+ }
+ }
- /**
- * Removes an IPartListener from the part service.
- */
- public void removePageListener(IPageListener l) {
- removeListenerObject(l);
- }
+ /**
+ * Removes an IPartListener from the part service.
+ */
+ public void removePageListener(IPageListener l) {
+ removeListenerObject(l);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PagePartSelectionTracker.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PagePartSelectionTracker.java
index bb2990261d9..f2efe0cfeae 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PagePartSelectionTracker.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PagePartSelectionTracker.java
@@ -17,28 +17,26 @@ import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPart;
/**
- * Provides debug view selection management/notification for
- * a debug view in a specific workbench page. This selection
- * provider shields clients from a debug view opening and closing,
- * and still provides selection notification/information even
- * when the debug view is not the active part.
+ * Provides debug view selection management/notification for a debug view in a
+ * specific workbench page. This selection provider shields clients from a debug
+ * view opening and closing, and still provides selection
+ * notification/information even when the debug view is not the active part.
*/
public class PagePartSelectionTracker {
- /**
- * Returns the id for the given part, taking into account
- * multi-view instances which may have a secondary id.
- *
- * @since 3.0
- */
+ /**
+ * Returns the id for the given part, taking into account multi-view instances
+ * which may have a secondary id.
+ *
+ * @since 3.0
+ */
static String getPartId(IWorkbenchPart part) {
- String id = part.getSite().getId();
- if (part instanceof IViewPart) {
- String secondaryId = ((IViewPart) part).getViewSite()
- .getSecondaryId();
- if (secondaryId != null) {
- id = id + ':' + secondaryId;
- }
- }
- return id;
- }
+ String id = part.getSite().getId();
+ if (part instanceof IViewPart) {
+ String secondaryId = ((IViewPart) part).getViewSite().getSecondaryId();
+ if (secondaryId != null) {
+ id = id + ':' + secondaryId;
+ }
+ }
+ return id;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartListenerList.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartListenerList.java
index 83cb3a96ae3..c736a758c8c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartListenerList.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartListenerList.java
@@ -24,124 +24,124 @@ import org.eclipse.ui.internal.misc.UIStats;
* Part listener list.
*/
/*
- * This class should be deleted when IPartListener and IPartListener2
- * renamed to IPartListener.
+ * This class should be deleted when IPartListener and IPartListener2 renamed to
+ * IPartListener.
*/
public class PartListenerList extends EventManager {
- /**
- * PartNotifier constructor comment.
- */
- public PartListenerList() {
- super();
- }
+ /**
+ * PartNotifier constructor comment.
+ */
+ public PartListenerList() {
+ super();
+ }
- /**
- * Adds an IPartListener to the part service.
- */
- public void addPartListener(IPartListener l) {
- addListenerObject(l);
- }
+ /**
+ * Adds an IPartListener to the part service.
+ */
+ public void addPartListener(IPartListener l) {
+ addListenerObject(l);
+ }
- /**
- * Calls a part listener with associated performance event instrumentation
- *
- * @param runnable
- * @param listener
- * @param part
- * @param description
- */
- private void fireEvent(SafeRunnable runnable, IPartListener listener, IWorkbenchPart part, String description) {
- String label = null;//for debugging
- if (UIStats.isDebugging(UIStats.NOTIFY_PART_LISTENERS)) {
- label = description + part.getTitle();
- UIStats.start(UIStats.NOTIFY_PART_LISTENERS, label);
- }
- SafeRunner.run(runnable);
- if (UIStats.isDebugging(UIStats.NOTIFY_PART_LISTENERS)) {
+ /**
+ * Calls a part listener with associated performance event instrumentation
+ *
+ * @param runnable
+ * @param listener
+ * @param part
+ * @param description
+ */
+ private void fireEvent(SafeRunnable runnable, IPartListener listener, IWorkbenchPart part, String description) {
+ String label = null;// for debugging
+ if (UIStats.isDebugging(UIStats.NOTIFY_PART_LISTENERS)) {
+ label = description + part.getTitle();
+ UIStats.start(UIStats.NOTIFY_PART_LISTENERS, label);
+ }
+ SafeRunner.run(runnable);
+ if (UIStats.isDebugging(UIStats.NOTIFY_PART_LISTENERS)) {
UIStats.end(UIStats.NOTIFY_PART_LISTENERS, listener, label);
}
}
- /**
- * Notifies the listener that a part has been activated.
- */
- public void firePartActivated(final IWorkbenchPart part) {
+ /**
+ * Notifies the listener that a part has been activated.
+ */
+ public void firePartActivated(final IWorkbenchPart part) {
for (Object listener : getListeners()) {
final IPartListener partListener = (IPartListener) listener;
- fireEvent(new SafeRunnable() {
- @Override
+ fireEvent(new SafeRunnable() {
+ @Override
public void run() {
partListener.partActivated(part);
- }
+ }
}, partListener, part, "activated::"); //$NON-NLS-1$
- }
- }
+ }
+ }
/**
- * Notifies the listener that a part has been brought to top.
- */
- public void firePartBroughtToTop(final IWorkbenchPart part) {
+ * Notifies the listener that a part has been brought to top.
+ */
+ public void firePartBroughtToTop(final IWorkbenchPart part) {
for (Object listener : getListeners()) {
final IPartListener partListener = (IPartListener) listener;
- fireEvent(new SafeRunnable() {
- @Override
+ fireEvent(new SafeRunnable() {
+ @Override
public void run() {
partListener.partBroughtToTop(part);
- }
+ }
}, partListener, part, "broughtToTop::"); //$NON-NLS-1$
- }
- }
+ }
+ }
- /**
- * Notifies the listener that a part has been closed
- */
- public void firePartClosed(final IWorkbenchPart part) {
+ /**
+ * Notifies the listener that a part has been closed
+ */
+ public void firePartClosed(final IWorkbenchPart part) {
for (Object element : getListeners()) {
final IPartListener partListener = (IPartListener) element;
- fireEvent(new SafeRunnable() {
- @Override
+ fireEvent(new SafeRunnable() {
+ @Override
public void run() {
partListener.partClosed(part);
- }
+ }
}, partListener, part, "closed::"); //$NON-NLS-1$
- }
- }
+ }
+ }
- /**
- * Notifies the listener that a part has been deactivated.
- */
- public void firePartDeactivated(final IWorkbenchPart part) {
+ /**
+ * Notifies the listener that a part has been deactivated.
+ */
+ public void firePartDeactivated(final IWorkbenchPart part) {
for (Object listener : getListeners()) {
final IPartListener partListener = (IPartListener) listener;
- fireEvent(new SafeRunnable() {
- @Override
+ fireEvent(new SafeRunnable() {
+ @Override
public void run() {
partListener.partDeactivated(part);
- }
+ }
}, partListener, part, "deactivated::"); //$NON-NLS-1$
- }
- }
+ }
+ }
- /**
- * Notifies the listener that a part has been opened.
- */
- public void firePartOpened(final IWorkbenchPart part) {
+ /**
+ * Notifies the listener that a part has been opened.
+ */
+ public void firePartOpened(final IWorkbenchPart part) {
for (Object listener : getListeners()) {
final IPartListener partListener = (IPartListener) listener;
- fireEvent(new SafeRunnable() {
- @Override
+ fireEvent(new SafeRunnable() {
+ @Override
public void run() {
partListener.partOpened(part);
- }
+ }
}, partListener, part, "opened::"); //$NON-NLS-1$
- }
- }
+ }
+ }
- /**
- * Removes an IPartListener from the part service.
- */
- public void removePartListener(IPartListener l) {
- removeListenerObject(l);
- }
+ /**
+ * Removes an IPartListener from the part service.
+ */
+ public void removePartListener(IPartListener l) {
+ removeListenerObject(l);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartListenerList2.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartListenerList2.java
index 8b8f5e9398d..99a78b97e74 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartListenerList2.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartListenerList2.java
@@ -27,140 +27,140 @@ import org.eclipse.ui.internal.misc.UIStats;
*/
public class PartListenerList2 extends EventManager {
- /**
- * PartListenerList2 constructor comment.
- */
- public PartListenerList2() {
- super();
- }
-
- /**
- * Adds an PartListener to the part service.
- */
- public void addPartListener(IPartListener2 l) {
- addListenerObject(l);
- }
-
- /**
- * Calls a part listener with associated performance event instrumentation
- *
- * @param runnable
- * @param listener
- * @param ref
- * @param string
- */
- private void fireEvent(SafeRunnable runnable, IPartListener2 listener, IWorkbenchPartReference ref, String string) {
- String label = null;//for debugging
- if (UIStats.isDebugging(UIStats.NOTIFY_PART_LISTENERS)) {
- label = string + ref.getTitle();
- UIStats.start(UIStats.NOTIFY_PART_LISTENERS, label);
- }
- SafeRunner.run(runnable);
- if (UIStats.isDebugging(UIStats.NOTIFY_PART_LISTENERS)) {
+ /**
+ * PartListenerList2 constructor comment.
+ */
+ public PartListenerList2() {
+ super();
+ }
+
+ /**
+ * Adds an PartListener to the part service.
+ */
+ public void addPartListener(IPartListener2 l) {
+ addListenerObject(l);
+ }
+
+ /**
+ * Calls a part listener with associated performance event instrumentation
+ *
+ * @param runnable
+ * @param listener
+ * @param ref
+ * @param string
+ */
+ private void fireEvent(SafeRunnable runnable, IPartListener2 listener, IWorkbenchPartReference ref, String string) {
+ String label = null;// for debugging
+ if (UIStats.isDebugging(UIStats.NOTIFY_PART_LISTENERS)) {
+ label = string + ref.getTitle();
+ UIStats.start(UIStats.NOTIFY_PART_LISTENERS, label);
+ }
+ SafeRunner.run(runnable);
+ if (UIStats.isDebugging(UIStats.NOTIFY_PART_LISTENERS)) {
UIStats.end(UIStats.NOTIFY_PART_LISTENERS, listener, label);
}
}
- /**
- * Notifies the listener that a part has been activated.
- */
- public void firePartActivated(final IWorkbenchPartReference ref) {
+ /**
+ * Notifies the listener that a part has been activated.
+ */
+ public void firePartActivated(final IWorkbenchPartReference ref) {
for (Object listener : getListeners()) {
final IPartListener2 partListener = (IPartListener2) listener;
- fireEvent(new SafeRunnable() {
- @Override
+ fireEvent(new SafeRunnable() {
+ @Override
public void run() {
partListener.partActivated(ref);
- }
+ }
}, partListener, ref, "activated::"); //$NON-NLS-1$
- }
- }
+ }
+ }
- /**
- * Notifies the listener that a part has been brought to top.
- */
- public void firePartBroughtToTop(final IWorkbenchPartReference ref) {
+ /**
+ * Notifies the listener that a part has been brought to top.
+ */
+ public void firePartBroughtToTop(final IWorkbenchPartReference ref) {
for (Object listener : getListeners()) {
final IPartListener2 partListener = (IPartListener2) listener;
- fireEvent(new SafeRunnable() {
- @Override
+ fireEvent(new SafeRunnable() {
+ @Override
public void run() {
partListener.partBroughtToTop(ref);
- }
+ }
}, partListener, ref, "broughtToTop::"); //$NON-NLS-1$
- }
- }
+ }
+ }
- /**
- * Notifies the listener that a part has been closed
- */
- public void firePartClosed(final IWorkbenchPartReference ref) {
+ /**
+ * Notifies the listener that a part has been closed
+ */
+ public void firePartClosed(final IWorkbenchPartReference ref) {
for (Object listener : getListeners()) {
final IPartListener2 partListener = (IPartListener2) listener;
- fireEvent(new SafeRunnable() {
- @Override
+ fireEvent(new SafeRunnable() {
+ @Override
public void run() {
partListener.partClosed(ref);
- }
+ }
}, partListener, ref, "closed::"); //$NON-NLS-1$
- }
- }
+ }
+ }
- /**
- * Notifies the listener that a part has been deactivated.
- */
- public void firePartDeactivated(final IWorkbenchPartReference ref) {
+ /**
+ * Notifies the listener that a part has been deactivated.
+ */
+ public void firePartDeactivated(final IWorkbenchPartReference ref) {
for (Object listener : getListeners()) {
final IPartListener2 partListener = (IPartListener2) listener;
- fireEvent(new SafeRunnable() {
- @Override
+ fireEvent(new SafeRunnable() {
+ @Override
public void run() {
partListener.partDeactivated(ref);
- }
+ }
}, partListener, ref, "deactivated::"); //$NON-NLS-1$
- }
- }
+ }
+ }
- /**
- * Notifies the listener that a part has been opened.
- */
- public void firePartOpened(final IWorkbenchPartReference ref) {
+ /**
+ * Notifies the listener that a part has been opened.
+ */
+ public void firePartOpened(final IWorkbenchPartReference ref) {
for (Object listener : getListeners()) {
final IPartListener2 partListener = (IPartListener2) listener;
- fireEvent(new SafeRunnable() {
- @Override
+ fireEvent(new SafeRunnable() {
+ @Override
public void run() {
partListener.partOpened(ref);
- }
+ }
}, partListener, ref, "opened::"); //$NON-NLS-1$
- }
- }
+ }
+ }
- /**
- * Notifies the listener that a part has been opened.
- */
- public void firePartHidden(final IWorkbenchPartReference ref) {
+ /**
+ * Notifies the listener that a part has been opened.
+ */
+ public void firePartHidden(final IWorkbenchPartReference ref) {
for (Object element : getListeners()) {
final IPartListener2 partListener;
- if (element instanceof IPartListener2) {
+ if (element instanceof IPartListener2) {
partListener = (IPartListener2) element;
} else {
continue;
}
- fireEvent(new SafeRunnable() {
- @Override
+ fireEvent(new SafeRunnable() {
+ @Override
public void run() {
partListener.partHidden(ref);
- }
+ }
}, partListener, ref, "hidden::"); //$NON-NLS-1$
- }
- }
+ }
+ }
- /**
- * Notifies the listener that a part has been opened.
- */
- public void firePartVisible(final IWorkbenchPartReference ref) {
+ /**
+ * Notifies the listener that a part has been opened.
+ */
+ public void firePartVisible(final IWorkbenchPartReference ref) {
for (Object listener : getListeners()) {
final IPartListener2 partListener;
if (listener instanceof IPartListener2) {
@@ -169,19 +169,19 @@ public class PartListenerList2 extends EventManager {
continue;
}
- fireEvent(new SafeRunnable() {
- @Override
+ fireEvent(new SafeRunnable() {
+ @Override
public void run() {
partListener.partVisible(ref);
- }
+ }
}, partListener, ref, "visible::"); //$NON-NLS-1$
- }
- }
+ }
+ }
- /**
- * Notifies the listener that a part has been opened.
- */
- public void firePartInputChanged(final IWorkbenchPartReference ref) {
+ /**
+ * Notifies the listener that a part has been opened.
+ */
+ public void firePartInputChanged(final IWorkbenchPartReference ref) {
for (Object listener : getListeners()) {
final IPartListener2 partListener;
if (listener instanceof IPartListener2) {
@@ -190,21 +190,21 @@ public class PartListenerList2 extends EventManager {
continue;
}
- fireEvent(new SafeRunnable() {
- @Override
+ fireEvent(new SafeRunnable() {
+ @Override
public void run() {
partListener.partInputChanged(ref);
- }
+ }
}, partListener, ref, "inputChanged::"); //$NON-NLS-1$
- }
- }
+ }
+ }
- /**
- * Removes an IPartListener from the part service.
- */
- public void removePartListener(IPartListener2 l) {
- removeListenerObject(l);
- }
+ /**
+ * Removes an IPartListener from the part service.
+ */
+ public void removePartListener(IPartListener2 l) {
+ removeListenerObject(l);
+ }
public void firePageChanged(final PageChangedEvent event) {
for (Object listener : getListeners()) {
@@ -215,12 +215,12 @@ public class PartListenerList2 extends EventManager {
continue;
}
- SafeRunnable.run(new SafeRunnable() {
- @Override
+ SafeRunnable.run(new SafeRunnable() {
+ @Override
public void run() {
partListener.pageChanged(event);
- }
- });
- }
+ }
+ });
+ }
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartPluginAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartPluginAction.java
index fdfd6d88aa8..6895ab5486c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartPluginAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartPluginAction.java
@@ -19,43 +19,40 @@ import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartSite;
/**
- * This class adds to the PluginAction support by
- * setting itself up for work within a WorkbenchPart.
- * The main difference is that it is capable of
+ * This class adds to the PluginAction support by setting itself up for work
+ * within a WorkbenchPart. The main difference is that it is capable of
* processing local selection changes within a part.
*/
public class PartPluginAction extends PluginAction {
- /**
- * PartPluginAction constructor.
- */
- public PartPluginAction(IConfigurationElement actionElement, String id,
- int style) {
- super(actionElement, id, style);
- }
+ /**
+ * PartPluginAction constructor.
+ */
+ public PartPluginAction(IConfigurationElement actionElement, String id, int style) {
+ super(actionElement, id, style);
+ }
- /**
- * Registers this action as a listener of the workbench part.
- */
- protected void registerSelectionListener(IWorkbenchPart aPart) {
- ISelectionProvider selectionProvider = aPart.getSite()
- .getSelectionProvider();
- if (selectionProvider != null) {
- selectionProvider.addSelectionChangedListener(this);
- selectionChanged(selectionProvider.getSelection());
- }
- }
+ /**
+ * Registers this action as a listener of the workbench part.
+ */
+ protected void registerSelectionListener(IWorkbenchPart aPart) {
+ ISelectionProvider selectionProvider = aPart.getSite().getSelectionProvider();
+ if (selectionProvider != null) {
+ selectionProvider.addSelectionChangedListener(this);
+ selectionChanged(selectionProvider.getSelection());
+ }
+ }
- /**
- * Unregisters this action as a listener of the workbench part.
- */
- protected void unregisterSelectionListener(IWorkbenchPart aPart) {
- IWorkbenchPartSite site = aPart.getSite();
+ /**
+ * Unregisters this action as a listener of the workbench part.
+ */
+ protected void unregisterSelectionListener(IWorkbenchPart aPart) {
+ IWorkbenchPartSite site = aPart.getSite();
if (site == null) {
return;
}
ISelectionProvider selectionProvider = site.getSelectionProvider();
- if (selectionProvider != null) {
- selectionProvider.removeSelectionChangedListener(this);
- }
- }
+ if (selectionProvider != null) {
+ selectionProvider.removeSelectionChangedListener(this);
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartService.java
index e3be2927449..0382062786b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartService.java
@@ -25,8 +25,7 @@ import org.eclipse.ui.IPartService;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartReference;
-public class PartService implements IPageChangedListener, IPartListener, IPartListener2,
- IPartService {
+public class PartService implements IPageChangedListener, IPartListener, IPartListener2, IPartService {
private ListenerList<IPartListener> partListeners = new ListenerList<>();
private ListenerList<IPartListener2> partListeners2 = new ListenerList<>();
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartSite.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartSite.java
index 50f676331d2..68ab62a128c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartSite.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartSite.java
@@ -74,54 +74,45 @@ import org.eclipse.ui.testing.IWorkbenchPartTestable;
* The <code>PartSite</code> lifecycle is as follows ..
*
* <ol>
- * <li>a site is constructed </li>
- * <li>a part is constructed and stored in the part </li>
- * <li>the site calls part.init() </li>
- * <li>a pane is constructed and stored in the site </li>
- * <li>the action bars for a part are constructed and stored in the site </li>
- * <li>the pane is added to a presentation </li>
- * <li>the SWT widgets for the pane and part are created </li>
- * <li>the site is activated, causing the actions to become visible </li>
+ * <li>a site is constructed</li>
+ * <li>a part is constructed and stored in the part</li>
+ * <li>the site calls part.init()</li>
+ * <li>a pane is constructed and stored in the site</li>
+ * <li>the action bars for a part are constructed and stored in the site</li>
+ * <li>the pane is added to a presentation</li>
+ * <li>the SWT widgets for the pane and part are created</li>
+ * <li>the site is activated, causing the actions to become visible</li>
* </ol>
*/
public abstract class PartSite implements IWorkbenchPartSite {
/**
- * This is a helper method for the register context menu functionality. It
- * is provided so that different implementations of the
+ * This is a helper method for the register context menu functionality. It is
+ * provided so that different implementations of the
* <code>IWorkbenchPartSite</code> interface don't have to worry about how
* context menus should work.
*
- * @param menuId
- * the menu id
- * @param menuManager
- * the menu manager
- * @param selectionProvider
- * the selection provider
- * @param includeEditorInput
- * whether editor inputs should be included in the structured
- * selection when calculating contributions
- * @param part
- * the part for this site
- * @param menuExtenders
- * the collection of menu extenders for this site
- * @see IWorkbenchPartSite#registerContextMenu(MenuManager,
- * ISelectionProvider)
+ * @param menuId the menu id
+ * @param menuManager the menu manager
+ * @param selectionProvider the selection provider
+ * @param includeEditorInput whether editor inputs should be included in the
+ * structured selection when calculating contributions
+ * @param part the part for this site
+ * @param menuExtenders the collection of menu extenders for this site
+ * @see IWorkbenchPartSite#registerContextMenu(MenuManager, ISelectionProvider)
*/
- public static final void registerContextMenu(final String menuId,
- final MenuManager menuManager, final ISelectionProvider selectionProvider,
- final boolean includeEditorInput, final IWorkbenchPart part, IEclipseContext context,
- final Collection menuExtenders) {
+ public static final void registerContextMenu(final String menuId, final MenuManager menuManager,
+ final ISelectionProvider selectionProvider, final boolean includeEditorInput, final IWorkbenchPart part,
+ IEclipseContext context, final Collection menuExtenders) {
/*
- * Check to see if the same menu manager and selection provider have
- * already been used. If they have, then we can just add another menu
- * identifier to the existing PopupMenuExtender.
+ * Check to see if the same menu manager and selection provider have already
+ * been used. If they have, then we can just add another menu identifier to the
+ * existing PopupMenuExtender.
*/
final Iterator extenderItr = menuExtenders.iterator();
boolean foundMatch = false;
while (extenderItr.hasNext()) {
- final PopupMenuExtender existingExtender = (PopupMenuExtender) extenderItr
- .next();
+ final PopupMenuExtender existingExtender = (PopupMenuExtender) extenderItr.next();
if (existingExtender.matches(menuManager, selectionProvider, part)) {
existingExtender.addMenuId(menuId);
foundMatch = true;
@@ -130,8 +121,8 @@ public abstract class PartSite implements IWorkbenchPartSite {
}
if (!foundMatch) {
- menuExtenders.add(new PopupMenuExtender(menuId, menuManager, selectionProvider, part,
- context, includeEditorInput));
+ menuExtenders.add(
+ new PopupMenuExtender(menuId, menuManager, selectionProvider, part, context, includeEditorInput));
}
}
@@ -174,15 +165,11 @@ public abstract class PartSite implements IWorkbenchPartSite {
/**
* Build the part site.
*
- * @param ref
- * the part reference
- * @param part
- * the part
- * @param page
- * the page it belongs to
+ * @param ref the part reference
+ * @param part the part
+ * @param page the page it belongs to
*/
- public PartSite(MPart model, IWorkbenchPart part, IWorkbenchPartReference ref,
- IConfigurationElement element) {
+ public PartSite(MPart model, IWorkbenchPart part, IWorkbenchPartReference ref, IConfigurationElement element) {
this.model = model;
this.part = part;
this.partReference = ref;
@@ -196,13 +183,11 @@ public abstract class PartSite implements IWorkbenchPartSite {
setWindow((MWindow) parent);
e4Context = model.getContext();
- IServiceLocatorCreator slc = e4Context
- .get(IServiceLocatorCreator.class);
+ IServiceLocatorCreator slc = e4Context.get(IServiceLocatorCreator.class);
IWorkbenchWindow workbenchWindow = getWorkbenchWindow();
- this.serviceLocator = (ServiceLocator) slc.createServiceLocator(workbenchWindow, null,
- () -> {
- // not sure what to do here
- }, e4Context);
+ this.serviceLocator = (ServiceLocator) slc.createServiceLocator(workbenchWindow, null, () -> {
+ // not sure what to do here
+ }, e4Context);
initializeDefaultServices();
}
@@ -215,24 +200,21 @@ public abstract class PartSite implements IWorkbenchPartSite {
MApplication application = topWindow.getContext().get(MApplication.class);
Workbench workbench = (Workbench) application.getContext().get(IWorkbench.class);
- workbenchWindow = workbench.createWorkbenchWindow(
- workbench.getDefaultPageInput(),
+ workbenchWindow = workbench.createWorkbenchWindow(workbench.getDefaultPageInput(),
workbench.getPerspectiveRegistry().findPerspectiveWithId(
- workbench.getPerspectiveRegistry().getDefaultPerspective()), topWindow,
- false);
+ workbench.getPerspectiveRegistry().getDefaultPerspective()),
+ topWindow, false);
}
/**
* Initialize the local services.
*/
private void initializeDefaultServices() {
- IHandlerService handlerService = new LegacyHandlerService(e4Context,
- new ActivePartExpression(part));
+ IHandlerService handlerService = new LegacyHandlerService(e4Context, new ActivePartExpression(part));
e4Context.set(IHandlerService.class, handlerService);
serviceLocator.registerService(IWorkbenchLocationService.class,
- new WorkbenchLocationService(IServiceScopes.PARTSITE_SCOPE,
- getWorkbenchWindow().getWorkbench(),
+ new WorkbenchLocationService(IServiceScopes.PARTSITE_SCOPE, getWorkbenchWindow().getWorkbench(),
getWorkbenchWindow(), this, null, null, 2));
// added back for legacy reasons
serviceLocator.registerService(IWorkbenchPartSite.class, this);
@@ -289,8 +271,7 @@ public abstract class PartSite implements IWorkbenchPartSite {
@Override
public Object compute(IEclipseContext context, String contextKey) {
if (selectionService == null) {
- selectionService = new SlaveSelectionService(context.getParent().get(
- ISelectionService.class));
+ selectionService = new SlaveSelectionService(context.getParent().get(ISelectionService.class));
}
return selectionService;
}
@@ -299,8 +280,8 @@ public abstract class PartSite implements IWorkbenchPartSite {
@Override
public Object compute(IEclipseContext context, String contextKey) {
if (contextService == null) {
- contextService = new SlaveContextService(context.getParent().get(
- IContextService.class), new ActivePartExpression(part));
+ contextService = new SlaveContextService(context.getParent().get(IContextService.class),
+ new ActivePartExpression(part));
}
return contextService;
}
@@ -309,8 +290,7 @@ public abstract class PartSite implements IWorkbenchPartSite {
@Override
public Object compute(IEclipseContext context, String contextKey) {
if (menuService == null) {
- menuService = new SlaveMenuService(context.getParent().get(IMenuService.class),
- model);
+ menuService = new SlaveMenuService(context.getParent().get(IMenuService.class), model);
}
return menuService;
}
@@ -328,9 +308,8 @@ public abstract class PartSite implements IWorkbenchPartSite {
managers.add(ext.getManager());
ext.dispose();
}
- if (managers.size()>0) {
- for (Iterator iterator = managers.iterator(); iterator
- .hasNext();) {
+ if (managers.size() > 0) {
+ for (Iterator iterator = managers.iterator(); iterator.hasNext();) {
MenuManager mgr = (MenuManager) iterator.next();
mgr.dispose();
}
@@ -338,10 +317,10 @@ public abstract class PartSite implements IWorkbenchPartSite {
menuExtenders = null;
}
- if (keyBindingService != null) {
+ if (keyBindingService != null) {
keyBindingService.dispose();
keyBindingService = null;
- }
+ }
if (progressService != null) {
progressService.dispose();
@@ -383,9 +362,8 @@ public abstract class PartSite implements IWorkbenchPartSite {
/**
* Returns the action bars for the part. If this part is a view then it has
- * exclusive use of the action bars. If this part is an editor then the
- * action bars are shared among this editor and other editors of the same
- * type.
+ * exclusive use of the action bars. If this part is an editor then the action
+ * bars are shared among this editor and other editors of the same type.
*/
public IActionBars getActionBars() {
return actionBars;
@@ -393,8 +371,8 @@ public abstract class PartSite implements IWorkbenchPartSite {
@Override
public String getId() {
- return extensionId == null ? element == null ? model.getElementId() : element
- .getAttribute(IWorkbenchRegistryConstants.ATT_ID)
+ return extensionId == null
+ ? element == null ? model.getElementId() : element.getAttribute(IWorkbenchRegistryConstants.ATT_ID)
: extensionId;
}
@@ -405,8 +383,7 @@ public abstract class PartSite implements IWorkbenchPartSite {
@Override
public String getRegisteredName() {
- return element == null ? model.getLocalizedLabel() : element
- .getAttribute(IWorkbenchRegistryConstants.ATT_NAME);
+ return element == null ? model.getLocalizedLabel() : element.getAttribute(IWorkbenchRegistryConstants.ATT_NAME);
}
/**
@@ -420,7 +397,6 @@ public abstract class PartSite implements IWorkbenchPartSite {
return window == null ? null : window.getActivePage();
}
-
/**
* Returns the part.
*/
@@ -490,7 +466,8 @@ public abstract class PartSite implements IWorkbenchPartSite {
private MWindow getTopLevelModelWindow(MWindow window) {
EObject previousParent = (EObject) window;
EObject parent = previousParent.eContainer();
- // we can't simply stop at an MWindow because the part may be in a detached window
+ // we can't simply stop at an MWindow because the part may be in a detached
+ // window
while (!(parent instanceof MApplication)) {
previousParent = parent;
parent = parent.eContainer();
@@ -513,8 +490,7 @@ public abstract class PartSite implements IWorkbenchPartSite {
* Register a popup menu for extension.
*/
@Override
- public void registerContextMenu(String menuID, MenuManager menuMgr,
- ISelectionProvider selProvider) {
+ public void registerContextMenu(String menuID, MenuManager menuMgr, ISelectionProvider selProvider) {
if (menuExtenders == null) {
menuExtenders = new ArrayList(1);
}
@@ -526,8 +502,7 @@ public abstract class PartSite implements IWorkbenchPartSite {
* Register a popup menu with the default id for extension.
*/
@Override
- public void registerContextMenu(MenuManager menuMgr,
- ISelectionProvider selProvider) {
+ public void registerContextMenu(MenuManager menuMgr, ISelectionProvider selProvider) {
registerContextMenu(getId(), menuMgr, selProvider);
}
@@ -554,7 +529,6 @@ public abstract class PartSite implements IWorkbenchPartSite {
actionBars = bars;
}
-
/**
* Sets the part.
*/
@@ -562,7 +536,6 @@ public abstract class PartSite implements IWorkbenchPartSite {
part = newPart;
}
-
/**
* Set the selection provider for a part.
*/
@@ -642,8 +615,8 @@ public abstract class PartSite implements IWorkbenchPartSite {
}
/**
- * Prints out the identifier, the plug-in identifier and the registered
- * name. This is for debugging purposes only.
+ * Prints out the identifier, the plug-in identifier and the registered name.
+ * This is for debugging purposes only.
*
* @since 3.2
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartTester.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartTester.java
index d1a47b5d544..ce30fa76caf 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartTester.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartTester.java
@@ -23,126 +23,117 @@ import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPart2;
public class PartTester {
- private PartTester() {
- }
-
- /**
- * Sanity-check the public interface of the editor. This is called on every editor after it
- * is fully initiallized, but before it is actually connected to the editor reference or the
- * layout. Calls as much of the editor's public interface as possible to test for exceptions,
- * and tests the return values for glaring faults. This does not need to be an exhaustive conformance
- * test, as it is called every time an editor is opened and it needs to be efficient.
- * The part should be unmodified when the method exits.
- *
- * @param part
- */
- public static void testEditor(IEditorPart part) throws Exception {
- testWorkbenchPart(part);
-
- Assert.isTrue(part.getEditorSite() == part.getSite(),
+ private PartTester() {
+ }
+
+ /**
+ * Sanity-check the public interface of the editor. This is called on every
+ * editor after it is fully initiallized, but before it is actually connected to
+ * the editor reference or the layout. Calls as much of the editor's public
+ * interface as possible to test for exceptions, and tests the return values for
+ * glaring faults. This does not need to be an exhaustive conformance test, as
+ * it is called every time an editor is opened and it needs to be efficient. The
+ * part should be unmodified when the method exits.
+ *
+ * @param part
+ */
+ public static void testEditor(IEditorPart part) throws Exception {
+ testWorkbenchPart(part);
+
+ Assert.isTrue(part.getEditorSite() == part.getSite(),
"The part's editor site must be the same as the part's site"); //$NON-NLS-1$
IEditorInput input = part.getEditorInput();
Assert.isNotNull(input, "The editor input must be non-null"); //$NON-NLS-1$
testEditorInput(input);
- part.isDirty();
- part.isSaveAsAllowed();
- part.isSaveOnCloseNeeded();
- }
+ part.isDirty();
+ part.isSaveAsAllowed();
+ part.isSaveOnCloseNeeded();
+ }
- public static void testEditorInput(IEditorInput input) throws Exception {
- input.getAdapter(Object.class);
+ public static void testEditorInput(IEditorInput input) throws Exception {
+ input.getAdapter(Object.class);
- // Don't test input.getImageDescriptor() -- the workbench never uses that
- // method and most editor inputs would fail the test. It should really be
- // deprecated.
+ // Don't test input.getImageDescriptor() -- the workbench never uses that
+ // method and most editor inputs would fail the test. It should really be
+ // deprecated.
- Assert.isNotNull(input.getName(),
- "The editor input must have a non-null name"); //$NON-NLS-1$
- Assert.isNotNull(input.getToolTipText(),
- "The editor input must have a non-null tool tip"); //$NON-NLS-1$
+ Assert.isNotNull(input.getName(), "The editor input must have a non-null name"); //$NON-NLS-1$
+ Assert.isNotNull(input.getToolTipText(), "The editor input must have a non-null tool tip"); //$NON-NLS-1$
// Persistable element may be null
IPersistableElement persistableElement = input.getPersistable();
if (persistableElement != null) {
- Assert
- .isNotNull(persistableElement.getFactoryId(),
- "The persistable element for the editor input must have a non-null factory id"); //$NON-NLS-1$
- }
- }
-
- /**
- * Sanity-checks a workbench part. Excercises the public interface and tests for any
- * obviously bogus return values. The part should be unmodified when the method exits.
- *
- * @param part
- * @throws Exception
- */
- private static void testWorkbenchPart(IWorkbenchPart part) throws Exception {
- IPropertyListener testListener = (source, propId) -> {
+ Assert.isNotNull(persistableElement.getFactoryId(),
+ "The persistable element for the editor input must have a non-null factory id"); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Sanity-checks a workbench part. Excercises the public interface and tests for
+ * any obviously bogus return values. The part should be unmodified when the
+ * method exits.
+ *
+ * @param part
+ * @throws Exception
+ */
+ private static void testWorkbenchPart(IWorkbenchPart part) throws Exception {
+ IPropertyListener testListener = (source, propId) -> {
};
- // Test addPropertyListener
- part.addPropertyListener(testListener);
+ // Test addPropertyListener
+ part.addPropertyListener(testListener);
- // Test removePropertyListener
- part.removePropertyListener(testListener);
+ // Test removePropertyListener
+ part.removePropertyListener(testListener);
- // Test equals
+ // Test equals
Assert.isTrue(part.equals(part), "A part must be equal to itself"); //$NON-NLS-1$
- Assert.isTrue(!part.equals(Integer.valueOf(32)),
- "A part must have a meaningful equals method"); //$NON-NLS-1$
+ Assert.isTrue(!part.equals(Integer.valueOf(32)), "A part must have a meaningful equals method"); //$NON-NLS-1$
- // Test getAdapter
- Object partAdapter = part.getAdapter(part.getClass());
- Assert.isTrue(partAdapter == null || partAdapter == part,
- "A part must adapter to itself or return null"); //$NON-NLS-1$
+ // Test getAdapter
+ Object partAdapter = part.getAdapter(part.getClass());
+ Assert.isTrue(partAdapter == null || partAdapter == part, "A part must adapter to itself or return null"); //$NON-NLS-1$
- // Test getTitle
+ // Test getTitle
Assert.isNotNull(part.getTitle(), "A part's title must be non-null"); //$NON-NLS-1$
// Test getTitleImage
- Assert.isNotNull(part.getTitleImage(),
- "A part's title image must be non-null"); //$NON-NLS-1$
+ Assert.isNotNull(part.getTitleImage(), "A part's title image must be non-null"); //$NON-NLS-1$
// Test getTitleToolTip
- Assert.isNotNull(part.getTitleToolTip(),
- "A part's title tool tip must be non-null"); //$NON-NLS-1$
+ Assert.isNotNull(part.getTitleToolTip(), "A part's title tool tip must be non-null"); //$NON-NLS-1$
// Test toString
- Assert.isNotNull(part.toString(),
- "A part's toString method must return a non-null value"); //$NON-NLS-1$
-
- // Compute hashCode
- part.hashCode();
-
- if (part instanceof IWorkbenchPart2) {
- testWorkbenchPart2((IWorkbenchPart2)part);
- }
- }
-
- private static void testWorkbenchPart2(IWorkbenchPart2 part)
- throws Exception {
- Assert.isNotNull(part.getContentDescription(),
- "A part must return a non-null content description"); //$NON-NLS-1$
- Assert.isNotNull(part.getPartName(),
- "A part must return a non-null part name"); //$NON-NLS-1$
- }
-
- /**
- * Sanity-check the public interface of a view. This is called on every view after it
- * is fully initiallized, but before it is actually connected to the part reference or the
- * layout. Calls as much of the part's public interface as possible without modifying the part
- * to test for exceptions and check the return values for glaring faults. This does not need
- * to be an exhaustive conformance test, as it is called every time an editor is opened and
- * it needs to be efficient.
- *
- * @param part
- */
- public static void testView(IViewPart part) throws Exception {
- Assert.isTrue(part.getSite() == part.getViewSite(),
- "A part's site must be the same as a part's view site"); //$NON-NLS-1$
- testWorkbenchPart(part);
- }
+ Assert.isNotNull(part.toString(), "A part's toString method must return a non-null value"); //$NON-NLS-1$
+
+ // Compute hashCode
+ part.hashCode();
+
+ if (part instanceof IWorkbenchPart2) {
+ testWorkbenchPart2((IWorkbenchPart2) part);
+ }
+ }
+
+ private static void testWorkbenchPart2(IWorkbenchPart2 part) throws Exception {
+ Assert.isNotNull(part.getContentDescription(), "A part must return a non-null content description"); //$NON-NLS-1$
+ Assert.isNotNull(part.getPartName(), "A part must return a non-null part name"); //$NON-NLS-1$
+ }
+
+ /**
+ * Sanity-check the public interface of a view. This is called on every view
+ * after it is fully initiallized, but before it is actually connected to the
+ * part reference or the layout. Calls as much of the part's public interface as
+ * possible without modifying the part to test for exceptions and check the
+ * return values for glaring faults. This does not need to be an exhaustive
+ * conformance test, as it is called every time an editor is opened and it needs
+ * to be efficient.
+ *
+ * @param part
+ */
+ public static void testView(IViewPart part) throws Exception {
+ Assert.isTrue(part.getSite() == part.getViewSite(), "A part's site must be the same as a part's view site"); //$NON-NLS-1$
+ testWorkbenchPart(part);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PendingSyncExec.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PendingSyncExec.java
index f86abf2faef..4cffb63e5b2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PendingSyncExec.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PendingSyncExec.java
@@ -26,17 +26,17 @@ public final class PendingSyncExec {
// Accessed by multiple threads. Synchronize on "this" before accessing.
private boolean hasFinishedRunning;
- public PendingSyncExec(Runnable runnable) {
- this.runnable = runnable;
- }
+ public PendingSyncExec(Runnable runnable) {
+ this.runnable = runnable;
+ }
- /**
- * Attempts to acquire this semaphore. Returns true if it was successfully acquired,
- * and false otherwise.
- */
+ /**
+ * Attempts to acquire this semaphore. Returns true if it was successfully
+ * acquired, and false otherwise.
+ */
private boolean acquire(long delay) throws InterruptedException {
return semaphore.tryAcquire(delay, TimeUnit.MILLISECONDS);
- }
+ }
@Override
public boolean equals(Object obj) {
@@ -49,9 +49,9 @@ public final class PendingSyncExec {
return (runnable == ((PendingSyncExec) obj).runnable);
}
- public Thread getOperationThread() {
- return operation;
- }
+ public Thread getOperationThread() {
+ return operation;
+ }
public void run() {
// Clear the interrupted flag. The blocked thread may have been
@@ -95,18 +95,18 @@ public final class PendingSyncExec {
}
}
- @Override
+ @Override
public int hashCode() {
- return runnable == null ? 0 : runnable.hashCode();
- }
+ return runnable == null ? 0 : runnable.hashCode();
+ }
- public void setOperationThread(Thread operation) {
- this.operation = operation;
- }
+ public void setOperationThread(Thread operation) {
+ this.operation = operation;
+ }
- // for debug only
- @Override
+ // for debug only
+ @Override
public String toString() {
return "PendingSyncExec(" + runnable + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveAction.java
index 4e609ab2494..785896c1591 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveAction.java
@@ -22,73 +22,71 @@ import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.actions.ActionFactory;
/**
- * Abstract superclass of actions which are enabled iff there is an active perspective
- * in the window.
+ * Abstract superclass of actions which are enabled iff there is an active
+ * perspective in the window.
*
* @since 3.1
*/
public abstract class PerspectiveAction extends Action implements ActionFactory.IWorkbenchAction {
- /**
- * The workbench window containing this action.
- */
- private IWorkbenchWindow workbenchWindow;
+ /**
+ * The workbench window containing this action.
+ */
+ private IWorkbenchWindow workbenchWindow;
- /**
- * Tracks perspective activation, to update this action's
- * enabled state.
- */
- private PerspectiveTracker tracker;
+ /**
+ * Tracks perspective activation, to update this action's enabled state.
+ */
+ private PerspectiveTracker tracker;
- /**
- * Constructs a new perspective action for the given window.
- *
- * @param window the window
- */
- protected PerspectiveAction(IWorkbenchWindow window) {
- Assert.isNotNull(window);
- this.workbenchWindow = window;
- tracker = new PerspectiveTracker(window, this);
- }
+ /**
+ * Constructs a new perspective action for the given window.
+ *
+ * @param window the window
+ */
+ protected PerspectiveAction(IWorkbenchWindow window) {
+ Assert.isNotNull(window);
+ this.workbenchWindow = window;
+ tracker = new PerspectiveTracker(window, this);
+ }
- /**
- * Returns the window, or <code>null</code> if the action has been disposed.
- *
- * @return the window or <code>null</code>
- */
- protected IWorkbenchWindow getWindow() {
- return workbenchWindow;
- }
+ /**
+ * Returns the window, or <code>null</code> if the action has been disposed.
+ *
+ * @return the window or <code>null</code>
+ */
+ protected IWorkbenchWindow getWindow() {
+ return workbenchWindow;
+ }
- @Override
+ @Override
public void run() {
- if (workbenchWindow == null) {
- // action has been disposed
- return;
- }
- IWorkbenchPage page = workbenchWindow.getActivePage();
- if (page != null && page.getPerspective() != null) {
- run(page, page.getPerspective());
- }
- }
+ if (workbenchWindow == null) {
+ // action has been disposed
+ return;
+ }
+ IWorkbenchPage page = workbenchWindow.getActivePage();
+ if (page != null && page.getPerspective() != null) {
+ run(page, page.getPerspective());
+ }
+ }
- /**
- * Runs the action, passing the active page and perspective.
- *
- * @param page the active page
- * @param persp the active perspective
- */
- protected abstract void run(IWorkbenchPage page, IPerspectiveDescriptor persp);
+ /**
+ * Runs the action, passing the active page and perspective.
+ *
+ * @param page the active page
+ * @param persp the active perspective
+ */
+ protected abstract void run(IWorkbenchPage page, IPerspectiveDescriptor persp);
- @Override
+ @Override
public void dispose() {
- if (workbenchWindow == null) {
- // already disposed
- return;
- }
- tracker.dispose();
- workbenchWindow = null;
- }
+ if (workbenchWindow == null) {
+ // already disposed
+ return;
+ }
+ tracker.dispose();
+ workbenchWindow = null;
+ }
}
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveBarContributionItem.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveBarContributionItem.java
index 3eaf30fbaf2..1ed3f8a5d1d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveBarContributionItem.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveBarContributionItem.java
@@ -31,205 +31,199 @@ import org.eclipse.ui.IWorkbenchPreferenceConstants;
import org.eclipse.ui.internal.util.PrefUtil;
/**
- * A {@link ContributionItem} specifically for contributions to the perspective switcher.
+ * A {@link ContributionItem} specifically for contributions to the perspective
+ * switcher.
*
*/
public class PerspectiveBarContributionItem extends ContributionItem {
- private IPerspectiveDescriptor perspective;
+ private IPerspectiveDescriptor perspective;
- private IPreferenceStore apiPreferenceStore = PrefUtil
- .getAPIPreferenceStore();
+ private IPreferenceStore apiPreferenceStore = PrefUtil.getAPIPreferenceStore();
- private ToolItem toolItem = null;
+ private ToolItem toolItem = null;
- private Image image;
+ private Image image;
- private IWorkbenchPage workbenchPage;
+ private IWorkbenchPage workbenchPage;
- /**
- * Create a new perspective contribution item
- *
- * @param perspective the descriptor for the perspective
- * @param workbenchPage the page that this perspective is in
- */
- public PerspectiveBarContributionItem(IPerspectiveDescriptor perspective,
- IWorkbenchPage workbenchPage) {
- super(perspective.getId());
- this.perspective = perspective;
- this.workbenchPage = workbenchPage;
- }
+ /**
+ * Create a new perspective contribution item
+ *
+ * @param perspective the descriptor for the perspective
+ * @param workbenchPage the page that this perspective is in
+ */
+ public PerspectiveBarContributionItem(IPerspectiveDescriptor perspective, IWorkbenchPage workbenchPage) {
+ super(perspective.getId());
+ this.perspective = perspective;
+ this.workbenchPage = workbenchPage;
+ }
- @Override
+ @Override
public void dispose() {
- super.dispose();
- if (image != null && !image.isDisposed()) {
- image.dispose();
- image = null;
- }
- apiPreferenceStore = null;
- workbenchPage = null;
- perspective = null;
-
- }
-
- @Override
+ super.dispose();
+ if (image != null && !image.isDisposed()) {
+ image.dispose();
+ image = null;
+ }
+ apiPreferenceStore = null;
+ workbenchPage = null;
+ perspective = null;
+
+ }
+
+ @Override
public void fill(ToolBar parent, int index) {
- if (toolItem == null && parent != null && !parent.isDisposed()) {
+ if (toolItem == null && parent != null && !parent.isDisposed()) {
- if (index >= 0) {
+ if (index >= 0) {
toolItem = new ToolItem(parent, SWT.CHECK, index);
} else {
toolItem = new ToolItem(parent, SWT.CHECK);
}
- if (image == null || image.isDisposed()) {
- createImage();
- }
- toolItem.setImage(image);
-
- toolItem.setToolTipText(NLS.bind(WorkbenchMessages.PerspectiveBarContributionItem_toolTip, perspective.getLabel()));
- toolItem.addSelectionListener(widgetSelectedAdapter(event -> select()));
- toolItem.setData(this); //TODO review need for this
- update();
- }
- }
-
- private void createImage() {
- ImageDescriptor imageDescriptor = perspective.getImageDescriptor();
- if (imageDescriptor != null) {
- image = imageDescriptor.createImage();
- } else {
- image = WorkbenchImages.getImageDescriptor(
- ISharedImages.IMG_ETOOL_DEF_PERSPECTIVE)
- .createImage();
- }
- }
-
- Image getImage() {
- if (image == null) {
- createImage();
- }
- return image;
- }
-
- /**
- * Select this perspective
- */
- public void select() {
- if (workbenchPage.getPerspective() != perspective) {
- workbenchPage.setPerspective(perspective);
- } else {
+ if (image == null || image.isDisposed()) {
+ createImage();
+ }
+ toolItem.setImage(image);
+
+ toolItem.setToolTipText(
+ NLS.bind(WorkbenchMessages.PerspectiveBarContributionItem_toolTip, perspective.getLabel()));
+ toolItem.addSelectionListener(widgetSelectedAdapter(event -> select()));
+ toolItem.setData(this); // TODO review need for this
+ update();
+ }
+ }
+
+ private void createImage() {
+ ImageDescriptor imageDescriptor = perspective.getImageDescriptor();
+ if (imageDescriptor != null) {
+ image = imageDescriptor.createImage();
+ } else {
+ image = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_ETOOL_DEF_PERSPECTIVE).createImage();
+ }
+ }
+
+ Image getImage() {
+ if (image == null) {
+ createImage();
+ }
+ return image;
+ }
+
+ /**
+ * Select this perspective
+ */
+ public void select() {
+ if (workbenchPage.getPerspective() != perspective) {
+ workbenchPage.setPerspective(perspective);
+ } else {
toolItem.setSelection(true);
}
- }
+ }
- @Override
+ @Override
public void update() {
- if (toolItem != null && !toolItem.isDisposed()) {
- toolItem
- .setSelection(workbenchPage.getPerspective() == perspective);
- if (apiPreferenceStore
- .getBoolean(IWorkbenchPreferenceConstants.SHOW_TEXT_ON_PERSPECTIVE_BAR)) {
- if (apiPreferenceStore.getString(
- IWorkbenchPreferenceConstants.DOCK_PERSPECTIVE_BAR)
- .equals(IWorkbenchPreferenceConstants.TOP_LEFT)) {
+ if (toolItem != null && !toolItem.isDisposed()) {
+ toolItem.setSelection(workbenchPage.getPerspective() == perspective);
+ if (apiPreferenceStore.getBoolean(IWorkbenchPreferenceConstants.SHOW_TEXT_ON_PERSPECTIVE_BAR)) {
+ if (apiPreferenceStore.getString(IWorkbenchPreferenceConstants.DOCK_PERSPECTIVE_BAR)
+ .equals(IWorkbenchPreferenceConstants.TOP_LEFT)) {
toolItem.setText(perspective.getLabel());
} else {
- toolItem.setText(shortenText(perspective.getLabel(),
- toolItem));
+ toolItem.setText(shortenText(perspective.getLabel(), toolItem));
}
- } else {
- toolItem.setText(""); //$NON-NLS-1$
- }
- }
- }
-
- /**
- * Update this item with a new perspective descriptor
- * @param newDesc
- */
- public void update(IPerspectiveDescriptor newDesc) {
- perspective = newDesc;
- if (toolItem != null && !toolItem.isDisposed()) {
- ImageDescriptor imageDescriptor = perspective.getImageDescriptor();
- if (imageDescriptor != null) {
- toolItem.setImage(imageDescriptor.createImage());
- } else {
- toolItem.setImage(WorkbenchImages.getImageDescriptor(
- ISharedImages.IMG_ETOOL_DEF_PERSPECTIVE)
- .createImage());
- }
- toolItem.setToolTipText(NLS.bind(WorkbenchMessages.PerspectiveBarContributionItem_toolTip, perspective.getLabel() ));
- }
- update();
- }
-
- IWorkbenchPage getPage() {
- return workbenchPage;
- }
-
- IPerspectiveDescriptor getPerspective() {
- return perspective;
- }
-
- ToolItem getToolItem() {
- return toolItem;
- }
-
- /**
- * Answer whether the receiver is a match for the provided
- * perspective descriptor
- *
- * @param perspective the perspective descriptor
- * @param workbenchPage the page
- * @return <code>true</code> if it is a match
- */
- public boolean handles(IPerspectiveDescriptor perspective,
- IWorkbenchPage workbenchPage) {
- return this.perspective == perspective
- && this.workbenchPage == workbenchPage;
- }
-
- /**
- * Set the current perspective
- * @param newPerspective
- */
- public void setPerspective(IPerspectiveDescriptor newPerspective) {
- this.perspective = newPerspective;
- }
-
- // TODO review need for this method
- void setSelection(boolean b) {
- if (toolItem != null && !toolItem.isDisposed()) {
+ } else {
+ toolItem.setText(""); //$NON-NLS-1$
+ }
+ }
+ }
+
+ /**
+ * Update this item with a new perspective descriptor
+ *
+ * @param newDesc
+ */
+ public void update(IPerspectiveDescriptor newDesc) {
+ perspective = newDesc;
+ if (toolItem != null && !toolItem.isDisposed()) {
+ ImageDescriptor imageDescriptor = perspective.getImageDescriptor();
+ if (imageDescriptor != null) {
+ toolItem.setImage(imageDescriptor.createImage());
+ } else {
+ toolItem.setImage(
+ WorkbenchImages.getImageDescriptor(ISharedImages.IMG_ETOOL_DEF_PERSPECTIVE).createImage());
+ }
+ toolItem.setToolTipText(
+ NLS.bind(WorkbenchMessages.PerspectiveBarContributionItem_toolTip, perspective.getLabel()));
+ }
+ update();
+ }
+
+ IWorkbenchPage getPage() {
+ return workbenchPage;
+ }
+
+ IPerspectiveDescriptor getPerspective() {
+ return perspective;
+ }
+
+ ToolItem getToolItem() {
+ return toolItem;
+ }
+
+ /**
+ * Answer whether the receiver is a match for the provided perspective
+ * descriptor
+ *
+ * @param perspective the perspective descriptor
+ * @param workbenchPage the page
+ * @return <code>true</code> if it is a match
+ */
+ public boolean handles(IPerspectiveDescriptor perspective, IWorkbenchPage workbenchPage) {
+ return this.perspective == perspective && this.workbenchPage == workbenchPage;
+ }
+
+ /**
+ * Set the current perspective
+ *
+ * @param newPerspective
+ */
+ public void setPerspective(IPerspectiveDescriptor newPerspective) {
+ this.perspective = newPerspective;
+ }
+
+ // TODO review need for this method
+ void setSelection(boolean b) {
+ if (toolItem != null && !toolItem.isDisposed()) {
toolItem.setSelection(b);
}
- }
+ }
- static int getMaxWidth(Image image) {
- return image.getBounds().width * 5;
- }
+ static int getMaxWidth(Image image) {
+ return image.getBounds().width * 5;
+ }
- private static final String ellipsis = "..."; //$NON-NLS-1$
+ private static final String ellipsis = "..."; //$NON-NLS-1$
- protected String shortenText(String textValue, ToolItem item) {
- if (textValue == null || toolItem == null || toolItem.isDisposed()) {
+ protected String shortenText(String textValue, ToolItem item) {
+ if (textValue == null || toolItem == null || toolItem.isDisposed()) {
return null;
}
- String returnText = textValue;
- GC gc = new GC(item.getParent());
- int maxWidth = getMaxWidth(item.getImage());
- if (gc.textExtent(textValue).x >= maxWidth) {
- for (int i = textValue.length(); i > 0; i--) {
- String test = textValue.substring(0, i);
- test = test + ellipsis;
- if (gc.textExtent(test).x < maxWidth) {
- returnText = test;
- break;
- }
- }
- }
- gc.dispose();
- return returnText;
- }
+ String returnText = textValue;
+ GC gc = new GC(item.getParent());
+ int maxWidth = getMaxWidth(item.getImage());
+ if (gc.textExtent(textValue).x >= maxWidth) {
+ for (int i = textValue.length(); i > 0; i--) {
+ String test = textValue.substring(0, i);
+ test = test + ellipsis;
+ if (gc.textExtent(test).x < maxWidth) {
+ returnText = test;
+ break;
+ }
+ }
+ }
+ gc.dispose();
+ return returnText;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveBarNewContributionItem.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveBarNewContributionItem.java
index 742ea1355a1..572dd8289e9 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveBarNewContributionItem.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveBarNewContributionItem.java
@@ -29,60 +29,57 @@ import org.eclipse.ui.actions.ContributionItemFactory;
public class PerspectiveBarNewContributionItem extends ContributionItem {
- private MenuManager menuManager = null;
+ private MenuManager menuManager = null;
- private Image image;
+ private Image image;
- private ToolItem toolItem = null;
+ private ToolItem toolItem = null;
- public PerspectiveBarNewContributionItem(IWorkbenchWindow workbenchWindow) {
- super(PerspectiveBarNewContributionItem.class.getName());
- menuManager = new MenuManager();
- menuManager.add(ContributionItemFactory.PERSPECTIVES_SHORTLIST
- .create(workbenchWindow));
- }
+ public PerspectiveBarNewContributionItem(IWorkbenchWindow workbenchWindow) {
+ super(PerspectiveBarNewContributionItem.class.getName());
+ menuManager = new MenuManager();
+ menuManager.add(ContributionItemFactory.PERSPECTIVES_SHORTLIST.create(workbenchWindow));
+ }
- @Override
+ @Override
public void dispose() {
- super.dispose();
- if (image != null && !image.isDisposed()) {
- image.dispose();
- image = null;
- }
- }
+ super.dispose();
+ if (image != null && !image.isDisposed()) {
+ image.dispose();
+ image = null;
+ }
+ }
- @Override
+ @Override
public void fill(final ToolBar parent, int index) {
- if (toolItem == null && parent != null) {
- parent.addDisposeListener(e -> {
- //toolItem.getImage().dispose();
- toolItem.dispose();
- toolItem = null;
+ if (toolItem == null && parent != null) {
+ parent.addDisposeListener(e -> {
+ // toolItem.getImage().dispose();
+ toolItem.dispose();
+ toolItem = null;
});
- toolItem = new ToolItem(parent, SWT.PUSH);
- if (image == null || image.isDisposed()) {
- image = WorkbenchImages.getImageDescriptor(
- IWorkbenchGraphicConstants.IMG_ETOOL_NEW_PAGE)
- .createImage();
- }
- toolItem.setImage(image);
+ toolItem = new ToolItem(parent, SWT.PUSH);
+ if (image == null || image.isDisposed()) {
+ image = WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_NEW_PAGE).createImage();
+ }
+ toolItem.setImage(image);
- toolItem.setText(""); //$NON-NLS-1$
- toolItem.setToolTipText(WorkbenchMessages.PerspectiveBarNewContributionItem_toolTip);
- toolItem.addSelectionListener(widgetSelectedAdapter(event -> {
- menuManager.update(true);
- Point point = new Point(event.x, event.y);
- if (event.widget instanceof ToolItem) {
- ToolItem toolItem = (ToolItem) event.widget;
- Rectangle rectangle = toolItem.getBounds();
+ toolItem.setText(""); //$NON-NLS-1$
+ toolItem.setToolTipText(WorkbenchMessages.PerspectiveBarNewContributionItem_toolTip);
+ toolItem.addSelectionListener(widgetSelectedAdapter(event -> {
+ menuManager.update(true);
+ Point point = new Point(event.x, event.y);
+ if (event.widget instanceof ToolItem) {
+ ToolItem toolItem = (ToolItem) event.widget;
+ Rectangle rectangle = toolItem.getBounds();
point = new Point(rectangle.x, rectangle.y + rectangle.height);
- }
- Menu menu = menuManager.createContextMenu(parent);
- point = parent.toDisplay(point);
- menu.setLocation(point.x, point.y);
- menu.setVisible(true);
+ }
+ Menu menu = menuManager.createContextMenu(parent);
+ point = parent.toDisplay(point);
+ menu.setLocation(point.x, point.y);
+ menu.setVisible(true);
}));
- }
- }
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveExtensionReader.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveExtensionReader.java
index b3c69d4cde2..38c51577b46 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveExtensionReader.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveExtensionReader.java
@@ -26,89 +26,88 @@ import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants;
import org.eclipse.ui.internal.registry.RegistryReader;
/**
- * A strategy to read perspective extension from the registry.
- * A pespective extension is one of a view, viewAction, perspAction,
- * newWizardAction, or actionSet.
+ * A strategy to read perspective extension from the registry. A pespective
+ * extension is one of a view, viewAction, perspAction, newWizardAction, or
+ * actionSet.
*/
public class PerspectiveExtensionReader extends RegistryReader {
- private String targetID;
+ private String targetID;
private ModeledPageLayout pageLayout;
private Set<String> includeOnlyTags = null;
- private static final String VAL_LEFT = "left";//$NON-NLS-1$
+ private static final String VAL_LEFT = "left";//$NON-NLS-1$
- private static final String VAL_RIGHT = "right";//$NON-NLS-1$
+ private static final String VAL_RIGHT = "right";//$NON-NLS-1$
- private static final String VAL_TOP = "top";//$NON-NLS-1$
+ private static final String VAL_TOP = "top";//$NON-NLS-1$
- private static final String VAL_BOTTOM = "bottom";//$NON-NLS-1$
+ private static final String VAL_BOTTOM = "bottom";//$NON-NLS-1$
- private static final String VAL_STACK = "stack";//$NON-NLS-1$
+ private static final String VAL_STACK = "stack";//$NON-NLS-1$
private static final String VAL_FAST = "fast";//$NON-NLS-1$
private static final String VAL_TRUE = "true";//$NON-NLS-1$
- // VAL_FALSE added by dan_rubel@instantiations.com
- // TODO: this logic is backwards... we should be checking for true, but
- // technically this is API now...
- private static final String VAL_FALSE = "false";//$NON-NLS-1$
+ // VAL_FALSE added by dan_rubel@instantiations.com
+ // TODO: this logic is backwards... we should be checking for true, but
+ // technically this is API now...
+ private static final String VAL_FALSE = "false";//$NON-NLS-1$
private IExtensionTracker tracker;
- /**
- * PerspectiveExtensionReader constructor..
- */
- public PerspectiveExtensionReader() {
- // do nothing
- }
-
- /**
- * Read the view extensions within a registry.
- *
- * @param extensionTracker the tracker
- * @param id the id
- * @param out the layout
- */
+ /**
+ * PerspectiveExtensionReader constructor..
+ */
+ public PerspectiveExtensionReader() {
+ // do nothing
+ }
+
+ /**
+ * Read the view extensions within a registry.
+ *
+ * @param extensionTracker the tracker
+ * @param id the id
+ * @param out the layout
+ */
public void extendLayout(IExtensionTracker extensionTracker, String id, ModeledPageLayout out) {
- tracker = extensionTracker;
- targetID = id;
- pageLayout = out;
- readRegistry(Platform.getExtensionRegistry(), PlatformUI.PLUGIN_ID,
- IWorkbenchRegistryConstants.PL_PERSPECTIVE_EXTENSIONS);
- }
-
- /**
- * Returns whether the given tag should be included.
- */
- private boolean includeTag(String tag) {
- return includeOnlyTags == null || includeOnlyTags.contains(tag);
- }
-
- /**
- * Process an action set.
- */
- private boolean processActionSet(IConfigurationElement element) {
- String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
- if (id != null) {
+ tracker = extensionTracker;
+ targetID = id;
+ pageLayout = out;
+ readRegistry(Platform.getExtensionRegistry(), PlatformUI.PLUGIN_ID,
+ IWorkbenchRegistryConstants.PL_PERSPECTIVE_EXTENSIONS);
+ }
+
+ /**
+ * Returns whether the given tag should be included.
+ */
+ private boolean includeTag(String tag) {
+ return includeOnlyTags == null || includeOnlyTags.contains(tag);
+ }
+
+ /**
+ * Process an action set.
+ */
+ private boolean processActionSet(IConfigurationElement element) {
+ String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
+ if (id != null) {
pageLayout.addActionSet(id);
}
- return true;
- }
-
- /**
- * Process an extension.
- * Assumption: Extension is for current perspective.
- */
- private boolean processExtension(IConfigurationElement element) {
- IConfigurationElement[] children = element.getChildren();
- for (IConfigurationElement child : children) {
- String type = child.getName();
- if (includeTag(type)) {
- boolean result = false;
- if (type.equals(IWorkbenchRegistryConstants.TAG_ACTION_SET)) {
+ return true;
+ }
+
+ /**
+ * Process an extension. Assumption: Extension is for current perspective.
+ */
+ private boolean processExtension(IConfigurationElement element) {
+ IConfigurationElement[] children = element.getChildren();
+ for (IConfigurationElement child : children) {
+ String type = child.getName();
+ if (includeTag(type)) {
+ boolean result = false;
+ if (type.equals(IWorkbenchRegistryConstants.TAG_ACTION_SET)) {
result = processActionSet(child);
} else if (type.equals(IWorkbenchRegistryConstants.TAG_VIEW)) {
result = processView(child);
@@ -125,120 +124,117 @@ public class PerspectiveExtensionReader extends RegistryReader {
} else if (type.equals(IWorkbenchRegistryConstants.TAG_HIDDEN_TOOLBAR_ITEM)) {
result = processHiddenToolBarItem(child);
}
- if (!result) {
- WorkbenchPlugin.log("Unable to process element: " + //$NON-NLS-1$
- type
- + " in perspective extension: " + //$NON-NLS-1$
- element.getDeclaringExtension()
- .getUniqueIdentifier());
- }
- }
- }
- return true;
- }
-
- /**
- * Process a perspective shortcut
- */
- private boolean processPerspectiveShortcut(IConfigurationElement element) {
- String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
- if (id != null) {
+ if (!result) {
+ WorkbenchPlugin.log("Unable to process element: " + //$NON-NLS-1$
+ type + " in perspective extension: " + //$NON-NLS-1$
+ element.getDeclaringExtension().getUniqueIdentifier());
+ }
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Process a perspective shortcut
+ */
+ private boolean processPerspectiveShortcut(IConfigurationElement element) {
+ String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
+ if (id != null) {
pageLayout.addPerspectiveShortcut(id);
}
- return true;
- }
-
- /**
- * Process a show in element.
- */
- private boolean processShowInPart(IConfigurationElement element) {
- String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
- if (id != null) {
+ return true;
+ }
+
+ /**
+ * Process a show in element.
+ */
+ private boolean processShowInPart(IConfigurationElement element) {
+ String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
+ if (id != null) {
pageLayout.addShowInPart(id);
}
- return true;
- }
-
- /**
- * Process a hidden menu item
- */
- private boolean processHiddenMenuItem(IConfigurationElement element) {
- String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
- if (id != null) {
+ return true;
+ }
+
+ /**
+ * Process a hidden menu item
+ */
+ private boolean processHiddenMenuItem(IConfigurationElement element) {
+ String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
+ if (id != null) {
pageLayout.addHiddenMenuItemId(id);
}
- return true;
- }
-
- /**
- * Process a hidden toolbar item
- */
- private boolean processHiddenToolBarItem(IConfigurationElement element) {
- String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
- if (id != null) {
+ return true;
+ }
+
+ /**
+ * Process a hidden toolbar item
+ */
+ private boolean processHiddenToolBarItem(IConfigurationElement element) {
+ String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
+ if (id != null) {
pageLayout.addHiddenToolBarItemId(id);
}
- return true;
- }
-
- // processView(IConfigurationElement) modified by dan_rubel@instantiations.com
- /**
- * Process a view
- */
- private boolean processView(IConfigurationElement element) {
- // Get id, relative, and relationship.
- String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
- String relative = element.getAttribute(IWorkbenchRegistryConstants.ATT_RELATIVE);
- String relationship = element.getAttribute(IWorkbenchRegistryConstants.ATT_RELATIONSHIP);
- String ratioString = element.getAttribute(IWorkbenchRegistryConstants.ATT_RATIO);
- boolean visible = !VAL_FALSE.equals(element.getAttribute(IWorkbenchRegistryConstants.ATT_VISIBLE));
- String closeable = element.getAttribute(IWorkbenchRegistryConstants.ATT_CLOSEABLE);
- String moveable = element.getAttribute(IWorkbenchRegistryConstants.ATT_MOVEABLE);
- String standalone = element.getAttribute(IWorkbenchRegistryConstants.ATT_STANDALONE);
- String showTitle = element.getAttribute(IWorkbenchRegistryConstants.ATT_SHOW_TITLE);
-
- // Default to 'false'
- String minVal = element.getAttribute(IWorkbenchRegistryConstants.ATT_MINIMIZED);
- boolean minimized = minVal != null && VAL_TRUE.equals(minVal);
-
- float ratio;
-
- if (id == null) {
- logMissingAttribute(element, IWorkbenchRegistryConstants.ATT_ID);
- return false;
- }
- if (relationship == null) {
- logMissingAttribute(element, IWorkbenchRegistryConstants.ATT_RELATIONSHIP);
- return false;
- }
+ return true;
+ }
+
+ // processView(IConfigurationElement) modified by dan_rubel@instantiations.com
+ /**
+ * Process a view
+ */
+ private boolean processView(IConfigurationElement element) {
+ // Get id, relative, and relationship.
+ String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
+ String relative = element.getAttribute(IWorkbenchRegistryConstants.ATT_RELATIVE);
+ String relationship = element.getAttribute(IWorkbenchRegistryConstants.ATT_RELATIONSHIP);
+ String ratioString = element.getAttribute(IWorkbenchRegistryConstants.ATT_RATIO);
+ boolean visible = !VAL_FALSE.equals(element.getAttribute(IWorkbenchRegistryConstants.ATT_VISIBLE));
+ String closeable = element.getAttribute(IWorkbenchRegistryConstants.ATT_CLOSEABLE);
+ String moveable = element.getAttribute(IWorkbenchRegistryConstants.ATT_MOVEABLE);
+ String standalone = element.getAttribute(IWorkbenchRegistryConstants.ATT_STANDALONE);
+ String showTitle = element.getAttribute(IWorkbenchRegistryConstants.ATT_SHOW_TITLE);
+
+ // Default to 'false'
+ String minVal = element.getAttribute(IWorkbenchRegistryConstants.ATT_MINIMIZED);
+ boolean minimized = minVal != null && VAL_TRUE.equals(minVal);
+
+ float ratio;
+
+ if (id == null) {
+ logMissingAttribute(element, IWorkbenchRegistryConstants.ATT_ID);
+ return false;
+ }
+ if (relationship == null) {
+ logMissingAttribute(element, IWorkbenchRegistryConstants.ATT_RELATIONSHIP);
+ return false;
+ }
if (!VAL_FAST.equals(relationship) && relative == null) {
- logError(element,
- "Attribute '" + IWorkbenchRegistryConstants.ATT_RELATIVE //$NON-NLS-1$
- + "' not defined. This attribute is required when " //$NON-NLS-1$
- + IWorkbenchRegistryConstants.ATT_RELATIONSHIP + "=\"" + relationship + "\"."); //$NON-NLS-1$ //$NON-NLS-2$
+ logError(element, "Attribute '" + IWorkbenchRegistryConstants.ATT_RELATIVE //$NON-NLS-1$
+ + "' not defined. This attribute is required when " //$NON-NLS-1$
+ + IWorkbenchRegistryConstants.ATT_RELATIONSHIP + "=\"" + relationship + "\"."); //$NON-NLS-1$ //$NON-NLS-2$
return false;
}
- // Get the ratio.
- if (ratioString == null) {
- // The ratio has not been specified.
- ratio = IPageLayout.NULL_RATIO;
- } else {
- try {
+ // Get the ratio.
+ if (ratioString == null) {
+ // The ratio has not been specified.
+ ratio = IPageLayout.NULL_RATIO;
+ } else {
+ try {
ratio = Float.parseFloat(ratioString);
- } catch (NumberFormatException e) {
- return false;
- }
- // If the ratio is outside the allowable range, mark it as invalid.
- if (ratio < IPageLayout.RATIO_MIN || ratio > IPageLayout.RATIO_MAX) {
+ } catch (NumberFormatException e) {
+ return false;
+ }
+ // If the ratio is outside the allowable range, mark it as invalid.
+ if (ratio < IPageLayout.RATIO_MIN || ratio > IPageLayout.RATIO_MAX) {
ratio = IPageLayout.INVALID_RATIO;
}
- }
+ }
- // Get relationship details.
- boolean stack = false;
- int intRelation = 0;
+ // Get relationship details.
+ boolean stack = false;
+ int intRelation = 0;
boolean fast = false;
- if (relationship.equals(VAL_LEFT)) {
+ if (relationship.equals(VAL_LEFT)) {
intRelation = IPageLayout.LEFT;
} else if (relationship.equals(VAL_RIGHT)) {
intRelation = IPageLayout.RIGHT;
@@ -254,15 +250,16 @@ public class PerspectiveExtensionReader extends RegistryReader {
return false;
}
- if (visible) {
- // If adding a view (not just a placeholder), remove any existing placeholder.
- // See bug 85948 [Perspectives] Adding register & expressions view by default to debug perspective fails
- pageLayout.removePlaceholder(id);
- }
+ if (visible) {
+ // If adding a view (not just a placeholder), remove any existing placeholder.
+ // See bug 85948 [Perspectives] Adding register & expressions view by default to
+ // debug perspective fails
+ pageLayout.removePlaceholder(id);
+ }
- // If stack ..
- if (stack) {
- if (visible) {
+ // If stack ..
+ if (stack) {
+ if (visible) {
pageLayout.stackView(id, relative, true);
} else {
pageLayout.stackView(id, relative, false);
@@ -278,34 +275,32 @@ public class PerspectiveExtensionReader extends RegistryReader {
}
} else {
- // The view is a regular view.
- // If the ratio is not specified or is invalid, use the default ratio.
- if (ratio == IPageLayout.NULL_RATIO
- || ratio == IPageLayout.INVALID_RATIO) {
+ // The view is a regular view.
+ // If the ratio is not specified or is invalid, use the default ratio.
+ if (ratio == IPageLayout.NULL_RATIO || ratio == IPageLayout.INVALID_RATIO) {
ratio = IPageLayout.DEFAULT_VIEW_RATIO;
}
- if (visible) {
- if (VAL_TRUE.equals(standalone)) {
- pageLayout.addStandaloneView(id, !VAL_FALSE
- .equals(showTitle), intRelation, ratio, relative);
- } else {
- pageLayout.addView(id, intRelation, ratio, relative, minimized);
- }
- } else {
+ if (visible) {
+ if (VAL_TRUE.equals(standalone)) {
+ pageLayout.addStandaloneView(id, !VAL_FALSE.equals(showTitle), intRelation, ratio, relative);
+ } else {
+ pageLayout.addView(id, intRelation, ratio, relative, minimized);
+ }
+ } else {
// Fix for 99155, CGross (schtoo@schtoo.com)
// Adding standalone placeholder for standalone views
if (VAL_TRUE.equals(standalone)) {
- pageLayout.addStandaloneViewPlaceholder(id, intRelation,
- ratio, relative, !VAL_FALSE.equals(showTitle));
+ pageLayout.addStandaloneViewPlaceholder(id, intRelation, ratio, relative,
+ !VAL_FALSE.equals(showTitle));
} else {
pageLayout.addPlaceholder(id, intRelation, ratio, relative);
}
}
- }
- IViewLayout viewLayout = pageLayout.getViewLayout(id);
- // may be null if it's been filtered by activity
- if (viewLayout != null) {
+ }
+ IViewLayout viewLayout = pageLayout.getViewLayout(id);
+ // may be null if it's been filtered by activity
+ if (viewLayout != null) {
if (closeable != null) {
viewLayout.setCloseable(!VAL_FALSE.equals(closeable));
}
@@ -314,56 +309,57 @@ public class PerspectiveExtensionReader extends RegistryReader {
}
}
- return true;
- }
+ return true;
+ }
- /**
+ /**
* Process a view shortcut
*/
- private boolean processViewShortcut(IConfigurationElement element) {
- String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
- if (id != null) {
+ private boolean processViewShortcut(IConfigurationElement element) {
+ String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
+ if (id != null) {
pageLayout.addShowViewShortcut(id);
}
- return true;
- }
-
- /**
- * Process a wizard shortcut
- */
- private boolean processWizardShortcut(IConfigurationElement element) {
- String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
- if (id != null) {
+ return true;
+ }
+
+ /**
+ * Process a wizard shortcut
+ */
+ private boolean processWizardShortcut(IConfigurationElement element) {
+ String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
+ if (id != null) {
pageLayout.addNewWizardShortcut(id);
}
- return true;
- }
+ return true;
+ }
- @Override
+ @Override
protected boolean readElement(IConfigurationElement element) {
- String type = element.getName();
- if (type.equals(IWorkbenchRegistryConstants.TAG_PERSPECTIVE_EXTENSION)) {
- String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_TARGET_ID);
- if (targetID.equals(id) || "*".equals(id)) { //$NON-NLS-1$
- if (tracker != null) {
- tracker.registerObject(element.getDeclaringExtension(), new DirtyPerspectiveMarker(id), IExtensionTracker.REF_STRONG);
+ String type = element.getName();
+ if (type.equals(IWorkbenchRegistryConstants.TAG_PERSPECTIVE_EXTENSION)) {
+ String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_TARGET_ID);
+ if (targetID.equals(id) || "*".equals(id)) { //$NON-NLS-1$
+ if (tracker != null) {
+ tracker.registerObject(element.getDeclaringExtension(), new DirtyPerspectiveMarker(id),
+ IExtensionTracker.REF_STRONG);
}
- return processExtension(element);
- }
- return true;
- }
- return false;
- }
-
- /**
- * Sets the tags to include. All others are ignored.
- *
- * @param tags the tags to include
- */
- public void setIncludeOnlyTags(String[] tags) {
+ return processExtension(element);
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Sets the tags to include. All others are ignored.
+ *
+ * @param tags the tags to include
+ */
+ public void setIncludeOnlyTags(String[] tags) {
includeOnlyTags = new HashSet<>();
- for (String tag : tags) {
- includeOnlyTags.add(tag);
- }
- }
+ for (String tag : tags) {
+ includeOnlyTags.add(tag);
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveListenerList.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveListenerList.java
index f15e691cc07..c2b38a79768 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveListenerList.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveListenerList.java
@@ -30,200 +30,193 @@ import org.eclipse.ui.internal.misc.UIStats;
*/
public class PerspectiveListenerList extends EventManager {
- /**
- * PerspectiveListenerList constructor comment.
- */
- public PerspectiveListenerList() {
- super();
- }
+ /**
+ * PerspectiveListenerList constructor comment.
+ */
+ public PerspectiveListenerList() {
+ super();
+ }
- /**
- * Adds an IPerspectiveListener to the perspective service.
- */
- public void addPerspectiveListener(IPerspectiveListener l) {
- addListenerObject(l);
- }
+ /**
+ * Adds an IPerspectiveListener to the perspective service.
+ */
+ public void addPerspectiveListener(IPerspectiveListener l) {
+ addListenerObject(l);
+ }
- /**
- * Calls a perspective listener with associated performance event instrumentation
- *
- * @param runnable
- * @param listener
- * @param perspective
- * @param description
- */
- private void fireEvent(SafeRunnable runnable, IPerspectiveListener listener, IPerspectiveDescriptor perspective, String description) {
- String label = null;//for debugging
- if (UIStats.isDebugging(UIStats.NOTIFY_PERSPECTIVE_LISTENERS)) {
- label = description + perspective.getId();
- UIStats.start(UIStats.NOTIFY_PERSPECTIVE_LISTENERS, label);
- }
- SafeRunner.run(runnable);
- if (UIStats.isDebugging(UIStats.NOTIFY_PERSPECTIVE_LISTENERS)) {
+ /**
+ * Calls a perspective listener with associated performance event
+ * instrumentation
+ *
+ * @param runnable
+ * @param listener
+ * @param perspective
+ * @param description
+ */
+ private void fireEvent(SafeRunnable runnable, IPerspectiveListener listener, IPerspectiveDescriptor perspective,
+ String description) {
+ String label = null;// for debugging
+ if (UIStats.isDebugging(UIStats.NOTIFY_PERSPECTIVE_LISTENERS)) {
+ label = description + perspective.getId();
+ UIStats.start(UIStats.NOTIFY_PERSPECTIVE_LISTENERS, label);
+ }
+ SafeRunner.run(runnable);
+ if (UIStats.isDebugging(UIStats.NOTIFY_PERSPECTIVE_LISTENERS)) {
UIStats.end(UIStats.NOTIFY_PERSPECTIVE_LISTENERS, listener, label);
}
}
- /**
- * Notifies the listener that a perspective has been activated.
- */
- public void firePerspectiveActivated(final IWorkbenchPage page,
- final IPerspectiveDescriptor perspective) {
+ /**
+ * Notifies the listener that a perspective has been activated.
+ */
+ public void firePerspectiveActivated(final IWorkbenchPage page, final IPerspectiveDescriptor perspective) {
for (Object listener : getListeners()) {
final IPerspectiveListener perspectiveListener = (IPerspectiveListener) listener;
- fireEvent(new SafeRunnable() {
- @Override
+ fireEvent(new SafeRunnable() {
+ @Override
public void run() {
perspectiveListener.perspectiveActivated(page, perspective);
- }
+ }
}, perspectiveListener, perspective, "activated::"); //$NON-NLS-1$
- }
- }
+ }
+ }
- /**
- * Notifies the listener that a perspective has been deactivated.
- *
- * @since 3.2
- */
- public void firePerspectivePreDeactivate(final IWorkbenchPage page,
- final IPerspectiveDescriptor perspective) {
+ /**
+ * Notifies the listener that a perspective has been deactivated.
+ *
+ * @since 3.2
+ */
+ public void firePerspectivePreDeactivate(final IWorkbenchPage page, final IPerspectiveDescriptor perspective) {
for (Object listener : getListeners()) {
if (listener instanceof IPerspectiveListener4) {
final IPerspectiveListener4 perspectiveListener = (IPerspectiveListener4) listener;
- fireEvent(new SafeRunnable() {
- @Override
+ fireEvent(new SafeRunnable() {
+ @Override
public void run() {
perspectiveListener.perspectivePreDeactivate(page, perspective);
- }
+ }
}, perspectiveListener, perspective, "pre-deactivate::"); //$NON-NLS-1$
- }
- }
- }
+ }
+ }
+ }
- /**
- * Notifies the listener that a perspective has been deactivated.
- *
- * @since 3.1
- */
- public void firePerspectiveDeactivated(final IWorkbenchPage page,
- final IPerspectiveDescriptor perspective) {
+ /**
+ * Notifies the listener that a perspective has been deactivated.
+ *
+ * @since 3.1
+ */
+ public void firePerspectiveDeactivated(final IWorkbenchPage page, final IPerspectiveDescriptor perspective) {
for (Object listener : getListeners()) {
if (listener instanceof IPerspectiveListener3) {
final IPerspectiveListener3 perspectiveListener = (IPerspectiveListener3) listener;
- fireEvent(new SafeRunnable() {
- @Override
+ fireEvent(new SafeRunnable() {
+ @Override
public void run() {
perspectiveListener.perspectiveDeactivated(page, perspective);
- }
+ }
}, perspectiveListener, perspective, "deactivated::"); //$NON-NLS-1$
- }
- }
- }
+ }
+ }
+ }
- /**
- * Notifies the listener that a perspective has been changed.
- */
- public void firePerspectiveChanged(final IWorkbenchPage page,
- final IPerspectiveDescriptor perspective, final String changeId) {
+ /**
+ * Notifies the listener that a perspective has been changed.
+ */
+ public void firePerspectiveChanged(final IWorkbenchPage page, final IPerspectiveDescriptor perspective,
+ final String changeId) {
for (Object listener : getListeners()) {
final IPerspectiveListener perspectiveListener = (IPerspectiveListener) listener;
- fireEvent(new SafeRunnable() {
- @Override
+ fireEvent(new SafeRunnable() {
+ @Override
public void run() {
perspectiveListener.perspectiveChanged(page, perspective, changeId);
- }
+ }
}, perspectiveListener, perspective, "changed::"); //$NON-NLS-1$
- }
- }
+ }
+ }
- /**
- * Notifies the listener that a part has been affected
- * in the given perspective.
- *
- * @since 3.0
- */
- public void firePerspectiveChanged(final IWorkbenchPage page,
- final IPerspectiveDescriptor perspective,
- final IWorkbenchPartReference partRef, final String changeId) {
+ /**
+ * Notifies the listener that a part has been affected in the given perspective.
+ *
+ * @since 3.0
+ */
+ public void firePerspectiveChanged(final IWorkbenchPage page, final IPerspectiveDescriptor perspective,
+ final IWorkbenchPartReference partRef, final String changeId) {
for (Object listener : getListeners()) {
if (listener instanceof IPerspectiveListener2) {
final IPerspectiveListener2 perspectiveListener = (IPerspectiveListener2) listener;
- fireEvent(new SafeRunnable() {
- @Override
+ fireEvent(new SafeRunnable() {
+ @Override
public void run() {
- perspectiveListener.perspectiveChanged(page, perspective, partRef,
- changeId);
- }
+ perspectiveListener.perspectiveChanged(page, perspective, partRef, changeId);
+ }
}, perspectiveListener, perspective, "changed::"); //$NON-NLS-1$
- }
- }
- }
+ }
+ }
+ }
- /**
- * Notifies the listener that a perspective has been closed.
- *
- * @since 3.1
- */
- public void firePerspectiveClosed(final IWorkbenchPage page,
- final IPerspectiveDescriptor perspective) {
+ /**
+ * Notifies the listener that a perspective has been closed.
+ *
+ * @since 3.1
+ */
+ public void firePerspectiveClosed(final IWorkbenchPage page, final IPerspectiveDescriptor perspective) {
for (Object listener : getListeners()) {
if (listener instanceof IPerspectiveListener3) {
final IPerspectiveListener3 perspectiveListener = (IPerspectiveListener3) listener;
- fireEvent(new SafeRunnable() {
- @Override
+ fireEvent(new SafeRunnable() {
+ @Override
public void run() {
perspectiveListener.perspectiveClosed(page, perspective);
- }
+ }
}, perspectiveListener, perspective, "closed::"); //$NON-NLS-1$
- }
- }
- }
+ }
+ }
+ }
- /**
- * Notifies the listener that a perspective has been opened.
- *
- * @since 3.1
- */
- public void firePerspectiveOpened(final IWorkbenchPage page,
- final IPerspectiveDescriptor perspective) {
+ /**
+ * Notifies the listener that a perspective has been opened.
+ *
+ * @since 3.1
+ */
+ public void firePerspectiveOpened(final IWorkbenchPage page, final IPerspectiveDescriptor perspective) {
for (Object listener : getListeners()) {
if (listener instanceof IPerspectiveListener3) {
final IPerspectiveListener3 perspectiveListener = (IPerspectiveListener3) listener;
- fireEvent(new SafeRunnable() {
- @Override
+ fireEvent(new SafeRunnable() {
+ @Override
public void run() {
perspectiveListener.perspectiveOpened(page, perspective);
- }
+ }
}, perspectiveListener, perspective, "opened::"); //$NON-NLS-1$
- }
- }
- }
+ }
+ }
+ }
- /**
- * Notifies the listener that a perspective has been deactivated.
- *
- * @since 3.1
- */
- public void firePerspectiveSavedAs(final IWorkbenchPage page,
- final IPerspectiveDescriptor oldPerspective,
- final IPerspectiveDescriptor newPerspective) {
+ /**
+ * Notifies the listener that a perspective has been deactivated.
+ *
+ * @since 3.1
+ */
+ public void firePerspectiveSavedAs(final IWorkbenchPage page, final IPerspectiveDescriptor oldPerspective,
+ final IPerspectiveDescriptor newPerspective) {
for (Object listener : getListeners()) {
if (listener instanceof IPerspectiveListener3) {
final IPerspectiveListener3 perspectiveListener = (IPerspectiveListener3) listener;
- fireEvent(new SafeRunnable() {
- @Override
+ fireEvent(new SafeRunnable() {
+ @Override
public void run() {
perspectiveListener.perspectiveSavedAs(page, oldPerspective, newPerspective);
- }
+ }
}, perspectiveListener, newPerspective, "saveAs::"); //$NON-NLS-1$
- }
- }
- }
+ }
+ }
+ }
- /**
- * Removes an IPerspectiveListener from the perspective service.
- */
- public void removePerspectiveListener(IPerspectiveListener l) {
- removeListenerObject(l);
- }
+ /**
+ * Removes an IPerspectiveListener from the perspective service.
+ */
+ public void removePerspectiveListener(IPerspectiveListener l) {
+ removeListenerObject(l);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveTagger.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveTagger.java
index 866df3b1a88..3c2e80d5fb8 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveTagger.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveTagger.java
@@ -82,20 +82,17 @@ public class PerspectiveTagger {
}
static void tagDebugPerspective(MPerspective perspective, EModelService modelService) {
- MUIElement element = modelService.find(
- "org.eclipse.debug.internal.ui.NavigatorFolderView", perspective); //$NON-NLS-1$
+ MUIElement element = modelService.find("org.eclipse.debug.internal.ui.NavigatorFolderView", perspective); //$NON-NLS-1$
if (element != null) {
element.getTags().add("org.eclipse.e4.primaryNavigationStack"); //$NON-NLS-1$
}
- element = modelService.find(
- "org.eclipse.debug.internal.ui.ConsoleFolderView", perspective); //$NON-NLS-1$
+ element = modelService.find("org.eclipse.debug.internal.ui.ConsoleFolderView", perspective); //$NON-NLS-1$
if (element != null) {
element.getTags().add("org.eclipse.e4.secondaryDataStack"); //$NON-NLS-1$
}
- element = modelService.find(
- "org.eclipse.debug.internal.ui.OutlineFolderView", perspective); //$NON-NLS-1$
+ element = modelService.find("org.eclipse.debug.internal.ui.OutlineFolderView", perspective); //$NON-NLS-1$
if (element != null) {
element.getTags().add("org.eclipse.e4.secondaryNavigationStack"); //$NON-NLS-1$
}
@@ -118,8 +115,7 @@ public class PerspectiveTagger {
}
}
- static void tagPluginDevelopmentPerspective(MPerspective perspective,
- EModelService modelService) {
+ static void tagPluginDevelopmentPerspective(MPerspective perspective, EModelService modelService) {
MUIElement element = modelService.find("topLeft", perspective); //$NON-NLS-1$
if (element != null) {
element.getTags().add("org.eclipse.e4.primaryNavigationStack"); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveTracker.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveTracker.java
index 3c88a62aee6..e416ee0cea9 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveTracker.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveTracker.java
@@ -27,103 +27,102 @@ import org.eclipse.ui.PerspectiveAdapter;
*
* @since 3.1
*/
-public class PerspectiveTracker extends PerspectiveAdapter implements
- IPageListener {
+public class PerspectiveTracker extends PerspectiveAdapter implements IPageListener {
- private IWorkbenchWindow window;
+ private IWorkbenchWindow window;
- private IAction action;
+ private IAction action;
- /**
- * Creates a perspective tracker for the given window.
- * Subclasses should override <code>update(IPerspectiveDescriptor)</code>
- * to get notified of perspective changes.
- *
- * @param window the window to track
- */
- protected PerspectiveTracker(IWorkbenchWindow window) {
- Assert.isNotNull(window);
- this.window = window;
- window.addPageListener(this);
- window.addPerspectiveListener(this);
- }
+ /**
+ * Creates a perspective tracker for the given window. Subclasses should
+ * override <code>update(IPerspectiveDescriptor)</code> to get notified of
+ * perspective changes.
+ *
+ * @param window the window to track
+ */
+ protected PerspectiveTracker(IWorkbenchWindow window) {
+ Assert.isNotNull(window);
+ this.window = window;
+ window.addPageListener(this);
+ window.addPerspectiveListener(this);
+ }
- /**
- * Creates a perspective tracker for the given window which will
- * enable the given action only when there is an active perspective.
- *
- * @param window the window to track
- * @param action the action to enable or disable
- */
- public PerspectiveTracker(IWorkbenchWindow window, IAction action) {
- this(window);
- this.action = action;
- update();
- }
+ /**
+ * Creates a perspective tracker for the given window which will enable the
+ * given action only when there is an active perspective.
+ *
+ * @param window the window to track
+ * @param action the action to enable or disable
+ */
+ public PerspectiveTracker(IWorkbenchWindow window, IAction action) {
+ this(window);
+ this.action = action;
+ update();
+ }
- /**
- * Disposes the tracker.
- */
- public void dispose() {
- if (window != null) {
- window.removePageListener(this);
- window.removePerspectiveListener(this);
+ /**
+ * Disposes the tracker.
+ */
+ public void dispose() {
+ if (window != null) {
+ window.removePageListener(this);
+ window.removePerspectiveListener(this);
window = null;
- }
- }
+ }
+ }
- @Override
+ @Override
public void pageActivated(IWorkbenchPage page) {
- update();
- }
+ update();
+ }
- @Override
+ @Override
public void pageClosed(IWorkbenchPage page) {
- update();
- }
+ update();
+ }
- @Override
+ @Override
public void pageOpened(IWorkbenchPage page) {
- // ignore
- }
+ // ignore
+ }
- @Override
- public void perspectiveActivated(IWorkbenchPage page,
- IPerspectiveDescriptor perspective) {
- update();
- }
+ @Override
+ public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
+ update();
+ }
- /**
- * Determines the active perspective in the window
- * and calls <code>update(IPerspectiveDescriptor)</code>.
- */
- private void update() {
- if (window != null) {
- IPerspectiveDescriptor persp = null;
- IWorkbenchPage page = window.getActivePage();
- if (page != null) {
- persp = page.getPerspective();
- }
- update(persp);
- }
- }
+ /**
+ * Determines the active perspective in the window and calls
+ * <code>update(IPerspectiveDescriptor)</code>.
+ */
+ private void update() {
+ if (window != null) {
+ IPerspectiveDescriptor persp = null;
+ IWorkbenchPage page = window.getActivePage();
+ if (page != null) {
+ persp = page.getPerspective();
+ }
+ update(persp);
+ }
+ }
- /**
- * Performs some function based on the active perspective in the window.
- * <p>
- * The default implementation enables the action (if given) if there
- * is an active perspective, otherwise it disables it.
- * </p>
- * <p>
- * Subclasses may override or extend.
- * </p>
- *
- * @param persp the active perspective in the window, or <code>null</code> if none
- */
- protected void update(IPerspectiveDescriptor persp) {
- if (action != null) {
- action.setEnabled(persp != null);
- }
- }
+ /**
+ * Performs some function based on the active perspective in the window.
+ * <p>
+ * The default implementation enables the action (if given) if there is an
+ * active perspective, otherwise it disables it.
+ * </p>
+ * <p>
+ * Subclasses may override or extend.
+ * </p>
+ *
+ * @param persp the active perspective in the window, or <code>null</code> if
+ * none
+ */
+ protected void update(IPerspectiveDescriptor persp) {
+ if (action != null) {
+ action.setEnabled(persp != null);
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PlaceholderContributionItem.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PlaceholderContributionItem.java
index a16b844a806..588cfb5806c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PlaceholderContributionItem.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PlaceholderContributionItem.java
@@ -32,189 +32,185 @@ import org.eclipse.swt.widgets.ToolBar;
*/
final class PlaceholderContributionItem implements IContributionItem {
- /**
- * The identifier for the replaced contribution item.
- */
- private final String id;
-
- /**
- * The height of the SWT widget corresponding to the replaced contribution
- * item.
- */
- private final int storedHeight;
-
- /**
- * The minimum number of items to display on the replaced contribution
- * item.
- */
- private final int storedMinimumItems;
-
- /**
- * Whether the replaced contribution item would display chevrons.
- */
- private final boolean storedUseChevron;
-
- /**
- * The width of the SWT widget corresponding to the replaced contribution
- * item.
- */
- private final int storedWidth;
-
- /**
- * Constructs a new instance of <code>PlaceholderContributionItem</code>
- * from the item it is intended to replace.
- *
- * @param item
- * The item to be replaced; must not be <code>null</code>.
- */
- PlaceholderContributionItem(final IToolBarContributionItem item) {
- item.saveWidgetState();
- id = item.getId();
- storedHeight = item.getCurrentHeight();
- storedWidth = item.getCurrentWidth();
- storedMinimumItems = item.getMinimumItemsToShow();
- storedUseChevron = item.getUseChevron();
- }
-
- @Override
+ /**
+ * The identifier for the replaced contribution item.
+ */
+ private final String id;
+
+ /**
+ * The height of the SWT widget corresponding to the replaced contribution item.
+ */
+ private final int storedHeight;
+
+ /**
+ * The minimum number of items to display on the replaced contribution item.
+ */
+ private final int storedMinimumItems;
+
+ /**
+ * Whether the replaced contribution item would display chevrons.
+ */
+ private final boolean storedUseChevron;
+
+ /**
+ * The width of the SWT widget corresponding to the replaced contribution item.
+ */
+ private final int storedWidth;
+
+ /**
+ * Constructs a new instance of <code>PlaceholderContributionItem</code> from
+ * the item it is intended to replace.
+ *
+ * @param item The item to be replaced; must not be <code>null</code>.
+ */
+ PlaceholderContributionItem(final IToolBarContributionItem item) {
+ item.saveWidgetState();
+ id = item.getId();
+ storedHeight = item.getCurrentHeight();
+ storedWidth = item.getCurrentWidth();
+ storedMinimumItems = item.getMinimumItemsToShow();
+ storedUseChevron = item.getUseChevron();
+ }
+
+ @Override
public void dispose() {
- // Do nothing
- }
+ // Do nothing
+ }
- @Override
+ @Override
public void fill(Composite parent) {
- throw new UnsupportedOperationException();
- }
+ throw new UnsupportedOperationException();
+ }
- @Override
+ @Override
public void fill(CoolBar parent, int index) {
- throw new UnsupportedOperationException();
+ throw new UnsupportedOperationException();
- }
+ }
- @Override
+ @Override
public void fill(Menu parent, int index) {
- throw new UnsupportedOperationException();
+ throw new UnsupportedOperationException();
- }
+ }
- @Override
+ @Override
public void fill(ToolBar parent, int index) {
- throw new UnsupportedOperationException();
+ throw new UnsupportedOperationException();
- }
+ }
- /**
- * The height of the replaced contribution item.
- *
- * @return The height.
- */
- int getHeight() {
- return storedHeight;
- }
+ /**
+ * The height of the replaced contribution item.
+ *
+ * @return The height.
+ */
+ int getHeight() {
+ return storedHeight;
+ }
- @Override
+ @Override
public String getId() {
- return id;
- }
-
- /**
- * The width of the replaced contribution item.
- *
- * @return The width.
- */
- int getWidth() {
- return storedWidth;
- }
-
- /**
- * Returns the minimum number of tool items to show in the cool item.
- *
- * @return the minimum number of tool items to show, or <code>SHOW_ALL_ITEMS</code>
- * if a value was not set
- * @see #setMinimumItemsToShow(int)
+ return id;
+ }
+
+ /**
+ * The width of the replaced contribution item.
+ *
+ * @return The width.
+ */
+ int getWidth() {
+ return storedWidth;
+ }
+
+ /**
+ * Returns the minimum number of tool items to show in the cool item.
+ *
+ * @return the minimum number of tool items to show, or
+ * <code>SHOW_ALL_ITEMS</code> if a value was not set
+ * @see #setMinimumItemsToShow(int)
* @since 3.2
- */
- int getMinimumItemsToShow() {
- return storedMinimumItems;
- }
-
- /**
- * Returns whether chevron support is enabled.
- *
- * @return <code>true</code> if chevron support is enabled, <code>false</code>
- * otherwise
+ */
+ int getMinimumItemsToShow() {
+ return storedMinimumItems;
+ }
+
+ /**
+ * Returns whether chevron support is enabled.
+ *
+ * @return <code>true</code> if chevron support is enabled, <code>false</code>
+ * otherwise
* @since 3.2
- */
- boolean getUseChevron() {
- return storedUseChevron;
- }
+ */
+ boolean getUseChevron() {
+ return storedUseChevron;
+ }
- @Override
+ @Override
public boolean isDirty() {
- return false;
- }
+ return false;
+ }
- @Override
+ @Override
public boolean isDynamic() {
- return false;
- }
+ return false;
+ }
- @Override
+ @Override
public boolean isEnabled() {
- // XXX Auto-generated method stub
- return false;
- }
+ // XXX Auto-generated method stub
+ return false;
+ }
- @Override
+ @Override
public boolean isGroupMarker() {
- return false;
- }
+ return false;
+ }
- @Override
+ @Override
public boolean isSeparator() {
- return false;
- }
+ return false;
+ }
- @Override
+ @Override
public boolean isVisible() {
- return false;
- }
+ return false;
+ }
- @Override
+ @Override
public void saveWidgetState() {
- // Do nothing.
+ // Do nothing.
- }
+ }
- @Override
+ @Override
public void setParent(IContributionManager parent) {
- // Do nothing
+ // Do nothing
- }
+ }
- @Override
+ @Override
public void setVisible(boolean visible) {
- // Do nothing.
- }
-
- /**
- * Displays a string representation of this contribution item, which is
- * really just a function of its identifier.
- */
- @Override
+ // Do nothing.
+ }
+
+ /**
+ * Displays a string representation of this contribution item, which is really
+ * just a function of its identifier.
+ */
+ @Override
public String toString() {
- return "PlaceholderContributionItem(" + id + ")"; //$NON-NLS-1$//$NON-NLS-2$
- }
+ return "PlaceholderContributionItem(" + id + ")"; //$NON-NLS-1$//$NON-NLS-2$
+ }
- @Override
+ @Override
public void update() {
- update(null);
+ update(null);
- }
+ }
- @Override
+ @Override
public void update(String identifier) {
- // Do nothing
- }
+ // Do nothing
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PlatformUIPreferenceListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PlatformUIPreferenceListener.java
index a5e56184cae..90380ecf339 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PlatformUIPreferenceListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PlatformUIPreferenceListener.java
@@ -41,16 +41,15 @@ import org.eclipse.ui.internal.util.PrefUtil;
* preference store and propogates the change for any special cases that require
* updating of other values within the workbench.
*/
-public class PlatformUIPreferenceListener implements
- IEclipsePreferences.IPreferenceChangeListener {
+public class PlatformUIPreferenceListener implements IEclipsePreferences.IPreferenceChangeListener {
private static PlatformUIPreferenceListener singleton;
- public static IEclipsePreferences.IPreferenceChangeListener getSingleton(){
- if(singleton == null) {
+ public static IEclipsePreferences.IPreferenceChangeListener getSingleton() {
+ if (singleton == null) {
singleton = new PlatformUIPreferenceListener();
}
- return singleton;
+ return singleton;
}
@Override
@@ -58,8 +57,7 @@ public class PlatformUIPreferenceListener implements
String propertyName = event.getKey();
if (IPreferenceConstants.ENABLED_DECORATORS.equals(propertyName)) {
- DecoratorManager manager = WorkbenchPlugin.getDefault()
- .getDecoratorManager();
+ DecoratorManager manager = WorkbenchPlugin.getDefault().getDecoratorManager();
manager.applyDecoratorsPreference();
manager.clearCaches();
manager.updateForEnablementChange();
@@ -67,8 +65,8 @@ public class PlatformUIPreferenceListener implements
}
if (IWorkbenchPreferenceConstants.SHOW_SYSTEM_JOBS.equals(propertyName)) {
- boolean setting = PrefUtil.getAPIPreferenceStore().getBoolean(
- IWorkbenchPreferenceConstants.SHOW_SYSTEM_JOBS);
+ boolean setting = PrefUtil.getAPIPreferenceStore()
+ .getBoolean(IWorkbenchPreferenceConstants.SHOW_SYSTEM_JOBS);
ProgressManager.getInstance().setShowSystemJobs(setting);
}
@@ -77,13 +75,11 @@ public class PlatformUIPreferenceListener implements
IWorkbench workbench = PlatformUI.getWorkbench();
workbench.getPerspectiveRegistry().setDefaultPerspective(
- PrefUtil.getAPIPreferenceStore().getString(
- IWorkbenchPreferenceConstants.DEFAULT_PERSPECTIVE_ID));
+ PrefUtil.getAPIPreferenceStore().getString(IWorkbenchPreferenceConstants.DEFAULT_PERSPECTIVE_ID));
return;
}
- if (IWorkbenchPreferenceConstants.DOCK_PERSPECTIVE_BAR
- .equals(propertyName)) {
+ if (IWorkbenchPreferenceConstants.DOCK_PERSPECTIVE_BAR.equals(propertyName)) {
// IPreferenceStore apiStore = PrefUtil.getAPIPreferenceStore();
IWorkbench workbench = PlatformUI.getWorkbench();
for (IWorkbenchWindow window : workbench.getWorkbenchWindows()) {
@@ -97,8 +93,7 @@ public class PlatformUIPreferenceListener implements
}
// TODO the banner apperance should have its own preference
- if (IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS
- .equals(propertyName)) {
+ if (IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS.equals(propertyName)) {
// boolean newValue = PrefUtil.getAPIPreferenceStore().getBoolean(
// IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS);
@@ -113,23 +108,19 @@ public class PlatformUIPreferenceListener implements
// Update the file associations if they have changed due to an import
if (IPreferenceConstants.RESOURCES.equals(propertyName)) {
- IEditorRegistry registry = WorkbenchPlugin.getDefault()
- .getEditorRegistry();
+ IEditorRegistry registry = WorkbenchPlugin.getDefault().getEditorRegistry();
if (registry instanceof EditorRegistry) {
EditorRegistry editorRegistry = (EditorRegistry) registry;
- IPreferenceStore store = WorkbenchPlugin.getDefault()
- .getPreferenceStore();
+ IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
Reader reader = null;
try {
- String xmlString = store
- .getString(IPreferenceConstants.RESOURCES);
+ String xmlString = store.getString(IPreferenceConstants.RESOURCES);
if (xmlString != null && xmlString.length() > 0) {
reader = new StringReader(xmlString);
// Build the editor map.
HashMap<String, IEditorDescriptor> editorMap = new HashMap<>();
int i = 0;
- IEditorDescriptor[] descriptors = editorRegistry
- .getSortedEditorsFromPlugins();
+ IEditorDescriptor[] descriptors = editorRegistry.getSortedEditorsFromPlugins();
// Get the internal editors
for (i = 0; i < descriptors.length; i++) {
IEditorDescriptor descriptor = descriptors[i];
@@ -181,8 +172,7 @@ public class PlatformUIPreferenceListener implements
boolean openOnSingleClick = store.getBoolean(IPreferenceConstants.OPEN_ON_SINGLE_CLICK);
boolean selectOnHover = store.getBoolean(IPreferenceConstants.SELECT_ON_HOVER);
boolean openAfterDelay = store.getBoolean(IPreferenceConstants.OPEN_AFTER_DELAY);
- int singleClickMethod = openOnSingleClick ? OpenStrategy.SINGLE_CLICK
- : OpenStrategy.DOUBLE_CLICK;
+ int singleClickMethod = openOnSingleClick ? OpenStrategy.SINGLE_CLICK : OpenStrategy.DOUBLE_CLICK;
if (openOnSingleClick) {
if (selectOnHover) {
singleClickMethod |= OpenStrategy.SELECT_ON_HOVER;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginAction.java
index fba12460c87..6557bb2993f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginAction.java
@@ -42,338 +42,318 @@ import org.eclipse.ui.internal.util.Util;
/**
* A PluginAction is a proxy for an action extension.
*
- * At startup we read the registry and create a PluginAction for each action extension.
- * This plugin action looks like the real action ( label, icon, etc ) and acts as
- * a proxy for the action until invoked. At that point the proxy will instantiate
- * the real action and delegate the run method to the real action.
- * This makes it possible to load the action extension lazily.
+ * At startup we read the registry and create a PluginAction for each action
+ * extension. This plugin action looks like the real action ( label, icon, etc )
+ * and acts as a proxy for the action until invoked. At that point the proxy
+ * will instantiate the real action and delegate the run method to the real
+ * action. This makes it possible to load the action extension lazily.
*
- * Occasionally the class will ask if it is OK to
- * load the delegate (on selection changes). If the plugin containing
- * the action extension has been loaded then the action extension itself
- * will be instantiated.
+ * Occasionally the class will ask if it is OK to load the delegate (on
+ * selection changes). If the plugin containing the action extension has been
+ * loaded then the action extension itself will be instantiated.
*/
-public abstract class PluginAction extends Action implements
- ISelectionListener, ISelectionChangedListener, INullSelectionListener,
- IPluginContribution {
- private IActionDelegate delegate;
+public abstract class PluginAction extends Action
+ implements ISelectionListener, ISelectionChangedListener, INullSelectionListener, IPluginContribution {
+ private IActionDelegate delegate;
- private SelectionEnabler enabler;
+ private SelectionEnabler enabler;
- private ISelection selection;
+ private ISelection selection;
- private IConfigurationElement configElement;
+ private IConfigurationElement configElement;
- private String pluginId;
+ private String pluginId;
- private String runAttribute = IWorkbenchRegistryConstants.ATT_CLASS;
+ private String runAttribute = IWorkbenchRegistryConstants.ATT_CLASS;
- private static int actionCount = 0;
+ private static int actionCount = 0;
- /**
- * PluginAction constructor.
- *
- * @param actionElement the element
- * @param id the identifier
- * @param style the style bits
- */
- public PluginAction(IConfigurationElement actionElement, String id,
- int style) {
- super(null, style);
+ /**
+ * PluginAction constructor.
+ *
+ * @param actionElement the element
+ * @param id the identifier
+ * @param style the style bits
+ */
+ public PluginAction(IConfigurationElement actionElement, String id, int style) {
+ super(null, style);
- this.configElement = actionElement;
+ this.configElement = actionElement;
- if (id != null) {
- setId(id);
- } else {
- // Create unique action id.
- setId("PluginAction." + Integer.toString(actionCount)); //$NON-NLS-1$
- ++actionCount;
- }
+ if (id != null) {
+ setId(id);
+ } else {
+ // Create unique action id.
+ setId("PluginAction." + Integer.toString(actionCount)); //$NON-NLS-1$
+ ++actionCount;
+ }
- String defId = actionElement
- .getAttribute(IWorkbenchRegistryConstants.ATT_DEFINITION_ID);
- setActionDefinitionId(defId);
+ String defId = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_DEFINITION_ID);
+ setActionDefinitionId(defId);
pluginId = configElement.getContributor().getName();
- // Read enablement declaration.
- if (configElement.getAttribute(IWorkbenchRegistryConstants.ATT_ENABLES_FOR) != null) {
- enabler = new SelectionEnabler(configElement);
- } else {
- IConfigurationElement[] kids = configElement
- .getChildren(IWorkbenchRegistryConstants.TAG_ENABLEMENT);
- IConfigurationElement[] kids2 = configElement
- .getChildren(IWorkbenchRegistryConstants.TAG_SELECTION);
- if (kids.length > 0 || kids2.length>0) {
+ // Read enablement declaration.
+ if (configElement.getAttribute(IWorkbenchRegistryConstants.ATT_ENABLES_FOR) != null) {
+ enabler = new SelectionEnabler(configElement);
+ } else {
+ IConfigurationElement[] kids = configElement.getChildren(IWorkbenchRegistryConstants.TAG_ENABLEMENT);
+ IConfigurationElement[] kids2 = configElement.getChildren(IWorkbenchRegistryConstants.TAG_SELECTION);
+ if (kids.length > 0 || kids2.length > 0) {
enabler = new SelectionEnabler(configElement);
}
}
- // Give enabler or delegate a chance to adjust enable state
- selectionChanged(StructuredSelection.EMPTY);
- }
-
- /**
- * Creates the delegate and refreshes its enablement.
- */
- protected final void createDelegate() {
- // The runAttribute is null if delegate creation failed previously...
- if (delegate == null && runAttribute != null) {
- try {
- Object obj = WorkbenchPlugin.createExtension(configElement,
- runAttribute);
- delegate = validateDelegate(obj);
- initDelegate();
- refreshEnablement();
- } catch (Throwable e) {
- runAttribute = null;
- IStatus status = null;
- if (e instanceof CoreException) {
- status = ((CoreException) e).getStatus();
- } else {
- status = StatusUtil
- .newStatus(
- IStatus.ERROR,
- "Internal plug-in action delegate error on creation.", e); //$NON-NLS-1$
- }
- String id = configElement.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
- WorkbenchPlugin
- .log(
- "Could not create action delegate for id: " + id, status); //$NON-NLS-1$
- return;
- }
- }
- }
-
- /**
- * Validates the object is a delegate of the expected type. Subclasses can
- * override to check for specific delegate types.
- * <p>
- * <b>Note:</b> Calls to the object are not allowed during this method.
- * </p>
- *
- * @param obj a possible action delegate implementation
- * @return the <code>IActionDelegate</code> implementation for the object
- * @throws WorkbenchException if not of the expected delegate type
- */
- protected IActionDelegate validateDelegate(Object obj)
- throws WorkbenchException {
- if (obj instanceof IActionDelegate) {
+ // Give enabler or delegate a chance to adjust enable state
+ selectionChanged(StructuredSelection.EMPTY);
+ }
+
+ /**
+ * Creates the delegate and refreshes its enablement.
+ */
+ protected final void createDelegate() {
+ // The runAttribute is null if delegate creation failed previously...
+ if (delegate == null && runAttribute != null) {
+ try {
+ Object obj = WorkbenchPlugin.createExtension(configElement, runAttribute);
+ delegate = validateDelegate(obj);
+ initDelegate();
+ refreshEnablement();
+ } catch (Throwable e) {
+ runAttribute = null;
+ IStatus status = null;
+ if (e instanceof CoreException) {
+ status = ((CoreException) e).getStatus();
+ } else {
+ status = StatusUtil.newStatus(IStatus.ERROR, "Internal plug-in action delegate error on creation.", //$NON-NLS-1$
+ e);
+ }
+ String id = configElement.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
+ WorkbenchPlugin.log("Could not create action delegate for id: " + id, status); //$NON-NLS-1$
+ return;
+ }
+ }
+ }
+
+ /**
+ * Validates the object is a delegate of the expected type. Subclasses can
+ * override to check for specific delegate types.
+ * <p>
+ * <b>Note:</b> Calls to the object are not allowed during this method.
+ * </p>
+ *
+ * @param obj a possible action delegate implementation
+ * @return the <code>IActionDelegate</code> implementation for the object
+ * @throws WorkbenchException if not of the expected delegate type
+ */
+ protected IActionDelegate validateDelegate(Object obj) throws WorkbenchException {
+ if (obj instanceof IActionDelegate) {
return (IActionDelegate) obj;
}
- throw new WorkbenchException(
- "Action must implement IActionDelegate"); //$NON-NLS-1$
- }
+ throw new WorkbenchException("Action must implement IActionDelegate"); //$NON-NLS-1$
+ }
- /**
- * Initialize the action delegate by calling its lifecycle method.
- * Subclasses may override but must call this implementation first.
- */
- protected void initDelegate() {
- if (delegate instanceof IActionDelegate2) {
+ /**
+ * Initialize the action delegate by calling its lifecycle method. Subclasses
+ * may override but must call this implementation first.
+ */
+ protected void initDelegate() {
+ if (delegate instanceof IActionDelegate2) {
((IActionDelegate2) delegate).init(this);
}
- }
-
- /**
- * Returns the action delegate if created. Can be <code>null</code>
- * if the delegate is not created yet or if previous delegate
- * creation failed.
- */
- protected IActionDelegate getDelegate() {
- return delegate;
- }
-
- /**
- * Returns true if the declaring plugin has been loaded
- * and there is no need to delay creating the delegate
- * any more.
- */
- protected boolean isOkToCreateDelegate() {
- // test if the plugin has loaded
- String bundleId = configElement.getContributor().getName();
- return BundleUtility.isActive(bundleId);
- }
-
- /**
- * Refresh the action enablement.
- */
- protected void refreshEnablement() {
- if (enabler != null) {
- setEnabled(enabler.isEnabledForSelection(selection));
- }
- if (delegate != null) {
- delegate.selectionChanged(this, selection);
- }
- }
-
- @Override
+ }
+
+ /**
+ * Returns the action delegate if created. Can be <code>null</code> if the
+ * delegate is not created yet or if previous delegate creation failed.
+ */
+ protected IActionDelegate getDelegate() {
+ return delegate;
+ }
+
+ /**
+ * Returns true if the declaring plugin has been loaded and there is no need to
+ * delay creating the delegate any more.
+ */
+ protected boolean isOkToCreateDelegate() {
+ // test if the plugin has loaded
+ String bundleId = configElement.getContributor().getName();
+ return BundleUtility.isActive(bundleId);
+ }
+
+ /**
+ * Refresh the action enablement.
+ */
+ protected void refreshEnablement() {
+ if (enabler != null) {
+ setEnabled(enabler.isEnabledForSelection(selection));
+ }
+ if (delegate != null) {
+ delegate.selectionChanged(this, selection);
+ }
+ }
+
+ @Override
public void run() {
- runWithEvent(null);
- }
+ runWithEvent(null);
+ }
- @Override
+ @Override
public void runWithEvent(Event event) {
- // this message dialog is problematic.
- if (delegate == null) {
- createDelegate();
- if (delegate == null) {
- MessageDialog
- .openInformation(
- Util.getShellToParentOn(),
- WorkbenchMessages.Information,
- WorkbenchMessages.PluginAction_operationNotAvailableMessage);
- return;
- }
- if (!isEnabled()) {
- MessageDialog.openInformation(Util.getShellToParentOn(), WorkbenchMessages.Information,
- WorkbenchMessages.PluginAction_disabledMessage);
- return;
- }
- }
-
- if (event != null) {
- if (delegate instanceof IActionDelegate2) {
- ((IActionDelegate2) delegate).runWithEvent(this, event);
- return;
- }
- // Keep for backward compatibility with R2.0
- if (delegate instanceof IActionDelegateWithEvent) {
- ((IActionDelegateWithEvent) delegate).runWithEvent(this, event);
- return;
- }
- }
-
- delegate.run(this);
- }
-
- /**
- * Handles selection change. If rule-based enabled is
- * defined, it will be first to call it. If the delegate
- * is loaded, it will also be given a chance.
- *
- * @param newSelection the new selection
- */
- public void selectionChanged(ISelection newSelection) {
- // Update selection.
- selection = newSelection;
- if (selection == null) {
+ // this message dialog is problematic.
+ if (delegate == null) {
+ createDelegate();
+ if (delegate == null) {
+ MessageDialog.openInformation(Util.getShellToParentOn(), WorkbenchMessages.Information,
+ WorkbenchMessages.PluginAction_operationNotAvailableMessage);
+ return;
+ }
+ if (!isEnabled()) {
+ MessageDialog.openInformation(Util.getShellToParentOn(), WorkbenchMessages.Information,
+ WorkbenchMessages.PluginAction_disabledMessage);
+ return;
+ }
+ }
+
+ if (event != null) {
+ if (delegate instanceof IActionDelegate2) {
+ ((IActionDelegate2) delegate).runWithEvent(this, event);
+ return;
+ }
+ // Keep for backward compatibility with R2.0
+ if (delegate instanceof IActionDelegateWithEvent) {
+ ((IActionDelegateWithEvent) delegate).runWithEvent(this, event);
+ return;
+ }
+ }
+
+ delegate.run(this);
+ }
+
+ /**
+ * Handles selection change. If rule-based enabled is defined, it will be first
+ * to call it. If the delegate is loaded, it will also be given a chance.
+ *
+ * @param newSelection the new selection
+ */
+ public void selectionChanged(ISelection newSelection) {
+ // Update selection.
+ selection = newSelection;
+ if (selection == null) {
selection = StructuredSelection.EMPTY;
}
- // The selection is passed to the delegate as-is without
- // modification. If the selection needs to be modified
- // the action contributors should do so.
+ // The selection is passed to the delegate as-is without
+ // modification. If the selection needs to be modified
+ // the action contributors should do so.
- // If the delegate can be loaded, do so.
- // Otherwise, just update the enablement.
- if (delegate == null && isOkToCreateDelegate()) {
+ // If the delegate can be loaded, do so.
+ // Otherwise, just update the enablement.
+ if (delegate == null && isOkToCreateDelegate()) {
createDelegate();
} else {
refreshEnablement();
}
- }
-
- /**
- * The <code>SelectionChangedEventAction</code> implementation of this
- * <code>ISelectionChangedListener</code> method calls
- * <code>selectionChanged(IStructuredSelection)</code> when the selection is
- * a structured one.
- */
- @Override
+ }
+
+ /**
+ * The <code>SelectionChangedEventAction</code> implementation of this
+ * <code>ISelectionChangedListener</code> method calls
+ * <code>selectionChanged(IStructuredSelection)</code> when the selection is a
+ * structured one.
+ */
+ @Override
public void selectionChanged(SelectionChangedEvent event) {
- ISelection sel = event.getSelection();
- selectionChanged(sel);
- }
-
- /**
- * The <code>SelectionChangedEventAction</code> implementation of this
- * <code>ISelectionListener</code> method calls
- * <code>selectionChanged(IStructuredSelection)</code> when the selection is
- * a structured one. Subclasses may extend this method to react to the change.
- */
- @Override
+ ISelection sel = event.getSelection();
+ selectionChanged(sel);
+ }
+
+ /**
+ * The <code>SelectionChangedEventAction</code> implementation of this
+ * <code>ISelectionListener</code> method calls
+ * <code>selectionChanged(IStructuredSelection)</code> when the selection is a
+ * structured one. Subclasses may extend this method to react to the change.
+ */
+ @Override
public void selectionChanged(IWorkbenchPart part, ISelection sel) {
- selectionChanged(sel);
- }
-
- /**
- * For testing purposes only.
- *
- * @return the selection
- * @since 3.1
- */
- public ISelection getSelection() {
- return selection;
- }
-
- /**
- * Returns the action identifier this action overrides.
- * Default implementation returns <code>null</code>.
- *
- * @return the action identifier to override or <code>null</code>
- */
- public String getOverrideActionId() {
- return null;
- }
-
- /**
- * @return the IConfigurationElement used to create this PluginAction.
- *
- * @since 3.0
- */
- protected IConfigurationElement getConfigElement() {
- return configElement;
- }
-
- @Override
+ selectionChanged(sel);
+ }
+
+ /**
+ * For testing purposes only.
+ *
+ * @return the selection
+ * @since 3.1
+ */
+ public ISelection getSelection() {
+ return selection;
+ }
+
+ /**
+ * Returns the action identifier this action overrides. Default implementation
+ * returns <code>null</code>.
+ *
+ * @return the action identifier to override or <code>null</code>
+ */
+ public String getOverrideActionId() {
+ return null;
+ }
+
+ /**
+ * @return the IConfigurationElement used to create this PluginAction.
+ *
+ * @since 3.0
+ */
+ protected IConfigurationElement getConfigElement() {
+ return configElement;
+ }
+
+ @Override
public String getLocalId() {
- return getId();
- }
+ return getId();
+ }
- @Override
+ @Override
public String getPluginId() {
- return pluginId;
- }
-
- /**
- * Disposes the delegate, if created.
- *
- * @since 3.1
- */
- public void disposeDelegate() {
- // avoid calling dispose() twice if the delegate implements
- // both IActionDelegate2 and IWorkbenchWindowActionDelegate
- if (getDelegate() instanceof IActionDelegate2) {
- ((IActionDelegate2) getDelegate()).dispose();
- }
- else if (getDelegate() instanceof IWorkbenchWindowActionDelegate) {
- ((IWorkbenchWindowActionDelegate) getDelegate()).dispose();
- }
- delegate = null;
- }
-
- /**
- * Disposes this plugin action.
- *
- * @since 3.1
- */
- public void dispose() {
- disposeDelegate();
- selection = null;
- }
-
- @Override
+ return pluginId;
+ }
+
+ /**
+ * Disposes the delegate, if created.
+ *
+ * @since 3.1
+ */
+ public void disposeDelegate() {
+ // avoid calling dispose() twice if the delegate implements
+ // both IActionDelegate2 and IWorkbenchWindowActionDelegate
+ if (getDelegate() instanceof IActionDelegate2) {
+ ((IActionDelegate2) getDelegate()).dispose();
+ } else if (getDelegate() instanceof IWorkbenchWindowActionDelegate) {
+ ((IWorkbenchWindowActionDelegate) getDelegate()).dispose();
+ }
+ delegate = null;
+ }
+
+ /**
+ * Disposes this plugin action.
+ *
+ * @since 3.1
+ */
+ public void dispose() {
+ disposeDelegate();
+ selection = null;
+ }
+
+ @Override
public IMenuCreator getMenuCreator() {
- // now that action contribution item defers asking for the menu
- // creator until its ready o show the menu, asking for the menu
- // creator is time to instantiate the delegate
- if (getDelegate()==null) {
- createDelegate();
- }
- return super.getMenuCreator();
- }
+ // now that action contribution item defers asking for the menu
+ // creator until its ready o show the menu, asking for the menu
+ // creator is time to instantiate the delegate
+ if (getDelegate() == null) {
+ createDelegate();
+ }
+ return super.getMenuCreator();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionBuilder.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionBuilder.java
index ee22787ca49..42554d509e6 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionBuilder.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionBuilder.java
@@ -37,468 +37,446 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
* from plugins into workbench parts (both editors and views).
*/
public abstract class PluginActionBuilder extends RegistryReader {
- protected String targetID;
+ protected String targetID;
- protected String targetContributionTag;
+ protected String targetContributionTag;
- protected BasicContribution currentContribution;
+ protected BasicContribution currentContribution;
protected ArrayList cache;
- /**
- * The default constructor.
- */
- public PluginActionBuilder() {
- }
-
- /**
- * Contributes submenus and/or actions into the provided menu and tool bar
- * managers.
- *
- * @param menu the menu to contribute to
- * @param toolbar the toolbar to contribute to
- * @param appendIfMissing append containers if missing
- */
- public final void contribute(IMenuManager menu, IToolBarManager toolbar,
- boolean appendIfMissing) {
- if (cache == null) {
+ /**
+ * The default constructor.
+ */
+ public PluginActionBuilder() {
+ }
+
+ /**
+ * Contributes submenus and/or actions into the provided menu and tool bar
+ * managers.
+ *
+ * @param menu the menu to contribute to
+ * @param toolbar the toolbar to contribute to
+ * @param appendIfMissing append containers if missing
+ */
+ public final void contribute(IMenuManager menu, IToolBarManager toolbar, boolean appendIfMissing) {
+ if (cache == null) {
return;
}
- for (int i = 0; i < cache.size(); i++) {
+ for (int i = 0; i < cache.size(); i++) {
BasicContribution contribution = (BasicContribution) cache.get(i);
- contribution.contribute(menu, appendIfMissing, toolbar,
- appendIfMissing);
- }
- }
-
- /**
- * This factory method returns a new ActionDescriptor for the
- * configuration element. It should be implemented by subclasses.
- */
- protected abstract ActionDescriptor createActionDescriptor(
- IConfigurationElement element);
-
- /**
- * Factory method to create the helper contribution class that will hold
- * onto the menus and actions contributed.
- */
- protected BasicContribution createContribution() {
- return new BasicContribution();
- }
-
- /**
- * Returns the name of the part ID attribute that is expected
- * in the target extension.
- */
- protected String getTargetID(IConfigurationElement element) {
- String value = element.getAttribute(IWorkbenchRegistryConstants.ATT_TARGET_ID);
- return value != null ? value : "???"; //$NON-NLS-1$
- }
-
- /**
- * Returns the id of this contributions.
- */
- protected String getID(IConfigurationElement element) {
- String value = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
- return value != null ? value : "???"; //$NON-NLS-1$
- }
-
- /**
- * Reads the contributions from the registry for the provided workbench
- * part and the provided extension point ID.
- */
- protected void readContributions(String id, String tag,
- String extensionPoint) {
- cache = null;
- currentContribution = null;
- targetID = id;
- targetContributionTag = tag;
- readRegistry(Platform.getExtensionRegistry(), PlatformUI.PLUGIN_ID,
- extensionPoint);
- }
-
- /**
- * Implements abstract method to handle the provided XML element
- * in the registry.
- */
- @Override
+ contribution.contribute(menu, appendIfMissing, toolbar, appendIfMissing);
+ }
+ }
+
+ /**
+ * This factory method returns a new ActionDescriptor for the configuration
+ * element. It should be implemented by subclasses.
+ */
+ protected abstract ActionDescriptor createActionDescriptor(IConfigurationElement element);
+
+ /**
+ * Factory method to create the helper contribution class that will hold onto
+ * the menus and actions contributed.
+ */
+ protected BasicContribution createContribution() {
+ return new BasicContribution();
+ }
+
+ /**
+ * Returns the name of the part ID attribute that is expected in the target
+ * extension.
+ */
+ protected String getTargetID(IConfigurationElement element) {
+ String value = element.getAttribute(IWorkbenchRegistryConstants.ATT_TARGET_ID);
+ return value != null ? value : "???"; //$NON-NLS-1$
+ }
+
+ /**
+ * Returns the id of this contributions.
+ */
+ protected String getID(IConfigurationElement element) {
+ String value = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
+ return value != null ? value : "???"; //$NON-NLS-1$
+ }
+
+ /**
+ * Reads the contributions from the registry for the provided workbench part and
+ * the provided extension point ID.
+ */
+ protected void readContributions(String id, String tag, String extensionPoint) {
+ cache = null;
+ currentContribution = null;
+ targetID = id;
+ targetContributionTag = tag;
+ readRegistry(Platform.getExtensionRegistry(), PlatformUI.PLUGIN_ID, extensionPoint);
+ }
+
+ /**
+ * Implements abstract method to handle the provided XML element in the
+ * registry.
+ */
+ @Override
protected boolean readElement(IConfigurationElement element) {
- String tag = element.getName();
-
- // Ignore all object contributions element as these
- // are handled by the ObjectActionContributorReader.
- if (tag.equals(IWorkbenchRegistryConstants.TAG_OBJECT_CONTRIBUTION)) {
- return true;
- }
-
- // Found top level contribution element
- if (tag.equals(targetContributionTag)) {
- if (targetID != null) {
- // Ignore contributions not matching target id
- String id = getTargetID(element);
- if (id == null || !id.equals(targetID)) {
+ String tag = element.getName();
+
+ // Ignore all object contributions element as these
+ // are handled by the ObjectActionContributorReader.
+ if (tag.equals(IWorkbenchRegistryConstants.TAG_OBJECT_CONTRIBUTION)) {
+ return true;
+ }
+
+ // Found top level contribution element
+ if (tag.equals(targetContributionTag)) {
+ if (targetID != null) {
+ // Ignore contributions not matching target id
+ String id = getTargetID(element);
+ if (id == null || !id.equals(targetID)) {
return true;
}
- }
+ }
- // Read its sub-elements
- currentContribution = createContribution();
- readElementChildren(element);
- if (cache == null) {
+ // Read its sub-elements
+ currentContribution = createContribution();
+ readElementChildren(element);
+ if (cache == null) {
cache = new ArrayList(4);
}
- cache.add(currentContribution);
- currentContribution = null;
- return true;
- }
-
- // Found menu contribution sub-element
- if (tag.equals(IWorkbenchRegistryConstants.TAG_MENU)) {
- currentContribution.addMenu(element);
- return true;
- }
-
- // Found action contribution sub-element
- if (tag.equals(IWorkbenchRegistryConstants.TAG_ACTION)) {
- currentContribution.addAction(createActionDescriptor(element));
- return true;
- }
-
- return false;
- }
-
- /**
- * Helper class to collect the menus and actions defined within a
- * contribution element.
- */
- protected static class BasicContribution {
+ cache.add(currentContribution);
+ currentContribution = null;
+ return true;
+ }
+
+ // Found menu contribution sub-element
+ if (tag.equals(IWorkbenchRegistryConstants.TAG_MENU)) {
+ currentContribution.addMenu(element);
+ return true;
+ }
+
+ // Found action contribution sub-element
+ if (tag.equals(IWorkbenchRegistryConstants.TAG_ACTION)) {
+ currentContribution.addAction(createActionDescriptor(element));
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Helper class to collect the menus and actions defined within a contribution
+ * element.
+ */
+ protected static class BasicContribution {
protected ArrayList menus;
protected ArrayList actions;
- /**
- * Add a menu.
- *
- * @param element the element to base the menu on
- */
- public void addMenu(IConfigurationElement element) {
- if (menus == null) {
+ /**
+ * Add a menu.
+ *
+ * @param element the element to base the menu on
+ */
+ public void addMenu(IConfigurationElement element) {
+ if (menus == null) {
menus = new ArrayList(1);
}
- menus.add(element);
- }
-
- /**
- * Add an action.
- *
- * @param desc the descriptor
- */
- public void addAction(ActionDescriptor desc) {
- if (actions == null) {
+ menus.add(element);
+ }
+
+ /**
+ * Add an action.
+ *
+ * @param desc the descriptor
+ */
+ public void addAction(ActionDescriptor desc) {
+ if (actions == null) {
actions = new ArrayList(3);
}
- actions.add(desc);
- }
-
- /**
- * Contributes submenus and/or actions into the provided menu and tool bar
- * managers.
- *
- * The elements added are filtered based on activity enablement.
- * @param menu the menu to contribute to
- * @param menuAppendIfMissing whether to append missing groups to menus
- * @param toolbar the toolbar to contribute to
- * @param toolAppendIfMissing whether to append missing groups to toolbars
- */
- public void contribute(IMenuManager menu, boolean menuAppendIfMissing,
- IToolBarManager toolbar, boolean toolAppendIfMissing) {
- if (menus != null && menu != null) {
- for (int i = 0; i < menus.size(); i++) {
- IConfigurationElement menuElement = (IConfigurationElement) menus
- .get(i);
- contributeMenu(menuElement, menu, menuAppendIfMissing);
- }
- }
-
- if (actions != null) {
- for (int i = 0; i < actions.size(); i++) {
+ actions.add(desc);
+ }
+
+ /**
+ * Contributes submenus and/or actions into the provided menu and tool bar
+ * managers.
+ *
+ * The elements added are filtered based on activity enablement.
+ *
+ * @param menu the menu to contribute to
+ * @param menuAppendIfMissing whether to append missing groups to menus
+ * @param toolbar the toolbar to contribute to
+ * @param toolAppendIfMissing whether to append missing groups to toolbars
+ */
+ public void contribute(IMenuManager menu, boolean menuAppendIfMissing, IToolBarManager toolbar,
+ boolean toolAppendIfMissing) {
+ if (menus != null && menu != null) {
+ for (int i = 0; i < menus.size(); i++) {
+ IConfigurationElement menuElement = (IConfigurationElement) menus.get(i);
+ contributeMenu(menuElement, menu, menuAppendIfMissing);
+ }
+ }
+
+ if (actions != null) {
+ for (int i = 0; i < actions.size(); i++) {
ActionDescriptor ad = (ActionDescriptor) actions.get(i);
- if (menu != null) {
+ if (menu != null) {
contributeMenuAction(ad, menu, menuAppendIfMissing);
}
- if (toolbar != null) {
- contributeToolbarAction(ad, toolbar,
- toolAppendIfMissing);
+ if (toolbar != null) {
+ contributeToolbarAction(ad, toolbar, toolAppendIfMissing);
}
- }
- }
- }
-
- /**
- * Creates a menu from the information in the menu configuration element and
- * adds it into the provided menu manager. If 'appendIfMissing' is true, and
- * menu path slot is not found, it will be created and menu will be added
- * into it. Otherwise, add operation will fail.
- */
- protected void contributeMenu(IConfigurationElement menuElement,
- IMenuManager mng, boolean appendIfMissing) {
- // Get config data.
- String id = menuElement.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
- String label = menuElement.getAttribute(IWorkbenchRegistryConstants.ATT_LABEL);
- String path = menuElement.getAttribute(IWorkbenchRegistryConstants.ATT_PATH);
- String icon = menuElement.getAttribute(IWorkbenchRegistryConstants.ATT_ICON);
- ImageDescriptor image = null;
- if (icon != null) {
- String extendingPluginId = menuElement.getDeclaringExtension()
- .getContributor().getName();
- image = AbstractUIPlugin.imageDescriptorFromPlugin(
- extendingPluginId, icon);
+ }
}
- if (label == null) {
+ }
+
+ /**
+ * Creates a menu from the information in the menu configuration element and
+ * adds it into the provided menu manager. If 'appendIfMissing' is true, and
+ * menu path slot is not found, it will be created and menu will be added into
+ * it. Otherwise, add operation will fail.
+ */
+ protected void contributeMenu(IConfigurationElement menuElement, IMenuManager mng, boolean appendIfMissing) {
+ // Get config data.
+ String id = menuElement.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
+ String label = menuElement.getAttribute(IWorkbenchRegistryConstants.ATT_LABEL);
+ String path = menuElement.getAttribute(IWorkbenchRegistryConstants.ATT_PATH);
+ String icon = menuElement.getAttribute(IWorkbenchRegistryConstants.ATT_ICON);
+ ImageDescriptor image = null;
+ if (icon != null) {
+ String extendingPluginId = menuElement.getDeclaringExtension().getContributor().getName();
+ image = AbstractUIPlugin.imageDescriptorFromPlugin(extendingPluginId, icon);
+ }
+ if (label == null) {
WorkbenchPlugin.log("Plugin \'" //$NON-NLS-1$
- + menuElement.getContributor().getName()
- + "\' invalid Menu Extension (label == null): " + id); //$NON-NLS-1$
+ + menuElement.getContributor().getName() + "\' invalid Menu Extension (label == null): " + id); //$NON-NLS-1$
return;
}
- // Calculate menu path and group.
- String group = null;
- if (path != null) {
- int loc = path.lastIndexOf('/');
- if (loc != -1) {
- group = path.substring(loc + 1);
- path = path.substring(0, loc);
- } else {
- // assume that path represents a slot
- // so actual path portion should be null
- group = path;
- path = null;
- }
- }
-
- // Find parent menu.
- IMenuManager parent = mng;
- if (path != null) {
- parent = mng.findMenuUsingPath(path);
- if (parent == null) {
+ // Calculate menu path and group.
+ String group = null;
+ if (path != null) {
+ int loc = path.lastIndexOf('/');
+ if (loc != -1) {
+ group = path.substring(loc + 1);
+ path = path.substring(0, loc);
+ } else {
+ // assume that path represents a slot
+ // so actual path portion should be null
+ group = path;
+ path = null;
+ }
+ }
+
+ // Find parent menu.
+ IMenuManager parent = mng;
+ if (path != null) {
+ parent = mng.findMenuUsingPath(path);
+ if (parent == null) {
ideLog("Plugin \'" //$NON-NLS-1$
- + menuElement.getContributor().getName()
- + "\' invalid Menu Extension (Path \'" //$NON-NLS-1$
- + path + "\' is invalid): " + id); //$NON-NLS-1$
+ + menuElement.getContributor().getName() + "\' invalid Menu Extension (Path \'" //$NON-NLS-1$
+ + path + "\' is invalid): " + id); //$NON-NLS-1$
return;
}
- }
+ }
- // Find reference group.
- if (group == null) {
+ // Find reference group.
+ if (group == null) {
group = IWorkbenchActionConstants.MB_ADDITIONS;
}
- IContributionItem sep = parent.find(group);
- if (sep == null) {
- if (appendIfMissing) {
+ IContributionItem sep = parent.find(group);
+ if (sep == null) {
+ if (appendIfMissing) {
addGroup(parent, group);
} else {
- WorkbenchPlugin
- .log("Plugin \'" //$NON-NLS-1$
- + menuElement.getContributor().getName()
- + "\' invalid Menu Extension (Group \'" //$NON-NLS-1$
- + group + "\' is invalid): " + id); //$NON-NLS-1$
- return;
- }
- }
-
- // If the menu does not exist create it.
- IMenuManager newMenu = parent.findMenuUsingPath(id);
- if (newMenu == null) {
+ WorkbenchPlugin.log("Plugin \'" //$NON-NLS-1$
+ + menuElement.getContributor().getName() + "\' invalid Menu Extension (Group \'" //$NON-NLS-1$
+ + group + "\' is invalid): " + id); //$NON-NLS-1$
+ return;
+ }
+ }
+
+ // If the menu does not exist create it.
+ IMenuManager newMenu = parent.findMenuUsingPath(id);
+ if (newMenu == null) {
newMenu = new MenuManager(label, image, id);
}
- // Add the menu
+ // Add the menu
try {
- insertAfter(parent, group, newMenu);
- } catch (IllegalArgumentException e) {
- WorkbenchPlugin
- .log("Plugin \'" //$NON-NLS-1$
- + menuElement.getContributor().getName()
- + "\' invalid Menu Extension (Group \'" //$NON-NLS-1$
- + group + "\' is missing): " + id); //$NON-NLS-1$
- }
-
- // Get the menu again as it may be wrapped, otherwise adding
- // the separators and group markers below will not be wrapped
- // properly if the menu was just created.
- newMenu = parent.findMenuUsingPath(id);
- if (newMenu == null) {
+ insertAfter(parent, group, newMenu);
+ } catch (IllegalArgumentException e) {
+ WorkbenchPlugin.log("Plugin \'" //$NON-NLS-1$
+ + menuElement.getContributor().getName() + "\' invalid Menu Extension (Group \'" //$NON-NLS-1$
+ + group + "\' is missing): " + id); //$NON-NLS-1$
+ }
+
+ // Get the menu again as it may be wrapped, otherwise adding
+ // the separators and group markers below will not be wrapped
+ // properly if the menu was just created.
+ newMenu = parent.findMenuUsingPath(id);
+ if (newMenu == null) {
WorkbenchPlugin.log("Could not find new menu: " + id); //$NON-NLS-1$
}
- // Create separators.
- IConfigurationElement[] children = menuElement.getChildren();
- for (IConfigurationElement element : children) {
- String childName = element.getName();
- if (childName.equals(IWorkbenchRegistryConstants.TAG_SEPARATOR)) {
- contributeSeparator(newMenu, element);
- } else if (childName.equals(IWorkbenchRegistryConstants.TAG_GROUP_MARKER)) {
- contributeGroupMarker(newMenu, element);
- }
- }
- }
-
- /**
- * Contributes action from action descriptor into the provided menu manager.
- */
- protected void contributeMenuAction(ActionDescriptor ad,
- IMenuManager menu, boolean appendIfMissing) {
- // Get config data.
- String mpath = ad.getMenuPath();
- String mgroup = ad.getMenuGroup();
- if (mpath == null && mgroup == null) {
+ // Create separators.
+ IConfigurationElement[] children = menuElement.getChildren();
+ for (IConfigurationElement element : children) {
+ String childName = element.getName();
+ if (childName.equals(IWorkbenchRegistryConstants.TAG_SEPARATOR)) {
+ contributeSeparator(newMenu, element);
+ } else if (childName.equals(IWorkbenchRegistryConstants.TAG_GROUP_MARKER)) {
+ contributeGroupMarker(newMenu, element);
+ }
+ }
+ }
+
+ /**
+ * Contributes action from action descriptor into the provided menu manager.
+ */
+ protected void contributeMenuAction(ActionDescriptor ad, IMenuManager menu, boolean appendIfMissing) {
+ // Get config data.
+ String mpath = ad.getMenuPath();
+ String mgroup = ad.getMenuGroup();
+ if (mpath == null && mgroup == null) {
return;
}
- // Find parent menu.
- IMenuManager parent = menu;
- if (mpath != null) {
- parent = parent.findMenuUsingPath(mpath);
- if (parent == null) {
- ideLog("Plug-in '" + ad.getPluginId() + "' contributed an invalid Menu Extension (Path: '" + mpath + "' is invalid): " + ad.getId()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- return;
- }
- }
-
- // Find reference group.
- if (mgroup == null) {
+ // Find parent menu.
+ IMenuManager parent = menu;
+ if (mpath != null) {
+ parent = parent.findMenuUsingPath(mpath);
+ if (parent == null) {
+ ideLog("Plug-in '" + ad.getPluginId() + "' contributed an invalid Menu Extension (Path: '" + mpath //$NON-NLS-1$ //$NON-NLS-2$
+ + "' is invalid): " + ad.getId()); //$NON-NLS-1$
+ return;
+ }
+ }
+
+ // Find reference group.
+ if (mgroup == null) {
mgroup = IWorkbenchActionConstants.MB_ADDITIONS;
}
- IContributionItem sep = parent.find(mgroup);
- if (sep == null) {
- if (appendIfMissing) {
+ IContributionItem sep = parent.find(mgroup);
+ if (sep == null) {
+ if (appendIfMissing) {
addGroup(parent, mgroup);
} else {
- WorkbenchPlugin
- .log("Plug-in '" + ad.getPluginId() + "' contributed an invalid Menu Extension (Group: '" + mgroup + "' is invalid): " + ad.getId()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- return;
- }
- }
-
- // Add action.
- try {
- insertAfter(parent, mgroup, ad);
- } catch (IllegalArgumentException e) {
- WorkbenchPlugin
- .log("Plug-in '" + ad.getPluginId() + "' contributed an invalid Menu Extension (Group: '" + mgroup + "' is missing): " + ad.getId()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- }
-
- /**
- * Creates a named menu separator from the information in the configuration element.
- * If the separator already exists do not create a second.
- */
- protected void contributeSeparator(IMenuManager menu,
- IConfigurationElement element) {
- String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_NAME);
- if (id == null || id.length() <= 0) {
+ WorkbenchPlugin
+ .log("Plug-in '" + ad.getPluginId() + "' contributed an invalid Menu Extension (Group: '" //$NON-NLS-1$ //$NON-NLS-2$
+ + mgroup + "' is invalid): " + ad.getId()); //$NON-NLS-1$
+ return;
+ }
+ }
+
+ // Add action.
+ try {
+ insertAfter(parent, mgroup, ad);
+ } catch (IllegalArgumentException e) {
+ WorkbenchPlugin.log("Plug-in '" + ad.getPluginId() + "' contributed an invalid Menu Extension (Group: '" //$NON-NLS-1$ //$NON-NLS-2$
+ + mgroup + "' is missing): " + ad.getId()); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Creates a named menu separator from the information in the configuration
+ * element. If the separator already exists do not create a second.
+ */
+ protected void contributeSeparator(IMenuManager menu, IConfigurationElement element) {
+ String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_NAME);
+ if (id == null || id.length() <= 0) {
return;
}
- IContributionItem sep = menu.find(id);
- if (sep != null) {
+ IContributionItem sep = menu.find(id);
+ if (sep != null) {
return;
}
- insertMenuGroup(menu, new Separator(id));
- }
-
- /**
- * Creates a named menu group marker from the information in the configuration element.
- * If the marker already exists do not create a second.
- */
- protected void contributeGroupMarker(IMenuManager menu,
- IConfigurationElement element) {
- String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_NAME);
- if (id == null || id.length() <= 0) {
+ insertMenuGroup(menu, new Separator(id));
+ }
+
+ /**
+ * Creates a named menu group marker from the information in the configuration
+ * element. If the marker already exists do not create a second.
+ */
+ protected void contributeGroupMarker(IMenuManager menu, IConfigurationElement element) {
+ String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_NAME);
+ if (id == null || id.length() <= 0) {
return;
}
- IContributionItem marker = menu.find(id);
- if (marker != null) {
+ IContributionItem marker = menu.find(id);
+ if (marker != null) {
return;
}
- insertMenuGroup(menu, new GroupMarker(id));
- }
-
- /**
- * Contributes action from the action descriptor into the provided tool bar manager.
- */
- protected void contributeToolbarAction(ActionDescriptor ad,
- IToolBarManager toolbar, boolean appendIfMissing) {
- // Get config data.
- String tId = ad.getToolbarId();
- String tgroup = ad.getToolbarGroupId();
- if (tId == null && tgroup == null) {
+ insertMenuGroup(menu, new GroupMarker(id));
+ }
+
+ /**
+ * Contributes action from the action descriptor into the provided tool bar
+ * manager.
+ */
+ protected void contributeToolbarAction(ActionDescriptor ad, IToolBarManager toolbar, boolean appendIfMissing) {
+ // Get config data.
+ String tId = ad.getToolbarId();
+ String tgroup = ad.getToolbarGroupId();
+ if (tId == null && tgroup == null) {
return;
}
- // Find reference group.
- if (tgroup == null) {
+ // Find reference group.
+ if (tgroup == null) {
tgroup = IWorkbenchActionConstants.MB_ADDITIONS;
}
- IContributionItem sep = null;
- sep = toolbar.find(tgroup);
- if (sep == null) {
- if (appendIfMissing) {
- addGroup(toolbar, tgroup);
- } else {
- WorkbenchPlugin
- .log("Plug-in '" + ad.getPluginId() //$NON-NLS-1$
- + "' invalid Toolbar Extension (Group \'" //$NON-NLS-1$
- + tgroup + "\' is invalid): " + ad.getId()); //$NON-NLS-1$
- return;
- }
- }
- // Add action to tool bar.
- try {
- insertAfter(toolbar, tgroup, ad);
- } catch (IllegalArgumentException e) {
- WorkbenchPlugin
- .log("Plug-in '" + ad.getPluginId() //$NON-NLS-1$
- + "' invalid Toolbar Extension (Group \'" //$NON-NLS-1$
- + tgroup + "\' is missing): " + ad.getId()); //$NON-NLS-1$
- }
- }
-
- /**
- * Inserts the separator or group marker into the menu. Subclasses may override.
- */
- protected void insertMenuGroup(IMenuManager menu,
- AbstractGroupMarker marker) {
- menu.add(marker);
- }
-
- /**
- * Inserts an action after another named contribution item.
- * Subclasses may override.
- */
- protected void insertAfter(IContributionManager mgr, String refId,
- ActionDescriptor desc) {
- final PluginActionContributionItem item = new PluginActionContributionItem(desc.getAction());
- item.setMode(desc.getMode());
+ IContributionItem sep = null;
+ sep = toolbar.find(tgroup);
+ if (sep == null) {
+ if (appendIfMissing) {
+ addGroup(toolbar, tgroup);
+ } else {
+ WorkbenchPlugin.log("Plug-in '" + ad.getPluginId() //$NON-NLS-1$
+ + "' invalid Toolbar Extension (Group \'" //$NON-NLS-1$
+ + tgroup + "\' is invalid): " + ad.getId()); //$NON-NLS-1$
+ return;
+ }
+ }
+ // Add action to tool bar.
+ try {
+ insertAfter(toolbar, tgroup, ad);
+ } catch (IllegalArgumentException e) {
+ WorkbenchPlugin.log("Plug-in '" + ad.getPluginId() //$NON-NLS-1$
+ + "' invalid Toolbar Extension (Group \'" //$NON-NLS-1$
+ + tgroup + "\' is missing): " + ad.getId()); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Inserts the separator or group marker into the menu. Subclasses may override.
+ */
+ protected void insertMenuGroup(IMenuManager menu, AbstractGroupMarker marker) {
+ menu.add(marker);
+ }
+
+ /**
+ * Inserts an action after another named contribution item. Subclasses may
+ * override.
+ */
+ protected void insertAfter(IContributionManager mgr, String refId, ActionDescriptor desc) {
+ final PluginActionContributionItem item = new PluginActionContributionItem(desc.getAction());
+ item.setMode(desc.getMode());
insertAfter(mgr, refId, item);
- }
-
- /**
- * Inserts a contribution item after another named contribution item.
- * Subclasses may override.
- */
- protected void insertAfter(IContributionManager mgr, String refId,
- IContributionItem item) {
- mgr.insertAfter(refId, item);
- }
-
- /**
- * Adds a group to a contribution manager.
- * Subclasses may override.
- */
- protected void addGroup(IContributionManager mgr, String name) {
- mgr.add(new Separator(name));
- }
+ }
+
+ /**
+ * Inserts a contribution item after another named contribution item. Subclasses
+ * may override.
+ */
+ protected void insertAfter(IContributionManager mgr, String refId, IContributionItem item) {
+ mgr.insertAfter(refId, item);
+ }
+
+ /**
+ * Adds a group to a contribution manager. Subclasses may override.
+ */
+ protected void addGroup(IContributionManager mgr, String name) {
+ mgr.add(new Separator(name));
+ }
/**
* Disposes this contribution.
@@ -515,41 +493,39 @@ public abstract class PluginActionBuilder extends RegistryReader {
* @since 3.1
*/
protected void disposeActions() {
- if (actions != null) {
- for (int i = 0; i < actions.size(); i++) {
- PluginAction proxy = ((ActionDescriptor) actions.get(i))
- .getAction();
+ if (actions != null) {
+ for (int i = 0; i < actions.size(); i++) {
+ PluginAction proxy = ((ActionDescriptor) actions.get(i)).getAction();
proxy.dispose();
- }
+ }
actions = null;
- }
+ }
}
- }
+ }
- private static boolean allowIdeLogging = false;
+ private static boolean allowIdeLogging = false;
- /**
- * If set to <code>false</code>, some of the logs that can be caused by
- * use IDE plugins from an RCP app will be ignored.
+ /**
+ * If set to <code>false</code>, some of the logs that can be caused by use IDE
+ * plugins from an RCP app will be ignored.
*
- * @param b
- * Log the errors or not.
+ * @param b Log the errors or not.
* @since 3.3
*/
- public static void setAllowIdeLogging(boolean b) {
- allowIdeLogging = b;
- }
+ public static void setAllowIdeLogging(boolean b) {
+ allowIdeLogging = b;
+ }
- /**
- * These are log messages that should be ignored by RCP apps when using the
- * IDE plugins.
+ /**
+ * These are log messages that should be ignored by RCP apps when using the IDE
+ * plugins.
*
* @param msg
* @since 3.3
*/
- private static void ideLog(String msg) {
- if (allowIdeLogging) {
- WorkbenchPlugin.log(msg);
- }
- }
+ private static void ideLog(String msg) {
+ if (allowIdeLogging) {
+ WorkbenchPlugin.log(msg);
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionContributionItem.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionContributionItem.java
index 6ca72e701c2..e1906b32456 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionContributionItem.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionContributionItem.java
@@ -32,155 +32,150 @@ import org.eclipse.ui.activities.WorkbenchActivityHelper;
* extension points.
*/
public class PluginActionContributionItem extends ActionContributionItem
- implements IIdentifierListener, IActivityManagerListener {
-
- private IIdentifier identifier = null;
-
- /**
- * Creates a new contribution item from the given action. The id of the
- * action is used as the id of the item.
- *
- * @param action
- * the action
- */
- public PluginActionContributionItem(PluginAction action) {
- // dynamic UI (DDW) - this constructor has changed since 1113
- super(action);
- }
-
- /**
- * Hook the activity and identifier listener (if necessary);
- *
- * @since 3.1
- */
- private void hookListeners() {
- PlatformUI.getWorkbench().getActivitySupport().getActivityManager()
- .addActivityManagerListener(this);
- // set up the identifier if necessary
- IIdentifier id = getIdentifier();
- if (id != null) {
+ implements IIdentifierListener, IActivityManagerListener {
+
+ private IIdentifier identifier = null;
+
+ /**
+ * Creates a new contribution item from the given action. The id of the action
+ * is used as the id of the item.
+ *
+ * @param action the action
+ */
+ public PluginActionContributionItem(PluginAction action) {
+ // dynamic UI (DDW) - this constructor has changed since 1113
+ super(action);
+ }
+
+ /**
+ * Hook the activity and identifier listener (if necessary);
+ *
+ * @since 3.1
+ */
+ private void hookListeners() {
+ PlatformUI.getWorkbench().getActivitySupport().getActivityManager().addActivityManagerListener(this);
+ // set up the identifier if necessary
+ IIdentifier id = getIdentifier();
+ if (id != null) {
id.addIdentifierListener(this);
}
- }
-
- /**
- * Unhook the activity and identifier listener (if necessary);
- *
- * @since 3.1
- */
- private void unhookListeners() {
- PlatformUI.getWorkbench().getActivitySupport().getActivityManager()
- .removeActivityManagerListener(this);
-
- IIdentifier id = getIdentifier();
- if (id != null) {
+ }
+
+ /**
+ * Unhook the activity and identifier listener (if necessary);
+ *
+ * @since 3.1
+ */
+ private void unhookListeners() {
+ PlatformUI.getWorkbench().getActivitySupport().getActivityManager().removeActivityManagerListener(this);
+
+ IIdentifier id = getIdentifier();
+ if (id != null) {
id.removeIdentifierListener(this);
}
- }
+ }
- @Override
+ @Override
public void setParent(IContributionManager parent) {
- IContributionManager oldParent = getParent();
- super.setParent(parent);
- if (oldParent == parent) {
+ IContributionManager oldParent = getParent();
+ super.setParent(parent);
+ if (oldParent == parent) {
return;
}
- if (parent == null) {
+ if (parent == null) {
unhookListeners();
} else {
hookListeners();
}
- }
-
- /**
- * Create the IIdentifier reference for this item.
- *
- * @since 3.0
- */
- private IIdentifier getIdentifier() {
- if (!WorkbenchActivityHelper.isFiltering()) {
+ }
+
+ /**
+ * Create the IIdentifier reference for this item.
+ *
+ * @since 3.0
+ */
+ private IIdentifier getIdentifier() {
+ if (!WorkbenchActivityHelper.isFiltering()) {
return null;
}
- if (identifier == null) {
- IWorkbenchActivitySupport workbenchActivitySupport = PlatformUI
- .getWorkbench().getActivitySupport();
- IPluginContribution contribution = (IPluginContribution) getAction();
- // no need to check if contribution.getPluginId() == null - plugin
- // actions are always from plugins.
- identifier = workbenchActivitySupport.getActivityManager()
- .getIdentifier(
- WorkbenchActivityHelper
- .createUnifiedId(contribution));
- }
- return identifier;
- }
-
- /**
- * Dispose of the IIdentifier if necessary.
- *
- * @since 3.0
- */
- private void disposeIdentifier() {
- identifier = null;
- }
-
- /**
- * The default implementation of this <code>IContributionItem</code>
- * method notifies the delegate if loaded and implements the <code>IActionDelegate2</code>
- * interface.
- */
- @Override
+ if (identifier == null) {
+ IWorkbenchActivitySupport workbenchActivitySupport = PlatformUI.getWorkbench().getActivitySupport();
+ IPluginContribution contribution = (IPluginContribution) getAction();
+ // no need to check if contribution.getPluginId() == null - plugin
+ // actions are always from plugins.
+ identifier = workbenchActivitySupport.getActivityManager()
+ .getIdentifier(WorkbenchActivityHelper.createUnifiedId(contribution));
+ }
+ return identifier;
+ }
+
+ /**
+ * Dispose of the IIdentifier if necessary.
+ *
+ * @since 3.0
+ */
+ private void disposeIdentifier() {
+ identifier = null;
+ }
+
+ /**
+ * The default implementation of this <code>IContributionItem</code> method
+ * notifies the delegate if loaded and implements the
+ * <code>IActionDelegate2</code> interface.
+ */
+ @Override
public void dispose() {
- unhookListeners();
- disposeIdentifier();
+ unhookListeners();
+ disposeIdentifier();
setParent(null);
- }
+ }
- @Override
+ @Override
public boolean isVisible() {
- if (identifier != null && !identifier.isEnabled()) {
+ if (identifier != null && !identifier.isEnabled()) {
return false;
}
- return super.isVisible();
- }
+ return super.isVisible();
+ }
- @Override
+ @Override
public void identifierChanged(IdentifierEvent identifierEvent) {
- invalidateParent();
- }
-
- /**
- * Mark the parent dirty if we have a parent.
- *
- * @since 3.1
- */
+ invalidateParent();
+ }
+
+ /**
+ * Mark the parent dirty if we have a parent.
+ *
+ * @since 3.1
+ */
protected void invalidateParent() {
- IContributionManager parent = getParent();
- if (parent != null) {
+ IContributionManager parent = getParent();
+ if (parent != null) {
parent.markDirty();
}
- }
+ }
- @Override
+ @Override
public void activityManagerChanged(ActivityManagerEvent activityManagerEvent) {
- // ensure that if we're going from a non-filtering state that we get an identifier
- // and vice versa.
- if (WorkbenchActivityHelper.isFiltering() && identifier == null) {
- hookListeners();
- invalidateParent();
- } else if (!WorkbenchActivityHelper.isFiltering() && identifier != null) {
- unhookListeners();
- disposeIdentifier();
- invalidateParent();
- }
- }
-
- /*
- * For testing purposes only
- */
- public ISelection getSelection() {
- return ((PluginAction)getAction()).getSelection();
- }
+ // ensure that if we're going from a non-filtering state that we get an
+ // identifier
+ // and vice versa.
+ if (WorkbenchActivityHelper.isFiltering() && identifier == null) {
+ hookListeners();
+ invalidateParent();
+ } else if (!WorkbenchActivityHelper.isFiltering() && identifier != null) {
+ unhookListeners();
+ disposeIdentifier();
+ invalidateParent();
+ }
+ }
+
+ /*
+ * For testing purposes only
+ */
+ public ISelection getSelection() {
+ return ((PluginAction) getAction()).getSelection();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionCoolBarContributionItem.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionCoolBarContributionItem.java
index cbb081a7d8a..f2ce9e3c5bf 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionCoolBarContributionItem.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionCoolBarContributionItem.java
@@ -20,33 +20,33 @@ import org.eclipse.jface.action.IContributionManager;
import org.eclipse.ui.PlatformUI;
/**
- * Contribution item for actions provided by plugins via workbench
- * action extension points.
+ * Contribution item for actions provided by plugins via workbench action
+ * extension points.
*/
-public class PluginActionCoolBarContributionItem extends
- PluginActionContributionItem implements IActionSetContributionItem {
- private String actionSetId;
+public class PluginActionCoolBarContributionItem extends PluginActionContributionItem
+ implements IActionSetContributionItem {
+ private String actionSetId;
- /**
- * Creates a new contribution item from the given action.
- * The id of the action is used as the id of the item.
- *
- * @param action the action
- */
- public PluginActionCoolBarContributionItem(PluginAction action) {
- super(action);
- setActionSetId(((WWinPluginAction) action).getActionSetId());
- }
+ /**
+ * Creates a new contribution item from the given action. The id of the action
+ * is used as the id of the item.
+ *
+ * @param action the action
+ */
+ public PluginActionCoolBarContributionItem(PluginAction action) {
+ super(action);
+ setActionSetId(((WWinPluginAction) action).getActionSetId());
+ }
- @Override
+ @Override
public String getActionSetId() {
- return actionSetId;
- }
+ return actionSetId;
+ }
- @Override
+ @Override
public void setActionSetId(String id) {
- this.actionSetId = id;
- }
+ this.actionSetId = id;
+ }
@Override
protected void invalidateParent() {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionSet.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionSet.java
index 6e64d93eddc..b47abd67eb5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionSet.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionSet.java
@@ -25,102 +25,101 @@ import org.eclipse.ui.internal.registry.IActionSet;
import org.eclipse.ui.services.IDisposable;
/**
- * A PluginActionSet is a proxy for an action set defined in XML.
- * It creates a PluginAction for each action and does the required
- * cleanup on dispose.
+ * A PluginActionSet is a proxy for an action set defined in XML. It creates a
+ * PluginAction for each action and does the required cleanup on dispose.
*/
public class PluginActionSet implements IActionSet {
- private ActionSetDescriptor desc;
+ private ActionSetDescriptor desc;
- private ArrayList pluginActions = new ArrayList(4);
+ private ArrayList pluginActions = new ArrayList(4);
- private ActionSetActionBars bars;
+ private ActionSetActionBars bars;
private IDisposable disposableBuilder;
- /**
- * PluginActionSet constructor comment.
- *
- * @param desc the descriptor
- */
- public PluginActionSet(ActionSetDescriptor desc) {
- super();
- this.desc = desc;
- }
-
- /**
- * Adds one plugin action ref to the list.
- *
- * @param action the action
- */
- public void addPluginAction(WWinPluginAction action) {
- pluginActions.add(action);
- }
-
- /**
- * Returns the list of plugin actions for the set.
- *
- * @return the actions for the set
- */
- public IAction[] getPluginActions() {
- IAction result[] = new IAction[pluginActions.size()];
- pluginActions.toArray(result);
- return result;
- }
-
- /**
- * Disposes of this action set.
- */
- @Override
+ /**
+ * PluginActionSet constructor comment.
+ *
+ * @param desc the descriptor
+ */
+ public PluginActionSet(ActionSetDescriptor desc) {
+ super();
+ this.desc = desc;
+ }
+
+ /**
+ * Adds one plugin action ref to the list.
+ *
+ * @param action the action
+ */
+ public void addPluginAction(WWinPluginAction action) {
+ pluginActions.add(action);
+ }
+
+ /**
+ * Returns the list of plugin actions for the set.
+ *
+ * @return the actions for the set
+ */
+ public IAction[] getPluginActions() {
+ IAction result[] = new IAction[pluginActions.size()];
+ pluginActions.toArray(result);
+ return result;
+ }
+
+ /**
+ * Disposes of this action set.
+ */
+ @Override
public void dispose() {
- Iterator iter = pluginActions.iterator();
- while (iter.hasNext()) {
- WWinPluginAction action = (WWinPluginAction) iter.next();
- action.dispose();
- }
- pluginActions.clear();
- bars = null;
+ Iterator iter = pluginActions.iterator();
+ while (iter.hasNext()) {
+ WWinPluginAction action = (WWinPluginAction) iter.next();
+ action.dispose();
+ }
+ pluginActions.clear();
+ bars = null;
if (disposableBuilder != null) {
disposableBuilder.dispose();
disposableBuilder = null;
}
- }
-
- /**
- */
- /* package */ActionSetActionBars getBars() {
- return bars;
- }
-
- /**
- * Returns the configuration element.
- *
- * @return the configuration element
- */
- public IConfigurationElement getConfigElement() {
- return desc.getConfigurationElement();
- }
-
- /**
- * Returns the underlying descriptor.
- *
- * @return the descriptor
- */
- public ActionSetDescriptor getDesc() {
- return desc;
- }
-
- /**
- * Initializes this action set, which is expected to add it actions as required
- * to the given workbench window and action bars.
- *
- * @param window the workbench window
- * @param bars the action bars
- */
- @Override
+ }
+
+ /**
+ */
+ /* package */ActionSetActionBars getBars() {
+ return bars;
+ }
+
+ /**
+ * Returns the configuration element.
+ *
+ * @return the configuration element
+ */
+ public IConfigurationElement getConfigElement() {
+ return desc.getConfigurationElement();
+ }
+
+ /**
+ * Returns the underlying descriptor.
+ *
+ * @return the descriptor
+ */
+ public ActionSetDescriptor getDesc() {
+ return desc;
+ }
+
+ /**
+ * Initializes this action set, which is expected to add it actions as required
+ * to the given workbench window and action bars.
+ *
+ * @param window the workbench window
+ * @param bars the action bars
+ */
+ @Override
public void init(IWorkbenchWindow window, IActionBars bars) {
- this.bars = (ActionSetActionBars) bars;
- }
+ this.bars = (ActionSetActionBars) bars;
+ }
public void setBuilder(IDisposable builder) {
if (disposableBuilder != null) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionSetBuilder.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionSetBuilder.java
index 2dd884e7862..df9fec7b965 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionSetBuilder.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionSetBuilder.java
@@ -39,730 +39,681 @@ import org.eclipse.ui.services.IDisposable;
*/
public class PluginActionSetBuilder extends PluginActionBuilder {
- private PluginActionSet actionSet;
+ private PluginActionSet actionSet;
- private IWorkbenchWindow window;
+ private IWorkbenchWindow window;
- private ArrayList adjunctContributions = new ArrayList(0);
+ private ArrayList adjunctContributions = new ArrayList(0);
- /**
- * Used by the workbench window extension handler to unhook action sets from
- * their associated window.
- *
- * @since 3.1
- */
+ /**
+ * Used by the workbench window extension handler to unhook action sets from
+ * their associated window.
+ *
+ * @since 3.1
+ */
public static class Binding implements IDisposable {
- PluginActionSetBuilder builder;
- PluginActionSet set;
- IWorkbenchWindow window;
+ PluginActionSetBuilder builder;
+ PluginActionSet set;
+ IWorkbenchWindow window;
IExtensionTracker tracker;
@Override
public void dispose() {
if (tracker != null) {
- tracker.unregisterObject(set.getConfigElement()
- .getDeclaringExtension(), this);
+ tracker.unregisterObject(set.getConfigElement().getDeclaringExtension(), this);
tracker = null;
}
}
- }
-
- /**
- * Constructs a new builder.
- */
- public PluginActionSetBuilder() {
- }
-
- /**
- * Read the actions within a config element. Called by customize perspective
- *
- * @param set the action set
- * @param window the window to contribute to
- */
- public void buildMenuAndToolBarStructure(PluginActionSet set,
- IWorkbenchWindow window) {
- this.actionSet = set;
- this.window = window;
- cache = null;
- currentContribution = null;
- targetID = null;
- targetContributionTag = IWorkbenchRegistryConstants.TAG_ACTION_SET;
-
- readElements(new IConfigurationElement[] { set.getConfigElement() });
-
- if (cache != null) {
- for (int i = 0; i < cache.size(); i++) {
- ActionSetContribution contribution = (ActionSetContribution) cache
- .get(i);
- contribution.contribute(actionSet.getBars(), true, true);
- if (contribution.isAdjunctContributor()) {
- adjunctContributions.add(contribution);
- }
- }
- }
- for (int i = 0; i < adjunctContributions.size(); i++) {
- ActionSetContribution contribution = (ActionSetContribution) adjunctContributions
- .get(i);
- ActionSetActionBars bars = actionSet.getBars();
- for (int j = 0; j < contribution.adjunctActions.size(); j++) {
- ActionDescriptor adjunctAction = (ActionDescriptor) contribution.adjunctActions
- .get(j);
- contribution
- .contributeAdjunctCoolbarAction(adjunctAction, bars);
- }
- }
-
- registerBinding(set);
- }
-
- @Override
- protected ActionDescriptor createActionDescriptor(
- IConfigurationElement element) {
- // As of 2.1, the "pulldown" attribute was deprecated and replaced by
- // the attribute "style". See doc for more details.
- boolean pullDownStyle = false;
- String style = element.getAttribute(IWorkbenchRegistryConstants.ATT_STYLE);
- if (style != null) {
- pullDownStyle = style.equals(ActionDescriptor.STYLE_PULLDOWN);
- } else {
- String pulldown = element.getAttribute(ActionDescriptor.STYLE_PULLDOWN);
- pullDownStyle = pulldown != null && pulldown.equals("true"); //$NON-NLS-1$
- }
-
- ActionDescriptor desc = null;
- if (pullDownStyle) {
- desc = new ActionDescriptor(element,
- ActionDescriptor.T_WORKBENCH_PULLDOWN, window);
+ }
+
+ /**
+ * Constructs a new builder.
+ */
+ public PluginActionSetBuilder() {
+ }
+
+ /**
+ * Read the actions within a config element. Called by customize perspective
+ *
+ * @param set the action set
+ * @param window the window to contribute to
+ */
+ public void buildMenuAndToolBarStructure(PluginActionSet set, IWorkbenchWindow window) {
+ this.actionSet = set;
+ this.window = window;
+ cache = null;
+ currentContribution = null;
+ targetID = null;
+ targetContributionTag = IWorkbenchRegistryConstants.TAG_ACTION_SET;
+
+ readElements(new IConfigurationElement[] { set.getConfigElement() });
+
+ if (cache != null) {
+ for (int i = 0; i < cache.size(); i++) {
+ ActionSetContribution contribution = (ActionSetContribution) cache.get(i);
+ contribution.contribute(actionSet.getBars(), true, true);
+ if (contribution.isAdjunctContributor()) {
+ adjunctContributions.add(contribution);
+ }
+ }
+ }
+ for (int i = 0; i < adjunctContributions.size(); i++) {
+ ActionSetContribution contribution = (ActionSetContribution) adjunctContributions.get(i);
+ ActionSetActionBars bars = actionSet.getBars();
+ for (int j = 0; j < contribution.adjunctActions.size(); j++) {
+ ActionDescriptor adjunctAction = (ActionDescriptor) contribution.adjunctActions.get(j);
+ contribution.contributeAdjunctCoolbarAction(adjunctAction, bars);
+ }
+ }
+
+ registerBinding(set);
+ }
+
+ @Override
+ protected ActionDescriptor createActionDescriptor(IConfigurationElement element) {
+ // As of 2.1, the "pulldown" attribute was deprecated and replaced by
+ // the attribute "style". See doc for more details.
+ boolean pullDownStyle = false;
+ String style = element.getAttribute(IWorkbenchRegistryConstants.ATT_STYLE);
+ if (style != null) {
+ pullDownStyle = style.equals(ActionDescriptor.STYLE_PULLDOWN);
} else {
- desc = new ActionDescriptor(element, ActionDescriptor.T_WORKBENCH,
- window);
+ String pulldown = element.getAttribute(ActionDescriptor.STYLE_PULLDOWN);
+ pullDownStyle = pulldown != null && pulldown.equals("true"); //$NON-NLS-1$
}
- WWinPluginAction action = (WWinPluginAction) desc.getAction();
- action.setActionSetId(actionSet.getDesc().getId());
- actionSet.addPluginAction(action);
- return desc;
- }
- @Override
+ ActionDescriptor desc = null;
+ if (pullDownStyle) {
+ desc = new ActionDescriptor(element, ActionDescriptor.T_WORKBENCH_PULLDOWN, window);
+ } else {
+ desc = new ActionDescriptor(element, ActionDescriptor.T_WORKBENCH, window);
+ }
+ WWinPluginAction action = (WWinPluginAction) desc.getAction();
+ action.setActionSetId(actionSet.getDesc().getId());
+ actionSet.addPluginAction(action);
+ return desc;
+ }
+
+ @Override
protected BasicContribution createContribution() {
- return new ActionSetContribution(actionSet.getDesc().getId(), window);
- }
-
- /**
- * Returns the insertion point for a new contribution item. Clients should
- * use this item as a reference point for insertAfter.
- *
- * @param startId the reference id for insertion
- * @param sortId the sorting id for the insertion. If null then the item
- * will be inserted at the end of all action sets.
- * @param mgr the target menu manager.
- * @param startVsEnd if <code>true</code> the items are added at the start of
- * action with the same id; else they are added to the end
- * @return the insertion point, or null if not found.
- */
- public static IContributionItem findInsertionPoint(String startId,
- String sortId, IContributionManager mgr, boolean startVsEnd) {
- // Get items.
- IContributionItem[] items = mgr.getItems();
-
- // Find the reference item.
- int insertIndex = 0;
- while (insertIndex < items.length) {
- if (startId.equals(items[insertIndex].getId())) {
+ return new ActionSetContribution(actionSet.getDesc().getId(), window);
+ }
+
+ /**
+ * Returns the insertion point for a new contribution item. Clients should use
+ * this item as a reference point for insertAfter.
+ *
+ * @param startId the reference id for insertion
+ * @param sortId the sorting id for the insertion. If null then the item
+ * will be inserted at the end of all action sets.
+ * @param mgr the target menu manager.
+ * @param startVsEnd if <code>true</code> the items are added at the start of
+ * action with the same id; else they are added to the end
+ * @return the insertion point, or null if not found.
+ */
+ public static IContributionItem findInsertionPoint(String startId, String sortId, IContributionManager mgr,
+ boolean startVsEnd) {
+ // Get items.
+ IContributionItem[] items = mgr.getItems();
+
+ // Find the reference item.
+ int insertIndex = 0;
+ while (insertIndex < items.length) {
+ if (startId.equals(items[insertIndex].getId())) {
break;
}
- ++insertIndex;
- }
- if (insertIndex >= items.length) {
+ ++insertIndex;
+ }
+ if (insertIndex >= items.length) {
return null;
}
- // Calculate startVsEnd comparison value.
- int compareMetric = 0;
- if (startVsEnd) {
+ // Calculate startVsEnd comparison value.
+ int compareMetric = 0;
+ if (startVsEnd) {
compareMetric = 1;
}
- // Find the insertion point for the new item.
- // We do this by iterating through all of the previous
- // action set contributions define within the current group.
- for (int nX = insertIndex + 1; nX < items.length; nX++) {
- IContributionItem item = items[nX];
- if (item.isSeparator() || item.isGroupMarker()) {
- // Fix for bug report 18357
- break;
- }
- if (item instanceof IActionSetContributionItem) {
- if (sortId != null) {
- String testId = ((IActionSetContributionItem) item)
- .getActionSetId();
- if (sortId.compareTo(testId) < compareMetric) {
+ // Find the insertion point for the new item.
+ // We do this by iterating through all of the previous
+ // action set contributions define within the current group.
+ for (int nX = insertIndex + 1; nX < items.length; nX++) {
+ IContributionItem item = items[nX];
+ if (item.isSeparator() || item.isGroupMarker()) {
+ // Fix for bug report 18357
+ break;
+ }
+ if (item instanceof IActionSetContributionItem) {
+ if (sortId != null) {
+ String testId = ((IActionSetContributionItem) item).getActionSetId();
+ if (sortId.compareTo(testId) < compareMetric) {
break;
}
- }
- insertIndex = nX;
- } else {
- break;
- }
- }
- // Return item.
- return items[insertIndex];
- }
-
- /**
- */
- /* package */static void processActionSets(ArrayList pluginActionSets,
- WorkbenchWindow window) {
- // Process the action sets in two passes. On the first pass the pluginActionSetBuilder
- // will process base contributions and cache adjunct contributions. On the second
- // pass the adjunct contributions will be processed.
- PluginActionSetBuilder[] builders = new PluginActionSetBuilder[pluginActionSets
- .size()];
- for (int i = 0; i < pluginActionSets.size(); i++) {
- PluginActionSet set = (PluginActionSet) pluginActionSets.get(i);
- PluginActionSetBuilder builder = new PluginActionSetBuilder();
- builder.readActionExtensions(set, window);
- builders[i] = builder;
- }
- for (PluginActionSetBuilder builder : builders) {
- builder.processAdjunctContributions();
- }
- }
-
- /**
- */
- protected void processAdjunctContributions() {
- // Contribute the adjunct contributions.
- for (int i = 0; i < adjunctContributions.size(); i++) {
- ActionSetContribution contribution = (ActionSetContribution) adjunctContributions
- .get(i);
- ActionSetActionBars bars = actionSet.getBars();
- for (int j = 0; j < contribution.adjunctActions.size(); j++) {
- ActionDescriptor adjunctAction = (ActionDescriptor) contribution.adjunctActions
- .get(j);
- contribution
- .contributeAdjunctCoolbarAction(adjunctAction, bars);
- }
- }
- }
-
- /**
- * Read the actions within a config element.
- */
- protected void readActionExtensions(PluginActionSet set,
- IWorkbenchWindow window) {
- this.actionSet = set;
- this.window = window;
- cache = null;
- currentContribution = null;
- targetID = null;
- targetContributionTag = IWorkbenchRegistryConstants.TAG_ACTION_SET;
-
- readElements(new IConfigurationElement[] { set.getConfigElement() });
-
- if (cache != null) {
- // for dynamic UI - save cache for future removal lf actionset extensions
- // Don't call addCache -- it's broken, and is only used for dynamic plugin removal,
- // which the workbench doesn't currently support.
- // See bug 66374 for more details.
- // WorkbenchPlugin.getDefault().getActionSetRegistry().addCache(set.getDesc().getId(), cache);
- for (int i = 0; i < cache.size(); i++) {
- ActionSetContribution contribution = (ActionSetContribution) cache
- .get(i);
- contribution.contribute(actionSet.getBars(), true, true);
- if (contribution.isAdjunctContributor()) {
- adjunctContributions.add(contribution);
- }
- }
-
- registerBinding(set);
-
- } else {
- WorkbenchPlugin
- .log("Action Set is empty: " + set.getDesc().getId()); //$NON-NLS-1$
- }
- }
-
- private void registerBinding(final PluginActionSet set) {
- final IExtensionTracker tracker = window.getExtensionTracker();
-
- // register the new binding
- final Binding binding = new Binding();
- binding.builder = this;
- binding.set = set;
- binding.window = window;
+ }
+ insertIndex = nX;
+ } else {
+ break;
+ }
+ }
+ // Return item.
+ return items[insertIndex];
+ }
+
+ /**
+ */
+ /* package */static void processActionSets(ArrayList pluginActionSets, WorkbenchWindow window) {
+ // Process the action sets in two passes. On the first pass the
+ // pluginActionSetBuilder
+ // will process base contributions and cache adjunct contributions. On the
+ // second
+ // pass the adjunct contributions will be processed.
+ PluginActionSetBuilder[] builders = new PluginActionSetBuilder[pluginActionSets.size()];
+ for (int i = 0; i < pluginActionSets.size(); i++) {
+ PluginActionSet set = (PluginActionSet) pluginActionSets.get(i);
+ PluginActionSetBuilder builder = new PluginActionSetBuilder();
+ builder.readActionExtensions(set, window);
+ builders[i] = builder;
+ }
+ for (PluginActionSetBuilder builder : builders) {
+ builder.processAdjunctContributions();
+ }
+ }
+
+ /**
+ */
+ protected void processAdjunctContributions() {
+ // Contribute the adjunct contributions.
+ for (int i = 0; i < adjunctContributions.size(); i++) {
+ ActionSetContribution contribution = (ActionSetContribution) adjunctContributions.get(i);
+ ActionSetActionBars bars = actionSet.getBars();
+ for (int j = 0; j < contribution.adjunctActions.size(); j++) {
+ ActionDescriptor adjunctAction = (ActionDescriptor) contribution.adjunctActions.get(j);
+ contribution.contributeAdjunctCoolbarAction(adjunctAction, bars);
+ }
+ }
+ }
+
+ /**
+ * Read the actions within a config element.
+ */
+ protected void readActionExtensions(PluginActionSet set, IWorkbenchWindow window) {
+ this.actionSet = set;
+ this.window = window;
+ cache = null;
+ currentContribution = null;
+ targetID = null;
+ targetContributionTag = IWorkbenchRegistryConstants.TAG_ACTION_SET;
+
+ readElements(new IConfigurationElement[] { set.getConfigElement() });
+
+ if (cache != null) {
+ // for dynamic UI - save cache for future removal lf actionset extensions
+ // Don't call addCache -- it's broken, and is only used for dynamic plugin
+ // removal,
+ // which the workbench doesn't currently support.
+ // See bug 66374 for more details.
+ // WorkbenchPlugin.getDefault().getActionSetRegistry().addCache(set.getDesc().getId(),
+ // cache);
+ for (int i = 0; i < cache.size(); i++) {
+ ActionSetContribution contribution = (ActionSetContribution) cache.get(i);
+ contribution.contribute(actionSet.getBars(), true, true);
+ if (contribution.isAdjunctContributor()) {
+ adjunctContributions.add(contribution);
+ }
+ }
+
+ registerBinding(set);
+
+ } else {
+ WorkbenchPlugin.log("Action Set is empty: " + set.getDesc().getId()); //$NON-NLS-1$
+ }
+ }
+
+ private void registerBinding(final PluginActionSet set) {
+ final IExtensionTracker tracker = window.getExtensionTracker();
+
+ // register the new binding
+ final Binding binding = new Binding();
+ binding.builder = this;
+ binding.set = set;
+ binding.window = window;
binding.tracker = tracker;
- tracker.registerObject(
- set.getConfigElement().getDeclaringExtension(), binding,
- IExtensionTracker.REF_STRONG);
+ tracker.registerObject(set.getConfigElement().getDeclaringExtension(), binding, IExtensionTracker.REF_STRONG);
set.setBuilder(binding);
- }
-
- /**
- * Helper class to collect the menus and actions defined within a
- * contribution element.
- */
- private static class ActionSetContribution extends BasicContribution {
- private String actionSetId;
-
- private WorkbenchWindow window;
-
- protected ArrayList adjunctActions = new ArrayList(0);
-
- /**
- * Create a new instance of <code>ActionSetContribution</code>.
- *
- * @param id the id
- * @param window the window to contribute to
- */
- public ActionSetContribution(String id, IWorkbenchWindow window) {
- super();
- actionSetId = id;
- this.window = (WorkbenchWindow) window;
- }
-
- /**
- * This implementation inserts the group into the action set additions group.
- */
- @Override
+ }
+
+ /**
+ * Helper class to collect the menus and actions defined within a contribution
+ * element.
+ */
+ private static class ActionSetContribution extends BasicContribution {
+ private String actionSetId;
+
+ private WorkbenchWindow window;
+
+ protected ArrayList adjunctActions = new ArrayList(0);
+
+ /**
+ * Create a new instance of <code>ActionSetContribution</code>.
+ *
+ * @param id the id
+ * @param window the window to contribute to
+ */
+ public ActionSetContribution(String id, IWorkbenchWindow window) {
+ super();
+ actionSetId = id;
+ this.window = (WorkbenchWindow) window;
+ }
+
+ /**
+ * This implementation inserts the group into the action set additions group.
+ */
+ @Override
protected void addGroup(IContributionManager mgr, String name) {
- IContributionItem refItem = findInsertionPoint(
- IWorkbenchActionConstants.MB_ADDITIONS, actionSetId, mgr,
- true);
- // Insert the new group marker.
- ActionSetSeparator group = new ActionSetSeparator(name, actionSetId);
- if (refItem == null) {
- mgr.add(group);
- } else {
- mgr.insertAfter(refItem.getId(), group);
- }
- }
-
- /**
- * Contributes submenus and/or actions into the provided menu and tool bar
- * managers.
- *
- * @param bars the action bars to contribute to
- * @param menuAppendIfMissing append to the menubar if missing
- * @param toolAppendIfMissing append to the toolbar if missing
- */
- public void contribute(IActionBars bars, boolean menuAppendIfMissing,
- boolean toolAppendIfMissing) {
-
- IMenuManager menuMgr = bars.getMenuManager();
- IToolBarManager toolBarMgr = bars.getToolBarManager();
- if (menus != null && menuMgr != null) {
- for (int i = 0; i < menus.size(); i++) {
- IConfigurationElement menuElement = (IConfigurationElement) menus
- .get(i);
- contributeMenu(menuElement, menuMgr, menuAppendIfMissing);
- }
- }
-
- if (actions != null) {
- for (int i = 0; i < actions.size(); i++) {
- ActionDescriptor ad = (ActionDescriptor) actions.get(i);
- if (menuMgr != null) {
+ IContributionItem refItem = findInsertionPoint(IWorkbenchActionConstants.MB_ADDITIONS, actionSetId, mgr,
+ true);
+ // Insert the new group marker.
+ ActionSetSeparator group = new ActionSetSeparator(name, actionSetId);
+ if (refItem == null) {
+ mgr.add(group);
+ } else {
+ mgr.insertAfter(refItem.getId(), group);
+ }
+ }
+
+ /**
+ * Contributes submenus and/or actions into the provided menu and tool bar
+ * managers.
+ *
+ * @param bars the action bars to contribute to
+ * @param menuAppendIfMissing append to the menubar if missing
+ * @param toolAppendIfMissing append to the toolbar if missing
+ */
+ public void contribute(IActionBars bars, boolean menuAppendIfMissing, boolean toolAppendIfMissing) {
+
+ IMenuManager menuMgr = bars.getMenuManager();
+ IToolBarManager toolBarMgr = bars.getToolBarManager();
+ if (menus != null && menuMgr != null) {
+ for (int i = 0; i < menus.size(); i++) {
+ IConfigurationElement menuElement = (IConfigurationElement) menus.get(i);
+ contributeMenu(menuElement, menuMgr, menuAppendIfMissing);
+ }
+ }
+
+ if (actions != null) {
+ for (int i = 0; i < actions.size(); i++) {
+ ActionDescriptor ad = (ActionDescriptor) actions.get(i);
+ if (menuMgr != null) {
contributeMenuAction(ad, menuMgr, menuAppendIfMissing);
}
- if (toolBarMgr != null) {
- if (bars instanceof ActionSetActionBars) {
- contributeCoolbarAction(ad,
- (ActionSetActionBars) bars);
- } else {
- contributeToolbarAction(ad, toolBarMgr,
- toolAppendIfMissing);
- }
- }
- }
- }
- }
-
- /**
- * Contributes action from the action descriptor into the cool bar manager.
- */
- protected void contributeAdjunctCoolbarAction(ActionDescriptor ad,
- ActionSetActionBars bars) {
- String toolBarId = ad.getToolbarId();
- String toolGroupId = ad.getToolbarGroupId();
-
- String contributingId = bars.getActionSetId();
- ICoolBarManager coolBarMgr = bars.getCoolBarManager();
- if (coolBarMgr == null) {
- return;
- }
-
- PluginAction action = ad.getAction();
- ActionContributionItem actionContribution = new PluginActionCoolBarContributionItem(
- action);
- actionContribution.setMode(ad.getMode());
-
- bars.addAdjunctContribution(actionContribution);
-
- // create a coolitem for the toolbar id if it does not yet exist
- IToolBarManager toolBarManager = bars.getToolBarManager(toolBarId);
-
- // Check to see if the group already exists
- IContributionItem groupMarker = toolBarManager.find(toolGroupId);
- // Add a group marker if one does not exist
- if (groupMarker == null) {
- toolBarManager.add(new Separator(toolGroupId));
- }
- IContributionItem refItem = findAlphabeticalOrder(toolGroupId,
- contributingId, toolBarManager);
- if (refItem != null && refItem.getId() != null) {
- toolBarManager.insertAfter(refItem.getId(), actionContribution);
- } else {
- toolBarManager.add(actionContribution);
- }
- toolBarManager.update(false);
-
- }
-
- /**
- * Contributes action from the action descriptor into the cool bar manager.
- */
- protected void contributeCoolbarAction(ActionDescriptor ad,
- ActionSetActionBars bars) {
- String toolBarId = ad.getToolbarId();
- String toolGroupId = ad.getToolbarGroupId();
- if (toolBarId == null && toolGroupId == null) {
+ if (toolBarMgr != null) {
+ if (bars instanceof ActionSetActionBars) {
+ contributeCoolbarAction(ad, (ActionSetActionBars) bars);
+ } else {
+ contributeToolbarAction(ad, toolBarMgr, toolAppendIfMissing);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Contributes action from the action descriptor into the cool bar manager.
+ */
+ protected void contributeAdjunctCoolbarAction(ActionDescriptor ad, ActionSetActionBars bars) {
+ String toolBarId = ad.getToolbarId();
+ String toolGroupId = ad.getToolbarGroupId();
+
+ String contributingId = bars.getActionSetId();
+ ICoolBarManager coolBarMgr = bars.getCoolBarManager();
+ if (coolBarMgr == null) {
return;
}
- String contributingId = bars.getActionSetId();
-
- if (toolBarId == null || toolBarId.equals("")) { //$NON-NLS-1$
- // the item is being added to the coolitem for its action set
- toolBarId = contributingId;
- }
-
- if (!toolBarId.equals(contributingId)) {
- // adding to another action set, validate the id
- if (!isValidCoolItemId(toolBarId, window)) {
- // toolbarid not valid, add the item to the coolitem for its action set
- toolBarId = contributingId;
- } else {
- adjunctActions.add(ad);
- return;
- }
- }
-
- // Create the action
- PluginAction action = ad.getAction();
- ActionContributionItem actionContribution = new PluginActionCoolBarContributionItem(
- action);
- actionContribution.setMode(ad.getMode());
-
- // retreive the toolbar from the action bars.
- IToolBarManager toolBar = bars.getToolBarManager(toolBarId);
-
- // Check to see if the group already exists
- IContributionItem groupMarker = toolBar.find(toolGroupId);
- // Add a group marker if one does not exist
- if (groupMarker == null) {
- // @issue should this be a GroupMarker?
- toolBar.add(new Separator(toolGroupId));
- }
- toolBar.prependToGroup(toolGroupId, actionContribution);
- toolBar.update(false);
-
- }
-
- /**
- * Checks to see if the cool item id is in the given window.
- */
- private boolean isValidCoolItemId(String id, WorkbenchWindow window) {
- ActionSetRegistry registry = WorkbenchPlugin.getDefault()
- .getActionSetRegistry();
- if (registry.findActionSet(id) != null) {
+ PluginAction action = ad.getAction();
+ ActionContributionItem actionContribution = new PluginActionCoolBarContributionItem(action);
+ actionContribution.setMode(ad.getMode());
+
+ bars.addAdjunctContribution(actionContribution);
+
+ // create a coolitem for the toolbar id if it does not yet exist
+ IToolBarManager toolBarManager = bars.getToolBarManager(toolBarId);
+
+ // Check to see if the group already exists
+ IContributionItem groupMarker = toolBarManager.find(toolGroupId);
+ // Add a group marker if one does not exist
+ if (groupMarker == null) {
+ toolBarManager.add(new Separator(toolGroupId));
+ }
+ IContributionItem refItem = findAlphabeticalOrder(toolGroupId, contributingId, toolBarManager);
+ if (refItem != null && refItem.getId() != null) {
+ toolBarManager.insertAfter(refItem.getId(), actionContribution);
+ } else {
+ toolBarManager.add(actionContribution);
+ }
+ toolBarManager.update(false);
+
+ }
+
+ /**
+ * Contributes action from the action descriptor into the cool bar manager.
+ */
+ protected void contributeCoolbarAction(ActionDescriptor ad, ActionSetActionBars bars) {
+ String toolBarId = ad.getToolbarId();
+ String toolGroupId = ad.getToolbarGroupId();
+ if (toolBarId == null && toolGroupId == null) {
+ return;
+ }
+
+ String contributingId = bars.getActionSetId();
+
+ if (toolBarId == null || toolBarId.equals("")) { //$NON-NLS-1$
+ // the item is being added to the coolitem for its action set
+ toolBarId = contributingId;
+ }
+
+ if (!toolBarId.equals(contributingId)) {
+ // adding to another action set, validate the id
+ if (!isValidCoolItemId(toolBarId, window)) {
+ // toolbarid not valid, add the item to the coolitem for its action set
+ toolBarId = contributingId;
+ } else {
+ adjunctActions.add(ad);
+ return;
+ }
+ }
+
+ // Create the action
+ PluginAction action = ad.getAction();
+ ActionContributionItem actionContribution = new PluginActionCoolBarContributionItem(action);
+ actionContribution.setMode(ad.getMode());
+
+ // retreive the toolbar from the action bars.
+ IToolBarManager toolBar = bars.getToolBarManager(toolBarId);
+
+ // Check to see if the group already exists
+ IContributionItem groupMarker = toolBar.find(toolGroupId);
+ // Add a group marker if one does not exist
+ if (groupMarker == null) {
+ // @issue should this be a GroupMarker?
+ toolBar.add(new Separator(toolGroupId));
+ }
+ toolBar.prependToGroup(toolGroupId, actionContribution);
+ toolBar.update(false);
+
+ }
+
+ /**
+ * Checks to see if the cool item id is in the given window.
+ */
+ private boolean isValidCoolItemId(String id, WorkbenchWindow window) {
+ ActionSetRegistry registry = WorkbenchPlugin.getDefault().getActionSetRegistry();
+ if (registry.findActionSet(id) != null) {
return true;
}
- if (window != null) {
- return window.isWorkbenchCoolItemId(id);
- }
- return false;
- }
-
- @Override
- protected void insertMenuGroup(IMenuManager menu,
- AbstractGroupMarker marker) {
- if (actionSetId != null) {
- IContributionItem[] items = menu.getItems();
- // Loop thru all the current groups looking for the first
- // group whose id > than the current action set id. Insert
- // current marker just before this item then.
- for (IContributionItem item : items) {
- if (item.isSeparator() || item.isGroupMarker()) {
- if (item instanceof IActionSetContributionItem) {
- String testId = ((IActionSetContributionItem) item)
- .getActionSetId();
- if (actionSetId.compareTo(testId) < 0) {
- menu.insertBefore(item.getId(), marker);
- return;
- }
- }
- }
- }
- }
-
- menu.add(marker);
- }
-
- private IContributionItem findAlphabeticalOrder(String startId,
- String itemId, IContributionManager mgr) {
- IContributionItem[] items = mgr.getItems();
- int insertIndex = 0;
-
- // look for starting point
- while (insertIndex < items.length) {
- IContributionItem item = items[insertIndex];
- if (startId != null && startId.equals(item.getId())) {
+ if (window != null) {
+ return window.isWorkbenchCoolItemId(id);
+ }
+ return false;
+ }
+
+ @Override
+ protected void insertMenuGroup(IMenuManager menu, AbstractGroupMarker marker) {
+ if (actionSetId != null) {
+ IContributionItem[] items = menu.getItems();
+ // Loop thru all the current groups looking for the first
+ // group whose id > than the current action set id. Insert
+ // current marker just before this item then.
+ for (IContributionItem item : items) {
+ if (item.isSeparator() || item.isGroupMarker()) {
+ if (item instanceof IActionSetContributionItem) {
+ String testId = ((IActionSetContributionItem) item).getActionSetId();
+ if (actionSetId.compareTo(testId) < 0) {
+ menu.insertBefore(item.getId(), marker);
+ return;
+ }
+ }
+ }
+ }
+ }
+
+ menu.add(marker);
+ }
+
+ private IContributionItem findAlphabeticalOrder(String startId, String itemId, IContributionManager mgr) {
+ IContributionItem[] items = mgr.getItems();
+ int insertIndex = 0;
+
+ // look for starting point
+ while (insertIndex < items.length) {
+ IContributionItem item = items[insertIndex];
+ if (startId != null && startId.equals(item.getId())) {
+ break;
+ }
+ ++insertIndex;
+ }
+
+ // Find the index that this item should be inserted in
+ for (int i = insertIndex + 1; i < items.length; i++) {
+ IContributionItem item = items[i];
+ if (item.isGroupMarker()) {
break;
}
- ++insertIndex;
- }
- // Find the index that this item should be inserted in
- for (int i = insertIndex + 1; i < items.length; i++) {
- IContributionItem item = items[i];
- if (item.isGroupMarker()) {
+ String testId = null;
+ if (item instanceof PluginActionCoolBarContributionItem) {
+ testId = ((PluginActionCoolBarContributionItem) item).getActionSetId();
+ }
+ if (testId == null) {
break;
}
- String testId = null;
- if (item instanceof PluginActionCoolBarContributionItem) {
- testId = ((PluginActionCoolBarContributionItem) item)
- .getActionSetId();
- }
- if (testId == null) {
- break;
- }
-
- if (itemId != null) {
- if (itemId.compareTo(testId) < 1) {
+ if (itemId != null) {
+ if (itemId.compareTo(testId) < 1) {
break;
}
- }
- insertIndex = i;
- }
- if (insertIndex >= items.length) {
- return null;
- }
- return items[insertIndex];
- }
-
- /**
- * Returns whether the contributor is an adjunct contributor.
- *
- * @return whether the contributor is an adjunct contributor
- */
- public boolean isAdjunctContributor() {
- return adjunctActions.size() > 0;
- }
-
- @Override
- protected void insertAfter(IContributionManager mgr, String refId,
- IContributionItem item) {
- IContributionItem refItem = findInsertionPoint(refId, actionSetId,
- mgr, true);
- if (refItem != null) {
- mgr.insertAfter(refItem.getId(), item);
- } else {
- WorkbenchPlugin
- .log("Reference item " + refId + " not found for action " + item.getId()); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- //for dynamic UI
- protected void revokeContribution(WorkbenchWindow window,
- IActionBars bars, String id) {
- revokeActionSetFromMenu(window.getMenuManager(), id);
- // IMenuManager menuMgr = bars.getMenuManager();
- // if (menuMgr != null)
- // revokeActionSetFromMenu(menuMgr, id);
-
- revokeActionSetFromCoolbar(window.getCoolBarManager2(), id);
- // IToolBarManager toolBarMgr = bars.getToolBarManager();
- // if (toolBarMgr != null && toolBarMgr instanceof CoolItemToolBarManager)
- // revokeActionSetFromToolbar(toolBarMgr, id);
- }
-
- //for dynamic UI
- protected void revokeAdjunctCoolbarAction(ActionDescriptor ad,
- ActionSetActionBars bars) {
- String toolBarId = ad.getToolbarId();
+ }
+ insertIndex = i;
+ }
+ if (insertIndex >= items.length) {
+ return null;
+ }
+ return items[insertIndex];
+ }
+
+ /**
+ * Returns whether the contributor is an adjunct contributor.
+ *
+ * @return whether the contributor is an adjunct contributor
+ */
+ public boolean isAdjunctContributor() {
+ return adjunctActions.size() > 0;
+ }
+
+ @Override
+ protected void insertAfter(IContributionManager mgr, String refId, IContributionItem item) {
+ IContributionItem refItem = findInsertionPoint(refId, actionSetId, mgr, true);
+ if (refItem != null) {
+ mgr.insertAfter(refItem.getId(), item);
+ } else {
+ WorkbenchPlugin.log("Reference item " + refId + " not found for action " + item.getId()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ // for dynamic UI
+ protected void revokeContribution(WorkbenchWindow window, IActionBars bars, String id) {
+ revokeActionSetFromMenu(window.getMenuManager(), id);
+ // IMenuManager menuMgr = bars.getMenuManager();
+ // if (menuMgr != null)
+ // revokeActionSetFromMenu(menuMgr, id);
+
+ revokeActionSetFromCoolbar(window.getCoolBarManager2(), id);
+ // IToolBarManager toolBarMgr = bars.getToolBarManager();
+ // if (toolBarMgr != null && toolBarMgr instanceof CoolItemToolBarManager)
+ // revokeActionSetFromToolbar(toolBarMgr, id);
+ }
+
+ // for dynamic UI
+ protected void revokeAdjunctCoolbarAction(ActionDescriptor ad, ActionSetActionBars bars) {
+ String toolBarId = ad.getToolbarId();
// String toolGroupId = ad.getToolbarGroupId();
//
// String contributingId = bars.getActionSetId();
- ICoolBarManager coolBarMgr = bars.getCoolBarManager();
- // ((CoolItemToolBarManager)bars.getToolBarManager()).getParentManager();
- PluginAction action = ad.getAction();
- PluginActionCoolBarContributionItem actionContribution = new PluginActionCoolBarContributionItem(
- action);
- actionContribution.setMode(ad.getMode());
-
- bars.removeAdjunctContribution(actionContribution);
-
- // remove a coolitem for the toolbar id if it exists
- IContributionItem cbItem = coolBarMgr.find(toolBarId);
- if (cbItem != null) {
+ ICoolBarManager coolBarMgr = bars.getCoolBarManager();
+ // ((CoolItemToolBarManager)bars.getToolBarManager()).getParentManager();
+ PluginAction action = ad.getAction();
+ PluginActionCoolBarContributionItem actionContribution = new PluginActionCoolBarContributionItem(action);
+ actionContribution.setMode(ad.getMode());
+
+ bars.removeAdjunctContribution(actionContribution);
+
+ // remove a coolitem for the toolbar id if it exists
+ IContributionItem cbItem = coolBarMgr.find(toolBarId);
+ if (cbItem != null) {
coolBarMgr.remove(cbItem);
}
- // activeManager = cbItem.getToolBarManager();
- // activeManager.remove(contributingId);
- // IContributionItem groupMarker = activeManager.find(toolGroupId);
- // if (groupMarker != null) {
- // int idx = activeManager.indexOf(toolGroupId);
- // IContributionItem[] items = activeManager.getItems();
- // if (items.length == idx+1 ||
- // ((items.length > idx && items[idx+1] instanceof Separator)))
- // if (activeManager.find(toolGroupId) != null)
- // activeManager.remove(toolGroupId);
- // }
- // activeManager.addAdjunctItemToGroup(toolGroupId, contributingId, actionContribution);
- }
-
- //for dynamic UI
- private void revokeActionSetFromMenu(IMenuManager menuMgr,
- String actionsetId) {
- IContributionItem[] items = menuMgr.getItems();
- ArrayList itemsToRemove = new ArrayList();
- String id;
- for (IContributionItem item : items) {
+ // activeManager = cbItem.getToolBarManager();
+ // activeManager.remove(contributingId);
+ // IContributionItem groupMarker = activeManager.find(toolGroupId);
+ // if (groupMarker != null) {
+ // int idx = activeManager.indexOf(toolGroupId);
+ // IContributionItem[] items = activeManager.getItems();
+ // if (items.length == idx+1 ||
+ // ((items.length > idx && items[idx+1] instanceof Separator)))
+ // if (activeManager.find(toolGroupId) != null)
+ // activeManager.remove(toolGroupId);
+ // }
+ // activeManager.addAdjunctItemToGroup(toolGroupId, contributingId,
+ // actionContribution);
+ }
+
+ // for dynamic UI
+ private void revokeActionSetFromMenu(IMenuManager menuMgr, String actionsetId) {
+ IContributionItem[] items = menuMgr.getItems();
+ ArrayList itemsToRemove = new ArrayList();
+ String id;
+ for (IContributionItem item : items) {
if (item instanceof IMenuManager) {
- revokeActionSetFromMenu((IMenuManager) item,
- actionsetId);
- } else if (item instanceof ActionSetContributionItem) {
- id = ((ActionSetContributionItem) item)
- .getActionSetId();
- if (actionsetId.equals(id)) {
+ revokeActionSetFromMenu((IMenuManager) item, actionsetId);
+ } else if (item instanceof ActionSetContributionItem) {
+ id = ((ActionSetContributionItem) item).getActionSetId();
+ if (actionsetId.equals(id)) {
itemsToRemove.add(item);
}
- } else if (item instanceof Separator) {
- id = ((Separator) item).getId();
- if (actionsetId.equals(id)) {
+ } else if (item instanceof Separator) {
+ id = ((Separator) item).getId();
+ if (actionsetId.equals(id)) {
itemsToRemove.add(item);
}
- } else if (item instanceof GroupMarker) {
- id = ((GroupMarker) item).getId();
- if (actionsetId.equals(id)) {
+ } else if (item instanceof GroupMarker) {
+ id = ((GroupMarker) item).getId();
+ if (actionsetId.equals(id)) {
itemsToRemove.add(item);
}
- }
- }
- Iterator iter = itemsToRemove.iterator();
- while (iter.hasNext()) {
- IContributionItem item = (IContributionItem) iter.next();
- menuMgr.remove(item);
- }
- menuMgr.update(true);
- }
-
- // for dynamic UI
- private void revokeActionSetFromCoolbar(ICoolBarManager coolbarMgr,
- String actionsetId) {
- IContributionItem[] items = coolbarMgr.getItems();
- ArrayList itemsToRemove = new ArrayList();
- String id;
- for (IContributionItem item : items) {
- id = item.getId();
- if (actionsetId.equals(id)) {
- itemsToRemove.add(item);
- continue;
- }
- if (item instanceof IToolBarManager) {
- revokeActionSetFromToolbar((IToolBarManager) item,
- actionsetId);
- } else if (item instanceof IToolBarContributionItem) {
- id = ((IToolBarContributionItem) item).getId();
- if (actionsetId.equals(id)) {
+ }
+ }
+ Iterator iter = itemsToRemove.iterator();
+ while (iter.hasNext()) {
+ IContributionItem item = (IContributionItem) iter.next();
+ menuMgr.remove(item);
+ }
+ menuMgr.update(true);
+ }
+
+ // for dynamic UI
+ private void revokeActionSetFromCoolbar(ICoolBarManager coolbarMgr, String actionsetId) {
+ IContributionItem[] items = coolbarMgr.getItems();
+ ArrayList itemsToRemove = new ArrayList();
+ String id;
+ for (IContributionItem item : items) {
+ id = item.getId();
+ if (actionsetId.equals(id)) {
+ itemsToRemove.add(item);
+ continue;
+ }
+ if (item instanceof IToolBarManager) {
+ revokeActionSetFromToolbar((IToolBarManager) item, actionsetId);
+ } else if (item instanceof IToolBarContributionItem) {
+ id = ((IToolBarContributionItem) item).getId();
+ if (actionsetId.equals(id)) {
itemsToRemove.add(item);
}
- } else if (item instanceof GroupMarker) {
- id = ((GroupMarker) item).getId();
- if (actionsetId.equals(id)) {
+ } else if (item instanceof GroupMarker) {
+ id = ((GroupMarker) item).getId();
+ if (actionsetId.equals(id)) {
itemsToRemove.add(item);
}
- }
- }
- Iterator iter = itemsToRemove.iterator();
- while (iter.hasNext()) {
+ }
+ }
+ Iterator iter = itemsToRemove.iterator();
+ while (iter.hasNext()) {
coolbarMgr.remove((IContributionItem) iter.next());
}
- coolbarMgr.update(true);
- }
-
- // for dynamic UI
- private void revokeActionSetFromToolbar(IToolBarManager toolbarMgr,
- String actionsetId) {
- IContributionItem[] items = toolbarMgr.getItems();
- ArrayList itemsToRemove = new ArrayList();
- String id;
- for (IContributionItem item : items) {
- id = item.getId();
- if (id.equals(actionsetId)) {
- itemsToRemove.add(item);
- continue;
- }
- if (item instanceof PluginActionCoolBarContributionItem) {
- id = ((PluginActionCoolBarContributionItem) item)
- .getActionSetId();
- if (actionsetId.equals(id)) {
+ coolbarMgr.update(true);
+ }
+
+ // for dynamic UI
+ private void revokeActionSetFromToolbar(IToolBarManager toolbarMgr, String actionsetId) {
+ IContributionItem[] items = toolbarMgr.getItems();
+ ArrayList itemsToRemove = new ArrayList();
+ String id;
+ for (IContributionItem item : items) {
+ id = item.getId();
+ if (id.equals(actionsetId)) {
+ itemsToRemove.add(item);
+ continue;
+ }
+ if (item instanceof PluginActionCoolBarContributionItem) {
+ id = ((PluginActionCoolBarContributionItem) item).getActionSetId();
+ if (actionsetId.equals(id)) {
itemsToRemove.add(item);
}
- } else if (item instanceof ActionContributionItem) {
- id = ((ActionContributionItem) item).getId();
- if (actionsetId.equals(id)) {
+ } else if (item instanceof ActionContributionItem) {
+ id = ((ActionContributionItem) item).getId();
+ if (actionsetId.equals(id)) {
itemsToRemove.add(item);
}
- } else if (item instanceof GroupMarker) {
- id = ((GroupMarker) item).getId();
- if (actionsetId.equals(id)) {
+ } else if (item instanceof GroupMarker) {
+ id = ((GroupMarker) item).getId();
+ if (actionsetId.equals(id)) {
itemsToRemove.add(item);
}
- }
- }
- Iterator iter = itemsToRemove.iterator();
- while (iter.hasNext()) {
+ }
+ }
+ Iterator iter = itemsToRemove.iterator();
+ while (iter.hasNext()) {
toolbarMgr.remove((IContributionItem) iter.next());
}
- toolbarMgr.update(true);
- }
- }
-
-
- /**
- * Remove the given action set from the window.
- *
- * @param set the set to remove
- * @param window the window to remove from
- */
- protected void removeActionExtensions(PluginActionSet set,
- IWorkbenchWindow window) {
- this.actionSet = set;
- this.window = window;
- currentContribution = null;
- targetID = null;
- targetContributionTag = IWorkbenchRegistryConstants.TAG_ACTION_SET;
- String id = set.getDesc().getId();
-
- if (cache != null) {
- for (int i = 0; i < cache.size(); i++) {
- ActionSetContribution contribution = (ActionSetContribution) cache
- .get(i);
- contribution.revokeContribution((WorkbenchWindow) window,
- actionSet.getBars(), id);
- if (contribution.isAdjunctContributor()) {
- for (int j = 0; j < contribution.adjunctActions.size(); j++) {
- ActionDescriptor adjunctAction = (ActionDescriptor) contribution.adjunctActions
- .get(j);
- contribution.revokeAdjunctCoolbarAction(adjunctAction,
- actionSet.getBars());
- }
- }
- }
- }
- }
+ toolbarMgr.update(true);
+ }
+ }
+
+ /**
+ * Remove the given action set from the window.
+ *
+ * @param set the set to remove
+ * @param window the window to remove from
+ */
+ protected void removeActionExtensions(PluginActionSet set, IWorkbenchWindow window) {
+ this.actionSet = set;
+ this.window = window;
+ currentContribution = null;
+ targetID = null;
+ targetContributionTag = IWorkbenchRegistryConstants.TAG_ACTION_SET;
+ String id = set.getDesc().getId();
+
+ if (cache != null) {
+ for (int i = 0; i < cache.size(); i++) {
+ ActionSetContribution contribution = (ActionSetContribution) cache.get(i);
+ contribution.revokeContribution((WorkbenchWindow) window, actionSet.getBars(), id);
+ if (contribution.isAdjunctContributor()) {
+ for (int j = 0; j < contribution.adjunctActions.size(); j++) {
+ ActionDescriptor adjunctAction = (ActionDescriptor) contribution.adjunctActions.get(j);
+ contribution.revokeAdjunctCoolbarAction(adjunctAction, actionSet.getBars());
+ }
+ }
+ }
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PopupMenuExtender.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PopupMenuExtender.java
index d8f42f7427a..ecb874b3421 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PopupMenuExtender.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PopupMenuExtender.java
@@ -63,35 +63,34 @@ import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants;
/**
* This class extends a single popup menu
*/
-public class PopupMenuExtender implements IMenuListener2,
- IRegistryChangeListener {
+public class PopupMenuExtender implements IMenuListener2, IRegistryChangeListener {
- /**
- * The bit in <code>bitSet</code> that stores whether the static actions
- * have been read from the registry.
- */
- private static final int STATIC_ACTION_READ = 1;
+ /**
+ * The bit in <code>bitSet</code> that stores whether the static actions have
+ * been read from the registry.
+ */
+ private static final int STATIC_ACTION_READ = 1;
- /**
- * The bit in <code>bitSet</code> that stores whether the editor input
- * should be included for the sake of object contributions.
- */
- private static final int INCLUDE_EDITOR_INPUT = 1 << 1;
+ /**
+ * The bit in <code>bitSet</code> that stores whether the editor input should be
+ * included for the sake of object contributions.
+ */
+ private static final int INCLUDE_EDITOR_INPUT = 1 << 1;
- private final MenuManager menu;
+ private final MenuManager menu;
- private SubMenuManager menuWrapper;
+ private SubMenuManager menuWrapper;
- private final ISelectionProvider selProvider;
+ private final ISelectionProvider selProvider;
- private final IWorkbenchPart part;
+ private final IWorkbenchPart part;
private Map<String, ViewerActionBuilder> staticActionBuilders = null;
- /**
- * The boolean properties maintained by this extender. A bit set is used to
- * save memory.
- */
+ /**
+ * The boolean properties maintained by this extender. A bit set is used to save
+ * memory.
+ */
private int bitSet = 0;
private ArrayList<PluginActionContributionItem> actionContributionCache = new ArrayList<>();
@@ -104,45 +103,34 @@ public class PopupMenuExtender implements IMenuListener2,
*/
private IEclipseContext context;
- /**
- * Construct a new menu extender.
- *
- * @param id
- * the menu id
- * @param menu
- * the menu to extend
- * @param prov
- * the selection provider
- * @param part
- * the part to extend
- * @param context
- * the context to create the child popup menu context under
- */
- public PopupMenuExtender(String id, MenuManager menu, ISelectionProvider prov,
- IWorkbenchPart part, IEclipseContext context) {
+ /**
+ * Construct a new menu extender.
+ *
+ * @param id the menu id
+ * @param menu the menu to extend
+ * @param prov the selection provider
+ * @param part the part to extend
+ * @param context the context to create the child popup menu context under
+ */
+ public PopupMenuExtender(String id, MenuManager menu, ISelectionProvider prov, IWorkbenchPart part,
+ IEclipseContext context) {
this(id, menu, prov, part, context, true);
}
- /**
- * Construct a new menu extender.
- *
- * @param id
- * the menu id
- * @param menu
- * the menu to extend
- * @param prov
- * the selection provider
- * @param part
- * the part to extend
- * @param context
- * the context to create the child popup menu context under
- * @param includeEditorInput
- * Whether the editor input should be included when adding object
- * contributions to this context menu.
- */
- public PopupMenuExtender(final String id, final MenuManager menu,
- final ISelectionProvider prov, final IWorkbenchPart part, IEclipseContext context,
- final boolean includeEditorInput) {
+ /**
+ * Construct a new menu extender.
+ *
+ * @param id the menu id
+ * @param menu the menu to extend
+ * @param prov the selection provider
+ * @param part the part to extend
+ * @param context the context to create the child popup menu context
+ * under
+ * @param includeEditorInput Whether the editor input should be included when
+ * adding object contributions to this context menu.
+ */
+ public PopupMenuExtender(final String id, final MenuManager menu, final ISelectionProvider prov,
+ final IWorkbenchPart part, IEclipseContext context, final boolean includeEditorInput) {
super();
this.menu = menu;
this.selProvider = prov;
@@ -169,8 +157,7 @@ public class PopupMenuExtender implements IMenuListener2,
}
menuModel = null;
for (MMenu item : modelPart.getMenus()) {
- if (id.equals(item.getElementId()) && item instanceof MPopupMenu
- && item.getTags().contains("popup")) { //$NON-NLS-1$
+ if (id.equals(item.getElementId()) && item instanceof MPopupMenu && item.getTags().contains("popup")) { //$NON-NLS-1$
menuModel = (MPopupMenu) item;
break;
}
@@ -195,41 +182,40 @@ public class PopupMenuExtender implements IMenuListener2,
MenuService.registerMenu(menu.getMenu().getParent(), menuModel, context);
}
}
+
// getMenuId() added by Dan Rubel (dan_rubel@instantiations.com)
- /**
- * Return the menu identifiers for this extender.
- *
- * @return The set of all identifiers that represent this extender.
- */
+ /**
+ * Return the menu identifiers for this extender.
+ *
+ * @return The set of all identifiers that represent this extender.
+ */
public Set<String> getMenuIds() {
- if (staticActionBuilders == null) {
+ if (staticActionBuilders == null) {
return Collections.emptySet();
- }
-
- return staticActionBuilders.keySet();
- }
-
- /**
- * <p>
- * Adds another menu identifier to this extender. An extender can represent
- * many menu identifiers. These identifiers should represent the same menu
- * manager, selection provider and part. Duplicate identifiers are
- * automatically ignored.
- * </p>
- * <p>
- * For example, it is necessary to filter out duplicate identifiers for
- * <code>CompilationUnitEditor</code> instances, as these define both
- * <code>"#CompilationUnitEditorContext"</code> and
- * <code>"org.eclipse.jdt.ui.CompilationUnitEditor.EditorContext"</code>
- * as menu identifier for the same pop-up menu. We don't want to contribute
- * duplicate items in this case.
- * </p>
- *
- * @param menuId
- * The menu identifier to add to this extender; should not be
- * <code>null</code>.
- */
- public final void addMenuId(final String menuId) {
+ }
+
+ return staticActionBuilders.keySet();
+ }
+
+ /**
+ * <p>
+ * Adds another menu identifier to this extender. An extender can represent many
+ * menu identifiers. These identifiers should represent the same menu manager,
+ * selection provider and part. Duplicate identifiers are automatically ignored.
+ * </p>
+ * <p>
+ * For example, it is necessary to filter out duplicate identifiers for
+ * <code>CompilationUnitEditor</code> instances, as these define both
+ * <code>"#CompilationUnitEditorContext"</code> and
+ * <code>"org.eclipse.jdt.ui.CompilationUnitEditor.EditorContext"</code> as menu
+ * identifier for the same pop-up menu. We don't want to contribute duplicate
+ * items in this case.
+ * </p>
+ *
+ * @param menuId The menu identifier to add to this extender; should not be
+ * <code>null</code>.
+ */
+ public final void addMenuId(final String menuId) {
bitSet &= ~STATIC_ACTION_READ;
if (menuModel != null) {
List<String> tags = menuModel.getTags();
@@ -241,97 +227,83 @@ public class PopupMenuExtender implements IMenuListener2,
readStaticActionsFor(menuId);
}
- /**
- * Determines whether this extender would be the same as another extender
- * created with the given values. Two extenders are equivalent if they have
- * the same menu manager, selection provider and part (i.e., if the menu
- * they represent is about to show, they would populate it with duplicate
- * values).
- *
- * @param menuManager
- * The menu manager with which to compare; may be
- * <code>null</code>.
- * @param selectionProvider
- * The selection provider with which to compare; may be
- * <code>null</code>.
- * @param part
- * The part with which to compare; may be <code>null</code>.
- * @return <code>true</code> if the menu manager, selection provider and
- * part are all the same.
- */
- public final boolean matches(final MenuManager menuManager,
- final ISelectionProvider selectionProvider,
- final IWorkbenchPart part) {
- return (this.menu == menuManager)
- && (this.selProvider == selectionProvider)
- && (this.part == part);
- }
-
- /**
- * Contributes items registered for the currently active editor.
- */
+ /**
+ * Determines whether this extender would be the same as another extender
+ * created with the given values. Two extenders are equivalent if they have the
+ * same menu manager, selection provider and part (i.e., if the menu they
+ * represent is about to show, they would populate it with duplicate values).
+ *
+ * @param menuManager The menu manager with which to compare; may be
+ * <code>null</code>.
+ * @param selectionProvider The selection provider with which to compare; may be
+ * <code>null</code>.
+ * @param part The part with which to compare; may be
+ * <code>null</code>.
+ * @return <code>true</code> if the menu manager, selection provider and part
+ * are all the same.
+ */
+ public final boolean matches(final MenuManager menuManager, final ISelectionProvider selectionProvider,
+ final IWorkbenchPart part) {
+ return (this.menu == menuManager) && (this.selProvider == selectionProvider) && (this.part == part);
+ }
+
+ /**
+ * Contributes items registered for the currently active editor.
+ */
private void addEditorActions(IMenuManager mgr, Set<IObjectActionContributor> alreadyContributed) {
- ISelectionProvider activeEditor = new ISelectionProvider() {
+ ISelectionProvider activeEditor = new ISelectionProvider() {
- @Override
- public void addSelectionChangedListener(
- ISelectionChangedListener listener) {
- throw new UnsupportedOperationException(
- "This ISelectionProvider is static, and cannot be modified."); //$NON-NLS-1$
- }
+ @Override
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {
+ throw new UnsupportedOperationException("This ISelectionProvider is static, and cannot be modified."); //$NON-NLS-1$
+ }
- @Override
+ @Override
public ISelection getSelection() {
- if (part instanceof IEditorPart) {
- final IEditorPart editorPart = (IEditorPart) part;
- return new StructuredSelection(new Object[] { editorPart
- .getEditorInput() });
- }
-
- return new StructuredSelection(new Object[0]);
- }
-
- @Override
- public void removeSelectionChangedListener(
- ISelectionChangedListener listener) {
- throw new UnsupportedOperationException(
- "This ISelectionProvider is static, and cannot be modified."); //$NON-NLS-1$
- }
-
- @Override
+ if (part instanceof IEditorPart) {
+ final IEditorPart editorPart = (IEditorPart) part;
+ return new StructuredSelection(new Object[] { editorPart.getEditorInput() });
+ }
+
+ return new StructuredSelection(new Object[0]);
+ }
+
+ @Override
+ public void removeSelectionChangedListener(ISelectionChangedListener listener) {
+ throw new UnsupportedOperationException("This ISelectionProvider is static, and cannot be modified."); //$NON-NLS-1$
+ }
+
+ @Override
public void setSelection(ISelection selection) {
- throw new UnsupportedOperationException(
- "This ISelectionProvider is static, and cannot be modified."); //$NON-NLS-1$
- }
- };
+ throw new UnsupportedOperationException("This ISelectionProvider is static, and cannot be modified."); //$NON-NLS-1$
+ }
+ };
- if (ObjectActionContributorManager.getManager().contributeObjectActions(part, mgr,
- activeEditor, alreadyContributed)) {
+ if (ObjectActionContributorManager.getManager().contributeObjectActions(part, mgr, activeEditor,
+ alreadyContributed)) {
mgr.add(new Separator());
}
- }
+ }
- /**
- * Contributes items registered for the object type(s) in
- * the current selection.
- */
+ /**
+ * Contributes items registered for the object type(s) in the current selection.
+ */
private void addObjectActions(IMenuManager mgr, Set<IObjectActionContributor> alreadyContributed) {
- if (selProvider != null) {
- if (ObjectActionContributorManager.getManager().contributeObjectActions(part, mgr,
- selProvider, alreadyContributed)) {
+ if (selProvider != null) {
+ if (ObjectActionContributorManager.getManager().contributeObjectActions(part, mgr, selProvider,
+ alreadyContributed)) {
mgr.add(new Separator());
- }
- }
- }
-
- /**
- * Disposes all of the static actions.
- */
- private final void clearStaticActions() {
+ }
+ }
+ }
+
+ /**
+ * Disposes all of the static actions.
+ */
+ private final void clearStaticActions() {
bitSet &= ~STATIC_ACTION_READ;
if (staticActionBuilders != null) {
- final Iterator<ViewerActionBuilder> staticActionBuilderItr = staticActionBuilders
- .values().iterator();
+ final Iterator<ViewerActionBuilder> staticActionBuilderItr = staticActionBuilders.values().iterator();
while (staticActionBuilderItr.hasNext()) {
final ViewerActionBuilder staticActionBuilder = staticActionBuilderItr.next();
staticActionBuilder.dispose();
@@ -339,13 +311,12 @@ public class PopupMenuExtender implements IMenuListener2,
}
}
- /**
- * Adds static items to the context menu.
- */
- private void addStaticActions(IMenuManager mgr) {
+ /**
+ * Adds static items to the context menu.
+ */
+ private void addStaticActions(IMenuManager mgr) {
if (staticActionBuilders != null) {
- final Iterator<ViewerActionBuilder> staticActionBuilderItr = staticActionBuilders
- .values().iterator();
+ final Iterator<ViewerActionBuilder> staticActionBuilderItr = staticActionBuilders.values().iterator();
while (staticActionBuilderItr.hasNext()) {
final ViewerActionBuilder staticActionBuilder = staticActionBuilderItr.next();
staticActionBuilder.contribute(mgr, null, true);
@@ -353,18 +324,17 @@ public class PopupMenuExtender implements IMenuListener2,
}
}
- /**
- * Notifies the listener that the menu is about to be shown.
- */
- @Override
+ /**
+ * Notifies the listener that the menu is about to be shown.
+ */
+ @Override
public void menuAboutToShow(IMenuManager mgr) {
registerE4Support();
- // Add this menu as a visible menu.
- final IWorkbenchPartSite site = part.getSite();
- if (site != null) {
- final IWorkbench workbench = site.getWorkbenchWindow()
- .getWorkbench();
+ // Add this menu as a visible menu.
+ final IWorkbenchPartSite site = part.getSite();
+ if (site != null) {
+ final IWorkbench workbench = site.getWorkbenchWindow().getWorkbench();
if (workbench instanceof Workbench) {
final Workbench realWorkbench = (Workbench) workbench;
runCleanUp(realWorkbench);
@@ -372,32 +342,29 @@ public class PopupMenuExtender implements IMenuListener2,
if ((bitSet & INCLUDE_EDITOR_INPUT) != 0) {
if (part instanceof IEditorPart) {
final IEditorPart editorPart = (IEditorPart) part;
- input = new StructuredSelection(
- new Object[] { editorPart.getEditorInput() });
+ input = new StructuredSelection(new Object[] { editorPart.getEditorInput() });
}
}
- ISelection s = (selProvider == null ? null : selProvider
- .getSelection());
+ ISelection s = (selProvider == null ? null : selProvider.getSelection());
realWorkbench.addShowingMenus(getMenuIds(), s, input);
}
}
addMenuContributions(mgr);
- readStaticActions();
- // test for additions removed to comply with menu contributions
- if (menuWrapper != null) {
- mgr = menuWrapper;
- menuWrapper.removeAll();
- }
+ readStaticActions();
+ // test for additions removed to comply with menu contributions
+ if (menuWrapper != null) {
+ mgr = menuWrapper;
+ menuWrapper.removeAll();
+ }
Set<IObjectActionContributor> contributedItems = new HashSet<>();
- if ((bitSet & INCLUDE_EDITOR_INPUT) != 0) {
+ if ((bitSet & INCLUDE_EDITOR_INPUT) != 0) {
addEditorActions(mgr, contributedItems);
- }
+ }
addObjectActions(mgr, contributedItems);
- addStaticActions(mgr);
- }
-
+ addStaticActions(mgr);
+ }
/**
* well, this goes to the renderer.
@@ -418,29 +385,29 @@ public class PopupMenuExtender implements IMenuListener2,
private MPopupMenu menuModel;
- /**
+ /**
* Notifies the listener that the menu is about to be hidden.
*/
- @Override
+ @Override
public final void menuAboutToHide(final IMenuManager mgr) {
- gatherContributions(mgr);
+ gatherContributions(mgr);
cleanupNeeded = true;
- // Remove this menu as a visible menu.
- final IWorkbenchPartSite site = part.getSite();
- if (site != null) {
- final IWorkbench workbench = site.getWorkbenchWindow().getWorkbench();
- if (workbench instanceof Workbench) {
- // try delaying this until after the selection event
- // has been fired.
- // This is less threatening if the popup: menu
- // contributions aren't tied to the evaluation service
+ // Remove this menu as a visible menu.
+ final IWorkbenchPartSite site = part.getSite();
+ if (site != null) {
+ final IWorkbench workbench = site.getWorkbenchWindow().getWorkbench();
+ if (workbench instanceof Workbench) {
+ // try delaying this until after the selection event
+ // has been fired.
+ // This is less threatening if the popup: menu
+ // contributions aren't tied to the evaluation service
workbench.getDisplay().asyncExec(() -> {
final Workbench realWorkbench = (Workbench) workbench;
runCleanUp(realWorkbench);
});
}
- }
- }
+ }
+ }
private void runCleanUp(Workbench realWorkbench) {
if (!cleanupNeeded) {
@@ -489,22 +456,22 @@ public class PopupMenuExtender implements IMenuListener2,
}
/**
- * Read all of the static items for the content menu.
- */
- private final void readStaticActions() {
- if (staticActionBuilders != null) {
+ * Read all of the static items for the content menu.
+ */
+ private final void readStaticActions() {
+ if (staticActionBuilders != null) {
final Iterator<String> menuIdItr = staticActionBuilders.keySet().iterator();
while (menuIdItr.hasNext()) {
final String menuId = menuIdItr.next();
readStaticActionsFor(menuId);
}
}
- }
+ }
- /**
+ /**
* Read static items for a particular menu id, into the context menu.
*/
- private void readStaticActionsFor(final String menuId) {
+ private void readStaticActionsFor(final String menuId) {
if ((bitSet & STATIC_ACTION_READ) != 0) {
return;
}
@@ -529,11 +496,11 @@ public class PopupMenuExtender implements IMenuListener2,
builder.readViewerContributions(menuId, selProvider, part);
}
- /**
- * Dispose of the menu extender. Should only be called when the part
- * is disposed.
- */
- public void dispose() {
+ /**
+ * Dispose of the menu extender. Should only be called when the part is
+ * disposed.
+ */
+ public void dispose() {
clearStaticActions();
Platform.getExtensionRegistry().removeRegistryChangeListener(this);
menu.removeMenuListener(this);
@@ -555,11 +522,9 @@ public class PopupMenuExtender implements IMenuListener2,
/**
* Unlink all contribution items from the given model menu.
*
- * @param renderer
- * the renderer that is holding the links
- * @param menu
- * the model menu whose children should have its items unlinked
- * from their corresponding contribution items
+ * @param renderer the renderer that is holding the links
+ * @param menu the model menu whose children should have its items unlinked
+ * from their corresponding contribution items
*/
private void unlink(MenuManagerRenderer renderer, MMenu menu) {
for (MMenuElement menuElement : menu.getChildren()) {
@@ -592,16 +557,16 @@ public class PopupMenuExtender implements IMenuListener2,
if (part != null) {
display = part.getSite().getPage().getWorkbenchWindow().getWorkbench().getDisplay();
}
- //check the delta to see if there are any viewer contribution changes. if so, null our builder to cause reparsing on the next menu show
- IExtensionDelta [] deltas = event.getExtensionDeltas();
+ // check the delta to see if there are any viewer contribution changes. if so,
+ // null our builder to cause reparsing on the next menu show
+ IExtensionDelta[] deltas = event.getExtensionDeltas();
for (IExtensionDelta delta : deltas) {
IExtensionPoint extensionPoint = delta.getExtensionPoint();
if (extensionPoint.getContributor().getName().equals(WorkbenchPlugin.PI_WORKBENCH)
- && extensionPoint.getSimpleIdentifier().equals(
- IWorkbenchRegistryConstants.PL_POPUP_MENU)) {
+ && extensionPoint.getSimpleIdentifier().equals(IWorkbenchRegistryConstants.PL_POPUP_MENU)) {
boolean clearPopups = false;
- IConfigurationElement [] elements = delta.getExtension().getConfigurationElements();
+ IConfigurationElement[] elements = delta.getExtension().getConfigurationElements();
for (IConfigurationElement element : elements) {
if (element.getName().equals(IWorkbenchRegistryConstants.TAG_VIEWER_CONTRIBUTION)) {
clearPopups = true;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ProductInfo.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ProductInfo.java
index 8ea39486752..29f42e814ab 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ProductInfo.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ProductInfo.java
@@ -17,100 +17,101 @@ import org.eclipse.core.runtime.IProduct;
import org.eclipse.jface.resource.ImageDescriptor;
/**
- * Stores information about the product. This class replaces the old AboutInfo.
+ * Stores information about the product. This class replaces the old AboutInfo.
* The product information is available as strings, but is needed as URLs, etc.
* This class manages that translation.
+ *
* @since 3.0
*/
public class ProductInfo {
- private IProduct product;
+ private IProduct product;
- private String productName;
+ private String productName;
- private String appName;
+ private String appName;
- private ImageDescriptor[] windowImages;
+ private ImageDescriptor[] windowImages;
- private ImageDescriptor aboutImage;
+ private ImageDescriptor aboutImage;
- private String aboutText;
+ private String aboutText;
- public ProductInfo(IProduct product) {
- this.product = product;
- }
+ public ProductInfo(IProduct product) {
+ this.product = product;
+ }
- /**
- * Returns the product name or <code>null</code>.
- * This is shown in the window title and the About action.
- *
- * @return the product name, or <code>null</code>
- */
- public String getProductName() {
- if (productName == null && product != null) {
+ /**
+ * Returns the product name or <code>null</code>. This is shown in the window
+ * title and the About action.
+ *
+ * @return the product name, or <code>null</code>
+ */
+ public String getProductName() {
+ if (productName == null && product != null) {
productName = product.getName();
}
- return productName;
- }
+ return productName;
+ }
- /**
- * Returns the application name or <code>null</code>. Note this is never
- * shown to the user. It is used to initialize the SWT Display.
- * <p>
- * On Motif, for example, this can be used to set the name used
- * for resource lookup.
- * </p>
- *
- * @return the application name, or <code>null</code>
- *
- * @see org.eclipse.swt.widgets.Display#setAppName
- */
- public String getAppName() {
- if (appName == null && product != null) {
+ /**
+ * Returns the application name or <code>null</code>. Note this is never shown
+ * to the user. It is used to initialize the SWT Display.
+ * <p>
+ * On Motif, for example, this can be used to set the name used for resource
+ * lookup.
+ * </p>
+ *
+ * @return the application name, or <code>null</code>
+ *
+ * @see org.eclipse.swt.widgets.Display#setAppName
+ */
+ public String getAppName() {
+ if (appName == null && product != null) {
appName = ProductProperties.getAppName(product);
}
- return appName;
- }
+ return appName;
+ }
- /**
- * Returns the descriptor for an image which can be shown in an "about" dialog
- * for this product. Products designed to run "headless" typically would not
- * have such an image.
- *
- * @return the descriptor for an about image, or <code>null</code> if none
- */
- public ImageDescriptor getAboutImage() {
- if (aboutImage == null && product != null) {
+ /**
+ * Returns the descriptor for an image which can be shown in an "about" dialog
+ * for this product. Products designed to run "headless" typically would not
+ * have such an image.
+ *
+ * @return the descriptor for an about image, or <code>null</code> if none
+ */
+ public ImageDescriptor getAboutImage() {
+ if (aboutImage == null && product != null) {
aboutImage = ProductProperties.getAboutImage(product);
}
- return aboutImage;
- }
+ return aboutImage;
+ }
- /**
- * Return an array of image descriptors for the window images to use for
- * this product. The expectations is that the elements will be the same
- * image rendered at different sizes. Products designed to run "headless"
- * typically would not have such images.
- *
- * @return an array of the image descriptors for the window images, or
- * <code>null</code> if none
- */
- public ImageDescriptor[] getWindowImages() {
- if (windowImages == null && product != null) {
+ /**
+ * Return an array of image descriptors for the window images to use for this
+ * product. The expectations is that the elements will be the same image
+ * rendered at different sizes. Products designed to run "headless" typically
+ * would not have such images.
+ *
+ * @return an array of the image descriptors for the window images, or
+ * <code>null</code> if none
+ */
+ public ImageDescriptor[] getWindowImages() {
+ if (windowImages == null && product != null) {
windowImages = ProductProperties.getWindowImages(product);
}
- return windowImages;
- }
+ return windowImages;
+ }
- /**
- * Returns the text to show in an "about" dialog for this product.
- * Products designed to run "headless" typically would not have such text.
- *
- * @return the about text, or <code>null</code> if none
- */
- public String getAboutText() {
- if (aboutText == null && product != null) {
+ /**
+ * Returns the text to show in an "about" dialog for this product. Products
+ * designed to run "headless" typically would not have such text.
+ *
+ * @return the about text, or <code>null</code> if none
+ */
+ public String getAboutText() {
+ if (aboutText == null && product != null) {
aboutText = ProductProperties.getAboutText(product);
}
- return aboutText;
- }
+ return aboutText;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ProductProperties.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ProductProperties.java
index d639c9815d8..d7b1c4e5c24 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ProductProperties.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ProductProperties.java
@@ -30,320 +30,309 @@ import org.osgi.framework.Bundle;
/**
* A class that converts the strings returned by
- * <code>org.eclipse.core.runtime.IProduct.getProperty</code> to the
- * appropriate class. This implementation is tightly bound to the properties
- * provided in IProductConstants. Clients adding their own properties could
- * choose to subclass this.
+ * <code>org.eclipse.core.runtime.IProduct.getProperty</code> to the appropriate
+ * class. This implementation is tightly bound to the properties provided in
+ * IProductConstants. Clients adding their own properties could choose to
+ * subclass this.
*
* @see org.eclipse.ui.branding.IProductConstants
* @since 3.0
*/
-public class ProductProperties extends BrandingProperties implements
- IProductConstants {
+public class ProductProperties extends BrandingProperties implements IProductConstants {
- private final IProduct product;
+ private final IProduct product;
- private String appName;
+ private String appName;
- private String aboutText;
+ private String aboutText;
- private ImageDescriptor aboutImageDescriptor;
+ private ImageDescriptor aboutImageDescriptor;
- private ImageDescriptor[] windowImageDescriptors;
+ private ImageDescriptor[] windowImageDescriptors;
- private URL welcomePageUrl;
+ private URL welcomePageUrl;
- private String productName;
+ private String productName;
- private String productId;
+ private String productId;
- private static final String ABOUT_MAPPINGS = "$nl$/about.mappings"; //$NON-NLS-1$
+ private static final String ABOUT_MAPPINGS = "$nl$/about.mappings"; //$NON-NLS-1$
- private static HashMap mappingsMap = new HashMap(4);
+ private static HashMap mappingsMap = new HashMap(4);
- private static String[] loadMappings(Bundle definingBundle) {
- URL location = FileLocator.find(definingBundle, new Path(
- ABOUT_MAPPINGS));
- PropertyResourceBundle bundle = null;
- InputStream is;
- if (location != null) {
- is = null;
- try {
- is = location.openStream();
- bundle = new PropertyResourceBundle(is);
- } catch (IOException e) {
- bundle = null;
- } finally {
- try {
- if (is != null) {
+ private static String[] loadMappings(Bundle definingBundle) {
+ URL location = FileLocator.find(definingBundle, new Path(ABOUT_MAPPINGS));
+ PropertyResourceBundle bundle = null;
+ InputStream is;
+ if (location != null) {
+ is = null;
+ try {
+ is = location.openStream();
+ bundle = new PropertyResourceBundle(is);
+ } catch (IOException e) {
+ bundle = null;
+ } finally {
+ try {
+ if (is != null) {
is.close();
}
- } catch (IOException e) {
- // do nothing if we fail to close
- }
- }
- }
-
- ArrayList mappingsList = new ArrayList();
- if (bundle != null) {
- boolean found = true;
- int i = 0;
- while (found) {
- try {
- mappingsList.add(bundle.getString(Integer.toString(i)));
- } catch (MissingResourceException e) {
- found = false;
- }
- i++;
- }
- }
- String[] mappings = (String[]) mappingsList.toArray(new String[mappingsList.size()]);
- mappingsMap.put(definingBundle, mappings);
- return mappings;
- }
-
- private static String[] getMappings(Bundle definingBundle) {
- String[] mappings = (String[]) mappingsMap.get(definingBundle);
- if (mappings == null) {
- mappings = loadMappings(definingBundle);
- }
- if (mappings == null) {
- mappings = new String[0];
- }
- return mappings;
- }
-
- /**
- * This instance will return properties from the given product. The properties are
- * retrieved in a lazy fashion and cached for later retrieval.
- * @param product must not be null
- */
- public ProductProperties(IProduct product) {
- if (product == null) {
+ } catch (IOException e) {
+ // do nothing if we fail to close
+ }
+ }
+ }
+
+ ArrayList mappingsList = new ArrayList();
+ if (bundle != null) {
+ boolean found = true;
+ int i = 0;
+ while (found) {
+ try {
+ mappingsList.add(bundle.getString(Integer.toString(i)));
+ } catch (MissingResourceException e) {
+ found = false;
+ }
+ i++;
+ }
+ }
+ String[] mappings = (String[]) mappingsList.toArray(new String[mappingsList.size()]);
+ mappingsMap.put(definingBundle, mappings);
+ return mappings;
+ }
+
+ private static String[] getMappings(Bundle definingBundle) {
+ String[] mappings = (String[]) mappingsMap.get(definingBundle);
+ if (mappings == null) {
+ mappings = loadMappings(definingBundle);
+ }
+ if (mappings == null) {
+ mappings = new String[0];
+ }
+ return mappings;
+ }
+
+ /**
+ * This instance will return properties from the given product. The properties
+ * are retrieved in a lazy fashion and cached for later retrieval.
+ *
+ * @param product must not be null
+ */
+ public ProductProperties(IProduct product) {
+ if (product == null) {
throw new IllegalArgumentException();
}
- this.product = product;
- }
-
- /**
- * The application name, used to initialize the SWT Display. This
- * value is distinct from the string displayed in the application
- * title bar.
- * <p>
- * E.g., On motif, this can be used to set the name used for
- * resource lookup.
- * </p>
- * @see org.eclipse.swt.widgets.Display#setAppName
- */
- public String getAppName() {
- if (appName == null) {
+ this.product = product;
+ }
+
+ /**
+ * The application name, used to initialize the SWT Display. This value is
+ * distinct from the string displayed in the application title bar.
+ * <p>
+ * E.g., On motif, this can be used to set the name used for resource lookup.
+ * </p>
+ *
+ * @see org.eclipse.swt.widgets.Display#setAppName
+ */
+ public String getAppName() {
+ if (appName == null) {
appName = getAppName(product);
}
- return appName;
- }
-
- /**
- * The text to show in an "about" dialog for this product.
- * Products designed to run "headless" typically would not
- * have such text.
- */
- public String getAboutText() {
- if (aboutText == null) {
+ return appName;
+ }
+
+ /**
+ * The text to show in an "about" dialog for this product. Products designed to
+ * run "headless" typically would not have such text.
+ */
+ public String getAboutText() {
+ if (aboutText == null) {
aboutText = getAboutText(product);
}
- return aboutText;
- }
-
- /**
- * An image which can be shown in an "about" dialog for this
- * product. Products designed to run "headless" typically would not
- * have such an image.
- * <p>
- * A full-sized product image (no larger than 500x330 pixels) is
- * shown without the "aboutText" blurb. A half-sized product image
- * (no larger than 250x330 pixels) is shown with the "aboutText"
- * blurb beside it.
- */
- public ImageDescriptor getAboutImage() {
- if (aboutImageDescriptor == null) {
+ return aboutText;
+ }
+
+ /**
+ * An image which can be shown in an "about" dialog for this product. Products
+ * designed to run "headless" typically would not have such an image.
+ * <p>
+ * A full-sized product image (no larger than 500x330 pixels) is shown without
+ * the "aboutText" blurb. A half-sized product image (no larger than 250x330
+ * pixels) is shown with the "aboutText" blurb beside it.
+ */
+ public ImageDescriptor getAboutImage() {
+ if (aboutImageDescriptor == null) {
aboutImageDescriptor = getAboutImage(product);
}
- return aboutImageDescriptor;
- }
-
- /**
- * An array of one or more images to be used for this product. The
- * expectation is that the array will contain the same image rendered
- * at different sizes (16x16 and 32x32).
- * Products designed to run "headless" typically would not have such images.
- * <p>
- * If this property is given, then it supercedes <code>WINDOW_IMAGE</code>.
- * </p>
- */
- public ImageDescriptor[] getWindowImages() {
- if (windowImageDescriptors == null) {
+ return aboutImageDescriptor;
+ }
+
+ /**
+ * An array of one or more images to be used for this product. The expectation
+ * is that the array will contain the same image rendered at different sizes
+ * (16x16 and 32x32). Products designed to run "headless" typically would not
+ * have such images.
+ * <p>
+ * If this property is given, then it supercedes <code>WINDOW_IMAGE</code>.
+ * </p>
+ */
+ public ImageDescriptor[] getWindowImages() {
+ if (windowImageDescriptors == null) {
windowImageDescriptors = getWindowImages(product);
}
- return windowImageDescriptors;
- }
-
- /**
- * Location of the product's welcome page (special XML-based format), either
- * a fully qualified valid URL or a path relative to the product's defining
- * bundle. Products designed to run "headless" typically would not have such
- * a page. Use of this property is discouraged in 3.0, the new
- * org.eclipse.ui.intro extension point should be used instead.
- */
- public URL getWelcomePageUrl() {
- if (welcomePageUrl == null) {
+ return windowImageDescriptors;
+ }
+
+ /**
+ * Location of the product's welcome page (special XML-based format), either a
+ * fully qualified valid URL or a path relative to the product's defining
+ * bundle. Products designed to run "headless" typically would not have such a
+ * page. Use of this property is discouraged in 3.0, the new
+ * org.eclipse.ui.intro extension point should be used instead.
+ */
+ public URL getWelcomePageUrl() {
+ if (welcomePageUrl == null) {
welcomePageUrl = getWelcomePageUrl(product);
}
- return welcomePageUrl;
- }
-
- /**
- * Returns the product name or <code>null</code>.
- * This is shown in the window title and the About action.
- */
- public String getProductName() {
- if (productName == null) {
+ return welcomePageUrl;
+ }
+
+ /**
+ * Returns the product name or <code>null</code>. This is shown in the window
+ * title and the About action.
+ */
+ public String getProductName() {
+ if (productName == null) {
productName = getProductName(product);
}
- return productName;
- }
-
- /**
- * Returns the id for the product or <code>null</code> if none.
- */
- public String getProductId() {
- if (productId == null) {
+ return productName;
+ }
+
+ /**
+ * Returns the id for the product or <code>null</code> if none.
+ */
+ public String getProductId() {
+ if (productId == null) {
productId = getProductId(product);
}
- return productId;
- }
-
- /**
- * The application name, used to initialize the SWT Display. This
- * value is distinct from the string displayed in the application
- * title bar.
- * <p>
- * E.g., On motif, this can be used to set the name used for
- * resource lookup.
- * </p>
- * <p>
- * The returned value will have {n} values substituted based on the
- * current product's mappings regardless of the given product argument.
- * </p>
- * @see org.eclipse.swt.widgets.Display#setAppName
- */
- public static String getAppName(IProduct product) {
- String property = product.getProperty(APP_NAME);
- if (property == null) {
+ return productId;
+ }
+
+ /**
+ * The application name, used to initialize the SWT Display. This value is
+ * distinct from the string displayed in the application title bar.
+ * <p>
+ * E.g., On motif, this can be used to set the name used for resource lookup.
+ * </p>
+ * <p>
+ * The returned value will have {n} values substituted based on the current
+ * product's mappings regardless of the given product argument.
+ * </p>
+ *
+ * @see org.eclipse.swt.widgets.Display#setAppName
+ */
+ public static String getAppName(IProduct product) {
+ String property = product.getProperty(APP_NAME);
+ if (property == null) {
return ""; //$NON-NLS-1$
}
- if (property.indexOf('{') == -1) {
+ if (property.indexOf('{') == -1) {
return property;
}
- String[] mappings = getMappings(product.getDefiningBundle());
+ String[] mappings = getMappings(product.getDefiningBundle());
return MessageFormat.format(property, (Object[]) mappings);
- }
-
- /**
- * The text to show in an "about" dialog for this product.
- * Products designed to run "headless" typically would not
- * have such text.
- * <p>
- * The returned value will have {n} values substituted based on the
- * current product's mappings regardless of the given product argument.
- * </p>
- */
- public static String getAboutText(IProduct product) {
- String property = product.getProperty(ABOUT_TEXT);
- if (property == null) {
+ }
+
+ /**
+ * The text to show in an "about" dialog for this product. Products designed to
+ * run "headless" typically would not have such text.
+ * <p>
+ * The returned value will have {n} values substituted based on the current
+ * product's mappings regardless of the given product argument.
+ * </p>
+ */
+ public static String getAboutText(IProduct product) {
+ String property = product.getProperty(ABOUT_TEXT);
+ if (property == null) {
return ""; //$NON-NLS-1$
}
- if (property.indexOf('{') == -1) {
+ if (property.indexOf('{') == -1) {
return property;
}
- String[] tempMappings = getMappings(product.getDefiningBundle());
- /*
- * Check if the mapping value is a system property, specified
- * by '$' at the beginning and end of the string. If so, update
- * the mappings array with the system property value.
- */
- for (int i=0; i<tempMappings.length; i++) {
- String nextString = tempMappings[i];
- int length = nextString.length();
-
- if (length > 2 && nextString.charAt(0) == '$' && nextString.charAt(length-1) == '$') {
- String systemPropertyKey = nextString.substring(1, length-1);
- // If system property is not set, insert an empty String
- tempMappings[i] = System.getProperty(systemPropertyKey, ""); //$NON-NLS-1$;
- }
- }
+ String[] tempMappings = getMappings(product.getDefiningBundle());
+ /*
+ * Check if the mapping value is a system property, specified by '$' at the
+ * beginning and end of the string. If so, update the mappings array with the
+ * system property value.
+ */
+ for (int i = 0; i < tempMappings.length; i++) {
+ String nextString = tempMappings[i];
+ int length = nextString.length();
+
+ if (length > 2 && nextString.charAt(0) == '$' && nextString.charAt(length - 1) == '$') {
+ String systemPropertyKey = nextString.substring(1, length - 1);
+ // If system property is not set, insert an empty String
+ tempMappings[i] = System.getProperty(systemPropertyKey, ""); //$NON-NLS-1$ ;
+ }
+ }
return MessageFormat.format(property, (Object[]) tempMappings);
- }
-
- /**
- * An image which can be shown in an "about" dialog for this
- * product. Products designed to run "headless" typically would not
- * have such an image.
- * <p>
- * A full-sized product image (no larger than 500x330 pixels) is
- * shown without the "aboutText" blurb. A half-sized product image
- * (no larger than 250x330 pixels) is shown with the "aboutText"
- * blurb beside it.
- */
- public static ImageDescriptor getAboutImage(IProduct product) {
- return getImage(product.getProperty(ABOUT_IMAGE), product
- .getDefiningBundle());
- }
-
- /**
- * An array of one or more images to be used for this product. The
- * expectation is that the array will contain the same image rendered
- * at different sizes (16x16 and 32x32).
- * Products designed to run "headless" typically would not have such images.
- * <p>
- * If this property is given, then it supercedes <code>WINDOW_IMAGE</code>.
- * </p>
- */
- public static ImageDescriptor[] getWindowImages(IProduct product) {
- String property = product.getProperty(WINDOW_IMAGES);
-
- // for compatibility with pre-3.0 plugins that may still use WINDOW_IMAGE
- if (property == null) {
+ }
+
+ /**
+ * An image which can be shown in an "about" dialog for this product. Products
+ * designed to run "headless" typically would not have such an image.
+ * <p>
+ * A full-sized product image (no larger than 500x330 pixels) is shown without
+ * the "aboutText" blurb. A half-sized product image (no larger than 250x330
+ * pixels) is shown with the "aboutText" blurb beside it.
+ */
+ public static ImageDescriptor getAboutImage(IProduct product) {
+ return getImage(product.getProperty(ABOUT_IMAGE), product.getDefiningBundle());
+ }
+
+ /**
+ * An array of one or more images to be used for this product. The expectation
+ * is that the array will contain the same image rendered at different sizes
+ * (16x16 and 32x32). Products designed to run "headless" typically would not
+ * have such images.
+ * <p>
+ * If this property is given, then it supercedes <code>WINDOW_IMAGE</code>.
+ * </p>
+ */
+ public static ImageDescriptor[] getWindowImages(IProduct product) {
+ String property = product.getProperty(WINDOW_IMAGES);
+
+ // for compatibility with pre-3.0 plugins that may still use WINDOW_IMAGE
+ if (property == null) {
property = product.getProperty(WINDOW_IMAGE);
}
- return getImages(property, product.getDefiningBundle());
- }
-
- /**
- * Location of the product's welcome page (special XML-based format), either
- * a fully qualified valid URL or a path relative to the product's defining
- * bundle. Products designed to run "headless" typically would not have such
- * a page. Use of this property is discouraged in 3.0, the new
- * org.eclipse.ui.intro extension point should be used instead.
- */
- public static URL getWelcomePageUrl(IProduct product) {
- return getUrl(product.getProperty(WELCOME_PAGE), product
- .getDefiningBundle());
- }
-
- /**
- * Returns the product name or <code>null</code>.
- * This is shown in the window title and the About action.
- */
- public static String getProductName(IProduct product) {
- return product.getName();
- }
-
- /**
- * Returns the id for the product.
- */
- public static String getProductId(IProduct product) {
- return product.getId();
- }
+ return getImages(property, product.getDefiningBundle());
+ }
+
+ /**
+ * Location of the product's welcome page (special XML-based format), either a
+ * fully qualified valid URL or a path relative to the product's defining
+ * bundle. Products designed to run "headless" typically would not have such a
+ * page. Use of this property is discouraged in 3.0, the new
+ * org.eclipse.ui.intro extension point should be used instead.
+ */
+ public static URL getWelcomePageUrl(IProduct product) {
+ return getUrl(product.getProperty(WELCOME_PAGE), product.getDefiningBundle());
+ }
+
+ /**
+ * Returns the product name or <code>null</code>. This is shown in the window
+ * title and the About action.
+ */
+ public static String getProductName(IProduct product) {
+ return product.getName();
+ }
+
+ /**
+ * Returns the id for the product.
+ */
+ public static String getProductId(IProduct product) {
+ return product.getId();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/RadioMenu.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/RadioMenu.java
index 70a6946f284..e2fd38a169f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/RadioMenu.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/RadioMenu.java
@@ -24,109 +24,109 @@ import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
/**
- * Represents a group of radio buttons in a menu. Each menu item
- * is mapped onto a particular value. The RadioMenu reports its state
- * using the attached Model object. That is, Model.getState() will
- * return the value of the currently selected radio button and Model.setState(value)
- * will select the radio button associated with the given value.
+ * Represents a group of radio buttons in a menu. Each menu item is mapped onto
+ * a particular value. The RadioMenu reports its state using the attached Model
+ * object. That is, Model.getState() will return the value of the currently
+ * selected radio button and Model.setState(value) will select the radio button
+ * associated with the given value.
*/
public class RadioMenu implements IChangeListener {
- private Model data;
+ private Model data;
- private Menu parent;
+ private Menu parent;
- private List items = new ArrayList();
+ private List items = new ArrayList();
SelectionListener selectionAdapter = widgetSelectedAdapter(e -> {
- Object newState = e.widget.getData();
+ Object newState = e.widget.getData();
- data.setState(newState, RadioMenu.this);
+ data.setState(newState, RadioMenu.this);
});
- /**
- * Creates a set of radio menu items on the given menu.
- *
- * @param parent menu that will contain the menu items
- * @param newData the model that will store the value of the currently selected item
- */
- public RadioMenu(Menu parent, Model newData) {
- this.parent = parent;
- this.data = newData;
-
- newData.addChangeListener(this);
- }
-
- /**
- * Returns true iff the given values are considered equal.
- *
- * @param value1
- * @param value2
- * @return
- */
- private static boolean isEqual(Object value1, Object value2) {
- if (value1 == null) {
- return value2 == null;
- } else if (value2 == null) {
- return false;
- }
-
- return value1.equals(value2);
- }
-
- /**
- * Creates a new menu item with the given text and value. When
- * the item is selected, the state of the model will change to
- * match the given value.
- *
- * @param text
- * @param value
- */
- public void addMenuItem(String text, Object value) {
- MenuItem newItem = new MenuItem(parent, SWT.RADIO);
-
- newItem.setSelection(isEqual(data.getState(), value));
- newItem.setText(text);
- newItem.setData(value);
- items.add(newItem);
-
- newItem.addSelectionListener(selectionAdapter);
- }
-
- /**
- * Disposes all menu items
- */
- public void dispose() {
- Iterator iter = items.iterator();
- while (iter.hasNext()) {
- MenuItem next = (MenuItem) iter.next();
-
- if (!next.isDisposed()) {
- next.removeSelectionListener(selectionAdapter);
- next.dispose();
- }
- }
-
- items.clear();
- }
-
- /**
- * Refreshes the selected menu items to match the current state of the model.
- */
- private void refreshSelection() {
- Iterator iter = items.iterator();
- while (iter.hasNext()) {
- MenuItem next = (MenuItem) iter.next();
-
- if (!next.isDisposed()) {
- next.setSelection(isEqual(data.getState(), next.getData()));
- }
- }
- }
-
- @Override
+ /**
+ * Creates a set of radio menu items on the given menu.
+ *
+ * @param parent menu that will contain the menu items
+ * @param newData the model that will store the value of the currently selected
+ * item
+ */
+ public RadioMenu(Menu parent, Model newData) {
+ this.parent = parent;
+ this.data = newData;
+
+ newData.addChangeListener(this);
+ }
+
+ /**
+ * Returns true iff the given values are considered equal.
+ *
+ * @param value1
+ * @param value2
+ * @return
+ */
+ private static boolean isEqual(Object value1, Object value2) {
+ if (value1 == null) {
+ return value2 == null;
+ } else if (value2 == null) {
+ return false;
+ }
+
+ return value1.equals(value2);
+ }
+
+ /**
+ * Creates a new menu item with the given text and value. When the item is
+ * selected, the state of the model will change to match the given value.
+ *
+ * @param text
+ * @param value
+ */
+ public void addMenuItem(String text, Object value) {
+ MenuItem newItem = new MenuItem(parent, SWT.RADIO);
+
+ newItem.setSelection(isEqual(data.getState(), value));
+ newItem.setText(text);
+ newItem.setData(value);
+ items.add(newItem);
+
+ newItem.addSelectionListener(selectionAdapter);
+ }
+
+ /**
+ * Disposes all menu items
+ */
+ public void dispose() {
+ Iterator iter = items.iterator();
+ while (iter.hasNext()) {
+ MenuItem next = (MenuItem) iter.next();
+
+ if (!next.isDisposed()) {
+ next.removeSelectionListener(selectionAdapter);
+ next.dispose();
+ }
+ }
+
+ items.clear();
+ }
+
+ /**
+ * Refreshes the selected menu items to match the current state of the model.
+ */
+ private void refreshSelection() {
+ Iterator iter = items.iterator();
+ while (iter.hasNext()) {
+ MenuItem next = (MenuItem) iter.next();
+
+ if (!next.isDisposed()) {
+ next.setSelection(isEqual(data.getState(), next.getData()));
+ }
+ }
+ }
+
+ @Override
public void update(boolean changed) {
- refreshSelection();
- }
+ refreshSelection();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/RectangleAnimationFeedbackBase.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/RectangleAnimationFeedbackBase.java
index 2ab85cc9b26..b8e9943ed86 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/RectangleAnimationFeedbackBase.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/RectangleAnimationFeedbackBase.java
@@ -27,6 +27,7 @@ import org.eclipse.ui.internal.AnimationFeedbackBase;
/**
* RectangleAnimationFeedbackBase is an abstract base class for all the
* rectangle animations.
+ *
* @since 3.3
*
*/
@@ -39,11 +40,10 @@ public abstract class RectangleAnimationFeedbackBase extends AnimationFeedbackBa
* Creates a Rectangle Animation Feedback
*
* @param parentShell specifies the composite where the animation will be drawn
- * @param start initial rectangle (display coordinates)
- * @param end final rectangle (display coordinates)
+ * @param start initial rectangle (display coordinates)
+ * @param end final rectangle (display coordinates)
*/
- public RectangleAnimationFeedbackBase(Shell parentShell, Rectangle start,
- Rectangle end) {
+ public RectangleAnimationFeedbackBase(Shell parentShell, Rectangle start, Rectangle end) {
super(parentShell);
addStartRect(start);
addEndRect(end);
@@ -69,24 +69,23 @@ public abstract class RectangleAnimationFeedbackBase extends AnimationFeedbackBa
}
}
- public void addStartRect(Control ctrl) {
- Rectangle ctrlBounds = ctrl.getBounds();
- Rectangle startRect = Geometry.toDisplay(ctrl.getParent(), ctrlBounds);
- addStartRect(startRect);
- }
+ public void addStartRect(Control ctrl) {
+ Rectangle ctrlBounds = ctrl.getBounds();
+ Rectangle startRect = Geometry.toDisplay(ctrl.getParent(), ctrlBounds);
+ addStartRect(startRect);
+ }
- public void addEndRect(Control ctrl) {
- Rectangle ctrlBounds = ctrl.getBounds();
- Rectangle endRect = Geometry.toDisplay(ctrl.getParent(), ctrlBounds);
- addEndRect(endRect);
- }
+ public void addEndRect(Control ctrl) {
+ Rectangle ctrlBounds = ctrl.getBounds();
+ Rectangle endRect = Geometry.toDisplay(ctrl.getParent(), ctrlBounds);
+ addEndRect(endRect);
+ }
- public static Rectangle interpolate(Rectangle start, Rectangle end,
- double amount) {
+ public static Rectangle interpolate(Rectangle start, Rectangle end, double amount) {
double initialWeight = 1.0 - amount;
- Rectangle result = new Rectangle((int) (start.x * initialWeight + end.x
- * amount), (int) (start.y * initialWeight + end.y * amount),
+ Rectangle result = new Rectangle((int) (start.x * initialWeight + end.x * amount),
+ (int) (start.y * initialWeight + end.y * amount),
(int) (start.width * initialWeight + end.width * amount),
(int) (start.height * initialWeight + end.height * amount));
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/RectangleAnimationImageFeedback.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/RectangleAnimationImageFeedback.java
index c528ad9c572..84062e93a72 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/RectangleAnimationImageFeedback.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/RectangleAnimationImageFeedback.java
@@ -27,15 +27,14 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
/**
- * Creates an animation effect where the interpolated rectangles are displayed using Canvas
- * controls that show an image of the bits that were originally occupied by the various
- * 'start' rectangles.
+ * Creates an animation effect where the interpolated rectangles are displayed
+ * using Canvas controls that show an image of the bits that were originally
+ * occupied by the various 'start' rectangles.
*
* @since 3.3
*
*/
-public class RectangleAnimationImageFeedback extends
- RectangleAnimationFeedbackBase {
+public class RectangleAnimationImageFeedback extends RectangleAnimationFeedbackBase {
private static class ImageCanvas extends Canvas {
private Image image;
@@ -54,8 +53,7 @@ public class RectangleAnimationImageFeedback extends
* @param gc
*/
protected void paintImage(GC gc) {
- gc.drawImage(image, 0, 0, image.getBounds().width, image
- .getBounds().height, 0, 0, getBounds().width,
+ gc.drawImage(image, 0, 0, image.getBounds().width, image.getBounds().height, 0, 0, getBounds().width,
getBounds().height);
}
@@ -71,9 +69,7 @@ public class RectangleAnimationImageFeedback extends
private Display display;
private List controls = new ArrayList();
-
- public RectangleAnimationImageFeedback(Shell parentShell, Rectangle start,
- Rectangle end) {
+ public RectangleAnimationImageFeedback(Shell parentShell, Rectangle start, Rectangle end) {
super(parentShell, start, end);
}
@@ -122,7 +118,7 @@ public class RectangleAnimationImageFeedback extends
if (rect == null)
return;
- // Rectangle start = Geometry.toControl(getAnimationShell(), rect);
+ // Rectangle start = Geometry.toControl(getAnimationShell(), rect);
super.addStartRect(rect);
}
@@ -130,7 +126,7 @@ public class RectangleAnimationImageFeedback extends
@Override
public void addEndRect(Rectangle rect) {
if (rect != null) {
- // Rectangle end = Geometry.toControl(getAnimationShell(), rect);
+ // Rectangle end = Geometry.toControl(getAnimationShell(), rect);
super.addEndRect(rect);
}
}
@@ -170,8 +166,7 @@ public class RectangleAnimationImageFeedback extends
GC gc = new GC(backingStore);
gc.copyArea(image, rect.x, rect.y);
gc.dispose();
- ImageCanvas canvas = new ImageCanvas(theShell, SWT.BORDER
- | SWT.NO_BACKGROUND, image);
+ ImageCanvas canvas = new ImageCanvas(theShell, SWT.BORDER | SWT.NO_BACKGROUND, image);
controls.add(canvas);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ReferenceCounter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ReferenceCounter.java
index 0fc59f82b05..efd7d27b692 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ReferenceCounter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ReferenceCounter.java
@@ -21,159 +21,157 @@ import java.util.Map;
import java.util.Set;
/**
- * A ReferenceCounter is used to reference counting objects.
- * Each object is identified by a unique ID. Together they form
- * an ID - value pair. An object is added to the counter by calling
- * #put(id, object). From this point on additional refs can be made
- * by calling #addRef(id) or #removeRef(id).
+ * A ReferenceCounter is used to reference counting objects. Each object is
+ * identified by a unique ID. Together they form an ID - value pair. An object
+ * is added to the counter by calling #put(id, object). From this point on
+ * additional refs can be made by calling #addRef(id) or #removeRef(id).
*/
public class ReferenceCounter {
- private Map mapIdToRec = new HashMap(11);
-
- /**
- * Capture the information about an object.
- */
- public static class RefRec {
- public RefRec(Object id, Object value) {
- this.id = id;
- this.value = value;
- addRef();
- }
-
- public Object getId() {
- return id;
- }
-
- public Object getValue() {
- return value;
- }
-
- public int addRef() {
- ++refCount;
- return refCount;
- }
-
- public int removeRef() {
- --refCount;
- return refCount;
- }
-
- public int getRef() {
- return refCount;
- }
-
- public boolean isNotReferenced() {
- return (refCount <= 0);
- }
-
- public Object id;
-
- public Object value;
-
- private int refCount;
- }
-
- /**
- * Creates a new counter.
- */
- public ReferenceCounter() {
- super();
- }
-
- /**
- * Adds one reference to an object in the counter.
- *
- * @param id is a unique ID for the object.
- * @return the new ref count
- */
- public int addRef(Object id) {
- RefRec rec = (RefRec) mapIdToRec.get(id);
- if (rec == null) {
+ private Map mapIdToRec = new HashMap(11);
+
+ /**
+ * Capture the information about an object.
+ */
+ public static class RefRec {
+ public RefRec(Object id, Object value) {
+ this.id = id;
+ this.value = value;
+ addRef();
+ }
+
+ public Object getId() {
+ return id;
+ }
+
+ public Object getValue() {
+ return value;
+ }
+
+ public int addRef() {
+ ++refCount;
+ return refCount;
+ }
+
+ public int removeRef() {
+ --refCount;
+ return refCount;
+ }
+
+ public int getRef() {
+ return refCount;
+ }
+
+ public boolean isNotReferenced() {
+ return (refCount <= 0);
+ }
+
+ public Object id;
+
+ public Object value;
+
+ private int refCount;
+ }
+
+ /**
+ * Creates a new counter.
+ */
+ public ReferenceCounter() {
+ super();
+ }
+
+ /**
+ * Adds one reference to an object in the counter.
+ *
+ * @param id is a unique ID for the object.
+ * @return the new ref count
+ */
+ public int addRef(Object id) {
+ RefRec rec = (RefRec) mapIdToRec.get(id);
+ if (rec == null) {
return 0;
}
- return rec.addRef();
- }
-
- /**
- * Returns the object defined by an ID. If the ID is not
- * found <code>null</code> is returned.
- *
- * @return the object or <code>null</code>
- */
- public Object get(Object id) {
- RefRec rec = (RefRec) mapIdToRec.get(id);
- if (rec == null) {
+ return rec.addRef();
+ }
+
+ /**
+ * Returns the object defined by an ID. If the ID is not found <code>null</code>
+ * is returned.
+ *
+ * @return the object or <code>null</code>
+ */
+ public Object get(Object id) {
+ RefRec rec = (RefRec) mapIdToRec.get(id);
+ if (rec == null) {
return null;
}
- return rec.getValue();
- }
-
- /**
- * Returns a complete list of the keys in the counter.
- *
- * @return a Set containing the ID for each.
- */
- public Set keySet() {
- return mapIdToRec.keySet();
- }
-
- /**
- * Adds an object to the counter for counting and gives
- * it an initial ref count of 1.
- *
- * @param id is a unique ID for the object.
- * @param value is the object itself.
- */
- public void put(Object id, Object value) {
- RefRec rec = new RefRec(id, value);
- mapIdToRec.put(id, rec);
- }
-
- /**
- * @param id is a unique ID for the object.
- * @return the current ref count
- */
- public int getRef(Object id) {
- RefRec rec = (RefRec) mapIdToRec.get(id);
- if (rec == null) {
+ return rec.getValue();
+ }
+
+ /**
+ * Returns a complete list of the keys in the counter.
+ *
+ * @return a Set containing the ID for each.
+ */
+ public Set keySet() {
+ return mapIdToRec.keySet();
+ }
+
+ /**
+ * Adds an object to the counter for counting and gives it an initial ref count
+ * of 1.
+ *
+ * @param id is a unique ID for the object.
+ * @param value is the object itself.
+ */
+ public void put(Object id, Object value) {
+ RefRec rec = new RefRec(id, value);
+ mapIdToRec.put(id, rec);
+ }
+
+ /**
+ * @param id is a unique ID for the object.
+ * @return the current ref count
+ */
+ public int getRef(Object id) {
+ RefRec rec = (RefRec) mapIdToRec.get(id);
+ if (rec == null) {
return 0;
}
- return rec.refCount;
- }
-
- /**
- * Removes one reference from an object in the counter.
- * If the ref count drops to 0 the object is removed from
- * the counter completely.
- *
- * @param id is a unique ID for the object.
- * @return the new ref count
- */
- public int removeRef(Object id) {
- RefRec rec = (RefRec) mapIdToRec.get(id);
- if (rec == null) {
- return 0;
- }
- int newCount = rec.removeRef();
- if (newCount <= 0) {
- mapIdToRec.remove(id);
- }
- return newCount;
- }
-
- /**
- * Returns a complete list of the values in the counter.
- *
- * @return a Collection containing the values.
- */
- public List values() {
- int size = mapIdToRec.size();
- ArrayList list = new ArrayList(size);
- Iterator iter = mapIdToRec.values().iterator();
- while (iter.hasNext()) {
- RefRec rec = (RefRec) iter.next();
- list.add(rec.getValue());
- }
- return list;
- }
+ return rec.refCount;
+ }
+
+ /**
+ * Removes one reference from an object in the counter. If the ref count drops
+ * to 0 the object is removed from the counter completely.
+ *
+ * @param id is a unique ID for the object.
+ * @return the new ref count
+ */
+ public int removeRef(Object id) {
+ RefRec rec = (RefRec) mapIdToRec.get(id);
+ if (rec == null) {
+ return 0;
+ }
+ int newCount = rec.removeRef();
+ if (newCount <= 0) {
+ mapIdToRec.remove(id);
+ }
+ return newCount;
+ }
+
+ /**
+ * Returns a complete list of the values in the counter.
+ *
+ * @return a Collection containing the values.
+ */
+ public List values() {
+ int size = mapIdToRec.size();
+ ArrayList list = new ArrayList(size);
+ Iterator iter = mapIdToRec.values().iterator();
+ while (iter.hasNext()) {
+ RefRec rec = (RefRec) iter.next();
+ list.add(rec.getValue());
+ }
+ return list;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ReopenEditorMenu.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ReopenEditorMenu.java
index ae7ebaa0c61..84296225fe2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ReopenEditorMenu.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ReopenEditorMenu.java
@@ -39,212 +39,207 @@ import org.eclipse.ui.PartInitException;
* A dynamic menu item which supports to switch to other Windows.
*/
public class ReopenEditorMenu extends ContributionItem {
- private IWorkbenchWindow window;
-
- private EditorHistory history;
-
- private boolean showSeparator;
-
- // the maximum length for a file name; must be >= 4
- private static final int MAX_TEXT_LENGTH = 40;
-
- // only assign mnemonic to the first nine items
- private static final int MAX_MNEMONIC_SIZE = 9;
-
- /**
- * Create a new instance.
- * @param window the window on which the menu is to be created
- * @param id menu's id
- * @param showSeparator whether or not to show a separator
- */
- public ReopenEditorMenu(IWorkbenchWindow window, String id,
- boolean showSeparator) {
- super(id);
- this.window = window;
- this.showSeparator = showSeparator;
- IWorkbench workbench = window.getWorkbench();
+ private IWorkbenchWindow window;
+
+ private EditorHistory history;
+
+ private boolean showSeparator;
+
+ // the maximum length for a file name; must be >= 4
+ private static final int MAX_TEXT_LENGTH = 40;
+
+ // only assign mnemonic to the first nine items
+ private static final int MAX_MNEMONIC_SIZE = 9;
+
+ /**
+ * Create a new instance.
+ *
+ * @param window the window on which the menu is to be created
+ * @param id menu's id
+ * @param showSeparator whether or not to show a separator
+ */
+ public ReopenEditorMenu(IWorkbenchWindow window, String id, boolean showSeparator) {
+ super(id);
+ this.window = window;
+ this.showSeparator = showSeparator;
+ IWorkbench workbench = window.getWorkbench();
if (workbench instanceof Workbench) {
history = ((Workbench) workbench).getEditorHistory();
}
- }
+ }
- /**
- * Returns the text for a history item. This may be truncated to fit
- * within the MAX_TEXT_LENGTH.
- */
- private String calcText(int index, EditorHistoryItem item) {
+ /**
+ * Returns the text for a history item. This may be truncated to fit within the
+ * MAX_TEXT_LENGTH.
+ */
+ private String calcText(int index, EditorHistoryItem item) {
// IMPORTANT: avoid accessing the item's input since
// this can require activating plugins.
// Instead, ask the item for the info, which can
// consult its memento if it is not restored yet.
- return calcText(index, item.getName(), item.getToolTipText(), Window
- .getDefaultOrientation() == SWT.RIGHT_TO_LEFT);
+ return calcText(index, item.getName(), item.getToolTipText(),
+ Window.getDefaultOrientation() == SWT.RIGHT_TO_LEFT);
}
- /**
- * Return a string suitable for a file MRU list. This should not be called
- * outside the framework.
- *
- * @param index the index in the MRU list
- * @param name the file name
- * @param toolTip potentially the path
- * @param rtl should it be right-to-left
- * @return a string suitable for an MRU file menu
- */
- public static String calcText(int index, String name, String toolTip, boolean rtl) {
- StringBuilder sb = new StringBuilder();
-
- int mnemonic = index + 1;
- StringBuilder nm = new StringBuilder();
- nm.append(mnemonic);
- if (mnemonic <= MAX_MNEMONIC_SIZE) {
- nm.insert(nm.length() - (mnemonic + "").length(), '&'); //$NON-NLS-1$
- }
+ /**
+ * Return a string suitable for a file MRU list. This should not be called
+ * outside the framework.
+ *
+ * @param index the index in the MRU list
+ * @param name the file name
+ * @param toolTip potentially the path
+ * @param rtl should it be right-to-left
+ * @return a string suitable for an MRU file menu
+ */
+ public static String calcText(int index, String name, String toolTip, boolean rtl) {
+ StringBuilder sb = new StringBuilder();
+
+ int mnemonic = index + 1;
+ StringBuilder nm = new StringBuilder();
+ nm.append(mnemonic);
+ if (mnemonic <= MAX_MNEMONIC_SIZE) {
+ nm.insert(nm.length() - (mnemonic + "").length(), '&'); //$NON-NLS-1$
+ }
// sb.append(" "); //$NON-NLS-1$
- String fileName = name;
- String pathName = toolTip;
- if (pathName.equals(fileName)) {
- // tool tip text isn't necessarily a path;
- // sometimes it's the same as name, so it shouldn't be treated as a path then
- pathName = ""; //$NON-NLS-1$
- }
- IPath path = new Path(pathName);
- // if last segment in path is the fileName, remove it
- if (path.segmentCount() > 1
- && path.segment(path.segmentCount() - 1).equals(fileName)) {
- path = path.removeLastSegments(1);
- pathName = path.toString();
- }
-
- if ((fileName.length() + pathName.length()) <= (MAX_TEXT_LENGTH - 4)) {
- // entire item name fits within maximum length
- sb.append(fileName);
- if (pathName.length() > 0) {
- sb.append(" ["); //$NON-NLS-1$
- sb.append(pathName);
- sb.append("]"); //$NON-NLS-1$
- }
- } else {
- // need to shorten the item name
- int length = fileName.length();
- if (length > MAX_TEXT_LENGTH) {
- // file name does not fit within length, truncate it
- sb.append(fileName.substring(0, MAX_TEXT_LENGTH - 3));
- sb.append("..."); //$NON-NLS-1$
- } else if (length > MAX_TEXT_LENGTH - 7) {
- sb.append(fileName);
- } else {
- sb.append(fileName);
- int segmentCount = path.segmentCount();
- if (segmentCount > 0) {
- length += 7; // 7 chars are taken for " [...]"
-
- sb.append(" ["); //$NON-NLS-1$
-
- // Add first n segments that fit
- int i = 0;
- while (i < segmentCount && length < MAX_TEXT_LENGTH) {
- String segment = path.segment(i);
- if (length + segment.length() < MAX_TEXT_LENGTH) {
- sb.append(segment);
- sb.append(IPath.SEPARATOR);
- length += segment.length() + 1;
- i++;
- } else if (i == 0) {
- // append at least part of the first segment
- sb.append(segment.substring(0, MAX_TEXT_LENGTH
- - length));
- length = MAX_TEXT_LENGTH;
- break;
- } else {
- break;
- }
- }
-
- sb.append("..."); //$NON-NLS-1$
-
- i = segmentCount - 1;
- // Add last n segments that fit
- while (i > 0 && length < MAX_TEXT_LENGTH) {
- String segment = path.segment(i);
- if (length + segment.length() < MAX_TEXT_LENGTH) {
- sb.append(IPath.SEPARATOR);
- sb.append(segment);
- length += segment.length() + 1;
- i--;
- } else {
- break;
- }
- }
-
- sb.append("]"); //$NON-NLS-1$
- }
- }
- }
- final String process;
- if (rtl) {
- process = sb + " " + nm; //$NON-NLS-1$
- } else {
- process = nm + " " + sb; //$NON-NLS-1$
- }
- return TextProcessor.process(process, TextProcessor.getDefaultDelimiters() + "[]");//$NON-NLS-1$
- }
-
- /**
- * Fills the given menu with
- * menu items for all windows.
- */
- @Override
+ String fileName = name;
+ String pathName = toolTip;
+ if (pathName.equals(fileName)) {
+ // tool tip text isn't necessarily a path;
+ // sometimes it's the same as name, so it shouldn't be treated as a path then
+ pathName = ""; //$NON-NLS-1$
+ }
+ IPath path = new Path(pathName);
+ // if last segment in path is the fileName, remove it
+ if (path.segmentCount() > 1 && path.segment(path.segmentCount() - 1).equals(fileName)) {
+ path = path.removeLastSegments(1);
+ pathName = path.toString();
+ }
+
+ if ((fileName.length() + pathName.length()) <= (MAX_TEXT_LENGTH - 4)) {
+ // entire item name fits within maximum length
+ sb.append(fileName);
+ if (pathName.length() > 0) {
+ sb.append(" ["); //$NON-NLS-1$
+ sb.append(pathName);
+ sb.append("]"); //$NON-NLS-1$
+ }
+ } else {
+ // need to shorten the item name
+ int length = fileName.length();
+ if (length > MAX_TEXT_LENGTH) {
+ // file name does not fit within length, truncate it
+ sb.append(fileName.substring(0, MAX_TEXT_LENGTH - 3));
+ sb.append("..."); //$NON-NLS-1$
+ } else if (length > MAX_TEXT_LENGTH - 7) {
+ sb.append(fileName);
+ } else {
+ sb.append(fileName);
+ int segmentCount = path.segmentCount();
+ if (segmentCount > 0) {
+ length += 7; // 7 chars are taken for " [...]"
+
+ sb.append(" ["); //$NON-NLS-1$
+
+ // Add first n segments that fit
+ int i = 0;
+ while (i < segmentCount && length < MAX_TEXT_LENGTH) {
+ String segment = path.segment(i);
+ if (length + segment.length() < MAX_TEXT_LENGTH) {
+ sb.append(segment);
+ sb.append(IPath.SEPARATOR);
+ length += segment.length() + 1;
+ i++;
+ } else if (i == 0) {
+ // append at least part of the first segment
+ sb.append(segment.substring(0, MAX_TEXT_LENGTH - length));
+ length = MAX_TEXT_LENGTH;
+ break;
+ } else {
+ break;
+ }
+ }
+
+ sb.append("..."); //$NON-NLS-1$
+
+ i = segmentCount - 1;
+ // Add last n segments that fit
+ while (i > 0 && length < MAX_TEXT_LENGTH) {
+ String segment = path.segment(i);
+ if (length + segment.length() < MAX_TEXT_LENGTH) {
+ sb.append(IPath.SEPARATOR);
+ sb.append(segment);
+ length += segment.length() + 1;
+ i--;
+ } else {
+ break;
+ }
+ }
+
+ sb.append("]"); //$NON-NLS-1$
+ }
+ }
+ }
+ final String process;
+ if (rtl) {
+ process = sb + " " + nm; //$NON-NLS-1$
+ } else {
+ process = nm + " " + sb; //$NON-NLS-1$
+ }
+ return TextProcessor.process(process, TextProcessor.getDefaultDelimiters() + "[]");//$NON-NLS-1$
+ }
+
+ /**
+ * Fills the given menu with menu items for all windows.
+ */
+ @Override
public void fill(final Menu menu, int index) {
- if (window.getActivePage() == null
- || window.getActivePage().getPerspective() == null) {
- return;
- }
+ if (window.getActivePage() == null || window.getActivePage().getPerspective() == null) {
+ return;
+ }
- int itemsToShow = WorkbenchPlugin.getDefault().getPreferenceStore()
- .getInt(IPreferenceConstants.RECENT_FILES);
+ int itemsToShow = WorkbenchPlugin.getDefault().getPreferenceStore().getInt(IPreferenceConstants.RECENT_FILES);
if (itemsToShow == 0 || history == null) {
- return;
- }
+ return;
+ }
- // Get items.
- EditorHistoryItem[] historyItems = history.getItems();
+ // Get items.
+ EditorHistoryItem[] historyItems = history.getItems();
- int n = Math.min(itemsToShow, historyItems.length);
- if (n <= 0) {
+ int n = Math.min(itemsToShow, historyItems.length);
+ if (n <= 0) {
addClearHistory(menu, n);
- return;
- }
+ return;
+ }
- if (showSeparator) {
- new MenuItem(menu, SWT.SEPARATOR, index);
- ++index;
- }
+ if (showSeparator) {
+ new MenuItem(menu, SWT.SEPARATOR, index);
+ ++index;
+ }
- final int menuIndex[] = new int[] { index };
+ final int menuIndex[] = new int[] { index };
- for (int i = 0; i < n; i++) {
- final EditorHistoryItem item = historyItems[i];
- final int historyIndex = i;
- SafeRunner.run(new SafeRunnable() {
- @Override
+ for (int i = 0; i < n; i++) {
+ final EditorHistoryItem item = historyItems[i];
+ final int historyIndex = i;
+ SafeRunner.run(new SafeRunnable() {
+ @Override
public void run() throws Exception {
- String text = calcText(historyIndex, item);
- MenuItem mi = new MenuItem(menu, SWT.PUSH, menuIndex[0]);
- ++menuIndex[0];
- mi.setText(text);
- mi.addSelectionListener(widgetSelectedAdapter(e -> open(item)));
- }
-
- @Override
+ String text = calcText(historyIndex, item);
+ MenuItem mi = new MenuItem(menu, SWT.PUSH, menuIndex[0]);
+ ++menuIndex[0];
+ mi.setText(text);
+ mi.addSelectionListener(widgetSelectedAdapter(e -> open(item)));
+ }
+
+ @Override
public void handleException(Throwable e) {
- // just skip the item if there's an error,
- // e.g. in the calculation of the shortened name
- WorkbenchPlugin.log(getClass(), "fill", e); //$NON-NLS-1$
- }
- });
- }
+ // just skip the item if there's an error,
+ // e.g. in the calculation of the shortened name
+ WorkbenchPlugin.log(getClass(), "fill", e); //$NON-NLS-1$
+ }
+ });
+ }
addClearHistory(menu, n);
}
@@ -257,45 +252,44 @@ public class ReopenEditorMenu extends ContributionItem {
history.remove(item);
})));
miClear.setEnabled(nItems > 0);
- }
+ }
- /**
- * Overridden to always return true and force dynamic menu building.
- */
- @Override
+ /**
+ * Overridden to always return true and force dynamic menu building.
+ */
+ @Override
public boolean isDynamic() {
- return true;
- }
-
- /**
- * Reopens the editor for the given history item.
- */
- private void open(EditorHistoryItem item) {
- IWorkbenchPage page = window.getActivePage();
- if (page != null) {
- try {
- String itemName = item.getName();
- if (!item.isRestored()) {
- item.restoreState();
- }
- IEditorInput input = item.getInput();
- IEditorDescriptor desc = item.getDescriptor();
+ return true;
+ }
+
+ /**
+ * Reopens the editor for the given history item.
+ */
+ private void open(EditorHistoryItem item) {
+ IWorkbenchPage page = window.getActivePage();
+ if (page != null) {
+ try {
+ String itemName = item.getName();
+ if (!item.isRestored()) {
+ item.restoreState();
+ }
+ IEditorInput input = item.getInput();
+ IEditorDescriptor desc = item.getDescriptor();
if (input == null || !input.exists() || desc == null) {
- String title = WorkbenchMessages.OpenRecent_errorTitle;
- String msg = NLS.bind(WorkbenchMessages.OpenRecent_unableToOpen, itemName );
- MessageDialog.openWarning(window.getShell(), title, msg);
- history.remove(item);
- } else {
- page.openEditor(input, desc.getId());
- }
- } catch (PartInitException e2) {
- String title = WorkbenchMessages.OpenRecent_errorTitle;
- MessageDialog.openWarning(window.getShell(), title, e2
- .getMessage());
- history.remove(item);
- }
- }
- }
+ String title = WorkbenchMessages.OpenRecent_errorTitle;
+ String msg = NLS.bind(WorkbenchMessages.OpenRecent_unableToOpen, itemName);
+ MessageDialog.openWarning(window.getShell(), title, msg);
+ history.remove(item);
+ } else {
+ page.openEditor(input, desc.getId());
+ }
+ } catch (PartInitException e2) {
+ String title = WorkbenchMessages.OpenRecent_errorTitle;
+ MessageDialog.openWarning(window.getShell(), title, e2.getMessage());
+ history.remove(item);
+ }
+ }
+ }
@Override
public void dispose() {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ResetPerspectiveAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ResetPerspectiveAction.java
index b624e84d167..bdc4f3e5c4d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ResetPerspectiveAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ResetPerspectiveAction.java
@@ -27,36 +27,36 @@ import org.eclipse.ui.PlatformUI;
*/
public class ResetPerspectiveAction extends PerspectiveAction {
- /**
- * This default constructor allows the the action to be called from the welcome page.
- */
- public ResetPerspectiveAction() {
- this(PlatformUI.getWorkbench().getActiveWorkbenchWindow());
- }
+ /**
+ * This default constructor allows the the action to be called from the welcome
+ * page.
+ */
+ public ResetPerspectiveAction() {
+ this(PlatformUI.getWorkbench().getActiveWorkbenchWindow());
+ }
- /**
- * Create an instance of this class
- * @param window the window
- */
- public ResetPerspectiveAction(IWorkbenchWindow window) {
- super(window);
- setText(WorkbenchMessages.ResetPerspective_text);
- setActionDefinitionId(IWorkbenchCommandConstants.WINDOW_RESET_PERSPECTIVE);
- // @issue missing action id
- setToolTipText(WorkbenchMessages.ResetPerspective_toolTip);
- window.getWorkbench().getHelpSystem().setHelp(this,
- IWorkbenchHelpContextIds.RESET_PERSPECTIVE_ACTION);
- }
+ /**
+ * Create an instance of this class
+ *
+ * @param window the window
+ */
+ public ResetPerspectiveAction(IWorkbenchWindow window) {
+ super(window);
+ setText(WorkbenchMessages.ResetPerspective_text);
+ setActionDefinitionId(IWorkbenchCommandConstants.WINDOW_RESET_PERSPECTIVE);
+ // @issue missing action id
+ setToolTipText(WorkbenchMessages.ResetPerspective_toolTip);
+ window.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.RESET_PERSPECTIVE_ACTION);
+ }
- @Override
+ @Override
protected void run(IWorkbenchPage page, IPerspectiveDescriptor persp) {
- String message = NLS.bind(WorkbenchMessages.ResetPerspective_message, persp.getLabel() );
- MessageDialog d = new MessageDialog(getWindow().getShell(),
- WorkbenchMessages.ResetPerspective_title,
- null, message, MessageDialog.QUESTION, 0, IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL);
- if (d.open() == 0) {
+ String message = NLS.bind(WorkbenchMessages.ResetPerspective_message, persp.getLabel());
+ MessageDialog d = new MessageDialog(getWindow().getShell(), WorkbenchMessages.ResetPerspective_title, null,
+ message, MessageDialog.QUESTION, 0, IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL);
+ if (d.open() == 0) {
page.resetPerspective();
}
- }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SavePerspectiveAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SavePerspectiveAction.java
index 4ec6039539c..164f2f0738e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SavePerspectiveAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SavePerspectiveAction.java
@@ -24,29 +24,26 @@ import org.eclipse.ui.internal.registry.PerspectiveDescriptor;
*/
public class SavePerspectiveAction extends PerspectiveAction {
- /**
- * Creates an instance of this class.
- *
- * @param window the workbench window in which this action appears
- */
- public SavePerspectiveAction(IWorkbenchWindow window) {
- super(window);
- setText(WorkbenchMessages.SavePerspective_text);
- setActionDefinitionId(IWorkbenchCommandConstants.WINDOW_SAVE_PERSPECTIVE_AS);
- // @issue missing action id
- setToolTipText(WorkbenchMessages.SavePerspective_toolTip);
- window.getWorkbench().getHelpSystem().setHelp(this,
- IWorkbenchHelpContextIds.SAVE_PERSPECTIVE_ACTION);
- }
+ /**
+ * Creates an instance of this class.
+ *
+ * @param window the workbench window in which this action appears
+ */
+ public SavePerspectiveAction(IWorkbenchWindow window) {
+ super(window);
+ setText(WorkbenchMessages.SavePerspective_text);
+ setActionDefinitionId(IWorkbenchCommandConstants.WINDOW_SAVE_PERSPECTIVE_AS);
+ // @issue missing action id
+ setToolTipText(WorkbenchMessages.SavePerspective_toolTip);
+ window.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.SAVE_PERSPECTIVE_ACTION);
+ }
- @Override
+ @Override
protected void run(IWorkbenchPage page, IPerspectiveDescriptor persp) {
- PerspectiveDescriptor desc = (PerspectiveDescriptor) persp;
- if (desc != null) {
+ PerspectiveDescriptor desc = (PerspectiveDescriptor) persp;
+ if (desc != null) {
// saveNonSingleton(page, desc);
- }
- }
-
-
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SaveableHelper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SaveableHelper.java
index d578f08e850..e69dea66284 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SaveableHelper.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SaveableHelper.java
@@ -72,7 +72,8 @@ public class SaveableHelper {
/**
* FOR USE BY THE AUTOMATED TEST HARNESS ONLY.
*
- * Sets the response to use when <code>savePart</code> is called with <code>confirm=true</code>.
+ * Sets the response to use when <code>savePart</code> is called with
+ * <code>confirm=true</code>.
*
* @param response 0 for yes, 1 for no, 2 for cancel, -1 for default (prompt)
*/
@@ -83,7 +84,8 @@ public class SaveableHelper {
/**
* FOR USE BY THE AUTOMATED TEST HARNESS ONLY.
*
- * Sets the response to use when <code>savePart</code> is called with <code>confirm=true</code>.
+ * Sets the response to use when <code>savePart</code> is called with
+ * <code>confirm=true</code>.
*
* @return 0 for yes, 1 for no, 2 for cancel, -1 for default (prompt)
*/
@@ -95,14 +97,14 @@ public class SaveableHelper {
* Saves the workbench part.
*
* @param saveable the part
- * @param part the same part
- * @param window the workbench window
- * @param confirm request confirmation
+ * @param part the same part
+ * @param window the workbench window
+ * @param confirm request confirmation
* @return <code>true</code> for continue, <code>false</code> if the operation
- * was canceled.
+ * was canceled.
*/
- public static boolean savePart(final ISaveablePart saveable, IWorkbenchPart part,
- IWorkbenchWindow window, boolean confirm) {
+ public static boolean savePart(final ISaveablePart saveable, IWorkbenchPart part, IWorkbenchWindow window,
+ boolean confirm) {
// Short circuit.
if (!saveable.isDirty()) {
return true;
@@ -113,18 +115,15 @@ public class SaveableHelper {
int choice = AutomatedResponse;
if (choice == USER_RESPONSE) {
if (saveable instanceof ISaveablePart2) {
- choice = ((ISaveablePart2)saveable).promptToSaveOnClose();
+ choice = ((ISaveablePart2) saveable).promptToSaveOnClose();
}
if (choice == USER_RESPONSE || choice == ISaveablePart2.DEFAULT) {
String message = NLS.bind(WorkbenchMessages.EditorManager_saveChangesQuestion,
LegacyActionTools.escapeMnemonics(part.getTitle()));
// Show a dialog.
- MessageDialog d = new MessageDialog(window.getShell(),
- WorkbenchMessages.Save_Resource, null, message,
- MessageDialog.QUESTION,
- 0,
- WorkbenchMessages.SaveableHelper_Save, WorkbenchMessages.SaveableHelper_Dont_Save,
- WorkbenchMessages.SaveableHelper_Cancel) {
+ MessageDialog d = new MessageDialog(window.getShell(), WorkbenchMessages.Save_Resource, null,
+ message, MessageDialog.QUESTION, 0, WorkbenchMessages.SaveableHelper_Save,
+ WorkbenchMessages.SaveableHelper_Dont_Save, WorkbenchMessages.SaveableHelper_Cancel) {
@Override
protected int getShellStyle() {
return super.getShellStyle() | SWT.SHEET;
@@ -137,13 +136,13 @@ public class SaveableHelper {
// Branch on the user choice.
// The choice id is based on the order of button labels above.
switch (choice) {
- case ISaveablePart2.YES : //yes
- break;
- case ISaveablePart2.NO : //no
- return true;
- default :
- case ISaveablePart2.CANCEL : //cancel
- return false;
+ case ISaveablePart2.YES: // yes
+ break;
+ case ISaveablePart2.NO: // no
+ return true;
+ default:
+ case ISaveablePart2.CANCEL: // cancel
+ return false;
}
}
@@ -165,12 +164,13 @@ public class SaveableHelper {
* Saves the selected dirty models from the given model source.
*
* @param modelSource the model source
- * @param window the workbench window
+ * @param window the workbench window
* @param confirm
* @return <code>true</code> for continue, <code>false</code> if the operation
- * was canceled or an error occurred while saving.
+ * was canceled or an error occurred while saving.
*/
- private static boolean saveModels(ISaveablesSource modelSource, final IWorkbenchWindow window, final boolean confirm) {
+ private static boolean saveModels(ISaveablesSource modelSource, final IWorkbenchWindow window,
+ final boolean confirm) {
final ArrayList<Saveable> dirtyModels = new ArrayList<>();
for (Saveable model : modelSource.getActiveSaveables()) {
if (model.isDirty()) {
@@ -210,17 +210,15 @@ public class SaveableHelper {
/**
* Saves the workbench part ... this is similar to
* {@link SaveableHelper#savePart(ISaveablePart, IWorkbenchPart, IWorkbenchWindow, boolean) }
- * except that the {@link ISaveablePart2#DEFAULT } case must cause the
- * calling function to allow this part to participate in the default saving
- * mechanism.
+ * except that the {@link ISaveablePart2#DEFAULT } case must cause the calling
+ * function to allow this part to participate in the default saving mechanism.
*
* @param saveable the part
- * @param window the workbench window
- * @param confirm request confirmation
+ * @param window the workbench window
+ * @param confirm request confirmation
* @return the ISaveablePart2 constant
*/
- static int savePart(final ISaveablePart2 saveable,
- IWorkbenchWindow window, boolean confirm) {
+ static int savePart(final ISaveablePart2 saveable, IWorkbenchWindow window, boolean confirm) {
// Short circuit.
if (!saveable.isDirty()) {
return ISaveablePart2.YES;
@@ -235,8 +233,8 @@ public class SaveableHelper {
// Branch on the user choice.
// The choice id is based on the order of button labels above.
- if (choice!=ISaveablePart2.YES) {
- return (choice==USER_RESPONSE?ISaveablePart2.DEFAULT:choice);
+ if (choice != ISaveablePart2.YES) {
+ return (choice == USER_RESPONSE ? ISaveablePart2.DEFAULT : choice);
}
}
@@ -247,7 +245,7 @@ public class SaveableHelper {
};
// Do the save.
- if (!runProgressMonitorOperation(WorkbenchMessages.Save, progressOp,window)) {
+ if (!runProgressMonitorOperation(WorkbenchMessages.Save, progressOp, window)) {
return ISaveablePart2.CANCEL;
}
return ISaveablePart2.YES;
@@ -257,17 +255,16 @@ public class SaveableHelper {
* Runs a progress monitor operation. Returns true if success, false if
* canceled.
*/
- static boolean runProgressMonitorOperation(String opName,
- IRunnableWithProgress progressOp, IWorkbenchWindow window) {
+ static boolean runProgressMonitorOperation(String opName, IRunnableWithProgress progressOp,
+ IWorkbenchWindow window) {
return runProgressMonitorOperation(opName, progressOp, window, window);
}
/**
- * Runs a progress monitor operation.
- * Returns true if success, false if canceled or an error occurred.
+ * Runs a progress monitor operation. Returns true if success, false if canceled
+ * or an error occurred.
*/
- static boolean runProgressMonitorOperation(String opName,
- final IRunnableWithProgress progressOp,
+ static boolean runProgressMonitorOperation(String opName, final IRunnableWithProgress progressOp,
final IRunnableContext runnableContext, final IShellProvider shellProvider) {
final boolean[] success = new boolean[] { false };
IRunnableWithProgress runnable = monitor -> {
@@ -280,12 +277,10 @@ public class SaveableHelper {
try {
runnableContext.run(false, true, runnable);
} catch (InvocationTargetException e) {
- String title = NLS.bind(WorkbenchMessages.EditorManager_operationFailed, opName );
+ String title = NLS.bind(WorkbenchMessages.EditorManager_operationFailed, opName);
Throwable targetExc = e.getTargetException();
- WorkbenchPlugin.log(title, new Status(IStatus.WARNING,
- PlatformUI.PLUGIN_ID, 0, title, targetExc));
- StatusUtil.handleStatus(title, targetExc, StatusManager.SHOW,
- shellProvider.getShell());
+ WorkbenchPlugin.log(title, new Status(IStatus.WARNING, PlatformUI.PLUGIN_ID, 0, title, targetExc));
+ StatusUtil.handleStatus(title, targetExc, StatusManager.SHOW, shellProvider.getShell());
// Fall through to return failure
} catch (InterruptedException e) {
// The user pressed cancel. Fall through to return failure
@@ -296,19 +291,17 @@ public class SaveableHelper {
}
/**
- * Returns whether the model source needs saving. This is true if any of
- * the active models are dirty. This logic must correspond with
- * {@link #saveModels} above.
+ * Returns whether the model source needs saving. This is true if any of the
+ * active models are dirty. This logic must correspond with {@link #saveModels}
+ * above.
*
- * @param modelSource
- * the model source
- * @return <code>true</code> if save is required, <code>false</code>
- * otherwise
+ * @param modelSource the model source
+ * @return <code>true</code> if save is required, <code>false</code> otherwise
* @since 3.2
*/
public static boolean needsSave(ISaveablesSource modelSource) {
for (Saveable model : modelSource.getActiveSaveables()) {
- if (model.isDirty() && !((InternalSaveable)model).isSavingInBackground()) {
+ if (model.isDirty() && !((InternalSaveable) model).isSavingInBackground()) {
return true;
}
}
@@ -321,11 +314,10 @@ public class SaveableHelper {
* @param shellProvider
* @param blockUntilSaved
*/
- public static void doSaveModel(final Saveable model,
- IProgressMonitor progressMonitor,
+ public static void doSaveModel(final Saveable model, IProgressMonitor progressMonitor,
final IShellProvider shellProvider, boolean blockUntilSaved) {
try {
- Job backgroundSaveJob = ((InternalSaveable)model).getBackgroundSaveJob();
+ Job backgroundSaveJob = ((InternalSaveable) model).getBackgroundSaveJob();
if (backgroundSaveJob != null) {
boolean canceled = waitForBackgroundSaveJob(model);
if (canceled) {
@@ -363,7 +355,7 @@ public class SaveableHelper {
@Override
public boolean belongsTo(Object family) {
if (family instanceof DynamicFamily) {
- return ((DynamicFamily)family).contains(model);
+ return ((DynamicFamily) family).contains(model);
}
return family.equals(model);
}
@@ -393,11 +385,10 @@ public class SaveableHelper {
@Override
public void done(final IJobChangeEvent event) {
((InternalSaveable) model).setBackgroundSaveJob(null);
- shellProvider.getShell().getDisplay().asyncExec(
- () -> {
- notifySaveAction(parts);
- model.enableUI(parts);
- });
+ shellProvider.getShell().getDisplay().asyncExec(() -> {
+ notifySaveAction(parts);
+ model.enableUI(parts);
+ });
}
});
// Finally, we are ready to schedule the job.
@@ -440,8 +431,8 @@ public class SaveableHelper {
}
/**
- * Waits for the background save jobs (if any) of the given saveables to complete.
- * This may open a progress dialog with the option to cancel.
+ * Waits for the background save jobs (if any) of the given saveables to
+ * complete. This may open a progress dialog with the option to cancel.
*
* @param modelsToSave
* @return true if the user canceled.
@@ -449,7 +440,8 @@ public class SaveableHelper {
public static boolean waitForBackgroundSaveJobs(final List modelsToSave) {
// block if any of the saveables is still saving in the background
try {
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(monitor -> Job.getJobManager().join(new DynamicFamily(modelsToSave), monitor));
+ PlatformUI.getWorkbench().getProgressService()
+ .busyCursorWhile(monitor -> Job.getJobManager().join(new DynamicFamily(modelsToSave), monitor));
} catch (InvocationTargetException e) {
StatusUtil.handleStatus(e, StatusManager.SHOW | StatusManager.LOG);
} catch (InterruptedException e) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SaveablesList.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SaveablesList.java
index 83830416d35..ebd032645ba 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SaveablesList.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SaveablesList.java
@@ -107,15 +107,13 @@ public class SaveablesList implements ISaveablesLifecycleListener {
allDistinctModels.addAll(saveables.next());
}
- return allDistinctModels.toArray(
- new Saveable[allDistinctModels.size()]);
+ return allDistinctModels.toArray(new Saveable[allDistinctModels.size()]);
}
// returns true if this model has not yet been in getModels()
private boolean addModel(Object source, Saveable model) {
if (model == null) {
- logWarning(
- "Ignored attempt to add invalid saveable", source, model); //$NON-NLS-1$
+ logWarning("Ignored attempt to add invalid saveable", source, model); //$NON-NLS-1$
return false;
}
boolean result = false;
@@ -127,8 +125,7 @@ public class SaveablesList implements ISaveablesLifecycleListener {
if (modelsForSource.add(model)) {
result = incrementRefCount(modelRefCounts, model);
} else {
- logWarning(
- "Ignored attempt to add saveable that was already registered", source, model); //$NON-NLS-1$
+ logWarning("Ignored attempt to add saveable that was already registered", source, model); //$NON-NLS-1$
}
return result;
}
@@ -275,8 +272,7 @@ public class SaveablesList implements ISaveablesLifecycleListener {
/**
*
- * @param key
- * current key
+ * @param key current key
* @return probably existing equal key we use in modelRefCounts map
*/
private Saveable findExistingRefKey(Saveable key) {
@@ -296,8 +292,7 @@ public class SaveablesList implements ISaveablesLifecycleListener {
boolean result = false;
Set<Saveable> modelsForSource = modelMap.get(source);
if (modelsForSource == null) {
- logWarning(
- "Ignored attempt to remove a saveable when no saveables were known", source, model); //$NON-NLS-1$
+ logWarning("Ignored attempt to remove a saveable when no saveables were known", source, model); //$NON-NLS-1$
} else {
if (modelsForSource.remove(model)) {
result = decrementRefCount(model);
@@ -305,8 +300,7 @@ public class SaveablesList implements ISaveablesLifecycleListener {
modelMap.remove(source);
}
} else {
- logWarning(
- "Ignored attempt to remove a saveable that was not registered", source, model); //$NON-NLS-1$
+ logWarning("Ignored attempt to remove a saveable that was not registered", source, model); //$NON-NLS-1$
}
}
return result;
@@ -318,24 +312,22 @@ public class SaveablesList implements ISaveablesLifecycleListener {
+ " from part: " + source); //$NON-NLS-1$
// record the current stack trace to help with debugging
assertionFailedException.fillInStackTrace();
- WorkbenchPlugin.log(StatusUtil.newStatus(IStatus.WARNING, message,
- assertionFailedException));
+ WorkbenchPlugin.log(StatusUtil.newStatus(IStatus.WARNING, message, assertionFailedException));
}
/**
* This implementation of handleModelLifecycleEvent must be called by
* implementers of ISaveablesSource whenever the list of models of the model
* source changes, or when the dirty state of models changes. The
- * ISaveablesSource instance must be passed as the source of the event
- * object.
+ * ISaveablesSource instance must be passed as the source of the event object.
* <p>
- * This method may also be called by objects that hold on to models but are
- * not workbench parts. In this case, the event source must be set to an
- * object that is not an instanceof IWorkbenchPart.
+ * This method may also be called by objects that hold on to models but are not
+ * workbench parts. In this case, the event source must be set to an object that
+ * is not an instanceof IWorkbenchPart.
* </p>
* <p>
- * Corresponding open and close events must originate from the same
- * (identical) event source.
+ * Corresponding open and close events must originate from the same (identical)
+ * event source.
* </p>
* <p>
* This method must be called on the UI thread.
@@ -363,9 +355,8 @@ public class SaveablesList implements ISaveablesLifecycleListener {
}
fillModelsClosing(modelsClosing, modelsDecrementing);
- boolean canceled = promptForSavingIfNecessary(PlatformUI
- .getWorkbench().getActiveWorkbenchWindow(), modelsClosing, modelsDecrementing,
- !event.isForce());
+ boolean canceled = promptForSavingIfNecessary(PlatformUI.getWorkbench().getActiveWorkbenchWindow(),
+ modelsClosing, modelsDecrementing, !event.isForce());
if (canceled) {
event.setVeto(true);
}
@@ -374,14 +365,15 @@ public class SaveablesList implements ISaveablesLifecycleListener {
removeModels(event.getSource(), modelArray);
break;
case SaveablesLifecycleEvent.DIRTY_CHANGED:
- fireModelLifecycleEvent(new SaveablesLifecycleEvent(this, event
- .getEventType(), event.getSaveables(), false));
+ fireModelLifecycleEvent(
+ new SaveablesLifecycleEvent(this, event.getEventType(), event.getSaveables(), false));
break;
}
}
/**
* Updates the set of non-part saveables sources.
+ *
* @param source
*/
private void updateNonPartSource(ISaveablesSource source) {
@@ -405,9 +397,8 @@ public class SaveablesList implements ISaveablesLifecycleListener {
}
}
if (removed.size() > 0) {
- fireModelLifecycleEvent(new SaveablesLifecycleEvent(this,
- SaveablesLifecycleEvent.POST_OPEN, removed
- .toArray(new Saveable[removed.size()]), false));
+ fireModelLifecycleEvent(new SaveablesLifecycleEvent(this, SaveablesLifecycleEvent.POST_OPEN,
+ removed.toArray(new Saveable[removed.size()]), false));
}
}
@@ -423,9 +414,8 @@ public class SaveablesList implements ISaveablesLifecycleListener {
}
}
if (added.size() > 0) {
- fireModelLifecycleEvent(new SaveablesLifecycleEvent(this,
- SaveablesLifecycleEvent.POST_OPEN, added
- .toArray(new Saveable[added.size()]), false));
+ fireModelLifecycleEvent(new SaveablesLifecycleEvent(this, SaveablesLifecycleEvent.POST_OPEN,
+ added.toArray(new Saveable[added.size()]), false));
}
}
@@ -439,16 +429,16 @@ public class SaveablesList implements ISaveablesLifecycleListener {
}
/**
- * Adds the given listener to the list of listeners. Has no effect if the
- * same (identical) listener has already been added. The listener will be
- * notified about changes to the models managed by this model manager. Event
- * types include: <br>
+ * Adds the given listener to the list of listeners. Has no effect if the same
+ * (identical) listener has already been added. The listener will be notified
+ * about changes to the models managed by this model manager. Event types
+ * include: <br>
* POST_OPEN when models were added to the list of models <br>
* POST_CLOSE when models were removed from the list of models <br>
* DIRTY_CHANGED when the dirty state of models changed
* <p>
- * Listeners should ignore all other event types, including PRE_CLOSE. There
- * is no guarantee that listeners are notified before models are closed.
+ * Listeners should ignore all other event types, including PRE_CLOSE. There is
+ * no guarantee that listeners are notified before models are closed.
*
* @param listener
*/
@@ -457,8 +447,8 @@ public class SaveablesList implements ISaveablesLifecycleListener {
}
/**
- * Removes the given listener from the list of listeners. Has no effect if
- * the given listener is not contained in the list.
+ * Removes the given listener from the list of listeners. Has no effect if the
+ * given listener is not contained in the list.
*
* @param listener
*/
@@ -493,8 +483,7 @@ public class SaveablesList implements ISaveablesLifecycleListener {
* @param window
* @return the post close info to be passed to postClose
*/
- public Object preCloseParts(List<IWorkbenchPart> partsToClose, boolean save,
- final IWorkbenchWindow window) {
+ public Object preCloseParts(List<IWorkbenchPart> partsToClose, boolean save, final IWorkbenchWindow window) {
return preCloseParts(partsToClose, save, window, window);
}
@@ -571,8 +560,8 @@ public class SaveablesList implements ISaveablesLifecycleListener {
}
}
if (save) {
- boolean canceled = promptForSavingIfNecessary(shellProvider, window,
- postCloseInfo.modelsClosing, postCloseInfo.modelsDecrementing, true, saveOptions);
+ boolean canceled = promptForSavingIfNecessary(shellProvider, window, postCloseInfo.modelsClosing,
+ postCloseInfo.modelsDecrementing, true, saveOptions);
if (canceled) {
return null;
}
@@ -600,14 +589,12 @@ public class SaveablesList implements ISaveablesLifecycleListener {
* @param canCancel
* @return true if the user canceled
*/
- private boolean promptForSavingIfNecessary(final IWorkbenchWindow window,
- Set<Saveable> modelsClosing, Map<Saveable, Integer> modelsDecrementing, boolean canCancel) {
- return promptForSavingIfNecessary(window, window, modelsClosing, modelsDecrementing,
- canCancel, null);
+ private boolean promptForSavingIfNecessary(final IWorkbenchWindow window, Set<Saveable> modelsClosing,
+ Map<Saveable, Integer> modelsDecrementing, boolean canCancel) {
+ return promptForSavingIfNecessary(window, window, modelsClosing, modelsDecrementing, canCancel, null);
}
- private boolean promptForSavingIfNecessary(IShellProvider shellProvider,
- IWorkbenchWindow window,
+ private boolean promptForSavingIfNecessary(IShellProvider shellProvider, IWorkbenchWindow window,
Set<Saveable> modelsClosing, Map<Saveable, Integer> modelsDecrementing, boolean canCancel,
Map<Saveable, Save> saveOptionMap) {
List<Saveable> modelsToOptionallySave = new ArrayList<>();
@@ -617,8 +604,8 @@ public class SaveablesList implements ISaveablesLifecycleListener {
}
}
- boolean shouldCancel = modelsToOptionallySave.isEmpty() ? false : promptForSaving(
- modelsToOptionallySave, shellProvider, window, canCancel, true, saveOptionMap);
+ boolean shouldCancel = modelsToOptionallySave.isEmpty() ? false
+ : promptForSaving(modelsToOptionallySave, shellProvider, window, canCancel, true, saveOptionMap);
if (shouldCancel) {
return true;
@@ -630,8 +617,8 @@ public class SaveablesList implements ISaveablesLifecycleListener {
modelsToSave.add(modelClosing);
}
}
- return modelsToSave.isEmpty() ? false : promptForSaving(modelsToSave, shellProvider,
- window, canCancel, false, saveOptionMap);
+ return modelsToSave.isEmpty() ? false
+ : promptForSaving(modelsToSave, shellProvider, window, canCancel, false, saveOptionMap);
}
/**
@@ -664,20 +651,23 @@ public class SaveablesList implements ISaveablesLifecycleListener {
}
return saveModels(tobeSaved, shellProvider, runnableContext);
}
+
/**
* Prompt the user to save the given saveables.
- * @param modelsToSave the saveables to be saved
- * @param shellProvider the provider used to obtain a shell in prompting is
- * required. Clients can use a workbench window for this.
- * @param runnableContext a runnable context that will be used to provide a
- * progress monitor while the save is taking place. Clients can
- * use a workbench window for this.
- * @param canCancel whether the operation can be canceled
+ *
+ * @param modelsToSave the saveables to be saved
+ * @param shellProvider the provider used to obtain a shell in prompting is
+ * required. Clients can use a workbench window for
+ * this.
+ * @param runnableContext a runnable context that will be used to provide a
+ * progress monitor while the save is taking place.
+ * Clients can use a workbench window for this.
+ * @param canCancel whether the operation can be canceled
* @param stillOpenElsewhere whether the models are referenced by open parts
* @return true if the user canceled
*/
- public boolean promptForSaving(List<Saveable> modelsToSave,
- final IShellProvider shellProvider, IRunnableContext runnableContext, final boolean canCancel, boolean stillOpenElsewhere) {
+ public boolean promptForSaving(List<Saveable> modelsToSave, final IShellProvider shellProvider,
+ IRunnableContext runnableContext, final boolean canCancel, boolean stillOpenElsewhere) {
// Save parts, exit the method if cancel is pressed.
if (modelsToSave.size() > 0) {
boolean canceled = SaveableHelper.waitForBackgroundSaveJobs(modelsToSave);
@@ -686,7 +676,8 @@ public class SaveablesList implements ISaveablesLifecycleListener {
}
IPreferenceStore apiPreferenceStore = PrefUtil.getAPIPreferenceStore();
- boolean dontPrompt = stillOpenElsewhere && !apiPreferenceStore.getBoolean(IWorkbenchPreferenceConstants.PROMPT_WHEN_SAVEABLE_STILL_OPEN);
+ boolean dontPrompt = stillOpenElsewhere
+ && !apiPreferenceStore.getBoolean(IWorkbenchPreferenceConstants.PROMPT_WHEN_SAVEABLE_STILL_OPEN);
if (dontPrompt) {
modelsToSave.clear();
@@ -706,20 +697,15 @@ public class SaveablesList implements ISaveablesLifecycleListener {
if (canCancel) {
buttonLabelToIdMap.put(WorkbenchMessages.SaveableHelper_Cancel, IDialogConstants.CANCEL_ID);
}
- String message = NLS
- .bind(
- WorkbenchMessages.EditorManager_saveChangesOptionallyQuestion,
- model.getName());
+ String message = NLS.bind(WorkbenchMessages.EditorManager_saveChangesOptionallyQuestion,
+ model.getName());
MessageDialogWithToggle dialogWithToggle = new MessageDialogWithToggle(shellProvider.getShell(),
- WorkbenchMessages.Save_Resource, null, message,
- MessageDialog.QUESTION, buttonLabelToIdMap, 0,
- WorkbenchMessages.EditorManager_closeWithoutPromptingOption, false) {
+ WorkbenchMessages.Save_Resource, null, message, MessageDialog.QUESTION, buttonLabelToIdMap,
+ 0, WorkbenchMessages.EditorManager_closeWithoutPromptingOption, false) {
@Override
protected int getShellStyle() {
- return (canCancel ? SWT.CLOSE : SWT.NONE)
- | SWT.TITLE | SWT.BORDER
- | SWT.APPLICATION_MODAL | SWT.SHEET
- | getDefaultOrientation();
+ return (canCancel ? SWT.CLOSE : SWT.NONE) | SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL
+ | SWT.SHEET | getDefaultOrientation();
}
};
dialog = dialogWithToggle;
@@ -733,19 +719,13 @@ public class SaveablesList implements ISaveablesLifecycleListener {
WorkbenchMessages.SaveableHelper_Dont_Save };
}
- String message = NLS
- .bind(
- WorkbenchMessages.EditorManager_saveChangesQuestion,
- model.getName());
- dialog = new MessageDialog(shellProvider.getShell(),
- WorkbenchMessages.Save_Resource, null, message,
+ String message = NLS.bind(WorkbenchMessages.EditorManager_saveChangesQuestion, model.getName());
+ dialog = new MessageDialog(shellProvider.getShell(), WorkbenchMessages.Save_Resource, null, message,
MessageDialog.QUESTION, 0, buttons) {
@Override
protected int getShellStyle() {
- return (canCancel ? SWT.CLOSE : SWT.NONE)
- | SWT.TITLE | SWT.BORDER
- | SWT.APPLICATION_MODAL | SWT.SHEET
- | getDefaultOrientation();
+ return (canCancel ? SWT.CLOSE : SWT.NONE) | SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL
+ | SWT.SHEET | getDefaultOrientation();
}
};
}
@@ -754,7 +734,7 @@ public class SaveablesList implements ISaveablesLifecycleListener {
if (SaveableHelper.testGetAutomatedResponse() == SaveableHelper.USER_RESPONSE) {
choice = dialog.open();
- if(stillOpenElsewhere) {
+ if (stillOpenElsewhere) {
// map value of choice back to ISaveablePart2 values
switch (choice) {
case IDialogConstants.YES_ID:
@@ -771,7 +751,8 @@ public class SaveablesList implements ISaveablesLifecycleListener {
}
MessageDialogWithToggle dialogWithToggle = (MessageDialogWithToggle) dialog;
if (choice != ISaveablePart2.CANCEL && dialogWithToggle.getToggleState()) {
- apiPreferenceStore.setValue(IWorkbenchPreferenceConstants.PROMPT_WHEN_SAVEABLE_STILL_OPEN, false);
+ apiPreferenceStore.setValue(IWorkbenchPreferenceConstants.PROMPT_WHEN_SAVEABLE_STILL_OPEN,
+ false);
}
}
}
@@ -790,11 +771,8 @@ public class SaveablesList implements ISaveablesLifecycleListener {
return true;
}
} else {
- MyListSelectionDialog dlg = new MyListSelectionDialog(
- shellProvider.getShell(),
- modelsToSave,
- new ArrayContentProvider(),
- new WorkbenchPartLabelProvider(),
+ MyListSelectionDialog dlg = new MyListSelectionDialog(shellProvider.getShell(), modelsToSave,
+ new ArrayContentProvider(), new WorkbenchPartLabelProvider(),
stillOpenElsewhere ? WorkbenchMessages.EditorManager_saveResourcesOptionallyMessage
: WorkbenchMessages.EditorManager_saveResourcesMessage,
canCancel, stillOpenElsewhere);
@@ -809,7 +787,8 @@ public class SaveablesList implements ISaveablesLifecycleListener {
return true;
if (dlg.getDontPromptSelection()) {
- apiPreferenceStore.setValue(IWorkbenchPreferenceConstants.PROMPT_WHEN_SAVEABLE_STILL_OPEN, false);
+ apiPreferenceStore.setValue(IWorkbenchPreferenceConstants.PROMPT_WHEN_SAVEABLE_STILL_OPEN,
+ false);
}
modelsToSave = new ArrayList<>();
@@ -828,12 +807,13 @@ public class SaveablesList implements ISaveablesLifecycleListener {
/**
* Save the given models.
- * @param finalModels the list of models to be saved
- * @param shellProvider the provider used to obtain a shell in prompting is
- * required. Clients can use a workbench window for this.
+ *
+ * @param finalModels the list of models to be saved
+ * @param shellProvider the provider used to obtain a shell in prompting is
+ * required. Clients can use a workbench window for this.
* @param runnableContext a runnable context that will be used to provide a
- * progress monitor while the save is taking place. Clients can
- * use a workbench window for this.
+ * progress monitor while the save is taking place.
+ * Clients can use a workbench window for this.
* @return <code>true</code> if the operation was canceled
*/
public boolean saveModels(final List<Saveable> finalModels, final IShellProvider shellProvider,
@@ -844,15 +824,12 @@ public class SaveablesList implements ISaveablesLifecycleListener {
/**
* Save the given models.
*
- * @param finalModels
- * the list of models to be saved
- * @param shellProvider
- * the provider used to obtain a shell in prompting is required.
- * Clients can use a workbench window for this.
- * @param runnableContext
- * a runnable context that will be used to provide a progress
- * monitor while the save is taking place. Clients can use a
- * workbench window for this.
+ * @param finalModels the list of models to be saved
+ * @param shellProvider the provider used to obtain a shell in prompting is
+ * required. Clients can use a workbench window for this.
+ * @param runnableContext a runnable context that will be used to provide a
+ * progress monitor while the save is taking place.
+ * Clients can use a workbench window for this.
* @param blockUntilSaved
* @return <code>true</code> if the operation was canceled
*/
@@ -869,8 +846,7 @@ public class SaveablesList implements ISaveablesLifecycleListener {
subMonitor.worked(1);
continue;
}
- SaveableHelper.doSaveModel(model, subMonitor.split(1),
- shellProvider, blockUntilSaved);
+ SaveableHelper.doSaveModel(model, subMonitor.split(1), shellProvider, blockUntilSaved);
if (subMonitor.isCanceled())
break;
}
@@ -878,8 +854,7 @@ public class SaveablesList implements ISaveablesLifecycleListener {
};
// Do the save.
- return !SaveableHelper.runProgressMonitorOperation(
- WorkbenchMessages.Save_All, progressOp, runnableContext,
+ return !SaveableHelper.runProgressMonitorOperation(WorkbenchMessages.Save_All, progressOp, runnableContext,
shellProvider);
}
@@ -911,19 +886,16 @@ public class SaveablesList implements ISaveablesLifecycleListener {
}
}
if (removed.size() > 0) {
- fireModelLifecycleEvent(new SaveablesLifecycleEvent(this,
- SaveablesLifecycleEvent.POST_CLOSE, removed
- .toArray(new Saveable[removed.size()]), false));
+ fireModelLifecycleEvent(new SaveablesLifecycleEvent(this, SaveablesLifecycleEvent.POST_CLOSE,
+ removed.toArray(new Saveable[removed.size()]), false));
}
}
/**
- * Returns the saveable models provided by the given part. If the part does
- * not provide any models, a default model is returned representing the
- * part.
+ * Returns the saveable models provided by the given part. If the part does not
+ * provide any models, a default model is returned representing the part.
*
- * @param part
- * the workbench part
+ * @param part the workbench part
* @return the saveable models
*/
private Saveable[] getSaveables(IWorkbenchPart part) {
@@ -950,8 +922,8 @@ public class SaveablesList implements ISaveablesLifecycleListener {
public void dirtyChanged(IWorkbenchPart part) {
Saveable[] saveables = getSaveables(part);
if (saveables.length > 0) {
- fireModelLifecycleEvent(new SaveablesLifecycleEvent(this,
- SaveablesLifecycleEvent.DIRTY_CHANGED, saveables, false));
+ fireModelLifecycleEvent(
+ new SaveablesLifecycleEvent(this, SaveablesLifecycleEvent.DIRTY_CHANGED, saveables, false));
}
}
@@ -972,15 +944,13 @@ public class SaveablesList implements ISaveablesLifecycleListener {
return result.toArray();
}
- private static final class MyListSelectionDialog extends
- ListSelectionDialog {
+ private static final class MyListSelectionDialog extends ListSelectionDialog {
private final boolean canCancel;
private Button checkbox;
private boolean dontPromptSelection;
private boolean stillOpenElsewhere;
- private MyListSelectionDialog(Shell shell, Object input,
- IStructuredContentProvider contentprovider,
+ private MyListSelectionDialog(Shell shell, Object input, IStructuredContentProvider contentprovider,
ILabelProvider labelProvider, String message, boolean canCancel, boolean stillOpenElsewhere) {
super(shell, input, contentprovider, labelProvider, message);
this.canCancel = canCancel;
@@ -1006,26 +976,27 @@ public class SaveablesList implements ISaveablesLifecycleListener {
@Override
protected Control createDialogArea(Composite parent) {
- Composite dialogAreaComposite = (Composite) super.createDialogArea(parent);
-
- if (stillOpenElsewhere) {
- Composite checkboxComposite = new Composite(dialogAreaComposite, SWT.NONE);
- checkboxComposite.setLayout(new GridLayout(2, false));
-
- checkbox = new Button(checkboxComposite, SWT.CHECK);
- checkbox.addSelectionListener(widgetSelectedAdapter(e -> dontPromptSelection = checkbox.getSelection()));
- GridData gd = new GridData();
- gd.horizontalAlignment = SWT.BEGINNING;
- checkbox.setLayoutData(gd);
-
- Label label = new Label(checkboxComposite, SWT.NONE);
- label.setText(WorkbenchMessages.EditorManager_closeWithoutPromptingOption);
- gd = new GridData();
- gd.grabExcessHorizontalSpace = true;
- gd.horizontalAlignment = SWT.BEGINNING;
- }
-
- return dialogAreaComposite;
+ Composite dialogAreaComposite = (Composite) super.createDialogArea(parent);
+
+ if (stillOpenElsewhere) {
+ Composite checkboxComposite = new Composite(dialogAreaComposite, SWT.NONE);
+ checkboxComposite.setLayout(new GridLayout(2, false));
+
+ checkbox = new Button(checkboxComposite, SWT.CHECK);
+ checkbox.addSelectionListener(
+ widgetSelectedAdapter(e -> dontPromptSelection = checkbox.getSelection()));
+ GridData gd = new GridData();
+ gd.horizontalAlignment = SWT.BEGINNING;
+ checkbox.setLayoutData(gd);
+
+ Label label = new Label(checkboxComposite, SWT.NONE);
+ label.setText(WorkbenchMessages.EditorManager_closeWithoutPromptingOption);
+ gd = new GridData();
+ gd.grabExcessHorizontalSpace = true;
+ gd.horizontalAlignment = SWT.BEGINNING;
+ }
+
+ return dialogAreaComposite;
}
}
@@ -1034,8 +1005,7 @@ public class SaveablesList implements ISaveablesLifecycleListener {
* list which are not workbench parts.
*/
public ISaveablesSource[] getNonPartSources() {
- return nonPartSources
- .toArray(new ISaveablesSource[nonPartSources.size()]);
+ return nonPartSources.toArray(new ISaveablesSource[nonPartSources.size()]);
}
public IWorkbenchPart[] getPartsForSaveable(Saveable model) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SelectionAdapterFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SelectionAdapterFactory.java
index cc009e3b0f0..a08095fcde0 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SelectionAdapterFactory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SelectionAdapterFactory.java
@@ -36,8 +36,7 @@ public class SelectionAdapterFactory implements IAdapterFactory {
/**
* The classes we can adapt to.
*/
- private static final Class[] CLASSES = new Class[] { IIterable.class,
- ICountable.class };
+ private static final Class[] CLASSES = new Class[] { IIterable.class, ICountable.class };
@Override
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SelectionConversionService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SelectionConversionService.java
index 52e5a77972b..89409755f7a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SelectionConversionService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SelectionConversionService.java
@@ -38,18 +38,16 @@ public class SelectionConversionService implements ISelectionConversionService {
/**
* Attempt to convert the elements in the passed selection into resources by
- * asking each for its IResource property (iff it isn't already a resource).
- * If all elements in the initial selection can be converted to resources
- * then answer a new selection containing these resources; otherwise answer
- * an empty selection.
+ * asking each for its IResource property (iff it isn't already a resource). If
+ * all elements in the initial selection can be converted to resources then
+ * answer a new selection containing these resources; otherwise answer an empty
+ * selection.
*
- * @param originalSelection
- * the original selection
+ * @param originalSelection the original selection
* @return the converted selection or an empty selection.
*/
@Override
- public IStructuredSelection convertToResources(
- IStructuredSelection originalSelection) {
+ public IStructuredSelection convertToResources(IStructuredSelection originalSelection) {
// @issue resource-specific code should be pushed into IDE
Class resourceClass = LegacyResourceSupport.getResourceClass();
if (resourceClass == null) {
@@ -62,9 +60,9 @@ public class SelectionConversionService implements ISelectionConversionService {
while (elements.hasNext()) {
Object currentElement = elements.next();
Object resource = Adapters.adapt(currentElement, resourceClass);
- if (resource != null) {
- result.add(resource);
- }
+ if (resource != null) {
+ result.add(resource);
+ }
}
// all that can be converted are done, answer new selection
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SharedImages.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SharedImages.java
index 9e97b0c4d5c..8c9cb4b17a1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SharedImages.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SharedImages.java
@@ -21,34 +21,35 @@ import org.eclipse.ui.ISharedImages;
* Common images used by the workbench which may be useful to other plug-ins.
*/
public class SharedImages implements ISharedImages {
- /**
- * Retrieves the specified image from the workbench plugin's image registry.
- *
- * @see ISharedImages
- */
- @Override
+ /**
+ * Retrieves the specified image from the workbench plugin's image registry.
+ *
+ * @see ISharedImages
+ */
+ @Override
public Image getImage(String symbolicName) {
- Image image = WorkbenchImages.getImage(symbolicName);
- if (image != null) {
+ Image image = WorkbenchImages.getImage(symbolicName);
+ if (image != null) {
return image;
}
- //if there is a descriptor for it, add the image to the registry.
- ImageDescriptor desc = WorkbenchImages.getImageDescriptor(symbolicName);
- if (desc != null) {
- WorkbenchImages.getImageRegistry().put(symbolicName, desc);
- return WorkbenchImages.getImageRegistry().get(symbolicName);
- }
- return null;
- }
+ // if there is a descriptor for it, add the image to the registry.
+ ImageDescriptor desc = WorkbenchImages.getImageDescriptor(symbolicName);
+ if (desc != null) {
+ WorkbenchImages.getImageRegistry().put(symbolicName, desc);
+ return WorkbenchImages.getImageRegistry().get(symbolicName);
+ }
+ return null;
+ }
- /**
- * Retrieves the specified image descriptor from the workbench plugin's image registry.
- *
- * @see ISharedImages
- */
- @Override
+ /**
+ * Retrieves the specified image descriptor from the workbench plugin's image
+ * registry.
+ *
+ * @see ISharedImages
+ */
+ @Override
public ImageDescriptor getImageDescriptor(String symbolicName) {
- return WorkbenchImages.getImageDescriptor(symbolicName);
- }
+ return WorkbenchImages.getImageDescriptor(symbolicName);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShellPool.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShellPool.java
index b575055e05d..fc416205448 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShellPool.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShellPool.java
@@ -25,117 +25,116 @@ import org.eclipse.swt.widgets.Shell;
/**
* Manages a pool of shells. This can be used instead of creating and destroying
- * shells. By reusing shells, they will never be disposed until the pool goes away.
- * This is useful in situations where client code may have cached pointers to the
- * shells to use as a parent for dialogs. It also works around bug 86226 (SWT menus
- * cannot be reparented).
+ * shells. By reusing shells, they will never be disposed until the pool goes
+ * away. This is useful in situations where client code may have cached pointers
+ * to the shells to use as a parent for dialogs. It also works around bug 86226
+ * (SWT menus cannot be reparented).
*
* @since 3.1
*/
public class ShellPool {
- private int flags;
+ private int flags;
- /**
- * Parent shell (or null if none)
- */
- private Shell parentShell;
+ /**
+ * Parent shell (or null if none)
+ */
+ private Shell parentShell;
- private LinkedList availableShells = new LinkedList();
+ private LinkedList availableShells = new LinkedList();
- private static final String CLOSE_LISTENER = "close listener"; //$NON-NLS-1$
+ private static final String CLOSE_LISTENER = "close listener"; //$NON-NLS-1$
- private boolean isDisposed = false;
+ private boolean isDisposed = false;
- private DisposeListener disposeListener = new DisposeListener() {
- @Override
+ private DisposeListener disposeListener = new DisposeListener() {
+ @Override
public void widgetDisposed(DisposeEvent e) {
- WorkbenchPlugin.log(new RuntimeException("Widget disposed too early!")); //$NON-NLS-1$
- }
- };
+ WorkbenchPlugin.log(new RuntimeException("Widget disposed too early!")); //$NON-NLS-1$
+ }
+ };
- private ShellListener closeListener = new ShellAdapter() {
+ private ShellListener closeListener = new ShellAdapter() {
- @Override
+ @Override
public void shellClosed(ShellEvent e) {
- if (isDisposed) {
- return;
- }
+ if (isDisposed) {
+ return;
+ }
- if (e.doit) {
- Shell s = (Shell)e.widget;
- ShellListener l = (ShellListener)s.getData(CLOSE_LISTENER);
+ if (e.doit) {
+ Shell s = (Shell) e.widget;
+ ShellListener l = (ShellListener) s.getData(CLOSE_LISTENER);
- if (l != null) {
- s.setData(CLOSE_LISTENER, null);
- l.shellClosed(e);
+ if (l != null) {
+ s.setData(CLOSE_LISTENER, null);
+ l.shellClosed(e);
- // The shell can 'cancel' the close by setting
- // the 'doit' to false...if so, do nothing
- if (e.doit) {
+ // The shell can 'cancel' the close by setting
+ // the 'doit' to false...if so, do nothing
+ if (e.doit) {
for (Control control : s.getChildren()) {
- control.dispose();
- }
- availableShells.add(s);
- s.setVisible(false);
- }
- else {
- // Restore the listener
- s.setData(CLOSE_LISTENER, l);
- }
- }
- }
- e.doit = false;
- }
- };
-
- /**
- * Creates a shell pool that allocates shells that are children of the
- * given parent and are created with the given flags.
- *
- * @param parentShell parent shell (may be null, indicating that this pool creates
- * top-level shells)
- * @param childFlags flags for all child shells
- */
- public ShellPool(Shell parentShell, int childFlags) {
- this.parentShell = parentShell;
- this.flags = childFlags;
- }
-
- /**
- * Returns a new shell. The shell must not be disposed directly, but it may be closed.
- * Once the shell is closed, it will be returned to the shell pool. Note: callers must
- * remove all listeners from the shell before closing it.
- */
- public Shell allocateShell(ShellListener closeListener) {
- Shell result;
- if (!availableShells.isEmpty()) {
- result = (Shell)availableShells.removeFirst();
- } else {
- result = new Shell(parentShell, flags);
- result.addShellListener(this.closeListener);
- result.addDisposeListener(disposeListener);
- }
-
- result.setData(CLOSE_LISTENER, closeListener);
- return result;
- }
-
- /**
- * Disposes this pool. Any unused shells in the pool are disposed immediately,
- * and any shells in use will be disposed once they are closed.
- *
- * @since 3.1
- */
- public void dispose() {
- for (Iterator iter = availableShells.iterator(); iter.hasNext();) {
- Shell next = (Shell) iter.next();
- next.removeDisposeListener(disposeListener);
-
- next.dispose();
- }
-
- availableShells.clear();
- isDisposed = true;
- }
+ control.dispose();
+ }
+ availableShells.add(s);
+ s.setVisible(false);
+ } else {
+ // Restore the listener
+ s.setData(CLOSE_LISTENER, l);
+ }
+ }
+ }
+ e.doit = false;
+ }
+ };
+
+ /**
+ * Creates a shell pool that allocates shells that are children of the given
+ * parent and are created with the given flags.
+ *
+ * @param parentShell parent shell (may be null, indicating that this pool
+ * creates top-level shells)
+ * @param childFlags flags for all child shells
+ */
+ public ShellPool(Shell parentShell, int childFlags) {
+ this.parentShell = parentShell;
+ this.flags = childFlags;
+ }
+
+ /**
+ * Returns a new shell. The shell must not be disposed directly, but it may be
+ * closed. Once the shell is closed, it will be returned to the shell pool.
+ * Note: callers must remove all listeners from the shell before closing it.
+ */
+ public Shell allocateShell(ShellListener closeListener) {
+ Shell result;
+ if (!availableShells.isEmpty()) {
+ result = (Shell) availableShells.removeFirst();
+ } else {
+ result = new Shell(parentShell, flags);
+ result.addShellListener(this.closeListener);
+ result.addDisposeListener(disposeListener);
+ }
+
+ result.setData(CLOSE_LISTENER, closeListener);
+ return result;
+ }
+
+ /**
+ * Disposes this pool. Any unused shells in the pool are disposed immediately,
+ * and any shells in use will be disposed once they are closed.
+ *
+ * @since 3.1
+ */
+ public void dispose() {
+ for (Iterator iter = availableShells.iterator(); iter.hasNext();) {
+ Shell next = (Shell) iter.next();
+ next.removeDisposeListener(disposeListener);
+
+ next.dispose();
+ }
+
+ availableShells.clear();
+ isDisposed = true;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowInHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowInHandler.java
index 183ba8caa95..5470b220a16 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowInHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowInHandler.java
@@ -55,8 +55,7 @@ public class ShowInHandler extends AbstractHandler implements IElementUpdater {
((WorkbenchPage) p).updateShowInSources(r.getModel());
}
- String targetId = event
- .getParameter(IWorkbenchCommandConstants.NAVIGATE_SHOW_IN_PARM_TARGET);
+ String targetId = event.getParameter(IWorkbenchCommandConstants.NAVIGATE_SHOW_IN_PARM_TARGET);
if (targetId == null) {
throw new ExecutionException("No targetId specified"); //$NON-NLS-1$
}
@@ -66,17 +65,16 @@ public class ShowInHandler extends AbstractHandler implements IElementUpdater {
if (sps != null) {
ISourceProvider sp = sps.getSourceProvider(ISources.SHOW_IN_SELECTION);
if (sp instanceof WorkbenchSourceProvider) {
- ((WorkbenchSourceProvider)sp).checkActivePart(true);
+ ((WorkbenchSourceProvider) sp).checkActivePart(true);
}
}
- ShowInContext context = getContext(HandlerUtil
- .getShowInSelection(event), HandlerUtil.getShowInInput(event));
+ ShowInContext context = getContext(HandlerUtil.getShowInSelection(event), HandlerUtil.getShowInInput(event));
if (context == null) {
return null;
}
- IWorkbenchPage page= activeWorkbenchWindow.getActivePage();
+ IWorkbenchPage page = activeWorkbenchWindow.getActivePage();
try {
IViewPart view = page.showView(targetId);
@@ -94,8 +92,8 @@ public class ShowInHandler extends AbstractHandler implements IElementUpdater {
}
/**
- * Returns the <code>ShowInContext</code> to show in the selected target,
- * or <code>null</code> if there is no valid context to show.
+ * Returns the <code>ShowInContext</code> to show in the selected target, or
+ * <code>null</code> if there is no valid context to show.
* <p>
* This implementation obtains the context from global variables provide.
* showInSelection and showInInput should be available.
@@ -114,8 +112,7 @@ public class ShowInHandler extends AbstractHandler implements IElementUpdater {
* Returns the <code>IShowInTarget</code> for the given part, or
* <code>null</code> if it does not provide one.
*
- * @param targetPart
- * the target part
+ * @param targetPart the target part
* @return the <code>IShowInTarget</code> or <code>null</code>
*/
private IShowInTarget getShowInTarget(IWorkbenchPart targetPart) {
@@ -124,8 +121,7 @@ public class ShowInHandler extends AbstractHandler implements IElementUpdater {
@Override
public void updateElement(UIElement element, Map parameters) {
- String targetId = (String) parameters
- .get(IWorkbenchCommandConstants.NAVIGATE_SHOW_IN_PARM_TARGET);
+ String targetId = (String) parameters.get(IWorkbenchCommandConstants.NAVIGATE_SHOW_IN_PARM_TARGET);
if (targetId == null || targetId.length() == 0) {
return;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowInMenu.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowInMenu.java
index 483f714498e..1bfd6e16b13 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowInMenu.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowInMenu.java
@@ -69,8 +69,7 @@ import org.eclipse.ui.views.IViewRegistry;
* actions. The items to show are determined from the active perspective and
* active part.
*/
-public class ShowInMenu extends ContributionItem implements
- IWorkbenchContribution {
+public class ShowInMenu extends ContributionItem implements IWorkbenchContribution {
private static final String NO_TARGETS_MSG = WorkbenchMessages.Workbench_showInNoTargets;
@@ -94,10 +93,8 @@ public class ShowInMenu extends ContributionItem implements
/**
* Creates a Show In menu.
*
- * @param window
- * the window containing the menu
- * @param id
- * The ID for this contribution
+ * @param window the window containing the menu
+ * @param id The ID for this contribution
*/
public ShowInMenu(IWorkbenchWindow window, String id) {
super(id);
@@ -127,7 +124,7 @@ public class ShowInMenu extends ContributionItem implements
return;
}
- if (currentManager!=null && currentManager.getSize() > 0) {
+ if (currentManager != null && currentManager.getSize() > 0) {
// IMenuService service = (IMenuService) locator
// .getService(IMenuService.class);
// service.releaseContributions(currentManager);
@@ -180,9 +177,7 @@ public class ShowInMenu extends ContributionItem implements
if (context == null) {
return;
}
- if (context.getInput() == null
- && (context.getSelection() == null || context.getSelection()
- .isEmpty())) {
+ if (context.getInput() == null && (context.getSelection() == null || context.getSelection().isEmpty())) {
return;
}
@@ -194,10 +189,8 @@ public class ShowInMenu extends ContributionItem implements
}
}
if (sourcePart != null && innerMgr instanceof MenuManager) {
- ISourceProviderService sps = locator
- .getService(ISourceProviderService.class);
- ISourceProvider sp = sps
- .getSourceProvider(ISources.SHOW_IN_SELECTION);
+ ISourceProviderService sps = locator.getService(ISourceProviderService.class);
+ ISourceProvider sp = sps.getSourceProvider(ISources.SHOW_IN_SELECTION);
if (sp instanceof WorkbenchSourceProvider) {
((WorkbenchSourceProvider) sp).checkActivePart(true);
}
@@ -206,18 +199,15 @@ public class ShowInMenu extends ContributionItem implements
String location = MenuUtil.SHOW_IN_MENU_ID;
location = location.substring(location.indexOf(':') + 1);
WorkbenchWindow workbenchWindow = (WorkbenchWindow) getWindow();
- MApplication application = workbenchWindow.getModel().getContext()
- .get(MApplication.class);
+ MApplication application = workbenchWindow.getModel().getContext().get(MApplication.class);
MMenu menuModel = MenuFactoryImpl.eINSTANCE.createMenu();
final ArrayList<MMenuContribution> toContribute = new ArrayList<>();
final ArrayList<MMenuElement> menuContributionsToRemove = new ArrayList<>();
- ExpressionContext eContext = new ExpressionContext(workbenchWindow.getModel()
- .getContext());
- ContributionsAnalyzer.gatherMenuContributions(menuModel,
- application.getMenuContributions(), location, toContribute, eContext, true);
- ContributionsAnalyzer.addMenuContributions(menuModel, toContribute,
- menuContributionsToRemove);
+ ExpressionContext eContext = new ExpressionContext(workbenchWindow.getModel().getContext());
+ ContributionsAnalyzer.gatherMenuContributions(menuModel, application.getMenuContributions(), location,
+ toContribute, eContext, true);
+ ContributionsAnalyzer.addMenuContributions(menuModel, toContribute, menuContributionsToRemove);
ICommandImageService imgService = workbenchWindow.getService(ICommandImageService.class);
@@ -225,9 +215,8 @@ public class ShowInMenu extends ContributionItem implements
if (menuElement instanceof MHandledMenuItem) {
MCommand command = ((MHandledMenuItem) menuElement).getCommand();
String commandId = command.getElementId();
- CommandContributionItemParameter ccip = new CommandContributionItemParameter(
- workbenchWindow, commandId, commandId,
- CommandContributionItem.STYLE_PUSH);
+ CommandContributionItemParameter ccip = new CommandContributionItemParameter(workbenchWindow,
+ commandId, commandId, CommandContributionItem.STYLE_PUSH);
String label = menuElement.getLabel();
if (label != null && label.length() > 0) {
ccip.label = label;
@@ -256,16 +245,15 @@ public class ShowInMenu extends ContributionItem implements
/**
* Return the appropriate command contribution item for the parameter.
+ *
* @param viewDescriptor
* @return the show in command contribution item
*/
protected IContributionItem getContributionItem(IViewDescriptor viewDescriptor) {
- CommandContributionItemParameter parm = new CommandContributionItemParameter(
- locator, viewDescriptor.getId(), IWorkbenchCommandConstants.NAVIGATE_SHOW_IN,
- CommandContributionItem.STYLE_PUSH);
+ CommandContributionItemParameter parm = new CommandContributionItemParameter(locator, viewDescriptor.getId(),
+ IWorkbenchCommandConstants.NAVIGATE_SHOW_IN, CommandContributionItem.STYLE_PUSH);
HashMap<String, String> targetId = new HashMap<>();
- targetId.put(IWorkbenchCommandConstants.NAVIGATE_SHOW_IN_PARM_TARGET,
- viewDescriptor.getId());
+ targetId.put(IWorkbenchCommandConstants.NAVIGATE_SHOW_IN_PARM_TARGET, viewDescriptor.getId());
parm.parameters = targetId;
parm.label = viewDescriptor.getLabel();
if (parm.label.length() > 0) {
@@ -276,8 +264,8 @@ public class ShowInMenu extends ContributionItem implements
}
/**
- * Returns the Show In... target part ids for the given source part. Merges
- * the contributions from the current perspective and the source part.
+ * Returns the Show In... target part ids for the given source part. Merges the
+ * contributions from the current perspective and the source part.
*/
private ArrayList<Object> getShowInPartIds(IWorkbenchPart sourcePart) {
ArrayList<Object> targetIds = new ArrayList<>();
@@ -312,8 +300,8 @@ public class ShowInMenu extends ContributionItem implements
* Returns the source part, or <code>null</code> if there is no applicable
* source part
* <p>
- * This implementation returns the current part in the window. Subclasses
- * may extend or reimplement.
+ * This implementation returns the current part in the window. Subclasses may
+ * extend or reimplement.
*
* @return the source part or <code>null</code>
*/
@@ -328,13 +316,12 @@ public class ShowInMenu extends ContributionItem implements
}
/**
- * Returns the <code>ShowInContext</code> to show in the selected target,
- * or <code>null</code> if there is no valid context to show.
+ * Returns the <code>ShowInContext</code> to show in the selected target, or
+ * <code>null</code> if there is no valid context to show.
* <p>
- * This implementation obtains the context from the
- * <code>IShowInSource</code> of the source part (if provided), or, if the
- * source part is an editor, it creates the context from the editor's input
- * and selection.
+ * This implementation obtains the context from the <code>IShowInSource</code>
+ * of the source part (if provided), or, if the source part is an editor, it
+ * creates the context from the editor's input and selection.
* <p>
* Subclasses may extend or reimplement.
*
@@ -372,8 +359,7 @@ public class ShowInMenu extends ContributionItem implements
descs.add(desc);
}
}
- return descs.toArray(new IViewDescriptor[descs
- .size()]);
+ return descs.toArray(new IViewDescriptor[descs.size()]);
}
@Override
@@ -385,8 +371,7 @@ public class ShowInMenu extends ContributionItem implements
if (locator == null)
return null;
- IWorkbenchLocationService wls = locator
- .getService(IWorkbenchLocationService.class);
+ IWorkbenchLocationService wls = locator.getService(IWorkbenchLocationService.class);
if (window == null) {
window = wls.getWorkbenchWindow();
@@ -414,7 +399,7 @@ public class ShowInMenu extends ContributionItem implements
if (getParent() instanceof MenuManager) {
((MenuManager) getParent()).removeMenuListener(menuListener);
}
- window=null;
- locator=null;
+ window = null;
+ locator = null;
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowViewMenu.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowViewMenu.java
index 34872252d75..8e8b0616082 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowViewMenu.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowViewMenu.java
@@ -58,16 +58,17 @@ import org.eclipse.ui.views.IViewDescriptor;
import org.eclipse.ui.views.IViewRegistry;
/**
- * A <code>ShowViewMenu</code> is used to populate a menu manager with Show
- * View actions. The visible views are determined by user preference from the
+ * A <code>ShowViewMenu</code> is used to populate a menu manager with Show View
+ * actions. The visible views are determined by user preference from the
* Perspective Customize dialog.
*/
public class ShowViewMenu extends ContributionItem {
/**
- * @deprecated As of 3.5, replaced by {@link IWorkbenchCommandConstants#VIEWS_SHOW_VIEW}
+ * @deprecated As of 3.5, replaced by
+ * {@link IWorkbenchCommandConstants#VIEWS_SHOW_VIEW}
*/
@Deprecated
- public static final String SHOW_VIEW_ID= IWorkbenchCommandConstants.VIEWS_SHOW_VIEW;
+ public static final String SHOW_VIEW_ID = IWorkbenchCommandConstants.VIEWS_SHOW_VIEW;
/**
* @deprecated As of 3.6, replaced by
* {@link IWorkbenchCommandConstants#VIEWS_SHOW_VIEW_PARM_ID}
@@ -102,14 +103,11 @@ public class ShowViewMenu extends ContributionItem {
private static Collator collator;
-
/**
* Creates a Show View menu.
*
- * @param window
- * the window containing the menu
- * @param id
- * the id
+ * @param window the window containing the menu
+ * @param id the id
*/
public ShowViewMenu(IWorkbenchWindow window, String id) {
this(window, id, false);
@@ -118,21 +116,16 @@ public class ShowViewMenu extends ContributionItem {
/**
* Creates a Show View menu.
*
- * @param window
- * the window containing the menu
- * @param id
- * the id
+ * @param window the window containing the menu
+ * @param id the id
* @param makeFast use the fact view variant of the command
*/
- public ShowViewMenu(IWorkbenchWindow window, String id,
- final boolean makeFast) {
+ public ShowViewMenu(IWorkbenchWindow window, String id, final boolean makeFast) {
super(id);
this.window = window;
this.makeFast = makeFast;
- final IHandlerService handlerService = window
- .getService(IHandlerService.class);
- final ICommandService commandService = window
- .getService(ICommandService.class);
+ final IHandlerService handlerService = window.getService(IHandlerService.class);
+ final ICommandService commandService = window.getService(ICommandService.class);
final ParameterizedCommand cmd = getCommand(commandService, makeFast);
showDlgAction = new Action(WorkbenchMessages.ShowView_title) {
@@ -152,12 +145,10 @@ public class ShowViewMenu extends ContributionItem {
}
};
- window.getWorkbench().getHelpSystem().setHelp(showDlgAction,
- IWorkbenchHelpContextIds.SHOW_VIEW_OTHER_ACTION);
+ window.getWorkbench().getHelpSystem().setHelp(showDlgAction, IWorkbenchHelpContextIds.SHOW_VIEW_OTHER_ACTION);
// indicate that a show views submenu has been created
if (window instanceof WorkbenchWindow) {
- ((WorkbenchWindow) window)
- .addSubmenu(WorkbenchWindow.SHOW_VIEW_SUBMENU);
+ ((WorkbenchWindow) window).addSubmenu(WorkbenchWindow.SHOW_VIEW_SUBMENU);
}
showDlgAction.setActionDefinitionId(IWorkbenchCommandConstants.VIEWS_SHOW_VIEW);
@@ -228,14 +219,12 @@ public class ShowViewMenu extends ContributionItem {
innerMgr.add(showDlgAction);
}
- static class PluginCCIP extends CommandContributionItemParameter implements
- IPluginContribution {
+ static class PluginCCIP extends CommandContributionItemParameter implements IPluginContribution {
private String localId;
private String pluginId;
- public PluginCCIP(IViewDescriptor v, IServiceLocator serviceLocator,
- String id, String commandId, int style) {
+ public PluginCCIP(IViewDescriptor v, IServiceLocator serviceLocator, String id, String commandId, int style) {
super(serviceLocator, id, commandId, style);
localId = ((ViewDescriptor) v).getLocalId();
pluginId = ((ViewDescriptor) v).getPluginId();
@@ -256,23 +245,20 @@ public class ShowViewMenu extends ContributionItem {
private CommandContributionItemParameter getItem(String viewId) {
IViewRegistry reg = WorkbenchPlugin.getDefault().getViewRegistry();
IViewDescriptor desc = reg.find(viewId);
- if (desc==null) {
+ if (desc == null) {
return null;
}
String label = desc.getLabel();
- CommandContributionItemParameter parms = new PluginCCIP(desc,
- window, viewId, IWorkbenchCommandConstants.VIEWS_SHOW_VIEW,
- CommandContributionItem.STYLE_PUSH);
+ CommandContributionItemParameter parms = new PluginCCIP(desc, window, viewId,
+ IWorkbenchCommandConstants.VIEWS_SHOW_VIEW, CommandContributionItem.STYLE_PUSH);
parms.label = label;
parms.icon = desc.getImageDescriptor();
parms.parameters = new HashMap();
parms.parameters.put(VIEW_ID_PARM, viewId);
if (makeFast) {
- parms.parameters.put(
- IWorkbenchCommandConstants.VIEWS_SHOW_VIEW_PARM_FASTVIEW,
- "true"); //$NON-NLS-1$
+ parms.parameters.put(IWorkbenchCommandConstants.VIEWS_SHOW_VIEW_PARM_FASTVIEW, "true"); //$NON-NLS-1$
}
return parms;
}
@@ -339,16 +325,13 @@ public class ShowViewMenu extends ContributionItem {
* @param commandService
* @param makeFast
*/
- private ParameterizedCommand getCommand(ICommandService commandService,
- final boolean makeFast) {
+ private ParameterizedCommand getCommand(ICommandService commandService, final boolean makeFast) {
Command c = commandService.getCommand(IWorkbenchCommandConstants.VIEWS_SHOW_VIEW);
Parameterization[] parms = null;
if (makeFast) {
try {
- IParameter parmDef = c
- .getParameter(IWorkbenchCommandConstants.VIEWS_SHOW_VIEW_PARM_FASTVIEW);
- parms = new Parameterization[] { new Parameterization(parmDef,
- "true") //$NON-NLS-1$
+ IParameter parmDef = c.getParameter(IWorkbenchCommandConstants.VIEWS_SHOW_VIEW_PARM_FASTVIEW);
+ parms = new Parameterization[] { new Parameterization(parmDef, "true") //$NON-NLS-1$
};
} catch (NotDefinedException e) {
// this should never happen
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowViewMenuHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowViewMenuHandler.java
index 6d58ef03775..ebe082069a1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowViewMenuHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowViewMenuHandler.java
@@ -76,8 +76,7 @@ public class ShowViewMenuHandler extends AbstractEvaluationHandler {
final Control topRight = ctf.getTopRight();
if (topRight instanceof Composite) {
for (Control child : ((Composite) topRight).getChildren()) {
- if (child instanceof ToolBar
- && "ViewMenu".equals(child.getData())) { //$NON-NLS-1$
+ if (child instanceof ToolBar && "ViewMenu".equals(child.getData())) { //$NON-NLS-1$
ToolBar tb = (ToolBar) child;
ToolItem ti = tb.getItem(0);
Event sevent = new Event();
@@ -102,8 +101,7 @@ public class ShowViewMenuHandler extends AbstractEvaluationHandler {
return null;
}
- private void showStandaloneViewMenu(ExecutionEvent event, MPart model, MMenu menuModel,
- Composite partContainer) {
+ private void showStandaloneViewMenu(ExecutionEvent event, MPart model, MMenu menuModel, Composite partContainer) {
Shell shell = partContainer.getShell();
Menu menu = (Menu) menuModel.getWidget();
if (menu == null) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SlavePageService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SlavePageService.java
index 12e87dc0030..797623b7d78 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SlavePageService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SlavePageService.java
@@ -29,13 +29,11 @@ public class SlavePageService implements IPageService, IDisposable {
private IPageService parent;
private ListenerList<IPageListener> pageListeners = new ListenerList<>(ListenerList.IDENTITY);
- private ListenerList<IPerspectiveListener> perspectiveListeners = new ListenerList<>(
- ListenerList.IDENTITY);
+ private ListenerList<IPerspectiveListener> perspectiveListeners = new ListenerList<>(ListenerList.IDENTITY);
public SlavePageService(IPageService parent) {
if (parent == null) {
- throw new IllegalArgumentException(
- "Parent IPageService cannot be null"); //$NON-NLS-1$
+ throw new IllegalArgumentException("Parent IPageService cannot be null"); //$NON-NLS-1$
}
this.parent = parent;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SlavePartService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SlavePartService.java
index debc420f252..5849484db7b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SlavePartService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SlavePartService.java
@@ -47,14 +47,12 @@ public class SlavePartService implements IPartService, IDisposable {
/**
* Constructs a new instance.
*
- * @param parentPartService
- * The parent part service for this slave. Never
- * <code>null</code>.
+ * @param parentPartService The parent part service for this slave. Never
+ * <code>null</code>.
*/
public SlavePartService(IPartService parentPartService) {
if (parentPartService == null) {
- throw new IllegalArgumentException(
- "The parent part service cannot be null"); //$NON-NLS-1$
+ throw new IllegalArgumentException("The parent part service cannot be null"); //$NON-NLS-1$
}
this.parent = parentPartService;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SlaveSelectionService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SlaveSelectionService.java
index 1c23839e022..98544041bdb 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SlaveSelectionService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SlaveSelectionService.java
@@ -41,8 +41,7 @@ public class SlaveSelectionService implements ISelectionService, IDisposable {
*/
public SlaveSelectionService(ISelectionService parentSelectionService) {
if (parentSelectionService == null) {
- throw new IllegalArgumentException(
- "The parent selection service cannot be null"); //$NON-NLS-1$
+ throw new IllegalArgumentException("The parent selection service cannot be null"); //$NON-NLS-1$
}
this.parentSelectionService = parentSelectionService;
}
@@ -54,8 +53,7 @@ public class SlaveSelectionService implements ISelectionService, IDisposable {
}
@Override
- public void addPostSelectionListener(String partId,
- ISelectionListener listener) {
+ public void addPostSelectionListener(String partId, ISelectionListener listener) {
listenersToPartId.put(listener, partId);
parentSelectionService.addPostSelectionListener(partId, listener);
}
@@ -89,8 +87,7 @@ public class SlaveSelectionService implements ISelectionService, IDisposable {
}
@Override
- public void removePostSelectionListener(String partId,
- ISelectionListener listener) {
+ public void removePostSelectionListener(String partId, ISelectionListener listener) {
postListenersToPartId.remove(listener);
parentSelectionService.removePostSelectionListener(partId, listener);
}
@@ -102,8 +99,7 @@ public class SlaveSelectionService implements ISelectionService, IDisposable {
}
@Override
- public void removeSelectionListener(String partId,
- ISelectionListener listener) {
+ public void removeSelectionListener(String partId, ISelectionListener listener) {
listenersToPartId.remove(listener);
parentSelectionService.removeSelectionListener(partId, listener);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SplitHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SplitHandler.java
index c230560402a..c2b85fa19f6 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SplitHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SplitHandler.java
@@ -31,6 +31,7 @@ import org.eclipse.ui.handlers.HandlerUtil;
/**
* Our sample handler extends AbstractHandler, an IHandler base class.
+ *
* @see org.eclipse.core.commands.IHandler
* @see org.eclipse.core.commands.AbstractHandler
*/
@@ -52,7 +53,7 @@ public class SplitHandler extends AbstractHandler {
window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
// Get services
- modelService = editorPart.getContext().get(EModelService.class);
+ modelService = editorPart.getContext().get(EModelService.class);
MPartStack stack = getStackFor(editorPart);
if (stack == null)
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/StandardTrim.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/StandardTrim.java
index de940a594cd..fb6556dc4c7 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/StandardTrim.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/StandardTrim.java
@@ -116,15 +116,15 @@ public class StandardTrim {
if (wbw == null) {
// Create one assuming there's no defined perspective
Workbench wb = (Workbench) PlatformUI.getWorkbench();
- wb.createWorkbenchWindow(wb.getDefaultPageInput(), null,
- modelService.getTopLevelWindowFor(toolControl), false);
+ wb.createWorkbenchWindow(wb.getDefaultPageInput(), null, modelService.getTopLevelWindowFor(toolControl),
+ false);
wbw = (WorkbenchWindow) context.get(IWorkbenchWindow.class);
}
if (wbw != null) {
Workbench wb = (Workbench) PlatformUI.getWorkbench();
- wb.createWorkbenchWindow(wb.getDefaultPageInput(), null,
- modelService.getTopLevelWindowFor(toolControl), false);
+ wb.createWorkbenchWindow(wb.getDefaultPageInput(), null, modelService.getTopLevelWindowFor(toolControl),
+ false);
wbw = (WorkbenchWindow) context.get(IWorkbenchWindow.class);
manager = wbw.getStatusLineManager();
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/StartupThreading.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/StartupThreading.java
index f99cb109caa..42dd53fde70 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/StartupThreading.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/StartupThreading.java
@@ -61,8 +61,7 @@ public final class StartupThreading {
} else if (throwable instanceof WorkbenchException) {
throw (WorkbenchException) throwable;
} else {
- throw new WorkbenchException(StatusUtil.newStatus(
- WorkbenchPlugin.PI_WORKBENCH, throwable));
+ throw new WorkbenchException(StatusUtil.newStatus(WorkbenchPlugin.PI_WORKBENCH, throwable));
}
}
}
@@ -78,8 +77,7 @@ public final class StartupThreading {
} else if (throwable instanceof WorkbenchException) {
throw (PartInitException) throwable;
} else {
- throw new PartInitException(StatusUtil.newStatus(
- WorkbenchPlugin.PI_WORKBENCH, throwable));
+ throw new PartInitException(StatusUtil.newStatus(WorkbenchPlugin.PI_WORKBENCH, throwable));
}
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SwitchToWindowMenu.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SwitchToWindowMenu.java
index 5a07c32d6e9..7dab7674ab9 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SwitchToWindowMenu.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SwitchToWindowMenu.java
@@ -27,111 +27,110 @@ import org.eclipse.ui.IWorkbenchWindow;
* A dynamic menu item to switch to other opened workbench windows.
*/
public class SwitchToWindowMenu extends ContributionItem {
- private static final int MAX_TEXT_LENGTH = 40;
+ private static final int MAX_TEXT_LENGTH = 40;
- private IWorkbenchWindow workbenchWindow;
+ private IWorkbenchWindow workbenchWindow;
- private boolean showSeparator;
+ private boolean showSeparator;
- /**
- * Creates a new instance of this class.
- *
- * @param window the workbench window this action applies to
- * @param showSeparator whether to add a separator in the menu
- */
- public SwitchToWindowMenu(IWorkbenchWindow window, String id,
- boolean showSeparator) {
- super(id);
- this.workbenchWindow = window;
- this.showSeparator = showSeparator;
- }
+ /**
+ * Creates a new instance of this class.
+ *
+ * @param window the workbench window this action applies to
+ * @param showSeparator whether to add a separator in the menu
+ */
+ public SwitchToWindowMenu(IWorkbenchWindow window, String id, boolean showSeparator) {
+ super(id);
+ this.workbenchWindow = window;
+ this.showSeparator = showSeparator;
+ }
- /**
- * Returns the text for a window. This may be truncated to fit
- * within the MAX_TEXT_LENGTH.
- */
- private String calcText(int number, IWorkbenchWindow window) {
- String suffix = window.getShell().getText();
- if (suffix == null) {
+ /**
+ * Returns the text for a window. This may be truncated to fit within the
+ * MAX_TEXT_LENGTH.
+ */
+ private String calcText(int number, IWorkbenchWindow window) {
+ String suffix = window.getShell().getText();
+ if (suffix == null) {
return null;
}
- StringBuilder sb = new StringBuilder();
- if (number < 10) {
+ StringBuilder sb = new StringBuilder();
+ if (number < 10) {
sb.append('&');
}
- sb.append(number);
- sb.append(' ');
- if (suffix.length() <= MAX_TEXT_LENGTH) {
- sb.append(suffix);
- } else {
- sb.append(suffix.substring(0, MAX_TEXT_LENGTH));
- sb.append("..."); //$NON-NLS-1$
- }
- return sb.toString();
- }
+ sb.append(number);
+ sb.append(' ');
+ if (suffix.length() <= MAX_TEXT_LENGTH) {
+ sb.append(suffix);
+ } else {
+ sb.append(suffix.substring(0, MAX_TEXT_LENGTH));
+ sb.append("..."); //$NON-NLS-1$
+ }
+ return sb.toString();
+ }
- /**
- * Fills the given menu with menu items for all
- * opened workbench windows.
- */
- @Override
+ /**
+ * Fills the given menu with menu items for all opened workbench windows.
+ */
+ @Override
public void fill(Menu menu, int index) {
- // Get workbench windows.
- IWorkbench workbench = workbenchWindow.getWorkbench();
- IWorkbenchWindow[] array = workbench.getWorkbenchWindows();
- // avoid showing the separator and list for 0 or 1 items
- if (array.length < 2) {
+ // Get workbench windows.
+ IWorkbench workbench = workbenchWindow.getWorkbench();
+ IWorkbenchWindow[] array = workbench.getWorkbenchWindows();
+ // avoid showing the separator and list for 0 or 1 items
+ if (array.length < 2) {
return;
}
- // Add separator.
- if (showSeparator) {
- new MenuItem(menu, SWT.SEPARATOR, index);
- ++index;
- }
+ // Add separator.
+ if (showSeparator) {
+ new MenuItem(menu, SWT.SEPARATOR, index);
+ ++index;
+ }
- // Add one item for each window.
- int count = 1;
+ // Add one item for each window.
+ int count = 1;
for (IWorkbenchWindow window : array) {
- // can encounter disposed shells if this update is in response to a shell closing
- if (!window.getShell().isDisposed()) {
- String name = calcText(count, window);
- if (name != null) {
- MenuItem mi = new MenuItem(menu, SWT.RADIO, index);
- index++;
- count++;
- mi.setText(name);
- mi.addSelectionListener(widgetSelectedAdapter(e -> {
- Shell windowShell = window.getShell();
- if (windowShell.getMinimized()) {
+ // can encounter disposed shells if this update is in response to a shell
+ // closing
+ if (!window.getShell().isDisposed()) {
+ String name = calcText(count, window);
+ if (name != null) {
+ MenuItem mi = new MenuItem(menu, SWT.RADIO, index);
+ index++;
+ count++;
+ mi.setText(name);
+ mi.addSelectionListener(widgetSelectedAdapter(e -> {
+ Shell windowShell = window.getShell();
+ if (windowShell.getMinimized()) {
windowShell.setMinimized(false);
}
- windowShell.setActive();
- windowShell.moveAbove(null);
+ windowShell.setActive();
+ windowShell.moveAbove(null);
}));
- mi.setSelection(window == workbenchWindow);
- }
- }
- }
- }
+ mi.setSelection(window == workbenchWindow);
+ }
+ }
+ }
+ }
- /**
- * Overridden to always return true and force dynamic menu building.
- */
- @Override
+ /**
+ * Overridden to always return true and force dynamic menu building.
+ */
+ @Override
public boolean isDirty() {
return true;
- }
+ }
- /**
- * Overridden to always return true and force dynamic menu building.
- */
- @Override
+ /**
+ * Overridden to always return true and force dynamic menu building.
+ */
+ @Override
public boolean isDynamic() {
- return true;
- }
+ return true;
+ }
@Override
public void dispose() {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ToggleEditorsVisibilityAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ToggleEditorsVisibilityAction.java
index 1ba1d9d6c29..913e8db5a9c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ToggleEditorsVisibilityAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ToggleEditorsVisibilityAction.java
@@ -19,70 +19,65 @@ import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
/**
- * Hides or shows the editor area within the current
- * perspective of the workbench page.
+ * Hides or shows the editor area within the current perspective of the
+ * workbench page.
*/
-public class ToggleEditorsVisibilityAction extends PerspectiveAction implements
- IPerspectiveListener {
+public class ToggleEditorsVisibilityAction extends PerspectiveAction implements IPerspectiveListener {
- @Override
- public void perspectiveActivated(IWorkbenchPage page,
- IPerspectiveDescriptor perspective) {
- if (page.isEditorAreaVisible()) {
- setText(WorkbenchMessages.ToggleEditor_hideEditors);
- } else {
- setText(WorkbenchMessages.ToggleEditor_showEditors);
- }
- }
+ @Override
+ public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
+ if (page.isEditorAreaVisible()) {
+ setText(WorkbenchMessages.ToggleEditor_hideEditors);
+ } else {
+ setText(WorkbenchMessages.ToggleEditor_showEditors);
+ }
+ }
- @Override
- public void perspectiveChanged(IWorkbenchPage page,
- IPerspectiveDescriptor perspective, String changeId) {
- if (changeId == IWorkbenchPage.CHANGE_RESET
- || changeId == IWorkbenchPage.CHANGE_EDITOR_AREA_HIDE
- || changeId == IWorkbenchPage.CHANGE_EDITOR_AREA_SHOW) {
- if (page.isEditorAreaVisible()) {
- setText(WorkbenchMessages.ToggleEditor_hideEditors);
- } else {
- setText(WorkbenchMessages.ToggleEditor_showEditors);
- }
- }
- }
+ @Override
+ public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId) {
+ if (changeId == IWorkbenchPage.CHANGE_RESET || changeId == IWorkbenchPage.CHANGE_EDITOR_AREA_HIDE
+ || changeId == IWorkbenchPage.CHANGE_EDITOR_AREA_SHOW) {
+ if (page.isEditorAreaVisible()) {
+ setText(WorkbenchMessages.ToggleEditor_hideEditors);
+ } else {
+ setText(WorkbenchMessages.ToggleEditor_showEditors);
+ }
+ }
+ }
- /**
- * Creates a new <code>ToggleEditorsVisibilityAction</code>
- *
- * @param window the window
- */
- public ToggleEditorsVisibilityAction(IWorkbenchWindow window) {
- super(window);
- setText(WorkbenchMessages.ToggleEditor_hideEditors);
- setActionDefinitionId("org.eclipse.ui.window.hideShowEditors"); //$NON-NLS-1$
- // @issue missing action id
- setToolTipText(WorkbenchMessages.ToggleEditor_toolTip);
- window.getWorkbench().getHelpSystem().setHelp(this,
- IWorkbenchHelpContextIds.TOGGLE_EDITORS_VISIBILITY_ACTION);
- window.addPerspectiveListener(this);
- }
+ /**
+ * Creates a new <code>ToggleEditorsVisibilityAction</code>
+ *
+ * @param window the window
+ */
+ public ToggleEditorsVisibilityAction(IWorkbenchWindow window) {
+ super(window);
+ setText(WorkbenchMessages.ToggleEditor_hideEditors);
+ setActionDefinitionId("org.eclipse.ui.window.hideShowEditors"); //$NON-NLS-1$
+ // @issue missing action id
+ setToolTipText(WorkbenchMessages.ToggleEditor_toolTip);
+ window.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.TOGGLE_EDITORS_VISIBILITY_ACTION);
+ window.addPerspectiveListener(this);
+ }
- @Override
+ @Override
protected void run(IWorkbenchPage page, IPerspectiveDescriptor persp) {
- boolean visible = page.isEditorAreaVisible();
- if (visible) {
- page.setEditorAreaVisible(false);
- setText(WorkbenchMessages.ToggleEditor_showEditors);
- } else {
- page.setEditorAreaVisible(true);
- setText(WorkbenchMessages.ToggleEditor_hideEditors);
- }
- }
+ boolean visible = page.isEditorAreaVisible();
+ if (visible) {
+ page.setEditorAreaVisible(false);
+ setText(WorkbenchMessages.ToggleEditor_showEditors);
+ } else {
+ page.setEditorAreaVisible(true);
+ setText(WorkbenchMessages.ToggleEditor_hideEditors);
+ }
+ }
- @Override
+ @Override
public void dispose() {
- if (getWindow() != null) {
- getWindow().removePerspectiveListener(this);
- }
- super.dispose();
- }
+ if (getWindow() != null) {
+ getWindow().removePerspectiveListener(this);
+ }
+ super.dispose();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/TrimFrame.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/TrimFrame.java
index ed3f2590905..a91fe47780a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/TrimFrame.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/TrimFrame.java
@@ -30,12 +30,10 @@ import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.ui.themes.ColorUtil;
/**
- * Draws a styled frame around its contained controls.
- * This class is intended to be used to wrap various
- * trim elements that appear in the workbench.
+ * Draws a styled frame around its contained controls. This class is intended to
+ * be used to wrap various trim elements that appear in the workbench.
*
- * Currently this class expects a <b>single</b> child
- * control.
+ * Currently this class expects a <b>single</b> child control.
*
* @since 3.3
*
@@ -43,150 +41,148 @@ import org.eclipse.ui.themes.ColorUtil;
public class TrimFrame {
private static int blend = 40;
- Canvas canvas = null;
-
- public TrimFrame(Composite parent) {
- createControl(parent);
- }
-
- private void createControl(Composite parent) {
- dispose();
- canvas = new Canvas(parent, SWT.NONE);
- canvas.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
-
- // paint the border
- canvas.addPaintListener(new PaintListener() {
- private void drawLine (GC gc, int x1, int y1, int x2, int y2, boolean flipXY) {
- if (flipXY) {
- int tmp = x1;
- x1 = y1;
- y1 = tmp;
- tmp = x2;
- x2 = y2;
- y2 = tmp;
- }
-
- gc.drawLine(x1, y1, x2, y2);
- }
-
- @Override
+ Canvas canvas = null;
+
+ public TrimFrame(Composite parent) {
+ createControl(parent);
+ }
+
+ private void createControl(Composite parent) {
+ dispose();
+ canvas = new Canvas(parent, SWT.NONE);
+ canvas.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
+
+ // paint the border
+ canvas.addPaintListener(new PaintListener() {
+ private void drawLine(GC gc, int x1, int y1, int x2, int y2, boolean flipXY) {
+ if (flipXY) {
+ int tmp = x1;
+ x1 = y1;
+ y1 = tmp;
+ tmp = x2;
+ x2 = y2;
+ y2 = tmp;
+ }
+
+ gc.drawLine(x1, y1, x2, y2);
+ }
+
+ @Override
public void paintControl(PaintEvent e) {
- Canvas canvas = (Canvas)e.widget;
- Control child = canvas.getChildren ()[0];
-
- // Are we horizontally or vertically aligned
- boolean flipXY = false;
- if (child instanceof ToolBar && (((ToolBar)child).getStyle() & SWT.VERTICAL) != 0)
- flipXY = true;
- else if (child instanceof CoolBar && (((CoolBar)child).getStyle() & SWT.VERTICAL) != 0)
- flipXY = true;
-
- Rectangle bb = canvas.getBounds();
- int maxX = bb.width-1;
- int maxY = bb.height-1;
-
- if (flipXY) {
- int tmp = maxX;
- maxX = maxY;
- maxY = tmp;
- }
-
- Color white = e.gc.getDevice ().getSystemColor(SWT.COLOR_WHITE);
- Color shadow = e.gc.getDevice().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
- RGB outerRGB = ColorUtil.blend(white.getRGB(), shadow.getRGB(), blend);
- Color outerColor = new Color(e.gc.getDevice(), outerRGB);
-
- // Draw the 'outer' bits
- e.gc.setForeground(outerColor);
-
- // Top Line and curve
- drawLine(e.gc, 1, 0, maxX-5, 0, flipXY);
- drawLine(e.gc, maxX-4, 1, maxX-3, 1, flipXY);
- drawLine(e.gc, maxX-2, 2, maxX-2, 2, flipXY);
- drawLine(e.gc, maxX-1, 3, maxX-1, 4, flipXY);
-
- // Bottom line and curve
- drawLine(e.gc, 1, maxY, maxX-5, maxY, flipXY);
- drawLine( e.gc, maxX-4, maxY-1, maxX-3, maxY-1, flipXY);
- drawLine(e.gc, maxX-2, maxY-2, maxX-2, maxY-2, flipXY);
- drawLine(e.gc, maxX-1, maxY-3, maxX-1, maxY-4, flipXY);
-
- // Left & Right edges
- drawLine(e.gc, 0, 1, 0, maxY-1, flipXY);
- drawLine(e.gc, maxX, 5, maxX, maxY-5, flipXY);
-
- // Dispose the color since we created it...
- outerColor.dispose();
-
- // Draw the 'inner' curve
- e.gc.setForeground (white);
-
- drawLine(e.gc, 1, 1, maxX-5, 1, flipXY);
- drawLine(e.gc, maxX-4, 2, maxX-3, 2, flipXY);
- drawLine(e.gc, maxX-3, 3, maxX-2, 3, flipXY);
- drawLine( e.gc, maxX-2, 4, maxX-2, 4, flipXY);
-
- drawLine(e.gc, 1, maxY-1, maxX-5, maxY-1, flipXY);
- drawLine(e.gc, maxX-4, maxY-2, maxX-3, maxY-2, flipXY);
- drawLine( e.gc, maxX-3, maxY-3, maxX-2, maxY-3, flipXY);
- drawLine(e.gc, maxX-2, maxY-4, maxX-2, maxY-4, flipXY);
-
- // Left and Right sides
- drawLine(e.gc, 1, 1, 1, maxY-1, flipXY);
- drawLine(e.gc, maxX-1, 5, maxX-1, maxY-5, flipXY);
- }
- });
-
- // provide a layout that provides enough extra space to
- // draw the border and to place the child conrol in the
- // correct location
- canvas.setLayout(new Layout() {
+ Canvas canvas = (Canvas) e.widget;
+ Control child = canvas.getChildren()[0];
+
+ // Are we horizontally or vertically aligned
+ boolean flipXY = false;
+ if (child instanceof ToolBar && (((ToolBar) child).getStyle() & SWT.VERTICAL) != 0)
+ flipXY = true;
+ else if (child instanceof CoolBar && (((CoolBar) child).getStyle() & SWT.VERTICAL) != 0)
+ flipXY = true;
+
+ Rectangle bb = canvas.getBounds();
+ int maxX = bb.width - 1;
+ int maxY = bb.height - 1;
+
+ if (flipXY) {
+ int tmp = maxX;
+ maxX = maxY;
+ maxY = tmp;
+ }
+
+ Color white = e.gc.getDevice().getSystemColor(SWT.COLOR_WHITE);
+ Color shadow = e.gc.getDevice().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
+ RGB outerRGB = ColorUtil.blend(white.getRGB(), shadow.getRGB(), blend);
+ Color outerColor = new Color(e.gc.getDevice(), outerRGB);
+
+ // Draw the 'outer' bits
+ e.gc.setForeground(outerColor);
+
+ // Top Line and curve
+ drawLine(e.gc, 1, 0, maxX - 5, 0, flipXY);
+ drawLine(e.gc, maxX - 4, 1, maxX - 3, 1, flipXY);
+ drawLine(e.gc, maxX - 2, 2, maxX - 2, 2, flipXY);
+ drawLine(e.gc, maxX - 1, 3, maxX - 1, 4, flipXY);
+
+ // Bottom line and curve
+ drawLine(e.gc, 1, maxY, maxX - 5, maxY, flipXY);
+ drawLine(e.gc, maxX - 4, maxY - 1, maxX - 3, maxY - 1, flipXY);
+ drawLine(e.gc, maxX - 2, maxY - 2, maxX - 2, maxY - 2, flipXY);
+ drawLine(e.gc, maxX - 1, maxY - 3, maxX - 1, maxY - 4, flipXY);
+
+ // Left & Right edges
+ drawLine(e.gc, 0, 1, 0, maxY - 1, flipXY);
+ drawLine(e.gc, maxX, 5, maxX, maxY - 5, flipXY);
+
+ // Dispose the color since we created it...
+ outerColor.dispose();
+
+ // Draw the 'inner' curve
+ e.gc.setForeground(white);
+
+ drawLine(e.gc, 1, 1, maxX - 5, 1, flipXY);
+ drawLine(e.gc, maxX - 4, 2, maxX - 3, 2, flipXY);
+ drawLine(e.gc, maxX - 3, 3, maxX - 2, 3, flipXY);
+ drawLine(e.gc, maxX - 2, 4, maxX - 2, 4, flipXY);
+
+ drawLine(e.gc, 1, maxY - 1, maxX - 5, maxY - 1, flipXY);
+ drawLine(e.gc, maxX - 4, maxY - 2, maxX - 3, maxY - 2, flipXY);
+ drawLine(e.gc, maxX - 3, maxY - 3, maxX - 2, maxY - 3, flipXY);
+ drawLine(e.gc, maxX - 2, maxY - 4, maxX - 2, maxY - 4, flipXY);
+
+ // Left and Right sides
+ drawLine(e.gc, 1, 1, 1, maxY - 1, flipXY);
+ drawLine(e.gc, maxX - 1, 5, maxX - 1, maxY - 5, flipXY);
+ }
+ });
+
+ // provide a layout that provides enough extra space to
+ // draw the border and to place the child conrol in the
+ // correct location
+ canvas.setLayout(new Layout() {
@Override
- protected Point computeSize(Composite composite, int wHint,
- int hHint, boolean changed) {
- Control[] children = composite.getChildren();
+ protected Point computeSize(Composite composite, int wHint, int hHint, boolean changed) {
+ Control[] children = composite.getChildren();
- if (children.length == 0)
- return new Point(0,0);
+ if (children.length == 0)
+ return new Point(0, 0);
- Point innerSize = children[0].computeSize(hHint, wHint, changed);
- innerSize.x += 4;
- innerSize.y += 4;
+ Point innerSize = children[0].computeSize(hHint, wHint, changed);
+ innerSize.x += 4;
+ innerSize.y += 4;
- Control child = children[0];
- if (child instanceof CoolBar && (((CoolBar)child).getStyle() & SWT.VERTICAL) != 0)
- innerSize.y += 3;
- else
- innerSize.x += 3;
+ Control child = children[0];
+ if (child instanceof CoolBar && (((CoolBar) child).getStyle() & SWT.VERTICAL) != 0)
+ innerSize.y += 3;
+ else
+ innerSize.x += 3;
- return innerSize;
- }
+ return innerSize;
+ }
- @Override
+ @Override
protected void layout(Composite composite, boolean flushCache) {
- Control[] children = composite.getChildren();
- if (children.length == 0)
- return;
-
- children[0].setLocation(2, 2);
- }
- });
- }
-
- /**
- * Dispose the frame
- */
- private void dispose() {
- if (canvas != null && !canvas.isDisposed())
- canvas.dispose();
- }
-
- /**
- * @return The border canvas
- */
- public Composite getComposite() {
- return canvas;
- }
+ Control[] children = composite.getChildren();
+ if (children.length == 0)
+ return;
+
+ children[0].setLocation(2, 2);
+ }
+ });
+ }
+
+ /**
+ * Dispose the frame
+ */
+ private void dispose() {
+ if (canvas != null && !canvas.isDisposed())
+ canvas.dispose();
+ }
+
+ /**
+ * @return The border canvas
+ */
+ public Composite getComposite() {
+ return canvas;
+ }
}
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/TrimUtil.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/TrimUtil.java
index af7e65219b9..7300ca45cff 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/TrimUtil.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/TrimUtil.java
@@ -34,24 +34,24 @@ import org.eclipse.swt.widgets.ToolItem;
*/
public class TrimUtil {
- /**
- * Default height for workbench trim.
- */
- public static final int TRIM_DEFAULT_HEIGHT;
- static {
- Shell s = new Shell(Display.getCurrent(), SWT.NONE);
- s.setLayout(new GridLayout());
- ToolBar t = new ToolBar(s, SWT.NONE);
- t.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- ToolItem ti = new ToolItem(t, SWT.PUSH);
- ti.setImage(JFaceResources.getImageRegistry().get(Dialog.DLG_IMG_MESSAGE_INFO));
- s.layout();
- int toolItemHeight = t.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
- GC gc = new GC(s);
- Point fontSize = gc.textExtent("Wg"); //$NON-NLS-1$
- gc.dispose();
- TRIM_DEFAULT_HEIGHT = Math.max(toolItemHeight, fontSize.y);
- s.dispose();
+ /**
+ * Default height for workbench trim.
+ */
+ public static final int TRIM_DEFAULT_HEIGHT;
+ static {
+ Shell s = new Shell(Display.getCurrent(), SWT.NONE);
+ s.setLayout(new GridLayout());
+ ToolBar t = new ToolBar(s, SWT.NONE);
+ t.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ ToolItem ti = new ToolItem(t, SWT.PUSH);
+ ti.setImage(JFaceResources.getImageRegistry().get(Dialog.DLG_IMG_MESSAGE_INFO));
+ s.layout();
+ int toolItemHeight = t.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
+ GC gc = new GC(s);
+ Point fontSize = gc.textExtent("Wg"); //$NON-NLS-1$
+ gc.dispose();
+ TRIM_DEFAULT_HEIGHT = Math.max(toolItemHeight, fontSize.y);
+ s.dispose();
- }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/UILockListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/UILockListener.java
index 9b243f7160d..e3adcc83c04 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/UILockListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/UILockListener.java
@@ -24,131 +24,131 @@ import org.eclipse.core.runtime.jobs.LockListener;
import org.eclipse.swt.widgets.Display;
/**
- * The UI lock listener is used to prevent the UI thread from deadlocking on
- * a lock when the thread owning the lock is attempting to syncExec.
+ * The UI lock listener is used to prevent the UI thread from deadlocking on a
+ * lock when the thread owning the lock is attempting to syncExec.
*/
public class UILockListener extends LockListener {
- /**
- * The Queue is the construct that keeps track of Semaphores.
- */
- public static class Queue {
- private static final int BASE_SIZE = 8;
-
- protected PendingSyncExec[] elements = new PendingSyncExec[BASE_SIZE];
-
- protected int head = 0;
-
- protected int tail = 0;
-
- /**
- * Add the semaphore to the queue.
- * @param element
- */
- public synchronized void add(PendingSyncExec element) {
- int newTail = increment(tail);
- if (newTail == head) {
- grow();
- newTail = tail + 1;
- }
- elements[tail] = element;
- tail = newTail;
- }
-
- private void grow() {
- int newSize = elements.length * 2;
- PendingSyncExec[] newElements = new PendingSyncExec[newSize];
- if (tail >= head) {
+ /**
+ * The Queue is the construct that keeps track of Semaphores.
+ */
+ public static class Queue {
+ private static final int BASE_SIZE = 8;
+
+ protected PendingSyncExec[] elements = new PendingSyncExec[BASE_SIZE];
+
+ protected int head = 0;
+
+ protected int tail = 0;
+
+ /**
+ * Add the semaphore to the queue.
+ *
+ * @param element
+ */
+ public synchronized void add(PendingSyncExec element) {
+ int newTail = increment(tail);
+ if (newTail == head) {
+ grow();
+ newTail = tail + 1;
+ }
+ elements[tail] = element;
+ tail = newTail;
+ }
+
+ private void grow() {
+ int newSize = elements.length * 2;
+ PendingSyncExec[] newElements = new PendingSyncExec[newSize];
+ if (tail >= head) {
System.arraycopy(elements, head, newElements, head, size());
} else {
- int newHead = newSize - (elements.length - head);
- System.arraycopy(elements, 0, newElements, 0, tail + 1);
- System.arraycopy(elements, head, newElements, newHead,
- (newSize - newHead));
- head = newHead;
- }
- elements = newElements;
- }
-
- private int increment(int index) {
- return (index == (elements.length - 1)) ? 0 : index + 1;
- }
-
- /**
- * Remove the next semaphore to be woken up.
- * @return
- */
- public synchronized PendingSyncExec remove() {
- if (tail == head) {
+ int newHead = newSize - (elements.length - head);
+ System.arraycopy(elements, 0, newElements, 0, tail + 1);
+ System.arraycopy(elements, head, newElements, newHead, (newSize - newHead));
+ head = newHead;
+ }
+ elements = newElements;
+ }
+
+ private int increment(int index) {
+ return (index == (elements.length - 1)) ? 0 : index + 1;
+ }
+
+ /**
+ * Remove the next semaphore to be woken up.
+ *
+ * @return
+ */
+ public synchronized PendingSyncExec remove() {
+ if (tail == head) {
return null;
}
- PendingSyncExec result = elements[head];
- elements[head] = null;
- head = increment(head);
- //reset the queue if it is empty and it has grown
- if (tail == head && elements.length > BASE_SIZE) {
- elements = new PendingSyncExec[BASE_SIZE];
- tail = head = 0;
- }
- return result;
- }
+ PendingSyncExec result = elements[head];
+ elements[head] = null;
+ head = increment(head);
+ // reset the queue if it is empty and it has grown
+ if (tail == head && elements.length > BASE_SIZE) {
+ elements = new PendingSyncExec[BASE_SIZE];
+ tail = head = 0;
+ }
+ return result;
+ }
- private int size() {
- return tail > head ? (tail - head)
- : ((elements.length - head) + tail);
- }
- }
+ private int size() {
+ return tail > head ? (tail - head) : ((elements.length - head) + tail);
+ }
+ }
- protected Display display;
+ protected Display display;
- protected final Queue pendingWork = new Queue();
+ protected final Queue pendingWork = new Queue();
- protected PendingSyncExec currentWork = null;
+ protected PendingSyncExec currentWork = null;
/**
* Points to the UI thread if it is currently waiting on a lock or null
*/
protected volatile Thread ui;
- /**
- * Create a new instance of the receiver.
- * @param display
- */
- public UILockListener(Display display) {
- this.display = display;
- }
+ /**
+ * Create a new instance of the receiver.
+ *
+ * @param display
+ */
+ public UILockListener(Display display) {
+ this.display = display;
+ }
- @Override
+ @Override
public void aboutToRelease() {
- if (isUI()) {
+ if (isUI()) {
ui = null;
}
- }
+ }
- @Override
+ @Override
public boolean aboutToWait(Thread lockOwner) {
- if (isUI()) {
- // If a syncExec was executed from the current operation, it
- // has already acquired the lock. So, just return true.
- if (currentWork != null
- && currentWork.getOperationThread() == lockOwner) {
+ if (isUI()) {
+ // If a syncExec was executed from the current operation, it
+ // has already acquired the lock. So, just return true.
+ if (currentWork != null && currentWork.getOperationThread() == lockOwner) {
return true;
}
- ui = Thread.currentThread();
- try {
- doPendingWork();
- } finally {
- //UI field may be nulled if there is a nested wait during execution
- //of pending work, so make sure it is assigned before we start waiting
- ui = Thread.currentThread();
- }
- }
- return false;
- }
-
- void addPendingWork(PendingSyncExec work) {
- pendingWork.add(work);
- }
+ ui = Thread.currentThread();
+ try {
+ doPendingWork();
+ } finally {
+ // UI field may be nulled if there is a nested wait during execution
+ // of pending work, so make sure it is assigned before we start waiting
+ ui = Thread.currentThread();
+ }
+ }
+ return false;
+ }
+
+ void addPendingWork(PendingSyncExec work) {
+ pendingWork.add(work);
+ }
@Override
public boolean canBlock() {
@@ -177,17 +177,16 @@ public class UILockListener extends LockListener {
void interruptUI(Runnable runnable) {
reportInterruption(runnable);
- display.getThread().interrupt();
- }
+ display.getThread().interrupt();
+ }
- boolean isLockOwner() {
- return isLockOwnerThread();
- }
+ boolean isLockOwner() {
+ return isLockOwnerThread();
+ }
- boolean isUI() {
- return (!display.isDisposed())
- && (display.getThread() == Thread.currentThread());
- }
+ boolean isUI() {
+ return (!display.isDisposed()) && (display.getThread() == Thread.currentThread());
+ }
boolean isUIWaiting() {
Thread localUi = ui;
@@ -195,8 +194,8 @@ public class UILockListener extends LockListener {
}
/**
- * Adds a 'UI thread interrupted' message to the log with extra lock state
- * and thread stack information.
+ * Adds a 'UI thread interrupted' message to the log with extra lock state and
+ * thread stack information.
*/
private void reportInterruption(Runnable runnable) {
Thread nonUiThread = Thread.currentThread();
@@ -206,7 +205,8 @@ public class UILockListener extends LockListener {
+ " will interrupt UI thread."; //$NON-NLS-1$
MultiStatus main = new MultiStatus(WorkbenchPlugin.PI_WORKBENCH, IStatus.ERROR, msg, null);
- ThreadInfo[] threads = ManagementFactory.getThreadMXBean().getThreadInfo(new long[] { nonUiThread.getId(), display.getThread().getId() }, true, true);
+ ThreadInfo[] threads = ManagementFactory.getThreadMXBean()
+ .getThreadInfo(new long[] { nonUiThread.getId(), display.getThread().getId() }, true, true);
for (ThreadInfo info : threads) {
String childMsg;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/UISynchronizer.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/UISynchronizer.java
index d58cc3ec00f..15ce1d42564 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/UISynchronizer.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/UISynchronizer.java
@@ -21,31 +21,32 @@ import org.eclipse.swt.widgets.Synchronizer;
import org.eclipse.ui.internal.StartupThreading.StartupRunnable;
public class UISynchronizer extends Synchronizer {
- protected UILockListener lockListener;
+ protected UILockListener lockListener;
- /**
- * Indicates that the UI is in startup mode and that no non-workbench
- * runnables should be invoked.
+ /**
+ * Indicates that the UI is in startup mode and that no non-workbench runnables
+ * should be invoked.
*/
protected boolean isStarting = true;
/**
- * List of non-workbench Runnables that need executing at some point in the future
+ * List of non-workbench Runnables that need executing at some point in the
+ * future
*/
protected List pendingStartup = new ArrayList();
/**
* If this boolean is set to true the synchronizer will fall back to the
- * behaviour it had prior to 3.3/3.4. Ie: there will be no restriction on
- * what runnables may be run via a/syncExec calls.
+ * behaviour it had prior to 3.3/3.4. Ie: there will be no restriction on what
+ * runnables may be run via a/syncExec calls.
*
* @see IPreferenceConstants#USE_32_THREADING
*/
private boolean use32Threading = false;
/**
- * Setting this variable to the value {@link Boolean#TRUE} will allow a
- * thread to execute code during the startup sequence.
+ * Setting this variable to the value {@link Boolean#TRUE} will allow a thread
+ * to execute code during the startup sequence.
*/
public static final ThreadLocal startupThread = new ThreadLocal() {
@@ -67,35 +68,34 @@ public class UISynchronizer extends Synchronizer {
protected Object initialValue() {
return Boolean.FALSE;
}
+
@Override
public void set(Object value) {
if (value != Boolean.TRUE && value != Boolean.FALSE)
throw new IllegalArgumentException();
- if (value == Boolean.TRUE
- && ((Boolean)startupThread.get()).booleanValue()) {
+ if (value == Boolean.TRUE && ((Boolean) startupThread.get()).booleanValue()) {
throw new IllegalStateException();
}
super.set(value);
}
};
- public UISynchronizer(Display display, UILockListener lock) {
- super(display);
- this.lockListener = lock;
- use32Threading = WorkbenchPlugin.getDefault()
- .getPreferenceStore().getBoolean(
- IPreferenceConstants.USE_32_THREADING);
- }
+ public UISynchronizer(Display display, UILockListener lock) {
+ super(display);
+ this.lockListener = lock;
+ use32Threading = WorkbenchPlugin.getDefault().getPreferenceStore()
+ .getBoolean(IPreferenceConstants.USE_32_THREADING);
+ }
- public void started() {
- synchronized (this) {
+ public void started() {
+ synchronized (this) {
if (!isStarting)
throw new IllegalStateException();
isStarting = false;
for (Iterator i = pendingStartup.iterator(); i.hasNext();) {
Runnable runnable = (Runnable) i.next();
try {
- //queue up all pending asyncs
+ // queue up all pending asyncs
super.asyncExec(runnable);
} catch (RuntimeException e) {
// do nothing
@@ -104,16 +104,15 @@ public class UISynchronizer extends Synchronizer {
pendingStartup = null;
// wake up all pending syncExecs
this.notifyAll();
- }
- }
+ }
+ }
- @Override
+ @Override
protected void asyncExec(Runnable runnable) {
- // the following block should not be invoked if we're using 3.2 threading.
- if (runnable != null && !use32Threading) {
+ // the following block should not be invoked if we're using 3.2 threading.
+ if (runnable != null && !use32Threading) {
synchronized (this) {
- if (isStarting && !(runnable instanceof StartupRunnable)
- && overrideThread.get() == Boolean.FALSE) {
+ if (isStarting && !(runnable instanceof StartupRunnable) && overrideThread.get() == Boolean.FALSE) {
// don't run it now, add it to the list of deferred runnables
pendingStartup.add(runnable);
@@ -122,8 +121,8 @@ public class UISynchronizer extends Synchronizer {
}
}
}
- super.asyncExec(runnable);
- }
+ super.asyncExec(runnable);
+ }
@Override
public void syncExec(Runnable runnable) {
@@ -141,16 +140,16 @@ public class UISynchronizer extends Synchronizer {
}
}
- //if this thread is the UI or this thread does not own any locks, just do the syncExec
- if ((runnable == null) || lockListener.isUI()
- || !lockListener.isLockOwner()) {
- super.syncExec(runnable);
- return;
- }
- PendingSyncExec work = new PendingSyncExec(runnable);
- work.setOperationThread(Thread.currentThread());
- lockListener.addPendingWork(work);
- asyncExec(() -> lockListener.doPendingWork());
+ // if this thread is the UI or this thread does not own any locks, just do the
+ // syncExec
+ if ((runnable == null) || lockListener.isUI() || !lockListener.isLockOwner()) {
+ super.syncExec(runnable);
+ return;
+ }
+ PendingSyncExec work = new PendingSyncExec(runnable);
+ work.setOperationThread(Thread.currentThread());
+ lockListener.addPendingWork(work);
+ asyncExec(() -> lockListener.doPendingWork());
try {
work.waitUntilExecuted(lockListener);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewActionBuilder.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewActionBuilder.java
index dd699e618e5..74efea628b0 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewActionBuilder.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewActionBuilder.java
@@ -20,66 +20,63 @@ import org.eclipse.ui.IViewPart;
import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants;
/**
- * This class reads the registry for extensions that plug into
- * 'viewActions' extension point.
+ * This class reads the registry for extensions that plug into 'viewActions'
+ * extension point.
*/
public class ViewActionBuilder extends PluginActionBuilder {
- public static final String TAG_CONTRIBUTION_TYPE = "viewContribution"; //$NON-NLS-1$
+ public static final String TAG_CONTRIBUTION_TYPE = "viewContribution"; //$NON-NLS-1$
- private IViewPart targetPart;
+ private IViewPart targetPart;
- /**
- * Basic constructor
- */
- public ViewActionBuilder() {
- }
+ /**
+ * Basic constructor
+ */
+ public ViewActionBuilder() {
+ }
- /**
- * Contribute the external menus and actions applicable for this view part.
- */
- private void contributeToPart(IViewPart part) {
- IActionBars bars = part.getViewSite().getActionBars();
- contribute(bars.getMenuManager(), bars.getToolBarManager(), true);
- }
+ /**
+ * Contribute the external menus and actions applicable for this view part.
+ */
+ private void contributeToPart(IViewPart part) {
+ IActionBars bars = part.getViewSite().getActionBars();
+ contribute(bars.getMenuManager(), bars.getToolBarManager(), true);
+ }
- @Override
- protected ActionDescriptor createActionDescriptor(
- org.eclipse.core.runtime.IConfigurationElement element) {
- return new ActionDescriptor(element, ActionDescriptor.T_VIEW,
- targetPart);
- }
+ @Override
+ protected ActionDescriptor createActionDescriptor(org.eclipse.core.runtime.IConfigurationElement element) {
+ return new ActionDescriptor(element, ActionDescriptor.T_VIEW, targetPart);
+ }
- /**
- * Return all extended actions.
- */
- public ActionDescriptor[] getExtendedActions() {
- if (cache == null) {
+ /**
+ * Return all extended actions.
+ */
+ public ActionDescriptor[] getExtendedActions() {
+ if (cache == null) {
return new ActionDescriptor[0];
}
- ArrayList results = new ArrayList();
- for (int i = 0; i < cache.size(); i++) {
- BasicContribution bc = (BasicContribution) cache.get(i);
- if (bc.actions != null) {
+ ArrayList results = new ArrayList();
+ for (int i = 0; i < cache.size(); i++) {
+ BasicContribution bc = (BasicContribution) cache.get(i);
+ if (bc.actions != null) {
results.addAll(bc.actions);
}
- }
- return (ActionDescriptor[]) results
- .toArray(new ActionDescriptor[results.size()]);
- }
+ }
+ return (ActionDescriptor[]) results.toArray(new ActionDescriptor[results.size()]);
+ }
- /**
- * Reads and apply all external contributions for this view's ID registered
- * in 'viewActions' extension point.
- */
- public void readActionExtensions(IViewPart viewPart) {
- targetPart = viewPart;
- readContributions(viewPart.getSite().getId(), TAG_CONTRIBUTION_TYPE,
- IWorkbenchRegistryConstants.PL_VIEW_ACTIONS);
- contributeToPart(targetPart);
- }
+ /**
+ * Reads and apply all external contributions for this view's ID registered in
+ * 'viewActions' extension point.
+ */
+ public void readActionExtensions(IViewPart viewPart) {
+ targetPart = viewPart;
+ readContributions(viewPart.getSite().getId(), TAG_CONTRIBUTION_TYPE,
+ IWorkbenchRegistryConstants.PL_VIEW_ACTIONS);
+ contributeToPart(targetPart);
+ }
- public void dispose() {
+ public void dispose() {
if (cache != null) {
for (int i = 0; i < cache.size(); i++) {
((BasicContribution) cache.get(i)).disposeActions();
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewIntroAdapterPart.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewIntroAdapterPart.java
index a7bcc3d23c7..7eb37b094e4 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewIntroAdapterPart.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewIntroAdapterPart.java
@@ -46,11 +46,11 @@ import org.osgi.service.event.EventHandler;
*/
public final class ViewIntroAdapterPart extends ViewPart {
- private IIntroPart introPart;
+ private IIntroPart introPart;
- private IIntroSite introSite;
+ private IIntroSite introSite;
- private boolean handleZoomEvents = true;
+ private boolean handleZoomEvents = true;
private IEventBroker eventBroker;
@@ -66,21 +66,18 @@ public final class ViewIntroAdapterPart extends ViewPart {
return;
if (UIEvents.isADD(event)
- && UIEvents.contains(event, UIEvents.EventTags.NEW_VALUE,
- IPresentationEngine.MAXIMIZED)) {
+ && UIEvents.contains(event, UIEvents.EventTags.NEW_VALUE, IPresentationEngine.MAXIMIZED)) {
setStandby(false);
} else if (UIEvents.isREMOVE(event)
- && UIEvents.contains(event, UIEvents.EventTags.OLD_VALUE,
- IPresentationEngine.MAXIMIZED)) {
+ && UIEvents.contains(event, UIEvents.EventTags.OLD_VALUE, IPresentationEngine.MAXIMIZED)) {
setStandby(true);
}
};
-
- /**
- * Adds a listener that toggles standby state if the view pane is zoomed.
- */
- private void addZoomListener() {
+ /**
+ * Adds a listener that toggles standby state if the view pane is zoomed.
+ */
+ private void addZoomListener() {
ViewSite site = (ViewSite) getViewSite();
MPart introModelPart = site.getModel();
if (introModelPart == null || introModelPart.getContext() == null)
@@ -88,7 +85,7 @@ public final class ViewIntroAdapterPart extends ViewPart {
eventBroker = introModelPart.getContext().get(IEventBroker.class);
eventBroker.subscribe(UIEvents.ApplicationElement.TOPIC_TAGS, zoomChangeListener);
- }
+ }
private MPartStack getIntroStack() {
ViewSite site = (ViewSite) getViewSite();
@@ -104,38 +101,38 @@ public final class ViewIntroAdapterPart extends ViewPart {
return null;
}
- /**
- * Forces the standby state of the intro part.
- *
- * @param standby update the standby state
- */
- public void setStandby(final boolean standby) {
+ /**
+ * Forces the standby state of the intro part.
+ *
+ * @param standby update the standby state
+ */
+ public void setStandby(final boolean standby) {
final Control control = (Control) ((PartSite) getSite()).getModel().getWidget();
- BusyIndicator.showWhile(control.getDisplay(), () -> {
- try {
- control.setRedraw(false);
- introPart.standbyStateChanged(standby);
- } finally {
- control.setRedraw(true);
- }
-
- setBarVisibility(standby);
+ BusyIndicator.showWhile(control.getDisplay(), () -> {
+ try {
+ control.setRedraw(false);
+ introPart.standbyStateChanged(standby);
+ } finally {
+ control.setRedraw(true);
+ }
+
+ setBarVisibility(standby);
});
- }
-
- /**
- * Toggles handling of zoom events.
- *
- * @param handle whether to handle zoom events
- */
- public void setHandleZoomEvents(boolean handle) {
- handleZoomEvents = handle;
- }
-
- @Override
+ }
+
+ /**
+ * Toggles handling of zoom events.
+ *
+ * @param handle whether to handle zoom events
+ */
+ public void setHandleZoomEvents(boolean handle) {
+ handleZoomEvents = handle;
+ }
+
+ @Override
public void createPartControl(Composite parent) {
- addZoomListener();
- introPart.createPartControl(parent);
+ addZoomListener();
+ introPart.createPartControl(parent);
ViewSite site = (ViewSite) getViewSite();
MPart introModelPart = site.getModel();
@@ -145,69 +142,64 @@ public final class ViewIntroAdapterPart extends ViewPart {
setStandby(!parentElement.getTags().contains(IPresentationEngine.MAXIMIZED));
}
}
- }
+ }
- @Override
+ @Override
public void dispose() {
eventBroker.unsubscribe(zoomChangeListener);
- setBarVisibility(true);
- getSite().getWorkbenchWindow().getWorkbench().getIntroManager()
- .closeIntro(introPart);
- introPart.dispose();
+ setBarVisibility(true);
+ getSite().getWorkbenchWindow().getWorkbench().getIntroManager().closeIntro(introPart);
+ introPart.dispose();
super.dispose();
- }
+ }
- @Override
+ @Override
public <T> T getAdapter(Class<T> adapter) {
return Adapters.adapt(introPart, adapter);
- }
+ }
- @Override
+ @Override
public Image getTitleImage() {
- return introPart.getTitleImage();
- }
+ return introPart.getTitleImage();
+ }
- @Override
+ @Override
public String getTitle() {
- // this method is called eagerly before our init method is called (and
- // therefore before our intropart is created). By default return
- // the view title from the view declaration. We will fire a property
- // change to set the title to the proper value in the init method.
- return introPart == null ? super.getTitle() : introPart.getTitle();
- }
-
- @Override
+ // this method is called eagerly before our init method is called (and
+ // therefore before our intropart is created). By default return
+ // the view title from the view declaration. We will fire a property
+ // change to set the title to the proper value in the init method.
+ return introPart == null ? super.getTitle() : introPart.getTitle();
+ }
+
+ @Override
public void init(IViewSite site, IMemento memento) throws PartInitException {
- super.init(site);
- Workbench workbench = (Workbench) site.getWorkbenchWindow()
- .getWorkbench();
- try {
- introPart = workbench.getWorkbenchIntroManager()
- .createNewIntroPart();
- // reset the part name of this view to be that of the intro title
- setPartName(introPart.getTitle());
- introPart.addPropertyListener((source, propId) -> firePropertyChange(propId));
- introSite = new ViewIntroAdapterSite(site, workbench
- .getIntroDescriptor());
- introPart.init(introSite, memento);
-
- } catch (CoreException e) {
- WorkbenchPlugin
- .log(
- IntroMessages.Intro_could_not_create_proxy, new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, IStatus.ERROR, IntroMessages.Intro_could_not_create_proxy, e));
- }
- }
-
- @Override
+ super.init(site);
+ Workbench workbench = (Workbench) site.getWorkbenchWindow().getWorkbench();
+ try {
+ introPart = workbench.getWorkbenchIntroManager().createNewIntroPart();
+ // reset the part name of this view to be that of the intro title
+ setPartName(introPart.getTitle());
+ introPart.addPropertyListener((source, propId) -> firePropertyChange(propId));
+ introSite = new ViewIntroAdapterSite(site, workbench.getIntroDescriptor());
+ introPart.init(introSite, memento);
+
+ } catch (CoreException e) {
+ WorkbenchPlugin.log(IntroMessages.Intro_could_not_create_proxy, new Status(IStatus.ERROR,
+ WorkbenchPlugin.PI_WORKBENCH, IStatus.ERROR, IntroMessages.Intro_could_not_create_proxy, e));
+ }
+ }
+
+ @Override
public void setFocus() {
- introPart.setFocus();
- }
+ introPart.setFocus();
+ }
- @Override
+ @Override
public void saveState(IMemento memento) {
- introPart.saveState(memento);
- }
+ introPart.saveState(memento);
+ }
/**
* Sets whether the CoolBar/PerspectiveBar should be visible.
@@ -216,20 +208,17 @@ public final class ViewIntroAdapterPart extends ViewPart {
* @since 3.1
*/
private void setBarVisibility(final boolean visible) {
- WorkbenchWindow window = (WorkbenchWindow) getSite()
- .getWorkbenchWindow();
+ WorkbenchWindow window = (WorkbenchWindow) getSite().getWorkbenchWindow();
boolean layout = false; // don't layout unless things have actually changed
if (visible) {
// Restore the last 'saved' state
- boolean coolbarVisible = PrefUtil
- .getInternalPreferenceStore().getBoolean(
- IPreferenceConstants.COOLBAR_VISIBLE);
- boolean persBarVisible = PrefUtil
- .getInternalPreferenceStore().getBoolean(
- IPreferenceConstants.PERSPECTIVEBAR_VISIBLE);
+ boolean coolbarVisible = PrefUtil.getInternalPreferenceStore()
+ .getBoolean(IPreferenceConstants.COOLBAR_VISIBLE);
+ boolean persBarVisible = PrefUtil.getInternalPreferenceStore()
+ .getBoolean(IPreferenceConstants.PERSPECTIVEBAR_VISIBLE);
layout = (coolbarVisible != window.getCoolBarVisible())
- || (persBarVisible != window.getPerspectiveBarVisible());
+ || (persBarVisible != window.getPerspectiveBarVisible());
window.setCoolBarVisible(coolbarVisible);
window.setPerspectiveBarVisible(persBarVisible);
} else {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewIntroAdapterSite.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewIntroAdapterSite.java
index efa042145de..a4938df7949 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewIntroAdapterSite.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewIntroAdapterSite.java
@@ -25,83 +25,83 @@ import org.eclipse.ui.internal.intro.IntroDescriptor;
import org.eclipse.ui.intro.IIntroSite;
/**
- * Simple <code>IIntroSite</code> that wraps a <code>IViewSite</code>. For use in conjunction with
- * <code>ViewIntroAdapterPart</code>.
+ * Simple <code>IIntroSite</code> that wraps a <code>IViewSite</code>. For use
+ * in conjunction with <code>ViewIntroAdapterPart</code>.
*
* @since 3.0
*/
final class ViewIntroAdapterSite implements IIntroSite {
- private IntroDescriptor descriptor;
+ private IntroDescriptor descriptor;
- private IViewSite viewSite;
+ private IViewSite viewSite;
- public ViewIntroAdapterSite(IViewSite viewSite, IntroDescriptor descriptor) {
- this.viewSite = viewSite;
- this.descriptor = descriptor;
- }
+ public ViewIntroAdapterSite(IViewSite viewSite, IntroDescriptor descriptor) {
+ this.viewSite = viewSite;
+ this.descriptor = descriptor;
+ }
- @Override
+ @Override
public IActionBars getActionBars() {
- return viewSite.getActionBars();
- }
+ return viewSite.getActionBars();
+ }
- @Override
+ @Override
public <T> T getAdapter(Class<T> adapter) {
return Adapters.adapt(viewSite, adapter);
- }
+ }
- @Override
+ @Override
public String getId() {
- return descriptor.getId();
- }
+ return descriptor.getId();
+ }
- @Override
+ @Override
public IKeyBindingService getKeyBindingService() {
- return viewSite.getKeyBindingService();
- }
+ return viewSite.getKeyBindingService();
+ }
- @Override
+ @Override
public IWorkbenchPage getPage() {
- return viewSite.getPage();
- }
+ return viewSite.getPage();
+ }
- @Override
+ @Override
public String getPluginId() {
- return descriptor.getPluginId();
- }
+ return descriptor.getPluginId();
+ }
- @Override
+ @Override
public ISelectionProvider getSelectionProvider() {
- return viewSite.getSelectionProvider();
- }
+ return viewSite.getSelectionProvider();
+ }
- @Override
+ @Override
public <T> T getService(final Class<T> key) {
- return viewSite.getService(key);
- }
+ return viewSite.getService(key);
+ }
- @Override
+ @Override
public Shell getShell() {
- return viewSite.getShell();
- }
+ return viewSite.getShell();
+ }
- @Override
+ @Override
public IWorkbenchWindow getWorkbenchWindow() {
- return viewSite.getWorkbenchWindow();
- }
+ return viewSite.getWorkbenchWindow();
+ }
@Override
public boolean hasService(final Class<?> key) {
return viewSite.hasService(key);
}
- @Override
+ @Override
public void setSelectionProvider(ISelectionProvider provider) {
- viewSite.setSelectionProvider(provider);
- }
+ viewSite.setSelectionProvider(provider);
+ }
- @Override
+ @Override
public String toString() {
- return viewSite.toString();
- }
+ return viewSite.toString();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewPluginAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewPluginAction.java
index cb828e0d15f..139aa5e71ab 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewPluginAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewPluginAction.java
@@ -20,52 +20,47 @@ import org.eclipse.ui.IViewPart;
import org.eclipse.ui.WorkbenchException;
/**
- * This class extends regular plugin action with the
- * additional requirement that the delegate has
- * to implement interface IViewActionDeelgate.
- * This interface has one additional method (init)
- * whose purpose is to initialize the delegate with
- * the view part in which the action is intended to run.
+ * This class extends regular plugin action with the additional requirement that
+ * the delegate has to implement interface IViewActionDeelgate. This interface
+ * has one additional method (init) whose purpose is to initialize the delegate
+ * with the view part in which the action is intended to run.
*/
public final class ViewPluginAction extends PartPluginAction {
- private IViewPart viewPart;
+ private IViewPart viewPart;
- /**
- * This class adds the requirement that action delegates
- * loaded on demand implement IViewActionDelegate
- */
- public ViewPluginAction(IConfigurationElement actionElement,
- IViewPart viewPart, String id, int style) {
- super(actionElement, id, style);
- this.viewPart = viewPart;
- registerSelectionListener(viewPart);
- }
+ /**
+ * This class adds the requirement that action delegates loaded on demand
+ * implement IViewActionDelegate
+ */
+ public ViewPluginAction(IConfigurationElement actionElement, IViewPart viewPart, String id, int style) {
+ super(actionElement, id, style);
+ this.viewPart = viewPart;
+ registerSelectionListener(viewPart);
+ }
- @Override
- protected IActionDelegate validateDelegate(Object obj)
- throws WorkbenchException {
- if (obj instanceof IViewActionDelegate) {
+ @Override
+ protected IActionDelegate validateDelegate(Object obj) throws WorkbenchException {
+ if (obj instanceof IViewActionDelegate) {
return (IViewActionDelegate) obj;
}
throw new WorkbenchException("Action must implement IViewActionDelegate"); //$NON-NLS-1$
- }
+ }
- @Override
+ @Override
protected void initDelegate() {
- super.initDelegate();
- ((IViewActionDelegate) getDelegate()).init(viewPart);
- }
+ super.initDelegate();
+ ((IViewActionDelegate) getDelegate()).init(viewPart);
+ }
- /**
- * Returns true if the view has been set
- * The view may be null after the constructor is called and
- * before the view is stored. We cannot create the delegate
- * at that time.
- */
- @Override
+ /**
+ * Returns true if the view has been set The view may be null after the
+ * constructor is called and before the view is stored. We cannot create the
+ * delegate at that time.
+ */
+ @Override
public boolean isOkToCreateDelegate() {
- return super.isOkToCreateDelegate() && viewPart != null;
- }
+ return super.isOkToCreateDelegate() && viewPart != null;
+ }
@Override
public void dispose() {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewReference.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewReference.java
index ec3e3a53d7a..9b4f1d31f2e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewReference.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewReference.java
@@ -38,8 +38,7 @@ public class ViewReference extends WorkbenchPartReference implements IViewRefere
private ViewDescriptor descriptor;
private IMemento memento;
- public ViewReference(IEclipseContext windowContext, IWorkbenchPage page, MPart part,
- ViewDescriptor descriptor) {
+ public ViewReference(IEclipseContext windowContext, IWorkbenchPage page, MPart part, ViewDescriptor descriptor) {
super(windowContext, page, part);
this.descriptor = descriptor;
@@ -104,15 +103,15 @@ public class ViewReference extends WorkbenchPartReference implements IViewRefere
return descriptor.createView();
} catch (CoreException e) {
IStatus status = e.getStatus();
- throw new PartInitException(new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH,
- status.getCode(), status.getMessage(), e));
+ throw new PartInitException(
+ new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, status.getCode(), status.getMessage(), e));
}
}
@Override
IWorkbenchPart createErrorPart() {
- IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, NLS.bind(
- WorkbenchMessages.ViewFactory_initException, getModel().getElementId()), new Exception());
+ IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH,
+ NLS.bind(WorkbenchMessages.ViewFactory_initException, getModel().getElementId()), new Exception());
return createErrorPart(status);
}
@@ -123,8 +122,8 @@ public class ViewReference extends WorkbenchPartReference implements IViewRefere
@Override
public void initialize(IWorkbenchPart part) throws PartInitException {
- ViewSite viewSite = new ViewSite(getModel(), part, this, descriptor == null ? null
- : descriptor.getConfigurationElement());
+ ViewSite viewSite = new ViewSite(getModel(), part, this,
+ descriptor == null ? null : descriptor.getConfigurationElement());
IViewPart view = (IViewPart) part;
view.init(viewSite, memento);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewSite.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewSite.java
index 116f14f79cc..0ad58dc5d64 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewSite.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewSite.java
@@ -28,15 +28,13 @@ import org.eclipse.ui.internal.e4.compatibility.ActionBars;
*/
public class ViewSite extends PartSite implements IViewSite {
- public ViewSite(MPart model, IWorkbenchPart part, IWorkbenchPartReference ref,
- IConfigurationElement element) {
+ public ViewSite(MPart model, IWorkbenchPart part, IWorkbenchPartReference ref, IConfigurationElement element) {
super(model, part, ref, element);
initializeDefaultServices();
}
private void initializeDefaultServices() {
- setActionBars(new ActionBars(((WorkbenchPage) getPage()).getActionBars(), serviceLocator,
- model));
+ setActionBars(new ActionBars(((WorkbenchPage) getPage()).getActionBars(), serviceLocator, model));
serviceLocator.registerService(IViewPart.class, getPart());
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewerActionBuilder.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewerActionBuilder.java
index ea08674c48d..f890eb581d8 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewerActionBuilder.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewerActionBuilder.java
@@ -28,134 +28,127 @@ import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants;
/**
- * This class reads the registry for extensions that plug into
- * 'popupMenus' extension point and deals only with the 'viewerContribution'
- * elements.
+ * This class reads the registry for extensions that plug into 'popupMenus'
+ * extension point and deals only with the 'viewerContribution' elements.
*/
public class ViewerActionBuilder extends PluginActionBuilder {
+ private ISelectionProvider provider;
- private ISelectionProvider provider;
+ private IWorkbenchPart part;
- private IWorkbenchPart part;
+ /**
+ * Basic contstructor
+ */
+ public ViewerActionBuilder() {
+ }
- /**
- * Basic contstructor
- */
- public ViewerActionBuilder() {
- }
-
- @Override
- protected ActionDescriptor createActionDescriptor(
- IConfigurationElement element) {
- if (part instanceof IViewPart) {
+ @Override
+ protected ActionDescriptor createActionDescriptor(IConfigurationElement element) {
+ if (part instanceof IViewPart) {
return new ActionDescriptor(element, ActionDescriptor.T_VIEW, part);
}
return new ActionDescriptor(element, ActionDescriptor.T_EDITOR, part);
- }
+ }
- @Override
+ @Override
protected BasicContribution createContribution() {
- return new ViewerContribution(provider);
- }
-
- /**
- * Dispose of the action builder
- */
- public void dispose() {
- if (cache != null) {
- for (int i = 0; i < cache.size(); i++) {
- ((BasicContribution) cache.get(i)).dispose();
- }
- cache = null;
- }
- }
-
- @Override
+ return new ViewerContribution(provider);
+ }
+
+ /**
+ * Dispose of the action builder
+ */
+ public void dispose() {
+ if (cache != null) {
+ for (int i = 0; i < cache.size(); i++) {
+ ((BasicContribution) cache.get(i)).dispose();
+ }
+ cache = null;
+ }
+ }
+
+ @Override
protected boolean readElement(IConfigurationElement element) {
- String tag = element.getName();
-
- // Found visibility sub-element
- if (currentContribution != null && tag.equals(IWorkbenchRegistryConstants.TAG_VISIBILITY)) {
- ((ViewerContribution) currentContribution)
- .setVisibilityTest(element);
- return true;
- }
-
- return super.readElement(element);
- }
-
- /**
- * Reads the contributions for a viewer menu.
- * This method is typically used in conjunction with <code>contribute</code> to read
- * and then insert actions for a particular viewer menu.
- *
- * @param id the menu id
- * @param prov the selection provider for the control containing the menu
- * @param part the part containing the menu.
- * @return <code>true</code> if 1 or more items were read.
- */
- public boolean readViewerContributions(String id, ISelectionProvider prov,
- IWorkbenchPart part) {
+ String tag = element.getName();
+
+ // Found visibility sub-element
+ if (currentContribution != null && tag.equals(IWorkbenchRegistryConstants.TAG_VISIBILITY)) {
+ ((ViewerContribution) currentContribution).setVisibilityTest(element);
+ return true;
+ }
+
+ return super.readElement(element);
+ }
+
+ /**
+ * Reads the contributions for a viewer menu. This method is typically used in
+ * conjunction with <code>contribute</code> to read and then insert actions for
+ * a particular viewer menu.
+ *
+ * @param id the menu id
+ * @param prov the selection provider for the control containing the menu
+ * @param part the part containing the menu.
+ * @return <code>true</code> if 1 or more items were read.
+ */
+ public boolean readViewerContributions(String id, ISelectionProvider prov, IWorkbenchPart part) {
Assert.isTrue(part instanceof IViewPart || part instanceof IEditorPart);
- provider = prov;
- this.part = part;
- readContributions(id, IWorkbenchRegistryConstants.TAG_VIEWER_CONTRIBUTION,
- IWorkbenchRegistryConstants.PL_POPUP_MENU);
- return (cache != null);
- }
-
- /**
- * Helper class to collect the menus and actions defined within a
- * contribution element.
- */
- private static class ViewerContribution extends BasicContribution implements ISelectionChangedListener {
- private ISelectionProvider selProvider;
-
- private ActionExpression visibilityTest;
-
- /**
- * Create a new ViewerContribution.
- *
- * @param selProvider the selection provider
- */
- public ViewerContribution(ISelectionProvider selProvider) {
- super();
- this.selProvider = selProvider;
+ provider = prov;
+ this.part = part;
+ readContributions(id, IWorkbenchRegistryConstants.TAG_VIEWER_CONTRIBUTION,
+ IWorkbenchRegistryConstants.PL_POPUP_MENU);
+ return (cache != null);
+ }
+
+ /**
+ * Helper class to collect the menus and actions defined within a contribution
+ * element.
+ */
+ private static class ViewerContribution extends BasicContribution implements ISelectionChangedListener {
+ private ISelectionProvider selProvider;
+
+ private ActionExpression visibilityTest;
+
+ /**
+ * Create a new ViewerContribution.
+ *
+ * @param selProvider the selection provider
+ */
+ public ViewerContribution(ISelectionProvider selProvider) {
+ super();
+ this.selProvider = selProvider;
if (selProvider != null) {
selProvider.addSelectionChangedListener(this);
}
- }
-
- /**
- * Set the visibility test.
- *
- * @param element the element
- */
- public void setVisibilityTest(IConfigurationElement element) {
- visibilityTest = new ActionExpression(element);
- }
-
- @Override
- public void contribute(IMenuManager menu, boolean menuAppendIfMissing,
- IToolBarManager toolbar, boolean toolAppendIfMissing) {
- boolean visible = true;
-
- if (visibilityTest != null) {
- ISelection selection = selProvider.getSelection();
- if (selection instanceof IStructuredSelection) {
- visible = visibilityTest
- .isEnabledFor((IStructuredSelection) selection);
- } else {
- visible = visibilityTest.isEnabledFor(selection);
- }
- }
-
- if (visible) {
- super.contribute(menu, menuAppendIfMissing, toolbar,
- toolAppendIfMissing);
+ }
+
+ /**
+ * Set the visibility test.
+ *
+ * @param element the element
+ */
+ public void setVisibilityTest(IConfigurationElement element) {
+ visibilityTest = new ActionExpression(element);
+ }
+
+ @Override
+ public void contribute(IMenuManager menu, boolean menuAppendIfMissing, IToolBarManager toolbar,
+ boolean toolAppendIfMissing) {
+ boolean visible = true;
+
+ if (visibilityTest != null) {
+ ISelection selection = selProvider.getSelection();
+ if (selection instanceof IStructuredSelection) {
+ visible = visibilityTest.isEnabledFor((IStructuredSelection) selection);
+ } else {
+ visible = visibilityTest.isEnabledFor(selection);
+ }
}
- }
+
+ if (visible) {
+ super.contribute(menu, menuAppendIfMissing, toolbar, toolAppendIfMissing);
+ }
+ }
@Override
public void dispose() {
@@ -167,10 +160,10 @@ public class ViewerActionBuilder extends PluginActionBuilder {
}
/**
- * Rather than hooking up each action as a selection listener,
- * the contribution itself is added, and propagates
- * the selection changed notification to all actions.
- * This simplifies cleanup, in addition to potentially reducing the number of listeners.
+ * Rather than hooking up each action as a selection listener, the contribution
+ * itself is added, and propagates the selection changed notification to all
+ * actions. This simplifies cleanup, in addition to potentially reducing the
+ * number of listeners.
*
* @see ISelectionChangedListener
* @since 3.1
@@ -184,6 +177,6 @@ public class ViewerActionBuilder extends PluginActionBuilder {
}
}
}
- }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WWinActionBars.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WWinActionBars.java
index de6c1a82e7e..d060e15d2b1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WWinActionBars.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WWinActionBars.java
@@ -23,105 +23,104 @@ import org.eclipse.ui.IActionBars2;
import org.eclipse.ui.services.IServiceLocator;
public class WWinActionBars implements IActionBars2 {
- private WorkbenchWindow window;
+ private WorkbenchWindow window;
- /**
- * PerspActionBars constructor comment.
- */
- public WWinActionBars(WorkbenchWindow window) {
- super();
- this.window = window;
- }
+ /**
+ * PerspActionBars constructor comment.
+ */
+ public WWinActionBars(WorkbenchWindow window) {
+ super();
+ this.window = window;
+ }
- /**
- * Clears the global action handler list.
- */
- @Override
+ /**
+ * Clears the global action handler list.
+ */
+ @Override
public void clearGlobalActionHandlers() {
- }
+ }
- /**
- * Returns the cool bar manager.
- *
- */
- @Override
+ /**
+ * Returns the cool bar manager.
+ *
+ */
+ @Override
public ICoolBarManager getCoolBarManager() {
- return window.getCoolBarManager2();
- }
+ return window.getCoolBarManager2();
+ }
- /**
- * Get the handler for a window action.
- *
- * @param actionID an action ID declared in the registry
- * @return an action handler which implements the action ID, or
- * <code>null</code> if none is registered.
- */
- @Override
+ /**
+ * Get the handler for a window action.
+ *
+ * @param actionID an action ID declared in the registry
+ * @return an action handler which implements the action ID, or
+ * <code>null</code> if none is registered.
+ */
+ @Override
public IAction getGlobalActionHandler(String actionID) {
- return null;
- }
+ return null;
+ }
- /**
- * Returns the menu manager. If items are added or
- * removed from the manager be sure to call <code>updateActionBars</code>.
- *
- * @return the menu manager
- */
- @Override
+ /**
+ * Returns the menu manager. If items are added or removed from the manager be
+ * sure to call <code>updateActionBars</code>.
+ *
+ * @return the menu manager
+ */
+ @Override
public IMenuManager getMenuManager() {
- return window.getMenuManager();
- }
+ return window.getMenuManager();
+ }
@Override
public final IServiceLocator getServiceLocator() {
return window;
}
- /**
- * Returns the status line manager. If items are added or
- * removed from the manager be sure to call <code>updateActionBars</code>.
- *
- * @return the status line manager
- */
- @Override
+ /**
+ * Returns the status line manager. If items are added or removed from the
+ * manager be sure to call <code>updateActionBars</code>.
+ *
+ * @return the status line manager
+ */
+ @Override
public IStatusLineManager getStatusLineManager() {
- return window.getStatusLineManager();
- }
+ return window.getStatusLineManager();
+ }
- /**
- * Returns the tool bar manager.
- *
- */
- @Override
+ /**
+ * Returns the tool bar manager.
+ *
+ */
+ @Override
public IToolBarManager getToolBarManager() {
- // This should never be called
- Assert.isTrue(false);
- return null;
- }
+ // This should never be called
+ Assert.isTrue(false);
+ return null;
+ }
- /**
- * Add a handler for a window action.
- *
- * The standard action ID's for the workbench are defined in
- * <code>IWorkbenchActions</code>.
- *
- * @see IWorkbenchActions
- *
- * @param actionID an action ID declared in the registry
- * @param handler an action which implements the action ID.
- * <code>null</code> may be passed to deregister a handler.
- */
- @Override
+ /**
+ * Add a handler for a window action.
+ *
+ * The standard action ID's for the workbench are defined in
+ * <code>IWorkbenchActions</code>.
+ *
+ * @see IWorkbenchActions
+ *
+ * @param actionID an action ID declared in the registry
+ * @param handler an action which implements the action ID. <code>null</code>
+ * may be passed to deregister a handler.
+ */
+ @Override
public void setGlobalActionHandler(String actionID, IAction handler) {
- }
+ }
/**
- * Commits all UI changes. This should be called
- * after additions or subtractions have been made to a
- * menu, status line, or toolbar.
- */
- @Override
+ * Commits all UI changes. This should be called after additions or subtractions
+ * have been made to a menu, status line, or toolbar.
+ */
+ @Override
public void updateActionBars() {
- window.updateActionBars();
- }
+ window.updateActionBars();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WWinPluginAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WWinPluginAction.java
index 22efe1e5a2f..467ffd9c049 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WWinPluginAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WWinPluginAction.java
@@ -33,248 +33,235 @@ import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants;
/**
* This class extends regular plugin action with the additional requirement that
* the delegate has to implement interface
- * {@link org.eclipse.ui.IWorkbenchWindowActionDelegate}. This interface has
- * one additional method (init) whose purpose is to initialize the delegate with
- * the window in which the action is intended to run.
+ * {@link org.eclipse.ui.IWorkbenchWindowActionDelegate}. This interface has one
+ * additional method (init) whose purpose is to initialize the delegate with the
+ * window in which the action is intended to run.
*/
-public class WWinPluginAction extends PluginAction implements
- IActionSetContributionItem {
- /**
- * The help listener assigned to this action, or <code>null</code> if none.
- */
- private HelpListener localHelpListener;
+public class WWinPluginAction extends PluginAction implements IActionSetContributionItem {
+ /**
+ * The help listener assigned to this action, or <code>null</code> if none.
+ */
+ private HelpListener localHelpListener;
- private IWorkbenchWindow window;
+ private IWorkbenchWindow window;
- private String actionSetId;
+ private String actionSetId;
- private RetargetAction retargetAction;
+ private RetargetAction retargetAction;
- private static ArrayList staticActionList = new ArrayList(50);
+ private static ArrayList staticActionList = new ArrayList(50);
- /**
- * Constructs a new <code>WWinPluginAction</code> object.
- *
- * @param actionElement the configuration element
- * @param window the window to contribute to
- * @param id the identifier
- * @param style the style
- */
- public WWinPluginAction(IConfigurationElement actionElement,
- IWorkbenchWindow window, String id, int style) {
- super(actionElement, id, style);
- this.window = window;
+ /**
+ * Constructs a new <code>WWinPluginAction</code> object.
+ *
+ * @param actionElement the configuration element
+ * @param window the window to contribute to
+ * @param id the identifier
+ * @param style the style
+ */
+ public WWinPluginAction(IConfigurationElement actionElement, IWorkbenchWindow window, String id, int style) {
+ super(actionElement, id, style);
+ this.window = window;
- // If config specifies a retarget action, create it now
- String retarget = actionElement
- .getAttribute(IWorkbenchRegistryConstants.ATT_RETARGET);
- if (retarget != null && Boolean.parseBoolean(retarget)) {
- // create a retarget action
- String allowLabelUpdate = actionElement
- .getAttribute(IWorkbenchRegistryConstants.ATT_ALLOW_LABEL_UPDATE);
- String label = actionElement
- .getAttribute(IWorkbenchRegistryConstants.ATT_LABEL);
+ // If config specifies a retarget action, create it now
+ String retarget = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_RETARGET);
+ if (retarget != null && Boolean.parseBoolean(retarget)) {
+ // create a retarget action
+ String allowLabelUpdate = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_ALLOW_LABEL_UPDATE);
+ String label = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_LABEL);
- if (allowLabelUpdate != null && Boolean.parseBoolean(allowLabelUpdate)) {
+ if (allowLabelUpdate != null && Boolean.parseBoolean(allowLabelUpdate)) {
retargetAction = new LabelRetargetAction(id, label, style);
} else {
retargetAction = new RetargetAction(id, label, style);
}
- retargetAction
- .addPropertyChangeListener(event -> {
- if (event.getProperty().equals(IAction.ENABLED)) {
- Object val1 = event.getNewValue();
- if (val1 instanceof Boolean) {
- setEnabled(((Boolean) val1).booleanValue());
- }
- } else if (event.getProperty().equals(
- IAction.CHECKED)) {
- Object val2 = event.getNewValue();
- if (val2 instanceof Boolean) {
- setChecked(((Boolean) val2).booleanValue());
- }
- } else if (event.getProperty().equals(IAction.TEXT)) {
- Object val3 = event.getNewValue();
- if (val3 instanceof String) {
- setText((String) val3);
- }
- } else if (event.getProperty().equals(
- IAction.TOOL_TIP_TEXT)) {
- Object val4 = event.getNewValue();
- if (val4 instanceof String) {
- setToolTipText((String) val4);
- }
- }
- });
- retargetAction.setEnabled(false);
- setEnabled(false);
- window.getPartService().addPartListener(retargetAction);
- IWorkbenchPart activePart = window.getPartService().getActivePart();
- if (activePart != null) {
+ retargetAction.addPropertyChangeListener(event -> {
+ if (event.getProperty().equals(IAction.ENABLED)) {
+ Object val1 = event.getNewValue();
+ if (val1 instanceof Boolean) {
+ setEnabled(((Boolean) val1).booleanValue());
+ }
+ } else if (event.getProperty().equals(IAction.CHECKED)) {
+ Object val2 = event.getNewValue();
+ if (val2 instanceof Boolean) {
+ setChecked(((Boolean) val2).booleanValue());
+ }
+ } else if (event.getProperty().equals(IAction.TEXT)) {
+ Object val3 = event.getNewValue();
+ if (val3 instanceof String) {
+ setText((String) val3);
+ }
+ } else if (event.getProperty().equals(IAction.TOOL_TIP_TEXT)) {
+ Object val4 = event.getNewValue();
+ if (val4 instanceof String) {
+ setToolTipText((String) val4);
+ }
+ }
+ });
+ retargetAction.setEnabled(false);
+ setEnabled(false);
+ window.getPartService().addPartListener(retargetAction);
+ IWorkbenchPart activePart = window.getPartService().getActivePart();
+ if (activePart != null) {
retargetAction.partActivated(activePart);
}
- } else {
- // if we retarget the handler will look after selection changes
- window.getSelectionService().addSelectionListener(this);
- refreshSelection();
- }
- addToActionList(this);
+ } else {
+ // if we retarget the handler will look after selection changes
+ window.getSelectionService().addSelectionListener(this);
+ refreshSelection();
+ }
+ addToActionList(this);
- super.setHelpListener(e -> {
- HelpListener listener = null;
- if (retargetAction != null) {
+ super.setHelpListener(e -> {
+ HelpListener listener = null;
+ if (retargetAction != null) {
listener = retargetAction.getHelpListener();
}
- if (listener == null) {
+ if (listener == null) {
// use our own help listener
- listener = localHelpListener;
+ listener = localHelpListener;
}
- if (listener != null) {
+ if (listener != null) {
// pass on the event
- listener.helpRequested(e);
+ listener.helpRequested(e);
}
});
- }
+ }
- /**
- * Adds an item to the action list.
- */
- private static void addToActionList(WWinPluginAction action) {
- staticActionList.add(action);
+ /**
+ * Adds an item to the action list.
+ */
+ private static void addToActionList(WWinPluginAction action) {
+ staticActionList.add(action);
Shell shell = action.window.getShell();
if (shell != null) {
shell.addDisposeListener(x -> action.dispose());
}
- }
+ }
- /**
- * Removes an item from the action list.
- */
- private static void removeFromActionList(WWinPluginAction action) {
- staticActionList.remove(action);
- }
+ /**
+ * Removes an item from the action list.
+ */
+ private static void removeFromActionList(WWinPluginAction action) {
+ staticActionList.remove(action);
+ }
- /**
- * Creates any actions which belong to an activated plugin.
- */
- public static void refreshActionList() {
- Iterator iter = staticActionList.iterator();
- while (iter.hasNext()) {
- WWinPluginAction action = (WWinPluginAction) iter.next();
- if ((action.getDelegate() == null) && action.isOkToCreateDelegate()) {
- action.createDelegate();
- // creating the delegate also refreshes its enablement
- }
- }
- }
+ /**
+ * Creates any actions which belong to an activated plugin.
+ */
+ public static void refreshActionList() {
+ Iterator iter = staticActionList.iterator();
+ while (iter.hasNext()) {
+ WWinPluginAction action = (WWinPluginAction) iter.next();
+ if ((action.getDelegate() == null) && action.isOkToCreateDelegate()) {
+ action.createDelegate();
+ // creating the delegate also refreshes its enablement
+ }
+ }
+ }
- @Override
- protected IActionDelegate validateDelegate(Object obj)
- throws WorkbenchException {
- if (obj instanceof IWorkbenchWindowActionDelegate) {
+ @Override
+ protected IActionDelegate validateDelegate(Object obj) throws WorkbenchException {
+ if (obj instanceof IWorkbenchWindowActionDelegate) {
return (IWorkbenchWindowActionDelegate) obj;
}
- throw new WorkbenchException(
- "Action must implement IWorkbenchWindowActionDelegate"); //$NON-NLS-1$
- }
+ throw new WorkbenchException("Action must implement IWorkbenchWindowActionDelegate"); //$NON-NLS-1$
+ }
- @Override
+ @Override
protected void initDelegate() {
- super.initDelegate();
- ((IWorkbenchWindowActionDelegate) getDelegate()).init(window);
- }
+ super.initDelegate();
+ ((IWorkbenchWindowActionDelegate) getDelegate()).init(window);
+ }
- /**
- * Disposes of the action and any resources held.
- */
- @Override
+ /**
+ * Disposes of the action and any resources held.
+ */
+ @Override
public void dispose() {
if (window == null) {
return;
}
- removeFromActionList(this);
- if (retargetAction != null) {
- window.getPartService().removePartListener(retargetAction);
- retargetAction.dispose();
- retargetAction = null;
- }
- window.getSelectionService().removeSelectionListener(this);
- super.dispose();
+ removeFromActionList(this);
+ if (retargetAction != null) {
+ window.getPartService().removePartListener(retargetAction);
+ retargetAction.dispose();
+ retargetAction = null;
+ }
+ window.getSelectionService().removeSelectionListener(this);
+ super.dispose();
window = null;
- }
+ }
- /**
- * Returns the action set id.
- */
- @Override
+ /**
+ * Returns the action set id.
+ */
+ @Override
public String getActionSetId() {
- return actionSetId;
- }
+ return actionSetId;
+ }
- /**
- * Returns true if the window has been set.
- * The window may be null after the constructor is called and
- * before the window is stored. We cannot create the delegate
- * at that time.
- */
- @Override
+ /**
+ * Returns true if the window has been set. The window may be null after the
+ * constructor is called and before the window is stored. We cannot create the
+ * delegate at that time.
+ */
+ @Override
public boolean isOkToCreateDelegate() {
- return super.isOkToCreateDelegate() && window != null
- && retargetAction == null;
- }
+ return super.isOkToCreateDelegate() && window != null && retargetAction == null;
+ }
- @Override
+ @Override
public void runWithEvent(Event event) {
- if (retargetAction == null) {
- super.runWithEvent(event);
- return;
- }
+ if (retargetAction == null) {
+ super.runWithEvent(event);
+ return;
+ }
- if (event != null) {
+ if (event != null) {
retargetAction.runWithEvent(event);
} else {
retargetAction.run();
}
- }
+ }
- /**
- * Sets the action set id.
- */
- @Override
+ /**
+ * Sets the action set id.
+ */
+ @Override
public void setActionSetId(String newActionSetId) {
- actionSetId = newActionSetId;
- }
+ actionSetId = newActionSetId;
+ }
- /**
- * The <code>WWinPluginAction</code> implementation of this method
- * declared on <code>IAction</code> stores the help listener in
- * a local field. The supplied listener is only used if there is
- * no retarget action.
- */
- @Override
+ /**
+ * The <code>WWinPluginAction</code> implementation of this method declared on
+ * <code>IAction</code> stores the help listener in a local field. The supplied
+ * listener is only used if there is no retarget action.
+ */
+ @Override
public void setHelpListener(HelpListener listener) {
- localHelpListener = listener;
- }
+ localHelpListener = listener;
+ }
- @Override
+ @Override
public void setChecked(boolean checked) {
- super.setChecked(checked);
- // This call may come from the SWT control event handler
- // itself, so notify the retarget action to keep things
- // in sync.
- if (retargetAction != null) {
+ super.setChecked(checked);
+ // This call may come from the SWT control event handler
+ // itself, so notify the retarget action to keep things
+ // in sync.
+ if (retargetAction != null) {
retargetAction.setChecked(checked);
}
- }
+ }
- /**
- * Refresh the selection for the action.
- */
- protected void refreshSelection() {
- ISelection selection = window.getSelectionService().getSelection();
- selectionChanged(selection);
- }
+ /**
+ * Refresh the selection for the action.
+ */
+ protected void refreshSelection() {
+ ISelection selection = window.getSelectionService().getSelection();
+ selectionChanged(selection);
+ }
@Override
public String toString() {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WWinPluginPulldown.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WWinPluginPulldown.java
index c112b99083b..9d9550a6ddc 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WWinPluginPulldown.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WWinPluginPulldown.java
@@ -39,16 +39,16 @@ public class WWinPluginPulldown extends WWinPluginAction {
private class MenuProxy implements IMenuCreator {
/**
- * A wrapper for loading the menu that defends against possible
- * exceptions triggered outside of the workbench.
+ * A wrapper for loading the menu that defends against possible exceptions
+ * triggered outside of the workbench.
*
* @since 3.0
*/
private class MenuLoader implements ISafeRunnable {
/**
- * The parent for the menu to be created. This value is
- * <code>null</code> if the parent is a menu.
+ * The parent for the menu to be created. This value is <code>null</code> if the
+ * parent is a menu.
*/
private final Control control;
@@ -58,30 +58,26 @@ public class WWinPluginPulldown extends WWinPluginAction {
private final IWorkbenchWindowPulldownDelegate delegate;
/**
- * The loaded menu. This value is <code>null</code> if the load
- * failed, or if it hasn't been loaded yet.
+ * The loaded menu. This value is <code>null</code> if the load failed, or if it
+ * hasn't been loaded yet.
*/
private Menu menu = null;
/**
- * The parent for the menu to be created. This value is
- * <code>null</code> if the parent is a control.
+ * The parent for the menu to be created. This value is <code>null</code> if the
+ * parent is a control.
*/
private final Menu parent;
/**
* Constructs a new instance of <code>MenuLoader</code>
*
- * @param delegate
- * The delegate from which the menu will be loaded; this
- * value must not be <code>null</code>.
- * @param parent
- * The parent of the menu to be loaded; this value must
- * not be <code>null</code>.
+ * @param delegate The delegate from which the menu will be loaded; this value
+ * must not be <code>null</code>.
+ * @param parent The parent of the menu to be loaded; this value must not be
+ * <code>null</code>.
*/
- private MenuLoader(
- final IWorkbenchWindowPulldownDelegate2 delegate,
- final Menu parent) {
+ private MenuLoader(final IWorkbenchWindowPulldownDelegate2 delegate, final Menu parent) {
this.delegate = delegate;
this.parent = parent;
this.control = null;
@@ -90,15 +86,12 @@ public class WWinPluginPulldown extends WWinPluginAction {
/**
* Constructs a new instance of <code>MenuLoader</code>
*
- * @param delegate
- * The delegate from which the menu will be loaded; this
- * value must not be <code>null</code>.
- * @param parent
- * The parent of the menu to be loaded; this value must
- * not be <code>null</code>.
+ * @param delegate The delegate from which the menu will be loaded; this value
+ * must not be <code>null</code>.
+ * @param parent The parent of the menu to be loaded; this value must not be
+ * <code>null</code>.
*/
- private MenuLoader(final IWorkbenchWindowPulldownDelegate delegate,
- final Control parent) {
+ private MenuLoader(final IWorkbenchWindowPulldownDelegate delegate, final Control parent) {
this.delegate = delegate;
this.parent = null;
this.control = parent;
@@ -129,8 +122,7 @@ public class WWinPluginPulldown extends WWinPluginAction {
if (parent == null) {
menu = delegate.getMenu(control);
} else {
- menu = ((IWorkbenchWindowPulldownDelegate2) delegate)
- .getMenu(parent);
+ menu = ((IWorkbenchWindowPulldownDelegate2) delegate).getMenu(parent);
}
}
}
@@ -179,39 +171,32 @@ public class WWinPluginPulldown extends WWinPluginAction {
/**
* Constructs a new instance of <code>WWinPluginPulldown</code>.
*
- * @param actionElement
- * The registry element from which the pulldown delegate should
- * be created; must not be <code>null</code>.
- * @param id
- * The identifier of this action delegate; may be
- * <code>null</code>.
- * @param window
- * The workbench window on which this pulldown should act; must
- * not be <code>null</code>.
- * @param style
- * The style.
+ * @param actionElement The registry element from which the pulldown delegate
+ * should be created; must not be <code>null</code>.
+ * @param id The identifier of this action delegate; may be
+ * <code>null</code>.
+ * @param window The workbench window on which this pulldown should act;
+ * must not be <code>null</code>.
+ * @param style The style.
*/
- public WWinPluginPulldown(IConfigurationElement actionElement,
- IWorkbenchWindow window, String id, int style) {
+ public WWinPluginPulldown(IConfigurationElement actionElement, IWorkbenchWindow window, String id, int style) {
super(actionElement, window, id, style);
menuProxy = new MenuProxy();
setMenuCreator(menuProxy);
}
@Override
- protected IActionDelegate validateDelegate(Object obj)
- throws WorkbenchException {
+ protected IActionDelegate validateDelegate(Object obj) throws WorkbenchException {
if (obj instanceof IWorkbenchWindowPulldownDelegate) {
return (IWorkbenchWindowPulldownDelegate) obj;
}
- throw new WorkbenchException(
- "Action must implement IWorkbenchWindowPulldownDelegate"); //$NON-NLS-1$
+ throw new WorkbenchException("Action must implement IWorkbenchWindowPulldownDelegate"); //$NON-NLS-1$
}
/**
- * Returns the pulldown delegate. If it does not exist it is created. Can
- * return <code>null</code> if delegate creation failed.
+ * Returns the pulldown delegate. If it does not exist it is created. Can return
+ * <code>null</code> if delegate creation failed.
*/
protected IWorkbenchWindowPulldownDelegate getPulldownDelegate() {
IActionDelegate delegate = getDelegate();
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java
index 9dea7ebd9de..0dd4f2e8a73 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java
@@ -276,8 +276,7 @@ import org.osgi.util.tracker.ServiceTracker;
* should not required access to the display.
* </p>
*/
-public final class Workbench extends EventManager implements IWorkbench,
- org.eclipse.e4.ui.workbench.IWorkbench {
+public final class Workbench extends EventManager implements IWorkbench, org.eclipse.e4.ui.workbench.IWorkbench {
public static final String WORKBENCH_AUTO_SAVE_JOB = "Workbench Auto-Save Job"; //$NON-NLS-1$
@@ -299,7 +298,6 @@ public final class Workbench extends EventManager implements IWorkbench,
private final SubMonitor subMonitor;
private Display displayForStartupListener;
-
StartupProgressBundleListener(IProgressMonitor progressMonitor, Display display) {
displayForStartupListener = display;
subMonitor = SubMonitor.convert(progressMonitor);
@@ -358,7 +356,6 @@ public final class Workbench extends EventManager implements IWorkbench,
private boolean workbenchAutoSave = true;
-
private EditorHistory editorHistory;
private boolean runEventLoop = true;
@@ -379,8 +376,8 @@ public final class Workbench extends EventManager implements IWorkbench,
private int returnCode = PlatformUI.RETURN_UNSTARTABLE;
/**
- * Advisor providing application-specific configuration and customization of
- * the workbench.
+ * Advisor providing application-specific configuration and customization of the
+ * workbench.
*
* @since 3.0
*/
@@ -403,10 +400,10 @@ public final class Workbench extends EventManager implements IWorkbench,
/**
* A count of how many large updates are going on. This tracks nesting of
* requests to disable services during a large update -- similar to the
- * <code>setRedraw</code> functionality on <code>Control</code>. When this
- * value becomes greater than zero, services are disabled. When this value
- * becomes zero, services are enabled. Please see
- * <code>largeUpdateStart()</code> and <code>largeUpdateEnd()</code>.
+ * <code>setRedraw</code> functionality on <code>Control</code>. When this value
+ * becomes greater than zero, services are disabled. When this value becomes
+ * zero, services are enabled. Please see <code>largeUpdateStart()</code> and
+ * <code>largeUpdateEnd()</code>.
*/
private int largeUpdates = 0;
@@ -450,12 +447,10 @@ public final class Workbench extends EventManager implements IWorkbench,
/**
* Creates a new workbench.
*
- * @param display
- * the display to be used for all UI interactions with the
- * workbench
- * @param advisor
- * the application-specific advisor that configures and
- * specializes this workbench instance
+ * @param display the display to be used for all UI interactions with the
+ * workbench
+ * @param advisor the application-specific advisor that configures and
+ * specializes this workbench instance
* @since 3.0
*/
private Workbench(Display display, final WorkbenchAdvisor advisor, MApplication app, IEclipseContext appContext) {
@@ -470,7 +465,6 @@ public final class Workbench extends EventManager implements IWorkbench,
throw new IllegalStateException(WorkbenchMessages.Workbench_CreatingWorkbenchTwice);
}
-
Workbench.instance = this;
StartupThreading.setDisplay(display);
@@ -511,16 +505,14 @@ public final class Workbench extends EventManager implements IWorkbench,
serviceLocator = (ServiceLocator) slc.createServiceLocator(null, null, () -> {
final Display display1 = getDisplay();
if (display1 != null && !display1.isDisposed()) {
- MessageDialog.openInformation(null,
- WorkbenchMessages.Workbench_NeedsClose_Title,
+ MessageDialog.openInformation(null, WorkbenchMessages.Workbench_NeedsClose_Title,
WorkbenchMessages.Workbench_NeedsClose_Message);
close(PlatformUI.RETURN_RESTART, true);
}
}, appContext);
serviceLocator.registerService(IServiceLocatorCreator.class, slc);
serviceLocator.registerService(IWorkbenchLocationService.class,
- new WorkbenchLocationService(IServiceScopes.WORKBENCH_SCOPE, this, null, null,
- null, null, 0));
+ new WorkbenchLocationService(IServiceScopes.WORKBENCH_SCOPE, this, null, null, null, null, 0));
}
/**
@@ -542,24 +534,21 @@ public final class Workbench extends EventManager implements IWorkbench,
* workbench advisor, and runs the workbench UI. This entails processing and
* dispatching events until the workbench is closed or restarted.
* <p>
- * This method is intended to be called by <code>PlatformUI</code>. Fails if
- * the workbench UI has already been created.
+ * This method is intended to be called by <code>PlatformUI</code>. Fails if the
+ * workbench UI has already been created.
* </p>
* <p>
* The display passed in must be the default display.
* </p>
*
- * @param display
- * the display to be used for all UI interactions with the
- * workbench
- * @param advisor
- * the application-specific advisor that configures and
- * specializes the workbench
- * @return return code {@link PlatformUI#RETURN_OK RETURN_OK}for normal
- * exit; {@link PlatformUI#RETURN_RESTART RETURN_RESTART}if the
- * workbench was terminated with a call to
- * {@link IWorkbench#restart IWorkbench.restart}; other values
- * reserved for future use
+ * @param display the display to be used for all UI interactions with the
+ * workbench
+ * @param advisor the application-specific advisor that configures and
+ * specializes the workbench
+ * @return return code {@link PlatformUI#RETURN_OK RETURN_OK}for normal exit;
+ * {@link PlatformUI#RETURN_RESTART RETURN_RESTART}if the workbench was
+ * terminated with a call to {@link IWorkbench#restart
+ * IWorkbench.restart}; other values reserved for future use
*/
public static int createAndRunWorkbench(final Display display, final WorkbenchAdvisor advisor) {
final int[] returnCode = new int[1];
@@ -570,8 +559,7 @@ public final class Workbench extends EventManager implements IWorkbench,
final String nlExtensions = Platform.getNLExtensions();
if (nlExtensions.length() > 0) {
ULocale.setDefault(Category.FORMAT,
- new ULocale(ULocale.getDefault(Category.FORMAT).getBaseName()
- + nlExtensions));
+ new ULocale(ULocale.getDefault(Category.FORMAT).getBaseName() + nlExtensions));
}
System.setProperty(org.eclipse.e4.ui.workbench.IWorkbench.XMI_URI_ARG,
@@ -630,8 +618,7 @@ public final class Workbench extends EventManager implements IWorkbench,
// run the legacy workbench once
returnCode[0] = workbench.runUI();
if (migrationProcessor != null && migrationProcessor.isWorkbenchMigrated()) {
- migrationProcessor.updatePartsAfterMigration(
- WorkbenchPlugin.getDefault().getPerspectiveRegistry(),
+ migrationProcessor.updatePartsAfterMigration(WorkbenchPlugin.getDefault().getPerspectiveRegistry(),
WorkbenchPlugin.getDefault().getViewRegistry());
WorkbenchPlugin.log(StatusUtil.newStatus(IStatus.INFO, "Workbench migration finished", null)); //$NON-NLS-1$
}
@@ -698,9 +685,8 @@ public final class Workbench extends EventManager implements IWorkbench,
static IApplicationContext getApplicationContext() {
if (instanceAppContext == null) {
- instanceAppContext = new ServiceTracker(
- WorkbenchPlugin.getDefault().getBundleContext(), IApplicationContext.class
- .getName(), null);
+ instanceAppContext = new ServiceTracker(WorkbenchPlugin.getDefault().getBundleContext(),
+ IApplicationContext.class.getName(), null);
instanceAppContext.open();
}
return (IApplicationContext) instanceAppContext.getService();
@@ -787,6 +773,7 @@ public final class Workbench extends EventManager implements IWorkbench,
SafeRunnable run = new SafeRunnable() {
Image background = null;
+
@Override
public void run() throws Exception {
String splashLoc = System.getProperty("org.eclipse.equinox.launcher.splash.location"); //$NON-NLS-1$
@@ -844,12 +831,10 @@ public final class Workbench extends EventManager implements IWorkbench,
splash.init(splashShell);
}
-
@Override
public void handleException(Throwable e) {
- StatusManager.getManager().handle(
- StatusUtil.newStatus(WorkbenchPlugin.PI_WORKBENCH,
- "Could not instantiate splash", e)); //$NON-NLS-1$
+ StatusManager.getManager()
+ .handle(StatusUtil.newStatus(WorkbenchPlugin.PI_WORKBENCH, "Could not instantiate splash", e)); //$NON-NLS-1$
createSplash = false;
splash = null;
if (background != null)
@@ -873,15 +858,14 @@ public final class Workbench extends EventManager implements IWorkbench,
/**
* Load an image from a filesystem path.
*
- * @param splashLoc
- * the location to load from
+ * @param splashLoc the location to load from
* @return the image or <code>null</code>
* @since 3.3
*/
private static Image loadSplashScreenImage(Display display, String splashLoc) {
Image background = null;
if (splashLoc != null) {
- try (InputStream input = new BufferedInputStream(new FileInputStream(splashLoc)) ){
+ try (InputStream input = new BufferedInputStream(new FileInputStream(splashLoc))) {
background = new Image(display, input);
} catch (SWTException | IOException e) {
StatusManager.getManager().handle(StatusUtil.newStatus(WorkbenchPlugin.PI_WORKBENCH, e));
@@ -939,10 +923,9 @@ public final class Workbench extends EventManager implements IWorkbench,
/**
* Fire workbench preShutdown event, stopping at the first one to veto
*
- * @param forced
- * flag indicating whether the shutdown is being forced
- * @return <code>true</code> to allow the workbench to proceed with
- * shutdown, <code>false</code> to veto a non-forced shutdown
+ * @param forced flag indicating whether the shutdown is being forced
+ * @return <code>true</code> to allow the workbench to proceed with shutdown,
+ * <code>false</code> to veto a non-forced shutdown
* @since 3.2
*/
boolean firePreShutdown(final boolean forced) {
@@ -990,8 +973,7 @@ public final class Workbench extends EventManager implements IWorkbench,
/**
* Fire window opened event.
*
- * @param window
- * The window which just opened; should not be <code>null</code>.
+ * @param window The window which just opened; should not be <code>null</code>.
*/
protected void fireWindowOpened(final IWorkbenchWindow window) {
Object list[] = getListeners();
@@ -1009,8 +991,7 @@ public final class Workbench extends EventManager implements IWorkbench,
/**
* Fire window closed event.
*
- * @param window
- * The window which just closed; should not be <code>null</code>.
+ * @param window The window which just closed; should not be <code>null</code>.
*/
protected void fireWindowClosed(final IWorkbenchWindow window) {
Object list[] = getListeners();
@@ -1028,9 +1009,8 @@ public final class Workbench extends EventManager implements IWorkbench,
/**
* Fire window activated event.
*
- * @param window
- * The window which was just activated; should not be
- * <code>null</code>.
+ * @param window The window which was just activated; should not be
+ * <code>null</code>.
*/
protected void fireWindowActivated(final IWorkbenchWindow window) {
Object list[] = getListeners();
@@ -1048,9 +1028,8 @@ public final class Workbench extends EventManager implements IWorkbench,
/**
* Fire window deactivated event.
*
- * @param window
- * The window which was just deactivated; should not be
- * <code>null</code>.
+ * @param window The window which was just deactivated; should not be
+ * <code>null</code>.
*/
protected void fireWindowDeactivated(final IWorkbenchWindow window) {
Object list[] = getListeners();
@@ -1068,9 +1047,8 @@ public final class Workbench extends EventManager implements IWorkbench,
/**
* Closes the workbench. Assumes that the busy cursor is active.
*
- * @param force
- * true if the close is mandatory, and false if the close is
- * allowed to fail
+ * @param force true if the close is mandatory, and false if the close is
+ * allowed to fail
* @return true if the close succeeded, and false otherwise
*/
private boolean busyClose(final boolean force) {
@@ -1094,14 +1072,13 @@ public final class Workbench extends EventManager implements IWorkbench,
}
// stop the workbench auto-save job so it can't conflict with shutdown
- if(autoSaveJob != null) {
+ if (autoSaveJob != null) {
autoSaveJob.cancel();
autoSaveJob = null;
}
boolean closeEditors = !force
- && PrefUtil.getAPIPreferenceStore().getBoolean(
- IWorkbenchPreferenceConstants.CLOSE_EDITORS_ON_EXIT);
+ && PrefUtil.getAPIPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.CLOSE_EDITORS_ON_EXIT);
if (closeEditors) {
SafeRunner.run(new SafeRunnable() {
@Override
@@ -1171,14 +1148,13 @@ public final class Workbench extends EventManager implements IWorkbench,
}
/**
- * Saves the state of the workbench in the same way that closing the it
- * would. Can be called while the editor is running so that if it crashes
- * the workbench state can be recovered.
+ * Saves the state of the workbench in the same way that closing the it would.
+ * Can be called while the editor is running so that if it crashes the workbench
+ * state can be recovered.
*
- * @param shutdown
- * If true, will close any editors that cannot be persisted. Will
- * also skip saving the model to the disk since that is done
- * later in shutdown.
+ * @param shutdown If true, will close any editors that cannot be persisted.
+ * Will also skip saving the model to the disk since that is
+ * done later in shutdown.
*/
private void persist(final boolean shutdown) {
// persist editors that can be and possibly close the others
@@ -1189,8 +1165,7 @@ public final class Workbench extends EventManager implements IWorkbench,
for (IWorkbenchWindow window : windows) {
IWorkbenchPage pages[] = window.getPages();
for (IWorkbenchPage page : pages) {
- List<EditorReference> editorReferences = ((WorkbenchPage) page)
- .getInternalEditorReferences();
+ List<EditorReference> editorReferences = ((WorkbenchPage) page).getInternalEditorReferences();
List<EditorReference> referencesToClose = new ArrayList<>();
for (EditorReference reference : editorReferences) {
IEditorPart editor = reference.getEditor(false);
@@ -1261,9 +1236,8 @@ public final class Workbench extends EventManager implements IWorkbench,
private boolean detectWorkbenchCorruption(MApplication application) {
if (application.getChildren().isEmpty()) {
- WorkbenchPlugin.log(
- "When auto-saving the workbench model, there were no top-level windows. " //$NON-NLS-1$
- + " Skipped saving the model.", //$NON-NLS-1$
+ WorkbenchPlugin.log("When auto-saving the workbench model, there were no top-level windows. " //$NON-NLS-1$
+ + " Skipped saving the model.", //$NON-NLS-1$
new Exception()); // log a stack trace to assist debugging
return true;
}
@@ -1271,8 +1245,8 @@ public final class Workbench extends EventManager implements IWorkbench,
}
/**
- * Copy the model, clean it up and write it out to workbench.xmi. Called as
- * part of persist(false) during auto-save.
+ * Copy the model, clean it up and write it out to workbench.xmi. Called as part
+ * of persist(false) during auto-save.
*/
private void persistWorkbenchModel() {
if (Job.getJobManager().find(WORKBENCH_AUTO_SAVE_JOB).length > 0) {
@@ -1377,8 +1351,7 @@ public final class Workbench extends EventManager implements IWorkbench,
if (activeWindow == null) {
activeWindow = windows[0];
}
- return WorkbenchPage.saveAll(new ArrayList<>(dirtyParts),
- confirm, closing, true, activeWindow, activeWindow);
+ return WorkbenchPage.saveAll(new ArrayList<>(dirtyParts), confirm, closing, true, activeWindow, activeWindow);
}
@Override
@@ -1387,24 +1360,21 @@ public final class Workbench extends EventManager implements IWorkbench,
}
/**
- * Closes the workbench, returning the given return code from the run
- * method. If forced, the workbench is closed no matter what.
+ * Closes the workbench, returning the given return code from the run method. If
+ * forced, the workbench is closed no matter what.
*
- * @param returnCode
- * {@link PlatformUI#RETURN_OK RETURN_OK}for normal exit;
- * {@link PlatformUI#RETURN_RESTART RETURN_RESTART}if the
- * workbench was terminated with a call to
- * {@link IWorkbench#restart IWorkbench.restart};
- * {@link PlatformUI#RETURN_EMERGENCY_CLOSE} for an emergency
- * shutdown {@link PlatformUI#RETURN_UNSTARTABLE
- * RETURN_UNSTARTABLE}if the workbench could not be started;
- * other values reserved for future use
+ * @param returnCode {@link PlatformUI#RETURN_OK RETURN_OK}for normal exit;
+ * {@link PlatformUI#RETURN_RESTART RETURN_RESTART}if the
+ * workbench was terminated with a call to
+ * {@link IWorkbench#restart IWorkbench.restart};
+ * {@link PlatformUI#RETURN_EMERGENCY_CLOSE} for an emergency
+ * shutdown {@link PlatformUI#RETURN_UNSTARTABLE
+ * RETURN_UNSTARTABLE}if the workbench could not be started;
+ * other values reserved for future use
*
- * @param force
- * true to force the workbench close, and false for a "soft"
- * close that can be canceled
- * @return true if the close was successful, and false if the close was
- * canceled
+ * @param force true to force the workbench close, and false for a "soft"
+ * close that can be canceled
+ * @return true if the close was successful, and false if the close was canceled
*/
/* package */
boolean close(int returnCode, final boolean force) {
@@ -1458,13 +1428,13 @@ public final class Workbench extends EventManager implements IWorkbench,
return iWorkbenchWindow;
}
// otherwise create new IWorkbenchWindow instance
- return createWorkbenchWindow(getDefaultPageInput(), getPerspectiveRegistry()
- .findPerspectiveWithId(getPerspectiveRegistry().getDefaultPerspective()),
+ return createWorkbenchWindow(getDefaultPageInput(),
+ getPerspectiveRegistry().findPerspectiveWithId(getPerspectiveRegistry().getDefaultPerspective()),
activeWindow, false);
}
- IWorkbenchWindow createWorkbenchWindow(IAdaptable input, IPerspectiveDescriptor descriptor,
- MWindow window, boolean newWindow) {
+ IWorkbenchWindow createWorkbenchWindow(IAdaptable input, IPerspectiveDescriptor descriptor, MWindow window,
+ boolean newWindow) {
IEclipseContext windowContext = window.getContext();
if (windowContext == null) {
@@ -1545,8 +1515,6 @@ public final class Workbench extends EventManager implements IWorkbench,
return WorkbenchPlugin.getDefault().getSharedImages();
}
-
-
@Override
public int getWorkbenchWindowCount() {
return getWorkbenchWindows().length;
@@ -1623,8 +1591,7 @@ public final class Workbench extends EventManager implements IWorkbench,
if (introRegistry.getIntroCount() > 0) {
IProduct product = Platform.getProduct();
if (product != null) {
- introDescriptor = (IntroDescriptor) introRegistry.getIntroForProduct(product
- .getId());
+ introDescriptor = (IntroDescriptor) introRegistry.getIntroForProduct(product.getId());
}
}
initializeDefaultServices();
@@ -1642,8 +1609,7 @@ public final class Workbench extends EventManager implements IWorkbench,
});
// configure use of color icons in toolbars
- boolean useColorIcons = PrefUtil.getInternalPreferenceStore().getBoolean(
- IPreferenceConstants.COLOR_ICONS);
+ boolean useColorIcons = PrefUtil.getInternalPreferenceStore().getBoolean(IPreferenceConstants.COLOR_ICONS);
ActionContributionItem.setUseColorIconsInToolbars(useColorIcons);
// initialize workbench single-click vs double-click behavior
@@ -1707,18 +1673,18 @@ public final class Workbench extends EventManager implements IWorkbench,
}
/**
- * Establishes the relationship between JFace actions and the command
- * manager.
+ * Establishes the relationship between JFace actions and the command manager.
*/
private void initializeCommandResolver() {
- ExternalActionManager.getInstance().setCallback(
- new CommandCallback(bindingManager, commandManager, commandId -> workbenchActivitySupport.getActivityManager().getIdentifier(
- commandId).isEnabled(), action -> !(action instanceof CommandAction)));
+ ExternalActionManager.getInstance()
+ .setCallback(new CommandCallback(bindingManager, commandManager,
+ commandId -> workbenchActivitySupport.getActivityManager().getIdentifier(commandId).isEnabled(),
+ action -> !(action instanceof CommandAction)));
}
/**
- * Initialize colors defined by the new colorDefinitions extension point.
- * Note this will be rolled into initializeColors() at some point.
+ * Initialize colors defined by the new colorDefinitions extension point. Note
+ * this will be rolled into initializeColors() at some point.
*
* @since 3.0
*/
@@ -1727,10 +1693,9 @@ public final class Workbench extends EventManager implements IWorkbench,
@Override
public void runWithException() {
- ColorDefinition[] colorDefinitions = WorkbenchPlugin.getDefault()
- .getThemeRegistry().getColors();
- ThemeElementHelper.populateRegistry(getThemeManager().getCurrentTheme(),
- colorDefinitions, PrefUtil.getInternalPreferenceStore());
+ ColorDefinition[] colorDefinitions = WorkbenchPlugin.getDefault().getThemeRegistry().getColors();
+ ThemeElementHelper.populateRegistry(getThemeManager().getCurrentTheme(), colorDefinitions,
+ PrefUtil.getInternalPreferenceStore());
}
});
}
@@ -1740,8 +1705,7 @@ public final class Workbench extends EventManager implements IWorkbench,
boolean openOnSingleClick = store.getBoolean(IPreferenceConstants.OPEN_ON_SINGLE_CLICK);
boolean selectOnHover = store.getBoolean(IPreferenceConstants.SELECT_ON_HOVER);
boolean openAfterDelay = store.getBoolean(IPreferenceConstants.OPEN_AFTER_DELAY);
- int singleClickMethod = openOnSingleClick ? OpenStrategy.SINGLE_CLICK
- : OpenStrategy.DOUBLE_CLICK;
+ int singleClickMethod = openOnSingleClick ? OpenStrategy.SINGLE_CLICK : OpenStrategy.DOUBLE_CLICK;
if (openOnSingleClick) {
if (selectOnHover) {
singleClickMethod |= OpenStrategy.SELECT_ON_HOVER;
@@ -1768,8 +1732,8 @@ public final class Workbench extends EventManager implements IWorkbench,
IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
if (!store.isDefault(IPreferenceConstants.NL_EXTENSIONS)) {
String nlExtensions = store.getString(IPreferenceConstants.NL_EXTENSIONS);
- ULocale.setDefault(Category.FORMAT, new ULocale(ULocale.getDefault(Category.FORMAT)
- .getBaseName() + nlExtensions));
+ ULocale.setDefault(Category.FORMAT,
+ new ULocale(ULocale.getDefault(Category.FORMAT).getBaseName() + nlExtensions));
}
}
@@ -1781,11 +1745,10 @@ public final class Workbench extends EventManager implements IWorkbench,
@Override
public void runWithException() {
- FontDefinition[] fontDefinitions = WorkbenchPlugin.getDefault().getThemeRegistry()
- .getFonts();
+ FontDefinition[] fontDefinitions = WorkbenchPlugin.getDefault().getThemeRegistry().getFonts();
- ThemeElementHelper.populateRegistry(getThemeManager().getCurrentTheme(),
- fontDefinitions, PrefUtil.getInternalPreferenceStore());
+ ThemeElementHelper.populateRegistry(getThemeManager().getCurrentTheme(), fontDefinitions,
+ PrefUtil.getInternalPreferenceStore());
final IPropertyChangeListener themeToPreferencesFontSynchronizer = event -> {
if (event.getNewValue() instanceof FontData[]) {
FontData[] fontData = (FontData[]) event.getNewValue();
@@ -1813,10 +1776,9 @@ public final class Workbench extends EventManager implements IWorkbench,
/*
* Initialize the workbench images.
*
- * @param windowImages An array of the descriptors of the images to be used
- * in the corner of each window, or <code>null</code> if none. It is
- * expected that the array will contain the same icon, rendered at different
- * sizes.
+ * @param windowImages An array of the descriptors of the images to be used in
+ * the corner of each window, or <code>null</code> if none. It is expected that
+ * the array will contain the same icon, rendered at different sizes.
*
* @since 3.0
*/
@@ -1847,7 +1809,6 @@ public final class Workbench extends EventManager implements IWorkbench,
}
}
-
@Override
public boolean isClosing() {
return isClosing;
@@ -1914,7 +1875,7 @@ public final class Workbench extends EventManager implements IWorkbench,
createReference(part);
}
}
-});
+ });
// watch for parts' contexts being set, once they've been set, we need
// to inject the ViewReference/EditorReference into the context
@@ -1972,11 +1933,10 @@ public final class Workbench extends EventManager implements IWorkbench,
}
/**
- * Returns a workbench page that will contain the specified part. If no page
- * can be located, one will be instantiated.
+ * Returns a workbench page that will contain the specified part. If no page can
+ * be located, one will be instantiated.
*
- * @param part
- * the model part to query a parent workbench page for
+ * @param part the model part to query a parent workbench page for
* @return the workbench page that contains the specified part
*/
private WorkbenchPage getWorkbenchPage(MPart part) {
@@ -1985,9 +1945,8 @@ public final class Workbench extends EventManager implements IWorkbench,
if (page == null) {
MWindow window = context.get(MWindow.class);
Workbench workbench = (Workbench) PlatformUI.getWorkbench();
- workbench.openWorkbenchWindow(getDefaultPageInput(), getPerspectiveRegistry()
- .findPerspectiveWithId(getDefaultPerspectiveId()),
- window, false);
+ workbench.openWorkbenchWindow(getDefaultPageInput(),
+ getPerspectiveRegistry().findPerspectiveWithId(getDefaultPerspectiveId()), window, false);
page = (WorkbenchPage) context.get(IWorkbenchPage.class);
}
return page;
@@ -1996,10 +1955,8 @@ public final class Workbench extends EventManager implements IWorkbench,
/**
* Sets the 3.x reference of the specified part into its context.
*
- * @param part
- * the model part that requires a 3.x part reference
- * @param context
- * the part's context
+ * @param part the model part that requires a 3.x part reference
+ * @param context the part's context
*/
private void setReference(MPart part, IEclipseContext context) {
String uri = part.getContributionURI();
@@ -2054,16 +2011,14 @@ public final class Workbench extends EventManager implements IWorkbench,
String descId = colonIndex == -1 ? partId : partId.substring(0, colonIndex);
IViewDescriptor desc = window.getWorkbench().getViewRegistry().find(descId);
- ViewReference ref = new ViewReference(window.getModel().getContext(), page, part,
- (ViewDescriptor) desc);
+ ViewReference ref = new ViewReference(window.getModel().getContext(), page, part, (ViewDescriptor) desc);
page.addViewReference(ref);
return ref;
}
private EditorReference createEditorReference(MPart part, WorkbenchPage page) {
WorkbenchWindow window = (WorkbenchWindow) page.getWorkbenchWindow();
- EditorReference ref = new EditorReference(window.getModel().getContext(), page, part, null,
- null, null);
+ EditorReference ref = new EditorReference(window.getModel().getContext(), page, part, null, null, null);
page.addEditorReference(ref);
return ref;
}
@@ -2072,8 +2027,7 @@ public final class Workbench extends EventManager implements IWorkbench,
* Creates a workbench part reference for the specified part if one does not
* already exist.
*
- * @param part
- * the model part to create a 3.x part reference for
+ * @param part the model part to create a 3.x part reference for
*/
private void createReference(MPart part) {
String uri = part.getContributionURI();
@@ -2182,6 +2136,7 @@ public final class Workbench extends EventManager implements IWorkbench,
}
return null;
}
+
private void defineBindingTable(String id) {
List<MBindingTable> bindingTables = application.getBindingTables();
if (contains(bindingTables, id)) {
@@ -2210,9 +2165,9 @@ public final class Workbench extends EventManager implements IWorkbench,
}
/**
- * Initializes all of the default services for the workbench. For
- * initializing the command-based services, this also parses the registry
- * and hooks up all the required listeners.
+ * Initializes all of the default services for the workbench. For initializing
+ * the command-based services, this also parses the registry and hooks up all
+ * the required listeners.
*/
private void initializeDefaultServices() {
@@ -2233,8 +2188,8 @@ public final class Workbench extends EventManager implements IWorkbench,
});
/*
- * Phase 1 of the initialization of commands. When this phase completes,
- * all the services and managers will exist, and be accessible via the
+ * Phase 1 of the initialization of commands. When this phase completes, all the
+ * services and managers will exist, and be accessible via the
* getService(Object) method.
*/
StartupThreading.runWithoutExceptions(new StartupRunnable() {
@@ -2296,8 +2251,7 @@ public final class Workbench extends EventManager implements IWorkbench,
public void runWithException() {
BindingManager.DEBUG = Policy.DEBUG_KEY_BINDINGS;
bindingManager = e4Context.get(BindingManager.class);
- bindingService[0] = ContextInjectionFactory.make(
- BindingService.class, e4Context);
+ bindingService[0] = ContextInjectionFactory.make(BindingService.class, e4Context);
}
});
@@ -2324,10 +2278,10 @@ public final class Workbench extends EventManager implements IWorkbench,
});
/*
- * Phase 2 of the initialization of commands. The source providers that
- * the workbench provides are creating and registered with the above
- * services. These source providers notify the services when particular
- * pieces of workbench state change.
+ * Phase 2 of the initialization of commands. The source providers that the
+ * workbench provides are creating and registered with the above services. These
+ * source providers notify the services when particular pieces of workbench
+ * state change.
*/
final SourceProviderService sourceProviderService = new SourceProviderService(serviceLocator);
serviceLocator.registerService(ISourceProviderService.class, sourceProviderService);
@@ -2364,9 +2318,9 @@ public final class Workbench extends EventManager implements IWorkbench,
});
/*
- * Phase 3 of the initialization of commands. This handles the creation
- * of wrappers for legacy APIs. By the time this phase completes, any
- * code trying to access commands through legacy APIs should work.
+ * Phase 3 of the initialization of commands. This handles the creation of
+ * wrappers for legacy APIs. By the time this phase completes, any code trying
+ * to access commands through legacy APIs should work.
*/
final IHandlerService[] handlerService = new IHandlerService[1];
StartupThreading.runWithoutExceptions(new StartupRunnable() {
@@ -2385,8 +2339,7 @@ public final class Workbench extends EventManager implements IWorkbench,
bindingManager.addBindingManagerListener(bindingManagerListener);
- serviceLocator.registerService(ISelectionConversionService.class,
- new SelectionConversionService());
+ serviceLocator.registerService(ISelectionConversionService.class, new SelectionConversionService());
backForwardListener = createBackForwardListener();
StartupThreading.runWithoutExceptions(new StartupRunnable() {
@@ -2433,8 +2386,8 @@ public final class Workbench extends EventManager implements IWorkbench,
/**
* Returns true if the Workbench is in the process of starting.
*
- * @return <code>true</code> if the Workbench is starting, but not yet
- * running the event loop.
+ * @return <code>true</code> if the Workbench is starting, but not yet running
+ * the event loop.
*/
@Override
public boolean isStarting() {
@@ -2445,7 +2398,8 @@ public final class Workbench extends EventManager implements IWorkbench,
* Opens the initial workbench window.
*/
/* package */void openFirstTimeWindow() {
- boolean showProgress = PrefUtil.getAPIPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.SHOW_PROGRESS_ON_STARTUP);
+ boolean showProgress = PrefUtil.getAPIPreferenceStore()
+ .getBoolean(IWorkbenchPreferenceConstants.SHOW_PROGRESS_ON_STARTUP);
if (!showProgress) {
doOpenFirstTimeWindow();
@@ -2477,8 +2431,7 @@ public final class Workbench extends EventManager implements IWorkbench,
@Override
public void runWithException() throws Throwable {
- ErrorDialog.openError(null, WorkbenchMessages.Problems_Opening_Page, e
- .getMessage(), e.getStatus());
+ ErrorDialog.openError(null, WorkbenchMessages.Problems_Opening_Page, e.getMessage(), e.getStatus());
}
});
}
@@ -2513,10 +2466,8 @@ public final class Workbench extends EventManager implements IWorkbench,
}
@Override
- public IWorkbenchWindow openWorkbenchWindow(String perspectiveId, IAdaptable input)
- throws WorkbenchException {
- IPerspectiveDescriptor descriptor = getPerspectiveRegistry().findPerspectiveWithId(
- perspectiveId);
+ public IWorkbenchWindow openWorkbenchWindow(String perspectiveId, IAdaptable input) throws WorkbenchException {
+ IPerspectiveDescriptor descriptor = getPerspectiveRegistry().findPerspectiveWithId(perspectiveId);
try {
MWindow window = BasicFactoryImpl.eINSTANCE.createTrimmedWindow();
return openWorkbenchWindow(input, descriptor, window, true);
@@ -2525,8 +2476,8 @@ public final class Workbench extends EventManager implements IWorkbench,
}
}
- public WorkbenchWindow openWorkbenchWindow(IAdaptable input, IPerspectiveDescriptor descriptor,
- MWindow window, boolean newWindow) {
+ public WorkbenchWindow openWorkbenchWindow(IAdaptable input, IPerspectiveDescriptor descriptor, MWindow window,
+ boolean newWindow) {
return (WorkbenchWindow) createWorkbenchWindow(input, descriptor, window, newWindow);
}
@@ -2558,17 +2509,16 @@ public final class Workbench extends EventManager implements IWorkbench,
/**
* Create and return a string with command line options for eclipse.exe that
- * will launch a new workbench that is the same as the currently running
- * one, but using the argument directory as its workspace.
+ * will launch a new workbench that is the same as the currently running one,
+ * but using the argument directory as its workspace.
* <p>
* Note that this method has been copied from
* OpenWorkspaceAction.buildCommandLine(String workspace)
* </p>
*
- * @param workspace
- * the directory to use as the new workspace
- * @return a string of command line options or <code>null</code> if
- * 'eclipse.vm' is not set
+ * @param workspace the directory to use as the new workspace
+ * @return a string of command line options or <code>null</code> if 'eclipse.vm'
+ * is not set
*/
private String buildCommandLine(String workspace) {
String property = System.getProperty(PROP_VM);
@@ -2640,8 +2590,8 @@ public final class Workbench extends EventManager implements IWorkbench,
* @return the ids of all plug-ins containing 1 or more startup extensions
*/
public ContributionInfo[] getEarlyActivatedPlugins() {
- IExtensionPoint point = registry
- .getExtensionPoint(PlatformUI.PLUGIN_ID, IWorkbenchRegistryConstants.PL_STARTUP);
+ IExtensionPoint point = registry.getExtensionPoint(PlatformUI.PLUGIN_ID,
+ IWorkbenchRegistryConstants.PL_STARTUP);
IExtension[] extensions = point.getExtensions();
ArrayList<String> pluginIds = new ArrayList<>(extensions.length);
for (IExtension extension : extensions) {
@@ -2660,22 +2610,21 @@ public final class Workbench extends EventManager implements IWorkbench,
}
/**
- * Returns the ids of the early activated plug-ins that have been disabled
- * by the user.
+ * Returns the ids of the early activated plug-ins that have been disabled by
+ * the user.
*
- * @return the ids of the early activated plug-ins that have been disabled
- * by the user
+ * @return the ids of the early activated plug-ins that have been disabled by
+ * the user
*/
public String[] getDisabledEarlyActivatedPlugins() {
- String pref = PrefUtil.getInternalPreferenceStore().getString(
- IPreferenceConstants.PLUGINS_NOT_ACTIVATED_ON_STARTUP);
+ String pref = PrefUtil.getInternalPreferenceStore()
+ .getString(IPreferenceConstants.PLUGINS_NOT_ACTIVATED_ON_STARTUP);
return pref.split(";"); //$NON-NLS-1$
}
/*
* Starts all plugins that extend the <code> org.eclipse.ui.startup </code>
- * extension point, and that the user has not disabled via the preference
- * page.
+ * extension point, and that the user has not disabled via the preference page.
*/
private void startPlugins() {
@@ -2723,8 +2672,7 @@ public final class Workbench extends EventManager implements IWorkbench,
/**
* Disable the Workbench Auto-Save job on startup during tests.
*
- * @param b
- * <code>false</code> to disable the tests.
+ * @param b <code>false</code> to disable the tests.
*/
public void setEnableAutoSave(boolean b) {
workbenchAutoSave = b;
@@ -2734,13 +2682,12 @@ public final class Workbench extends EventManager implements IWorkbench,
* Internal method for running the workbench UI. This entails processing and
* dispatching events until the workbench is closed or restarted.
*
- * @return return code {@link PlatformUI#RETURN_OK RETURN_OK}for normal
- * exit; {@link PlatformUI#RETURN_RESTART RETURN_RESTART}if the
- * workbench was terminated with a call to
- * {@link IWorkbench#restart IWorkbench.restart};
- * {@link PlatformUI#RETURN_UNSTARTABLE RETURN_UNSTARTABLE}if the
- * workbench could not be started; other values reserved for future
- * use
+ * @return return code {@link PlatformUI#RETURN_OK RETURN_OK}for normal exit;
+ * {@link PlatformUI#RETURN_RESTART RETURN_RESTART}if the workbench was
+ * terminated with a call to {@link IWorkbench#restart
+ * IWorkbench.restart}; {@link PlatformUI#RETURN_UNSTARTABLE
+ * RETURN_UNSTARTABLE}if the workbench could not be started; other
+ * values reserved for future use
* @since 3.0
*/
private int runUI() {
@@ -2809,8 +2756,7 @@ public final class Workbench extends EventManager implements IWorkbench,
.registerService(IWorkbench.class.getName(), this, properties);
e4WorkbenchService = WorkbenchPlugin.getDefault().getBundleContext()
- .registerService(org.eclipse.e4.ui.workbench.IWorkbench.class.getName(),
- this, properties);
+ .registerService(org.eclipse.e4.ui.workbench.IWorkbench.class.getName(), this, properties);
Runnable earlyStartup = () -> {
// Let the advisor run its start-up code.
@@ -2877,8 +2823,7 @@ public final class Workbench extends EventManager implements IWorkbench,
handler.handleException(e);
} else {
String msg = "Exception in Workbench.runUI after display was disposed"; //$NON-NLS-1$
- WorkbenchPlugin.log(msg, new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 1,
- msg, e));
+ WorkbenchPlugin.log(msg, new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 1, msg, e));
}
}
@@ -2891,11 +2836,8 @@ public final class Workbench extends EventManager implements IWorkbench,
return minuteSaveInterval * 60 * 1000;
}
-
-
@Override
- public IWorkbenchPage showPerspective(String perspectiveId, IWorkbenchWindow window)
- throws WorkbenchException {
+ public IWorkbenchPage showPerspective(String perspectiveId, IWorkbenchWindow window) throws WorkbenchException {
return showPerspective(perspectiveId, window, advisor.getDefaultPageInput());
}
@@ -2917,14 +2859,13 @@ public final class Workbench extends EventManager implements IWorkbench,
}
@Override
- public IWorkbenchPage showPerspective(String perspectiveId, IWorkbenchWindow targetWindow,
- IAdaptable input) throws WorkbenchException {
+ public IWorkbenchPage showPerspective(String perspectiveId, IWorkbenchWindow targetWindow, IAdaptable input)
+ throws WorkbenchException {
Assert.isNotNull(perspectiveId);
- IPerspectiveDescriptor targetPerspective = getPerspectiveRegistry().findPerspectiveWithId(
- perspectiveId);
+ IPerspectiveDescriptor targetPerspective = getPerspectiveRegistry().findPerspectiveWithId(perspectiveId);
if (targetPerspective == null) {
- throw new WorkbenchException(NLS.bind(
- WorkbenchMessages.WorkbenchPage_ErrorCreatingPerspective, perspectiveId));
+ throw new WorkbenchException(
+ NLS.bind(WorkbenchMessages.WorkbenchPage_ErrorCreatingPerspective, perspectiveId));
}
if (targetWindow != null) {
@@ -2968,9 +2909,8 @@ public final class Workbench extends EventManager implements IWorkbench,
try {
advisor.postShutdown();
} catch (Exception ex) {
- StatusManager.getManager().handle(
- StatusUtil.newStatus(WorkbenchPlugin.PI_WORKBENCH,
- "Exceptions during shutdown", ex)); //$NON-NLS-1$
+ StatusManager.getManager()
+ .handle(StatusUtil.newStatus(WorkbenchPlugin.PI_WORKBENCH, "Exceptions during shutdown", ex)); //$NON-NLS-1$
}
// notify regular workbench clients of shutdown, and clear the list when done
@@ -3034,13 +2974,12 @@ public final class Workbench extends EventManager implements IWorkbench,
}
/**
- * Returns the unique object that applications use to configure the
- * workbench.
+ * Returns the unique object that applications use to configure the workbench.
* <p>
- * IMPORTANT This method is declared package-private to prevent regular
- * plug-ins from downcasting IWorkbench to Workbench and getting hold of the
- * workbench configurer that would allow them to tamper with the workbench.
- * The workbench configurer is available only to the application.
+ * IMPORTANT This method is declared package-private to prevent regular plug-ins
+ * from downcasting IWorkbench to Workbench and getting hold of the workbench
+ * configurer that would allow them to tamper with the workbench. The workbench
+ * configurer is available only to the application.
* </p>
*/
/* package */
@@ -3054,10 +2993,10 @@ public final class Workbench extends EventManager implements IWorkbench,
/**
* Returns the workbench advisor that created this workbench.
* <p>
- * IMPORTANT This method is declared package-private to prevent regular
- * plug-ins from downcasting IWorkbench to Workbench and getting hold of the
- * workbench advisor that would allow them to tamper with the workbench. The
- * workbench advisor is internal to the application.
+ * IMPORTANT This method is declared package-private to prevent regular plug-ins
+ * from downcasting IWorkbench to Workbench and getting hold of the workbench
+ * advisor that would allow them to tamper with the workbench. The workbench
+ * advisor is internal to the application.
* </p>
*/
/* package */
@@ -3118,9 +3057,9 @@ public final class Workbench extends EventManager implements IWorkbench,
/**
* The single instance of the binding manager used by the workbench. This is
- * initialized in <code>Workbench.init(Display)</code> and then never
- * changed. This value will only be <code>null</code> if the initialization
- * call has not yet completed.
+ * initialized in <code>Workbench.init(Display)</code> and then never changed.
+ * This value will only be <code>null</code> if the initialization call has not
+ * yet completed.
*
* @since 3.1
*/
@@ -3128,9 +3067,9 @@ public final class Workbench extends EventManager implements IWorkbench,
/**
* The single instance of the command manager used by the workbench. This is
- * initialized in <code>Workbench.init(Display)</code> and then never
- * changed. This value will only be <code>null</code> if the initialization
- * call has not yet completed.
+ * initialized in <code>Workbench.init(Display)</code> and then never changed.
+ * This value will only be <code>null</code> if the initialization call has not
+ * yet completed.
*
* @since 3.1
*/
@@ -3138,9 +3077,9 @@ public final class Workbench extends EventManager implements IWorkbench,
/**
* The single instance of the context manager used by the workbench. This is
- * initialized in <code>Workbench.init(Display)</code> and then never
- * changed. This value will only be <code>null</code> if the initialization
- * call has not yet completed.
+ * initialized in <code>Workbench.init(Display)</code> and then never changed.
+ * This value will only be <code>null</code> if the initialization call has not
+ * yet completed.
*
* @since 3.1
*/
@@ -3218,11 +3157,10 @@ public final class Workbench extends EventManager implements IWorkbench,
}
/**
- * This method exists as a test hook. This method should
- * <strong>NEVER</strong> be called by clients.
+ * This method exists as a test hook. This method should <strong>NEVER</strong>
+ * be called by clients.
*
- * @param descriptor
- * The intro descriptor to use.
+ * @param descriptor The intro descriptor to use.
* @since 3.0
*/
public void setIntroDescriptor(IntroDescriptor descriptor) {
@@ -3246,8 +3184,8 @@ public final class Workbench extends EventManager implements IWorkbench,
if (deltas.length == 0) {
return;
}
- final String disabledPlugins = PrefUtil.getInternalPreferenceStore().getString(
- IPreferenceConstants.PLUGINS_NOT_ACTIVATED_ON_STARTUP);
+ final String disabledPlugins = PrefUtil.getInternalPreferenceStore()
+ .getString(IPreferenceConstants.PLUGINS_NOT_ACTIVATED_ON_STARTUP);
for (IExtensionDelta delta : deltas) {
IExtension extension = delta.getExtension();
@@ -3271,11 +3209,11 @@ public final class Workbench extends EventManager implements IWorkbench,
}
/**
- * Returns <code>true</code> if the workbench is running, <code>false</code>
- * if it has been terminated.
+ * Returns <code>true</code> if the workbench is running, <code>false</code> if
+ * it has been terminated.
*
- * @return <code>true</code> if the workbench is running, <code>false</code>
- * if it has been terminated.
+ * @return <code>true</code> if the workbench is running, <code>false</code> if
+ * it has been terminated.
*/
public boolean isRunning() {
return runEventLoop;
@@ -3283,11 +3221,11 @@ public final class Workbench extends EventManager implements IWorkbench,
/**
* <p>
- * Indicates the start of a large update within the workbench. This is used
- * to disable CPU-intensive, change-sensitive services that were temporarily
- * disabled in the midst of large changes. This method should always be
- * called in tandem with <code>largeUpdateEnd</code>, and the event loop
- * should not be allowed to spin before that method is called.
+ * Indicates the start of a large update within the workbench. This is used to
+ * disable CPU-intensive, change-sensitive services that were temporarily
+ * disabled in the midst of large changes. This method should always be called
+ * in tandem with <code>largeUpdateEnd</code>, and the event loop should not be
+ * allowed to spin before that method is called.
* </p>
* <p>
* Important: always use with <code>largeUpdateEnd</code>!
@@ -3309,8 +3247,8 @@ public final class Workbench extends EventManager implements IWorkbench,
* Indicates the end of a large update within the workbench. This is used to
* re-enable services that were temporarily disabled in the midst of large
* changes. This method should always be called in tandem with
- * <code>largeUpdateStart</code>, and the event loop should not be allowed
- * to spin before this method is called.
+ * <code>largeUpdateStart</code>, and the event loop should not be allowed to
+ * spin before this method is called.
* </p>
* <p>
* Important: always protect this call by using <code>finally</code>!
@@ -3378,7 +3316,6 @@ public final class Workbench extends EventManager implements IWorkbench,
return key.cast(serviceLocator.getService(key));
}
-
@Override
public <T> T getService(final Class<T> key) {
return serviceLocator.getService(key);
@@ -3391,40 +3328,36 @@ public final class Workbench extends EventManager implements IWorkbench,
/**
* Registers a service with this locator. If there is an existing service
- * matching the same <code>api</code> and it implements {@link IDisposable},
- * it will be disposed.
+ * matching the same <code>api</code> and it implements {@link IDisposable}, it
+ * will be disposed.
*
- * @param api
- * This is the interface that the service implements. Must not be
- * <code>null</code>.
- * @param service
- * The service to register. This must be some implementation of
- * <code>api</code>. This value must not be <code>null</code>.
+ * @param api This is the interface that the service implements. Must not be
+ * <code>null</code>.
+ * @param service The service to register. This must be some implementation of
+ * <code>api</code>. This value must not be <code>null</code>.
*/
public void registerService(final Class api, final Object service) {
serviceLocator.registerService(api, service);
}
/**
- * The source provider that tracks which context menus (i.e., menus with
- * target identifiers) are now showing. This value is <code>null</code>
- * until {@link #initializeDefaultServices()} is called.
+ * The source provider that tracks which context menus (i.e., menus with target
+ * identifiers) are now showing. This value is <code>null</code> until
+ * {@link #initializeDefaultServices()} is called.
*/
private MenuSourceProvider menuSourceProvider;
/**
- * Adds the ids of a menu that is now showing to the menu source provider.
- * This is used for legacy action-based handlers which need to become active
- * only for the duration of a menu being visible.
+ * Adds the ids of a menu that is now showing to the menu source provider. This
+ * is used for legacy action-based handlers which need to become active only for
+ * the duration of a menu being visible.
*
- * @param menuIds
- * The identifiers of the menu that is now showing; must not be
- * <code>null</code>.
+ * @param menuIds The identifiers of the menu that is now showing; must
+ * not be <code>null</code>.
* @param localSelection
* @param localEditorInput
*/
- public void addShowingMenus(final Set menuIds, final ISelection localSelection,
- final ISelection localEditorInput) {
+ public void addShowingMenus(final Set menuIds, final ISelection localSelection, final ISelection localEditorInput) {
menuSourceProvider.addShowingMenus(menuIds, localSelection, localEditorInput);
Map currentState = menuSourceProvider.getCurrentState();
for (String key : menuSourceProvider.getProvidedSourceNames()) {
@@ -3433,13 +3366,12 @@ public final class Workbench extends EventManager implements IWorkbench,
}
/**
- * Removes the ids of a menu that is now hidden from the menu source
- * provider. This is used for legacy action-based handlers which need to
- * become active only for the duration of a menu being visible.
+ * Removes the ids of a menu that is now hidden from the menu source provider.
+ * This is used for legacy action-based handlers which need to become active
+ * only for the duration of a menu being visible.
*
- * @param menuIds
- * The identifiers of the menu that is now hidden; must not be
- * <code>null</code>.
+ * @param menuIds The identifiers of the menu that is now hidden; must
+ * not be <code>null</code>.
* @param localSelection
* @param localEditorInput
*/
@@ -3452,8 +3384,8 @@ public final class Workbench extends EventManager implements IWorkbench,
}
@Override
- public boolean saveAll(final IShellProvider shellProvider,
- final IRunnableContext runnableContext, final ISaveableFilter filter, boolean confirm) {
+ public boolean saveAll(final IShellProvider shellProvider, final IRunnableContext runnableContext,
+ final ISaveableFilter filter, boolean confirm) {
SaveablesList saveablesList = (SaveablesList) getService(ISaveablesLifecycleListener.class);
Saveable[] saveables = saveablesList.getOpenModels();
List<Saveable> toSave = getFilteredSaveables(filter, saveables);
@@ -3546,8 +3478,7 @@ public final class Workbench extends EventManager implements IWorkbench,
// TODO: Currently we store the editors history only. Add more if needed
- result.add(getEditorHistory().saveState(
- memento.createChild(IWorkbenchConstants.TAG_MRU_LIST)));
+ result.add(getEditorHistory().saveState(memento.createChild(IWorkbenchConstants.TAG_MRU_LIST)));
return result;
}
@@ -3564,8 +3495,7 @@ public final class Workbench extends EventManager implements IWorkbench,
}
}
} catch (Exception e) {
- WorkbenchPlugin.log(new Status(
- IStatus.ERROR, PlatformUI.PLUGIN_ID, 0,
+ WorkbenchPlugin.log(new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0,
WorkbenchMessages.Workbench_problemsRestoring, e));
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchConfigurer.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchConfigurer.java
index b2f5ada9857..7ff7970d5c7 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchConfigurer.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchConfigurer.java
@@ -31,8 +31,8 @@ import org.eclipse.ui.application.WorkbenchAdvisor;
/**
* Internal class providing special access for configuring the workbench.
* <p>
- * Note that these objects are only available to the main application
- * (the plug-in that creates and owns the workbench).
+ * Note that these objects are only available to the main application (the
+ * plug-in that creates and owns the workbench).
* </p>
* <p>
* This class is not intended to be instantiated or subclassed by clients.
@@ -42,132 +42,129 @@ import org.eclipse.ui.application.WorkbenchAdvisor;
*/
public final class WorkbenchConfigurer implements IWorkbenchConfigurer {
- /**
- * Table to hold arbitrary key-data settings (key type: <code>String</code>,
- * value type: <code>Object</code>).
- * @see #setData
- */
- private Map extraData = new HashMap();
-
- /**
- * Indicates whether workbench state should be saved on close and
- * restored on subsequent open.
- */
- private boolean saveAndRestore = false;
-
- /**
- * Indicates whether the workbench is being force to close. During
- * an emergency close, no interaction with the user should be done.
- */
- private boolean isEmergencyClosing = false;
-
- /**
- * Indicates the behaviour when the last window is closed.
- * If <code>true</code>, the workbench will exit (saving the last window's state,
- * if configured to do so).
- * If <code>false</code> the window will be closed, leaving the workbench running.
- *
- * @since 3.1
- */
+ /**
+ * Table to hold arbitrary key-data settings (key type: <code>String</code>,
+ * value type: <code>Object</code>).
+ *
+ * @see #setData
+ */
+ private Map extraData = new HashMap();
+
+ /**
+ * Indicates whether workbench state should be saved on close and restored on
+ * subsequent open.
+ */
+ private boolean saveAndRestore = false;
+
+ /**
+ * Indicates whether the workbench is being force to close. During an emergency
+ * close, no interaction with the user should be done.
+ */
+ private boolean isEmergencyClosing = false;
+
+ /**
+ * Indicates the behaviour when the last window is closed. If <code>true</code>,
+ * the workbench will exit (saving the last window's state, if configured to do
+ * so). If <code>false</code> the window will be closed, leaving the workbench
+ * running.
+ *
+ * @since 3.1
+ */
private boolean exitOnLastWindowClose = true;
- /**
- * Creates a new workbench configurer.
- * <p>
- * This method is declared package-private. Clients are passed an instance
- * only via {@link WorkbenchAdvisor#initialize WorkbenchAdvisor.initialize}
- * </p>
- */
- /* package */WorkbenchConfigurer() {
- super();
- }
-
- @Override
+ /**
+ * Creates a new workbench configurer.
+ * <p>
+ * This method is declared package-private. Clients are passed an instance only
+ * via {@link WorkbenchAdvisor#initialize WorkbenchAdvisor.initialize}
+ * </p>
+ */
+ /* package */ WorkbenchConfigurer() {
+ super();
+ }
+
+ @Override
public IWorkbench getWorkbench() {
- return PlatformUI.getWorkbench();
- }
+ return PlatformUI.getWorkbench();
+ }
- @Override
+ @Override
public WindowManager getWorkbenchWindowManager() {
- // return the global workbench window manager
+ // return the global workbench window manager
return null;
- }
-
- @Override
- public void declareImage(String symbolicName, ImageDescriptor descriptor,
- boolean shared) {
- if (symbolicName == null || descriptor == null) {
- throw new IllegalArgumentException();
- }
- WorkbenchImages.declareImage(symbolicName, descriptor, shared);
- }
-
- @Override
- public IWorkbenchWindowConfigurer getWindowConfigurer(
- IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- return ((WorkbenchWindow) window).getWindowConfigurer();
- }
-
- @Override
+ }
+
+ @Override
+ public void declareImage(String symbolicName, ImageDescriptor descriptor, boolean shared) {
+ if (symbolicName == null || descriptor == null) {
+ throw new IllegalArgumentException();
+ }
+ WorkbenchImages.declareImage(symbolicName, descriptor, shared);
+ }
+
+ @Override
+ public IWorkbenchWindowConfigurer getWindowConfigurer(IWorkbenchWindow window) {
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ return ((WorkbenchWindow) window).getWindowConfigurer();
+ }
+
+ @Override
public boolean getSaveAndRestore() {
- return saveAndRestore;
- }
+ return saveAndRestore;
+ }
- @Override
+ @Override
public void setSaveAndRestore(boolean enabled) {
- saveAndRestore = enabled;
- }
+ saveAndRestore = enabled;
+ }
- @Override
+ @Override
public Object getData(String key) {
- if (key == null) {
- throw new IllegalArgumentException();
- }
- return extraData.get(key);
- }
+ if (key == null) {
+ throw new IllegalArgumentException();
+ }
+ return extraData.get(key);
+ }
- @Override
+ @Override
public void setData(String key, Object data) {
- if (key == null) {
- throw new IllegalArgumentException();
- }
- if (data != null) {
- extraData.put(key, data);
- } else {
- extraData.remove(key);
- }
- }
-
- @Override
+ if (key == null) {
+ throw new IllegalArgumentException();
+ }
+ if (data != null) {
+ extraData.put(key, data);
+ } else {
+ extraData.remove(key);
+ }
+ }
+
+ @Override
public void emergencyClose() {
- if (!isEmergencyClosing) {
- isEmergencyClosing = true;
- if (Workbench.getInstance() != null
- && !Workbench.getInstance().isClosing()) {
- Workbench.getInstance().close(
- PlatformUI.RETURN_EMERGENCY_CLOSE, true);
- }
- }
-
- }
-
- @Override
+ if (!isEmergencyClosing) {
+ isEmergencyClosing = true;
+ if (Workbench.getInstance() != null && !Workbench.getInstance().isClosing()) {
+ Workbench.getInstance().close(PlatformUI.RETURN_EMERGENCY_CLOSE, true);
+ }
+ }
+
+ }
+
+ @Override
public boolean emergencyClosing() {
- return isEmergencyClosing;
- }
+ return isEmergencyClosing;
+ }
- @Override
+ @Override
public IStatus restoreState() {
return Status.OK_STATUS;
- }
+ }
- @Override
+ @Override
public void openFirstTimeWindow() {
- ((Workbench) getWorkbench()).openFirstTimeWindow();
- }
+ ((Workbench) getWorkbench()).openFirstTimeWindow();
+ }
@Override
public IWorkbenchWindowConfigurer restoreWorkbenchWindow(IMemento memento) throws WorkbenchException {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchEditorsHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchEditorsHandler.java
index a0c7f0dcea0..7ab4305029c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchEditorsHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchEditorsHandler.java
@@ -32,8 +32,7 @@ public class WorkbenchEditorsHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- IWorkbenchWindow workbenchWindow = HandlerUtil
- .getActiveWorkbenchWindow(event);
+ IWorkbenchWindow workbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);
if (workbenchWindow == null) {
// action has been disposed
return null;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchErrorHandlerProxy.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchErrorHandlerProxy.java
index 145143431ea..653aaa28e7c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchErrorHandlerProxy.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchErrorHandlerProxy.java
@@ -31,14 +31,12 @@ public class WorkbenchErrorHandlerProxy extends AbstractStatusHandler {
@Override
public void handle(final StatusAdapter statusAdapter, int style) {
- Workbench.getInstance().getAdvisor().getWorkbenchErrorHandler().handle(
- statusAdapter, style);
+ Workbench.getInstance().getAdvisor().getWorkbenchErrorHandler().handle(statusAdapter, style);
}
@Override
public boolean supportsNotification(int type) {
- return Workbench.getInstance().getAdvisor().getWorkbenchErrorHandler()
- .supportsNotification(type);
+ return Workbench.getInstance().getAdvisor().getWorkbenchErrorHandler().supportsNotification(type);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchHandlerServiceHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchHandlerServiceHandler.java
index ee698cf66a8..8e750d0673e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchHandlerServiceHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchHandlerServiceHandler.java
@@ -25,8 +25,7 @@ import org.eclipse.ui.menus.UIElement;
* @since 3.5
*
*/
-public class WorkbenchHandlerServiceHandler extends HandlerServiceHandler implements
- IElementUpdater {
+public class WorkbenchHandlerServiceHandler extends HandlerServiceHandler implements IElementUpdater {
/**
* @param commandId
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchImages.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchImages.java
index 072e67696f1..0e52c32b5cb 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchImages.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchImages.java
@@ -65,81 +65,80 @@ import org.eclipse.ui.internal.util.BundleUtility;
* Add a constant to IWorkbenchGraphicConstants following the conventions Add
* the declaration to this file
*/
-public/*final*/class WorkbenchImages {
+public/* final */class WorkbenchImages {
- private static Map<String, ImageDescriptor> descriptors;
+ private static Map<String, ImageDescriptor> descriptors;
- private static ImageRegistry imageRegistry;
+ private static ImageRegistry imageRegistry;
- /* Declare Common paths */
+ /* Declare Common paths */
- public static final String ICONS_PATH = "$nl$/icons/full/";//$NON-NLS-1$
+ public static final String ICONS_PATH = "$nl$/icons/full/";//$NON-NLS-1$
- private static final String PATH_ETOOL = ICONS_PATH + "etool16/"; //Enabled toolbar icons.//$NON-NLS-1$
+ private static final String PATH_ETOOL = ICONS_PATH + "etool16/"; // Enabled toolbar icons.//$NON-NLS-1$
- private static final String PATH_DTOOL = ICONS_PATH + "dtool16/"; //Disabled toolbar icons.//$NON-NLS-1$
+ private static final String PATH_DTOOL = ICONS_PATH + "dtool16/"; // Disabled toolbar icons.//$NON-NLS-1$
- private static final String PATH_ELOCALTOOL = ICONS_PATH + "elcl16/"; //Enabled local toolbar icons.//$NON-NLS-1$
+ private static final String PATH_ELOCALTOOL = ICONS_PATH + "elcl16/"; // Enabled local toolbar icons.//$NON-NLS-1$
- private static final String PATH_DLOCALTOOL = ICONS_PATH + "dlcl16/"; //Disabled local toolbar icons.//$NON-NLS-1$
+ private static final String PATH_DLOCALTOOL = ICONS_PATH + "dlcl16/"; // Disabled local toolbar icons.//$NON-NLS-1$
- private static final String PATH_EVIEW = ICONS_PATH + "eview16/"; //View icons//$NON-NLS-1$
+ private static final String PATH_EVIEW = ICONS_PATH + "eview16/"; // View icons//$NON-NLS-1$
private static final String PATH_OVERLAY = ICONS_PATH + "ovr16/"; //$NON-NLS-1$
- private static final String PATH_OBJECT = ICONS_PATH + "obj16/"; //Model object icons//$NON-NLS-1$
+ private static final String PATH_OBJECT = ICONS_PATH + "obj16/"; // Model object icons//$NON-NLS-1$
- private static final String PATH_POINTER = ICONS_PATH + "pointer/"; //Pointer icons//$NON-NLS-1$
+ private static final String PATH_POINTER = ICONS_PATH + "pointer/"; // Pointer icons//$NON-NLS-1$
- private static final String PATH_WIZBAN = ICONS_PATH + "wizban/"; //Wizard icons//$NON-NLS-1$
+ private static final String PATH_WIZBAN = ICONS_PATH + "wizban/"; // Wizard icons//$NON-NLS-1$
private static final String PATH_PREF = ICONS_PATH + "pref/"; // Preferences icons//$NON-NLS-1$
- /**
- * Declares a workbench image given the path of the image file (relative to
- * the workbench plug-in). This is a helper method that creates the image
- * descriptor and passes it to the main <code>declareImage</code> method.
- *
- * @param key the symbolic name of the image
- * @param path the path of the image file relative to the base of the workbench
- * plug-ins install directory
- * @param shared <code>true</code> if this is a shared image, and
- * <code>false</code> if this is not a shared image
- */
- private static final void declareImage(String key, String path,
- boolean shared) {
- URL url = BundleUtility.find(PlatformUI.PLUGIN_ID, path);
- ImageDescriptor desc = ImageDescriptor.createFromURL(url);
- declareImage(key, desc, shared);
- }
-
- private static void drawViewMenu(GC gc, GC maskgc) {
- Display display = Display.getCurrent();
-
- gc.setForeground(display.getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW));
- gc.setBackground(display.getSystemColor(SWT.COLOR_LIST_BACKGROUND));
-
- int[] shapeArray = new int[] {1, 1, 10, 1, 6, 5, 5, 5};
- gc.fillPolygon(shapeArray);
- gc.drawPolygon(shapeArray);
-
- Color black = display.getSystemColor(SWT.COLOR_BLACK);
- Color white = display.getSystemColor(SWT.COLOR_WHITE);
-
- maskgc.setBackground(black);
- maskgc.fillRectangle(0,0,12,16);
-
- maskgc.setBackground(white);
- maskgc.setForeground(white);
- maskgc.fillPolygon(shapeArray);
- maskgc.drawPolygon(shapeArray);
- }
-
- /**
- * Declares all the workbench's images, including both "shared" ones and
- * internal ones.
- */
- private static final void declareImages() {
+ /**
+ * Declares a workbench image given the path of the image file (relative to the
+ * workbench plug-in). This is a helper method that creates the image descriptor
+ * and passes it to the main <code>declareImage</code> method.
+ *
+ * @param key the symbolic name of the image
+ * @param path the path of the image file relative to the base of the
+ * workbench plug-ins install directory
+ * @param shared <code>true</code> if this is a shared image, and
+ * <code>false</code> if this is not a shared image
+ */
+ private static final void declareImage(String key, String path, boolean shared) {
+ URL url = BundleUtility.find(PlatformUI.PLUGIN_ID, path);
+ ImageDescriptor desc = ImageDescriptor.createFromURL(url);
+ declareImage(key, desc, shared);
+ }
+
+ private static void drawViewMenu(GC gc, GC maskgc) {
+ Display display = Display.getCurrent();
+
+ gc.setForeground(display.getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW));
+ gc.setBackground(display.getSystemColor(SWT.COLOR_LIST_BACKGROUND));
+
+ int[] shapeArray = new int[] { 1, 1, 10, 1, 6, 5, 5, 5 };
+ gc.fillPolygon(shapeArray);
+ gc.drawPolygon(shapeArray);
+
+ Color black = display.getSystemColor(SWT.COLOR_BLACK);
+ Color white = display.getSystemColor(SWT.COLOR_WHITE);
+
+ maskgc.setBackground(black);
+ maskgc.fillRectangle(0, 0, 12, 16);
+
+ maskgc.setBackground(white);
+ maskgc.setForeground(white);
+ maskgc.fillPolygon(shapeArray);
+ maskgc.drawPolygon(shapeArray);
+ }
+
+ /**
+ * Declares all the workbench's images, including both "shared" ones and
+ * internal ones.
+ */
+ private static final void declareImages() {
// Overlays
declareImage(ISharedImages.IMG_DEC_FIELD_ERROR, PATH_OVERLAY + "error_ovr.png", true); //$NON-NLS-1$
declareImage(ISharedImages.IMG_DEC_FIELD_WARNING, PATH_OVERLAY + "warning_ovr.png", true); //$NON-NLS-1$
@@ -334,217 +333,201 @@ public/*final*/class WorkbenchImages {
getImageRegistry().put(IWorkbenchGraphicConstants.IMG_LCL_RENDERED_VIEW_MENU, vm2);
- }
+ }
- /**
- * Declares all the workbench's deprecated hover images, including both "shared" ones and
- * internal ones.
- *
- * @deprecated As of 3.0, since the workbench itself no longer uses the hover image variants
- */
- @Deprecated
+ /**
+ * Declares all the workbench's deprecated hover images, including both "shared"
+ * ones and internal ones.
+ *
+ * @deprecated As of 3.0, since the workbench itself no longer uses the hover
+ * image variants
+ */
+ @Deprecated
private static final void declareHoverImages() {
- declareImage(ISharedImages.IMG_TOOL_UNDO_HOVER, PATH_ETOOL
- + "undo_edit.png", true); //$NON-NLS-1$
- declareImage(ISharedImages.IMG_TOOL_REDO_HOVER, PATH_ETOOL
- + "redo_edit.png", true); //$NON-NLS-1$
- declareImage(ISharedImages.IMG_TOOL_CUT_HOVER, PATH_ETOOL
- + "cut_edit.png", true); //$NON-NLS-1$
- declareImage(ISharedImages.IMG_TOOL_COPY_HOVER, PATH_ETOOL
- + "copy_edit.png", true); //$NON-NLS-1$
- declareImage(ISharedImages.IMG_TOOL_PASTE_HOVER, PATH_ETOOL
- + "paste_edit.png", true); //$NON-NLS-1$
- declareImage(ISharedImages.IMG_TOOL_FORWARD_HOVER, PATH_ELOCALTOOL
- + "forward_nav.png", true); //$NON-NLS-1$
- declareImage(ISharedImages.IMG_TOOL_DELETE_HOVER, PATH_ETOOL
- + "delete_edit.png", true); //$NON-NLS-1$
- declareImage(ISharedImages.IMG_TOOL_NEW_WIZARD_HOVER, PATH_ETOOL
- + "new_wiz.png", true); //$NON-NLS-1$
- declareImage(ISharedImages.IMG_TOOL_BACK_HOVER, PATH_ELOCALTOOL
- + "backward_nav.png", true); //$NON-NLS-1$
- declareImage(ISharedImages.IMG_TOOL_UP_HOVER, PATH_ELOCALTOOL
- + "up_nav.png", true); //$NON-NLS-1$
- }
-
- /**
- * Declares a workbench image.
- * <p>
- * The workbench remembers the given image descriptor under the given name,
- * and makes the image available to plug-ins via
- * {@link org.eclipse.ui.ISharedImages IWorkbench.getSharedImages()}.
- * For "shared" images, the workbench remembers the image descriptor and
- * will manages the image object create from it; clients retrieve "shared"
- * images via
- * {@link org.eclipse.ui.ISharedImages#getImage ISharedImages.getImage()}.
- * For the other, "non-shared" images, the workbench remembers only the
- * image descriptor; clients retrieve the image descriptor via
- * {@link org.eclipse.ui.ISharedImages#getImageDescriptor
- * ISharedImages.getImageDescriptor()} and are entirely
- * responsible for managing the image objects they create from it.
- * (This is made confusing by the historical fact that the API interface
- * is called "ISharedImages".)
- * </p>
- *
- * @param symbolicName the symbolic name of the image
- * @param descriptor the image descriptor
- * @param shared <code>true</code> if this is a shared image, and
- * <code>false</code> if this is not a shared image
- * @see org.eclipse.ui.ISharedImages#getImage
- * @see org.eclipse.ui.ISharedImages#getImageDescriptor
- */
- public static void declareImage(String symbolicName,
- ImageDescriptor descriptor, boolean shared) {
- if (Policy.DEBUG_DECLARED_IMAGES) {
- Image image = descriptor.createImage(false);
- if (image == null) {
- WorkbenchPlugin.log("Image not found in WorkbenchImages.declaredImage(). symbolicName=" + symbolicName + " descriptor=" + descriptor, new Exception("stack dump")); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
- }
- else {
- image.dispose();
- }
- }
- getDescriptors().put(symbolicName, descriptor);
- if (shared) {
- getImageRegistry().put(symbolicName, descriptor);
- }
- }
-
- /**
- * Returns the map from symbolic name to ImageDescriptor.
- *
- * @return the map from symbolic name to ImageDescriptor.
- */
- public static Map<String, ImageDescriptor> getDescriptors() {
- if (descriptors == null) {
- initializeImageRegistry();
- }
- return descriptors;
- }
-
- /**
- * Returns the image stored in the workbench plugin's image registry
- * under the given symbolic name. If there isn't any value associated
- * with the name then <code>null</code> is returned.
- *
- * The returned Image is managed by the workbench plugin's image registry.
- * Callers of this method must not dispose the returned image.
- *
- * This method is essentially a convenient short form of
- * WorkbenchImages.getImageRegistry.get(symbolicName).
- *
- * @param symbolicName the symbolic name
- * @return the image
- */
- public static Image getImage(String symbolicName) {
- return getImageRegistry().get(symbolicName);
- }
-
- /**
- * Returns the image descriptor stored under the given symbolic name.
- * If there isn't any value associated with the name then <code>null
- * </code> is returned.
- *
- * The class also "caches" commonly used images in the image registry.
- * If you are looking for one of these common images it is recommended you use
- * the getImage() method instead.
- *
- * @param symbolicName the symbolic name
- * @return the image descriptor
- */
- public static ImageDescriptor getImageDescriptor(String symbolicName) {
- return getDescriptors().get(symbolicName);
- }
-
- /**
- * Convenience Method.
- * Returns an ImageDescriptor obtained from an external program.
- * If there isn't any image then <code>null</code> is returned.
- *
- * This method is convenience and only intended for use by the workbench because it
- * explicitly uses the workbench's registry for caching/retrieving images from other
- * extensions -- other plugins must user their own registry.
- * This convenience method is subject to removal.
- *
- * Note:
- * This consults the plugin for extension and obtains its installation location.
- * all requested images are assumed to be in a directory below and relative to that
- * plugins installation directory.
- *
- * @param filename the file name
- * @param offset the offset
- * @return the image descriptor
- */
-
- public static ImageDescriptor getImageDescriptorFromProgram(
- String filename, int offset) {
- Assert.isNotNull(filename);
- String key = filename + "*" + offset; //use * as it is not a valid filename character//$NON-NLS-1$
- ImageDescriptor desc = getImageDescriptor(key);
- if (desc == null) {
- desc = new ProgramImageDescriptor(filename, offset);
- getDescriptors().put(key, desc);
- }
- return desc;
- }
-
- /**
- * Returns the ImageRegistry.
- *
- * @return the image registry
- */
- public static ImageRegistry getImageRegistry() {
- if (imageRegistry == null) {
- initializeImageRegistry();
- }
- return imageRegistry;
- }
-
- /**
- * Initialize the image registry by declaring all of the required graphics.
- * This involves creating JFace image descriptors describing how to
- * create/find the image should it be needed. The image is not actually
- * allocated until requested.
+ declareImage(ISharedImages.IMG_TOOL_UNDO_HOVER, PATH_ETOOL + "undo_edit.png", true); //$NON-NLS-1$
+ declareImage(ISharedImages.IMG_TOOL_REDO_HOVER, PATH_ETOOL + "redo_edit.png", true); //$NON-NLS-1$
+ declareImage(ISharedImages.IMG_TOOL_CUT_HOVER, PATH_ETOOL + "cut_edit.png", true); //$NON-NLS-1$
+ declareImage(ISharedImages.IMG_TOOL_COPY_HOVER, PATH_ETOOL + "copy_edit.png", true); //$NON-NLS-1$
+ declareImage(ISharedImages.IMG_TOOL_PASTE_HOVER, PATH_ETOOL + "paste_edit.png", true); //$NON-NLS-1$
+ declareImage(ISharedImages.IMG_TOOL_FORWARD_HOVER, PATH_ELOCALTOOL + "forward_nav.png", true); //$NON-NLS-1$
+ declareImage(ISharedImages.IMG_TOOL_DELETE_HOVER, PATH_ETOOL + "delete_edit.png", true); //$NON-NLS-1$
+ declareImage(ISharedImages.IMG_TOOL_NEW_WIZARD_HOVER, PATH_ETOOL + "new_wiz.png", true); //$NON-NLS-1$
+ declareImage(ISharedImages.IMG_TOOL_BACK_HOVER, PATH_ELOCALTOOL + "backward_nav.png", true); //$NON-NLS-1$
+ declareImage(ISharedImages.IMG_TOOL_UP_HOVER, PATH_ELOCALTOOL + "up_nav.png", true); //$NON-NLS-1$
+ }
+
+ /**
+ * Declares a workbench image.
+ * <p>
+ * The workbench remembers the given image descriptor under the given name, and
+ * makes the image available to plug-ins via {@link org.eclipse.ui.ISharedImages
+ * IWorkbench.getSharedImages()}. For "shared" images, the workbench remembers
+ * the image descriptor and will manages the image object create from it;
+ * clients retrieve "shared" images via
+ * {@link org.eclipse.ui.ISharedImages#getImage ISharedImages.getImage()}. For
+ * the other, "non-shared" images, the workbench remembers only the image
+ * descriptor; clients retrieve the image descriptor via
+ * {@link org.eclipse.ui.ISharedImages#getImageDescriptor
+ * ISharedImages.getImageDescriptor()} and are entirely responsible for managing
+ * the image objects they create from it. (This is made confusing by the
+ * historical fact that the API interface is called "ISharedImages".)
+ * </p>
+ *
+ * @param symbolicName the symbolic name of the image
+ * @param descriptor the image descriptor
+ * @param shared <code>true</code> if this is a shared image, and
+ * <code>false</code> if this is not a shared image
+ * @see org.eclipse.ui.ISharedImages#getImage
+ * @see org.eclipse.ui.ISharedImages#getImageDescriptor
+ */
+ public static void declareImage(String symbolicName, ImageDescriptor descriptor, boolean shared) {
+ if (Policy.DEBUG_DECLARED_IMAGES) {
+ Image image = descriptor.createImage(false);
+ if (image == null) {
+ WorkbenchPlugin.log("Image not found in WorkbenchImages.declaredImage(). symbolicName=" + symbolicName //$NON-NLS-1$
+ + " descriptor=" + descriptor, new Exception("stack dump")); //$NON-NLS-1$//$NON-NLS-2$
+ } else {
+ image.dispose();
+ }
+ }
+ getDescriptors().put(symbolicName, descriptor);
+ if (shared) {
+ getImageRegistry().put(symbolicName, descriptor);
+ }
+ }
+
+ /**
+ * Returns the map from symbolic name to ImageDescriptor.
+ *
+ * @return the map from symbolic name to ImageDescriptor.
+ */
+ public static Map<String, ImageDescriptor> getDescriptors() {
+ if (descriptors == null) {
+ initializeImageRegistry();
+ }
+ return descriptors;
+ }
+
+ /**
+ * Returns the image stored in the workbench plugin's image registry under the
+ * given symbolic name. If there isn't any value associated with the name then
+ * <code>null</code> is returned.
+ *
+ * The returned Image is managed by the workbench plugin's image registry.
+ * Callers of this method must not dispose the returned image.
+ *
+ * This method is essentially a convenient short form of
+ * WorkbenchImages.getImageRegistry.get(symbolicName).
+ *
+ * @param symbolicName the symbolic name
+ * @return the image
+ */
+ public static Image getImage(String symbolicName) {
+ return getImageRegistry().get(symbolicName);
+ }
+
+ /**
+ * Returns the image descriptor stored under the given symbolic name. If there
+ * isn't any value associated with the name then <code>null
+ * </code> is returned.
+ *
+ * The class also "caches" commonly used images in the image registry. If you
+ * are looking for one of these common images it is recommended you use the
+ * getImage() method instead.
+ *
+ * @param symbolicName the symbolic name
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String symbolicName) {
+ return getDescriptors().get(symbolicName);
+ }
+
+ /**
+ * Convenience Method. Returns an ImageDescriptor obtained from an external
+ * program. If there isn't any image then <code>null</code> is returned.
+ *
+ * This method is convenience and only intended for use by the workbench because
+ * it explicitly uses the workbench's registry for caching/retrieving images
+ * from other extensions -- other plugins must user their own registry. This
+ * convenience method is subject to removal.
+ *
+ * Note: This consults the plugin for extension and obtains its installation
+ * location. all requested images are assumed to be in a directory below and
+ * relative to that plugins installation directory.
+ *
+ * @param filename the file name
+ * @param offset the offset
+ * @return the image descriptor
+ */
+
+ public static ImageDescriptor getImageDescriptorFromProgram(String filename, int offset) {
+ Assert.isNotNull(filename);
+ String key = filename + "*" + offset; // use * as it is not a valid filename character//$NON-NLS-1$
+ ImageDescriptor desc = getImageDescriptor(key);
+ if (desc == null) {
+ desc = new ProgramImageDescriptor(filename, offset);
+ getDescriptors().put(key, desc);
+ }
+ return desc;
+ }
+
+ /**
+ * Returns the ImageRegistry.
+ *
+ * @return the image registry
+ */
+ public static ImageRegistry getImageRegistry() {
+ if (imageRegistry == null) {
+ initializeImageRegistry();
+ }
+ return imageRegistry;
+ }
+
+ /**
+ * Initialize the image registry by declaring all of the required graphics. This
+ * involves creating JFace image descriptors describing how to create/find the
+ * image should it be needed. The image is not actually allocated until
+ * requested.
*
* Prefix conventions Wizard Banners WIZBAN_ Preference Banners PREF_BAN_
- * Property Page Banners PROPBAN_ Enable toolbar ETOOL_ Disable toolbar
- * DTOOL_ Local enabled toolbar ELCL_ Local Disable toolbar DLCL_ Object
- * large OBJL_ Object small OBJS_ View VIEW_ Product images PROD_ Misc
- * images MISC_
+ * Property Page Banners PROPBAN_ Enable toolbar ETOOL_ Disable toolbar DTOOL_
+ * Local enabled toolbar ELCL_ Local Disable toolbar DLCL_ Object large OBJL_
+ * Object small OBJS_ View VIEW_ Product images PROD_ Misc images MISC_
*
- * Where are the images? The images (typically png files) are found in the
- * same location as this plugin class. This may mean the same package
- * directory as the package holding this class. The images are declared
- * using this.getClass() to ensure they are looked up via this plugin class.
+ * Where are the images? The images (typically png files) are found in the same
+ * location as this plugin class. This may mean the same package directory as
+ * the package holding this class. The images are declared using this.getClass()
+ * to ensure they are looked up via this plugin class.
*
* @see ImageRegistry
*/
- private static void initializeImageRegistry() {
- imageRegistry = new ImageRegistry();
+ private static void initializeImageRegistry() {
+ imageRegistry = new ImageRegistry();
descriptors = new HashMap<>();
- declareImages();
- }
-
- /**
- * Disposes and clears the workbench images.
- * Called when the workbench is shutting down.
- *
- * @since 3.1
- */
- public static void dispose() {
- if (imageRegistry != null) {
- imageRegistry.dispose();
- imageRegistry = null;
- descriptors = null;
- }
- }
+ declareImages();
+ }
+
+ /**
+ * Disposes and clears the workbench images. Called when the workbench is
+ * shutting down.
+ *
+ * @since 3.1
+ */
+ public static void dispose() {
+ if (imageRegistry != null) {
+ imageRegistry.dispose();
+ imageRegistry = null;
+ descriptors = null;
+ }
+ }
/**
- * Get the workbench image with the given path relative to
- * ICON_PATH.
+ * Get the workbench image with the given path relative to ICON_PATH.
+ *
* @param relativePath
* @return ImageDescriptor
*/
- public static ImageDescriptor getWorkbenchImageDescriptor(String relativePath){
+ public static ImageDescriptor getWorkbenchImageDescriptor(String relativePath) {
return ImageDescriptor.createFromURL(BundleUtility.find(PlatformUI.PLUGIN_ID, ICONS_PATH + relativePath));
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchIntroManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchIntroManager.java
index edb2bc35eba..741a3a889ba 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchIntroManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchIntroManager.java
@@ -45,147 +45,144 @@ import org.eclipse.ui.intro.IntroContentDetector;
*/
public class WorkbenchIntroManager implements IIntroManager {
- private final Workbench workbench;
-
- /**
- * Create a new instance of the receiver.
- *
- * @param workbench the workbench instance
- */
- WorkbenchIntroManager(Workbench workbench) {
- this.workbench = workbench;
- workbench.getExtensionTracker().registerHandler(new IExtensionChangeHandler(){
-
- @Override
- public void addExtension(IExtensionTracker tracker,IExtension extension) {
- //Do nothing
- }
+ private final Workbench workbench;
+
+ /**
+ * Create a new instance of the receiver.
+ *
+ * @param workbench the workbench instance
+ */
+ WorkbenchIntroManager(Workbench workbench) {
+ this.workbench = workbench;
+ workbench.getExtensionTracker().registerHandler(new IExtensionChangeHandler() {
+
+ @Override
+ public void addExtension(IExtensionTracker tracker, IExtension extension) {
+ // Do nothing
+ }
@Override
public void removeExtension(IExtension source, Object[] objects) {
- for (Object object : objects) {
- if (object instanceof IIntroPart) {
- closeIntro((IIntroPart) object);
- }
- }
+ for (Object object : objects) {
+ if (object instanceof IIntroPart) {
+ closeIntro((IIntroPart) object);
+ }
+ }
- }}, null);
+ }
+ }, null);
- }
+ }
- /**
- * The currently active introPart in this workspace, <code>null</code> if none.
- */
- private IIntroPart introPart;
+ /**
+ * The currently active introPart in this workspace, <code>null</code> if none.
+ */
+ private IIntroPart introPart;
- @Override
+ @Override
public boolean closeIntro(IIntroPart part) {
- if (introPart == null || !introPart.equals(part)) {
+ if (introPart == null || !introPart.equals(part)) {
return false;
}
- IViewPart introView = getViewIntroAdapterPart();
- if (introView != null) {
- //assumption is that there is only ever one intro per workbench
- //if we ever support one per window then this will need revisiting
- IWorkbenchPage page = introView.getSite().getPage();
+ IViewPart introView = getViewIntroAdapterPart();
+ if (introView != null) {
+ // assumption is that there is only ever one intro per workbench
+ // if we ever support one per window then this will need revisiting
+ IWorkbenchPage page = introView.getSite().getPage();
if (page == null) {
introPart = null;
return true;
}
- IViewReference reference = page
- .findViewReference(IIntroConstants.INTRO_VIEW_ID);
- page.hideView(introView);
- if (reference == null || reference.getPart(false) == null) {
- introPart = null;
- return true;
- }
- return false;
- }
+ IViewReference reference = page.findViewReference(IIntroConstants.INTRO_VIEW_ID);
+ page.hideView(introView);
+ if (reference == null || reference.getPart(false) == null) {
+ introPart = null;
+ return true;
+ }
+ return false;
+ }
// if there is no part then null our reference
introPart = null;
- return true;
- }
+ return true;
+ }
- @Override
- public IIntroPart showIntro(IWorkbenchWindow preferredWindow,
- boolean standby) {
- if (preferredWindow == null) {
+ @Override
+ public IIntroPart showIntro(IWorkbenchWindow preferredWindow, boolean standby) {
+ if (preferredWindow == null) {
preferredWindow = this.workbench.getActiveWorkbenchWindow();
}
- if (preferredWindow == null) {
+ if (preferredWindow == null) {
return null;
}
- ViewIntroAdapterPart viewPart = getViewIntroAdapterPart();
- if (viewPart == null) {
- createIntro(preferredWindow);
- } else {
- try {
- IWorkbenchPage page = viewPart.getSite().getPage();
- IWorkbenchWindow window = page.getWorkbenchWindow();
- if (!window.equals(preferredWindow)) {
- window.getShell().setActive();
- }
-
- page.showView(IIntroConstants.INTRO_VIEW_ID);
- } catch (PartInitException e) {
- WorkbenchPlugin
- .log(
- "Could not open intro", new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, IStatus.ERROR, "Could not open intro", e)); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- setIntroStandby(introPart, standby);
- return introPart;
- }
-
- /**
- * @param testWindow the window to test
- * @return whether the intro exists in the given window
- */
- /*package*/boolean isIntroInWindow(IWorkbenchWindow testWindow) {
- ViewIntroAdapterPart viewPart = getViewIntroAdapterPart();
- if (viewPart == null) {
+ ViewIntroAdapterPart viewPart = getViewIntroAdapterPart();
+ if (viewPart == null) {
+ createIntro(preferredWindow);
+ } else {
+ try {
+ IWorkbenchPage page = viewPart.getSite().getPage();
+ IWorkbenchWindow window = page.getWorkbenchWindow();
+ if (!window.equals(preferredWindow)) {
+ window.getShell().setActive();
+ }
+
+ page.showView(IIntroConstants.INTRO_VIEW_ID);
+ } catch (PartInitException e) {
+ WorkbenchPlugin.log("Could not open intro", new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, //$NON-NLS-1$
+ IStatus.ERROR, "Could not open intro", e)); //$NON-NLS-1$
+ }
+ }
+ setIntroStandby(introPart, standby);
+ return introPart;
+ }
+
+ /**
+ * @param testWindow the window to test
+ * @return whether the intro exists in the given window
+ */
+ /* package */boolean isIntroInWindow(IWorkbenchWindow testWindow) {
+ ViewIntroAdapterPart viewPart = getViewIntroAdapterPart();
+ if (viewPart == null) {
return false;
}
- IWorkbenchWindow window = viewPart.getSite().getWorkbenchWindow();
- if (window.equals(testWindow)) {
- return true;
- }
- return false;
- }
-
- /**
- * Create a new Intro area (a view, currently) in the provided window. If there is no intro
- * descriptor for this workbench then no work is done.
- *
- * @param preferredWindow the window to create the intro in.
- */
- private void createIntro(IWorkbenchWindow preferredWindow) {
- if (this.workbench.getIntroDescriptor() == null) {
+ IWorkbenchWindow window = viewPart.getSite().getWorkbenchWindow();
+ if (window.equals(testWindow)) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Create a new Intro area (a view, currently) in the provided window. If there
+ * is no intro descriptor for this workbench then no work is done.
+ *
+ * @param preferredWindow the window to create the intro in.
+ */
+ private void createIntro(IWorkbenchWindow preferredWindow) {
+ if (this.workbench.getIntroDescriptor() == null) {
return;
}
- IWorkbenchPage workbenchPage = preferredWindow.getActivePage();
- if (workbenchPage == null) {
+ IWorkbenchPage workbenchPage = preferredWindow.getActivePage();
+ if (workbenchPage == null) {
return;
}
- try {
- workbenchPage.showView(IIntroConstants.INTRO_VIEW_ID);
- } catch (PartInitException e) {
- WorkbenchPlugin
- .log(
- IntroMessages.Intro_could_not_create_part, new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, IStatus.ERROR, IntroMessages.Intro_could_not_create_part, e));
- }
- }
-
- @Override
+ try {
+ workbenchPage.showView(IIntroConstants.INTRO_VIEW_ID);
+ } catch (PartInitException e) {
+ WorkbenchPlugin.log(IntroMessages.Intro_could_not_create_part, new Status(IStatus.ERROR,
+ WorkbenchPlugin.PI_WORKBENCH, IStatus.ERROR, IntroMessages.Intro_could_not_create_part, e));
+ }
+ }
+
+ @Override
public void setIntroStandby(IIntroPart part, boolean standby) {
- if (introPart == null || !introPart.equals(part)) {
+ if (introPart == null || !introPart.equals(part)) {
return;
}
@@ -225,32 +222,32 @@ public class WorkbenchIntroManager implements IIntroManager {
return false;
return introStack.getTags().contains(IPresentationEngine.MAXIMIZED);
- }
+ }
- @Override
+ @Override
public boolean isIntroStandby(IIntroPart part) {
- if (introPart == null || !introPart.equals(part)) {
+ if (introPart == null || !introPart.equals(part)) {
return false;
}
- ViewIntroAdapterPart viewIntroAdapterPart = getViewIntroAdapterPart();
- if (viewIntroAdapterPart == null) {
+ ViewIntroAdapterPart viewIntroAdapterPart = getViewIntroAdapterPart();
+ if (viewIntroAdapterPart == null) {
return false;
}
return !isIntroMaximized(viewIntroAdapterPart);
- }
+ }
- @Override
+ @Override
public IIntroPart getIntro() {
- return introPart;
- }
-
- /**
- * @return the <code>ViewIntroAdapterPart</code> for this workbench, <code>null</code> if it
- * cannot be found.
- */
- /*package*/ViewIntroAdapterPart getViewIntroAdapterPart() {
+ return introPart;
+ }
+
+ /**
+ * @return the <code>ViewIntroAdapterPart</code> for this workbench,
+ * <code>null</code> if it cannot be found.
+ */
+ /* package */ViewIntroAdapterPart getViewIntroAdapterPart() {
for (IWorkbenchWindow iWorkbenchWindow : this.workbench.getWorkbenchWindows()) {
WorkbenchWindow window = (WorkbenchWindow) iWorkbenchWindow;
MUIElement introPart = window.modelService.find(IIntroConstants.INTRO_VIEW_ID, window.getModel());
@@ -265,46 +262,42 @@ public class WorkbenchIntroManager implements IIntroManager {
}
}
}
- return null;
- }
-
- /**
- * @return a new IIntroPart. This has the side effect of setting the introPart field to the new
- * value.
- */
- /*package*/IIntroPart createNewIntroPart() throws CoreException {
- IntroDescriptor introDescriptor = workbench.getIntroDescriptor();
- introPart = introDescriptor == null ? null
- : introDescriptor.createIntro();
- if (introPart != null) {
- workbench.getExtensionTracker().registerObject(
- introDescriptor.getConfigurationElement()
- .getDeclaringExtension(), introPart,
+ return null;
+ }
+
+ /**
+ * @return a new IIntroPart. This has the side effect of setting the introPart
+ * field to the new value.
+ */
+ /* package */IIntroPart createNewIntroPart() throws CoreException {
+ IntroDescriptor introDescriptor = workbench.getIntroDescriptor();
+ introPart = introDescriptor == null ? null : introDescriptor.createIntro();
+ if (introPart != null) {
+ workbench.getExtensionTracker().registerObject(
+ introDescriptor.getConfigurationElement().getDeclaringExtension(), introPart,
IExtensionTracker.REF_WEAK);
- }
- return introPart;
- }
+ }
+ return introPart;
+ }
- @Override
+ @Override
public boolean hasIntro() {
- return workbench.getIntroDescriptor() != null;
- }
+ return workbench.getIntroDescriptor() != null;
+ }
- @Override
+ @Override
public boolean isNewContentAvailable() {
IntroDescriptor introDescriptor = workbench.getIntroDescriptor();
if (introDescriptor == null) {
return false;
}
try {
- IntroContentDetector contentDetector = introDescriptor
- .getIntroContentDetector();
+ IntroContentDetector contentDetector = introDescriptor.getIntroContentDetector();
if (contentDetector != null) {
return contentDetector.isNewContentAvailable();
}
} catch (CoreException ex) {
- WorkbenchPlugin.log(new Status(IStatus.WARNING,
- WorkbenchPlugin.PI_WORKBENCH, IStatus.WARNING,
+ WorkbenchPlugin.log(new Status(IStatus.WARNING, WorkbenchPlugin.PI_WORKBENCH, IStatus.WARNING,
"Could not load intro content detector", ex)); //$NON-NLS-1$
}
return false;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchLayoutSettingsTransfer.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchLayoutSettingsTransfer.java
index cfe3b55f729..435ef47366d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchLayoutSettingsTransfer.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchLayoutSettingsTransfer.java
@@ -48,17 +48,14 @@ public class WorkbenchLayoutSettingsTransfer extends WorkbenchSettingsTransfer {
File workspaceFile = createFileAndDirectories(newWorkspaceRoot);
if (workspaceFile == null)
- return new Status(
- IStatus.ERROR,
- WorkbenchPlugin.PI_WORKBENCH,
+ return new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH,
WorkbenchMessages.WorkbenchSettings_CouldNotCreateDirectories);
File deltas = new File(currentLocation.toOSString(), "deltas.xml"); //$NON-NLS-1$
if (deltas.exists()) {
byte[] bytes = new byte[8192];
FileInputStream inputStream = new FileInputStream(deltas);
- FileOutputStream outputStream = new FileOutputStream(new File(workspaceFile,
- "deltas.xml")); //$NON-NLS-1$
+ FileOutputStream outputStream = new FileOutputStream(new File(workspaceFile, "deltas.xml")); //$NON-NLS-1$
int read = inputStream.read(bytes, 0, 8192);
while (read != -1) {
outputStream.write(bytes, 0, read);
@@ -72,8 +69,7 @@ public class WorkbenchLayoutSettingsTransfer extends WorkbenchSettingsTransfer {
if (workbenchModel.exists()) {
byte[] bytes = new byte[8192];
FileInputStream inputStream = new FileInputStream(workbenchModel);
- FileOutputStream outputStream = new FileOutputStream(new File(workspaceFile,
- "workbench.xmi")); //$NON-NLS-1$
+ FileOutputStream outputStream = new FileOutputStream(new File(workspaceFile, "workbench.xmi")); //$NON-NLS-1$
int read = inputStream.read(bytes, 0, 8192);
while (read != -1) {
outputStream.write(bytes, 0, read);
@@ -92,12 +88,12 @@ public class WorkbenchLayoutSettingsTransfer extends WorkbenchSettingsTransfer {
}
/**
- * Create the parent directories for the workbench layout file and then
- * return the File.
+ * Create the parent directories for the workbench layout file and then return
+ * the File.
*
* @param newWorkspaceRoot
- * @return File the new layout file. Return <code>null</code> if the file
- * cannot be created.
+ * @return File the new layout file. Return <code>null</code> if the file cannot
+ * be created.
*/
private File createFileAndDirectories(IPath newWorkspaceRoot) {
IPath newWorkspaceLocation = getNewWorkbenchStateLocation(newWorkspaceRoot);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java
index 49209bf93c2..2e2f714bf83 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java
@@ -26,14 +26,13 @@ package org.eclipse.ui.internal;
import org.eclipse.osgi.util.NLS;
/**
- * Message class for workbench messages. These messages are used
- * throughout the workbench.
+ * Message class for workbench messages. These messages are used throughout the
+ * workbench.
*
*/
public class WorkbenchMessages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.ui.internal.messages";//$NON-NLS-1$
-
public static String ThemingEnabled;
public static String ThemeChangeWarningText;
@@ -42,36 +41,27 @@ public class WorkbenchMessages extends NLS {
public static String BundleSigningTray_Cant_Find_Service;
-
public static String BundleSigningTray_Determine_Signer_For;
-
public static String BundleSigningTray_Signing_Certificate;
-
public static String BundleSigningTray_Signing_Date;
-
public static String BundleSigningTray_Unget_Signing_Service;
-
public static String BundleSigningTray_Unknown;
-
public static String BundleSigningTray_Unsigned;
-
public static String BundleSigningTray_Working;
-
public static String NewWorkingSet;
-
public static String PlatformUI_NoWorkbench;
public static String Workbench_CreatingWorkbenchTwice;
- public static String StatusUtil_errorOccurred;
+ public static String StatusUtil_errorOccurred;
// ==============================================================================
// Workbench Actions
@@ -109,7 +99,6 @@ public class WorkbenchMessages extends NLS {
public static String Workbench_properties;
public static String Workbench_propertiesToolTip;
-
public static String Workbench_print;
public static String Workbench_printToolTip;
public static String ExportResourcesAction_text;
@@ -125,7 +114,6 @@ public class WorkbenchMessages extends NLS {
public static String Exit_text;
public static String Exit_toolTip;
-
// --- Edit Menu ---
public static String Workbench_undo;
public static String Workbench_undoToolTip;
@@ -181,10 +169,10 @@ public class WorkbenchMessages extends NLS {
public static String SelectPerspective_open_button_label;
public static String Workbench_showPerspectiveError;
public static String ChangeToPerspectiveMenu_errorTitle;
- public static String OpenPerspectiveDialogAction_text;
- public static String OpenPerspectiveDialogAction_tooltip;
+ public static String OpenPerspectiveDialogAction_text;
+ public static String OpenPerspectiveDialogAction_tooltip;
- public static String ShowView_title;
+ public static String ShowView_title;
public static String ShowView_shellTitle;
public static String ShowView_selectViewHelp;
public static String ShowView_noDesc;
@@ -304,8 +292,6 @@ public class WorkbenchMessages extends NLS {
// --- Filtered Table Base ---
public static String FilteredTableBase_Filter;
-
-
// --- Help Menu ---
public static String AboutAction_text;
public static String AboutAction_toolTip;
@@ -318,7 +304,6 @@ public class WorkbenchMessages extends NLS {
public static String AboutDialog_shellTitle;
public static String AboutDialog_defaultProductName;
-
public static String AboutDialog_DetailsButton;
public static String ProductInfoDialog_errorTitle;
public static String ProductInfoDialog_unableToOpenWebBrowser;
@@ -357,24 +342,21 @@ public class WorkbenchMessages extends NLS {
public static String AboutFeaturesDialog_pluginInfoMessage;
public static String AboutFeaturesDialog_noInfoTitle;
-
public static String AboutFeaturesDialog_SimpleTitle;
public static String AboutSystemDialog_browseErrorLogName;
public static String AboutSystemDialog_copyToClipboardName;
public static String AboutSystemDialog_noLogTitle;
public static String AboutSystemDialog_noLogMessage;
-
public static String AboutSystemPage_FetchJobTitle;
-
public static String AboutSystemPage_RetrievingSystemInfo;
// --- Shortcutbar ---
public static String PerspectiveBarContributionItem_toolTip;
public static String PerspectiveBarNewContributionItem_toolTip;
- //--- Coolbar ---
+ // --- Coolbar ---
public static String WorkbenchWindow_FileToolbar;
public static String WorkbenchWindow_EditToolbar;
public static String WorkbenchWindow_NavigateToolbar;
@@ -382,7 +364,6 @@ public class WorkbenchMessages extends NLS {
public static String WorkbenchWindow_searchCombo_toolTip;
public static String WorkbenchWindow_searchCombo_text;
-
public static String WorkbenchWindow_close;
public static String WorkbenchPage_ErrorCreatingPerspective;
@@ -409,7 +390,6 @@ public class WorkbenchMessages extends NLS {
public static String GoInto_text;
public static String GoInto_toolTip;
-
public static String ICategory_other;
public static String ICategory_general;
@@ -457,7 +437,7 @@ public class WorkbenchMessages extends NLS {
// Preference Pages
// ==============================================================================
public static String PreferenceNode_errorMessage;
- public static String PreferenceNode_NotFound;
+ public static String PreferenceNode_NotFound;
public static String Preference_note;
public static String Preference_import;
public static String Preference_export;
@@ -500,14 +480,13 @@ public class WorkbenchMessages extends NLS {
public static String FileEditorPreference_existsTitle;
public static String FileEditorPreference_existsMessage;
public static String FileEditorPreference_defaultLabel;
- public static String FileEditorPreference_contentTypesRelatedLink;
- public static String FileEditorPreference_isLocked;
+ public static String FileEditorPreference_contentTypesRelatedLink;
+ public static String FileEditorPreference_isLocked;
public static String FileExtension_extensionEmptyMessage;
public static String FileExtension_fileNameInvalidMessage;
public static String FilteredPreferenceDialog_Key_Scrolling;
-
public static String FilteredPreferenceDialog_PreferenceSaveFailed;
public static String FilteredPreferenceDialog_Resize;
public static String FilteredPreferenceDialog_FilterToolTip;
@@ -544,7 +523,7 @@ public class WorkbenchMessages extends NLS {
public static String PerspectiveLabelProvider_unknown;
- //---- General Preferences----
+ // ---- General Preferences----
public static String PreferencePage_noDescription;
public static String PreferencePageParameterValues_pageLabelSeparator;
@@ -601,7 +580,6 @@ public class WorkbenchMessages extends NLS {
public static String Error;
public static String Information;
-
public static String InstallationDialog_ShellTitle;
public static String Workbench_NeedsClose_Title;
@@ -635,17 +613,16 @@ public class WorkbenchMessages extends NLS {
public static String EditorManager_saveChangesQuestion;
public static String EditorManager_closeWithoutPromptingOption;
public static String EditorManager_saveChangesOptionallyQuestion;
- public static String EditorManager_missing_editor_descriptor;
- public static String EditorManager_no_in_place_support;
- public static String EditorManager_no_persisted_state;
- public static String EditorManager_no_input_factory_ID;
- public static String EditorManager_bad_element_factory;
- public static String EditorManager_create_element_returned_null;
- public static String EditorManager_wrong_createElement_result;
- public static String EditorManager_backgroundSaveJobName;
+ public static String EditorManager_missing_editor_descriptor;
+ public static String EditorManager_no_in_place_support;
+ public static String EditorManager_no_persisted_state;
+ public static String EditorManager_no_input_factory_ID;
+ public static String EditorManager_bad_element_factory;
+ public static String EditorManager_create_element_returned_null;
+ public static String EditorManager_wrong_createElement_result;
+ public static String EditorManager_backgroundSaveJobName;
public static String EditorManager_largeDocumentWarning;
-
public static String ExternalEditor_errorMessage;
public static String Save;
public static String Save_Resource;
@@ -658,7 +635,6 @@ public class WorkbenchMessages extends NLS {
public static String SaveableHelper_Dont_Save;
public static String SaveableHelper_Save_Selected;
-
// ==============================================================================
// Perspective Framework
// ==============================================================================
@@ -674,8 +650,6 @@ public class WorkbenchMessages extends NLS {
public static String Perspective_localCopyLabel;
public static String WorkbenchPage_problemRestoringTitle;
-
-
// ==============================================================================
// Views Framework
// ==============================================================================
@@ -693,8 +667,8 @@ public class WorkbenchMessages extends NLS {
public static String WorkbenchPage_UnknownLabel;
-
- // These four keys are marked as unused by the NLS search, but they are indirectly used
+ // These four keys are marked as unused by the NLS search, but they are
+ // indirectly used
// and should be removed.
public static String PartPane_sizeLeft;
public static String PartPane_sizeRight;
@@ -717,7 +691,6 @@ public class WorkbenchMessages extends NLS {
public static String WorkbenchPage_IllegalViewMode;
public static String WorkbenchPart_AutoTitleFormat;
-
public static String AbstractWorkingSetManager_updatersActivating;
public static String DecoratorManager_ErrorActivatingDecorator;
@@ -820,7 +793,8 @@ public class WorkbenchMessages extends NLS {
public static String SystemSummary_sectionTitle;
public static String SystemSummary_sectionError;
- // paramter 0 is the feature name, parameter 1 is the version and parameter 2 is the Id
+ // paramter 0 is the feature name, parameter 1 is the version and parameter 2 is
+ // the Id
public static String SystemSummary_featureVersion;
public static String SystemSummary_descriptorIdVersionState;
@@ -856,7 +830,7 @@ public class WorkbenchMessages extends NLS {
public static String WorkbenchEncoding_invalidCharset;
- //==============================================================
+ // ==============================================================
// Undo/Redo Support
public static String Operations_undoCommand;
@@ -886,7 +860,7 @@ public class WorkbenchMessages extends NLS {
public static String Operations_stoppedOnUndoErrorStatus;
public static String Operations_stoppedOnRedoErrorStatus;
- //==============================================================
+ // ==============================================================
// Heap Status
public static String HeapStatus_status;
@@ -902,33 +876,31 @@ public class WorkbenchMessages extends NLS {
public static String SplitValues_Horizontal;
-
public static String SplitValues_Vertical;
+ // ==============================================================================
+ // Content Types preference page
+ // ==============================================================================
- // ==============================================================================
- // Content Types preference page
- // ==============================================================================
-
- public static String ContentTypes_lockedFormat;
- public static String ContentTypes_characterSetLabel;
- public static String ContentTypes_characterSetUpdateLabel;
- public static String ContentTypes_unsupportedEncoding;
- public static String ContentTypes_fileAssociationsLabel;
- public static String ContentTypes_fileAssociationsAddLabel;
- public static String ContentTypes_fileAssociationsEditLabel;
- public static String ContentTypes_fileAssociationsRemoveLabel;
- public static String ContentTypes_contentTypesLabel;
- public static String ContentTypes_errorDialogMessage;
- public static String ContentTypes_FileEditorsRelatedLink;
- public static String ContentTypes_addDialog_title;
- public static String ContentTypes_addDialog_messageHeader;
- public static String ContentTypes_addDialog_message;
- public static String ContentTypes_addDialog_label;
- public static String ContentTypes_editDialog_title;
- public static String ContentTypes_editDialog_messageHeader;
- public static String ContentTypes_editDialog_message;
- public static String ContentTypes_editDialog_label;
+ public static String ContentTypes_lockedFormat;
+ public static String ContentTypes_characterSetLabel;
+ public static String ContentTypes_characterSetUpdateLabel;
+ public static String ContentTypes_unsupportedEncoding;
+ public static String ContentTypes_fileAssociationsLabel;
+ public static String ContentTypes_fileAssociationsAddLabel;
+ public static String ContentTypes_fileAssociationsEditLabel;
+ public static String ContentTypes_fileAssociationsRemoveLabel;
+ public static String ContentTypes_contentTypesLabel;
+ public static String ContentTypes_errorDialogMessage;
+ public static String ContentTypes_FileEditorsRelatedLink;
+ public static String ContentTypes_addDialog_title;
+ public static String ContentTypes_addDialog_messageHeader;
+ public static String ContentTypes_addDialog_message;
+ public static String ContentTypes_addDialog_label;
+ public static String ContentTypes_editDialog_title;
+ public static String ContentTypes_editDialog_messageHeader;
+ public static String ContentTypes_editDialog_message;
+ public static String ContentTypes_editDialog_label;
public static String ContentTypes_addRootContentTypeButton;
public static String ContentTypes_addChildContentTypeButton;
public static String ContentTypes_removeContentTypeButton;
@@ -939,36 +911,36 @@ public class WorkbenchMessages extends NLS {
public static String ContentTypes_newContentTypeDialog_defaultNameWithParent;
public static String ContentTypes_newContentTypeDialog_invalidContentTypeName;
public static String ContentTypes_failedAtEditingContentTypes;
- public static String Edit;
+ public static String Edit;
public static String ContentTypes_editorAssociations;
public static String ContentTypes_editorAssociationAddLabel;
public static String ContentTypes_editorAssociationRemoveLabel;
- // =========================================================================
- // Deprecated actions support
- // =========================================================================
- public static String CommandService_AutogeneratedCategoryName;
- public static String CommandService_AutogeneratedCategoryDescription;
- public static String LegacyActionPersistence_AutogeneratedCommandName;
-
- // ==============================================================================
- // Trim Common UI
- // ==============================================================================
-
- // Trim Menu item labels
- public static String TrimCommon_DockOn;
- public static String TrimCommon_Left;
- public static String TrimCommon_Right;
- public static String TrimCommon_Bottom;
- public static String TrimCommon_Top;
- public static String TrimCommon_Close;
-
- // Trim area Display Names
- public static String TrimCommon_Progress_TrimName;
-
- // FilteredItemsSelectionDialog
- public static String FilteredItemsSelectionDialog_cacheSearchJob_taskName;
- public static String FilteredItemsSelectionDialog_menu;
+ // =========================================================================
+ // Deprecated actions support
+ // =========================================================================
+ public static String CommandService_AutogeneratedCategoryName;
+ public static String CommandService_AutogeneratedCategoryDescription;
+ public static String LegacyActionPersistence_AutogeneratedCommandName;
+
+ // ==============================================================================
+ // Trim Common UI
+ // ==============================================================================
+
+ // Trim Menu item labels
+ public static String TrimCommon_DockOn;
+ public static String TrimCommon_Left;
+ public static String TrimCommon_Right;
+ public static String TrimCommon_Bottom;
+ public static String TrimCommon_Top;
+ public static String TrimCommon_Close;
+
+ // Trim area Display Names
+ public static String TrimCommon_Progress_TrimName;
+
+ // FilteredItemsSelectionDialog
+ public static String FilteredItemsSelectionDialog_cacheSearchJob_taskName;
+ public static String FilteredItemsSelectionDialog_menu;
public static String FilteredItemsSelectionDialog_refreshJob;
public static String FilteredItemsSelectionDialog_progressRefreshJob;
public static String FilteredItemsSelectionDialog_cacheRefreshJob;
@@ -980,28 +952,27 @@ public class WorkbenchMessages extends NLS {
public static String FilteredItemsSelectionDialog_removeItemsFromHistoryAction;
public static String FilteredItemsSelectionDialog_searchJob_taskName;
public static String FilteredItemsSelectionDialog_separatorLabel;
- public static String FilteredItemsSelectionDialog_storeError;
- public static String FilteredItemsSelectionDialog_restoreError;
- public static String FilteredItemsSelectionDialog_nItemsSelected;
+ public static String FilteredItemsSelectionDialog_storeError;
+ public static String FilteredItemsSelectionDialog_restoreError;
+ public static String FilteredItemsSelectionDialog_nItemsSelected;
- // AbstractSearcher
- public static String FilteredItemsSelectionDialog_jobLabel;
- public static String FilteredItemsSelectionDialog_jobError;
+ // AbstractSearcher
+ public static String FilteredItemsSelectionDialog_jobLabel;
+ public static String FilteredItemsSelectionDialog_jobError;
- // GranualProgressMonitor
- public static String FilteredItemsSelectionDialog_taskProgressMessage;
- public static String FilteredItemsSelectionDialog_subtaskProgressMessage;
+ // GranualProgressMonitor
+ public static String FilteredItemsSelectionDialog_taskProgressMessage;
+ public static String FilteredItemsSelectionDialog_subtaskProgressMessage;
- static {
+ static {
// load message values from bundle file
NLS.initializeMessages(BUNDLE_NAME, WorkbenchMessages.class);
}
+ // Content assist support
+ public static String ContentAssist_Cue_Description_Key;
- // Content assist support
- public static String ContentAssist_Cue_Description_Key;
-
- //Settings transfer
+ // Settings transfer
public static String WorkbenchLayoutSettings_Name;
public static String WorkbenchSettings_CouldNotCreateDirectories;
public static String WorkbenchSettings_CouldNotFindLocation;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java
index 4dbfad81e1f..6436f4574d7 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java
@@ -198,8 +198,8 @@ public class WorkbenchPage implements IWorkbenchPage {
private static final String ATT_AGGREGATE_WORKING_SET_ID = "aggregateWorkingSetId"; //$NON-NLS-1$
- private static final int WINDOW_SCOPE = EModelService.OUTSIDE_PERSPECTIVE
- | EModelService.IN_ANY_PERSPECTIVE | EModelService.IN_SHARED_AREA;
+ private static final int WINDOW_SCOPE = EModelService.OUTSIDE_PERSPECTIVE | EModelService.IN_ANY_PERSPECTIVE
+ | EModelService.IN_SHARED_AREA;
class E4PartListener implements org.eclipse.e4.ui.workbench.modeling.IPartListener {
@@ -264,11 +264,10 @@ public class WorkbenchPage implements IWorkbenchPage {
private List<String> mruShowInPartIds = new ArrayList<>();
/**
- * Deactivate the last editor's action bars if another type of editor has //
- * * been activated.
+ * Deactivate the last editor's action bars if another type of editor has // *
+ * been activated.
*
- * @param part
- * the part that is being activated
+ * @param part the part that is being activated
*/
private void deactivateLastEditor(MPart part) {
Object client = part.getObject();
@@ -401,8 +400,7 @@ public class WorkbenchPage implements IWorkbenchPage {
return ((CompatibilityPart) clientObject).getPart();
} else if (clientObject != null) {
if (part.getTransientData().get(E4PartWrapper.E4_WRAPPER_KEY) instanceof E4PartWrapper) {
- return (IWorkbenchPart) part.getTransientData().get(
- E4PartWrapper.E4_WRAPPER_KEY);
+ return (IWorkbenchPart) part.getTransientData().get(E4PartWrapper.E4_WRAPPER_KEY);
}
ViewReference viewReference = getViewReference(part);
@@ -423,11 +421,9 @@ public class WorkbenchPage implements IWorkbenchPage {
private void updateActiveEditorSources(MPart part) {
IEditorPart editor = getEditor(part);
- window.getContext().set(ISources.ACTIVE_EDITOR_ID_NAME,
- editor == null ? null : editor.getSite().getId());
+ window.getContext().set(ISources.ACTIVE_EDITOR_ID_NAME, editor == null ? null : editor.getSite().getId());
window.getContext().set(ISources.ACTIVE_EDITOR_NAME, editor);
- window.getContext().set(ISources.ACTIVE_EDITOR_INPUT_NAME,
- editor == null ? null : editor.getEditorInput());
+ window.getContext().set(ISources.ACTIVE_EDITOR_INPUT_NAME, editor == null ? null : editor.getEditorInput());
if (editor != null) {
navigationHistory.markEditor(editor);
@@ -551,28 +547,27 @@ public class WorkbenchPage implements IWorkbenchPage {
protected WorkbenchWindow legacyWindow;
- private IAdaptable input;
+ private IAdaptable input;
- private IWorkingSet workingSet;
+ private IWorkingSet workingSet;
- private AggregateWorkingSet aggregateWorkingSet;
+ private AggregateWorkingSet aggregateWorkingSet;
- private Composite composite;
+ private Composite composite;
private ListenerList<IPropertyChangeListener> propertyChangeListeners = new ListenerList<>();
- private IActionBars actionBars;
-
- private ActionSetManager actionSets;
+ private IActionBars actionBars;
- private NavigationHistory navigationHistory = new NavigationHistory(this);
+ private ActionSetManager actionSets;
+ private NavigationHistory navigationHistory = new NavigationHistory(this);
- /**
- * If we're in the process of activating a part, this points to the new part.
- * Otherwise, this is null.
- */
- private IWorkbenchPartReference partBeingActivated = null;
+ /**
+ * If we're in the process of activating a part, this points to the new part.
+ * Otherwise, this is null.
+ */
+ private IWorkbenchPartReference partBeingActivated = null;
private IWorkingSet[] workingSets = new IWorkingSet[0];
@@ -595,9 +590,9 @@ public class WorkbenchPage implements IWorkbenchPage {
private IExtensionTracker tracker;
- // Deferral count... delays disposing parts and sending certain events if nonzero
- private int deferCount = 0;
-
+ // Deferral count... delays disposing parts and sending certain events if
+ // nonzero
+ private int deferCount = 0;
private String aggregateWorkingSetId;
@@ -618,8 +613,7 @@ public class WorkbenchPage implements IWorkbenchPage {
/**
* Updates the contributions given the new part as the active part.
*
- * @param newPart
- * the new active part, may be <code>null</code>
+ * @param newPart the new active part, may be <code>null</code>
*/
public void updateActivePart(IWorkbenchPart newPart) {
if (activePart == newPart) {
@@ -703,8 +697,7 @@ public class WorkbenchPage implements IWorkbenchPage {
/**
* Updates the contributions given the new part as the topEditor.
*
- * @param newEditor
- * the new top editor, may be <code>null</code>
+ * @param newEditor the new top editor, may be <code>null</code>
*/
public void updateTopEditor(IEditorPart newEditor) {
if (topEditor == newEditor) {
@@ -749,15 +742,13 @@ public class WorkbenchPage implements IWorkbenchPage {
}
/**
- * Activates the contributions of the given part. If <code>enable</code>
- * is <code>true</code> the contributions are visible and enabled,
- * otherwise they are disabled.
+ * Activates the contributions of the given part. If <code>enable</code> is
+ * <code>true</code> the contributions are visible and enabled, otherwise they
+ * are disabled.
*
- * @param part
- * the part whose contributions are to be activated
- * @param enable
- * <code>true</code> the contributions are to be enabled, not
- * just visible.
+ * @param part the part whose contributions are to be activated
+ * @param enable <code>true</code> the contributions are to be enabled, not just
+ * visible.
*/
private void activateContributions(IWorkbenchPart part, boolean enable) {
PartSite site = (PartSite) part.getSite();
@@ -765,15 +756,12 @@ public class WorkbenchPage implements IWorkbenchPage {
}
/**
- * Deactivates the contributions of the given part. If
- * <code>remove</code> is <code>true</code> the contributions are
- * removed, otherwise they are disabled.
+ * Deactivates the contributions of the given part. If <code>remove</code> is
+ * <code>true</code> the contributions are removed, otherwise they are disabled.
*
- * @param part
- * the part whose contributions are to be deactivated
- * @param remove
- * <code>true</code> the contributions are to be removed, not
- * just disabled.
+ * @param part the part whose contributions are to be deactivated
+ * @param remove <code>true</code> the contributions are to be removed, not just
+ * disabled.
*/
private void deactivateContributions(IWorkbenchPart part, boolean remove) {
PartSite site = (PartSite) part.getSite();
@@ -785,26 +773,23 @@ public class WorkbenchPage implements IWorkbenchPage {
/**
* Calculates the action sets to show for the given part and editor
*
- * @param part
- * the active part, may be <code>null</code>
- * @param editor
- * the current editor, may be <code>null</code>, may be the
- * active part
+ * @param part the active part, may be <code>null</code>
+ * @param editor the current editor, may be <code>null</code>, may be the active
+ * part
* @return the new action sets
*/
- private List<IActionSetDescriptor> calculateActionSets(IWorkbenchPart part,
- IEditorPart editor) {
+ private List<IActionSetDescriptor> calculateActionSets(IWorkbenchPart part, IEditorPart editor) {
List<IActionSetDescriptor> newActionSets = new ArrayList<>();
if (part != null) {
- IActionSetDescriptor[] partActionSets = WorkbenchPlugin.getDefault()
- .getActionSetRegistry().getActionSetsFor(part.getSite().getId());
+ IActionSetDescriptor[] partActionSets = WorkbenchPlugin.getDefault().getActionSetRegistry()
+ .getActionSetsFor(part.getSite().getId());
for (IActionSetDescriptor partActionSetDescriptor : partActionSets) {
newActionSets.add(partActionSetDescriptor);
}
}
if (editor != null && editor != part) {
- IActionSetDescriptor[] editorActionSets = WorkbenchPlugin.getDefault()
- .getActionSetRegistry().getActionSetsFor(editor.getSite().getId());
+ IActionSetDescriptor[] editorActionSets = WorkbenchPlugin.getDefault().getActionSetRegistry()
+ .getActionSetsFor(editor.getSite().getId());
for (IActionSetDescriptor editorActionSetDescriptor : editorActionSets) {
newActionSets.add(editorActionSetDescriptor);
}
@@ -813,11 +798,9 @@ public class WorkbenchPage implements IWorkbenchPage {
}
/**
- * Updates the actions we are showing for the active part and current
- * editor.
+ * Updates the actions we are showing for the active part and current editor.
*
- * @param newActionSets
- * the action sets to show
+ * @param newActionSets the action sets to show
* @return <code>true</code> if the action sets changed
*/
private boolean updateActionSets(List<IActionSetDescriptor> newActionSets) {
@@ -825,8 +808,7 @@ public class WorkbenchPage implements IWorkbenchPage {
return false;
}
- IContextService service = legacyWindow
- .getService(IContextService.class);
+ IContextService service = legacyWindow.getService(IContextService.class);
try {
service.deferUpdates(true);
@@ -851,8 +833,7 @@ public class WorkbenchPage implements IWorkbenchPage {
}
legacyWindow.updateActionSets(); // this calls updateActionBars
- legacyWindow.firePerspectiveChanged(WorkbenchPage.this, getPerspective(),
- CHANGE_ACTION_SET_SHOW);
+ legacyWindow.firePerspectiveChanged(WorkbenchPage.this, getPerspective(), CHANGE_ACTION_SET_SHOW);
return true;
}
@@ -871,8 +852,8 @@ public class WorkbenchPage implements IWorkbenchPage {
private IEventBroker broker;
/**
- * An event handler that listens for an MArea's widget being set so that we
- * can install DND support into its control.
+ * An event handler that listens for an MArea's widget being set so that we can
+ * install DND support into its control.
*/
private EventHandler widgetHandler = event -> {
Object element = event.getProperty(UIEvents.EventTags.ELEMENT);
@@ -902,8 +883,7 @@ public class WorkbenchPage implements IWorkbenchPage {
@Inject
@Optional
- private void handleMinimizedStacks(
- @UIEventTopic(UIEvents.ApplicationElement.TOPIC_TAGS) Event event) {
+ private void handleMinimizedStacks(@UIEventTopic(UIEvents.ApplicationElement.TOPIC_TAGS) Event event) {
Object changedObj = event.getProperty(EventTags.ELEMENT);
if (!(changedObj instanceof MToolControl))
@@ -950,44 +930,42 @@ public class WorkbenchPage implements IWorkbenchPage {
}
/**
- * Boolean field to determine whether DND support has been added to the
- * shared area yet.
+ * Boolean field to determine whether DND support has been added to the shared
+ * area yet.
*
* @see #installAreaDropSupport(Control)
*/
private boolean dndSupportInstalled = false;
- /**
- * Constructs a page. <code>restoreState(IMemento)</code> should be
- * called to restore this page from data stored in a persistance file.
- *
- * @param w
- * the parent window
- * @param input
- * the page input
- * @throws WorkbenchException
- */
- public WorkbenchPage(WorkbenchWindow w, IAdaptable input)
- throws WorkbenchException {
- super();
- init(w, null, input, false);
- }
-
- /**
- * Allow access to the UI model that this page is managing
- * @return the MWindow element for this page
- */
- public MWindow getWindowModel() {
- return window;
-
- }
- /**
- * Activates a part. The part will be brought to the front and given focus.
- *
- * @param part
- * the part to activate
- */
- @Override
+ /**
+ * Constructs a page. <code>restoreState(IMemento)</code> should be called to
+ * restore this page from data stored in a persistance file.
+ *
+ * @param w the parent window
+ * @param input the page input
+ * @throws WorkbenchException
+ */
+ public WorkbenchPage(WorkbenchWindow w, IAdaptable input) throws WorkbenchException {
+ super();
+ init(w, null, input, false);
+ }
+
+ /**
+ * Allow access to the UI model that this page is managing
+ *
+ * @return the MWindow element for this page
+ */
+ public MWindow getWindowModel() {
+ return window;
+
+ }
+
+ /**
+ * Activates a part. The part will be brought to the front and given focus.
+ *
+ * @param part the part to activate
+ */
+ @Override
public void activate(IWorkbenchPart part) {
if (part == null || !certifyPart(part) || legacyWindow.isClosing()) {
return;
@@ -999,75 +977,72 @@ public class WorkbenchPage implements IWorkbenchPage {
}
}
- /**
+ /**
* Adds an IPartListener to the part service.
*/
- @Override
+ @Override
public void addPartListener(IPartListener l) {
partListenerList.add(l);
- }
+ }
/**
* Adds an IPartListener to the part service.
*/
- @Override
+ @Override
public void addPartListener(IPartListener2 l) {
partListener2List.add(l);
- }
-
- /**
- * Implements IWorkbenchPage
- *
- * @see org.eclipse.ui.IWorkbenchPage#addPropertyChangeListener(IPropertyChangeListener)
- * @since 2.0
- * @deprecated individual views should store a working set if needed and
- * register a property change listener directly with the
- * working set manager to receive notification when the view
- * working set is removed.
- */
- @Deprecated
+ }
+
+ /**
+ * Implements IWorkbenchPage
+ *
+ * @see org.eclipse.ui.IWorkbenchPage#addPropertyChangeListener(IPropertyChangeListener)
+ * @since 2.0
+ * @deprecated individual views should store a working set if needed and
+ * register a property change listener directly with the working set
+ * manager to receive notification when the view working set is
+ * removed.
+ */
+ @Deprecated
@Override
public void addPropertyChangeListener(IPropertyChangeListener listener) {
- propertyChangeListeners.add(listener);
- }
+ propertyChangeListeners.add(listener);
+ }
- @Override
+ @Override
public void addSelectionListener(ISelectionListener listener) {
selectionService.addSelectionListener(listener);
- }
+ }
- @Override
+ @Override
public void addSelectionListener(String partId, ISelectionListener listener) {
selectionService.addSelectionListener(partId, listener);
- }
+ }
- @Override
+ @Override
public void addPostSelectionListener(ISelectionListener listener) {
selectionService.addPostSelectionListener(listener);
- }
+ }
- @Override
- public void addPostSelectionListener(String partId,
- ISelectionListener listener) {
+ @Override
+ public void addPostSelectionListener(String partId, ISelectionListener listener) {
selectionService.addPostSelectionListener(partId, listener);
- }
-
- /**
- * Moves a part forward in the Z order of a perspective so it is visible.
- * If the part is in the same stack as the active part, the new part is
- * activated.
- *
- * @param part
- * the part to bring to move forward
- */
- @Override
+ }
+
+ /**
+ * Moves a part forward in the Z order of a perspective so it is visible. If the
+ * part is in the same stack as the active part, the new part is activated.
+ *
+ * @param part the part to bring to move forward
+ */
+ @Override
public void bringToTop(IWorkbenchPart part) {
- // Sanity check.
+ // Sanity check.
MPart mpart = findPart(part);
if (mpart != null) {
partService.bringToTop(mpart);
}
- }
+ }
public MPart findPart(IWorkbenchPart part) {
if (part == null) {
@@ -1088,13 +1063,11 @@ public class WorkbenchPage implements IWorkbenchPage {
return null;
}
- public EditorReference createEditorReferenceForPart(final MPart part, IEditorInput input,
- String editorId,
+ public EditorReference createEditorReferenceForPart(final MPart part, IEditorInput input, String editorId,
IMemento memento) {
IEditorRegistry registry = legacyWindow.getWorkbench().getEditorRegistry();
EditorDescriptor descriptor = (EditorDescriptor) registry.findEditor(editorId);
- final EditorReference ref = new EditorReference(window.getContext(), this, part, input,
- descriptor, memento);
+ final EditorReference ref = new EditorReference(window.getContext(), this, part, input, descriptor, memento);
addEditorReference(ref);
ref.subscribe();
return ref;
@@ -1141,8 +1114,8 @@ public class WorkbenchPage implements IWorkbenchPage {
MPerspective currentPerspective = getCurrentPerspective();
if (currentPerspective != null) {
int scope = allPerspectives ? WINDOW_SCOPE : EModelService.PRESENTATION;
- List<MPart> placeholders = modelService.findElements(window,
- CompatibilityEditor.MODEL_ELEMENT_ID, MPart.class, null, scope);
+ List<MPart> placeholders = modelService.findElements(window, CompatibilityEditor.MODEL_ELEMENT_ID,
+ MPart.class, null, scope);
List<EditorReference> visibleReferences = new ArrayList<>();
for (EditorReference reference : sortedReferences) {
for (MPart placeholder : placeholders) {
@@ -1216,24 +1189,21 @@ public class WorkbenchPage implements IWorkbenchPage {
}
/**
- * Searches the workbench window for a part with the given view id and
- * secondary id (if desired) given the specified search rules.
+ * Searches the workbench window for a part with the given view id and secondary
+ * id (if desired) given the specified search rules.
*
- * @param viewId
- * the id of the view
- * @param secondaryId
- * the secondary id of the view, or <code>null</code> if the view
- * to search for should be one without a secondary id defined
- * @param searchFlags
- * the desired search locations
+ * @param viewId the id of the view
+ * @param secondaryId the secondary id of the view, or <code>null</code> if the
+ * view to search for should be one without a secondary id
+ * defined
+ * @param searchFlags the desired search locations
* @return the part with the specified view id and secondary id, or
* <code>null</code> if it could not be found in this page's parent
* workbench window
* @see EModelService#findElements(MUIElement, String, Class, List, int)
*/
private MPart findPart(String viewId, int searchFlags) {
- List<MPart> parts = modelService.findElements(getWindowModel(), viewId, MPart.class, null,
- searchFlags);
+ List<MPart> parts = modelService.findElements(getWindowModel(), viewId, MPart.class, null, searchFlags);
if (parts.size() > 0)
return parts.get(0);
@@ -1271,8 +1241,7 @@ public class WorkbenchPage implements IWorkbenchPage {
if (part == null) {
MPlaceholder ph = partService.createSharedPart(viewId, false);
if (ph == null) {
- throw new PartInitException(NLS.bind(WorkbenchMessages.ViewFactory_couldNotCreate,
- viewId));
+ throw new PartInitException(NLS.bind(WorkbenchMessages.ViewFactory_couldNotCreate, viewId));
}
part = (MPart) ph.getRef();
@@ -1287,6 +1256,7 @@ public class WorkbenchPage implements IWorkbenchPage {
}
return (IViewPart) ref.getPart(true);
}
+
private MPart showPart(int mode, MPart part) {
switch (mode) {
case VIEW_ACTIVATE:
@@ -1307,8 +1277,8 @@ public class WorkbenchPage implements IWorkbenchPage {
} else {
part = ((PartServiceImpl) partService).addPart(part);
MPlaceholder activePlaceholder = activePart.getCurSharedRef();
- MUIElement activePartParent = activePlaceholder == null ? activePart
- .getParent() : activePlaceholder.getParent();
+ MUIElement activePartParent = activePlaceholder == null ? activePart.getParent()
+ : activePlaceholder.getParent();
partService.showPart(part, PartState.CREATE);
if (part.getCurSharedRef() == null || part.getCurSharedRef().getParent() != activePartParent) {
partService.bringToTop(part);
@@ -1339,53 +1309,53 @@ public class WorkbenchPage implements IWorkbenchPage {
return part;
}
- /**
- * Returns whether a part exists in the current page.
- */
- private boolean certifyPart(IWorkbenchPart part) {
- //Workaround for bug 22325
- if (part != null && !(part.getSite() instanceof PartSite)) {
+ /**
+ * Returns whether a part exists in the current page.
+ */
+ private boolean certifyPart(IWorkbenchPart part) {
+ // Workaround for bug 22325
+ if (part != null && !(part.getSite() instanceof PartSite)) {
return false;
}
return true;
- }
+ }
- /**
+ /**
* Closes this page.
- */
- @Override
+ */
+ @Override
public boolean close() {
- final boolean[] ret = new boolean[1];
+ final boolean[] ret = new boolean[1];
BusyIndicator.showWhile(null, () -> ret[0] = close(true, true));
- return ret[0];
- }
-
- public boolean closeAllSavedEditors() {
- // get the Saved editors
- IEditorReference editors[] = getEditorReferences();
- IEditorReference savedEditors[] = new IEditorReference[editors.length];
- int j = 0;
+ return ret[0];
+ }
+
+ public boolean closeAllSavedEditors() {
+ // get the Saved editors
+ IEditorReference editors[] = getEditorReferences();
+ IEditorReference savedEditors[] = new IEditorReference[editors.length];
+ int j = 0;
for (IEditorReference editor : editors) {
- if (!editor.isDirty()) {
- savedEditors[j++] = editor;
- }
- }
- //there are no unsaved editors
- if (j == 0) {
+ if (!editor.isDirty()) {
+ savedEditors[j++] = editor;
+ }
+ }
+ // there are no unsaved editors
+ if (j == 0) {
return true;
}
- IEditorReference[] newSaved = new IEditorReference[j];
- System.arraycopy(savedEditors, 0, newSaved, 0, j);
- return closeEditors(newSaved, false);
- }
+ IEditorReference[] newSaved = new IEditorReference[j];
+ System.arraycopy(savedEditors, 0, newSaved, 0, j);
+ return closeEditors(newSaved, false);
+ }
- /**
- * See IWorkbenchPage
- */
- @Override
+ /**
+ * See IWorkbenchPage
+ */
+ @Override
public boolean closeAllEditors(boolean save) {
- return closeEditors(getEditorReferences(), save);
- }
+ return closeEditors(getEditorReferences(), save);
+ }
/**
* See IWorkbenchPage
@@ -1394,7 +1364,7 @@ public class WorkbenchPage implements IWorkbenchPage {
public boolean closeEditors(IEditorReference[] refArray, boolean save) {
if (refArray.length == 0) {
return true;
- }
+ }
// Check if we're being asked to close any parts that are already closed
// or cannot
@@ -1411,10 +1381,8 @@ public class WorkbenchPage implements IWorkbenchPage {
// opened the dialog is usually
// at fault.
if (reference == partBeingActivated) {
- WorkbenchPlugin.log(new RuntimeException(
- "WARNING: Blocked recursive attempt to close part " //$NON-NLS-1$
- + partBeingActivated.getId()
- + " while still in the middle of activating it")); //$NON-NLS-1$
+ WorkbenchPlugin.log(new RuntimeException("WARNING: Blocked recursive attempt to close part " //$NON-NLS-1$
+ + partBeingActivated.getId() + " while still in the middle of activating it")); //$NON-NLS-1$
return false;
}
@@ -1426,11 +1394,11 @@ public class WorkbenchPage implements IWorkbenchPage {
// skip it and proceed with closing the remaining parts.
if (ref.isDisposed()) {
continue;
- }
- }
+ }
+ }
editorRefs.add(reference);
- }
+ }
// if active navigation position belongs to an editor being closed,
// update it
@@ -1444,7 +1412,7 @@ public class WorkbenchPage implements IWorkbenchPage {
continue;
if (navigationHistory.updateActive(oldPart))
break; // updated - skip the rest
- }
+ }
// notify the model manager before the close
List<IWorkbenchPart> partsToClose = new ArrayList<>();
@@ -1452,22 +1420,21 @@ public class WorkbenchPage implements IWorkbenchPage {
IEditorPart refPart = ref.getEditor(false);
if (refPart != null) {
partsToClose.add(refPart);
- }
- }
+ }
+ }
boolean confirm = true;
SaveablesList modelManager = null;
Object postCloseInfo = null;
if (partsToClose.size() > 0) {
- modelManager = (SaveablesList) getWorkbenchWindow().getService(
- ISaveablesLifecycleListener.class);
+ modelManager = (SaveablesList) getWorkbenchWindow().getService(ISaveablesLifecycleListener.class);
// this may prompt for saving and return null if the user canceled:
postCloseInfo = modelManager.preCloseParts(partsToClose, save, getWorkbenchWindow());
if (postCloseInfo == null) {
return false;
}
confirm = false;
- }
+ }
// Fire pre-removal changes
for (IEditorReference ref : editorRefs) {
@@ -1476,7 +1443,7 @@ public class WorkbenchPage implements IWorkbenchPage {
}
- deferUpdates(true);
+ deferUpdates(true);
try {
if (modelManager != null) {
modelManager.postClose(postCloseInfo);
@@ -1516,14 +1483,14 @@ public class WorkbenchPage implements IWorkbenchPage {
}
} finally {
deferUpdates(false);
- }
+ }
// Notify interested listeners after the close
legacyWindow.firePerspectiveChanged(this, getPerspective(), CHANGE_EDITOR_CLOSE);
- // Return true on success.
+ // Return true on success.
return true;
- }
+ }
public boolean closeEditor(IEditorReference editor) {
if (getInternalEditorReferences().contains(editor)) {
@@ -1595,63 +1562,59 @@ public class WorkbenchPage implements IWorkbenchPage {
return false;
}
- /**
- * Enables or disables listener notifications. This is used to delay listener notifications until the
- * end of a public method.
- *
- * @param shouldDefer
- */
- private void deferUpdates(boolean shouldDefer) {
- if (shouldDefer) {
- if (deferCount == 0) {
- startDeferring();
- }
- deferCount++;
- } else {
- deferCount--;
- if (deferCount == 0) {
- handleDeferredEvents();
- }
- }
- }
-
- private void startDeferring() {
+ /**
+ * Enables or disables listener notifications. This is used to delay listener
+ * notifications until the end of a public method.
+ *
+ * @param shouldDefer
+ */
+ private void deferUpdates(boolean shouldDefer) {
+ if (shouldDefer) {
+ if (deferCount == 0) {
+ startDeferring();
+ }
+ deferCount++;
+ } else {
+ deferCount--;
+ if (deferCount == 0) {
+ handleDeferredEvents();
+ }
+ }
+ }
+
+ private void startDeferring() {
// TODO compat: do we defer events
- }
+ }
- private void handleDeferredEvents() {
+ private void handleDeferredEvents() {
// TODO compat: do we handler defered events
- }
+ }
- public boolean closeEditor(IEditorReference editorRef, boolean save) {
- return closeEditors(new IEditorReference[] {editorRef}, save);
- }
+ public boolean closeEditor(IEditorReference editorRef, boolean save) {
+ return closeEditors(new IEditorReference[] { editorRef }, save);
+ }
- /**
- * See IWorkbenchPage#closeEditor
- */
- @Override
+ /**
+ * See IWorkbenchPage#closeEditor
+ */
+ @Override
public boolean closeEditor(IEditorPart editor, boolean save) {
- IWorkbenchPartReference ref = getReference(editor);
- if (ref instanceof IEditorReference) {
- return closeEditors(new IEditorReference[] {(IEditorReference) ref}, save);
- }
- return false;
- }
+ IWorkbenchPartReference ref = getReference(editor);
+ if (ref instanceof IEditorReference) {
+ return closeEditors(new IEditorReference[] { (IEditorReference) ref }, save);
+ }
+ return false;
+ }
/**
* Closes the specified perspective.
*
- * @param desc
- * the perspective to close
- * @param perspectiveId
- * the id of the perspective being closed
- * @param saveParts
- * <code>true</code> if dirty parts should be prompted for its
- * contents to be saved, <code>false</code> otherwise
+ * @param desc the perspective to close
+ * @param perspectiveId the id of the perspective being closed
+ * @param saveParts <code>true</code> if dirty parts should be prompted for
+ * its contents to be saved, <code>false</code> otherwise
*/
- private void closePerspective(IPerspectiveDescriptor desc, String perspectiveId,
- boolean saveParts) {
+ private void closePerspective(IPerspectiveDescriptor desc, String perspectiveId, boolean saveParts) {
MPerspective persp = (MPerspective) modelService.find(perspectiveId, window);
// check to ensure this perspective actually exists in this window
if (persp != null) {
@@ -1706,11 +1669,9 @@ public class WorkbenchPage implements IWorkbenchPage {
// Remove from caches
sortedPerspectives.remove(desc);
// check if we're closing the currently active perspective
- if (getPerspectiveStack().getSelectedElement() == persp
- && !sortedPerspectives.isEmpty()) {
+ if (getPerspectiveStack().getSelectedElement() == persp && !sortedPerspectives.isEmpty()) {
// get the perspective that was last active and set it
- IPerspectiveDescriptor lastActive = sortedPerspectives.get(sortedPerspectives
- .size() - 1);
+ IPerspectiveDescriptor lastActive = sortedPerspectives.get(sortedPerspectives.size() - 1);
if (lastActive != null) {
setPerspective(lastActive);
}
@@ -1727,8 +1688,8 @@ public class WorkbenchPage implements IWorkbenchPage {
closePerspective(desc, desc.getId(), saveParts, closePage);
}
- public void closePerspective(IPerspectiveDescriptor desc, String perspectiveId,
- boolean saveParts, boolean closePage) {
+ public void closePerspective(IPerspectiveDescriptor desc, String perspectiveId, boolean saveParts,
+ boolean closePage) {
MPerspective persp = (MPerspective) modelService.find(perspectiveId, window);
// check to ensure this perspective actually exists in this window
if (persp != null) {
@@ -1755,14 +1716,11 @@ public class WorkbenchPage implements IWorkbenchPage {
MPerspective curPersp = _perspectiveStack.getSelectedElement();
for (MPerspective persp : kids) {
if (persp != curPersp) {
- closePerspective(getPerspectiveDesc(persp.getElementId()),
- persp.getElementId(), false);
+ closePerspective(getPerspectiveDesc(persp.getElementId()), persp.getElementId(), false);
}
}
if (curPersp != null) {
- closePerspective(getPerspectiveDesc(curPersp.getElementId()),
- curPersp.getElementId(),
- false);
+ closePerspective(getPerspectiveDesc(curPersp.getElementId()), curPersp.getElementId(), false);
}
if (closePage) {
close();
@@ -1873,11 +1831,9 @@ public class WorkbenchPage implements IWorkbenchPage {
*/
public void unzoomAllPerspectives() {
// TODO compat: we have no min/max behaviour
- }
-
-
+ }
- /**
+ /**
* Cleanup.
*/
public void dispose() {
@@ -1933,7 +1889,8 @@ public class WorkbenchPage implements IWorkbenchPage {
// public void run() {
// // WorkbenchPlugin.log(new Status(IStatus.WARNING,
// WorkbenchPlugin.PI_WORKBENCH,
- //// Status.OK, "WorkbenchPage leaked a refcount for view " + ref.getId(), null)); //$NON-NLS-1$//$NON-NLS-2$
+ //// Status.OK, "WorkbenchPage leaked a refcount for view " + ref.getId(),
+ // null)); //$NON-NLS-1$//$NON-NLS-2$
//
// ref.dispose();
// }
@@ -1968,27 +1925,24 @@ public class WorkbenchPage implements IWorkbenchPage {
// PlatformUI.getWorkbench().getWorkingSetManager().removeWorkingSet(aggregateWorkingSet);
// }
// }
- }
-
-
+ }
- /**
- * @return NavigationHistory
- */
- @Override
+ /**
+ * @return NavigationHistory
+ */
+ @Override
public INavigationHistory getNavigationHistory() {
- return navigationHistory;
- }
+ return navigationHistory;
+ }
- public boolean editActionSets() {
+ public boolean editActionSets() {
Perspective persp = getActivePerspective();
if (persp == null) {
return false;
}
// Create list dialog.
- CustomizePerspectiveDialog dlg = legacyWindow.createCustomizePerspectiveDialog(persp,
- window.getContext());
+ CustomizePerspectiveDialog dlg = legacyWindow.createCustomizePerspectiveDialog(persp, window.getContext());
// Open.
boolean ret = (dlg.open() == Window.OK);
if (ret) {
@@ -1997,22 +1951,21 @@ public class WorkbenchPage implements IWorkbenchPage {
legacyWindow.firePerspectiveChanged(this, getPerspective(), CHANGE_RESET_COMPLETE);
}
return ret;
- }
-
+ }
- /**
- * See IWorkbenchPage@findView.
- */
- @Override
+ /**
+ * See IWorkbenchPage@findView.
+ */
+ @Override
public IViewPart findView(String id) {
- IViewReference ref = findViewReference(id);
- if (ref == null) {
+ IViewReference ref = findViewReference(id);
+ if (ref == null) {
return null;
}
- return ref.getView(true);
- }
+ return ref.getView(true);
+ }
- @Override
+ @Override
public IViewReference findViewReference(String viewId) {
for (IViewReference reference : getViewReferences()) {
ViewReference ref = (ViewReference) reference;
@@ -2021,15 +1974,15 @@ public class WorkbenchPage implements IWorkbenchPage {
}
}
return null;
- }
+ }
- @Override
+ @Override
public IViewReference findViewReference(String viewId, String secondaryId) {
String compoundId = viewId;
if (secondaryId != null && secondaryId.length() > 0)
compoundId += ":" + secondaryId; //$NON-NLS-1$
return findViewReference(compoundId);
- }
+ }
public void createViewReferenceForPart(final MPart part, String viewId) {
// If the id contains a ':' use the part before it as the descriptor id
@@ -2037,8 +1990,7 @@ public class WorkbenchPage implements IWorkbenchPage {
String descId = colonIndex == -1 ? viewId : viewId.substring(0, colonIndex);
IViewDescriptor desc = getWorkbenchWindow().getWorkbench().getViewRegistry().find(descId);
- final ViewReference ref = new ViewReference(window.getContext(), this, part,
- (ViewDescriptor) desc);
+ final ViewReference ref = new ViewReference(window.getContext(), this, part, (ViewDescriptor) desc);
if (contains(ref)) {
return;
}
@@ -2052,38 +2004,33 @@ public class WorkbenchPage implements IWorkbenchPage {
addViewReference(ref);
}
- /**
- * Notify property change listeners about a property change.
- *
- * @param changeId
- * the change id
- * @param oldValue
- * old property value
- * @param newValue
- * new property value
- */
- private void firePropertyChange(String changeId, Object oldValue,
- Object newValue) {
+ /**
+ * Notify property change listeners about a property change.
+ *
+ * @param changeId the change id
+ * @param oldValue old property value
+ * @param newValue new property value
+ */
+ private void firePropertyChange(String changeId, Object oldValue, Object newValue) {
- UIListenerLogging.logPagePropertyChanged(this, changeId, oldValue, newValue);
+ UIListenerLogging.logPagePropertyChanged(this, changeId, oldValue, newValue);
- PropertyChangeEvent event = new PropertyChangeEvent(this, changeId,
- oldValue, newValue);
+ PropertyChangeEvent event = new PropertyChangeEvent(this, changeId, oldValue, newValue);
for (IPropertyChangeListener listener : propertyChangeListeners) {
listener.propertyChange(event);
- }
- }
-
- /*
- * Returns the action bars.
- */
- public IActionBars getActionBars() {
- if (actionBars == null) {
+ }
+ }
+
+ /*
+ * Returns the action bars.
+ */
+ public IActionBars getActionBars() {
+ if (actionBars == null) {
actionBars = new WWinActionBars(legacyWindow);
}
- return actionBars;
- }
+ return actionBars;
+ }
/**
* Returns an array of the visible action sets.
@@ -2095,10 +2042,10 @@ public class WorkbenchPage implements IWorkbenchPage {
return collection.toArray(new IActionSetDescriptor[collection.size()]);
}
- /**
- * @see IWorkbenchPage
- */
- @Override
+ /**
+ * @see IWorkbenchPage
+ */
+ @Override
public IEditorPart getActiveEditor() {
IWorkbenchPart activePart = getActivePart();
if (activePart instanceof IEditorPart) {
@@ -2137,8 +2084,8 @@ public class WorkbenchPage implements IWorkbenchPage {
return null;
}
- List<MPart> parts = modelService.findElements(perspective,
- CompatibilityEditor.MODEL_ELEMENT_ID, MPart.class, null);
+ List<MPart> parts = modelService.findElements(perspective, CompatibilityEditor.MODEL_ELEMENT_ID, MPart.class,
+ null);
for (MPart part : parts) {
Object object = part.getObject();
if (object instanceof CompatibilityEditor) {
@@ -2156,12 +2103,12 @@ public class WorkbenchPage implements IWorkbenchPage {
/**
* Searches and returns an editor from the activation list that is being
- * displayed in the current presentation. If an editor is in the
- * presentation but is behind another part it will not be returned.
+ * displayed in the current presentation. If an editor is in the presentation
+ * but is behind another part it will not be returned.
*
* @return an editor that is being shown in the current presentation and was
- * previously activated, editors that are behind another part in a
- * stack will not be returned
+ * previously activated, editors that are behind another part in a stack
+ * will not be returned
*/
private IEditorPart findActiveEditor() {
List<MPart> candidates = new ArrayList<>(activationList);
@@ -2171,8 +2118,7 @@ public class WorkbenchPage implements IWorkbenchPage {
}
if (area != null && area.isVisible() && area.isToBeRendered()) {
// we have a shared area, try iterating over its editors first
- List<MPart> editors = modelService
- .findElements(area, CompatibilityEditor.MODEL_ELEMENT_ID, MPart.class);
+ List<MPart> editors = modelService.findElements(area, CompatibilityEditor.MODEL_ELEMENT_ID, MPart.class);
for (Iterator<MPart> it = candidates.iterator(); it.hasNext();) {
MPart model = it.next();
if (!editors.contains(model)) {
@@ -2205,7 +2151,7 @@ public class WorkbenchPage implements IWorkbenchPage {
}
}
return null;
- }
+ }
private boolean isInArea(MUIElement area, MUIElement element) {
if (!element.isToBeRendered() || !element.isVisible()) {
@@ -2254,7 +2200,7 @@ public class WorkbenchPage implements IWorkbenchPage {
return isValid(ancestor, parent);
}
- @Override
+ @Override
public IWorkbenchPart getActivePart() {
if (partService == null) {
return null;
@@ -2311,8 +2257,7 @@ public class WorkbenchPage implements IWorkbenchPage {
}
return editorRefs.toArray(new IEditorReference[editorRefs.size()]);
default:
- if ((matchFlags & IWorkbenchPage.MATCH_ID) != 0
- && (matchFlags & IWorkbenchPage.MATCH_INPUT) != 0) {
+ if ((matchFlags & IWorkbenchPage.MATCH_ID) != 0 && (matchFlags & IWorkbenchPage.MATCH_INPUT) != 0) {
editorRefs = new ArrayList<>();
for (EditorReference editorRef : filteredReferences) {
if (editorRef.getId().equals(editorId)) {
@@ -2325,8 +2270,7 @@ public class WorkbenchPage implements IWorkbenchPage {
}
}
- private void checkEditor(IEditorInput input, List<IEditorReference> editorRefs,
- EditorReference editorRef) {
+ private void checkEditor(IEditorInput input, List<IEditorReference> editorRefs, EditorReference editorRef) {
EditorDescriptor descriptor = editorRef.getDescriptor();
if (descriptor != null) {
IEditorMatchingStrategy strategy = descriptor.getEditorMatchingStrategy();
@@ -2346,8 +2290,7 @@ public class WorkbenchPage implements IWorkbenchPage {
}
String id = persistable.getFactoryId();
- if (id != null && id.equals(editorRef.getFactoryId())
- && name.equals(editorRef.getName())
+ if (id != null && id.equals(editorRef.getFactoryId()) && name.equals(editorRef.getName())
&& input.equals(editorRef.getEditorInput())) {
editorRefs.add(editorRef);
}
@@ -2388,20 +2331,15 @@ public class WorkbenchPage implements IWorkbenchPage {
}
/**
- * Returns a sorted array of references to editors and/or views from this
- * page.
+ * Returns a sorted array of references to editors and/or views from this page.
*
- * @param editors
- * include editors
- * @param views
- * include views
- * @param allPerspectives
- * if {@code false}, does not include parts from inactive
- * perspectives
+ * @param editors include editors
+ * @param views include views
+ * @param allPerspectives if {@code false}, does not include parts from inactive
+ * perspectives
* @return a sorted array of references to editors and/or views
*/
- private IWorkbenchPartReference[] getSortedParts(boolean editors, boolean views,
- boolean allPerspectives) {
+ private IWorkbenchPartReference[] getSortedParts(boolean editors, boolean views, boolean allPerspectives) {
if (!editors && !views) {
return new IWorkbenchPartReference[0];
}
@@ -2449,23 +2387,23 @@ public class WorkbenchPage implements IWorkbenchPage {
return sortedReferences.toArray(new IWorkbenchPartReference[sortedReferences.size()]);
}
- /**
- * @see IWorkbenchPage
- */
- @Override
+ /**
+ * @see IWorkbenchPage
+ */
+ @Override
public IAdaptable getInput() {
- return input;
- }
-
- /**
- * Returns the page label. This is a combination of the page input and
- * active perspective.
- */
- @Override
+ return input;
+ }
+
+ /**
+ * Returns the page label. This is a combination of the page input and active
+ * perspective.
+ */
+ @Override
public String getLabel() {
- String label = WorkbenchMessages.WorkbenchPage_UnknownLabel;
- IWorkbenchAdapter adapter = Adapters.adapt(input, IWorkbenchAdapter.class);
- if (adapter != null) {
+ String label = WorkbenchMessages.WorkbenchPage_UnknownLabel;
+ IWorkbenchAdapter adapter = Adapters.adapt(input, IWorkbenchAdapter.class);
+ if (adapter != null) {
label = adapter.getLabel(input);
}
// Perspective persp = getActivePerspective();
@@ -2477,13 +2415,13 @@ public class WorkbenchPage implements IWorkbenchPage {
// NLS.bind(WorkbenchMessages.WorkbenchPage_PerspectiveFormat,label,
// deferredActivePersp.getLabel());
// }
- return label;
- }
+ return label;
+ }
- /**
- * Returns the perspective.
- */
- @Override
+ /**
+ * Returns the perspective.
+ */
+ @Override
public IPerspectiveDescriptor getPerspective() {
MPerspectiveStack ps = getPerspectiveStack();
MPerspective curPersp = ps.getSelectedElement();
@@ -2498,40 +2436,37 @@ public class WorkbenchPage implements IWorkbenchPage {
if (perspectiveRegistry == null) {
return null;
}
- IPerspectiveDescriptor desc = perspectiveRegistry
- .findPerspectiveWithId(id);
+ IPerspectiveDescriptor desc = perspectiveRegistry.findPerspectiveWithId(id);
return desc;
}
- @Override
+ @Override
public ISelection getSelection() {
return selectionService.getSelection();
- }
+ }
- @Override
+ @Override
public ISelection getSelection(String partId) {
return selectionService.getSelection(partId);
- }
+ }
/**
- * Returns the ids of the parts to list in the Show In... prompter. This is
- * a List of Strings.
+ * Returns the ids of the parts to list in the Show In... prompter. This is a
+ * List of Strings.
*
* @return the ids of the parts that should be available in the 'Show In...'
* prompt
*/
public ArrayList<?> getShowInPartIds() {
MPerspective perspective = getPerspectiveStack().getSelectedElement();
- return new ArrayList<>(ModeledPageLayout.getIds(perspective,
- ModeledPageLayout.SHOW_IN_PART_TAG));
+ return new ArrayList<>(ModeledPageLayout.getIds(perspective, ModeledPageLayout.SHOW_IN_PART_TAG));
}
/**
- * The user successfully performed a Show In... action on the specified
- * part. Update the list of Show In items accordingly.
+ * The user successfully performed a Show In... action on the specified part.
+ * Update the list of Show In items accordingly.
*
- * @param partId
- * the id of the part that the action was performed on
+ * @param partId the id of the part that the action was performed on
*/
public void performedShowIn(String partId) {
mruShowInPartIds.remove(partId);
@@ -2541,8 +2476,7 @@ public class WorkbenchPage implements IWorkbenchPage {
/**
* Sorts the given collection of show in target part ids in MRU order.
*
- * @param partIds
- * the collection of part ids to rearrange
+ * @param partIds the collection of part ids to rearrange
*/
public void sortShowInPartIds(ArrayList<?> partIds) {
Collections.sort(partIds, (ob1, ob2) -> {
@@ -2556,10 +2490,10 @@ public class WorkbenchPage implements IWorkbenchPage {
});
}
- /**
- * See IWorkbenchPage.
- */
- @Override
+ /**
+ * See IWorkbenchPage.
+ */
+ @Override
public IViewReference[] getViewReferences() {
return getViewReferences(false);
}
@@ -2614,7 +2548,7 @@ public class WorkbenchPage implements IWorkbenchPage {
/**
* See IWorkbenchPage.
*/
- @Override
+ @Override
public IViewPart[] getViews() {
IViewReference[] viewReferences = getViewReferences();
int length = viewReferences.length;
@@ -2625,33 +2559,31 @@ public class WorkbenchPage implements IWorkbenchPage {
return views;
}
-
-
- /**
+ /**
* See IWorkbenchPage.
*/
- @Override
+ @Override
public IWorkbenchWindow getWorkbenchWindow() {
return legacyWindow;
- }
-
- /**
- * Implements IWorkbenchPage
- *
- * @see org.eclipse.ui.IWorkbenchPage#getWorkingSet()
- * @since 2.0
- * @deprecated individual views should store a working set if needed
- */
- @Deprecated
+ }
+
+ /**
+ * Implements IWorkbenchPage
+ *
+ * @see org.eclipse.ui.IWorkbenchPage#getWorkingSet()
+ * @since 2.0
+ * @deprecated individual views should store a working set if needed
+ */
+ @Deprecated
@Override
public IWorkingSet getWorkingSet() {
- return workingSet;
- }
+ return workingSet;
+ }
- /**
- * @see IWorkbenchPage
- */
- @Override
+ /**
+ * @see IWorkbenchPage
+ */
+ @Override
public void hideActionSet(String actionSetID) {
MPerspective mpersp = getCurrentPerspective();
if (mpersp == null)
@@ -2670,17 +2602,17 @@ public class WorkbenchPage implements IWorkbenchPage {
}
String tag = ModeledPageLayout.ACTION_SET_TAG + actionSetID;
addHiddenItems(tag);
- }
+ }
@Override
public void hideView(IViewReference view) {
- if (view != null) {
- for (IViewReference reference : getViewReferences()) {
- if (reference == view) {
+ if (view != null) {
+ for (IViewReference reference : getViewReferences()) {
+ if (reference == view) {
hidePart(((ViewReference) view).getModel(), true, true, false);
break;
- }
- }
+ }
+ }
}
}
@@ -2694,23 +2626,19 @@ public class WorkbenchPage implements IWorkbenchPage {
}
}
- /**
- * Initialize the page.
- *
- * @param w
- * the parent window
- * @param layoutID
- * may be <code>null</code> if restoring from file
- * @param input
- * the page input
- * @param openExtras
- * whether to process the perspective extras preference
- */
+ /**
+ * Initialize the page.
+ *
+ * @param w the parent window
+ * @param layoutID may be <code>null</code> if restoring from file
+ * @param input the page input
+ * @param openExtras whether to process the perspective extras preference
+ */
private void init(WorkbenchWindow w, String layoutID, IAdaptable input, boolean openExtras) {
// Save args.
this.legacyWindow = w;
- this.input = input;
- actionSets = new ActionSetManager(w);
+ this.input = input;
+ actionSets = new ActionSetManager(w);
initActionSetListener();
initMaxFileSize();
}
@@ -2722,8 +2650,8 @@ public class WorkbenchPage implements IWorkbenchPage {
}
@PostConstruct
- public void setup(MApplication application, EModelService modelService, IEventBroker broker,
- MWindow window, EPartService partService) {
+ public void setup(MApplication application, EModelService modelService, IEventBroker broker, MWindow window,
+ EPartService partService) {
this.application = application;
this.modelService = modelService;
this.broker = broker;
@@ -2734,18 +2662,15 @@ public class WorkbenchPage implements IWorkbenchPage {
partService.addPartListener(e4PartListener);
// create editor references for all editors
- List<MPart> editors = modelService.findElements(window,
- CompatibilityEditor.MODEL_ELEMENT_ID, MPart.class, null,
- EModelService.IN_ANY_PERSPECTIVE | EModelService.OUTSIDE_PERSPECTIVE
- | EModelService.IN_SHARED_AREA);
+ List<MPart> editors = modelService.findElements(window, CompatibilityEditor.MODEL_ELEMENT_ID, MPart.class, null,
+ EModelService.IN_ANY_PERSPECTIVE | EModelService.OUTSIDE_PERSPECTIVE | EModelService.IN_SHARED_AREA);
for (MPart editor : editors) {
createEditorReferenceForPart(editor, null, editor.getElementId(), null);
}
// create view references for rendered view placeholders
- List<MPlaceholder> placeholders = modelService.findElements(window, null,
- MPlaceholder.class, null, EModelService.IN_ANY_PERSPECTIVE
- | EModelService.OUTSIDE_PERSPECTIVE);
+ List<MPlaceholder> placeholders = modelService.findElements(window, null, MPlaceholder.class, null,
+ EModelService.IN_ANY_PERSPECTIVE | EModelService.OUTSIDE_PERSPECTIVE);
for (MPlaceholder placeholder : placeholders) {
if (placeholder.isToBeRendered()) {
MUIElement ref = placeholder.getRef();
@@ -2773,11 +2698,9 @@ public class WorkbenchPage implements IWorkbenchPage {
extendPerspectives(perspectiveStack);
}
- IPerspectiveRegistry registry = getWorkbenchWindow().getWorkbench()
- .getPerspectiveRegistry();
+ IPerspectiveRegistry registry = getWorkbenchWindow().getWorkbench().getPerspectiveRegistry();
for (MPerspective perspective : perspectiveStack.getChildren()) {
- IPerspectiveDescriptor desc = registry
- .findPerspectiveWithId(perspective.getElementId());
+ IPerspectiveDescriptor desc = registry.findPerspectiveWithId(perspective.getElementId());
if (desc != null) {
sortedPerspectives.add(desc);
}
@@ -2785,8 +2708,7 @@ public class WorkbenchPage implements IWorkbenchPage {
MPerspective selectedPerspective = perspectiveStack.getSelectedElement();
if (selectedPerspective != null) {
- IPerspectiveDescriptor desc = registry.findPerspectiveWithId(selectedPerspective
- .getElementId());
+ IPerspectiveDescriptor desc = registry.findPerspectiveWithId(selectedPerspective.getElementId());
if (desc != null) {
sortedPerspectives.remove(desc);
sortedPerspectives.add(desc);
@@ -2795,12 +2717,12 @@ public class WorkbenchPage implements IWorkbenchPage {
restoreWorkingSets();
restoreShowInMruPartIdsList();
configureExistingWindows();
- }
+ }
/*
- * Perform any configuration required for an existing MWindow. The
- * association of an MWindow to the WorkbenchWindow/WorkbenchPage can occur
- * at different times (see Bug 454056 for details).
+ * Perform any configuration required for an existing MWindow. The association
+ * of an MWindow to the WorkbenchWindow/WorkbenchPage can occur at different
+ * times (see Bug 454056 for details).
*/
private void configureExistingWindows() {
List<MArea> elements = modelService.findElements(window, null, MArea.class);
@@ -2813,22 +2735,19 @@ public class WorkbenchPage implements IWorkbenchPage {
}
public void restoreWorkingSets() {
- String workingSetName = getWindowModel().getPersistedState().get(
- IWorkbenchConstants.TAG_WORKING_SET);
+ String workingSetName = getWindowModel().getPersistedState().get(IWorkbenchConstants.TAG_WORKING_SET);
if (workingSetName != null) {
AbstractWorkingSetManager workingSetManager = (AbstractWorkingSetManager) getWorkbenchWindow()
.getWorkbench().getWorkingSetManager();
setWorkingSet(workingSetManager.getWorkingSet(workingSetName));
}
- String workingSetMemString = getWindowModel().getPersistedState().get(
- IWorkbenchConstants.TAG_WORKING_SETS);
+ String workingSetMemString = getWindowModel().getPersistedState().get(IWorkbenchConstants.TAG_WORKING_SETS);
if (workingSetMemString != null) {
IMemento workingSetMem;
try {
workingSetMem = XMLMemento.createReadRoot(new StringReader(workingSetMemString));
- IMemento[] workingSetChildren = workingSetMem
- .getChildren(IWorkbenchConstants.TAG_WORKING_SET);
+ IMemento[] workingSetChildren = workingSetMem.getChildren(IWorkbenchConstants.TAG_WORKING_SET);
List<IWorkingSet> workingSetList = new ArrayList<>(workingSetChildren.length);
for (IMemento memento : workingSetChildren) {
IWorkingSet set = getWorkbenchWindow().getWorkbench().getWorkingSetManager()
@@ -2840,14 +2759,12 @@ public class WorkbenchPage implements IWorkbenchPage {
workingSets = workingSetList.toArray(new IWorkingSet[workingSetList.size()]);
} catch (WorkbenchException e) {
- StatusManager.getManager().handle(
- new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.ERROR,
- WorkbenchMessages.WorkbenchPage_problemRestoringTitle, e));
+ StatusManager.getManager().handle(new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.ERROR,
+ WorkbenchMessages.WorkbenchPage_problemRestoringTitle, e));
}
}
- aggregateWorkingSetId = getWindowModel().getPersistedState().get(
- ATT_AGGREGATE_WORKING_SET_ID);
+ aggregateWorkingSetId = getWindowModel().getPersistedState().get(ATT_AGGREGATE_WORKING_SET_ID);
}
private void restoreShowInMruPartIdsList() {
@@ -2860,9 +2777,8 @@ public class WorkbenchPage implements IWorkbenchPage {
mruShowInPartIds.add(child.getID());
}
} catch (WorkbenchException e) {
- StatusManager.getManager().handle(
- new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.ERROR,
- WorkbenchMessages.WorkbenchPage_problemRestoringTitle, e));
+ StatusManager.getManager().handle(new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.ERROR,
+ WorkbenchMessages.WorkbenchPage_problemRestoringTitle, e));
}
}
}
@@ -2871,8 +2787,7 @@ public class WorkbenchPage implements IWorkbenchPage {
public void saveWorkingSets() {
// Save working set if set
if (workingSet != null) {
- getWindowModel().getPersistedState().put(IWorkbenchConstants.TAG_WORKING_SET,
- workingSet.getName());
+ getWindowModel().getPersistedState().put(IWorkbenchConstants.TAG_WORKING_SET, workingSet.getName());
} else {
getWindowModel().getPersistedState().remove(IWorkbenchConstants.TAG_WORKING_SET);
}
@@ -2883,8 +2798,7 @@ public class WorkbenchPage implements IWorkbenchPage {
}
saveMemento(IWorkbenchConstants.TAG_WORKING_SETS, IWorkbenchConstants.TAG_WORKING_SET, workingSetNames);
- getWindowModel().getPersistedState().put(ATT_AGGREGATE_WORKING_SET_ID,
- aggregateWorkingSetId);
+ getWindowModel().getPersistedState().put(ATT_AGGREGATE_WORKING_SET_ID, aggregateWorkingSetId);
}
@PreDestroy
@@ -2909,22 +2823,21 @@ public class WorkbenchPage implements IWorkbenchPage {
}
/**
- * Extends the perspectives within the given stack with action set
- * contributions from the <code>perspectiveExtensions</code> extension
- * point.
+ * Extends the perspectives within the given stack with action set contributions
+ * from the <code>perspectiveExtensions</code> extension point.
*
- * @param perspectiveStack
- * the stack that contain the perspectives to be extended
+ * @param perspectiveStack the stack that contain the perspectives to be
+ * extended
*/
private void extendPerspectives(MPerspectiveStack perspectiveStack) {
for (MPerspective perspective : perspectiveStack.getChildren()) {
String id = perspective.getElementId();
- IPerspectiveDescriptor desc = getWorkbenchWindow().getWorkbench()
- .getPerspectiveRegistry().findPerspectiveWithId(id);
+ IPerspectiveDescriptor desc = getWorkbenchWindow().getWorkbench().getPerspectiveRegistry()
+ .findPerspectiveWithId(id);
if (desc != null) {
MPerspective temporary = modelService.createModelElement(MPerspective.class);
- ModeledPageLayout modelLayout = new ModeledPageLayout(window, modelService,
- partService, temporary, desc, this, true);
+ ModeledPageLayout modelLayout = new ModeledPageLayout(window, modelService, partService, temporary,
+ desc, this, true);
PerspectiveExtensionReader reader = new PerspectiveExtensionReader();
reader.setIncludeOnlyTags(new String[] { IWorkbenchRegistryConstants.TAG_ACTION_SET });
@@ -2940,8 +2853,8 @@ public class WorkbenchPage implements IWorkbenchPage {
.findPerspectiveWithId(id);
if (desc != null) {
MPerspective temporary = modelService.createModelElement(MPerspective.class);
- ModeledPageLayout modelLayout = new ModeledPageLayout(window, modelService,
- partService, temporary, desc, this, true);
+ ModeledPageLayout modelLayout = new ModeledPageLayout(window, modelService, partService, temporary, desc,
+ this, true);
PerspectiveExtensionReader reader = new PerspectiveExtensionReader();
reader.setIncludeOnlyTags(new String[] { IWorkbenchRegistryConstants.TAG_ACTION_SET });
@@ -2952,13 +2865,10 @@ public class WorkbenchPage implements IWorkbenchPage {
}
/**
- * Copies action set extensions from the temporary perspective to the other
- * one.
+ * Copies action set extensions from the temporary perspective to the other one.
*
- * @param perspective
- * the perspective to copy action set contributions to
- * @param temporary
- * the perspective to copy action set contributions from
+ * @param perspective the perspective to copy action set contributions to
+ * @param temporary the perspective to copy action set contributions from
*/
private void addActionSet(MPerspective perspective, MPerspective temporary) {
List<String> tags = perspective.getTags();
@@ -2971,19 +2881,17 @@ public class WorkbenchPage implements IWorkbenchPage {
}
/**
- * Installs drop support into the shared area so that editors can be opened
- * by dragging and dropping files into it.
+ * Installs drop support into the shared area so that editors can be opened by
+ * dragging and dropping files into it.
*
- * @param control
- * the control to attach the drop support to
+ * @param control the control to attach the drop support to
*/
private void installAreaDropSupport(Control control) {
if (!dndSupportInstalled) {
WorkbenchWindowConfigurer configurer = legacyWindow.getWindowConfigurer();
DropTargetListener dropTargetListener = configurer.getDropTargetListener();
if (dropTargetListener != null) {
- DropTarget dropTarget = new DropTarget(control, DND.DROP_DEFAULT | DND.DROP_COPY
- | DND.DROP_LINK);
+ DropTarget dropTarget = new DropTarget(control, DND.DROP_DEFAULT | DND.DROP_COPY | DND.DROP_LINK);
dropTarget.setTransfer(configurer.getTransfers());
dropTarget.addDropListener(dropTargetListener);
}
@@ -3076,37 +2984,35 @@ public class WorkbenchPage implements IWorkbenchPage {
};
/**
- * See IWorkbenchPage.
- */
- @Override
+ * See IWorkbenchPage.
+ */
+ @Override
public boolean isPartVisible(IWorkbenchPart part) {
MPart mpart = findPart(part);
return mpart == null ? false : partService.isPartVisible(mpart);
- }
+ }
public MUIElement findSharedArea() {
MPerspective perspective = getPerspectiveStack().getSelectedElement();
- return perspective == null ? null : modelService.find(IPageLayout.ID_EDITOR_AREA,
- perspective);
+ return perspective == null ? null : modelService.find(IPageLayout.ID_EDITOR_AREA, perspective);
}
- /**
- * See IWorkbenchPage.
- */
- @Override
+ /**
+ * See IWorkbenchPage.
+ */
+ @Override
public boolean isEditorAreaVisible() {
MUIElement find = findSharedArea();
return find == null ? false : find.isVisible() && find.isToBeRendered();
- }
+ }
- @Override
+ @Override
public boolean isPageZoomed() {
List<String> maxTag = new ArrayList<>();
maxTag.add(IPresentationEngine.MAXIMIZED);
List<Object> maxElements = modelService.findElements(window, null, null, maxTag);
return maxElements.size() > 0;
- }
-
+ }
// /**
// * This method is called when the page is activated.
@@ -3133,104 +3039,94 @@ public class WorkbenchPage implements IWorkbenchPage {
// composite.setVisible(false);
// }
- /**
- * See IWorkbenchPage.
- */
- @Override
+ /**
+ * See IWorkbenchPage.
+ */
+ @Override
public void reuseEditor(IReusableEditor editor, IEditorInput input) {
- // Rather than calling editor.setInput on the editor directly, we do it through the part reference.
- // This case lets us detect badly behaved editors that are not firing a PROP_INPUT event in response
- // to the input change... but if all editors obeyed their API contract, the "else" branch would be
- // sufficient.
+ // Rather than calling editor.setInput on the editor directly, we do it through
+ // the part reference.
+ // This case lets us detect badly behaved editors that are not firing a
+ // PROP_INPUT event in response
+ // to the input change... but if all editors obeyed their API contract, the
+ // "else" branch would be
+ // sufficient.
// TODO compat: should we be talking to the editor reference here
editor.setInput(input);
- navigationHistory.markEditor(editor);
- }
-
- /**
- * See IWorkbenchPage.
- */
- @Override
- public IEditorPart openEditor(IEditorInput input, String editorID)
- throws PartInitException {
- return openEditor(input, editorID, true, MATCH_INPUT);
- }
-
- /**
- * See IWorkbenchPage.
- */
- @Override
- public IEditorPart openEditor(IEditorInput input, String editorID,
- boolean activate) throws PartInitException {
+ navigationHistory.markEditor(editor);
+ }
+
+ /**
+ * See IWorkbenchPage.
+ */
+ @Override
+ public IEditorPart openEditor(IEditorInput input, String editorID) throws PartInitException {
+ return openEditor(input, editorID, true, MATCH_INPUT);
+ }
+
+ /**
+ * See IWorkbenchPage.
+ */
+ @Override
+ public IEditorPart openEditor(IEditorInput input, String editorID, boolean activate) throws PartInitException {
return openEditor(input, editorID, activate, MATCH_INPUT);
- }
-
- /**
- * See IWorkbenchPage.
- */
- @Override
- public IEditorPart openEditor(final IEditorInput input,
- final String editorID, final boolean activate, final int matchFlags)
- throws PartInitException {
- return openEditor(input, editorID, activate, matchFlags, null, true);
- }
+ }
+
+ /**
+ * See IWorkbenchPage.
+ */
+ @Override
+ public IEditorPart openEditor(final IEditorInput input, final String editorID, final boolean activate,
+ final int matchFlags) throws PartInitException {
+ return openEditor(input, editorID, activate, matchFlags, null, true);
+ }
/**
* This is not public API but for use internally. editorState can be
* <code>null</code>.
*
- * @param input
- * the input to open the editor with
- * @param editorID
- * the id of the editor to open
- * @param activate
- * <tt>true</tt> if the editor should be activated,
- * <tt>false</tt> otherwise
- * @param matchFlags
- * a bit mask consisting of zero or more of the MATCH_* constants
- * OR-ed together
- * @param editorState
- * the previously saved state of the editor as a memento, this
- * may be <tt>null</tt>
- * @param notify
- * <tt>true</tt> if the perspective should fire off events about
- * the editors being opened, <tt>false</tt> otherwise
+ * @param input the input to open the editor with
+ * @param editorID the id of the editor to open
+ * @param activate <tt>true</tt> if the editor should be activated,
+ * <tt>false</tt> otherwise
+ * @param matchFlags a bit mask consisting of zero or more of the MATCH_*
+ * constants OR-ed together
+ * @param editorState the previously saved state of the editor as a memento,
+ * this may be <tt>null</tt>
+ * @param notify <tt>true</tt> if the perspective should fire off events
+ * about the editors being opened, <tt>false</tt> otherwise
* @return the opened editor
- * @exception PartInitException
- * if the editor could not be created or initialized
+ * @exception PartInitException if the editor could not be created or
+ * initialized
*/
- public IEditorPart openEditor(final IEditorInput input, final String editorID,
- final boolean activate, final int matchFlags, final IMemento editorState,
- final boolean notify) throws PartInitException {
- if (input == null || editorID == null) {
- throw new IllegalArgumentException();
- }
-
- final IEditorPart result[] = new IEditorPart[1];
- final PartInitException ex[] = new PartInitException[1];
- BusyIndicator.showWhile(legacyWindow.getWorkbench().getDisplay(),
- () -> {
- try {
- result[0] = busyOpenEditor(input, editorID, activate, matchFlags, editorState, notify);
- } catch (PartInitException e) {
- ex[0] = e;
- }
- });
- if (ex[0] != null) {
- throw ex[0];
+ public IEditorPart openEditor(final IEditorInput input, final String editorID, final boolean activate,
+ final int matchFlags, final IMemento editorState, final boolean notify) throws PartInitException {
+ if (input == null || editorID == null) {
+ throw new IllegalArgumentException();
}
- return result[0];
- }
-
+ final IEditorPart result[] = new IEditorPart[1];
+ final PartInitException ex[] = new PartInitException[1];
+ BusyIndicator.showWhile(legacyWindow.getWorkbench().getDisplay(), () -> {
+ try {
+ result[0] = busyOpenEditor(input, editorID, activate, matchFlags, editorState, notify);
+ } catch (PartInitException e) {
+ ex[0] = e;
+ }
+ });
+ if (ex[0] != null) {
+ throw ex[0];
+ }
+ return result[0];
+ }
- /**
- * @see #openEditor(IEditorInput, String, boolean, int)
+ /**
+ * @see #openEditor(IEditorInput, String, boolean, int)
*/
- private IEditorPart busyOpenEditor(IEditorInput input, String editorId, boolean activate,
- int matchFlags, IMemento editorState, boolean notify) throws PartInitException {
+ private IEditorPart busyOpenEditor(IEditorInput input, String editorId, boolean activate, int matchFlags,
+ IMemento editorState, boolean notify) throws PartInitException {
if (input == null || editorId == null) {
throw new IllegalArgumentException();
@@ -3248,8 +3144,7 @@ public class WorkbenchPage implements IWorkbenchPage {
return null;
}
- IEditorDescriptor desc = getWorkbenchWindow().getWorkbench()
- .getEditorRegistry().findEditor(editorId);
+ IEditorDescriptor desc = getWorkbenchWindow().getWorkbench().getEditorRegistry().findEditor(editorId);
if (desc != null && !desc.isOpenExternal() && isLargeDocument(input)) {
desc = getAlternateEditor();
if (desc == null) {
@@ -3258,8 +3153,7 @@ public class WorkbenchPage implements IWorkbenchPage {
}
}
if (desc == null) {
- throw new PartInitException(NLS.bind(
- WorkbenchMessages.EditorManager_unknownEditorIDMessage, editorId));
+ throw new PartInitException(NLS.bind(WorkbenchMessages.EditorManager_unknownEditorIDMessage, editorId));
}
setEditorAreaVisible(true);
@@ -3271,8 +3165,7 @@ public class WorkbenchPage implements IWorkbenchPage {
((IShowEditorInput) editor).showEditorInput(input);
}
- partService.showPart(((EditorReference) editorReferences[0]).getModel(),
- PartState.VISIBLE);
+ partService.showPart(((EditorReference) editorReferences[0]).getModel(), PartState.VISIBLE);
if (activate) {
activate(editor);
@@ -3282,12 +3175,11 @@ public class WorkbenchPage implements IWorkbenchPage {
return editor;
} else if (desc.isInternal()) {
// look for an editor to reuse
- EditorReference reusableEditorRef = (EditorReference) ((TabBehaviour) Tweaklets
- .get(TabBehaviour.KEY)).findReusableEditor(this);
+ EditorReference reusableEditorRef = (EditorReference) ((TabBehaviour) Tweaklets.get(TabBehaviour.KEY))
+ .findReusableEditor(this);
if (reusableEditorRef != null) {
IEditorPart reusableEditor = reusableEditorRef.getEditor(false);
- if (editorId.equals(reusableEditorRef.getId())
- && reusableEditor instanceof IReusableEditor) {
+ if (editorId.equals(reusableEditorRef.getId()) && reusableEditor instanceof IReusableEditor) {
// reusable editors that share the same id are okay
recordEditor(input, desc);
reuseEditor((IReusableEditor) reusableEditor, input);
@@ -3334,7 +3226,7 @@ public class WorkbenchPage implements IWorkbenchPage {
recordEditor(input, desc);
return compatibilityEditor.getEditor();
- }
+ }
private void recordEditor(IEditorInput input, IEditorDescriptor descriptor) {
EditorHistory history = ((Workbench) legacyWindow.getWorkbench()).getEditorHistory();
@@ -3376,78 +3268,72 @@ public class WorkbenchPage implements IWorkbenchPage {
}
}
- /**
- * See IWorkbenchPage.
- */
- @Override
+ /**
+ * See IWorkbenchPage.
+ */
+ @Override
public boolean isEditorPinned(IEditorPart editor) {
- WorkbenchPartReference ref = (WorkbenchPartReference)getReference(editor);
- return ref != null && ref.isPinned();
- }
-
-
+ WorkbenchPartReference ref = (WorkbenchPartReference) getReference(editor);
+ return ref != null && ref.isPinned();
+ }
- /**
- * Removes an IPartListener from the part service.
- */
- @Override
+ /**
+ * Removes an IPartListener from the part service.
+ */
+ @Override
public void removePartListener(IPartListener l) {
partListenerList.remove(l);
- }
+ }
- /**
- * Removes an IPartListener from the part service.
- */
- @Override
+ /**
+ * Removes an IPartListener from the part service.
+ */
+ @Override
public void removePartListener(IPartListener2 l) {
partListener2List.remove(l);
- }
-
- /**
- * Implements IWorkbenchPage
- *
- * @see org.eclipse.ui.IWorkbenchPage#removePropertyChangeListener(IPropertyChangeListener)
- * @since 2.0
- * @deprecated individual views should store a working set if needed and
- * register a property change listener directly with the
- * working set manager to receive notification when the view
- * working set is removed.
- */
- @Deprecated
+ }
+
+ /**
+ * Implements IWorkbenchPage
+ *
+ * @see org.eclipse.ui.IWorkbenchPage#removePropertyChangeListener(IPropertyChangeListener)
+ * @since 2.0
+ * @deprecated individual views should store a working set if needed and
+ * register a property change listener directly with the working set
+ * manager to receive notification when the view working set is
+ * removed.
+ */
+ @Deprecated
@Override
public void removePropertyChangeListener(IPropertyChangeListener listener) {
- propertyChangeListeners.remove(listener);
- }
+ propertyChangeListeners.remove(listener);
+ }
- @Override
+ @Override
public void removeSelectionListener(ISelectionListener listener) {
selectionService.removeSelectionListener(listener);
- }
+ }
- @Override
- public void removeSelectionListener(String partId,
- ISelectionListener listener) {
+ @Override
+ public void removeSelectionListener(String partId, ISelectionListener listener) {
selectionService.removeSelectionListener(partId, listener);
- }
+ }
- @Override
+ @Override
public void removePostSelectionListener(ISelectionListener listener) {
selectionService.removePostSelectionListener(listener);
- }
+ }
- @Override
- public void removePostSelectionListener(String partId,
- ISelectionListener listener) {
+ @Override
+ public void removePostSelectionListener(String partId, ISelectionListener listener) {
selectionService.removePostSelectionListener(partId, listener);
- }
-
-
+ }
- /**
- * Resets the layout for the perspective. The active part in the old layout
- * is activated in the new layout for consistent user context.
- */
- @Override
+ /**
+ * Resets the layout for the perspective. The active part in the old layout is
+ * activated in the new layout for consistent user context.
+ */
+ @Override
public void resetPerspective() {
MPerspectiveStack perspStack = getPerspectiveStack();
MPerspective persp = perspStack.getSelectedElement();
@@ -3469,8 +3355,8 @@ public class WorkbenchPage implements IWorkbenchPage {
MUIElement area = findSharedArea();
if (area != null) {
// remove all editors in the shared area from the list of parts
- perspectiveParts.removeAll(modelService.findElements(area,
- CompatibilityEditor.MODEL_ELEMENT_ID, MPart.class, null));
+ perspectiveParts.removeAll(
+ modelService.findElements(area, CompatibilityEditor.MODEL_ELEMENT_ID, MPart.class, null));
}
List<MPart> dirtyParts = new ArrayList<>();
@@ -3500,10 +3386,8 @@ public class WorkbenchPage implements IWorkbenchPage {
SaveablesList saveablesList = null;
Object postCloseInfo = null;
if (partsToSave.size() > 0) {
- saveablesList = (SaveablesList) getWorkbenchWindow().getService(
- ISaveablesLifecycleListener.class);
- postCloseInfo = saveablesList.preCloseParts(partsToSave, true,
- this.getWorkbenchWindow());
+ saveablesList = (SaveablesList) getWorkbenchWindow().getService(ISaveablesLifecycleListener.class);
+ postCloseInfo = saveablesList.preCloseParts(partsToSave, true, this.getWorkbenchWindow());
if (postCloseInfo == null) {
// cancel
// We're not going through with the reset, so it is
@@ -3522,14 +3406,12 @@ public class WorkbenchPage implements IWorkbenchPage {
boolean revert = false;
if (desc instanceof PerspectiveDescriptor) {
PerspectiveDescriptor perspectiveDescriptor = (PerspectiveDescriptor) desc;
- revert = perspectiveDescriptor.isPredefined()
- && !perspectiveDescriptor.hasCustomDefinition();
+ revert = perspectiveDescriptor.isPredefined() && !perspectiveDescriptor.hasCustomDefinition();
}
MPerspective dummyPerspective = null;
if (!revert) {
- dummyPerspective = (MPerspective) modelService.cloneSnippet(application, desc.getId(),
- window);
+ dummyPerspective = (MPerspective) modelService.cloneSnippet(application, desc.getId(), window);
if (dummyPerspective != null) {
handleNullRefPlaceHolders(dummyPerspective, window);
}
@@ -3541,8 +3423,8 @@ public class WorkbenchPage implements IWorkbenchPage {
dummyPerspective.setElementId(persp.getElementId());
IPerspectiveFactory factory = ((PerspectiveDescriptor) desc).createFactory();
- ModeledPageLayout modelLayout = new ModeledPageLayout(window, modelService,
- partService, dummyPerspective, desc, this, true);
+ ModeledPageLayout modelLayout = new ModeledPageLayout(window, modelService, partService, dummyPerspective,
+ desc, this, true);
factory.createInitialLayout(modelLayout);
PerspectiveTagger.tagPerspective(dummyPerspective, modelService);
@@ -3582,7 +3464,8 @@ public class WorkbenchPage implements IWorkbenchPage {
persp.getWindows().add(detachedWindow);
}
- // Remove original windows. Can't remove them first or the MParts will be disposed
+ // Remove original windows. Can't remove them first or the MParts will be
+ // disposed
for (MWindow detachedWindow : existingDetachedWindows) {
detachedWindow.setToBeRendered(false);
persp.getWindows().remove(detachedWindow);
@@ -3608,8 +3491,7 @@ public class WorkbenchPage implements IWorkbenchPage {
tags.addAll(dummyPerspective.getTags());
// remove HIDDEN_EXPLICITLY tag from trim elements
- List<MTrimElement> trimElements = modelService.findElements(window, null,
- MTrimElement.class, null);
+ List<MTrimElement> trimElements = modelService.findElements(window, null, MTrimElement.class, null);
for (MTrimElement mTrimElement : trimElements) {
mTrimElement.getTags().remove(IPresentationEngine.HIDDEN_EXPLICITLY);
}
@@ -3644,17 +3526,17 @@ public class WorkbenchPage implements IWorkbenchPage {
// });
}
- /**
- * See IWorkbenchPage
- */
- @Override
+ /**
+ * See IWorkbenchPage
+ */
+ @Override
public boolean saveAllEditors(boolean confirm) {
- return saveAllEditors(confirm, false, false);
- }
+ return saveAllEditors(confirm, false, false);
+ }
/**
- * @return {@link ISaveablePart} objects derived from {@link IWorkbenchPart}
- * 's on this page
+ * @return {@link ISaveablePart} objects derived from {@link IWorkbenchPart} 's
+ * on this page
*/
public ISaveablePart[] getDirtyParts() {
List<ISaveablePart> result = new ArrayList<>(3);
@@ -3673,8 +3555,8 @@ public class WorkbenchPage implements IWorkbenchPage {
/**
* @return workbench parts which are dirty (implement or adapt to
- * {@link ISaveablePart}). Only parts matching different saveables
- * are returned.
+ * {@link ISaveablePart}). Only parts matching different saveables are
+ * returned.
*/
public IWorkbenchPart[] getDirtyWorkbenchParts() {
List<IWorkbenchPart> result = new ArrayList<>(3);
@@ -3728,8 +3610,7 @@ public class WorkbenchPage implements IWorkbenchPage {
}
public static boolean saveAll(List<IWorkbenchPart> dirtyParts, final boolean confirm, final boolean closing,
- boolean addNonPartSources, final IRunnableContext runnableContext,
- final IWorkbenchWindow workbenchWindow) {
+ boolean addNonPartSources, final IRunnableContext runnableContext, final IWorkbenchWindow workbenchWindow) {
// clone the input list
dirtyParts = new ArrayList<>(dirtyParts);
@@ -3739,24 +3620,22 @@ public class WorkbenchPage implements IWorkbenchPage {
removeSaveOnCloseNotNeededParts(dirtyParts);
}
- SaveablesList saveablesList = (SaveablesList) PlatformUI.getWorkbench().getService(
- ISaveablesLifecycleListener.class);
+ SaveablesList saveablesList = (SaveablesList) PlatformUI.getWorkbench()
+ .getService(ISaveablesLifecycleListener.class);
if (confirm) {
- return processSaveable2(dirtyParts) ? false : saveablesList.preCloseParts(dirtyParts, true, true,
- workbenchWindow, workbenchWindow) != null;
+ return processSaveable2(dirtyParts) ? false
+ : saveablesList.preCloseParts(dirtyParts, true, true, workbenchWindow, workbenchWindow) != null;
}
List<Saveable> modelsToSave = convertToSaveables(dirtyParts, closing, addNonPartSources);
- return modelsToSave.isEmpty() ? true : !saveablesList.saveModels(modelsToSave, workbenchWindow,
- runnableContext, closing);
+ return modelsToSave.isEmpty() ? true
+ : !saveablesList.saveModels(modelsToSave, workbenchWindow, runnableContext, closing);
}
/**
- * Removes from the provided list parts that don't need to be saved on
- * close.
+ * Removes from the provided list parts that don't need to be saved on close.
*
- * @param parts
- * the list of the parts (ISaveablePart)
+ * @param parts the list of the parts (ISaveablePart)
*/
private static void removeSaveOnCloseNotNeededParts(List<IWorkbenchPart> parts) {
for (Iterator<IWorkbenchPart> it = parts.iterator(); it.hasNext();) {
@@ -3769,11 +3648,10 @@ public class WorkbenchPage implements IWorkbenchPage {
}
/**
- * Processes all parts that implement ISaveablePart2 and removes them from
- * the list.
+ * Processes all parts that implement ISaveablePart2 and removes them from the
+ * list.
*
- * @param dirtyParts
- * the list of the parts
+ * @param dirtyParts the list of the parts
* @return true if cancelled
*/
private static boolean processSaveable2(List<IWorkbenchPart> dirtyParts) {
@@ -3796,10 +3674,8 @@ public class WorkbenchPage implements IWorkbenchPage {
WorkbenchPage page = (WorkbenchPage) part.getSite().getPage();
if (!Util.equals(currentPage, page)) {
if (currentPage != null && currentPageOriginalPerspective != null) {
- if (!currentPageOriginalPerspective.equals(currentPage
- .getActivePerspective())) {
- currentPage
- .setPerspective(currentPageOriginalPerspective.getDesc());
+ if (!currentPageOriginalPerspective.equals(currentPage.getActivePerspective())) {
+ currentPage.setPerspective(currentPageOriginalPerspective.getDesc());
}
}
currentPage = page;
@@ -3848,18 +3724,15 @@ public class WorkbenchPage implements IWorkbenchPage {
}
/**
- * For each part (view or editor) in the given list, attempts to convert it
- * to one or more saveable models. Duplicate models are removed. If closing
- * is true, then models that will remain open in parts other than the given
- * parts are removed.
+ * For each part (view or editor) in the given list, attempts to convert it to
+ * one or more saveable models. Duplicate models are removed. If closing is
+ * true, then models that will remain open in parts other than the given parts
+ * are removed.
*
- * @param parts
- * the parts (list of IViewPart or IEditorPart)
- * @param closing
- * whether the parts are being closed
- * @param addNonPartSources
- * whether non-part sources should be added (true for the Save
- * All action, see bug 139004)
+ * @param parts the parts (list of IViewPart or IEditorPart)
+ * @param closing whether the parts are being closed
+ * @param addNonPartSources whether non-part sources should be added (true for
+ * the Save All action, see bug 139004)
* @return the dirty models
*/
private static List<Saveable> convertToSaveables(List<IWorkbenchPart> parts, boolean closing,
@@ -3870,17 +3743,15 @@ public class WorkbenchPage implements IWorkbenchPage {
for (Saveable saveable : getSaveables(part)) {
if (saveable.isDirty() && !seen.contains(saveable)) {
seen.add(saveable);
- if (!closing
- || closingLastPartShowingModel(saveable, parts, part.getSite()
- .getPage())) {
+ if (!closing || closingLastPartShowingModel(saveable, parts, part.getSite().getPage())) {
result.add(saveable);
}
}
}
}
if (addNonPartSources) {
- SaveablesList saveablesList = (SaveablesList) PlatformUI.getWorkbench().getService(
- ISaveablesLifecycleListener.class);
+ SaveablesList saveablesList = (SaveablesList) PlatformUI.getWorkbench()
+ .getService(ISaveablesLifecycleListener.class);
ISaveablesSource[] nonPartSources = saveablesList.getNonPartSources();
for (ISaveablesSource nonPartSource : nonPartSources) {
for (Saveable saveable : nonPartSource.getSaveables()) {
@@ -3895,12 +3766,10 @@ public class WorkbenchPage implements IWorkbenchPage {
}
/**
- * Returns the saveable models provided by the given part. If the part does
- * not provide any models, a default model is returned representing the
- * part.
+ * Returns the saveable models provided by the given part. If the part does not
+ * provide any models, a default model is returned representing the part.
*
- * @param part
- * the workbench part
+ * @param part the workbench part
* @return the saveable models
*/
private static Saveable[] getSaveables(IWorkbenchPart part) {
@@ -3912,15 +3781,12 @@ public class WorkbenchPage implements IWorkbenchPage {
}
/**
- * Returns true if, in the given page, no more parts will reference the
- * given model if the given parts are closed.
+ * Returns true if, in the given page, no more parts will reference the given
+ * model if the given parts are closed.
*
- * @param model
- * the model
- * @param closingParts
- * the parts being closed (list of IViewPart or IEditorPart)
- * @param page
- * the page
+ * @param model the model
+ * @param closingParts the parts being closed (list of IViewPart or IEditorPart)
+ * @param page the page
* @return <code>true</code> if no more parts in the page will reference the
* given model, <code>false</code> otherwise
*/
@@ -3951,44 +3817,39 @@ public class WorkbenchPage implements IWorkbenchPage {
}
/**
- * Saves the contents of the provided saveable and returns whether the
- * operation succeeded or not.
+ * Saves the contents of the provided saveable and returns whether the operation
+ * succeeded or not.
*
- * @param saveable
- * the saveable part to save
+ * @param saveable the saveable part to save
* @param part
- * @param confirm
- * whether the user should be prompted for confirmation of the
- * save request
- * @param closing
- * whether the part will be closed after the save operation has
- * completed, this may determine whether whether the save
- * operation will actually be invoked or not
+ * @param confirm whether the user should be prompted for confirmation of the
+ * save request
+ * @param closing whether the part will be closed after the save operation has
+ * completed, this may determine whether whether the save
+ * operation will actually be invoked or not
* @return <code>true</code> if the saveable's contents has been persisted,
* <code>false</code> otherwise
* @see ISaveablePart#isSaveOnCloseNeeded()
*/
- public boolean saveSaveable(ISaveablePart saveable, IWorkbenchPart part, boolean confirm,
- boolean closing) {
+ public boolean saveSaveable(ISaveablePart saveable, IWorkbenchPart part, boolean confirm, boolean closing) {
if (closing && !saveable.isSaveOnCloseNeeded()) {
return true;
}
return SaveableHelper.savePart(saveable, part, legacyWindow, confirm);
}
- /**
- * Saves an editors in the workbench. If <code>confirm</code> is <code>true</code>
- * the user is prompted to confirm the command.
- *
- * @param confirm
- * if user confirmation should be sought
- * @return <code>true</code> if the command succeeded, or <code>false</code>
- * if the user cancels the command
- */
- @Override
+ /**
+ * Saves an editors in the workbench. If <code>confirm</code> is
+ * <code>true</code> the user is prompted to confirm the command.
+ *
+ * @param confirm if user confirmation should be sought
+ * @return <code>true</code> if the command succeeded, or <code>false</code> if
+ * the user cancels the command
+ */
+ @Override
public boolean saveEditor(IEditorPart editor, boolean confirm) {
return saveSaveable(editor, editor, confirm, false);
- }
+ }
@Override
public void savePerspective() {
@@ -4000,8 +3861,8 @@ public class WorkbenchPage implements IWorkbenchPage {
MPerspective visiblePerspective = getPerspectiveStack().getSelectedElement();
// get the original perspective
String originalPerspectiveId = visiblePerspective.getElementId();
- IPerspectiveDescriptor originalPerspective = getWorkbenchWindow().getWorkbench()
- .getPerspectiveRegistry().findPerspectiveWithId(originalPerspectiveId);
+ IPerspectiveDescriptor originalPerspective = getWorkbenchWindow().getWorkbench().getPerspectiveRegistry()
+ .findPerspectiveWithId(originalPerspectiveId);
// remove it from our collection of previously opened perspectives
sortedPerspectives.remove(originalPerspective);
// append the saved perspective
@@ -4068,7 +3929,8 @@ public class WorkbenchPage implements IWorkbenchPage {
}
if (!modelToPerspectiveMapping.containsKey(mperspective)) {
boolean fixedPerspective = false;
- PerspectiveDescriptor perspectiveDesc = (PerspectiveDescriptor) getPerspectiveDesc(mperspective.getElementId());
+ PerspectiveDescriptor perspectiveDesc = (PerspectiveDescriptor) getPerspectiveDesc(
+ mperspective.getElementId());
if (perspectiveDesc == null) {
fixedPerspective = true;
perspectiveDesc = fixOrphanPerspective(mperspective);
@@ -4085,9 +3947,9 @@ public class WorkbenchPage implements IWorkbenchPage {
/**
* An 'orphan' perspective is one that was originally created through a
- * contribution but whose contributing bundle is no longer available. In
- * order to allow it to behave correctly within the environment (for Close,
- * Reset...) we turn it into a 'custom' perspective on its first activation.
+ * contribution but whose contributing bundle is no longer available. In order
+ * to allow it to behave correctly within the environment (for Close, Reset...)
+ * we turn it into a 'custom' perspective on its first activation.
*
* @return
*/
@@ -4156,8 +4018,8 @@ public class WorkbenchPage implements IWorkbenchPage {
}
}
- MPerspective modelPerspective = (MPerspective) modelService.cloneSnippet(application,
- perspective.getId(), window);
+ MPerspective modelPerspective = (MPerspective) modelService.cloneSnippet(application, perspective.getId(),
+ window);
if (modelPerspective == null) {
// couldn't find the perspective, create a new one
@@ -4255,8 +4117,8 @@ public class WorkbenchPage implements IWorkbenchPage {
// instantiate the perspective
IPerspectiveFactory factory = ((PerspectiveDescriptor) perspective).createFactory();
- ModeledPageLayout modelLayout = new ModeledPageLayout(window, modelService,
- partService, modelPerspective, perspective, this, true);
+ ModeledPageLayout modelLayout = new ModeledPageLayout(window, modelService, partService, modelPerspective,
+ perspective, this, true);
factory.createInitialLayout(modelLayout);
PerspectiveTagger.tagPerspective(modelPerspective, modelService);
PerspectiveExtensionReader reader = new PerspectiveExtensionReader();
@@ -4264,14 +4126,12 @@ public class WorkbenchPage implements IWorkbenchPage {
return modelPerspective;
}
- void perspectiveActionSetChanged(Perspective perspective, IActionSetDescriptor descriptor,
- int changeType) {
+ void perspectiveActionSetChanged(Perspective perspective, IActionSetDescriptor descriptor, int changeType) {
if (perspective == getActivePerspective()) {
actionSets.change(descriptor, changeType);
}
}
-
/**
* Retrieves the perspective stack of the window that's containing this
* workbench page.
@@ -4298,8 +4158,7 @@ public class WorkbenchPage implements IWorkbenchPage {
MPartSashContainer stickySash = modelService.createModelElement(MPartSashContainer.class);
stickySash.setHorizontal(true);
- MPerspectiveStack perspectiveStack = modelService
- .createModelElement(MPerspectiveStack.class);
+ MPerspectiveStack perspectiveStack = modelService.createModelElement(MPerspectiveStack.class);
perspectiveStack.setElementId(IWorkbenchConstants.PERSPECTIVE_STACK_ID);
perspectiveStack.setContainerData("7500"); //$NON-NLS-1$
@@ -4308,12 +4167,11 @@ public class WorkbenchPage implements IWorkbenchPage {
stickyFolder.setElementId("stickyFolderRight"); //$NON-NLS-1$
stickyFolder.setToBeRendered(false);
- IStickyViewDescriptor[] stickyViews = getWorkbenchWindow().getWorkbench().getViewRegistry()
- .getStickyViews();
+ IStickyViewDescriptor[] stickyViews = getWorkbenchWindow().getWorkbench().getViewRegistry().getStickyViews();
for (IStickyViewDescriptor stickyView : stickyViews) {
if (stickyView.getLocation() == IPageLayout.RIGHT) {
- MStackElement viewModel = ModeledPageLayout.createViewModel(application,
- stickyView.getId(), false, this, partService, true);
+ MStackElement viewModel = ModeledPageLayout.createViewModel(application, stickyView.getId(), false,
+ this, partService, true);
stickyFolder.getChildren().add(viewModel);
}
}
@@ -4328,75 +4186,69 @@ public class WorkbenchPage implements IWorkbenchPage {
return perspectiveStack;
}
- /**
- * Sets the active working set for the workbench page. Notifies property
- * change listener about the change.
- *
- * @param newWorkingSet
- * the active working set for the page. May be null.
- * @since 2.0
- * @deprecated individual views should store a working set if needed
- */
- @Deprecated
+ /**
+ * Sets the active working set for the workbench page. Notifies property change
+ * listener about the change.
+ *
+ * @param newWorkingSet the active working set for the page. May be null.
+ * @since 2.0
+ * @deprecated individual views should store a working set if needed
+ */
+ @Deprecated
public void setWorkingSet(IWorkingSet newWorkingSet) {
- IWorkingSet oldWorkingSet = workingSet;
-
- workingSet = newWorkingSet;
- if (oldWorkingSet != newWorkingSet) {
- firePropertyChange(CHANGE_WORKING_SET_REPLACE, oldWorkingSet,
- newWorkingSet);
- }
- if (newWorkingSet != null) {
- WorkbenchPlugin.getDefault().getWorkingSetManager()
- .addPropertyChangeListener(workingSetPropertyChangeListener);
- } else {
- WorkbenchPlugin.getDefault().getWorkingSetManager()
- .removePropertyChangeListener(workingSetPropertyChangeListener);
- }
- }
-
- /**
- * @see IWorkbenchPage
- */
- @Override
+ IWorkingSet oldWorkingSet = workingSet;
+
+ workingSet = newWorkingSet;
+ if (oldWorkingSet != newWorkingSet) {
+ firePropertyChange(CHANGE_WORKING_SET_REPLACE, oldWorkingSet, newWorkingSet);
+ }
+ if (newWorkingSet != null) {
+ WorkbenchPlugin.getDefault().getWorkingSetManager()
+ .addPropertyChangeListener(workingSetPropertyChangeListener);
+ } else {
+ WorkbenchPlugin.getDefault().getWorkingSetManager()
+ .removePropertyChangeListener(workingSetPropertyChangeListener);
+ }
+ }
+
+ /**
+ * @see IWorkbenchPage
+ */
+ @Override
public void showActionSet(String actionSetID) {
- Perspective persp = getActivePerspective();
- if (persp != null) {
- ActionSetRegistry reg = WorkbenchPlugin.getDefault()
- .getActionSetRegistry();
+ Perspective persp = getActivePerspective();
+ if (persp != null) {
+ ActionSetRegistry reg = WorkbenchPlugin.getDefault().getActionSetRegistry();
- IActionSetDescriptor desc = reg.findActionSet(actionSetID);
- if (desc != null) {
+ IActionSetDescriptor desc = reg.findActionSet(actionSetID);
+ if (desc != null) {
List<IActionSetDescriptor> offActionSets = persp.getAlwaysOffActionSets();
for (IActionSetDescriptor off : offActionSets) {
if (off.getId().equals(desc.getId())) {
return;
}
}
- persp.addActionSet(desc);
- legacyWindow.updateActionSets();
- legacyWindow.firePerspectiveChanged(this, getPerspective(),
- CHANGE_ACTION_SET_SHOW);
- }
- }
- }
-
- /**
- * See IWorkbenchPage.
- */
- @Override
+ persp.addActionSet(desc);
+ legacyWindow.updateActionSets();
+ legacyWindow.firePerspectiveChanged(this, getPerspective(), CHANGE_ACTION_SET_SHOW);
+ }
+ }
+ }
+
+ /**
+ * See IWorkbenchPage.
+ */
+ @Override
public IViewPart showView(String viewID) throws PartInitException {
- return showView(viewID, null, VIEW_ACTIVATE);
- }
+ return showView(viewID, null, VIEW_ACTIVATE);
+ }
@Override
- public IViewPart showView(final String viewID, final String secondaryID, final int mode)
- throws PartInitException {
+ public IViewPart showView(final String viewID, final String secondaryID, final int mode) throws PartInitException {
if (secondaryID != null) {
if (secondaryID.length() == 0 || secondaryID.indexOf(':') != -1) {
- throw new IllegalArgumentException(
- WorkbenchMessages.WorkbenchPage_IllegalSecondaryId);
+ throw new IllegalArgumentException(WorkbenchMessages.WorkbenchPage_IllegalSecondaryId);
}
}
if (!certifyMode(mode)) {
@@ -4422,21 +4274,21 @@ public class WorkbenchPage implements IWorkbenchPage {
}
}
- /**
- * @param mode the mode to test
- * @return whether the mode is recognized
- * @since 3.0
- */
- private boolean certifyMode(int mode) {
- switch (mode) {
- case VIEW_ACTIVATE:
- case VIEW_VISIBLE:
- case VIEW_CREATE:
- return true;
- default:
- return false;
- }
- }
+ /**
+ * @param mode the mode to test
+ * @return whether the mode is recognized
+ * @since 3.0
+ */
+ private boolean certifyMode(int mode) {
+ switch (mode) {
+ case VIEW_ACTIVATE:
+ case VIEW_VISIBLE:
+ case VIEW_CREATE:
+ return true;
+ default:
+ return false;
+ }
+ }
public MUIElement getActiveElement(IWorkbenchPartReference ref) {
MUIElement element = null;
@@ -4477,7 +4329,7 @@ public class WorkbenchPage implements IWorkbenchPage {
setPartState(element, state);
}
- @Override
+ @Override
public int getPartState(IWorkbenchPartReference ref) {
int state = STATE_RESTORED;
MUIElement element = getActiveElement(ref);
@@ -4509,18 +4361,17 @@ public class WorkbenchPage implements IWorkbenchPage {
}
}
- /**
- * updateActionBars method comment.
- */
- public void updateActionBars() {
+ /**
+ * updateActionBars method comment.
+ */
+ public void updateActionBars() {
legacyWindow.updateActionBars();
- }
-
+ }
- @Override
+ @Override
public void zoomOut() {
// TODO compat: what does the zoom do?
- }
+ }
@Override
public void toggleZoom(IWorkbenchPartReference ref) {
@@ -4534,14 +4385,12 @@ public class WorkbenchPage implements IWorkbenchPage {
}
}
-
@Override
public IPerspectiveDescriptor[] getOpenPerspectives() {
MPerspectiveStack perspectiveStack = modelService.findElements(window, null, MPerspectiveStack.class).get(0);
IPerspectiveRegistry registry = PlatformUI.getWorkbench().getPerspectiveRegistry();
- ArrayList<IPerspectiveDescriptor> tmp = new ArrayList<>(
- perspectiveStack.getChildren().size());
+ ArrayList<IPerspectiveDescriptor> tmp = new ArrayList<>(perspectiveStack.getChildren().size());
for (MPerspective persp : perspectiveStack.getChildren()) {
String perspectiveId = persp.getElementId();
IPerspectiveDescriptor desc = registry.findPerspectiveWithId(perspectiveId);
@@ -4560,16 +4409,14 @@ public class WorkbenchPage implements IWorkbenchPage {
return sortedPerspectives.toArray(new IPerspectiveDescriptor[sortedPerspectives.size()]);
}
-
-
- /**
- * Returns the reference to the given part, or <code>null</code> if it has no reference
- * (i.e. it is not a top-level part in this workbench page).
- *
- * @param part the part
- * @return the part's reference or <code>null</code> if the given part does not belong
- * to this workbench page
- */
+ /**
+ * Returns the reference to the given part, or <code>null</code> if it has no
+ * reference (i.e. it is not a top-level part in this workbench page).
+ *
+ * @param part the part
+ * @return the part's reference or <code>null</code> if the given part does not
+ * belong to this workbench page
+ */
@Override
public IWorkbenchPartReference getReference(IWorkbenchPart part) {
if (part != null) {
@@ -4606,8 +4453,9 @@ public class WorkbenchPage implements IWorkbenchPage {
if (parent instanceof MPartStack) {
MStackElement selectedElement = ((MPartStack) parent).getSelectedElement();
- final MUIElement topPart = selectedElement instanceof MPlaceholder ? ((MPlaceholder) selectedElement)
- .getRef() : null;
+ final MUIElement topPart = selectedElement instanceof MPlaceholder
+ ? ((MPlaceholder) selectedElement).getRef()
+ : null;
List<CompatibilityView> stack = new ArrayList<>();
for (Object child : parent.getChildren()) {
@@ -4658,7 +4506,6 @@ public class WorkbenchPage implements IWorkbenchPage {
return null;
}
-
@Override
public IExtensionTracker getExtensionTracker() {
if (tracker == null) {
@@ -4699,17 +4546,15 @@ public class WorkbenchPage implements IWorkbenchPage {
return getArrayForTag(ModeledPageLayout.SHOW_VIEW_TAG);
}
+ public boolean isPartVisible(IWorkbenchPartReference reference) {
+ IWorkbenchPart part = reference.getPart(false);
+ // Can't be visible if it isn't created yet
+ if (part == null) {
+ return false;
+ }
-
- public boolean isPartVisible(IWorkbenchPartReference reference) {
- IWorkbenchPart part = reference.getPart(false);
- // Can't be visible if it isn't created yet
- if (part == null) {
- return false;
- }
-
- return isPartVisible(part);
- }
+ return isPartVisible(part);
+ }
@Override
public IWorkingSet[] getWorkingSets() {
@@ -4719,14 +4564,11 @@ public class WorkbenchPage implements IWorkbenchPage {
@Override
public void setWorkingSets(IWorkingSet[] newWorkingSets) {
if (newWorkingSets != null) {
- WorkbenchPlugin
- .getDefault()
- .getWorkingSetManager()
+ WorkbenchPlugin.getDefault().getWorkingSetManager()
.addPropertyChangeListener(workingSetPropertyChangeListener);
} else {
WorkbenchPlugin.getDefault().getWorkingSetManager()
- .removePropertyChangeListener(
- workingSetPropertyChangeListener);
+ .removePropertyChangeListener(workingSetPropertyChangeListener);
}
if (newWorkingSets == null) {
@@ -4749,8 +4591,7 @@ public class WorkbenchPage implements IWorkbenchPage {
workingSets = newWorkingSets;
if (!Arrays.equals(oldWorkingSets, newWorkingSets)) {
- firePropertyChange(CHANGE_WORKING_SETS_REPLACE, oldWorkingSets,
- newWorkingSets);
+ firePropertyChange(CHANGE_WORKING_SETS_REPLACE, oldWorkingSets, newWorkingSets);
if (aggregateWorkingSet != null) {
aggregateWorkingSet.setComponents(workingSets);
}
@@ -4760,8 +4601,7 @@ public class WorkbenchPage implements IWorkbenchPage {
@Override
public IWorkingSet getAggregateWorkingSet() {
if (aggregateWorkingSet == null) {
- IWorkingSetManager workingSetManager = PlatformUI.getWorkbench()
- .getWorkingSetManager();
+ IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager();
if (aggregateWorkingSetId == null) {
aggregateWorkingSetId = generateAggregateWorkingSetId();
@@ -4769,10 +4609,9 @@ public class WorkbenchPage implements IWorkbenchPage {
aggregateWorkingSet = (AggregateWorkingSet) workingSetManager.getWorkingSet(aggregateWorkingSetId);
}
if (aggregateWorkingSet == null) {
- aggregateWorkingSet = (AggregateWorkingSet) workingSetManager
- .createAggregateWorkingSet(aggregateWorkingSetId,
- WorkbenchMessages.WorkbenchPage_workingSet_default_label,
- getWorkingSets());
+ aggregateWorkingSet = (AggregateWorkingSet) workingSetManager.createAggregateWorkingSet(
+ aggregateWorkingSetId, WorkbenchMessages.WorkbenchPage_workingSet_default_label,
+ getWorkingSets());
workingSetManager.addWorkingSet(aggregateWorkingSet);
}
}
@@ -4786,10 +4625,11 @@ public class WorkbenchPage implements IWorkbenchPage {
@Override
public void showEditor(IEditorReference ref) {
IWorkbenchPart wPart = ref.getPart(false);
- MPart part = ((EditorReference)ref).getModel();
+ MPart part = ((EditorReference) ref).getModel();
part.setVisible(true);
- //Workaround to get content visible. Otherwise the content sometimes is not rendered.
+ // Workaround to get content visible. Otherwise the content sometimes is not
+ // rendered.
MElementContainer<MUIElement> partStack = part.getParent();
partStack.setSelectedElement(null);
partStack.setSelectedElement(part);
@@ -4798,7 +4638,7 @@ public class WorkbenchPage implements IWorkbenchPage {
@Override
public void hideEditor(IEditorReference ref) {
- MPart part = ((EditorReference)ref).getModel();
+ MPart part = ((EditorReference) ref).getModel();
part.setVisible(false);
}
@@ -4828,14 +4668,14 @@ public class WorkbenchPage implements IWorkbenchPage {
}
@Override
- public IEditorReference[] openEditors(IEditorInput[] inputs, String[] editorIDs, int matchFlags) throws MultiPartInitException {
+ public IEditorReference[] openEditors(IEditorInput[] inputs, String[] editorIDs, int matchFlags)
+ throws MultiPartInitException {
return openEditors(inputs, editorIDs, null, matchFlags, 0);
}
@Override
- public IEditorReference[] openEditors(IEditorInput[] inputs, String[] editorIDs,
- IMemento[] mementos, int matchFlags, int activationIndex)
- throws MultiPartInitException {
+ public IEditorReference[] openEditors(IEditorInput[] inputs, String[] editorIDs, IMemento[] mementos,
+ int matchFlags, int activationIndex) throws MultiPartInitException {
// If we are only working with mementos create a placeholder array of
// nulls
if (inputs == null) {
@@ -4889,10 +4729,8 @@ public class WorkbenchPage implements IWorkbenchPage {
outerMem.putString(IWorkbenchConstants.TAG_ID, curEditorID);
outerMem.copyChild(curMemento);
- XMLMemento inputMem = (XMLMemento) outerMem
- .createChild(IWorkbenchConstants.TAG_INPUT);
- inputMem.putString(IWorkbenchConstants.TAG_FACTORY_ID, curInput.getPersistable()
- .getFactoryId());
+ XMLMemento inputMem = (XMLMemento) outerMem.createChild(IWorkbenchConstants.TAG_INPUT);
+ inputMem.putString(IWorkbenchConstants.TAG_FACTORY_ID, curInput.getPersistable().getFactoryId());
inputMem.putString(IWorkbenchConstants.TAG_PATH, curInput.getName());
}
@@ -4900,22 +4738,20 @@ public class WorkbenchPage implements IWorkbenchPage {
// and the memento (if any)
if (reg.findEditor(curEditorID) == null) {
references[i] = null;
- exceptions[i] = new PartInitException(NLS.bind(
- WorkbenchMessages.EditorManager_unknownEditorIDMessage, curEditorID));
+ exceptions[i] = new PartInitException(
+ NLS.bind(WorkbenchMessages.EditorManager_unknownEditorIDMessage, curEditorID));
hasFailures = true;
} else if (curInput == null) {
references[i] = null;
- exceptions[i] = new PartInitException(NLS.bind(
- WorkbenchMessages.EditorManager_no_persisted_state, curEditorID));
+ exceptions[i] = new PartInitException(
+ NLS.bind(WorkbenchMessages.EditorManager_no_persisted_state, curEditorID));
hasFailures = true;
} else {
// Is there an existing editor ?
- IEditorReference[] existingEditors = findEditors(curInput, curEditorID,
- matchFlags);
+ IEditorReference[] existingEditors = findEditors(curInput, curEditorID, matchFlags);
if (existingEditors.length == 0) {
MPart editor = partService.createPart(CompatibilityEditor.MODEL_ELEMENT_ID);
- references[i] = createEditorReferenceForPart(editor, curInput, curEditorID,
- null);
+ references[i] = createEditorReferenceForPart(editor, curInput, curEditorID, null);
if (i == activationIndex)
editorToActivate = editor;
@@ -4927,8 +4763,7 @@ public class WorkbenchPage implements IWorkbenchPage {
StringWriter writer = new StringWriter();
try {
memento.save(writer);
- editor.getPersistedState().put(WorkbenchPartReference.MEMENTO_KEY,
- writer.toString());
+ editor.getPersistedState().put(WorkbenchPartReference.MEMENTO_KEY, writer.toString());
} catch (IOException e) {
WorkbenchPlugin.log(e);
}
@@ -4953,24 +4788,21 @@ public class WorkbenchPage implements IWorkbenchPage {
StringWriter writer = new StringWriter();
try {
momento.save(writer);
- ee.getModel().getPersistedState()
- .put(WorkbenchPartReference.MEMENTO_KEY, writer.toString());
+ ee.getModel().getPersistedState().put(WorkbenchPartReference.MEMENTO_KEY,
+ writer.toString());
} catch (IOException e) {
WorkbenchPlugin.log(e);
}
}
} else {
// editor already rendered, try to update its state
- if (curMemento != null
- && ee.getModel().getObject() instanceof CompatibilityEditor) {
- CompatibilityEditor ce = (CompatibilityEditor) ee.getModel()
- .getObject();
+ if (curMemento != null && ee.getModel().getObject() instanceof CompatibilityEditor) {
+ CompatibilityEditor ce = (CompatibilityEditor) ee.getModel().getObject();
if (ce.getEditor() instanceof IPersistableEditor) {
IPersistableEditor pe = (IPersistableEditor) ce.getEditor();
// Extract the 'editorState' from the memento
- IMemento editorMem = curMemento
- .getChild(IWorkbenchConstants.TAG_EDITOR_STATE);
+ IMemento editorMem = curMemento.getChild(IWorkbenchConstants.TAG_EDITOR_STATE);
if (editorMem == null) {
// Must be an externally defined memento,
// take the second child
@@ -4995,8 +4827,7 @@ public class WorkbenchPage implements IWorkbenchPage {
for (IEditorReference reference : references) {
if (reference != null) {
hasSuccesses = true;
- legacyWindow.firePerspectiveChanged(this, getPerspective(), reference,
- CHANGE_EDITOR_OPEN);
+ legacyWindow.firePerspectiveChanged(this, getPerspective(), reference, CHANGE_EDITOR_OPEN);
}
}
@@ -5084,8 +4915,7 @@ public class WorkbenchPage implements IWorkbenchPage {
}
});
}
- }
- else if (client != null) {
+ } else if (client != null) {
if (part.getTransientData().get(E4PartWrapper.E4_WRAPPER_KEY) instanceof E4PartWrapper) {
IWorkbenchPart workbenchPart = (IWorkbenchPart) part.getTransientData()
.get(E4PartWrapper.E4_WRAPPER_KEY);
@@ -5170,8 +5000,7 @@ public class WorkbenchPage implements IWorkbenchPage {
}
/**
- * @param comPart
- * e4 wrapper around {@link IWorkbenchPart}
+ * @param comPart e4 wrapper around {@link IWorkbenchPart}
* @return can return null, in case {@link CompatibilityPart} was already
* disposed
*/
@@ -5216,8 +5045,7 @@ public class WorkbenchPage implements IWorkbenchPage {
}
if (compatibilityPart instanceof CompatibilityView) {
- legacyWindow.firePerspectiveChanged(this, getPerspective(), partReference,
- CHANGE_VIEW_SHOW);
+ legacyWindow.firePerspectiveChanged(this, getPerspective(), partReference, CHANGE_VIEW_SHOW);
legacyWindow.firePerspectiveChanged(this, getPerspective(), CHANGE_VIEW_SHOW);
}
}
@@ -5292,8 +5120,7 @@ public class WorkbenchPage implements IWorkbenchPage {
}
if (compatibilityPart instanceof CompatibilityView) {
- legacyWindow.firePerspectiveChanged(this, getPerspective(), partReference,
- CHANGE_VIEW_HIDE);
+ legacyWindow.firePerspectiveChanged(this, getPerspective(), partReference, CHANGE_VIEW_HIDE);
legacyWindow.firePerspectiveChanged(this, getPerspective(), CHANGE_VIEW_HIDE);
}
}
@@ -5461,29 +5288,23 @@ public class WorkbenchPage implements IWorkbenchPage {
/**
* Opens an editor represented by the descriptor with the given input.
*
- * @param fileEditorInput
- * the input that the editor should open
- * @param editorDescriptor
- * the descriptor of the editor to open
- * @param activate
- * <tt>true</tt> if the editor should be activated,
- * <tt>false</tt> otherwise
- * @param editorState
- * the previously saved state of the editor as a memento, this
- * may be <tt>null</tt>
+ * @param fileEditorInput the input that the editor should open
+ * @param editorDescriptor the descriptor of the editor to open
+ * @param activate <tt>true</tt> if the editor should be activated,
+ * <tt>false</tt> otherwise
+ * @param editorState the previously saved state of the editor as a
+ * memento, this may be <tt>null</tt>
* @return the opened editor
- * @exception PartInitException
- * if the editor could not be created or initialized
+ * @exception PartInitException if the editor could not be created or
+ * initialized
*/
- public IEditorPart openEditorFromDescriptor(IEditorInput fileEditorInput,
- IEditorDescriptor editorDescriptor, final boolean activate, final IMemento editorState)
- throws PartInitException {
+ public IEditorPart openEditorFromDescriptor(IEditorInput fileEditorInput, IEditorDescriptor editorDescriptor,
+ final boolean activate, final IMemento editorState) throws PartInitException {
if (editorDescriptor.isOpenExternal()) {
openExternalEditor((EditorDescriptor) editorDescriptor, fileEditorInput);
return null;
}
- return openEditor(fileEditorInput, editorDescriptor.getId(), activate, MATCH_INPUT,
- editorState, true);
+ return openEditor(fileEditorInput, editorDescriptor.getId(), activate, MATCH_INPUT, editorState, true);
}
/**
@@ -5512,15 +5333,13 @@ public class WorkbenchPage implements IWorkbenchPage {
}
});
} else {
- throw new PartInitException(NLS.bind(
- WorkbenchMessages.EditorManager_errorOpeningExternalEditor, desc.getFileName(),
- desc.getId()));
+ throw new PartInitException(NLS.bind(WorkbenchMessages.EditorManager_errorOpeningExternalEditor,
+ desc.getFileName(), desc.getId()));
}
if (ex[0] != null) {
- throw new PartInitException(NLS.bind(
- WorkbenchMessages.EditorManager_errorOpeningExternalEditor, desc.getFileName(),
- desc.getId()), ex[0]);
+ throw new PartInitException(NLS.bind(WorkbenchMessages.EditorManager_errorOpeningExternalEditor,
+ desc.getFileName(), desc.getId()), ex[0]);
}
recordEditor(input, desc);
@@ -5535,8 +5354,8 @@ public class WorkbenchPage implements IWorkbenchPage {
}
/**
- * Unzooms the shared area if there are no more rendered parts contained
- * within it.
+ * Unzooms the shared area if there are no more rendered parts contained within
+ * it.
*
* @see #unzoomSharedArea(MUIElement)
*/
@@ -5561,8 +5380,7 @@ public class WorkbenchPage implements IWorkbenchPage {
/**
* Unzooms the shared area if the specified element is in the shared area.
*
- * @param element
- * the element to check if it is in the shared area
+ * @param element the element to check if it is in the shared area
* @see #unzoomSharedArea()
*/
private void unzoomSharedArea(MUIElement element) {
@@ -5572,8 +5390,7 @@ public class WorkbenchPage implements IWorkbenchPage {
}
/**
- * An event handler for listening to parts and placeholders being
- * unrendered.
+ * An event handler for listening to parts and placeholders being unrendered.
*/
private EventHandler referenceRemovalEventHandler = event -> {
if (Boolean.TRUE.equals(event.getProperty(UIEvents.EventTags.NEW_VALUE))) {
@@ -5663,8 +5480,7 @@ public class WorkbenchPage implements IWorkbenchPage {
if (newValue.length() == 0)
perspective.getPersistedState().remove(ModeledPageLayout.HIDDEN_ITEMS_KEY);
else
- perspective.getPersistedState().put(ModeledPageLayout.HIDDEN_ITEMS_KEY,
- newValue);
+ perspective.getPersistedState().put(ModeledPageLayout.HIDDEN_ITEMS_KEY, newValue);
}
}
@@ -5704,10 +5520,10 @@ public class WorkbenchPage implements IWorkbenchPage {
}
/**
- * Call {@link #firePartDeactivated(MPart)} if the passed part is the
- * currently active part according to the part service. This method should
- * only be called in the case of workbench shutdown, where E4 does not fire
- * deactivate listeners on the active part.
+ * Call {@link #firePartDeactivated(MPart)} if the passed part is the currently
+ * active part according to the part service. This method should only be called
+ * in the case of workbench shutdown, where E4 does not fire deactivate
+ * listeners on the active part.
*
* @param part
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPartReference.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPartReference.java
index fe02abece8b..66313b7f06a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPartReference.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPartReference.java
@@ -60,94 +60,95 @@ import org.osgi.service.event.EventHandler;
public abstract class WorkbenchPartReference implements IWorkbenchPartReference, ISizeProvider {
/**
- * Internal property ID: Indicates that the underlying part was created
- */
- public static final int INTERNAL_PROPERTY_OPENED = 0x211;
-
- /**
- * Internal property ID: Indicates that the underlying part was destroyed
- */
- public static final int INTERNAL_PROPERTY_CLOSED = 0x212;
-
- /**
- * Internal property ID: Indicates that the result of IEditorReference.isPinned()
- */
- public static final int INTERNAL_PROPERTY_PINNED = 0x213;
-
- /**
- * Internal property ID: Indicates that the result of getVisible() has changed
- */
- public static final int INTERNAL_PROPERTY_VISIBLE = 0x214;
-
- /**
- * Internal property ID: Indicates that the result of isZoomed() has changed
- */
- public static final int INTERNAL_PROPERTY_ZOOMED = 0x215;
-
- /**
- * Internal property ID: Indicates that the part has an active child and the
- * active child has changed. (fired by PartStack)
- */
- public static final int INTERNAL_PROPERTY_ACTIVE_CHILD_CHANGED = 0x216;
-
- /**
- * Internal property ID: Indicates that changed in the min / max
- * state has changed
- */
- public static final int INTERNAL_PROPERTY_MAXIMIZED = 0x217;
-
- // State constants //////////////////////////////
-
- /**
- * State constant indicating that the part is not created yet
- */
- public static int STATE_LAZY = 0;
-
- /**
- * State constant indicating that the part is in the process of being created
- */
- public static int STATE_CREATION_IN_PROGRESS = 1;
-
- /**
- * State constant indicating that the part has been created
- */
- public static int STATE_CREATED = 2;
-
- /**
- * State constant indicating that the reference has been disposed (the reference shouldn't be
- * used anymore)
- */
- public static int STATE_DISPOSED = 3;
+ * Internal property ID: Indicates that the underlying part was created
+ */
+ public static final int INTERNAL_PROPERTY_OPENED = 0x211;
+
+ /**
+ * Internal property ID: Indicates that the underlying part was destroyed
+ */
+ public static final int INTERNAL_PROPERTY_CLOSED = 0x212;
+
+ /**
+ * Internal property ID: Indicates that the result of
+ * IEditorReference.isPinned()
+ */
+ public static final int INTERNAL_PROPERTY_PINNED = 0x213;
+
+ /**
+ * Internal property ID: Indicates that the result of getVisible() has changed
+ */
+ public static final int INTERNAL_PROPERTY_VISIBLE = 0x214;
+
+ /**
+ * Internal property ID: Indicates that the result of isZoomed() has changed
+ */
+ public static final int INTERNAL_PROPERTY_ZOOMED = 0x215;
+
+ /**
+ * Internal property ID: Indicates that the part has an active child and the
+ * active child has changed. (fired by PartStack)
+ */
+ public static final int INTERNAL_PROPERTY_ACTIVE_CHILD_CHANGED = 0x216;
+
+ /**
+ * Internal property ID: Indicates that changed in the min / max state has
+ * changed
+ */
+ public static final int INTERNAL_PROPERTY_MAXIMIZED = 0x217;
+
+ // State constants //////////////////////////////
+
+ /**
+ * State constant indicating that the part is not created yet
+ */
+ public static int STATE_LAZY = 0;
+
+ /**
+ * State constant indicating that the part is in the process of being created
+ */
+ public static int STATE_CREATION_IN_PROGRESS = 1;
+
+ /**
+ * State constant indicating that the part has been created
+ */
+ public static int STATE_CREATED = 2;
+
+ /**
+ * State constant indicating that the reference has been disposed (the reference
+ * shouldn't be used anymore)
+ */
+ public static int STATE_DISPOSED = 3;
static String MEMENTO_KEY = "memento"; //$NON-NLS-1$
- /**
- * Current state of the reference. Used to detect recursive creation errors, disposed
- * references, etc.
- */
- private int state = STATE_LAZY;
+ /**
+ * Current state of the reference. Used to detect recursive creation errors,
+ * disposed references, etc.
+ */
+ private int state = STATE_LAZY;
protected IWorkbenchPart legacyPart;
- private boolean pinned = false;
+ private boolean pinned = false;
- /**
- * API listener list
- */
+ /**
+ * API listener list
+ */
private ListenerList<IPropertyListener> propChangeListeners = new ListenerList<>();
- /**
- * Internal listener list. Listens to the INTERNAL_PROPERTY_* property change events that are not yet API.
- * TODO: Make these properties API in 3.2
- */
+ /**
+ * Internal listener list. Listens to the INTERNAL_PROPERTY_* property change
+ * events that are not yet API. TODO: Make these properties API in 3.2
+ */
private ListenerList<IPropertyListener> internalPropChangeListeners = new ListenerList<>();
private ListenerList<IPropertyChangeListener> partChangeListeners = new ListenerList<>();
- protected Map propertyCache = new HashMap();
+ protected Map propertyCache = new HashMap();
- private IPropertyListener propertyChangeListener = (source, propId) -> partPropertyChanged(source, propId);
+ private IPropertyListener propertyChangeListener = (source, propId) -> partPropertyChanged(source, propId);
- private IPropertyChangeListener partPropertyChangeListener = event -> partPropertyChanged(event);
+ private IPropertyChangeListener partPropertyChangeListener = event -> partPropertyChanged(event);
private IWorkbenchPage page;
@@ -157,8 +158,8 @@ public abstract class WorkbenchPartReference implements IWorkbenchPartReference,
private EventHandler contextEventHandler;
- public WorkbenchPartReference(IEclipseContext windowContext, IWorkbenchPage page, MPart part) {
- this.windowContext = windowContext;
+ public WorkbenchPartReference(IEclipseContext windowContext, IWorkbenchPage page, MPart part) {
+ this.windowContext = windowContext;
this.page = page;
this.part = part;
@@ -189,8 +190,7 @@ public abstract class WorkbenchPartReference implements IWorkbenchPartReference,
public void subscribe() {
IEventBroker broker = windowContext.get(IEventBroker.class);
- broker.subscribe(UIEvents.Context.TOPIC_CONTEXT,
- createContextEventHandler());
+ broker.subscribe(UIEvents.Context.TOPIC_CONTEXT, createContextEventHandler());
}
public void unsubscribe() {
@@ -201,87 +201,88 @@ public abstract class WorkbenchPartReference implements IWorkbenchPartReference,
}
}
- public boolean isDisposed() {
- return state == STATE_DISPOSED;
- }
+ public boolean isDisposed() {
+ return state == STATE_DISPOSED;
+ }
- protected void checkReference() {
- if (state == STATE_DISPOSED) {
- throw new RuntimeException("Error: IWorkbenchPartReference disposed"); //$NON-NLS-1$
- }
- }
+ protected void checkReference() {
+ if (state == STATE_DISPOSED) {
+ throw new RuntimeException("Error: IWorkbenchPartReference disposed"); //$NON-NLS-1$
+ }
+ }
public MPart getModel() {
return part;
}
-
- protected void partPropertyChanged(Object source, int propId) {
+ protected void partPropertyChanged(Object source, int propId) {
firePropertyChange(propId);
- // Let the model manager know as well
- if (propId == IWorkbenchPartConstants.PROP_DIRTY) {
- IWorkbenchPart actualPart = getPart(false);
- if (actualPart != null) {
- SaveablesList modelManager = (SaveablesList) actualPart.getSite().getService(ISaveablesLifecycleListener.class);
- modelManager.dirtyChanged(actualPart);
- }
- }
- }
-
- protected void partPropertyChanged(PropertyChangeEvent event) {
- firePartPropertyChange(event);
- }
-
- /**
- * Releases any references maintained by this part reference
- * when its actual part becomes known (not called when it is disposed).
- */
- protected void releaseReferences() {
-
- }
-
- /* package */ void addInternalPropertyListener(IPropertyListener listener) {
- internalPropChangeListeners.add(listener);
- }
-
- /* package */ void removeInternalPropertyListener(IPropertyListener listener) {
- internalPropChangeListeners.remove(listener);
- }
-
- protected void fireInternalPropertyChange(int id) {
+ // Let the model manager know as well
+ if (propId == IWorkbenchPartConstants.PROP_DIRTY) {
+ IWorkbenchPart actualPart = getPart(false);
+ if (actualPart != null) {
+ SaveablesList modelManager = (SaveablesList) actualPart.getSite()
+ .getService(ISaveablesLifecycleListener.class);
+ modelManager.dirtyChanged(actualPart);
+ }
+ }
+ }
+
+ protected void partPropertyChanged(PropertyChangeEvent event) {
+ firePartPropertyChange(event);
+ }
+
+ /**
+ * Releases any references maintained by this part reference when its actual
+ * part becomes known (not called when it is disposed).
+ */
+ protected void releaseReferences() {
+
+ }
+
+ /* package */ void addInternalPropertyListener(IPropertyListener listener) {
+ internalPropChangeListeners.add(listener);
+ }
+
+ /* package */ void removeInternalPropertyListener(IPropertyListener listener) {
+ internalPropChangeListeners.remove(listener);
+ }
+
+ protected void fireInternalPropertyChange(int id) {
for (IPropertyListener listener : internalPropChangeListeners) {
listener.propertyChanged(this, id);
- }
- }
+ }
+ }
- /**
- * @see IWorkbenchPart
- */
- @Override
+ /**
+ * @see IWorkbenchPart
+ */
+ @Override
public void addPropertyListener(IPropertyListener listener) {
- // The properties of a disposed reference will never change, so don't
- // add listeners
- if (isDisposed()) {
- return;
- }
-
- propChangeListeners.add(listener);
- }
-
- /**
- * @see IWorkbenchPart
- */
- @Override
- public void removePropertyListener(IPropertyListener listener) {
- // Currently I'm not calling checkReference here for fear of breaking things late in 3.1, but it may
- // make sense to do so later. For now we just turn it into a NOP if the reference is disposed.
- if (isDisposed()) {
- return;
- }
- propChangeListeners.remove(listener);
- }
+ // The properties of a disposed reference will never change, so don't
+ // add listeners
+ if (isDisposed()) {
+ return;
+ }
+ propChangeListeners.add(listener);
+ }
+
+ /**
+ * @see IWorkbenchPart
+ */
+ @Override
+ public void removePropertyListener(IPropertyListener listener) {
+ // Currently I'm not calling checkReference here for fear of breaking things
+ // late in 3.1, but it may
+ // make sense to do so later. For now we just turn it into a NOP if the
+ // reference is disposed.
+ if (isDisposed()) {
+ return;
+ }
+ propChangeListeners.remove(listener);
+ }
@Override
public String getTitle() {
@@ -291,8 +292,7 @@ public abstract class WorkbenchPartReference implements IWorkbenchPartReference,
@Override
public String getTitleToolTip() {
- String toolTip = (String) part.getTransientData().get(
- IPresentationEngine.OVERRIDE_TITLE_TOOL_TIP_KEY);
+ String toolTip = (String) part.getTransientData().get(IPresentationEngine.OVERRIDE_TITLE_TOOL_TIP_KEY);
if (toolTip == null || toolTip.length() == 0)
toolTip = part.getLocalizedTooltip();
return Util.safeString(toolTip);
@@ -307,23 +307,25 @@ public abstract class WorkbenchPartReference implements IWorkbenchPartReference,
return colonIndex == -1 ? id : id.substring(0, colonIndex);
}
- /**
- * Computes a new title for the part. Subclasses may override to change the default behavior.
- *
- * @return the title for the part
- */
- protected String computeTitle() {
- return getRawTitle();
- }
-
- /**
- * Returns the unmodified title for the part, or the empty string if none
- *
- * @return the unmodified title, as set by the IWorkbenchPart. Returns the empty string if none.
- */
- protected final String getRawTitle() {
+ /**
+ * Computes a new title for the part. Subclasses may override to change the
+ * default behavior.
+ *
+ * @return the title for the part
+ */
+ protected String computeTitle() {
+ return getRawTitle();
+ }
+
+ /**
+ * Returns the unmodified title for the part, or the empty string if none
+ *
+ * @return the unmodified title, as set by the IWorkbenchPart. Returns the empty
+ * string if none.
+ */
+ protected final String getRawTitle() {
return Util.safeString(legacyPart.getTitle());
- }
+ }
@Override
public final Image getTitleImage() {
@@ -331,8 +333,7 @@ public abstract class WorkbenchPartReference implements IWorkbenchPartReference,
return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_DEF_VIEW);
}
- WorkbenchWindow wbw = (WorkbenchWindow) PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow();
+ WorkbenchWindow wbw = (WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (part != null && wbw.getModel().getRenderer() instanceof SWTPartRenderer) {
SWTPartRenderer r = (SWTPartRenderer) wbw.getModel().getRenderer();
Image image = r.getImage(part);
@@ -344,26 +345,26 @@ public abstract class WorkbenchPartReference implements IWorkbenchPartReference,
return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_DEF_VIEW);
}
- /* package */ void fireVisibilityChange() {
- fireInternalPropertyChange(INTERNAL_PROPERTY_VISIBLE);
- }
+ /* package */ void fireVisibilityChange() {
+ fireInternalPropertyChange(INTERNAL_PROPERTY_VISIBLE);
+ }
- /* package */ void fireZoomChange() {
- fireInternalPropertyChange(INTERNAL_PROPERTY_ZOOMED);
- }
+ /* package */ void fireZoomChange() {
+ fireInternalPropertyChange(INTERNAL_PROPERTY_ZOOMED);
+ }
protected void firePropertyChange(int id) {
- immediateFirePropertyChange(id);
- }
+ immediateFirePropertyChange(id);
+ }
- private void immediateFirePropertyChange(int id) {
- UIListenerLogging.logPartReferencePropertyChange(this, id);
+ private void immediateFirePropertyChange(int id) {
+ UIListenerLogging.logPartReferencePropertyChange(this, id);
for (IPropertyListener listener : propChangeListeners) {
listener.propertyChanged(legacyPart, id);
- }
+ }
- fireInternalPropertyChange(id);
- }
+ fireInternalPropertyChange(id);
+ }
public abstract PartSite getSite();
@@ -375,20 +376,19 @@ public abstract class WorkbenchPartReference implements IWorkbenchPartReference,
workbenchPart.addPropertyListener(propertyChangeListener);
if (workbenchPart instanceof IWorkbenchPart3) {
- ((IWorkbenchPart3) workbenchPart)
- .addPartPropertyListener(partPropertyChangeListener);
+ ((IWorkbenchPart3) workbenchPart).addPartPropertyListener(partPropertyChangeListener);
}
}
}
- @Override
+ @Override
public final IWorkbenchPart getPart(boolean restore) {
- if (isDisposed()) {
- return null;
- }
+ if (isDisposed()) {
+ return null;
+ }
- if (legacyPart == null) {
+ if (legacyPart == null) {
if (restore && part.getWidget() == null) {
// create the underlying client object backed by the part model
// with the rendering engine
@@ -407,14 +407,14 @@ public abstract class WorkbenchPartReference implements IWorkbenchPartReference,
legacyPart = compatibilityPart.getPart();
}
} else if (part.getObject() != null) {
- if (part.getTransientData().get(E4PartWrapper.E4_WRAPPER_KEY) instanceof E4PartWrapper) {
- return (IWorkbenchPart) part.getTransientData().get(E4PartWrapper.E4_WRAPPER_KEY);
+ if (part.getTransientData().get(E4PartWrapper.E4_WRAPPER_KEY) instanceof E4PartWrapper) {
+ return (IWorkbenchPart) part.getTransientData().get(E4PartWrapper.E4_WRAPPER_KEY);
}
- }
+ }
}
return legacyPart;
- }
+ }
public abstract IWorkbenchPart createPart() throws PartInitException;
@@ -426,85 +426,84 @@ public abstract class WorkbenchPartReference implements IWorkbenchPartReference,
// To be implemented by subclasses
}
- /**
- *
- */
+ /**
+ *
+ */
private void doDisposePart() {
if (legacyPart != null) {
- fireInternalPropertyChange(INTERNAL_PROPERTY_CLOSED);
- // Don't let exceptions in client code bring us down. Log them and continue.
- try {
+ fireInternalPropertyChange(INTERNAL_PROPERTY_CLOSED);
+ // Don't let exceptions in client code bring us down. Log them and continue.
+ try {
legacyPart.removePropertyListener(propertyChangeListener);
if (legacyPart instanceof IWorkbenchPart3) {
- ((IWorkbenchPart3) legacyPart)
- .removePartPropertyListener(partPropertyChangeListener);
- }
- } catch (Exception e) {
- WorkbenchPlugin.log(e);
- }
+ ((IWorkbenchPart3) legacyPart).removePartPropertyListener(partPropertyChangeListener);
+ }
+ } catch (Exception e) {
+ WorkbenchPlugin.log(e);
+ }
legacyPart = null;
- }
- }
+ }
+ }
- public void setPinned(boolean newPinned) {
- if (isDisposed()) {
- return;
- }
+ public void setPinned(boolean newPinned) {
+ if (isDisposed()) {
+ return;
+ }
- if (newPinned == pinned) {
- return;
- }
+ if (newPinned == pinned) {
+ return;
+ }
- pinned = newPinned;
+ pinned = newPinned;
immediateFirePropertyChange(IWorkbenchPartConstants.PROP_TITLE);
- if (pinned)
- part.getTags().add(IPresentationEngine.ADORNMENT_PIN);
- else
- part.getTags().remove(IPresentationEngine.ADORNMENT_PIN);
+ if (pinned)
+ part.getTags().add(IPresentationEngine.ADORNMENT_PIN);
+ else
+ part.getTags().remove(IPresentationEngine.ADORNMENT_PIN);
- fireInternalPropertyChange(INTERNAL_PROPERTY_PINNED);
- }
+ fireInternalPropertyChange(INTERNAL_PROPERTY_PINNED);
+ }
- public boolean isPinned() {
- return pinned;
- }
+ public boolean isPinned() {
+ return pinned;
+ }
- @Override
+ @Override
public String getPartProperty(String key) {
if (legacyPart != null) {
if (legacyPart instanceof IWorkbenchPart3) {
return ((IWorkbenchPart3) legacyPart).getPartProperty(key);
}
} else {
- return (String)propertyCache.get(key);
+ return (String) propertyCache.get(key);
}
return null;
}
- @Override
+ @Override
public void addPartPropertyListener(IPropertyChangeListener listener) {
- if (isDisposed()) {
- return;
- }
- partChangeListeners.add(listener);
- }
+ if (isDisposed()) {
+ return;
+ }
+ partChangeListeners.add(listener);
+ }
- @Override
+ @Override
public void removePartPropertyListener(IPropertyChangeListener listener) {
- if (isDisposed()) {
- return;
- }
- partChangeListeners.remove(listener);
- }
+ if (isDisposed()) {
+ return;
+ }
+ partChangeListeners.remove(listener);
+ }
- protected void firePartPropertyChange(PropertyChangeEvent event) {
+ protected void firePartPropertyChange(PropertyChangeEvent event) {
for (IPropertyChangeListener l : partChangeListeners) {
l.propertyChange(event);
}
}
- protected void createPartProperties(IWorkbenchPart3 workbenchPart) {
+ protected void createPartProperties(IWorkbenchPart3 workbenchPart) {
Iterator i = propertyCache.entrySet().iterator();
while (i.hasNext()) {
Map.Entry e = (Map.Entry) i.next();
@@ -512,26 +511,26 @@ public abstract class WorkbenchPartReference implements IWorkbenchPartReference,
}
}
- @Override
- public int computePreferredSize(boolean width, int availableParallel,
- int availablePerpendicular, int preferredResult) {
+ @Override
+ public int computePreferredSize(boolean width, int availableParallel, int availablePerpendicular,
+ int preferredResult) {
ISizeProvider sizeProvider = Adapters.adapt(legacyPart, ISizeProvider.class);
- if (sizeProvider != null) {
- return sizeProvider.computePreferredSize(width, availableParallel, availablePerpendicular, preferredResult);
- }
+ if (sizeProvider != null) {
+ return sizeProvider.computePreferredSize(width, availableParallel, availablePerpendicular, preferredResult);
+ }
- return preferredResult;
- }
+ return preferredResult;
+ }
- @Override
+ @Override
public int getSizeFlags(boolean width) {
ISizeProvider sizeProvider = Adapters.adapt(legacyPart, ISizeProvider.class);
- if (sizeProvider != null) {
- return sizeProvider.getSizeFlags(width);
- }
- return 0;
- }
+ if (sizeProvider != null) {
+ return sizeProvider.getSizeFlags(width);
+ }
+ return 0;
+ }
@Override
public IWorkbenchPage getPage() {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPlugin.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPlugin.java
index 0933faff0ff..11005a77c5a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPlugin.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPlugin.java
@@ -90,23 +90,20 @@ import org.osgi.framework.BundleListener;
import org.osgi.util.tracker.ServiceTracker;
/**
- * This class represents the TOP of the workbench UI world
- * A plugin class is effectively an application wrapper
- * for a plugin & its classes. This class should be thought
- * of as the workbench UI's application class.
+ * This class represents the TOP of the workbench UI world A plugin class is
+ * effectively an application wrapper for a plugin & its classes. This class
+ * should be thought of as the workbench UI's application class.
*
- * This class is responsible for tracking various registries
- * font, preference, graphics, dialog store.
+ * This class is responsible for tracking various registries font, preference,
+ * graphics, dialog store.
*
- * This class is explicitly referenced by the
- * workbench plugin's "plugin.xml" and places it
- * into the UI start extension point of the main
- * overall application harness
+ * This class is explicitly referenced by the workbench plugin's "plugin.xml"
+ * and places it into the UI start extension point of the main overall
+ * application harness
*
- * When is this class started?
- * When the Application
- * calls createExecutableExtension to create an executable
- * instance of our workbench class.
+ * When is this class started? When the Application calls
+ * createExecutableExtension to create an executable instance of our workbench
+ * class.
*/
public class WorkbenchPlugin extends AbstractUIPlugin {
@@ -131,70 +128,71 @@ public class WorkbenchPlugin extends AbstractUIPlugin {
private static final String BIDI_SUPPORT_OPTION = "on";//$NON-NLS-1$
private static final String BIDI_TEXTDIR_OPTION = "textDir";//$NON-NLS-1$
+ // Default instance of the receiver
+ private static WorkbenchPlugin inst;
- // Default instance of the receiver
- private static WorkbenchPlugin inst;
+ // Manager that maps resources to descriptors of editors to use
+ private EditorRegistry editorRegistry;
- // Manager that maps resources to descriptors of editors to use
- private EditorRegistry editorRegistry;
+ // Manager for the DecoratorManager
+ private DecoratorManager decoratorManager;
- // Manager for the DecoratorManager
- private DecoratorManager decoratorManager;
+ // Theme registry
+ private ThemeRegistry themeRegistry;
- // Theme registry
- private ThemeRegistry themeRegistry;
+ // Manager for working sets (IWorkingSet)
+ private WorkingSetManager workingSetManager;
- // Manager for working sets (IWorkingSet)
- private WorkingSetManager workingSetManager;
+ // Working set registry, stores working set dialogs
+ private WorkingSetRegistry workingSetRegistry;
- // Working set registry, stores working set dialogs
- private WorkingSetRegistry workingSetRegistry;
+ // The context within which this plugin was started.
+ private BundleContext bundleContext;
- // The context within which this plugin was started.
- private BundleContext bundleContext;
-
- // The set of currently starting bundles
+ // The set of currently starting bundles
private Collection<Bundle> startingBundles = new HashSet<>();
- /**
- * Global workbench ui plugin flag. Only workbench implementation is allowed to use this flag
- * All other plugins, examples, or test cases must *not* use this flag.
- */
- public static boolean DEBUG = false;
+ /**
+ * Global workbench ui plugin flag. Only workbench implementation is allowed to
+ * use this flag All other plugins, examples, or test cases must *not* use this
+ * flag.
+ */
+ public static boolean DEBUG = false;
- /**
- * The workbench plugin ID.
- *
- * @issue we should just drop this constant and use PlatformUI.PLUGIN_ID instead
- */
- public static String PI_WORKBENCH = PlatformUI.PLUGIN_ID;
+ /**
+ * The workbench plugin ID.
+ *
+ * @issue we should just drop this constant and use PlatformUI.PLUGIN_ID instead
+ */
+ public static String PI_WORKBENCH = PlatformUI.PLUGIN_ID;
- /**
- * The character used to separate preference page category ids
- */
- public static char PREFERENCE_PAGE_CATEGORY_SEPARATOR = '/';
+ /**
+ * The character used to separate preference page category ids
+ */
+ public static char PREFERENCE_PAGE_CATEGORY_SEPARATOR = '/';
- // Other data.
- private WorkbenchPreferenceManager preferenceManager;
+ // Other data.
+ private WorkbenchPreferenceManager preferenceManager;
- private ViewRegistry viewRegistry;
+ private ViewRegistry viewRegistry;
- private PerspectiveRegistry perspRegistry;
+ private PerspectiveRegistry perspRegistry;
- private ActionSetRegistry actionSetRegistry;
+ private ActionSetRegistry actionSetRegistry;
- private SharedImages sharedImages;
+ private SharedImages sharedImages;
- /**
- * Information describing the product (formerly called "primary plugin"); lazily
- * initialized.
- * @since 3.0
- */
- private ProductInfo productInfo = null;
+ /**
+ * Information describing the product (formerly called "primary plugin"); lazily
+ * initialized.
+ *
+ * @since 3.0
+ */
+ private ProductInfo productInfo = null;
- private IntroRegistry introRegistry;
+ private IntroRegistry introRegistry;
- private WorkbenchOperationSupport operationSupport;
+ private WorkbenchOperationSupport operationSupport;
private BundleListener bundleListener;
private IEclipseContext e4Context;
@@ -207,126 +205,121 @@ public class WorkbenchPlugin extends AbstractUIPlugin {
private ICommandHelpService commandHelpService;
- /**
- * Create an instance of the WorkbenchPlugin. The workbench plugin is
- * effectively the "application" for the workbench UI. The entire UI
- * operates as a good plugin citizen.
- */
- public WorkbenchPlugin() {
- super();
- inst = this;
- }
-
- /**
- * Unload all members. This can be used to run a second instance of a workbench.
- * @since 3.0
- */
- void reset() {
- editorRegistry = null;
-
- if (decoratorManager != null) {
+ /**
+ * Create an instance of the WorkbenchPlugin. The workbench plugin is
+ * effectively the "application" for the workbench UI. The entire UI operates as
+ * a good plugin citizen.
+ */
+ public WorkbenchPlugin() {
+ super();
+ inst = this;
+ }
+
+ /**
+ * Unload all members. This can be used to run a second instance of a workbench.
+ *
+ * @since 3.0
+ */
+ void reset() {
+ editorRegistry = null;
+
+ if (decoratorManager != null) {
decoratorManager.shutdown();
- decoratorManager = null;
- }
+ decoratorManager = null;
+ }
- ProgressManager.shutdownProgressManager();
+ ProgressManager.shutdownProgressManager();
- themeRegistry = null;
- if (workingSetManager != null) {
- workingSetManager.dispose();
- workingSetManager = null;
- }
- workingSetRegistry = null;
+ themeRegistry = null;
+ if (workingSetManager != null) {
+ workingSetManager.dispose();
+ workingSetManager = null;
+ }
+ workingSetRegistry = null;
- preferenceManager = null;
- if (viewRegistry != null) {
+ preferenceManager = null;
+ if (viewRegistry != null) {
// nothing to dispose for viewRegistry
- viewRegistry = null;
- }
- if (perspRegistry != null) {
- perspRegistry.dispose();
- perspRegistry = null;
- }
- actionSetRegistry = null;
- sharedImages = null;
-
- productInfo = null;
- introRegistry = null;
+ viewRegistry = null;
+ }
+ if (perspRegistry != null) {
+ perspRegistry.dispose();
+ perspRegistry = null;
+ }
+ actionSetRegistry = null;
+ sharedImages = null;
+
+ productInfo = null;
+ introRegistry = null;
helpService = null;
commandHelpService = null;
- if (operationSupport != null) {
- operationSupport.dispose();
- operationSupport = null;
- }
-
- DEBUG = false;
-
- }
-
- /**
- * Creates an extension. If the extension plugin has not
- * been loaded a busy cursor will be activated during the duration of
- * the load.
- *
- * @param element the config element defining the extension
- * @param classAttribute the name of the attribute carrying the class
- * @return the extension object
- * @throws CoreException if the extension cannot be created
- */
- public static Object createExtension(final IConfigurationElement element,
- final String classAttribute) throws CoreException {
- try {
- // If plugin has been loaded create extension.
- // Otherwise, show busy cursor then create extension.
+ if (operationSupport != null) {
+ operationSupport.dispose();
+ operationSupport = null;
+ }
+
+ DEBUG = false;
+
+ }
+
+ /**
+ * Creates an extension. If the extension plugin has not been loaded a busy
+ * cursor will be activated during the duration of the load.
+ *
+ * @param element the config element defining the extension
+ * @param classAttribute the name of the attribute carrying the class
+ * @return the extension object
+ * @throws CoreException if the extension cannot be created
+ */
+ public static Object createExtension(final IConfigurationElement element, final String classAttribute)
+ throws CoreException {
+ try {
+ // If plugin has been loaded create extension.
+ // Otherwise, show busy cursor then create extension.
if (BundleUtility.isActivated(element.getContributor().getName())) {
- return element.createExecutableExtension(classAttribute);
- }
- final Object[] ret = new Object[1];
- final CoreException[] exc = new CoreException[1];
- BusyIndicator.showWhile(null, () -> {
- try {
- ret[0] = element
- .createExecutableExtension(classAttribute);
- } catch (CoreException e) {
- exc[0] = e;
- }
+ return element.createExecutableExtension(classAttribute);
+ }
+ final Object[] ret = new Object[1];
+ final CoreException[] exc = new CoreException[1];
+ BusyIndicator.showWhile(null, () -> {
+ try {
+ ret[0] = element.createExecutableExtension(classAttribute);
+ } catch (CoreException e) {
+ exc[0] = e;
+ }
});
- if (exc[0] != null) {
+ if (exc[0] != null) {
throw exc[0];
}
- return ret[0];
-
- } catch (CoreException core) {
- throw core;
- } catch (Exception e) {
- throw new CoreException(new Status(IStatus.ERROR, PI_WORKBENCH,
- IStatus.ERROR, WorkbenchMessages.WorkbenchPlugin_extension,e));
- }
- }
-
- /**
- * Answers whether the provided element either has an attribute with the
- * given name or a child element with the given name with an attribute
- * called class.
+ return ret[0];
+
+ } catch (CoreException core) {
+ throw core;
+ } catch (Exception e) {
+ throw new CoreException(new Status(IStatus.ERROR, PI_WORKBENCH, IStatus.ERROR,
+ WorkbenchMessages.WorkbenchPlugin_extension, e));
+ }
+ }
+
+ /**
+ * Answers whether the provided element either has an attribute with the given
+ * name or a child element with the given name with an attribute called class.
*
- * @param element
- * the element to test
- * @param extensionName
- * the name of the extension to test for
+ * @param element the element to test
+ * @param extensionName the name of the extension to test for
* @return whether or not the extension is declared
* @since 3.3
*/
- public static boolean hasExecutableExtension(IConfigurationElement element,
- String extensionName) {
+ public static boolean hasExecutableExtension(IConfigurationElement element, String extensionName) {
if (element.getAttribute(extensionName) != null)
return true;
String elementText = element.getValue();
if (elementText != null && !elementText.equals("")) //$NON-NLS-1$
return true;
- IConfigurationElement [] children = element.getChildren(extensionName);
+ IConfigurationElement[] children = element.getChildren(extensionName);
if (children.length == 1) {
if (children[0].getAttribute(IWorkbenchRegistryConstants.ATT_CLASS) != null)
return true;
@@ -336,26 +329,23 @@ public class WorkbenchPlugin extends AbstractUIPlugin {
/**
* Checks to see if the provided element has the syntax for an executable
- * extension with a given name that resides in a bundle that is already
- * active. Determining the bundle happens in one of two ways:<br/>
+ * extension with a given name that resides in a bundle that is already active.
+ * Determining the bundle happens in one of two ways:<br/>
* <ul>
- * <li>The element has an attribute with the specified name or element text
- * in the form <code>bundle.id/class.name[:optional attributes]</code></li>
+ * <li>The element has an attribute with the specified name or element text in
+ * the form <code>bundle.id/class.name[:optional attributes]</code></li>
* <li>The element has a child element with the specified name that has a
* <code>plugin</code> attribute</li>
* </ul>
*
- * @param element
- * the element to test
- * @param extensionName
- * the name of the extension to test for
- * @return whether or not the bundle expressed by the above criteria is
- * active. If the bundle cannot be determined then the state of the
- * bundle that declared the element is returned.
+ * @param element the element to test
+ * @param extensionName the name of the extension to test for
+ * @return whether or not the bundle expressed by the above criteria is active.
+ * If the bundle cannot be determined then the state of the bundle that
+ * declared the element is returned.
* @since 3.3
*/
- public static boolean isBundleLoadedForExecutableExtension(
- IConfigurationElement element, String extensionName) {
+ public static boolean isBundleLoadedForExecutableExtension(IConfigurationElement element, String extensionName) {
Bundle bundle = getBundleForExecutableExtension(element, extensionName);
if (bundle == null)
@@ -367,16 +357,14 @@ public class WorkbenchPlugin extends AbstractUIPlugin {
* Returns the bundle that contains the class referenced by an executable
* extension. Determining the bundle happens in one of two ways:<br/>
* <ul>
- * <li>The element has an attribute with the specified name or element text
- * in the form <code>bundle.id/class.name[:optional attributes]</code></li>
+ * <li>The element has an attribute with the specified name or element text in
+ * the form <code>bundle.id/class.name[:optional attributes]</code></li>
* <li>The element has a child element with the specified name that has a
* <code>plugin</code> attribute</li>
* </ul>
*
- * @param element
- * the element to test
- * @param extensionName
- * the name of the extension to test for
+ * @param element the element to test
+ * @param extensionName the name of the extension to test for
* @return the bundle referenced by the extension. If that bundle cannot be
* determined the bundle that declared the element is returned. Note
* that this may be <code>null</code>.
@@ -427,7 +415,7 @@ public class WorkbenchPlugin extends AbstractUIPlugin {
return Platform.getBundle(contributorName);
}
- /**
+ /**
* Returns the image registry for this plugin.
*
* Where are the images? The images (typically gifs) are found in the same
@@ -435,138 +423,141 @@ public class WorkbenchPlugin extends AbstractUIPlugin {
*
* @see ImageRegistry
*
- * Note: The workbench uses the standard JFace ImageRegistry to track its
- * images. In addition the class WorkbenchGraphicResources provides
- * convenience access to the graphics resources and fast field access for
- * some of the commonly used graphical images.
+ * Note: The workbench uses the standard JFace ImageRegistry to track its
+ * images. In addition the class WorkbenchGraphicResources provides
+ * convenience access to the graphics resources and fast field access for
+ * some of the commonly used graphical images.
*/
- @Override
+ @Override
protected ImageRegistry createImageRegistry() {
- return WorkbenchImages.getImageRegistry();
- }
-
- /**
- * Returns the action set registry for the workbench.
- *
- * @return the workbench action set registry
- */
- public ActionSetRegistry getActionSetRegistry() {
+ return WorkbenchImages.getImageRegistry();
+ }
+
+ /**
+ * Returns the action set registry for the workbench.
+ *
+ * @return the workbench action set registry
+ */
+ public ActionSetRegistry getActionSetRegistry() {
return e4Context.get(ActionSetRegistry.class);
- }
-
- /**
- * Return the default instance of the receiver. This represents the runtime plugin.
- * @return WorkbenchPlugin
- * @see AbstractUIPlugin for the typical implementation pattern for plugin classes.
- */
- public static WorkbenchPlugin getDefault() {
- return inst;
- }
-
- /**
- * Answer the manager that maps resource types to a the
- * description of the editor to use
- * @return IEditorRegistry the editor registry used
- * by this plug-in.
- */
-
- public IEditorRegistry getEditorRegistry() {
+ }
+
+ /**
+ * Return the default instance of the receiver. This represents the runtime
+ * plugin.
+ *
+ * @return WorkbenchPlugin
+ * @see AbstractUIPlugin for the typical implementation pattern for plugin
+ * classes.
+ */
+ public static WorkbenchPlugin getDefault() {
+ return inst;
+ }
+
+ /**
+ * Answer the manager that maps resource types to a the description of the
+ * editor to use
+ *
+ * @return IEditorRegistry the editor registry used by this plug-in.
+ */
+
+ public IEditorRegistry getEditorRegistry() {
return e4Context.get(IEditorRegistry.class);
- }
-
- /**
- * Answer the element factory for an id, or <code>null</code. if not found.
- * @param targetID
- * @return IElementFactory
- */
- public IElementFactory getElementFactory(String targetID) {
-
- // Get the extension point registry.
- IExtensionPoint extensionPoint;
- extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(
- PI_WORKBENCH, IWorkbenchRegistryConstants.PL_ELEMENT_FACTORY);
-
- if (extensionPoint == null) {
- WorkbenchPlugin
- .log("Unable to find element factory. Extension point: " + IWorkbenchRegistryConstants.PL_ELEMENT_FACTORY + " not found"); //$NON-NLS-2$ //$NON-NLS-1$
- return null;
- }
-
- // Loop through the config elements.
- IConfigurationElement targetElement = null;
- IConfigurationElement[] configElements = extensionPoint
- .getConfigurationElements();
- for (IConfigurationElement configElement : configElements) {
- String strID = configElement.getAttribute("id"); //$NON-NLS-1$
- if (targetID.equals(strID)) {
- targetElement = configElement;
- break;
- }
- }
- if (targetElement == null) {
- // log it since we cannot safely display a dialog.
- WorkbenchPlugin.log("Unable to find element factory: " + targetID); //$NON-NLS-1$
- return null;
- }
-
- // Create the extension.
- IElementFactory factory = null;
- try {
- factory = (IElementFactory) createExtension(targetElement, "class"); //$NON-NLS-1$
- } catch (CoreException e) {
- // log it since we cannot safely display a dialog.
- WorkbenchPlugin.log(
- "Unable to create element factory.", e.getStatus()); //$NON-NLS-1$
- factory = null;
- }
- return factory;
- }
-
- /**
- * Return the perspective registry.
- * @return IPerspectiveRegistry. The registry for the receiver.
- */
- public IPerspectiveRegistry getPerspectiveRegistry() {
+ }
+
+ /**
+ * Answer the element factory for an id, or <code>null</code. if not found.
+ *
+ * @param targetID
+ * @return IElementFactory
+ */
+ public IElementFactory getElementFactory(String targetID) {
+
+ // Get the extension point registry.
+ IExtensionPoint extensionPoint;
+ extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(PI_WORKBENCH,
+ IWorkbenchRegistryConstants.PL_ELEMENT_FACTORY);
+
+ if (extensionPoint == null) {
+ WorkbenchPlugin.log("Unable to find element factory. Extension point: " //$NON-NLS-1$
+ + IWorkbenchRegistryConstants.PL_ELEMENT_FACTORY + " not found"); //$NON-NLS-1$
+ return null;
+ }
+
+ // Loop through the config elements.
+ IConfigurationElement targetElement = null;
+ IConfigurationElement[] configElements = extensionPoint.getConfigurationElements();
+ for (IConfigurationElement configElement : configElements) {
+ String strID = configElement.getAttribute("id"); //$NON-NLS-1$
+ if (targetID.equals(strID)) {
+ targetElement = configElement;
+ break;
+ }
+ }
+ if (targetElement == null) {
+ // log it since we cannot safely display a dialog.
+ WorkbenchPlugin.log("Unable to find element factory: " + targetID); //$NON-NLS-1$
+ return null;
+ }
+
+ // Create the extension.
+ IElementFactory factory = null;
+ try {
+ factory = (IElementFactory) createExtension(targetElement, "class"); //$NON-NLS-1$
+ } catch (CoreException e) {
+ // log it since we cannot safely display a dialog.
+ WorkbenchPlugin.log("Unable to create element factory.", e.getStatus()); //$NON-NLS-1$
+ factory = null;
+ }
+ return factory;
+ }
+
+ /**
+ * Return the perspective registry.
+ *
+ * @return IPerspectiveRegistry. The registry for the receiver.
+ */
+ public IPerspectiveRegistry getPerspectiveRegistry() {
return e4Context.get(IPerspectiveRegistry.class);
- }
-
- /**
- * Returns the working set manager
- *
- * @return the working set manager
- * @since 2.0
- */
- public IWorkingSetManager getWorkingSetManager() {
+ }
+
+ /**
+ * Returns the working set manager
+ *
+ * @return the working set manager
+ * @since 2.0
+ */
+ public IWorkingSetManager getWorkingSetManager() {
return e4Context.get(IWorkingSetManager.class);
- }
-
- /**
- * Returns the working set registry
- *
- * @return the working set registry
- * @since 2.0
- */
- public WorkingSetRegistry getWorkingSetRegistry() {
+ }
+
+ /**
+ * Returns the working set registry
+ *
+ * @return the working set registry
+ * @since 2.0
+ */
+ public WorkingSetRegistry getWorkingSetRegistry() {
return e4Context.get(WorkingSetRegistry.class);
- }
-
- /**
- * Returns the introduction registry.
- *
- * @return the introduction registry.
- * @since 3.0
- */
- public IIntroRegistry getIntroRegistry() {
+ }
+
+ /**
+ * Returns the introduction registry.
+ *
+ * @return the introduction registry.
+ * @since 3.0
+ */
+ public IIntroRegistry getIntroRegistry() {
return e4Context.get(IIntroRegistry.class);
- }
+ }
- /**
+ /**
* Returns the operation support.
*
* @return the workbench operation support.
* @since 3.1
*/
- public IWorkbenchOperationSupport getOperationSupport() {
+ public IWorkbenchOperationSupport getOperationSupport() {
IWorkbenchOperationSupport op = e4Context.get(IWorkbenchOperationSupport.class);
if (op == null) {
// we're in shutdown, but some plugins get this in their stop()
@@ -574,100 +565,100 @@ public class WorkbenchPlugin extends AbstractUIPlugin {
op = new WorkbenchOperationSupport();
}
return op;
- }
-
+ }
- /**
- * Get the preference manager.
- * @return PreferenceManager the preference manager for
- * the receiver.
- */
- public PreferenceManager getPreferenceManager() {
+ /**
+ * Get the preference manager.
+ *
+ * @return PreferenceManager the preference manager for the receiver.
+ */
+ public PreferenceManager getPreferenceManager() {
return e4Context.get(PreferenceManager.class);
- }
-
- /**
- * Returns the shared images for the workbench.
- *
- * @return the shared image manager
- */
- public ISharedImages getSharedImages() {
- if(sharedImages == null) {
- sharedImages = new SharedImages();
- }
- if(e4Context == null) {
- return sharedImages;
- }
+ }
+
+ /**
+ * Returns the shared images for the workbench.
+ *
+ * @return the shared image manager
+ */
+ public ISharedImages getSharedImages() {
+ if (sharedImages == null) {
+ sharedImages = new SharedImages();
+ }
+ if (e4Context == null) {
+ return sharedImages;
+ }
return e4Context.get(ISharedImages.class);
- }
-
- /**
- * Returns the theme registry for the workbench.
- *
- * @return the theme registry
- */
- public IThemeRegistry getThemeRegistry() {
+ }
+
+ /**
+ * Returns the theme registry for the workbench.
+ *
+ * @return the theme registry
+ */
+ public IThemeRegistry getThemeRegistry() {
return e4Context.get(IThemeRegistry.class);
- }
-
- /**
- * Answer the view registry.
- * @return IViewRegistry the view registry for the
- * receiver.
- */
- public IViewRegistry getViewRegistry() {
+ }
+
+ /**
+ * Answer the view registry.
+ *
+ * @return IViewRegistry the view registry for the receiver.
+ */
+ public IViewRegistry getViewRegistry() {
return e4Context.get(IViewRegistry.class);
- }
+ }
- /**
- * Answer the workbench.
- * @deprecated Use <code>PlatformUI.getWorkbench()</code> instead.
- */
- @Deprecated
+ /**
+ * Answer the workbench.
+ *
+ * @deprecated Use <code>PlatformUI.getWorkbench()</code> instead.
+ */
+ @Deprecated
@Override
public IWorkbench getWorkbench() {
- return PlatformUI.getWorkbench();
- }
-
- /**
- * Set default preference values.
- * This method must be called whenever the preference store is initially loaded
- * because the default values are not stored in the preference store.
- */
- @Override
+ return PlatformUI.getWorkbench();
+ }
+
+ /**
+ * Set default preference values. This method must be called whenever the
+ * preference store is initially loaded because the default values are not
+ * stored in the preference store.
+ */
+ @Override
protected void initializeDefaultPreferences(IPreferenceStore store) {
- // Do nothing. This should not be called.
- // Prefs are initialized in WorkbenchPreferenceInitializer.
- }
-
- /**
- * Logs the given message to the platform log.
- *
- * If you have an exception in hand, call log(String, Throwable) instead.
- *
- * If you have a status object in hand call log(String, IStatus) instead.
- *
- * This convenience method is for internal use by the Workbench only and
- * must not be called outside the Workbench.
- *
- * @param message
- * A high level UI message describing when the problem happened.
- */
- public static void log(String message) {
- getDefault().getLog().log(
- StatusUtil.newStatus(IStatus.ERROR, message, null));
- }
-
- /**
- * Log the throwable.
- * @param t
- */
- public static void log(Throwable t) {
+ // Do nothing. This should not be called.
+ // Prefs are initialized in WorkbenchPreferenceInitializer.
+ }
+
+ /**
+ * Logs the given message to the platform log.
+ *
+ * If you have an exception in hand, call log(String, Throwable) instead.
+ *
+ * If you have a status object in hand call log(String, IStatus) instead.
+ *
+ * This convenience method is for internal use by the Workbench only and must
+ * not be called outside the Workbench.
+ *
+ * @param message A high level UI message describing when the problem happened.
+ */
+ public static void log(String message) {
+ getDefault().getLog().log(StatusUtil.newStatus(IStatus.ERROR, message, null));
+ }
+
+ /**
+ * Log the throwable.
+ *
+ * @param t
+ */
+ public static void log(Throwable t) {
getDefault().getLog().log(getStatus(t));
}
/**
* Return the status from throwable
+ *
* @param t throwable
* @return IStatus
*/
@@ -678,8 +669,8 @@ public class WorkbenchPlugin extends AbstractUIPlugin {
}
/**
- * Create a new error from the message and the
- * throwable.
+ * Create a new error from the message and the throwable.
+ *
* @param message
* @param t
* @return IStatus
@@ -696,123 +687,116 @@ public class WorkbenchPlugin extends AbstractUIPlugin {
errorCode = ce.getStatus().getCode();
}
- return new Status(IStatus.ERROR, pluginId, errorCode, message,
- StatusUtil.getCause(t));
+ return new Status(IStatus.ERROR, pluginId, errorCode, message, StatusUtil.getCause(t));
}
- /**
+ /**
* Logs the given message and throwable to the platform log.
*
* If you have a status object in hand call log(String, IStatus) instead.
*
- * This convenience method is for internal use by the Workbench only and
- * must not be called outside the Workbench.
+ * This convenience method is for internal use by the Workbench only and must
+ * not be called outside the Workbench.
*
- * @param message
- * A high level UI message describing when the problem happened.
- * @param t
- * The throwable from where the problem actually occurred.
+ * @param message A high level UI message describing when the problem happened.
+ * @param t The throwable from where the problem actually occurred.
+ */
+ public static void log(String message, Throwable t) {
+ IStatus status = StatusUtil.newStatus(IStatus.ERROR, message, t);
+ log(message, status);
+ }
+
+ /**
+ * Logs the given throwable to the platform log, indicating the class and method
+ * from where it is being logged (this is not necessarily where it occurred).
+ *
+ * This convenience method is for internal use by the Workbench only and must
+ * not be called outside the Workbench.
+ *
+ * @param clazz The calling class.
+ * @param methodName The calling method name.
+ * @param t The throwable from where the problem actually occurred.
*/
- public static void log(String message, Throwable t) {
- IStatus status = StatusUtil.newStatus(IStatus.ERROR, message, t);
- log(message, status);
- }
-
- /**
- * Logs the given throwable to the platform log, indicating the class and
- * method from where it is being logged (this is not necessarily where it
- * occurred).
- *
- * This convenience method is for internal use by the Workbench only and
- * must not be called outside the Workbench.
- *
- * @param clazz
- * The calling class.
- * @param methodName
- * The calling method name.
- * @param t
- * The throwable from where the problem actually occurred.
- */
- public static void log(Class clazz, String methodName, Throwable t) {
- String msg = MessageFormat.format("Exception in {0}.{1}: {2}", //$NON-NLS-1$
+ public static void log(Class clazz, String methodName, Throwable t) {
+ String msg = MessageFormat.format("Exception in {0}.{1}: {2}", //$NON-NLS-1$
clazz.getName(), methodName, t);
- log(msg, t);
- }
-
- /**
- * Logs the given message and status to the platform log.
- *
- * This convenience method is for internal use by the Workbench only and
- * must not be called outside the Workbench.
- *
- * @param message
- * A high level UI message describing when the problem happened.
- * May be <code>null</code>.
- * @param status
- * The status describing the problem. Must not be null.
- */
- public static void log(String message, IStatus status) {
-
- //1FTUHE0: ITPCORE:ALL - API - Status & logging - loss of semantic info
+ log(msg, t);
+ }
+
+ /**
+ * Logs the given message and status to the platform log.
+ *
+ * This convenience method is for internal use by the Workbench only and must
+ * not be called outside the Workbench.
+ *
+ * @param message A high level UI message describing when the problem happened.
+ * May be <code>null</code>.
+ * @param status The status describing the problem. Must not be null.
+ */
+ public static void log(String message, IStatus status) {
+
+ // 1FTUHE0: ITPCORE:ALL - API - Status & logging - loss of semantic info
// Combine message and status into a MultiStatus to avoid losing
// context, but avoid creating the MultiStatus unnecessarily if message
// is the same
if (message != null && !message.equals(status.getMessage())) {
status = StatusUtil.newStatus(Collections.singletonList(status), message, null);
- }
+ }
getDefault().getLog().log(status);
- }
-
- /**
- * Log the status to the default log.
- * @param status
- */
- public static void log(IStatus status) {
- getDefault().getLog().log(status);
- }
-
- /**
- * Get the decorator manager for the receiver
- * @return DecoratorManager the decorator manager
- * for the receiver.
- */
- public DecoratorManager getDecoratorManager() {
+ }
+
+ /**
+ * Log the status to the default log.
+ *
+ * @param status
+ */
+ public static void log(IStatus status) {
+ getDefault().getLog().log(status);
+ }
+
+ /**
+ * Get the decorator manager for the receiver
+ *
+ * @return DecoratorManager the decorator manager for the receiver.
+ */
+ public DecoratorManager getDecoratorManager() {
return (DecoratorManager) e4Context.get(IDecoratorManager.class);
- }
+ }
- @Override
+ @Override
public void start(BundleContext context) throws Exception {
- context.addBundleListener(getBundleListener());
- super.start(context);
- bundleContext = context;
+ context.addBundleListener(getBundleListener());
+ super.start(context);
+ bundleContext = context;
- JFaceUtil.initializeJFace();
+ JFaceUtil.initializeJFace();
parseBidiArguments();
Window.setDefaultOrientation(getDefaultOrientation());
- // The UI plugin needs to be initialized so that it can install the callback in PrefUtil,
- // which needs to be done as early as possible, before the workbench
- // accesses any API preferences.
- Bundle uiBundle = Platform.getBundle(PlatformUI.PLUGIN_ID);
- try {
- // Attempt to load the activator of the ui bundle. This will force lazy start
- // of the ui bundle. Using the bundle activator class here because it is a
- // class that needs to be loaded anyway so it should not cause extra classes
- // to be loaded.s
- if(uiBundle != null)
- uiBundle.start(Bundle.START_TRANSIENT);
- } catch (BundleException e) {
- WorkbenchPlugin.log("Unable to load UI activator", e); //$NON-NLS-1$
- }
+ // The UI plugin needs to be initialized so that it can install the callback in
+ // PrefUtil,
+ // which needs to be done as early as possible, before the workbench
+ // accesses any API preferences.
+ Bundle uiBundle = Platform.getBundle(PlatformUI.PLUGIN_ID);
+ try {
+ // Attempt to load the activator of the ui bundle. This will force lazy start
+ // of the ui bundle. Using the bundle activator class here because it is a
+ // class that needs to be loaded anyway so it should not cause extra classes
+ // to be loaded.s
+ if (uiBundle != null)
+ uiBundle.start(Bundle.START_TRANSIENT);
+ } catch (BundleException e) {
+ WorkbenchPlugin.log("Unable to load UI activator", e); //$NON-NLS-1$
+ }
/*
- * DO NOT RUN ANY OTHER CODE AFTER THIS LINE. If you do, then you are
- * likely to cause a deadlock in class loader code. Please see Bug 86450
- * for more information.
+ * DO NOT RUN ANY OTHER CODE AFTER THIS LINE. If you do, then you are likely to
+ * cause a deadlock in class loader code. Please see Bug 86450 for more
+ * information.
*/
- }
+ }
/**
* Read the -bidi option from the command line arguments. The valid values /
@@ -827,16 +811,16 @@ public class WorkbenchPlugin extends AbstractUIPlugin {
* <li>The order of parameters under the <code>-bidi</code> switch is
* arbitrary.</li>
* <li>The presence of any parameter is not mandatory.</li>
- * <li>If any of the parameters is not specified, the default value is
- * assumed. Defaults:
+ * <li>If any of the parameters is not specified, the default value is assumed.
+ * Defaults:
* <ul>
* <li>on: n</li>
* <li>textDir: no default value</li>
* </ul>
* </li>
- * <li>If no value (or an illegal value) is provided for handling of base
- * text direction functionality, then bidi support is turned off and no
- * handling occurs.</li>
+ * <li>If no value (or an illegal value) is provided for handling of base text
+ * direction functionality, then bidi support is turned off and no handling
+ * occurs.</li>
* </ul>
*/
private void parseBidiArguments() {
@@ -870,37 +854,36 @@ public class WorkbenchPlugin extends AbstractUIPlugin {
}
/**
- * Get the default orientation from the command line arguments. If there are
- * no arguments imply the orientation.
+ * Get the default orientation from the command line arguments. If there are no
+ * arguments imply the orientation.
*
* @return int
* @see SWT#NONE
* @see SWT#RIGHT_TO_LEFT
* @see SWT#LEFT_TO_RIGHT
*/
- private int getDefaultOrientation() {
+ private int getDefaultOrientation() {
String[] commandLineArgs = Platform.getCommandLineArgs();
int orientation = getCommandLineOrientation(commandLineArgs);
- if(orientation != SWT.NONE) {
+ if (orientation != SWT.NONE) {
return orientation;
}
orientation = getSystemPropertyOrientation();
- if(orientation != SWT.NONE) {
+ if (orientation != SWT.NONE) {
return orientation;
}
- return checkCommandLineLocale(); //Use the default value if there is nothing specified
+ return checkCommandLineLocale(); // Use the default value if there is nothing specified
}
/**
- * Check whether the workbench messages are in a Bidi language. This method
- * will return <code>null</code> if it is unable to determine message
- * properties.
+ * Check whether the workbench messages are in a Bidi language. This method will
+ * return <code>null</code> if it is unable to determine message properties.
*/
private Boolean isBidiMessageText() {
// Check if the user installed the NLS packs for bidi
@@ -911,8 +894,7 @@ public class WorkbenchPlugin extends AbstractUIPlugin {
try {
// use qualified class name to avoid import statement
// and premature attempt to resolve class reference
- boolean isBidi = com.ibm.icu.text.Bidi.requiresBidi(message.toCharArray(), 0,
- message.length());
+ boolean isBidi = com.ibm.icu.text.Bidi.requiresBidi(message.toCharArray(), 0, message.length());
return Boolean.valueOf(isBidi);
} catch (NoClassDefFoundError e) {
// the ICU Base bundle used in place of ICU?
@@ -921,17 +903,15 @@ public class WorkbenchPlugin extends AbstractUIPlugin {
}
/**
- * Check to see if the command line parameter for -nl
- * has been set. If so imply the orientation from this
- * specified Locale. If it is a bidirectional Locale
- * return SWT#RIGHT_TO_LEFT.
- * If it has not been set or has been set to
- * a unidirectional Locale then return SWT#NONE.
+ * Check to see if the command line parameter for -nl has been set. If so imply
+ * the orientation from this specified Locale. If it is a bidirectional Locale
+ * return SWT#RIGHT_TO_LEFT. If it has not been set or has been set to a
+ * unidirectional Locale then return SWT#NONE.
*
- * Locale is determined differently by different JDKs
- * and may not be consistent with the users expectations.
+ * Locale is determined differently by different JDKs and may not be consistent
+ * with the users expectations.
*
-
+ *
* @return int
* @see SWT#NONE
* @see SWT#RIGHT_TO_LEFT
@@ -958,9 +938,9 @@ public class WorkbenchPlugin extends AbstractUIPlugin {
}
/**
- * Check to see if the orientation was set in the
- * system properties. If there is no orientation
- * specified return SWT#NONE.
+ * Check to see if the orientation was set in the system properties. If there is
+ * no orientation specified return SWT#NONE.
+ *
* @return int
* @see SWT#NONE
* @see SWT#RIGHT_TO_LEFT
@@ -968,18 +948,19 @@ public class WorkbenchPlugin extends AbstractUIPlugin {
*/
private int getSystemPropertyOrientation() {
String orientation = System.getProperty(ORIENTATION_PROPERTY);
- if(RIGHT_TO_LEFT.equals(orientation)) {
+ if (RIGHT_TO_LEFT.equals(orientation)) {
return SWT.RIGHT_TO_LEFT;
}
- if(LEFT_TO_RIGHT.equals(orientation)) {
+ if (LEFT_TO_RIGHT.equals(orientation)) {
return SWT.LEFT_TO_RIGHT;
}
return SWT.NONE;
}
/**
- * Find the orientation in the commandLineArgs. If there
- * is no orientation specified return SWT#NONE.
+ * Find the orientation in the commandLineArgs. If there is no orientation
+ * specified return SWT#NONE.
+ *
* @param commandLineArgs
* @return int
* @see SWT#NONE
@@ -987,16 +968,16 @@ public class WorkbenchPlugin extends AbstractUIPlugin {
* @see SWT#LEFT_TO_RIGHT
*/
private int getCommandLineOrientation(String[] commandLineArgs) {
- //Do not process the last one as it will never have a parameter
+ // Do not process the last one as it will never have a parameter
for (int i = 0; i < commandLineArgs.length - 1; i++) {
- if(commandLineArgs[i].equalsIgnoreCase(ORIENTATION_COMMAND_LINE)){
- String orientation = commandLineArgs[i+1];
- if(orientation.equals(RIGHT_TO_LEFT)){
- System.setProperty(ORIENTATION_PROPERTY,RIGHT_TO_LEFT);
+ if (commandLineArgs[i].equalsIgnoreCase(ORIENTATION_COMMAND_LINE)) {
+ String orientation = commandLineArgs[i + 1];
+ if (orientation.equals(RIGHT_TO_LEFT)) {
+ System.setProperty(ORIENTATION_PROPERTY, RIGHT_TO_LEFT);
return SWT.RIGHT_TO_LEFT;
}
- if(orientation.equals(LEFT_TO_RIGHT)){
- System.setProperty(ORIENTATION_PROPERTY,LEFT_TO_RIGHT);
+ if (orientation.equals(LEFT_TO_RIGHT)) {
+ System.setProperty(ORIENTATION_PROPERTY, LEFT_TO_RIGHT);
return SWT.LEFT_TO_RIGHT;
}
}
@@ -1006,82 +987,81 @@ public class WorkbenchPlugin extends AbstractUIPlugin {
}
/**
- * Return an array of all bundles contained in this workbench.
- *
- * @return an array of bundles in the workbench or an empty array if none
- * @since 3.0
- */
- public Bundle[] getBundles() {
- return bundleContext == null ? new Bundle[0] : bundleContext
- .getBundles();
- }
-
- /**
- * Returns the bundle context associated with the workbench plug-in.
- *
- * @return the bundle context
- * @since 3.1
- */
- public BundleContext getBundleContext() {
- return bundleContext;
- }
-
- /**
- * Returns the application name.
- * <p>
- * Note this is never shown to the user.
- * It is used to initialize the SWT Display.
- * On Motif, for example, this can be used
- * to set the name used for resource lookup.
- * </p>
- *
- * @return the application name, or <code>null</code>
- * @see org.eclipse.swt.widgets.Display#setAppName
- * @since 3.0
- */
- public String getAppName() {
- return getProductInfo().getAppName();
- }
-
- /**
- * Returns the name of the product.
- *
- * @return the product name, or <code>null</code> if none
- * @since 3.0
- */
- public String getProductName() {
- return getProductInfo().getProductName();
- }
-
- /**
- * Returns the image descriptors for the window image to use for this product.
- *
- * @return an array of the image descriptors for the window image, or
- * <code>null</code> if none
- * @since 3.0
- */
- public ImageDescriptor[] getWindowImages() {
- return getProductInfo().getWindowImages();
- }
-
- /**
- * Returns an instance that describes this plugin's product (formerly "primary
- * plugin").
- * @return ProductInfo the product info for the receiver
- */
- private ProductInfo getProductInfo() {
- if (productInfo == null) {
+ * Return an array of all bundles contained in this workbench.
+ *
+ * @return an array of bundles in the workbench or an empty array if none
+ * @since 3.0
+ */
+ public Bundle[] getBundles() {
+ return bundleContext == null ? new Bundle[0] : bundleContext.getBundles();
+ }
+
+ /**
+ * Returns the bundle context associated with the workbench plug-in.
+ *
+ * @return the bundle context
+ * @since 3.1
+ */
+ public BundleContext getBundleContext() {
+ return bundleContext;
+ }
+
+ /**
+ * Returns the application name.
+ * <p>
+ * Note this is never shown to the user. It is used to initialize the SWT
+ * Display. On Motif, for example, this can be used to set the name used for
+ * resource lookup.
+ * </p>
+ *
+ * @return the application name, or <code>null</code>
+ * @see org.eclipse.swt.widgets.Display#setAppName
+ * @since 3.0
+ */
+ public String getAppName() {
+ return getProductInfo().getAppName();
+ }
+
+ /**
+ * Returns the name of the product.
+ *
+ * @return the product name, or <code>null</code> if none
+ * @since 3.0
+ */
+ public String getProductName() {
+ return getProductInfo().getProductName();
+ }
+
+ /**
+ * Returns the image descriptors for the window image to use for this product.
+ *
+ * @return an array of the image descriptors for the window image, or
+ * <code>null</code> if none
+ * @since 3.0
+ */
+ public ImageDescriptor[] getWindowImages() {
+ return getProductInfo().getWindowImages();
+ }
+
+ /**
+ * Returns an instance that describes this plugin's product (formerly "primary
+ * plugin").
+ *
+ * @return ProductInfo the product info for the receiver
+ */
+ private ProductInfo getProductInfo() {
+ if (productInfo == null) {
productInfo = new ProductInfo(Platform.getProduct());
}
- return productInfo;
- }
+ return productInfo;
+ }
- @Override
+ @Override
public void stop(BundleContext context) throws Exception {
- if (bundleListener!=null) {
- context.removeBundleListener(bundleListener);
- bundleListener = null;
- }
+ if (bundleListener != null) {
+ context.removeBundleListener(bundleListener);
+ bundleListener = null;
+ }
if (debugTracker != null) {
debugTracker.close();
debugTracker = null;
@@ -1090,60 +1070,60 @@ public class WorkbenchPlugin extends AbstractUIPlugin {
testableTracker.close();
testableTracker = null;
}
- super.stop(context);
- }
-
- /**
- * Return the new wizard registry.
- *
- * @return the new wizard registry
- * @since 3.1
- */
- public IWizardRegistry getNewWizardRegistry() {
+ super.stop(context);
+ }
+
+ /**
+ * Return the new wizard registry.
+ *
+ * @return the new wizard registry
+ * @since 3.1
+ */
+ public IWizardRegistry getNewWizardRegistry() {
return e4Context.get(NewWizardRegistry.class);
- }
-
- /**
- * Return the import wizard registry.
- *
- * @return the import wizard registry
- * @since 3.1
- */
- public IWizardRegistry getImportWizardRegistry() {
+ }
+
+ /**
+ * Return the import wizard registry.
+ *
+ * @return the import wizard registry
+ * @since 3.1
+ */
+ public IWizardRegistry getImportWizardRegistry() {
return e4Context.get(ImportWizardRegistry.class);
- }
-
- /**
- * Return the export wizard registry.
- *
- * @return the export wizard registry
- * @since 3.1
- */
- public IWizardRegistry getExportWizardRegistry() {
+ }
+
+ /**
+ * Return the export wizard registry.
+ *
+ * @return the export wizard registry
+ * @since 3.1
+ */
+ public IWizardRegistry getExportWizardRegistry() {
return e4Context.get(ExportWizardRegistry.class);
- }
-
- /**
- * FOR INTERNAL WORKBENCH USE ONLY.
- *
- * Returns the path to a location in the file system that can be used
- * to persist/restore state between workbench invocations.
- * If the location did not exist prior to this call it will be created.
- * Returns <code>null</code> if no such location is available.
- *
- * @return path to a location in the file system where this plug-in can
- * persist data between sessions, or <code>null</code> if no such
- * location is available.
- * @since 3.1
- */
- public IPath getDataLocation() {
- try {
- return getStateLocation();
- } catch (IllegalStateException e) {
+ }
+
+ /**
+ * FOR INTERNAL WORKBENCH USE ONLY.
+ *
+ * Returns the path to a location in the file system that can be used to
+ * persist/restore state between workbench invocations. If the location did not
+ * exist prior to this call it will be created. Returns <code>null</code> if no
+ * such location is available.
+ *
+ * @return path to a location in the file system where this plug-in can persist
+ * data between sessions, or <code>null</code> if no such location is
+ * available.
+ * @since 3.1
+ */
+ public IPath getDataLocation() {
+ try {
+ return getStateLocation();
+ } catch (IllegalStateException e) {
// This occurs if -data=@none is explicitly specified, so return null
- return null;
- }
- }
+ return null;
+ }
+ }
/* package */ void addBundleListener(BundleListener bundleListener) {
bundleContext.addBundleListener(bundleListener);
@@ -1173,15 +1153,15 @@ public class WorkbenchPlugin extends AbstractUIPlugin {
// when it enters STARTING and STARTING when it exists STARTING :-)
synchronized (startingBundles) {
switch (eventType) {
- case BundleEvent.STARTING :
- startingBundles.add(event.getBundle());
- break;
- case BundleEvent.STARTED :
- case BundleEvent.STOPPED :
- startingBundles.remove(event.getBundle());
- break;
- default :
- break;
+ case BundleEvent.STARTING:
+ startingBundles.add(event.getBundle());
+ break;
+ case BundleEvent.STARTED:
+ case BundleEvent.STOPPED:
+ startingBundles.remove(event.getBundle());
+ break;
+ default:
+ break;
}
}
}
@@ -1193,9 +1173,11 @@ public class WorkbenchPlugin extends AbstractUIPlugin {
}
/**
- * Return whether or not the OSGi framework has specified the handle of a splash shell.
+ * Return whether or not the OSGi framework has specified the handle of a splash
+ * shell.
*
- * @return whether or not the OSGi framework has specified the handle of a splash shell
+ * @return whether or not the OSGi framework has specified the handle of a
+ * splash shell
* @since 3.4
*/
public static boolean isSplashHandleSpecified() {
@@ -1203,13 +1185,11 @@ public class WorkbenchPlugin extends AbstractUIPlugin {
}
/**
- * Get the splash shell for this workbench instance, if any. This will find
- * the splash created by the launcher (native) code and wrap it in a SWT
- * shell. This may have the side effect of setting data on the provided
- * {@link Display}.
+ * Get the splash shell for this workbench instance, if any. This will find the
+ * splash created by the launcher (native) code and wrap it in a SWT shell. This
+ * may have the side effect of setting data on the provided {@link Display}.
*
- * @param display
- * the display to parent the shell on
+ * @param display the display to parent the shell on
*
* @return the splash shell or <code>null</code>
* @throws InvocationTargetException
@@ -1220,8 +1200,7 @@ public class WorkbenchPlugin extends AbstractUIPlugin {
* @since 3.4
*/
public static Shell getSplashShell(Display display)
- throws NumberFormatException, IllegalArgumentException,
- IllegalAccessException, InvocationTargetException {
+ throws NumberFormatException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
Shell splashShell = (Shell) display.getData(DATA_SPLASH_SHELL);
if (splashShell != null)
return splashShell;
@@ -1254,11 +1233,10 @@ public class WorkbenchPlugin extends AbstractUIPlugin {
}
/**
- * Removes any splash shell data set on the provided display and disposes
- * the shell if necessary.
+ * Removes any splash shell data set on the provided display and disposes the
+ * shell if necessary.
*
- * @param display
- * the display to parent the shell on
+ * @param display the display to parent the shell on
* @since 3.4
*/
public static void unsetSplashShell(Display display) {
@@ -1273,6 +1251,7 @@ public class WorkbenchPlugin extends AbstractUIPlugin {
/**
* Initialized the workbench plug-in with the e4 context
+ *
* @param context the e4 context
*/
public void initializeContext(IEclipseContext context) {
@@ -1282,8 +1261,7 @@ public class WorkbenchPlugin extends AbstractUIPlugin {
@Override
public Object compute(IEclipseContext context, String contextKey) {
if (perspRegistry == null) {
- perspRegistry = ContextInjectionFactory.make(
- PerspectiveRegistry.class, e4Context);
+ perspRegistry = ContextInjectionFactory.make(PerspectiveRegistry.class, e4Context);
}
return perspRegistry;
}
@@ -1293,8 +1271,7 @@ public class WorkbenchPlugin extends AbstractUIPlugin {
@Override
public Object compute(IEclipseContext context, String contextKey) {
if (viewRegistry == null) {
- viewRegistry = ContextInjectionFactory.make(ViewRegistry.class,
- e4Context);
+ viewRegistry = ContextInjectionFactory.make(ViewRegistry.class, e4Context);
}
return viewRegistry;
}
@@ -1357,12 +1334,10 @@ public class WorkbenchPlugin extends AbstractUIPlugin {
@Override
public Object compute(IEclipseContext context, String contextKey) {
if (preferenceManager == null) {
- preferenceManager = new WorkbenchPreferenceManager(
- PREFERENCE_PAGE_CATEGORY_SEPARATOR);
+ preferenceManager = new WorkbenchPreferenceManager(PREFERENCE_PAGE_CATEGORY_SEPARATOR);
// Get the pages from the registry
- PreferencePageRegistryReader registryReader = new PreferencePageRegistryReader(
- getWorkbench());
+ PreferencePageRegistryReader registryReader = new PreferencePageRegistryReader(getWorkbench());
registryReader.loadFromRegistry(Platform.getExtensionRegistry());
preferenceManager.addPages(registryReader.getTopLevelNodes());
@@ -1433,8 +1408,7 @@ public class WorkbenchPlugin extends AbstractUIPlugin {
@Override
public Object compute(IEclipseContext context, String contextKey) {
if (commandHelpService == null) {
- commandHelpService = ContextInjectionFactory.make(CommandHelpServiceImpl.class,
- e4Context);
+ commandHelpService = ContextInjectionFactory.make(CommandHelpServiceImpl.class, e4Context);
}
return commandHelpService;
}
@@ -1454,17 +1428,16 @@ public class WorkbenchPlugin extends AbstractUIPlugin {
return (DebugOptions) debugTracker.getService();
}
-
/**
- * Returns a {@link TestableObject} provided by a TestableObject
- * service or <code>null</code> if a service implementation cannot
- * be found. The TestableObject is used to hook tests into the
- * application lifecycle.
+ * Returns a {@link TestableObject} provided by a TestableObject service or
+ * <code>null</code> if a service implementation cannot be found. The
+ * TestableObject is used to hook tests into the application lifecycle.
* <p>
- * It is recommended the testable object is obtained via service
- * over {@link Workbench#getWorkbenchTestable()} to avoid the
- * tests having a dependency on the Workbench.
+ * It is recommended the testable object is obtained via service over
+ * {@link Workbench#getWorkbenchTestable()} to avoid the tests having a
+ * dependency on the Workbench.
* </p>
+ *
* @see PlatformUI#getTestableObject()
* @return TestableObject provided via service or <code>null</code>
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPreferenceInitializer.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPreferenceInitializer.java
index 0735d400e60..8ff2141909f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPreferenceInitializer.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPreferenceInitializer.java
@@ -45,20 +45,16 @@ import org.osgi.service.prefs.BackingStoreException;
*/
public class WorkbenchPreferenceInitializer extends AbstractPreferenceInitializer {
-
-
@Override
public void initializeDefaultPreferences() {
IScopeContext context = DefaultScope.INSTANCE;
- IEclipsePreferences node = context.getNode(WorkbenchPlugin
- .getDefault().getBundle().getSymbolicName());
+ IEclipsePreferences node = context.getNode(WorkbenchPlugin.getDefault().getBundle().getSymbolicName());
node.putBoolean(IPreferenceConstants.RUN_IN_BACKGROUND, true);
node.putBoolean(IPreferenceConstants.SHOULD_PROMPT_FOR_ENABLEMENT, true);
node.putBoolean(IPreferenceConstants.EDITORLIST_PULLDOWN_ACTIVE, false);
- node.putBoolean(IPreferenceConstants.EDITORLIST_DISPLAY_FULL_NAME,
- false);
+ node.putBoolean(IPreferenceConstants.EDITORLIST_DISPLAY_FULL_NAME, false);
node.putBoolean(IPreferenceConstants.STICKY_CYCLE, false);
node.putBoolean(IPreferenceConstants.REUSE_EDITORS_BOOLEAN, false);
node.putInt(IPreferenceConstants.REUSE_EDITORS, 8);
@@ -80,14 +76,12 @@ public class WorkbenchPreferenceInitializer extends AbstractPreferenceInitialize
node.putBoolean(IPreferenceConstants.PERSPECTIVEBAR_VISIBLE, true);
node.putInt(IPreferenceConstants.EDITOR_TAB_WIDTH, 3); // high
- node.putInt(IPreferenceConstants.OPEN_PERSP_MODE,
- IPreferenceConstants.OPM_ACTIVE_PAGE);
+ node.putInt(IPreferenceConstants.OPEN_PERSP_MODE, IPreferenceConstants.OPM_ACTIVE_PAGE);
node.put(IPreferenceConstants.ENABLED_DECORATORS, ""); //$NON-NLS-1$
- node.putInt(IPreferenceConstants.EDITORLIST_SELECTION_SCOPE,
- IPreferenceConstants.EDITORLIST_SET_PAGE_SCOPE); // Current
- // Window
- node.putInt(IPreferenceConstants.EDITORLIST_SORT_CRITERIA,
- IPreferenceConstants.EDITORLIST_NAME_SORT); // Name Sort
+ node.putInt(IPreferenceConstants.EDITORLIST_SELECTION_SCOPE, IPreferenceConstants.EDITORLIST_SET_PAGE_SCOPE); // Current
+ // Window
+ node.putInt(IPreferenceConstants.EDITORLIST_SORT_CRITERIA, IPreferenceConstants.EDITORLIST_NAME_SORT); // Name
+ // Sort
node.putBoolean(IPreferenceConstants.COLOR_ICONS, true);
node.putInt(IPreferenceConstants.KEYS_PREFERENCE_SELECTED_TAB, 0);
node.putBoolean(IPreferenceConstants.MULTI_KEY_ASSIST, true);
@@ -101,7 +95,7 @@ public class WorkbenchPreferenceInitializer extends AbstractPreferenceInitialize
node.putBoolean("ENABLE_COOL_BARS", true); //$NON-NLS-1$
// Temporary option to enable new menu organization
node.putBoolean("ENABLE_NEW_MENUS", true); //$NON-NLS-1$
- //Temporary option to turn off the dialog font
+ // Temporary option to turn off the dialog font
node.putBoolean("DISABLE_DIALOG_FONT", false); //$NON-NLS-1$
// Heap status preferences
@@ -125,22 +119,18 @@ public class WorkbenchPreferenceInitializer extends AbstractPreferenceInitialize
// Progress view
node.putInt(IPreferenceConstants.MAX_PROGRESS_ENTRIES, 20);
- IEclipsePreferences rootNode = (IEclipsePreferences) Platform
- .getPreferencesService().getRootNode()
+ IEclipsePreferences rootNode = (IEclipsePreferences) Platform.getPreferencesService().getRootNode()
.node(InstanceScope.SCOPE);
- final String workbenchName = WorkbenchPlugin.getDefault().getBundle()
- .getSymbolicName();
+ final String workbenchName = WorkbenchPlugin.getDefault().getBundle().getSymbolicName();
try {
if (rootNode.nodeExists(workbenchName)) {
((IEclipsePreferences) rootNode.node(workbenchName))
- .addPreferenceChangeListener(PlatformUIPreferenceListener
- .getSingleton());
+ .addPreferenceChangeListener(PlatformUIPreferenceListener.getSingleton());
}
} catch (BackingStoreException e) {
- IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin
- .getDefault().getBundle().getSymbolicName(), IStatus.ERROR,
- e.getLocalizedMessage(), e);
+ IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.getDefault().getBundle().getSymbolicName(),
+ IStatus.ERROR, e.getLocalizedMessage(), e);
WorkbenchPlugin.getDefault().getLog().log(status);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchSupportFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchSupportFactory.java
index 0472b8faee9..9eb2f4eda57 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchSupportFactory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchSupportFactory.java
@@ -36,11 +36,9 @@ import org.eclipse.ui.services.IServiceLocator;
public class WorkbenchSupportFactory extends AbstractServiceFactory {
@Override
- public Object create(Class serviceInterface, IServiceLocator parentLocator,
- IServiceLocator locator) {
+ public Object create(Class serviceInterface, IServiceLocator parentLocator, IServiceLocator locator) {
- IWorkbenchLocationService wls = locator
- .getService(IWorkbenchLocationService.class);
+ IWorkbenchLocationService wls = locator.getService(IWorkbenchLocationService.class);
final IWorkbench wb = wls.getWorkbench();
if (wb == null) {
return null;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java
index be5e728bf81..5fcf2a6f28e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java
@@ -206,6 +206,7 @@ import org.eclipse.ui.services.IServiceScopes;
import org.eclipse.ui.views.IViewDescriptor;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventHandler;
+
/**
* A window within the workbench.
*/
@@ -288,9 +289,9 @@ public class WorkbenchWindow implements IWorkbenchWindow {
}
/**
- * The map of services maintained by the workbench window. These services
- * are initialized when the workbench window is being constructed by
- * dependency injection.
+ * The map of services maintained by the workbench window. These services are
+ * initialized when the workbench window is being constructed by dependency
+ * injection.
*/
private ServiceLocator serviceLocator;
@@ -408,8 +409,8 @@ public class WorkbenchWindow implements IWorkbenchWindow {
public static final int SHOW_VIEW_SUBMENU = 0x01;
/**
- * Constant (bit mask) indicating which the Open Perspective submenu is
- * probably present somewhere in this window.
+ * Constant (bit mask) indicating which the Open Perspective submenu is probably
+ * present somewhere in this window.
*
* @see #addSubmenu
* @since 3.0
@@ -428,11 +429,10 @@ public class WorkbenchWindow implements IWorkbenchWindow {
/**
* Remembers that this window contains the given submenu.
*
- * @param type
- * the type of submenu, one of: {@link #NEW_WIZARD_SUBMENU
- * NEW_WIZARD_SUBMENU}, {@link #OPEN_PERSPECTIVE_SUBMENU
- * OPEN_PERSPECTIVE_SUBMENU}, {@link #SHOW_VIEW_SUBMENU
- * SHOW_VIEW_SUBMENU}
+ * @param type the type of submenu, one of: {@link #NEW_WIZARD_SUBMENU
+ * NEW_WIZARD_SUBMENU}, {@link #OPEN_PERSPECTIVE_SUBMENU
+ * OPEN_PERSPECTIVE_SUBMENU}, {@link #SHOW_VIEW_SUBMENU
+ * SHOW_VIEW_SUBMENU}
* @see #containsSubmenu
* @since 3.0
*/
@@ -443,11 +443,10 @@ public class WorkbenchWindow implements IWorkbenchWindow {
/**
* Checks to see if this window contains the given type of submenu.
*
- * @param type
- * the type of submenu, one of: {@link #NEW_WIZARD_SUBMENU
- * NEW_WIZARD_SUBMENU}, {@link #OPEN_PERSPECTIVE_SUBMENU
- * OPEN_PERSPECTIVE_SUBMENU}, {@link #SHOW_VIEW_SUBMENU
- * SHOW_VIEW_SUBMENU}
+ * @param type the type of submenu, one of: {@link #NEW_WIZARD_SUBMENU
+ * NEW_WIZARD_SUBMENU}, {@link #OPEN_PERSPECTIVE_SUBMENU
+ * OPEN_PERSPECTIVE_SUBMENU}, {@link #SHOW_VIEW_SUBMENU
+ * SHOW_VIEW_SUBMENU}
* @return <code>true</code> if window contains submenu, <code>false</code>
* otherwise
* @see #addSubmenu
@@ -462,16 +461,14 @@ public class WorkbenchWindow implements IWorkbenchWindow {
*
* @since 3.0
*/
- private static final int FILL_ALL_ACTION_BARS = ActionBarAdvisor.FILL_MENU_BAR
- | ActionBarAdvisor.FILL_COOL_BAR | ActionBarAdvisor.FILL_STATUS_LINE;
+ private static final int FILL_ALL_ACTION_BARS = ActionBarAdvisor.FILL_MENU_BAR | ActionBarAdvisor.FILL_COOL_BAR
+ | ActionBarAdvisor.FILL_STATUS_LINE;
/**
* Creates and initializes a new workbench window.
*
- * @param input
- * the input for this workbench window
- * @param pers
- * the perspective to initialize this workbench window with
+ * @param input the input for this workbench window
+ * @param pers the perspective to initialize this workbench window with
*/
public WorkbenchWindow(IAdaptable input, IPerspectiveDescriptor pers) {
this.input = input;
@@ -490,37 +487,34 @@ public class WorkbenchWindow implements IWorkbenchWindow {
// Initialize a previous 'saved' state if applicable. We no longer
// update the preference store.
if (getModel().getPersistedState().containsKey(IPreferenceConstants.COOLBAR_VISIBLE)) {
- this.coolBarVisible = Boolean.parseBoolean(getModel().getPersistedState().get(
- IPreferenceConstants.COOLBAR_VISIBLE));
+ this.coolBarVisible = Boolean
+ .parseBoolean(getModel().getPersistedState().get(IPreferenceConstants.COOLBAR_VISIBLE));
} else {
- this.coolBarVisible = PrefUtil.getInternalPreferenceStore().getBoolean(
- IPreferenceConstants.COOLBAR_VISIBLE);
+ this.coolBarVisible = PrefUtil.getInternalPreferenceStore()
+ .getBoolean(IPreferenceConstants.COOLBAR_VISIBLE);
getModel().getPersistedState().put(IPreferenceConstants.COOLBAR_VISIBLE,
Boolean.toString(this.coolBarVisible));
}
- if (getModel().getPersistedState().containsKey(
- IPreferenceConstants.PERSPECTIVEBAR_VISIBLE)) {
- this.perspectiveBarVisible = Boolean.parseBoolean(getModel().getPersistedState()
- .get(IPreferenceConstants.PERSPECTIVEBAR_VISIBLE));
+ if (getModel().getPersistedState().containsKey(IPreferenceConstants.PERSPECTIVEBAR_VISIBLE)) {
+ this.perspectiveBarVisible = Boolean
+ .parseBoolean(getModel().getPersistedState().get(IPreferenceConstants.PERSPECTIVEBAR_VISIBLE));
} else {
- this.perspectiveBarVisible = PrefUtil.getInternalPreferenceStore().getBoolean(
- IPreferenceConstants.PERSPECTIVEBAR_VISIBLE);
+ this.perspectiveBarVisible = PrefUtil.getInternalPreferenceStore()
+ .getBoolean(IPreferenceConstants.PERSPECTIVEBAR_VISIBLE);
getModel().getPersistedState().put(IPreferenceConstants.PERSPECTIVEBAR_VISIBLE,
Boolean.toString(this.perspectiveBarVisible));
}
- IServiceLocatorCreator slc = workbench
- .getService(IServiceLocatorCreator.class);
- this.serviceLocator = (ServiceLocator) slc.createServiceLocator(workbench, null,
- new IDisposable() {
- @Override
- public void dispose() {
- final Shell shell = getShell();
- if (shell != null && !shell.isDisposed()) {
- close();
- }
- }
- }, windowContext);
+ IServiceLocatorCreator slc = workbench.getService(IServiceLocatorCreator.class);
+ this.serviceLocator = (ServiceLocator) slc.createServiceLocator(workbench, null, new IDisposable() {
+ @Override
+ public void dispose() {
+ final Shell shell = getShell();
+ if (shell != null && !shell.isDisposed()) {
+ close();
+ }
+ }
+ }, windowContext);
windowContext.set(IExtensionTracker.class.getName(), new ContextFunction() {
@Override
@@ -551,8 +545,8 @@ public class WorkbenchWindow implements IWorkbenchWindow {
if (!saveable.isSaveOnCloseNeeded()) {
return Save.NO;
}
- return SaveableHelper.savePart(saveable, part,
- WorkbenchWindow.this, true) ? Save.NO : Save.CANCEL;
+ return SaveableHelper.savePart(saveable, part, WorkbenchWindow.this, true) ? Save.NO
+ : Save.CANCEL;
}
}
return defaultSaveHandler.promptToSave(dirtyPart);
@@ -599,9 +593,8 @@ public class WorkbenchWindow implements IWorkbenchWindow {
if (SaveableHelper.isSaveable(workbenchPart)) {
SaveablesList saveablesList = (SaveablesList) PlatformUI.getWorkbench()
.getService(ISaveablesLifecycleListener.class);
- Object saveResult = saveablesList.preCloseParts(
- Collections.singletonList(workbenchPart), true,
- WorkbenchWindow.this);
+ Object saveResult = saveablesList.preCloseParts(Collections.singletonList(workbenchPart),
+ true, WorkbenchWindow.this);
return saveResult != null;
}
}
@@ -647,6 +640,7 @@ public class WorkbenchWindow implements IWorkbenchWindow {
}
LabelProvider labelProvider = new LabelProvider() {
WorkbenchPartLabelProvider workbenchLabelProvider = new WorkbenchPartLabelProvider();
+
@Override
public String getText(Object element) {
if (element instanceof Saveable) {
@@ -690,7 +684,7 @@ public class WorkbenchWindow implements IWorkbenchWindow {
}
}
Map<Saveable, Save> saveOptionMap = new HashMap<>();
- for (Saveable saveable: saveablesSet) {
+ for (Saveable saveable : saveablesSet) {
boolean found = false;
for (Object o : toSave) {
if (o == saveable) {
@@ -735,8 +729,7 @@ public class WorkbenchWindow implements IWorkbenchWindow {
SaveablesList saveablesList = (SaveablesList) PlatformUI.getWorkbench()
.getService(ISaveablesLifecycleListener.class);
- Object saveResult = saveablesList.preCloseParts(saveableParts, true,
- WorkbenchWindow.this);
+ Object saveResult = saveablesList.preCloseParts(saveableParts, true, WorkbenchWindow.this);
return (saveResult != null);
}
};
@@ -756,14 +749,12 @@ public class WorkbenchWindow implements IWorkbenchWindow {
initializeDefaultServices();
/*
- * Remove the second QuickAccess control if an older workspace is
- * opened.
+ * Remove the second QuickAccess control if an older workspace is opened.
*
- * An older workspace will create an ApplicationModel which already
- * contains the QuickAccess elements, from the old
- * "popuolateTopTrimContribution()" method. The new implementation
- * of this method doesn't add the QuickAccess elements anymore but
- * an old workbench.xmi still has these entries in it and so they
+ * An older workspace will create an ApplicationModel which already contains the
+ * QuickAccess elements, from the old "popuolateTopTrimContribution()" method.
+ * The new implementation of this method doesn't add the QuickAccess elements
+ * anymore but an old workbench.xmi still has these entries in it and so they
* need to be removed.
*/
cleanLegacyQuickAccessContribution();
@@ -808,13 +799,11 @@ public class WorkbenchWindow implements IWorkbenchWindow {
mainMenu = modelService.createModelElement(MMenu.class);
mainMenu.setElementId(ActionSet.MAIN_MENU);
- renderer = (MenuManagerRenderer) rendererFactory
- .getRenderer(mainMenu, null);
+ renderer = (MenuManagerRenderer) rendererFactory.getRenderer(mainMenu, null);
renderer.linkModelToManager(mainMenu, menuManager);
fill(renderer, mainMenu, menuManager);
model.setMainMenu(mainMenu);
- final Menu menu = (Menu) engine.createGui(mainMenu, model.getWidget(),
- model.getContext());
+ final Menu menu = (Menu) engine.createGui(mainMenu, model.getWidget(), model.getContext());
shell.setMenuBar(menu);
menuUpdater = () -> {
@@ -836,8 +825,7 @@ public class WorkbenchWindow implements IWorkbenchWindow {
public boolean changed(IEclipseContext context) {
ExpressionInfo info = new ExpressionInfo();
IEclipseContext leafContext = windowContext.getActiveLeaf();
- MenuManagerRendererFilter.collectInfo(info, mainMenu, renderer,
- leafContext, true);
+ MenuManagerRendererFilter.collectInfo(info, mainMenu, renderer, leafContext, true);
// if one of these variables change, re-run the RAT
for (String name : info.getAccessedVariableNames()) {
leafContext.get(name);
@@ -867,17 +855,14 @@ public class WorkbenchWindow implements IWorkbenchWindow {
updateActionSets();
IPreferenceStore preferenceStore = PrefUtil.getAPIPreferenceStore();
- boolean enableAnimations = preferenceStore
- .getBoolean(IWorkbenchPreferenceConstants.ENABLE_ANIMATIONS);
+ boolean enableAnimations = preferenceStore.getBoolean(IWorkbenchPreferenceConstants.ENABLE_ANIMATIONS);
preferenceStore.setValue(IWorkbenchPreferenceConstants.ENABLE_ANIMATIONS, false);
// Hack!! don't show the intro if there's more than one open
// perspective
- List<MPerspective> persps = modelService.findElements(model, null, MPerspective.class,
- null);
+ List<MPerspective> persps = modelService.findElements(model, null, MPerspective.class, null);
if (persps.size() > 1) {
- PrefUtil.getAPIPreferenceStore().setValue(IWorkbenchPreferenceConstants.SHOW_INTRO,
- false);
+ PrefUtil.getAPIPreferenceStore().setValue(IWorkbenchPreferenceConstants.SHOW_INTRO, false);
PrefUtil.saveAPIPrefs();
}
@@ -896,8 +881,7 @@ public class WorkbenchWindow implements IWorkbenchWindow {
getWindowAdvisor().postWindowCreate();
getWindowAdvisor().openIntro();
- preferenceStore.setValue(IWorkbenchPreferenceConstants.ENABLE_ANIMATIONS,
- enableAnimations);
+ preferenceStore.setValue(IWorkbenchPreferenceConstants.ENABLE_ANIMATIONS, enableAnimations);
getShell().setData(this);
trackShellActivation();
@@ -959,8 +943,7 @@ public class WorkbenchWindow implements IWorkbenchWindow {
perspective = registry.findPerspectiveWithId(forcedPerspectiveId);
}
- List<MPerspectiveStack> perspStackList = modelService.findElements(model, null,
- MPerspectiveStack.class, null);
+ List<MPerspectiveStack> perspStackList = modelService.findElements(model, null, MPerspectiveStack.class, null);
MPerspective selectedPersp = null;
if (!perspStackList.isEmpty()) {
@@ -992,21 +975,20 @@ public class WorkbenchWindow implements IWorkbenchWindow {
// that would remove everything from this method except the fill(*)
/*
* Reason Why: The setup() method which calls this method also calls the
- * ActionBarAdvisor to fill the TopTrim-Bar. Both this and the
- * ActionBarAdvisor fill method will be called after the entire
- * application model and all its fragments have been build already. This
- * leads to the effect that all the elements contributed via the
- * application model would be placed in front of the elements
- * contributed by the setup() method. (Means all the "Save", "Save All",
- * and so on, buttons which are normally placed at the beginning of the
- * trimbar (left) would be moved to the end of it (right).)
+ * ActionBarAdvisor to fill the TopTrim-Bar. Both this and the ActionBarAdvisor
+ * fill method will be called after the entire application model and all its
+ * fragments have been build already. This leads to the effect that all the
+ * elements contributed via the application model would be placed in front of
+ * the elements contributed by the setup() method. (Means all the "Save",
+ * "Save All", and so on, buttons which are normally placed at the beginning of
+ * the trimbar (left) would be moved to the end of it (right).)
*/
MToolControl spacerControl = (MToolControl) modelService.find(PERSPECTIVE_SPACER_ID, model);
if (spacerControl == null) {
spacerControl = modelService.createModelElement(MToolControl.class);
spacerControl.setElementId(PERSPECTIVE_SPACER_ID);
- spacerControl
- .setContributionURI("bundleclass://org.eclipse.e4.ui.workbench.renderers.swt/org.eclipse.e4.ui.workbench.renderers.swt.LayoutModifierToolControl"); //$NON-NLS-1$
+ spacerControl.setContributionURI(
+ "bundleclass://org.eclipse.e4.ui.workbench.renderers.swt/org.eclipse.e4.ui.workbench.renderers.swt.LayoutModifierToolControl"); //$NON-NLS-1$
spacerControl.getTags().add(TrimBarLayout.SPACER);
spacerControl.getTags().add("SHOW_RESTORE_MENU"); //$NON-NLS-1$
trimBar.getChildren().add(spacerControl);
@@ -1016,8 +998,7 @@ public class WorkbenchWindow implements IWorkbenchWindow {
}
}
- MToolControl switcherControl = (MToolControl) modelService.find(
- "PerspectiveSwitcher", model); //$NON-NLS-1$
+ MToolControl switcherControl = (MToolControl) modelService.find("PerspectiveSwitcher", model); //$NON-NLS-1$
if (switcherControl == null && getWindowConfigurer().getShowPerspectiveBar()) {
switcherControl = modelService.createModelElement(MToolControl.class);
switcherControl.setToBeRendered(getWindowConfigurer().getShowPerspectiveBar());
@@ -1025,8 +1006,8 @@ public class WorkbenchWindow implements IWorkbenchWindow {
switcherControl.getTags().add(IPresentationEngine.DRAGGABLE);
switcherControl.getTags().add("HIDEABLE"); //$NON-NLS-1$
switcherControl.getTags().add("SHOW_RESTORE_MENU"); //$NON-NLS-1$
- switcherControl
- .setContributionURI("bundleclass://org.eclipse.ui.workbench/org.eclipse.e4.ui.workbench.addons.perspectiveswitcher.PerspectiveSwitcher"); //$NON-NLS-1$
+ switcherControl.setContributionURI(
+ "bundleclass://org.eclipse.ui.workbench/org.eclipse.e4.ui.workbench.addons.perspectiveswitcher.PerspectiveSwitcher"); //$NON-NLS-1$
trimBar.getChildren().add(switcherControl);
} else if (switcherControl != null) {
if (!getWindowConfigurer().getShowPerspectiveBar()) {
@@ -1048,18 +1029,16 @@ public class WorkbenchWindow implements IWorkbenchWindow {
}
/**
- * Removes the "legacy" QuickAccess related fields from the
- * ApplicationModel.
+ * Removes the "legacy" QuickAccess related fields from the ApplicationModel.
* <p>
* The "legacy" QuickAccess fields exist in the ApplicationModel if an older
- * workspace is opened which was build before the QuickAccess was
- * contributed via e4xmi-fragment.
+ * workspace is opened which was build before the QuickAccess was contributed
+ * via e4xmi-fragment.
* </p>
*/
private void cleanLegacyQuickAccessContribution() {
for (String quickAccessElementId : QUICK_ACCESS_ELEMENT_IDS) {
- MToolControl legacyElement = (MToolControl) modelService.find(quickAccessElementId,
- model);
+ MToolControl legacyElement = (MToolControl) modelService.find(quickAccessElementId, model);
if (legacyElement != null) {
EcoreUtil.remove((EObject) legacyElement);
}
@@ -1073,31 +1052,29 @@ public class WorkbenchWindow implements IWorkbenchWindow {
* available in the model this method will move them to the correct place if
* required. The movement can be influenced by a tag which begins with
* {@value #MOVE_TAG} followed by the normal positioning information (e.g.:
- * move_after:PerspectiveSpacer). For more information about positioning
- * have a look at: {@link PositionInfo#parse(String)}.
+ * move_after:PerspectiveSpacer). For more information about positioning have a
+ * look at: {@link PositionInfo#parse(String)}.
* </p>
*/
private void positionQuickAccess() {
/*
- * The QUICK_ACCESS_ELEMENT_IDS array contains the IDs of optional
- * elements provided via an e4xmi application model fragment. The method
- * checks if they should be moved to a special position. This behavior
- * is required because nearly all elements in the legacy workbench are
- * not provided via e4xmi application model. They are provided
- * programmatically after the e4xmi application model and the
- * corresponding fragment models are already processed.
+ * The QUICK_ACCESS_ELEMENT_IDS array contains the IDs of optional elements
+ * provided via an e4xmi application model fragment. The method checks if they
+ * should be moved to a special position. This behavior is required because
+ * nearly all elements in the legacy workbench are not provided via e4xmi
+ * application model. They are provided programmatically after the e4xmi
+ * application model and the corresponding fragment models are already
+ * processed.
*/
for (String quickAccessElementId : QUICK_ACCESS_ELEMENT_IDS) {
- MToolControl quickAccessElement = (MToolControl) modelService.find(
- quickAccessElementId, model);
+ MToolControl quickAccessElement = (MToolControl) modelService.find(quickAccessElementId, model);
if (quickAccessElement != null) {
moveControl(quickAccessElement.getParent(), quickAccessElement);
// target the quick access field specifically
if (QUICK_ACCESS_ID.equals(quickAccessElement.getElementId())) {
if (model.getTags().contains(QUICK_ACCESS_HIDDEN)) {
- if (!quickAccessElement.getTags().contains(
- IPresentationEngine.HIDDEN_EXPLICITLY)) {
+ if (!quickAccessElement.getTags().contains(IPresentationEngine.HIDDEN_EXPLICITLY)) {
quickAccessElement.getTags().add(IPresentationEngine.HIDDEN_EXPLICITLY);
}
} else if (!model.getTags().contains(QUICK_ACCESS_DEFAULT_VISIBILITY_CHANGED)
@@ -1120,8 +1097,7 @@ public class WorkbenchWindow implements IWorkbenchWindow {
}
@Inject
- private void hideQuickAccess(
- @Optional @UIEventTopic(UIEvents.ApplicationElement.TOPIC_TAGS) Event event) {
+ private void hideQuickAccess(@Optional @UIEventTopic(UIEvents.ApplicationElement.TOPIC_TAGS) Event event) {
if (event == null) {
return;
}
@@ -1138,16 +1114,14 @@ public class WorkbenchWindow implements IWorkbenchWindow {
return;
}
if (UIEvents.isADD(event)) {
- if (UIEvents.contains(event, UIEvents.EventTags.NEW_VALUE,
- IPresentationEngine.HIDDEN_EXPLICITLY)) {
+ if (UIEvents.contains(event, UIEvents.EventTags.NEW_VALUE, IPresentationEngine.HIDDEN_EXPLICITLY)) {
if (!model.getTags().contains(QUICK_ACCESS_HIDDEN)) {
model.getTags().add(QUICK_ACCESS_HIDDEN);
quickAccessDefaultVisibilityChanged();
}
}
} else if (UIEvents.isREMOVE(event)) {
- if (UIEvents.contains(event, UIEvents.EventTags.OLD_VALUE,
- IPresentationEngine.HIDDEN_EXPLICITLY)) {
+ if (UIEvents.contains(event, UIEvents.EventTags.OLD_VALUE, IPresentationEngine.HIDDEN_EXPLICITLY)) {
model.getTags().remove(QUICK_ACCESS_HIDDEN);
quickAccessDefaultVisibilityChanged();
}
@@ -1158,15 +1132,13 @@ public class WorkbenchWindow implements IWorkbenchWindow {
model.getTags().add(QUICK_ACCESS_DEFAULT_VISIBILITY_CHANGED);
}
-
/**
- * Moves the given element from its current position to the position
- * mentioned in one of its tags.
+ * Moves the given element from its current position to the position mentioned
+ * in one of its tags.
*
- * @param elementContainer
- * the list of elements in which the element should be moved
- * @param element
- * the element to move
+ * @param elementContainer the list of elements in which the element should be
+ * moved
+ * @param element the element to move
*/
private void moveControl(MElementContainer<MUIElement> elementContainer, MUIElement element) {
if (element == null || elementContainer == null)
@@ -1228,13 +1200,10 @@ public class WorkbenchWindow implements IWorkbenchWindow {
}
/**
- * Find the element with the given id in the given list of
- * {@link MUIElement}s.
+ * Find the element with the given id in the given list of {@link MUIElement}s.
*
- * @param elements
- * the list of {@link MUIElement}s to search
- * @param id
- * the id of the {@link MUIElement} to find
+ * @param elements the list of {@link MUIElement}s to search
+ * @param id the id of the {@link MUIElement} to find
* @return the index of the {@link MUIElement} in the given list or -1 if
* element wasn't found
*/
@@ -1254,14 +1223,12 @@ public class WorkbenchWindow implements IWorkbenchWindow {
}
/**
- * Checks if the {@link MUIElement} has a tag starting with
- * {@value #MOVE_TAG} and if so it will extract the {@link PositionInfo} out
- * of it.
+ * Checks if the {@link MUIElement} has a tag starting with {@value #MOVE_TAG}
+ * and if so it will extract the {@link PositionInfo} out of it.
*
- * @param element
- * the element to check
- * @return the found {@link PositionInfo} on the given {@link MUIElement},
- * or <code>null</code> if none was found
+ * @param element the element to check
+ * @return the found {@link PositionInfo} on the given {@link MUIElement}, or
+ * <code>null</code> if none was found
*/
private PositionInfo findMovePositionInfo(MUIElement element) {
if (element != null) {
@@ -1277,8 +1244,7 @@ public class WorkbenchWindow implements IWorkbenchWindow {
private void populateStandardTrim(MTrimBar bottomTrim) {
// StatusLine
- MToolControl slElement = (MToolControl) modelService.find(
-STATUS_LINE_ID, model);
+ MToolControl slElement = (MToolControl) modelService.find(STATUS_LINE_ID, model);
if (slElement == null) {
slElement = modelService.createModelElement(MToolControl.class);
slElement.setElementId(STATUS_LINE_ID);
@@ -1289,8 +1255,7 @@ STATUS_LINE_ID, model);
slElement.getTags().add(TrimBarLayout.SPACER);
// Heap Status
- MToolControl hsElement = (MToolControl) modelService.find(
- "org.eclipse.ui.HeapStatus", model); //$NON-NLS-1$
+ MToolControl hsElement = (MToolControl) modelService.find("org.eclipse.ui.HeapStatus", model); //$NON-NLS-1$
if (hsElement == null) {
hsElement = modelService.createModelElement(MToolControl.class);
hsElement.setElementId("org.eclipse.ui.HeapStatus"); //$NON-NLS-1$
@@ -1301,8 +1266,7 @@ STATUS_LINE_ID, model);
hsElement.setToBeRendered(getShowHeapStatus());
// Progress Bar
- MToolControl pbElement = (MToolControl) modelService.find(
- "org.eclipse.ui.ProgressBar", model); //$NON-NLS-1$
+ MToolControl pbElement = (MToolControl) modelService.find("org.eclipse.ui.ProgressBar", model); //$NON-NLS-1$
if (pbElement == null) {
pbElement = modelService.createModelElement(MToolControl.class);
pbElement.setElementId("org.eclipse.ui.ProgressBar"); //$NON-NLS-1$
@@ -1315,8 +1279,7 @@ STATUS_LINE_ID, model);
private void populateTrimContributions(MTrimBar bottomTrim) {
// Part 1: Add groups
- IConfigurationElement[] exts = extensionRegistry
- .getConfigurationElementsFor("org.eclipse.ui.menus"); //$NON-NLS-1$
+ IConfigurationElement[] exts = extensionRegistry.getConfigurationElementsFor("org.eclipse.ui.menus"); //$NON-NLS-1$
List<IConfigurationElement> items = new ArrayList<>();
for (IConfigurationElement ice : exts) {
if ("group".equals(ice.getName()) || "widget".equals(ice.getName())) { //$NON-NLS-1$ //$NON-NLS-2$
@@ -1338,7 +1301,8 @@ STATUS_LINE_ID, model);
for (IConfigurationElement item : items) {
String id = item.getAttribute("id"); //$NON-NLS-1$
String classSpec = item.getAttribute("class"); //$NON-NLS-1$
- //boolean sepVisible = "true".equals(item.getAttribute("separatorsVisible")); //$NON-NLS-1$ //$NON-NLS-2$
+ // boolean sepVisible = "true".equals(item.getAttribute("separatorsVisible"));
+ // //$NON-NLS-1$ //$NON-NLS-2$
IConfigurationElement[] locs = item.getChildren("location"); //$NON-NLS-1$
for (IConfigurationElement loc : locs) {
IConfigurationElement[] bars = loc.getChildren("bar"); //$NON-NLS-1$
@@ -1348,8 +1312,7 @@ STATUS_LINE_ID, model);
if (isTrim) {
String path = bar.getAttribute("path"); //$NON-NLS-1$
if (path != null && path.length() > 0) {
- createdTrim = addTrimElement(bottomTrim, item, id, false, path,
- classSpec);
+ createdTrim = addTrimElement(bottomTrim, item, id, false, path, classSpec);
} else {
IConfigurationElement[] orders = loc.getChildren("order"); //$NON-NLS-1$
if (orders.length > 0) {
@@ -1358,8 +1321,7 @@ STATUS_LINE_ID, model);
if ("status".equals(relTo)) //$NON-NLS-1$
relTo = STATUS_LINE_ID;
- createdTrim = addTrimElement(bottomTrim, item, id, isBefore,
- relTo, classSpec);
+ createdTrim = addTrimElement(bottomTrim, item, id, isBefore, relTo, classSpec);
}
}
@@ -1375,8 +1337,8 @@ STATUS_LINE_ID, model);
}
}
- private MToolControl addTrimElement(MTrimBar bottomTrim, IConfigurationElement ice, String id,
- boolean isBefore, String relTo, String classSpec) {
+ private MToolControl addTrimElement(MTrimBar bottomTrim, IConfigurationElement ice, String id, boolean isBefore,
+ String relTo, String classSpec) {
// is it already in the trim ?
MUIElement existingTrim = modelService.find(id, bottomTrim);
if (existingTrim != null) {
@@ -1530,20 +1492,20 @@ STATUS_LINE_ID, model);
/**
* The handlers for global actions that were last submitted to the workbench
* command support. This is a map of command identifiers to
- * <code>ActionHandler</code>. This map is never <code>null</code>, and is
- * never empty as long as at least one global action has been registered.
+ * <code>ActionHandler</code>. This map is never <code>null</code>, and is never
+ * empty as long as at least one global action has been registered.
*/
private Map<String, ActionHandler> globalActionHandlersByCommandId = new HashMap<>();
/**
- * The list of handler submissions submitted to the workbench command
- * support. This list may be empty, but it is never <code>null</code>.
+ * The list of handler submissions submitted to the workbench command support.
+ * This list may be empty, but it is never <code>null</code>.
*/
private List<IHandlerActivation> handlerActivations = new ArrayList<>();
/**
- * The number of large updates that are currently going on. If this is
- * number is greater than zero, then UI updateActionBars is a no-op.
+ * The number of large updates that are currently going on. If this is number is
+ * greater than zero, then UI updateActionBars is a no-op.
*
* @since 3.1
*/
@@ -1591,30 +1553,28 @@ STATUS_LINE_ID, model);
/**
* <p>
- * Submits the action handlers for action set actions and global actions.
- * Global actions are given priority, so that if a global action and an
- * action set action both handle the same command, the global action is
- * given priority.
+ * Submits the action handlers for action set actions and global actions. Global
+ * actions are given priority, so that if a global action and an action set
+ * action both handle the same command, the global action is given priority.
* </p>
* <p>
- * These submissions are submitted as <code>Priority.LEGACY</code>, which
- * means that they are the lowest priority. This means that if a higher
- * priority submission handles the same command under the same conditions,
- * that that submission will become the handler.
+ * These submissions are submitted as <code>Priority.LEGACY</code>, which means
+ * that they are the lowest priority. This means that if a higher priority
+ * submission handles the same command under the same conditions, that that
+ * submission will become the handler.
* </p>
*/
void submitGlobalActions() {
final IHandlerService handlerService = getService(IHandlerService.class);
/*
- * Mash the action sets and global actions together, with global actions
- * taking priority.
+ * Mash the action sets and global actions together, with global actions taking
+ * priority.
*/
Map<String, ActionHandler> handlersByCommandId = new HashMap<>();
handlersByCommandId.putAll(globalActionHandlersByCommandId);
- List<IHandlerActivation> newHandlers = new ArrayList<>(
- handlersByCommandId.size());
+ List<IHandlerActivation> newHandlers = new ArrayList<>(handlersByCommandId.size());
Iterator<IHandlerActivation> existingIter = handlerActivations.iterator();
while (existingIter.hasNext()) {
@@ -1647,8 +1607,7 @@ STATUS_LINE_ID, model);
/**
* Add a generic property listener.
*
- * @param listener
- * the listener to add
+ * @param listener the listener to add
* @since 3.3
*/
public void addPropertyChangeListener(IPropertyChangeListener listener) {
@@ -1658,16 +1617,14 @@ STATUS_LINE_ID, model);
/**
* Removes a generic property listener.
*
- * @param listener
- * the listener to remove
+ * @param listener the listener to remove
* @since 3.3
*/
public void removePropertyChangeListener(IPropertyChangeListener listener) {
genericPropertyListeners.remove(listener);
}
- private void firePropertyChanged(final String property, final Object oldValue,
- final Object newValue) {
+ private void firePropertyChanged(final String property, final Object oldValue, final Object newValue) {
PropertyChangeEvent event = new PropertyChangeEvent(this, property, oldValue, newValue);
for (Object listener : genericPropertyListeners.getListeners()) {
IPropertyChangeListener propertyChangeListener = (IPropertyChangeListener) listener;
@@ -1698,20 +1655,18 @@ STATUS_LINE_ID, model);
*/
private boolean busyClose(boolean remove) {
/*
- * Warning: Intricate flow of control and re-entrant invocations of this
- * method:
+ * Warning: Intricate flow of control and re-entrant invocations of this method:
*
- * - busyClose(true) is called from WorkbenchWindow#close() when the
- * user closes a workbench window.
+ * - busyClose(true) is called from WorkbenchWindow#close() when the user closes
+ * a workbench window.
*
- * - busyClose(false) is called from Workbench#close(int, boolean). This
- * happens on File > Exit/Restart, [Mac] Quit Eclipse, AND ... tadaa ...
- * from busyClose(true) when the user closes the last window => [Case A]
+ * - busyClose(false) is called from Workbench#close(int, boolean). This happens
+ * on File > Exit/Restart, [Mac] Quit Eclipse, AND ... tadaa ... from
+ * busyClose(true) when the user closes the last window => [Case A]
*
- * Additional complication: busyClose(true) can also be called again
- * when someone runs an event loop during the shutdown sequence. In that
- * case, the nested busyClose(true) should be dropped (bug 381555) =>
- * [Case B]
+ * Additional complication: busyClose(true) can also be called again when
+ * someone runs an event loop during the shutdown sequence. In that case, the
+ * nested busyClose(true) should be dropped (bug 381555) => [Case B]
*/
if (closing) {
// [Case A] Window is already closing.
@@ -1735,8 +1690,7 @@ STATUS_LINE_ID, model);
// Tag the currently active part so we can restore focus on startup
IWorkbenchPage activePage = getActivePage();
if (activePage != null) {
- WorkbenchPartReference ref = (WorkbenchPartReference) activePage
- .getActivePartReference();
+ WorkbenchPartReference ref = (WorkbenchPartReference) activePage.getActivePartReference();
if (ref != null) {
ref.getModel().getTags().add(EPartService.ACTIVE_ON_CLOSE_TAG);
}
@@ -1797,8 +1751,8 @@ STATUS_LINE_ID, model);
}
/**
- * Notifies interested parties (namely the advisor) that the window is about
- * to be opened.
+ * Notifies interested parties (namely the advisor) that the window is about to
+ * be opened.
*
* @since 3.1
*/
@@ -1816,8 +1770,7 @@ STATUS_LINE_ID, model);
* Notifies interested parties (namely the advisor) that the window has been
* restored from a previously saved state.
*
- * @throws WorkbenchException
- * passed through from the advisor
+ * @throws WorkbenchException passed through from the advisor
* @since 3.1
*/
void fireWindowRestored() throws WorkbenchException {
@@ -1866,8 +1819,7 @@ STATUS_LINE_ID, model);
allowUpdates(windowManager);
windowManager.update(false);
- UIListenerLogging.logPerspectiveEvent(this, page, perspective,
- UIListenerLogging.PLE_PERSP_ACTIVATED);
+ UIListenerLogging.logPerspectiveEvent(this, page, perspective, UIListenerLogging.PLE_PERSP_ACTIVATED);
perspectiveListeners.firePerspectiveActivated(page, perspective);
}
@@ -1877,8 +1829,7 @@ STATUS_LINE_ID, model);
* @since 3.2
*/
void firePerspectivePreDeactivate(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
- UIListenerLogging.logPerspectiveEvent(this, page, perspective,
- UIListenerLogging.PLE_PERSP_PRE_DEACTIVATE);
+ UIListenerLogging.logPerspectiveEvent(this, page, perspective, UIListenerLogging.PLE_PERSP_PRE_DEACTIVATE);
perspectiveListeners.firePerspectivePreDeactivate(page, perspective);
}
@@ -1888,8 +1839,7 @@ STATUS_LINE_ID, model);
* @since 3.1
*/
void firePerspectiveDeactivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
- UIListenerLogging.logPerspectiveEvent(this, page, perspective,
- UIListenerLogging.PLE_PERSP_DEACTIVATED);
+ UIListenerLogging.logPerspectiveEvent(this, page, perspective, UIListenerLogging.PLE_PERSP_DEACTIVATED);
perspectiveListeners.firePerspectiveDeactivated(page, perspective);
}
@@ -1900,8 +1850,7 @@ STATUS_LINE_ID, model);
* @param perspective
* @param changeId
*/
- public void firePerspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective,
- String changeId) {
+ public void firePerspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId) {
// Some callers call this even when there is no active perspective.
// Just ignore this case.
if (perspective != null) {
@@ -1923,8 +1872,7 @@ STATUS_LINE_ID, model);
// Some callers call this even when there is no active perspective.
// Just ignore this case.
if (perspective != null) {
- UIListenerLogging
- .logPerspectiveChangedEvent(this, page, perspective, partRef, changeId);
+ UIListenerLogging.logPerspectiveChangedEvent(this, page, perspective, partRef, changeId);
perspectiveListeners.firePerspectiveChanged(page, perspective, partRef, changeId);
}
}
@@ -1933,8 +1881,7 @@ STATUS_LINE_ID, model);
* Fires perspective closed
*/
void firePerspectiveClosed(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
- UIListenerLogging.logPerspectiveEvent(this, page, perspective,
- UIListenerLogging.PLE_PERSP_CLOSED);
+ UIListenerLogging.logPerspectiveEvent(this, page, perspective, UIListenerLogging.PLE_PERSP_CLOSED);
perspectiveListeners.firePerspectiveClosed(page, perspective);
}
@@ -1942,8 +1889,7 @@ STATUS_LINE_ID, model);
* Fires perspective opened
*/
void firePerspectiveOpened(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
- UIListenerLogging.logPerspectiveEvent(this, page, perspective,
- UIListenerLogging.PLE_PERSP_OPENED);
+ UIListenerLogging.logPerspectiveEvent(this, page, perspective, UIListenerLogging.PLE_PERSP_OPENED);
perspectiveListeners.firePerspectiveOpened(page, perspective);
}
@@ -2009,8 +1955,8 @@ STATUS_LINE_ID, model);
* Returns <code>true</code> when the window's shell is activated,
* <code>false</code> when it's shell is deactivated
*
- * @return boolean <code>true</code> when shell activated,
- * <code>false</code> when shell deactivated
+ * @return boolean <code>true</code> when shell activated, <code>false</code>
+ * when shell deactivated
*/
public boolean getShellActivated() {
return shellActivated;
@@ -2026,8 +1972,7 @@ STATUS_LINE_ID, model);
private void hideNonRestorableViews() {
List<MPart> sharedPartsToRemove = new ArrayList<>();
- List<MPlaceholder> phList = modelService
- .findElements(model, null, MPlaceholder.class, null);
+ List<MPlaceholder> phList = modelService.findElements(model, null, MPlaceholder.class, null);
for (MPlaceholder ph : phList) {
if (!(ph.getRef() instanceof MPart))
continue;
@@ -2076,9 +2021,8 @@ STATUS_LINE_ID, model);
* Unconditionally close this window. Assumes the proper flags have been set
* correctly (e.i. closing and updateDisabled)
*
- * @param remove
- * <code>true</code> if this window should be removed from the
- * application model
+ * @param remove <code>true</code> if this window should be removed from the
+ * application model
*/
private boolean hardClose(boolean remove) {
try {
@@ -2104,8 +2048,7 @@ STATUS_LINE_ID, model);
globalActionHandlersByCommandId.clear();
// Remove the enabled submissions. Bug 64024.
- final IContextService contextService = workbench
- .getService(IContextService.class);
+ final IContextService contextService = workbench.getService(IContextService.class);
contextService.unregisterShell(getShell());
// time to wipe our our populate
@@ -2212,8 +2155,7 @@ STATUS_LINE_ID, model);
}
@Override
- public IWorkbenchPage openPage(final String perspectiveId, final IAdaptable input)
- throws WorkbenchException {
+ public IWorkbenchPage openPage(final String perspectiveId, final IAdaptable input) throws WorkbenchException {
final Object[] result = new Object[1];
BusyIndicator.showWhile(null, () -> {
try {
@@ -2232,13 +2174,11 @@ STATUS_LINE_ID, model);
}
}
- private IWorkbenchPage busyOpenPage(String perspectiveId, IAdaptable input)
- throws WorkbenchException {
- IPerspectiveDescriptor descriptor = workbench.getPerspectiveRegistry()
- .findPerspectiveWithId(perspectiveId);
+ private IWorkbenchPage busyOpenPage(String perspectiveId, IAdaptable input) throws WorkbenchException {
+ IPerspectiveDescriptor descriptor = workbench.getPerspectiveRegistry().findPerspectiveWithId(perspectiveId);
if (descriptor == null) {
- throw new WorkbenchException(NLS.bind(
- WorkbenchMessages.WorkbenchPage_ErrorCreatingPerspective, perspectiveId));
+ throw new WorkbenchException(
+ NLS.bind(WorkbenchMessages.WorkbenchPage_ErrorCreatingPerspective, perspectiveId));
}
if (page == null) {
@@ -2333,8 +2273,7 @@ STATUS_LINE_ID, model);
}
}
-
- //Disable the presentation (except the bottom trim)
+ // Disable the presentation (except the bottom trim)
TrimmedPartLayout tpl = (TrimmedPartLayout) getShell().getLayout();
disableControl(tpl.clientArea, toEnable);
disableControl(tpl.top, toEnable);
@@ -2437,10 +2376,8 @@ STATUS_LINE_ID, model);
if (menuRestrictions.isEmpty()) {
return;
}
- EvaluationReference[] refs = menuRestrictions
- .toArray(new EvaluationReference[menuRestrictions.size()]);
- IEvaluationService es = serviceLocator
- .getService(IEvaluationService.class);
+ EvaluationReference[] refs = menuRestrictions.toArray(new EvaluationReference[menuRestrictions.size()]);
+ IEvaluationService es = serviceLocator.getService(IEvaluationService.class);
IEvaluationContext currentState = es.getCurrentState();
for (EvaluationReference reference : refs) {
reference.setPostingChanges(true);
@@ -2450,8 +2387,7 @@ STATUS_LINE_ID, model);
boolean ns = reference.evaluate(currentState);
if (os != ns) {
reference.getListener().propertyChange(
- new PropertyChangeEvent(reference, reference.getProperty(), valueOf(os),
- valueOf(ns)));
+ new PropertyChangeEvent(reference, reference.getProperty(), valueOf(os), valueOf(ns)));
}
}
}
@@ -2528,9 +2464,9 @@ STATUS_LINE_ID, model);
* <p>
* Indicates the start of a large update within this window. This is used to
* disable CPU-intensive, change-sensitive services that were temporarily
- * disabled in the midst of large changes. This method should always be
- * called in tandem with <code>largeUpdateEnd</code>, and the event loop
- * should not be allowed to spin before that method is called.
+ * disabled in the midst of large changes. This method should always be called
+ * in tandem with <code>largeUpdateEnd</code>, and the event loop should not be
+ * allowed to spin before that method is called.
* </p>
* <p>
* Important: always use with <code>largeUpdateEnd</code>!
@@ -2547,8 +2483,8 @@ STATUS_LINE_ID, model);
* Indicates the end of a large update within this window. This is used to
* re-enable services that were temporarily disabled in the midst of large
* changes. This method should always be called in tandem with
- * <code>largeUpdateStart</code>, and the event loop should not be allowed
- * to spin before this method is called.
+ * <code>largeUpdateStart</code>, and the event loop should not be allowed to
+ * spin before this method is called.
* </p>
* <p>
* Important: always protect this call by using <code>finally</code>!
@@ -2563,9 +2499,8 @@ STATUS_LINE_ID, model);
}
/**
- * Update the visible action sets. This method is typically called from a
- * page when the user changes the visible action sets within the
- * prespective.
+ * Update the visible action sets. This method is typically called from a page
+ * when the user changes the visible action sets within the prespective.
*/
public void updateActionSets() {
if (updateDisabled) {
@@ -2648,12 +2583,8 @@ STATUS_LINE_ID, model);
*/
private boolean getShowHeapStatus() {
return // Show if the preference is set or debug option is on
- PrefUtil.getAPIPreferenceStore().getBoolean(
- IWorkbenchPreferenceConstants.SHOW_MEMORY_MONITOR)
- || Boolean
- .valueOf(
- Platform.getDebugOption(PlatformUI.PLUGIN_ID
- + "/perf/showHeapStatus")).booleanValue(); //$NON-NLS-1$
+ PrefUtil.getAPIPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.SHOW_MEMORY_MONITOR) || Boolean
+ .valueOf(Platform.getDebugOption(PlatformUI.PLUGIN_ID + "/perf/showHeapStatus")).booleanValue(); //$NON-NLS-1$
}
public void showHeapStatus(boolean show) {
@@ -2667,11 +2598,11 @@ STATUS_LINE_ID, model);
/**
* Returns the unique object that applications use to configure this window.
* <p>
- * IMPORTANT This method is declared package-private to prevent regular
- * plug-ins from downcasting IWorkbenchWindow to WorkbenchWindow and getting
- * hold of the workbench window configurer that would allow them to tamper
- * with the workbench window. The workbench window configurer is available
- * only to the application.
+ * IMPORTANT This method is declared package-private to prevent regular plug-ins
+ * from downcasting IWorkbenchWindow to WorkbenchWindow and getting hold of the
+ * workbench window configurer that would allow them to tamper with the
+ * workbench window. The workbench window configurer is available only to the
+ * application.
* </p>
*/
/* package - DO NOT CHANGE */
@@ -2687,10 +2618,10 @@ STATUS_LINE_ID, model);
* Returns the workbench advisor. Assumes the workbench has been created
* already.
* <p>
- * IMPORTANT This method is declared private to prevent regular plug-ins
- * from downcasting IWorkbenchWindow to WorkbenchWindow and getting hold of
- * the workbench advisor that would allow them to tamper with the workbench.
- * The workbench advisor is internal to the application.
+ * IMPORTANT This method is declared private to prevent regular plug-ins from
+ * downcasting IWorkbenchWindow to WorkbenchWindow and getting hold of the
+ * workbench advisor that would allow them to tamper with the workbench. The
+ * workbench advisor is internal to the application.
* </p>
*/
private/* private - DO NOT CHANGE */
@@ -2701,10 +2632,10 @@ STATUS_LINE_ID, model);
/**
* Returns the window advisor, creating a new one for this window if needed.
* <p>
- * IMPORTANT This method is declared package private to prevent regular
- * plug-ins from downcasting IWorkbenchWindow to WorkbenchWindow and getting
- * hold of the window advisor that would allow them to tamper with the
- * window. The window advisor is internal to the application.
+ * IMPORTANT This method is declared package private to prevent regular plug-ins
+ * from downcasting IWorkbenchWindow to WorkbenchWindow and getting hold of the
+ * window advisor that would allow them to tamper with the window. The window
+ * advisor is internal to the application.
* </p>
*/
/* package private - DO NOT CHANGE */
@@ -2717,20 +2648,19 @@ STATUS_LINE_ID, model);
}
/**
- * Returns the action bar advisor, creating a new one for this window if
- * needed.
+ * Returns the action bar advisor, creating a new one for this window if needed.
* <p>
- * IMPORTANT This method is declared private to prevent regular plug-ins
- * from downcasting IWorkbenchWindow to WorkbenchWindow and getting hold of
- * the action bar advisor that would allow them to tamper with the window's
- * action bars. The action bar advisor is internal to the application.
+ * IMPORTANT This method is declared private to prevent regular plug-ins from
+ * downcasting IWorkbenchWindow to WorkbenchWindow and getting hold of the
+ * action bar advisor that would allow them to tamper with the window's action
+ * bars. The action bar advisor is internal to the application.
* </p>
*/
private/* private - DO NOT CHANGE */
ActionBarAdvisor getActionBarAdvisor() {
if (actionBarAdvisor == null) {
- actionBarAdvisor = getWindowAdvisor().createActionBarAdvisor(
- getWindowConfigurer().getActionBarConfigurer());
+ actionBarAdvisor = getWindowAdvisor()
+ .createActionBarAdvisor(getWindowConfigurer().getActionBarConfigurer());
Assert.isNotNull(actionBarAdvisor);
}
return actionBarAdvisor;
@@ -2746,8 +2676,7 @@ STATUS_LINE_ID, model);
/**
* Fills the window's real action bars.
*
- * @param flags
- * indicate which bars to fill
+ * @param flags indicate which bars to fill
*/
public void fillActionBars(int flags) {
Workbench workbench = getWorkbenchImpl();
@@ -2762,10 +2691,8 @@ STATUS_LINE_ID, model);
/**
* Fills the window's proxy action bars.
*
- * @param proxyBars
- * the proxy configurer
- * @param flags
- * indicate which bars to fill
+ * @param proxyBars the proxy configurer
+ * @param flags indicate which bars to fill
*/
public void fillActionBars(IActionBarConfigurer2 proxyBars, int flags) {
Assert.isNotNull(proxyBars);
@@ -2780,23 +2707,21 @@ STATUS_LINE_ID, model);
}
/**
- * Cause the coolbar to be shown or hidden; note that the coolbar may still
- * be visible depending on the visibility state of other elements. This
- * method is a lower-level method that affects the visibility but does not
- * update any associated preference values.
+ * Cause the coolbar to be shown or hidden; note that the coolbar may still be
+ * visible depending on the visibility state of other elements. This method is a
+ * lower-level method that affects the visibility but does not update any
+ * associated preference values.
*
- * @param visible
- * whether the cool bar should be shown. This is only applicable
- * if the window configurer also wishes either the cool bar to be
- * visible.
+ * @param visible whether the cool bar should be shown. This is only applicable
+ * if the window configurer also wishes either the cool bar to be
+ * visible.
* @since 3.0
*/
public void setCoolBarVisible(boolean visible) {
boolean oldValue = coolBarVisible;
coolBarVisible = visible;
if (oldValue != coolBarVisible) {
- getModel().getPersistedState().put(IPreferenceConstants.COOLBAR_VISIBLE,
- Boolean.toString(visible));
+ getModel().getPersistedState().put(IPreferenceConstants.COOLBAR_VISIBLE, Boolean.toString(visible));
updateLayoutDataForContents();
firePropertyChanged(PROP_COOLBAR_VISIBLE, oldValue ? Boolean.TRUE : Boolean.FALSE,
coolBarVisible ? Boolean.TRUE : Boolean.FALSE);
@@ -2804,9 +2729,8 @@ STATUS_LINE_ID, model);
}
/**
- * @return whether the cool bar should be shown. This is only applicable if
- * the window configurer also wishes either the cool bar to be
- * visible.
+ * @return whether the cool bar should be shown. This is only applicable if the
+ * window configurer also wishes either the cool bar to be visible.
* @since 3.0
*/
public boolean getCoolBarVisible() {
@@ -2821,33 +2745,31 @@ STATUS_LINE_ID, model);
}
/**
- * Cause the perspective bar to be shown or hidden; note that the
- * perspective bar may still be visible depending on the visibility state of
- * other elements. This method is a lower-level method that affects the
- * visibility but does not update any associated preference values.
+ * Cause the perspective bar to be shown or hidden; note that the perspective
+ * bar may still be visible depending on the visibility state of other elements.
+ * This method is a lower-level method that affects the visibility but does not
+ * update any associated preference values.
*
- * @param visible
- * whether the perspective bar should be shown. This is only
- * applicable if the window configurer also wishes either the
- * perspective bar to be visible.
+ * @param visible whether the perspective bar should be shown. This is only
+ * applicable if the window configurer also wishes either the
+ * perspective bar to be visible.
* @since 3.0
*/
public void setPerspectiveBarVisible(boolean visible) {
boolean oldValue = perspectiveBarVisible;
perspectiveBarVisible = visible;
if (oldValue != perspectiveBarVisible) {
- getModel().getPersistedState().put(IPreferenceConstants.PERSPECTIVEBAR_VISIBLE,
- Boolean.toString(visible));
+ getModel().getPersistedState().put(IPreferenceConstants.PERSPECTIVEBAR_VISIBLE, Boolean.toString(visible));
updateLayoutDataForContents();
- firePropertyChanged(PROP_PERSPECTIVEBAR_VISIBLE, oldValue ? Boolean.TRUE
- : Boolean.FALSE, perspectiveBarVisible ? Boolean.TRUE : Boolean.FALSE);
+ firePropertyChanged(PROP_PERSPECTIVEBAR_VISIBLE, oldValue ? Boolean.TRUE : Boolean.FALSE,
+ perspectiveBarVisible ? Boolean.TRUE : Boolean.FALSE);
}
}
/**
- * @return whether the perspective bar should be shown. This is only
- * applicable if the window configurer also wishes either the
- * perspective bar to be visible.
+ * @return whether the perspective bar should be shown. This is only applicable
+ * if the window configurer also wishes either the perspective bar to be
+ * visible.
* @since 3.0
*/
public boolean getPerspectiveBarVisible() {
@@ -2855,18 +2777,16 @@ STATUS_LINE_ID, model);
}
/**
- * @param visible
- * whether the perspective bar should be shown. This is only
- * applicable if the window configurer also wishes either the
- * perspective bar to be visible.
+ * @param visible whether the perspective bar should be shown. This is only
+ * applicable if the window configurer also wishes either the
+ * perspective bar to be visible.
* @since 3.0
*/
public void setStatusLineVisible(boolean visible) {
boolean oldValue = statusLineVisible;
statusLineVisible = visible;
if (oldValue != statusLineVisible) {
- getModel().getPersistedState().put(IPreferenceConstants.PERSPECTIVEBAR_VISIBLE,
- Boolean.toString(visible));
+ getModel().getPersistedState().put(IPreferenceConstants.PERSPECTIVEBAR_VISIBLE, Boolean.toString(visible));
updateLayoutDataForContents();
firePropertyChanged(PROP_STATUS_LINE_VISIBLE, oldValue ? Boolean.TRUE : Boolean.FALSE,
statusLineVisible ? Boolean.TRUE : Boolean.FALSE);
@@ -2874,9 +2794,9 @@ STATUS_LINE_ID, model);
}
/**
- * @return whether the perspective bar should be shown. This is only
- * applicable if the window configurer also wishes either the
- * perspective bar to be visible.
+ * @return whether the perspective bar should be shown. This is only applicable
+ * if the window configurer also wishes either the perspective bar to be
+ * visible.
* @since 3.0
*/
public boolean getStatusLineVisible() {
@@ -2919,8 +2839,7 @@ STATUS_LINE_ID, model);
private final void initializeDefaultServices() {
IEclipseContext windowContext = model.getContext();
serviceLocator.registerService(IWorkbenchLocationService.class,
- new WorkbenchLocationService(IServiceScopes.WINDOW_SCOPE, getWorkbench(), this,
- null, null, null, 1));
+ new WorkbenchLocationService(IServiceScopes.WINDOW_SCOPE, getWorkbench(), this, null, null, null, 1));
// added back for legacy reasons
serviceLocator.registerService(IWorkbenchWindow.class, this);
@@ -2938,13 +2857,12 @@ STATUS_LINE_ID, model);
actionPersistence.read();
ICommandService cmdService = workbench.getService(ICommandService.class);
- SlaveCommandService slaveCmdService = new SlaveCommandService(cmdService,
- IServiceScopes.WINDOW_SCOPE, this, model.getContext());
+ SlaveCommandService slaveCmdService = new SlaveCommandService(cmdService, IServiceScopes.WINDOW_SCOPE, this,
+ model.getContext());
serviceLocator.registerService(ICommandService.class, slaveCmdService);
serviceLocator.registerService(IUpdateService.class, slaveCmdService);
- IContextService cxs = ContextInjectionFactory
- .make(ContextService.class, model.getContext());
+ IContextService cxs = ContextInjectionFactory.make(ContextService.class, model.getContext());
serviceLocator.registerService(IContextService.class, cxs);
IMenuService parent = getWorkbench().getService(IMenuService.class);
@@ -2963,9 +2881,9 @@ STATUS_LINE_ID, model);
}
/**
- * Toggle the visibility of the coolbar/perspective bar. This method
- * respects the window configurer and will only toggle visibility if the
- * item in question was originally declared visible by the window advisor.
+ * Toggle the visibility of the coolbar/perspective bar. This method respects
+ * the window configurer and will only toggle visibility if the item in question
+ * was originally declared visible by the window advisor.
*
* @since 3.3
*/
@@ -2988,8 +2906,8 @@ STATUS_LINE_ID, model);
}
/**
- * Return true if the toolbar is visible. Note that it may not be possible
- * to make the toolbar visible (i.e., the window configurer).
+ * Return true if the toolbar is visible. Note that it may not be possible to
+ * make the toolbar visible (i.e., the window configurer).
*
* @return true if the toolbar is visible
* @since 4.2
@@ -3040,8 +2958,7 @@ STATUS_LINE_ID, model);
public ICoolBarManager getCoolBarManager2() {
if (coolbarToTrim == null) {
- coolbarToTrim = new CoolBarToTrimManager(application, model, workbenchTrimElements,
- rendererFactory);
+ coolbarToTrim = new CoolBarToTrimManager(application, model, workbenchTrimElements, rendererFactory);
}
return coolbarToTrim;
}
@@ -3181,8 +3098,7 @@ STATUS_LINE_ID, model);
return getToolBarManager2();
}
- public CustomizePerspectiveDialog createCustomizePerspectiveDialog(Perspective persp,
- IEclipseContext context) {
+ public CustomizePerspectiveDialog createCustomizePerspectiveDialog(Perspective persp, IEclipseContext context) {
return new CustomizePerspectiveDialog(getWindowConfigurer(), persp, context);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindowConfigurer.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindowConfigurer.java
index 42c0d1cba2e..1a1220b5a75 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindowConfigurer.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindowConfigurer.java
@@ -49,8 +49,8 @@ import org.eclipse.ui.internal.provisional.application.IActionBarConfigurer2;
/**
* Internal class providing special access for configuring workbench windows.
* <p>
- * Note that these objects are only available to the main application
- * (the plug-in that creates and owns the workbench).
+ * Note that these objects are only available to the main application (the
+ * plug-in that creates and owns the workbench).
* </p>
* <p>
* This class is not intended to be instantiated or subclassed by clients.
@@ -58,152 +58,151 @@ import org.eclipse.ui.internal.provisional.application.IActionBarConfigurer2;
*
* @since 3.0
*/
-public final class WorkbenchWindowConfigurer implements
- IWorkbenchWindowConfigurer {
-
- /**
- * The workbench window associated with this configurer.
- */
- private WorkbenchWindow window;
-
- /**
- * The shell style bits to use when the window's shell is being created.
- */
- private int shellStyle = SWT.SHELL_TRIM | Window.getDefaultOrientation();
-
- /**
- * The window title to set when the window's shell has been created.
- */
- private String windowTitle;
-
- /**
- * Whether the workbench window should show the perspective bar
- */
- private boolean showPerspectiveBar = false;
-
- /**
- * Whether the workbench window should show the status line.
- */
- private boolean showStatusLine = true;
-
- /**
- * Whether the workbench window should show the main tool bar.
- */
- private boolean showToolBar = true;
-
- /**
- * Whether the workbench window should show the main menu bar.
- */
- private boolean showMenuBar = true;
-
- /**
- * Whether the workbench window should have a progress indicator.
- */
- private boolean showProgressIndicator = false;
-
- /**
- * Table to hold arbitrary key-data settings (key type: <code>String</code>,
- * value type: <code>Object</code>).
- * @see #setData
- */
- private Map extraData = new HashMap(1);
-
- /**
- * Holds the list drag and drop <code>Transfer</code> for the
- * editor area
- */
- private ArrayList transferTypes = new ArrayList(3);
-
- /**
- * The <code>DropTargetListener</code> implementation for handling a
- * drop into the editor area.
- */
- private DropTargetListener dropTargetListener = null;
-
- /**
- * Object for configuring this workbench window's action bars.
- * Lazily initialized to an instance unique to this window.
- */
- private WindowActionBarConfigurer actionBarConfigurer = null;
-
- /**
- * The initial size to use for the shell.
- */
- private Point initialSize = new Point(1024, 768);
-
- /**
- * Action bar configurer that changes this workbench window.
- * This implementation keeps track of of cool bar items
- */
- class WindowActionBarConfigurer implements IActionBarConfigurer2 {
-
- private IActionBarConfigurer2 proxy;
-
- /**
- * Sets the proxy to use, or <code>null</code> for none.
- *
- * @param proxy the proxy
- */
- public void setProxy(IActionBarConfigurer2 proxy) {
- this.proxy = proxy;
- }
-
- @Override
+public final class WorkbenchWindowConfigurer implements IWorkbenchWindowConfigurer {
+
+ /**
+ * The workbench window associated with this configurer.
+ */
+ private WorkbenchWindow window;
+
+ /**
+ * The shell style bits to use when the window's shell is being created.
+ */
+ private int shellStyle = SWT.SHELL_TRIM | Window.getDefaultOrientation();
+
+ /**
+ * The window title to set when the window's shell has been created.
+ */
+ private String windowTitle;
+
+ /**
+ * Whether the workbench window should show the perspective bar
+ */
+ private boolean showPerspectiveBar = false;
+
+ /**
+ * Whether the workbench window should show the status line.
+ */
+ private boolean showStatusLine = true;
+
+ /**
+ * Whether the workbench window should show the main tool bar.
+ */
+ private boolean showToolBar = true;
+
+ /**
+ * Whether the workbench window should show the main menu bar.
+ */
+ private boolean showMenuBar = true;
+
+ /**
+ * Whether the workbench window should have a progress indicator.
+ */
+ private boolean showProgressIndicator = false;
+
+ /**
+ * Table to hold arbitrary key-data settings (key type: <code>String</code>,
+ * value type: <code>Object</code>).
+ *
+ * @see #setData
+ */
+ private Map extraData = new HashMap(1);
+
+ /**
+ * Holds the list drag and drop <code>Transfer</code> for the editor area
+ */
+ private ArrayList transferTypes = new ArrayList(3);
+
+ /**
+ * The <code>DropTargetListener</code> implementation for handling a drop into
+ * the editor area.
+ */
+ private DropTargetListener dropTargetListener = null;
+
+ /**
+ * Object for configuring this workbench window's action bars. Lazily
+ * initialized to an instance unique to this window.
+ */
+ private WindowActionBarConfigurer actionBarConfigurer = null;
+
+ /**
+ * The initial size to use for the shell.
+ */
+ private Point initialSize = new Point(1024, 768);
+
+ /**
+ * Action bar configurer that changes this workbench window. This implementation
+ * keeps track of of cool bar items
+ */
+ class WindowActionBarConfigurer implements IActionBarConfigurer2 {
+
+ private IActionBarConfigurer2 proxy;
+
+ /**
+ * Sets the proxy to use, or <code>null</code> for none.
+ *
+ * @param proxy the proxy
+ */
+ public void setProxy(IActionBarConfigurer2 proxy) {
+ this.proxy = proxy;
+ }
+
+ @Override
public IWorkbenchWindowConfigurer getWindowConfigurer() {
- return window.getWindowConfigurer();
- }
-
- /**
- * Returns whether the given id is for a cool item.
- *
- * @param the item id
- * @return <code>true</code> if it is a cool item,
- * and <code>false</code> otherwise
- */
- /* package */boolean containsCoolItem(String id) {
- ICoolBarManager cbManager = getCoolBarManager();
- if (cbManager == null) {
+ return window.getWindowConfigurer();
+ }
+
+ /**
+ * Returns whether the given id is for a cool item.
+ *
+ * @param the item id
+ * @return <code>true</code> if it is a cool item, and <code>false</code>
+ * otherwise
+ */
+ /* package */boolean containsCoolItem(String id) {
+ ICoolBarManager cbManager = getCoolBarManager();
+ if (cbManager == null) {
return false;
}
- IContributionItem cbItem = cbManager.find(id);
- if (cbItem == null) {
+ IContributionItem cbItem = cbManager.find(id);
+ if (cbItem == null) {
return false;
}
- //@ issue: maybe we should check if cbItem is visible?
- return true;
- }
+ // @ issue: maybe we should check if cbItem is visible?
+ return true;
+ }
- @Override
+ @Override
public IStatusLineManager getStatusLineManager() {
- if (proxy != null) {
- return proxy.getStatusLineManager();
- }
+ if (proxy != null) {
+ return proxy.getStatusLineManager();
+ }
return window.getStatusLineManager();
- }
+ }
- @Override
+ @Override
public IMenuManager getMenuManager() {
- if (proxy != null) {
- return proxy.getMenuManager();
- }
+ if (proxy != null) {
+ return proxy.getMenuManager();
+ }
return window.getMenuManager();
- }
+ }
- @Override
+ @Override
public ICoolBarManager getCoolBarManager() {
- if (proxy != null) {
- return proxy.getCoolBarManager();
- }
+ if (proxy != null) {
+ return proxy.getCoolBarManager();
+ }
return window.getCoolBarManager2();
- }
+ }
- @Override
+ @Override
public void registerGlobalAction(IAction action) {
- if (proxy != null) {
- proxy.registerGlobalAction(action);
- }
- window.registerGlobalAction(action);
- }
+ if (proxy != null) {
+ proxy.registerGlobalAction(action);
+ }
+ window.registerGlobalAction(action);
+ }
@Override
public IToolBarManager createToolBarManager() {
@@ -220,269 +219,269 @@ public final class WorkbenchWindowConfigurer implements
}
return new ToolBarContributionItem2(toolBarManager, id);
}
- }
-
- /**
- * Creates a new workbench window configurer.
- * <p>
- * This method is declared package-private. Clients obtain instances
- * via {@link WorkbenchAdvisor#getWindowConfigurer
- * WorkbenchAdvisor.getWindowConfigurer}
- * </p>
- *
- * @param window the workbench window that this object configures
- * @see WorkbenchAdvisor#getWindowConfigurer
- */
- WorkbenchWindowConfigurer(WorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- this.window = window;
- windowTitle = WorkbenchPlugin.getDefault().getProductName();
- if (windowTitle == null) {
- windowTitle = ""; //$NON-NLS-1$
- }
- }
-
- @Override
+ }
+
+ /**
+ * Creates a new workbench window configurer.
+ * <p>
+ * This method is declared package-private. Clients obtain instances via
+ * {@link WorkbenchAdvisor#getWindowConfigurer
+ * WorkbenchAdvisor.getWindowConfigurer}
+ * </p>
+ *
+ * @param window the workbench window that this object configures
+ * @see WorkbenchAdvisor#getWindowConfigurer
+ */
+ WorkbenchWindowConfigurer(WorkbenchWindow window) {
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ this.window = window;
+ windowTitle = WorkbenchPlugin.getDefault().getProductName();
+ if (windowTitle == null) {
+ windowTitle = ""; //$NON-NLS-1$
+ }
+ }
+
+ @Override
public IWorkbenchWindow getWindow() {
- return window;
- }
+ return window;
+ }
- @Override
+ @Override
public IWorkbenchConfigurer getWorkbenchConfigurer() {
- return Workbench.getInstance().getWorkbenchConfigurer();
- }
-
- /**
- * Returns the title as set by <code>setTitle</code>, without consulting the shell.
- *
- * @return the window title as set, or <code>null</code> if not set
- */
- /* package */String basicGetTitle() {
- return windowTitle;
- }
-
- @Override
+ return Workbench.getInstance().getWorkbenchConfigurer();
+ }
+
+ /**
+ * Returns the title as set by <code>setTitle</code>, without consulting the
+ * shell.
+ *
+ * @return the window title as set, or <code>null</code> if not set
+ */
+ /* package */String basicGetTitle() {
+ return windowTitle;
+ }
+
+ @Override
public String getTitle() {
- Shell shell = window.getShell();
- if (shell != null && !shell.isDisposed()) {
- // update the cached title
- windowTitle = shell.getText();
- }
- return windowTitle;
- }
-
- @Override
+ Shell shell = window.getShell();
+ if (shell != null && !shell.isDisposed()) {
+ // update the cached title
+ windowTitle = shell.getText();
+ }
+ return windowTitle;
+ }
+
+ @Override
public void setTitle(String title) {
- if (title == null) {
- throw new IllegalArgumentException();
- }
- windowTitle = title;
- Shell shell = window.getShell();
- if (shell != null && !shell.isDisposed()) {
- shell.setText(TextProcessor.process(title, WorkbenchWindow.TEXT_DELIMITERS));
- }
- }
-
- @Override
+ if (title == null) {
+ throw new IllegalArgumentException();
+ }
+ windowTitle = title;
+ Shell shell = window.getShell();
+ if (shell != null && !shell.isDisposed()) {
+ shell.setText(TextProcessor.process(title, WorkbenchWindow.TEXT_DELIMITERS));
+ }
+ }
+
+ @Override
public boolean getShowMenuBar() {
- return showMenuBar;
- }
+ return showMenuBar;
+ }
- @Override
+ @Override
public void setShowMenuBar(boolean show) {
- showMenuBar = show;
- WorkbenchWindow win = (WorkbenchWindow) getWindow();
- Shell shell = win.getShell();
- if (shell != null) {
- boolean showing = shell.getMenuBar() != null;
- if (show != showing) {
- if (show) {
+ showMenuBar = show;
+ WorkbenchWindow win = (WorkbenchWindow) getWindow();
+ Shell shell = win.getShell();
+ if (shell != null) {
+ boolean showing = shell.getMenuBar() != null;
+ if (show != showing) {
+ if (show) {
+ shell.setMenuBar(null);
+ } else {
shell.setMenuBar(null);
- } else {
- shell.setMenuBar(null);
- }
- }
- }
- }
-
- @Override
+ }
+ }
+ }
+ }
+
+ @Override
public boolean getShowCoolBar() {
- return showToolBar;
- }
+ return showToolBar;
+ }
- @Override
+ @Override
public void setShowCoolBar(boolean show) {
- showToolBar = show;
- // @issue need to be able to reconfigure after window's controls created
- }
-
- @Override
- public boolean getShowFastViewBars() {
- // not supported anymore
- return false;
- }
-
- @Override
- public void setShowFastViewBars(boolean show) {
- // not supported anymore
- }
-
- @Override
+ showToolBar = show;
+ // @issue need to be able to reconfigure after window's controls created
+ }
+
+ @Override
+ public boolean getShowFastViewBars() {
+ // not supported anymore
+ return false;
+ }
+
+ @Override
+ public void setShowFastViewBars(boolean show) {
+ // not supported anymore
+ }
+
+ @Override
public boolean getShowPerspectiveBar() {
- return showPerspectiveBar;
- }
+ return showPerspectiveBar;
+ }
- @Override
+ @Override
public void setShowPerspectiveBar(boolean show) {
- showPerspectiveBar = show;
- // @issue need to be able to reconfigure after window's controls created
- }
+ showPerspectiveBar = show;
+ // @issue need to be able to reconfigure after window's controls created
+ }
- @Override
+ @Override
public boolean getShowStatusLine() {
- return showStatusLine;
- }
+ return showStatusLine;
+ }
- @Override
+ @Override
public void setShowStatusLine(boolean show) {
- showStatusLine = show;
- window.setStatusLineVisible(show);
- // @issue need to be able to reconfigure after window's controls created
- }
+ showStatusLine = show;
+ window.setStatusLineVisible(show);
+ // @issue need to be able to reconfigure after window's controls created
+ }
- @Override
+ @Override
public boolean getShowProgressIndicator() {
- return showProgressIndicator;
- }
+ return showProgressIndicator;
+ }
- @Override
+ @Override
public void setShowProgressIndicator(boolean show) {
- showProgressIndicator = show;
- // @issue need to be able to reconfigure after window's controls created
- }
+ showProgressIndicator = show;
+ // @issue need to be able to reconfigure after window's controls created
+ }
- @Override
+ @Override
public Object getData(String key) {
- if (key == null) {
- throw new IllegalArgumentException();
- }
- return extraData.get(key);
- }
+ if (key == null) {
+ throw new IllegalArgumentException();
+ }
+ return extraData.get(key);
+ }
- @Override
+ @Override
public void setData(String key, Object data) {
- if (key == null) {
- throw new IllegalArgumentException();
- }
- if (data != null) {
- extraData.put(key, data);
- } else {
- extraData.remove(key);
- }
- }
-
- @Override
+ if (key == null) {
+ throw new IllegalArgumentException();
+ }
+ if (data != null) {
+ extraData.put(key, data);
+ } else {
+ extraData.remove(key);
+ }
+ }
+
+ @Override
public void addEditorAreaTransfer(Transfer tranfer) {
if (tranfer != null && !transferTypes.contains(tranfer)) {
transferTypes.add(tranfer);
}
- }
+ }
- @Override
- public void configureEditorAreaDropListener(
- DropTargetListener dropTargetListener) {
+ @Override
+ public void configureEditorAreaDropListener(DropTargetListener dropTargetListener) {
this.dropTargetListener = dropTargetListener;
- }
-
- /**
- * Returns the array of <code>Transfer</code> added by the application
- */
- /* package */Transfer[] getTransfers() {
- Transfer[] transfers = new Transfer[transferTypes.size()];
- transferTypes.toArray(transfers);
- return transfers;
- }
-
- /**
- * Returns the drop listener provided by the application.
- */
- /* package */DropTargetListener getDropTargetListener() {
- return dropTargetListener;
- }
-
- @Override
+ }
+
+ /**
+ * Returns the array of <code>Transfer</code> added by the application
+ */
+ /* package */Transfer[] getTransfers() {
+ Transfer[] transfers = new Transfer[transferTypes.size()];
+ transferTypes.toArray(transfers);
+ return transfers;
+ }
+
+ /**
+ * Returns the drop listener provided by the application.
+ */
+ /* package */DropTargetListener getDropTargetListener() {
+ return dropTargetListener;
+ }
+
+ @Override
public IActionBarConfigurer getActionBarConfigurer() {
- if (actionBarConfigurer == null) {
- // lazily initialize
- actionBarConfigurer = new WindowActionBarConfigurer();
- }
- return actionBarConfigurer;
- }
-
- /**
- * Returns whether the given id is for a cool item.
- *
- * @param the item id
- * @return <code>true</code> if it is a cool item,
- * and <code>false</code> otherwise
- */
- /* package */boolean containsCoolItem(String id) {
- // trigger lazy initialization
- getActionBarConfigurer();
- return actionBarConfigurer.containsCoolItem(id);
- }
-
- @Override
+ if (actionBarConfigurer == null) {
+ // lazily initialize
+ actionBarConfigurer = new WindowActionBarConfigurer();
+ }
+ return actionBarConfigurer;
+ }
+
+ /**
+ * Returns whether the given id is for a cool item.
+ *
+ * @param the item id
+ * @return <code>true</code> if it is a cool item, and <code>false</code>
+ * otherwise
+ */
+ /* package */boolean containsCoolItem(String id) {
+ // trigger lazy initialization
+ getActionBarConfigurer();
+ return actionBarConfigurer.containsCoolItem(id);
+ }
+
+ @Override
public int getShellStyle() {
- return shellStyle;
- }
+ return shellStyle;
+ }
- @Override
+ @Override
public void setShellStyle(int shellStyle) {
- this.shellStyle = shellStyle;
- }
+ this.shellStyle = shellStyle;
+ }
- @Override
+ @Override
public Point getInitialSize() {
- return initialSize;
- }
+ return initialSize;
+ }
- @Override
+ @Override
public void setInitialSize(Point size) {
- initialSize = size;
- }
+ initialSize = size;
+ }
- /**
- * Creates the default window contents.
- *
- * @param shell the shell
- */
- public void createDefaultContents(Shell shell) {
+ /**
+ * Creates the default window contents.
+ *
+ * @param shell the shell
+ */
+ public void createDefaultContents(Shell shell) {
- }
+ }
- @Override
+ @Override
public Menu createMenuBar() {
return null;
- }
+ }
- @Override
+ @Override
public Control createCoolBarControl(Composite parent) {
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public Control createStatusLineControl(Composite parent) {
return null;
- }
+ }
- @Override
+ @Override
public Control createPageComposite(Composite parent) {
return null;
- }
+ }
@Override
public IStatus saveState(IMemento memento) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindowPropertyTester.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindowPropertyTester.java
index 48272cb4fa8..31d87f9e48d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindowPropertyTester.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindowPropertyTester.java
@@ -28,8 +28,7 @@ public class WorkbenchWindowPropertyTester extends PropertyTester {
private static final String PROPERTY_IS_PERSPECTIVEBAR_VISIBLE = "isPerspectiveBarVisible"; //$NON-NLS-1$
@Override
- public boolean test(Object receiver, String property, Object[] args,
- Object expectedValue) {
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
if (args.length == 0 && receiver instanceof WorkbenchWindow) {
boolean defaultExpectedValue = true;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSet.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSet.java
index b32302f6152..7a13b53b7cb 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSet.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSet.java
@@ -48,14 +48,11 @@ public class WorkingSet extends AbstractWorkingSet {
/**
* Creates a new working set.
*
- * @param name
- * the name of the new working set. Should not have leading or
- * trailing whitespace.
- * @param label
- * the label of the new working set
- * @param elements
- * the content of the new working set. May be empty but not
- * <code>null</code>.
+ * @param name the name of the new working set. Should not have leading or
+ * trailing whitespace.
+ * @param label the label of the new working set
+ * @param elements the content of the new working set. May be empty but not
+ * <code>null</code>.
*/
public WorkingSet(String name, String label, IAdaptable[] elements) {
super(name, label);
@@ -65,19 +62,16 @@ public class WorkingSet extends AbstractWorkingSet {
/**
* Creates a new working set from a memento.
*
- * @param name
- * the name of the new working set. Should not have leading or
- * trailing whitespace.
- * @param memento
- * persistence memento containing the elements of the working
- * set.
+ * @param name the name of the new working set. Should not have leading or
+ * trailing whitespace.
+ * @param memento persistence memento containing the elements of the working
+ * set.
*/
protected WorkingSet(String name, String label, IMemento memento) {
super(name, label);
workingSetMemento = memento;
if (workingSetMemento != null) {
- String uniqueId = workingSetMemento
- .getString(IWorkbenchConstants.TAG_ID);
+ String uniqueId = workingSetMemento.getString(IWorkbenchConstants.TAG_ID);
if (uniqueId != null) {
setUniqueId(uniqueId);
}
@@ -87,8 +81,7 @@ public class WorkingSet extends AbstractWorkingSet {
/**
* Tests the receiver and the object for equality
*
- * @param object
- * object to compare the receiver to
+ * @param object object to compare the receiver to
* @return true=the object equals the receiver, the name is the same. false
* otherwise
*/
@@ -100,8 +93,7 @@ public class WorkingSet extends AbstractWorkingSet {
if (object instanceof WorkingSet) {
WorkingSet workingSet = (WorkingSet) object;
return Util.equals(workingSet.getName(), getName())
- && Util.equals(workingSet.getElementsArray(),
- getElementsArray())
+ && Util.equals(workingSet.getElementsArray(), getElementsArray())
&& Util.equals(workingSet.getId(), getId());
}
return false;
@@ -155,51 +147,43 @@ public class WorkingSet extends AbstractWorkingSet {
*/
@Override
void restoreWorkingSet() {
- IMemento[] itemMementos = workingSetMemento
- .getChildren(IWorkbenchConstants.TAG_ITEM);
+ IMemento[] itemMementos = workingSetMemento.getChildren(IWorkbenchConstants.TAG_ITEM);
final Set items = new HashSet();
for (final IMemento itemMemento : itemMementos) {
- final String factoryID = itemMemento
- .getString(IWorkbenchConstants.TAG_FACTORY_ID);
+ final String factoryID = itemMemento.getString(IWorkbenchConstants.TAG_FACTORY_ID);
if (factoryID == null) {
- WorkbenchPlugin
- .log("Unable to restore working set item - no factory ID."); //$NON-NLS-1$
+ WorkbenchPlugin.log("Unable to restore working set item - no factory ID."); //$NON-NLS-1$
continue;
}
- final IElementFactory factory = PlatformUI.getWorkbench()
- .getElementFactory(factoryID);
+ final IElementFactory factory = PlatformUI.getWorkbench().getElementFactory(factoryID);
if (factory == null) {
- WorkbenchPlugin
- .log("Unable to restore working set item - cannot instantiate factory: " + factoryID); //$NON-NLS-1$
+ WorkbenchPlugin.log("Unable to restore working set item - cannot instantiate factory: " + factoryID); //$NON-NLS-1$
continue;
}
- SafeRunner
- .run(new SafeRunnable(
- "Unable to restore working set item - exception while invoking factory: " + factoryID) { //$NON-NLS-1$
+ SafeRunner.run(new SafeRunnable(
+ "Unable to restore working set item - exception while invoking factory: " + factoryID) { //$NON-NLS-1$
- @Override
- public void run() throws Exception {
- IAdaptable item = factory
- .createElement(itemMemento);
- if (item == null) {
- if (Policy.DEBUG_WORKING_SETS)
- WorkbenchPlugin
- .log("Unable to restore working set item - cannot instantiate item: " + factoryID); //$NON-NLS-1$
+ @Override
+ public void run() throws Exception {
+ IAdaptable item = factory.createElement(itemMemento);
+ if (item == null) {
+ if (Policy.DEBUG_WORKING_SETS)
+ WorkbenchPlugin
+ .log("Unable to restore working set item - cannot instantiate item: " + factoryID); //$NON-NLS-1$
- } else
- items.add(item);
- }
- });
+ } else
+ items.add(item);
+ }
+ });
}
- internalSetElements((IAdaptable[]) items.toArray(new IAdaptable[items
- .size()]));
+ internalSetElements((IAdaptable[]) items.toArray(new IAdaptable[items.size()]));
}
/**
- * Implements IPersistableElement. Persist the working set name and working
- * set contents. The contents has to be either IPersistableElements or
- * provide adapters for it to be persistent.
+ * Implements IPersistableElement. Persist the working set name and working set
+ * contents. The contents has to be either IPersistableElements or provide
+ * adapters for it to be persistent.
*
* @see org.eclipse.ui.IPersistableElement#saveState(IMemento)
*/
@@ -219,20 +203,16 @@ public class WorkingSet extends AbstractWorkingSet {
IAdaptable adaptable = (IAdaptable) iterator.next();
final IPersistableElement persistable = Adapters.adapt(adaptable, IPersistableElement.class);
if (persistable != null) {
- final IMemento itemMemento = memento
- .createChild(IWorkbenchConstants.TAG_ITEM);
+ final IMemento itemMemento = memento.createChild(IWorkbenchConstants.TAG_ITEM);
- itemMemento.putString(IWorkbenchConstants.TAG_FACTORY_ID,
- persistable.getFactoryId());
- SafeRunner
- .run(new SafeRunnable(
- "Problems occurred while saving persistable item state") { //$NON-NLS-1$
+ itemMemento.putString(IWorkbenchConstants.TAG_FACTORY_ID, persistable.getFactoryId());
+ SafeRunner.run(new SafeRunnable("Problems occurred while saving persistable item state") { //$NON-NLS-1$
- @Override
- public void run() throws Exception {
- persistable.saveState(itemMemento);
- }
- });
+ @Override
+ public void run() throws Exception {
+ persistable.saveState(itemMemento);
+ }
+ });
}
}
}
@@ -269,16 +249,14 @@ public class WorkingSet extends AbstractWorkingSet {
/**
* Return the working set descriptor for this working set.
*
- * @param defaultId
- * the default working set type ID to use if this set has no
- * defined type
- * @return the descriptor for this working set or <code>null</code> if it
- * cannot be determined
+ * @param defaultId the default working set type ID to use if this set has no
+ * defined type
+ * @return the descriptor for this working set or <code>null</code> if it cannot
+ * be determined
* @since 3.3
*/
private WorkingSetDescriptor getDescriptor(String defaultId) {
- WorkingSetRegistry registry = WorkbenchPlugin.getDefault()
- .getWorkingSetRegistry();
+ WorkingSetRegistry registry = WorkbenchPlugin.getDefault().getWorkingSetRegistry();
String id = getId();
if (id == null)
id = defaultId;
@@ -295,8 +273,7 @@ public class WorkingSet extends AbstractWorkingSet {
WorkingSetDescriptor descriptor = getDescriptor(null);
if (descriptor == null || !descriptor.isElementAdapterClassLoaded())
return objects;
- return ((WorkingSetManager) manager).getElementAdapter(
- descriptor).adaptElements(this, objects);
+ return ((WorkingSetManager) manager).getElementAdapter(descriptor).adaptElements(this, objects);
}
return objects;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSetComparator.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSetComparator.java
index 41c091c88d6..4e89686ead0 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSetComparator.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSetComparator.java
@@ -35,14 +35,14 @@ public class WorkingSetComparator implements Comparator {
return (WorkingSetComparator) INSTANCES.get();
}
- private Collator fCollator = Collator.getInstance();
+ private Collator fCollator = Collator.getInstance();
- /**
- * Implements Comparator.
- *
- * @see Comparator#compare(Object, Object)
- */
- @Override
+ /**
+ * Implements Comparator.
+ *
+ * @see Comparator#compare(Object, Object)
+ */
+ @Override
public int compare(Object o1, Object o2) {
String name1 = null;
String name2 = null;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSetFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSetFactory.java
index ed73e81b7f5..a024ec55792 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSetFactory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSetFactory.java
@@ -18,44 +18,40 @@ import org.eclipse.ui.IElementFactory;
import org.eclipse.ui.IMemento;
/**
- * A WorkingSetFactory is used to recreate a persisted WorkingSet
- * object.
+ * A WorkingSetFactory is used to recreate a persisted WorkingSet object.
*/
public class WorkingSetFactory implements IElementFactory {
- @Override
+ @Override
public IAdaptable createElement(IMemento memento) {
- String workingSetName = memento.getString(IWorkbenchConstants.TAG_NAME);
- String label = memento.getString(IWorkbenchConstants.TAG_LABEL);
- if (label == null) {
+ String workingSetName = memento.getString(IWorkbenchConstants.TAG_NAME);
+ String label = memento.getString(IWorkbenchConstants.TAG_LABEL);
+ if (label == null) {
label = workingSetName;
}
- String workingSetEditPageId = memento
- .getString(IWorkbenchConstants.TAG_EDIT_PAGE_ID);
- String aggregateString = memento
- .getString(AbstractWorkingSet.TAG_AGGREGATE);
- boolean isAggregate = aggregateString != null
- && Boolean.parseBoolean(aggregateString);
+ String workingSetEditPageId = memento.getString(IWorkbenchConstants.TAG_EDIT_PAGE_ID);
+ String aggregateString = memento.getString(AbstractWorkingSet.TAG_AGGREGATE);
+ boolean isAggregate = aggregateString != null && Boolean.parseBoolean(aggregateString);
if (workingSetName == null) {
return null;
}
- AbstractWorkingSet workingSet = null;
+ AbstractWorkingSet workingSet = null;
- if (isAggregate) {
+ if (isAggregate) {
workingSet = new AggregateWorkingSet(workingSetName, label, memento);
} else {
workingSet = new WorkingSet(workingSetName, label, memento);
}
- if (workingSetEditPageId != null) {
- workingSet.setId(workingSetEditPageId);
- } else if (!isAggregate) {
- // working sets created with builds 20020418 and 20020419 will not
- // have an edit page id. fix this automatically.
- workingSet.setId("org.eclipse.ui.resourceWorkingSetPage"); //$NON-NLS-1$
- }
- return workingSet;
- }
+ if (workingSetEditPageId != null) {
+ workingSet.setId(workingSetEditPageId);
+ } else if (!isAggregate) {
+ // working sets created with builds 20020418 and 20020419 will not
+ // have an edit page id. fix this automatically.
+ workingSet.setId("org.eclipse.ui.resourceWorkingSetPage"); //$NON-NLS-1$
+ }
+ return workingSet;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSetManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSetManager.java
index 7b485a5355d..006294b091a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSetManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSetManager.java
@@ -42,8 +42,7 @@ import org.osgi.framework.BundleListener;
* @see IWorkingSetManager
* @since 2.0
*/
-public class WorkingSetManager extends AbstractWorkingSetManager implements
- IWorkingSetManager, BundleListener {
+public class WorkingSetManager extends AbstractWorkingSetManager implements IWorkingSetManager, BundleListener {
// Working set persistence
public static final String WORKING_SET_STATE_FILENAME = "workingsets.xml"; //$NON-NLS-1$
@@ -69,8 +68,8 @@ public class WorkingSetManager extends AbstractWorkingSetManager implements
}
/**
- * Returns the file used as the persistence store, or <code>null</code> if
- * there is no available file.
+ * Returns the file used as the persistence store, or <code>null</code> if there
+ * is no available file.
*
* @return the file used as the persistence store, or <code>null</code>
*/
@@ -101,17 +100,14 @@ public class WorkingSetManager extends AbstractWorkingSetManager implements
restoreInProgress = true;
FileInputStream input = new FileInputStream(stateFile);
- BufferedReader reader = new BufferedReader(
- new InputStreamReader(input, StandardCharsets.UTF_8));
+ BufferedReader reader = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8));
IMemento memento = XMLMemento.createReadRoot(reader);
restoreWorkingSetState(memento);
restoreMruList(memento);
reader.close();
} catch (IOException | WorkbenchException e) {
- handleInternalError(
- e,
- WorkbenchMessages.ProblemRestoringWorkingSetState_title,
+ handleInternalError(e, WorkbenchMessages.ProblemRestoringWorkingSetState_title,
WorkbenchMessages.ProblemRestoringWorkingSetState_message);
} finally {
restoreInProgress = false;
@@ -142,26 +138,22 @@ public class WorkingSetManager extends AbstractWorkingSetManager implements
saveState(stateFile);
} catch (IOException e) {
stateFile.delete();
- handleInternalError(e,
- WorkbenchMessages.ProblemSavingWorkingSetState_title,
+ handleInternalError(e, WorkbenchMessages.ProblemSavingWorkingSetState_title,
WorkbenchMessages.ProblemSavingWorkingSetState_message);
}
}
/**
- * Persists all working sets and fires a property change event for the
- * changed working set. Should only be called by
- * org.eclipse.ui.internal.WorkingSet.
+ * Persists all working sets and fires a property change event for the changed
+ * working set. Should only be called by org.eclipse.ui.internal.WorkingSet.
*
- * @param changedWorkingSet
- * the working set that has changed
- * @param propertyChangeId
- * the changed property. one of CHANGE_WORKING_SET_CONTENT_CHANGE
- * and CHANGE_WORKING_SET_NAME_CHANGE
+ * @param changedWorkingSet the working set that has changed
+ * @param propertyChangeId the changed property. one of
+ * CHANGE_WORKING_SET_CONTENT_CHANGE and
+ * CHANGE_WORKING_SET_NAME_CHANGE
*/
@Override
- public void workingSetChanged(IWorkingSet changedWorkingSet,
- String propertyChangeId, Object oldValue) {
+ public void workingSetChanged(IWorkingSet changedWorkingSet, String propertyChangeId, Object oldValue) {
saveState();
super.workingSetChanged(changedWorkingSet, propertyChangeId, oldValue);
}
@@ -170,12 +162,10 @@ public class WorkingSetManager extends AbstractWorkingSetManager implements
* Show and Log the exception using StatusManager.
*/
private void handleInternalError(Exception exp, String title, String message) {
- Status status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH,
- message, exp);
+ Status status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, message, exp);
StatusAdapter sa = new StatusAdapter(status);
sa.setProperty(IStatusAdapterConstants.TITLE_PROPERTY, title);
- StatusManager.getManager().handle(sa,
- StatusManager.SHOW | StatusManager.LOG);
+ StatusManager.getManager().handle(sa, StatusManager.SHOW | StatusManager.LOG);
}
@Override
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSetMenuContributionItem.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSetMenuContributionItem.java
index 46e430a3e8a..9927ba09584 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSetMenuContributionItem.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSetMenuContributionItem.java
@@ -34,74 +34,73 @@ import org.eclipse.ui.actions.WorkingSetFilterActionGroup;
* @since 2.1
*/
public class WorkingSetMenuContributionItem extends ContributionItem {
- private Image image;
+ private Image image;
- private int id;
+ private int id;
- private IWorkingSet workingSet;
+ private IWorkingSet workingSet;
- private WorkingSetFilterActionGroup actionGroup;
+ private WorkingSetFilterActionGroup actionGroup;
- /**
- * Returns the id of this menu contribution item
- *
- * @param id numerical id
- * @return String string id
- */
- public static String getId(int id) {
- return WorkingSetMenuContributionItem.class.getName() + "." + id; //$NON-NLS-1$
- }
+ /**
+ * Returns the id of this menu contribution item
+ *
+ * @param id numerical id
+ * @return String string id
+ */
+ public static String getId(int id) {
+ return WorkingSetMenuContributionItem.class.getName() + "." + id; //$NON-NLS-1$
+ }
- /**
- * Creates a new instance of the receiver.
- *
- * @param id sequential id of the new instance
- * @param actionGroup the action group this contribution item is created in
- */
- public WorkingSetMenuContributionItem(int id,
- WorkingSetFilterActionGroup actionGroup, IWorkingSet workingSet) {
- super(getId(id));
- Assert.isNotNull(actionGroup);
- Assert.isNotNull(workingSet);
- this.id = id;
- this.actionGroup = actionGroup;
- this.workingSet = workingSet;
- }
+ /**
+ * Creates a new instance of the receiver.
+ *
+ * @param id sequential id of the new instance
+ * @param actionGroup the action group this contribution item is created in
+ */
+ public WorkingSetMenuContributionItem(int id, WorkingSetFilterActionGroup actionGroup, IWorkingSet workingSet) {
+ super(getId(id));
+ Assert.isNotNull(actionGroup);
+ Assert.isNotNull(workingSet);
+ this.id = id;
+ this.actionGroup = actionGroup;
+ this.workingSet = workingSet;
+ }
- /**
- * Adds a menu item for the working set.
- * Overrides method from ContributionItem.
- *
- * @see org.eclipse.jface.action.ContributionItem#fill(Menu,int)
- */
- @Override
+ /**
+ * Adds a menu item for the working set. Overrides method from ContributionItem.
+ *
+ * @see org.eclipse.jface.action.ContributionItem#fill(Menu,int)
+ */
+ @Override
public void fill(Menu menu, int index) {
- MenuItem mi = new MenuItem(menu, SWT.RADIO, index);
- mi.setText("&" + id + " " + workingSet.getLabel()); //$NON-NLS-1$ //$NON-NLS-2$
- mi.setSelection(workingSet.equals(actionGroup.getWorkingSet()));
- mi.addSelectionListener(widgetSelectedAdapter(e -> {
+ MenuItem mi = new MenuItem(menu, SWT.RADIO, index);
+ mi.setText("&" + id + " " + workingSet.getLabel()); //$NON-NLS-1$ //$NON-NLS-2$
+ mi.setSelection(workingSet.equals(actionGroup.getWorkingSet()));
+ mi.addSelectionListener(widgetSelectedAdapter(e -> {
IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager();
- actionGroup.setWorkingSet(workingSet);
- manager.addRecentWorkingSet(workingSet);
+ actionGroup.setWorkingSet(workingSet);
+ manager.addRecentWorkingSet(workingSet);
}));
- if (image == null) {
+ if (image == null) {
ImageDescriptor imageDescriptor = workingSet.getImageDescriptor();
if (imageDescriptor != null)
image = imageDescriptor.createImage();
}
mi.setImage(image);
- }
+ }
- /**
- * Overridden to always return true and force dynamic menu building.
- */
- @Override
+ /**
+ * Overridden to always return true and force dynamic menu building.
+ */
+ @Override
public boolean isDynamic() {
- return true;
- }
+ return true;
+ }
/*
* @see org.eclipse.jface.action.ContributionItem#dispose()
+ *
* @since 3.3
*/
@Override
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutAction.java
index 07bd2b40772..ba112648843 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutAction.java
@@ -30,54 +30,52 @@ import org.eclipse.ui.internal.dialogs.AboutDialog;
/**
* Creates an About dialog and opens it.
*/
-public class AboutAction extends Action implements
- ActionFactory.IWorkbenchAction {
+public class AboutAction extends Action implements ActionFactory.IWorkbenchAction {
- /**
- * The workbench window; or <code>null</code> if this action has been
- * <code>dispose</code>d.
- */
- private IWorkbenchWindow workbenchWindow;
+ /**
+ * The workbench window; or <code>null</code> if this action has been
+ * <code>dispose</code>d.
+ */
+ private IWorkbenchWindow workbenchWindow;
- /**
- * Creates a new <code>AboutAction</code>.
- *
- * @param window the window
- */
- public AboutAction(IWorkbenchWindow window) {
- if (window == null) {
+ /**
+ * Creates a new <code>AboutAction</code>.
+ *
+ * @param window the window
+ */
+ public AboutAction(IWorkbenchWindow window) {
+ if (window == null) {
throw new IllegalArgumentException();
}
- this.workbenchWindow = window;
+ this.workbenchWindow = window;
- // use message with no fill-in
- IProduct product = Platform.getProduct();
- String productName = null;
- if (product != null) {
+ // use message with no fill-in
+ IProduct product = Platform.getProduct();
+ String productName = null;
+ if (product != null) {
productName = product.getName();
}
- if (productName == null) {
+ if (productName == null) {
productName = ""; //$NON-NLS-1$
}
- setText(NLS.bind(WorkbenchMessages.AboutAction_text,productName));
- setToolTipText(NLS.bind(WorkbenchMessages.AboutAction_toolTip, productName));
- setId("about"); //$NON-NLS-1$
+ setText(NLS.bind(WorkbenchMessages.AboutAction_text, productName));
+ setToolTipText(NLS.bind(WorkbenchMessages.AboutAction_toolTip, productName));
+ setId("about"); //$NON-NLS-1$
setActionDefinitionId(IWorkbenchCommandConstants.HELP_ABOUT);
- window.getWorkbench().getHelpSystem().setHelp(this,
- IWorkbenchHelpContextIds.ABOUT_ACTION);
- }
+ window.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.ABOUT_ACTION);
+ }
- @Override
+ @Override
public void run() {
- // make sure action is not disposed
- if (workbenchWindow != null) {
+ // make sure action is not disposed
+ if (workbenchWindow != null) {
new AboutDialog(workbenchWindow.getShell()).open();
}
- }
+ }
- @Override
+ @Override
public void dispose() {
- workbenchWindow = null;
- }
+ workbenchWindow = null;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutBundleData.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutBundleData.java
index b3e98b0dc82..b1f20e40818 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutBundleData.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutBundleData.java
@@ -26,87 +26,79 @@ import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceReference;
-
-
/**
* A small class to manage the about dialog information for a single bundle.
+ *
* @since 3.0
*/
public class AboutBundleData extends AboutData {
private Bundle bundle;
- private boolean isSignedDetermined = false;
+ private boolean isSignedDetermined = false;
private boolean isSigned;
- public AboutBundleData(Bundle bundle) {
- super(getResourceString(bundle, Constants.BUNDLE_VENDOR),
- getResourceString(bundle, Constants.BUNDLE_NAME),
- getResourceString(bundle, Constants.BUNDLE_VERSION), bundle
- .getSymbolicName());
-
- this.bundle = bundle;
-
- }
-
- public int getState() {
- return bundle.getState();
- }
-
- /**
- * @return a string representation of the argument state.
- * Does not return null.
- */
- public String getStateName() {
- switch (getState()) {
- case Bundle.INSTALLED:
- return WorkbenchMessages.AboutPluginsDialog_state_installed;
- case Bundle.RESOLVED:
- return WorkbenchMessages.AboutPluginsDialog_state_resolved;
- case Bundle.STARTING:
- return WorkbenchMessages.AboutPluginsDialog_state_starting;
- case Bundle.STOPPING:
- return WorkbenchMessages.AboutPluginsDialog_state_stopping;
- case Bundle.UNINSTALLED:
- return WorkbenchMessages.AboutPluginsDialog_state_uninstalled;
- case Bundle.ACTIVE:
- return WorkbenchMessages.AboutPluginsDialog_state_active;
- default:
- return WorkbenchMessages.AboutPluginsDialog_state_unknown;
- }
- }
-
- /**
- * A function to translate the resource tags that may be embedded in a
- * string associated with some bundle.
- *
- * @param headerName
- * the used to retrieve the correct string
- * @return the string or null if the string cannot be found
- */
- private static String getResourceString(Bundle bundle, String headerName) {
- String value = bundle.getHeaders().get(headerName);
- return value == null ? null : Platform.getResourceString(bundle, value);
- }
-
- public boolean isSignedDetermined() {
- return isSignedDetermined;
- }
-
- public boolean isSigned() throws IllegalStateException {
+ public AboutBundleData(Bundle bundle) {
+ super(getResourceString(bundle, Constants.BUNDLE_VENDOR), getResourceString(bundle, Constants.BUNDLE_NAME),
+ getResourceString(bundle, Constants.BUNDLE_VERSION), bundle.getSymbolicName());
+
+ this.bundle = bundle;
+
+ }
+
+ public int getState() {
+ return bundle.getState();
+ }
+
+ /**
+ * @return a string representation of the argument state. Does not return null.
+ */
+ public String getStateName() {
+ switch (getState()) {
+ case Bundle.INSTALLED:
+ return WorkbenchMessages.AboutPluginsDialog_state_installed;
+ case Bundle.RESOLVED:
+ return WorkbenchMessages.AboutPluginsDialog_state_resolved;
+ case Bundle.STARTING:
+ return WorkbenchMessages.AboutPluginsDialog_state_starting;
+ case Bundle.STOPPING:
+ return WorkbenchMessages.AboutPluginsDialog_state_stopping;
+ case Bundle.UNINSTALLED:
+ return WorkbenchMessages.AboutPluginsDialog_state_uninstalled;
+ case Bundle.ACTIVE:
+ return WorkbenchMessages.AboutPluginsDialog_state_active;
+ default:
+ return WorkbenchMessages.AboutPluginsDialog_state_unknown;
+ }
+ }
+
+ /**
+ * A function to translate the resource tags that may be embedded in a string
+ * associated with some bundle.
+ *
+ * @param headerName the used to retrieve the correct string
+ * @return the string or null if the string cannot be found
+ */
+ private static String getResourceString(Bundle bundle, String headerName) {
+ String value = bundle.getHeaders().get(headerName);
+ return value == null ? null : Platform.getResourceString(bundle, value);
+ }
+
+ public boolean isSignedDetermined() {
+ return isSignedDetermined;
+ }
+
+ public boolean isSigned() throws IllegalStateException {
if (isSignedDetermined)
return isSigned;
- BundleContext bundleContext = WorkbenchPlugin.getDefault()
- .getBundleContext();
- ServiceReference<?> factoryRef = bundleContext
- .getServiceReference(SignedContentFactory.class.getName());
+ BundleContext bundleContext = WorkbenchPlugin.getDefault().getBundleContext();
+ ServiceReference<?> factoryRef = bundleContext.getServiceReference(SignedContentFactory.class.getName());
if (factoryRef == null)
throw new IllegalStateException();
- SignedContentFactory contentFactory = (SignedContentFactory) bundleContext
- .getService(factoryRef);
+ SignedContentFactory contentFactory = (SignedContentFactory) bundleContext.getService(factoryRef);
try {
SignedContent signedContent = contentFactory.getSignedContent(bundle);
isSigned = signedContent != null && signedContent.isSigned();
@@ -114,7 +106,7 @@ public class AboutBundleData extends AboutData {
return isSigned;
} catch (IOException e) {
throw (IllegalStateException) new IllegalStateException().initCause(e);
- } catch (GeneralSecurityException e){
+ } catch (GeneralSecurityException e) {
throw (IllegalStateException) new IllegalStateException().initCause(e);
} finally {
bundleContext.ungetService(factoryRef);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutBundleGroupData.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutBundleGroupData.java
index 18ea33932a4..bf0cf896e71 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutBundleGroupData.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutBundleGroupData.java
@@ -24,94 +24,93 @@ import org.eclipse.ui.branding.IBundleGroupConstants;
/**
* A small class to manage the information related to IBundleGroup's.
+ *
* @since 3.0
*/
public class AboutBundleGroupData extends AboutData {
- private IBundleGroup bundleGroup;
+ private IBundleGroup bundleGroup;
- private URL licenseUrl;
+ private URL licenseUrl;
- private URL featureImageUrl;
+ private URL featureImageUrl;
- private Long featureImageCrc;
+ private Long featureImageCrc;
- private ImageDescriptor featureImage;
+ private ImageDescriptor featureImage;
- public AboutBundleGroupData(IBundleGroup bundleGroup) {
- super(bundleGroup.getProviderName(), bundleGroup.getName(), bundleGroup
- .getVersion(), bundleGroup.getIdentifier());
- this.bundleGroup = bundleGroup;
- }
+ public AboutBundleGroupData(IBundleGroup bundleGroup) {
+ super(bundleGroup.getProviderName(), bundleGroup.getName(), bundleGroup.getVersion(),
+ bundleGroup.getIdentifier());
+ this.bundleGroup = bundleGroup;
+ }
- public IBundleGroup getBundleGroup() {
- return bundleGroup;
- }
+ public IBundleGroup getBundleGroup() {
+ return bundleGroup;
+ }
- public URL getLicenseUrl() {
- if (licenseUrl == null) {
- licenseUrl = getURL(bundleGroup
- .getProperty(IBundleGroupConstants.LICENSE_HREF));
+ public URL getLicenseUrl() {
+ if (licenseUrl == null) {
+ licenseUrl = getURL(bundleGroup.getProperty(IBundleGroupConstants.LICENSE_HREF));
}
- return licenseUrl;
- }
+ return licenseUrl;
+ }
- public URL getFeatureImageUrl() {
- if (featureImageUrl == null) {
- featureImageUrl = getURL(bundleGroup
- .getProperty(IBundleGroupConstants.FEATURE_IMAGE));
+ public URL getFeatureImageUrl() {
+ if (featureImageUrl == null) {
+ featureImageUrl = getURL(bundleGroup.getProperty(IBundleGroupConstants.FEATURE_IMAGE));
}
- return featureImageUrl;
- }
+ return featureImageUrl;
+ }
- public ImageDescriptor getFeatureImage() {
- if (featureImage == null) {
+ public ImageDescriptor getFeatureImage() {
+ if (featureImage == null) {
featureImage = getImage(getFeatureImageUrl());
}
- return featureImage;
- }
+ return featureImage;
+ }
- public Long getFeatureImageCrc() {
- if (featureImageCrc != null) {
+ public Long getFeatureImageCrc() {
+ if (featureImageCrc != null) {
return featureImageCrc;
}
- URL url = getFeatureImageUrl();
- if (url == null) {
+ URL url = getFeatureImageUrl();
+ if (url == null) {
return null;
}
- // Get the image bytes
- InputStream in = null;
- try {
- CRC32 checksum = new CRC32();
- in = new CheckedInputStream(url.openStream(), checksum);
+ // Get the image bytes
+ InputStream in = null;
+ try {
+ CRC32 checksum = new CRC32();
+ in = new CheckedInputStream(url.openStream(), checksum);
- // the contents don't matter, the read just needs a place to go
- byte[] sink = new byte[1024];
- while (true) {
+ // the contents don't matter, the read just needs a place to go
+ byte[] sink = new byte[1024];
+ while (true) {
if (in.read(sink) <= 0) {
break;
}
}
featureImageCrc = Long.valueOf(checksum.getValue());
- return featureImageCrc;
+ return featureImageCrc;
- } catch (IOException e) {
- return null;
- } finally {
- if (in != null) {
+ } catch (IOException e) {
+ return null;
+ } finally {
+ if (in != null) {
try {
- in.close();
- } catch (IOException e) {
- // do nothing
- }
+ in.close();
+ } catch (IOException e) {
+ // do nothing
+ }
}
- }
- }
+ }
+ }
- public String getAboutText() {
- return bundleGroup.getProperty(IBundleGroupConstants.ABOUT_TEXT);
- }
+ public String getAboutText() {
+ return bundleGroup.getProperty(IBundleGroupConstants.ABOUT_TEXT);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutData.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutData.java
index e93a7abda9d..a3cfbe230dc 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutData.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutData.java
@@ -25,216 +25,209 @@ import java.util.Locale;
import org.eclipse.jface.resource.ImageDescriptor;
/**
- * An abstract parent that describes data that can be displayed in a table in one of
- * the about dialogs.
+ * An abstract parent that describes data that can be displayed in a table in
+ * one of the about dialogs.
+ *
* @since 3.0
*/
public abstract class AboutData {
- private String providerName;
+ private String providerName;
- private String name;
+ private String name;
- private String version;
+ private String version;
- private String id;
+ private String id;
- private String versionedId = null;
+ private String versionedId = null;
- protected AboutData(String providerName, String name, String version,
- String id) {
- this.providerName = providerName == null ? "" : providerName; //$NON-NLS-1$
- this.name = name == null ? "" : name; //$NON-NLS-1$
- this.version = version == null ? "" : version; //$NON-NLS-1$
- this.id = id == null ? "" : id; //$NON-NLS-1$
- }
+ protected AboutData(String providerName, String name, String version, String id) {
+ this.providerName = providerName == null ? "" : providerName; //$NON-NLS-1$
+ this.name = name == null ? "" : name; //$NON-NLS-1$
+ this.version = version == null ? "" : version; //$NON-NLS-1$
+ this.id = id == null ? "" : id; //$NON-NLS-1$
+ }
- public String getId() {
- return id;
- }
+ public String getId() {
+ return id;
+ }
- public String getName() {
- return name;
- }
+ public String getName() {
+ return name;
+ }
- public String getProviderName() {
- return providerName;
- }
+ public String getProviderName() {
+ return providerName;
+ }
- public String getVersion() {
- return version;
- }
+ public String getVersion() {
+ return version;
+ }
- public String getVersionedId() {
- if (versionedId == null) {
+ public String getVersionedId() {
+ if (versionedId == null) {
versionedId = getId() + "_" + getVersion(); //$NON-NLS-1$
}
- return versionedId;
- }
-
- /**
- * Modify the argument array to reverse the sort order.
- * @param infos
- */
- private static void reverse(AboutData[] infos) {
+ return versionedId;
+ }
+
+ /**
+ * Modify the argument array to reverse the sort order.
+ *
+ * @param infos
+ */
+ private static void reverse(AboutData[] infos) {
List<AboutData> infoList = Arrays.asList(infos);
- Collections.reverse(infoList);
- for (int i = 0; i < infos.length; ++i) {
+ Collections.reverse(infoList);
+ for (int i = 0; i < infos.length; ++i) {
infos[i] = infoList.get(i);
}
- }
-
- /**
- * Modify the argument array to be sorted by provider. If the reverse
- * boolean is true, the array is assumed to already be sorted and the
- * direction of sort (ascending vs. descending) is reversed. Entries
- * with the same name are sorted by name.
- *
- * @param reverse
- * if true then the order of the argument is reversed without
- * examining the value of the fields
- * @param infos
- * the data to be sorted
- */
- public static void sortByProvider(boolean reverse, AboutData[] infos) {
- if (reverse) {
- reverse(infos);
- return;
- }
+ }
+
+ /**
+ * Modify the argument array to be sorted by provider. If the reverse boolean is
+ * true, the array is assumed to already be sorted and the direction of sort
+ * (ascending vs. descending) is reversed. Entries with the same name are sorted
+ * by name.
+ *
+ * @param reverse if true then the order of the argument is reversed without
+ * examining the value of the fields
+ * @param infos the data to be sorted
+ */
+ public static void sortByProvider(boolean reverse, AboutData[] infos) {
+ if (reverse) {
+ reverse(infos);
+ return;
+ }
Arrays.sort(infos, new Comparator<AboutData>() {
- Collator collator = Collator.getInstance(Locale.getDefault());
+ Collator collator = Collator.getInstance(Locale.getDefault());
@Override
public int compare(AboutData info1, AboutData info2) {
String provider1 = info1.getProviderName();
- String provider2 = info2.getProviderName();
+ String provider2 = info2.getProviderName();
- if (!provider1.equals(provider2)) {
+ if (!provider1.equals(provider2)) {
return collator.compare(provider1, provider2);
}
- return collator.compare(info1.getName(), info2.getName());
- }
- });
- }
-
- /**
- * Modify the argument array to be sorted by name. If the reverse
- * boolean is true, the array is assumed to already be sorted and the
- * direction of sort (ascending vs. descending) is reversed.
- *
- * @param reverse
- * if true then the order of the argument is reversed without
- * examining the value of the fields
- * @param infos
- * the data to be sorted
- */
- public static void sortByName(boolean reverse, AboutData[] infos) {
- if (reverse) {
- reverse(infos);
- return;
- }
+ return collator.compare(info1.getName(), info2.getName());
+ }
+ });
+ }
+
+ /**
+ * Modify the argument array to be sorted by name. If the reverse boolean is
+ * true, the array is assumed to already be sorted and the direction of sort
+ * (ascending vs. descending) is reversed.
+ *
+ * @param reverse if true then the order of the argument is reversed without
+ * examining the value of the fields
+ * @param infos the data to be sorted
+ */
+ public static void sortByName(boolean reverse, AboutData[] infos) {
+ if (reverse) {
+ reverse(infos);
+ return;
+ }
Arrays.sort(infos, new Comparator<AboutData>() {
- Collator collator = Collator.getInstance(Locale.getDefault());
+ Collator collator = Collator.getInstance(Locale.getDefault());
@Override
public int compare(AboutData info1, AboutData info2) {
return collator.compare(info1.getName(), info2.getName());
- }
- });
- }
-
- /**
- * Modify the argument array to be sorted by version. If the reverse
- * boolean is true, the array is assumed to already be sorted and the
- * direction of sort (ascending vs. descending) is reversed. Entries
- * with the same name are sorted by name.
- *
- * @param reverse
- * if true then the order of the argument is reversed without
- * examining the value of the fields
- * @param infos
- * the data to be sorted
- */
- public static void sortByVersion(boolean reverse, AboutData[] infos) {
- if (reverse) {
- reverse(infos);
- return;
- }
+ }
+ });
+ }
+
+ /**
+ * Modify the argument array to be sorted by version. If the reverse boolean is
+ * true, the array is assumed to already be sorted and the direction of sort
+ * (ascending vs. descending) is reversed. Entries with the same name are sorted
+ * by name.
+ *
+ * @param reverse if true then the order of the argument is reversed without
+ * examining the value of the fields
+ * @param infos the data to be sorted
+ */
+ public static void sortByVersion(boolean reverse, AboutData[] infos) {
+ if (reverse) {
+ reverse(infos);
+ return;
+ }
Arrays.sort(infos, new Comparator<AboutData>() {
- Collator collator = Collator.getInstance(Locale.getDefault());
+ Collator collator = Collator.getInstance(Locale.getDefault());
@Override
public int compare(AboutData info1, AboutData info2) {
- String version1 = info1.getVersion();
- String version2 = info2.getVersion();
+ String version1 = info1.getVersion();
+ String version2 = info2.getVersion();
- if (!version1.equals(version2)) {
+ if (!version1.equals(version2)) {
return collator.compare(version1, version2);
}
- return collator.compare(info1.getName(), info2.getName());
- }
- });
- }
-
- /**
- * Modify the argument array to be sorted by id. If the reverse
- * boolean is true, the array is assumed to already be sorted and the
- * direction of sort (ascending vs. descending) is reversed. Entries
- * with the same name are sorted by name.
- *
- * @param reverse
- * if true then the order of the argument is reversed without
- * examining the value of the fields
- * @param infos
- * the data to be sorted
- */
- public static void sortById(boolean reverse, AboutData[] infos) {
- if (reverse) {
- reverse(infos);
- return;
- }
+ return collator.compare(info1.getName(), info2.getName());
+ }
+ });
+ }
+
+ /**
+ * Modify the argument array to be sorted by id. If the reverse boolean is true,
+ * the array is assumed to already be sorted and the direction of sort
+ * (ascending vs. descending) is reversed. Entries with the same name are sorted
+ * by name.
+ *
+ * @param reverse if true then the order of the argument is reversed without
+ * examining the value of the fields
+ * @param infos the data to be sorted
+ */
+ public static void sortById(boolean reverse, AboutData[] infos) {
+ if (reverse) {
+ reverse(infos);
+ return;
+ }
Arrays.sort(infos, new Comparator<AboutData>() {
- Collator collator = Collator.getInstance(Locale.getDefault());
+ Collator collator = Collator.getInstance(Locale.getDefault());
@Override
public int compare(AboutData info1, AboutData info2) {
- String id1 = info1.getId();
- String id2 = info2.getId();
+ String id1 = info1.getId();
+ String id2 = info2.getId();
- if (!id1.equals(id2)) {
+ if (!id1.equals(id2)) {
return collator.compare(id1, id2);
}
- return collator.compare(info1.getName(), info2.getName());
- }
- });
- }
+ return collator.compare(info1.getName(), info2.getName());
+ }
+ });
+ }
- protected static URL getURL(String value) {
- try {
- if (value != null) {
+ protected static URL getURL(String value) {
+ try {
+ if (value != null) {
return new URL(value);
}
- } catch (IOException e) {
- // do nothing
- }
+ } catch (IOException e) {
+ // do nothing
+ }
- return null;
- }
+ return null;
+ }
- protected static ImageDescriptor getImage(URL url) {
- return url == null ? null : ImageDescriptor.createFromURL(url);
- }
+ protected static ImageDescriptor getImage(URL url) {
+ return url == null ? null : ImageDescriptor.createFromURL(url);
+ }
- protected static ImageDescriptor getImage(String value) {
- return getImage(getURL(value));
- }
+ protected static ImageDescriptor getImage(String value) {
+ return getImage(getURL(value));
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutFeaturesButtonManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutFeaturesButtonManager.java
index 94470c5fd2c..c1ea5db41e3 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutFeaturesButtonManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutFeaturesButtonManager.java
@@ -20,88 +20,88 @@ import java.util.Map;
/**
* Utility class used to associate BundleInfo's that have the same provider and
- * image. The algorithm in <code>java.util.zip.CRC32</code> is used to determine
+ * image. The algorithm in <code>java.util.zip.CRC32</code> is used to determine
* image identity.
*/
public class AboutFeaturesButtonManager {
private Map<Key, List<AboutBundleGroupData>> providerMap = new HashMap<>();
- private static class Key {
- public String providerName;
+ private static class Key {
+ public String providerName;
- public Long crc;
+ public Long crc;
- /**
- * @param crc must not be null
- */
- public Key(String providerName, Long crc) {
- this.providerName = providerName;
- this.crc = crc;
- }
+ /**
+ * @param crc must not be null
+ */
+ public Key(String providerName, Long crc) {
+ this.providerName = providerName;
+ this.crc = crc;
+ }
- @Override
+ @Override
public boolean equals(Object o) {
- if (!(o instanceof Key)) {
+ if (!(o instanceof Key)) {
return false;
}
- Key other = (Key) o;
- if (!providerName.equals(other.providerName)) {
+ Key other = (Key) o;
+ if (!providerName.equals(other.providerName)) {
return false;
}
- return crc.equals(other.crc);
- }
+ return crc.equals(other.crc);
+ }
- @Override
+ @Override
public int hashCode() {
- return providerName.hashCode();
- }
- }
+ return providerName.hashCode();
+ }
+ }
- /**
- * @return true if a button should be added (i.e., the argument has an image
- * and it does not already have a button)
- */
- public boolean add(AboutBundleGroupData info) {
- // no button for features without an image
- Long crc = info.getFeatureImageCrc();
- if (crc == null) {
+ /**
+ * @return true if a button should be added (i.e., the argument has an image and
+ * it does not already have a button)
+ */
+ public boolean add(AboutBundleGroupData info) {
+ // no button for features without an image
+ Long crc = info.getFeatureImageCrc();
+ if (crc == null) {
return false;
}
- String providerName = info.getProviderName();
- Key key = new Key(providerName, crc);
+ String providerName = info.getProviderName();
+ Key key = new Key(providerName, crc);
List<AboutBundleGroupData> infoList = providerMap.get(key);
- if (infoList != null) {
- infoList.add(info);
- return false;
- }
+ if (infoList != null) {
+ infoList.add(info);
+ return false;
+ }
infoList = new ArrayList<>();
- infoList.add(info);
- providerMap.put(key, infoList);
- return true;
- }
+ infoList.add(info);
+ providerMap.put(key, infoList);
+ return true;
+ }
- /**
- * Return an array of all bundle groups that share the argument's provider and
- * image. Returns an empty array if there isn't any related information.
- */
- public AboutBundleGroupData[] getRelatedInfos(AboutBundleGroupData info) {
- // if there's no image, then there won't be a button
- Long crc = info.getFeatureImageCrc();
- if (crc == null) {
+ /**
+ * Return an array of all bundle groups that share the argument's provider and
+ * image. Returns an empty array if there isn't any related information.
+ */
+ public AboutBundleGroupData[] getRelatedInfos(AboutBundleGroupData info) {
+ // if there's no image, then there won't be a button
+ Long crc = info.getFeatureImageCrc();
+ if (crc == null) {
return new AboutBundleGroupData[0];
}
- String providerName = info.getProviderName();
- Key key = new Key(providerName, crc);
+ String providerName = info.getProviderName();
+ Key key = new Key(providerName, crc);
List<AboutBundleGroupData> infoList = providerMap.get(key);
- if (infoList == null) {
+ if (infoList == null) {
return new AboutBundleGroupData[0];
}
return infoList.toArray(new AboutBundleGroupData[0]);
- }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutFeaturesPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutFeaturesPage.java
index 23411bc8a86..bd0211da0b5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutFeaturesPage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutFeaturesPage.java
@@ -90,10 +90,8 @@ public class AboutFeaturesPage extends ProductInfoPage {
private AboutBundleGroupData[] bundleGroupInfos;
- private String columnTitles[] = {
- WorkbenchMessages.AboutFeaturesDialog_provider,
- WorkbenchMessages.AboutFeaturesDialog_featureName,
- WorkbenchMessages.AboutFeaturesDialog_version,
+ private String columnTitles[] = { WorkbenchMessages.AboutFeaturesDialog_provider,
+ WorkbenchMessages.AboutFeaturesDialog_featureName, WorkbenchMessages.AboutFeaturesDialog_version,
WorkbenchMessages.AboutFeaturesDialog_featureId, };
private int lastColumnChosen = 0; // initially sort by provider
@@ -135,15 +133,14 @@ public class AboutFeaturesPage extends ProductInfoPage {
// copy, since the client set this value.
AboutBundleGroupData[] clientArray = bundleGroupInfos;
bundleGroupInfos = new AboutBundleGroupData[clientArray.length];
- System.arraycopy(clientArray, 0, bundleGroupInfos, 0,
- clientArray.length);
+ System.arraycopy(clientArray, 0, bundleGroupInfos, 0, clientArray.length);
}
AboutData.sortByProvider(reverseSort, bundleGroupInfos);
}
/**
- * The Plugins button was pressed. Open an about dialog on the plugins for
- * the selected feature.
+ * The Plugins button was pressed. Open an about dialog on the plugins for the
+ * selected feature.
*/
private void handlePluginInfoPressed() {
TableItem[] items = table.getSelection();
@@ -153,30 +150,20 @@ public class AboutFeaturesPage extends ProductInfoPage {
AboutBundleGroupData info = (AboutBundleGroupData) items[0].getData();
IBundleGroup bundleGroup = info.getBundleGroup();
- Bundle[] bundles = bundleGroup == null ? new Bundle[0] : bundleGroup
- .getBundles();
+ Bundle[] bundles = bundleGroup == null ? new Bundle[0] : bundleGroup.getBundles();
- AboutPluginsDialog d = new AboutPluginsDialog(
- getShell(),
- getProductName(),
- bundles,
+ AboutPluginsDialog d = new AboutPluginsDialog(getShell(), getProductName(), bundles,
WorkbenchMessages.AboutFeaturesDialog_pluginInfoTitle,
- NLS
- .bind(
- WorkbenchMessages.AboutFeaturesDialog_pluginInfoMessage,
- bundleGroup.getIdentifier()),
+ NLS.bind(WorkbenchMessages.AboutFeaturesDialog_pluginInfoMessage, bundleGroup.getIdentifier()),
IWorkbenchHelpContextIds.ABOUT_FEATURES_PLUGINS_DIALOG);
d.open();
}
@Override
public void createPageButtons(Composite parent) {
- moreButton = createButton(parent, MORE_ID,
- WorkbenchMessages.AboutFeaturesDialog_moreInfo);
- pluginsButton = createButton(parent, PLUGINS_ID,
- WorkbenchMessages.AboutFeaturesDialog_pluginsInfo);
- createButton(parent, COLUMNS_ID,
- WorkbenchMessages.AboutFeaturesDialog_columns);
+ moreButton = createButton(parent, MORE_ID, WorkbenchMessages.AboutFeaturesDialog_moreInfo);
+ pluginsButton = createButton(parent, PLUGINS_ID, WorkbenchMessages.AboutFeaturesDialog_pluginsInfo);
+ createButton(parent, COLUMNS_ID, WorkbenchMessages.AboutFeaturesDialog_columns);
TableItem[] items = table.getSelection();
if (items.length > 0) {
updateButtons((AboutBundleGroupData) items[0].getData());
@@ -187,8 +174,7 @@ public class AboutFeaturesPage extends ProductInfoPage {
public void createControl(Composite parent) {
initializeDialogUnits(parent);
parent.getShell().addDisposeListener(arg0 -> disposeImages());
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
- IWorkbenchHelpContextIds.ABOUT_FEATURES_DIALOG);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IWorkbenchHelpContextIds.ABOUT_FEATURES_DIALOG);
Composite outer = createOuterComposite(parent);
@@ -204,8 +190,7 @@ public class AboutFeaturesPage extends ProductInfoPage {
Font font = parent.getFont();
infoArea = new Composite(parent, SWT.BORDER);
- infoArea.setBackground(infoArea.getDisplay().getSystemColor(
- SWT.COLOR_LIST_BACKGROUND));
+ infoArea.setBackground(infoArea.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
infoArea.setBackgroundMode(SWT.INHERIT_FORCE);
GridData data = new GridData(GridData.FILL, GridData.FILL, true, false);
// need to provide space for arbitrary feature infos, not just the
@@ -248,18 +233,15 @@ public class AboutFeaturesPage extends ProductInfoPage {
/**
* Create the table part of the dialog.
*
- * @param parent
- * the parent composite to contain the dialog area
+ * @param parent the parent composite to contain the dialog area
*/
protected void createTable(Composite parent) {
initializeBundleGroupInfos();
- table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE
- | SWT.FULL_SELECTION | SWT.BORDER);
+ table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER);
- GridData gridData = new GridData(GridData.FILL, GridData.FILL, true,
- true);
+ GridData gridData = new GridData(GridData.FILL, GridData.FILL, true, true);
gridData.heightHint = convertVerticalDLUsToPixels(TABLE_HEIGHT);
table.setLayoutData(gridData);
table.setHeaderVisible(true);
@@ -271,8 +253,7 @@ public class AboutFeaturesPage extends ProductInfoPage {
// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=266177
if (e.item == null)
return;
- AboutBundleGroupData info = (AboutBundleGroupData) e.item
- .getData();
+ AboutBundleGroupData info = (AboutBundleGroupData) e.item.getData();
updateInfoArea(info);
updateButtons(info);
}));
@@ -280,10 +261,8 @@ public class AboutFeaturesPage extends ProductInfoPage {
handlePluginInfoPressed();
}));
- int[] columnWidths = { convertHorizontalDLUsToPixels(120),
- convertHorizontalDLUsToPixels(120),
- convertHorizontalDLUsToPixels(70),
- convertHorizontalDLUsToPixels(130) };
+ int[] columnWidths = { convertHorizontalDLUsToPixels(120), convertHorizontalDLUsToPixels(120),
+ convertHorizontalDLUsToPixels(70), convertHorizontalDLUsToPixels(130) };
for (int i = 0; i < columnTitles.length; i++) {
TableColumn tableColumn = new TableColumn(table, SWT.NULL);
@@ -382,8 +361,7 @@ public class AboutFeaturesPage extends ProductInfoPage {
/**
* Select the initial selection
*
- * @param info
- * the info
+ * @param info the info
*/
public void setInitialSelection(AboutBundleGroupData info) {
lastSelection = info;
@@ -392,8 +370,7 @@ public class AboutFeaturesPage extends ProductInfoPage {
/**
* Sort the rows of the table based on the selected column.
*
- * @param column
- * index of table column selected as sort criteria
+ * @param column index of table column selected as sort criteria
*/
private void sort(int column) {
if (lastColumnChosen == column) {
@@ -468,12 +445,10 @@ public class AboutFeaturesPage extends ProductInfoPage {
* Return an array of strings containing the argument's information in the
* proper order for this table's columns.
*
- * @param info
- * the source information for the new row, must not be null
+ * @param info the source information for the new row, must not be null
*/
private static String[] createRow(AboutBundleGroupData info) {
- return new String[] { info.getProviderName(), info.getName(),
- info.getVersion(), info.getId() };
+ return new String[] { info.getProviderName(), info.getName(), info.getVersion(), info.getId() };
}
protected Collection<Object> getSelectionValue() {
@@ -494,8 +469,8 @@ public class AboutFeaturesPage extends ProductInfoPage {
/**
* The More Info button was pressed. Open a browser with the license for the
- * selected item or an information dialog if there is no license, or the
- * browser cannot be opened.
+ * selected item or an information dialog if there is no license, or the browser
+ * cannot be opened.
*/
private void handleMoreInfoPressed() {
TableItem[] items = table.getSelection();
@@ -504,10 +479,8 @@ public class AboutFeaturesPage extends ProductInfoPage {
}
AboutBundleGroupData info = (AboutBundleGroupData) items[0].getData();
- if (info == null
- || !AboutUtils.openBrowser(getShell(), info.getLicenseUrl())) {
- MessageDialog.openInformation(getShell(),
- WorkbenchMessages.AboutFeaturesDialog_noInfoTitle,
+ if (info == null || !AboutUtils.openBrowser(getShell(), info.getLicenseUrl())) {
+ MessageDialog.openInformation(getShell(), WorkbenchMessages.AboutFeaturesDialog_noInfoTitle,
WorkbenchMessages.AboutFeaturesDialog_noInformation);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutItem.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutItem.java
index 056973b192a..ebe913b612f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutItem.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutItem.java
@@ -17,62 +17,60 @@ package org.eclipse.ui.internal.about;
* Holds the information for text appearing in the about dialog
*/
public class AboutItem {
- private String text;
+ private String text;
- private int[][] linkRanges;
+ private int[][] linkRanges;
- private String[] hrefs;
+ private String[] hrefs;
- /**
- * Creates a new about item
- */
- public AboutItem(String text, int[][] linkRanges, String[] hrefs) {
+ /**
+ * Creates a new about item
+ */
+ public AboutItem(String text, int[][] linkRanges, String[] hrefs) {
- this.text = text;
- this.linkRanges = linkRanges;
- this.hrefs = hrefs;
- }
+ this.text = text;
+ this.linkRanges = linkRanges;
+ this.hrefs = hrefs;
+ }
- /**
- * Returns the link ranges (character locations)
- */
- public int[][] getLinkRanges() {
- return linkRanges;
- }
+ /**
+ * Returns the link ranges (character locations)
+ */
+ public int[][] getLinkRanges() {
+ return linkRanges;
+ }
- /**
- * Returns the text to display
- */
- public String getText() {
- return text;
- }
+ /**
+ * Returns the text to display
+ */
+ public String getText() {
+ return text;
+ }
- /**
- * Returns true if a link is present at the given character location
- */
- public boolean isLinkAt(int offset) {
- // Check if there is a link at the offset
- for (int[] linkRange : linkRanges) {
- if (offset >= linkRange[0]
- && offset < linkRange[0] + linkRange[1]) {
- return true;
- }
- }
- return false;
- }
+ /**
+ * Returns true if a link is present at the given character location
+ */
+ public boolean isLinkAt(int offset) {
+ // Check if there is a link at the offset
+ for (int[] linkRange : linkRanges) {
+ if (offset >= linkRange[0] && offset < linkRange[0] + linkRange[1]) {
+ return true;
+ }
+ }
+ return false;
+ }
- /**
- * Returns the link at the given offset (if there is one),
- * otherwise returns <code>null</code>.
- */
- public String getLinkAt(int offset) {
- // Check if there is a link at the offset
- for (int i = 0; i < linkRanges.length; i++) {
- if (offset >= linkRanges[i][0]
- && offset < linkRanges[i][0] + linkRanges[i][1]) {
- return hrefs[i];
- }
- }
- return null;
- }
+ /**
+ * Returns the link at the given offset (if there is one), otherwise returns
+ * <code>null</code>.
+ */
+ public String getLinkAt(int offset) {
+ // Check if there is a link at the offset
+ for (int i = 0; i < linkRanges.length; i++) {
+ if (offset >= linkRanges[i][0] && offset < linkRanges[i][0] + linkRanges[i][1]) {
+ return hrefs[i];
+ }
+ }
+ return null;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutPluginsPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutPluginsPage.java
index 6136b51759a..ce975ed37f5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutPluginsPage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutPluginsPage.java
@@ -85,8 +85,7 @@ import org.osgi.framework.Bundle;
*/
public class AboutPluginsPage extends ProductInfoPage {
- public class BundleTableLabelProvider extends LabelProvider implements
- ITableLabelProvider {
+ public class BundleTableLabelProvider extends LabelProvider implements ITableLabelProvider {
/**
* Queue containing bundle signing info to be resolved.
@@ -99,8 +98,8 @@ public class AboutPluginsPage extends ProductInfoPage {
private List<AboutBundleData> updateQueue = new ArrayList<>();
/*
- * this job will attempt to discover the signing state of a given bundle
- * and then send it along to the update job
+ * this job will attempt to discover the signing state of a given bundle and
+ * then send it along to the update job
*/
private Job resolveJob = new Job(AboutPluginsPage.class.getName()) {
{
@@ -144,11 +143,11 @@ public class AboutPluginsPage extends ProductInfoPage {
};
/*
- * this job is responsible for feeding label change events into the
- * viewer as they become available from the resolve job
+ * this job is responsible for feeding label change events into the viewer as
+ * they become available from the resolve job
*/
- private Job updateJob = new WorkbenchJob(PlatformUI.getWorkbench()
- .getDisplay(), AboutPluginsPage.class.getName()) {
+ private Job updateJob = new WorkbenchJob(PlatformUI.getWorkbench().getDisplay(),
+ AboutPluginsPage.class.getName()) {
{
setSystem(true);
setPriority(Job.DECORATE);
@@ -166,13 +165,11 @@ public class AboutPluginsPage extends ProductInfoPage {
if (updateQueue.isEmpty())
return Status.OK_STATUS;
- data = updateQueue
- .toArray(new AboutBundleData[updateQueue.size()]);
+ data = updateQueue.toArray(new AboutBundleData[updateQueue.size()]);
updateQueue.clear();
}
- fireLabelProviderChanged(new LabelProviderChangedEvent(
- BundleTableLabelProvider.this, data));
+ fireLabelProviderChanged(new LabelProviderChangedEvent(BundleTableLabelProvider.this, data));
}
}
};
@@ -183,9 +180,8 @@ public class AboutPluginsPage extends ProductInfoPage {
if (element instanceof AboutBundleData) {
final AboutBundleData data = (AboutBundleData) element;
if (data.isSignedDetermined()) {
- return WorkbenchImages
- .getImage(data.isSigned() ? IWorkbenchGraphicConstants.IMG_OBJ_SIGNED_YES
- : IWorkbenchGraphicConstants.IMG_OBJ_SIGNED_NO);
+ return WorkbenchImages.getImage(data.isSigned() ? IWorkbenchGraphicConstants.IMG_OBJ_SIGNED_YES
+ : IWorkbenchGraphicConstants.IMG_OBJ_SIGNED_NO);
}
synchronized (resolveQueue) {
@@ -193,8 +189,7 @@ public class AboutPluginsPage extends ProductInfoPage {
}
resolveJob.schedule();
- return WorkbenchImages
- .getImage(IWorkbenchGraphicConstants.IMG_OBJ_SIGNED_UNKNOWN);
+ return WorkbenchImages.getImage(IWorkbenchGraphicConstants.IMG_OBJ_SIGNED_UNKNOWN);
}
}
return null;
@@ -247,12 +242,9 @@ public class AboutPluginsPage extends ProductInfoPage {
private String helpContextId = IWorkbenchHelpContextIds.ABOUT_PLUGINS_DIALOG;
- private String columnTitles[] = {
- WorkbenchMessages.AboutPluginsDialog_signed,
- WorkbenchMessages.AboutPluginsDialog_provider,
- WorkbenchMessages.AboutPluginsDialog_pluginName,
- WorkbenchMessages.AboutPluginsDialog_version,
- WorkbenchMessages.AboutPluginsDialog_pluginId,
+ private String columnTitles[] = { WorkbenchMessages.AboutPluginsDialog_signed,
+ WorkbenchMessages.AboutPluginsDialog_provider, WorkbenchMessages.AboutPluginsDialog_pluginName,
+ WorkbenchMessages.AboutPluginsDialog_version, WorkbenchMessages.AboutPluginsDialog_pluginId,
};
private Bundle[] bundles = WorkbenchPlugin.getDefault().getBundles();
@@ -281,15 +273,12 @@ public class AboutPluginsPage extends ProductInfoPage {
signingArea.setData(bundleInfo);
signingArea.createContents(sashForm);
- sashForm.setWeights(new int[] { 100 - SIGNING_AREA_PERCENTAGE,
- SIGNING_AREA_PERCENTAGE });
- signingInfo
- .setText(WorkbenchMessages.AboutPluginsDialog_signingInfo_hide);
+ sashForm.setWeights(new int[] { 100 - SIGNING_AREA_PERCENTAGE, SIGNING_AREA_PERCENTAGE });
+ signingInfo.setText(WorkbenchMessages.AboutPluginsDialog_signingInfo_hide);
} else {
// hide
- signingInfo
- .setText(WorkbenchMessages.AboutPluginsDialog_signingInfo_show);
+ signingInfo.setText(WorkbenchMessages.AboutPluginsDialog_signingInfo_show);
signingArea.dispose();
signingArea = null;
sashForm.setWeights(new int[] { 100 });
@@ -299,16 +288,13 @@ public class AboutPluginsPage extends ProductInfoPage {
@Override
public void createPageButtons(Composite parent) {
- moreInfo = createButton(parent, MORE_ID,
- WorkbenchMessages.AboutPluginsDialog_moreInfo);
+ moreInfo = createButton(parent, MORE_ID, WorkbenchMessages.AboutPluginsDialog_moreInfo);
moreInfo.setEnabled(false);
- signingInfo = createButton(parent, SIGNING_ID,
- WorkbenchMessages.AboutPluginsDialog_signingInfo_show);
+ signingInfo = createButton(parent, SIGNING_ID, WorkbenchMessages.AboutPluginsDialog_signingInfo_show);
signingInfo.setEnabled(false);
- createButton(parent, COLUMNS_ID,
- WorkbenchMessages.AboutPluginsDialog_columns);
+ createButton(parent, COLUMNS_ID, WorkbenchMessages.AboutPluginsDialog_columns);
}
@Override
@@ -362,8 +348,7 @@ public class AboutPluginsPage extends ProductInfoPage {
/**
* Create the table part of the dialog.
*
- * @param parent
- * the parent composite to contain the dialog area
+ * @param parent the parent composite to contain the dialog area
*/
protected void createTable(Composite parent) {
final Text filterText = new Text(parent, SWT.BORDER | SWT.SEARCH | SWT.ICON_CANCEL);
@@ -371,8 +356,8 @@ public class AboutPluginsPage extends ProductInfoPage {
filterText.setMessage(WorkbenchMessages.AboutPluginsDialog_filterTextMessage);
filterText.setFocus();
- vendorInfo = new TableViewer(parent, SWT.H_SCROLL | SWT.V_SCROLL
- | SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER);
+ vendorInfo = new TableViewer(parent,
+ SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER);
vendorInfo.setUseHashlookup(true);
vendorInfo.getTable().setHeaderVisible(true);
vendorInfo.getTable().setLinesVisible(true);
@@ -381,17 +366,13 @@ public class AboutPluginsPage extends ProductInfoPage {
final TableComparator comparator = new TableComparator();
vendorInfo.setComparator(comparator);
- int[] columnWidths = {
- convertHorizontalDLUsToPixels(30), // signature
- convertHorizontalDLUsToPixels(120),
- convertHorizontalDLUsToPixels(120),
- convertHorizontalDLUsToPixels(70),
- convertHorizontalDLUsToPixels(130), };
+ int[] columnWidths = { convertHorizontalDLUsToPixels(30), // signature
+ convertHorizontalDLUsToPixels(120), convertHorizontalDLUsToPixels(120),
+ convertHorizontalDLUsToPixels(70), convertHorizontalDLUsToPixels(130), };
// create table headers
for (int i = 0; i < columnTitles.length; i++) {
- TableColumn column = new TableColumn(vendorInfo.getTable(),
- SWT.NULL);
+ TableColumn column = new TableColumn(vendorInfo.getTable(), SWT.NULL);
if (i == PLUGIN_NAME_COLUMN_INDEX) { // prime initial sorting
updateTableSorting(i);
}
@@ -411,8 +392,7 @@ public class AboutPluginsPage extends ProductInfoPage {
});
vendorInfo.addFilter(searchFilter);
- GridData gridData = new GridData(GridData.FILL, GridData.FILL, true,
- true);
+ GridData gridData = new GridData(GridData.FILL, GridData.FILL, true, true);
gridData.heightHint = convertVerticalDLUsToPixels(TABLE_HEIGHT);
vendorInfo.getTable().setLayoutData(gridData);
@@ -428,34 +408,28 @@ public class AboutPluginsPage extends ProductInfoPage {
/**
* Update the sort information on both the comparator and the table.
*
- * @param columnIndex
- * the index to sort by
+ * @param columnIndex the index to sort by
* @since 3.4
*/
private void updateTableSorting(final int columnIndex) {
- TableComparator comparator = (TableComparator) vendorInfo
- .getComparator();
+ TableComparator comparator = (TableComparator) vendorInfo.getComparator();
// toggle direction if it's the same column
if (columnIndex == comparator.getSortColumn()) {
comparator.setAscending(!comparator.isAscending());
}
comparator.setSortColumn(columnIndex);
- vendorInfo.getTable().setSortColumn(
- vendorInfo.getTable().getColumn(columnIndex));
- vendorInfo.getTable().setSortDirection(
- comparator.isAscending() ? SWT.UP : SWT.DOWN);
+ vendorInfo.getTable().setSortColumn(vendorInfo.getTable().getColumn(columnIndex));
+ vendorInfo.getTable().setSortDirection(comparator.isAscending() ? SWT.UP : SWT.DOWN);
vendorInfo.refresh(false);
}
/**
- * Return an URL to the plugin's about.html file (what is shown when
- * "More info" is pressed) or null if no such file exists. The method does
- * nl lookup to allow for i18n.
+ * Return an URL to the plugin's about.html file (what is shown when "More info"
+ * is pressed) or null if no such file exists. The method does nl lookup to
+ * allow for i18n.
*
- * @param bundleInfo
- * the bundle info
- * @param makeLocal
- * whether to make the about content local
+ * @param bundleInfo the bundle info
+ * @param makeLocal whether to make the about content local
* @return the URL or <code>null</code>
*/
private URL getMoreInfoURL(AboutBundleData bundleInfo, boolean makeLocal) {
@@ -502,8 +476,7 @@ public class AboutPluginsPage extends ProductInfoPage {
// item has additional info
IStructuredSelection selection = vendorInfo.getStructuredSelection();
if (selection.getFirstElement() instanceof AboutBundleData) {
- AboutBundleData selected = (AboutBundleData) selection
- .getFirstElement();
+ AboutBundleData selected = (AboutBundleData) selection.getFirstElement();
moreInfo.setEnabled(selectionHasInfo(selected));
signingInfo.setEnabled(true);
if (signingArea != null) {
@@ -534,13 +507,11 @@ public class AboutPluginsPage extends ProductInfoPage {
}
/**
- * Check if the currently selected plugin has additional information to
- * show.
+ * Check if the currently selected plugin has additional information to show.
*
* @param bundleInfo
*
- * @return true if the selected plugin has additional info available to
- * display
+ * @return true if the selected plugin has additional info available to display
*/
private boolean selectionHasInfo(AboutBundleData bundleInfo) {
@@ -557,8 +528,8 @@ public class AboutPluginsPage extends ProductInfoPage {
/**
* The More Info button was pressed. Open a browser showing the license
- * information for the selected bundle or an error dialog if the browser
- * cannot be opened.
+ * information for the selected bundle or an error dialog if the browser cannot
+ * be opened.
*/
protected void handleMoreInfoPressed() {
if (vendorInfo == null) {
@@ -570,14 +541,11 @@ public class AboutPluginsPage extends ProductInfoPage {
AboutBundleData bundleInfo = (AboutBundleData) vendorInfo.getStructuredSelection().getFirstElement();
- if (!AboutUtils.openBrowser(getShell(),
- getMoreInfoURL(bundleInfo, true))) {
- String message = NLS.bind(
- WorkbenchMessages.AboutPluginsDialog_unableToOpenFile,
- PLUGININFO, bundleInfo.getId());
- StatusUtil.handleStatus(
- WorkbenchMessages.AboutPluginsDialog_errorTitle
- + ": " + message, StatusManager.SHOW, getShell()); //$NON-NLS-1$
+ if (!AboutUtils.openBrowser(getShell(), getMoreInfoURL(bundleInfo, true))) {
+ String message = NLS.bind(WorkbenchMessages.AboutPluginsDialog_unableToOpenFile, PLUGININFO,
+ bundleInfo.getId());
+ StatusUtil.handleStatus(WorkbenchMessages.AboutPluginsDialog_errorTitle + ": " + message, //$NON-NLS-1$
+ StatusManager.SHOW, getShell());
}
}
@@ -598,8 +566,7 @@ class TableComparator extends ViewerComparator {
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
- if (sortColumn == 0 && e1 instanceof AboutBundleData
- && e2 instanceof AboutBundleData) {
+ if (sortColumn == 0 && e1 instanceof AboutBundleData && e2 instanceof AboutBundleData) {
AboutBundleData d1 = (AboutBundleData) e1;
AboutBundleData d2 = (AboutBundleData) e2;
int diff = getSignedSortValue(d1) - getSignedSortValue(d2);
@@ -613,10 +580,8 @@ class TableComparator extends ViewerComparator {
IBaseLabelProvider baseLabel = tableViewer.getLabelProvider();
if (baseLabel instanceof ITableLabelProvider) {
ITableLabelProvider tableProvider = (ITableLabelProvider) baseLabel;
- String e1p = tableProvider
- .getColumnText(e1, lastSortColumn);
- String e2p = tableProvider
- .getColumnText(e2, lastSortColumn);
+ String e1p = tableProvider.getColumnText(e1, lastSortColumn);
+ String e2p = tableProvider.getColumnText(e2, lastSortColumn);
int result = getComparator().compare(e1p, e2p);
return lastAscending ? result : (-1) * result;
}
@@ -640,12 +605,10 @@ class TableComparator extends ViewerComparator {
result = getComparator().compare(e1p, e2p);
return lastAscending ? result : (-1) * result;
} // secondary sort is by column 0
- if (e1 instanceof AboutBundleData
- && e2 instanceof AboutBundleData) {
+ if (e1 instanceof AboutBundleData && e2 instanceof AboutBundleData) {
AboutBundleData d1 = (AboutBundleData) e1;
AboutBundleData d2 = (AboutBundleData) e2;
- int diff = getSignedSortValue(d1)
- - getSignedSortValue(d2);
+ int diff = getSignedSortValue(d1) - getSignedSortValue(d2);
return lastAscending ? diff : -diff;
}
}
@@ -679,8 +642,7 @@ class TableComparator extends ViewerComparator {
}
/**
- * @param sortColumn
- * The sortColumn to set.
+ * @param sortColumn The sortColumn to set.
*/
public void setSortColumn(int sortColumn) {
if (this.sortColumn != sortColumn) {
@@ -698,8 +660,7 @@ class TableComparator extends ViewerComparator {
}
/**
- * @param ascending
- * The ascending to set.
+ * @param ascending The ascending to set.
*/
public void setAscending(boolean ascending) {
this.ascending = ascending;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutSystemPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutSystemPage.java
index 5abb7fd6ecc..f6126c884e4 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutSystemPage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutSystemPage.java
@@ -52,17 +52,13 @@ public final class AboutSystemPage extends ProductInfoPage {
@Override
public void createControl(Composite parent) {
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
- IWorkbenchHelpContextIds.SYSTEM_SUMMARY_DIALOG);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IWorkbenchHelpContextIds.SYSTEM_SUMMARY_DIALOG);
Composite outer = createOuterComposite(parent);
- text = new Text(outer, SWT.MULTI | SWT.BORDER | SWT.READ_ONLY
- | SWT.V_SCROLL | SWT.NO_FOCUS | SWT.H_SCROLL);
- text.setBackground(parent.getDisplay().getSystemColor(
- SWT.COLOR_LIST_BACKGROUND));
- GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL
- | GridData.VERTICAL_ALIGN_FILL);
+ text = new Text(outer, SWT.MULTI | SWT.BORDER | SWT.READ_ONLY | SWT.V_SCROLL | SWT.NO_FOCUS | SWT.H_SCROLL);
+ text.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
+ GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
gridData.grabExcessVerticalSpace = true;
gridData.grabExcessHorizontalSpace = true;
gridData.heightHint = convertVerticalDLUsToPixels(300);
@@ -80,8 +76,7 @@ public final class AboutSystemPage extends ProductInfoPage {
String filename = Platform.getLogFileLocation().toOSString();
button.setEnabled(new File(filename).exists());
- createButton(parent, COPY_TO_CLIPBOARD_BUTTON,
- WorkbenchMessages.AboutSystemDialog_copyToClipboardName);
+ createButton(parent, COPY_TO_CLIPBOARD_BUTTON, WorkbenchMessages.AboutSystemDialog_copyToClipboardName);
}
@Override
@@ -100,8 +95,7 @@ public final class AboutSystemPage extends ProductInfoPage {
String contents = text.getSelectionText();
if (contents.length() == 0)
contents = text.getText();
- clipboard.setContents(new Object[] { contents },
- new Transfer[] { TextTransfer.getInstance() });
+ clipboard.setContents(new Object[] { contents }, new Transfer[] { TextTransfer.getInstance() });
} finally {
if (clipboard != null) {
clipboard.dispose();
@@ -134,8 +128,7 @@ public final class AboutSystemPage extends ProductInfoPage {
Clipboard clipboard = null;
try {
clipboard = new Clipboard(getShell().getDisplay());
- clipboard.setContents(new Object[] { text.getText() },
- new Transfer[] { TextTransfer.getInstance() });
+ clipboard.setContents(new Object[] { text.getText() }, new Transfer[] { TextTransfer.getInstance() });
} finally {
if (clipboard != null) {
clipboard.dispose();
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutTextManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutTextManager.java
index ae8b2e5387e..6a2df2d9f01 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutTextManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutTextManager.java
@@ -33,126 +33,125 @@ import org.eclipse.swt.graphics.Point;
public class AboutTextManager {
- /**
- * Scan the contents of the about text
- * @param s
- * @return
- */
- public static AboutItem scan(String s) {
+ /**
+ * Scan the contents of the about text
+ *
+ * @param s
+ * @return
+ */
+ public static AboutItem scan(String s) {
ArrayList<int[]> linkRanges = new ArrayList<>();
ArrayList<String> links = new ArrayList<>();
// Slightly modified version of JFace URL detection,
- // see org.eclipse.jface.text.hyperlink.URLHyperlinkDetector
+ // see org.eclipse.jface.text.hyperlink.URLHyperlinkDetector
- int urlSeparatorOffset= s.indexOf("://"); //$NON-NLS-1$
- while(urlSeparatorOffset >= 0) {
+ int urlSeparatorOffset = s.indexOf("://"); //$NON-NLS-1$
+ while (urlSeparatorOffset >= 0) {
- boolean startDoubleQuote= false;
+ boolean startDoubleQuote = false;
// URL protocol (left to "://")
- int urlOffset= urlSeparatorOffset;
+ int urlOffset = urlSeparatorOffset;
char ch;
do {
urlOffset--;
- ch= ' ';
+ ch = ' ';
if (urlOffset > -1)
- ch= s.charAt(urlOffset);
- startDoubleQuote= ch == '"';
+ ch = s.charAt(urlOffset);
+ startDoubleQuote = ch == '"';
} while (Character.isUnicodeIdentifierStart(ch));
urlOffset++;
-
// Right to "://"
- StringTokenizer tokenizer= new StringTokenizer(s.substring(urlSeparatorOffset + 3), " \t\n\r\f<>", false); //$NON-NLS-1$
+ StringTokenizer tokenizer = new StringTokenizer(s.substring(urlSeparatorOffset + 3), " \t\n\r\f<>", false); //$NON-NLS-1$
if (!tokenizer.hasMoreTokens())
return null;
- int urlLength= tokenizer.nextToken().length() + 3 + urlSeparatorOffset - urlOffset;
+ int urlLength = tokenizer.nextToken().length() + 3 + urlSeparatorOffset - urlOffset;
if (startDoubleQuote) {
- int endOffset= -1;
- int nextDoubleQuote= s.indexOf('"', urlOffset);
- int nextWhitespace= s.indexOf(' ', urlOffset);
+ int endOffset = -1;
+ int nextDoubleQuote = s.indexOf('"', urlOffset);
+ int nextWhitespace = s.indexOf(' ', urlOffset);
if (nextDoubleQuote != -1 && nextWhitespace != -1)
- endOffset= Math.min(nextDoubleQuote, nextWhitespace);
+ endOffset = Math.min(nextDoubleQuote, nextWhitespace);
else if (nextDoubleQuote != -1)
- endOffset= nextDoubleQuote;
+ endOffset = nextDoubleQuote;
else if (nextWhitespace != -1)
- endOffset= nextWhitespace;
+ endOffset = nextWhitespace;
if (endOffset != -1)
- urlLength= endOffset - urlOffset;
+ urlLength = endOffset - urlOffset;
}
linkRanges.add(new int[] { urlOffset, urlLength });
- links.add(s.substring(urlOffset, urlOffset+urlLength));
+ links.add(s.substring(urlOffset, urlOffset + urlLength));
- urlSeparatorOffset= s.indexOf("://", urlOffset+urlLength+1); //$NON-NLS-1$
+ urlSeparatorOffset = s.indexOf("://", urlOffset + urlLength + 1); //$NON-NLS-1$
}
- return new AboutItem(s, linkRanges.toArray(new int[linkRanges
- .size()][2]), links
- .toArray(new String[links.size()]));
- }
+ return new AboutItem(s, linkRanges.toArray(new int[linkRanges.size()][2]),
+ links.toArray(new String[links.size()]));
+ }
+
private StyledText styledText;
- private boolean mouseDown = false;
+ private boolean mouseDown = false;
- private boolean dragEvent = false;
+ private boolean dragEvent = false;
- private AboutItem item;
+ private AboutItem item;
- public AboutTextManager(StyledText text) {
- this.styledText = text;
- addListeners();
- }
+ public AboutTextManager(StyledText text) {
+ this.styledText = text;
+ addListeners();
+ }
- /**
- * Adds listeners to the given styled text
- */
- protected void addListeners() {
+ /**
+ * Adds listeners to the given styled text
+ */
+ protected void addListeners() {
Cursor handCursor = styledText.getDisplay().getSystemCursor(SWT.CURSOR_HAND);
Cursor busyCursor = styledText.getDisplay().getSystemCursor(SWT.CURSOR_WAIT);
- styledText.addMouseListener(new MouseAdapter() {
- @Override
+ styledText.addMouseListener(new MouseAdapter() {
+ @Override
public void mouseDown(MouseEvent e) {
- if (e.button != 1) {
- return;
- }
- mouseDown = true;
- }
+ if (e.button != 1) {
+ return;
+ }
+ mouseDown = true;
+ }
- @Override
+ @Override
public void mouseUp(MouseEvent e) {
- mouseDown = false;
- int offset = styledText.getCaretOffset();
- if (dragEvent) {
- // don't activate a link during a drag/mouse up operation
- dragEvent = false;
- if (item != null && item.isLinkAt(offset)) {
- styledText.setCursor(handCursor);
- }
- } else if (item != null && item.isLinkAt(offset)) {
- styledText.setCursor(busyCursor);
- AboutUtils.openLink(styledText.getShell(), item.getLinkAt(offset));
- StyleRange selectionRange = getCurrentRange();
- styledText.setSelectionRange(selectionRange.start,
- selectionRange.length);
- styledText.setCursor(null);
- }
- }
- });
-
- styledText.addMouseMoveListener(e -> {
- // Do not change cursor on drag events
- if (mouseDown) {
- if (!dragEvent) {
- StyledText text1 = (StyledText) e.widget;
- text1.setCursor(null);
- }
- dragEvent = true;
- return;
- }
- StyledText text2 = (StyledText) e.widget;
+ mouseDown = false;
+ int offset = styledText.getCaretOffset();
+ if (dragEvent) {
+ // don't activate a link during a drag/mouse up operation
+ dragEvent = false;
+ if (item != null && item.isLinkAt(offset)) {
+ styledText.setCursor(handCursor);
+ }
+ } else if (item != null && item.isLinkAt(offset)) {
+ styledText.setCursor(busyCursor);
+ AboutUtils.openLink(styledText.getShell(), item.getLinkAt(offset));
+ StyleRange selectionRange = getCurrentRange();
+ styledText.setSelectionRange(selectionRange.start, selectionRange.length);
+ styledText.setCursor(null);
+ }
+ }
+ });
+
+ styledText.addMouseMoveListener(e -> {
+ // Do not change cursor on drag events
+ if (mouseDown) {
+ if (!dragEvent) {
+ StyledText text1 = (StyledText) e.widget;
+ text1.setCursor(null);
+ }
+ dragEvent = true;
+ return;
+ }
+ StyledText text2 = (StyledText) e.widget;
int offset = text2.getOffsetAtPoint(new Point(e.x, e.y));
if (offset == -1) {
text2.setCursor(null);
@@ -163,162 +162,155 @@ public class AboutTextManager {
}
});
- styledText.addTraverseListener(e -> {
- switch (e.detail) {
- case SWT.TRAVERSE_ESCAPE:
- e.doit = true;
- break;
- case SWT.TRAVERSE_TAB_NEXT:
- //Previously traverse out in the backward direction?
- Point nextSelection = styledText.getSelection();
- int charCount = styledText.getCharCount();
- if ((nextSelection.x == charCount)
- && (nextSelection.y == charCount)) {
- styledText.setSelection(0);
- }
- StyleRange nextRange = findNextRange();
- if (nextRange == null) {
- // Next time in start at beginning, also used by
- // TRAVERSE_TAB_PREVIOUS to indicate we traversed out
- // in the forward direction
- styledText.setSelection(0);
- e.doit = true;
- } else {
- styledText.setSelectionRange(nextRange.start,
- nextRange.length);
- e.doit = true;
- e.detail = SWT.TRAVERSE_NONE;
- }
- break;
- case SWT.TRAVERSE_TAB_PREVIOUS:
- //Previously traverse out in the forward direction?
- Point previousSelection = styledText.getSelection();
- if ((previousSelection.x == 0)
- && (previousSelection.y == 0)) {
- styledText.setSelection(styledText.getCharCount());
+ styledText.addTraverseListener(e -> {
+ switch (e.detail) {
+ case SWT.TRAVERSE_ESCAPE:
+ e.doit = true;
+ break;
+ case SWT.TRAVERSE_TAB_NEXT:
+ // Previously traverse out in the backward direction?
+ Point nextSelection = styledText.getSelection();
+ int charCount = styledText.getCharCount();
+ if ((nextSelection.x == charCount) && (nextSelection.y == charCount)) {
+ styledText.setSelection(0);
+ }
+ StyleRange nextRange = findNextRange();
+ if (nextRange == null) {
+ // Next time in start at beginning, also used by
+ // TRAVERSE_TAB_PREVIOUS to indicate we traversed out
+ // in the forward direction
+ styledText.setSelection(0);
+ e.doit = true;
+ } else {
+ styledText.setSelectionRange(nextRange.start, nextRange.length);
+ e.doit = true;
+ e.detail = SWT.TRAVERSE_NONE;
+ }
+ break;
+ case SWT.TRAVERSE_TAB_PREVIOUS:
+ // Previously traverse out in the forward direction?
+ Point previousSelection = styledText.getSelection();
+ if ((previousSelection.x == 0) && (previousSelection.y == 0)) {
+ styledText.setSelection(styledText.getCharCount());
}
- StyleRange previousRange = findPreviousRange();
- if (previousRange == null) {
- // Next time in start at the end, also used by
- // TRAVERSE_TAB_NEXT to indicate we traversed out
- // in the backward direction
- styledText.setSelection(styledText.getCharCount());
- e.doit = true;
- } else {
- styledText.setSelectionRange(previousRange.start,
- previousRange.length);
- e.doit = true;
- e.detail = SWT.TRAVERSE_NONE;
- }
- break;
- default:
- break;
- }
+ StyleRange previousRange = findPreviousRange();
+ if (previousRange == null) {
+ // Next time in start at the end, also used by
+ // TRAVERSE_TAB_NEXT to indicate we traversed out
+ // in the backward direction
+ styledText.setSelection(styledText.getCharCount());
+ e.doit = true;
+ } else {
+ styledText.setSelectionRange(previousRange.start, previousRange.length);
+ e.doit = true;
+ e.detail = SWT.TRAVERSE_NONE;
+ }
+ break;
+ default:
+ break;
+ }
});
- //Listen for Tab and Space to allow keyboard navigation
- styledText.addKeyListener(new KeyAdapter() {
- @Override
+ // Listen for Tab and Space to allow keyboard navigation
+ styledText.addKeyListener(new KeyAdapter() {
+ @Override
public void keyPressed(KeyEvent event) {
- StyledText text = (StyledText) event.widget;
- if (event.character == ' ' || event.character == SWT.CR) {
- if (item != null) {
- //Be sure we are in the selection
- int offset = text.getSelection().x + 1;
-
- if (item.isLinkAt(offset)) {
- text.setCursor(busyCursor);
- AboutUtils.openLink(styledText.getShell(), item.getLinkAt(offset));
- StyleRange selectionRange = getCurrentRange();
- text.setSelectionRange(selectionRange.start,
- selectionRange.length);
- text.setCursor(null);
- }
- }
- return;
- }
- }
- });
- }
-
- /**
- * Gets the about item.
- * @return the about item
- */
- public AboutItem getItem() {
- return item;
- }
-
- /**
- * Sets the about item.
- * @param item about item
- */
- public void setItem(AboutItem item) {
- this.item = item;
- if (item != null) {
- styledText.setText(item.getText());
- setLinkRanges(item.getLinkRanges());
- }
- }
-
- /**
- * Find the range of the current selection.
- */
- private StyleRange getCurrentRange() {
- StyleRange[] ranges = styledText.getStyleRanges();
- int currentSelectionEnd = styledText.getSelection().y;
- int currentSelectionStart = styledText.getSelection().x;
-
- for (StyleRange range : ranges) {
- if ((currentSelectionStart >= range.start)
- && (currentSelectionEnd <= (range.start + range.length))) {
- return range;
- }
- }
- return null;
- }
-
- /**
- * Find the next range after the current
- * selection.
- */
- private StyleRange findNextRange() {
- StyleRange[] ranges = styledText.getStyleRanges();
- int currentSelectionEnd = styledText.getSelection().y;
-
- for (StyleRange range : ranges) {
- if (range.start >= currentSelectionEnd) {
+ StyledText text = (StyledText) event.widget;
+ if (event.character == ' ' || event.character == SWT.CR) {
+ if (item != null) {
+ // Be sure we are in the selection
+ int offset = text.getSelection().x + 1;
+
+ if (item.isLinkAt(offset)) {
+ text.setCursor(busyCursor);
+ AboutUtils.openLink(styledText.getShell(), item.getLinkAt(offset));
+ StyleRange selectionRange = getCurrentRange();
+ text.setSelectionRange(selectionRange.start, selectionRange.length);
+ text.setCursor(null);
+ }
+ }
+ return;
+ }
+ }
+ });
+ }
+
+ /**
+ * Gets the about item.
+ *
+ * @return the about item
+ */
+ public AboutItem getItem() {
+ return item;
+ }
+
+ /**
+ * Sets the about item.
+ *
+ * @param item about item
+ */
+ public void setItem(AboutItem item) {
+ this.item = item;
+ if (item != null) {
+ styledText.setText(item.getText());
+ setLinkRanges(item.getLinkRanges());
+ }
+ }
+
+ /**
+ * Find the range of the current selection.
+ */
+ private StyleRange getCurrentRange() {
+ StyleRange[] ranges = styledText.getStyleRanges();
+ int currentSelectionEnd = styledText.getSelection().y;
+ int currentSelectionStart = styledText.getSelection().x;
+
+ for (StyleRange range : ranges) {
+ if ((currentSelectionStart >= range.start) && (currentSelectionEnd <= (range.start + range.length))) {
return range;
}
- }
- return null;
- }
-
- /**
- * Find the previous range before the current selection.
- */
- private StyleRange findPreviousRange() {
- StyleRange[] ranges = styledText.getStyleRanges();
- int currentSelectionStart = styledText.getSelection().x;
-
- for (int i = ranges.length - 1; i > -1; i--) {
- if ((ranges[i].start + ranges[i].length - 1) < currentSelectionStart) {
+ }
+ return null;
+ }
+
+ /**
+ * Find the next range after the current selection.
+ */
+ private StyleRange findNextRange() {
+ StyleRange[] ranges = styledText.getStyleRanges();
+ int currentSelectionEnd = styledText.getSelection().y;
+
+ for (StyleRange range : ranges) {
+ if (range.start >= currentSelectionEnd) {
+ return range;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Find the previous range before the current selection.
+ */
+ private StyleRange findPreviousRange() {
+ StyleRange[] ranges = styledText.getStyleRanges();
+ int currentSelectionStart = styledText.getSelection().x;
+
+ for (int i = ranges.length - 1; i > -1; i--) {
+ if ((ranges[i].start + ranges[i].length - 1) < currentSelectionStart) {
return ranges[i];
}
- }
- return null;
- }
-
- /**
- * Sets the styled text's link (blue) ranges
- */
- private void setLinkRanges(int[][] linkRanges) {
- Color fg = JFaceColors.getHyperlinkText(styledText.getShell()
- .getDisplay());
- for (int[] linkRange : linkRanges) {
- StyleRange r = new StyleRange(linkRange[0], linkRange[1],
- fg, null);
- styledText.setStyleRange(r);
- }
- }
+ }
+ return null;
+ }
+
+ /**
+ * Sets the styled text's link (blue) ranges
+ */
+ private void setLinkRanges(int[][] linkRanges) {
+ Color fg = JFaceColors.getHyperlinkText(styledText.getShell().getDisplay());
+ for (int[] linkRange : linkRanges) {
+ StyleRange r = new StyleRange(linkRange[0], linkRange[1], fg, null);
+ styledText.setStyleRange(r);
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutUtils.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutUtils.java
index 9767b8e5095..c400c6c56e4 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutUtils.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/AboutUtils.java
@@ -76,13 +76,11 @@ public class AboutUtils {
urlOffset++;
// Right to "://"
- StringTokenizer tokenizer = new StringTokenizer(s
- .substring(urlSeparatorOffset + 3), " \t\n\r\f<>", false); //$NON-NLS-1$
+ StringTokenizer tokenizer = new StringTokenizer(s.substring(urlSeparatorOffset + 3), " \t\n\r\f<>", false); //$NON-NLS-1$
if (!tokenizer.hasMoreTokens())
return null;
- int urlLength = tokenizer.nextToken().length() + 3
- + urlSeparatorOffset - urlOffset;
+ int urlLength = tokenizer.nextToken().length() + 3 + urlSeparatorOffset - urlOffset;
if (startDoubleQuote) {
int endOffset = -1;
@@ -103,19 +101,17 @@ public class AboutUtils {
urlSeparatorOffset = s.indexOf("://", urlOffset + urlLength + 1); //$NON-NLS-1$
}
- return new AboutItem(s, linkRanges.toArray(new int[linkRanges
- .size()][2]), links
- .toArray(new String[links.size()]));
+ return new AboutItem(s, linkRanges.toArray(new int[linkRanges.size()][2]),
+ links.toArray(new String[links.size()]));
}
/**
- * Open a browser with the argument title on the argument url. If the url
- * refers to a resource within a bundle, then a temp copy of the file will
- * be extracted and opened.
+ * Open a browser with the argument title on the argument url. If the url refers
+ * to a resource within a bundle, then a temp copy of the file will be extracted
+ * and opened.
*
* @see <code>Platform.asLocalUrl</code>
- * @param url
- * The target url to be displayed, null will be safely ignored
+ * @param url The target url to be displayed, null will be safely ignored
* @return true if the url was successfully displayed and false otherwise
*/
public static boolean openBrowser(Shell shell, URL url) {
@@ -146,8 +142,7 @@ public class AboutUtils {
}
href = "file:///" + href; //$NON-NLS-1$
}
- IWorkbenchBrowserSupport support = PlatformUI.getWorkbench()
- .getBrowserSupport();
+ IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport();
try {
IWebBrowser browser = support.getExternalBrowser();
browser.openURL(new URL(urlEncodeForSpaces(href.toCharArray())));
@@ -159,9 +154,8 @@ public class AboutUtils {
}
/**
- * This method encodes the url, removes the spaces from the url and replaces
- * the same with <code>"%20"</code>. This method is required to fix Bug
- * 77840.
+ * This method encodes the url, removes the spaces from the url and replaces the
+ * same with <code>"%20"</code>. This method is required to fix Bug 77840.
*
* @since 3.0.2
*/
@@ -180,12 +174,9 @@ public class AboutUtils {
/**
* display an error message
*/
- private static void openWebBrowserError(Shell shell, final String href,
- final Throwable t) {
+ private static void openWebBrowserError(Shell shell, final String href, final Throwable t) {
String title = WorkbenchMessages.ProductInfoDialog_errorTitle;
- String msg = NLS.bind(
- WorkbenchMessages.ProductInfoDialog_unableToOpenWebBrowser,
- href);
+ String msg = NLS.bind(WorkbenchMessages.ProductInfoDialog_unableToOpenWebBrowser, href);
IStatus status = WorkbenchPlugin.getStatus(t);
StatusUtil.handleStatus(status, title + ": " + msg, StatusManager.SHOW, //$NON-NLS-1$
shell);
@@ -203,8 +194,7 @@ public class AboutUtils {
// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=97783
File logCopy = makeDisplayCopy(log);
if (logCopy != null) {
- AboutUtils.openLink(shell,
- "file:///" + logCopy.getAbsolutePath()); //$NON-NLS-1$
+ AboutUtils.openLink(shell, "file:///" + logCopy.getAbsolutePath()); //$NON-NLS-1$
return;
}
// Couldn't make copy, try to open the original log.
@@ -220,10 +210,8 @@ public class AboutUtils {
AboutUtils.openLink(shell, "file:///" + filename); //$NON-NLS-1$
return;
}
- MessageDialog.openInformation(shell,
- WorkbenchMessages.AboutSystemDialog_noLogTitle, NLS.bind(
- WorkbenchMessages.AboutSystemDialog_noLogMessage,
- filename));
+ MessageDialog.openInformation(shell, WorkbenchMessages.AboutSystemDialog_noLogTitle,
+ NLS.bind(WorkbenchMessages.AboutSystemDialog_noLogMessage, filename));
}
/**
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/BundleSigningInfo.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/BundleSigningInfo.java
index f932c3fcb2c..a6d98b34c16 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/BundleSigningInfo.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/BundleSigningInfo.java
@@ -88,8 +88,7 @@ public class BundleSigningInfo {
date = new Text(composite, SWT.READ_ONLY);
GC gc = new GC(date);
gc.setFont(JFaceResources.getDialogFont());
- Point size = gc.stringExtent(DateFormat.getDateTimeInstance()
- .format(new Date()));
+ Point size = gc.stringExtent(DateFormat.getDateTimeInstance().format(new Date()));
data.widthHint = size.x;
gc.dispose();
date.setText(WorkbenchMessages.BundleSigningTray_Working);
@@ -98,15 +97,12 @@ public class BundleSigningInfo {
// signer
{
Label label = new Label(composite, SWT.NONE);
- label
- .setText(WorkbenchMessages.BundleSigningTray_Signing_Certificate);
- GridData data = new GridData(SWT.BEGINNING, SWT.BEGINNING, true,
- false);
+ label.setText(WorkbenchMessages.BundleSigningTray_Signing_Certificate);
+ GridData data = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, false);
data.horizontalSpan = 2;
data = new GridData(SWT.FILL, SWT.FILL, true, true);
data.horizontalSpan = 2;
- certificate = new StyledText(composite, SWT.READ_ONLY | SWT.MULTI
- | SWT.WRAP);
+ certificate = new StyledText(composite, SWT.READ_ONLY | SWT.MULTI | SWT.WRAP);
certificate.setText(WorkbenchMessages.BundleSigningTray_Working);
certificate.setLayoutData(data);
}
@@ -141,14 +137,13 @@ public class BundleSigningInfo {
}
final AboutBundleData myData = data;
- final Job signerJob = Job.create(NLS.bind(
- WorkbenchMessages.BundleSigningTray_Determine_Signer_For,
- myData.getId()), (IJobFunction) monitor -> {
+ final Job signerJob = Job.create(
+ NLS.bind(WorkbenchMessages.BundleSigningTray_Determine_Signer_For, myData.getId()),
+ (IJobFunction) monitor -> {
try {
if (myData != data)
return Status.OK_STATUS;
- SignedContent signedContent = contentFactory
- .getSignedContent(myData.getBundle());
+ SignedContent signedContent = contentFactory.getSignedContent(myData.getBundle());
if (myData != data)
return Status.OK_STATUS;
SignerInfo[] signers = signedContent.getSignerInfos();
@@ -160,14 +155,12 @@ public class BundleSigningInfo {
signerText = WorkbenchMessages.BundleSigningTray_Unsigned;
dateText = WorkbenchMessages.BundleSigningTray_Unsigned;
} else {
- Properties[] certs = parseCerts(signers[0]
- .getCertificateChain());
+ Properties[] certs = parseCerts(signers[0].getCertificateChain());
if (certs.length == 0)
signerText = WorkbenchMessages.BundleSigningTray_Unknown;
else {
StringBuilder buffer = new StringBuilder();
- for (Iterator<Entry<Object, Object>> i = certs[0].entrySet().iterator(); i
- .hasNext();) {
+ for (Iterator<Entry<Object, Object>> i = certs[0].entrySet().iterator(); i.hasNext();) {
Entry<Object, Object> entry = i.next();
buffer.append(entry.getKey());
buffer.append('=');
@@ -178,33 +171,27 @@ public class BundleSigningInfo {
signerText = buffer.toString();
}
- Date signDate = signedContent
- .getSigningTime(signers[0]);
+ Date signDate = signedContent.getSigningTime(signers[0]);
if (signDate != null)
- dateText = DateFormat.getDateTimeInstance().format(
- signDate);
+ dateText = DateFormat.getDateTimeInstance().format(signDate);
else
dateText = WorkbenchMessages.BundleSigningTray_Unknown;
}
- PlatformUI.getWorkbench().getDisplay().asyncExec(
- () -> {
- // check to see if the tray is still visible
- // and if
- // we're still looking at the same item
- if (!isOpen()
- && BundleSigningInfo.this.data != myData)
- return;
- certificate.setText(signerText);
- date.setText(dateText);
- });
+ PlatformUI.getWorkbench().getDisplay().asyncExec(() -> {
+ // check to see if the tray is still visible
+ // and if
+ // we're still looking at the same item
+ if (!isOpen() && BundleSigningInfo.this.data != myData)
+ return;
+ certificate.setText(signerText);
+ date.setText(dateText);
+ });
} catch (IOException e1) {
- return new Status(IStatus.ERROR,
- WorkbenchPlugin.PI_WORKBENCH, e1.getMessage(), e1);
+ return new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, e1.getMessage(), e1);
} catch (GeneralSecurityException e2) {
- return new Status(IStatus.ERROR,
- WorkbenchPlugin.PI_WORKBENCH, e2.getMessage(), e2);
+ return new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, e2.getMessage(), e2);
}
return Status.OK_STATUS;
});
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/ConfigurationLogDefaultSection.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/ConfigurationLogDefaultSection.java
index 7f338511218..5497d25c3c5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/ConfigurationLogDefaultSection.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/ConfigurationLogDefaultSection.java
@@ -40,7 +40,7 @@ import org.eclipse.ui.internal.WorkbenchPlugin;
import org.osgi.framework.Bundle;
/**
- * This class puts basic platform information into the system summary log. This
+ * This class puts basic platform information into the system summary log. This
* includes sections for the java properties, the ids of all installed features
* and plugins, as well as a the current contents of the preferences service.
*
@@ -48,66 +48,66 @@ import org.osgi.framework.Bundle;
*/
public class ConfigurationLogDefaultSection implements ISystemSummarySection {
- private static final String ECLIPSE_PROPERTY_PREFIX = "eclipse."; //$NON-NLS-1$
+ private static final String ECLIPSE_PROPERTY_PREFIX = "eclipse."; //$NON-NLS-1$
- @Override
+ @Override
public void write(PrintWriter writer) {
- appendProperties(writer);
+ appendProperties(writer);
appendEnvironmentVariables(writer);
- appendFeatures(writer);
- appendRegistry(writer);
- appendUserPreferences(writer);
- }
-
- /**
- * Appends the <code>System</code> properties.
- */
- private void appendProperties(PrintWriter writer) {
- writer.println();
- writer.println(WorkbenchMessages.SystemSummary_systemProperties);
- Properties properties = System.getProperties();
+ appendFeatures(writer);
+ appendRegistry(writer);
+ appendUserPreferences(writer);
+ }
+
+ /**
+ * Appends the <code>System</code> properties.
+ */
+ private void appendProperties(PrintWriter writer) {
+ writer.println();
+ writer.println(WorkbenchMessages.SystemSummary_systemProperties);
+ Properties properties = System.getProperties();
SortedSet<Object> set = new TreeSet<>((o1, o2) -> {
- String s1 = (String) o1;
- String s2 = (String) o2;
- return s1.compareTo(s2);
+ String s1 = (String) o1;
+ String s2 = (String) o2;
+ return s1.compareTo(s2);
});
- set.addAll(properties.keySet());
+ set.addAll(properties.keySet());
Iterator<Object> i = set.iterator();
- while (i.hasNext()) {
- String key = (String)i.next();
- String value = properties.getProperty(key);
+ while (i.hasNext()) {
+ String key = (String) i.next();
+ String value = properties.getProperty(key);
- writer.print(key);
- writer.print('=');
+ writer.print(key);
+ writer.print('=');
- // some types of properties have special characters embedded
- if (key.startsWith(ECLIPSE_PROPERTY_PREFIX)) {
+ // some types of properties have special characters embedded
+ if (key.startsWith(ECLIPSE_PROPERTY_PREFIX)) {
printEclipseProperty(writer, value);
- } else if (key.toUpperCase().indexOf("PASSWORD") != -1) { //$NON-NLS-1$
- // We should obscure any property that may be a password
- for (int j = 0; j < value.length(); j++) {
+ } else if (key.toUpperCase().indexOf("PASSWORD") != -1) { //$NON-NLS-1$
+ // We should obscure any property that may be a password
+ for (int j = 0; j < value.length(); j++) {
writer.print('*');
}
- writer.println();
+ writer.println();
} else {
writer.println(value);
}
- }
- }
+ }
+ }
- private static void printEclipseProperty(PrintWriter writer, String value) {
+ private static void printEclipseProperty(PrintWriter writer, String value) {
String[] lines = value.split("\n"); //$NON-NLS-1$
- for (String line : lines) {
+ for (String line : lines) {
writer.println(line);
}
- }
+ }
- /**
- * Appends the installed and configured features.
- */
- private void appendFeatures(PrintWriter writer) {
- writer.println();
- writer.println(WorkbenchMessages.SystemSummary_features);
+ /**
+ * Appends the installed and configured features.
+ */
+ private void appendFeatures(PrintWriter writer) {
+ writer.println();
+ writer.println(WorkbenchMessages.SystemSummary_features);
IBundleGroupProvider[] providers = Platform.getBundleGroupProviders();
LinkedList<AboutBundleGroupData> groups = new LinkedList<>();
@@ -121,75 +121,73 @@ public class ConfigurationLogDefaultSection implements ISystemSummarySection {
}
AboutBundleGroupData[] bundleGroupInfos = groups.toArray(new AboutBundleGroupData[0]);
- AboutData.sortById(false, bundleGroupInfos);
+ AboutData.sortById(false, bundleGroupInfos);
for (AboutBundleGroupData info : bundleGroupInfos) {
String[] args = new String[] { info.getId(), info.getVersion(), info.getName() };
writer.println(NLS.bind(WorkbenchMessages.SystemSummary_featureVersion, args));
}
- }
+ }
- /**
- * Appends the contents of the Plugin Registry.
- */
- private void appendRegistry(PrintWriter writer) {
- writer.println();
- writer.println(WorkbenchMessages.SystemSummary_pluginRegistry);
+ /**
+ * Appends the contents of the Plugin Registry.
+ */
+ private void appendRegistry(PrintWriter writer) {
+ writer.println();
+ writer.println(WorkbenchMessages.SystemSummary_pluginRegistry);
- Bundle[] bundles = WorkbenchPlugin.getDefault().getBundles();
- AboutBundleData[] bundleInfos = new AboutBundleData[bundles.length];
+ Bundle[] bundles = WorkbenchPlugin.getDefault().getBundles();
+ AboutBundleData[] bundleInfos = new AboutBundleData[bundles.length];
- for (int i = 0; i < bundles.length; ++i) {
+ for (int i = 0; i < bundles.length; ++i) {
bundleInfos[i] = new AboutBundleData(bundles[i]);
}
- AboutData.sortById(false, bundleInfos);
-
- for (AboutBundleData info : bundleInfos) {
- String[] args = new String[] { info.getId(), info.getVersion(),
- info.getName(), info.getStateName() };
- writer.println(NLS.bind(WorkbenchMessages.SystemSummary_descriptorIdVersionState, args));
- }
- }
-
- /**
- * Appends the preferences
- */
- private void appendUserPreferences(PrintWriter writer) {
- // write the prefs to a byte array
- IPreferencesService service = Platform.getPreferencesService();
- IEclipsePreferences node = service.getRootNode();
- ByteArrayOutputStream stm = new ByteArrayOutputStream();
- try {
- service.exportPreferences(node, stm, null);
- } catch (CoreException e) {
- writer.println("Error reading preferences " + e.toString());//$NON-NLS-1$
- }
-
- // copy the prefs from the byte array to the writer
- writer.println();
- writer.println(WorkbenchMessages.SystemSummary_userPreferences);
-
- BufferedReader reader = null;
- try {
- ByteArrayInputStream in = new ByteArrayInputStream(stm
- .toByteArray());
- reader = new BufferedReader(new InputStreamReader(in, "8859_1")); //$NON-NLS-1$
- char[] chars = new char[8192];
-
- while (true) {
- int read = reader.read(chars);
- if (read <= 0) {
+ AboutData.sortById(false, bundleInfos);
+
+ for (AboutBundleData info : bundleInfos) {
+ String[] args = new String[] { info.getId(), info.getVersion(), info.getName(), info.getStateName() };
+ writer.println(NLS.bind(WorkbenchMessages.SystemSummary_descriptorIdVersionState, args));
+ }
+ }
+
+ /**
+ * Appends the preferences
+ */
+ private void appendUserPreferences(PrintWriter writer) {
+ // write the prefs to a byte array
+ IPreferencesService service = Platform.getPreferencesService();
+ IEclipsePreferences node = service.getRootNode();
+ ByteArrayOutputStream stm = new ByteArrayOutputStream();
+ try {
+ service.exportPreferences(node, stm, null);
+ } catch (CoreException e) {
+ writer.println("Error reading preferences " + e.toString());//$NON-NLS-1$
+ }
+
+ // copy the prefs from the byte array to the writer
+ writer.println();
+ writer.println(WorkbenchMessages.SystemSummary_userPreferences);
+
+ BufferedReader reader = null;
+ try {
+ ByteArrayInputStream in = new ByteArrayInputStream(stm.toByteArray());
+ reader = new BufferedReader(new InputStreamReader(in, "8859_1")); //$NON-NLS-1$
+ char[] chars = new char[8192];
+
+ while (true) {
+ int read = reader.read(chars);
+ if (read <= 0) {
break;
}
- writer.write(chars, 0, read);
- }
- } catch (IOException e) {
- writer.println("Error reading preferences " + e.toString());//$NON-NLS-1$
- }
-
- // ByteArray streams don't need to be closed
- }
+ writer.write(chars, 0, read);
+ }
+ } catch (IOException e) {
+ writer.println("Error reading preferences " + e.toString());//$NON-NLS-1$
+ }
+
+ // ByteArray streams don't need to be closed
+ }
/**
* Appends environment variables.
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/InstallationDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/InstallationDialog.java
index 263967b2774..7d372ebedba 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/InstallationDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/InstallationDialog.java
@@ -57,8 +57,7 @@ import org.eclipse.ui.services.IServiceLocator;
* @since 3.5
*
*/
-public class InstallationDialog extends TrayDialog implements
- IInstallationPageContainer {
+public class InstallationDialog extends TrayDialog implements IInstallationPageContainer {
class ButtonManager {
private Composite composite;
@@ -110,11 +109,9 @@ public class InstallationDialog extends TrayDialog implements
composite.layout(true);
}
- protected void setButtonLayoutData(FontMetrics metrics, Control button,
- boolean visible) {
+ protected void setButtonLayoutData(FontMetrics metrics, Control button, boolean visible) {
GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- int widthHint = Dialog.convertHorizontalDLUsToPixels(metrics,
- IDialogConstants.BUTTON_WIDTH);
+ int widthHint = Dialog.convertHorizontalDLUsToPixels(metrics, IDialogConstants.BUTTON_WIDTH);
Point minSize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
data.widthHint = Math.max(widthHint, minSize.x);
data.exclude = !visible;
@@ -164,8 +161,7 @@ public class InstallationDialog extends TrayDialog implements
IProduct product = Platform.getProduct();
if (product != null && product.getName() != null)
productName = product.getName();
- newShell.setText(NLS.bind(
- WorkbenchMessages.InstallationDialog_ShellTitle, productName));
+ newShell.setText(NLS.bind(WorkbenchMessages.InstallationDialog_ShellTitle, productName));
}
@Override
@@ -191,15 +187,12 @@ public class InstallationDialog extends TrayDialog implements
}
protected void createFolderItems(CTabFolder folder) {
- IConfigurationElement[] elements = ConfigurationInfo
- .getSortedExtensions(loadElements());
+ IConfigurationElement[] elements = ConfigurationInfo.getSortedExtensions(loadElements());
for (IConfigurationElement element : elements) {
CTabItem item = new CTabItem(folder, SWT.NONE);
- item.setText(element
- .getAttribute(IWorkbenchRegistryConstants.ATT_NAME));
+ item.setText(element.getAttribute(IWorkbenchRegistryConstants.ATT_NAME));
item.setData(element);
- item.setData(ID, element
- .getAttribute(IWorkbenchRegistryConstants.ATT_ID));
+ item.setData(ID, element.getAttribute(IWorkbenchRegistryConstants.ATT_ID));
Composite control = new Composite(folder, SWT.NONE);
control.setLayout(new GridLayout());
@@ -240,8 +233,7 @@ public class InstallationDialog extends TrayDialog implements
*/
private void tabSelected(CTabItem item) {
if (item.getData() instanceof IConfigurationElement) {
- final IConfigurationElement element = (IConfigurationElement) item
- .getData();
+ final IConfigurationElement element = (IConfigurationElement) item.getData();
Composite pageComposite = (Composite) item.getControl();
try {
@@ -255,8 +247,7 @@ public class InstallationDialog extends TrayDialog implements
// Must be done before creating the buttons because the control
// button creation methods
// use this map.
- pageToId.put(page, element
- .getAttribute(IWorkbenchRegistryConstants.ATT_ID));
+ pageToId.put(page, element.getAttribute(IWorkbenchRegistryConstants.ATT_ID));
createButtons(page);
item.setData(page);
item.addDisposeListener(e -> page.dispose());
@@ -272,12 +263,12 @@ public class InstallationDialog extends TrayDialog implements
String id = (String) item.getData(ID);
rememberSelectedTab(id);
buttonManager.update(id);
- Button button = createButton(buttonManager.getParent(),
- IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, true);
+ Button button = createButton(buttonManager.getParent(), IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL,
+ true);
GridData gd = (GridData) button.getLayoutData();
gd.horizontalAlignment = SWT.BEGINNING;
gd.horizontalIndent = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH) / 2;
- // Layout the button bar's parent and all of its children. We must
+ // Layout the button bar's parent and all of its children. We must
// cascade through all children because the buttons have changed and
// because tray dialog inserts an extra composite in the button bar
// hierarchy.
@@ -308,15 +299,14 @@ public class InstallationDialog extends TrayDialog implements
}
private IConfigurationElement[] loadElements() {
- IExtensionPoint point = Platform.getExtensionRegistry()
- .getExtensionPoint("org.eclipse.ui", "installationPages"); //$NON-NLS-1$ //$NON-NLS-2$
+ IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.ui", //$NON-NLS-1$
+ "installationPages"); //$NON-NLS-1$
return point.getConfigurationElements();
}
@Override
protected IDialogSettings getDialogBoundsSettings() {
- IDialogSettings settings = WorkbenchPlugin.getDefault()
- .getDialogSettings();
+ IDialogSettings settings = WorkbenchPlugin.getDefault().getDialogSettings();
IDialogSettings section = settings.getSection(DIALOG_SETTINGS_SECTION);
if (section == null) {
section = settings.addNewSection(DIALOG_SETTINGS_SECTION);
@@ -354,16 +344,15 @@ public class InstallationDialog extends TrayDialog implements
}
/**
- * Set the modal parent dialog that was used to launch this dialog. This
- * should be used by any launching dialog so that the {
- * {@link #closeModalContainers()} method can be properly implemented.
+ * Set the modal parent dialog that was used to launch this dialog. This should
+ * be used by any launching dialog so that the { {@link #closeModalContainers()}
+ * method can be properly implemented.
*
- * @param parent
- * the modal parent dialog that launched this dialog, or
- * <code>null</code> if there was no parent.
+ * @param parent the modal parent dialog that launched this dialog, or
+ * <code>null</code> if there was no parent.
*
- * This is an internal method and should not be used outside of
- * platform UI.
+ * This is an internal method and should not be used outside of
+ * platform UI.
*/
public void setModalParent(Dialog parent) {
this.modalParent = parent;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/InstallationHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/InstallationHandler.java
index 37260b6f92a..26b06bac7ea 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/InstallationHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/InstallationHandler.java
@@ -19,7 +19,7 @@ import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.handlers.HandlerUtil;
-public class InstallationHandler extends AbstractHandler{
+public class InstallationHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/ProductInfoDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/ProductInfoDialog.java
index d2dfa213a85..156d82fe462 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/ProductInfoDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/ProductInfoDialog.java
@@ -48,8 +48,7 @@ public abstract class ProductInfoDialog extends InstallationDialog {
super(shell, PlatformUI.getWorkbench().getActiveWorkbenchWindow());
}
- public void initializeDialog(ProductInfoPage page, String title,
- String helpContextId) {
+ public void initializeDialog(ProductInfoPage page, String title, String helpContextId) {
this.page = page;
this.title = title;
this.helpContextId = helpContextId;
@@ -81,8 +80,7 @@ public abstract class ProductInfoDialog extends InstallationDialog {
super.configureShell(newShell);
newShell.setText(title);
if (helpContextId != null)
- PlatformUI.getWorkbench().getHelpSystem().setHelp(newShell,
- helpContextId);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(newShell, helpContextId);
}
@Override
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/ProductInfoPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/ProductInfoPage.java
index 5f6ab52ebca..005aedf979a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/ProductInfoPage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/about/ProductInfoPage.java
@@ -41,13 +41,12 @@ import org.eclipse.ui.internal.WorkbenchMessages;
import org.eclipse.ui.swt.IFocusService;
/**
- * Abstract superclass of about dialog installation pages. The ProductInfoPage
+ * Abstract superclass of about dialog installation pages. The ProductInfoPage
* is set up so that the page can be hosted as one of many pages in the
* InstallationDialog, or as the only page in a ProductInfoDialog.
*/
-public abstract class ProductInfoPage extends InstallationPage implements
- IShellProvider {
+public abstract class ProductInfoPage extends InstallationPage implements IShellProvider {
private IProduct product;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/AbstractWorkingSetPulldownDelegate.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/AbstractWorkingSetPulldownDelegate.java
index eb46492bc58..b41d0cc81b1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/AbstractWorkingSetPulldownDelegate.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/AbstractWorkingSetPulldownDelegate.java
@@ -40,8 +40,8 @@ import org.eclipse.ui.internal.registry.WorkingSetRegistry;
*
* @since 3.3
*/
-public abstract class AbstractWorkingSetPulldownDelegate implements
- IWorkbenchWindowActionDelegate, IWorkbenchWindowPulldownDelegate2 {
+public abstract class AbstractWorkingSetPulldownDelegate
+ implements IWorkbenchWindowActionDelegate, IWorkbenchWindowPulldownDelegate2 {
private Menu menubarMenu;
@@ -120,17 +120,14 @@ public abstract class AbstractWorkingSetPulldownDelegate implements
* @return an array of arrays
*/
protected IWorkingSet[][] splitSets() {
- IWorkingSet[] allSets = getWindow().getWorkbench().getWorkingSetManager()
- .getWorkingSets();
+ IWorkingSet[] allSets = getWindow().getWorkbench().getWorkingSetManager().getWorkingSets();
Map map = new HashMap();
- WorkingSetRegistry registry = WorkbenchPlugin.getDefault()
- .getWorkingSetRegistry();
+ WorkingSetRegistry registry = WorkbenchPlugin.getDefault().getWorkingSetRegistry();
for (IWorkingSet allSet : allSets) {
String setType = allSet.getId();
- if (WorkbenchActivityHelper.filterItem(registry
- .getWorkingSetDescriptor(setType))) {
+ if (WorkbenchActivityHelper.filterItem(registry.getWorkingSetDescriptor(setType))) {
continue;
}
List setsOfType = (List) map.get(setType);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/ClearWorkingSetAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/ClearWorkingSetAction.java
index 2f5c1d87fec..c54f5c7c754 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/ClearWorkingSetAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/ClearWorkingSetAction.java
@@ -27,30 +27,29 @@ import org.eclipse.ui.internal.WorkbenchMessages;
* @since 2.1
*/
public class ClearWorkingSetAction extends Action {
- private WorkingSetFilterActionGroup actionGroup;
+ private WorkingSetFilterActionGroup actionGroup;
- /**
- * Creates a new instance of the receiver.
- *
- * @param actionGroup the action group this action is created in
- */
- public ClearWorkingSetAction(WorkingSetFilterActionGroup actionGroup) {
- super(WorkbenchMessages.ClearWorkingSetAction_text);
- Assert.isNotNull(actionGroup);
- setToolTipText(WorkbenchMessages.ClearWorkingSetAction_toolTip);
- setEnabled(actionGroup.getWorkingSet() != null);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
- IWorkbenchHelpContextIds.CLEAR_WORKING_SET_ACTION);
- this.actionGroup = actionGroup;
- }
+ /**
+ * Creates a new instance of the receiver.
+ *
+ * @param actionGroup the action group this action is created in
+ */
+ public ClearWorkingSetAction(WorkingSetFilterActionGroup actionGroup) {
+ super(WorkbenchMessages.ClearWorkingSetAction_text);
+ Assert.isNotNull(actionGroup);
+ setToolTipText(WorkbenchMessages.ClearWorkingSetAction_toolTip);
+ setEnabled(actionGroup.getWorkingSet() != null);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.CLEAR_WORKING_SET_ACTION);
+ this.actionGroup = actionGroup;
+ }
- /**
- * Overrides method from Action
- *
- * @see Action#run
- */
- @Override
+ /**
+ * Overrides method from Action
+ *
+ * @see Action#run
+ */
+ @Override
public void run() {
- actionGroup.setWorkingSet(null);
- }
+ actionGroup.setWorkingSet(null);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/CommandAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/CommandAction.java
index 098ef20380b..280a9d35fe4 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/CommandAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/CommandAction.java
@@ -58,31 +58,25 @@ public class CommandAction extends Action {
* Creates the action backed by a command. For commands that don't take
* parameters.
*
- * @param serviceLocator
- * The service locator that is closest in lifecycle to this
- * action.
- * @param commandIdIn
- * the command id. Must not be <code>null</code>.
+ * @param serviceLocator The service locator that is closest in lifecycle to
+ * this action.
+ * @param commandIdIn the command id. Must not be <code>null</code>.
*/
public CommandAction(IServiceLocator serviceLocator, String commandIdIn) {
this(serviceLocator, commandIdIn, null);
}
/**
- * Creates the action backed by a parameterized command. The parameterMap
- * must contain only all required parameters, and may contain the optional
+ * Creates the action backed by a parameterized command. The parameterMap must
+ * contain only all required parameters, and may contain the optional
* parameters.
*
- * @param serviceLocator
- * The service locator that is closest in lifecycle to this
- * action.
- * @param commandIdIn
- * the command id. Must not be <code>null</code>.
- * @param parameterMap
- * the parameter map. May be <code>null</code>.
+ * @param serviceLocator The service locator that is closest in lifecycle to
+ * this action.
+ * @param commandIdIn the command id. Must not be <code>null</code>.
+ * @param parameterMap the parameter map. May be <code>null</code>.
*/
- public CommandAction(IServiceLocator serviceLocator, String commandIdIn,
- Map parameterMap) {
+ public CommandAction(IServiceLocator serviceLocator, String commandIdIn, Map parameterMap) {
if (commandIdIn == null) {
throw new NullPointerException("commandIdIn must not be null"); //$NON-NLS-1$
}
@@ -92,8 +86,7 @@ public class CommandAction extends Action {
protected ICommandListener getCommandListener() {
if (commandListener == null) {
commandListener = commandEvent -> {
- if (commandEvent.isHandledChanged()
- || commandEvent.isEnabledChanged()) {
+ if (commandEvent.isHandledChanged() || commandEvent.isEnabledChanged()) {
if (commandEvent.getCommand().isDefined()) {
setEnabled(commandEvent.getCommand().isEnabled());
}
@@ -106,14 +99,11 @@ public class CommandAction extends Action {
/**
* Build a command from the executable extension information.
*
- * @param commandService
- * to get the Command object
- * @param commandId
- * the command id for this action
+ * @param commandService to get the Command object
+ * @param commandId the command id for this action
* @param parameterMap
*/
- private void createCommand(ICommandService commandService,
- String commandId, Map parameterMap) {
+ private void createCommand(ICommandService commandService, String commandId, Map parameterMap) {
Command cmd = commandService.getCommand(commandId);
if (!cmd.isDefined()) {
WorkbenchPlugin.log("Command " + commandId + " is undefined"); //$NON-NLS-1$//$NON-NLS-2$
@@ -125,16 +115,14 @@ public class CommandAction extends Action {
return;
}
- parameterizedCommand = ParameterizedCommand.generateCommand(cmd,
- parameterMap);
+ parameterizedCommand = ParameterizedCommand.generateCommand(cmd, parameterMap);
}
public void dispose() {
// not important for command ID, maybe for command though.
handlerService = null;
if (commandListener != null) {
- parameterizedCommand.getCommand().removeCommandListener(
- commandListener);
+ parameterizedCommand.getCommand().removeCommandListener(commandListener);
commandListener = null;
}
parameterizedCommand = null;
@@ -164,18 +152,14 @@ public class CommandAction extends Action {
runWithEvent(null);
}
- protected void init(IServiceLocator serviceLocator, String commandIdIn,
- Map parameterMap) {
+ protected void init(IServiceLocator serviceLocator, String commandIdIn, Map parameterMap) {
if (handlerService != null) {
// already initialized
return;
}
- handlerService = serviceLocator
- .getService(IHandlerService.class);
- ICommandService commandService = serviceLocator
- .getService(ICommandService.class);
- ICommandImageService commandImageService = serviceLocator
- .getService(ICommandImageService.class);
+ handlerService = serviceLocator.getService(IHandlerService.class);
+ ICommandService commandService = serviceLocator.getService(ICommandService.class);
+ ICommandImageService commandImageService = serviceLocator.getService(ICommandImageService.class);
createCommand(commandService, commandIdIn, parameterMap);
if (parameterizedCommand != null) {
@@ -186,17 +170,14 @@ public class CommandAction extends Action {
} catch (NotDefinedException e) {
// if we get this far it shouldn't be a problem
}
- parameterizedCommand.getCommand().addCommandListener(
- getCommandListener());
- parameterizedCommand.getCommand().setEnabled(
- handlerService.getCurrentState());
+ parameterizedCommand.getCommand().addCommandListener(getCommandListener());
+ parameterizedCommand.getCommand().setEnabled(handlerService.getCurrentState());
setEnabled(parameterizedCommand.getCommand().isEnabled());
- setImageDescriptor(commandImageService.getImageDescriptor(
- commandIdIn, ICommandImageService.TYPE_DEFAULT));
- setDisabledImageDescriptor(commandImageService.getImageDescriptor(
- commandIdIn, ICommandImageService.TYPE_DISABLED));
- setHoverImageDescriptor(commandImageService.getImageDescriptor(
- commandIdIn, ICommandImageService.TYPE_HOVER));
+ setImageDescriptor(commandImageService.getImageDescriptor(commandIdIn, ICommandImageService.TYPE_DEFAULT));
+ setDisabledImageDescriptor(
+ commandImageService.getImageDescriptor(commandIdIn, ICommandImageService.TYPE_DISABLED));
+ setHoverImageDescriptor(
+ commandImageService.getImageDescriptor(commandIdIn, ICommandImageService.TYPE_HOVER));
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/DynamicHelpAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/DynamicHelpAction.java
index 5bbcc6f5b2b..a587933aa25 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/DynamicHelpAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/DynamicHelpAction.java
@@ -46,8 +46,7 @@ public class DynamicHelpAction extends Action implements IWorkbenchAction {
/**
* Constructor for use by ActionFactory.
*
- * @param window
- * the window
+ * @param window the window
*/
public DynamicHelpAction(IWorkbenchWindow window) {
if (window == null) {
@@ -57,8 +56,8 @@ public class DynamicHelpAction extends Action implements IWorkbenchAction {
setActionDefinitionId(IWorkbenchCommandConstants.HELP_DYNAMIC_HELP);
// support for allowing a product to override the text for the action
- String overrideText = PrefUtil.getAPIPreferenceStore().getString(
- IWorkbenchPreferenceConstants.DYNAMIC_HELP_ACTION_TEXT);
+ String overrideText = PrefUtil.getAPIPreferenceStore()
+ .getString(IWorkbenchPreferenceConstants.DYNAMIC_HELP_ACTION_TEXT);
if ("".equals(overrideText)) { //$NON-NLS-1$
setText(appendAccelerator(WorkbenchMessages.DynamicHelpAction_text));
setToolTipText(WorkbenchMessages.DynamicHelpAction_toolTip);
@@ -66,8 +65,7 @@ public class DynamicHelpAction extends Action implements IWorkbenchAction {
setText(appendAccelerator(overrideText));
setToolTipText(Action.removeMnemonics(overrideText));
}
- window.getWorkbench().getHelpSystem().setHelp(this,
- IWorkbenchHelpContextIds.DYNAMIC_HELP_ACTION);
+ window.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.DYNAMIC_HELP_ACTION);
}
private String appendAccelerator(String text) {
@@ -77,8 +75,8 @@ public class DynamicHelpAction extends Action implements IWorkbenchAction {
// Commented out due to the problem described in
// Bugzilla bug #95057
- //if (Platform.getWS().equals(Platform.WS_WIN32))
- // return text + "\t" + KeyStroke.getInstance(SWT.F1).format(); //$NON-NLS-1$
+ // if (Platform.getWS().equals(Platform.WS_WIN32))
+ // return text + "\t" + KeyStroke.getInstance(SWT.F1).format(); //$NON-NLS-1$
return text;
}
@@ -89,8 +87,7 @@ public class DynamicHelpAction extends Action implements IWorkbenchAction {
return;
}
// This may take a while, so use the busy indicator
- BusyIndicator.showWhile(null, () -> workbenchWindow.getWorkbench().getHelpSystem()
- .displayDynamicHelp());
+ BusyIndicator.showWhile(null, () -> workbenchWindow.getWorkbench().getHelpSystem().displayDynamicHelp());
}
@Override
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/EditWorkingSetAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/EditWorkingSetAction.java
index 63a52d3f052..960e8abdb49 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/EditWorkingSetAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/EditWorkingSetAction.java
@@ -34,55 +34,51 @@ import org.eclipse.ui.internal.WorkbenchMessages;
* @since 2.1
*/
public class EditWorkingSetAction extends Action {
- private Shell shell;
+ private Shell shell;
- private WorkingSetFilterActionGroup actionGroup;
+ private WorkingSetFilterActionGroup actionGroup;
- /**
- * Creates a new instance of the receiver.
- *
- * @param actionGroup the action group this action is created in
- * @param shell the parent shell
- */
- public EditWorkingSetAction(WorkingSetFilterActionGroup actionGroup,
- Shell shell) {
- super(WorkbenchMessages.EditWorkingSetAction_text);
- Assert.isNotNull(actionGroup);
- setToolTipText(WorkbenchMessages.EditWorkingSetAction_toolTip);
+ /**
+ * Creates a new instance of the receiver.
+ *
+ * @param actionGroup the action group this action is created in
+ * @param shell the parent shell
+ */
+ public EditWorkingSetAction(WorkingSetFilterActionGroup actionGroup, Shell shell) {
+ super(WorkbenchMessages.EditWorkingSetAction_text);
+ Assert.isNotNull(actionGroup);
+ setToolTipText(WorkbenchMessages.EditWorkingSetAction_toolTip);
- this.shell = shell;
- this.actionGroup = actionGroup;
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
- IWorkbenchHelpContextIds.EDIT_WORKING_SET_ACTION);
- }
+ this.shell = shell;
+ this.actionGroup = actionGroup;
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.EDIT_WORKING_SET_ACTION);
+ }
- /**
- * Overrides method from Action
- *
- * @see Action#run
- */
- @Override
+ /**
+ * Overrides method from Action
+ *
+ * @see Action#run
+ */
+ @Override
public void run() {
- IWorkingSetManager manager = PlatformUI.getWorkbench()
- .getWorkingSetManager();
- IWorkingSet workingSet = actionGroup.getWorkingSet();
+ IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager();
+ IWorkingSet workingSet = actionGroup.getWorkingSet();
- if (workingSet == null) {
- setEnabled(false);
- return;
- }
- IWorkingSetEditWizard wizard = manager
- .createWorkingSetEditWizard(workingSet);
- if (wizard == null) {
- String title = WorkbenchMessages.EditWorkingSetAction_error_nowizard_title;
- String message = WorkbenchMessages.EditWorkingSetAction_error_nowizard_message;
- MessageDialog.openError(shell, title, message);
- return;
- }
- WizardDialog dialog = new WizardDialog(shell, wizard);
- dialog.create();
- if (dialog.open() == Window.OK) {
+ if (workingSet == null) {
+ setEnabled(false);
+ return;
+ }
+ IWorkingSetEditWizard wizard = manager.createWorkingSetEditWizard(workingSet);
+ if (wizard == null) {
+ String title = WorkbenchMessages.EditWorkingSetAction_error_nowizard_title;
+ String message = WorkbenchMessages.EditWorkingSetAction_error_nowizard_message;
+ MessageDialog.openError(shell, title, message);
+ return;
+ }
+ WizardDialog dialog = new WizardDialog(shell, wizard);
+ dialog.create();
+ if (dialog.open() == Window.OK) {
actionGroup.setWorkingSet(wizard.getSelection());
}
- }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/HelpContentsAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/HelpContentsAction.java
index 220abfce63b..198562f1508 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/HelpContentsAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/HelpContentsAction.java
@@ -32,60 +32,58 @@ import org.eclipse.ui.internal.util.PrefUtil;
* @since 3.0
*/
public class HelpContentsAction extends Action implements IWorkbenchAction {
- /**
- * The workbench window; or <code>null</code> if this
- * action has been <code>dispose</code>d.
- */
- private IWorkbenchWindow workbenchWindow;
+ /**
+ * The workbench window; or <code>null</code> if this action has been
+ * <code>dispose</code>d.
+ */
+ private IWorkbenchWindow workbenchWindow;
- /**
- * Zero-arg constructor to allow cheat sheets to reuse this action.
- */
- public HelpContentsAction() {
- this(PlatformUI.getWorkbench().getActiveWorkbenchWindow());
- }
+ /**
+ * Zero-arg constructor to allow cheat sheets to reuse this action.
+ */
+ public HelpContentsAction() {
+ this(PlatformUI.getWorkbench().getActiveWorkbenchWindow());
+ }
- /**
- * Constructor for use by ActionFactory.
- *
- * @param window the window
- */
- public HelpContentsAction(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- this.workbenchWindow = window;
- setActionDefinitionId(IWorkbenchCommandConstants.HELP_HELP_CONTENTS);
+ /**
+ * Constructor for use by ActionFactory.
+ *
+ * @param window the window
+ */
+ public HelpContentsAction(IWorkbenchWindow window) {
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ this.workbenchWindow = window;
+ setActionDefinitionId(IWorkbenchCommandConstants.HELP_HELP_CONTENTS);
- // support for allowing a product to override the text for the action
- String overrideText = PrefUtil.getAPIPreferenceStore().getString(
- IWorkbenchPreferenceConstants.HELP_CONTENTS_ACTION_TEXT);
- if ("".equals(overrideText)) { //$NON-NLS-1$
- setText(WorkbenchMessages.HelpContentsAction_text);
- setToolTipText(WorkbenchMessages.HelpContentsAction_toolTip);
- } else {
- setText(overrideText);
- setToolTipText(Action.removeMnemonics(overrideText));
- }
- setImageDescriptor(WorkbenchImages
- .getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_HELP_CONTENTS));
- window.getWorkbench().getHelpSystem().setHelp(this,
- IWorkbenchHelpContextIds.HELP_CONTENTS_ACTION);
- }
+ // support for allowing a product to override the text for the action
+ String overrideText = PrefUtil.getAPIPreferenceStore()
+ .getString(IWorkbenchPreferenceConstants.HELP_CONTENTS_ACTION_TEXT);
+ if ("".equals(overrideText)) { //$NON-NLS-1$
+ setText(WorkbenchMessages.HelpContentsAction_text);
+ setToolTipText(WorkbenchMessages.HelpContentsAction_toolTip);
+ } else {
+ setText(overrideText);
+ setToolTipText(Action.removeMnemonics(overrideText));
+ }
+ setImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_HELP_CONTENTS));
+ window.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.HELP_CONTENTS_ACTION);
+ }
- @Override
+ @Override
public void run() {
- if (workbenchWindow == null) {
- // action has been disposed
- return;
- }
- //This may take a while, so use the busy indicator
- BusyIndicator.showWhile(null, () -> workbenchWindow.getWorkbench().getHelpSystem().displayHelp());
- }
+ if (workbenchWindow == null) {
+ // action has been disposed
+ return;
+ }
+ // This may take a while, so use the busy indicator
+ BusyIndicator.showWhile(null, () -> workbenchWindow.getWorkbench().getHelpSystem().displayHelp());
+ }
- @Override
+ @Override
public void dispose() {
- workbenchWindow = null;
- }
+ workbenchWindow = null;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/HelpSearchAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/HelpSearchAction.java
index 034e192dff0..375300a6fd1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/HelpSearchAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/HelpSearchAction.java
@@ -32,60 +32,58 @@ import org.eclipse.ui.internal.util.PrefUtil;
* @since 3.1
*/
public class HelpSearchAction extends Action implements IWorkbenchAction {
- /**
- * The workbench window; or <code>null</code> if this
- * action has been <code>dispose</code>d.
- */
- private IWorkbenchWindow workbenchWindow;
+ /**
+ * The workbench window; or <code>null</code> if this action has been
+ * <code>dispose</code>d.
+ */
+ private IWorkbenchWindow workbenchWindow;
- /**
- * Zero-arg constructor to allow cheat sheets to reuse this action.
- */
- public HelpSearchAction() {
- this(PlatformUI.getWorkbench().getActiveWorkbenchWindow());
- }
+ /**
+ * Zero-arg constructor to allow cheat sheets to reuse this action.
+ */
+ public HelpSearchAction() {
+ this(PlatformUI.getWorkbench().getActiveWorkbenchWindow());
+ }
- /**
- * Constructor for use by ActionFactory.
- *
- * @param window the window
- */
- public HelpSearchAction(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException();
- }
- this.workbenchWindow = window;
- setActionDefinitionId(IWorkbenchCommandConstants.HELP_HELP_SEARCH);
+ /**
+ * Constructor for use by ActionFactory.
+ *
+ * @param window the window
+ */
+ public HelpSearchAction(IWorkbenchWindow window) {
+ if (window == null) {
+ throw new IllegalArgumentException();
+ }
+ this.workbenchWindow = window;
+ setActionDefinitionId(IWorkbenchCommandConstants.HELP_HELP_SEARCH);
- // support for allowing a product to override the text for the action
- String overrideText = PrefUtil.getAPIPreferenceStore().getString(
- IWorkbenchPreferenceConstants.HELP_SEARCH_ACTION_TEXT);
- if ("".equals(overrideText)) { //$NON-NLS-1$
- setText(WorkbenchMessages.HelpSearchAction_text);
- setToolTipText(WorkbenchMessages.HelpSearchAction_toolTip);
- } else {
- setText(overrideText);
- setToolTipText(Action.removeMnemonics(overrideText));
- }
- setImageDescriptor(WorkbenchImages
- .getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_HELP_SEARCH));
- window.getWorkbench().getHelpSystem().setHelp(this,
- IWorkbenchHelpContextIds.HELP_SEARCH_ACTION);
- }
+ // support for allowing a product to override the text for the action
+ String overrideText = PrefUtil.getAPIPreferenceStore()
+ .getString(IWorkbenchPreferenceConstants.HELP_SEARCH_ACTION_TEXT);
+ if ("".equals(overrideText)) { //$NON-NLS-1$
+ setText(WorkbenchMessages.HelpSearchAction_text);
+ setToolTipText(WorkbenchMessages.HelpSearchAction_toolTip);
+ } else {
+ setText(overrideText);
+ setToolTipText(Action.removeMnemonics(overrideText));
+ }
+ setImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_HELP_SEARCH));
+ window.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.HELP_SEARCH_ACTION);
+ }
- @Override
+ @Override
public void run() {
- if (workbenchWindow == null) {
- // action has been disposed
- return;
- }
- //This may take a while, so use the busy indicator
- BusyIndicator.showWhile(null, () -> workbenchWindow.getWorkbench().getHelpSystem().displaySearch());
- }
+ if (workbenchWindow == null) {
+ // action has been disposed
+ return;
+ }
+ // This may take a while, so use the busy indicator
+ BusyIndicator.showWhile(null, () -> workbenchWindow.getWorkbench().getHelpSystem().displaySearch());
+ }
- @Override
+ @Override
public void dispose() {
- workbenchWindow = null;
- }
+ workbenchWindow = null;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/HelpSearchContributionItem.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/HelpSearchContributionItem.java
index 7ef0296a678..1b77b4bffd8 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/HelpSearchContributionItem.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/HelpSearchContributionItem.java
@@ -28,8 +28,8 @@ import org.eclipse.ui.internal.WorkbenchMessages;
import org.eclipse.ui.internal.WorkbenchPlugin;
/**
- * This is the contribution item that is used to add a help search field to
- * the cool bar.
+ * This is the contribution item that is used to add a help search field to the
+ * cool bar.
*
* @since 3.1
*/
@@ -55,11 +55,11 @@ public class HelpSearchContributionItem extends ControlContribution {
* Creates the contribution item.
*
* @param window the window
- * @param id the contribution item id
+ * @param id the contribution item id
*/
public HelpSearchContributionItem(IWorkbenchWindow window, String id) {
super(id);
- Assert.isNotNull(window);
+ Assert.isNotNull(window);
this.window = window;
}
@@ -67,8 +67,7 @@ public class HelpSearchContributionItem extends ControlContribution {
protected Control createControl(Composite parent) {
combo = new Combo(parent, SWT.NONE);
combo.setToolTipText(WorkbenchMessages.WorkbenchWindow_searchCombo_toolTip);
- String[] items = WorkbenchPlugin.getDefault().getDialogSettings()
- .getArray(ID);
+ String[] items = WorkbenchPlugin.getDefault().getDialogSettings().getArray(ID);
if (items != null) {
combo.setItems(items);
}
@@ -97,7 +96,7 @@ public class HelpSearchContributionItem extends ControlContribution {
private void doSearch(String phrase, boolean updateList) {
if (phrase.length() == 0) {
- window.getWorkbench().getHelpSystem().displaySearch();
+ window.getWorkbench().getHelpSystem().displaySearch();
return;
}
if (updateList) {
@@ -114,8 +113,7 @@ public class HelpSearchContributionItem extends ControlContribution {
if (combo.getItemCount() > MAX_ITEM_COUNT) {
combo.remove(combo.getItemCount() - 1);
}
- WorkbenchPlugin.getDefault().getDialogSettings().put(ID,
- combo.getItems());
+ WorkbenchPlugin.getDefault().getDialogSettings().put(ID, combo.getItems());
}
}
window.getWorkbench().getHelpSystem().search(phrase);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/ModifyWorkingSetDelegate.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/ModifyWorkingSetDelegate.java
index 4bcc791e59a..5cff2c0b7d1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/ModifyWorkingSetDelegate.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/ModifyWorkingSetDelegate.java
@@ -54,8 +54,8 @@ import org.eclipse.ui.internal.WorkbenchPlugin;
* @since 3.3
*
*/
-public class ModifyWorkingSetDelegate extends
- AbstractWorkingSetPulldownDelegate implements IExecutableExtension, IActionDelegate2 {
+public class ModifyWorkingSetDelegate extends AbstractWorkingSetPulldownDelegate
+ implements IExecutableExtension, IActionDelegate2 {
public static class NewWorkingSetAction extends Action {
@@ -68,21 +68,19 @@ public class ModifyWorkingSetDelegate extends
@Override
public void run() {
- IWorkingSetManager manager = WorkbenchPlugin.getDefault()
- .getWorkingSetManager();
+ IWorkingSetManager manager = WorkbenchPlugin.getDefault().getWorkingSetManager();
IWorkingSetNewWizard wizard = manager.createWorkingSetNewWizard(null);
// the wizard can never be null since we have at least a resource
// working set
// creation page
- WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench()
- .getDisplay().getActiveShell(), wizard);
+ WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), wizard);
dialog.create();
PlatformUI.getWorkbench().getHelpSystem().setHelp(dialog.getShell(),
IWorkbenchHelpContextIds.WORKING_SET_NEW_WIZARD);
if (dialog.open() == Window.OK) {
IWorkingSet workingSet = wizard.getSelection();
- if(workingSet != null) {
+ if (workingSet != null) {
manager.addWorkingSet(workingSet);
}
}
@@ -94,14 +92,14 @@ public class ModifyWorkingSetDelegate extends
private IWorkingSet set;
- private IAdaptable [] selectedElements;
+ private IAdaptable[] selectedElements;
/**
* @param set
* @param selectedElements
* @param add
*/
- private ModifyAction(IWorkingSet set, IAdaptable [] selectedElements) {
+ private ModifyAction(IWorkingSet set, IAdaptable[] selectedElements) {
super(set.getLabel(), IAction.AS_CHECK_BOX);
this.set = set;
this.selectedElements = selectedElements;
@@ -112,8 +110,7 @@ public class ModifyWorkingSetDelegate extends
public void run() {
Collection oldElements = Arrays.asList(set.getElements());
- Set newElements = new HashSet(oldElements.size()
- + selectedElements.length);
+ Set newElements = new HashSet(oldElements.size() + selectedElements.length);
newElements.addAll(oldElements);
List selectedAsList = Arrays.asList(selectedElements);
if (add) {
@@ -121,8 +118,7 @@ public class ModifyWorkingSetDelegate extends
} else {
newElements.removeAll(selectedAsList);
}
- set.setElements((IAdaptable[]) newElements
- .toArray(new IAdaptable[newElements.size()]));
+ set.setElements((IAdaptable[]) newElements.toArray(new IAdaptable[newElements.size()]));
}
}
@@ -172,14 +168,12 @@ public class ModifyWorkingSetDelegate extends
@Override
public void init(IWorkbenchWindow window) {
super.init(window);
- getWindow().getWorkbench().getWorkingSetManager()
- .addPropertyChangeListener(listener);
+ getWindow().getWorkbench().getWorkingSetManager().addPropertyChangeListener(listener);
}
@Override
public void dispose() {
- getWindow().getWorkbench().getWorkingSetManager()
- .removePropertyChangeListener(listener);
+ getWindow().getWorkbench().getWorkingSetManager().removePropertyChangeListener(listener);
super.dispose();
contextMenuCreator.dispose();
}
@@ -198,7 +192,7 @@ public class ModifyWorkingSetDelegate extends
}
}
// create working set action only for add menu
- if(add) {
+ if (add) {
IContributionItem item = null;
if (menu.getItemCount() > 0) {
item = new Separator();
@@ -209,6 +203,7 @@ public class ModifyWorkingSetDelegate extends
item.fill(menu, -1);
}
}
+
/**
* Return the list of items to show in the submenu.
*
@@ -218,8 +213,9 @@ public class ModifyWorkingSetDelegate extends
List menuItems = new ArrayList();
ISelection selection = getSelection();
if (!(selection instanceof IStructuredSelection)) {
- if(!add) {
- IAction emptyAction = new Action(WorkbenchMessages.NoApplicableWorkingSets) {};
+ if (!add) {
+ IAction emptyAction = new Action(WorkbenchMessages.NoApplicableWorkingSets) {
+ };
emptyAction.setEnabled(false);
menuItems.add(emptyAction);
}
@@ -227,7 +223,7 @@ public class ModifyWorkingSetDelegate extends
}
IWorkingSet[][] typedSets = splitSets();
- Object [] selectedElements = ((IStructuredSelection)selection).toArray();
+ Object[] selectedElements = ((IStructuredSelection) selection).toArray();
// keep a tab of whether or not we need a separator. If a given type
// of working set has contributed some items then this will be true
@@ -242,11 +238,10 @@ public class ModifyWorkingSetDelegate extends
for (IWorkingSet set : sets) {
Set existingElements = new HashSet();
- existingElements.addAll(Arrays
- .asList(set.getElements()));
+ existingElements.addAll(Arrays.asList(set.getElements()));
boolean visible = false;
- IAdaptable [] adaptables = new IAdaptable[selectedElements.length];
+ IAdaptable[] adaptables = new IAdaptable[selectedElements.length];
System.arraycopy(selectedElements, 0, adaptables, 0, selectedElements.length);
adaptables = set.adaptElements(adaptables);
if (adaptables.length > 0 && add) {
@@ -258,10 +253,9 @@ public class ModifyWorkingSetDelegate extends
break;
}
}
- }
- else if (adaptables.length > 0) {
+ } else if (adaptables.length > 0) {
for (IAdaptable adaptable : adaptables) {
- if (existingElements.contains(adaptable)){
+ if (existingElements.contains(adaptable)) {
visible = true; // show if any element
// is present in removal
break;
@@ -274,8 +268,7 @@ public class ModifyWorkingSetDelegate extends
menuItems.add(new Separator());
needsSeparator = false;
}
- ModifyAction action = new ModifyAction(set,
- adaptables);
+ ModifyAction action = new ModifyAction(set, adaptables);
menuItems.add(action);
}
}
@@ -284,8 +277,7 @@ public class ModifyWorkingSetDelegate extends
needsSeparator |= menuItems.size() > oldCount;
}
if (menuItems.isEmpty() && !add) {
- IAction emptyAction = new Action(
- WorkbenchMessages.NoApplicableWorkingSets) {
+ IAction emptyAction = new Action(WorkbenchMessages.NoApplicableWorkingSets) {
};
emptyAction.setEnabled(false);
menuItems.add(emptyAction);
@@ -310,9 +302,9 @@ public class ModifyWorkingSetDelegate extends
public void selectionChanged(IAction actionProxy, ISelection selection) {
super.selectionChanged(actionProxy, selection);
if (selection instanceof IStructuredSelection) {
- Object[] selectedElements = ((IStructuredSelection) getSelection())
- .toArray();
- // ensure every item is of type IAdaptable and is NOT an IWorkingSet (minimal fix for 157799)
+ Object[] selectedElements = ((IStructuredSelection) getSelection()).toArray();
+ // ensure every item is of type IAdaptable and is NOT an IWorkingSet (minimal
+ // fix for 157799)
boolean minimallyOkay = true;
for (Object selectedElement : selectedElements) {
Object object = selectedElement;
@@ -323,14 +315,12 @@ public class ModifyWorkingSetDelegate extends
}
actionProxy.setEnabled(minimallyOkay);
- }
- else
+ } else
actionProxy.setEnabled(false);
}
@Override
- public void setInitializationData(IConfigurationElement config,
- String propertyName, Object data) {
+ public void setInitializationData(IConfigurationElement config, String propertyName, Object data) {
if (data instanceof String) {
add = Boolean.parseBoolean((String) data);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/NewWizardShortcutAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/NewWizardShortcutAction.java
index de11d5e8653..0c19cde8ff4 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/NewWizardShortcutAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/NewWizardShortcutAction.java
@@ -38,130 +38,124 @@ import org.eclipse.ui.wizards.IWizardDescriptor;
/**
* Opens a specific new wizard.
*/
-public class NewWizardShortcutAction extends Action implements
- IPluginContribution {
- private IWizardDescriptor wizardElement;
-
- /**
- * The wizard dialog width
- */
- private static final int SIZING_WIZARD_WIDTH = 500;
-
- /**
- * The wizard dialog height
- */
- private static final int SIZING_WIZARD_HEIGHT = 500;
-
- private IWorkbenchWindow window;
-
- /**
- * Create an instance of this class.
- *
- * @param window the workbench window in which this action will appear
- * @param wizardDesc a wizard element
- */
- public NewWizardShortcutAction(IWorkbenchWindow window,
- IWizardDescriptor wizardDesc) {
- super(wizardDesc.getLabel());
- setToolTipText(wizardDesc.getDescription());
- setImageDescriptor(wizardDesc.getImageDescriptor());
- setId(ActionFactory.NEW.getId());
- wizardElement = wizardDesc;
- this.window = window;
- }
-
- /**
- * Get the wizard descriptor for this action.
- *
- * @return the wizard descriptor
- */
- public IWizardDescriptor getWizardDescriptor() {
+public class NewWizardShortcutAction extends Action implements IPluginContribution {
+ private IWizardDescriptor wizardElement;
+
+ /**
+ * The wizard dialog width
+ */
+ private static final int SIZING_WIZARD_WIDTH = 500;
+
+ /**
+ * The wizard dialog height
+ */
+ private static final int SIZING_WIZARD_HEIGHT = 500;
+
+ private IWorkbenchWindow window;
+
+ /**
+ * Create an instance of this class.
+ *
+ * @param window the workbench window in which this action will appear
+ * @param wizardDesc a wizard element
+ */
+ public NewWizardShortcutAction(IWorkbenchWindow window, IWizardDescriptor wizardDesc) {
+ super(wizardDesc.getLabel());
+ setToolTipText(wizardDesc.getDescription());
+ setImageDescriptor(wizardDesc.getImageDescriptor());
+ setId(ActionFactory.NEW.getId());
+ wizardElement = wizardDesc;
+ this.window = window;
+ }
+
+ /**
+ * Get the wizard descriptor for this action.
+ *
+ * @return the wizard descriptor
+ */
+ public IWizardDescriptor getWizardDescriptor() {
return wizardElement;
}
- @Override
+ @Override
public void run() {
- // create instance of target wizard
-
- INewWizard wizard;
- try {
- wizard = (INewWizard) wizardElement.createWizard();
- } catch (CoreException e) {
- ErrorDialog.openError(window.getShell(), WorkbenchMessages.NewWizardShortcutAction_errorTitle,
- WorkbenchMessages.NewWizardShortcutAction_errorMessage,
- e.getStatus());
- return;
- }
-
- ISelection selection = window.getSelectionService().getSelection();
- IStructuredSelection selectionToPass = StructuredSelection.EMPTY;
- if (selection instanceof IStructuredSelection) {
- selectionToPass = wizardElement
- .adaptedSelection((IStructuredSelection) selection);
- } else {
- // Build the selection from the IFile of the editor
- IWorkbenchPart part = window.getPartService().getActivePart();
- if (part instanceof IEditorPart) {
- IEditorInput input = ((IEditorPart) part).getEditorInput();
- Class fileClass = LegacyResourceSupport.getFileClass();
- if (input != null && fileClass != null) {
+ // create instance of target wizard
+
+ INewWizard wizard;
+ try {
+ wizard = (INewWizard) wizardElement.createWizard();
+ } catch (CoreException e) {
+ ErrorDialog.openError(window.getShell(), WorkbenchMessages.NewWizardShortcutAction_errorTitle,
+ WorkbenchMessages.NewWizardShortcutAction_errorMessage, e.getStatus());
+ return;
+ }
+
+ ISelection selection = window.getSelectionService().getSelection();
+ IStructuredSelection selectionToPass = StructuredSelection.EMPTY;
+ if (selection instanceof IStructuredSelection) {
+ selectionToPass = wizardElement.adaptedSelection((IStructuredSelection) selection);
+ } else {
+ // Build the selection from the IFile of the editor
+ IWorkbenchPart part = window.getPartService().getActivePart();
+ if (part instanceof IEditorPart) {
+ IEditorInput input = ((IEditorPart) part).getEditorInput();
+ Class fileClass = LegacyResourceSupport.getFileClass();
+ if (input != null && fileClass != null) {
Object file = Adapters.adapt(input, fileClass);
- if (file != null) {
- selectionToPass = new StructuredSelection(file);
- }
- }
- }
- }
-
- // even tho we MAY finish early without showing a dialog, prep the
+ if (file != null) {
+ selectionToPass = new StructuredSelection(file);
+ }
+ }
+ }
+ }
+
+ // even tho we MAY finish early without showing a dialog, prep the
// wizard with a dialog and such in case it's logic requires it
// - yes, it wastes a dialog but they are plentiful...
wizard.init(window.getWorkbench(), selectionToPass);
- Shell parent = window.getShell();
- WizardDialog dialog = new WizardDialog(parent, wizard);
- dialog.create();
- Point defaultSize = dialog.getShell().getSize();
- dialog.getShell().setSize(
- Math.max(SIZING_WIZARD_WIDTH, defaultSize.x),
- Math.max(SIZING_WIZARD_HEIGHT, defaultSize.y));
- window.getWorkbench().getHelpSystem().setHelp(dialog.getShell(),
- IWorkbenchHelpContextIds.NEW_WIZARD_SHORTCUT);
-
- // if the wizard can finish early and doesn't have any pages, just finish it.
- if (wizardElement.canFinishEarly() && !wizardElement.hasPages()) {
+ Shell parent = window.getShell();
+ WizardDialog dialog = new WizardDialog(parent, wizard);
+ dialog.create();
+ Point defaultSize = dialog.getShell().getSize();
+ dialog.getShell().setSize(Math.max(SIZING_WIZARD_WIDTH, defaultSize.x),
+ Math.max(SIZING_WIZARD_HEIGHT, defaultSize.y));
+ window.getWorkbench().getHelpSystem().setHelp(dialog.getShell(), IWorkbenchHelpContextIds.NEW_WIZARD_SHORTCUT);
+
+ // if the wizard can finish early and doesn't have any pages, just finish it.
+ if (wizardElement.canFinishEarly() && !wizardElement.hasPages()) {
wizard.performFinish();
dialog.close();
} else {
dialog.open();
}
- }
+ }
- @Override
+ @Override
public String getLocalId() {
- IPluginContribution contribution = getPluginContribution();
- if (contribution != null) {
+ IPluginContribution contribution = getPluginContribution();
+ if (contribution != null) {
return contribution.getLocalId();
}
- return wizardElement.getId();
- }
+ return wizardElement.getId();
+ }
- @Override
+ @Override
public String getPluginId() {
- IPluginContribution contribution = getPluginContribution();
- if (contribution != null) {
+ IPluginContribution contribution = getPluginContribution();
+ if (contribution != null) {
return contribution.getPluginId();
}
- return null;
- }
-
- /**
- * Return the plugin contribution associated with the wizard.
- *
- * @return the contribution or <code>null</code>
- * @since 3.1
- */
- private IPluginContribution getPluginContribution() {
+ return null;
+ }
+
+ /**
+ * Return the plugin contribution associated with the wizard.
+ *
+ * @return the contribution or <code>null</code>
+ * @since 3.1
+ */
+ private IPluginContribution getPluginContribution() {
return Adapters.adapt(wizardElement, IPluginContribution.class);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/SelectWorkingSetAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/SelectWorkingSetAction.java
index b0874b64154..4896a3bba18 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/SelectWorkingSetAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/SelectWorkingSetAction.java
@@ -27,61 +27,57 @@ import org.eclipse.ui.internal.IWorkbenchHelpContextIds;
import org.eclipse.ui.internal.WorkbenchMessages;
/**
- * Displays an IWorkingSetSelectionDialog and sets the selected
- * working set in the action group.
+ * Displays an IWorkingSetSelectionDialog and sets the selected working set in
+ * the action group.
*
* @since 2.1
*/
public class SelectWorkingSetAction extends Action {
- private Shell shell;
+ private Shell shell;
- private WorkingSetFilterActionGroup actionGroup;
+ private WorkingSetFilterActionGroup actionGroup;
- /**
- * Creates a new instance of the receiver.
- *
- * @param actionGroup the action group this action is created in
- * @param shell shell to use for opening working set selection dialog.
- */
- public SelectWorkingSetAction(WorkingSetFilterActionGroup actionGroup,
- Shell shell) {
- super(WorkbenchMessages.SelectWorkingSetAction_text);
- Assert.isNotNull(actionGroup);
- setToolTipText(WorkbenchMessages.SelectWorkingSetAction_toolTip);
+ /**
+ * Creates a new instance of the receiver.
+ *
+ * @param actionGroup the action group this action is created in
+ * @param shell shell to use for opening working set selection dialog.
+ */
+ public SelectWorkingSetAction(WorkingSetFilterActionGroup actionGroup, Shell shell) {
+ super(WorkbenchMessages.SelectWorkingSetAction_text);
+ Assert.isNotNull(actionGroup);
+ setToolTipText(WorkbenchMessages.SelectWorkingSetAction_toolTip);
- this.shell = shell;
- this.actionGroup = actionGroup;
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
- IWorkbenchHelpContextIds.SELECT_WORKING_SET_ACTION);
- }
+ this.shell = shell;
+ this.actionGroup = actionGroup;
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.SELECT_WORKING_SET_ACTION);
+ }
- /**
- * Overrides method from Action
- *
- * @see Action#run()
- */
- @Override
+ /**
+ * Overrides method from Action
+ *
+ * @see Action#run()
+ */
+ @Override
public void run() {
- IWorkingSetManager manager = PlatformUI.getWorkbench()
- .getWorkingSetManager();
- IWorkingSetSelectionDialog dialog = manager
- .createWorkingSetSelectionDialog(shell, false);
- IWorkingSet workingSet = actionGroup.getWorkingSet();
+ IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager();
+ IWorkingSetSelectionDialog dialog = manager.createWorkingSetSelectionDialog(shell, false);
+ IWorkingSet workingSet = actionGroup.getWorkingSet();
- if (workingSet != null) {
+ if (workingSet != null) {
dialog.setSelection(new IWorkingSet[] { workingSet });
}
- if (dialog.open() == Window.OK) {
- IWorkingSet[] result = dialog.getSelection();
- if (result != null && result.length > 0) {
- actionGroup.setWorkingSet(result[0]);
- manager.addRecentWorkingSet(result[0]);
- } else {
- actionGroup.setWorkingSet(null);
- }
- } else {
+ if (dialog.open() == Window.OK) {
+ IWorkingSet[] result = dialog.getSelection();
+ if (result != null && result.length > 0) {
+ actionGroup.setWorkingSet(result[0]);
+ manager.addRecentWorkingSet(result[0]);
+ } else {
+ actionGroup.setWorkingSet(null);
+ }
+ } else {
actionGroup.setWorkingSet(workingSet);
}
- }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/SelectWorkingSetsAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/SelectWorkingSetsAction.java
index f78ba506d4a..5761d9fb1ba 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/SelectWorkingSetsAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/actions/SelectWorkingSetsAction.java
@@ -36,7 +36,7 @@ import org.eclipse.ui.internal.dialogs.SimpleWorkingSetSelectionDialog;
*
* @since 3.2
*/
-public class SelectWorkingSetsAction extends AbstractWorkingSetPulldownDelegate {
+public class SelectWorkingSetsAction extends AbstractWorkingSetPulldownDelegate {
private class ManageWorkingSetsAction extends Action {
@@ -63,15 +63,14 @@ public class SelectWorkingSetsAction extends AbstractWorkingSetPulldownDelegate
@Override
public void runWithEvent(Event event) {
- Set newList = new HashSet(Arrays.asList(getWindow().getActivePage()
- .getWorkingSets()));
+ Set newList = new HashSet(Arrays.asList(getWindow().getActivePage().getWorkingSets()));
if (isChecked()) {
// if the primary modifier key is down then clear the list
// first. this makes the selection exclusive rather than
// additive.
- boolean modified = (event.stateMask & KeyLookupFactory
- .getDefault().formalModifierLookup(IKeyLookup.M1_NAME)) != 0;
+ boolean modified = (event.stateMask
+ & KeyLookupFactory.getDefault().formalModifierLookup(IKeyLookup.M1_NAME)) != 0;
if (modified)
newList.clear();
@@ -80,9 +79,8 @@ public class SelectWorkingSetsAction extends AbstractWorkingSetPulldownDelegate
newList.remove(set);
}
- getWindow().getActivePage().setWorkingSets(
- (IWorkingSet[]) newList.toArray(new IWorkingSet[newList
- .size()]));
+ getWindow().getActivePage()
+ .setWorkingSets((IWorkingSet[]) newList.toArray(new IWorkingSet[newList.size()]));
}
}
@@ -94,8 +92,7 @@ public class SelectWorkingSetsAction extends AbstractWorkingSetPulldownDelegate
for (IWorkingSet set : sets) {
// only add visible sets
// if (set.isVisible()) {
- ActionContributionItem item = new ActionContributionItem(
- new ToggleWorkingSetAction(set));
+ ActionContributionItem item = new ActionContributionItem(new ToggleWorkingSetAction(set));
item.fill(menu, -1);
// }
}
@@ -103,8 +100,7 @@ public class SelectWorkingSetsAction extends AbstractWorkingSetPulldownDelegate
separator.fill(menu, -1);
}
- ActionContributionItem item = new ActionContributionItem(
- new ManageWorkingSetsAction());
+ ActionContributionItem item = new ActionContributionItem(new ManageWorkingSetsAction());
item.fill(menu, -1);
}
@@ -125,8 +121,7 @@ public class SelectWorkingSetsAction extends AbstractWorkingSetPulldownDelegate
@Override
public void run(IAction action) {
- ConfigureWindowWorkingSetsDialog dialog = new ConfigureWindowWorkingSetsDialog(
- getWindow());
+ ConfigureWindowWorkingSetsDialog dialog = new ConfigureWindowWorkingSetsDialog(getWindow());
if (dialog.open() == Window.OK) {
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/AbstractActivityManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/AbstractActivityManager.java
index 5941fd890fc..6ac7f011aec 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/AbstractActivityManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/AbstractActivityManager.java
@@ -22,26 +22,24 @@ import org.eclipse.ui.activities.IActivityManagerListener;
public abstract class AbstractActivityManager implements IActivityManager {
private ListenerList<IActivityManagerListener> activityManagerListeners;
- protected AbstractActivityManager() {
- }
+ protected AbstractActivityManager() {
+ }
- @Override
- public void addActivityManagerListener(
- IActivityManagerListener activityManagerListener) {
- if (activityManagerListener == null) {
+ @Override
+ public void addActivityManagerListener(IActivityManagerListener activityManagerListener) {
+ if (activityManagerListener == null) {
throw new NullPointerException();
}
- if (activityManagerListeners == null) {
+ if (activityManagerListeners == null) {
activityManagerListeners = new ListenerList<>();
}
activityManagerListeners.add(activityManagerListener);
- }
+ }
- protected void fireActivityManagerChanged(
- ActivityManagerEvent activityManagerEvent) {
- if (activityManagerEvent == null) {
+ protected void fireActivityManagerChanged(ActivityManagerEvent activityManagerEvent) {
+ if (activityManagerEvent == null) {
throw new NullPointerException();
}
@@ -50,17 +48,16 @@ public abstract class AbstractActivityManager implements IActivityManager {
listener.activityManagerChanged(activityManagerEvent);
}
}
- }
+ }
- @Override
- public void removeActivityManagerListener(
- IActivityManagerListener activityManagerListener) {
- if (activityManagerListener == null) {
+ @Override
+ public void removeActivityManagerListener(IActivityManagerListener activityManagerListener) {
+ if (activityManagerListener == null) {
throw new NullPointerException();
}
- if (activityManagerListeners != null) {
+ if (activityManagerListeners != null) {
activityManagerListeners.remove(activityManagerListener);
}
- }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/AbstractActivityRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/AbstractActivityRegistry.java
index 4ecc3d67a2f..5742e1553f2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/AbstractActivityRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/AbstractActivityRegistry.java
@@ -26,7 +26,7 @@ public abstract class AbstractActivityRegistry implements IActivityRegistry {
protected List<ActivityPatternBindingDefinition> activityPatternBindingDefinitions = Collections.emptyList();
- private ActivityRegistryEvent activityRegistryEvent;
+ private ActivityRegistryEvent activityRegistryEvent;
private List<IActivityRegistryListener> activityRegistryListeners;
@@ -36,77 +36,74 @@ public abstract class AbstractActivityRegistry implements IActivityRegistry {
protected List<String> defaultEnabledActivities = Collections.emptyList();
- protected AbstractActivityRegistry() {
- }
+ protected AbstractActivityRegistry() {
+ }
- @Override
- public void addActivityRegistryListener(
- IActivityRegistryListener activityRegistryListener) {
- if (activityRegistryListener == null) {
+ @Override
+ public void addActivityRegistryListener(IActivityRegistryListener activityRegistryListener) {
+ if (activityRegistryListener == null) {
throw new NullPointerException();
}
- if (activityRegistryListeners == null) {
+ if (activityRegistryListeners == null) {
activityRegistryListeners = new ArrayList<>();
}
- if (!activityRegistryListeners.contains(activityRegistryListener)) {
+ if (!activityRegistryListeners.contains(activityRegistryListener)) {
activityRegistryListeners.add(activityRegistryListener);
}
- }
+ }
- protected void fireActivityRegistryChanged() {
- if (activityRegistryListeners != null) {
- for (int i = 0; i < activityRegistryListeners.size(); i++) {
- if (activityRegistryEvent == null) {
+ protected void fireActivityRegistryChanged() {
+ if (activityRegistryListeners != null) {
+ for (int i = 0; i < activityRegistryListeners.size(); i++) {
+ if (activityRegistryEvent == null) {
activityRegistryEvent = new ActivityRegistryEvent(this);
}
- activityRegistryListeners.get(i)
- .activityRegistryChanged(activityRegistryEvent);
- }
- }
- }
+ activityRegistryListeners.get(i).activityRegistryChanged(activityRegistryEvent);
+ }
+ }
+ }
- @Override
+ @Override
public List<ActivityRequirementBindingDefinition> getActivityRequirementBindingDefinitions() {
- return activityRequirementBindingDefinitions;
- }
+ return activityRequirementBindingDefinitions;
+ }
- @Override
+ @Override
public List<ActivityDefinition> getActivityDefinitions() {
- return activityDefinitions;
- }
+ return activityDefinitions;
+ }
- @Override
+ @Override
public List<ActivityPatternBindingDefinition> getActivityPatternBindingDefinitions() {
- return activityPatternBindingDefinitions;
- }
+ return activityPatternBindingDefinitions;
+ }
- @Override
+ @Override
public List<CategoryActivityBindingDefinition> getCategoryActivityBindingDefinitions() {
- return categoryActivityBindingDefinitions;
- }
+ return categoryActivityBindingDefinitions;
+ }
- @Override
+ @Override
public List<CategoryDefinition> getCategoryDefinitions() {
- return categoryDefinitions;
- }
+ return categoryDefinitions;
+ }
- @Override
- public void removeActivityRegistryListener(
- IActivityRegistryListener activityRegistryListener) {
- if (activityRegistryListener == null) {
+ @Override
+ public void removeActivityRegistryListener(IActivityRegistryListener activityRegistryListener) {
+ if (activityRegistryListener == null) {
throw new NullPointerException();
}
- if (activityRegistryListeners != null) {
+ if (activityRegistryListeners != null) {
activityRegistryListeners.remove(activityRegistryListener);
}
- }
+ }
- @Override
+ @Override
public List<String> getDefaultEnabledActivities() {
- return defaultEnabledActivities;
- }
+ return defaultEnabledActivities;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/Activity.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/Activity.java
index 3abca9cd5e3..bb1406e8b63 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/Activity.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/Activity.java
@@ -29,203 +29,195 @@ import org.eclipse.ui.activities.NotDefinedException;
import org.eclipse.ui.internal.util.Util;
final class Activity implements IActivity {
- private static final int HASH_FACTOR = 89;
+ private static final int HASH_FACTOR = 89;
- private static final int HASH_INITIAL = Activity.class.getName().hashCode();
+ private static final int HASH_INITIAL = Activity.class.getName().hashCode();
private static final Set<Activity> strongReferences = new HashSet<>();
private Set<IActivityRequirementBinding> activityRequirementBindings;
- private transient IActivityRequirementBinding[] activityRequirementBindingsAsArray;
+ private transient IActivityRequirementBinding[] activityRequirementBindingsAsArray;
private List<IActivityListener> activityListeners;
private Set<IActivityPatternBinding> activityPatternBindings;
- private transient IActivityPatternBinding[] activityPatternBindingsAsArray;
+ private transient IActivityPatternBinding[] activityPatternBindingsAsArray;
- private boolean defined;
+ private boolean defined;
- private boolean enabled;
+ private boolean enabled;
- private transient int hashCode = HASH_INITIAL;
+ private transient int hashCode = HASH_INITIAL;
- private String id;
+ private String id;
- private String name;
+ private String name;
- private transient String string;
+ private transient String string;
- private String description;
+ private String description;
- private boolean defaultEnabled;
+ private boolean defaultEnabled;
private Expression expression;
- Activity(String id) {
- if (id == null) {
+ Activity(String id) {
+ if (id == null) {
throw new NullPointerException();
}
- this.id = id;
- }
+ this.id = id;
+ }
- @Override
+ @Override
public void addActivityListener(IActivityListener activityListener) {
- if (activityListener == null) {
+ if (activityListener == null) {
throw new NullPointerException();
}
- if (activityListeners == null) {
+ if (activityListeners == null) {
activityListeners = new ArrayList<>();
}
- if (!activityListeners.contains(activityListener)) {
+ if (!activityListeners.contains(activityListener)) {
activityListeners.add(activityListener);
}
- strongReferences.add(this);
- }
+ strongReferences.add(this);
+ }
- @Override
+ @Override
public int compareTo(IActivity object) {
- Activity castedObject = (Activity) object;
+ Activity castedObject = (Activity) object;
- int compareTo = Util.compare(
- activityRequirementBindingsAsArray,
- castedObject.activityRequirementBindingsAsArray);
+ int compareTo = Util.compare(activityRequirementBindingsAsArray,
+ castedObject.activityRequirementBindingsAsArray);
- if (compareTo == 0) {
- compareTo = Util.compare(
- activityPatternBindingsAsArray,
- castedObject.activityPatternBindingsAsArray);
+ if (compareTo == 0) {
+ compareTo = Util.compare(activityPatternBindingsAsArray, castedObject.activityPatternBindingsAsArray);
- if (compareTo == 0) {
- compareTo = Util.compare(defined, castedObject.defined);
+ if (compareTo == 0) {
+ compareTo = Util.compare(defined, castedObject.defined);
- if (compareTo == 0) {
- compareTo = Util.compare(enabled, castedObject.enabled);
+ if (compareTo == 0) {
+ compareTo = Util.compare(enabled, castedObject.enabled);
- if (compareTo == 0) {
- compareTo = Util.compare(id, castedObject.id);
+ if (compareTo == 0) {
+ compareTo = Util.compare(id, castedObject.id);
- if (compareTo == 0) {
+ if (compareTo == 0) {
compareTo = Util.compare(name, castedObject.name);
}
- }
- }
- }
- }
+ }
+ }
+ }
+ }
- return compareTo;
- }
+ return compareTo;
+ }
- @Override
+ @Override
public boolean equals(Object object) {
- if (!(object instanceof Activity)) {
+ if (!(object instanceof Activity)) {
return false;
}
- final Activity castedObject = (Activity) object;
+ final Activity castedObject = (Activity) object;
- if (!Util.equals(activityRequirementBindings,
- castedObject.activityRequirementBindings)) {
- return false;
- }
+ if (!Util.equals(activityRequirementBindings, castedObject.activityRequirementBindings)) {
+ return false;
+ }
- if (!Util.equals(activityPatternBindings,
- castedObject.activityPatternBindings)) {
- return false;
- }
+ if (!Util.equals(activityPatternBindings, castedObject.activityPatternBindings)) {
+ return false;
+ }
- if (!Util.equals(defined, castedObject.defined)) {
- return false;
- }
+ if (!Util.equals(defined, castedObject.defined)) {
+ return false;
+ }
- if (!Util.equals(enabled, castedObject.enabled)) {
- return false;
- }
+ if (!Util.equals(enabled, castedObject.enabled)) {
+ return false;
+ }
- if (!Util.equals(id, castedObject.id)) {
- return false;
- }
+ if (!Util.equals(id, castedObject.id)) {
+ return false;
+ }
- return Util.equals(name, castedObject.name);
- }
+ return Util.equals(name, castedObject.name);
+ }
- void fireActivityChanged(ActivityEvent activityEvent) {
- if (activityEvent == null) {
+ void fireActivityChanged(ActivityEvent activityEvent) {
+ if (activityEvent == null) {
throw new NullPointerException();
}
- if (activityListeners != null) {
+ if (activityListeners != null) {
for (int i = 0; i < activityListeners.size(); i++) {
- activityListeners.get(i)
- .activityChanged(activityEvent);
+ activityListeners.get(i).activityChanged(activityEvent);
}
}
- }
+ }
- @Override
+ @Override
public Set<IActivityRequirementBinding> getActivityRequirementBindings() {
- return activityRequirementBindings;
- }
+ return activityRequirementBindings;
+ }
- @Override
+ @Override
public Set<IActivityPatternBinding> getActivityPatternBindings() {
- return activityPatternBindings;
- }
+ return activityPatternBindings;
+ }
- @Override
+ @Override
public String getId() {
- return id;
- }
+ return id;
+ }
- @Override
+ @Override
public String getName() throws NotDefinedException {
- if (!defined) {
+ if (!defined) {
throw new NotDefinedException();
}
- return name;
- }
+ return name;
+ }
- @Override
+ @Override
public Expression getExpression() {
- return expression;
- }
+ return expression;
+ }
- @Override
+ @Override
public int hashCode() {
- if (hashCode == HASH_INITIAL) {
- hashCode = hashCode * HASH_FACTOR
- + Util.hashCode(activityRequirementBindings);
- hashCode = hashCode * HASH_FACTOR
- + Util.hashCode(activityPatternBindings);
- hashCode = hashCode * HASH_FACTOR + Util.hashCode(defined);
- hashCode = hashCode * HASH_FACTOR + Util.hashCode(enabled);
- hashCode = hashCode * HASH_FACTOR + Util.hashCode(id);
- hashCode = hashCode * HASH_FACTOR + Util.hashCode(name);
- if (hashCode == HASH_INITIAL) {
+ if (hashCode == HASH_INITIAL) {
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(activityRequirementBindings);
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(activityPatternBindings);
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(defined);
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(enabled);
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(id);
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(name);
+ if (hashCode == HASH_INITIAL) {
hashCode++;
}
- }
+ }
- return hashCode;
- }
+ return hashCode;
+ }
- @Override
+ @Override
public boolean isDefined() {
- return defined;
- }
+ return defined;
+ }
- @Override
+ @Override
public boolean isEnabled() {
- return enabled;
- }
+ return enabled;
+ }
- public boolean isMatch(String string) {
+ public boolean isMatch(String string) {
if (isDefined()) {
for (Iterator<IActivityPatternBinding> iterator = activityPatternBindings.iterator(); iterator.hasNext();) {
ActivityPatternBinding activityPatternBinding = (ActivityPatternBinding) iterator.next();
@@ -236,41 +228,38 @@ final class Activity implements IActivity {
}
}
- return false;
- }
+ return false;
+ }
- @Override
+ @Override
public void removeActivityListener(IActivityListener activityListener) {
- if (activityListener == null) {
+ if (activityListener == null) {
throw new NullPointerException();
}
- if (activityListeners != null) {
+ if (activityListeners != null) {
activityListeners.remove(activityListener);
}
- if (activityListeners.isEmpty()) {
+ if (activityListeners.isEmpty()) {
strongReferences.remove(this);
}
- }
+ }
boolean setActivityRequirementBindings(Set<IActivityRequirementBinding> activityRequirementBindings) {
- activityRequirementBindings = Util.safeCopy(
- activityRequirementBindings, IActivityRequirementBinding.class);
-
- if (!Util.equals(activityRequirementBindings,
- this.activityRequirementBindings)) {
- this.activityRequirementBindings = activityRequirementBindings;
- this.activityRequirementBindingsAsArray = this.activityRequirementBindings
- .toArray(new IActivityRequirementBinding[this.activityRequirementBindings
- .size()]);
- hashCode = HASH_INITIAL;
- string = null;
- return true;
- }
-
- return false;
- }
+ activityRequirementBindings = Util.safeCopy(activityRequirementBindings, IActivityRequirementBinding.class);
+
+ if (!Util.equals(activityRequirementBindings, this.activityRequirementBindings)) {
+ this.activityRequirementBindings = activityRequirementBindings;
+ this.activityRequirementBindingsAsArray = this.activityRequirementBindings
+ .toArray(new IActivityRequirementBinding[this.activityRequirementBindings.size()]);
+ hashCode = HASH_INITIAL;
+ string = null;
+ return true;
+ }
+
+ return false;
+ }
boolean setActivityPatternBindings(Set<IActivityPatternBinding> activityPatternBindings) {
activityPatternBindings = Util.safeCopy(activityPatternBindings, IActivityPatternBinding.class);
@@ -287,99 +276,99 @@ final class Activity implements IActivity {
return false;
}
- boolean setDefined(boolean defined) {
- if (defined != this.defined) {
- this.defined = defined;
- hashCode = HASH_INITIAL;
- string = null;
- return true;
- }
-
- return false;
- }
-
- boolean setEnabled(boolean enabled) {
- if (enabled != this.enabled) {
- this.enabled = enabled;
- hashCode = HASH_INITIAL;
- string = null;
- return true;
- }
-
- return false;
- }
-
- boolean setName(String name) {
- if (!Util.equals(name, this.name)) {
- this.name = name;
- hashCode = HASH_INITIAL;
- string = null;
- return true;
- }
-
- return false;
- }
-
- void setExpression(Expression exp) {
- expression = exp;
- }
-
- boolean setDescription(String description) {
- if (!Util.equals(description, this.description)) {
- this.description = description;
- hashCode = HASH_INITIAL;
- string = null;
- return true;
- }
-
- return false;
- }
-
- @Override
+ boolean setDefined(boolean defined) {
+ if (defined != this.defined) {
+ this.defined = defined;
+ hashCode = HASH_INITIAL;
+ string = null;
+ return true;
+ }
+
+ return false;
+ }
+
+ boolean setEnabled(boolean enabled) {
+ if (enabled != this.enabled) {
+ this.enabled = enabled;
+ hashCode = HASH_INITIAL;
+ string = null;
+ return true;
+ }
+
+ return false;
+ }
+
+ boolean setName(String name) {
+ if (!Util.equals(name, this.name)) {
+ this.name = name;
+ hashCode = HASH_INITIAL;
+ string = null;
+ return true;
+ }
+
+ return false;
+ }
+
+ void setExpression(Expression exp) {
+ expression = exp;
+ }
+
+ boolean setDescription(String description) {
+ if (!Util.equals(description, this.description)) {
+ this.description = description;
+ hashCode = HASH_INITIAL;
+ string = null;
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
public String toString() {
- if (string == null) {
- final StringBuilder stringBuffer = new StringBuilder();
- stringBuffer.append('[');
- stringBuffer.append(activityRequirementBindings);
- stringBuffer.append(',');
- stringBuffer.append(activityPatternBindings);
- stringBuffer.append(',');
- stringBuffer.append(defined);
- stringBuffer.append(',');
- stringBuffer.append(enabled);
- stringBuffer.append(',');
- stringBuffer.append(id);
- stringBuffer.append(',');
- stringBuffer.append(name);
- stringBuffer.append(']');
- string = stringBuffer.toString();
- }
-
- return string;
- }
-
- @Override
+ if (string == null) {
+ final StringBuilder stringBuffer = new StringBuilder();
+ stringBuffer.append('[');
+ stringBuffer.append(activityRequirementBindings);
+ stringBuffer.append(',');
+ stringBuffer.append(activityPatternBindings);
+ stringBuffer.append(',');
+ stringBuffer.append(defined);
+ stringBuffer.append(',');
+ stringBuffer.append(enabled);
+ stringBuffer.append(',');
+ stringBuffer.append(id);
+ stringBuffer.append(',');
+ stringBuffer.append(name);
+ stringBuffer.append(']');
+ string = stringBuffer.toString();
+ }
+
+ return string;
+ }
+
+ @Override
public String getDescription() throws NotDefinedException {
- if (!defined) {
+ if (!defined) {
throw new NotDefinedException();
}
- return description;
- }
+ return description;
+ }
- @Override
+ @Override
public boolean isDefaultEnabled() {
- return defaultEnabled;
- }
-
- boolean setDefaultEnabled(boolean defaultEnabled) {
- if (!Util.equals(defaultEnabled, this.defaultEnabled)) {
- this.defaultEnabled = defaultEnabled;
- hashCode = HASH_INITIAL;
- string = null;
- return true;
- }
-
- return false;
- }
+ return defaultEnabled;
+ }
+
+ boolean setDefaultEnabled(boolean defaultEnabled) {
+ if (!Util.equals(defaultEnabled, this.defaultEnabled)) {
+ this.defaultEnabled = defaultEnabled;
+ hashCode = HASH_INITIAL;
+ string = null;
+ return true;
+ }
+
+ return false;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityDefinition.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityDefinition.java
index aa88b8661f7..9065a53435e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityDefinition.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityDefinition.java
@@ -23,168 +23,165 @@ import org.eclipse.core.expressions.Expression;
import org.eclipse.ui.internal.util.Util;
public final class ActivityDefinition implements Comparable<ActivityDefinition> {
- private static final int HASH_FACTOR = 89;
+ private static final int HASH_FACTOR = 89;
- private static final int HASH_INITIAL = ActivityDefinition.class.getName()
- .hashCode();
+ private static final int HASH_INITIAL = ActivityDefinition.class.getName().hashCode();
static Map<String, ActivityDefinition> activityDefinitionsById(Collection<ActivityDefinition> activityDefinitions,
- boolean allowNullIds) {
- if (activityDefinitions == null) {
+ boolean allowNullIds) {
+ if (activityDefinitions == null) {
throw new NullPointerException();
}
Map<String, ActivityDefinition> map = new HashMap<>();
Iterator<ActivityDefinition> iterator = activityDefinitions.iterator();
- while (iterator.hasNext()) {
+ while (iterator.hasNext()) {
ActivityDefinition activityDefinition = iterator.next();
- String id = activityDefinition.getId();
+ String id = activityDefinition.getId();
- if (allowNullIds || id != null) {
+ if (allowNullIds || id != null) {
map.put(id, activityDefinition);
}
- }
+ }
- return map;
- }
+ return map;
+ }
static Map<String, Collection<ActivityDefinition>> activityDefinitionsByName(
- Collection<ActivityDefinition> activityDefinitions,
- boolean allowNullNames) {
- if (activityDefinitions == null) {
+ Collection<ActivityDefinition> activityDefinitions, boolean allowNullNames) {
+ if (activityDefinitions == null) {
throw new NullPointerException();
}
Map<String, Collection<ActivityDefinition>> map = new HashMap<>();
Iterator<ActivityDefinition> iterator = activityDefinitions.iterator();
- while (iterator.hasNext()) {
+ while (iterator.hasNext()) {
ActivityDefinition activityDefinition = iterator.next();
- String name = activityDefinition.getName();
+ String name = activityDefinition.getName();
- if (allowNullNames || name != null) {
+ if (allowNullNames || name != null) {
Collection<ActivityDefinition> activityDefinitions2 = map.get(name);
- if (activityDefinitions2 == null) {
+ if (activityDefinitions2 == null) {
activityDefinitions2 = new HashSet<>();
- map.put(name, activityDefinitions2);
- }
+ map.put(name, activityDefinitions2);
+ }
- activityDefinitions2.add(activityDefinition);
- }
- }
+ activityDefinitions2.add(activityDefinition);
+ }
+ }
- return map;
- }
+ return map;
+ }
- private transient int hashCode = HASH_INITIAL;
+ private transient int hashCode = HASH_INITIAL;
- private String id;
+ private String id;
- private String name;
+ private String name;
- private String sourceId;
+ private String sourceId;
- private String description;
+ private String description;
- private transient String string;
+ private transient String string;
private Expression enabledWhen;
- public ActivityDefinition(String id, String name, String sourceId,
- String description) {
- this.id = id;
- this.name = name;
- this.sourceId = sourceId;
- this.description = description;
- }
+ public ActivityDefinition(String id, String name, String sourceId, String description) {
+ this.id = id;
+ this.name = name;
+ this.sourceId = sourceId;
+ this.description = description;
+ }
- @Override
+ @Override
public int compareTo(ActivityDefinition object) {
int compareTo = Util.compare(id, object.id);
- if (compareTo == 0) {
+ if (compareTo == 0) {
compareTo = Util.compare(name, object.name);
- if (compareTo == 0) {
+ if (compareTo == 0) {
compareTo = Util.compare(sourceId, object.sourceId);
}
- }
+ }
- return compareTo;
- }
+ return compareTo;
+ }
- @Override
+ @Override
public boolean equals(Object object) {
- if (!(object instanceof ActivityDefinition)) {
+ if (!(object instanceof ActivityDefinition)) {
return false;
}
- final ActivityDefinition castedObject = (ActivityDefinition) object;
- if (!Util.equals(id, castedObject.id)) {
- return false;
- }
+ final ActivityDefinition castedObject = (ActivityDefinition) object;
+ if (!Util.equals(id, castedObject.id)) {
+ return false;
+ }
- if (!Util.equals(name, castedObject.name)) {
- return false;
- }
+ if (!Util.equals(name, castedObject.name)) {
+ return false;
+ }
- return Util.equals(sourceId, castedObject.sourceId);
- }
+ return Util.equals(sourceId, castedObject.sourceId);
+ }
- public String getId() {
- return id;
- }
+ public String getId() {
+ return id;
+ }
- public String getName() {
- return name;
- }
+ public String getName() {
+ return name;
+ }
- public String getSourceId() {
- return sourceId;
- }
+ public String getSourceId() {
+ return sourceId;
+ }
- @Override
+ @Override
public int hashCode() {
- if (hashCode == HASH_INITIAL) {
- hashCode = hashCode * HASH_FACTOR + Util.hashCode(id);
- hashCode = hashCode * HASH_FACTOR + Util.hashCode(name);
- hashCode = hashCode * HASH_FACTOR + Util.hashCode(sourceId);
- if (hashCode == HASH_INITIAL) {
+ if (hashCode == HASH_INITIAL) {
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(id);
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(name);
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(sourceId);
+ if (hashCode == HASH_INITIAL) {
hashCode++;
}
- }
+ }
- return hashCode;
- }
+ return hashCode;
+ }
- @Override
+ @Override
public String toString() {
- if (string == null) {
- final StringBuilder stringBuffer = new StringBuilder();
- stringBuffer.append('[');
- stringBuffer.append(id);
- stringBuffer.append(',');
- stringBuffer.append(name);
- stringBuffer.append(',');
- stringBuffer.append(sourceId);
- stringBuffer.append(']');
- string = stringBuffer.toString();
- }
-
- return string;
- }
-
- public String getDescription() {
- return description;
- }
-
- void setEnabledWhen(Expression expression) {
- enabledWhen = expression;
- }
-
- public Expression getEnabledWhen() {
- return enabledWhen;
- }
+ if (string == null) {
+ final StringBuilder stringBuffer = new StringBuilder();
+ stringBuffer.append('[');
+ stringBuffer.append(id);
+ stringBuffer.append(',');
+ stringBuffer.append(name);
+ stringBuffer.append(',');
+ stringBuffer.append(sourceId);
+ stringBuffer.append(']');
+ string = stringBuffer.toString();
+ }
+
+ return string;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ void setEnabledWhen(Expression expression) {
+ enabledWhen = expression;
+ }
+
+ public Expression getEnabledWhen() {
+ return enabledWhen;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityPatternBinding.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityPatternBinding.java
index 21cfa573ca3..84ffb1aab2a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityPatternBinding.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityPatternBinding.java
@@ -19,165 +19,161 @@ import org.eclipse.ui.activities.IActivityPatternBinding;
import org.eclipse.ui.internal.util.Util;
public final class ActivityPatternBinding implements IActivityPatternBinding {
- private static final int HASH_FACTOR = 89;
+ private static final int HASH_FACTOR = 89;
- private static final int HASH_INITIAL = ActivityPatternBinding.class
- .getName().hashCode();
+ private static final int HASH_INITIAL = ActivityPatternBinding.class.getName().hashCode();
- private String activityId;
+ private String activityId;
- private transient int hashCode = HASH_INITIAL;
+ private transient int hashCode = HASH_INITIAL;
- private Pattern pattern;
+ private Pattern pattern;
- private String patternString;
+ private String patternString;
- private boolean isEqualityPattern;
+ private boolean isEqualityPattern;
- private transient String string;
+ private transient String string;
- /**
- * @param activityId The id.
- * @param pattern A string that will be compiled to a pattern matcher.
- */
- public ActivityPatternBinding(String activityId, String pattern) {
- this(activityId, Pattern.compile(pattern));
- }
+ /**
+ * @param activityId The id.
+ * @param pattern A string that will be compiled to a pattern matcher.
+ */
+ public ActivityPatternBinding(String activityId, String pattern) {
+ this(activityId, Pattern.compile(pattern));
+ }
- /**
- *
- * @param activityId The id
- * @param pattern This string will be used as plain string, or as pattern-
- * matcher pattern. The use depends on parameter <code>nonRegExp</code>.
- * @param isEqualityPattern If true the <code>pattern</code> string will be
- * interpreted as normal string, not as pattern.
- */
- public ActivityPatternBinding(String activityId, String pattern, boolean
- isEqualityPattern) {
- if (pattern == null) {
+ /**
+ *
+ * @param activityId The id
+ * @param pattern This string will be used as plain string, or as
+ * pattern- matcher pattern. The use depends on
+ * parameter <code>nonRegExp</code>.
+ * @param isEqualityPattern If true the <code>pattern</code> string will be
+ * interpreted as normal string, not as pattern.
+ */
+ public ActivityPatternBinding(String activityId, String pattern, boolean isEqualityPattern) {
+ if (pattern == null) {
throw new NullPointerException();
}
- this.activityId = activityId;
- this.isEqualityPattern = isEqualityPattern;
- if (isEqualityPattern) {
- this.patternString = pattern;
- this.pattern = null;
- } else {
- this.patternString = null;
- this.pattern = Pattern.compile(pattern);
- }
- }
-
- public ActivityPatternBinding(String activityId, Pattern pattern) {
- if (pattern == null) {
+ this.activityId = activityId;
+ this.isEqualityPattern = isEqualityPattern;
+ if (isEqualityPattern) {
+ this.patternString = pattern;
+ this.pattern = null;
+ } else {
+ this.patternString = null;
+ this.pattern = Pattern.compile(pattern);
+ }
+ }
+
+ public ActivityPatternBinding(String activityId, Pattern pattern) {
+ if (pattern == null) {
throw new NullPointerException();
}
- this.activityId = activityId;
- this.pattern = pattern;
- this.isEqualityPattern = false;
- this.patternString = null;
- }
+ this.activityId = activityId;
+ this.pattern = pattern;
+ this.isEqualityPattern = false;
+ this.patternString = null;
+ }
- @Override
+ @Override
public int compareTo(IActivityPatternBinding object) {
- ActivityPatternBinding castedObject = (ActivityPatternBinding) object;
- int compareTo = Util.compare(activityId, castedObject.activityId);
+ ActivityPatternBinding castedObject = (ActivityPatternBinding) object;
+ int compareTo = Util.compare(activityId, castedObject.activityId);
- if (compareTo == 0) {
- compareTo = Util.compare(isEqualityPattern,
- castedObject.isEqualityPattern);
+ if (compareTo == 0) {
+ compareTo = Util.compare(isEqualityPattern, castedObject.isEqualityPattern);
- if (compareTo == 0)
- compareTo = Util.compare(getPattern().pattern(), castedObject
- .getPattern().pattern());
+ if (compareTo == 0)
+ compareTo = Util.compare(getPattern().pattern(), castedObject.getPattern().pattern());
}
- return compareTo;
- }
+ return compareTo;
+ }
- @Override
+ @Override
public boolean equals(Object object) {
- if (!(object instanceof ActivityPatternBinding)) {
+ if (!(object instanceof ActivityPatternBinding)) {
return false;
}
- final ActivityPatternBinding castedObject = (ActivityPatternBinding) object;
- if (!Util.equals(activityId, castedObject.activityId)) {
- return false;
- }
+ final ActivityPatternBinding castedObject = (ActivityPatternBinding) object;
+ if (!Util.equals(activityId, castedObject.activityId)) {
+ return false;
+ }
- if (!Util.equals(isEqualityPattern, castedObject.isEqualityPattern)) {
- return false;
- }
+ if (!Util.equals(isEqualityPattern, castedObject.isEqualityPattern)) {
+ return false;
+ }
- return Util.equals(getPattern(), castedObject.getPattern());
- }
+ return Util.equals(getPattern(), castedObject.getPattern());
+ }
- @Override
+ @Override
public String getActivityId() {
- return activityId;
- }
+ return activityId;
+ }
- @Override
+ @Override
public Pattern getPattern() {
- if (pattern == null) {
- pattern = Pattern.compile(PatternUtil.quotePattern(patternString));
- }
- return pattern;
- }
+ if (pattern == null) {
+ pattern = Pattern.compile(PatternUtil.quotePattern(patternString));
+ }
+ return pattern;
+ }
- @Override
+ @Override
public String getString() {
- if (isEqualityPattern) {
- return patternString;
- }
- return getPattern().pattern();
- }
+ if (isEqualityPattern) {
+ return patternString;
+ }
+ return getPattern().pattern();
+ }
@Override
public boolean isEqualityPattern() {
return isEqualityPattern;
}
-
- @Override
+ @Override
public int hashCode() {
- if (hashCode == HASH_INITIAL) {
- hashCode = hashCode * HASH_FACTOR + Util.hashCode(activityId);
- hashCode = hashCode * HASH_FACTOR + Util.hashCode(pattern);
- if (hashCode == HASH_INITIAL) {
+ if (hashCode == HASH_INITIAL) {
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(activityId);
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(pattern);
+ if (hashCode == HASH_INITIAL) {
hashCode++;
}
- }
+ }
- return hashCode;
- }
+ return hashCode;
+ }
- @Override
+ @Override
public String toString() {
- if (string == null) {
- final StringBuilder stringBuffer = new StringBuilder();
- stringBuffer.append('[');
- stringBuffer.append(activityId);
- stringBuffer.append(',');
- stringBuffer.append(isEqualityPattern());
- stringBuffer.append(',');
- stringBuffer.append(getString());
- stringBuffer.append(']');
- string = stringBuffer.toString();
- }
-
- return string;
- }
+ if (string == null) {
+ final StringBuilder stringBuffer = new StringBuilder();
+ stringBuffer.append('[');
+ stringBuffer.append(activityId);
+ stringBuffer.append(',');
+ stringBuffer.append(isEqualityPattern());
+ stringBuffer.append(',');
+ stringBuffer.append(getString());
+ stringBuffer.append(']');
+ string = stringBuffer.toString();
+ }
+
+ return string;
+ }
/**
* Returns whether this binding's pattern matches the given string.
*
* @param toMatch the string to match
* @return <code>true</code> if it matches, <code>false</code> if not
- * @since 3.1
+ * @since 3.1
*/
public boolean isMatch(String toMatch) {
if (isEqualityPattern) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityPatternBindingDefinition.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityPatternBindingDefinition.java
index 25d936bbe0c..14dc81b4152 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityPatternBindingDefinition.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityPatternBindingDefinition.java
@@ -22,14 +22,13 @@ import java.util.Map;
import org.eclipse.ui.internal.util.Util;
public final class ActivityPatternBindingDefinition {
- private static final int HASH_FACTOR = 89;
+ private static final int HASH_FACTOR = 89;
- private static final int HASH_INITIAL = ActivityPatternBindingDefinition.class
- .getName().hashCode();
+ private static final int HASH_INITIAL = ActivityPatternBindingDefinition.class.getName().hashCode();
static Map<String, Collection<ActivityPatternBindingDefinition>> activityPatternBindingDefinitionsByActivityId(
Collection<ActivityPatternBindingDefinition> activityPatternBindingDefinitions) {
- if (activityPatternBindingDefinitions == null) {
+ if (activityPatternBindingDefinitions == null) {
throw new NullPointerException();
}
@@ -52,124 +51,123 @@ public final class ActivityPatternBindingDefinition {
}
}
- return map;
- }
+ return map;
+ }
- private String activityId;
+ private String activityId;
- private transient int hashCode = HASH_INITIAL;
+ private transient int hashCode = HASH_INITIAL;
- private String pattern;
+ private String pattern;
- private String sourceId;
+ private String sourceId;
- private transient String string;
+ private transient String string;
- /**
- * If the string is taken "as is", without interpreting it as a regular
- * expression.
- */
- private boolean isEqualityPattern;
+ /**
+ * If the string is taken "as is", without interpreting it as a regular
+ * expression.
+ */
+ private boolean isEqualityPattern;
- public ActivityPatternBindingDefinition(String activityId, String pattern,
- String sourceId) {
- this(activityId, pattern, sourceId, false);
- }
+ public ActivityPatternBindingDefinition(String activityId, String pattern, String sourceId) {
+ this(activityId, pattern, sourceId, false);
+ }
- public ActivityPatternBindingDefinition(String activityId, String pattern,
- String sourceId, boolean isEqualityPattern) {
+ public ActivityPatternBindingDefinition(String activityId, String pattern, String sourceId,
+ boolean isEqualityPattern) {
this.activityId = activityId;
this.pattern = pattern;
this.sourceId = sourceId;
this.isEqualityPattern = isEqualityPattern;
}
- public int compareTo(Object object) {
- ActivityPatternBindingDefinition castedObject = (ActivityPatternBindingDefinition) object;
- int compareTo = Util.compare(activityId, castedObject.activityId);
+ public int compareTo(Object object) {
+ ActivityPatternBindingDefinition castedObject = (ActivityPatternBindingDefinition) object;
+ int compareTo = Util.compare(activityId, castedObject.activityId);
- if (compareTo == 0) {
- compareTo = Util.compare(pattern, castedObject.pattern);
+ if (compareTo == 0) {
+ compareTo = Util.compare(pattern, castedObject.pattern);
- if (compareTo == 0) {
- compareTo = Util.compare(isEqualityPattern, castedObject.isEqualityPattern);
+ if (compareTo == 0) {
+ compareTo = Util.compare(isEqualityPattern, castedObject.isEqualityPattern);
- if (compareTo == 0)
- compareTo = Util.compare(sourceId, castedObject.sourceId);
+ if (compareTo == 0)
+ compareTo = Util.compare(sourceId, castedObject.sourceId);
}
- }
+ }
- return compareTo;
- }
+ return compareTo;
+ }
- @Override
+ @Override
public boolean equals(Object object) {
- if (!(object instanceof ActivityPatternBindingDefinition)) {
+ if (!(object instanceof ActivityPatternBindingDefinition)) {
return false;
}
- final ActivityPatternBindingDefinition castedObject = (ActivityPatternBindingDefinition) object;
- if (!Util.equals(activityId, castedObject.activityId)) {
- return false;
- }
+ final ActivityPatternBindingDefinition castedObject = (ActivityPatternBindingDefinition) object;
+ if (!Util.equals(activityId, castedObject.activityId)) {
+ return false;
+ }
- if (!Util.equals(pattern, castedObject.pattern)) {
- return false;
- }
+ if (!Util.equals(pattern, castedObject.pattern)) {
+ return false;
+ }
- if (!Util.equals(isEqualityPattern, castedObject.isEqualityPattern)) {
- return false;
- }
+ if (!Util.equals(isEqualityPattern, castedObject.isEqualityPattern)) {
+ return false;
+ }
- return Util.equals(sourceId, castedObject.sourceId);
- }
+ return Util.equals(sourceId, castedObject.sourceId);
+ }
- public String getActivityId() {
- return activityId;
- }
+ public String getActivityId() {
+ return activityId;
+ }
- public String getPattern() {
- return pattern;
- }
+ public String getPattern() {
+ return pattern;
+ }
- public String getSourceId() {
- return sourceId;
- }
+ public String getSourceId() {
+ return sourceId;
+ }
- public boolean isEqualityPattern() {
- return isEqualityPattern;
- }
+ public boolean isEqualityPattern() {
+ return isEqualityPattern;
+ }
- @Override
+ @Override
public int hashCode() {
- if (hashCode == HASH_INITIAL) {
- hashCode = hashCode * HASH_FACTOR + Util.hashCode(activityId);
- hashCode = hashCode * HASH_FACTOR + Util.hashCode(pattern);
- hashCode = hashCode * HASH_FACTOR + Util.hashCode(sourceId);
- if (hashCode == HASH_INITIAL) {
+ if (hashCode == HASH_INITIAL) {
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(activityId);
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(pattern);
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(sourceId);
+ if (hashCode == HASH_INITIAL) {
hashCode++;
}
- }
+ }
- return hashCode;
- }
+ return hashCode;
+ }
- @Override
+ @Override
public String toString() {
- if (string == null) {
- final StringBuilder stringBuffer = new StringBuilder();
- stringBuffer.append('[');
- stringBuffer.append(activityId);
- stringBuffer.append(',');
- stringBuffer.append(isEqualityPattern);
- stringBuffer.append(',');
- stringBuffer.append(pattern);
- stringBuffer.append(',');
- stringBuffer.append(sourceId);
- stringBuffer.append(']');
- string = stringBuffer.toString();
- }
-
- return string;
- }
+ if (string == null) {
+ final StringBuilder stringBuffer = new StringBuilder();
+ stringBuffer.append('[');
+ stringBuffer.append(activityId);
+ stringBuffer.append(',');
+ stringBuffer.append(isEqualityPattern);
+ stringBuffer.append(',');
+ stringBuffer.append(pattern);
+ stringBuffer.append(',');
+ stringBuffer.append(sourceId);
+ stringBuffer.append(']');
+ string = stringBuffer.toString();
+ }
+
+ return string;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityPropertyTester.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityPropertyTester.java
index 7ac2c8012ae..8141888c214 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityPropertyTester.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityPropertyTester.java
@@ -32,13 +32,12 @@ public class ActivityPropertyTester extends PropertyTester {
private static final String PROPERTY_IS_CATEGORY_ENABLED = "isCategoryEnabled"; //$NON-NLS-1$
@Override
- public boolean test(Object receiver, String property, Object[] args,
- Object expectedValue) {
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
if (args.length == 1 && receiver instanceof IWorkbench && args[0] instanceof String) {
if (PROPERTY_IS_ACTIVITY_ENABLED.equals(property)) {
- return isActivityEnabled((String) args[0], (IWorkbench)receiver);
+ return isActivityEnabled((String) args[0], (IWorkbench) receiver);
} else if (PROPERTY_IS_CATEGORY_ENABLED.equals(property)) {
- return isCategoryEnabled((String) args[0], (IWorkbench)receiver);
+ return isCategoryEnabled((String) args[0], (IWorkbench) receiver);
}
}
return false;
@@ -46,10 +45,8 @@ public class ActivityPropertyTester extends PropertyTester {
private static boolean isActivityEnabled(String activityId, IWorkbench workbench) {
try {
- IWorkbenchActivitySupport workbenchActivitySupport =
- workbench.getActivitySupport();
- IActivityManager activityManager = workbenchActivitySupport
- .getActivityManager();
+ IWorkbenchActivitySupport workbenchActivitySupport = workbench.getActivitySupport();
+ IActivityManager activityManager = workbenchActivitySupport.getActivityManager();
return activityManager.getActivity(activityId).isEnabled();
} catch (Exception e) {
// workbench not yet activated; nothing enabled yet
@@ -59,12 +56,9 @@ public class ActivityPropertyTester extends PropertyTester {
private static boolean isCategoryEnabled(String categoryId, IWorkbench workbench) {
try {
- IWorkbenchActivitySupport workbenchActivitySupport =
- workbench.getActivitySupport();
- IActivityManager activityManager = workbenchActivitySupport
- .getActivityManager();
- return WorkbenchActivityHelper.isEnabled(activityManager,
- categoryId);
+ IWorkbenchActivitySupport workbenchActivitySupport = workbench.getActivitySupport();
+ IActivityManager activityManager = workbenchActivitySupport.getActivityManager();
+ return WorkbenchActivityHelper.isEnabled(activityManager, categoryId);
} catch (Exception e) {
// workbench not yet activated; nothing enabled yet
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityRegistryEvent.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityRegistryEvent.java
index 3384113f62e..59753996a5d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityRegistryEvent.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityRegistryEvent.java
@@ -15,17 +15,17 @@
package org.eclipse.ui.internal.activities;
final class ActivityRegistryEvent {
- private IActivityRegistry activityRegistry;
+ private IActivityRegistry activityRegistry;
- ActivityRegistryEvent(IActivityRegistry activityRegistry) {
- if (activityRegistry == null) {
+ ActivityRegistryEvent(IActivityRegistry activityRegistry) {
+ if (activityRegistry == null) {
throw new NullPointerException();
}
- this.activityRegistry = activityRegistry;
- }
+ this.activityRegistry = activityRegistry;
+ }
- IActivityRegistry getActivityRegistry() {
- return activityRegistry;
- }
+ IActivityRegistry getActivityRegistry() {
+ return activityRegistry;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityRequirementBinding.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityRequirementBinding.java
index cff8d43a300..3b797747afa 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityRequirementBinding.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityRequirementBinding.java
@@ -17,94 +17,89 @@ package org.eclipse.ui.internal.activities;
import org.eclipse.ui.activities.IActivityRequirementBinding;
import org.eclipse.ui.internal.util.Util;
-public final class ActivityRequirementBinding implements
- IActivityRequirementBinding {
- private static final int HASH_FACTOR = 89;
+public final class ActivityRequirementBinding implements IActivityRequirementBinding {
+ private static final int HASH_FACTOR = 89;
- private static final int HASH_INITIAL = ActivityRequirementBinding.class
- .getName().hashCode();
+ private static final int HASH_INITIAL = ActivityRequirementBinding.class.getName().hashCode();
- private String requiredActivityId;
+ private String requiredActivityId;
- private transient int hashCode = HASH_INITIAL;
+ private transient int hashCode = HASH_INITIAL;
- private String activityId;
+ private String activityId;
- private transient String string;
+ private transient String string;
- public ActivityRequirementBinding(String requiredActivityId,
- String activityId) {
- if (requiredActivityId == null || activityId == null) {
+ public ActivityRequirementBinding(String requiredActivityId, String activityId) {
+ if (requiredActivityId == null || activityId == null) {
throw new NullPointerException();
}
- this.requiredActivityId = requiredActivityId;
- this.activityId = activityId;
- }
+ this.requiredActivityId = requiredActivityId;
+ this.activityId = activityId;
+ }
- @Override
+ @Override
public int compareTo(IActivityRequirementBinding object) {
- ActivityRequirementBinding castedObject = (ActivityRequirementBinding) object;
- int compareTo = Util.compare(requiredActivityId,
- castedObject.requiredActivityId);
+ ActivityRequirementBinding castedObject = (ActivityRequirementBinding) object;
+ int compareTo = Util.compare(requiredActivityId, castedObject.requiredActivityId);
- if (compareTo == 0) {
+ if (compareTo == 0) {
compareTo = Util.compare(activityId, castedObject.activityId);
}
- return compareTo;
- }
+ return compareTo;
+ }
- @Override
+ @Override
public boolean equals(Object object) {
- if (!(object instanceof ActivityRequirementBinding)) {
+ if (!(object instanceof ActivityRequirementBinding)) {
return false;
}
- final ActivityRequirementBinding castedObject = (ActivityRequirementBinding) object;
- if (!Util.equals(requiredActivityId, castedObject.requiredActivityId)) {
- return false;
- }
+ final ActivityRequirementBinding castedObject = (ActivityRequirementBinding) object;
+ if (!Util.equals(requiredActivityId, castedObject.requiredActivityId)) {
+ return false;
+ }
- return Util.equals(activityId, castedObject.activityId);
- }
+ return Util.equals(activityId, castedObject.activityId);
+ }
- @Override
+ @Override
public String getRequiredActivityId() {
- return requiredActivityId;
- }
+ return requiredActivityId;
+ }
- @Override
+ @Override
public String getActivityId() {
- return activityId;
- }
+ return activityId;
+ }
- @Override
+ @Override
public int hashCode() {
- if (hashCode == HASH_INITIAL) {
- hashCode = hashCode * HASH_FACTOR
- + Util.hashCode(requiredActivityId);
- hashCode = hashCode * HASH_FACTOR + Util.hashCode(activityId);
- if (hashCode == HASH_INITIAL) {
+ if (hashCode == HASH_INITIAL) {
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(requiredActivityId);
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(activityId);
+ if (hashCode == HASH_INITIAL) {
hashCode++;
}
- }
+ }
- return hashCode;
- }
+ return hashCode;
+ }
- @Override
+ @Override
public String toString() {
- if (string == null) {
- final StringBuilder stringBuffer = new StringBuilder();
- stringBuffer.append('[');
- stringBuffer.append(requiredActivityId);
- stringBuffer.append(',');
- stringBuffer.append(activityId);
- stringBuffer.append(']');
- string = stringBuffer.toString();
- }
-
- return string;
- }
+ if (string == null) {
+ final StringBuilder stringBuffer = new StringBuilder();
+ stringBuffer.append('[');
+ stringBuffer.append(requiredActivityId);
+ stringBuffer.append(',');
+ stringBuffer.append(activityId);
+ stringBuffer.append(']');
+ string = stringBuffer.toString();
+ }
+
+ return string;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityRequirementBindingDefinition.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityRequirementBindingDefinition.java
index ca622c283e2..fbd1ba44367 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityRequirementBindingDefinition.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ActivityRequirementBindingDefinition.java
@@ -22,139 +22,130 @@ import java.util.Map;
import org.eclipse.ui.internal.util.Util;
public final class ActivityRequirementBindingDefinition {
- private static final int HASH_FACTOR = 89;
+ private static final int HASH_FACTOR = 89;
- private static final int HASH_INITIAL = ActivityRequirementBindingDefinition.class
- .getName().hashCode();
+ private static final int HASH_INITIAL = ActivityRequirementBindingDefinition.class.getName().hashCode();
static Map<String, Collection<ActivityRequirementBindingDefinition>> activityRequirementBindingDefinitionsByActivityId(
Collection<ActivityRequirementBindingDefinition> activityRequirementBindingDefinitions) {
- if (activityRequirementBindingDefinitions == null) {
+ if (activityRequirementBindingDefinitions == null) {
throw new NullPointerException();
}
Map<String, Collection<ActivityRequirementBindingDefinition>> map = new HashMap<>();
Iterator<ActivityRequirementBindingDefinition> iterator = activityRequirementBindingDefinitions.iterator();
- while (iterator.hasNext()) {
- Object object = iterator.next();
- Util.assertInstance(object,
- ActivityRequirementBindingDefinition.class);
- ActivityRequirementBindingDefinition activityRequirementBindingDefinition = (ActivityRequirementBindingDefinition) object;
- String parentActivityId = activityRequirementBindingDefinition
- .getActivityId();
+ while (iterator.hasNext()) {
+ Object object = iterator.next();
+ Util.assertInstance(object, ActivityRequirementBindingDefinition.class);
+ ActivityRequirementBindingDefinition activityRequirementBindingDefinition = (ActivityRequirementBindingDefinition) object;
+ String parentActivityId = activityRequirementBindingDefinition.getActivityId();
- if (parentActivityId != null) {
+ if (parentActivityId != null) {
Collection<ActivityRequirementBindingDefinition> activityRequirementBindingDefinitions2 = map
- .get(parentActivityId);
+ .get(parentActivityId);
- if (activityRequirementBindingDefinitions2 == null) {
+ if (activityRequirementBindingDefinitions2 == null) {
activityRequirementBindingDefinitions2 = new HashSet<>();
- map.put(parentActivityId,
- activityRequirementBindingDefinitions2);
- }
+ map.put(parentActivityId, activityRequirementBindingDefinitions2);
+ }
- activityRequirementBindingDefinitions2
- .add(activityRequirementBindingDefinition);
- }
- }
+ activityRequirementBindingDefinitions2.add(activityRequirementBindingDefinition);
+ }
+ }
- return map;
- }
+ return map;
+ }
- private String requiredActivityId;
+ private String requiredActivityId;
- private transient int hashCode = HASH_INITIAL;
+ private transient int hashCode = HASH_INITIAL;
- private String activityId;
+ private String activityId;
- private String sourceId;
+ private String sourceId;
- private transient String string;
+ private transient String string;
- public ActivityRequirementBindingDefinition(String requiredActivityId,
- String activityId, String sourceId) {
- this.requiredActivityId = requiredActivityId;
- this.activityId = activityId;
- this.sourceId = sourceId;
- }
+ public ActivityRequirementBindingDefinition(String requiredActivityId, String activityId, String sourceId) {
+ this.requiredActivityId = requiredActivityId;
+ this.activityId = activityId;
+ this.sourceId = sourceId;
+ }
- public int compareTo(Object object) {
- ActivityRequirementBindingDefinition castedObject = (ActivityRequirementBindingDefinition) object;
- int compareTo = Util.compare(requiredActivityId,
- castedObject.requiredActivityId);
+ public int compareTo(Object object) {
+ ActivityRequirementBindingDefinition castedObject = (ActivityRequirementBindingDefinition) object;
+ int compareTo = Util.compare(requiredActivityId, castedObject.requiredActivityId);
- if (compareTo == 0) {
- compareTo = Util.compare(activityId, castedObject.activityId);
+ if (compareTo == 0) {
+ compareTo = Util.compare(activityId, castedObject.activityId);
- if (compareTo == 0) {
+ if (compareTo == 0) {
compareTo = Util.compare(sourceId, castedObject.sourceId);
}
- }
+ }
- return compareTo;
- }
+ return compareTo;
+ }
- @Override
+ @Override
public boolean equals(Object object) {
- if (!(object instanceof ActivityRequirementBindingDefinition)) {
+ if (!(object instanceof ActivityRequirementBindingDefinition)) {
return false;
}
- final ActivityRequirementBindingDefinition castedObject = (ActivityRequirementBindingDefinition) object;
- if (!Util.equals(requiredActivityId,
- castedObject.requiredActivityId)) {
- return false;
- }
+ final ActivityRequirementBindingDefinition castedObject = (ActivityRequirementBindingDefinition) object;
+ if (!Util.equals(requiredActivityId, castedObject.requiredActivityId)) {
+ return false;
+ }
- if (!Util.equals(activityId, castedObject.activityId)) {
- return false;
- }
+ if (!Util.equals(activityId, castedObject.activityId)) {
+ return false;
+ }
- return Util.equals(sourceId, castedObject.sourceId);
- }
+ return Util.equals(sourceId, castedObject.sourceId);
+ }
- public String getRequiredActivityId() {
- return requiredActivityId;
- }
+ public String getRequiredActivityId() {
+ return requiredActivityId;
+ }
- public String getActivityId() {
- return activityId;
- }
+ public String getActivityId() {
+ return activityId;
+ }
- public String getSourceId() {
- return sourceId;
- }
+ public String getSourceId() {
+ return sourceId;
+ }
- @Override
+ @Override
public int hashCode() {
- if (hashCode == HASH_INITIAL) {
- hashCode = hashCode * HASH_FACTOR
- + Util.hashCode(requiredActivityId);
- hashCode = hashCode * HASH_FACTOR + Util.hashCode(activityId);
- hashCode = hashCode * HASH_FACTOR + Util.hashCode(sourceId);
- if (hashCode == HASH_INITIAL) {
+ if (hashCode == HASH_INITIAL) {
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(requiredActivityId);
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(activityId);
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(sourceId);
+ if (hashCode == HASH_INITIAL) {
hashCode++;
}
- }
+ }
- return hashCode;
- }
+ return hashCode;
+ }
- @Override
+ @Override
public String toString() {
- if (string == null) {
- final StringBuilder stringBuffer = new StringBuilder();
- stringBuffer.append('[');
- stringBuffer.append(requiredActivityId);
- stringBuffer.append(',');
- stringBuffer.append(activityId);
- stringBuffer.append(',');
- stringBuffer.append(sourceId);
- stringBuffer.append(']');
- string = stringBuffer.toString();
- }
-
- return string;
- }
+ if (string == null) {
+ final StringBuilder stringBuffer = new StringBuilder();
+ stringBuffer.append('[');
+ stringBuffer.append(requiredActivityId);
+ stringBuffer.append(',');
+ stringBuffer.append(activityId);
+ stringBuffer.append(',');
+ stringBuffer.append(sourceId);
+ stringBuffer.append(']');
+ string = stringBuffer.toString();
+ }
+
+ return string;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/Category.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/Category.java
index c63058125c6..47478017efa 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/Category.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/Category.java
@@ -26,244 +26,236 @@ import org.eclipse.ui.activities.NotDefinedException;
import org.eclipse.ui.internal.util.Util;
final class Category implements ICategory {
- private static final int HASH_FACTOR = 89;
+ private static final int HASH_FACTOR = 89;
- private static final int HASH_INITIAL = Category.class.getName().hashCode();
+ private static final int HASH_INITIAL = Category.class.getName().hashCode();
private static final Set<Category> strongReferences = new HashSet<>();
private Set<ICategoryActivityBinding> categoryActivityBindings;
- private transient ICategoryActivityBinding[] categoryActivityBindingsAsArray;
+ private transient ICategoryActivityBinding[] categoryActivityBindingsAsArray;
private List<ICategoryListener> categoryListeners;
- private boolean defined;
+ private boolean defined;
- private transient int hashCode = HASH_INITIAL;
+ private transient int hashCode = HASH_INITIAL;
- private String id;
+ private String id;
- private String name;
+ private String name;
- private transient String string;
+ private transient String string;
- private String description;
+ private String description;
- Category(String id) {
- if (id == null) {
+ Category(String id) {
+ if (id == null) {
throw new NullPointerException();
}
- this.id = id;
- }
+ this.id = id;
+ }
- @Override
+ @Override
public void addCategoryListener(ICategoryListener categoryListener) {
- if (categoryListener == null) {
+ if (categoryListener == null) {
throw new NullPointerException();
}
- if (categoryListeners == null) {
+ if (categoryListeners == null) {
categoryListeners = new ArrayList<>();
}
- if (!categoryListeners.contains(categoryListener)) {
+ if (!categoryListeners.contains(categoryListener)) {
categoryListeners.add(categoryListener);
}
- strongReferences.add(this);
- }
+ strongReferences.add(this);
+ }
- @Override
+ @Override
public int compareTo(ICategory object) {
- Category castedObject = (Category) object;
- int compareTo = Util.compare(
- categoryActivityBindingsAsArray,
- castedObject.categoryActivityBindingsAsArray);
+ Category castedObject = (Category) object;
+ int compareTo = Util.compare(categoryActivityBindingsAsArray, castedObject.categoryActivityBindingsAsArray);
- if (compareTo == 0) {
+ if (compareTo == 0) {
compareTo = Util.compare(defined, castedObject.defined);
- if (compareTo == 0) {
- compareTo = Util.compare(id, castedObject.id);
+ if (compareTo == 0) {
+ compareTo = Util.compare(id, castedObject.id);
- if (compareTo == 0) {
+ if (compareTo == 0) {
compareTo = Util.compare(name, castedObject.name);
}
- }
- }
+ }
+ }
- return compareTo;
- }
+ return compareTo;
+ }
- @Override
+ @Override
public boolean equals(Object object) {
- if (!(object instanceof Category)) {
+ if (!(object instanceof Category)) {
return false;
}
- final Category castedObject = (Category) object;
- if (!Util.equals(categoryActivityBindings,
- castedObject.categoryActivityBindings)) {
- return false;
- }
+ final Category castedObject = (Category) object;
+ if (!Util.equals(categoryActivityBindings, castedObject.categoryActivityBindings)) {
+ return false;
+ }
- if (!Util.equals(defined, castedObject.defined)) {
- return false;
- }
+ if (!Util.equals(defined, castedObject.defined)) {
+ return false;
+ }
- if (!Util.equals(id, castedObject.id)) {
- return false;
- }
+ if (!Util.equals(id, castedObject.id)) {
+ return false;
+ }
- return Util.equals(name, castedObject.name);
- }
+ return Util.equals(name, castedObject.name);
+ }
- void fireCategoryChanged(CategoryEvent categoryEvent) {
- if (categoryEvent == null) {
+ void fireCategoryChanged(CategoryEvent categoryEvent) {
+ if (categoryEvent == null) {
throw new NullPointerException();
}
- if (categoryListeners != null) {
+ if (categoryListeners != null) {
for (int i = 0; i < categoryListeners.size(); i++) {
- categoryListeners.get(i)
- .categoryChanged(categoryEvent);
+ categoryListeners.get(i).categoryChanged(categoryEvent);
}
}
- }
+ }
- @Override
+ @Override
public Set<ICategoryActivityBinding> getCategoryActivityBindings() {
- return categoryActivityBindings;
- }
+ return categoryActivityBindings;
+ }
- @Override
+ @Override
public String getId() {
- return id;
- }
+ return id;
+ }
- @Override
+ @Override
public String getName() throws NotDefinedException {
- if (!defined) {
+ if (!defined) {
throw new NotDefinedException();
}
- return name;
- }
+ return name;
+ }
- @Override
+ @Override
public int hashCode() {
- if (hashCode == HASH_INITIAL) {
- hashCode = hashCode * HASH_FACTOR
- + Util.hashCode(categoryActivityBindings);
- hashCode = hashCode * HASH_FACTOR + Util.hashCode(defined);
- hashCode = hashCode * HASH_FACTOR + Util.hashCode(id);
- hashCode = hashCode * HASH_FACTOR + Util.hashCode(name);
- if (hashCode == HASH_INITIAL) {
+ if (hashCode == HASH_INITIAL) {
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(categoryActivityBindings);
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(defined);
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(id);
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(name);
+ if (hashCode == HASH_INITIAL) {
hashCode++;
}
- }
+ }
- return hashCode;
- }
+ return hashCode;
+ }
- @Override
+ @Override
public boolean isDefined() {
- return defined;
- }
+ return defined;
+ }
- @Override
+ @Override
public void removeCategoryListener(ICategoryListener categoryListener) {
- if (categoryListener == null) {
+ if (categoryListener == null) {
throw new NullPointerException();
}
- if (categoryListeners != null) {
+ if (categoryListeners != null) {
categoryListeners.remove(categoryListener);
}
- if (categoryListeners.isEmpty()) {
+ if (categoryListeners.isEmpty()) {
strongReferences.remove(this);
}
- }
+ }
boolean setCategoryActivityBindings(Set<ICategoryActivityBinding> categoryActivityBindings) {
- categoryActivityBindings = Util.safeCopy(categoryActivityBindings,
- ICategoryActivityBinding.class);
-
- if (!Util.equals(categoryActivityBindings,
- this.categoryActivityBindings)) {
- this.categoryActivityBindings = categoryActivityBindings;
- this.categoryActivityBindingsAsArray = this.categoryActivityBindings
- .toArray(new ICategoryActivityBinding[this.categoryActivityBindings
- .size()]);
- hashCode = HASH_INITIAL;
- string = null;
- return true;
- }
-
- return false;
- }
-
- boolean setDefined(boolean defined) {
- if (defined != this.defined) {
- this.defined = defined;
- hashCode = HASH_INITIAL;
- string = null;
- return true;
- }
-
- return false;
- }
-
- boolean setName(String name) {
- if (!Util.equals(name, this.name)) {
- this.name = name;
- hashCode = HASH_INITIAL;
- string = null;
- return true;
- }
-
- return false;
- }
-
- @Override
+ categoryActivityBindings = Util.safeCopy(categoryActivityBindings, ICategoryActivityBinding.class);
+
+ if (!Util.equals(categoryActivityBindings, this.categoryActivityBindings)) {
+ this.categoryActivityBindings = categoryActivityBindings;
+ this.categoryActivityBindingsAsArray = this.categoryActivityBindings
+ .toArray(new ICategoryActivityBinding[this.categoryActivityBindings.size()]);
+ hashCode = HASH_INITIAL;
+ string = null;
+ return true;
+ }
+
+ return false;
+ }
+
+ boolean setDefined(boolean defined) {
+ if (defined != this.defined) {
+ this.defined = defined;
+ hashCode = HASH_INITIAL;
+ string = null;
+ return true;
+ }
+
+ return false;
+ }
+
+ boolean setName(String name) {
+ if (!Util.equals(name, this.name)) {
+ this.name = name;
+ hashCode = HASH_INITIAL;
+ string = null;
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
public String toString() {
- if (string == null) {
- final StringBuilder stringBuffer = new StringBuilder();
- stringBuffer.append('[');
- stringBuffer.append(categoryActivityBindings);
- stringBuffer.append(',');
- stringBuffer.append(defined);
- stringBuffer.append(',');
- stringBuffer.append(id);
- stringBuffer.append(',');
- stringBuffer.append(name);
- stringBuffer.append(']');
- string = stringBuffer.toString();
- }
-
- return string;
- }
-
- @Override
+ if (string == null) {
+ final StringBuilder stringBuffer = new StringBuilder();
+ stringBuffer.append('[');
+ stringBuffer.append(categoryActivityBindings);
+ stringBuffer.append(',');
+ stringBuffer.append(defined);
+ stringBuffer.append(',');
+ stringBuffer.append(id);
+ stringBuffer.append(',');
+ stringBuffer.append(name);
+ stringBuffer.append(']');
+ string = stringBuffer.toString();
+ }
+
+ return string;
+ }
+
+ @Override
public String getDescription() throws NotDefinedException {
- if (!defined) {
+ if (!defined) {
throw new NotDefinedException();
}
- return description;
- }
+ return description;
+ }
- public boolean setDescription(String description) {
- if (!Util.equals(description, this.description)) {
- this.description = description;
- hashCode = HASH_INITIAL;
- string = null;
- return true;
- }
+ public boolean setDescription(String description) {
+ if (!Util.equals(description, this.description)) {
+ this.description = description;
+ hashCode = HASH_INITIAL;
+ string = null;
+ return true;
+ }
- return false;
- }
+ return false;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/CategoryActivityBinding.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/CategoryActivityBinding.java
index 9a20eee6e9b..251058920e2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/CategoryActivityBinding.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/CategoryActivityBinding.java
@@ -18,89 +18,88 @@ import org.eclipse.ui.activities.ICategoryActivityBinding;
import org.eclipse.ui.internal.util.Util;
public final class CategoryActivityBinding implements ICategoryActivityBinding {
- private static final int HASH_FACTOR = 89;
+ private static final int HASH_FACTOR = 89;
- private static final int HASH_INITIAL = CategoryActivityBinding.class
- .getName().hashCode();
+ private static final int HASH_INITIAL = CategoryActivityBinding.class.getName().hashCode();
- private String activityId;
+ private String activityId;
- private String categoryId;
+ private String categoryId;
- private transient int hashCode = HASH_INITIAL;
+ private transient int hashCode = HASH_INITIAL;
- private transient String string;
+ private transient String string;
- public CategoryActivityBinding(String activityId, String categoryId) {
- if (activityId == null || categoryId == null) {
+ public CategoryActivityBinding(String activityId, String categoryId) {
+ if (activityId == null || categoryId == null) {
throw new NullPointerException();
}
- this.activityId = activityId;
- this.categoryId = categoryId;
- }
+ this.activityId = activityId;
+ this.categoryId = categoryId;
+ }
- @Override
+ @Override
public int compareTo(ICategoryActivityBinding object) {
- CategoryActivityBinding castedObject = (CategoryActivityBinding) object;
- int compareTo = Util.compare(activityId, castedObject.activityId);
+ CategoryActivityBinding castedObject = (CategoryActivityBinding) object;
+ int compareTo = Util.compare(activityId, castedObject.activityId);
- if (compareTo == 0) {
+ if (compareTo == 0) {
compareTo = Util.compare(categoryId, castedObject.categoryId);
}
- return compareTo;
- }
+ return compareTo;
+ }
- @Override
+ @Override
public boolean equals(Object object) {
- if (!(object instanceof CategoryActivityBinding)) {
+ if (!(object instanceof CategoryActivityBinding)) {
return false;
}
- final CategoryActivityBinding castedObject = (CategoryActivityBinding) object;
- if (!Util.equals(activityId, castedObject.activityId)) {
- return false;
- }
+ final CategoryActivityBinding castedObject = (CategoryActivityBinding) object;
+ if (!Util.equals(activityId, castedObject.activityId)) {
+ return false;
+ }
- return Util.equals(categoryId, castedObject.categoryId);
- }
+ return Util.equals(categoryId, castedObject.categoryId);
+ }
- @Override
+ @Override
public String getActivityId() {
- return activityId;
- }
+ return activityId;
+ }
- @Override
+ @Override
public String getCategoryId() {
- return categoryId;
- }
+ return categoryId;
+ }
- @Override
+ @Override
public int hashCode() {
- if (hashCode == HASH_INITIAL){
- hashCode = hashCode * HASH_FACTOR + Util.hashCode(activityId);
- hashCode = hashCode * HASH_FACTOR + Util.hashCode(categoryId);
- if (hashCode == HASH_INITIAL) {
+ if (hashCode == HASH_INITIAL) {
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(activityId);
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(categoryId);
+ if (hashCode == HASH_INITIAL) {
hashCode++;
}
- }
+ }
- return hashCode;
- }
+ return hashCode;
+ }
- @Override
+ @Override
public String toString() {
- if (string == null) {
- final StringBuilder stringBuffer = new StringBuilder();
- stringBuffer.append('[');
- stringBuffer.append(activityId);
- stringBuffer.append(',');
- stringBuffer.append(categoryId);
- stringBuffer.append(']');
- string = stringBuffer.toString();
- }
-
- return string;
- }
+ if (string == null) {
+ final StringBuilder stringBuffer = new StringBuilder();
+ stringBuffer.append('[');
+ stringBuffer.append(activityId);
+ stringBuffer.append(',');
+ stringBuffer.append(categoryId);
+ stringBuffer.append(']');
+ string = stringBuffer.toString();
+ }
+
+ return string;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/CategoryActivityBindingDefinition.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/CategoryActivityBindingDefinition.java
index 88e64451c1b..ee99fcf0bdf 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/CategoryActivityBindingDefinition.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/CategoryActivityBindingDefinition.java
@@ -22,132 +22,127 @@ import java.util.Map;
import org.eclipse.ui.internal.util.Util;
public final class CategoryActivityBindingDefinition {
- private static final int HASH_FACTOR = 89;
+ private static final int HASH_FACTOR = 89;
- private static final int HASH_INITIAL = CategoryActivityBindingDefinition.class
- .getName().hashCode();
+ private static final int HASH_INITIAL = CategoryActivityBindingDefinition.class.getName().hashCode();
static Map<String, Collection<CategoryActivityBindingDefinition>> categoryActivityBindingDefinitionsByCategoryId(
Collection<CategoryActivityBindingDefinition> categoryActivityBindingDefinitions) {
- if (categoryActivityBindingDefinitions == null) {
+ if (categoryActivityBindingDefinitions == null) {
throw new NullPointerException();
}
Map<String, Collection<CategoryActivityBindingDefinition>> map = new HashMap<>();
Iterator<CategoryActivityBindingDefinition> iterator = categoryActivityBindingDefinitions.iterator();
- while (iterator.hasNext()) {
+ while (iterator.hasNext()) {
CategoryActivityBindingDefinition categoryActivityBindingDefinition = iterator.next();
- String categoryId = categoryActivityBindingDefinition
- .getCategoryId();
+ String categoryId = categoryActivityBindingDefinition.getCategoryId();
- if (categoryId != null) {
- Collection<CategoryActivityBindingDefinition> categoryActivityBindingDefinitions2 = map
- .get(categoryId);
+ if (categoryId != null) {
+ Collection<CategoryActivityBindingDefinition> categoryActivityBindingDefinitions2 = map.get(categoryId);
- if (categoryActivityBindingDefinitions2 == null) {
+ if (categoryActivityBindingDefinitions2 == null) {
categoryActivityBindingDefinitions2 = new HashSet<>();
- map.put(categoryId, categoryActivityBindingDefinitions2);
- }
+ map.put(categoryId, categoryActivityBindingDefinitions2);
+ }
- categoryActivityBindingDefinitions2
- .add(categoryActivityBindingDefinition);
- }
- }
+ categoryActivityBindingDefinitions2.add(categoryActivityBindingDefinition);
+ }
+ }
- return map;
- }
+ return map;
+ }
- private String activityId;
+ private String activityId;
- private String categoryId;
+ private String categoryId;
- private transient int hashCode = HASH_INITIAL;
+ private transient int hashCode = HASH_INITIAL;
- private String sourceId;
+ private String sourceId;
- private transient String string;
+ private transient String string;
- public CategoryActivityBindingDefinition(String activityId,
- String categoryId, String sourceId) {
- this.activityId = activityId;
- this.categoryId = categoryId;
- this.sourceId = sourceId;
- }
+ public CategoryActivityBindingDefinition(String activityId, String categoryId, String sourceId) {
+ this.activityId = activityId;
+ this.categoryId = categoryId;
+ this.sourceId = sourceId;
+ }
- public int compareTo(Object object) {
- CategoryActivityBindingDefinition castedObject = (CategoryActivityBindingDefinition) object;
- int compareTo = Util.compare(activityId, castedObject.activityId);
+ public int compareTo(Object object) {
+ CategoryActivityBindingDefinition castedObject = (CategoryActivityBindingDefinition) object;
+ int compareTo = Util.compare(activityId, castedObject.activityId);
- if (compareTo == 0) {
- compareTo = Util.compare(categoryId, castedObject.categoryId);
+ if (compareTo == 0) {
+ compareTo = Util.compare(categoryId, castedObject.categoryId);
- if (compareTo == 0) {
+ if (compareTo == 0) {
compareTo = Util.compare(sourceId, castedObject.sourceId);
}
- }
+ }
- return compareTo;
- }
+ return compareTo;
+ }
- @Override
+ @Override
public boolean equals(Object object) {
- if (!(object instanceof CategoryActivityBindingDefinition)) {
+ if (!(object instanceof CategoryActivityBindingDefinition)) {
return false;
}
- final CategoryActivityBindingDefinition castedObject = (CategoryActivityBindingDefinition) object;
- if (!Util.equals(activityId, castedObject.activityId)) {
- return false;
- }
+ final CategoryActivityBindingDefinition castedObject = (CategoryActivityBindingDefinition) object;
+ if (!Util.equals(activityId, castedObject.activityId)) {
+ return false;
+ }
- if (!Util.equals(categoryId, castedObject.categoryId)) {
- return false;
- }
+ if (!Util.equals(categoryId, castedObject.categoryId)) {
+ return false;
+ }
- return Util.equals(sourceId, castedObject.sourceId);
- }
+ return Util.equals(sourceId, castedObject.sourceId);
+ }
- public String getActivityId() {
- return activityId;
- }
+ public String getActivityId() {
+ return activityId;
+ }
- public String getCategoryId() {
- return categoryId;
- }
+ public String getCategoryId() {
+ return categoryId;
+ }
- public String getSourceId() {
- return sourceId;
- }
+ public String getSourceId() {
+ return sourceId;
+ }
- @Override
+ @Override
public int hashCode() {
- if (hashCode == HASH_INITIAL) {
- hashCode = hashCode * HASH_FACTOR + Util.hashCode(activityId);
- hashCode = hashCode * HASH_FACTOR + Util.hashCode(categoryId);
- hashCode = hashCode * HASH_FACTOR + Util.hashCode(sourceId);
- if (hashCode == HASH_INITIAL) {
+ if (hashCode == HASH_INITIAL) {
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(activityId);
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(categoryId);
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(sourceId);
+ if (hashCode == HASH_INITIAL) {
hashCode++;
}
- }
+ }
- return hashCode;
- }
+ return hashCode;
+ }
- @Override
+ @Override
public String toString() {
- if (string == null) {
- final StringBuilder stringBuffer = new StringBuilder();
- stringBuffer.append('[');
- stringBuffer.append(activityId);
- stringBuffer.append(',');
- stringBuffer.append(categoryId);
- stringBuffer.append(',');
- stringBuffer.append(sourceId);
- stringBuffer.append(']');
- string = stringBuffer.toString();
- }
-
- return string;
- }
+ if (string == null) {
+ final StringBuilder stringBuffer = new StringBuilder();
+ stringBuffer.append('[');
+ stringBuffer.append(activityId);
+ stringBuffer.append(',');
+ stringBuffer.append(categoryId);
+ stringBuffer.append(',');
+ stringBuffer.append(sourceId);
+ stringBuffer.append(']');
+ string = stringBuffer.toString();
+ }
+
+ return string;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/CategoryDefinition.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/CategoryDefinition.java
index 6153b6e35b6..44abbd28f28 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/CategoryDefinition.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/CategoryDefinition.java
@@ -22,158 +22,155 @@ import java.util.Map;
import org.eclipse.ui.internal.util.Util;
public final class CategoryDefinition implements Comparable<CategoryDefinition> {
- private static final int HASH_FACTOR = 89;
+ private static final int HASH_FACTOR = 89;
- private static final int HASH_INITIAL = CategoryDefinition.class.getName()
- .hashCode();
+ private static final int HASH_INITIAL = CategoryDefinition.class.getName().hashCode();
static Map<String, CategoryDefinition> categoryDefinitionsById(Collection<CategoryDefinition> categoryDefinitions,
- boolean allowNullIds) {
- if (categoryDefinitions == null) {
+ boolean allowNullIds) {
+ if (categoryDefinitions == null) {
throw new NullPointerException();
}
Map<String, CategoryDefinition> map = new HashMap<>();
Iterator<CategoryDefinition> iterator = categoryDefinitions.iterator();
- while (iterator.hasNext()) {
+ while (iterator.hasNext()) {
CategoryDefinition categoryDefinition = iterator.next();
- String id = categoryDefinition.getId();
+ String id = categoryDefinition.getId();
- if (allowNullIds || id != null) {
+ if (allowNullIds || id != null) {
map.put(id, categoryDefinition);
}
- }
+ }
- return map;
- }
+ return map;
+ }
static Map<String, Collection<CategoryDefinition>> categoryDefinitionsByName(
- Collection<CategoryDefinition> categoryDefinitions,
- boolean allowNullNames) {
- if (categoryDefinitions == null) {
+ Collection<CategoryDefinition> categoryDefinitions, boolean allowNullNames) {
+ if (categoryDefinitions == null) {
throw new NullPointerException();
}
Map<String, Collection<CategoryDefinition>> map = new HashMap<>();
Iterator<CategoryDefinition> iterator = categoryDefinitions.iterator();
- while (iterator.hasNext()) {
+ while (iterator.hasNext()) {
CategoryDefinition categoryDefinition = iterator.next();
- String name = categoryDefinition.getName();
+ String name = categoryDefinition.getName();
- if (allowNullNames || name != null) {
+ if (allowNullNames || name != null) {
Collection<CategoryDefinition> categoryDefinitions2 = map.get(name);
- if (categoryDefinitions2 == null) {
+ if (categoryDefinitions2 == null) {
categoryDefinitions2 = new HashSet<>();
- map.put(name, categoryDefinitions2);
- }
+ map.put(name, categoryDefinitions2);
+ }
- categoryDefinitions2.add(categoryDefinition);
- }
- }
+ categoryDefinitions2.add(categoryDefinition);
+ }
+ }
- return map;
- }
+ return map;
+ }
- private transient int hashCode = HASH_INITIAL;
+ private transient int hashCode = HASH_INITIAL;
- private String id;
+ private String id;
- private String name;
+ private String name;
- private String sourceId;
+ private String sourceId;
- private transient String string;
+ private transient String string;
- private String description;
+ private String description;
- public CategoryDefinition(String id, String name, String sourceId,
- String description) {
- this.id = id;
- this.name = name;
- this.sourceId = sourceId;
- this.description = description;
- }
+ public CategoryDefinition(String id, String name, String sourceId, String description) {
+ this.id = id;
+ this.name = name;
+ this.sourceId = sourceId;
+ this.description = description;
+ }
- @Override
+ @Override
public int compareTo(CategoryDefinition object) {
int compareTo = Util.compare(id, object.id);
- if (compareTo == 0) {
+ if (compareTo == 0) {
compareTo = Util.compare(name, object.name);
- if (compareTo == 0) {
+ if (compareTo == 0) {
compareTo = Util.compare(sourceId, object.sourceId);
}
- }
+ }
- return compareTo;
- }
+ return compareTo;
+ }
- @Override
+ @Override
public boolean equals(Object object) {
- if (!(object instanceof CategoryDefinition)) {
+ if (!(object instanceof CategoryDefinition)) {
return false;
}
- final CategoryDefinition castedObject = (CategoryDefinition) object;
- if (!Util.equals(id, castedObject.id)) {
- return false;
- }
+ final CategoryDefinition castedObject = (CategoryDefinition) object;
+ if (!Util.equals(id, castedObject.id)) {
+ return false;
+ }
- if (!Util.equals(name, castedObject.name)) {
- return false;
- }
+ if (!Util.equals(name, castedObject.name)) {
+ return false;
+ }
- return Util.equals(sourceId, castedObject.sourceId);
- }
+ return Util.equals(sourceId, castedObject.sourceId);
+ }
- public String getId() {
- return id;
- }
+ public String getId() {
+ return id;
+ }
- public String getName() {
- return name;
- }
+ public String getName() {
+ return name;
+ }
- public String getSourceId() {
- return sourceId;
- }
+ public String getSourceId() {
+ return sourceId;
+ }
- @Override
+ @Override
public int hashCode() {
- if (hashCode == HASH_INITIAL) {
- hashCode = hashCode * HASH_FACTOR + Util.hashCode(id);
- hashCode = hashCode * HASH_FACTOR + Util.hashCode(name);
- hashCode = hashCode * HASH_FACTOR + Util.hashCode(sourceId);
- if (hashCode == HASH_INITIAL) {
+ if (hashCode == HASH_INITIAL) {
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(id);
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(name);
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(sourceId);
+ if (hashCode == HASH_INITIAL) {
hashCode++;
}
- }
+ }
- return hashCode;
- }
+ return hashCode;
+ }
- @Override
+ @Override
public String toString() {
- if (string == null) {
- final StringBuilder stringBuffer = new StringBuilder();
- stringBuffer.append('[');
- stringBuffer.append(id);
- stringBuffer.append(',');
- stringBuffer.append(name);
- stringBuffer.append(',');
- stringBuffer.append(sourceId);
- stringBuffer.append(']');
- string = stringBuffer.toString();
- }
-
- return string;
- }
-
- public String getDescription() {
- return description;
- }
+ if (string == null) {
+ final StringBuilder stringBuffer = new StringBuilder();
+ stringBuffer.append('[');
+ stringBuffer.append(id);
+ stringBuffer.append(',');
+ stringBuffer.append(name);
+ stringBuffer.append(',');
+ stringBuffer.append(sourceId);
+ stringBuffer.append(']');
+ string = stringBuffer.toString();
+ }
+
+ return string;
+ }
+
+ public String getDescription() {
+ return description;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ExtensionActivityRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ExtensionActivityRegistry.java
index 0c8e8fb1c99..2cfcca82dde 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ExtensionActivityRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ExtensionActivityRegistry.java
@@ -53,7 +53,7 @@ final class ExtensionActivityRegistry extends AbstractActivityRegistry {
private List<String> defaultEnabledActivities;
- private IExtensionRegistry extensionRegistry;
+ private IExtensionRegistry extensionRegistry;
ExtensionActivityRegistry(IExtensionRegistry extensionRegistry) {
if (extensionRegistry == null) {
@@ -74,31 +74,31 @@ final class ExtensionActivityRegistry extends AbstractActivityRegistry {
load();
}
- private String getNamespace(IConfigurationElement configurationElement) {
- String namespace = null;
+ private String getNamespace(IConfigurationElement configurationElement) {
+ String namespace = null;
- if (configurationElement != null) {
- IExtension extension = configurationElement.getDeclaringExtension();
+ if (configurationElement != null) {
+ IExtension extension = configurationElement.getDeclaringExtension();
- if (extension != null) {
+ if (extension != null) {
namespace = extension.getContributor().getName();
}
- }
-
- return namespace;
- }
-
- /**
- * Returns the activity definition found at this id.
- *
- * @param id <code>ActivityDefinition</code> id.
- * @return <code>ActivityDefinition</code> with given id or <code>null</code> if not found.
- */
- private ActivityDefinition getActivityDefinitionById(String id) {
+ }
+
+ return namespace;
+ }
+
+ /**
+ * Returns the activity definition found at this id.
+ *
+ * @param id <code>ActivityDefinition</code> id.
+ * @return <code>ActivityDefinition</code> with given id or <code>null</code> if
+ * not found.
+ */
+ private ActivityDefinition getActivityDefinitionById(String id) {
int size = activityDefinitions.size();
for (int i = 0; i < size; i++) {
- ActivityDefinition activityDef = activityDefinitions
- .get(i);
+ ActivityDefinition activityDef = activityDefinitions.get(i);
if (activityDef.getId().equals(id)) {
return activityDef;
}
@@ -107,49 +107,49 @@ final class ExtensionActivityRegistry extends AbstractActivityRegistry {
}
private void load() {
- if (activityRequirementBindingDefinitions == null) {
+ if (activityRequirementBindingDefinitions == null) {
activityRequirementBindingDefinitions = new ArrayList<>();
} else {
activityRequirementBindingDefinitions.clear();
}
- if (activityDefinitions == null) {
+ if (activityDefinitions == null) {
activityDefinitions = new ArrayList<>();
} else {
activityDefinitions.clear();
}
- if (activityPatternBindingDefinitions == null) {
+ if (activityPatternBindingDefinitions == null) {
activityPatternBindingDefinitions = new ArrayList<>();
} else {
activityPatternBindingDefinitions.clear();
}
- if (categoryActivityBindingDefinitions == null) {
+ if (categoryActivityBindingDefinitions == null) {
categoryActivityBindingDefinitions = new ArrayList<>();
} else {
categoryActivityBindingDefinitions.clear();
}
- if (categoryDefinitions == null) {
+ if (categoryDefinitions == null) {
categoryDefinitions = new ArrayList<>();
} else {
categoryDefinitions.clear();
}
- if (defaultEnabledActivities == null) {
+ if (defaultEnabledActivities == null) {
defaultEnabledActivities = new ArrayList<>();
} else {
defaultEnabledActivities.clear();
}
- IConfigurationElement[] configurationElements = extensionRegistry
- .getConfigurationElementsFor(Persistence.PACKAGE_FULL);
+ IConfigurationElement[] configurationElements = extensionRegistry
+ .getConfigurationElementsFor(Persistence.PACKAGE_FULL);
- for (IConfigurationElement configurationElement : configurationElements) {
- String name = configurationElement.getName();
+ for (IConfigurationElement configurationElement : configurationElements) {
+ String name = configurationElement.getName();
- if (Persistence.TAG_ACTIVITY_REQUIREMENT_BINDING.equals(name)) {
+ if (Persistence.TAG_ACTIVITY_REQUIREMENT_BINDING.equals(name)) {
readActivityRequirementBindingDefinition(configurationElement);
} else if (Persistence.TAG_ACTIVITY.equals(name)) {
readActivityDefinition(configurationElement);
@@ -162,7 +162,7 @@ final class ExtensionActivityRegistry extends AbstractActivityRegistry {
} else if (Persistence.TAG_DEFAULT_ENABLEMENT.equals(name)) {
readDefaultEnablement(configurationElement);
}
- }
+ }
// merge enablement overrides from plugin_customization.ini
IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
@@ -180,20 +180,15 @@ final class ExtensionActivityRegistry extends AbstractActivityRegistry {
}
}
- // Removal of all defaultEnabledActivites which target to expression
- // controlled activities.
+ // Removal of all defaultEnabledActivites which target to expression
+ // controlled activities.
for (int i = 0; i < defaultEnabledActivities.size();) {
String id = defaultEnabledActivities.get(i);
ActivityDefinition activityDef = getActivityDefinitionById(id);
if (activityDef != null && activityDef.getEnabledWhen() != null) {
defaultEnabledActivities.remove(i);
- StatusManager
- .getManager()
- .handle(
- new Status(
- IStatus.WARNING,
- PlatformUI.PLUGIN_ID,
- "Default enabled activity declarations will be ignored (id: " + id + ")")); //$NON-NLS-1$ //$NON-NLS-2$
+ StatusManager.getManager().handle(new Status(IStatus.WARNING, PlatformUI.PLUGIN_ID,
+ "Default enabled activity declarations will be ignored (id: " + id + ")")); //$NON-NLS-1$ //$NON-NLS-2$
} else {
i++;
}
@@ -219,55 +214,50 @@ final class ExtensionActivityRegistry extends AbstractActivityRegistry {
}
}
- boolean activityRegistryChanged = false;
+ boolean activityRegistryChanged = false;
- if (!activityRequirementBindingDefinitions
- .equals(super.activityRequirementBindingDefinitions)) {
- super.activityRequirementBindingDefinitions = Collections
+ if (!activityRequirementBindingDefinitions.equals(super.activityRequirementBindingDefinitions)) {
+ super.activityRequirementBindingDefinitions = Collections
.unmodifiableList(new ArrayList<>(activityRequirementBindingDefinitions));
- activityRegistryChanged = true;
- }
+ activityRegistryChanged = true;
+ }
if (!activityDefinitions.equals(super.activityDefinitions)) {
super.activityDefinitions = Collections.unmodifiableList(new ArrayList<>(activityDefinitions));
activityRegistryChanged = true;
}
- if (!activityPatternBindingDefinitions
- .equals(super.activityPatternBindingDefinitions)) {
- super.activityPatternBindingDefinitions = Collections
+ if (!activityPatternBindingDefinitions.equals(super.activityPatternBindingDefinitions)) {
+ super.activityPatternBindingDefinitions = Collections
.unmodifiableList(new ArrayList<>(activityPatternBindingDefinitions));
- activityRegistryChanged = true;
- }
+ activityRegistryChanged = true;
+ }
- if (!categoryActivityBindingDefinitions
- .equals(super.categoryActivityBindingDefinitions)) {
- super.categoryActivityBindingDefinitions = Collections
+ if (!categoryActivityBindingDefinitions.equals(super.categoryActivityBindingDefinitions)) {
+ super.categoryActivityBindingDefinitions = Collections
.unmodifiableList(new ArrayList<>(categoryActivityBindingDefinitions));
- activityRegistryChanged = true;
- }
+ activityRegistryChanged = true;
+ }
- if (!categoryDefinitions.equals(super.categoryDefinitions)) {
- super.categoryDefinitions = Collections
- .unmodifiableList(new ArrayList<>(categoryDefinitions));
- activityRegistryChanged = true;
- }
+ if (!categoryDefinitions.equals(super.categoryDefinitions)) {
+ super.categoryDefinitions = Collections.unmodifiableList(new ArrayList<>(categoryDefinitions));
+ activityRegistryChanged = true;
+ }
if (!defaultEnabledActivities.equals(super.defaultEnabledActivities)) {
super.defaultEnabledActivities = Collections.unmodifiableList(new ArrayList<>(defaultEnabledActivities));
activityRegistryChanged = true;
}
- if (activityRegistryChanged) {
+ if (activityRegistryChanged) {
fireActivityRegistryChanged();
}
- }
+ }
/**
* Create the preference key for the activity.
*
- * @param activityId
- * the activity id.
+ * @param activityId the activity id.
* @return String a preference key representing the activity.
*/
private String createPreferenceKey(String activityId) {
@@ -284,38 +274,30 @@ final class ExtensionActivityRegistry extends AbstractActivityRegistry {
}
- private void readActivityRequirementBindingDefinition(
- IConfigurationElement configurationElement) {
- ActivityRequirementBindingDefinition activityRequirementBindingDefinition = Persistence
- .readActivityRequirementBindingDefinition(
- new ConfigurationElementMemento(configurationElement),
- getNamespace(configurationElement));
+ private void readActivityRequirementBindingDefinition(IConfigurationElement configurationElement) {
+ ActivityRequirementBindingDefinition activityRequirementBindingDefinition = Persistence
+ .readActivityRequirementBindingDefinition(new ConfigurationElementMemento(configurationElement),
+ getNamespace(configurationElement));
- if (activityRequirementBindingDefinition != null) {
- activityRequirementBindingDefinitions
- .add(activityRequirementBindingDefinition);
+ if (activityRequirementBindingDefinition != null) {
+ activityRequirementBindingDefinitions.add(activityRequirementBindingDefinition);
}
- }
-
- private void readActivityDefinition(
- IConfigurationElement configurationElement) {
- ActivityDefinition activityDefinition = Persistence
- .readActivityDefinition(new ConfigurationElementMemento(
- configurationElement),
- getNamespace(configurationElement));
-
- if (activityDefinition != null) {
- // this is not ideal, but core expressions takes an
- // IConfigurationElement or a w3c dom Document
+ }
+
+ private void readActivityDefinition(IConfigurationElement configurationElement) {
+ ActivityDefinition activityDefinition = Persistence.readActivityDefinition(
+ new ConfigurationElementMemento(configurationElement), getNamespace(configurationElement));
+
+ if (activityDefinition != null) {
+ // this is not ideal, but core expressions takes an
+ // IConfigurationElement or a w3c dom Document
IConfigurationElement[] enabledWhen = configurationElement
.getChildren(IWorkbenchRegistryConstants.TAG_ENABLED_WHEN);
if (enabledWhen.length == 1) {
- IConfigurationElement[] expElement = enabledWhen[0]
- .getChildren();
+ IConfigurationElement[] expElement = enabledWhen[0].getChildren();
if (expElement.length == 1) {
try {
- Expression expression = ExpressionConverter
- .getDefault().perform(expElement[0]);
+ Expression expression = ExpressionConverter.getDefault().perform(expElement[0]);
activityDefinition.setEnabledWhen(expression);
} catch (CoreException e) {
StatusManager.getManager().handle(e, WorkbenchPlugin.PI_WORKBENCH);
@@ -324,43 +306,34 @@ final class ExtensionActivityRegistry extends AbstractActivityRegistry {
}
activityDefinitions.add(activityDefinition);
}
- }
-
- private void readActivityPatternBindingDefinition(
- IConfigurationElement configurationElement) {
- ActivityPatternBindingDefinition activityPatternBindingDefinition = Persistence
- .readActivityPatternBindingDefinition(
- new ConfigurationElementMemento(configurationElement),
- getNamespace(configurationElement));
-
- if (activityPatternBindingDefinition != null) {
- activityPatternBindingDefinitions
- .add(activityPatternBindingDefinition);
+ }
+
+ private void readActivityPatternBindingDefinition(IConfigurationElement configurationElement) {
+ ActivityPatternBindingDefinition activityPatternBindingDefinition = Persistence
+ .readActivityPatternBindingDefinition(new ConfigurationElementMemento(configurationElement),
+ getNamespace(configurationElement));
+
+ if (activityPatternBindingDefinition != null) {
+ activityPatternBindingDefinitions.add(activityPatternBindingDefinition);
}
- }
-
- private void readCategoryActivityBindingDefinition(
- IConfigurationElement configurationElement) {
- CategoryActivityBindingDefinition categoryActivityBindingDefinition = Persistence
- .readCategoryActivityBindingDefinition(
- new ConfigurationElementMemento(configurationElement),
- getNamespace(configurationElement));
-
- if (categoryActivityBindingDefinition != null) {
- categoryActivityBindingDefinitions
- .add(categoryActivityBindingDefinition);
+ }
+
+ private void readCategoryActivityBindingDefinition(IConfigurationElement configurationElement) {
+ CategoryActivityBindingDefinition categoryActivityBindingDefinition = Persistence
+ .readCategoryActivityBindingDefinition(new ConfigurationElementMemento(configurationElement),
+ getNamespace(configurationElement));
+
+ if (categoryActivityBindingDefinition != null) {
+ categoryActivityBindingDefinitions.add(categoryActivityBindingDefinition);
}
- }
+ }
- private void readCategoryDefinition(
- IConfigurationElement configurationElement) {
- CategoryDefinition categoryDefinition = Persistence
- .readCategoryDefinition(new ConfigurationElementMemento(
- configurationElement),
- getNamespace(configurationElement));
+ private void readCategoryDefinition(IConfigurationElement configurationElement) {
+ CategoryDefinition categoryDefinition = Persistence.readCategoryDefinition(
+ new ConfigurationElementMemento(configurationElement), getNamespace(configurationElement));
- if (categoryDefinition != null) {
+ if (categoryDefinition != null) {
categoryDefinitions.add(categoryDefinition);
}
- }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/IActivityRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/IActivityRegistry.java
index dc69891bfc6..c42826035c0 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/IActivityRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/IActivityRegistry.java
@@ -18,8 +18,7 @@ import java.util.List;
public interface IActivityRegistry {
- void addActivityRegistryListener(
- IActivityRegistryListener activityRegistryListener);
+ void addActivityRegistryListener(IActivityRegistryListener activityRegistryListener);
List<ActivityRequirementBindingDefinition> getActivityRequirementBindingDefinitions();
@@ -33,6 +32,5 @@ public interface IActivityRegistry {
List<String> getDefaultEnabledActivities();
- void removeActivityRegistryListener(
- IActivityRegistryListener activityRegistryListener);
+ void removeActivityRegistryListener(IActivityRegistryListener activityRegistryListener);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/IActivityRegistryListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/IActivityRegistryListener.java
index 6b4dd520164..01d99ae04ce 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/IActivityRegistryListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/IActivityRegistryListener.java
@@ -16,5 +16,5 @@ package org.eclipse.ui.internal.activities;
public interface IActivityRegistryListener {
- void activityRegistryChanged(ActivityRegistryEvent activityRegistryEvent);
+ void activityRegistryChanged(ActivityRegistryEvent activityRegistryEvent);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/Identifier.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/Identifier.java
index 26143031b17..dc281a32bc7 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/Identifier.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/Identifier.java
@@ -25,178 +25,176 @@ import org.eclipse.ui.activities.IdentifierEvent;
import org.eclipse.ui.internal.util.Util;
final class Identifier implements IIdentifier {
- private static final int HASH_FACTOR = 89;
+ private static final int HASH_FACTOR = 89;
- private static final int HASH_INITIAL = Identifier.class.getName()
- .hashCode();
+ private static final int HASH_INITIAL = Identifier.class.getName().hashCode();
private static final Set<Identifier> strongReferences = new HashSet<>();
private Set<String> activityIds = Collections.emptySet();
- private transient String[] activityIdsAsArray = {};
+ private transient String[] activityIdsAsArray = {};
- private boolean enabled;
+ private boolean enabled;
- private transient int hashCode = HASH_INITIAL;
+ private transient int hashCode = HASH_INITIAL;
- private String id;
+ private String id;
private ListenerList<IIdentifierListener> identifierListeners;
- private transient String string;
+ private transient String string;
- Identifier(String id) {
- if (id == null) {
+ Identifier(String id) {
+ if (id == null) {
throw new NullPointerException();
}
- this.id = id;
- }
+ this.id = id;
+ }
- @Override
+ @Override
public void addIdentifierListener(IIdentifierListener identifierListener) {
- if (identifierListener == null) {
+ if (identifierListener == null) {
throw new NullPointerException();
}
- if (identifierListeners == null) {
+ if (identifierListeners == null) {
identifierListeners = new ListenerList<>(ListenerList.IDENTITY);
}
identifierListeners.add(identifierListener);
- strongReferences.add(this);
- }
+ strongReferences.add(this);
+ }
- @Override
+ @Override
public int compareTo(IIdentifier object) {
- Identifier castedObject = (Identifier) object;
- int compareTo = Util.compare(activityIdsAsArray,
- castedObject.activityIdsAsArray);
+ Identifier castedObject = (Identifier) object;
+ int compareTo = Util.compare(activityIdsAsArray, castedObject.activityIdsAsArray);
- if (compareTo == 0) {
- compareTo = Util.compare(enabled, castedObject.enabled);
+ if (compareTo == 0) {
+ compareTo = Util.compare(enabled, castedObject.enabled);
- if (compareTo == 0) {
+ if (compareTo == 0) {
compareTo = Util.compare(id, castedObject.id);
}
- }
+ }
- return compareTo;
- }
+ return compareTo;
+ }
- @Override
+ @Override
public boolean equals(Object object) {
- if (!(object instanceof Identifier)) {
+ if (!(object instanceof Identifier)) {
return false;
}
- final Identifier castedObject = (Identifier) object;
- if (!Util.equals(activityIds, castedObject.activityIds)) {
- return false;
- }
+ final Identifier castedObject = (Identifier) object;
+ if (!Util.equals(activityIds, castedObject.activityIds)) {
+ return false;
+ }
- if (!Util.equals(enabled, castedObject.enabled)) {
- return false;
- }
+ if (!Util.equals(enabled, castedObject.enabled)) {
+ return false;
+ }
- return Util.equals(id, castedObject.id);
- }
+ return Util.equals(id, castedObject.id);
+ }
- void fireIdentifierChanged(IdentifierEvent identifierEvent) {
- if (identifierEvent == null) {
+ void fireIdentifierChanged(IdentifierEvent identifierEvent) {
+ if (identifierEvent == null) {
throw new NullPointerException();
}
- if (identifierListeners != null) {
+ if (identifierListeners != null) {
for (IIdentifierListener listener : identifierListeners) {
listener.identifierChanged(identifierEvent);
}
}
- }
+ }
@Override
public Set<String> getActivityIds() {
- return activityIds;
- }
+ return activityIds;
+ }
- @Override
+ @Override
public String getId() {
- return id;
- }
+ return id;
+ }
- @Override
+ @Override
public int hashCode() {
- if (hashCode == HASH_INITIAL) {
- hashCode = hashCode * HASH_FACTOR + Util.hashCode(activityIds);
- hashCode = hashCode * HASH_FACTOR + Util.hashCode(enabled);
- hashCode = hashCode * HASH_FACTOR + Util.hashCode(id);
- if (hashCode == HASH_INITIAL) {
+ if (hashCode == HASH_INITIAL) {
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(activityIds);
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(enabled);
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(id);
+ if (hashCode == HASH_INITIAL) {
hashCode++;
}
- }
+ }
- return hashCode;
- }
+ return hashCode;
+ }
- @Override
+ @Override
public boolean isEnabled() {
- return enabled;
- }
+ return enabled;
+ }
- @Override
+ @Override
public void removeIdentifierListener(IIdentifierListener identifierListener) {
- if (identifierListener == null) {
+ if (identifierListener == null) {
throw new NullPointerException();
}
- if (identifierListeners != null) {
+ if (identifierListeners != null) {
identifierListeners.remove(identifierListener);
if (identifierListeners.isEmpty()) {
strongReferences.remove(this);
}
}
- }
+ }
boolean setActivityIds(Set<String> activityIds) {
activityIds = Util.safeCopy(activityIds, String.class);
- if (!Util.equals(activityIds, this.activityIds)) {
- this.activityIds = activityIds;
+ if (!Util.equals(activityIds, this.activityIds)) {
+ this.activityIds = activityIds;
this.activityIdsAsArray = this.activityIds.toArray(new String[this.activityIds.size()]);
- hashCode = HASH_INITIAL;
- string = null;
- return true;
- }
-
- return false;
- }
-
- boolean setEnabled(boolean enabled) {
- if (enabled != this.enabled) {
- this.enabled = enabled;
- hashCode = HASH_INITIAL;
- string = null;
- return true;
- }
-
- return false;
- }
-
- @Override
+ hashCode = HASH_INITIAL;
+ string = null;
+ return true;
+ }
+
+ return false;
+ }
+
+ boolean setEnabled(boolean enabled) {
+ if (enabled != this.enabled) {
+ this.enabled = enabled;
+ hashCode = HASH_INITIAL;
+ string = null;
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
public String toString() {
- if (string == null) {
- final StringBuilder stringBuffer = new StringBuilder();
- stringBuffer.append('[');
- stringBuffer.append(activityIds);
- stringBuffer.append(',');
- stringBuffer.append(enabled);
- stringBuffer.append(',');
- stringBuffer.append(id);
- stringBuffer.append(']');
- string = stringBuffer.toString();
- }
-
- return string;
- }
+ if (string == null) {
+ final StringBuilder stringBuffer = new StringBuilder();
+ stringBuffer.append('[');
+ stringBuffer.append(activityIds);
+ stringBuffer.append(',');
+ stringBuffer.append(enabled);
+ stringBuffer.append(',');
+ stringBuffer.append(id);
+ stringBuffer.append(']');
+ string = stringBuffer.toString();
+ }
+
+ return string;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/InternalActivityHelper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/InternalActivityHelper.java
index 3d321088e8c..78c20618ac3 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/InternalActivityHelper.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/InternalActivityHelper.java
@@ -40,8 +40,7 @@ import org.eclipse.ui.activities.ICategoryActivityBinding;
*/
public final class InternalActivityHelper {
- public static Set<String> getActivityIdsForCategory(
- IActivityManager activityManager, ICategory category) {
+ public static Set<String> getActivityIdsForCategory(IActivityManager activityManager, ICategory category) {
Set<ICategoryActivityBinding> bindings = category.getCategoryActivityBindings();
Set<String> activityIds = new HashSet<>();
for (Iterator<ICategoryActivityBinding> i = bindings.iterator(); i.hasNext();) {
@@ -79,8 +78,7 @@ public final class InternalActivityHelper {
return enabledCategories;
}
- public static Set<String> getPartiallyEnabledCategories(
- IActivityManager activityManager) {
+ public static Set<String> getPartiallyEnabledCategories(IActivityManager activityManager) {
Set<String> definedCategoryIds = activityManager.getDefinedCategoryIds();
Set<String> partialCategories = new HashSet<>();
for (Iterator<String> i = definedCategoryIds.iterator(); i.hasNext();) {
@@ -93,10 +91,8 @@ public final class InternalActivityHelper {
return partialCategories;
}
- private static boolean isPartiallyEnabled(IActivityManager activityManager,
- String categoryId) {
- Set<String> activityIds = getActivityIdsForCategory(activityManager,
- activityManager.getCategory(categoryId));
+ private static boolean isPartiallyEnabled(IActivityManager activityManager, String categoryId) {
+ Set<String> activityIds = getActivityIdsForCategory(activityManager, activityManager.getCategory(categoryId));
int foundCount = 0;
for (Iterator<String> i = activityIds.iterator(); i.hasNext();) {
String activityId = i.next();
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/MutableActivityManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/MutableActivityManager.java
index 033e44def2f..6733efef7cf 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/MutableActivityManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/MutableActivityManager.java
@@ -59,7 +59,7 @@ import org.eclipse.ui.services.IEvaluationService;
* @since 3.0
*/
public final class MutableActivityManager extends AbstractActivityManager
- implements IMutableActivityManager, Cloneable {
+ implements IMutableActivityManager, Cloneable {
private Map<String, Activity> activitiesById = new HashMap<>();
@@ -69,7 +69,7 @@ public final class MutableActivityManager extends AbstractActivityManager
private Map<String, Set<IActivityPatternBinding>> activityPatternBindingsByActivityId = new HashMap<>();
- private IActivityRegistry activityRegistry;
+ private IActivityRegistry activityRegistry;
private Map<String, Category> categoriesById = new HashMap<>();
@@ -85,190 +85,188 @@ public final class MutableActivityManager extends AbstractActivityManager
private Map<String, Identifier> identifiersById = new HashMap<>();
- /**
- * Avoid endless circular referencing of re-adding activity to evaluation
- * listener, because of adding it the first time to evaluation listener.
- */
- private boolean addingEvaluationListener = false;
+ /**
+ * Avoid endless circular referencing of re-adding activity to evaluation
+ * listener, because of adding it the first time to evaluation listener.
+ */
+ private boolean addingEvaluationListener = false;
- /**
- * A list of identifiers that need to have their activity sets reconciled in the background job.
- */
+ /**
+ * A list of identifiers that need to have their activity sets reconciled in the
+ * background job.
+ */
private List<Identifier> deferredIdentifiers = Collections.synchronizedList(new LinkedList<>());
- /**
- * The identifier update job. Lazily initialized.
- */
- private Job deferredIdentifierJob = null;
+ /**
+ * The identifier update job. Lazily initialized.
+ */
+ private Job deferredIdentifierJob = null;
private final IActivityRegistryListener activityRegistryListener = activityRegistryEvent -> readRegistry(false);
private Map<ActivityDefinition, IEvaluationReference> refsByActivityDefinition = new HashMap<>();
- /**
- * Create a new instance of this class using the platform extension registry.
- * @param triggerPointAdvisor
- */
- public MutableActivityManager(ITriggerPointAdvisor triggerPointAdvisor) {
- this(triggerPointAdvisor, new ExtensionActivityRegistry(Platform.getExtensionRegistry()));
- }
-
- /**
- * Create a new instance of this class using the provided registry.
- * @param triggerPointAdvisor
- *
- * @param activityRegistry the activity registry
- */
- public MutableActivityManager(ITriggerPointAdvisor triggerPointAdvisor, IActivityRegistry activityRegistry) {
- Assert.isNotNull(activityRegistry);
- Assert.isNotNull(triggerPointAdvisor);
-
- this.advisor = triggerPointAdvisor;
- this.activityRegistry = activityRegistry;
-
- this.activityRegistry
- .addActivityRegistryListener(activityRegistryListener);
-
- readRegistry(true);
- }
+ /**
+ * Create a new instance of this class using the platform extension registry.
+ *
+ * @param triggerPointAdvisor
+ */
+ public MutableActivityManager(ITriggerPointAdvisor triggerPointAdvisor) {
+ this(triggerPointAdvisor, new ExtensionActivityRegistry(Platform.getExtensionRegistry()));
+ }
+
+ /**
+ * Create a new instance of this class using the provided registry.
+ *
+ * @param triggerPointAdvisor
+ *
+ * @param activityRegistry the activity registry
+ */
+ public MutableActivityManager(ITriggerPointAdvisor triggerPointAdvisor, IActivityRegistry activityRegistry) {
+ Assert.isNotNull(activityRegistry);
+ Assert.isNotNull(triggerPointAdvisor);
+
+ this.advisor = triggerPointAdvisor;
+ this.activityRegistry = activityRegistry;
+
+ this.activityRegistry.addActivityRegistryListener(activityRegistryListener);
+
+ readRegistry(true);
+ }
@Override
synchronized public IActivity getActivity(String activityId) {
- if (activityId == null) {
+ if (activityId == null) {
throw new NullPointerException();
}
- Activity activity = activitiesById.get(activityId);
+ Activity activity = activitiesById.get(activityId);
- if (activity == null) {
- activity = new Activity(activityId);
- updateActivity(activity);
- activitiesById.put(activityId, activity);
- }
+ if (activity == null) {
+ activity = new Activity(activityId);
+ updateActivity(activity);
+ activitiesById.put(activityId, activity);
+ }
- return activity;
- }
+ return activity;
+ }
@Override
synchronized public ICategory getCategory(String categoryId) {
- if (categoryId == null) {
+ if (categoryId == null) {
throw new NullPointerException();
}
- Category category = categoriesById.get(categoryId);
+ Category category = categoriesById.get(categoryId);
- if (category == null) {
- category = new Category(categoryId);
- updateCategory(category);
- categoriesById.put(categoryId, category);
- }
+ if (category == null) {
+ category = new Category(categoryId);
+ updateCategory(category);
+ categoriesById.put(categoryId, category);
+ }
- return category;
- }
+ return category;
+ }
@Override
synchronized public Set<String> getDefinedActivityIds() {
- return Collections.unmodifiableSet(definedActivityIds);
- }
+ return Collections.unmodifiableSet(definedActivityIds);
+ }
@Override
synchronized public Set<String> getDefinedCategoryIds() {
- return Collections.unmodifiableSet(definedCategoryIds);
- }
+ return Collections.unmodifiableSet(definedCategoryIds);
+ }
@Override
synchronized public Set<String> getEnabledActivityIds() {
- return Collections.unmodifiableSet(enabledActivityIds);
- }
+ return Collections.unmodifiableSet(enabledActivityIds);
+ }
@Override
synchronized public IIdentifier getIdentifier(String identifierId) {
- if (identifierId == null) {
+ if (identifierId == null) {
throw new NullPointerException();
}
- Identifier identifier = identifiersById.get(identifierId);
+ Identifier identifier = identifiersById.get(identifierId);
- if (identifier == null) {
- identifier = new Identifier(identifierId);
- updateIdentifier(identifier);
- identifiersById.put(identifierId, identifier);
- }
+ if (identifier == null) {
+ identifier = new Identifier(identifierId);
+ updateIdentifier(identifier);
+ identifiersById.put(identifierId, identifier);
+ }
- return identifier;
- }
+ return identifier;
+ }
private void getRequiredActivityIds(Set<String> activityIds, Set<String> requiredActivityIds) {
for (Iterator<String> iterator = activityIds.iterator(); iterator.hasNext();) {
- String activityId = iterator.next();
- IActivity activity = getActivity(activityId);
+ String activityId = iterator.next();
+ IActivity activity = getActivity(activityId);
Set<String> childActivityIds = new HashSet<>();
- Set<IActivityRequirementBinding> activityRequirementBindings = activity
- .getActivityRequirementBindings();
+ Set<IActivityRequirementBinding> activityRequirementBindings = activity.getActivityRequirementBindings();
for (Iterator<IActivityRequirementBinding> iterator2 = activityRequirementBindings.iterator(); iterator2
- .hasNext();) {
- IActivityRequirementBinding activityRequirementBinding = iterator2
- .next();
- childActivityIds.add(activityRequirementBinding
- .getRequiredActivityId());
- }
-
- childActivityIds.removeAll(requiredActivityIds);
- requiredActivityIds.addAll(childActivityIds);
- getRequiredActivityIds(childActivityIds, requiredActivityIds);
- }
- }
+ .hasNext();) {
+ IActivityRequirementBinding activityRequirementBinding = iterator2.next();
+ childActivityIds.add(activityRequirementBinding.getRequiredActivityId());
+ }
+
+ childActivityIds.removeAll(requiredActivityIds);
+ requiredActivityIds.addAll(childActivityIds);
+ getRequiredActivityIds(childActivityIds, requiredActivityIds);
+ }
+ }
private void notifyActivities(Map<String, ActivityEvent> activityEventsByActivityId) {
for (Iterator<Map.Entry<String, ActivityEvent>> iterator = activityEventsByActivityId.entrySet()
- .iterator(); iterator.hasNext();) {
+ .iterator(); iterator.hasNext();) {
Entry<String, ActivityEvent> entry = iterator.next();
- String activityId = entry.getKey();
- ActivityEvent activityEvent = entry.getValue();
- Activity activity = activitiesById.get(activityId);
+ String activityId = entry.getKey();
+ ActivityEvent activityEvent = entry.getValue();
+ Activity activity = activitiesById.get(activityId);
- if (activity != null) {
+ if (activity != null) {
activity.fireActivityChanged(activityEvent);
}
- }
- }
+ }
+ }
private void notifyCategories(Map<String, CategoryEvent> categoryEventsByCategoryId) {
for (Iterator<Entry<String, CategoryEvent>> iterator = categoryEventsByCategoryId.entrySet()
- .iterator(); iterator.hasNext();) {
+ .iterator(); iterator.hasNext();) {
Entry<String, CategoryEvent> entry = iterator.next();
- String categoryId = entry.getKey();
- CategoryEvent categoryEvent = entry.getValue();
- Category category = categoriesById.get(categoryId);
+ String categoryId = entry.getKey();
+ CategoryEvent categoryEvent = entry.getValue();
+ Category category = categoriesById.get(categoryId);
- if (category != null) {
+ if (category != null) {
category.fireCategoryChanged(categoryEvent);
}
- }
- }
+ }
+ }
private void notifyIdentifiers(Map<String, IdentifierEvent> identifierEventsByIdentifierId) {
for (Iterator<Entry<String, IdentifierEvent>> iterator = identifierEventsByIdentifierId.entrySet()
- .iterator(); iterator.hasNext();) {
+ .iterator(); iterator.hasNext();) {
Entry<String, IdentifierEvent> entry = iterator.next();
String identifierId = entry.getKey();
IdentifierEvent identifierEvent = entry.getValue();
Identifier identifier = identifiersById.get(identifierId);
- if (identifier != null) {
+ if (identifier != null) {
identifier.fireIdentifierChanged(identifierEvent);
}
- }
- }
+ }
+ }
- private void readRegistry(boolean setDefaults) {
- clearExpressions();
+ private void readRegistry(boolean setDefaults) {
+ clearExpressions();
Collection<ActivityDefinition> activityDefinitions = new ArrayList<>();
- activityDefinitions.addAll(activityRegistry.getActivityDefinitions());
+ activityDefinitions.addAll(activityRegistry.getActivityDefinitions());
Map<String, ActivityDefinition> activityDefinitionsById = new HashMap<>(
- ActivityDefinition
- .activityDefinitionsById(activityDefinitions, false));
+ ActivityDefinition.activityDefinitionsById(activityDefinitions, false));
for (Iterator<ActivityDefinition> iterator = activityDefinitionsById.values().iterator(); iterator.hasNext();) {
ActivityDefinition activityDefinition = iterator.next();
@@ -280,10 +278,9 @@ public final class MutableActivityManager extends AbstractActivityManager
}
Collection<CategoryDefinition> categoryDefinitions = new ArrayList<>();
- categoryDefinitions.addAll(activityRegistry.getCategoryDefinitions());
+ categoryDefinitions.addAll(activityRegistry.getCategoryDefinitions());
Map<String, CategoryDefinition> categoryDefinitionsById = new HashMap<>(
- CategoryDefinition
- .categoryDefinitionsById(categoryDefinitions, false));
+ CategoryDefinition.categoryDefinitionsById(categoryDefinitions, false));
for (Iterator<CategoryDefinition> iterator = categoryDefinitionsById.values().iterator(); iterator.hasNext();) {
CategoryDefinition categoryDefinition = iterator.next();
@@ -295,29 +292,28 @@ public final class MutableActivityManager extends AbstractActivityManager
}
Map<String, Collection<ActivityRequirementBindingDefinition>> activityRequirementBindingDefinitionsByActivityId = ActivityRequirementBindingDefinition
- .activityRequirementBindingDefinitionsByActivityId(activityRegistry
- .getActivityRequirementBindingDefinitions());
+ .activityRequirementBindingDefinitionsByActivityId(
+ activityRegistry.getActivityRequirementBindingDefinitions());
Map<String, Set<IActivityRequirementBinding>> activityRequirementBindingsByActivityId = new HashMap<>();
for (Iterator<Entry<String, Collection<ActivityRequirementBindingDefinition>>> iterator = activityRequirementBindingDefinitionsByActivityId
- .entrySet().iterator(); iterator.hasNext();) {
+ .entrySet().iterator(); iterator.hasNext();) {
Entry<String, Collection<ActivityRequirementBindingDefinition>> entry = iterator.next();
- String parentActivityId = entry.getKey();
+ String parentActivityId = entry.getKey();
- if (activityDefinitionsById.containsKey(parentActivityId)) {
+ if (activityDefinitionsById.containsKey(parentActivityId)) {
Collection<ActivityRequirementBindingDefinition> activityRequirementBindingDefinitions = entry
.getValue();
- if (activityRequirementBindingDefinitions != null) {
+ if (activityRequirementBindingDefinitions != null) {
for (Iterator<ActivityRequirementBindingDefinition> iterator2 = activityRequirementBindingDefinitions
.iterator(); iterator2.hasNext();) {
ActivityRequirementBindingDefinition activityRequirementBindingDefinition = iterator2.next();
String childActivityId = activityRequirementBindingDefinition.getRequiredActivityId();
- if (activityDefinitionsById
- .containsKey(childActivityId)) {
- IActivityRequirementBinding activityRequirementBinding = new ActivityRequirementBinding(
- childActivityId, parentActivityId);
+ if (activityDefinitionsById.containsKey(childActivityId)) {
+ IActivityRequirementBinding activityRequirementBinding = new ActivityRequirementBinding(
+ childActivityId, parentActivityId);
Set<IActivityRequirementBinding> activityRequirementBindings = activityRequirementBindingsByActivityId
.get(parentActivityId);
@@ -329,66 +325,63 @@ public final class MutableActivityManager extends AbstractActivityManager
activityRequirementBindings.add(activityRequirementBinding);
}
- }
+ }
}
- }
- }
+ }
+ }
Map<String, Collection<ActivityPatternBindingDefinition>> activityPatternBindingDefinitionsByActivityId = ActivityPatternBindingDefinition
- .activityPatternBindingDefinitionsByActivityId(activityRegistry
- .getActivityPatternBindingDefinitions());
+ .activityPatternBindingDefinitionsByActivityId(activityRegistry.getActivityPatternBindingDefinitions());
Map<String, Set<IActivityPatternBinding>> activityPatternBindingsByActivityId = new HashMap<>();
for (Iterator<Entry<String, Collection<ActivityPatternBindingDefinition>>> iterator = activityPatternBindingDefinitionsByActivityId
- .entrySet().iterator(); iterator.hasNext();) {
+ .entrySet().iterator(); iterator.hasNext();) {
Entry<String, Collection<ActivityPatternBindingDefinition>> entry = iterator.next();
- String activityId = entry.getKey();
+ String activityId = entry.getKey();
- if (activityDefinitionsById.containsKey(activityId)) {
- Collection<ActivityPatternBindingDefinition> activityPatternBindingDefinitions = entry
- .getValue();
+ if (activityDefinitionsById.containsKey(activityId)) {
+ Collection<ActivityPatternBindingDefinition> activityPatternBindingDefinitions = entry.getValue();
- if (activityPatternBindingDefinitions != null) {
+ if (activityPatternBindingDefinitions != null) {
for (Iterator<ActivityPatternBindingDefinition> iterator2 = activityPatternBindingDefinitions
- .iterator(); iterator2.hasNext();) {
+ .iterator(); iterator2.hasNext();) {
ActivityPatternBindingDefinition activityPatternBindingDefinition = iterator2.next();
String pattern = activityPatternBindingDefinition.getPattern();
- if (pattern != null && pattern.length() != 0) {
+ if (pattern != null && pattern.length() != 0) {
IActivityPatternBinding activityPatternBinding = new ActivityPatternBinding(activityId,
pattern, activityPatternBindingDefinition.isEqualityPattern());
Set<IActivityPatternBinding> activityPatternBindings = activityPatternBindingsByActivityId
.get(activityId);
- if (activityPatternBindings == null) {
+ if (activityPatternBindings == null) {
activityPatternBindings = new HashSet<>();
activityPatternBindingsByActivityId.put(activityId, activityPatternBindings);
- }
+ }
- activityPatternBindings.add(activityPatternBinding);
- }
- }
+ activityPatternBindings.add(activityPatternBinding);
+ }
+ }
}
- }
- }
+ }
+ }
Map<String, Collection<CategoryActivityBindingDefinition>> categoryActivityBindingDefinitionsByCategoryId = CategoryActivityBindingDefinition
- .categoryActivityBindingDefinitionsByCategoryId(activityRegistry
- .getCategoryActivityBindingDefinitions());
+ .categoryActivityBindingDefinitionsByCategoryId(
+ activityRegistry.getCategoryActivityBindingDefinitions());
Map<String, Set<ICategoryActivityBinding>> categoryActivityBindingsByCategoryId = new HashMap<>();
for (Iterator<Entry<String, Collection<CategoryActivityBindingDefinition>>> iterator = categoryActivityBindingDefinitionsByCategoryId
- .entrySet().iterator(); iterator.hasNext();) {
+ .entrySet().iterator(); iterator.hasNext();) {
Entry<String, Collection<CategoryActivityBindingDefinition>> entry = iterator.next();
- String categoryId = entry.getKey();
+ String categoryId = entry.getKey();
- if (categoryDefinitionsById.containsKey(categoryId)) {
- Collection<CategoryActivityBindingDefinition> categoryActivityBindingDefinitions = entry
- .getValue();
+ if (categoryDefinitionsById.containsKey(categoryId)) {
+ Collection<CategoryActivityBindingDefinition> categoryActivityBindingDefinitions = entry.getValue();
- if (categoryActivityBindingDefinitions != null) {
+ if (categoryActivityBindingDefinitions != null) {
for (Iterator<CategoryActivityBindingDefinition> iterator2 = categoryActivityBindingDefinitions
- .iterator(); iterator2.hasNext();) {
+ .iterator(); iterator2.hasNext();) {
CategoryActivityBindingDefinition categoryActivityBindingDefinition = iterator2.next();
String activityId = categoryActivityBindingDefinition.getActivityId();
@@ -405,46 +398,46 @@ public final class MutableActivityManager extends AbstractActivityManager
categoryActivityBindings.add(categoryActivityBinding);
}
- }
+ }
}
- }
- }
-
- this.activityRequirementBindingsByActivityId = activityRequirementBindingsByActivityId;
- this.activityDefinitionsById = activityDefinitionsById;
- this.activityPatternBindingsByActivityId = activityPatternBindingsByActivityId;
- this.categoryActivityBindingsByCategoryId = categoryActivityBindingsByCategoryId;
- this.categoryDefinitionsById = categoryDefinitionsById;
- boolean definedActivityIdsChanged = false;
+ }
+ }
+
+ this.activityRequirementBindingsByActivityId = activityRequirementBindingsByActivityId;
+ this.activityDefinitionsById = activityDefinitionsById;
+ this.activityPatternBindingsByActivityId = activityPatternBindingsByActivityId;
+ this.categoryActivityBindingsByCategoryId = categoryActivityBindingsByCategoryId;
+ this.categoryDefinitionsById = categoryDefinitionsById;
+ boolean definedActivityIdsChanged = false;
Set<String> definedActivityIds = new HashSet<>(activityDefinitionsById.keySet());
Set<String> previouslyDefinedActivityIds = null;
- if (!definedActivityIds.equals(this.definedActivityIds)) {
- previouslyDefinedActivityIds = this.definedActivityIds;
- this.definedActivityIds = definedActivityIds;
- definedActivityIdsChanged = true;
- }
+ if (!definedActivityIds.equals(this.definedActivityIds)) {
+ previouslyDefinedActivityIds = this.definedActivityIds;
+ this.definedActivityIds = definedActivityIds;
+ definedActivityIdsChanged = true;
+ }
- boolean definedCategoryIdsChanged = false;
+ boolean definedCategoryIdsChanged = false;
Set<String> definedCategoryIds = new HashSet<>(categoryDefinitionsById.keySet());
Set<String> previouslyDefinedCategoryIds = null;
- if (!definedCategoryIds.equals(this.definedCategoryIds)) {
- previouslyDefinedCategoryIds = this.definedCategoryIds;
- this.definedCategoryIds = definedCategoryIds;
- definedCategoryIdsChanged = true;
- }
+ if (!definedCategoryIds.equals(this.definedCategoryIds)) {
+ previouslyDefinedCategoryIds = this.definedCategoryIds;
+ this.definedCategoryIds = definedCategoryIds;
+ definedCategoryIdsChanged = true;
+ }
Set<String> enabledActivityIds = new HashSet<>(this.enabledActivityIds);
- getRequiredActivityIds(this.enabledActivityIds, enabledActivityIds);
- boolean enabledActivityIdsChanged = false;
+ getRequiredActivityIds(this.enabledActivityIds, enabledActivityIds);
+ boolean enabledActivityIdsChanged = false;
Set<String> previouslyEnabledActivityIds = null;
- if (!this.enabledActivityIds.equals(enabledActivityIds)) {
- previouslyEnabledActivityIds = this.enabledActivityIds;
- this.enabledActivityIds = enabledActivityIds;
- enabledActivityIdsChanged = true;
- }
+ if (!this.enabledActivityIds.equals(enabledActivityIds)) {
+ previouslyEnabledActivityIds = this.enabledActivityIds;
+ this.enabledActivityIds = enabledActivityIds;
+ enabledActivityIdsChanged = true;
+ }
Map<String, ActivityEvent> activityEventsByActivityId = updateActivities(activitiesById.keySet());
@@ -452,35 +445,31 @@ public final class MutableActivityManager extends AbstractActivityManager
Map<String, IdentifierEvent> identifierEventsByIdentifierId = updateIdentifiers(identifiersById.keySet());
- if (definedActivityIdsChanged || definedCategoryIdsChanged
- || enabledActivityIdsChanged) {
- fireActivityManagerChanged(new ActivityManagerEvent(this,
- definedActivityIdsChanged, definedCategoryIdsChanged,
- enabledActivityIdsChanged, previouslyDefinedActivityIds,
- previouslyDefinedCategoryIds, previouslyEnabledActivityIds));
+ if (definedActivityIdsChanged || definedCategoryIdsChanged || enabledActivityIdsChanged) {
+ fireActivityManagerChanged(new ActivityManagerEvent(this, definedActivityIdsChanged,
+ definedCategoryIdsChanged, enabledActivityIdsChanged, previouslyDefinedActivityIds,
+ previouslyDefinedCategoryIds, previouslyEnabledActivityIds));
}
- if (activityEventsByActivityId != null) {
+ if (activityEventsByActivityId != null) {
notifyActivities(activityEventsByActivityId);
}
- if (categoryEventsByCategoryId != null) {
+ if (categoryEventsByCategoryId != null) {
notifyCategories(categoryEventsByCategoryId);
}
- if (identifierEventsByIdentifierId != null) {
+ if (identifierEventsByIdentifierId != null) {
notifyIdentifiers(identifierEventsByIdentifierId);
}
- if (setDefaults) {
- setEnabledActivityIds(new HashSet<>(activityRegistry
- .getDefaultEnabledActivities()));
- }
- }
+ if (setDefaults) {
+ setEnabledActivityIds(new HashSet<>(activityRegistry.getDefaultEnabledActivities()));
+ }
+ }
private void clearExpressions() {
- IEvaluationService evaluationService = PlatformUI
- .getWorkbench().getService(IEvaluationService.class);
+ IEvaluationService evaluationService = PlatformUI.getWorkbench().getService(IEvaluationService.class);
Iterator<IEvaluationReference> i = refsByActivityDefinition.values().iterator();
while (i.hasNext()) {
IEvaluationReference ref = i.next();
@@ -493,53 +482,53 @@ public final class MutableActivityManager extends AbstractActivityManager
synchronized public void setEnabledActivityIds(Set<String> enabledActivityIds) {
enabledActivityIds = new HashSet<>(enabledActivityIds);
Set<String> requiredActivityIds = new HashSet<>(enabledActivityIds);
- getRequiredActivityIds(enabledActivityIds, requiredActivityIds);
- enabledActivityIds = requiredActivityIds;
+ getRequiredActivityIds(enabledActivityIds, requiredActivityIds);
+ enabledActivityIds = requiredActivityIds;
Set<String> deltaActivityIds = null;
- boolean activityManagerChanged = false;
+ boolean activityManagerChanged = false;
Map<String, ActivityEvent> activityEventsByActivityId = null;
Set<String> previouslyEnabledActivityIds = null;
- // the sets are different so there may be work to do.
- if (!this.enabledActivityIds.equals(enabledActivityIds)) {
- previouslyEnabledActivityIds = this.enabledActivityIds;
- activityManagerChanged = true;
+ // the sets are different so there may be work to do.
+ if (!this.enabledActivityIds.equals(enabledActivityIds)) {
+ previouslyEnabledActivityIds = this.enabledActivityIds;
+ activityManagerChanged = true;
- // break out the additions to the current set
+ // break out the additions to the current set
Set<String> additions = new HashSet<>(enabledActivityIds);
- additions.removeAll(previouslyEnabledActivityIds);
+ additions.removeAll(previouslyEnabledActivityIds);
- // and the removals
+ // and the removals
Set<String> removals = new HashSet<>(previouslyEnabledActivityIds);
- removals.removeAll(enabledActivityIds);
+ removals.removeAll(enabledActivityIds);
- // remove from each set the expression-activities
- removeExpressionControlledActivities(additions);
- removeExpressionControlledActivities(removals);
+ // remove from each set the expression-activities
+ removeExpressionControlledActivities(additions);
+ removeExpressionControlledActivities(removals);
- // merge the two sets into one delta - these are the changes that
+ // merge the two sets into one delta - these are the changes that
// need to be made after taking expressions into account
deltaActivityIds = new HashSet<>(additions);
- deltaActivityIds.addAll(removals);
+ deltaActivityIds.addAll(removals);
- if (deltaActivityIds.size() > 0) {
- // instead of blowing away the old set with the new we will
+ if (deltaActivityIds.size() > 0) {
+ // instead of blowing away the old set with the new we will
// instead modify it based on the deltas
- // add in all the new activities to the current set
- enabledActivityIds.addAll(additions);
- // and remove the stale ones
- enabledActivityIds.removeAll(removals);
- // finally set the internal set of activities
- this.enabledActivityIds = enabledActivityIds;
+ // add in all the new activities to the current set
+ enabledActivityIds.addAll(additions);
+ // and remove the stale ones
+ enabledActivityIds.removeAll(removals);
+ // finally set the internal set of activities
+ this.enabledActivityIds = enabledActivityIds;
activityEventsByActivityId = updateActivities(deltaActivityIds);
} else {
return;
}
- }
+ }
- updateListeners(activityManagerChanged, activityEventsByActivityId,
- deltaActivityIds, previouslyEnabledActivityIds);
- }
+ updateListeners(activityManagerChanged, activityEventsByActivityId, deltaActivityIds,
+ previouslyEnabledActivityIds);
+ }
/**
* Updates all the listeners to changes in the state.
@@ -549,24 +538,23 @@ public final class MutableActivityManager extends AbstractActivityManager
* @param deltaActivityIds
* @param previouslyEnabledActivityIds
*/
- private void updateListeners(boolean activityManagerChanged,
- Map<String, ActivityEvent> activityEventsByActivityId, Set<String> deltaActivityIds,
- Set<String> previouslyEnabledActivityIds) {
+ private void updateListeners(boolean activityManagerChanged, Map<String, ActivityEvent> activityEventsByActivityId,
+ Set<String> deltaActivityIds, Set<String> previouslyEnabledActivityIds) {
// don't update identifiers if the enabled activity set has not changed
- if (activityManagerChanged) {
- Map<String, IdentifierEvent> identifierEventsByIdentifierId = updateIdentifiers(identifiersById
- .keySet(), deltaActivityIds);
- if (identifierEventsByIdentifierId != null) {
+ if (activityManagerChanged) {
+ Map<String, IdentifierEvent> identifierEventsByIdentifierId = updateIdentifiers(identifiersById.keySet(),
+ deltaActivityIds);
+ if (identifierEventsByIdentifierId != null) {
notifyIdentifiers(identifierEventsByIdentifierId);
}
- }
- if (activityEventsByActivityId != null) {
+ }
+ if (activityEventsByActivityId != null) {
notifyActivities(activityEventsByActivityId);
}
- if (activityManagerChanged) {
- fireActivityManagerChanged(new ActivityManagerEvent(this, false,
- false, true, null, null, previouslyEnabledActivityIds));
+ if (activityManagerChanged) {
+ fireActivityManagerChanged(
+ new ActivityManagerEvent(this, false, false, true, null, null, previouslyEnabledActivityIds));
}
}
@@ -588,19 +576,17 @@ public final class MutableActivityManager extends AbstractActivityManager
* @param id
* @param previouslyEnabledActivityIds
*/
- private void updateExpressionEnabledActivities(String id,
- Set<String> previouslyEnabledActivityIds) {
+ private void updateExpressionEnabledActivities(String id, Set<String> previouslyEnabledActivityIds) {
Set<String> deltaActivityIds = new HashSet<>();
deltaActivityIds.add(id);
Map<String, ActivityEvent> activityEventsByActivityId = updateActivities(deltaActivityIds);
- updateListeners(true, activityEventsByActivityId, deltaActivityIds,
- previouslyEnabledActivityIds);
+ updateListeners(true, activityEventsByActivityId, deltaActivityIds, previouslyEnabledActivityIds);
}
-
/**
- * Removes from a list of activity changes all those that are based on expressions
+ * Removes from a list of activity changes all those that are based on
+ * expressions
*
* @param delta the set to modify
*/
@@ -621,20 +607,20 @@ public final class MutableActivityManager extends AbstractActivityManager
Map<String, ActivityEvent> activityEventsByActivityId = new TreeMap<>();
for (Iterator<String> iterator = activityIds.iterator(); iterator.hasNext();) {
- String activityId = iterator.next();
- Activity activity = activitiesById.get(activityId);
+ String activityId = iterator.next();
+ Activity activity = activitiesById.get(activityId);
- if (activity != null) {
- ActivityEvent activityEvent = updateActivity(activity);
+ if (activity != null) {
+ ActivityEvent activityEvent = updateActivity(activity);
- if (activityEvent != null) {
+ if (activityEvent != null) {
activityEventsByActivityId.put(activityId, activityEvent);
}
- }
- }
+ }
+ }
- return activityEventsByActivityId;
- }
+ return activityEventsByActivityId;
+ }
private IPropertyChangeListener enabledWhenListener = event -> {
if (addingEvaluationListener) {
@@ -656,36 +642,29 @@ public final class MutableActivityManager extends AbstractActivityManager
private ITriggerPointAdvisor advisor;
- private ActivityEvent updateActivity(Activity activity) {
+ private ActivityEvent updateActivity(Activity activity) {
Set<IActivityRequirementBinding> activityRequirementBindings = activityRequirementBindingsByActivityId
- .get(activity.getId());
- boolean activityRequirementBindingsChanged = activity
- .setActivityRequirementBindings(activityRequirementBindings != null ? activityRequirementBindings
- : Collections.emptySet());
+ .get(activity.getId());
+ boolean activityRequirementBindingsChanged = activity.setActivityRequirementBindings(
+ activityRequirementBindings != null ? activityRequirementBindings : Collections.emptySet());
Set<IActivityPatternBinding> activityPatternBindings = activityPatternBindingsByActivityId
- .get(activity.getId());
- boolean activityPatternBindingsChanged = activity
- .setActivityPatternBindings(activityPatternBindings != null ? activityPatternBindings
- : Collections.emptySet());
- ActivityDefinition activityDefinition = activityDefinitionsById
- .get(activity.getId());
- boolean definedChanged = activity
- .setDefined(activityDefinition != null);
-
- // enabledWhen comes into play
- IEvaluationReference ref = refsByActivityDefinition
- .get(activityDefinition);
- IEvaluationService evaluationService = PlatformUI
- .getWorkbench().getService(IEvaluationService.class);
+ .get(activity.getId());
+ boolean activityPatternBindingsChanged = activity.setActivityPatternBindings(
+ activityPatternBindings != null ? activityPatternBindings : Collections.emptySet());
+ ActivityDefinition activityDefinition = activityDefinitionsById.get(activity.getId());
+ boolean definedChanged = activity.setDefined(activityDefinition != null);
+
+ // enabledWhen comes into play
+ IEvaluationReference ref = refsByActivityDefinition.get(activityDefinition);
+ IEvaluationService evaluationService = PlatformUI.getWorkbench().getService(IEvaluationService.class);
boolean newRef = false;
- if (activityDefinition != null && evaluationService!=null) {
+ if (activityDefinition != null && evaluationService != null) {
activity.setExpression(activityDefinition.getEnabledWhen());
- if (ref == null && activityDefinition.getEnabledWhen()!=null) {
+ if (ref == null && activityDefinition.getEnabledWhen() != null) {
addingEvaluationListener = true;
try {
- ref = evaluationService.addEvaluationListener(
- activityDefinition.getEnabledWhen(),
- enabledWhenListener, activityDefinition.getId());
+ ref = evaluationService.addEvaluationListener(activityDefinition.getEnabledWhen(),
+ enabledWhenListener, activityDefinition.getId());
newRef = true;
} finally {
addingEvaluationListener = false;
@@ -696,9 +675,8 @@ public final class MutableActivityManager extends AbstractActivityManager
}
}
final boolean enabledChanged;
- if (ref != null && evaluationService!=null) {
- enabledChanged = activity.setEnabled(ref.evaluate(evaluationService
- .getCurrentState()));
+ if (ref != null && evaluationService != null) {
+ enabledChanged = activity.setEnabled(ref.evaluate(evaluationService.getCurrentState()));
if (newRef && activity.isEnabled()) {
// make sure this activity is in the enabled set for this
// manager - event firing will be handled by the caller to this
@@ -706,51 +684,43 @@ public final class MutableActivityManager extends AbstractActivityManager
this.enabledActivityIds.add(activity.getId());
}
} else {
- enabledChanged = activity.setEnabled(enabledActivityIds
- .contains(activity.getId()));
- }
-
- boolean nameChanged = activity
- .setName(activityDefinition != null ? activityDefinition
- .getName() : null);
- boolean descriptionChanged = activity
- .setDescription(activityDefinition != null ? activityDefinition
- .getDescription() : null);
- boolean defaultEnabledChanged = activity.setDefaultEnabled(activityRegistry
- .getDefaultEnabledActivities().contains(activity.getId()));
- if (activityRequirementBindingsChanged
- || activityPatternBindingsChanged || definedChanged
- || enabledChanged || nameChanged || descriptionChanged
- || defaultEnabledChanged) {
- return new ActivityEvent(activity,
- activityRequirementBindingsChanged,
- activityPatternBindingsChanged, definedChanged,
- descriptionChanged, enabledChanged, nameChanged, defaultEnabledChanged);
- }
-
- return null;
- }
+ enabledChanged = activity.setEnabled(enabledActivityIds.contains(activity.getId()));
+ }
+
+ boolean nameChanged = activity.setName(activityDefinition != null ? activityDefinition.getName() : null);
+ boolean descriptionChanged = activity
+ .setDescription(activityDefinition != null ? activityDefinition.getDescription() : null);
+ boolean defaultEnabledChanged = activity
+ .setDefaultEnabled(activityRegistry.getDefaultEnabledActivities().contains(activity.getId()));
+ if (activityRequirementBindingsChanged || activityPatternBindingsChanged || definedChanged || enabledChanged
+ || nameChanged || descriptionChanged || defaultEnabledChanged) {
+ return new ActivityEvent(activity, activityRequirementBindingsChanged, activityPatternBindingsChanged,
+ definedChanged, descriptionChanged, enabledChanged, nameChanged, defaultEnabledChanged);
+ }
+
+ return null;
+ }
private Map<String, CategoryEvent> updateCategories(Collection<String> categoryIds) {
Map<String, CategoryEvent> categoryEventsByCategoryId = new TreeMap<>();
for (Iterator<String> iterator = categoryIds.iterator(); iterator.hasNext();) {
- String categoryId = iterator.next();
- Category category = categoriesById.get(categoryId);
+ String categoryId = iterator.next();
+ Category category = categoriesById.get(categoryId);
- if (category != null) {
- CategoryEvent categoryEvent = updateCategory(category);
+ if (category != null) {
+ CategoryEvent categoryEvent = updateCategory(category);
- if (categoryEvent != null) {
+ if (categoryEvent != null) {
categoryEventsByCategoryId.put(categoryId, categoryEvent);
}
- }
- }
+ }
+ }
- return categoryEventsByCategoryId;
- }
+ return categoryEventsByCategoryId;
+ }
- private CategoryEvent updateCategory(Category category) {
+ private CategoryEvent updateCategory(Category category) {
Set<ICategoryActivityBinding> categoryActivityBindings = categoryActivityBindingsByCategoryId
.get(category.getId());
boolean categoryActivityBindingsChanged = category.setCategoryActivityBindings(
@@ -767,68 +737,65 @@ public final class MutableActivityManager extends AbstractActivityManager
}
return null;
- }
+ }
- private IdentifierEvent updateIdentifier(Identifier identifier) {
- return updateIdentifier(identifier, definedActivityIds);
- }
+ private IdentifierEvent updateIdentifier(Identifier identifier) {
+ return updateIdentifier(identifier, definedActivityIds);
+ }
private IdentifierEvent updateIdentifier(Identifier identifier, Set<String> changedActivityIds) {
- String id = identifier.getId();
+ String id = identifier.getId();
Set<String> activityIds = new HashSet<>();
- boolean enabled = false;
+ boolean enabled = false;
- boolean activityIdsChanged = false;
+ boolean activityIdsChanged = false;
- boolean enabledChanged = false;
+ boolean enabledChanged = false;
- // short-circut logic. If all activities are enabled, then the
- // identifier must be as well. Return true and schedule the remainder of
- // the work to run in a background job.
- if (enabledActivityIds.size() == definedActivityIds.size()) {
- enabled = true;
- enabledChanged = identifier.setEnabled(enabled);
- identifier.setActivityIds(Collections.EMPTY_SET);
- deferredIdentifiers.add(identifier);
- getUpdateJob().schedule();
- if (enabledChanged) {
- return new IdentifierEvent(identifier, activityIdsChanged,
- enabledChanged);
+ // short-circut logic. If all activities are enabled, then the
+ // identifier must be as well. Return true and schedule the remainder of
+ // the work to run in a background job.
+ if (enabledActivityIds.size() == definedActivityIds.size()) {
+ enabled = true;
+ enabledChanged = identifier.setEnabled(enabled);
+ identifier.setActivityIds(Collections.EMPTY_SET);
+ deferredIdentifiers.add(identifier);
+ getUpdateJob().schedule();
+ if (enabledChanged) {
+ return new IdentifierEvent(identifier, activityIdsChanged, enabledChanged);
}
- } else {
+ } else {
Set<String> activityIdsToUpdate = new HashSet<>(changedActivityIds);
- if (identifier.getActivityIds() != null) {
- activityIdsToUpdate.addAll(identifier.getActivityIds());
- }
- for (Iterator<String> iterator = activityIdsToUpdate.iterator(); iterator
- .hasNext();) {
- String activityId = iterator.next();
- Activity activity = (Activity) getActivity(activityId);
-
- if (activity.isMatch(id)) {
- activityIds.add(activityId);
- }
- }
-
- activityIdsChanged = identifier.setActivityIds(activityIds);
-
- if (advisor != null) {
- enabled = advisor.computeEnablement(this, identifier);
- }
- enabledChanged = identifier.setEnabled(enabled);
-
- if (activityIdsChanged || enabledChanged) {
- return new IdentifierEvent(identifier, activityIdsChanged,
- enabledChanged);
+ if (identifier.getActivityIds() != null) {
+ activityIdsToUpdate.addAll(identifier.getActivityIds());
}
- }
- return null;
- }
+ for (Iterator<String> iterator = activityIdsToUpdate.iterator(); iterator.hasNext();) {
+ String activityId = iterator.next();
+ Activity activity = (Activity) getActivity(activityId);
+
+ if (activity.isMatch(id)) {
+ activityIds.add(activityId);
+ }
+ }
+
+ activityIdsChanged = identifier.setActivityIds(activityIds);
+
+ if (advisor != null) {
+ enabled = advisor.computeEnablement(this, identifier);
+ }
+ enabledChanged = identifier.setEnabled(enabled);
+
+ if (activityIdsChanged || enabledChanged) {
+ return new IdentifierEvent(identifier, activityIdsChanged, enabledChanged);
+ }
+ }
+ return null;
+ }
private Map<String, IdentifierEvent> updateIdentifiers(Collection<String> identifierIds) {
- return updateIdentifiers(identifierIds, definedActivityIds);
- }
+ return updateIdentifiers(identifierIds, definedActivityIds);
+ }
private Map<String, IdentifierEvent> updateIdentifiers(Collection<String> identifierIds,
Set<String> changedActivityIds) {
@@ -850,30 +817,30 @@ public final class MutableActivityManager extends AbstractActivityManager
return identifierEventsByIdentifierId;
}
- /**
- * Unhook this manager from its registry.
- *
- * @since 3.1
- */
- public void unhookRegistryListeners() {
- activityRegistry.removeActivityRegistryListener(activityRegistryListener);
- }
+ /**
+ * Unhook this manager from its registry.
+ *
+ * @since 3.1
+ */
+ public void unhookRegistryListeners() {
+ activityRegistry.removeActivityRegistryListener(activityRegistryListener);
+ }
@Override
synchronized public Object clone() {
- MutableActivityManager clone = new MutableActivityManager(advisor, activityRegistry);
- clone.setEnabledActivityIds(getEnabledActivityIds());
- return clone;
- }
-
- /**
- * Return the identifier update job.
- *
- * @return the job
- * @since 3.1
- */
- private Job getUpdateJob() {
- if (deferredIdentifierJob == null) {
+ MutableActivityManager clone = new MutableActivityManager(advisor, activityRegistry);
+ clone.setEnabledActivityIds(getEnabledActivityIds());
+ return clone;
+ }
+
+ /**
+ * Return the identifier update job.
+ *
+ * @return the job
+ * @since 3.1
+ */
+ private Job getUpdateJob() {
+ if (deferredIdentifierJob == null) {
deferredIdentifierJob = Job.create("Activity Identifier Update", (IJobFunction) monitor -> { //$NON-NLS-1$
final Map<String, IdentifierEvent> identifierEventsByIdentifierId = new HashMap<>();
@@ -908,9 +875,9 @@ public final class MutableActivityManager extends AbstractActivityManager
}
return Status.OK_STATUS;
});
- deferredIdentifierJob.setSystem(true);
- }
- return deferredIdentifierJob;
- }
+ deferredIdentifierJob.setSystem(true);
+ }
+ return deferredIdentifierJob;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/PatternUtil.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/PatternUtil.java
index 6d2386efe0b..08c6e96a03b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/PatternUtil.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/PatternUtil.java
@@ -24,21 +24,21 @@ package org.eclipse.ui.internal.activities;
public class PatternUtil {
/**
- * Quotes a string pattern as non-regular expression string.
- * That means: no regular expresion instructions in the given string
- * won't be taken into account.<br/>
- * Example:
- * <code>String searchString = "xy[^a]";<br/>
+ * Quotes a string pattern as non-regular expression string. That means: no
+ * regular expresion instructions in the given string won't be taken into
+ * account.<br/>
+ * Example: <code>String searchString = "xy[^a]";<br/>
* Pattern.compile(quotePattern(searchString)).matcher(searchString)
* .matches();
* <br/> </code> will return true.
+ *
* @param pattern pattern to quote
* @return the quoted pattern
*/
public static String quotePattern(String pattern) {
- final String START = "\\Q"; //$NON-NLS-1$
+ final String START = "\\Q"; //$NON-NLS-1$
final String STOP = "\\E"; //$NON-NLS-1$
- final int STOP_LENGTH = 2; // STOP.length()
+ final int STOP_LENGTH = 2; // STOP.length()
StringBuilder result = new StringBuilder(START);
int stopIndex = pattern.indexOf(STOP);
@@ -46,7 +46,7 @@ public class PatternUtil {
return result.append(pattern).append(STOP).toString();
}
- for (int position=0; ;) {
+ for (int position = 0;;) {
stopIndex = pattern.indexOf(STOP, position);
if (stopIndex >= 0) {
result.append(pattern.substring(position, stopIndex + 2)).append("\\").append(STOP).append(START); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/Persistence.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/Persistence.java
index 76c6ae643f6..0d60b0eccfb 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/Persistence.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/Persistence.java
@@ -21,189 +21,178 @@ import org.eclipse.ui.internal.WorkbenchPlugin;
import org.eclipse.ui.internal.util.ConfigurationElementMemento;
public final class Persistence {
- static final String PACKAGE_BASE = "activities"; //$NON-NLS-1$
+ static final String PACKAGE_BASE = "activities"; //$NON-NLS-1$
- static final String PACKAGE_FULL = "org.eclipse.ui.activities"; //$NON-NLS-1$
+ static final String PACKAGE_FULL = "org.eclipse.ui.activities"; //$NON-NLS-1$
- static final String PACKAGE_PREFIX = "org.eclipse.ui"; //$NON-NLS-1$
+ static final String PACKAGE_PREFIX = "org.eclipse.ui"; //$NON-NLS-1$
- static final String TAG_ACTIVITY = "activity"; //$NON-NLS-1$
+ static final String TAG_ACTIVITY = "activity"; //$NON-NLS-1$
- static final String TAG_ACTIVITY_REQUIREMENT_BINDING = "activityRequirementBinding"; //$NON-NLS-1$
+ static final String TAG_ACTIVITY_REQUIREMENT_BINDING = "activityRequirementBinding"; //$NON-NLS-1$
- static final String TAG_DEFAULT_ENABLEMENT = "defaultEnablement"; //$NON-NLS-1$
+ static final String TAG_DEFAULT_ENABLEMENT = "defaultEnablement"; //$NON-NLS-1$
- static final String TAG_ACTIVITY_ID = "activityId"; //$NON-NLS-1$
+ static final String TAG_ACTIVITY_ID = "activityId"; //$NON-NLS-1$
- static final String TAG_ACTIVITY_PATTERN_BINDING = "activityPatternBinding"; //$NON-NLS-1$
+ static final String TAG_ACTIVITY_PATTERN_BINDING = "activityPatternBinding"; //$NON-NLS-1$
- static final String TAG_CATEGORY = "category"; //$NON-NLS-1$
+ static final String TAG_CATEGORY = "category"; //$NON-NLS-1$
- static final String TAG_CATEGORY_ACTIVITY_BINDING = "categoryActivityBinding"; //$NON-NLS-1$
+ static final String TAG_CATEGORY_ACTIVITY_BINDING = "categoryActivityBinding"; //$NON-NLS-1$
- static final String TAG_CATEGORY_ID = "categoryId"; //$NON-NLS-1$
+ static final String TAG_CATEGORY_ID = "categoryId"; //$NON-NLS-1$
- static final String TAG_REQUIRED_ACTIVITY_ID = "requiredActivityId"; //$NON-NLS-1$
+ static final String TAG_REQUIRED_ACTIVITY_ID = "requiredActivityId"; //$NON-NLS-1$
- static final String TAG_ID = "id"; //$NON-NLS-1$
+ static final String TAG_ID = "id"; //$NON-NLS-1$
- static final String TAG_NAME = "name"; //$NON-NLS-1$
+ static final String TAG_NAME = "name"; //$NON-NLS-1$
- static final String TAG_PATTERN = "pattern"; //$NON-NLS-1$
+ static final String TAG_PATTERN = "pattern"; //$NON-NLS-1$
- static final String TAG_IS_EQUALITY_PATTERN = "isEqualityPattern"; //$NON-NLS-1$
+ static final String TAG_IS_EQUALITY_PATTERN = "isEqualityPattern"; //$NON-NLS-1$
- static final String TAG_SOURCE_ID = "sourceId"; //$NON-NLS-1$
+ static final String TAG_SOURCE_ID = "sourceId"; //$NON-NLS-1$
- static final String TAG_DESCRIPTION = "description"; //$NON-NLS-1$
+ static final String TAG_DESCRIPTION = "description"; //$NON-NLS-1$
- // Used only in error messages addressed to plug-in developers
- public static final String ACTIVITY_REQUIREMENT_BINDING_DESC = "Invalid activity requirement binding"; //$NON-NLS-1$
- public static final String ACTIVITY_DESC = "Invalid activity"; //$NON-NLS-1$
- public static final String ACTIVITY_PATTERN_BINDING_DESC = "Invalid activity pattern binding"; //$NON-NLS-1$
- public static final String CATEGORY_ACTIVITY_BINDING_DESC = "Invalid category activity binding"; //$NON-NLS-1$
- public static final String CATEGORY_DESC = "Invalid category description"; //$NON-NLS-1$
- public static final String ACTIVITY_IMAGE_BINDING_DESC = "Invalid activity image binding"; //$NON-NLS-1$
- public static final String ACTIVITY_TRIGGER_DESC = "Invalid trigger point"; //$NON-NLS-1$
- public static final String ACTIVITY_TRIGGER_HINT_DESC = "Invalid trigger point hint"; //$NON-NLS-1$
+ // Used only in error messages addressed to plug-in developers
+ public static final String ACTIVITY_REQUIREMENT_BINDING_DESC = "Invalid activity requirement binding"; //$NON-NLS-1$
+ public static final String ACTIVITY_DESC = "Invalid activity"; //$NON-NLS-1$
+ public static final String ACTIVITY_PATTERN_BINDING_DESC = "Invalid activity pattern binding"; //$NON-NLS-1$
+ public static final String CATEGORY_ACTIVITY_BINDING_DESC = "Invalid category activity binding"; //$NON-NLS-1$
+ public static final String CATEGORY_DESC = "Invalid category description"; //$NON-NLS-1$
+ public static final String ACTIVITY_IMAGE_BINDING_DESC = "Invalid activity image binding"; //$NON-NLS-1$
+ public static final String ACTIVITY_TRIGGER_DESC = "Invalid trigger point"; //$NON-NLS-1$
+ public static final String ACTIVITY_TRIGGER_HINT_DESC = "Invalid trigger point hint"; //$NON-NLS-1$
- // Non-translatable error messages for plug-in developers
- public static final String shortContextTemplate = " (contributed by ''{0}'')"; //$NON-NLS-1$;
- public static final String fullContextTemplate = " (contributed by ''{0}'', extension ID ''{1}'')"; //$NON-NLS-1$;
+ // Non-translatable error messages for plug-in developers
+ public static final String shortContextTemplate = " (contributed by ''{0}'')"; //$NON-NLS-1$ ;
+ public static final String fullContextTemplate = " (contributed by ''{0}'', extension ID ''{1}'')"; //$NON-NLS-1$ ;
- static ActivityRequirementBindingDefinition readActivityRequirementBindingDefinition(
- IMemento memento, String sourceIdOverride) { //, IStatus status) {
- String childActivityId = memento.getString(TAG_REQUIRED_ACTIVITY_ID);
- if (childActivityId == null) {
- log(memento, ACTIVITY_REQUIREMENT_BINDING_DESC, "missing ID of the required activity"); //$NON-NLS-1$
+ static ActivityRequirementBindingDefinition readActivityRequirementBindingDefinition(IMemento memento,
+ String sourceIdOverride) { // , IStatus status) {
+ String childActivityId = memento.getString(TAG_REQUIRED_ACTIVITY_ID);
+ if (childActivityId == null) {
+ log(memento, ACTIVITY_REQUIREMENT_BINDING_DESC, "missing ID of the required activity"); //$NON-NLS-1$
return null;
}
- String parentActivityId = memento.getString(TAG_ACTIVITY_ID);
- if (parentActivityId == null) {
- log(memento, ACTIVITY_REQUIREMENT_BINDING_DESC, "missing ID of the activity to bind"); //$NON-NLS-1$
+ String parentActivityId = memento.getString(TAG_ACTIVITY_ID);
+ if (parentActivityId == null) {
+ log(memento, ACTIVITY_REQUIREMENT_BINDING_DESC, "missing ID of the activity to bind"); //$NON-NLS-1$
return null;
}
- String sourceId = sourceIdOverride != null ? sourceIdOverride : memento
- .getString(TAG_SOURCE_ID);
- return new ActivityRequirementBindingDefinition(childActivityId,
- parentActivityId, sourceId);
- }
-
- static String readDefaultEnablement(IMemento memento) {
- return memento.getString(TAG_ID);
- }
-
- static ActivityDefinition readActivityDefinition(IMemento memento,
- String sourceIdOverride) {
-
- String id = memento.getString(TAG_ID);
- if (id == null) {
- log(memento, ACTIVITY_DESC, "missing a unique identifier"); //$NON-NLS-1$
+ String sourceId = sourceIdOverride != null ? sourceIdOverride : memento.getString(TAG_SOURCE_ID);
+ return new ActivityRequirementBindingDefinition(childActivityId, parentActivityId, sourceId);
+ }
+
+ static String readDefaultEnablement(IMemento memento) {
+ return memento.getString(TAG_ID);
+ }
+
+ static ActivityDefinition readActivityDefinition(IMemento memento, String sourceIdOverride) {
+
+ String id = memento.getString(TAG_ID);
+ if (id == null) {
+ log(memento, ACTIVITY_DESC, "missing a unique identifier"); //$NON-NLS-1$
return null;
}
- String name = memento.getString(TAG_NAME);
- if (name == null) {
- log(memento, ACTIVITY_DESC, "missing a translatable name"); //$NON-NLS-1$
+ String name = memento.getString(TAG_NAME);
+ if (name == null) {
+ log(memento, ACTIVITY_DESC, "missing a translatable name"); //$NON-NLS-1$
return null;
}
- String description = memento.getString(TAG_DESCRIPTION);
- if (description == null) {
+ String description = memento.getString(TAG_DESCRIPTION);
+ if (description == null) {
description = ""; //$NON-NLS-1$
}
- String sourceId = sourceIdOverride != null ? sourceIdOverride : memento
- .getString(TAG_SOURCE_ID);
- return new ActivityDefinition(id, name, sourceId, description);
- }
+ String sourceId = sourceIdOverride != null ? sourceIdOverride : memento.getString(TAG_SOURCE_ID);
+ return new ActivityDefinition(id, name, sourceId, description);
+ }
- static ActivityPatternBindingDefinition readActivityPatternBindingDefinition(
- IMemento memento, String sourceIdOverride) {
+ static ActivityPatternBindingDefinition readActivityPatternBindingDefinition(IMemento memento,
+ String sourceIdOverride) {
- String activityId = memento.getString(TAG_ACTIVITY_ID);
- if (activityId == null) {
- log(memento, ACTIVITY_PATTERN_BINDING_DESC, "missing an ID of the activity to bind"); //$NON-NLS-1$
+ String activityId = memento.getString(TAG_ACTIVITY_ID);
+ if (activityId == null) {
+ log(memento, ACTIVITY_PATTERN_BINDING_DESC, "missing an ID of the activity to bind"); //$NON-NLS-1$
return null;
}
- String pattern = memento.getString(TAG_PATTERN);
- if (pattern == null) {
- log(memento, ACTIVITY_PATTERN_BINDING_DESC, "missing the pattern to be bound"); //$NON-NLS-1$
+ String pattern = memento.getString(TAG_PATTERN);
+ if (pattern == null) {
+ log(memento, ACTIVITY_PATTERN_BINDING_DESC, "missing the pattern to be bound"); //$NON-NLS-1$
return null;
}
- String sourceId = sourceIdOverride != null ? sourceIdOverride : memento
- .getString(TAG_SOURCE_ID);
+ String sourceId = sourceIdOverride != null ? sourceIdOverride : memento.getString(TAG_SOURCE_ID);
- final String isEqualityPatternStr = memento.getString(TAG_IS_EQUALITY_PATTERN);
- final boolean isEqualityPattern = (isEqualityPatternStr != null && isEqualityPatternStr
- .equals("true")); //$NON-NLS-1$
+ final String isEqualityPatternStr = memento.getString(TAG_IS_EQUALITY_PATTERN);
+ final boolean isEqualityPattern = (isEqualityPatternStr != null && isEqualityPatternStr.equals("true")); //$NON-NLS-1$
- return new ActivityPatternBindingDefinition(activityId, pattern,
- sourceId, isEqualityPattern);
- }
+ return new ActivityPatternBindingDefinition(activityId, pattern, sourceId, isEqualityPattern);
+ }
- static CategoryActivityBindingDefinition readCategoryActivityBindingDefinition(
- IMemento memento, String sourceIdOverride) {
+ static CategoryActivityBindingDefinition readCategoryActivityBindingDefinition(IMemento memento,
+ String sourceIdOverride) {
- String activityId = memento.getString(TAG_ACTIVITY_ID);
- if (activityId == null) {
- log(memento, CATEGORY_ACTIVITY_BINDING_DESC, "missing the ID of the activity to bind"); //$NON-NLS-1$
+ String activityId = memento.getString(TAG_ACTIVITY_ID);
+ if (activityId == null) {
+ log(memento, CATEGORY_ACTIVITY_BINDING_DESC, "missing the ID of the activity to bind"); //$NON-NLS-1$
return null;
}
- String categoryId = memento.getString(TAG_CATEGORY_ID);
- if (categoryId == null) {
- log(memento, CATEGORY_ACTIVITY_BINDING_DESC, "missing the ID of the category to bind"); //$NON-NLS-1$
+ String categoryId = memento.getString(TAG_CATEGORY_ID);
+ if (categoryId == null) {
+ log(memento, CATEGORY_ACTIVITY_BINDING_DESC, "missing the ID of the category to bind"); //$NON-NLS-1$
return null;
}
- String sourceId = sourceIdOverride != null ? sourceIdOverride : memento
- .getString(TAG_SOURCE_ID);
- return new CategoryActivityBindingDefinition(activityId, categoryId,
- sourceId);
- }
-
- static CategoryDefinition readCategoryDefinition(IMemento memento,
- String sourceIdOverride) {
-
- String id = memento.getString(TAG_ID);
- if (id == null) {
- log(memento, CATEGORY_DESC, "has no ID"); //$NON-NLS-1$
+ String sourceId = sourceIdOverride != null ? sourceIdOverride : memento.getString(TAG_SOURCE_ID);
+ return new CategoryActivityBindingDefinition(activityId, categoryId, sourceId);
+ }
+
+ static CategoryDefinition readCategoryDefinition(IMemento memento, String sourceIdOverride) {
+
+ String id = memento.getString(TAG_ID);
+ if (id == null) {
+ log(memento, CATEGORY_DESC, "has no ID"); //$NON-NLS-1$
return null;
}
- String name = memento.getString(TAG_NAME);
- if (name == null) {
- log(memento, CATEGORY_DESC, "missing a translatable name"); //$NON-NLS-1$
+ String name = memento.getString(TAG_NAME);
+ if (name == null) {
+ log(memento, CATEGORY_DESC, "missing a translatable name"); //$NON-NLS-1$
return null;
}
- String description = memento.getString(TAG_DESCRIPTION);
- if (description == null) {
+ String description = memento.getString(TAG_DESCRIPTION);
+ if (description == null) {
description = ""; //$NON-NLS-1$
}
- String sourceId = sourceIdOverride != null ? sourceIdOverride : memento
- .getString(TAG_SOURCE_ID);
- return new CategoryDefinition(id, name, sourceId, description);
- }
-
- private Persistence() {
- //no-op
- }
-
- static public void log(IMemento memento, String elementName, String msg) {
- if (memento instanceof ConfigurationElementMemento) {
- ConfigurationElementMemento cMemento = (ConfigurationElementMemento) memento;
- log(elementName, msg, cMemento.getContributorName(), cMemento.getExtensionID());
- } else
- log(elementName, msg, null, null);
- }
-
- static public void log(IConfigurationElement element, String elementName, String msg) {
- String contributorName = element.getContributor().getName();
- String extensionID = element.getDeclaringExtension().getUniqueIdentifier();
- log(elementName, msg, contributorName, extensionID);
- }
-
- static public void log(String elementName, String msg, String contributorName, String extensionID) {
- String msgInContext = elementName + ": " + msg; //$NON-NLS-1$;
- if (contributorName != null && extensionID != null)
- msgInContext += NLS.bind(fullContextTemplate, contributorName, extensionID);
- else if (contributorName != null)
- msgInContext += NLS.bind(shortContextTemplate, contributorName);
- WorkbenchPlugin.log(msgInContext);
- }
+ String sourceId = sourceIdOverride != null ? sourceIdOverride : memento.getString(TAG_SOURCE_ID);
+ return new CategoryDefinition(id, name, sourceId, description);
+ }
+
+ private Persistence() {
+ // no-op
+ }
+
+ static public void log(IMemento memento, String elementName, String msg) {
+ if (memento instanceof ConfigurationElementMemento) {
+ ConfigurationElementMemento cMemento = (ConfigurationElementMemento) memento;
+ log(elementName, msg, cMemento.getContributorName(), cMemento.getExtensionID());
+ } else
+ log(elementName, msg, null, null);
+ }
+
+ static public void log(IConfigurationElement element, String elementName, String msg) {
+ String contributorName = element.getContributor().getName();
+ String extensionID = element.getDeclaringExtension().getUniqueIdentifier();
+ log(elementName, msg, contributorName, extensionID);
+ }
+
+ static public void log(String elementName, String msg, String contributorName, String extensionID) {
+ String msgInContext = elementName + ": " + msg; //$NON-NLS-1$ ;
+ if (contributorName != null && extensionID != null)
+ msgInContext += NLS.bind(fullContextTemplate, contributorName, extensionID);
+ else if (contributorName != null)
+ msgInContext += NLS.bind(shortContextTemplate, contributorName);
+ WorkbenchPlugin.log(msgInContext);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ProxyActivityManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ProxyActivityManager.java
index 0d928bfbb17..f2130cf3ccf 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ProxyActivityManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ProxyActivityManager.java
@@ -22,61 +22,54 @@ import org.eclipse.ui.activities.ICategory;
import org.eclipse.ui.activities.IIdentifier;
public final class ProxyActivityManager extends AbstractActivityManager {
- private IActivityManager activityManager;
+ private IActivityManager activityManager;
- public ProxyActivityManager(IActivityManager activityManager) {
- if (activityManager == null) {
+ public ProxyActivityManager(IActivityManager activityManager) {
+ if (activityManager == null) {
throw new NullPointerException();
}
- this.activityManager = activityManager;
+ this.activityManager = activityManager;
- this.activityManager
- .addActivityManagerListener(activityManagerEvent -> {
- ActivityManagerEvent proxyActivityManagerEvent = new ActivityManagerEvent(
- ProxyActivityManager.this, activityManagerEvent
- .haveDefinedActivityIdsChanged(),
- activityManagerEvent
- .haveDefinedCategoryIdsChanged(),
- activityManagerEvent
- .haveEnabledActivityIdsChanged(),
- activityManagerEvent
- .getPreviouslyDefinedActivityIds(),
- activityManagerEvent
- .getPreviouslyDefinedCategoryIds(),
- activityManagerEvent
- .getPreviouslyEnabledActivityIds());
- fireActivityManagerChanged(proxyActivityManagerEvent);
- });
- }
+ this.activityManager.addActivityManagerListener(activityManagerEvent -> {
+ ActivityManagerEvent proxyActivityManagerEvent = new ActivityManagerEvent(ProxyActivityManager.this,
+ activityManagerEvent.haveDefinedActivityIdsChanged(),
+ activityManagerEvent.haveDefinedCategoryIdsChanged(),
+ activityManagerEvent.haveEnabledActivityIdsChanged(),
+ activityManagerEvent.getPreviouslyDefinedActivityIds(),
+ activityManagerEvent.getPreviouslyDefinedCategoryIds(),
+ activityManagerEvent.getPreviouslyEnabledActivityIds());
+ fireActivityManagerChanged(proxyActivityManagerEvent);
+ });
+ }
- @Override
+ @Override
public IActivity getActivity(String activityId) {
- return activityManager.getActivity(activityId);
- }
+ return activityManager.getActivity(activityId);
+ }
- @Override
+ @Override
public ICategory getCategory(String categoryId) {
- return activityManager.getCategory(categoryId);
- }
+ return activityManager.getCategory(categoryId);
+ }
- @Override
+ @Override
public Set<String> getDefinedActivityIds() {
- return activityManager.getDefinedActivityIds();
- }
+ return activityManager.getDefinedActivityIds();
+ }
- @Override
+ @Override
public Set<String> getDefinedCategoryIds() {
- return activityManager.getDefinedCategoryIds();
- }
+ return activityManager.getDefinedCategoryIds();
+ }
- @Override
+ @Override
public Set<String> getEnabledActivityIds() {
- return activityManager.getEnabledActivityIds();
- }
+ return activityManager.getEnabledActivityIds();
+ }
- @Override
+ @Override
public IIdentifier getIdentifier(String identifierId) {
- return activityManager.getIdentifier(identifierId);
- }
+ return activityManager.getIdentifier(identifierId);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/AbstractTriggerPoint.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/AbstractTriggerPoint.java
index 9c30a4fb47d..95c538d5ee3 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/AbstractTriggerPoint.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/AbstractTriggerPoint.java
@@ -20,11 +20,10 @@ import org.eclipse.ui.activities.ITriggerPoint;
*/
public abstract class AbstractTriggerPoint implements ITriggerPoint {
-
@Override
public boolean equals(Object obj) {
if (obj instanceof ITriggerPoint) {
- return getId().equals(((ITriggerPoint)obj).getId());
+ return getId().equals(((ITriggerPoint) obj).getId());
}
return false;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ActivityCategoryContentProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ActivityCategoryContentProvider.java
index d27a5b83529..cae855086d5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ActivityCategoryContentProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ActivityCategoryContentProvider.java
@@ -39,24 +39,22 @@ import org.eclipse.ui.internal.activities.InternalActivityHelper;
*/
public class ActivityCategoryContentProvider implements ITreeContentProvider {
- /**
- * The manager to extract content from.
- */
- private IActivityManager manager;
+ /**
+ * The manager to extract content from.
+ */
+ private IActivityManager manager;
- @Override
+ @Override
public void dispose() {
- manager = null;
- }
+ manager = null;
+ }
- /**
- * @param category
- * the category to fetch.
+ /**
+ * @param category the category to fetch.
* @return all activities in the category.
*/
private IActivity[] getCategoryActivities(ICategory category) {
- Set<String> activityIds = InternalActivityHelper.getActivityIdsForCategory(
- manager, category);
+ Set<String> activityIds = InternalActivityHelper.getActivityIdsForCategory(manager, category);
List<IActivity> categoryActivities = new ArrayList<>(activityIds.size());
for (String activityId : activityIds) {
categoryActivities.add(new CategorizedActivity(category, manager.getActivity(activityId)));
@@ -68,12 +66,10 @@ public class ActivityCategoryContentProvider implements ITreeContentProvider {
/**
* Get the duplicate activities found in the other defined categories.
*
- * @param categorizedActivity
- * The categorized activity.
+ * @param categorizedActivity The categorized activity.
* @return the list of duplicate categorized activities.
*/
- public Object[] getDuplicateCategoryActivities(
- CategorizedActivity categorizedActivity) {
+ public Object[] getDuplicateCategoryActivities(CategorizedActivity categorizedActivity) {
ArrayList<CategorizedActivity> duplicateCategorizedactivities = new ArrayList<>();
Set<String> categoryIds = manager.getDefinedCategoryIds();
ICategory currentCategory = null;
@@ -107,15 +103,13 @@ public class ActivityCategoryContentProvider implements ITreeContentProvider {
/**
* Get the child required activities.
*
- * @param activityId
- * The parent activity id.
+ * @param activityId The parent activity id.
* @return the list of child required activities.
*/
public Object[] getChildRequiredActivities(String activityId) {
ArrayList<CategorizedActivity> childRequiredActivities = new ArrayList<>();
IActivity activity = manager.getActivity(activityId);
- Set<IActivityRequirementBinding> actvitiyRequirementBindings = activity
- .getActivityRequirementBindings();
+ Set<IActivityRequirementBinding> actvitiyRequirementBindings = activity.getActivityRequirementBindings();
String requiredActivityId = null;
IActivityRequirementBinding currentActivityRequirementBinding = null;
Object[] currentCategoryIds = null;
@@ -136,8 +130,7 @@ public class ActivityCategoryContentProvider implements ITreeContentProvider {
/**
* Get the parent required activities.
*
- * @param activityId
- * The child activity id.
+ * @param activityId The child activity id.
* @return the list of parent required activities.
*/
public Object[] getParentRequiredActivities(String activityId) {
@@ -169,8 +162,7 @@ public class ActivityCategoryContentProvider implements ITreeContentProvider {
/**
* Get the activity's categories (there could be more than one).
*
- * @param activityId
- * The activity id.
+ * @param activityId The activity id.
* @return the activity's categories.
*/
private Object[] getActivityCategories(String activityId) {
@@ -191,49 +183,49 @@ public class ActivityCategoryContentProvider implements ITreeContentProvider {
return activityCategories.toArray();
}
- @Override
+ @Override
public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof IActivityManager) {
+ if (parentElement instanceof IActivityManager) {
Set<String> categoryIds = manager.getDefinedCategoryIds();
ArrayList<ICategory> categories = new ArrayList<>(categoryIds.size());
for (String categoryId : categoryIds) {
- ICategory category = manager.getCategory(categoryId);
+ ICategory category = manager.getCategory(categoryId);
if (getCategoryActivities(category).length > 0) {
categories.add(category);
}
- }
- return categories.toArray();
- } else if (parentElement instanceof ICategory) {
- return getCategoryActivities((ICategory) parentElement);
- }
- return new Object[0];
- }
-
- @Override
+ }
+ return categories.toArray();
+ } else if (parentElement instanceof ICategory) {
+ return getCategoryActivities((ICategory) parentElement);
+ }
+ return new Object[0];
+ }
+
+ @Override
public Object[] getElements(Object inputElement) {
- return getChildren(inputElement);
- }
+ return getChildren(inputElement);
+ }
- @Override
+ @Override
public Object getParent(Object element) {
- if (element instanceof CategorizedActivity) {
- return ((CategorizedActivity) element).getCategory();
- }
- return null;
- }
+ if (element instanceof CategorizedActivity) {
+ return ((CategorizedActivity) element).getCategory();
+ }
+ return null;
+ }
- @Override
+ @Override
public boolean hasChildren(Object element) {
- if (element instanceof IActivityManager || element instanceof ICategory) {
+ if (element instanceof IActivityManager || element instanceof ICategory) {
return true;
}
- return false;
- }
+ return false;
+ }
- @Override
+ @Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
if (newInput instanceof IActivityManager) {
manager = (IActivityManager) newInput;
}
- }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ActivityCategoryLabelProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ActivityCategoryLabelProvider.java
index 951b9ecdc9a..8d01dfed184 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ActivityCategoryLabelProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ActivityCategoryLabelProvider.java
@@ -27,8 +27,8 @@ import org.eclipse.ui.activities.ICategory;
import org.eclipse.ui.activities.NotDefinedException;
/**
- * Provides labels for elements drawn from <code>IActivityManagers</code>.
- * Ie: <code>IActivity</code> and <code>ICategory</code> objects.
+ * Provides labels for elements drawn from <code>IActivityManagers</code>. Ie:
+ * <code>IActivity</code> and <code>ICategory</code> objects.
*
* @since 3.0
*/
@@ -44,67 +44,64 @@ public class ActivityCategoryLabelProvider extends LabelProvider {
manager = new LocalResourceManager(JFaceResources.getResources());
}
- @Override
+ @Override
public Image getImage(Object element) {
- try {
- ImageDescriptor descriptor = getDescriptor(element);
- if (descriptor != null) {
+ try {
+ ImageDescriptor descriptor = getDescriptor(element);
+ if (descriptor != null) {
return manager.createImage(descriptor);
}
- }
- catch (DeviceResourceException e) {
- //ignore
- }
- return null;
- }
+ } catch (DeviceResourceException e) {
+ // ignore
+ }
+ return null;
+ }
- private ImageDescriptor getDescriptor(Object element) {
- ImageDescriptor descriptor = descriptorMap.get(element);
- if (descriptor != null) {
+ private ImageDescriptor getDescriptor(Object element) {
+ ImageDescriptor descriptor = descriptorMap.get(element);
+ if (descriptor != null) {
return descriptor;
}
- if (element instanceof ICategory) {
- ICategory category = (ICategory) element;
- descriptor = PlatformUI.getWorkbench().getActivitySupport()
- .getImageDescriptor(category);
+ if (element instanceof ICategory) {
+ ICategory category = (ICategory) element;
+ descriptor = PlatformUI.getWorkbench().getActivitySupport().getImageDescriptor(category);
if (descriptor != null) {
descriptorMap.put(element, descriptor);
}
- } else if (element instanceof IActivity) {
- IActivity activity = (IActivity) element;
- descriptor = PlatformUI.getWorkbench().getActivitySupport()
- .getImageDescriptor(activity);
+ } else if (element instanceof IActivity) {
+ IActivity activity = (IActivity) element;
+ descriptor = PlatformUI.getWorkbench().getActivitySupport().getImageDescriptor(activity);
if (descriptor != null) {
descriptorMap.put(element, descriptor);
}
- }
- return descriptor;
- }
+ }
+ return descriptor;
+ }
- @Override
+ @Override
public String getText(Object element) {
- if (element instanceof IActivity) {
- IActivity activity = (IActivity) element;
- try {
- return activity.getName();
- } catch (NotDefinedException e) {
- return activity.getId();
- }
- } else if (element instanceof ICategory) {
- ICategory category = ((ICategory) element);
- try {
- return category.getName();
- } catch (NotDefinedException e) {
- return category.getId();
- }
- }
- return super.getText(element);
- }
+ if (element instanceof IActivity) {
+ IActivity activity = (IActivity) element;
+ try {
+ return activity.getName();
+ } catch (NotDefinedException e) {
+ return activity.getId();
+ }
+ } else if (element instanceof ICategory) {
+ ICategory category = ((ICategory) element);
+ try {
+ return category.getName();
+ } catch (NotDefinedException e) {
+ return category.getId();
+ }
+ }
+ return super.getText(element);
+ }
- @Override
+ @Override
public void dispose() {
- manager.dispose();
- descriptorMap.clear();
- }
+ manager.dispose();
+ descriptorMap.clear();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ActivityContentProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ActivityContentProvider.java
index 5ddefff0c10..0f871e87550 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ActivityContentProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ActivityContentProvider.java
@@ -22,14 +22,14 @@ import org.eclipse.ui.activities.IActivityManager;
*/
public class ActivityContentProvider implements IStructuredContentProvider {
- @Override
+ @Override
public Object[] getElements(Object inputElement) {
- Object[] activities = new Object[0];
- if (inputElement instanceof IActivityManager) {
+ Object[] activities = new Object[0];
+ if (inputElement instanceof IActivityManager) {
activities = ((IActivityManager) inputElement).getDefinedActivityIds().toArray();
- } else if (inputElement instanceof Collection) {
+ } else if (inputElement instanceof Collection) {
activities = ((Collection<?>) inputElement).toArray();
- }
- return activities;
- }
+ }
+ return activities;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ActivityEnabler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ActivityEnabler.java
index b1b254f479e..f98599c1c52 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ActivityEnabler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ActivityEnabler.java
@@ -109,8 +109,7 @@ public class ActivityEnabler {
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
- Set<Object> checked = new HashSet<>(Arrays.asList(dualViewer
- .getCheckedElements()));
+ Set<Object> checked = new HashSet<>(Arrays.asList(dualViewer.getCheckedElements()));
Object element = event.getElement();
if (element instanceof ICategory) {
// clicking on a category should enable/disable all activities
@@ -122,8 +121,7 @@ public class ActivityEnabler {
// Update the category's activities for multiplicity in other
// categories
for (Object categoryActivity : provider.getChildren(element)) {
- handleDuplicateActivities(event.getChecked(),
- categoryActivity);
+ handleDuplicateActivities(event.getChecked(), categoryActivity);
}
} else {
@@ -136,13 +134,10 @@ public class ActivityEnabler {
/**
* Handle duplicate activities.
*
- * @param checkedState
- * Checked state of the element.
- * @param element
- * The checked element.
+ * @param checkedState Checked state of the element.
+ * @param element The checked element.
*/
- private void handleDuplicateActivities(boolean checkedState,
- Object element) {
+ private void handleDuplicateActivities(boolean checkedState, Object element) {
// Retrieve duplicate activities from the other categories
Object[] duplicateActivities = provider.getDuplicateCategoryActivities((CategorizedActivity) element);
for (Object activity : duplicateActivities) {
@@ -151,19 +146,15 @@ public class ActivityEnabler {
dualViewer.setChecked(activity, checkedState);
// handle the activity check to potentially update its
// category's enablement
- handleActivityCheck(new HashSet<>(Arrays.asList(dualViewer
- .getCheckedElements())), activity);
+ handleActivityCheck(new HashSet<>(Arrays.asList(dualViewer.getCheckedElements())), activity);
}
}
/**
- * Handle the checking of an activity and update its category's checked
- * state.
+ * Handle the checking of an activity and update its category's checked state.
*
- * @param checked
- * The set of checked elements in the viewer.
- * @param element
- * The checked element.
+ * @param checked The set of checked elements in the viewer.
+ * @param element The checked element.
*/
private void handleActivityCheck(Set<Object> checked, Object element) {
// clicking on an activity can potentially change the check/gray
@@ -200,10 +191,8 @@ public class ActivityEnabler {
/**
* Handle the activity's required activities (parent and child).
*
- * @param checked
- * The set of checked elements in the viewer.
- * @param element
- * The checked element.
+ * @param checked The set of checked elements in the viewer.
+ * @param element The checked element.
*
*/
private void handleRequiredActivities(Set<?> checked, Object element) {
@@ -211,9 +200,7 @@ public class ActivityEnabler {
// An element has been checked - we want to check its child required
// activities
if (checked.contains(element)) {
- requiredActivities = provider
- .getChildRequiredActivities(((CategorizedActivity) element)
- .getId());
+ requiredActivities = provider.getChildRequiredActivities(((CategorizedActivity) element).getId());
for (int index = 0; index < requiredActivities.length; index++) {
// We want to check the element if it is unchecked
if (!checked.contains(requiredActivities[index])) {
@@ -243,12 +230,10 @@ public class ActivityEnabler {
/**
* Create a new instance.
*
- * @param activitySupport
- * the <code>IMutableActivityMananger</code> to use.
- * @param strings
- * map of strings to use. See the constants on
- * {@link org.eclipse.ui.activities.ActivitiesPreferencePage} for
- * details.
+ * @param activitySupport the <code>IMutableActivityMananger</code> to use.
+ * @param strings map of strings to use. See the constants on
+ * {@link org.eclipse.ui.activities.ActivitiesPreferencePage}
+ * for details.
*/
public ActivityEnabler(IMutableActivityManager activitySupport, Properties strings) {
this.activitySupport = activitySupport;
@@ -258,15 +243,14 @@ public class ActivityEnabler {
/**
* Create the controls.
*
- * @param parent
- * the parent in which to create the controls.
+ * @param parent the parent in which to create the controls.
* @return the composite in which the controls exist.
*/
public Control createControl(Composite parent) {
- GC gc = new GC(parent);
- gc.setFont(JFaceResources.getDialogFont());
- FontMetrics fontMetrics = gc.getFontMetrics();
- gc.dispose();
+ GC gc = new GC(parent);
+ gc.setFont(JFaceResources.getDialogFont());
+ FontMetrics fontMetrics = gc.getFontMetrics();
+ gc.dispose();
Composite composite = new Composite(parent, SWT.NONE);
@@ -314,13 +298,12 @@ public class ActivityEnabler {
deselectAllButton.addSelectionListener(widgetSelectedAdapter(e -> toggleTreeEnablement(false)));
setButtonLayoutData(deselectAllButton, fontMetrics);
-
dualViewer.addCheckStateListener(checkListener);
dualViewer.addSelectionChangedListener(selectionListener);
dualViewer.setSelection(new StructuredSelection());
- Dialog.applyDialogFont(composite);
+ Dialog.applyDialogFont(composite);
return composite;
}
@@ -329,23 +312,24 @@ public class ActivityEnabler {
GridLayout layout = new GridLayout(nColumns, false);
layout.marginHeight = 0;
layout.marginWidth = 0;
- layout.horizontalSpacing = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_SPACING);
+ layout.horizontalSpacing = Dialog.convertHorizontalDLUsToPixels(fontMetrics,
+ IDialogConstants.HORIZONTAL_SPACING);
layout.verticalSpacing = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_SPACING);
return layout;
}
- private GridData setButtonLayoutData(Button button, FontMetrics fontMetrics) {
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- int widthHint = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.BUTTON_WIDTH);
- Point minSize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
- data.widthHint = Math.max(widthHint, minSize.x);
- button.setLayoutData(data);
- return data;
- }
+ private GridData setButtonLayoutData(Button button, FontMetrics fontMetrics) {
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ int widthHint = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.BUTTON_WIDTH);
+ Point minSize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
+ data.widthHint = Math.max(widthHint, minSize.x);
+ button.setLayoutData(data);
+ return data;
+ }
/**
- * Set the enabled category/activity check/grey states based on initial
- * activity enablement.
+ * Set the enabled category/activity check/grey states based on initial activity
+ * enablement.
*/
private void setInitialStates() {
Set<String> enabledActivities = activitySupport.getEnabledActivityIds();
@@ -353,8 +337,7 @@ public class ActivityEnabler {
}
private void setEnabledStates(Set<String> enabledActivities) {
- Set<String> categories = activitySupport
- .getDefinedCategoryIds();
+ Set<String> categories = activitySupport.getDefinedCategoryIds();
List<Object> checked = new ArrayList<>(10), grayed = new ArrayList<>(10);
for (String categoryId : categories) {
ICategory category = activitySupport.getCategory(categoryId);
@@ -420,16 +403,16 @@ public class ActivityEnabler {
Set<String> defaultEnabled = new HashSet<>();
Set<String> activityIds = activitySupport.getDefinedActivityIds();
for (Iterator<String> i = activityIds.iterator(); i.hasNext();) {
- String activityId = i.next();
- IActivity activity = activitySupport.getActivity(activityId);
- try {
- if (activity.isDefaultEnabled()) {
- defaultEnabled.add(activityId);
- }
- } catch (NotDefinedException e) {
- // this can't happen - we're iterating over defined activities.
- }
- }
+ String activityId = i.next();
+ IActivity activity = activitySupport.getActivity(activityId);
+ try {
+ if (activity.isDefaultEnabled()) {
+ defaultEnabled.add(activityId);
+ }
+ } catch (NotDefinedException e) {
+ // this can't happen - we're iterating over defined activities.
+ }
+ }
setEnabledStates(defaultEnabled);
}
@@ -437,19 +420,17 @@ public class ActivityEnabler {
/**
* Toggles the enablement state of all activities.
*
- * @param enabled
- * whether the tree should be enabled
+ * @param enabled whether the tree should be enabled
*/
protected void toggleTreeEnablement(boolean enabled) {
Object[] elements = provider.getElements(activitySupport);
- //reset grey state to null
+ // reset grey state to null
dualViewer.setGrayedElements(new Object[0]);
- //enable all categories
+ // enable all categories
for (Object element : elements) {
- dualViewer
- .expandToLevel(element, AbstractTreeViewer.ALL_LEVELS);
+ dualViewer.expandToLevel(element, AbstractTreeViewer.ALL_LEVELS);
dualViewer.setSubtreeChecked(element, enabled);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ActivityLabelProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ActivityLabelProvider.java
index 77a7f366ab7..591acc121db 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ActivityLabelProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ActivityLabelProvider.java
@@ -21,51 +21,50 @@ import org.eclipse.ui.activities.NotDefinedException;
/**
* Provides labels for <code>IActivity</code> objects. They may be passed
- * directly or as <code>String</code> identifiers that are matched against
- * the activity manager.
+ * directly or as <code>String</code> identifiers that are matched against the
+ * activity manager.
*
* @since 3.0
*/
public class ActivityLabelProvider extends LabelProvider {
- private IActivityManager activityManager;
+ private IActivityManager activityManager;
- /**
- * Create a new instance of the receiver.
- *
- * @param activityManager
- * @since 3.0
- */
- public ActivityLabelProvider(IActivityManager activityManager) {
- this.activityManager = activityManager;
- }
+ /**
+ * Create a new instance of the receiver.
+ *
+ * @param activityManager
+ * @since 3.0
+ */
+ public ActivityLabelProvider(IActivityManager activityManager) {
+ this.activityManager = activityManager;
+ }
- /**
- * @param activity
- * @return
- */
- private String getActivityText(IActivity activity) {
- try {
- return activity.getName();
- } catch (NotDefinedException e) {
- return activity.getId();
- }
- }
+ /**
+ * @param activity
+ * @return
+ */
+ private String getActivityText(IActivity activity) {
+ try {
+ return activity.getName();
+ } catch (NotDefinedException e) {
+ return activity.getId();
+ }
+ }
- @Override
+ @Override
public Image getImage(Object element) {
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public String getText(Object element) {
- if (element instanceof String) {
- return getActivityText(activityManager
- .getActivity((String) element));
- } else if (element instanceof IActivity) {
- return getActivityText((IActivity) element);
- } else {
- throw new IllegalArgumentException();
- }
- }
+ if (element instanceof String) {
+ return getActivityText(activityManager.getActivity((String) element));
+ } else if (element instanceof IActivity) {
+ return getActivityText((IActivity) element);
+ } else {
+ throw new IllegalArgumentException();
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ActivityMessages.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ActivityMessages.java
index 76d018deda0..502ccc288ed 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ActivityMessages.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ActivityMessages.java
@@ -15,10 +15,8 @@ package org.eclipse.ui.internal.activities.ws;
import org.eclipse.osgi.util.NLS;
-
/**
- * The ActivtyMessages are the messages used by the activities
- * support.
+ * The ActivtyMessages are the messages used by the activities support.
*
*/
public class ActivityMessages extends NLS {
@@ -26,14 +24,14 @@ public class ActivityMessages extends NLS {
public static String ActivityEnabler_description;
public static String ActivityEnabler_activities;
- public static String ActivityEnabler_categories;
+ public static String ActivityEnabler_categories;
public static String ActivityEnabler_selectAll;
public static String ActivityEnabler_deselectAll;
- public static String ActivitiesPreferencePage_advancedDialogTitle;
- public static String ActivitiesPreferencePage_advancedButton;
- public static String ActivitiesPreferencePage_lockedMessage;
- public static String ActivitiesPreferencePage_captionMessage;
- public static String ActivitiesPreferencePage_requirements;
+ public static String ActivitiesPreferencePage_advancedDialogTitle;
+ public static String ActivitiesPreferencePage_advancedButton;
+ public static String ActivitiesPreferencePage_lockedMessage;
+ public static String ActivitiesPreferencePage_captionMessage;
+ public static String ActivitiesPreferencePage_requirements;
public static String ManagerTask;
public static String ManagerWindowSubTask;
public static String ManagerViewsSubTask;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ActivityViewerFilter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ActivityViewerFilter.java
index fddb9076bc7..838c8507295 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ActivityViewerFilter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ActivityViewerFilter.java
@@ -24,29 +24,29 @@ import org.eclipse.ui.activities.WorkbenchActivityHelper;
*/
public class ActivityViewerFilter extends ViewerFilter {
- private boolean hasEncounteredFilteredItem = false;
+ private boolean hasEncounteredFilteredItem = false;
- @Override
+ @Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
- if (WorkbenchActivityHelper.filterItem(element)) {
- setHasEncounteredFilteredItem(true);
- return false;
- }
- return true;
- }
+ if (WorkbenchActivityHelper.filterItem(element)) {
+ setHasEncounteredFilteredItem(true);
+ return false;
+ }
+ return true;
+ }
- /**
- * @return returns whether the filter has filtered an item
- */
- public boolean getHasEncounteredFilteredItem() {
- return hasEncounteredFilteredItem;
- }
+ /**
+ * @return returns whether the filter has filtered an item
+ */
+ public boolean getHasEncounteredFilteredItem() {
+ return hasEncounteredFilteredItem;
+ }
- /**
+ /**
* @param hasEncounteredFilteredItem sets whether the filter has filtered an
* item
*/
- public void setHasEncounteredFilteredItem(boolean hasEncounteredFilteredItem) {
- this.hasEncounteredFilteredItem = hasEncounteredFilteredItem;
- }
+ public void setHasEncounteredFilteredItem(boolean hasEncounteredFilteredItem) {
+ this.hasEncounteredFilteredItem = hasEncounteredFilteredItem;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/CategorizedActivity.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/CategorizedActivity.java
index 07d5298bf29..55cda7b3741 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/CategorizedActivity.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/CategorizedActivity.java
@@ -24,128 +24,126 @@ import org.eclipse.ui.activities.NotDefinedException;
/**
* IActivity proxy that is used by the
- * <code>IActivityCategoryContentProvider</code>. Each
- * proxy keeps a pointer to the <code>ICategory</code> under which it is being
- * provided.
+ * <code>IActivityCategoryContentProvider</code>. Each proxy keeps a pointer to
+ * the <code>ICategory</code> under which it is being provided.
*
* @since 3.0
*/
public class CategorizedActivity implements IActivity {
- /**
- * The real <code>IActivity</code>.
- */
- private IActivity activity;
-
- /**
- * The <code>ICategory</code> under which this proxy will be rendered.
- */
- private ICategory category;
-
- /**
- * Create a new instance.
- *
- * @param category the <code>ICategory</code> under which this proxy will be
- * rendered.
- * @param activity the real <code>IActivity</code>.
- */
- public CategorizedActivity(ICategory category, IActivity activity) {
- this.activity = activity;
- this.category = category;
- }
-
- @Override
+ /**
+ * The real <code>IActivity</code>.
+ */
+ private IActivity activity;
+
+ /**
+ * The <code>ICategory</code> under which this proxy will be rendered.
+ */
+ private ICategory category;
+
+ /**
+ * Create a new instance.
+ *
+ * @param category the <code>ICategory</code> under which this proxy will be
+ * rendered.
+ * @param activity the real <code>IActivity</code>.
+ */
+ public CategorizedActivity(ICategory category, IActivity activity) {
+ this.activity = activity;
+ this.category = category;
+ }
+
+ @Override
public void addActivityListener(IActivityListener activityListener) {
- activity.addActivityListener(activityListener);
- }
+ activity.addActivityListener(activityListener);
+ }
- @Override
+ @Override
public int compareTo(IActivity o) {
- return activity.compareTo(o);
- }
+ return activity.compareTo(o);
+ }
- @Override
+ @Override
public boolean equals(Object o) {
- if (o instanceof CategorizedActivity) {
- if (((CategorizedActivity) o).getCategory().equals(getCategory())) {
- return ((CategorizedActivity) o).getActivity().equals(
- getActivity());
+ if (o instanceof CategorizedActivity) {
+ if (((CategorizedActivity) o).getCategory().equals(getCategory())) {
+ return ((CategorizedActivity) o).getActivity().equals(getActivity());
}
- }
- return false;
- }
-
- /**
- * @return returns the <code>IActivity</code>.
- */
- public IActivity getActivity() {
- return activity;
- }
-
- @Override
+ }
+ return false;
+ }
+
+ /**
+ * @return returns the <code>IActivity</code>.
+ */
+ public IActivity getActivity() {
+ return activity;
+ }
+
+ @Override
public Set<IActivityRequirementBinding> getActivityRequirementBindings() {
- return activity.getActivityRequirementBindings();
- }
+ return activity.getActivityRequirementBindings();
+ }
- @Override
+ @Override
public Set<IActivityPatternBinding> getActivityPatternBindings() {
- return activity.getActivityPatternBindings();
- }
+ return activity.getActivityPatternBindings();
+ }
- /**
- * @return returns the <code>ICategory</code>.
- */
- public ICategory getCategory() {
- return category;
- }
+ /**
+ * @return returns the <code>ICategory</code>.
+ */
+ public ICategory getCategory() {
+ return category;
+ }
- @Override
+ @Override
public String getId() {
- return activity.getId();
- }
+ return activity.getId();
+ }
- @Override
+ @Override
public String getName() throws NotDefinedException {
- return activity.getName();
- }
+ return activity.getName();
+ }
- @Override
+ @Override
public int hashCode() {
- return activity.hashCode();
- }
+ return activity.hashCode();
+ }
- @Override
+ @Override
public boolean isDefined() {
- return activity.isDefined();
- }
+ return activity.isDefined();
+ }
- @Override
+ @Override
public boolean isEnabled() {
- return activity.isEnabled();
- }
+ return activity.isEnabled();
+ }
- @Override
+ @Override
public void removeActivityListener(IActivityListener activityListener) {
- activity.removeActivityListener(activityListener);
- }
+ activity.removeActivityListener(activityListener);
+ }
- @Override
+ @Override
public String toString() {
- return category.getId() + " -> " + activity.getId(); //$NON-NLS-1$
- }
+ return category.getId() + " -> " + activity.getId(); //$NON-NLS-1$
+ }
- @Override
+ @Override
public String getDescription() throws NotDefinedException {
- return activity.getDescription();
- }
+ return activity.getDescription();
+ }
- @Override
+ @Override
public boolean isDefaultEnabled() throws NotDefinedException {
- return activity.isDefaultEnabled();
- }
+ return activity.isDefaultEnabled();
+ }
- @Override
+ @Override
public Expression getExpression() {
- return activity.getExpression();
- }
+ return activity.getExpression();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/EnablementDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/EnablementDialog.java
index a51110beafa..34aaa265c05 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/EnablementDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/EnablementDialog.java
@@ -49,34 +49,33 @@ import org.eclipse.ui.activities.WorkbenchTriggerPointAdvisor;
public class EnablementDialog extends Dialog {
/**
- * The translation bundle in which to look up internationalized text.
- */
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
- .getBundle(EnablementDialog.class.getName());
+ * The translation bundle in which to look up internationalized text.
+ */
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(EnablementDialog.class.getName());
- private Button dontAskButton;
+ private Button dontAskButton;
private Set<String> activitiesToEnable = new HashSet<>(7);
private Collection<String> activityIds;
- private boolean dontAsk;
+ private boolean dontAsk;
- private Button detailsButton;
+ private Button detailsButton;
- boolean showDetails = false;
+ boolean showDetails = false;
- private Composite detailsComposite;
+ private Composite detailsComposite;
- private Label detailsLabel;
+ private Label detailsLabel;
- private String selectedActivity;
+ private String selectedActivity;
- private Text detailsText;
+ private Text detailsText;
private Properties strings;
- /**
+ /**
* Create a new instance of the receiver.
*
* @param parentShell the parent shell
@@ -84,228 +83,213 @@ public class EnablementDialog extends Dialog {
* @param strings string overrides
*/
public EnablementDialog(Shell parentShell, Collection<String> activityIds, Properties strings) {
- super(parentShell);
- this.activityIds = activityIds;
+ super(parentShell);
+ this.activityIds = activityIds;
this.strings = strings;
- }
+ }
- @Override
+ @Override
protected Control createDialogArea(Composite parent) {
- Composite composite = (Composite) super.createDialogArea(parent);
- Font dialogFont = parent.getFont();
- composite.setFont(dialogFont);
- Label text = new Label(composite, SWT.NONE);
- text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- text.setFont(dialogFont);
- IActivityManager manager = PlatformUI.getWorkbench()
- .getActivitySupport().getActivityManager();
-
- if (activityIds.size() == 1) {
- String activityId = activityIds.iterator().next();
- activitiesToEnable.add(activityId);
- selectedActivity = activityId;
-
- IActivity activity = manager.getActivity(activityId);
- String activityText;
- try {
- activityText = activity.getName();
- } catch (NotDefinedException e) {
- activityText = activity.getId();
- }
- text.setText(MessageFormat.format(RESOURCE_BUNDLE
- .getString("requiresSingle"), //$NON-NLS-1$
+ Composite composite = (Composite) super.createDialogArea(parent);
+ Font dialogFont = parent.getFont();
+ composite.setFont(dialogFont);
+ Label text = new Label(composite, SWT.NONE);
+ text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ text.setFont(dialogFont);
+ IActivityManager manager = PlatformUI.getWorkbench().getActivitySupport().getActivityManager();
+
+ if (activityIds.size() == 1) {
+ String activityId = activityIds.iterator().next();
+ activitiesToEnable.add(activityId);
+ selectedActivity = activityId;
+
+ IActivity activity = manager.getActivity(activityId);
+ String activityText;
+ try {
+ activityText = activity.getName();
+ } catch (NotDefinedException e) {
+ activityText = activity.getId();
+ }
+ text.setText(MessageFormat.format(RESOURCE_BUNDLE.getString("requiresSingle"), //$NON-NLS-1$
activityText));
- text = new Label(composite, SWT.NONE);
- text
- .setText(strings
- .getProperty(
- WorkbenchTriggerPointAdvisor.PROCEED_SINGLE,
- RESOURCE_BUNDLE
- .getString(WorkbenchTriggerPointAdvisor.PROCEED_SINGLE)));
- text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- text.setFont(dialogFont);
- } else {
- text.setText(RESOURCE_BUNDLE.getString("requiresMulti")); //$NON-NLS-1$
+ text = new Label(composite, SWT.NONE);
+ text.setText(strings.getProperty(WorkbenchTriggerPointAdvisor.PROCEED_SINGLE,
+ RESOURCE_BUNDLE.getString(WorkbenchTriggerPointAdvisor.PROCEED_SINGLE)));
+ text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ text.setFont(dialogFont);
+ } else {
+ text.setText(RESOURCE_BUNDLE.getString("requiresMulti")); //$NON-NLS-1$
Set<String> activityIdsCopy = new HashSet<>(activityIds);
- CheckboxTableViewer viewer = CheckboxTableViewer.newCheckList(
- composite, SWT.CHECK | SWT.BORDER | SWT.SINGLE);
- viewer.setContentProvider(new ActivityContentProvider());
- viewer.setLabelProvider(new ActivityLabelProvider(manager));
- viewer.setInput(activityIdsCopy);
- viewer.setCheckedElements(activityIdsCopy.toArray());
- viewer.addCheckStateListener(event -> {
- if (event.getChecked()) {
+ CheckboxTableViewer viewer = CheckboxTableViewer.newCheckList(composite,
+ SWT.CHECK | SWT.BORDER | SWT.SINGLE);
+ viewer.setContentProvider(new ActivityContentProvider());
+ viewer.setLabelProvider(new ActivityLabelProvider(manager));
+ viewer.setInput(activityIdsCopy);
+ viewer.setCheckedElements(activityIdsCopy.toArray());
+ viewer.addCheckStateListener(event -> {
+ if (event.getChecked()) {
activitiesToEnable.add((String) event.getElement());
} else {
activitiesToEnable.remove(event.getElement());
}
- getButton(Window.OK).setEnabled(
- !activitiesToEnable.isEmpty());
+ getButton(Window.OK).setEnabled(!activitiesToEnable.isEmpty());
});
- viewer.addSelectionChangedListener(event -> {
+ viewer.addSelectionChangedListener(event -> {
selectedActivity = (String) event.getStructuredSelection().getFirstElement();
- setDetails();
+ setDetails();
});
- activitiesToEnable.addAll(activityIdsCopy);
-
- viewer.getControl().setLayoutData(
- new GridData(GridData.FILL_HORIZONTAL));
- viewer.getControl().setFont(dialogFont);
-
- text = new Label(composite, SWT.NONE);
- text.setText(strings.getProperty(WorkbenchTriggerPointAdvisor.PROCEED_MULTI, RESOURCE_BUNDLE
- .getString(WorkbenchTriggerPointAdvisor.PROCEED_MULTI)));
- text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- text.setFont(dialogFont);
- }
- Label seperator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
- seperator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- dontAskButton = new Button(composite, SWT.CHECK);
- dontAskButton.setSelection(false);
- dontAskButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- dontAskButton.setText(strings.getProperty(
- WorkbenchTriggerPointAdvisor.DONT_ASK, RESOURCE_BUNDLE
- .getString(WorkbenchTriggerPointAdvisor.DONT_ASK)));
- dontAskButton.setFont(dialogFont);
-
- detailsComposite = new Composite(composite, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- detailsComposite.setLayout(layout);
- detailsLabel = new Label(detailsComposite, SWT.NONE);
- detailsLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- detailsLabel.setFont(dialogFont);
-
- detailsText = new Text(detailsComposite, SWT.WRAP | SWT.V_SCROLL
- | SWT.BORDER | SWT.READ_ONLY);
- detailsText.setLayoutData(new GridData(GridData.FILL_BOTH));
- detailsText.setFont(dialogFont);
-
- setDetails();
-
- GridData data = new GridData(GridData.FILL_BOTH);
- detailsComposite.setLayoutData(data);
- setDetailHints();
-
- return composite;
- }
-
- /**
- * Set the text of the detail label and text area.
- */
- protected void setDetails() {
- if (selectedActivity == null) {
- detailsLabel
- .setText(strings
- .getProperty(
- WorkbenchTriggerPointAdvisor.NO_DETAILS,
- RESOURCE_BUNDLE
- .getString(WorkbenchTriggerPointAdvisor.NO_DETAILS)));
- detailsText.setText(""); //$NON-NLS-1$
- } else {
- IActivity activity = PlatformUI.getWorkbench().getActivitySupport()
- .getActivityManager().getActivity(selectedActivity);
- String name;
- try {
- name = activity.getName();
- } catch (NotDefinedException e1) {
- name = selectedActivity;
- }
- String desc;
- try {
- desc = activity.getDescription();
- } catch (NotDefinedException e) {
- desc = RESOURCE_BUNDLE.getString("noDescAvailable"); //$NON-NLS-1$
- }
- detailsLabel.setText(MessageFormat.format(RESOURCE_BUNDLE
- .getString("detailsLabel"), name)); //$NON-NLS-1$
- detailsText.setText(desc);
- }
- }
-
- /**
- *
- */
- protected void setDetailHints() {
- GridData data = (GridData) detailsComposite.getLayoutData();
- if (showDetails) {
- Composite parent = detailsComposite.getParent();
- data.widthHint = parent.getSize().x - ((GridLayout)parent.getLayout()).marginWidth * 2;
- data.heightHint = convertHeightInCharsToPixels(5);
- } else {
- data.widthHint = 0;
- data.heightHint = 0;
- }
- }
-
- /**
- * Set the label of the detail button based on whether we're currently showing the description text.
- */
- private void setDetailButtonLabel() {
- if (!showDetails) {
+ activitiesToEnable.addAll(activityIdsCopy);
+
+ viewer.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ viewer.getControl().setFont(dialogFont);
+
+ text = new Label(composite, SWT.NONE);
+ text.setText(strings.getProperty(WorkbenchTriggerPointAdvisor.PROCEED_MULTI,
+ RESOURCE_BUNDLE.getString(WorkbenchTriggerPointAdvisor.PROCEED_MULTI)));
+ text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ text.setFont(dialogFont);
+ }
+ Label seperator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
+ seperator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ dontAskButton = new Button(composite, SWT.CHECK);
+ dontAskButton.setSelection(false);
+ dontAskButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ dontAskButton.setText(strings.getProperty(WorkbenchTriggerPointAdvisor.DONT_ASK,
+ RESOURCE_BUNDLE.getString(WorkbenchTriggerPointAdvisor.DONT_ASK)));
+ dontAskButton.setFont(dialogFont);
+
+ detailsComposite = new Composite(composite, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ detailsComposite.setLayout(layout);
+ detailsLabel = new Label(detailsComposite, SWT.NONE);
+ detailsLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ detailsLabel.setFont(dialogFont);
+
+ detailsText = new Text(detailsComposite, SWT.WRAP | SWT.V_SCROLL | SWT.BORDER | SWT.READ_ONLY);
+ detailsText.setLayoutData(new GridData(GridData.FILL_BOTH));
+ detailsText.setFont(dialogFont);
+
+ setDetails();
+
+ GridData data = new GridData(GridData.FILL_BOTH);
+ detailsComposite.setLayoutData(data);
+ setDetailHints();
+
+ return composite;
+ }
+
+ /**
+ * Set the text of the detail label and text area.
+ */
+ protected void setDetails() {
+ if (selectedActivity == null) {
+ detailsLabel.setText(strings.getProperty(WorkbenchTriggerPointAdvisor.NO_DETAILS,
+ RESOURCE_BUNDLE.getString(WorkbenchTriggerPointAdvisor.NO_DETAILS)));
+ detailsText.setText(""); //$NON-NLS-1$
+ } else {
+ IActivity activity = PlatformUI.getWorkbench().getActivitySupport().getActivityManager()
+ .getActivity(selectedActivity);
+ String name;
+ try {
+ name = activity.getName();
+ } catch (NotDefinedException e1) {
+ name = selectedActivity;
+ }
+ String desc;
+ try {
+ desc = activity.getDescription();
+ } catch (NotDefinedException e) {
+ desc = RESOURCE_BUNDLE.getString("noDescAvailable"); //$NON-NLS-1$
+ }
+ detailsLabel.setText(MessageFormat.format(RESOURCE_BUNDLE.getString("detailsLabel"), name)); //$NON-NLS-1$
+ detailsText.setText(desc);
+ }
+ }
+
+ /**
+ *
+ */
+ protected void setDetailHints() {
+ GridData data = (GridData) detailsComposite.getLayoutData();
+ if (showDetails) {
+ Composite parent = detailsComposite.getParent();
+ data.widthHint = parent.getSize().x - ((GridLayout) parent.getLayout()).marginWidth * 2;
+ data.heightHint = convertHeightInCharsToPixels(5);
+ } else {
+ data.widthHint = 0;
+ data.heightHint = 0;
+ }
+ }
+
+ /**
+ * Set the label of the detail button based on whether we're currently showing
+ * the description text.
+ */
+ private void setDetailButtonLabel() {
+ if (!showDetails) {
detailsButton.setText(RESOURCE_BUNDLE.getString("showDetails")); //$NON-NLS-1$
} else {
detailsButton.setText(RESOURCE_BUNDLE.getString("hideDetails")); //$NON-NLS-1$
}
- }
+ }
- @Override
+ @Override
protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(RESOURCE_BUNDLE.getString("title")); //$NON-NLS-1$
- }
-
- /**
- * @return Returns whether the user has declared that there is to be no further
- * prompting for the supplied activities
- */
- public boolean getDontAsk() {
- return dontAsk;
- }
-
- /**
- * @return Returns the activities to enable
- */
+ super.configureShell(newShell);
+ newShell.setText(RESOURCE_BUNDLE.getString("title")); //$NON-NLS-1$
+ }
+
+ /**
+ * @return Returns whether the user has declared that there is to be no further
+ * prompting for the supplied activities
+ */
+ public boolean getDontAsk() {
+ return dontAsk;
+ }
+
+ /**
+ * @return Returns the activities to enable
+ */
public Set<String> getActivitiesToEnable() {
- return activitiesToEnable;
- }
+ return activitiesToEnable;
+ }
- @Override
+ @Override
protected void okPressed() {
- dontAsk = dontAskButton.getSelection();
- super.okPressed();
- }
+ dontAsk = dontAskButton.getSelection();
+ super.okPressed();
+ }
- @Override
+ @Override
protected void createButtonsForButtonBar(Composite parent) {
- super.createButtonsForButtonBar(parent);
- detailsButton = createButton(parent, IDialogConstants.DETAILS_ID,
- "", false); //$NON-NLS-1$
- setDetailButtonLabel();
- }
+ super.createButtonsForButtonBar(parent);
+ detailsButton = createButton(parent, IDialogConstants.DETAILS_ID, "", false); //$NON-NLS-1$
+ setDetailButtonLabel();
+ }
- @Override
+ @Override
protected void buttonPressed(int buttonId) {
- if (buttonId == IDialogConstants.DETAILS_ID) {
- detailsPressed();
- return;
- }
- super.buttonPressed(buttonId);
- }
-
- /**
- * Handles selection of the Details button.
- */
- private void detailsPressed() {
- showDetails = !showDetails;
- setDetailButtonLabel();
- setDetailHints();
- setDetails();
- ((Composite) getDialogArea()).layout(true);
- getShell().setSize(getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT));
- }
+ if (buttonId == IDialogConstants.DETAILS_ID) {
+ detailsPressed();
+ return;
+ }
+ super.buttonPressed(buttonId);
+ }
+
+ /**
+ * Handles selection of the Details button.
+ */
+ private void detailsPressed() {
+ showDetails = !showDetails;
+ setDetailButtonLabel();
+ setDetailHints();
+ setDetails();
+ ((Composite) getDialogArea()).layout(true);
+ getShell().setSize(getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT));
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ImageBindingRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ImageBindingRegistry.java
index 681ddda9adb..43b8b5e40c9 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ImageBindingRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/ImageBindingRegistry.java
@@ -40,7 +40,7 @@ public class ImageBindingRegistry implements IExtensionChangeHandler {
public ImageBindingRegistry(String tag) {
super();
this.tag = tag;
- IExtension [] extensions = getExtensionPointFilter().getExtensions();
+ IExtension[] extensions = getExtensionPointFilter().getExtensions();
for (IExtension extension : extensions) {
addExtension(PlatformUI.getWorkbench().getExtensionTracker(), extension);
}
@@ -48,14 +48,15 @@ public class ImageBindingRegistry implements IExtensionChangeHandler {
@Override
public void addExtension(IExtensionTracker tracker, IExtension extension) {
- IConfigurationElement [] elements = extension.getConfigurationElements();
+ IConfigurationElement[] elements = extension.getConfigurationElements();
for (IConfigurationElement element : elements) {
if (element.getName().equals(tag)) {
String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
String file = element.getAttribute(IWorkbenchRegistryConstants.ATT_ICON);
if (file == null || id == null) {
- Persistence.log(element, Persistence.ACTIVITY_IMAGE_BINDING_DESC, "definition must contain icon and ID"); //$NON-NLS-1$
- continue; //ignore - malformed
+ Persistence.log(element, Persistence.ACTIVITY_IMAGE_BINDING_DESC,
+ "definition must contain icon and ID"); //$NON-NLS-1$
+ continue; // ignore - malformed
}
if (registry.getDescriptor(id) == null) { // first come, first serve
ImageDescriptor descriptor = AbstractUIPlugin
@@ -70,14 +71,15 @@ public class ImageBindingRegistry implements IExtensionChangeHandler {
}
- /**
- * Return the activity support extension point that this registry is interested in.
- *
- * @return the extension point
- */
+ /**
+ * Return the activity support extension point that this registry is interested
+ * in.
+ *
+ * @return the extension point
+ */
public IExtensionPoint getExtensionPointFilter() {
- return Platform.getExtensionRegistry().getExtensionPoint(
- PlatformUI.PLUGIN_ID, IWorkbenchRegistryConstants.PL_ACTIVITYSUPPORT);
+ return Platform.getExtensionRegistry().getExtensionPoint(PlatformUI.PLUGIN_ID,
+ IWorkbenchRegistryConstants.PL_ACTIVITYSUPPORT);
}
@Override
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/RegistryTriggerPoint.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/RegistryTriggerPoint.java
index b0c78a79428..6fedc27abf0 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/RegistryTriggerPoint.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/RegistryTriggerPoint.java
@@ -24,63 +24,60 @@ import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants;
*/
public class RegistryTriggerPoint extends AbstractTriggerPoint {
- private String id;
+ private String id;
- private IConfigurationElement element;
+ private IConfigurationElement element;
private Map<String, String> hints;
- /**
- * Create a new instance of this class.
- *
- * @param id the id of the trigger point
- * @param element the defining configuration element
- */
- public RegistryTriggerPoint(String id, IConfigurationElement element) {
- this.id = id;
- this.element = element;
- }
+ /**
+ * Create a new instance of this class.
+ *
+ * @param id the id of the trigger point
+ * @param element the defining configuration element
+ */
+ public RegistryTriggerPoint(String id, IConfigurationElement element) {
+ this.id = id;
+ this.element = element;
+ }
- @Override
+ @Override
public String getId() {
- return id;
- }
+ return id;
+ }
- @Override
+ @Override
public String getStringHint(String key) {
- return getHints().get(key);
- }
+ return getHints().get(key);
+ }
- @Override
+ @Override
public boolean getBooleanHint(String key) {
- return Boolean.parseBoolean(getStringHint(key));
- }
+ return Boolean.parseBoolean(getStringHint(key));
+ }
- /**
- * Lazily create the hints.
- *
- * @return the hint map
- */
+ /**
+ * Lazily create the hints.
+ *
+ * @return the hint map
+ */
private Map<String, String> getHints() {
- if (hints == null) {
+ if (hints == null) {
hints = new HashMap<>();
- IConfigurationElement[] hintElements = element
- .getChildren(IWorkbenchRegistryConstants.TAG_HINT);
- for (IConfigurationElement hintElement : hintElements) {
- String id = hintElement
- .getAttribute(IWorkbenchRegistryConstants.ATT_ID);
- String value = hintElement
- .getAttribute(IWorkbenchRegistryConstants.ATT_VALUE);
+ IConfigurationElement[] hintElements = element.getChildren(IWorkbenchRegistryConstants.TAG_HINT);
+ for (IConfigurationElement hintElement : hintElements) {
+ String id = hintElement.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
+ String value = hintElement.getAttribute(IWorkbenchRegistryConstants.ATT_VALUE);
- if (id == null || value == null) {
+ if (id == null || value == null) {
Persistence.log(element, Persistence.ACTIVITY_TRIGGER_HINT_DESC, "hint must contain ID and value"); //$NON-NLS-1$
continue;
}
hints.put(id, value);
- }
- }
+ }
+ }
- return hints;
- }
+ return hints;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/TriggerPointAdvisorDescriptor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/TriggerPointAdvisorDescriptor.java
index b40f3416e36..1f42871d211 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/TriggerPointAdvisorDescriptor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/TriggerPointAdvisorDescriptor.java
@@ -33,17 +33,13 @@ public final class TriggerPointAdvisorDescriptor {
/**
* Create a new instance of this class.
*
- * @param element
- * the configuration element
- * @throws IllegalArgumentException
- * thrown if the element is missing an id attribute
+ * @param element the configuration element
+ * @throws IllegalArgumentException thrown if the element is missing an id
+ * attribute
*/
- public TriggerPointAdvisorDescriptor(IConfigurationElement element)
- throws IllegalArgumentException {
+ public TriggerPointAdvisorDescriptor(IConfigurationElement element) throws IllegalArgumentException {
id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
- if (id == null
- || RegistryReader.getClassValue(element,
- IWorkbenchRegistryConstants.ATT_CLASS) == null) {
+ if (id == null || RegistryReader.getClassValue(element, IWorkbenchRegistryConstants.ATT_CLASS) == null) {
throw new IllegalArgumentException();
}
this.element = element;
@@ -62,11 +58,9 @@ public final class TriggerPointAdvisorDescriptor {
* Create the advisor for this descriptor.
*
* @return the advisor
- * @throws CoreException
- * thrown if there is an issue creating the advisor
+ * @throws CoreException thrown if there is an issue creating the advisor
*/
public ITriggerPointAdvisor createAdvisor() throws CoreException {
- return (ITriggerPointAdvisor) element
- .createExecutableExtension(IWorkbenchRegistryConstants.ATT_CLASS);
+ return (ITriggerPointAdvisor) element.createExecutableExtension(IWorkbenchRegistryConstants.ATT_CLASS);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/TriggerPointAdvisorRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/TriggerPointAdvisorRegistry.java
index 9e0cca93022..dedc703ab47 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/TriggerPointAdvisorRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/TriggerPointAdvisorRegistry.java
@@ -58,9 +58,8 @@ public class TriggerPointAdvisorRegistry {
* @return the advisors
*/
public TriggerPointAdvisorDescriptor[] getAdvisors() {
- IExtensionPoint point = Platform.getExtensionRegistry()
- .getExtensionPoint(PlatformUI.PLUGIN_ID,
- IWorkbenchRegistryConstants.PL_ACTIVITYSUPPORT);
+ IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(PlatformUI.PLUGIN_ID,
+ IWorkbenchRegistryConstants.PL_ACTIVITYSUPPORT);
if (point == null) {
return new TriggerPointAdvisorDescriptor[0];
}
@@ -91,14 +90,12 @@ public class TriggerPointAdvisorRegistry {
/**
* Return the trigger point advisor bound to a given product.
*
- * @param productId
- * the product id
+ * @param productId the product id
* @return the advisor
*/
public TriggerPointAdvisorDescriptor getAdvisorForProduct(String productId) {
- IExtensionPoint point = Platform.getExtensionRegistry()
- .getExtensionPoint(PlatformUI.PLUGIN_ID,
- IWorkbenchRegistryConstants.PL_ACTIVITYSUPPORT);
+ IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(PlatformUI.PLUGIN_ID,
+ IWorkbenchRegistryConstants.PL_ACTIVITYSUPPORT);
if (point == null) {
return null;
}
@@ -126,29 +123,19 @@ public class TriggerPointAdvisorRegistry {
* @param extensions
* @return the advisor id
*/
- private String getAdvisorForProduct(String targetProductId,
- IExtension[] extensions) {
+ private String getAdvisorForProduct(String targetProductId, IExtension[] extensions) {
for (IExtension extension : extensions) {
- IConfigurationElement[] elements = extension
- .getConfigurationElements();
+ IConfigurationElement[] elements = extension.getConfigurationElements();
for (IConfigurationElement element : elements) {
- if (element.getName().equals(
- IWorkbenchRegistryConstants.TAG_ADVISORPRODUCTBINDING)) {
- String advisorId = element
- .getAttribute(IWorkbenchRegistryConstants.ATT_ADVISORID);
- String productId = element
- .getAttribute(IWorkbenchRegistryConstants.ATT_PRODUCTID);
+ if (element.getName().equals(IWorkbenchRegistryConstants.TAG_ADVISORPRODUCTBINDING)) {
+ String advisorId = element.getAttribute(IWorkbenchRegistryConstants.ATT_ADVISORID);
+ String productId = element.getAttribute(IWorkbenchRegistryConstants.ATT_PRODUCTID);
if (advisorId == null || productId == null) {
- IStatus status = new Status(
- IStatus.ERROR,
- element.getDeclaringExtension()
- .getContributor().getName(),
- IStatus.ERROR,
+ IStatus status = new Status(IStatus.ERROR,
+ element.getDeclaringExtension().getContributor().getName(), IStatus.ERROR,
"triggerPointAdvisorId and productId must be defined.", new IllegalArgumentException()); //$NON-NLS-1$
- WorkbenchPlugin
- .log(
- "Invalid trigger point advisor binding", status); //$NON-NLS-1$
+ WorkbenchPlugin.log("Invalid trigger point advisor binding", status); //$NON-NLS-1$
continue;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/TriggerPointManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/TriggerPointManager.java
index 916b4dcfbfc..95f2a1c4df1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/TriggerPointManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/TriggerPointManager.java
@@ -37,92 +37,86 @@ public class TriggerPointManager implements ITriggerPointManager, IExtensionChan
private HashMap<String, AbstractTriggerPoint> triggerMap = new HashMap<>();
- /**
- *
- */
- public TriggerPointManager() {
- super();
- triggerMap.put(ITriggerPointManager.UNKNOWN_TRIGGER_POINT_ID,
- new AbstractTriggerPoint() {
+ /**
+ *
+ */
+ public TriggerPointManager() {
+ super();
+ triggerMap.put(ITriggerPointManager.UNKNOWN_TRIGGER_POINT_ID, new AbstractTriggerPoint() {
- @Override
- public String getId() {
- return ITriggerPointManager.UNKNOWN_TRIGGER_POINT_ID;
- }
+ @Override
+ public String getId() {
+ return ITriggerPointManager.UNKNOWN_TRIGGER_POINT_ID;
+ }
- @Override
- public String getStringHint(String key) {
- if (ITriggerPoint.HINT_INTERACTIVE.equals(key)) {
- // TODO: change to false when we have mapped our
- // trigger points
- return Boolean.TRUE.toString();
- }
- return null;
- }
+ @Override
+ public String getStringHint(String key) {
+ if (ITriggerPoint.HINT_INTERACTIVE.equals(key)) {
+ // TODO: change to false when we have mapped our
+ // trigger points
+ return Boolean.TRUE.toString();
+ }
+ return null;
+ }
- @Override
- public boolean getBooleanHint(String key) {
- if (ITriggerPoint.HINT_INTERACTIVE.equals(key)) {
- // TODO: change to false when we have mapped our
- // trigger points
- return true;
- }
- return false;
- }
- });
- IExtensionTracker tracker = PlatformUI.getWorkbench().getExtensionTracker();
- tracker.registerHandler(this, ExtensionTracker.createExtensionPointFilter(getExtensionPointFilter()));
+ @Override
+ public boolean getBooleanHint(String key) {
+ if (ITriggerPoint.HINT_INTERACTIVE.equals(key)) {
+ // TODO: change to false when we have mapped our
+ // trigger points
+ return true;
+ }
+ return false;
+ }
+ });
+ IExtensionTracker tracker = PlatformUI.getWorkbench().getExtensionTracker();
+ tracker.registerHandler(this, ExtensionTracker.createExtensionPointFilter(getExtensionPointFilter()));
- IExtensionPoint point = getExtensionPointFilter();
- IExtension[] extensions = point.getExtensions();
- for (IExtension extension : extensions) {
- addExtension(tracker,
- extension);
- }
- }
+ IExtensionPoint point = getExtensionPointFilter();
+ IExtension[] extensions = point.getExtensions();
+ for (IExtension extension : extensions) {
+ addExtension(tracker, extension);
+ }
+ }
- @Override
+ @Override
public ITriggerPoint getTriggerPoint(String id) {
- return triggerMap.get(id);
- }
+ return triggerMap.get(id);
+ }
- @Override
+ @Override
public Set<String> getDefinedTriggerPointIds() {
return triggerMap.keySet();
- }
+ }
- @Override
+ @Override
public void removeExtension(IExtension extension, Object[] objects) {
- for (Object object : objects) {
- if (object instanceof RegistryTriggerPoint) {
- triggerMap.remove(((RegistryTriggerPoint) object).getId());
- }
- }
- }
+ for (Object object : objects) {
+ if (object instanceof RegistryTriggerPoint) {
+ triggerMap.remove(((RegistryTriggerPoint) object).getId());
+ }
+ }
+ }
- @Override
+ @Override
public void addExtension(IExtensionTracker tracker, IExtension extension) {
- IConfigurationElement[] elements = extension.getConfigurationElements();
- for (IConfigurationElement element : elements) {
- if (element.getName().equals(
- IWorkbenchRegistryConstants.TAG_TRIGGERPOINT)) {
- String id = element
- .getAttribute(IWorkbenchRegistryConstants.ATT_ID);
- if (id == null) {
+ IConfigurationElement[] elements = extension.getConfigurationElements();
+ for (IConfigurationElement element : elements) {
+ if (element.getName().equals(IWorkbenchRegistryConstants.TAG_TRIGGERPOINT)) {
+ String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
+ if (id == null) {
Persistence.log(element, Persistence.ACTIVITY_TRIGGER_DESC, "missing a unique identifier"); //$NON-NLS-1$
continue;
}
- RegistryTriggerPoint triggerPoint = new RegistryTriggerPoint(
- id, element);
- triggerMap.put(id, triggerPoint);
- tracker.registerObject(extension, triggerPoint,
- IExtensionTracker.REF_WEAK);
- }
- }
- }
+ RegistryTriggerPoint triggerPoint = new RegistryTriggerPoint(id, element);
+ triggerMap.put(id, triggerPoint);
+ tracker.registerObject(extension, triggerPoint, IExtensionTracker.REF_WEAK);
+ }
+ }
+ }
- private IExtensionPoint getExtensionPointFilter() {
- return Platform.getExtensionRegistry().getExtensionPoint(
- PlatformUI.PLUGIN_ID, IWorkbenchRegistryConstants.PL_ACTIVITYSUPPORT);
- }
+ private IExtensionPoint getExtensionPointFilter() {
+ return Platform.getExtensionRegistry().getExtensionPoint(PlatformUI.PLUGIN_ID,
+ IWorkbenchRegistryConstants.PL_ACTIVITYSUPPORT);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/WorkbenchActivitySupport.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/WorkbenchActivitySupport.java
index e2652425e48..b7348f05019 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/WorkbenchActivitySupport.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/WorkbenchActivitySupport.java
@@ -59,13 +59,15 @@ import org.eclipse.ui.internal.misc.StatusUtil;
import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants;
/**
- * Implementation of {@link org.eclipse.ui.activities.IWorkbenchActivitySupport}.
+ * Implementation of
+ * {@link org.eclipse.ui.activities.IWorkbenchActivitySupport}.
+ *
* @since 3.0
*/
public class WorkbenchActivitySupport implements IWorkbenchActivitySupport, IExtensionChangeHandler {
- private MutableActivityManager mutableActivityManager;
+ private MutableActivityManager mutableActivityManager;
- private ProxyActivityManager proxyActivityManager;
+ private ProxyActivityManager proxyActivityManager;
private ImageBindingRegistry activityImageBindingRegistry;
@@ -78,249 +80,210 @@ public class WorkbenchActivitySupport implements IWorkbenchActivitySupport, IExt
/**
* Create a new instance of this class.
*/
- public WorkbenchActivitySupport() {
+ public WorkbenchActivitySupport() {
triggerPointManager = new TriggerPointManager();
IExtensionTracker tracker = PlatformUI.getWorkbench().getExtensionTracker();
- tracker.registerHandler(this, ExtensionTracker.createExtensionPointFilter(getActivitySupportExtensionPoint()));
- mutableActivityManager = new MutableActivityManager(getTriggerPointAdvisor());
- proxyActivityManager = new ProxyActivityManager(mutableActivityManager);
- mutableActivityManager
- .addActivityManagerListener(new IActivityManagerListener() {
-
- private Set<String> lastEnabled = new HashSet<>(
- mutableActivityManager.getEnabledActivityIds());
-
- @Override
- public void activityManagerChanged(
- ActivityManagerEvent activityManagerEvent) {
- Set<String> activityIds = mutableActivityManager
- .getEnabledActivityIds();
- // only update the windows if we've not processed this new enablement state already.
- if (!activityIds.equals(lastEnabled)) {
- lastEnabled = new HashSet<>(activityIds);
-
- // abort if the workbench isn't running
- if (!PlatformUI.isWorkbenchRunning()) {
- return;
- }
-
- // refresh the managers on all windows.
- final IWorkbench workbench = PlatformUI.getWorkbench();
- IWorkbenchWindow[] windows = workbench.getWorkbenchWindows();
- for (IWorkbenchWindow wWindow : windows) {
- if (wWindow instanceof WorkbenchWindow) {
- final WorkbenchWindow window = (WorkbenchWindow) wWindow;
-
- final ProgressMonitorDialog dialog = new ProgressMonitorDialog(window.getShell());
-
- final IRunnableWithProgress runnable = new IRunnableWithProgress() {
-
- /**
- * When this operation should open a dialog
- */
- private long openTime;
-
- /**
- * Whether the dialog has been opened yet.
- */
- private boolean dialogOpened = false;
-
- @Override
- public void run(IProgressMonitor monitor) {
-
- openTime = System
- .currentTimeMillis()
- + workbench
- .getProgressService()
- .getLongOperationTime();
-
- //two work units - updating the window bars, and updating view bars
- monitor
- .beginTask(
- ActivityMessages.ManagerTask, 2);
-
- monitor
- .subTask(ActivityMessages.ManagerWindowSubTask);
-
- //update window managers...
- updateWindowBars(window);
- monitor.worked(1);
-
- monitor
- .subTask(ActivityMessages.ManagerViewsSubTask);
- // update all of the (realized) views in all of the pages
- IWorkbenchPage[] pages = window
- .getPages();
- for (IWorkbenchPage page : pages) {
- IViewReference[] refs = page.getViewReferences();
- for (IViewReference ref : refs) {
- IViewPart part = ref.getView(false);
- if (part != null) {
- updateViewBars(part);
- }
- }
- }
- monitor.worked(1);
-
- monitor.done();
- }
-
- /**
- * Update the managers on the given given view.
- *
- * @param part the view to update
- */
- private void updateViewBars(
- IViewPart part) {
- IViewSite viewSite = part
- .getViewSite();
- // check for badly behaving or badly initialized views
- if (viewSite == null) {
- return;
+ tracker.registerHandler(this, ExtensionTracker.createExtensionPointFilter(getActivitySupportExtensionPoint()));
+ mutableActivityManager = new MutableActivityManager(getTriggerPointAdvisor());
+ proxyActivityManager = new ProxyActivityManager(mutableActivityManager);
+ mutableActivityManager.addActivityManagerListener(new IActivityManagerListener() {
+
+ private Set<String> lastEnabled = new HashSet<>(mutableActivityManager.getEnabledActivityIds());
+
+ @Override
+ public void activityManagerChanged(ActivityManagerEvent activityManagerEvent) {
+ Set<String> activityIds = mutableActivityManager.getEnabledActivityIds();
+ // only update the windows if we've not processed this new enablement state
+ // already.
+ if (!activityIds.equals(lastEnabled)) {
+ lastEnabled = new HashSet<>(activityIds);
+
+ // abort if the workbench isn't running
+ if (!PlatformUI.isWorkbenchRunning()) {
+ return;
+ }
+
+ // refresh the managers on all windows.
+ final IWorkbench workbench = PlatformUI.getWorkbench();
+ IWorkbenchWindow[] windows = workbench.getWorkbenchWindows();
+ for (IWorkbenchWindow wWindow : windows) {
+ if (wWindow instanceof WorkbenchWindow) {
+ final WorkbenchWindow window = (WorkbenchWindow) wWindow;
+
+ final ProgressMonitorDialog dialog = new ProgressMonitorDialog(window.getShell());
+
+ final IRunnableWithProgress runnable = new IRunnableWithProgress() {
+
+ /**
+ * When this operation should open a dialog
+ */
+ private long openTime;
+
+ /**
+ * Whether the dialog has been opened yet.
+ */
+ private boolean dialogOpened = false;
+
+ @Override
+ public void run(IProgressMonitor monitor) {
+
+ openTime = System.currentTimeMillis()
+ + workbench.getProgressService().getLongOperationTime();
+
+ // two work units - updating the window bars, and updating view bars
+ monitor.beginTask(ActivityMessages.ManagerTask, 2);
+
+ monitor.subTask(ActivityMessages.ManagerWindowSubTask);
+
+ // update window managers...
+ updateWindowBars(window);
+ monitor.worked(1);
+
+ monitor.subTask(ActivityMessages.ManagerViewsSubTask);
+ // update all of the (realized) views in all of the pages
+ IWorkbenchPage[] pages = window.getPages();
+ for (IWorkbenchPage page : pages) {
+ IViewReference[] refs = page.getViewReferences();
+ for (IViewReference ref : refs) {
+ IViewPart part = ref.getView(false);
+ if (part != null) {
+ updateViewBars(part);
}
- IActionBars bars = viewSite
- .getActionBars();
- IContributionManager manager = bars
- .getMenuManager();
- if (manager != null) {
- updateManager(manager);
- }
- manager = bars.getToolBarManager();
- if (manager != null) {
- updateManager(manager);
- }
- manager = bars
- .getStatusLineManager();
- if (manager != null) {
- updateManager(manager);
- }
- }
-
- /**
- * Update the managers on the given window.
- *
- * @param window the window to update
- */
- private void updateWindowBars(
- final WorkbenchWindow window) {
- IContributionManager manager = window
- .getMenuBarManager();
- if (manager != null) {
- updateManager(manager);
- }
- manager = window
- .getCoolBarManager2();
- if (manager != null) {
- updateManager(manager);
- }
- manager = window
- .getToolBarManager2();
- if (manager != null) {
- updateManager(manager);
- }
- manager = window
- .getStatusLineManager();
- if (manager != null) {
- updateManager(manager);
- }
- }
-
- /**
- * Update the given manager in the UI thread.
- * This may also open the progress dialog if
- * the operation is taking too long.
- *
- * @param manager the manager to update
- */
- private void updateManager(
- final IContributionManager manager) {
- if (!dialogOpened
- && System
- .currentTimeMillis() > openTime) {
- dialog.open();
- dialogOpened = true;
- }
-
- manager.update(true);
- }
- };
-
- // don't open the dialog by default - that'll be
- // handled by the runnable if we take too long
- dialog.setOpenOnRun(false);
- // run this in the UI thread
- workbench.getDisplay().asyncExec(
- () -> BusyIndicator
- .showWhile(
- workbench
- .getDisplay(),
- () -> {
- try {
- dialog
- .run(
- false,
- false,
- runnable);
- } catch (InvocationTargetException e1) {
- log(e1);
- } catch (InterruptedException e2) {
- log(e2);
- }
- }));
- }
- }
- }
- }
-
- /**
- * Logs an error message to the workbench log.
- *
- * @param e the exception to log
- */
- private void log(Exception e) {
- StatusUtil.newStatus(IStatus.ERROR,
- "Could not update contribution managers", e); //$NON-NLS-1$
- }
- });
- }
-
- @Override
+ }
+ }
+ monitor.worked(1);
+
+ monitor.done();
+ }
+
+ /**
+ * Update the managers on the given given view.
+ *
+ * @param part the view to update
+ */
+ private void updateViewBars(IViewPart part) {
+ IViewSite viewSite = part.getViewSite();
+ // check for badly behaving or badly initialized views
+ if (viewSite == null) {
+ return;
+ }
+ IActionBars bars = viewSite.getActionBars();
+ IContributionManager manager = bars.getMenuManager();
+ if (manager != null) {
+ updateManager(manager);
+ }
+ manager = bars.getToolBarManager();
+ if (manager != null) {
+ updateManager(manager);
+ }
+ manager = bars.getStatusLineManager();
+ if (manager != null) {
+ updateManager(manager);
+ }
+ }
+
+ /**
+ * Update the managers on the given window.
+ *
+ * @param window the window to update
+ */
+ private void updateWindowBars(final WorkbenchWindow window) {
+ IContributionManager manager = window.getMenuBarManager();
+ if (manager != null) {
+ updateManager(manager);
+ }
+ manager = window.getCoolBarManager2();
+ if (manager != null) {
+ updateManager(manager);
+ }
+ manager = window.getToolBarManager2();
+ if (manager != null) {
+ updateManager(manager);
+ }
+ manager = window.getStatusLineManager();
+ if (manager != null) {
+ updateManager(manager);
+ }
+ }
+
+ /**
+ * Update the given manager in the UI thread. This may also open the progress
+ * dialog if the operation is taking too long.
+ *
+ * @param manager the manager to update
+ */
+ private void updateManager(final IContributionManager manager) {
+ if (!dialogOpened && System.currentTimeMillis() > openTime) {
+ dialog.open();
+ dialogOpened = true;
+ }
+
+ manager.update(true);
+ }
+ };
+
+ // don't open the dialog by default - that'll be
+ // handled by the runnable if we take too long
+ dialog.setOpenOnRun(false);
+ // run this in the UI thread
+ workbench.getDisplay()
+ .asyncExec(() -> BusyIndicator.showWhile(workbench.getDisplay(), () -> {
+ try {
+ dialog.run(false, false, runnable);
+ } catch (InvocationTargetException e1) {
+ log(e1);
+ } catch (InterruptedException e2) {
+ log(e2);
+ }
+ }));
+ }
+ }
+ }
+ }
+
+ /**
+ * Logs an error message to the workbench log.
+ *
+ * @param e the exception to log
+ */
+ private void log(Exception e) {
+ StatusUtil.newStatus(IStatus.ERROR, "Could not update contribution managers", e); //$NON-NLS-1$
+ }
+ });
+ }
+
+ @Override
public IActivityManager getActivityManager() {
- return proxyActivityManager;
- }
+ return proxyActivityManager;
+ }
- @Override
+ @Override
public void setEnabledActivityIds(Set<String> enabledActivityIds) {
- mutableActivityManager.setEnabledActivityIds(enabledActivityIds);
- }
+ mutableActivityManager.setEnabledActivityIds(enabledActivityIds);
+ }
@Override
public ImageDescriptor getImageDescriptor(IActivity activity) {
if (activity.isDefined()) {
- ImageDescriptor descriptor = getActivityImageBindingRegistry()
- .getImageDescriptor(activity.getId());
+ ImageDescriptor descriptor = getActivityImageBindingRegistry().getImageDescriptor(activity.getId());
if (descriptor != null) {
return descriptor;
}
}
- return WorkbenchImages
- .getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJ_ACTIVITY);
+ return WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJ_ACTIVITY);
}
@Override
public ImageDescriptor getImageDescriptor(ICategory category) {
if (category.isDefined()) {
- ImageDescriptor descriptor = getCategoryImageBindingRegistry()
- .getImageDescriptor(category.getId());
+ ImageDescriptor descriptor = getCategoryImageBindingRegistry().getImageDescriptor(category.getId());
if (descriptor != null) {
return descriptor;
}
}
- return WorkbenchImages
- .getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJ_ACTIVITY_CATEGORY);
+ return WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJ_ACTIVITY_CATEGORY);
}
-
/**
* Return the activity image registry.
*
@@ -329,14 +292,10 @@ public class WorkbenchActivitySupport implements IWorkbenchActivitySupport, IExt
*/
private ImageBindingRegistry getActivityImageBindingRegistry() {
if (activityImageBindingRegistry == null) {
- activityImageBindingRegistry = new ImageBindingRegistry(IWorkbenchRegistryConstants.TAG_ACTIVITY_IMAGE_BINDING);
- PlatformUI
- .getWorkbench()
- .getExtensionTracker()
- .registerHandler(
- activityImageBindingRegistry,
- ExtensionTracker
- .createExtensionPointFilter(getActivitySupportExtensionPoint()));
+ activityImageBindingRegistry = new ImageBindingRegistry(
+ IWorkbenchRegistryConstants.TAG_ACTIVITY_IMAGE_BINDING);
+ PlatformUI.getWorkbench().getExtensionTracker().registerHandler(activityImageBindingRegistry,
+ ExtensionTracker.createExtensionPointFilter(getActivitySupportExtensionPoint()));
}
return activityImageBindingRegistry;
}
@@ -349,14 +308,10 @@ public class WorkbenchActivitySupport implements IWorkbenchActivitySupport, IExt
*/
private ImageBindingRegistry getCategoryImageBindingRegistry() {
if (categoryImageBindingRegistry == null) {
- categoryImageBindingRegistry = new ImageBindingRegistry(IWorkbenchRegistryConstants.TAG_CATEGORY_IMAGE_BINDING);
- PlatformUI
- .getWorkbench()
- .getExtensionTracker()
- .registerHandler(
- categoryImageBindingRegistry,
- ExtensionTracker
- .createExtensionPointFilter(getActivitySupportExtensionPoint()));
+ categoryImageBindingRegistry = new ImageBindingRegistry(
+ IWorkbenchRegistryConstants.TAG_CATEGORY_IMAGE_BINDING);
+ PlatformUI.getWorkbench().getExtensionTracker().registerHandler(categoryImageBindingRegistry,
+ ExtensionTracker.createExtensionPointFilter(getActivitySupportExtensionPoint()));
}
return categoryImageBindingRegistry;
}
@@ -393,9 +348,9 @@ public class WorkbenchActivitySupport implements IWorkbenchActivitySupport, IExt
}
IProduct product = Platform.getProduct();
- if (product != null) {
- TriggerPointAdvisorDescriptor descriptor = TriggerPointAdvisorRegistry
- .getInstance().getAdvisorForProduct(product.getId());
+ if (product != null) {
+ TriggerPointAdvisorDescriptor descriptor = TriggerPointAdvisorRegistry.getInstance()
+ .getAdvisorForProduct(product.getId());
if (descriptor != null) {
try {
advisor = descriptor.createAdvisor();
@@ -403,7 +358,7 @@ public class WorkbenchActivitySupport implements IWorkbenchActivitySupport, IExt
WorkbenchPlugin.log("could not create trigger point advisor", e); //$NON-NLS-1$
}
}
- }
+ }
if (advisor == null) {
advisor = new WorkbenchTriggerPointAdvisor();
@@ -427,15 +382,15 @@ public class WorkbenchActivitySupport implements IWorkbenchActivitySupport, IExt
}
}
- /**
- * Return the activity support extension point.
- *
- * @return the activity support extension point.
- * @since 3.1
- */
+ /**
+ * Return the activity support extension point.
+ *
+ * @return the activity support extension point.
+ * @since 3.1
+ */
private IExtensionPoint getActivitySupportExtensionPoint() {
- return Platform.getExtensionRegistry().getExtensionPoint(
- PlatformUI.PLUGIN_ID, IWorkbenchRegistryConstants.PL_ACTIVITYSUPPORT);
+ return Platform.getExtensionRegistry().getExtensionPoint(PlatformUI.PLUGIN_ID,
+ IWorkbenchRegistryConstants.PL_ACTIVITYSUPPORT);
}
@Override
@@ -448,10 +403,10 @@ public class WorkbenchActivitySupport implements IWorkbenchActivitySupport, IExt
}
}
- @Override
+ @Override
public IMutableActivityManager createWorkingCopy() {
- MutableActivityManager clone = (MutableActivityManager) mutableActivityManager.clone();
- clone.unhookRegistryListeners();
- return clone;
- }
+ MutableActivityManager clone = (MutableActivityManager) mutableActivityManager.clone();
+ clone.unhookRegistryListeners();
+ return clone;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/WorkbenchTriggerPoints.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/WorkbenchTriggerPoints.java
index 4ccc15c9009..f6a96dbd372 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/WorkbenchTriggerPoints.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/activities/ws/WorkbenchTriggerPoints.java
@@ -18,24 +18,28 @@ package org.eclipse.ui.internal.activities.ws;
*/
public interface WorkbenchTriggerPoints {
- /**
- * New wizard trigger point identifier. Value <code>org.eclipse.ui.newWizards</code>.
- */
- String NEW_WIZARDS = "org.eclipse.ui.newWizards"; //$NON-NLS-1$
+ /**
+ * New wizard trigger point identifier. Value
+ * <code>org.eclipse.ui.newWizards</code>.
+ */
+ String NEW_WIZARDS = "org.eclipse.ui.newWizards"; //$NON-NLS-1$
- /**
- * Perspective opening trigger point identifier. Value <code>org.eclipse.ui.openPerspectiveDialog</code>.
- */
- String OPEN_PERSPECITVE_DIALOG = "org.eclipse.ui.openPerspectiveDialog"; //$NON-NLS-1$
+ /**
+ * Perspective opening trigger point identifier. Value
+ * <code>org.eclipse.ui.openPerspectiveDialog</code>.
+ */
+ String OPEN_PERSPECITVE_DIALOG = "org.eclipse.ui.openPerspectiveDialog"; //$NON-NLS-1$
- /**
- * Import wizards trigger point identifier. Value <code>org.eclipse.ui.importWizards</code>.
- */
- String IMPORT_WIZARDS = "org.eclipse.ui.importWizards"; //$NON-NLS-1$
+ /**
+ * Import wizards trigger point identifier. Value
+ * <code>org.eclipse.ui.importWizards</code>.
+ */
+ String IMPORT_WIZARDS = "org.eclipse.ui.importWizards"; //$NON-NLS-1$
- /**
- * Export wizards trigger point identifier. Value <code>org.eclipse.ui.exportWizards</code>.
- */
- String EXPORT_WIZARDS = "org.eclipse.ui.exportWizards"; //$NON-NLS-1$
+ /**
+ * Export wizards trigger point identifier. Value
+ * <code>org.eclipse.ui.exportWizards</code>.
+ */
+ String EXPORT_WIZARDS = "org.eclipse.ui.exportWizards"; //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/application/CompatibilityActionBarAdvisor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/application/CompatibilityActionBarAdvisor.java
index df9f934cb91..da53200b211 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/application/CompatibilityActionBarAdvisor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/application/CompatibilityActionBarAdvisor.java
@@ -18,36 +18,35 @@ import org.eclipse.ui.application.IActionBarConfigurer;
import org.eclipse.ui.application.WorkbenchAdvisor;
/**
- * An implementation of <code>ActionBarAdvisor</code> that
- * calls back to the 3.0 legacy methods on <code>WorkbenchAdvisor</code>
- * for backwards compatibility.
+ * An implementation of <code>ActionBarAdvisor</code> that calls back to the 3.0
+ * legacy methods on <code>WorkbenchAdvisor</code> for backwards compatibility.
*
* @since 3.1
*/
public class CompatibilityActionBarAdvisor extends ActionBarAdvisor {
- private WorkbenchAdvisor wbAdvisor;
+ private WorkbenchAdvisor wbAdvisor;
- /**
- * Creates a new compatibility action bar advisor.
- *
- * @param wbAdvisor the workbench advisor
- * @param configurer the action bar configurer
- */
- public CompatibilityActionBarAdvisor(WorkbenchAdvisor wbAdvisor, IActionBarConfigurer configurer) {
- super(configurer);
- this.wbAdvisor = wbAdvisor;
- }
+ /**
+ * Creates a new compatibility action bar advisor.
+ *
+ * @param wbAdvisor the workbench advisor
+ * @param configurer the action bar configurer
+ */
+ public CompatibilityActionBarAdvisor(WorkbenchAdvisor wbAdvisor, IActionBarConfigurer configurer) {
+ super(configurer);
+ this.wbAdvisor = wbAdvisor;
+ }
- @Override
+ @Override
public void fillActionBars(int flags) {
- IActionBarConfigurer abc = getActionBarConfigurer();
- wbAdvisor.fillActionBars(abc.getWindowConfigurer().getWindow(), abc, flags);
- }
+ IActionBarConfigurer abc = getActionBarConfigurer();
+ wbAdvisor.fillActionBars(abc.getWindowConfigurer().getWindow(), abc, flags);
+ }
- @Override
+ @Override
public boolean isApplicationMenu(String menuId) {
- IActionBarConfigurer abc = getActionBarConfigurer();
- return wbAdvisor.isApplicationMenu(abc.getWindowConfigurer(), menuId);
- }
+ IActionBarConfigurer abc = getActionBarConfigurer();
+ return wbAdvisor.isApplicationMenu(abc.getWindowConfigurer(), menuId);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/application/CompatibilityWorkbenchWindowAdvisor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/application/CompatibilityWorkbenchWindowAdvisor.java
index b27d7866036..79b764d0f0b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/application/CompatibilityWorkbenchWindowAdvisor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/application/CompatibilityWorkbenchWindowAdvisor.java
@@ -23,79 +23,79 @@ import org.eclipse.ui.application.WorkbenchAdvisor;
import org.eclipse.ui.application.WorkbenchWindowAdvisor;
/**
- * An implementation of <code>WorkbenchWindowAdvisor</code> that
- * calls back to the 3.0 legacy methods on <code>WorkbenchAdvisor</code>
- * for backwards compatibility.
+ * An implementation of <code>WorkbenchWindowAdvisor</code> that calls back to
+ * the 3.0 legacy methods on <code>WorkbenchAdvisor</code> for backwards
+ * compatibility.
*
* @since 3.1
*/
public class CompatibilityWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
- private WorkbenchAdvisor wbAdvisor;
-
- /**
- * Creates a new compatibility workbench window advisor.
- *
- * @param wbAdvisor the workbench advisor
- * @param windowConfigurer the window configurer
- */
- public CompatibilityWorkbenchWindowAdvisor(WorkbenchAdvisor wbAdvisor, IWorkbenchWindowConfigurer windowConfigurer) {
- super(windowConfigurer);
- this.wbAdvisor = wbAdvisor;
- }
-
- @Override
+ private WorkbenchAdvisor wbAdvisor;
+
+ /**
+ * Creates a new compatibility workbench window advisor.
+ *
+ * @param wbAdvisor the workbench advisor
+ * @param windowConfigurer the window configurer
+ */
+ public CompatibilityWorkbenchWindowAdvisor(WorkbenchAdvisor wbAdvisor,
+ IWorkbenchWindowConfigurer windowConfigurer) {
+ super(windowConfigurer);
+ this.wbAdvisor = wbAdvisor;
+ }
+
+ @Override
public void preWindowOpen() {
- wbAdvisor.preWindowOpen(getWindowConfigurer());
- }
+ wbAdvisor.preWindowOpen(getWindowConfigurer());
+ }
- @Override
+ @Override
public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer configurer) {
- return new CompatibilityActionBarAdvisor(wbAdvisor, configurer);
- }
+ return new CompatibilityActionBarAdvisor(wbAdvisor, configurer);
+ }
- @Override
+ @Override
public void postWindowRestore() throws WorkbenchException {
- wbAdvisor.postWindowRestore(getWindowConfigurer());
- }
+ wbAdvisor.postWindowRestore(getWindowConfigurer());
+ }
- @Override
+ @Override
public void openIntro() {
- wbAdvisor.openIntro(getWindowConfigurer());
- }
+ wbAdvisor.openIntro(getWindowConfigurer());
+ }
- @Override
+ @Override
public void postWindowCreate() {
- wbAdvisor.postWindowCreate(getWindowConfigurer());
- }
+ wbAdvisor.postWindowCreate(getWindowConfigurer());
+ }
- @Override
+ @Override
public void postWindowOpen() {
- wbAdvisor.postWindowOpen(getWindowConfigurer());
- }
+ wbAdvisor.postWindowOpen(getWindowConfigurer());
+ }
- @Override
+ @Override
public boolean preWindowShellClose() {
- return wbAdvisor.preWindowShellClose(getWindowConfigurer());
- }
+ return wbAdvisor.preWindowShellClose(getWindowConfigurer());
+ }
- @Override
+ @Override
public void postWindowClose() {
- wbAdvisor.postWindowClose(getWindowConfigurer());
- }
+ wbAdvisor.postWindowClose(getWindowConfigurer());
+ }
- public boolean isApplicationMenu(String menuId) {
- return wbAdvisor.isApplicationMenu(getWindowConfigurer(), menuId);
- }
+ public boolean isApplicationMenu(String menuId) {
+ return wbAdvisor.isApplicationMenu(getWindowConfigurer(), menuId);
+ }
- public IAdaptable getDefaultPageInput() {
- return wbAdvisor.getDefaultPageInput();
- }
+ public IAdaptable getDefaultPageInput() {
+ return wbAdvisor.getDefaultPageInput();
+ }
- @Override
+ @Override
public void createWindowContents(Shell shell) {
- wbAdvisor.createWindowContents(getWindowConfigurer(), shell);
- }
-
+ wbAdvisor.createWindowContents(getWindowConfigurer(), shell);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/browser/DefaultWebBrowser.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/browser/DefaultWebBrowser.java
index 2dcc3f21789..ae51f3ad852 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/browser/DefaultWebBrowser.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/browser/DefaultWebBrowser.java
@@ -72,9 +72,7 @@ public class DefaultWebBrowser extends AbstractWebBrowser {
try {
Runtime.getRuntime().exec("/usr/bin/open " + localHref); //$NON-NLS-1$
} catch (IOException e) {
- throw new PartInitException(
- WorkbenchMessages.ProductInfoDialog_unableToOpenWebBrowser,
- e);
+ throw new PartInitException(WorkbenchMessages.ProductInfoDialog_unableToOpenWebBrowser, e);
}
} else {
Thread launcher = new Thread("About Link Launcher") {//$NON-NLS-1$
@@ -82,17 +80,12 @@ public class DefaultWebBrowser extends AbstractWebBrowser {
public void run() {
try {
/*
- * encoding the href as the browser does not open if
- * there is a space in the url. Bug 77840
+ * encoding the href as the browser does not open if there is a space in the
+ * url. Bug 77840
*/
- String encodedLocalHref = urlEncodeForSpaces(localHref
- .toCharArray());
+ String encodedLocalHref = urlEncodeForSpaces(localHref.toCharArray());
if (webBrowserOpened) {
- Runtime
- .getRuntime()
- .exec(
- webBrowser
- + " -remote openURL(" + encodedLocalHref + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+ Runtime.getRuntime().exec(webBrowser + " -remote openURL(" + encodedLocalHref + ")"); //$NON-NLS-1$ //$NON-NLS-2$
} else {
Process p = openWebBrowser(encodedLocalHref);
webBrowserOpened = true;
@@ -122,9 +115,8 @@ public class DefaultWebBrowser extends AbstractWebBrowser {
}
/**
- * This method encodes the url, removes the spaces from the url and replaces
- * the same with <code>"%20"</code>. This method is required to fix Bug
- * 77840.
+ * This method encodes the url, removes the spaces from the url and replaces the
+ * same with <code>"%20"</code>. This method is required to fix Bug 77840.
*
*/
private String urlEncodeForSpaces(char[] input) {
@@ -145,7 +137,7 @@ public class DefaultWebBrowser extends AbstractWebBrowser {
if (webBrowser == null) {
try {
webBrowser = "firefox"; //$NON-NLS-1$
- p = Runtime.getRuntime().exec(webBrowser + " " + href); //$NON-NLS-1$;
+ p = Runtime.getRuntime().exec(webBrowser + " " + href); //$NON-NLS-1$ ;
} catch (IOException e) {
p = null;
webBrowser = "mozilla"; //$NON-NLS-1$
@@ -154,7 +146,7 @@ public class DefaultWebBrowser extends AbstractWebBrowser {
if (p == null) {
try {
- p = Runtime.getRuntime().exec(webBrowser + " " + href); //$NON-NLS-1$;
+ p = Runtime.getRuntime().exec(webBrowser + " " + href); //$NON-NLS-1$ ;
} catch (IOException e) {
p = null;
webBrowser = "netscape"; //$NON-NLS-1$
@@ -163,7 +155,7 @@ public class DefaultWebBrowser extends AbstractWebBrowser {
if (p == null) {
try {
- p = Runtime.getRuntime().exec(webBrowser + " " + href); //$NON-NLS-1$;
+ p = Runtime.getRuntime().exec(webBrowser + " " + href); //$NON-NLS-1$ ;
} catch (IOException e) {
p = null;
throw e;
@@ -177,10 +169,7 @@ public class DefaultWebBrowser extends AbstractWebBrowser {
* display an error message
*/
private void openWebBrowserError(Display display) {
- display.asyncExec(() -> MessageDialog
- .openError(
- null,
- WorkbenchMessages.ProductInfoDialog_errorTitle,
- WorkbenchMessages.ProductInfoDialog_unableToOpenWebBrowser));
+ display.asyncExec(() -> MessageDialog.openError(null, WorkbenchMessages.ProductInfoDialog_errorTitle,
+ WorkbenchMessages.ProductInfoDialog_unableToOpenWebBrowser));
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/browser/DefaultWorkbenchBrowserSupport.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/browser/DefaultWorkbenchBrowserSupport.java
index aa9bb7c667d..45c9a798ea5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/browser/DefaultWorkbenchBrowserSupport.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/browser/DefaultWorkbenchBrowserSupport.java
@@ -28,8 +28,7 @@ import org.eclipse.ui.browser.IWebBrowser;
*
* @since 3.1
*/
-public class DefaultWorkbenchBrowserSupport extends
- AbstractWorkbenchBrowserSupport {
+public class DefaultWorkbenchBrowserSupport extends AbstractWorkbenchBrowserSupport {
private Hashtable browsers;
private static final String DEFAULT_BROWSER_ID_BASE = "org.eclipse.ui.defaultBrowser"; //$NON-NLS-1$
@@ -52,15 +51,15 @@ public class DefaultWorkbenchBrowserSupport extends
return (IWebBrowser) browsers.get(id);
}
- protected IWebBrowser doCreateBrowser(int style, String browserId,
- String name, String tooltip) throws PartInitException {
+ protected IWebBrowser doCreateBrowser(int style, String browserId, String name, String tooltip)
+ throws PartInitException {
return new DefaultWebBrowser(this, browserId);
}
@Override
- public IWebBrowser createBrowser(int style, String browserId, String name,
- String tooltip) throws PartInitException {
- IWebBrowser browser = findBrowser(browserId == null? getDefaultId():browserId);
+ public IWebBrowser createBrowser(int style, String browserId, String name, String tooltip)
+ throws PartInitException {
+ IWebBrowser browser = findBrowser(browserId == null ? getDefaultId() : browserId);
if (browser != null) {
return browser;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/browser/WorkbenchBrowserSupport.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/browser/WorkbenchBrowserSupport.java
index 6d733b57721..f4bfbc3d0f8 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/browser/WorkbenchBrowserSupport.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/browser/WorkbenchBrowserSupport.java
@@ -46,24 +46,23 @@ public class WorkbenchBrowserSupport extends AbstractWorkbenchBrowserSupport {
private boolean initialized;
- private String desiredBrowserSupportId;
+ private String desiredBrowserSupportId;
private IExtensionChangeHandler handler = new IExtensionChangeHandler() {
- @Override
- public void addExtension(IExtensionTracker tracker,IExtension extension) {
- //Do nothing
- }
+ @Override
+ public void addExtension(IExtensionTracker tracker, IExtension extension) {
+ // Do nothing
+ }
- @Override
+ @Override
public void removeExtension(IExtension source, Object[] objects) {
for (Object object : objects) {
if (object == activeSupport) {
dispose();
// remove ourselves - we'll be added again in initalize if
// needed
- PlatformUI.getWorkbench().getExtensionTracker()
- .unregisterHandler(handler);
+ PlatformUI.getWorkbench().getExtensionTracker().unregisterHandler(handler);
}
}
}
@@ -88,10 +87,9 @@ public class WorkbenchBrowserSupport extends AbstractWorkbenchBrowserSupport {
}
@Override
- public IWebBrowser createBrowser(int style, String browserId, String name,
- String tooltip) throws PartInitException {
- return getActiveSupport()
- .createBrowser(style, browserId, name, tooltip);
+ public IWebBrowser createBrowser(int style, String browserId, String name, String tooltip)
+ throws PartInitException {
+ return getActiveSupport().createBrowser(style, browserId, name, tooltip);
}
@Override
@@ -115,26 +113,24 @@ public class WorkbenchBrowserSupport extends AbstractWorkbenchBrowserSupport {
return activeSupport;
}
- /**
- * Answers whether the system has a non-default browser installed.
- *
- * @return whether the system has a non-default browser installed
- */
- public boolean hasNonDefaultBrowser() {
- return !(getActiveSupport() instanceof DefaultWorkbenchBrowserSupport);
- }
+ /**
+ * Answers whether the system has a non-default browser installed.
+ *
+ * @return whether the system has a non-default browser installed
+ */
+ public boolean hasNonDefaultBrowser() {
+ return !(getActiveSupport() instanceof DefaultWorkbenchBrowserSupport);
+ }
private void loadActiveSupport() {
BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
@Override
public void run() {
- IConfigurationElement[] elements = Platform
- .getExtensionRegistry().getConfigurationElementsFor(
- PlatformUI.PLUGIN_ID,
- IWorkbenchRegistryConstants.PL_BROWSER_SUPPORT);
+ IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(
+ PlatformUI.PLUGIN_ID, IWorkbenchRegistryConstants.PL_BROWSER_SUPPORT);
IConfigurationElement elementToUse = null;
- if (desiredBrowserSupportId != null) {
+ if (desiredBrowserSupportId != null) {
elementToUse = findDesiredElement(elements);
} else {
elementToUse = getElementToUse(elements);
@@ -144,30 +140,28 @@ public class WorkbenchBrowserSupport extends AbstractWorkbenchBrowserSupport {
}
}
- /**
- * Search for the element whose extension has ID equal to that of
- * the field desiredBrowserSupport.
- *
- * @param elements
- * the elements to search
- * @return the element or <code>null</code>
- */
- private IConfigurationElement findDesiredElement(IConfigurationElement [] elements) {
- for (IConfigurationElement element : elements) {
- if (desiredBrowserSupportId.equals(element.getDeclaringExtension().getUniqueIdentifier())) {
+ /**
+ * Search for the element whose extension has ID equal to that of the field
+ * desiredBrowserSupport.
+ *
+ * @param elements the elements to search
+ * @return the element or <code>null</code>
+ */
+ private IConfigurationElement findDesiredElement(IConfigurationElement[] elements) {
+ for (IConfigurationElement element : elements) {
+ if (desiredBrowserSupportId.equals(element.getDeclaringExtension().getUniqueIdentifier())) {
return element;
}
- }
- return null;
- }
+ }
+ return null;
+ }
- private IExtensionPoint getExtensionPoint() {
- return Platform.getExtensionRegistry()
- .getExtensionPoint(PlatformUI.PLUGIN_ID, IWorkbenchRegistryConstants.PL_BROWSER_SUPPORT);
- }
+ private IExtensionPoint getExtensionPoint() {
+ return Platform.getExtensionRegistry().getExtensionPoint(PlatformUI.PLUGIN_ID,
+ IWorkbenchRegistryConstants.PL_BROWSER_SUPPORT);
+ }
- private IConfigurationElement getElementToUse(
- IConfigurationElement[] elements) {
+ private IConfigurationElement getElementToUse(IConfigurationElement[] elements) {
if (elements.length == 0) {
return null;
}
@@ -197,25 +191,22 @@ public class WorkbenchBrowserSupport extends AbstractWorkbenchBrowserSupport {
return choice;
}
- private boolean initializePluggableBrowserSupport(
- IConfigurationElement element) {
+ private boolean initializePluggableBrowserSupport(IConfigurationElement element) {
// Instantiate the browser support
try {
- activeSupport = (AbstractWorkbenchBrowserSupport) WorkbenchPlugin
- .createExtension(element, IWorkbenchRegistryConstants.ATT_CLASS);
+ activeSupport = (AbstractWorkbenchBrowserSupport) WorkbenchPlugin.createExtension(element,
+ IWorkbenchRegistryConstants.ATT_CLASS);
// start listening for removals
IExtensionTracker extensionTracker = PlatformUI.getWorkbench().getExtensionTracker();
- extensionTracker.registerHandler(handler, ExtensionTracker
- .createExtensionPointFilter(getExtensionPoint()));
+ extensionTracker.registerHandler(handler,
+ ExtensionTracker.createExtensionPointFilter(getExtensionPoint()));
// register the new browser support for removal
// notification
- extensionTracker
- .registerObject(element.getDeclaringExtension(),
- activeSupport, IExtensionTracker.REF_WEAK);
+ extensionTracker.registerObject(element.getDeclaringExtension(), activeSupport,
+ IExtensionTracker.REF_WEAK);
return true;
} catch (CoreException e) {
- WorkbenchPlugin
- .log("Unable to instantiate browser support" + e.getStatus(), e);//$NON-NLS-1$
+ WorkbenchPlugin.log("Unable to instantiate browser support" + e.getStatus(), e);//$NON-NLS-1$
}
return false;
}
@@ -223,21 +214,21 @@ public class WorkbenchBrowserSupport extends AbstractWorkbenchBrowserSupport {
});
}
- /**
- * For debug purposes only.
- *
- * @param desiredBrowserSupportId the desired browser system id
- */
- public void setDesiredBrowserSupportId(String desiredBrowserSupportId) {
- dispose(); // prep for a new help system
- this.desiredBrowserSupportId = desiredBrowserSupportId;
- }
-
- /**
- * Dispose of the active support.
- */
- protected void dispose() {
- activeSupport = null;
- initialized = false;
- }
+ /**
+ * For debug purposes only.
+ *
+ * @param desiredBrowserSupportId the desired browser system id
+ */
+ public void setDesiredBrowserSupportId(String desiredBrowserSupportId) {
+ dispose(); // prep for a new help system
+ this.desiredBrowserSupportId = desiredBrowserSupportId;
+ }
+
+ /**
+ * Dispose of the active support.
+ */
+ protected void dispose() {
+ activeSupport = null;
+ initialized = false;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandImageManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandImageManager.java
index ac83276baa1..1241000a323 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandImageManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandImageManager.java
@@ -55,48 +55,41 @@ public final class CommandImageManager extends EventManager {
public static final int TYPE_DISABLED = 1;
/**
- * The type of image to display if the mouse is hovering over the command
- * and the command is enabled.
+ * The type of image to display if the mouse is hovering over the command and
+ * the command is enabled.
*/
public static final int TYPE_HOVER = 2;
/**
- * The map of command identifiers (<code>String</code>) to images. The
- * images are an array indexed by type. The values in the array are either
- * an <code>ImageDescriptor</code> or a <code>Map</code> of style (<code>String</code>)
- * to <code>ImageDescriptor</code>.
+ * The map of command identifiers (<code>String</code>) to images. The images
+ * are an array indexed by type. The values in the array are either an
+ * <code>ImageDescriptor</code> or a <code>Map</code> of style
+ * (<code>String</code>) to <code>ImageDescriptor</code>.
*/
private final Map imagesById = new HashMap();
/**
- * Adds a listener to this command image manager. The listener will be
- * notified when the set of image bindings changes. This can be used to
- * track the global appearance and disappearance of image bindings.
+ * Adds a listener to this command image manager. The listener will be notified
+ * when the set of image bindings changes. This can be used to track the global
+ * appearance and disappearance of image bindings.
*
- * @param listener
- * The listener to attach; must not be <code>null</code>.
+ * @param listener The listener to attach; must not be <code>null</code>.
*/
- public void addCommandImageManagerListener(
- final ICommandImageManagerListener listener) {
+ public void addCommandImageManagerListener(final ICommandImageManagerListener listener) {
addListenerObject(listener);
}
/**
* Binds a particular image path to a command id, type and style triple
*
- * @param commandId
- * The identifier of the command to which the image should be
- * bound; must not be <code>null</code>.
- * @param type
- * The type of image to retrieve. This value must be one of the
- * <code>TYPE</code> constants defined in this class.
- * @param style
- * The style of the image; may be <code>null</code>.
- * @param url
- * The URL to the image. Should not be <code>null</code>.
+ * @param commandId The identifier of the command to which the image should be
+ * bound; must not be <code>null</code>.
+ * @param type The type of image to retrieve. This value must be one of the
+ * <code>TYPE</code> constants defined in this class.
+ * @param style The style of the image; may be <code>null</code>.
+ * @param url The URL to the image. Should not be <code>null</code>.
*/
- public void bind(final String commandId, final int type,
- final String style, final URL url) {
+ public void bind(final String commandId, final int type, final String style, final URL url) {
final ImageDescriptor descriptor = ImageDescriptor.createFromURL(url);
bind(commandId, type, style, descriptor);
}
@@ -104,19 +97,14 @@ public final class CommandImageManager extends EventManager {
/**
* Binds a particular image path to a command id, type and style triple
*
- * @param commandId
- * The identifier of the command to which the image should be
- * bound; must not be <code>null</code>.
- * @param type
- * The type of image to retrieve. This value must be one of the
- * <code>TYPE</code> constants defined in this class.
- * @param style
- * The style of the image; may be <code>null</code>.
- * @param descriptor
- * The image descriptor. Should not be <code>null</code>.
+ * @param commandId The identifier of the command to which the image should be
+ * bound; must not be <code>null</code>.
+ * @param type The type of image to retrieve. This value must be one of
+ * the <code>TYPE</code> constants defined in this class.
+ * @param style The style of the image; may be <code>null</code>.
+ * @param descriptor The image descriptor. Should not be <code>null</code>.
*/
- public void bind(final String commandId, final int type,
- final String style, final ImageDescriptor descriptor) {
+ public void bind(final String commandId, final int type, final String style, final ImageDescriptor descriptor) {
Object[] images = (Object[]) imagesById.get(commandId);
if (images == null) {
images = new Object[3];
@@ -124,8 +112,7 @@ public final class CommandImageManager extends EventManager {
}
if ((type < 0) || (type >= images.length)) {
- throw new IllegalArgumentException(
- "The type must be one of TYPE_DEFAULT, TYPE_DISABLED and TYPE_HOVER."); //$NON-NLS-1$
+ throw new IllegalArgumentException("The type must be one of TYPE_DEFAULT, TYPE_DISABLED and TYPE_HOVER."); //$NON-NLS-1$
}
final Object typedImage = images[type];
@@ -140,8 +127,7 @@ public final class CommandImageManager extends EventManager {
if (typedImage instanceof Map) {
final Map styleMap = (Map) typedImage;
styleMap.put(style, descriptor);
- } else if (typedImage instanceof ImageDescriptor
- || typedImage == null) {
+ } else if (typedImage instanceof ImageDescriptor || typedImage == null) {
final Map styleMap = new HashMap();
styleMap.put(null, typedImage);
styleMap.put(style, descriptor);
@@ -149,8 +135,7 @@ public final class CommandImageManager extends EventManager {
}
}
- fireManagerChanged(new CommandImageManagerEvent(this,
- new String[] { commandId }, type, style));
+ fireManagerChanged(new CommandImageManagerEvent(this, new String[] { commandId }, type, style));
}
/**
@@ -159,20 +144,17 @@ public final class CommandImageManager extends EventManager {
public void clear() {
imagesById.clear();
if (isListenerAttached()) {
- final String[] commandIds = (String[]) imagesById.keySet().toArray(
- new String[imagesById.size()]);
- fireManagerChanged(new CommandImageManagerEvent(this, commandIds,
- TYPE_DEFAULT, null));
+ final String[] commandIds = (String[]) imagesById.keySet().toArray(new String[imagesById.size()]);
+ fireManagerChanged(new CommandImageManagerEvent(this, commandIds, TYPE_DEFAULT, null));
}
}
/**
- * Notifies all of the listeners to this manager that the image bindings
- * have changed.
+ * Notifies all of the listeners to this manager that the image bindings have
+ * changed.
*
- * @param event
- * The event to send to all of the listeners; must not be
- * <code>null</code>.
+ * @param event The event to send to all of the listeners; must not be
+ * <code>null</code>.
*/
private void fireManagerChanged(final CommandImageManagerEvent event) {
if (event == null) {
@@ -187,13 +169,12 @@ public final class CommandImageManager extends EventManager {
}
/**
- * Generates a style tag that is not currently used for the given command.
- * This can be used by applications trying to create a unique style for a
- * new set of images.
+ * Generates a style tag that is not currently used for the given command. This
+ * can be used by applications trying to create a unique style for a new set of
+ * images.
*
- * @param commandId
- * The identifier of the command for which a unique style is
- * required; must not be <code>null</code>.
+ * @param commandId The identifier of the command for which a unique style is
+ * required; must not be <code>null</code>.
* @return A style tag that is not currently used; may be <code>null</code>.
*/
public String generateUnusedStyle(final String commandId) {
@@ -215,7 +196,7 @@ public final class CommandImageManager extends EventManager {
if (!existingStyles.contains(null)) {
return null;
}
- StringBuilder generatedStyle = new StringBuilder("AUTOGEN:::"); //$NON-NLS-1$
+ StringBuilder generatedStyle = new StringBuilder("AUTOGEN:::"); //$NON-NLS-1$
int index = 0;
while (existingStyles.contains(generatedStyle)) {
generatedStyle.append(index % 10);
@@ -226,51 +207,43 @@ public final class CommandImageManager extends EventManager {
}
/**
- * Retrieves the default image associated with the given command in the
- * default style.
+ * Retrieves the default image associated with the given command in the default
+ * style.
*
- * @param commandId
- * The identifier to find; must not be <code>null</code>.
- * @return An image appropriate for the given command; never
- * <code>null</code>.
+ * @param commandId The identifier to find; must not be <code>null</code>.
+ * @return An image appropriate for the given command; never <code>null</code>.
*/
public ImageDescriptor getImageDescriptor(final String commandId) {
return getImageDescriptor(commandId, TYPE_DEFAULT, null);
}
/**
- * Retrieves the image of the given type associated with the given command
- * in the default style.
+ * Retrieves the image of the given type associated with the given command in
+ * the default style.
*
- * @param commandId
- * The identifier to find; must not be <code>null</code>.
- * @param type
- * The type of image to retrieve. This value must be one of the
- * <code>TYPE</code> constants defined in this class.
- * @return An image appropriate for the given command; <code>null</code>
- * if the given image type cannot be found.
+ * @param commandId The identifier to find; must not be <code>null</code>.
+ * @param type The type of image to retrieve. This value must be one of the
+ * <code>TYPE</code> constants defined in this class.
+ * @return An image appropriate for the given command; <code>null</code> if the
+ * given image type cannot be found.
*/
- public ImageDescriptor getImageDescriptor(final String commandId,
- final int type) {
+ public ImageDescriptor getImageDescriptor(final String commandId, final int type) {
return getImageDescriptor(commandId, type, null);
}
/**
- * Retrieves the image of the given type associated with the given command
- * in the given style.
+ * Retrieves the image of the given type associated with the given command in
+ * the given style.
*
- * @param commandId
- * The identifier to find; must not be <code>null</code>.
- * @param type
- * The type of image to retrieve. This value must be one of the
- * <code>TYPE</code> constants defined in this class.
- * @param style
- * The style of the image to retrieve; may be <code>null</code>.
- * @return An image appropriate for the given command; <code>null</code>
- * if the given image style and type cannot be found.
+ * @param commandId The identifier to find; must not be <code>null</code>.
+ * @param type The type of image to retrieve. This value must be one of the
+ * <code>TYPE</code> constants defined in this class.
+ * @param style The style of the image to retrieve; may be
+ * <code>null</code>.
+ * @return An image appropriate for the given command; <code>null</code> if the
+ * given image style and type cannot be found.
*/
- public ImageDescriptor getImageDescriptor(final String commandId,
- final int type, final String style) {
+ public ImageDescriptor getImageDescriptor(final String commandId, final int type, final String style) {
if (commandId == null) {
throw new NullPointerException();
}
@@ -281,8 +254,7 @@ public final class CommandImageManager extends EventManager {
}
if ((type < 0) || (type >= images.length)) {
- throw new IllegalArgumentException(
- "The type must be one of TYPE_DEFAULT, TYPE_DISABLED and TYPE_HOVER."); //$NON-NLS-1$
+ throw new IllegalArgumentException("The type must be one of TYPE_DEFAULT, TYPE_DISABLED and TYPE_HOVER."); //$NON-NLS-1$
}
Object typedImage = images[type];
@@ -314,29 +286,25 @@ public final class CommandImageManager extends EventManager {
}
/**
- * Retrieves the default image associated with the given command in the
- * given style.
+ * Retrieves the default image associated with the given command in the given
+ * style.
*
- * @param commandId
- * The identifier to find; must not be <code>null</code>.
- * @param style
- * The style of the image to retrieve; may be <code>null</code>.
- * @return An image appropriate for the given command; <code>null</code>
- * if the given image style cannot be found.
+ * @param commandId The identifier to find; must not be <code>null</code>.
+ * @param style The style of the image to retrieve; may be
+ * <code>null</code>.
+ * @return An image appropriate for the given command; <code>null</code> if the
+ * given image style cannot be found.
*/
- public ImageDescriptor getImageDescriptor(final String commandId,
- final String style) {
+ public ImageDescriptor getImageDescriptor(final String commandId, final String style) {
return getImageDescriptor(commandId, TYPE_DEFAULT, style);
}
/**
* Removes a listener from this command image manager.
*
- * @param listener
- * The listener to be removed; must not be <code>null</code>.
+ * @param listener The listener to be removed; must not be <code>null</code>.
*/
- public void removeCommandImageManagerListener(
- final ICommandImageManagerListener listener) {
+ public void removeCommandImageManagerListener(final ICommandImageManagerListener listener) {
removeListenerObject(listener);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandImageManagerEvent.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandImageManagerEvent.java
index ebb6c8852b1..3077286f878 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandImageManagerEvent.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandImageManagerEvent.java
@@ -21,9 +21,9 @@ package org.eclipse.ui.internal.commands;
* Clients must neither instantiate nor extend.
* </p>
* <p>
- * <strong>PROVISIONAL</strong>. This class or interface has been added as
- * part of a work in progress. There is a guarantee neither that this API will
- * work nor that it will remain the same. Please do not use this API without
+ * <strong>PROVISIONAL</strong>. This class or interface has been added as part
+ * of a work in progress. There is a guarantee neither that this API will work
+ * nor that it will remain the same. Please do not use this API without
* consulting with the Platform/UI team.
* </p>
* <p>
@@ -37,8 +37,8 @@ package org.eclipse.ui.internal.commands;
public final class CommandImageManagerEvent {
/**
- * The identifiers of the commands whose image bindings have changed. This
- * value is never <code>null</code> and never empty.
+ * The identifiers of the commands whose image bindings have changed. This value
+ * is never <code>null</code> and never empty.
*/
private final String[] changedCommandIds;
@@ -61,23 +61,21 @@ public final class CommandImageManagerEvent {
/**
* Creates a new instance of this class.
*
- * @param commandImageManager
- * the instance of the manager that changed; must not be
- * <code>null</code>.
- * @param changedCommandIds
- * The identifiers of the commands whose image bindings have
- * changed; this value must not be <code>null</code> and must
- * not be empty. This value is not copied.
+ * @param commandImageManager the instance of the manager that changed; must not
+ * be <code>null</code>.
+ * @param changedCommandIds The identifiers of the commands whose image
+ * bindings have changed; this value must not be
+ * <code>null</code> and must not be empty. This
+ * value is not copied.
*/
- CommandImageManagerEvent(final CommandImageManager commandImageManager,
- final String[] changedCommandIds, final int type, final String style) {
+ CommandImageManagerEvent(final CommandImageManager commandImageManager, final String[] changedCommandIds,
+ final int type, final String style) {
if (commandImageManager == null) {
throw new NullPointerException("An event must refer to its manager"); //$NON-NLS-1$
}
if ((changedCommandIds == null) || (changedCommandIds.length < 1)) {
- throw new IllegalArgumentException(
- "There must be at least one change command identifier"); //$NON-NLS-1$
+ throw new IllegalArgumentException("There must be at least one change command identifier"); //$NON-NLS-1$
}
this.commandImageManager = commandImageManager;
@@ -89,13 +87,12 @@ public final class CommandImageManagerEvent {
/**
* Returns the identifiers of the commands whose bindings have changed.
*
- * @return The identifiers of the commands whose bindings have changed;
- * neither <code>null</code> nor empty.
+ * @return The identifiers of the commands whose bindings have changed; neither
+ * <code>null</code> nor empty.
*/
public String[] getChangedCommandIds() {
final String[] copy = new String[changedCommandIds.length];
- System.arraycopy(changedCommandIds, 0, copy, 0,
- changedCommandIds.length);
+ System.arraycopy(changedCommandIds, 0, copy, 0, changedCommandIds.length);
return copy;
}
@@ -112,9 +109,8 @@ public final class CommandImageManagerEvent {
/**
* Returns whether one of the images of the given command has changed.
*
- * @param commandId
- * The identifier of the command to check; must not be
- * <code>null</code>.
+ * @param commandId The identifier of the command to check; must not be
+ * <code>null</code>.
* @return <code>true</code> if one of the command's images has changed;
* <code>false</code> otherwise.
*/
@@ -132,37 +128,30 @@ public final class CommandImageManagerEvent {
/**
* Returns whether the image for the command has changed.
*
- * @param commandId
- * The identifier of the command to check; must not be
- * <code>null</code>.
+ * @param commandId The identifier of the command to check; must not be
+ * <code>null</code>.
* @return <code>true</code> if the command's image has changed
* @see CommandImageManager#getImageDescriptor(String)
*/
public boolean isCommandImageChanged(final String commandId) {
- return isCommandIdChanged(commandId)
- && (type == CommandImageManager.TYPE_DEFAULT)
- && (style == null);
+ return isCommandIdChanged(commandId) && (type == CommandImageManager.TYPE_DEFAULT) && (style == null);
}
/**
* Returns whether the image of the given type for the command has changed.
*
- * @param commandId
- * The identifier of the command to check; must not be
- * <code>null</code>.
- * @param type
- * The type of image, one of
- * {@link CommandImageManager#TYPE_DEFAULT},
- * {@link CommandImageManager#TYPE_DISABLED} or
- * {@link CommandImageManager#TYPE_HOVER}.
+ * @param commandId The identifier of the command to check; must not be
+ * <code>null</code>.
+ * @param type The type of image, one of
+ * {@link CommandImageManager#TYPE_DEFAULT},
+ * {@link CommandImageManager#TYPE_DISABLED} or
+ * {@link CommandImageManager#TYPE_HOVER}.
* @return <code>true</code> if the command's image of the given type has
* changed.
* @see CommandImageManager#getImageDescriptor(String, int)
*/
- public boolean isCommandImageChanged(final String commandId,
- final int type) {
- return isCommandIdChanged(commandId)
- && ((type == CommandImageManager.TYPE_DEFAULT) || (type == this.type))
+ public boolean isCommandImageChanged(final String commandId, final int type) {
+ return isCommandIdChanged(commandId) && ((type == CommandImageManager.TYPE_DEFAULT) || (type == this.type))
&& (style == null);
}
@@ -170,43 +159,34 @@ public final class CommandImageManagerEvent {
* Returns whether the image of the given type and style for the command has
* changed.
*
- * @param commandId
- * The identifier of the command to check; must not be
- * <code>null</code>.
- * @param type
- * The type of image, one of
- * {@link CommandImageManager#TYPE_DEFAULT},
- * {@link CommandImageManager#TYPE_DISABLED} or
- * {@link CommandImageManager#TYPE_HOVER}.
- * @param style
- * The style of the image; may be anything.
- * @return <code>true</code> if the command's image of the given type and
- * style has changed.
+ * @param commandId The identifier of the command to check; must not be
+ * <code>null</code>.
+ * @param type The type of image, one of
+ * {@link CommandImageManager#TYPE_DEFAULT},
+ * {@link CommandImageManager#TYPE_DISABLED} or
+ * {@link CommandImageManager#TYPE_HOVER}.
+ * @param style The style of the image; may be anything.
+ * @return <code>true</code> if the command's image of the given type and style
+ * has changed.
* @see CommandImageManager#getImageDescriptor(String, int, String)
*/
- public boolean isCommandImageChanged(final String commandId,
- final int type, final String style) {
- return isCommandIdChanged(commandId)
- && ((type == CommandImageManager.TYPE_DEFAULT) || (type == this.type))
+ public boolean isCommandImageChanged(final String commandId, final int type, final String style) {
+ return isCommandIdChanged(commandId) && ((type == CommandImageManager.TYPE_DEFAULT) || (type == this.type))
&& ((style == null) || (style.equals(this.style)));
}
/**
* Returns whether the image of the given style for the command has changed.
*
- * @param commandId
- * The identifier of the command to check; must not be
- * <code>null</code>.
- * @param style
- * The style of the image; may be anything.
+ * @param commandId The identifier of the command to check; must not be
+ * <code>null</code>.
+ * @param style The style of the image; may be anything.
* @return <code>true</code> if the command's image of the given style has
* changed.
* @see CommandImageManager#getImageDescriptor(String, String)
*/
- public boolean isCommandImageChanged(final String commandId,
- final String style) {
- return isCommandIdChanged(commandId)
- && (type == CommandImageManager.TYPE_DEFAULT)
+ public boolean isCommandImageChanged(final String commandId, final String style) {
+ return isCommandIdChanged(commandId) && (type == CommandImageManager.TYPE_DEFAULT)
&& ((style == null) || (style.equals(this.style)));
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandImagePersistence.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandImagePersistence.java
index f0a0a8f5cb5..eeea1e4db1b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandImagePersistence.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandImagePersistence.java
@@ -61,23 +61,19 @@ public final class CommandImagePersistence extends RegistryPersistence {
/**
* Reads all of the images from the command images extension point.
*
- * @param configurationElements
- * The configuration elements in the command images extension
- * point; must not be <code>null</code>, but may be empty.
- * @param configurationElementCount
- * The number of configuration elements that are really in the
- * array.
- * @param commandImageManager
- * The command image manager to which the images should be added;
- * must not be <code>null</code>.
- * @param commandService
- * The command service for the workbench; must not be
- * <code>null</code>.
+ * @param configurationElements The configuration elements in the command
+ * images extension point; must not be
+ * <code>null</code>, but may be empty.
+ * @param configurationElementCount The number of configuration elements that
+ * are really in the array.
+ * @param commandImageManager The command image manager to which the
+ * images should be added; must not be
+ * <code>null</code>.
+ * @param commandService The command service for the workbench; must
+ * not be <code>null</code>.
*/
- private static void readImagesFromRegistry(
- final IConfigurationElement[] configurationElements,
- final int configurationElementCount,
- final CommandImageManager commandImageManager,
+ private static void readImagesFromRegistry(final IConfigurationElement[] configurationElements,
+ final int configurationElementCount, final CommandImageManager commandImageManager,
final ICommandService commandService) {
// Undefine all the previous images.
commandImageManager.clear();
@@ -88,16 +84,15 @@ public final class CommandImagePersistence extends RegistryPersistence {
final IConfigurationElement configurationElement = configurationElements[i];
// Read out the command identifier.
- final String commandId = readRequired(configurationElement,
- ATT_COMMAND_ID, warningsToLog, "Image needs an id"); //$NON-NLS-1$
+ final String commandId = readRequired(configurationElement, ATT_COMMAND_ID, warningsToLog,
+ "Image needs an id"); //$NON-NLS-1$
if (commandId == null) {
continue;
}
if (!commandService.getCommand(commandId).isDefined()) {
// Reference to an undefined command. This is invalid.
- addWarning(warningsToLog,
- "Cannot bind to an undefined command", //$NON-NLS-1$
+ addWarning(warningsToLog, "Cannot bind to an undefined command", //$NON-NLS-1$
configurationElement, commandId);
continue;
}
@@ -106,46 +101,36 @@ public final class CommandImagePersistence extends RegistryPersistence {
final String style = readOptional(configurationElement, ATT_STYLE);
// Read out the default icon.
- final String icon = readRequired(configurationElement, ATT_ICON,
- warningsToLog, commandId);
+ final String icon = readRequired(configurationElement, ATT_ICON, warningsToLog, commandId);
if (icon == null) {
continue;
}
- final String disabledIcon = readOptional(configurationElement,
- ATT_DISABLEDICON);
- final String hoverIcon = readOptional(configurationElement,
- ATT_HOVERICON);
+ final String disabledIcon = readOptional(configurationElement, ATT_DISABLEDICON);
+ final String hoverIcon = readOptional(configurationElement, ATT_HOVERICON);
String namespaceId = configurationElement.getNamespaceIdentifier();
- ImageDescriptor iconDescriptor = AbstractUIPlugin
- .imageDescriptorFromPlugin(namespaceId, icon);
- commandImageManager.bind(commandId,
- CommandImageManager.TYPE_DEFAULT, style, iconDescriptor);
+ ImageDescriptor iconDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(namespaceId, icon);
+ commandImageManager.bind(commandId, CommandImageManager.TYPE_DEFAULT, style, iconDescriptor);
if (disabledIcon != null) {
- ImageDescriptor disabledIconDescriptor = AbstractUIPlugin
- .imageDescriptorFromPlugin(namespaceId, disabledIcon);
- commandImageManager.bind(commandId,
- CommandImageManager.TYPE_DISABLED, style,
- disabledIconDescriptor);
+ ImageDescriptor disabledIconDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(namespaceId,
+ disabledIcon);
+ commandImageManager.bind(commandId, CommandImageManager.TYPE_DISABLED, style, disabledIconDescriptor);
}
if (hoverIcon != null) {
- ImageDescriptor hoverIconDescriptor = AbstractUIPlugin
- .imageDescriptorFromPlugin(namespaceId, hoverIcon);
- commandImageManager.bind(commandId,
- CommandImageManager.TYPE_HOVER, style,
- hoverIconDescriptor);
+ ImageDescriptor hoverIconDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(namespaceId,
+ hoverIcon);
+ commandImageManager.bind(commandId, CommandImageManager.TYPE_HOVER, style, hoverIconDescriptor);
}
}
- logWarnings(
- warningsToLog,
+ logWarnings(warningsToLog,
"Warnings while parsing the images from the 'org.eclipse.ui.commandImages' extension point."); //$NON-NLS-1$
}
/**
- * The command image manager which should be populated with the values from
- * the registry; must not be <code>null</code>.
+ * The command image manager which should be populated with the values from the
+ * registry; must not be <code>null</code>.
*/
private final CommandImageManager commandImageManager;
@@ -157,23 +142,20 @@ public final class CommandImagePersistence extends RegistryPersistence {
/**
* Constructs a new instance of <code>CommandImagePersistence</code>.
*
- * @param commandImageManager
- * The command image manager which should be populated with the
- * values from the registry; must not be <code>null</code>.
- * @param commandService
- * The command service for the workbench; must not be
- * <code>null</code>.
+ * @param commandImageManager The command image manager which should be
+ * populated with the values from the registry; must
+ * not be <code>null</code>.
+ * @param commandService The command service for the workbench; must not be
+ * <code>null</code>.
*/
- CommandImagePersistence(final CommandImageManager commandImageManager,
- final ICommandService commandService) {
+ CommandImagePersistence(final CommandImageManager commandImageManager, final ICommandService commandService) {
this.commandImageManager = commandImageManager;
this.commandService = commandService;
}
@Override
protected boolean isChangeImportant(final IRegistryChangeEvent event) {
- final IExtensionDelta[] imageDeltas = event.getExtensionDeltas(
- PlatformUI.PLUGIN_ID,
+ final IExtensionDelta[] imageDeltas = event.getExtensionDeltas(PlatformUI.PLUGIN_ID,
IWorkbenchRegistryConstants.PL_COMMAND_IMAGES);
return (imageDeltas.length != 0);
}
@@ -202,14 +184,13 @@ public final class CommandImagePersistence extends RegistryPersistence {
// Check if it is a binding definition.
if (TAG_IMAGE.equals(name)) {
- addElementToIndexedArray(configurationElement,
- indexedConfigurationElements, INDEX_IMAGES,
+ addElementToIndexedArray(configurationElement, indexedConfigurationElements, INDEX_IMAGES,
imageCount++);
}
}
- readImagesFromRegistry(indexedConfigurationElements[INDEX_IMAGES],
- imageCount, commandImageManager, commandService);
+ readImagesFromRegistry(indexedConfigurationElements[INDEX_IMAGES], imageCount, commandImageManager,
+ commandService);
// Associate product icon to About command
IProduct product = Platform.getProduct();
if (product != null) {
@@ -225,8 +206,8 @@ public final class CommandImagePersistence extends RegistryPersistence {
CommandImageManager.TYPE_DEFAULT, null, icon);
commandImageManager.bind(IWorkbenchCommandConstants.HELP_ABOUT,
CommandImageManager.TYPE_DISABLED, null, icon);
- commandImageManager.bind(IWorkbenchCommandConstants.HELP_ABOUT,
- CommandImageManager.TYPE_HOVER, null, icon);
+ commandImageManager.bind(IWorkbenchCommandConstants.HELP_ABOUT, CommandImageManager.TYPE_HOVER,
+ null, icon);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandImageService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandImageService.java
index 785a94a2ecc..07774e9ef93 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandImageService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandImageService.java
@@ -41,68 +41,52 @@ public final class CommandImageService implements ICommandImageService {
private final CommandImagePersistence commandImagePersistence;
/**
- * Constructs a new instance of <code>CommandService</code> using a
- * command image manager.
+ * Constructs a new instance of <code>CommandService</code> using a command
+ * image manager.
*
- * @param commandImageManager
- * The command image manager to use; must not be
- * <code>null</code>.
- * @param commandService
- * The workbench command service; must not be <code>null</code>.
- * This is used for checking whether a command is defined when
- * reading the registry.
+ * @param commandImageManager The command image manager to use; must not be
+ * <code>null</code>.
+ * @param commandService The workbench command service; must not be
+ * <code>null</code>. This is used for checking
+ * whether a command is defined when reading the
+ * registry.
*/
- public CommandImageService(final CommandImageManager commandImageManager,
- final ICommandService commandService) {
+ public CommandImageService(final CommandImageManager commandImageManager, final ICommandService commandService) {
if (commandImageManager == null) {
- throw new NullPointerException(
- "Cannot create a command image service with a null manager"); //$NON-NLS-1$
+ throw new NullPointerException("Cannot create a command image service with a null manager"); //$NON-NLS-1$
}
if (commandService == null) {
- throw new NullPointerException(
- "Cannot create a command image service with a null command service"); //$NON-NLS-1$
+ throw new NullPointerException("Cannot create a command image service with a null command service"); //$NON-NLS-1$
}
this.commandImageManager = commandImageManager;
- this.commandImagePersistence = new CommandImagePersistence(
- commandImageManager, commandService);
+ this.commandImagePersistence = new CommandImagePersistence(commandImageManager, commandService);
}
/**
- * Binds a particular image descriptor to a command id, type and style
- * triple
+ * Binds a particular image descriptor to a command id, type and style triple
*
- * @param commandId
- * The identifier of the command to which the image should be
- * bound; must not be <code>null</code>.
- * @param type
- * The type of image to retrieve. This value must be one of the
- * <code>TYPE</code> constants defined in this class.
- * @param style
- * The style of the image; may be <code>null</code>.
- * @param descriptor
- * The image descriptor. Should not be <code>null</code>.
+ * @param commandId The identifier of the command to which the image should be
+ * bound; must not be <code>null</code>.
+ * @param type The type of image to retrieve. This value must be one of
+ * the <code>TYPE</code> constants defined in this class.
+ * @param style The style of the image; may be <code>null</code>.
+ * @param descriptor The image descriptor. Should not be <code>null</code>.
*/
- public void bind(final String commandId, final int type,
- final String style, final ImageDescriptor descriptor) {
+ public void bind(final String commandId, final int type, final String style, final ImageDescriptor descriptor) {
commandImageManager.bind(commandId, type, style, descriptor);
}
/**
* Binds a particular image path to a command id, type and style triple
*
- * @param commandId
- * The identifier of the command to which the image should be
- * bound; must not be <code>null</code>.
- * @param type
- * The type of image to retrieve. This value must be one of the
- * <code>TYPE</code> constants defined in this class.
- * @param style
- * The style of the image; may be <code>null</code>.
- * @param url
- * The URL to the image. Should not be <code>null</code>.
+ * @param commandId The identifier of the command to which the image should be
+ * bound; must not be <code>null</code>.
+ * @param type The type of image to retrieve. This value must be one of the
+ * <code>TYPE</code> constants defined in this class.
+ * @param style The style of the image; may be <code>null</code>.
+ * @param url The URL to the image. Should not be <code>null</code>.
*/
- public void bind(final String commandId, final int type,
- final String style, final URL url) {
+ public void bind(final String commandId, final int type, final String style, final URL url) {
commandImageManager.bind(commandId, type, style, url);
}
@@ -112,13 +96,12 @@ public final class CommandImageService implements ICommandImageService {
}
/**
- * Generates a style tag that is not currently used for the given command.
- * This can be used by applications trying to create a unique style for a
- * new set of images.
+ * Generates a style tag that is not currently used for the given command. This
+ * can be used by applications trying to create a unique style for a new set of
+ * images.
*
- * @param commandId
- * The identifier of the command for which a unique style is
- * required; must not be <code>null</code>.
+ * @param commandId The identifier of the command for which a unique style is
+ * required; must not be <code>null</code>.
* @return A style tag that is not currently used; may be <code>null</code>.
*/
public String generateUnusedStyle(final String commandId) {
@@ -131,20 +114,17 @@ public final class CommandImageService implements ICommandImageService {
}
@Override
- public ImageDescriptor getImageDescriptor(final String commandId,
- final int type) {
+ public ImageDescriptor getImageDescriptor(final String commandId, final int type) {
return commandImageManager.getImageDescriptor(commandId, type);
}
@Override
- public ImageDescriptor getImageDescriptor(final String commandId,
- final int type, final String style) {
+ public ImageDescriptor getImageDescriptor(final String commandId, final int type, final String style) {
return commandImageManager.getImageDescriptor(commandId, type, style);
}
@Override
- public ImageDescriptor getImageDescriptor(final String commandId,
- final String style) {
+ public ImageDescriptor getImageDescriptor(final String commandId, final String style) {
return commandImageManager.getImageDescriptor(commandId, style);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandLegacyWrapper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandLegacyWrapper.java
index 3cf258c1dea..a60c62b3cf0 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandLegacyWrapper.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandLegacyWrapper.java
@@ -54,53 +54,45 @@ final class CommandLegacyWrapper implements ICommand {
private final Command command;
/**
- * A parameterized representation of the command. This is created lazily. If
- * it has not yet been created, it is <code>null</code>.
+ * A parameterized representation of the command. This is created lazily. If it
+ * has not yet been created, it is <code>null</code>.
*/
private ParameterizedCommand parameterizedCommand;
/**
* Constructs a new <code>CommandWrapper</code>
*
- * @param command
- * The command to be wrapped; must not be <code>null</code>.
- * @param bindingManager
- * The binding manager to support this wrapper; must not be
- * <code>null</code>.
+ * @param command The command to be wrapped; must not be
+ * <code>null</code>.
+ * @param bindingManager The binding manager to support this wrapper; must not
+ * be <code>null</code>.
*/
- CommandLegacyWrapper(final Command command,
- final BindingManager bindingManager) {
+ CommandLegacyWrapper(final Command command, final BindingManager bindingManager) {
if (command == null) {
- throw new NullPointerException(
- "The wrapped command cannot be <code>null</code>."); //$NON-NLS-1$
+ throw new NullPointerException("The wrapped command cannot be <code>null</code>."); //$NON-NLS-1$
}
if (bindingManager == null) {
- throw new NullPointerException(
- "A binding manager is required to wrap a command"); //$NON-NLS-1$
+ throw new NullPointerException("A binding manager is required to wrap a command"); //$NON-NLS-1$
}
this.command = command;
this.bindingManager = bindingManager;
}
-
@Override
public void addCommandListener(final ICommandListener commandListener) {
- command.addCommandListener(new LegacyCommandListenerWrapper(
- commandListener, bindingManager));
+ command.addCommandListener(new LegacyCommandListenerWrapper(commandListener, bindingManager));
}
@Override
- public Object execute(Map parameterValuesByName)
- throws ExecutionException, NotHandledException {
+ public Object execute(Map parameterValuesByName) throws ExecutionException, NotHandledException {
try {
- IHandlerService service = PlatformUI.getWorkbench().getService(
- IHandlerService.class);
+ IHandlerService service = PlatformUI.getWorkbench().getService(IHandlerService.class);
return command.execute(new ExecutionEvent(command,
- (parameterValuesByName == null) ? Collections.EMPTY_MAP
- : parameterValuesByName, null, service.getCurrentState()));
+ (parameterValuesByName == null) ? Collections.EMPTY_MAP : parameterValuesByName, null,
+ service.getCurrentState()));
} catch (final org.eclipse.core.commands.ExecutionException e) {
throw new ExecutionException(e);
} catch (final org.eclipse.core.commands.NotHandledException e) {
@@ -113,10 +105,8 @@ final class CommandLegacyWrapper implements ICommand {
final Map attributeValues = new HashMap();
// avoid using Boolean.valueOf to allow compilation against JCL
// Foundation (bug 80053)
- attributeValues.put(ILegacyAttributeNames.ENABLED,
- command.isEnabled() ? Boolean.TRUE : Boolean.FALSE);
- attributeValues.put(ILegacyAttributeNames.HANDLED,
- command.isHandled() ? Boolean.TRUE : Boolean.FALSE);
+ attributeValues.put(ILegacyAttributeNames.ENABLED, command.isEnabled() ? Boolean.TRUE : Boolean.FALSE);
+ attributeValues.put(ILegacyAttributeNames.HANDLED, command.isHandled() ? Boolean.TRUE : Boolean.FALSE);
return attributeValues;
}
@@ -149,19 +139,14 @@ final class CommandLegacyWrapper implements ICommand {
if (parameterizedCommand == null) {
parameterizedCommand = new ParameterizedCommand(command, null);
}
- IBindingService bindingService = PlatformUI.getWorkbench().getService(
- IBindingService.class);
- final TriggerSequence[] activeBindings = bindingService
- .getActiveBindingsFor(parameterizedCommand);
+ IBindingService bindingService = PlatformUI.getWorkbench().getService(IBindingService.class);
+ final TriggerSequence[] activeBindings = bindingService.getActiveBindingsFor(parameterizedCommand);
final int activeBindingsCount = activeBindings.length;
for (int i = 0; i < activeBindingsCount; i++) {
final TriggerSequence triggerSequence = activeBindings[i];
if (triggerSequence instanceof org.eclipse.jface.bindings.keys.KeySequence) {
- legacyBindings
- .add(new KeySequenceBinding(
- KeySequence
- .getInstance((org.eclipse.jface.bindings.keys.KeySequence) triggerSequence),
- 0));
+ legacyBindings.add(new KeySequenceBinding(
+ KeySequence.getInstance((org.eclipse.jface.bindings.keys.KeySequence) triggerSequence), 0));
}
}
@@ -188,10 +173,8 @@ final class CommandLegacyWrapper implements ICommand {
}
@Override
- public void removeCommandListener(
- final ICommandListener commandListener) {
- command.removeCommandListener(new LegacyCommandListenerWrapper(
- commandListener, bindingManager));
+ public void removeCommandListener(final ICommandListener commandListener) {
+ command.removeCommandListener(new LegacyCommandListenerWrapper(commandListener, bindingManager));
}
@Override
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandManagerFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandManagerFactory.java
index ad25d2035df..1ce8578a388 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandManagerFactory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandManagerFactory.java
@@ -19,7 +19,8 @@ import org.eclipse.core.commands.contexts.ContextManager;
import org.eclipse.jface.bindings.BindingManager;
/**
- * This class allows clients to broker instances of <code>ICommandManager</code>.
+ * This class allows clients to broker instances of
+ * <code>ICommandManager</code>.
* <p>
* This class is not intended to be extended by clients.
* </p>
@@ -31,26 +32,19 @@ public final class CommandManagerFactory {
/**
* Creates a new instance of <code>IMutableCommandManager</code>.
*
- * @param bindingManager
- * The binding manager providing support for the command manager;
- * must not be <code>null</code>.
- * @param commandManager
- * The command manager providing support for this command
- * manager; must not be <code>null</code>.
- * @param contextManager
- * The context manager for this command manager; must not be
- * <code>null</code>.
- * @return a new instance of <code>IMutableCommandManager</code>. Clients
- * should not make assumptions about the concrete implementation
- * outside the contract of the interface. Guaranteed not to be
- * <code>null</code>.
+ * @param bindingManager The binding manager providing support for the command
+ * manager; must not be <code>null</code>.
+ * @param commandManager The command manager providing support for this command
+ * manager; must not be <code>null</code>.
+ * @param contextManager The context manager for this command manager; must not
+ * be <code>null</code>.
+ * @return a new instance of <code>IMutableCommandManager</code>. Clients should
+ * not make assumptions about the concrete implementation outside the
+ * contract of the interface. Guaranteed not to be <code>null</code>.
*/
- public static CommandManagerLegacyWrapper getCommandManagerWrapper(
- final BindingManager bindingManager,
- final CommandManager commandManager,
- final ContextManager contextManager) {
- return new CommandManagerLegacyWrapper(bindingManager, commandManager,
- contextManager);
+ public static CommandManagerLegacyWrapper getCommandManagerWrapper(final BindingManager bindingManager,
+ final CommandManager commandManager, final ContextManager contextManager) {
+ return new CommandManagerLegacyWrapper(bindingManager, commandManager, contextManager);
}
private CommandManagerFactory() {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandManagerLegacyWrapper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandManagerLegacyWrapper.java
index 739183c32f8..5e04c83977b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandManagerLegacyWrapper.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandManagerLegacyWrapper.java
@@ -50,27 +50,24 @@ import org.eclipse.ui.keys.KeySequence;
* @since 3.1
*/
public final class CommandManagerLegacyWrapper implements ICommandManager,
- org.eclipse.core.commands.ICommandManagerListener,
- IBindingManagerListener, IContextManagerListener {
+ org.eclipse.core.commands.ICommandManagerListener, IBindingManagerListener, IContextManagerListener {
/**
- * Whether commands should print out information about which handlers are
- * being executed. Change this value if you want console output on command
- * execution.
+ * Whether commands should print out information about which handlers are being
+ * executed. Change this value if you want console output on command execution.
*/
public static boolean DEBUG_COMMAND_EXECUTION = false;
/**
- * Whether commands should print out information about handler changes.
- * Change this value if you want console output when commands change
- * handlers.
+ * Whether commands should print out information about handler changes. Change
+ * this value if you want console output when commands change handlers.
*/
public static boolean DEBUG_HANDLERS = false;
/**
- * Which command should print out debugging information. Change this value
- * if you want to only here when a command with a particular identifier
- * changes its handler.
+ * Which command should print out debugging information. Change this value if
+ * you want to only here when a command with a particular identifier changes its
+ * handler.
*/
public static String DEBUG_HANDLERS_COMMAND_ID = null;
@@ -87,17 +84,16 @@ public final class CommandManagerLegacyWrapper implements ICommandManager,
}
/**
- * The JFace binding machine that provides binding support for this
- * workbench mutable command manager. This value will never be
- * <code>null</code>.
+ * The JFace binding machine that provides binding support for this workbench
+ * mutable command manager. This value will never be <code>null</code>.
*
* @since 3.1
*/
private final BindingManager bindingManager;
/**
- * The command manager that provides functionality for this workbench
- * command manager. This value will never be <code>null</code>.
+ * The command manager that provides functionality for this workbench command
+ * manager. This value will never be <code>null</code>.
*
* @since 3.1
*/
@@ -106,35 +102,30 @@ public final class CommandManagerLegacyWrapper implements ICommandManager,
private List commandManagerListeners;
/**
- * The context manager that provides functionality for this workbench
- * command manager. This value will never be <code>null</code>.
+ * The context manager that provides functionality for this workbench command
+ * manager. This value will never be <code>null</code>.
*
* @since 3.1
*/
private final ContextManager contextManager;
/**
- * Constructs a new instance of <code>MutableCommandManager</code>. The
- * binding manager and command manager providing support for this manager
- * are constructed at this time.
+ * Constructs a new instance of <code>MutableCommandManager</code>. The binding
+ * manager and command manager providing support for this manager are
+ * constructed at this time.
*
- * @param bindingManager
- * The binding manager providing support for the command manager;
- * must not be <code>null</code>.
- * @param commandManager
- * The command manager providing support for this command
- * manager; must not be <code>null</code>.
- * @param contextManager
- * The context manager to provide context support to this
- * manager. This value must not be <code>null</code>.
+ * @param bindingManager The binding manager providing support for the command
+ * manager; must not be <code>null</code>.
+ * @param commandManager The command manager providing support for this command
+ * manager; must not be <code>null</code>.
+ * @param contextManager The context manager to provide context support to this
+ * manager. This value must not be <code>null</code>.
*
*/
- public CommandManagerLegacyWrapper(final BindingManager bindingManager,
- final CommandManager commandManager,
+ public CommandManagerLegacyWrapper(final BindingManager bindingManager, final CommandManager commandManager,
final ContextManager contextManager) {
if (contextManager == null) {
- throw new NullPointerException(
- "The context manager cannot be null."); //$NON-NLS-1$
+ throw new NullPointerException("The context manager cannot be null."); //$NON-NLS-1$
}
this.bindingManager = bindingManager;
this.commandManager = commandManager;
@@ -142,8 +133,7 @@ public final class CommandManagerLegacyWrapper implements ICommandManager,
}
@Override
- public void addCommandManagerListener(
- final ICommandManagerListener commandManagerListener) {
+ public void addCommandManagerListener(final ICommandManagerListener commandManagerListener) {
if (commandManagerListener == null) {
throw new NullPointerException("Cannot add a null listener."); //$NON-NLS-1$
}
@@ -167,8 +157,7 @@ public final class CommandManagerLegacyWrapper implements ICommandManager,
if (schemeDefinitionsChanged) {
previousSchemes = new HashSet();
final Scheme scheme = event.getScheme();
- final Scheme[] definedSchemes = event.getManager()
- .getDefinedSchemes();
+ final Scheme[] definedSchemes = event.getManager().getDefinedSchemes();
final int definedSchemesCount = definedSchemes.length;
for (int i = 0; i < definedSchemesCount; i++) {
final Scheme definedScheme = definedSchemes[0];
@@ -184,21 +173,18 @@ public final class CommandManagerLegacyWrapper implements ICommandManager,
previousSchemes = null;
}
- fireCommandManagerChanged(new CommandManagerEvent(this, false, event
- .isActiveSchemeChanged(), event.isLocaleChanged(), event
- .isPlatformChanged(), false, false, schemeDefinitionsChanged,
- null, null, previousSchemes));
+ fireCommandManagerChanged(new CommandManagerEvent(this, false, event.isActiveSchemeChanged(),
+ event.isLocaleChanged(), event.isPlatformChanged(), false, false, schemeDefinitionsChanged, null, null,
+ previousSchemes));
}
@Override
- public void commandManagerChanged(
- final org.eclipse.core.commands.CommandManagerEvent event) {
+ public void commandManagerChanged(final org.eclipse.core.commands.CommandManagerEvent event) {
// Figure out the set of previous category identifiers.
final boolean categoryIdsChanged = event.isCategoryChanged();
final Set previousCategoryIds;
if (categoryIdsChanged) {
- previousCategoryIds = new HashSet(commandManager
- .getDefinedCategoryIds());
+ previousCategoryIds = new HashSet(commandManager.getDefinedCategoryIds());
final String categoryId = event.getCategoryId();
if (event.isCategoryDefined()) {
previousCategoryIds.remove(categoryId);
@@ -213,8 +199,7 @@ public final class CommandManagerLegacyWrapper implements ICommandManager,
final boolean commandIdsChanged = event.isCommandChanged();
final Set previousCommandIds;
if (commandIdsChanged) {
- previousCommandIds = new HashSet(commandManager
- .getDefinedCommandIds());
+ previousCommandIds = new HashSet(commandManager.getDefinedCommandIds());
final String commandId = event.getCommandId();
if (event.isCommandDefined()) {
previousCommandIds.remove(commandId);
@@ -225,27 +210,23 @@ public final class CommandManagerLegacyWrapper implements ICommandManager,
previousCommandIds = null;
}
- fireCommandManagerChanged(new CommandManagerEvent(this, false, false,
- false, false, categoryIdsChanged, commandIdsChanged, false,
- previousCategoryIds, previousCommandIds, null));
+ fireCommandManagerChanged(new CommandManagerEvent(this, false, false, false, false, categoryIdsChanged,
+ commandIdsChanged, false, previousCategoryIds, previousCommandIds, null));
}
@Override
public void contextManagerChanged(final ContextManagerEvent event) {
- fireCommandManagerChanged(new CommandManagerEvent(this, event
- .isActiveContextsChanged(), false, false, false, false, false,
- false, null, null, null));
+ fireCommandManagerChanged(new CommandManagerEvent(this, event.isActiveContextsChanged(), false, false, false,
+ false, false, false, null, null, null));
}
- private void fireCommandManagerChanged(
- CommandManagerEvent commandManagerEvent) {
+ private void fireCommandManagerChanged(CommandManagerEvent commandManagerEvent) {
if (commandManagerEvent == null) {
throw new NullPointerException();
}
if (commandManagerListeners != null) {
for (int i = 0; i < commandManagerListeners.size(); i++) {
- ((ICommandManagerListener) commandManagerListeners.get(i))
- .commandManagerChanged(commandManagerEvent);
+ ((ICommandManagerListener) commandManagerListeners.get(i)).commandManagerChanged(commandManagerEvent);
}
}
}
@@ -263,8 +244,8 @@ public final class CommandManagerLegacyWrapper implements ICommandManager,
}
/*
- * TODO This is possibly a breaking change. The id should be non-null,
- * and presumably, a real scheme id.
+ * TODO This is possibly a breaking change. The id should be non-null, and
+ * presumably, a real scheme id.
*/
return Util.ZERO_LENGTH_STRING;
}
@@ -326,18 +307,15 @@ public final class CommandManagerLegacyWrapper implements ICommandManager,
try {
final org.eclipse.jface.bindings.keys.KeySequence sequence = org.eclipse.jface.bindings.keys.KeySequence
.getInstance(keySequence.toString());
- final Map partialMatches = bindingManager
- .getPartialMatches(sequence);
+ final Map partialMatches = bindingManager.getPartialMatches(sequence);
final Map returnValue = new HashMap();
final Iterator matchItr = partialMatches.entrySet().iterator();
while (matchItr.hasNext()) {
final Map.Entry entry = (Map.Entry) matchItr.next();
- final TriggerSequence trigger = (TriggerSequence) entry
- .getKey();
+ final TriggerSequence trigger = (TriggerSequence) entry.getKey();
if (trigger instanceof org.eclipse.jface.bindings.keys.KeySequence) {
final org.eclipse.jface.bindings.keys.KeySequence triggerKey = (org.eclipse.jface.bindings.keys.KeySequence) trigger;
- returnValue.put(KeySequence.getInstance(triggerKey
- .toString()), entry.getValue());
+ returnValue.put(KeySequence.getInstance(triggerKey.toString()), entry.getValue());
}
}
return returnValue;
@@ -388,8 +366,7 @@ public final class CommandManagerLegacyWrapper implements ICommandManager,
}
@Override
- public void removeCommandManagerListener(
- ICommandManagerListener commandManagerListener) {
+ public void removeCommandManagerListener(ICommandManagerListener commandManagerListener) {
if (commandManagerListener == null) {
throw new NullPointerException("Cannot remove a null listener"); //$NON-NLS-1$
}
@@ -408,9 +385,9 @@ public final class CommandManagerLegacyWrapper implements ICommandManager,
/**
* Updates the handlers for a block of commands all at once.
*
- * @param handlersByCommandId
- * The map of command identifier (<code>String</code>) to
- * handler (<code>IHandler</code>).
+ * @param handlersByCommandId The map of command identifier
+ * (<code>String</code>) to handler
+ * (<code>IHandler</code>).
*/
public void setHandlersByCommandId(final Map handlersByCommandId) {
// Wrap legacy handlers so they can be passed to the new API.
@@ -420,8 +397,8 @@ public final class CommandManagerLegacyWrapper implements ICommandManager,
final Object handler = entry.getValue();
if (handler instanceof org.eclipse.ui.commands.IHandler) {
final String commandId = (String) entry.getKey();
- handlersByCommandId.put(commandId, new LegacyHandlerWrapper(
- (org.eclipse.ui.commands.IHandler) handler));
+ handlersByCommandId.put(commandId,
+ new LegacyHandlerWrapper((org.eclipse.ui.commands.IHandler) handler));
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandPersistence.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandPersistence.java
index 9bf1946f0f5..142caefa73e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandPersistence.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandPersistence.java
@@ -69,25 +69,22 @@ public final class CommandPersistence extends RegistryPersistence {
/**
* Reads all of the category definitions from the commands extension point.
*
- * @param configurationElements
- * The configuration elements in the commands extension point;
- * must not be <code>null</code>, but may be empty.
- * @param configurationElementCount
- * The number of configuration elements that are really in the
- * array.
- * @param commandManager
- * The command service to which the categories should be added;
- * must not be <code>null</code>.
+ * @param configurationElements The configuration elements in the commands
+ * extension point; must not be
+ * <code>null</code>, but may be empty.
+ * @param configurationElementCount The number of configuration elements that
+ * are really in the array.
+ * @param commandManager The command service to which the categories
+ * should be added; must not be
+ * <code>null</code>.
*/
- private static void readCategoriesFromRegistry(
- final IConfigurationElement[] configurationElements,
+ private static void readCategoriesFromRegistry(final IConfigurationElement[] configurationElements,
final int configurationElementCount, final CommandManager commandManager) {
Category undefCat = commandManager.getCategory(null);
if (!undefCat.isDefined()) {
// Define the uncategorized category.
- commandManager.defineUncategorizedCategory(
- WorkbenchMessages.CommandService_AutogeneratedCategoryName,
+ commandManager.defineUncategorizedCategory(WorkbenchMessages.CommandService_AutogeneratedCategoryName,
WorkbenchMessages.CommandService_AutogeneratedCategoryDescription);
}
@@ -97,23 +94,21 @@ public final class CommandPersistence extends RegistryPersistence {
final IConfigurationElement configurationElement = configurationElements[i];
// Read out the category identifier.
- final String categoryId = readRequired(configurationElement,
- ATT_ID, warningsToLog, "Categories need an id"); //$NON-NLS-1$
+ final String categoryId = readRequired(configurationElement, ATT_ID, warningsToLog,
+ "Categories need an id"); //$NON-NLS-1$
if (categoryId == null) {
continue;
}
// Read out the name.
- final String name = readRequired(configurationElement, ATT_NAME,
- warningsToLog, "Categories need a name", //$NON-NLS-1$
+ final String name = readRequired(configurationElement, ATT_NAME, warningsToLog, "Categories need a name", //$NON-NLS-1$
categoryId);
if (name == null) {
continue;
}
// Read out the description.
- final String description = readOptional(configurationElement,
- ATT_DESCRIPTION);
+ final String description = readOptional(configurationElement, ATT_DESCRIPTION);
final Category category = commandManager.getCategory(categoryId);
if (!category.isDefined()) {
@@ -122,26 +117,23 @@ public final class CommandPersistence extends RegistryPersistence {
}
// If there were any warnings, then log them now.
- logWarnings(
- warningsToLog,
+ logWarnings(warningsToLog,
"Warnings while parsing the commands from the 'org.eclipse.ui.commands' and 'org.eclipse.ui.actionDefinitions' extension points."); //$NON-NLS-1$
}
/**
* Reads all of the command definitions from the commands extension point.
*
- * @param configurationElements
- * The configuration elements in the commands extension point;
- * must not be <code>null</code>, but may be empty.
- * @param configurationElementCount
- * The number of configuration elements that are really in the
- * array.
- * @param commandManager
- * The command service to which the commands should be added;
- * must not be <code>null</code>.
+ * @param configurationElements The configuration elements in the commands
+ * extension point; must not be
+ * <code>null</code>, but may be empty.
+ * @param configurationElementCount The number of configuration elements that
+ * are really in the array.
+ * @param commandManager The command service to which the commands
+ * should be added; must not be
+ * <code>null</code>.
*/
- private static void readCommandsFromRegistry(
- final IConfigurationElement[] configurationElements,
+ private static void readCommandsFromRegistry(final IConfigurationElement[] configurationElements,
final int configurationElementCount, final CommandManager commandManager) {
final List warningsToLog = new ArrayList(1);
@@ -149,26 +141,22 @@ public final class CommandPersistence extends RegistryPersistence {
final IConfigurationElement configurationElement = configurationElements[i];
// Read out the command identifier.
- final String commandId = readRequired(configurationElement, ATT_ID,
- warningsToLog, "Commands need an id"); //$NON-NLS-1$
+ final String commandId = readRequired(configurationElement, ATT_ID, warningsToLog, "Commands need an id"); //$NON-NLS-1$
if (commandId == null) {
continue;
}
// Read out the name.
- final String name = readRequired(configurationElement, ATT_NAME,
- warningsToLog, "Commands need a name"); //$NON-NLS-1$
+ final String name = readRequired(configurationElement, ATT_NAME, warningsToLog, "Commands need a name"); //$NON-NLS-1$
if (name == null) {
continue;
}
// Read out the description.
- final String description = readOptional(configurationElement,
- ATT_DESCRIPTION);
+ final String description = readOptional(configurationElement, ATT_DESCRIPTION);
// Read out the category id.
- String categoryId = configurationElement
- .getAttribute(ATT_CATEGORY_ID);
+ String categoryId = configurationElement.getAttribute(ATT_CATEGORY_ID);
if ((categoryId == null) || (categoryId.length() == 0)) {
categoryId = configurationElement.getAttribute(ATT_CATEGORY);
if ((categoryId != null) && (categoryId.length() == 0)) {
@@ -177,25 +165,19 @@ public final class CommandPersistence extends RegistryPersistence {
}
// Read out the parameters.
- final Parameter[] parameters = readParameters(configurationElement,
- warningsToLog, commandManager);
+ final Parameter[] parameters = readParameters(configurationElement, warningsToLog, commandManager);
// Read out the returnTypeId.
- final String returnTypeId = readOptional(configurationElement,
- ATT_RETURN_TYPE_ID);
+ final String returnTypeId = readOptional(configurationElement, ATT_RETURN_TYPE_ID);
// Read out the help context identifier.
- final String helpContextId = readOptional(configurationElement,
- ATT_HELP_CONTEXT_ID);
+ final String helpContextId = readOptional(configurationElement, ATT_HELP_CONTEXT_ID);
final Command command = commandManager.getCommand(commandId);
final Category category = commandManager.getCategory(categoryId);
if (!category.isDefined()) {
- addWarning(
- warningsToLog,
- "Commands should really have a category", //$NON-NLS-1$
- configurationElement, commandId,
- "categoryId", categoryId); //$NON-NLS-1$
+ addWarning(warningsToLog, "Commands should really have a category", //$NON-NLS-1$
+ configurationElement, commandId, "categoryId", categoryId); //$NON-NLS-1$
}
final ParameterType returnType;
@@ -216,8 +198,7 @@ public final class CommandPersistence extends RegistryPersistence {
}
// If there were any warnings, then log them now.
- logWarnings(
- warningsToLog,
+ logWarnings(warningsToLog,
"Warnings while parsing the commands from the 'org.eclipse.ui.commands' and 'org.eclipse.ui.actionDefinitions' extension points."); //$NON-NLS-1$
}
@@ -227,24 +208,22 @@ public final class CommandPersistence extends RegistryPersistence {
* guaranteed to be valid. If invalid parameters are found, then a warning
* status will be appended to the <code>warningsToLog</code> list.
*
- * @param configurationElement
- * The configuration element from which the parameters should be
- * read; must not be <code>null</code>.
- * @param warningsToLog
- * The list of warnings found during parsing. Warnings found
- * while parsing the parameters will be appended to this list.
- * This value must not be <code>null</code>.
- * @param commandManager
- * The command service from which the parameter can get parameter
- * types; must not be <code>null</code>.
+ * @param configurationElement The configuration element from which the
+ * parameters should be read; must not be
+ * <code>null</code>.
+ * @param warningsToLog The list of warnings found during parsing.
+ * Warnings found while parsing the parameters will
+ * be appended to this list. This value must not be
+ * <code>null</code>.
+ * @param commandManager The command service from which the parameter can
+ * get parameter types; must not be
+ * <code>null</code>.
* @return The array of parameters found for this configuration element;
* <code>null</code> if none can be found.
*/
- private static Parameter[] readParameters(
- final IConfigurationElement configurationElement, final List warningsToLog,
- final CommandManager commandManager) {
- final IConfigurationElement[] parameterElements = configurationElement
- .getChildren(TAG_COMMAND_PARAMETER);
+ private static Parameter[] readParameters(final IConfigurationElement configurationElement,
+ final List warningsToLog, final CommandManager commandManager) {
+ final IConfigurationElement[] parameterElements = configurationElement.getChildren(TAG_COMMAND_PARAMETER);
if ((parameterElements == null) || (parameterElements.length == 0)) {
return null;
}
@@ -253,30 +232,26 @@ public final class CommandPersistence extends RegistryPersistence {
Parameter[] parameters = new Parameter[parameterElements.length];
for (final IConfigurationElement parameterElement : parameterElements) {
// Read out the id
- final String id = readRequired(parameterElement, ATT_ID,
- warningsToLog, "Parameters need an id"); //$NON-NLS-1$
+ final String id = readRequired(parameterElement, ATT_ID, warningsToLog, "Parameters need an id"); //$NON-NLS-1$
if (id == null) {
continue;
}
// Read out the name.
- final String name = readRequired(parameterElement, ATT_NAME,
- warningsToLog, "Parameters need a name"); //$NON-NLS-1$
+ final String name = readRequired(parameterElement, ATT_NAME, warningsToLog, "Parameters need a name"); //$NON-NLS-1$
if (name == null) {
continue;
}
/*
- * The IParameterValues will be initialized lazily as an
- * IExecutableExtension.
+ * The IParameterValues will be initialized lazily as an IExecutableExtension.
*/
// Read out the typeId attribute, if present.
final String typeId = readOptional(parameterElement, ATT_TYPE_ID);
// Read out the optional attribute, if present.
- final boolean optional = readBoolean(parameterElement,
- ATT_OPTIONAL, true);
+ final boolean optional = readBoolean(parameterElement, ATT_OPTIONAL, true);
final ParameterType type;
if (typeId == null) {
@@ -285,15 +260,13 @@ public final class CommandPersistence extends RegistryPersistence {
type = commandManager.getParameterType(typeId);
}
- final Parameter parameter = new Parameter(id, name,
- parameterElement, type, optional);
+ final Parameter parameter = new Parameter(id, name, parameterElement, type, optional);
parameters[insertionIndex++] = parameter;
}
if (insertionIndex != parameters.length) {
final Parameter[] compactedParameters = new Parameter[insertionIndex];
- System.arraycopy(parameters, 0, compactedParameters, 0,
- insertionIndex);
+ System.arraycopy(parameters, 0, compactedParameters, 0, insertionIndex);
parameters = compactedParameters;
}
@@ -301,22 +274,20 @@ public final class CommandPersistence extends RegistryPersistence {
}
/**
- * Reads all of the commandParameterType definitions from the commands
- * extension point.
+ * Reads all of the commandParameterType definitions from the commands extension
+ * point.
*
- * @param configurationElements
- * The configuration elements in the commands extension point;
- * must not be <code>null</code>, but may be empty.
- * @param configurationElementCount
- * The number of configuration elements that are really in the
- * array.
- * @param commandManager
- * The command service to which the commands should be added;
- * must not be <code>null</code>.
+ * @param configurationElements The configuration elements in the commands
+ * extension point; must not be
+ * <code>null</code>, but may be empty.
+ * @param configurationElementCount The number of configuration elements that
+ * are really in the array.
+ * @param commandManager The command service to which the commands
+ * should be added; must not be
+ * <code>null</code>.
* @since 3.2
*/
- private static void readParameterTypesFromRegistry(
- final IConfigurationElement[] configurationElements,
+ private static void readParameterTypesFromRegistry(final IConfigurationElement[] configurationElements,
final int configurationElementCount, final CommandManager commandManager) {
final List warningsToLog = new ArrayList(1);
@@ -325,8 +296,8 @@ public final class CommandPersistence extends RegistryPersistence {
final IConfigurationElement configurationElement = configurationElements[i];
// Read out the commandParameterType identifier.
- final String parameterTypeId = readRequired(configurationElement,
- ATT_ID, warningsToLog, "Command parameter types need an id"); //$NON-NLS-1$
+ final String parameterTypeId = readRequired(configurationElement, ATT_ID, warningsToLog,
+ "Command parameter types need an id"); //$NON-NLS-1$
if (parameterTypeId == null) {
continue;
}
@@ -335,53 +306,46 @@ public final class CommandPersistence extends RegistryPersistence {
final String type = readOptional(configurationElement, ATT_TYPE);
// Read out the converter.
- final String converter = readOptional(configurationElement,
- ATT_CONVERTER);
+ final String converter = readOptional(configurationElement, ATT_CONVERTER);
/*
* if the converter attribute was given, create a proxy
- * AbstractParameterValueConverter for the ParameterType, otherwise
- * null indicates there is no converter
+ * AbstractParameterValueConverter for the ParameterType, otherwise null
+ * indicates there is no converter
*/
final AbstractParameterValueConverter parameterValueConverter = (converter == null) ? null
: new ParameterValueConverterProxy(configurationElement);
- final ParameterType parameterType = commandManager
- .getParameterType(parameterTypeId);
+ final ParameterType parameterType = commandManager.getParameterType(parameterTypeId);
if (!parameterType.isDefined()) {
parameterType.define(type, parameterValueConverter);
}
}
// If there were any warnings, then log them now.
- logWarnings(
- warningsToLog,
+ logWarnings(warningsToLog,
"Warnings while parsing the commandParameterTypes from the 'org.eclipse.ui.commands' extension point."); //$NON-NLS-1$
}
/**
- * Reads the states from a parent configuration element. This is used to
- * read the state sub-elements from a command element. Each state is
- * guaranteed to be valid. If invalid states are found, then a warning
- * status will be appended to the <code>warningsToLog</code> list.
+ * Reads the states from a parent configuration element. This is used to read
+ * the state sub-elements from a command element. Each state is guaranteed to be
+ * valid. If invalid states are found, then a warning status will be appended to
+ * the <code>warningsToLog</code> list.
*
- * @param configurationElement
- * The configuration element from which the states should be
- * read; must not be <code>null</code>.
- * @param warningsToLog
- * The list of warnings found during parsing. Warnings found
- * while parsing the parameters will be appended to this list.
- * This value must not be <code>null</code>.
- * @param command
- * The command for which the state is being read; may be
- * <code>null</code>.
+ * @param configurationElement The configuration element from which the states
+ * should be read; must not be <code>null</code>.
+ * @param warningsToLog The list of warnings found during parsing.
+ * Warnings found while parsing the parameters will
+ * be appended to this list. This value must not be
+ * <code>null</code>.
+ * @param command The command for which the state is being read;
+ * may be <code>null</code>.
*/
- private static void readState(
- final IConfigurationElement configurationElement,
- final List warningsToLog, final Command command) {
- final IConfigurationElement[] stateElements = configurationElement
- .getChildren(TAG_STATE);
+ private static void readState(final IConfigurationElement configurationElement, final List warningsToLog,
+ final Command command) {
+ final IConfigurationElement[] stateElements = configurationElement.getChildren(TAG_STATE);
if ((stateElements == null) || (stateElements.length == 0)) {
return;
}
@@ -395,8 +359,7 @@ public final class CommandPersistence extends RegistryPersistence {
if (checkClass(stateElement, warningsToLog, "State must have an associated class", id)) { //$NON-NLS-1$
if (command.getState(id) == null) {
final State state = new CommandStateProxy(stateElement, ATT_CLASS,
- PrefUtil.getInternalPreferenceStore(),
- CommandService.createPreferenceKey(command, id));
+ PrefUtil.getInternalPreferenceStore(), CommandService.createPreferenceKey(command, id));
command.addState(id, state);
}
}
@@ -404,17 +367,17 @@ public final class CommandPersistence extends RegistryPersistence {
}
/**
- * The command service with which this persistence class is associated;
- * never <code>null</code>.
+ * The command service with which this persistence class is associated; never
+ * <code>null</code>.
*/
private final CommandManager commandManager;
/**
* Constructs a new instance of <code>CommandPersistence</code>.
*
- * @param commandService
- * The command service which should be populated with the values
- * from the registry; must not be <code>null</code>.
+ * @param commandService The command service which should be populated with the
+ * values from the registry; must not be
+ * <code>null</code>.
*/
public CommandPersistence(final CommandManager commandService) {
if (commandService == null) {
@@ -429,12 +392,11 @@ public final class CommandPersistence extends RegistryPersistence {
}
public boolean commandsNeedUpdating(final IRegistryChangeEvent event) {
- final IExtensionDelta[] commandDeltas = event.getExtensionDeltas(
- PlatformUI.PLUGIN_ID, IWorkbenchRegistryConstants.PL_COMMANDS);
+ final IExtensionDelta[] commandDeltas = event.getExtensionDeltas(PlatformUI.PLUGIN_ID,
+ IWorkbenchRegistryConstants.PL_COMMANDS);
if (commandDeltas.length == 0) {
- final IExtensionDelta[] actionDefinitionDeltas = event
- .getExtensionDeltas(PlatformUI.PLUGIN_ID,
- IWorkbenchRegistryConstants.PL_ACTION_DEFINITIONS);
+ final IExtensionDelta[] actionDefinitionDeltas = event.getExtensionDeltas(PlatformUI.PLUGIN_ID,
+ IWorkbenchRegistryConstants.PL_ACTION_DEFINITIONS);
if (actionDefinitionDeltas.length == 0) {
return false;
}
@@ -446,9 +408,9 @@ public final class CommandPersistence extends RegistryPersistence {
/**
* Reads all of the commands and categories from the registry,
*
- * @param commandManager
- * The command service which should be populated with the values
- * from the registry; must not be <code>null</code>.
+ * @param commandManager The command service which should be populated with the
+ * values from the registry; must not be
+ * <code>null</code>.
*/
@Override
protected void read() {
@@ -465,25 +427,20 @@ public final class CommandPersistence extends RegistryPersistence {
final IConfigurationElement[][] indexedConfigurationElements = new IConfigurationElement[3][];
// Sort the commands extension point based on element name.
- final IConfigurationElement[] commandsExtensionPoint = registry
- .getConfigurationElementsFor(EXTENSION_COMMANDS);
+ final IConfigurationElement[] commandsExtensionPoint = registry.getConfigurationElementsFor(EXTENSION_COMMANDS);
for (final IConfigurationElement configurationElement : commandsExtensionPoint) {
final String name = configurationElement.getName();
// Check if it is a binding definition.
if (TAG_COMMAND.equals(name)) {
- addElementToIndexedArray(configurationElement,
- indexedConfigurationElements,
- INDEX_COMMAND_DEFINITIONS, commandDefinitionCount++);
+ addElementToIndexedArray(configurationElement, indexedConfigurationElements, INDEX_COMMAND_DEFINITIONS,
+ commandDefinitionCount++);
} else if (TAG_CATEGORY.equals(name)) {
- addElementToIndexedArray(configurationElement,
- indexedConfigurationElements,
- INDEX_CATEGORY_DEFINITIONS, categoryDefinitionCount++);
+ addElementToIndexedArray(configurationElement, indexedConfigurationElements, INDEX_CATEGORY_DEFINITIONS,
+ categoryDefinitionCount++);
} else if (TAG_COMMAND_PARAMETER_TYPE.equals(name)) {
- addElementToIndexedArray(configurationElement,
- indexedConfigurationElements,
- INDEX_PARAMETER_TYPE_DEFINITIONS,
- parameterTypeDefinitionCount++);
+ addElementToIndexedArray(configurationElement, indexedConfigurationElements,
+ INDEX_PARAMETER_TYPE_DEFINITIONS, parameterTypeDefinitionCount++);
}
}
@@ -493,20 +450,16 @@ public final class CommandPersistence extends RegistryPersistence {
final String name = configurationElement.getName();
if (TAG_ACTION_DEFINITION.equals(name)) {
- addElementToIndexedArray(configurationElement,
- indexedConfigurationElements,
- INDEX_COMMAND_DEFINITIONS, commandDefinitionCount++);
+ addElementToIndexedArray(configurationElement, indexedConfigurationElements, INDEX_COMMAND_DEFINITIONS,
+ commandDefinitionCount++);
}
}
- readCategoriesFromRegistry(
- indexedConfigurationElements[INDEX_CATEGORY_DEFINITIONS],
- categoryDefinitionCount, commandManager);
- readCommandsFromRegistry(
- indexedConfigurationElements[INDEX_COMMAND_DEFINITIONS],
- commandDefinitionCount, commandManager);
- readParameterTypesFromRegistry(
- indexedConfigurationElements[INDEX_PARAMETER_TYPE_DEFINITIONS],
+ readCategoriesFromRegistry(indexedConfigurationElements[INDEX_CATEGORY_DEFINITIONS], categoryDefinitionCount,
+ commandManager);
+ readCommandsFromRegistry(indexedConfigurationElements[INDEX_COMMAND_DEFINITIONS], commandDefinitionCount,
+ commandManager);
+ readParameterTypesFromRegistry(indexedConfigurationElements[INDEX_PARAMETER_TYPE_DEFINITIONS],
parameterTypeDefinitionCount, commandManager);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandService.java
index a49803f64c2..659d4663253 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandService.java
@@ -64,19 +64,15 @@ public final class CommandService implements ICommandService, IUpdateService {
private static final String PREFERENCE_KEY_PREFIX = "org.eclipse.ui.commands/state"; //$NON-NLS-1$
/**
- * Creates a preference key for the given piece of state on the given
- * command.
+ * Creates a preference key for the given piece of state on the given command.
*
- * @param command
- * The command for which the preference key should be created;
- * must not be <code>null</code>.
- * @param stateId
- * The identifier of the state for which the preference key
- * should be created; must not be <code>null</code>.
+ * @param command The command for which the preference key should be created;
+ * must not be <code>null</code>.
+ * @param stateId The identifier of the state for which the preference key
+ * should be created; must not be <code>null</code>.
* @return A suitable preference key; never <code>null</code>.
*/
- static String createPreferenceKey(final Command command,
- final String stateId) {
+ static String createPreferenceKey(final Command command, final String stateId) {
return PREFERENCE_KEY_PREFIX + '/' + command.getId() + '/' + stateId;
}
@@ -96,16 +92,15 @@ public final class CommandService implements ICommandService, IUpdateService {
private ICommandHelpService commandHelpService;
/**
- * Constructs a new instance of <code>CommandService</code> using a
- * command manager.
+ * Constructs a new instance of <code>CommandService</code> using a command
+ * manager.
*
- * @param commandManager
- * The command manager to use; must not be <code>null</code>.
+ * @param commandManager The command manager to use; must not be
+ * <code>null</code>.
*/
public CommandService(final CommandManager commandManager, IEclipseContext context) {
if (commandManager == null) {
- throw new NullPointerException(
- "Cannot create a command service with a null manager"); //$NON-NLS-1$
+ throw new NullPointerException("Cannot create a command service with a null manager"); //$NON-NLS-1$
}
this.commandManager = commandManager;
this.commandPersistence = new CommandPersistence(commandManager);
@@ -119,14 +114,12 @@ public final class CommandService implements ICommandService, IUpdateService {
}
@Override
- public void defineUncategorizedCategory(final String name,
- final String description) {
+ public void defineUncategorizedCategory(final String name, final String description) {
commandManager.defineUncategorizedCategory(name, description);
}
@Override
- public ParameterizedCommand deserialize(
- final String serializedParameterizedCommand)
+ public ParameterizedCommand deserialize(final String serializedParameterizedCommand)
throws NotDefinedException, SerializationException {
return commandManager.deserialize(serializedParameterizedCommand);
}
@@ -136,8 +129,8 @@ public final class CommandService implements ICommandService, IUpdateService {
commandPersistence.dispose();
/*
- * All state on all commands neeeds to be disposed. This is so that the
- * state has a chance to persist any changes.
+ * All state on all commands neeeds to be disposed. This is so that the state
+ * has a chance to persist any changes.
*/
final Command[] commands = commandManager.getAllCommands();
for (final Command command : commands) {
@@ -147,8 +140,7 @@ public final class CommandService implements ICommandService, IUpdateService {
if (state instanceof PersistentState) {
final PersistentState persistentState = (PersistentState) state;
if (persistentState.shouldPersist()) {
- persistentState.save(PrefUtil
- .getInternalPreferenceStore(),
+ persistentState.save(PrefUtil.getInternalPreferenceStore(),
createPreferenceKey(command, stateId));
}
}
@@ -198,18 +190,15 @@ public final class CommandService implements ICommandService, IUpdateService {
}
/**
- * @throws NotDefinedException
- * if the given command is not defined
+ * @throws NotDefinedException if the given command is not defined
*/
@Override
- public String getHelpContextId(final Command command)
- throws NotDefinedException {
+ public String getHelpContextId(final Command command) throws NotDefinedException {
return commandHelpService.getHelpContextId(command.getId(), context);
}
@Override
- public String getHelpContextId(final String commandId)
- throws NotDefinedException {
+ public String getHelpContextId(final String commandId) throws NotDefinedException {
final Command command = getCommand(commandId);
return getHelpContextId(command);
}
@@ -260,12 +249,11 @@ public final class CommandService implements ICommandService, IUpdateService {
for (Iterator i = callbackRefs.iterator(); i.hasNext();) {
final IElementReference callbackRef = (IElementReference) i.next();
- final Map parms = Collections.unmodifiableMap(callbackRef
- .getParameters());
+ final Map parms = Collections.unmodifiableMap(callbackRef.getParameters());
ISafeRunnable run = new ISafeRunnable() {
@Override
public void handleException(Throwable exception) {
- WorkbenchPlugin.log("Failed to update callback: " //$NON-NLS-1$
+ WorkbenchPlugin.log("Failed to update callback: " //$NON-NLS-1$
+ callbackRef.getCommandId(), exception);
}
@@ -278,8 +266,7 @@ public final class CommandService implements ICommandService, IUpdateService {
SafeRunner.run(run);
} else {
boolean match = true;
- for (Iterator j = filter.entrySet().iterator(); j.hasNext()
- && match;) {
+ for (Iterator j = filter.entrySet().iterator(); j.hasNext() && match;) {
Map.Entry parmEntry = (Map.Entry) j.next();
Object value = parms.get(parmEntry.getKey());
if (!parmEntry.getValue().equals(value)) {
@@ -294,33 +281,28 @@ public final class CommandService implements ICommandService, IUpdateService {
}
@Override
- public IElementReference registerElementForCommand(
- ParameterizedCommand command, UIElement element)
+ public IElementReference registerElementForCommand(ParameterizedCommand command, UIElement element)
throws NotDefinedException {
if (!command.getCommand().isDefined()) {
- throw new NotDefinedException(
- "Cannot define a callback for undefined command " //$NON-NLS-1$
- + command.getCommand().getId());
+ throw new NotDefinedException("Cannot define a callback for undefined command " //$NON-NLS-1$
+ + command.getCommand().getId());
}
if (element == null) {
throw new NotDefinedException("No callback defined for command " //$NON-NLS-1$
+ command.getCommand().getId());
}
- ElementReference ref = new ElementReference(command.getId(), element,
- command.getParameterMap());
+ ElementReference ref = new ElementReference(command.getId(), element, command.getParameterMap());
registerElement(ref);
return ref;
}
@Override
public void registerElement(IElementReference elementReference) {
- List parameterizedCommands = (List) commandCallbacks
- .get(elementReference.getCommandId());
+ List parameterizedCommands = (List) commandCallbacks.get(elementReference.getCommandId());
if (parameterizedCommands == null) {
parameterizedCommands = new ArrayList();
- commandCallbacks.put(elementReference.getCommandId(),
- parameterizedCommands);
+ commandCallbacks.put(elementReference.getCommandId(), parameterizedCommands);
}
parameterizedCommands.add(elementReference);
@@ -329,9 +311,8 @@ public final class CommandService implements ICommandService, IUpdateService {
Command command = getCommand(elementReference.getCommandId());
if (command.isDefined()) {
if (command.getHandler() instanceof IElementUpdater) {
- ((IElementUpdater) command.getHandler()).updateElement(
- elementReference.getElement(), elementReference
- .getParameters());
+ ((IElementUpdater) command.getHandler()).updateElement(elementReference.getElement(),
+ elementReference.getParameters());
}
}
}
@@ -340,8 +321,7 @@ public final class CommandService implements ICommandService, IUpdateService {
public void unregisterElement(IElementReference elementReference) {
if (commandCallbacks == null)
return;
- List parameterizedCommands = (List) commandCallbacks
- .get(elementReference.getCommandId());
+ List parameterizedCommands = (List) commandCallbacks.get(elementReference.getCommandId());
if (parameterizedCommands != null) {
parameterizedCommands.remove(elementReference);
if (parameterizedCommands.isEmpty()) {
@@ -358,8 +338,7 @@ public final class CommandService implements ICommandService, IUpdateService {
}
@Override
- public Runnable registerElementForUpdate(ParameterizedCommand parameterizedCommand,
- final MItem item) {
+ public Runnable registerElementForUpdate(ParameterizedCommand parameterizedCommand, final MItem item) {
UIElement element = new UIElement(context.get(IWorkbench.class)) {
@Override
@@ -395,8 +374,7 @@ public final class CommandService implements ICommandService, IUpdateService {
};
try {
- final IElementReference reference = registerElementForCommand(parameterizedCommand,
- element);
+ final IElementReference reference = registerElementForCommand(parameterizedCommand, element);
return () -> unregisterElement(reference);
} catch (NotDefinedException e) {
WorkbenchPlugin.log(e);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandServiceFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandServiceFactory.java
index 2600280eae2..b93d2181d77 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandServiceFactory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandServiceFactory.java
@@ -32,13 +32,11 @@ import org.eclipse.ui.services.IServiceScopes;
public class CommandServiceFactory extends AbstractServiceFactory {
@Override
- public Object create(Class serviceInterface, IServiceLocator parentLocator,
- IServiceLocator locator) {
+ public Object create(Class serviceInterface, IServiceLocator parentLocator, IServiceLocator locator) {
if (!ICommandService.class.equals(serviceInterface)) {
return null;
}
- IWorkbenchLocationService wls = locator
- .getService(IWorkbenchLocationService.class);
+ IWorkbenchLocationService wls = locator.getService(IWorkbenchLocationService.class);
final IWorkbench wb = wls.getWorkbench();
if (wb == null) {
return null;
@@ -53,8 +51,7 @@ public class CommandServiceFactory extends AbstractServiceFactory {
final IWorkbenchPartSite site = wls.getPartSite();
if (site == null) {
- return new SlaveCommandService((ICommandService) parent,
- IServiceScopes.WINDOW_SCOPE, window);
+ return new SlaveCommandService((ICommandService) parent, IServiceScopes.WINDOW_SCOPE, window);
}
if (parent instanceof SlaveCommandService) {
@@ -62,26 +59,23 @@ public class CommandServiceFactory extends AbstractServiceFactory {
if (pageSite != null) {
MContext context = pageSite.getService(MContext.class);
if (context == null) {
- return new SlaveCommandService((ICommandService) parent,
- IServiceScopes.PAGESITE_SCOPE, pageSite);
+ return new SlaveCommandService((ICommandService) parent, IServiceScopes.PAGESITE_SCOPE, pageSite);
}
- return new SlaveCommandService((ICommandService) parent,
- IServiceScopes.PAGESITE_SCOPE, pageSite, context.getContext());
+ return new SlaveCommandService((ICommandService) parent, IServiceScopes.PAGESITE_SCOPE, pageSite,
+ context.getContext());
}
IServiceLocator mpepSite = wls.getMultiPageEditorSite();
if (mpepSite != null) {
MContext context = mpepSite.getService(MContext.class);
if (context == null) {
- return new SlaveCommandService((ICommandService) parent,
- IServiceScopes.MPESITE_SCOPE, mpepSite);
+ return new SlaveCommandService((ICommandService) parent, IServiceScopes.MPESITE_SCOPE, mpepSite);
}
- return new SlaveCommandService((ICommandService) parent,
- IServiceScopes.MPESITE_SCOPE, mpepSite, context.getContext());
+ return new SlaveCommandService((ICommandService) parent, IServiceScopes.MPESITE_SCOPE, mpepSite,
+ context.getContext());
}
}
- return new SlaveCommandService((ICommandService) parent,
- IServiceScopes.PARTSITE_SCOPE, site);
+ return new SlaveCommandService((ICommandService) parent, IServiceScopes.PARTSITE_SCOPE, site);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandStateProxy.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandStateProxy.java
index 034ad08cfb0..ec1a9eb10b4 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandStateProxy.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandStateProxy.java
@@ -47,8 +47,8 @@ public final class CommandStateProxy extends PersistentState {
/**
* The configuration element from which the state can be created. This value
- * will exist until the element is converted into a real class -- at which
- * point this value will be set to <code>null</code>.
+ * will exist until the element is converted into a real class -- at which point
+ * this value will be set to <code>null</code>.
*/
private IConfigurationElement configurationElement;
@@ -63,9 +63,9 @@ public final class CommandStateProxy extends PersistentState {
private IPreferenceStore preferenceStore;
/**
- * The real state. This value is <code>null</code> until the proxy is
- * forced to load the real state. At this point, the configuration element
- * is converted, nulled out, and this state gains a reference.
+ * The real state. This value is <code>null</code> until the proxy is forced to
+ * load the real state. At this point, the configuration element is converted,
+ * nulled out, and this state gains a reference.
*/
private State state = null;
@@ -79,32 +79,27 @@ public final class CommandStateProxy extends PersistentState {
* Constructs a new instance of <code>HandlerState</code> with all the
* information it needs to create the real state later.
*
- * @param configurationElement
- * The configuration element from which the real class can be
- * loaded at run-time; must not be <code>null</code>.
- * @param stateAttributeName
- * The name of the attribute or element containing the state
- * executable extension; must not be <code>null</code>.
- * @param preferenceStore
- * The preference store to which any persistent data should be
- * written, and from which it should be loaded; may be
- * <code>null</code>.
- * @param preferenceKey
- * The key at which the persistent data is located within the
- * preference store.
+ * @param configurationElement The configuration element from which the real
+ * class can be loaded at run-time; must not be
+ * <code>null</code>.
+ * @param stateAttributeName The name of the attribute or element containing
+ * the state executable extension; must not be
+ * <code>null</code>.
+ * @param preferenceStore The preference store to which any persistent data
+ * should be written, and from which it should be
+ * loaded; may be <code>null</code>.
+ * @param preferenceKey The key at which the persistent data is located
+ * within the preference store.
*/
- public CommandStateProxy(final IConfigurationElement configurationElement,
- final String stateAttributeName,
+ public CommandStateProxy(final IConfigurationElement configurationElement, final String stateAttributeName,
final IPreferenceStore preferenceStore, final String preferenceKey) {
if (configurationElement == null) {
- throw new NullPointerException(
- "The configuration element backing a state proxy cannot be null"); //$NON-NLS-1$
+ throw new NullPointerException("The configuration element backing a state proxy cannot be null"); //$NON-NLS-1$
}
if (stateAttributeName == null) {
- throw new NullPointerException(
- "The attribute containing the state class must be known"); //$NON-NLS-1$
+ throw new NullPointerException("The attribute containing the state class must be known"); //$NON-NLS-1$
}
this.configurationElement = configurationElement;
@@ -128,8 +123,7 @@ public final class CommandStateProxy extends PersistentState {
state.dispose();
if (state instanceof PersistentState) {
final PersistentState persistableState = (PersistentState) state;
- if (persistableState.shouldPersist() && preferenceStore != null
- && preferenceKey != null) {
+ if (persistableState.shouldPersist() && preferenceStore != null && preferenceKey != null) {
persistableState.save(preferenceStore, preferenceKey);
}
}
@@ -146,12 +140,10 @@ public final class CommandStateProxy extends PersistentState {
}
@Override
- public void load(final IPreferenceStore store,
- final String preferenceKey) {
+ public void load(final IPreferenceStore store, final String preferenceKey) {
if (loadState() && state instanceof PersistentState) {
final PersistentState persistableState = (PersistentState) state;
- if (persistableState.shouldPersist() && preferenceStore != null
- && preferenceKey != null) {
+ if (persistableState.shouldPersist() && preferenceStore != null && preferenceKey != null) {
persistableState.load(preferenceStore, preferenceKey);
}
}
@@ -162,8 +154,8 @@ public final class CommandStateProxy extends PersistentState {
* variables are updated accordingly and the state is told to load its value
* from the preference store.
*
- * @return <code>true</code> if the state is now non-null;
- * <code>false</code> otherwise.
+ * @return <code>true</code> if the state is now non-null; <code>false</code>
+ * otherwise.
*/
private boolean loadState() {
return loadState(false);
@@ -174,16 +166,15 @@ public final class CommandStateProxy extends PersistentState {
* variables are updated accordingly and the state is told to load its value
* from the preference store.
*
- * @param readPersistence
- * Whether the persistent state for this object should be read.
- * @return <code>true</code> if the state is now non-null;
- * <code>false</code> otherwise.
+ * @param readPersistence Whether the persistent state for this object should be
+ * read.
+ * @return <code>true</code> if the state is now non-null; <code>false</code>
+ * otherwise.
*/
private boolean loadState(final boolean readPersistence) {
if (state == null) {
try {
- state = (State) configurationElement
- .createExecutableExtension(stateAttributeName);
+ state = (State) configurationElement.createExecutableExtension(stateAttributeName);
state.setId(getId());
configurationElement = null;
@@ -205,16 +196,14 @@ public final class CommandStateProxy extends PersistentState {
} catch (final ClassCastException e) {
final String message = "The proxied state was the wrong class"; //$NON-NLS-1$
- final IStatus status = new Status(IStatus.ERROR,
- WorkbenchPlugin.PI_WORKBENCH, 0, message, e);
+ final IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 0, message, e);
WorkbenchPlugin.log(message, status);
return false;
} catch (final CoreException e) {
final String message = "The proxied state for '" + configurationElement.getAttribute(stateAttributeName) //$NON-NLS-1$
+ "' could not be loaded"; //$NON-NLS-1$
- IStatus status = new Status(IStatus.ERROR,
- WorkbenchPlugin.PI_WORKBENCH, 0, message, e);
+ IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 0, message, e);
WorkbenchPlugin.log(message, status);
return false;
}
@@ -233,8 +222,7 @@ public final class CommandStateProxy extends PersistentState {
}
@Override
- public void save(final IPreferenceStore store,
- final String preferenceKey) {
+ public void save(final IPreferenceStore store, final String preferenceKey) {
if (loadState() && state instanceof PersistentState) {
((PersistentState) state).save(store, preferenceKey);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/ElementReference.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/ElementReference.java
index ed37b694ccc..af1232f7b19 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/ElementReference.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/ElementReference.java
@@ -35,12 +35,9 @@ public class ElementReference implements IElementReference {
/**
* Construct the reference.
*
- * @param id
- * command id. Must not be <code>null</code>.
- * @param adapt
- * the element. Must not be <code>null</code>.
- * @param parms.
- * parameters used for filtering. Must not be <code>null</code>.
+ * @param id command id. Must not be <code>null</code>.
+ * @param adapt the element. Must not be <code>null</code>.
+ * @param parms. parameters used for filtering. Must not be <code>null</code>.
*/
public ElementReference(String id, UIElement adapt, Map parms) {
commandId = id;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/ICommandImageManagerListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/ICommandImageManagerListener.java
index 69804458787..d8cf5ecce56 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/ICommandImageManagerListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/ICommandImageManagerListener.java
@@ -22,9 +22,9 @@ package org.eclipse.ui.internal.commands;
* Clients may instantiate, but must not extend.
* </p>
* <p>
- * <strong>PROVISIONAL</strong>. This class or interface has been added as
- * part of a work in progress. There is a guarantee neither that this API will
- * work nor that it will remain the same. Please do not use this API without
+ * <strong>PROVISIONAL</strong>. This class or interface has been added as part
+ * of a work in progress. There is a guarantee neither that this API will work
+ * nor that it will remain the same. Please do not use this API without
* consulting with the Platform/UI team.
* </p>
* <p>
@@ -38,11 +38,10 @@ public interface ICommandImageManagerListener {
/**
* Notifies that one or more properties of an instance of
- * <code>CommandImageManager</code> have changed. Specific details are
- * described in the <code>CommandImageManagerEvent</code>.
+ * <code>CommandImageManager</code> have changed. Specific details are described
+ * in the <code>CommandImageManagerEvent</code>.
*
- * @param event
- * The event; never <code>null</code>.
+ * @param event The event; never <code>null</code>.
*/
void commandImageManagerChanged(CommandImageManagerEvent event);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/ILegacyAttributeNames.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/ILegacyAttributeNames.java
index 5521aa116fd..9de073dd558 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/ILegacyAttributeNames.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/ILegacyAttributeNames.java
@@ -29,8 +29,8 @@ public interface ILegacyAttributeNames {
String ENABLED = IAction.ENABLED;
/**
- * Whether the handler is capable of handling delegation of responsibilities
- * at this time.
+ * Whether the handler is capable of handling delegation of responsibilities at
+ * this time.
*/
String HANDLED = IAction.HANDLED;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/LegacyCommandListenerWrapper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/LegacyCommandListenerWrapper.java
index 2c1b6cf8953..c16951d507a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/LegacyCommandListenerWrapper.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/LegacyCommandListenerWrapper.java
@@ -38,22 +38,19 @@ final class LegacyCommandListenerWrapper implements ICommandListener {
private final org.eclipse.ui.commands.ICommandListener listener;
/**
- * Constructs a new instance of <code>CommandListenerWrapper</code> around
- * a legacy listener.
+ * Constructs a new instance of <code>CommandListenerWrapper</code> around a
+ * legacy listener.
*
- * @param listener
- * The listener to be wrapped; must not be <code>null</code>.
+ * @param listener The listener to be wrapped; must not be <code>null</code>.
*/
- LegacyCommandListenerWrapper(
- final org.eclipse.ui.commands.ICommandListener listener,
+ LegacyCommandListenerWrapper(final org.eclipse.ui.commands.ICommandListener listener,
final BindingManager bindingManager) {
if (listener == null) {
throw new NullPointerException("Cannot wrap a null listener."); //$NON-NLS-1$
}
if (bindingManager == null) {
- throw new NullPointerException(
- "Cannot create a listener wrapper without a binding manager"); //$NON-NLS-1$
+ throw new NullPointerException("Cannot create a listener wrapper without a binding manager"); //$NON-NLS-1$
}
this.listener = listener;
@@ -62,16 +59,14 @@ final class LegacyCommandListenerWrapper implements ICommandListener {
@Override
public void commandChanged(final CommandEvent commandEvent) {
- final ICommand command = new CommandLegacyWrapper(commandEvent.getCommand(),
- bindingManager);
+ final ICommand command = new CommandLegacyWrapper(commandEvent.getCommand(), bindingManager);
final boolean definedChanged = commandEvent.isDefinedChanged();
final boolean descriptionChanged = commandEvent.isDescriptionChanged();
final boolean handledChanged = commandEvent.isHandledChanged();
final boolean nameChanged = commandEvent.isNameChanged();
- listener.commandChanged(new org.eclipse.ui.commands.CommandEvent(
- command, false, false, definedChanged, descriptionChanged,
- handledChanged, false, nameChanged, null));
+ listener.commandChanged(new org.eclipse.ui.commands.CommandEvent(command, false, false, definedChanged,
+ descriptionChanged, handledChanged, false, nameChanged, null));
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/ParameterValueConverterProxy.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/ParameterValueConverterProxy.java
index 85f199ce90d..6f15059164b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/ParameterValueConverterProxy.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/ParameterValueConverterProxy.java
@@ -26,49 +26,43 @@ import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants;
*
* @since 3.2
*/
-public final class ParameterValueConverterProxy extends
- AbstractParameterValueConverter {
+public final class ParameterValueConverterProxy extends AbstractParameterValueConverter {
/**
- * The configuration element providing the executable extension that will
- * extend <code>AbstractParameterValueConverter</code>. This value will
- * not be <code>null</code>.
+ * The configuration element providing the executable extension that will extend
+ * <code>AbstractParameterValueConverter</code>. This value will not be
+ * <code>null</code>.
*/
private final IConfigurationElement converterConfigurationElement;
/**
- * The real parameter value converter instance. This will be
- * <code>null</code> until one of the conversion methods are used.
+ * The real parameter value converter instance. This will be <code>null</code>
+ * until one of the conversion methods are used.
*/
private AbstractParameterValueConverter parameterValueConverter;
/**
- * Constructs a <code>ParameterValueConverterProxy</code> to represent the
- * real converter until it is needed.
+ * Constructs a <code>ParameterValueConverterProxy</code> to represent the real
+ * converter until it is needed.
*
- * @param converterConfigurationElement
- * The configuration element from which the real converter can be
- * loaded.
+ * @param converterConfigurationElement The configuration element from which the
+ * real converter can be loaded.
*/
- public ParameterValueConverterProxy(
- final IConfigurationElement converterConfigurationElement) {
+ public ParameterValueConverterProxy(final IConfigurationElement converterConfigurationElement) {
if (converterConfigurationElement == null) {
- throw new NullPointerException(
- "converterConfigurationElement must not be null"); //$NON-NLS-1$
+ throw new NullPointerException("converterConfigurationElement must not be null"); //$NON-NLS-1$
}
this.converterConfigurationElement = converterConfigurationElement;
}
@Override
- public Object convertToObject(final String parameterValue)
- throws ParameterValueConversionException {
+ public Object convertToObject(final String parameterValue) throws ParameterValueConversionException {
return getConverter().convertToObject(parameterValue);
}
@Override
- public String convertToString(final Object parameterValue)
- throws ParameterValueConversionException {
+ public String convertToString(final Object parameterValue) throws ParameterValueConversionException {
return getConverter().convertToString(parameterValue);
}
@@ -77,18 +71,16 @@ public final class ParameterValueConverterProxy extends
* exception indicating the converter could not be obtained.
*
* @return the real converter for this proxy; never <code>null</code>.
- * @throws ParameterValueConversionException
- * if the converter could not be obtained
+ * @throws ParameterValueConversionException if the converter could not be
+ * obtained
*/
- private AbstractParameterValueConverter getConverter()
- throws ParameterValueConversionException {
+ private AbstractParameterValueConverter getConverter() throws ParameterValueConversionException {
if (parameterValueConverter == null) {
try {
parameterValueConverter = (AbstractParameterValueConverter) converterConfigurationElement
.createExecutableExtension(IWorkbenchRegistryConstants.ATT_CONVERTER);
} catch (final CoreException e) {
- throw new ParameterValueConversionException(
- "Problem creating parameter value converter", e); //$NON-NLS-1$
+ throw new ParameterValueConversionException("Problem creating parameter value converter", e); //$NON-NLS-1$
} catch (final ClassCastException e) {
throw new ParameterValueConversionException(
"Parameter value converter was not a subclass of AbstractParameterValueConverter", e); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/SlaveCommandService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/SlaveCommandService.java
index c4c6ff21093..f7edd58f13b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/SlaveCommandService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/SlaveCommandService.java
@@ -63,8 +63,8 @@ public class SlaveCommandService implements ICommandService, IUpdateService {
private ICommandService fParentService;
/**
- * The scoping constant added to callback registrations submitted through
- * this service.
+ * The scoping constant added to callback registrations submitted through this
+ * service.
*
* @since 3.3
*/
@@ -83,19 +83,16 @@ public class SlaveCommandService implements ICommandService, IUpdateService {
/**
* Build the slave service.
*
- * @param parent
- * the parent service. This must not be <code>null</code>.
+ * @param parent the parent service. This must not be <code>null</code>.
*/
public SlaveCommandService(ICommandService parent, String scopeName, IServiceLocator scopeValue) {
this(parent, scopeName, scopeValue, null);
}
- public SlaveCommandService(ICommandService parent, String scopeName,
- IServiceLocator scopeValue,
+ public SlaveCommandService(ICommandService parent, String scopeName, IServiceLocator scopeValue,
IEclipseContext context) {
if (parent == null) {
- throw new NullPointerException(
- "The parent command service must not be null"); //$NON-NLS-1$
+ throw new NullPointerException("The parent command service must not be null"); //$NON-NLS-1$
}
fParentService = parent;
fScopingName = scopeName;
@@ -117,9 +114,8 @@ public class SlaveCommandService implements ICommandService, IUpdateService {
}
@Override
- public ParameterizedCommand deserialize(
- String serializedParameterizedCommand) throws NotDefinedException,
- SerializationException {
+ public ParameterizedCommand deserialize(String serializedParameterizedCommand)
+ throws NotDefinedException, SerializationException {
return fParentService.deserialize(serializedParameterizedCommand);
}
@@ -184,14 +180,12 @@ public class SlaveCommandService implements ICommandService, IUpdateService {
}
@Override
- public final String getHelpContextId(final Command command)
- throws NotDefinedException {
+ public final String getHelpContextId(final Command command) throws NotDefinedException {
return fParentService.getHelpContextId(command);
}
@Override
- public final String getHelpContextId(final String commandId)
- throws NotDefinedException {
+ public final String getHelpContextId(final String commandId) throws NotDefinedException {
return fParentService.getHelpContextId(commandId);
}
@@ -212,8 +206,7 @@ public class SlaveCommandService implements ICommandService, IUpdateService {
}
@Override
- public final void setHelpContextId(final IHandler handler,
- final String helpContextId) {
+ public final void setHelpContextId(final IHandler handler, final String helpContextId) {
fParentService.setHelpContextId(handler, helpContextId);
}
@@ -223,21 +216,18 @@ public class SlaveCommandService implements ICommandService, IUpdateService {
}
@Override
- public IElementReference registerElementForCommand(
- ParameterizedCommand command, UIElement element)
+ public IElementReference registerElementForCommand(ParameterizedCommand command, UIElement element)
throws NotDefinedException {
if (!command.getCommand().isDefined()) {
- throw new NotDefinedException(
- "Cannot define a callback for undefined command " //$NON-NLS-1$
- + command.getCommand().getId());
+ throw new NotDefinedException("Cannot define a callback for undefined command " //$NON-NLS-1$
+ + command.getCommand().getId());
}
if (element == null) {
throw new NotDefinedException("No callback defined for command " //$NON-NLS-1$
+ command.getCommand().getId());
}
- ElementReference ref = new ElementReference(command.getId(), element,
- command.getParameterMap());
+ ElementReference ref = new ElementReference(command.getId(), element, command.getParameterMap());
registerElement(ref);
return ref;
}
@@ -256,8 +246,7 @@ public class SlaveCommandService implements ICommandService, IUpdateService {
}
@Override
- public Runnable registerElementForUpdate(ParameterizedCommand parameterizedCommand,
- final MItem item) {
+ public Runnable registerElementForUpdate(ParameterizedCommand parameterizedCommand, final MItem item) {
UIElement element = new UIElement(fScopingValue) {
@Override
@@ -293,8 +282,7 @@ public class SlaveCommandService implements ICommandService, IUpdateService {
};
try {
- final IElementReference reference = registerElementForCommand(parameterizedCommand,
- element);
+ final IElementReference reference = registerElementForCommand(parameterizedCommand, element);
return () -> unregisterElement(reference);
} catch (NotDefinedException e) {
WorkbenchPlugin.log(e);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/WorkbenchCommandSupport.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/WorkbenchCommandSupport.java
index 334140d6239..15b6abc5d0f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/WorkbenchCommandSupport.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/WorkbenchCommandSupport.java
@@ -36,68 +36,59 @@ import org.eclipse.ui.internal.handlers.LegacyHandlerWrapper;
public class WorkbenchCommandSupport implements IWorkbenchCommandSupport {
/**
- * The map of activations that have been given to the handler service (<code>IHandlerActivation</code>),
- * indexed by the submissions (<code>HandlerSubmission</code>). This map
- * should be <code>null</code> if there are no such activations.
+ * The map of activations that have been given to the handler service
+ * (<code>IHandlerActivation</code>), indexed by the submissions
+ * (<code>HandlerSubmission</code>). This map should be <code>null</code> if
+ * there are no such activations.
*/
private Map activationsBySubmission = null;
/**
- * The mutable command manager that should be notified of changes to the
- * list of active handlers. This value is never <code>null</code>.
+ * The mutable command manager that should be notified of changes to the list of
+ * active handlers. This value is never <code>null</code>.
*/
private final CommandManagerLegacyWrapper commandManagerWrapper;
/**
- * The handler service for the workbench. This value is never
- * <code>null</code>.
+ * The handler service for the workbench. This value is never <code>null</code>.
*/
private final IHandlerService handlerService;
/**
* Constructs a new instance of <code>WorkbenchCommandSupport</code>
*
- * @param bindingManager
- * The binding manager providing support for the command manager;
- * must not be <code>null</code>.
- * @param commandManager
- * The command manager for the workbench; must not be
- * <code>null</code>.
- * @param contextManager
- * The context manager providing support for the command manager
- * and binding manager; must not be <code>null</code>.
- * @param handlerService
- * The handler service for the workbench; must not be
- * <code>null</code>.
+ * @param bindingManager The binding manager providing support for the command
+ * manager; must not be <code>null</code>.
+ * @param commandManager The command manager for the workbench; must not be
+ * <code>null</code>.
+ * @param contextManager The context manager providing support for the command
+ * manager and binding manager; must not be
+ * <code>null</code>.
+ * @param handlerService The handler service for the workbench; must not be
+ * <code>null</code>.
*/
- public WorkbenchCommandSupport(final BindingManager bindingManager,
- final CommandManager commandManager,
- final ContextManager contextManager,
- final IHandlerService handlerService) {
+ public WorkbenchCommandSupport(final BindingManager bindingManager, final CommandManager commandManager,
+ final ContextManager contextManager, final IHandlerService handlerService) {
if (handlerService == null) {
throw new NullPointerException("The handler service cannot be null"); //$NON-NLS-1$
}
this.handlerService = handlerService;
- commandManagerWrapper = CommandManagerFactory.getCommandManagerWrapper(
- bindingManager, commandManager, contextManager);
+ commandManagerWrapper = CommandManagerFactory.getCommandManagerWrapper(bindingManager, commandManager,
+ contextManager);
// Initialize the old key formatter settings.
org.eclipse.ui.keys.KeyFormatterFactory
- .setDefault(org.eclipse.ui.keys.SWTKeySupport
- .getKeyFormatterForPlatform());
+ .setDefault(org.eclipse.ui.keys.SWTKeySupport.getKeyFormatterForPlatform());
}
@Override
- public final void addHandlerSubmission(
- final HandlerSubmission handlerSubmission) {
- final IHandlerActivation activation = handlerService.activateHandler(
- handlerSubmission.getCommandId(), new LegacyHandlerWrapper(
- handlerSubmission.getHandler()),
- new LegacyHandlerSubmissionExpression(handlerSubmission
- .getActivePartId(), handlerSubmission.getActiveShell(),
- handlerSubmission.getActiveWorkbenchPartSite()));
+ public final void addHandlerSubmission(final HandlerSubmission handlerSubmission) {
+ final IHandlerActivation activation = handlerService.activateHandler(handlerSubmission.getCommandId(),
+ new LegacyHandlerWrapper(handlerSubmission.getHandler()),
+ new LegacyHandlerSubmissionExpression(handlerSubmission.getActivePartId(),
+ handlerSubmission.getActiveShell(), handlerSubmission.getActiveWorkbenchPartSite()));
if (activationsBySubmission == null) {
activationsBySubmission = new HashMap();
}
@@ -118,8 +109,7 @@ public class WorkbenchCommandSupport implements IWorkbenchCommandSupport {
}
@Override
- public final void removeHandlerSubmission(
- final HandlerSubmission handlerSubmission) {
+ public final void removeHandlerSubmission(final HandlerSubmission handlerSubmission) {
if (activationsBySubmission == null) {
return;
}
@@ -132,8 +122,7 @@ public class WorkbenchCommandSupport implements IWorkbenchCommandSupport {
}
@Override
- public final void removeHandlerSubmissions(
- final Collection handlerSubmissions) {
+ public final void removeHandlerSubmissions(final Collection handlerSubmissions) {
final Iterator submissionItr = handlerSubmissions.iterator();
while (submissionItr.hasNext()) {
removeHandlerSubmission((HandlerSubmission) submissionItr.next());
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ActiveContextSourceProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ActiveContextSourceProvider.java
index ab345314ecc..fd948acbdd1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ActiveContextSourceProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ActiveContextSourceProvider.java
@@ -35,8 +35,7 @@ import org.eclipse.ui.services.IServiceLocator;
*
* @since 3.2
*/
-public final class ActiveContextSourceProvider extends AbstractSourceProvider
- implements IContextManagerListener {
+public final class ActiveContextSourceProvider extends AbstractSourceProvider implements IContextManagerListener {
/**
* The names of the sources supported by this source provider.
@@ -44,8 +43,8 @@ public final class ActiveContextSourceProvider extends AbstractSourceProvider
private static final String[] PROVIDED_SOURCE_NAMES = new String[] { ISources.ACTIVE_CONTEXT_NAME };
/**
- * The context service with which this source provider should communicate.
- * This value is never <code>null</code>.
+ * The context service with which this source provider should communicate. This
+ * value is never <code>null</code>.
*/
private IContextService contextService;
@@ -71,8 +70,7 @@ public final class ActiveContextSourceProvider extends AbstractSourceProvider
@Override
public Map getCurrentState() {
final Map currentState = new TreeMap();
- final Collection activeContextIds = contextService
- .getActiveContextIds();
+ final Collection activeContextIds = contextService.getActiveContextIds();
currentState.put(ISources.ACTIVE_CONTEXT_NAME, activeContextIds);
return currentState;
}
@@ -84,8 +82,7 @@ public final class ActiveContextSourceProvider extends AbstractSourceProvider
@Override
public void initialize(IServiceLocator locator) {
- contextService = locator
- .getService(IContextService.class);
+ contextService = locator.getService(IContextService.class);
contextService.addContextManagerListener(this);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextActivation.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextActivation.java
index 33d108d9658..9688f0b127b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextActivation.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextActivation.java
@@ -37,48 +37,42 @@ import org.eclipse.ui.internal.services.EvaluationResultCache;
*
* @since 3.1
*/
-final class ContextActivation extends EvaluationResultCache implements
- IContextActivation {
+final class ContextActivation extends EvaluationResultCache implements IContextActivation {
/**
- * The identifier for the context which should be active. This value is
- * never <code>null</code>.
+ * The identifier for the context which should be active. This value is never
+ * <code>null</code>.
*/
private final String contextId;
/**
- * The context service from which this context activation was requested.
- * This value is never <code>null</code>.
+ * The context service from which this context activation was requested. This
+ * value is never <code>null</code>.
*/
private final IContextService contextService;
/**
* Constructs a new instance of <code>ContextActivation</code>.
*
- * @param contextId
- * The identifier for the context which should be activated. This
- * value must not be <code>null</code>.
- * @param expression
- * The expression that must evaluate to <code>true</code>
- * before this handler is active. This value may be
- * <code>null</code> if it is always active.
- * @param contextService
- * The context service from which the handler activation was
- * requested; must not be <code>null</code>.
+ * @param contextId The identifier for the context which should be
+ * activated. This value must not be <code>null</code>.
+ * @param expression The expression that must evaluate to <code>true</code>
+ * before this handler is active. This value may be
+ * <code>null</code> if it is always active.
+ * @param contextService The context service from which the handler activation
+ * was requested; must not be <code>null</code>.
* @see ISources
*/
- public ContextActivation(final String contextId,
- final Expression expression, final IContextService contextService) {
+ public ContextActivation(final String contextId, final Expression expression,
+ final IContextService contextService) {
super(expression);
if (contextId == null) {
- throw new NullPointerException(
- "The context identifier for a context activation cannot be null"); //$NON-NLS-1$
+ throw new NullPointerException("The context identifier for a context activation cannot be null"); //$NON-NLS-1$
}
if (contextService == null) {
- throw new NullPointerException(
- "The context service for an activation cannot be null"); //$NON-NLS-1$
+ throw new NullPointerException("The context service for an activation cannot be null"); //$NON-NLS-1$
}
this.contextId = contextId;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextAuthority.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextAuthority.java
index 944930a55ab..0ff737302f2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextAuthority.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextAuthority.java
@@ -49,22 +49,21 @@ import org.eclipse.ui.internal.services.ExpressionAuthority;
*/
public final class ContextAuthority extends ExpressionAuthority {
-
/**
- * The default size of the set containing the activations to recompute. This
- * is more than enough to cover the average case.
+ * The default size of the set containing the activations to recompute. This is
+ * more than enough to cover the average case.
*/
private static final int ACTIVATIONS_TO_RECOMPUTE_SIZE = 4;
/**
- * Whether the context authority should kick into debugging mode. This
- * causes the unresolvable handler conflicts to be printed to the console.
+ * Whether the context authority should kick into debugging mode. This causes
+ * the unresolvable handler conflicts to be printed to the console.
*/
private static final boolean DEBUG = Policy.DEBUG_CONTEXTS;
/**
- * Whether the performance information should be printed about the
- * performance of the context authority.
+ * Whether the performance information should be printed about the performance
+ * of the context authority.
*/
private static final boolean DEBUG_PERFORMANCE = Policy.DEBUG_CONTEXTS_PERFORMANCE;
@@ -80,66 +79,62 @@ public final class ContextAuthority extends ExpressionAuthority {
/**
* A bucket sort of the context activations based on source priority. Each
- * activation will appear only once per set, but may appear in multiple
- * sets. If no activations are defined for a particular priority level, then
- * the array at that index will only contain <code>null</code>.
+ * activation will appear only once per set, but may appear in multiple sets. If
+ * no activations are defined for a particular priority level, then the array at
+ * that index will only contain <code>null</code>.
*/
private final Set[] activationsBySourcePriority = new Set[33];
/**
* This is a map of context activations (<code>Collection</code> of
- * <code>IContextActivation</code>) sorted by context identifier (<code>String</code>).
- * If there is only one context activation for a context, then the
- * <code>Collection</code> is replaced by a
- * <code>IContextActivation</code>. If there is no activation, the entry
- * should be removed entirely.
+ * <code>IContextActivation</code>) sorted by context identifier
+ * (<code>String</code>). If there is only one context activation for a context,
+ * then the <code>Collection</code> is replaced by a
+ * <code>IContextActivation</code>. If there is no activation, the entry should
+ * be removed entirely.
*/
private final Map contextActivationsByContextId = new HashMap();
/**
- * The context manager that should be updated when the contexts are
- * changing.
+ * The context manager that should be updated when the contexts are changing.
*/
private final ContextManager contextManager;
/**
- * The context service that should be used for authority-managed
- * shell-related contexts. This value is never <code>null</code>.
+ * The context service that should be used for authority-managed shell-related
+ * contexts. This value is never <code>null</code>.
*/
private final IContextService contextService;
/**
- * This is a map of shell to a list of activations. When a shell is
- * registered, it is added to this map with the list of activation that
- * should be submitted when the shell is active. When the shell is
- * deactivated, this same list should be withdrawn. A shell is removed from
- * this map using the {@link #unregisterShell(Shell)}method. This value may
- * be empty, but is never <code>null</code>. The <code>null</code> key
- * is reserved for active shells that have not been registered but have a
- * parent (i.e., default dialog service).
+ * This is a map of shell to a list of activations. When a shell is registered,
+ * it is added to this map with the list of activation that should be submitted
+ * when the shell is active. When the shell is deactivated, this same list
+ * should be withdrawn. A shell is removed from this map using the
+ * {@link #unregisterShell(Shell)}method. This value may be empty, but is never
+ * <code>null</code>. The <code>null</code> key is reserved for active shells
+ * that have not been registered but have a parent (i.e., default dialog
+ * service).
*/
private final Map registeredWindows = new WeakHashMap();
/**
* Constructs a new instance of <code>ContextAuthority</code>.
*
- * @param contextManager
- * The context manager from which contexts can be retrieved (to
- * update their active state); must not be <code>null</code>.
- * @param contextService
- * The workbench context service for which this authority is
- * acting. This allows the authority to manage shell-specific
- * contexts. This value must not be <code>null</code>.
+ * @param contextManager The context manager from which contexts can be
+ * retrieved (to update their active state); must not be
+ * <code>null</code>.
+ * @param contextService The workbench context service for which this authority
+ * is acting. This allows the authority to manage
+ * shell-specific contexts. This value must not be
+ * <code>null</code>.
*/
- ContextAuthority(final ContextManager contextManager,
- final IContextService contextService) {
+ ContextAuthority(final ContextManager contextManager, final IContextService contextService) {
if (contextManager == null) {
- throw new NullPointerException(
- "The context authority needs a context manager"); //$NON-NLS-1$
+ throw new NullPointerException("The context authority needs a context manager"); //$NON-NLS-1$
}
if (contextService == null) {
- throw new NullPointerException(
- "The context authority needs an evaluation context"); //$NON-NLS-1$
+ throw new NullPointerException("The context authority needs an evaluation context"); //$NON-NLS-1$
}
this.contextManager = contextManager;
@@ -149,8 +144,7 @@ public final class ContextAuthority extends ExpressionAuthority {
/**
* Activates a context on the workbench. This will add it to a master list.
*
- * @param activation
- * The activation; must not be <code>null</code>.
+ * @param activation The activation; must not be <code>null</code>.
*/
void activateContext(final IContextActivation activation) {
// First we update the contextActivationsByContextId map.
@@ -167,8 +161,7 @@ public final class ContextAuthority extends ExpressionAuthority {
final Collection contextActivations = new ArrayList(2);
contextActivations.add(value);
contextActivations.add(activation);
- contextActivationsByContextId
- .put(contextId, contextActivations);
+ contextActivationsByContextId.put(contextId, contextActivations);
updateContext(contextId, containsActive(contextActivations));
}
} else {
@@ -193,71 +186,60 @@ public final class ContextAuthority extends ExpressionAuthority {
/**
* Checks whether the new active shell is registered. If it is already
* registered, then it does no work. If it is not registered, then it checks
- * what type of contexts the shell should have by default. This is
- * determined by parenting. A shell with no parent receives no contexts. A
- * shell with a parent, receives the dialog contexts.
+ * what type of contexts the shell should have by default. This is determined by
+ * parenting. A shell with no parent receives no contexts. A shell with a
+ * parent, receives the dialog contexts.
*
- * @param newShell
- * The newly active shell; may be <code>null</code> or
- * disposed.
- * @param oldShell
- * The previously active shell; may be <code>null</code> or
- * disposed.
+ * @param newShell The newly active shell; may be <code>null</code> or disposed.
+ * @param oldShell The previously active shell; may be <code>null</code> or
+ * disposed.
*/
- private void checkWindowType(final Shell newShell,
- final Shell oldShell) {
+ private void checkWindowType(final Shell newShell, final Shell oldShell) {
/*
- * If the previous active shell was recognized as a dialog by default,
- * then remove its submissions.
+ * If the previous active shell was recognized as a dialog by default, then
+ * remove its submissions.
*/
- Collection oldActivations = (Collection) registeredWindows
- .get(oldShell);
+ Collection oldActivations = (Collection) registeredWindows.get(oldShell);
if (oldActivations == null) {
/*
- * The old shell wasn't registered. So, we need to check if it was
- * considered a dialog by default.
+ * The old shell wasn't registered. So, we need to check if it was considered a
+ * dialog by default.
*/
oldActivations = (Collection) registeredWindows.get(null);
if (oldActivations != null) {
final Iterator oldActivationItr = oldActivations.iterator();
while (oldActivationItr.hasNext()) {
- final IContextActivation activation = (IContextActivation) oldActivationItr
- .next();
+ final IContextActivation activation = (IContextActivation) oldActivationItr.next();
deactivateContext(activation);
}
}
}
/*
- * If the new active shell is recognized as a dialog by default, then
- * create some submissions, remember them, and submit them for
- * processing.
+ * If the new active shell is recognized as a dialog by default, then create
+ * some submissions, remember them, and submit them for processing.
*/
if ((newShell != null) && (!newShell.isDisposed())) {
final Collection newActivations;
- if ((newShell.getParent() != null)
- && (registeredWindows.get(newShell) == null)) {
+ if ((newShell.getParent() != null) && (registeredWindows.get(newShell) == null)) {
// This is a dialog by default.
newActivations = new ArrayList();
- final Expression expression = new ActiveShellExpression(
- newShell);
+ final Expression expression = new ActiveShellExpression(newShell);
final IContextActivation dialogWindowActivation = new ContextActivation(
- IContextService.CONTEXT_ID_DIALOG_AND_WINDOW,
- expression, contextService);
+ IContextService.CONTEXT_ID_DIALOG_AND_WINDOW, expression, contextService);
activateContext(dialogWindowActivation);
newActivations.add(dialogWindowActivation);
- final IContextActivation dialogActivation = new ContextActivation(
- IContextService.CONTEXT_ID_DIALOG, expression,
- contextService);
+ final IContextActivation dialogActivation = new ContextActivation(IContextService.CONTEXT_ID_DIALOG,
+ expression, contextService);
activateContext(dialogActivation);
newActivations.add(dialogActivation);
registeredWindows.put(null, newActivations);
/*
- * Make sure the submissions will be removed in event of
- * disposal. This is really just a paranoid check. The
- * "oldSubmissions" code above should take care of this.
+ * Make sure the submissions will be removed in event of disposal. This is
+ * really just a paranoid check. The "oldSubmissions" code above should take
+ * care of this.
*/
newShell.addDisposeListener(new DisposeListener() {
@@ -269,18 +251,14 @@ public final class ContextAuthority extends ExpressionAuthority {
}
/*
- * In the case where a dispose has happened, we are
- * expecting an activation event to arrive at some point
- * in the future. If we process the submissions now,
- * then we will update the activeShell before
- * checkWindowType is called. This means that dialogs
- * won't be recognized as dialogs.
+ * In the case where a dispose has happened, we are expecting an activation
+ * event to arrive at some point in the future. If we process the submissions
+ * now, then we will update the activeShell before checkWindowType is called.
+ * This means that dialogs won't be recognized as dialogs.
*/
- final Iterator newActivationItr = newActivations
- .iterator();
+ final Iterator newActivationItr = newActivations.iterator();
while (newActivationItr.hasNext()) {
- deactivateContext((IContextActivation) newActivationItr
- .next());
+ deactivateContext((IContextActivation) newActivationItr.next());
}
}
});
@@ -294,20 +272,18 @@ public final class ContextAuthority extends ExpressionAuthority {
}
/**
- * Returns a subset of the given <code>activations</code> containing only
- * those that are active
+ * Returns a subset of the given <code>activations</code> containing only those
+ * that are active
*
- * @param activations
- * The activations to trim; must not be <code>null</code>, but
- * may be empty.
+ * @param activations The activations to trim; must not be <code>null</code>,
+ * but may be empty.
* @return <code>true</code> if there is at least one active context;
* <code>false</code> otherwise.
*/
private boolean containsActive(final Collection activations) {
final Iterator activationItr = activations.iterator();
while (activationItr.hasNext()) {
- final IContextActivation activation = (IContextActivation) activationItr
- .next();
+ final IContextActivation activation = (IContextActivation) activationItr.next();
if (evaluate(activation)) {
return true;
}
@@ -320,8 +296,7 @@ public final class ContextAuthority extends ExpressionAuthority {
* Removes an activation for a context on the workbench. This will remove it
* from the master list, and update the appropriate context, if necessary.
*
- * @param activation
- * The activation; must not be <code>null</code>.
+ * @param activation The activation; must not be <code>null</code>.
*/
void deactivateContext(final IContextActivation activation) {
// First we update the handlerActivationsByCommandId map.
@@ -336,10 +311,9 @@ public final class ContextAuthority extends ExpressionAuthority {
updateContext(contextId, false);
} else if (contextActivations.size() == 1) {
- final IContextActivation remainingActivation = (IContextActivation) contextActivations
- .iterator().next();
- contextActivationsByContextId.put(contextId,
- remainingActivation);
+ final IContextActivation remainingActivation = (IContextActivation) contextActivations.iterator()
+ .next();
+ contextActivationsByContextId.put(contextId, remainingActivation);
updateContext(contextId, evaluate(remainingActivation));
} else {
@@ -381,10 +355,9 @@ public final class ContextAuthority extends ExpressionAuthority {
/**
* Returns the shell type for the given shell.
*
- * @param shell
- * The shell for which the type should be determined. If this
- * value is <code>null</code>, then
- * <code>IWorkbenchContextSupport.TYPE_NONE</code> is returned.
+ * @param shell The shell for which the type should be determined. If this value
+ * is <code>null</code>, then
+ * <code>IWorkbenchContextSupport.TYPE_NONE</code> is returned.
* @return <code>IWorkbenchContextSupport.TYPE_WINDOW</code>,
* <code>IWorkbenchContextSupport.TYPE_DIALOG</code>, or
* <code>IWorkbenchContextSupport.TYPE_NONE</code>.
@@ -395,8 +368,7 @@ public final class ContextAuthority extends ExpressionAuthority {
return IContextService.TYPE_NONE;
}
- final Collection activations = (Collection) registeredWindows
- .get(shell);
+ final Collection activations = (Collection) registeredWindows.get(shell);
if (activations != null) {
// The shell is registered, so check what type it was registered as.
if (activations.isEmpty()) {
@@ -407,8 +379,7 @@ public final class ContextAuthority extends ExpressionAuthority {
// Look for the right type of context id.
final Iterator activationItr = activations.iterator();
while (activationItr.hasNext()) {
- final IContextActivation activation = (IContextActivation) activationItr
- .next();
+ final IContextActivation activation = (IContextActivation) activationItr.next();
final String contextId = activation.getContextId();
if (contextId == IContextService.CONTEXT_ID_DIALOG) {
return IContextService.TYPE_DIALOG;
@@ -418,23 +389,20 @@ public final class ContextAuthority extends ExpressionAuthority {
}
// This shouldn't be possible.
- Assert
- .isTrue(
- false,
- "A registered shell should have at least one submission matching TYPE_WINDOW or TYPE_DIALOG"); //$NON-NLS-1$
+ Assert.isTrue(false,
+ "A registered shell should have at least one submission matching TYPE_WINDOW or TYPE_DIALOG"); //$NON-NLS-1$
return IContextService.TYPE_NONE; // not reachable
} else if (shell.getParent() != null) {
/*
- * The shell is not registered, but it has a parent. It is therefore
- * considered a dialog by default.
+ * The shell is not registered, but it has a parent. It is therefore considered
+ * a dialog by default.
*/
return IContextService.TYPE_DIALOG;
} else {
/*
- * The shell is not registered, but has no parent. It gets no key
- * bindings.
+ * The shell is not registered, but has no parent. It gets no key bindings.
*/
return IContextService.TYPE_NONE;
}
@@ -444,33 +412,29 @@ public final class ContextAuthority extends ExpressionAuthority {
* <p>
* Registers a shell to automatically promote or demote some basic types of
* contexts. The "In Dialogs" and "In Windows" contexts are provided by the
- * system. This a convenience method to ensure that these contexts are
- * promoted when the given is shell is active.
+ * system. This a convenience method to ensure that these contexts are promoted
+ * when the given is shell is active.
* </p>
* <p>
* If a shell is registered as a window, then the "In Windows" context is
- * enabled when that shell is active. If a shell is registered as a dialog --
- * or is not registered, but has a parent shell -- then the "In Dialogs"
- * context is enabled when that shell is active. If the shell is registered
- * as none -- or is not registered, but has no parent shell -- then the
- * neither of the contexts will be enabled (by us -- someone else can always
- * enabled them).
+ * enabled when that shell is active. If a shell is registered as a dialog -- or
+ * is not registered, but has a parent shell -- then the "In Dialogs" context is
+ * enabled when that shell is active. If the shell is registered as none -- or
+ * is not registered, but has no parent shell -- then the neither of the
+ * contexts will be enabled (by us -- someone else can always enabled them).
* </p>
* <p>
* If the provided shell has already been registered, then this method will
* change the registration.
* </p>
*
- * @param shell
- * The shell to register for key bindings; must not be
- * <code>null</code>.
- * @param type
- * The type of shell being registered. This value must be one of
- * the constants given in this interface.
+ * @param shell The shell to register for key bindings; must not be
+ * <code>null</code>.
+ * @param type The type of shell being registered. This value must be one of
+ * the constants given in this interface.
*
- * @return <code>true</code> if the shell had already been registered
- * (i.e., the registration has changed); <code>false</code>
- * otherwise.
+ * @return <code>true</code> if the shell had already been registered (i.e., the
+ * registration has changed); <code>false</code> otherwise.
*/
public boolean registerShell(final Shell shell, final int type) {
// We do not allow null shell registration. It is reserved.
@@ -507,14 +471,12 @@ public final class ContextAuthority extends ExpressionAuthority {
switch (type) {
case IContextService.TYPE_DIALOG:
expression = new ActiveShellExpression(shell);
- dialogWindowActivation = new ContextActivation(
- IContextService.CONTEXT_ID_DIALOG_AND_WINDOW, expression,
+ dialogWindowActivation = new ContextActivation(IContextService.CONTEXT_ID_DIALOG_AND_WINDOW, expression,
contextService);
activateContext(dialogWindowActivation);
activations.add(dialogWindowActivation);
- final IContextActivation dialogActivation = new ContextActivation(
- IContextService.CONTEXT_ID_DIALOG, expression,
- contextService);
+ final IContextActivation dialogActivation = new ContextActivation(IContextService.CONTEXT_ID_DIALOG,
+ expression, contextService);
activateContext(dialogActivation);
activations.add(dialogActivation);
break;
@@ -522,14 +484,12 @@ public final class ContextAuthority extends ExpressionAuthority {
break;
case IContextService.TYPE_WINDOW:
expression = new ActiveShellExpression(shell);
- dialogWindowActivation = new ContextActivation(
- IContextService.CONTEXT_ID_DIALOG_AND_WINDOW, expression,
+ dialogWindowActivation = new ContextActivation(IContextService.CONTEXT_ID_DIALOG_AND_WINDOW, expression,
contextService);
activateContext(dialogWindowActivation);
activations.add(dialogWindowActivation);
- final IContextActivation windowActivation = new ContextActivation(
- IContextService.CONTEXT_ID_WINDOW, expression,
- contextService);
+ final IContextActivation windowActivation = new ContextActivation(IContextService.CONTEXT_ID_WINDOW,
+ expression, contextService);
activateContext(windowActivation);
activations.add(windowActivation);
break;
@@ -540,15 +500,12 @@ public final class ContextAuthority extends ExpressionAuthority {
// Check to see if the activations are already present.
boolean returnValue = false;
- final Collection previousActivations = (Collection) registeredWindows
- .get(shell);
+ final Collection previousActivations = (Collection) registeredWindows.get(shell);
if (previousActivations != null) {
returnValue = true;
- final Iterator previousActivationItr = previousActivations
- .iterator();
+ final Iterator previousActivationItr = previousActivations.iterator();
while (previousActivationItr.hasNext()) {
- final IContextActivation activation = (IContextActivation) previousActivationItr
- .next();
+ final IContextActivation activation = (IContextActivation) previousActivationItr.next();
deactivateContext(activation);
}
}
@@ -557,8 +514,8 @@ public final class ContextAuthority extends ExpressionAuthority {
registeredWindows.put(shell, activations);
/*
- * Remember the dispose listener so that we can remove it later if we
- * unregister the shell.
+ * Remember the dispose listener so that we can remove it later if we unregister
+ * the shell.
*/
final DisposeListener shellDisposeListener = new DisposeListener() {
@@ -570,11 +527,10 @@ public final class ContextAuthority extends ExpressionAuthority {
}
/*
- * In the case where a dispose has happened, we are expecting an
- * activation event to arrive at some point in the future. If we
- * process the submissions now, then we will update the
- * activeShell before checkWindowType is called. This means that
- * dialogs won't be recognized as dialogs.
+ * In the case where a dispose has happened, we are expecting an activation
+ * event to arrive at some point in the future. If we process the submissions
+ * now, then we will update the activeShell before checkWindowType is called.
+ * This means that dialogs won't be recognized as dialogs.
*/
final Iterator activationItr = activations.iterator();
while (activationItr.hasNext()) {
@@ -595,8 +551,8 @@ public final class ContextAuthority extends ExpressionAuthority {
* time this method is called, <code>context</code> is up-to-date with the
* current state of the application.
*
- * @param sourcePriority
- * A bit mask of all the source priorities that have changed.
+ * @param sourcePriority A bit mask of all the source priorities that have
+ * changed.
*/
@Override
protected void sourceChanged(final int sourcePriority) {
@@ -607,13 +563,12 @@ public final class ContextAuthority extends ExpressionAuthority {
}
/*
- * In this first phase, we cycle through all of the activations that
- * could have potentially changed. Each such activation is added to a
- * set for future processing. We add it to a set so that we avoid
- * handling any individual activation more than once.
+ * In this first phase, we cycle through all of the activations that could have
+ * potentially changed. Each such activation is added to a set for future
+ * processing. We add it to a set so that we avoid handling any individual
+ * activation more than once.
*/
- final Set activationsToRecompute = new HashSet(
- ACTIVATIONS_TO_RECOMPUTE_SIZE);
+ final Set activationsToRecompute = new HashSet(ACTIVATIONS_TO_RECOMPUTE_SIZE);
for (int i = 1; i <= 32; i++) {
if ((sourcePriority & (1 << i)) != 0) {
final Collection activations = activationsBySourcePriority[i];
@@ -627,16 +582,14 @@ public final class ContextAuthority extends ExpressionAuthority {
}
/*
- * For every activation, we recompute its active state, and check
- * whether it has changed. If it has changed, then we take note of the
- * context identifier so we can update the context later.
+ * For every activation, we recompute its active state, and check whether it has
+ * changed. If it has changed, then we take note of the context identifier so we
+ * can update the context later.
*/
- final Collection changedContextIds = new ArrayList(
- activationsToRecompute.size());
+ final Collection changedContextIds = new ArrayList(activationsToRecompute.size());
final Iterator activationItr = activationsToRecompute.iterator();
while (activationItr.hasNext()) {
- final IContextActivation activation = (IContextActivation) activationItr
- .next();
+ final IContextActivation activation = (IContextActivation) activationItr.next();
final boolean currentActive = evaluate(activation);
activation.clearResult();
final boolean newActive = evaluate(activation);
@@ -648,14 +601,13 @@ public final class ContextAuthority extends ExpressionAuthority {
try {
contextManager.deferUpdates(true);
/*
- * For every context identifier with a changed activation, we
- * resolve conflicts and trigger an update.
+ * For every context identifier with a changed activation, we resolve conflicts
+ * and trigger an update.
*/
final Iterator changedContextIdItr = changedContextIds.iterator();
while (changedContextIdItr.hasNext()) {
final String contextId = (String) changedContextIdItr.next();
- final Object value = contextActivationsByContextId
- .get(contextId);
+ final Object value = contextActivationsByContextId.get(contextId);
if (value instanceof IContextActivation) {
final IContextActivation activation = (IContextActivation) value;
updateContext(contextId, evaluate(activation));
@@ -674,8 +626,7 @@ public final class ContextAuthority extends ExpressionAuthority {
final long elapsedTime = System.currentTimeMillis() - startTime;
final int size = activationsToRecompute.size();
if (size > 0) {
- Tracing.printTrace(TRACING_COMPONENT, size
- + " activations recomputed in " + elapsedTime + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
+ Tracing.printTrace(TRACING_COMPONENT, size + " activations recomputed in " + elapsedTime + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
}
@@ -683,18 +634,17 @@ public final class ContextAuthority extends ExpressionAuthority {
/**
* <p>
* Unregisters a shell that was previously registered. After this method
- * completes, the shell will be treated as if it had never been registered
- * at all. If you have registered a shell, you should ensure that this
- * method is called when the shell is disposed. Otherwise, a potential
- * memory leak will exist.
+ * completes, the shell will be treated as if it had never been registered at
+ * all. If you have registered a shell, you should ensure that this method is
+ * called when the shell is disposed. Otherwise, a potential memory leak will
+ * exist.
* </p>
* <p>
- * If the shell was never registered, or if the shell is <code>null</code>,
- * then this method returns <code>false</code> and does nothing.
+ * If the shell was never registered, or if the shell is <code>null</code>, then
+ * this method returns <code>false</code> and does nothing.
*
- * @param shell
- * The shell to be unregistered; does nothing if this value is
- * <code>null</code>.
+ * @param shell The shell to be unregistered; does nothing if this value is
+ * <code>null</code>.
*
* @return <code>true</code> if the shell had been registered;
* <code>false</code> otherwise.
@@ -706,28 +656,23 @@ public final class ContextAuthority extends ExpressionAuthority {
}
/*
- * If we're unregistering the shell but we're not about to dispose it,
- * then we'll end up leaking the DisposeListener unless we remove it
- * here.
+ * If we're unregistering the shell but we're not about to dispose it, then
+ * we'll end up leaking the DisposeListener unless we remove it here.
*/
if (!shell.isDisposed()) {
- final DisposeListener oldListener = (DisposeListener) shell
- .getData(DISPOSE_LISTENER);
+ final DisposeListener oldListener = (DisposeListener) shell.getData(DISPOSE_LISTENER);
if (oldListener != null) {
shell.removeDisposeListener(oldListener);
}
}
- Collection previousActivations = (Collection) registeredWindows
- .get(shell);
+ Collection previousActivations = (Collection) registeredWindows.get(shell);
if (previousActivations != null) {
registeredWindows.remove(shell);
- final Iterator previousActivationItr = previousActivations
- .iterator();
+ final Iterator previousActivationItr = previousActivations.iterator();
while (previousActivationItr.hasNext()) {
- final IContextActivation activation = (IContextActivation) previousActivationItr
- .next();
+ final IContextActivation activation = (IContextActivation) previousActivationItr.next();
deactivateContext(activation);
}
return true;
@@ -739,15 +684,12 @@ public final class ContextAuthority extends ExpressionAuthority {
/**
* Updates the context with the given context activation.
*
- * @param contextId
- * The identifier of the context which should be updated; must
- * not be <code>null</code>.
- * @param active
- * Whether the context should be active; <code>false</code>
- * otherwise.
+ * @param contextId The identifier of the context which should be updated; must
+ * not be <code>null</code>.
+ * @param active Whether the context should be active; <code>false</code>
+ * otherwise.
*/
- private void updateContext(final String contextId,
- final boolean active) {
+ private void updateContext(final String contextId, final boolean active) {
if (active) {
contextManager.addActiveContext(contextId);
} else {
@@ -756,37 +698,30 @@ public final class ContextAuthority extends ExpressionAuthority {
}
/**
- * Updates this authority's evaluation context. If the changed variable is
- * the <code>ISources.ACTIVE_SHELL_NAME</code> variable, then this also
- * triggers an update of the shell-specific contexts. For example, if a
- * dialog becomes active, then the dialog context will be activated by this
- * method.
+ * Updates this authority's evaluation context. If the changed variable is the
+ * <code>ISources.ACTIVE_SHELL_NAME</code> variable, then this also triggers an
+ * update of the shell-specific contexts. For example, if a dialog becomes
+ * active, then the dialog context will be activated by this method.
*
- * @param name
- * The name of the variable to update; must not be
- * <code>null</code>.
- * @param value
- * The new value of the variable. If this value is
- * <code>null</code>, then the variable is removed.
+ * @param name The name of the variable to update; must not be
+ * <code>null</code>.
+ * @param value The new value of the variable. If this value is
+ * <code>null</code>, then the variable is removed.
*/
@Override
- protected void updateEvaluationContext(final String name,
- final Object value) {
+ protected void updateEvaluationContext(final String name, final Object value) {
/*
- * Bug 84056. If we update the active workbench window, then we risk
- * falling back to that shell when the active shell has registered as
- * "none".
+ * Bug 84056. If we update the active workbench window, then we risk falling
+ * back to that shell when the active shell has registered as "none".
*/
- if ((name != null)
- && (!ISources.ACTIVE_WORKBENCH_WINDOW_SHELL_NAME.equals(name))) {
+ if ((name != null) && (!ISources.ACTIVE_WORKBENCH_WINDOW_SHELL_NAME.equals(name))) {
/*
- * We need to track shell activation ourselves, as some special
- * contexts are automatically activated in response to different
- * types of shells becoming active.
+ * We need to track shell activation ourselves, as some special contexts are
+ * automatically activated in response to different types of shells becoming
+ * active.
*/
if (ISources.ACTIVE_SHELL_NAME.equals(name)) {
- checkWindowType((Shell) value,
- (Shell) getVariable(ISources.ACTIVE_SHELL_NAME));
+ checkWindowType((Shell) value, (Shell) getVariable(ISources.ACTIVE_SHELL_NAME));
}
// Update the evaluation context itself.
@@ -797,8 +732,8 @@ public final class ContextAuthority extends ExpressionAuthority {
/**
* <p>
* Bug 95792. A mechanism by which the key binding architecture can force an
- * update of the contexts (based on the active shell) before trying to
- * execute a command. This mechanism is required for GTK+ only.
+ * update of the contexts (based on the active shell) before trying to execute a
+ * command. This mechanism is required for GTK+ only.
* </p>
* <p>
* DO NOT CALL THIS METHOD.
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextLegacyWrapper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextLegacyWrapper.java
index 530c1acda07..4be665ba80c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextLegacyWrapper.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextLegacyWrapper.java
@@ -30,36 +30,30 @@ import org.eclipse.ui.internal.util.Util;
public class ContextLegacyWrapper implements IContext {
/**
- * The context manager that maintains the set of active contexts; must not
- * be <code>null</code>.
+ * The context manager that maintains the set of active contexts; must not be
+ * <code>null</code>.
*/
private final ContextManager contextManager;
/**
- * The wrapped instance of context. This value will never be
- * <code>null</code>.
+ * The wrapped instance of context. This value will never be <code>null</code>.
*/
private final Context wrappedContext;
/**
* Constructs a new instance of <code>ContextWrapper</code>.
*
- * @param context
- * The context to wrapper; must not be <code>null</code>.
- * @param contextManager
- * The context manager that maintains the set of active contexts;
- * must not be <code>null</code>.
+ * @param context The context to wrapper; must not be <code>null</code>.
+ * @param contextManager The context manager that maintains the set of active
+ * contexts; must not be <code>null</code>.
*/
- public ContextLegacyWrapper(final Context context,
- final ContextManager contextManager) {
+ public ContextLegacyWrapper(final Context context, final ContextManager contextManager) {
if (context == null) {
- throw new NullPointerException(
- "A wrapper cannot be created on a null context"); //$NON-NLS-1$
+ throw new NullPointerException("A wrapper cannot be created on a null context"); //$NON-NLS-1$
}
if (contextManager == null) {
- throw new NullPointerException(
- "A wrapper cannot be created with a null manager"); //$NON-NLS-1$
+ throw new NullPointerException("A wrapper cannot be created with a null manager"); //$NON-NLS-1$
}
wrappedContext = context;
@@ -68,21 +62,20 @@ public class ContextLegacyWrapper implements IContext {
@Override
public void addContextListener(IContextListener contextListener) {
- final LegacyContextListenerWrapper wrapper = new LegacyContextListenerWrapper(
- contextListener, contextManager, this);
+ final LegacyContextListenerWrapper wrapper = new LegacyContextListenerWrapper(contextListener, contextManager,
+ this);
wrappedContext.addContextListener(wrapper);
/*
- * We need to add the listener to the context manager as well, as only
- * the manager advertises changes to the enabled state.
+ * We need to add the listener to the context manager as well, as only the
+ * manager advertises changes to the enabled state.
*/
contextManager.addContextManagerListener(wrapper);
}
@Override
public int compareTo(Object o) {
- return Util
- .compare(wrappedContext, ((ContextLegacyWrapper) o).wrappedContext);
+ return Util.compare(wrappedContext, ((ContextLegacyWrapper) o).wrappedContext);
}
@Override
@@ -115,14 +108,13 @@ public class ContextLegacyWrapper implements IContext {
@Override
public boolean isEnabled() {
- return contextManager.getActiveContextIds().contains(
- wrappedContext.getId());
+ return contextManager.getActiveContextIds().contains(wrappedContext.getId());
}
@Override
public void removeContextListener(IContextListener contextListener) {
- final LegacyContextListenerWrapper wrapper = new LegacyContextListenerWrapper(
- contextListener, contextManager, this);
+ final LegacyContextListenerWrapper wrapper = new LegacyContextListenerWrapper(contextListener, contextManager,
+ this);
wrappedContext.removeContextListener(wrapper);
contextManager.removeContextManagerListener(wrapper);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextManagerFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextManagerFactory.java
index fb5de0a01f0..cf5291ab892 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextManagerFactory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextManagerFactory.java
@@ -17,7 +17,8 @@ package org.eclipse.ui.internal.contexts;
import org.eclipse.core.commands.contexts.ContextManager;
/**
- * This class allows clients to broker instances of <code>IContextManager</code>.
+ * This class allows clients to broker instances of
+ * <code>IContextManager</code>.
* <p>
* This class is not intended to be extended by clients.
* </p>
@@ -29,16 +30,13 @@ public final class ContextManagerFactory {
/**
* Creates a new instance of <code>ContextManagerWrapper</code>.
*
- * @param contextManager
- * The context manager that this context manager wrapper should
- * wrap; must not be <code>null</code>.
- * @return a new instance of <code>ContextManagerWrapper</code>. Clients
- * should not make assumptions about the concrete implementation
- * outside the contract of the interface. Guaranteed not to be
- * <code>null</code>.
+ * @param contextManager The context manager that this context manager wrapper
+ * should wrap; must not be <code>null</code>.
+ * @return a new instance of <code>ContextManagerWrapper</code>. Clients should
+ * not make assumptions about the concrete implementation outside the
+ * contract of the interface. Guaranteed not to be <code>null</code>.
*/
- public static ContextManagerLegacyWrapper getContextManagerWrapper(
- final ContextManager contextManager) {
+ public static ContextManagerLegacyWrapper getContextManagerWrapper(final ContextManager contextManager) {
return new ContextManagerLegacyWrapper(contextManager);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextManagerLegacyWrapper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextManagerLegacyWrapper.java
index 7e0e8852bef..d82095061e3 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextManagerLegacyWrapper.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextManagerLegacyWrapper.java
@@ -36,15 +36,14 @@ import org.eclipse.ui.contexts.IContextManagerListener;
*
* @since 3.1
*/
-public final class ContextManagerLegacyWrapper implements
- org.eclipse.core.commands.contexts.IContextManagerListener,
- IContextManager {
+public final class ContextManagerLegacyWrapper
+ implements org.eclipse.core.commands.contexts.IContextManagerListener, IContextManager {
/**
* A comparator between context identifiers, that sorts them based on depth
- * within the tree. Context identifiers representing deeper items (i.e.,
- * items with more ancestors), have lesser values (i.e., would appear
- * earlier in a set).
+ * within the tree. Context identifiers representing deeper items (i.e., items
+ * with more ancestors), have lesser values (i.e., would appear earlier in a
+ * set).
*
* @since 3.0
*/
@@ -99,10 +98,9 @@ public final class ContextManagerLegacyWrapper implements
}
/**
- * A set that contains context identifiers (strings). The set is sorted
- * based on how many ancestors the corresponding contexts have. Contexts
- * with no parents appear last, while contexts with the most ancestors
- * appear first.
+ * A set that contains context identifiers (strings). The set is sorted based on
+ * how many ancestors the corresponding contexts have. Contexts with no parents
+ * appear last, while contexts with the most ancestors appear first.
*
* @since 3.0
*/
@@ -116,13 +114,12 @@ public final class ContextManagerLegacyWrapper implements
private static final long serialVersionUID = 3257291326872892465L;
/**
- * Constructs a new instance of <code>DepthSortedContextIdSet</code>
- * with the set to be sorted.
+ * Constructs a new instance of <code>DepthSortedContextIdSet</code> with the
+ * set to be sorted.
*
- * @param contextIds
- * A set of context identifiers (strings); this may contain
- * <code>null</code> values. The set may not be
- * <code>null</code>, but may be empty.
+ * @param contextIds A set of context identifiers (strings); this may contain
+ * <code>null</code> values. The set may not be
+ * <code>null</code>, but may be empty.
*/
private DepthSortedContextIdSet(final Set contextIds) {
super(new ContextIdDepthComparator());
@@ -135,12 +132,11 @@ public final class ContextManagerLegacyWrapper implements
private List contextManagerListeners;
/**
- * Constructs a new instance of <code>MutableContextManager</code>. The
- * registry is created on the platform's extension registry.
+ * Constructs a new instance of <code>MutableContextManager</code>. The registry
+ * is created on the platform's extension registry.
*
- * @param contextManager
- * The manager which will provided the real support; must not be
- * <code>null</code>.
+ * @param contextManager The manager which will provided the real support; must
+ * not be <code>null</code>.
*/
public ContextManagerLegacyWrapper(ContextManager contextManager) {
@@ -153,8 +149,7 @@ public final class ContextManagerLegacyWrapper implements
}
@Override
- public void addContextManagerListener(
- IContextManagerListener contextManagerListener) {
+ public void addContextManagerListener(IContextManagerListener contextManagerListener) {
if (contextManagerListener == null) {
throw new NullPointerException();
}
@@ -169,8 +164,7 @@ public final class ContextManagerLegacyWrapper implements
}
@Override
- public void contextManagerChanged(
- org.eclipse.core.commands.contexts.ContextManagerEvent contextManagerEvent) {
+ public void contextManagerChanged(org.eclipse.core.commands.contexts.ContextManagerEvent contextManagerEvent) {
final String contextId = contextManagerEvent.getContextId();
final boolean definedContextsChanged;
final Set previouslyDefinedContextIds;
@@ -180,8 +174,7 @@ public final class ContextManagerLegacyWrapper implements
} else {
definedContextsChanged = true;
previouslyDefinedContextIds = new HashSet();
- previouslyDefinedContextIds.addAll(contextManager
- .getDefinedContextIds());
+ previouslyDefinedContextIds.addAll(contextManager.getDefinedContextIds());
if (contextManagerEvent.isContextDefined()) {
previouslyDefinedContextIds.remove(contextId);
} else {
@@ -189,38 +182,32 @@ public final class ContextManagerLegacyWrapper implements
}
}
- fireContextManagerChanged(new ContextManagerEvent(this,
- definedContextsChanged, contextManagerEvent
- .isActiveContextsChanged(),
- previouslyDefinedContextIds, contextManagerEvent
- .getPreviouslyActiveContextIds()));
+ fireContextManagerChanged(
+ new ContextManagerEvent(this, definedContextsChanged, contextManagerEvent.isActiveContextsChanged(),
+ previouslyDefinedContextIds, contextManagerEvent.getPreviouslyActiveContextIds()));
}
- protected void fireContextManagerChanged(
- ContextManagerEvent contextManagerEvent) {
+ protected void fireContextManagerChanged(ContextManagerEvent contextManagerEvent) {
if (contextManagerEvent == null) {
throw new NullPointerException();
}
if (contextManagerListeners != null) {
for (int i = 0; i < contextManagerListeners.size(); i++) {
- ((IContextManagerListener) contextManagerListeners.get(i))
- .contextManagerChanged(contextManagerEvent);
+ ((IContextManagerListener) contextManagerListeners.get(i)).contextManagerChanged(contextManagerEvent);
}
}
}
@Override
public IContext getContext(String contextId) {
- return new ContextLegacyWrapper(contextManager.getContext(contextId),
- contextManager);
+ return new ContextLegacyWrapper(contextManager.getContext(contextId), contextManager);
}
@Override
public SortedSet getDefinedContextIds() {
- return new DepthSortedContextIdSet(contextManager
- .getDefinedContextIds());
+ return new DepthSortedContextIdSet(contextManager.getDefinedContextIds());
}
@Override
@@ -229,8 +216,7 @@ public final class ContextManagerLegacyWrapper implements
}
@Override
- public void removeContextManagerListener(
- IContextManagerListener contextManagerListener) {
+ public void removeContextManagerListener(IContextManagerListener contextManagerListener) {
if (contextManagerListener == null) {
throw new NullPointerException();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextPersistence.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextPersistence.java
index 51c36ef9da8..04f5fddeec8 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextPersistence.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextPersistence.java
@@ -46,51 +46,44 @@ public final class ContextPersistence extends RegistryPersistence {
/**
* Reads all of the command definitions from the commands extension point.
*
- * @param configurationElements
- * The configuration elements in the commands extension point;
- * must not be <code>null</code>, but may be empty.
- * @param configurationElementCount
- * The number of configuration elements that are really in the
- * array.
- * @param contextManager
- * The context manager to which the commands should be added;
- * must not be <code>null</code>.
+ * @param configurationElements The configuration elements in the commands
+ * extension point; must not be
+ * <code>null</code>, but may be empty.
+ * @param configurationElementCount The number of configuration elements that
+ * are really in the array.
+ * @param contextManager The context manager to which the commands
+ * should be added; must not be
+ * <code>null</code>.
*/
- private static void readContextsFromRegistry(
- final IConfigurationElement[] configurationElements,
- final int configurationElementCount,
- final ContextManager contextManager) {
+ private static void readContextsFromRegistry(final IConfigurationElement[] configurationElements,
+ final int configurationElementCount, final ContextManager contextManager) {
final List warningsToLog = new ArrayList(1);
for (int i = 0; i < configurationElementCount; i++) {
final IConfigurationElement configurationElement = configurationElements[i];
// Read out the command identifier.
- final String contextId = readRequired(configurationElement, ATT_ID,
- warningsToLog, "Contexts need an id"); //$NON-NLS-1$
+ final String contextId = readRequired(configurationElement, ATT_ID, warningsToLog, "Contexts need an id"); //$NON-NLS-1$
if (contextId == null) {
continue;
}
// Read out the name.
- final String name = readRequired(configurationElement, ATT_NAME,
- warningsToLog, "Contexts need a name", //$NON-NLS-1$
+ final String name = readRequired(configurationElement, ATT_NAME, warningsToLog, "Contexts need a name", //$NON-NLS-1$
contextId);
if (name == null) {
continue;
}
// Read out the description.
- final String description = readOptional(configurationElement,
- ATT_DESCRIPTION);
+ final String description = readOptional(configurationElement, ATT_DESCRIPTION);
// Read out the parent id.
String parentId = configurationElement.getAttribute(ATT_PARENT_ID);
if ((parentId == null) || (parentId.length() == 0)) {
parentId = configurationElement.getAttribute(ATT_PARENT);
if ((parentId == null) || (parentId.length() == 0)) {
- parentId = configurationElement
- .getAttribute(ATT_PARENT_SCOPE);
+ parentId = configurationElement.getAttribute(ATT_PARENT_SCOPE);
}
}
if ((parentId != null) && (parentId.length() == 0)) {
@@ -103,8 +96,7 @@ public final class ContextPersistence extends RegistryPersistence {
}
}
- logWarnings(
- warningsToLog,
+ logWarnings(warningsToLog,
"Warnings while parsing the contexts from the 'org.eclipse.ui.contexts', 'org.eclipse.ui.commands' and 'org.eclipse.ui.acceleratorScopes' extension points."); //$NON-NLS-1$
}
@@ -118,25 +110,21 @@ public final class ContextPersistence extends RegistryPersistence {
*/
public ContextPersistence(final ContextManager contextManager) {
if (contextManager == null) {
- throw new NullPointerException(
- "The context manager must not be null"); //$NON-NLS-1$
+ throw new NullPointerException("The context manager must not be null"); //$NON-NLS-1$
}
this.contextManager = contextManager;
}
@Override
protected boolean isChangeImportant(final IRegistryChangeEvent event) {
- final IExtensionDelta[] acceleratorScopeDeltas = event
- .getExtensionDeltas(PlatformUI.PLUGIN_ID,
- IWorkbenchRegistryConstants.PL_ACCELERATOR_SCOPES);
+ final IExtensionDelta[] acceleratorScopeDeltas = event.getExtensionDeltas(PlatformUI.PLUGIN_ID,
+ IWorkbenchRegistryConstants.PL_ACCELERATOR_SCOPES);
if (acceleratorScopeDeltas.length == 0) {
- final IExtensionDelta[] contextDeltas = event.getExtensionDeltas(
- PlatformUI.PLUGIN_ID,
+ final IExtensionDelta[] contextDeltas = event.getExtensionDeltas(PlatformUI.PLUGIN_ID,
IWorkbenchRegistryConstants.PL_CONTEXTS);
if (contextDeltas.length == 0) {
- final IExtensionDelta[] commandDeltas = event
- .getExtensionDeltas(PlatformUI.PLUGIN_ID,
- IWorkbenchRegistryConstants.PL_COMMANDS);
+ final IExtensionDelta[] commandDeltas = event.getExtensionDeltas(PlatformUI.PLUGIN_ID,
+ IWorkbenchRegistryConstants.PL_COMMANDS);
if (commandDeltas.length == 0) {
return false;
}
@@ -149,9 +137,9 @@ public final class ContextPersistence extends RegistryPersistence {
/**
* Reads all of the contexts from the registry,
*
- * @param contextManager
- * The context manager which should be populated with the values
- * from the registry; must not be <code>null</code>.
+ * @param contextManager The context manager which should be populated with the
+ * values from the registry; must not be
+ * <code>null</code>.
*/
@Override
protected void read() {
@@ -167,8 +155,7 @@ public final class ContextPersistence extends RegistryPersistence {
final IConfigurationElement[][] indexedConfigurationElements = new IConfigurationElement[1][];
/*
- * Retrieve the accelerator scopes from the accelerator scopes extension
- * point.
+ * Retrieve the accelerator scopes from the accelerator scopes extension point.
*/
final IConfigurationElement[] acceleratorScopesExtensionPoint = registry
.getConfigurationElementsFor(EXTENSION_ACCELERATOR_SCOPES);
@@ -177,30 +164,26 @@ public final class ContextPersistence extends RegistryPersistence {
// Check if it is a binding definition.
if (TAG_ACCELERATOR_SCOPE.equals(name)) {
- addElementToIndexedArray(configurationElement,
- indexedConfigurationElements,
- INDEX_CONTEXT_DEFINITIONS, contextDefinitionCount++);
+ addElementToIndexedArray(configurationElement, indexedConfigurationElements, INDEX_CONTEXT_DEFINITIONS,
+ contextDefinitionCount++);
}
}
/*
- * Retrieve the deprecated scopes and contexts from the commands
- * extension point.
+ * Retrieve the deprecated scopes and contexts from the commands extension
+ * point.
*/
- final IConfigurationElement[] commandsExtensionPoint = registry
- .getConfigurationElementsFor(EXTENSION_COMMANDS);
+ final IConfigurationElement[] commandsExtensionPoint = registry.getConfigurationElementsFor(EXTENSION_COMMANDS);
for (final IConfigurationElement configurationElement : commandsExtensionPoint) {
final String name = configurationElement.getName();
// Check if it is a binding definition.
if (TAG_SCOPE.equals(name)) {
- addElementToIndexedArray(configurationElement,
- indexedConfigurationElements,
- INDEX_CONTEXT_DEFINITIONS, contextDefinitionCount++);
+ addElementToIndexedArray(configurationElement, indexedConfigurationElements, INDEX_CONTEXT_DEFINITIONS,
+ contextDefinitionCount++);
} else if (TAG_CONTEXT.equals(name)) {
- addElementToIndexedArray(configurationElement,
- indexedConfigurationElements,
- INDEX_CONTEXT_DEFINITIONS, contextDefinitionCount++);
+ addElementToIndexedArray(configurationElement, indexedConfigurationElements, INDEX_CONTEXT_DEFINITIONS,
+ contextDefinitionCount++);
}
}
@@ -208,22 +191,19 @@ public final class ContextPersistence extends RegistryPersistence {
/*
* Retrieve the contexts from the contexts extension point.
*/
- final IConfigurationElement[] contextsExtensionPoint = registry
- .getConfigurationElementsFor(EXTENSION_CONTEXTS);
+ final IConfigurationElement[] contextsExtensionPoint = registry.getConfigurationElementsFor(EXTENSION_CONTEXTS);
for (final IConfigurationElement configurationElement : contextsExtensionPoint) {
final String name = configurationElement.getName();
// Check if it is a binding definition.
if (TAG_CONTEXT.equals(name)) {
- addElementToIndexedArray(configurationElement,
- indexedConfigurationElements,
- INDEX_CONTEXT_DEFINITIONS, contextDefinitionCount++);
+ addElementToIndexedArray(configurationElement, indexedConfigurationElements, INDEX_CONTEXT_DEFINITIONS,
+ contextDefinitionCount++);
}
}
- readContextsFromRegistry(
- indexedConfigurationElements[INDEX_CONTEXT_DEFINITIONS],
- contextDefinitionCount, contextManager);
+ readContextsFromRegistry(indexedConfigurationElements[INDEX_CONTEXT_DEFINITIONS], contextDefinitionCount,
+ contextManager);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextService.java
index 0d31e54f8bc..2936de7f8c0 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextService.java
@@ -70,17 +70,16 @@ public final class ContextService implements IContextService {
private final ContextPersistence contextPersistence;
/**
- * Constructs a new instance of <code>ContextService</code> using a
- * context manager.
+ * Constructs a new instance of <code>ContextService</code> using a context
+ * manager.
*
- * @param contextManager
- * The context manager to use; must not be <code>null</code>.
+ * @param contextManager The context manager to use; must not be
+ * <code>null</code>.
*/
@Inject
public ContextService(final ContextManager contextManager) {
if (contextManager == null) {
- throw new NullPointerException(
- "Cannot create a context service with a null manager"); //$NON-NLS-1$
+ throw new NullPointerException("Cannot create a context service with a null manager"); //$NON-NLS-1$
}
this.contextManager = contextManager;
this.contextAuthority = new ContextAuthority(contextManager, this);
@@ -120,8 +119,8 @@ public final class ContextService implements IContextService {
try {
if (updating) {
EvaluationResult result = expression.evaluate(ctx);
- if (cached != null
- && (cached == result || (cached != EvaluationResult.FALSE && result != EvaluationResult.FALSE))) {
+ if (cached != null && (cached == result
+ || (cached != EvaluationResult.FALSE && result != EvaluationResult.FALSE))) {
return updating;
}
if (result != EvaluationResult.FALSE) {
@@ -140,11 +139,9 @@ public final class ContextService implements IContextService {
}
@Override
- public IContextActivation activateContext(final String contextId,
- final Expression expression) {
+ public IContextActivation activateContext(final String contextId, final Expression expression) {
- final IContextActivation activation = new ContextActivation(contextId,
- expression, this);
+ final IContextActivation activation = new ContextActivation(contextId, expression, this);
contextAuthority.activateContext(activation);
if (expression == null) {
contextService.activateContext(contextId);
@@ -157,20 +154,18 @@ public final class ContextService implements IContextService {
}
@Override
- public IContextActivation activateContext(String contextId,
- Expression expression, boolean global) {
+ public IContextActivation activateContext(String contextId, Expression expression, boolean global) {
return activateContext(contextId, expression);
}
@Override
- public IContextActivation activateContext(final String contextId,
- final Expression expression, final int sourcePriority) {
+ public IContextActivation activateContext(final String contextId, final Expression expression,
+ final int sourcePriority) {
return activateContext(contextId, expression);
}
@Override
- public void addContextManagerListener(
- final IContextManagerListener listener) {
+ public void addContextManagerListener(final IContextManagerListener listener) {
contextManager.addContextManagerListener(listener);
}
@@ -251,8 +246,7 @@ public final class ContextService implements IContextService {
}
@Override
- public void removeContextManagerListener(
- final IContextManagerListener listener) {
+ public void removeContextManagerListener(final IContextManagerListener listener) {
contextManager.removeContextManagerListener(listener);
}
@@ -269,8 +263,8 @@ public final class ContextService implements IContextService {
/**
* <p>
* Bug 95792. A mechanism by which the key binding architecture can force an
- * update of the contexts (based on the active shell) before trying to
- * execute a command. This mechanism is required for GTK+ only.
+ * update of the contexts (based on the active shell) before trying to execute a
+ * command. This mechanism is required for GTK+ only.
* </p>
* <p>
* DO NOT CALL THIS METHOD.
@@ -283,22 +277,20 @@ public final class ContextService implements IContextService {
/**
* <p>
* Bug 95792. A mechanism by which the key binding architecture can force an
- * update of the contexts (based on the active shell) before trying to
- * execute a command. This mechanism is required for GTK+ only.
+ * update of the contexts (based on the active shell) before trying to execute a
+ * command. This mechanism is required for GTK+ only.
* </p>
* <p>
* DO NOT CALL THIS METHOD.
* </p>
*
- * @param shell
- * The shell that should be considered active; must not be
- * <code>null</code>.
+ * @param shell The shell that should be considered active; must not be
+ * <code>null</code>.
*/
public void updateShellKludge(final Shell shell) {
final Shell currentActiveShell = contextAuthority.getActiveShell();
if (currentActiveShell != shell) {
- contextAuthority.sourceChanged(ISources.ACTIVE_SHELL,
- ISources.ACTIVE_SHELL_NAME, shell);
+ contextAuthority.sourceChanged(ISources.ACTIVE_SHELL, ISources.ACTIVE_SHELL_NAME, shell);
}
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextServiceFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextServiceFactory.java
index 162828605d7..70ce65c0a31 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextServiceFactory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextServiceFactory.java
@@ -33,13 +33,11 @@ import org.eclipse.ui.services.IServiceLocator;
public class ContextServiceFactory extends AbstractServiceFactory {
@Override
- public Object create(Class serviceInterface, IServiceLocator parentLocator,
- IServiceLocator locator) {
+ public Object create(Class serviceInterface, IServiceLocator parentLocator, IServiceLocator locator) {
if (!IContextService.class.equals(serviceInterface)) {
return null;
}
- IWorkbenchLocationService wls = locator
- .getService(IWorkbenchLocationService.class);
+ IWorkbenchLocationService wls = locator.getService(IWorkbenchLocationService.class);
final IWorkbench wb = wls.getWorkbench();
if (wb == null) {
return null;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/LegacyContextListenerWrapper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/LegacyContextListenerWrapper.java
index 2c47c1b9c86..ffebed1465e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/LegacyContextListenerWrapper.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/LegacyContextListenerWrapper.java
@@ -30,18 +30,17 @@ import org.eclipse.ui.contexts.IContext;
*
* @since 3.1
*/
-public class LegacyContextListenerWrapper implements IContextListener,
- IContextManagerListener {
+public class LegacyContextListenerWrapper implements IContextListener, IContextManagerListener {
/**
- * The legacy context that this listener would previously have been attached
- * to. This value is never <code>null</code>.
+ * The legacy context that this listener would previously have been attached to.
+ * This value is never <code>null</code>.
*/
private final IContext context;
/**
- * The context manager used for constructing the context wrapper when an
- * event occurs; must not be <code>null</code>.
+ * The context manager used for constructing the context wrapper when an event
+ * occurs; must not be <code>null</code>.
*/
private final ContextManager contextManager;
@@ -53,31 +52,26 @@ public class LegacyContextListenerWrapper implements IContextListener,
/**
* Constructs a new instance of <code>ContextListenerWrapper</code>.
*
- * @param listener
- * The listener to be wrapped. Must not be <code>null</code>.
- * @param contextManager
- * The context manager used for constructing the context wrapper
- * when an event occurs; must not be <code>null</code>.
- * @param context
- * The legacy context this listener will be listening to; must
- * not be <code>null</code>.
+ * @param listener The listener to be wrapped. Must not be
+ * <code>null</code>.
+ * @param contextManager The context manager used for constructing the context
+ * wrapper when an event occurs; must not be
+ * <code>null</code>.
+ * @param context The legacy context this listener will be listening to;
+ * must not be <code>null</code>.
*/
- public LegacyContextListenerWrapper(
- final org.eclipse.ui.contexts.IContextListener listener,
+ public LegacyContextListenerWrapper(final org.eclipse.ui.contexts.IContextListener listener,
final ContextManager contextManager, final IContext context) {
if (listener == null) {
- throw new NullPointerException(
- "Cannot create a listener wrapper on a null listener"); //$NON-NLS-1$
+ throw new NullPointerException("Cannot create a listener wrapper on a null listener"); //$NON-NLS-1$
}
if (contextManager == null) {
- throw new NullPointerException(
- "Cannot create a listener wrapper with a null context manager"); //$NON-NLS-1$
+ throw new NullPointerException("Cannot create a listener wrapper with a null context manager"); //$NON-NLS-1$
}
if (context == null) {
- throw new NullPointerException(
- "Cannot create a listener wrapper with a null context"); //$NON-NLS-1$
+ throw new NullPointerException("Cannot create a listener wrapper with a null context"); //$NON-NLS-1$
}
wrappedListener = listener;
@@ -87,13 +81,9 @@ public class LegacyContextListenerWrapper implements IContextListener,
@Override
public final void contextChanged(final ContextEvent contextEvent) {
- wrappedListener
- .contextChanged(new org.eclipse.ui.contexts.ContextEvent(
- new ContextLegacyWrapper(contextEvent.getContext(),
- contextManager), contextEvent
- .isDefinedChanged(), false, contextEvent
- .isNameChanged(), contextEvent
- .isParentIdChanged()));
+ wrappedListener.contextChanged(new org.eclipse.ui.contexts.ContextEvent(
+ new ContextLegacyWrapper(contextEvent.getContext(), contextManager), contextEvent.isDefinedChanged(),
+ false, contextEvent.isNameChanged(), contextEvent.isParentIdChanged()));
}
@Override
@@ -103,15 +93,11 @@ public class LegacyContextListenerWrapper implements IContextListener,
if (event.isActiveContextsChanged()) {
final Set previousContexts = event.getPreviouslyActiveContextIds();
final Set currentContexts = contextManager.getActiveContextIds();
- if ((previousContexts != null)
- && (previousContexts.contains(contextId))
- && ((currentContexts == null) || (currentContexts
- .contains(contextId)))) {
+ if ((previousContexts != null) && (previousContexts.contains(contextId))
+ && ((currentContexts == null) || (currentContexts.contains(contextId)))) {
enabledChanged = true;
- } else if ((currentContexts != null)
- && (currentContexts.contains(contextId))
- && ((previousContexts == null) || (previousContexts
- .contains(contextId)))) {
+ } else if ((currentContexts != null) && (currentContexts.contains(contextId))
+ && ((previousContexts == null) || (previousContexts.contains(contextId)))) {
enabledChanged = true;
} else {
enabledChanged = false;
@@ -121,8 +107,7 @@ public class LegacyContextListenerWrapper implements IContextListener,
}
wrappedListener
- .contextChanged(new org.eclipse.ui.contexts.ContextEvent(
- context, false, enabledChanged, false, false));
+ .contextChanged(new org.eclipse.ui.contexts.ContextEvent(context, false, enabledChanged, false, false));
}
@Override
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/NestableContextService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/NestableContextService.java
index b83d63d61ce..7c0ca6a95ec 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/NestableContextService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/NestableContextService.java
@@ -34,8 +34,7 @@ import org.eclipse.ui.internal.services.INestable;
*
* @since 3.2
*/
-public class NestableContextService extends SlaveContextService implements
- INestable {
+public class NestableContextService extends SlaveContextService implements INestable {
/**
* Maintain the state of the context service.
*/
@@ -44,15 +43,13 @@ public class NestableContextService extends SlaveContextService implements
/**
* Construct the new nested slave context.
*
- * @param parentService
- * the parent context service; must not be <code>null</code>.
- * @param defaultExpression
- * A default expression to use to determine viability. It's
- * mainly used for conflict resolution. It can be
- * <code>null</code>.
+ * @param parentService the parent context service; must not be
+ * <code>null</code>.
+ * @param defaultExpression A default expression to use to determine viability.
+ * It's mainly used for conflict resolution. It can be
+ * <code>null</code>.
*/
- public NestableContextService(IContextService parentService,
- Expression defaultExpression) {
+ public NestableContextService(IContextService parentService, Expression defaultExpression) {
super(parentService, defaultExpression);
fActive = false;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/SlaveContextService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/SlaveContextService.java
index d1a59dfe4f6..42dc9cd6a53 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/SlaveContextService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/SlaveContextService.java
@@ -48,9 +48,9 @@ public class SlaveContextService implements IContextService {
protected IContextService fParentService;
/**
- * The default expression used when {@link #activateContext(String) } is
- * called. Contexts contributed that use this expression will only be active
- * with this service is active.
+ * The default expression used when {@link #activateContext(String) } is called.
+ * Contexts contributed that use this expression will only be active with this
+ * service is active.
*/
protected Expression fDefaultExpression;
@@ -60,10 +60,9 @@ public class SlaveContextService implements IContextService {
protected Set fParentActivations;
/**
- * A map of the local activation to the parent activations. If this service
- * is inactive, then all parent activations are <code>null</code>.
- * Otherwise, they point to the corresponding activation in the parent
- * service.
+ * A map of the local activation to the parent activations. If this service is
+ * inactive, then all parent activations are <code>null</code>. Otherwise, they
+ * point to the corresponding activation in the parent service.
*/
protected Map fLocalActivations;
@@ -82,8 +81,8 @@ public class SlaveContextService implements IContextService {
private Collection fSourceProviders;
/**
- * A collection of shells registered through this service. The listeners are
- * not activated/deactivated, but they will be removed when this service is
+ * A collection of shells registered through this service. The listeners are not
+ * activated/deactivated, but they will be removed when this service is
* disposed.
*/
private Collection fRegisteredShells;
@@ -91,18 +90,15 @@ public class SlaveContextService implements IContextService {
/**
* Construct the new slave.
*
- * @param parentService
- * the parent context service; must not be <code>null</code>.
- * @param defaultExpression
- * A default expression to use to determine viability. It's
- * mainly used for conflict resolution. It can be
- * <code>null</code>.
+ * @param parentService the parent context service; must not be
+ * <code>null</code>.
+ * @param defaultExpression A default expression to use to determine viability.
+ * It's mainly used for conflict resolution. It can be
+ * <code>null</code>.
*/
- public SlaveContextService(IContextService parentService,
- Expression defaultExpression) {
+ public SlaveContextService(IContextService parentService, Expression defaultExpression) {
if (parentService == null) {
- throw new NullPointerException(
- "The parent context service must not be null"); //$NON-NLS-1$
+ throw new NullPointerException("The parent context service must not be null"); //$NON-NLS-1$
}
fParentService = parentService;
fDefaultExpression = defaultExpression;
@@ -121,23 +117,19 @@ public class SlaveContextService implements IContextService {
@Override
public IContextActivation activateContext(String contextId) {
- ContextActivation activation = new ContextActivation(contextId,
- fDefaultExpression, this);
+ ContextActivation activation = new ContextActivation(contextId, fDefaultExpression, this);
return doActivateContext(activation);
}
@Override
- public IContextActivation activateContext(String contextId,
- Expression expression) {
+ public IContextActivation activateContext(String contextId, Expression expression) {
return activateContext(contextId, expression, false);
}
@Override
- public IContextActivation activateContext(String contextId,
- Expression expression, boolean global) {
+ public IContextActivation activateContext(String contextId, Expression expression, boolean global) {
if (global) {
- IContextActivation activation = fParentService.activateContext(
- contextId, expression, global);
+ IContextActivation activation = fParentService.activateContext(contextId, expression, global);
fParentActivations.add(activation);
return activation;
}
@@ -152,14 +144,12 @@ public class SlaveContextService implements IContextService {
aExpression = expression;
}
- ContextActivation activation = new ContextActivation(contextId,
- aExpression, this);
+ ContextActivation activation = new ContextActivation(contextId, aExpression, this);
return doActivateContext(activation);
}
@Override
- public IContextActivation activateContext(String contextId,
- Expression expression, int sourcePriorities) {
+ public IContextActivation activateContext(String contextId, Expression expression, int sourcePriorities) {
return activateContext(contextId, expression);
}
@@ -183,8 +173,7 @@ public class SlaveContextService implements IContextService {
public void deactivateContext(IContextActivation activation) {
IContextActivation parentActivation = null;
if (fLocalActivations.containsKey(activation)) {
- parentActivation = (IContextActivation) fLocalActivations
- .remove(activation);
+ parentActivation = (IContextActivation) fLocalActivations.remove(activation);
} else {
parentActivation = activation;
}
@@ -234,15 +223,13 @@ public class SlaveContextService implements IContextService {
/**
* Activate the context with respect to this slave service.
*
- * @param contextId
- * the context id
- * @param expression
- * the expression to use
+ * @param contextId the context id
+ * @param expression the expression to use
* @return the activated context
*/
protected IContextActivation doActivateContext(IContextActivation activation) {
- IContextActivation parentActivation = fParentService.activateContext(
- activation.getContextId(), activation.getExpression());
+ IContextActivation parentActivation = fParentService.activateContext(activation.getContextId(),
+ activation.getExpression());
fParentActivations.add(parentActivation);
fLocalActivations.put(activation, parentActivation);
return activation;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/WorkbenchContextSupport.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/WorkbenchContextSupport.java
index 930a7d43f0f..8c806c8221b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/WorkbenchContextSupport.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/WorkbenchContextSupport.java
@@ -37,21 +37,20 @@ import org.eclipse.ui.keys.IBindingService;
public class WorkbenchContextSupport implements IWorkbenchContextSupport {
/**
- * The map of activations that have been given to the handler service (<code>IHandlerActivation</code>),
- * indexed by the submissions (<code>HandlerSubmission</code>). This map
- * should be <code>null</code> if there are no such activations.
+ * The map of activations that have been given to the handler service
+ * (<code>IHandlerActivation</code>), indexed by the submissions
+ * (<code>HandlerSubmission</code>). This map should be <code>null</code> if
+ * there are no such activations.
*/
private Map activationsBySubmission = null;
/**
- * The binding service for the workbench. This value is never
- * <code>null</code>.
+ * The binding service for the workbench. This value is never <code>null</code>.
*/
private IBindingService bindingService;
/**
- * The context service for the workbench. This value is never
- * <code>null</code>.
+ * The context service for the workbench. This value is never <code>null</code>.
*/
private IContextService contextService;
@@ -61,40 +60,32 @@ public class WorkbenchContextSupport implements IWorkbenchContextSupport {
private ContextManagerLegacyWrapper contextManagerWrapper;
/**
- * The workbench for which context support is being provided. This value
- * must not be <code>null</code>.
+ * The workbench for which context support is being provided. This value must
+ * not be <code>null</code>.
*/
private final Workbench workbench;
/**
- * Constructs a new instance of <code>WorkbenchCommandSupport</code>.
- * This attaches the key binding support, and adds a global shell activation
- * filter.
+ * Constructs a new instance of <code>WorkbenchCommandSupport</code>. This
+ * attaches the key binding support, and adds a global shell activation filter.
*
- * @param workbenchToSupport
- * The workbench that needs to be supported by this instance;
- * must not be <code>null</code>.
- * @param contextManager
- * The context manager to be wrappered; must not be
- * <code>null</code>.
+ * @param workbenchToSupport The workbench that needs to be supported by this
+ * instance; must not be <code>null</code>.
+ * @param contextManager The context manager to be wrappered; must not be
+ * <code>null</code>.
*/
- public WorkbenchContextSupport(final Workbench workbenchToSupport,
- final ContextManager contextManager) {
+ public WorkbenchContextSupport(final Workbench workbenchToSupport, final ContextManager contextManager) {
workbench = workbenchToSupport;
contextService = workbench.getService(IContextService.class);
bindingService = workbench.getService(IBindingService.class);
- contextManagerWrapper = ContextManagerFactory
- .getContextManagerWrapper(contextManager);
+ contextManagerWrapper = ContextManagerFactory.getContextManagerWrapper(contextManager);
}
@Override
- public final void addEnabledSubmission(
- final EnabledSubmission enabledSubmission) {
- final IContextActivation activation = contextService.activateContext(
- enabledSubmission.getContextId(),
- new LegacyHandlerSubmissionExpression(enabledSubmission
- .getActivePartId(), enabledSubmission.getActiveShell(),
- enabledSubmission.getActiveWorkbenchPartSite()));
+ public final void addEnabledSubmission(final EnabledSubmission enabledSubmission) {
+ final IContextActivation activation = contextService.activateContext(enabledSubmission.getContextId(),
+ new LegacyHandlerSubmissionExpression(enabledSubmission.getActivePartId(),
+ enabledSubmission.getActiveShell(), enabledSubmission.getActiveWorkbenchPartSite()));
if (activationsBySubmission == null) {
activationsBySubmission = new HashMap();
}
@@ -135,8 +126,7 @@ public class WorkbenchContextSupport implements IWorkbenchContextSupport {
}
@Override
- public final void removeEnabledSubmission(
- final EnabledSubmission enabledSubmission) {
+ public final void removeEnabledSubmission(final EnabledSubmission enabledSubmission) {
if (activationsBySubmission == null) {
return;
}
@@ -149,8 +139,7 @@ public class WorkbenchContextSupport implements IWorkbenchContextSupport {
}
@Override
- public final void removeEnabledSubmissions(
- final Collection enabledSubmissions) {
+ public final void removeEnabledSubmissions(final Collection enabledSubmissions) {
final Iterator submissionItr = enabledSubmissions.iterator();
while (submissionItr.hasNext()) {
removeEnabledSubmission((EnabledSubmission) submissionItr.next());
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DeclarativeDecorator.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DeclarativeDecorator.java
index 5dc8732a148..59a5c2c35d4 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DeclarativeDecorator.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DeclarativeDecorator.java
@@ -29,60 +29,60 @@ public class DeclarativeDecorator implements ILightweightLabelDecorator {
private String iconLocation;
- private IConfigurationElement configElement;
+ private IConfigurationElement configElement;
- private ImageDescriptor descriptor;
+ private ImageDescriptor descriptor;
- DeclarativeDecorator(IConfigurationElement definingElement, String iconPath) {
- this.iconLocation = iconPath;
- this.configElement = definingElement;
- }
+ DeclarativeDecorator(IConfigurationElement definingElement, String iconPath) {
+ this.iconLocation = iconPath;
+ this.configElement = definingElement;
+ }
- /**
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
- */
- @Override
+ /**
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
+ */
+ @Override
public void addListener(ILabelProviderListener listener) {
- }
+ }
- /**
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
- */
- @Override
+ /**
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
+ */
+ @Override
public void dispose() {
- //Nothing to do here
- }
+ // Nothing to do here
+ }
/**
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object,
- * java.lang.String)
- */
- @Override
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object,
+ * java.lang.String)
+ */
+ @Override
public boolean isLabelProperty(Object element, String property) {
- return false;
- }
+ return false;
+ }
- /**
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
- */
- @Override
+ /**
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
+ */
+ @Override
public void removeListener(ILabelProviderListener listener) {
- }
+ }
- /**
- * @see org.eclipse.jface.viewers.ILightweightLabelDecorator#decorate(java.lang.Object,
- * org.eclipse.jface.viewers.IDecoration)
- */
- @Override
+ /**
+ * @see org.eclipse.jface.viewers.ILightweightLabelDecorator#decorate(java.lang.Object,
+ * org.eclipse.jface.viewers.IDecoration)
+ */
+ @Override
public void decorate(Object element, IDecoration decoration) {
- if (descriptor == null) {
- URL url = BundleUtility.find(configElement.getDeclaringExtension()
- .getContributor().getName(), iconLocation);
- if (url == null) {
+ if (descriptor == null) {
+ URL url = BundleUtility.find(configElement.getDeclaringExtension().getContributor().getName(),
+ iconLocation);
+ if (url == null) {
return;
}
- descriptor = ImageDescriptor.createFromURL(url);
- }
- decoration.addOverlay(descriptor);
- }
+ descriptor = ImageDescriptor.createFromURL(url);
+ }
+ decoration.addOverlay(descriptor);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecorationBuilder.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecorationBuilder.java
index 716ee4643f2..2ad3238a3d9 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecorationBuilder.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecorationBuilder.java
@@ -62,8 +62,7 @@ public class DecorationBuilder implements IDecoration {
/**
* Create a decoration builder for the given context
*
- * @param context
- * a decoration context
+ * @param context a decoration context
*/
public DecorationBuilder(IDecorationContext context) {
this.context = context;
@@ -101,8 +100,8 @@ public class DecorationBuilder implements IDecoration {
}
valueSet = true;
} else {
- WorkbenchPlugin
- .log("Unable to apply decoration for " + currentDefinition.getId() + " invalid quadrant: " + quadrant); //$NON-NLS-1$ //$NON-NLS-2$
+ WorkbenchPlugin.log(
+ "Unable to apply decoration for " + currentDefinition.getId() + " invalid quadrant: " + quadrant); //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -143,8 +142,7 @@ public class DecorationBuilder implements IDecoration {
if (clearReplacementImage) {
descriptors[IDecoration.REPLACE] = null;
}
- DecorationResult newResult = new DecorationResult(new ArrayList(
- prefixes), new ArrayList(suffixes), descriptors,
+ DecorationResult newResult = new DecorationResult(new ArrayList(prefixes), new ArrayList(suffixes), descriptors,
foregroundColor, backgroundColor, font);
return newResult;
@@ -192,7 +190,6 @@ public class DecorationBuilder implements IDecoration {
valueSet = true;
}
-
@Override
public void setBackgroundColor(Color bgColor) {
this.backgroundColor = bgColor;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecorationImageBuilder.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecorationImageBuilder.java
index 221a29596c1..fa1df65f67e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecorationImageBuilder.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecorationImageBuilder.java
@@ -42,8 +42,7 @@ class DecorationImageBuilder {
rgbs[i] = new RGB(i, i, i);
}
ALPHA_PALETTE = new PaletteData(rgbs);
- BW_PALETTE = new PaletteData(new RGB[] { new RGB(0, 0, 0),
- new RGB(255, 255, 255) });
+ BW_PALETTE = new PaletteData(new RGB[] { new RGB(0, 0, 0), new RGB(255, 255, 255) });
}
private static int getTransparencyDepth(ImageData data) {
@@ -60,8 +59,7 @@ class DecorationImageBuilder {
return 0;
}
- private static ImageData getTransparency(ImageData data,
- int transparencyDepth) {
+ private static ImageData getTransparency(ImageData data, int transparencyDepth) {
if (data == null)
return null;
if (transparencyDepth == 1)
@@ -69,8 +67,8 @@ class DecorationImageBuilder {
ImageData mask = null;
if (data.maskData != null && data.depth == 32) {
ImageData m = data.getTransparencyMask();
- mask = new ImageData(data.width, data.height, 8, ALPHA_PALETTE,
- data.width, new byte[data.width * data.height]);
+ mask = new ImageData(data.width, data.height, 8, ALPHA_PALETTE, data.width,
+ new byte[data.width * data.height]);
for (int y = 0; y < data.height; y++) {
for (int x = 0; x < data.width; x++) {
int alpha = data.getPixel(x, y) & 0xFF;
@@ -83,25 +81,24 @@ class DecorationImageBuilder {
}
} else if (data.maskData != null || data.transparentPixel != -1) {
ImageData m = data.getTransparencyMask();
- mask = new ImageData(data.width, data.height, 8, ALPHA_PALETTE,
- data.width, new byte[data.width * data.height]);
+ mask = new ImageData(data.width, data.height, 8, ALPHA_PALETTE, data.width,
+ new byte[data.width * data.height]);
for (int y = 0; y < mask.height; y++) {
for (int x = 0; x < mask.width; x++) {
mask.setPixel(x, y, m.getPixel(x, y) != 0 ? (byte) 255 : 0);
}
}
} else if (data.alpha != -1) {
- mask = new ImageData(data.width, data.height, 8, ALPHA_PALETTE,
- data.width, new byte[data.width * data.height]);
+ mask = new ImageData(data.width, data.height, 8, ALPHA_PALETTE, data.width,
+ new byte[data.width * data.height]);
for (int i = 0; i < mask.data.length; i++) {
mask.data[i] = (byte) data.alpha;
}
} else if (data.alphaData != null) {
- mask = new ImageData(data.width, data.height, 8, ALPHA_PALETTE,
- data.width, data.alphaData);
+ mask = new ImageData(data.width, data.height, 8, ALPHA_PALETTE, data.width, data.alphaData);
} else {
- mask = new ImageData(data.width, data.height, 8, ALPHA_PALETTE,
- data.width, new byte[data.width * data.height]);
+ mask = new ImageData(data.width, data.height, 8, ALPHA_PALETTE, data.width,
+ new byte[data.width * data.height]);
for (int i = 0; i < mask.data.length; i++) {
mask.data[i] = (byte) 255;
}
@@ -109,13 +106,11 @@ class DecorationImageBuilder {
return mask;
}
- private static void composite(ImageData dst, ImageData src, int xOffset,
- int yOffset) {
+ private static void composite(ImageData dst, ImageData src, int xOffset, int yOffset) {
if (dst.depth == 1) {
for (int y = 0, dstY = y + yOffset; y < src.height; y++, dstY++) {
for (int x = 0, dstX = x + xOffset; x < src.width; x++, dstX++) {
- if (0 <= dstX && dstX < dst.width && 0 <= dstY
- && dstY < dst.height) {
+ if (0 <= dstX && dstX < dst.width && 0 <= dstY && dstY < dst.height) {
if (src.getPixel(x, y) != 0) {
dst.setPixel(dstX, dstY, 1);
}
@@ -125,8 +120,7 @@ class DecorationImageBuilder {
} else if (dst.depth == 8) {
for (int y = 0, dstY = y + yOffset; y < src.height; y++, dstY++) {
for (int x = 0, dstX = x + xOffset; x < src.width; x++, dstX++) {
- if (0 <= dstX && dstX < dst.width && 0 <= dstY
- && dstY < dst.height) {
+ if (0 <= dstX && dstX < dst.width && 0 <= dstY && dstY < dst.height) {
int srcAlpha = src.getPixel(x, y);
int dstAlpha = dst.getPixel(dstX, dstY);
dstAlpha += (srcAlpha - dstAlpha) * srcAlpha / 255;
@@ -139,22 +133,21 @@ class DecorationImageBuilder {
/**
* Create a composite image by underlaying and overlaying the base image.
+ *
* @param device
* @param base
* @param overlay
* @return Image
*/
- static Image compositeImage(Device device, ImageData base,
- ImageData[] overlay) {
+ static Image compositeImage(Device device, ImageData base, ImageData[] overlay) {
if (base == null)
return null;
- Image image = new Image(device, new ImageData(base.width, base.height,
- 24, new PaletteData(0xff, 0xff00, 0xff00000)));
+ Image image = new Image(device,
+ new ImageData(base.width, base.height, 24, new PaletteData(0xff, 0xff00, 0xff00000)));
GC gc = new GC(image);
ImageData src;
int maskDepth = 0, baseMaskDepth = 0;
- ImageData underlay = src = overlay.length > UNDERLAY ? overlay[UNDERLAY]
- : null;
+ ImageData underlay = src = overlay.length > UNDERLAY ? overlay[UNDERLAY] : null;
if (src != null) {
maskDepth = Math.max(maskDepth, getTransparencyDepth(src));
Image img = new Image(device, src);
@@ -203,13 +196,11 @@ class DecorationImageBuilder {
ImageData mask = null;
switch (maskDepth) {
case 1:
- mask = new ImageData(base.width, base.height, maskDepth,
- BW_PALETTE);
+ mask = new ImageData(base.width, base.height, maskDepth, BW_PALETTE);
break;
case 8:
- mask = new ImageData(base.width, base.height, maskDepth,
- ALPHA_PALETTE, base.width, new byte[base.width
- * base.height]);
+ mask = new ImageData(base.width, base.height, maskDepth, ALPHA_PALETTE, base.width,
+ new byte[base.width * base.height]);
break;
}
src = getTransparency(underlay, maskDepth);
@@ -229,8 +220,7 @@ class DecorationImageBuilder {
composite(mask, src, 0, mask.height - src.height);
src = getTransparency(bottomRight, maskDepth);
if (src != null)
- composite(mask, src, mask.width - src.width, mask.height
- - src.height);
+ composite(mask, src, mask.width - src.width, mask.height - src.height);
switch (maskDepth) {
case 1:
newData.maskData = mask.data;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecorationReference.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecorationReference.java
index 9c414c69828..f675fd53cad 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecorationReference.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecorationReference.java
@@ -19,86 +19,90 @@ import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.internal.WorkbenchMessages;
/**
- * A DecorationReference is a class that holds onto the starting
- * text and image of a decoration.
+ * A DecorationReference is a class that holds onto the starting text and image
+ * of a decoration.
*/
class DecorationReference {
- Object element;
+ Object element;
- Object adaptedElement;
+ Object adaptedElement;
- String undecoratedText;
+ String undecoratedText;
- boolean forceUpdate = false;
+ boolean forceUpdate = false;
IDecorationContext[] contexts;
- DecorationReference(Object object, Object adaptedObject, IDecorationContext context) {
- this.contexts = new IDecorationContext[] { context} ;
+ DecorationReference(Object object, Object adaptedObject, IDecorationContext context) {
+ this.contexts = new IDecorationContext[] { context };
Assert.isNotNull(object);
- element = object;
- this.adaptedElement = adaptedObject;
- }
+ element = object;
+ this.adaptedElement = adaptedObject;
+ }
- /**
- * Returns the adaptedElement.
- * @return Object
- */
- Object getAdaptedElement() {
- return adaptedElement;
- }
+ /**
+ * Returns the adaptedElement.
+ *
+ * @return Object
+ */
+ Object getAdaptedElement() {
+ return adaptedElement;
+ }
- /**
- * Returns the element.
- * @return Object
- */
- Object getElement() {
- return element;
- }
+ /**
+ * Returns the element.
+ *
+ * @return Object
+ */
+ Object getElement() {
+ return element;
+ }
- /**
- * Return true if an update should occur whether or
- * not there is a result.
- * @return boolean
- */
- boolean shouldForceUpdate() {
- return forceUpdate;
- }
+ /**
+ * Return true if an update should occur whether or not there is a result.
+ *
+ * @return boolean
+ */
+ boolean shouldForceUpdate() {
+ return forceUpdate;
+ }
- /**
- * Sets the forceUpdate flag. If true an update
- * occurs whether or not a decoration has resulted.
- * @param forceUpdate The forceUpdate to set
- */
- void setForceUpdate(boolean forceUpdate) {
- this.forceUpdate = forceUpdate;
- }
+ /**
+ * Sets the forceUpdate flag. If true an update occurs whether or not a
+ * decoration has resulted.
+ *
+ * @param forceUpdate The forceUpdate to set
+ */
+ void setForceUpdate(boolean forceUpdate) {
+ this.forceUpdate = forceUpdate;
+ }
- /**
- * Set the text that will be used to label the decoration
- * calculation.
- * @param text
- */
- void setUndecoratedText(String text) {
- undecoratedText = text;
- }
+ /**
+ * Set the text that will be used to label the decoration calculation.
+ *
+ * @param text
+ */
+ void setUndecoratedText(String text) {
+ undecoratedText = text;
+ }
- /**
- * Return the string for the subtask for this element.
- * @return String
- */
- String getSubTask() {
- if (undecoratedText == null) {
+ /**
+ * Return the string for the subtask for this element.
+ *
+ * @return String
+ */
+ String getSubTask() {
+ if (undecoratedText == null) {
return WorkbenchMessages.DecorationReference_EmptyReference;
}
- return NLS.bind(WorkbenchMessages.DecorationScheduler_DecoratingSubtask, undecoratedText );
- }
+ return NLS.bind(WorkbenchMessages.DecorationScheduler_DecoratingSubtask, undecoratedText);
+ }
- /**
- * Returns the decoration context associated with the element
- * being decorated
- * @return the decoration context
- */
+ /**
+ * Returns the decoration context associated with the element being decorated
+ *
+ * @return the decoration context
+ */
IDecorationContext[] getContexts() {
return contexts;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecorationResult.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecorationResult.java
index edcaaaa3a2b..7333efccbf1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecorationResult.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecorationResult.java
@@ -42,8 +42,7 @@ public class DecorationResult {
private Font font;
- DecorationResult(List prefixList, List suffixList,
- ImageDescriptor[] imageDescriptors, Color resultForegroundColor,
+ DecorationResult(List prefixList, List suffixList, ImageDescriptor[] imageDescriptors, Color resultForegroundColor,
Color resultBackgroundColor, Font resultFont) {
prefixes = prefixList;
suffixes = suffixList;
@@ -93,9 +92,9 @@ public class DecorationResult {
}
/**
- * Decorate the String supplied with the prefixes and suffixes. This method
- * is public for use by the test suites and is not intended to be referenced
- * by other workbench internals.
+ * Decorate the String supplied with the prefixes and suffixes. This method is
+ * public for use by the test suites and is not intended to be referenced by
+ * other workbench internals.
*
* @param text
* @return String
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecorationScheduler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecorationScheduler.java
index 4adc3583dd1..d89079e46cd 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecorationScheduler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecorationScheduler.java
@@ -95,16 +95,14 @@ public class DecorationScheduler {
}
/**
- * Decorate the text for the receiver. If it has already been done then
- * return the result, otherwise queue it for decoration.
+ * Decorate the text for the receiver. If it has already been done then return
+ * the result, otherwise queue it for decoration.
*
* @return String
* @param text
* @param element
- * @param adaptedElement
- * The adapted value of element. May be null.
- * @param context
- * the decoration context
+ * @param adaptedElement The adapted value of element. May be null.
+ * @param context the decoration context
*/
public String decorateWithText(String text, Object element, Object adaptedElement, IDecorationContext context) {
@@ -123,15 +121,11 @@ public class DecorationScheduler {
* Queue the element and its adapted value if it has not been already.
*
* @param element
- * @param adaptedElement
- * The adapted value of element. May be null.
- * @param forceUpdate
- * If true then a labelProviderChanged is fired whether
- * decoration occurred or not.
- * @param undecoratedText
- * The original text for the element if it is known.
- * @param context
- * The decoration context
+ * @param adaptedElement The adapted value of element. May be null.
+ * @param forceUpdate If true then a labelProviderChanged is fired whether
+ * decoration occurred or not.
+ * @param undecoratedText The original text for the element if it is known.
+ * @param context The decoration context
*/
synchronized void queueForDecoration(Object element, Object adaptedElement, boolean forceUpdate,
@@ -164,10 +158,8 @@ public class DecorationScheduler {
* @return Image
* @param image
* @param element
- * @param adaptedElement
- * The adapted value of element. May be null.
- * @param context
- * the decoration context
+ * @param adaptedElement The adapted value of element. May be null.
+ * @param context the decoration context
* @param manager
*
*/
@@ -186,13 +178,10 @@ public class DecorationScheduler {
* Return the DecorationResult for element. If there isn't one queue for
* decoration and return <code>null</code>.
*
- * @param element
- * The element to be decorated. If it is <code>null</code>
- * return <code>null</code>.
- * @param adaptedElement
- * It's adapted value.
- * @param context
- * The deocration context
+ * @param element The element to be decorated. If it is <code>null</code>
+ * return <code>null</code>.
+ * @param adaptedElement It's adapted value.
+ * @param context The deocration context
* @return DecorationResult or <code>null</code>
*/
private DecorationResult getResult(Object element, Object adaptedElement, IDecorationContext context) {
@@ -212,8 +201,7 @@ public class DecorationScheduler {
}
- private DecorationResult internalGetResult(Object element,
- IDecorationContext context) {
+ private DecorationResult internalGetResult(Object element, IDecorationContext context) {
Map results = (Map) resultCache.get(context);
if (results != null) {
return (DecorationResult) results.get(element);
@@ -221,8 +209,7 @@ public class DecorationScheduler {
return null;
}
- protected void internalPutResult(Object element,
- IDecorationContext context, DecorationResult result) {
+ protected void internalPutResult(Object element, IDecorationContext context, DecorationResult result) {
Map results = (Map) resultCache.get(context);
if (results == null) {
results = new HashMap();
@@ -327,15 +314,11 @@ public class DecorationScheduler {
/**
* Ensure that a result is cached for the given element and context
*
- * @param element
- * the elements
- * @param force
- * whether an update should be forced
- * @param context
- * the decoration context
+ * @param element the elements
+ * @param force whether an update should be forced
+ * @param context the decoration context
*/
- private void ensureResultCached(Object element, boolean force,
- IDecorationContext context) {
+ private void ensureResultCached(Object element, boolean force, IDecorationContext context) {
boolean elementIsCached = internalGetResult(element, context) != null;
if (elementIsCached) {
synchronized (pendingKey) {
@@ -371,7 +354,6 @@ public class DecorationScheduler {
pendingUpdate.add(element);
}
-
}
}
}
@@ -465,15 +447,15 @@ public class DecorationScheduler {
// someone has already cleared it out.
if (currentIndex == NEEDS_INIT) {
if (hasPendingUpdates()) {
- resetState();
+ resetState();
return Status.OK_STATUS;
}
setUpUpdates();
}
if (listeners.length == 0) {
- resetState();
- return Status.OK_STATUS;
+ resetState();
+ return Status.OK_STATUS;
}
monitor.beginTask(WorkbenchMessages.DecorationScheduler_UpdatingTask, IProgressMonitor.UNKNOWN);
@@ -485,8 +467,7 @@ public class DecorationScheduler {
// If it was removed in the meantime then skip it.
if (!removedListeners.contains(listener)) {
- decoratorManager.fireListener(
- labelProviderChangedEvent, listener);
+ decoratorManager.fireListener(labelProviderChangedEvent, listener);
}
// If it is taking long enough for the user to notice then
@@ -499,7 +480,7 @@ public class DecorationScheduler {
monitor.done();
if (currentIndex >= listeners.length) {
- resetState();
+ resetState();
if (!hasPendingUpdates()) {
decorated();
}
@@ -511,19 +492,19 @@ public class DecorationScheduler {
return Status.OK_STATUS;
}
- /**
- * Clear any cached information.
- */
- private void resetState() {
- currentIndex = NEEDS_INIT;// Reset
- removedListeners.clear();
- // Other decoration requests may have occurred due to
- // updates or we may have timed out updating listeners.
- // Only clear the results if there are none pending.
- if (awaitingDecoration.isEmpty()) {
- resultCache.clear();
- }
- }
+ /**
+ * Clear any cached information.
+ */
+ private void resetState() {
+ currentIndex = NEEDS_INIT;// Reset
+ removedListeners.clear();
+ // Other decoration requests may have occurred due to
+ // updates or we may have timed out updating listeners.
+ // Only clear the results if there are none pending.
+ if (awaitingDecoration.isEmpty()) {
+ resultCache.clear();
+ }
+ }
private void setUpUpdates() {
// Get the elements awaiting update and then
@@ -557,8 +538,7 @@ public class DecorationScheduler {
* Return whether or not there is a decoration for this element ready.
*
* @param element
- * @param context
- * The decoration context
+ * @param context The decoration context
* @return boolean true if the element is ready.
*/
public boolean isDecorationReady(Object element, IDecorationContext context) {
@@ -569,11 +549,10 @@ public class DecorationScheduler {
* Return the background Color for element. If there is no result cue for
* decoration and return null, otherwise return the value in the result.
*
- * @param element
- * The Object to be decorated
+ * @param element The Object to be decorated
* @param adaptedElement
- * @return Color or <code>null</code> if there is no value or if it is has
- * not been decorated yet.
+ * @return Color or <code>null</code> if there is no value or if it is has not
+ * been decorated yet.
*/
public Color getBackgroundColor(Object element, Object adaptedElement) {
DecorationResult decoration = getResult(element, adaptedElement, DecorationContext.DEFAULT_CONTEXT);
@@ -588,11 +567,10 @@ public class DecorationScheduler {
* Return the font for element. If there is no result cue for decoration and
* return null, otherwise return the value in the result.
*
- * @param element
- * The Object to be decorated
+ * @param element The Object to be decorated
* @param adaptedElement
- * @return Font or <code>null</code> if there is no value or if it is has
- * not been decorated yet.
+ * @return Font or <code>null</code> if there is no value or if it is has not
+ * been decorated yet.
*/
public Font getFont(Object element, Object adaptedElement) {
DecorationResult decoration = getResult(element, adaptedElement, DecorationContext.DEFAULT_CONTEXT);
@@ -607,11 +585,10 @@ public class DecorationScheduler {
* Return the foreground Color for element. If there is no result cue for
* decoration and return null, otherwise return the value in the result.
*
- * @param element
- * The Object to be decorated
+ * @param element The Object to be decorated
* @param adaptedElement
- * @return Color or <code>null</code> if there is no value or if it is has
- * not been decorated yet.
+ * @return Color or <code>null</code> if there is no value or if it is has not
+ * been decorated yet.
*/
public Color getForegroundColor(Object element, Object adaptedElement) {
DecorationResult decoration = getResult(element, adaptedElement, DecorationContext.DEFAULT_CONTEXT);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecoratorDefinition.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecoratorDefinition.java
index 91d88df7b8d..c0f5788424d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecoratorDefinition.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecoratorDefinition.java
@@ -23,265 +23,258 @@ import org.eclipse.ui.internal.WorkbenchPlugin;
import org.eclipse.ui.internal.registry.RegistryReader;
/**
- * The DecoratorDefinition is the class that holds onto
- * the label decorator, the name and the name of the
- * class a decorator definition applies to,
+ * The DecoratorDefinition is the class that holds onto the label decorator, the
+ * name and the name of the class a decorator definition applies to,
*/
public abstract class DecoratorDefinition implements IPluginContribution {
- private static final String ATT_LABEL = "label"; //$NON-NLS-1$
+ private static final String ATT_LABEL = "label"; //$NON-NLS-1$
- private static final String ATT_OBJECT_CLASS = "objectClass"; //$NON-NLS-1$
+ private static final String ATT_OBJECT_CLASS = "objectClass"; //$NON-NLS-1$
- static final String CHILD_ENABLEMENT = "enablement"; //$NON-NLS-1$
+ static final String CHILD_ENABLEMENT = "enablement"; //$NON-NLS-1$
- private static final String ATT_ADAPTABLE = "adaptable"; //$NON-NLS-1$
+ private static final String ATT_ADAPTABLE = "adaptable"; //$NON-NLS-1$
- private static final String ATT_ENABLED = "state"; //$NON-NLS-1$
+ private static final String ATT_ENABLED = "state"; //$NON-NLS-1$
- private ActionExpression enablement;
+ private ActionExpression enablement;
- protected boolean enabled;
+ protected boolean enabled;
- private boolean defaultEnabled;
+ private boolean defaultEnabled;
- private String id;
+ private String id;
- protected IConfigurationElement definingElement;
+ protected IConfigurationElement definingElement;
- //A flag that is set if there is an error creating the decorator
- protected boolean labelProviderCreationFailed = false;
+ // A flag that is set if there is an error creating the decorator
+ protected boolean labelProviderCreationFailed = false;
private boolean hasReadEnablement;
static final String ATT_CLASS = "class";//$NON-NLS-1$
- /**
- * Create a new instance of the receiver with the
- * supplied values.
- */
+ /**
+ * Create a new instance of the receiver with the supplied values.
+ */
- DecoratorDefinition(String identifier, IConfigurationElement element) {
+ DecoratorDefinition(String identifier, IConfigurationElement element) {
- this.id = identifier;
- this.definingElement = element;
+ this.id = identifier;
+ this.definingElement = element;
- this.enabled = this.defaultEnabled = Boolean.parseBoolean(element.getAttribute(ATT_ENABLED));
- }
+ this.enabled = this.defaultEnabled = Boolean.parseBoolean(element.getAttribute(ATT_ENABLED));
+ }
- /**
+ /**
* Gets the name.
*
- * @return Returns the label attribute from the decorator contribution, or
- * null if the underlined definition is not valid anymore
+ * @return Returns the label attribute from the decorator contribution, or null
+ * if the underlined definition is not valid anymore
*/
- public String getName() {
+ public String getName() {
if (!definingElement.isValid()) {
crashDisable();
return null;
}
- return definingElement.getAttribute(ATT_LABEL);
- }
+ return definingElement.getAttribute(ATT_LABEL);
+ }
- /**
+ /**
* Returns the description
*
- * @return Returns the label attribute from the decorator contribution, or
- * null if the underlined definition is not valid anymore
+ * @return Returns the label attribute from the decorator contribution, or null
+ * if the underlined definition is not valid anymore
*/
- public String getDescription() {
+ public String getDescription() {
if (!definingElement.isValid()) {
crashDisable();
return null;
}
- return RegistryReader.getDescription(definingElement);
- }
-
- /**
- * Gets the enabled.
- * @return Returns a boolean
- */
- public boolean isEnabled() {
- return enabled;
- }
-
- /**
- * Sets the enabled flag and adds or removes the decorator
- * manager as a listener as appropriate.
- * @param newState The enabled to set
- */
- public void setEnabled(boolean newState) {
-
- //Only refresh if there has been a change
- if (this.enabled != newState) {
- this.enabled = newState;
- try {
- refreshDecorator();
- } catch (CoreException exception) {
- handleCoreException(exception);
- }
-
- }
- }
-
- /**
- * Refresh the current decorator based on our enable
- * state.
- */
- protected abstract void refreshDecorator() throws CoreException;
-
- /**
- * Dispose the decorator instance and remove listeners
- * as appropirate.
- * @param disposedDecorator
- */
- protected void disposeCachedDecorator(IBaseLabelProvider disposedDecorator) {
- disposedDecorator.removeListener(WorkbenchPlugin.getDefault()
- .getDecoratorManager());
- disposedDecorator.dispose();
-
- }
-
- /**
- * Return whether or not this decorator should be
- * applied to adapted types.
- *
- * @return whether or not this decorator should be
- * applied to adapted types
- */
- public boolean isAdaptable() {
+ return RegistryReader.getDescription(definingElement);
+ }
+
+ /**
+ * Gets the enabled.
+ *
+ * @return Returns a boolean
+ */
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ /**
+ * Sets the enabled flag and adds or removes the decorator manager as a listener
+ * as appropriate.
+ *
+ * @param newState The enabled to set
+ */
+ public void setEnabled(boolean newState) {
+
+ // Only refresh if there has been a change
+ if (this.enabled != newState) {
+ this.enabled = newState;
+ try {
+ refreshDecorator();
+ } catch (CoreException exception) {
+ handleCoreException(exception);
+ }
+
+ }
+ }
+
+ /**
+ * Refresh the current decorator based on our enable state.
+ */
+ protected abstract void refreshDecorator() throws CoreException;
+
+ /**
+ * Dispose the decorator instance and remove listeners as appropirate.
+ *
+ * @param disposedDecorator
+ */
+ protected void disposeCachedDecorator(IBaseLabelProvider disposedDecorator) {
+ disposedDecorator.removeListener(WorkbenchPlugin.getDefault().getDecoratorManager());
+ disposedDecorator.dispose();
+
+ }
+
+ /**
+ * Return whether or not this decorator should be applied to adapted types.
+ *
+ * @return whether or not this decorator should be applied to adapted types
+ */
+ public boolean isAdaptable() {
if (!definingElement.isValid()) {
crashDisable();
return false;
}
- return Boolean.parseBoolean(definingElement.getAttribute(ATT_ADAPTABLE));
- }
-
- /**
- * Gets the id.
- * @return Returns a String
- */
- public String getId() {
- return id;
- }
-
- /**
- * Return the default value for this type - this value
- * is the value read from the element description.
- *
- * @return the default value for this type - this value
- * is the value read from the element description
- */
- public boolean getDefaultValue() {
- return defaultEnabled;
- }
-
- /**
- * Returns the enablement.
- * @return ActionExpression
- */
- protected ActionExpression getEnablement() {
- if (!hasReadEnablement) {
- hasReadEnablement = true;
- initializeEnablement();
- }
- return enablement;
- }
-
- /**
- * Initialize the enablement expression for this decorator
- */
- protected void initializeEnablement() {
+ return Boolean.parseBoolean(definingElement.getAttribute(ATT_ADAPTABLE));
+ }
+
+ /**
+ * Gets the id.
+ *
+ * @return Returns a String
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Return the default value for this type - this value is the value read from
+ * the element description.
+ *
+ * @return the default value for this type - this value is the value read from
+ * the element description
+ */
+ public boolean getDefaultValue() {
+ return defaultEnabled;
+ }
+
+ /**
+ * Returns the enablement.
+ *
+ * @return ActionExpression
+ */
+ protected ActionExpression getEnablement() {
+ if (!hasReadEnablement) {
+ hasReadEnablement = true;
+ initializeEnablement();
+ }
+ return enablement;
+ }
+
+ /**
+ * Initialize the enablement expression for this decorator
+ */
+ protected void initializeEnablement() {
if (!definingElement.isValid()) {
crashDisable();
return;
}
- IConfigurationElement[] elements = definingElement.getChildren(CHILD_ENABLEMENT);
- if (elements.length == 0) {
- String className = definingElement.getAttribute(ATT_OBJECT_CLASS);
- if (className != null) {
- enablement = new ActionExpression(ATT_OBJECT_CLASS,
- className);
+ IConfigurationElement[] elements = definingElement.getChildren(CHILD_ENABLEMENT);
+ if (elements.length == 0) {
+ String className = definingElement.getAttribute(ATT_OBJECT_CLASS);
+ if (className != null) {
+ enablement = new ActionExpression(ATT_OBJECT_CLASS, className);
}
- } else {
+ } else {
enablement = new ActionExpression(elements[0]);
}
- }
-
- /**
- * Add a listener for the decorator.If there is an exception
- * then inform the user and disable the receiver.
- * This method should not be called unless a check for
- * isEnabled() has been done first.
- */
- void addListener(ILabelProviderListener listener) {
- try {
- //Internal decorator might be null so be prepared
- IBaseLabelProvider currentDecorator = internalGetLabelProvider();
- if (currentDecorator != null) {
+ }
+
+ /**
+ * Add a listener for the decorator.If there is an exception then inform the
+ * user and disable the receiver. This method should not be called unless a
+ * check for isEnabled() has been done first.
+ */
+ void addListener(ILabelProviderListener listener) {
+ try {
+ // Internal decorator might be null so be prepared
+ IBaseLabelProvider currentDecorator = internalGetLabelProvider();
+ if (currentDecorator != null) {
currentDecorator.addListener(listener);
}
- } catch (CoreException exception) {
- handleCoreException(exception);
- }
- }
-
- /**
- * Return whether or not the decorator registered for element
- * has a label property called property name. If there is an
- * exception disable the receiver and return false.
- * This method should not be called unless a check for
- * isEnabled() has been done first.
- */
- boolean isLabelProperty(Object element, String property) {
- try { //Internal decorator might be null so be prepared
- IBaseLabelProvider currentDecorator = internalGetLabelProvider();
- if (currentDecorator != null) {
+ } catch (CoreException exception) {
+ handleCoreException(exception);
+ }
+ }
+
+ /**
+ * Return whether or not the decorator registered for element has a label
+ * property called property name. If there is an exception disable the receiver
+ * and return false. This method should not be called unless a check for
+ * isEnabled() has been done first.
+ */
+ boolean isLabelProperty(Object element, String property) {
+ try { // Internal decorator might be null so be prepared
+ IBaseLabelProvider currentDecorator = internalGetLabelProvider();
+ if (currentDecorator != null) {
return currentDecorator.isLabelProperty(element, property);
}
- } catch (CoreException exception) {
- handleCoreException(exception);
- return false;
- }
- return false;
- }
-
- /**
- * Gets the label provider and creates it if it does not exist yet.
- * Throws a CoreException if there is a problem
- * creating the labelProvider.
- * This method should not be called unless a check for
- * enabled to be true is done first.
- * @return Returns a ILabelDecorator
- */
- protected abstract IBaseLabelProvider internalGetLabelProvider()
- throws CoreException;
-
- /**
- * A CoreException has occured. Inform the user and disable
- * the receiver.
- */
-
- protected void handleCoreException(CoreException exception) {
-
- //If there is an error then reset the enabling to false
- WorkbenchPlugin.log(exception);
- crashDisable();
- }
-
- /**
- * A crash has occured. Disable the receiver without notification.
- */
- public void crashDisable() {
- this.enabled = false;
- }
-
- /**
- * Return whether or not this is a full or lightweight definition.
- * @return <code>true</code> if this is not a lightweight decorator.
- */
- public abstract boolean isFull();
+ } catch (CoreException exception) {
+ handleCoreException(exception);
+ return false;
+ }
+ return false;
+ }
+
+ /**
+ * Gets the label provider and creates it if it does not exist yet. Throws a
+ * CoreException if there is a problem creating the labelProvider. This method
+ * should not be called unless a check for enabled to be true is done first.
+ *
+ * @return Returns a ILabelDecorator
+ */
+ protected abstract IBaseLabelProvider internalGetLabelProvider() throws CoreException;
+
+ /**
+ * A CoreException has occured. Inform the user and disable the receiver.
+ */
+
+ protected void handleCoreException(CoreException exception) {
+
+ // If there is an error then reset the enabling to false
+ WorkbenchPlugin.log(exception);
+ crashDisable();
+ }
+
+ /**
+ * A crash has occured. Disable the receiver without notification.
+ */
+ public void crashDisable() {
+ this.enabled = false;
+ }
+
+ /**
+ * Return whether or not this is a full or lightweight definition.
+ *
+ * @return <code>true</code> if this is not a lightweight decorator.
+ */
+ public abstract boolean isFull();
/**
* Return the configuration element.
@@ -293,23 +286,24 @@ public abstract class DecoratorDefinition implements IPluginContribution {
return definingElement;
}
- /**
- * Return whether the decorator is applicable to the given element
- * @param element the element to be decorated
- * @return whether the decorator w=should be applied to the element
- */
- public boolean isEnabledFor(Object element) {
- if(isEnabled()){
- ActionExpression expression = getEnablement();
- if(expression != null) {
+ /**
+ * Return whether the decorator is applicable to the given element
+ *
+ * @param element the element to be decorated
+ * @return whether the decorator w=should be applied to the element
+ */
+ public boolean isEnabledFor(Object element) {
+ if (isEnabled()) {
+ ActionExpression expression = getEnablement();
+ if (expression != null) {
return expression.isEnabledFor(element);
}
// Always on if no expression and is still enabled
return isEnabled();
- }
- return false;
+ }
+ return false;
- }
+ }
@Override
public String getPluginId() {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecoratorManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecoratorManager.java
index eba0980608f..45ce53445ef 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecoratorManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecoratorManager.java
@@ -68,11 +68,10 @@ import org.eclipse.ui.progress.WorkbenchJob;
*
* @since 2.0
*/
-public class DecoratorManager implements ILabelProviderListener,
- IDecoratorManager, IExtensionChangeHandler {
+public class DecoratorManager implements ILabelProviderListener, IDecoratorManager, IExtensionChangeHandler {
- private static String EXTENSIONPOINT_UNIQUE_ID = WorkbenchPlugin.PI_WORKBENCH
- + "." + IWorkbenchRegistryConstants.PL_DECORATORS; //$NON-NLS-1$
+ private static String EXTENSIONPOINT_UNIQUE_ID = WorkbenchPlugin.PI_WORKBENCH + "." //$NON-NLS-1$
+ + IWorkbenchRegistryConstants.PL_DECORATORS;
/**
* The family for the decorate job.
@@ -106,22 +105,22 @@ public class DecoratorManager implements ILabelProviderListener,
private LocalResourceManager resourceManager;
-
/**
- * ManagedWorkbenchLabelDecorator is the internal LabelDecorator
- * passed as result of calls to {@link IDecoratorManager#getLabelDecorator()}
+ * ManagedWorkbenchLabelDecorator is the internal LabelDecorator passed as
+ * result of calls to {@link IDecoratorManager#getLabelDecorator()}
+ *
* @since 3.4
*
*/
private static class ManagedWorkbenchLabelDecorator extends LabelDecorator
- implements ILabelDecorator, IDelayedLabelDecorator,
- IColorDecorator, IFontDecorator {
+ implements ILabelDecorator, IDelayedLabelDecorator, IColorDecorator, IFontDecorator {
private final DecoratorManager decoratorManager;
private LocalResourceManager resourceManager;
/**
* Create a new instance of the receiver that supports decoratorManager
+ *
* @param decoratorManager
*/
public ManagedWorkbenchLabelDecorator(DecoratorManager decoratorManager) {
@@ -131,40 +130,34 @@ public class DecoratorManager implements ILabelProviderListener,
/**
* Return a resource manager local to the receiver.
+ *
* @return {@link LocalResourceManager}
*/
private LocalResourceManager getResourceManager() {
if (resourceManager == null) {
- resourceManager = new LocalResourceManager(decoratorManager
- .getResourceManager());
+ resourceManager = new LocalResourceManager(decoratorManager.getResourceManager());
}
return resourceManager;
}
@Override
- public Image decorateImage(Image image, Object element,
- IDecorationContext context) {
- return decoratorManager.decorateImage(image, element, context,
- getResourceManager());
+ public Image decorateImage(Image image, Object element, IDecorationContext context) {
+ return decoratorManager.decorateImage(image, element, context, getResourceManager());
}
@Override
- public String decorateText(String text, Object element,
- IDecorationContext context) {
+ public String decorateText(String text, Object element, IDecorationContext context) {
return decoratorManager.decorateText(text, element, context);
}
@Override
- public boolean prepareDecoration(Object element, String originalText,
- IDecorationContext context) {
- return decoratorManager.prepareDecoration(element, originalText,
- context);
+ public boolean prepareDecoration(Object element, String originalText, IDecorationContext context) {
+ return decoratorManager.prepareDecoration(element, originalText, context);
}
@Override
public boolean prepareDecoration(Object element, String originalText) {
- return prepareDecoration(element, originalText,
- DecorationContext.DEFAULT_CONTEXT);
+ return prepareDecoration(element, originalText, DecorationContext.DEFAULT_CONTEXT);
}
@Override
@@ -184,14 +177,12 @@ public class DecoratorManager implements ILabelProviderListener,
@Override
public Image decorateImage(Image image, Object element) {
- return decorateImage(image, element,
- DecorationContext.DEFAULT_CONTEXT);
+ return decorateImage(image, element, DecorationContext.DEFAULT_CONTEXT);
}
@Override
public String decorateText(String text, Object element) {
- return decorateText(text, element,
- DecorationContext.DEFAULT_CONTEXT);
+ return decorateText(text, element, DecorationContext.DEFAULT_CONTEXT);
}
@Override
@@ -226,10 +217,8 @@ public class DecoratorManager implements ILabelProviderListener,
public DecoratorManager() {
scheduler = new DecorationScheduler(this);
- IExtensionTracker tracker = PlatformUI.getWorkbench()
- .getExtensionTracker();
- tracker.registerHandler(this, ExtensionTracker
- .createExtensionPointFilter(getExtensionPointFilter()));
+ IExtensionTracker tracker = PlatformUI.getWorkbench().getExtensionTracker();
+ tracker.registerHandler(this, ExtensionTracker.createExtensionPointFilter(getExtensionPointFilter()));
resourceManager = null;
}
@@ -239,25 +228,21 @@ public class DecoratorManager implements ILabelProviderListener,
*/
private void initializeDecoratorDefinitions() {
DecoratorRegistryReader reader = new DecoratorRegistryReader();
- Collection values = reader
- .readRegistry(Platform.getExtensionRegistry());
+ Collection values = reader.readRegistry(Platform.getExtensionRegistry());
ArrayList full = new ArrayList();
ArrayList lightweight = new ArrayList();
Iterator allDefinitions = values.iterator();
- IExtensionTracker configurationElementTracker = PlatformUI
- .getWorkbench().getExtensionTracker();
+ IExtensionTracker configurationElementTracker = PlatformUI.getWorkbench().getExtensionTracker();
while (allDefinitions.hasNext()) {
- DecoratorDefinition nextDefinition = (DecoratorDefinition) allDefinitions
- .next();
+ DecoratorDefinition nextDefinition = (DecoratorDefinition) allDefinitions.next();
if (nextDefinition.isFull()) {
full.add(nextDefinition);
} else {
lightweight.add(nextDefinition);
}
- configurationElementTracker.registerObject(nextDefinition
- .getConfigurationElement().getDeclaringExtension(),
+ configurationElementTracker.registerObject(nextDefinition.getConfigurationElement().getDeclaringExtension(),
nextDefinition, IExtensionTracker.REF_WEAK);
}
@@ -268,8 +253,7 @@ public class DecoratorManager implements ILabelProviderListener,
.size()];
lightweight.toArray(lightweightDefinitions);
- lightweightManager = new LightweightDecoratorManager(
- lightweightDefinitions);
+ lightweightManager = new LightweightDecoratorManager(lightweightDefinitions);
applyDecoratorsPreference();
}
@@ -277,8 +261,7 @@ public class DecoratorManager implements ILabelProviderListener,
/**
* For dynamic UI
*
- * @param definition
- * the definition to add
+ * @param definition the definition to add
* @since 3.0
*/
public void addDecorator(DecoratorDefinition definition) {
@@ -286,25 +269,19 @@ public class DecoratorManager implements ILabelProviderListener,
if (getFullDecoratorDefinition(definition.getId()) == null) {
FullDecoratorDefinition[] oldDefs = getFullDefinitions();
fullDefinitions = new FullDecoratorDefinition[fullDefinitions.length + 1];
- System
- .arraycopy(oldDefs, 0, fullDefinitions, 0,
- oldDefs.length);
+ System.arraycopy(oldDefs, 0, fullDefinitions, 0, oldDefs.length);
fullDefinitions[oldDefs.length] = (FullDecoratorDefinition) definition;
clearCaches();
updateForEnablementChange();
}
} else {
- if (getLightweightManager().addDecorator(
- (LightweightDecoratorDefinition) definition)) {
+ if (getLightweightManager().addDecorator((LightweightDecoratorDefinition) definition)) {
clearCaches();
updateForEnablementChange();
}
}
- ((Workbench) PlatformUI.getWorkbench()).getExtensionTracker()
- .registerObject(
- definition.getConfigurationElement()
- .getDeclaringExtension(), definition,
- IExtensionTracker.REF_WEAK);
+ ((Workbench) PlatformUI.getWorkbench()).getExtensionTracker().registerObject(
+ definition.getConfigurationElement().getDeclaringExtension(), definition, IExtensionTracker.REF_WEAK);
}
/**
@@ -312,13 +289,11 @@ public class DecoratorManager implements ILabelProviderListener,
* calculate it from the enabledDefinitions and update the cache.
*
* @return Collection of DecoratorDefinition.
- * @param element
- * The element being tested.
- * @param enabledDefinitions
- * The definitions currently defined for this decorator.
+ * @param element The element being tested.
+ * @param enabledDefinitions The definitions currently defined for this
+ * decorator.
*/
- static Collection getDecoratorsFor(Object element,
- DecoratorDefinition[] enabledDefinitions) {
+ static Collection getDecoratorsFor(Object element, DecoratorDefinition[] enabledDefinitions) {
ArrayList decorators = new ArrayList();
@@ -364,13 +339,10 @@ public class DecoratorManager implements ILabelProviderListener,
/**
* Inform all of the listeners that require an update
*
- * @param listener
- * The listener we are updating.
- * @param event
- * the event with the update details
+ * @param listener The listener we are updating.
+ * @param event the event with the update details
*/
- void fireListener(final LabelProviderChangedEvent event,
- final ILabelProviderListener listener) {
+ void fireListener(final LabelProviderChangedEvent event, final ILabelProviderListener listener) {
SafeRunner.run(new SafeRunnable() {
@Override
public void run() {
@@ -383,8 +355,7 @@ public class DecoratorManager implements ILabelProviderListener,
/**
* Inform all of the listeners that require an update
*
- * @param event
- * the event with the update details
+ * @param event the event with the update details
*/
void fireListeners(final LabelProviderChangedEvent event) {
for (final ILabelProviderListener l : listeners) {
@@ -401,8 +372,7 @@ public class DecoratorManager implements ILabelProviderListener,
* Fire any listeners from the UIThread. Used for cases where this may be
* invoked outside of the UI by the public API.
*
- * @param event
- * the event with the update details
+ * @param event the event with the update details
*/
void fireListenersInUIThread(final LabelProviderChangedEvent event) {
@@ -412,14 +382,12 @@ public class DecoratorManager implements ILabelProviderListener,
}
// Only bother with the job if in the UI Thread
- if (Thread.currentThread() == PlatformUI.getWorkbench().getDisplay()
- .getThread()) {
+ if (Thread.currentThread() == PlatformUI.getWorkbench().getDisplay().getThread()) {
fireListeners(event);
return;
}
- WorkbenchJob updateJob = new WorkbenchJob(
- WorkbenchMessages.DecorationScheduler_UpdateJobName) {
+ WorkbenchJob updateJob = new WorkbenchJob(WorkbenchMessages.DecorationScheduler_UpdateJobName) {
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
fireListeners(event);
@@ -436,25 +404,22 @@ public class DecoratorManager implements ILabelProviderListener,
}
-
/**
* Decorate the text in the receiver using the context.
+ *
* @param text
* @param element
* @param context
* @return String
* @see LabelDecorator#decorateText(String, Object, IDecorationContext)
*/
- public String decorateText(String text, Object element,
- IDecorationContext context) {
+ public String decorateText(String text, Object element, IDecorationContext context) {
// Get any adaptations to IResource
Object adapted = getResourceAdapter(element);
- String result = scheduler.decorateWithText(text, element, adapted,
- context);
+ String result = scheduler.decorateWithText(text, element, adapted, context);
for (FullDecoratorDefinition decorator : getDecoratorsFor(element)) {
if (decorator.isEnabledFor(element)) {
- String newResult = safeDecorateText(element, result,
- decorator);
+ String newResult = safeDecorateText(element, result, decorator);
if (newResult != null) {
result = newResult;
}
@@ -463,10 +428,8 @@ public class DecoratorManager implements ILabelProviderListener,
if (adapted != null) {
for (FullDecoratorDefinition decorator : getDecoratorsFor(adapted)) {
- if (decorator.isAdaptable()
- && decorator.isEnabledFor(adapted)) {
- String newResult = safeDecorateText(adapted, result,
- decorator);
+ if (decorator.isAdaptable() && decorator.isEnabledFor(adapted)) {
+ String newResult = safeDecorateText(adapted, result, decorator);
if (newResult != null) {
result = newResult;
}
@@ -477,7 +440,6 @@ public class DecoratorManager implements ILabelProviderListener,
return result;
}
-
@Override
public String decorateText(String text, Object element) {
return decorateText(text, element, DecorationContext.DEFAULT_CONTEXT);
@@ -486,16 +448,12 @@ public class DecoratorManager implements ILabelProviderListener,
/**
* Decorate the text in a SafeRunnable.
*
- * @param element
- * The element we are decorating
- * @param start
- * The currently decorated String
- * @param decorator
- * The decorator to run.
+ * @param element The element we are decorating
+ * @param start The currently decorated String
+ * @param decorator The decorator to run.
* @return String
*/
- private String safeDecorateText(Object element, String start,
- FullDecoratorDefinition decorator) {
+ private String safeDecorateText(Object element, String start, FullDecoratorDefinition decorator) {
fullTextRunnable.setValues(start, element, decorator);
SafeRunner.run(fullTextRunnable);
String newResult = fullTextRunnable.getResult();
@@ -505,6 +463,7 @@ public class DecoratorManager implements ILabelProviderListener,
/**
* Decorate the image within the context. Allocate any new images in
* localResourceManager
+ *
* @param image
* @param element
* @param context
@@ -512,16 +471,14 @@ public class DecoratorManager implements ILabelProviderListener,
* @return Image
* @see LabelDecorator#decorateImage(Image, Object, IDecorationContext)
*/
- public Image decorateImage(Image image, Object element,
- IDecorationContext context, ResourceManager localResourceManager) {
+ public Image decorateImage(Image image, Object element, IDecorationContext context,
+ ResourceManager localResourceManager) {
Object adapted = getResourceAdapter(element);
- Image result = scheduler.decorateWithOverlays(image, element, adapted,
- context, localResourceManager);
+ Image result = scheduler.decorateWithOverlays(image, element, adapted, context, localResourceManager);
for (FullDecoratorDefinition decorator : getDecoratorsFor(element)) {
if (decorator.isEnabledFor(element)) {
- Image newResult = safeDecorateImage(element, result,
- decorator);
+ Image newResult = safeDecorateImage(element, result, decorator);
if (newResult != null) {
result = newResult;
}
@@ -532,10 +489,8 @@ public class DecoratorManager implements ILabelProviderListener,
if (adapted != null) {
for (FullDecoratorDefinition decorator : getDecoratorsFor(adapted)) {
- if (decorator.isAdaptable()
- && decorator.isEnabledFor(adapted)) {
- Image newResult = safeDecorateImage(adapted, result,
- decorator);
+ if (decorator.isAdaptable() && decorator.isEnabledFor(adapted)) {
+ Image newResult = safeDecorateImage(adapted, result, decorator);
if (newResult != null) {
result = newResult;
}
@@ -548,23 +503,18 @@ public class DecoratorManager implements ILabelProviderListener,
@Override
public Image decorateImage(Image image, Object element) {
- return decorateImage(image, element, DecorationContext.DEFAULT_CONTEXT,
- getResourceManager());
+ return decorateImage(image, element, DecorationContext.DEFAULT_CONTEXT, getResourceManager());
}
/**
* Decorate the image in a SafeRunnable.
*
- * @param element
- * The element we are decorating
- * @param start
- * The currently decorated Image
- * @param decorator
- * The decorator to run.
+ * @param element The element we are decorating
+ * @param start The currently decorated Image
+ * @param decorator The decorator to run.
* @return Image
*/
- private Image safeDecorateImage(Object element, Image start,
- FullDecoratorDefinition decorator) {
+ private Image safeDecorateImage(Object element, Image start, FullDecoratorDefinition decorator) {
fullImageRunnable.setValues(start, element, decorator);
SafeRunner.run(fullImageRunnable);
Image newResult = fullImageRunnable.getResult();
@@ -579,8 +529,7 @@ public class DecoratorManager implements ILabelProviderListener,
* @return Object or <code>null</code>.
*/
private Object getResourceAdapter(Object element) {
- Object adapted = LegacyResourceSupport
- .getAdaptedContributorResource(element);
+ Object adapted = LegacyResourceSupport.getAdaptedContributorResource(element);
if (adapted != element) {
return adapted; // Avoid applying decorator twice
}
@@ -598,19 +547,17 @@ public class DecoratorManager implements ILabelProviderListener,
/**
* Return whether or not the decorator registered for element has a label
- * property called property name. Check for an adapted resource if
- * checkAdapted is true.
+ * property called property name. Check for an adapted resource if checkAdapted
+ * is true.
*
* @param element
* @param property
* @param checkAdapted
- * @return boolean <code>true</code> if there is a label property for
- * element or its adapted value
+ * @return boolean <code>true</code> if there is a label property for element or
+ * its adapted value
*/
- public boolean isLabelProperty(Object element, String property,
- boolean checkAdapted) {
- boolean fullCheck = isLabelProperty(element, property,
- getDecoratorsFor(element));
+ public boolean isLabelProperty(Object element, String property, boolean checkAdapted) {
+ boolean fullCheck = isLabelProperty(element, property, getDecoratorsFor(element));
if (fullCheck) {
return fullCheck;
@@ -630,23 +577,19 @@ public class DecoratorManager implements ILabelProviderListener,
return false;
}
- fullCheck = isLabelProperty(adapted, property,
- getDecoratorsFor(adapted));
+ fullCheck = isLabelProperty(adapted, property, getDecoratorsFor(adapted));
if (fullCheck) {
return fullCheck;
}
- return isLabelProperty(adapted, property, lightweightManager
- .getDecoratorsFor(adapted));
+ return isLabelProperty(adapted, property, lightweightManager.getDecoratorsFor(adapted));
}
return false;
}
- private boolean isLabelProperty(Object element, String property,
- DecoratorDefinition[] decorators) {
+ private boolean isLabelProperty(Object element, String property, DecoratorDefinition[] decorators) {
for (DecoratorDefinition decorator : decorators) {
- if (decorator.isEnabledFor(element)
- && decorator.isLabelProperty(element, property)) {
+ if (decorator.isEnabledFor(element) && decorator.isLabelProperty(element, property)) {
return true;
}
}
@@ -673,8 +616,7 @@ public class DecoratorManager implements ILabelProviderListener,
result.add(element);
}
}
- FullDecoratorDefinition[] returnArray = new FullDecoratorDefinition[result
- .size()];
+ FullDecoratorDefinition[] returnArray = new FullDecoratorDefinition[result.size()];
result.toArray(returnArray);
return returnArray;
}
@@ -688,8 +630,8 @@ public class DecoratorManager implements ILabelProviderListener,
}
/**
- * Clear the caches in the manager. This is required to avoid updates that
- * may occur due to changes in enablement.
+ * Clear the caches in the manager. This is required to avoid updates that may
+ * occur due to changes in enablement.
*/
public void clearCaches() {
getLightweightManager().reset();
@@ -713,14 +655,11 @@ public class DecoratorManager implements ILabelProviderListener,
* @return DecoratorDefinition[]
*/
public DecoratorDefinition[] getAllDecoratorDefinitions() {
- LightweightDecoratorDefinition[] lightweightDefinitions = getLightweightManager()
- .getDefinitions();
+ LightweightDecoratorDefinition[] lightweightDefinitions = getLightweightManager().getDefinitions();
DecoratorDefinition[] returnValue = new DecoratorDefinition[fullDefinitions.length
+ lightweightDefinitions.length];
- System.arraycopy(fullDefinitions, 0, returnValue, 0,
- fullDefinitions.length);
- System.arraycopy(lightweightDefinitions, 0, returnValue,
- fullDefinitions.length, lightweightDefinitions.length);
+ System.arraycopy(fullDefinitions, 0, returnValue, 0, fullDefinitions.length);
+ System.arraycopy(lightweightDefinitions, 0, returnValue, fullDefinitions.length, lightweightDefinitions.length);
return returnValue;
}
@@ -741,8 +680,7 @@ public class DecoratorManager implements ILabelProviderListener,
Object adapted = getResourceAdapter(element);
// Force an update in case full decorators are the only ones
// enabled
- scheduler.queueForDecoration(element, adapted, true, null,
- DecorationContext.DEFAULT_CONTEXT);
+ scheduler.queueForDecoration(element, adapted, true, null, DecorationContext.DEFAULT_CONTEXT);
}
}
}
@@ -753,16 +691,14 @@ public class DecoratorManager implements ILabelProviderListener,
private void writeDecoratorsPreference() {
StringBuilder enabledIds = new StringBuilder();
writeDecoratorsPreference(enabledIds, getFullDefinitions());
- writeDecoratorsPreference(enabledIds, getLightweightManager()
- .getDefinitions());
+ writeDecoratorsPreference(enabledIds, getLightweightManager().getDefinitions());
- WorkbenchPlugin.getDefault().getPreferenceStore().setValue(
- IPreferenceConstants.ENABLED_DECORATORS, enabledIds.toString());
+ WorkbenchPlugin.getDefault().getPreferenceStore().setValue(IPreferenceConstants.ENABLED_DECORATORS,
+ enabledIds.toString());
PrefUtil.savePrefs();
}
- private void writeDecoratorsPreference(StringBuilder enabledIds,
- DecoratorDefinition[] definitions) {
+ private void writeDecoratorsPreference(StringBuilder enabledIds, DecoratorDefinition[] definitions) {
for (DecoratorDefinition definition : definitions) {
enabledIds.append(definition.getId());
enabledIds.append(VALUE_SEPARATOR);
@@ -777,25 +713,22 @@ public class DecoratorManager implements ILabelProviderListener,
}
/**
- * Get the currently enabled decorators in preference store and set the
- * state of the current definitions accordingly.
+ * Get the currently enabled decorators in preference store and set the state of
+ * the current definitions accordingly.
*/
public void applyDecoratorsPreference() {
- String preferenceValue = WorkbenchPlugin.getDefault()
- .getPreferenceStore().getString(
- IPreferenceConstants.ENABLED_DECORATORS);
+ String preferenceValue = WorkbenchPlugin.getDefault().getPreferenceStore()
+ .getString(IPreferenceConstants.ENABLED_DECORATORS);
- StringTokenizer tokenizer = new StringTokenizer(preferenceValue,
- PREFERENCE_SEPARATOR);
+ StringTokenizer tokenizer = new StringTokenizer(preferenceValue, PREFERENCE_SEPARATOR);
Set enabledIds = new HashSet();
Set disabledIds = new HashSet();
while (tokenizer.hasMoreTokens()) {
String nextValuePair = tokenizer.nextToken();
// Strip out the true or false to get the id
- String id = nextValuePair.substring(0, nextValuePair
- .indexOf(VALUE_SEPARATOR));
+ String id = nextValuePair.substring(0, nextValuePair.indexOf(VALUE_SEPARATOR));
if (nextValuePair.endsWith(P_TRUE)) {
enabledIds.add(id);
} else {
@@ -814,8 +747,7 @@ public class DecoratorManager implements ILabelProviderListener,
}
}
- LightweightDecoratorDefinition[] lightweightDefinitions = getLightweightManager()
- .getDefinitions();
+ LightweightDecoratorDefinition[] lightweightDefinitions = getLightweightManager().getDefinitions();
for (LightweightDecoratorDefinition lightweightDefinition : lightweightDefinitions) {
String id = lightweightDefinition.getId();
if (enabledIds.contains(id)) {
@@ -874,8 +806,8 @@ public class DecoratorManager implements ILabelProviderListener,
*/
public ResourceManager getResourceManager() {
if (resourceManager == null) {
- resourceManager = new LocalResourceManager(JFaceResources
- .getResources(PlatformUI.getWorkbench().getDisplay()));
+ resourceManager = new LocalResourceManager(
+ JFaceResources.getResources(PlatformUI.getWorkbench().getDisplay()));
}
return resourceManager;
}
@@ -931,10 +863,8 @@ public class DecoratorManager implements ILabelProviderListener,
* @see IDecoratorManager#getLightweightLabelDecorator(String)
*/
@Override
- public ILightweightLabelDecorator getLightweightLabelDecorator(
- String decoratorId) {
- LightweightDecoratorDefinition definition = getLightweightManager()
- .getDecoratorDefinition(decoratorId);
+ public ILightweightLabelDecorator getLightweightLabelDecorator(String decoratorId) {
+ LightweightDecoratorDefinition definition = getLightweightManager().getDecoratorDefinition(decoratorId);
// Do not return for a disabled decorator
if (definition != null && definition.isEnabled()) {
return definition.getDecorator();
@@ -946,8 +876,7 @@ public class DecoratorManager implements ILabelProviderListener,
* Get the DecoratorDefinition with the supplied id
*
* @return DecoratorDefinition or <code>null</code> if it is not found
- * @param decoratorId
- * String
+ * @param decoratorId String
*/
private DecoratorDefinition getDecoratorDefinition(String decoratorId) {
DecoratorDefinition returnValue = getFullDecoratorDefinition(decoratorId);
@@ -961,11 +890,9 @@ public class DecoratorManager implements ILabelProviderListener,
* Get the FullDecoratorDefinition with the supplied id
*
* @return FullDecoratorDefinition or <code>null</code> if it is not found
- * @param decoratorId
- * the id
+ * @param decoratorId the id
*/
- private FullDecoratorDefinition getFullDecoratorDefinition(
- String decoratorId) {
+ private FullDecoratorDefinition getFullDecoratorDefinition(String decoratorId) {
int idx = getFullDecoratorDefinitionIdx(decoratorId);
if (idx != -1) {
return getFullDefinitions()[idx];
@@ -976,8 +903,7 @@ public class DecoratorManager implements ILabelProviderListener,
/**
* Return the index of the definition in the array.
*
- * @param decoratorId
- * the id
+ * @param decoratorId the id
* @return the index of the definition in the array or <code>-1</code>
* @since 3.1
*/
@@ -994,8 +920,7 @@ public class DecoratorManager implements ILabelProviderListener,
/**
* Get the full decorator definitions registered for elements of this type.
*
- * @param element
- * The element to look up
+ * @param element The element to look up
* @return FullDecoratorDefinition[]
*/
private FullDecoratorDefinition[] getDecoratorsFor(Object element) {
@@ -1004,8 +929,7 @@ public class DecoratorManager implements ILabelProviderListener,
return EMPTY_FULL_DEF;
}
- Collection decorators = getDecoratorsFor(element,
- enabledFullDefinitions());
+ Collection decorators = getDecoratorsFor(element, enabledFullDefinitions());
FullDecoratorDefinition[] decoratorArray = EMPTY_FULL_DEF;
if (decorators.size() > 0) {
decoratorArray = new FullDecoratorDefinition[decorators.size()];
@@ -1016,8 +940,8 @@ public class DecoratorManager implements ILabelProviderListener,
}
/**
- * Returns the lightweightManager. This method is public for use by test
- * cases. No other classes outside of this package should use this method.
+ * Returns the lightweightManager. This method is public for use by test cases.
+ * No other classes outside of this package should use this method.
*
* @return LightweightDecoratorManager
*/
@@ -1042,12 +966,10 @@ public class DecoratorManager implements ILabelProviderListener,
}
- public boolean prepareDecoration(Object element, String originalText,
- IDecorationContext context) {
+ public boolean prepareDecoration(Object element, String originalText, IDecorationContext context) {
// Check if there is a decoration ready or if there is no lightweight
// decorators to be applied
- if (scheduler.isDecorationReady(element, context)
- || !getLightweightManager().hasEnabledDefinitions()) {
+ if (scheduler.isDecorationReady(element, context) || !getLightweightManager().hasEnabledDefinitions()) {
return true;
}
@@ -1059,8 +981,7 @@ public class DecoratorManager implements ILabelProviderListener,
}
// Queue the decoration.
- scheduler.queueForDecoration(element, getResourceAdapter(element),
- force, originalText, context);
+ scheduler.queueForDecoration(element, getResourceAdapter(element), force, originalText, context);
// If we are going to force an update just let that happen later.
return !force;
@@ -1068,8 +989,7 @@ public class DecoratorManager implements ILabelProviderListener,
@Override
public boolean prepareDecoration(Object element, String originalText) {
- return prepareDecoration(element, originalText,
- DecorationContext.DEFAULT_CONTEXT);
+ return prepareDecoration(element, originalText, DecorationContext.DEFAULT_CONTEXT);
}
public Font decorateFont(Object element) {
@@ -1077,13 +997,11 @@ public class DecoratorManager implements ILabelProviderListener,
}
public Color decorateBackground(Object element) {
- return scheduler.getBackgroundColor(element,
- getResourceAdapter(element));
+ return scheduler.getBackgroundColor(element, getResourceAdapter(element));
}
public Color decorateForeground(Object element) {
- return scheduler.getForegroundColor(element,
- getResourceAdapter(element));
+ return scheduler.getForegroundColor(element, getResourceAdapter(element));
}
/**
@@ -1099,13 +1017,11 @@ public class DecoratorManager implements ILabelProviderListener,
}
private IExtensionPoint getExtensionPointFilter() {
- return Platform.getExtensionRegistry().getExtensionPoint(
- EXTENSIONPOINT_UNIQUE_ID);
+ return Platform.getExtensionRegistry().getExtensionPoint(EXTENSIONPOINT_UNIQUE_ID);
}
@Override
- public void addExtension(IExtensionTracker tracker,
- IExtension addedExtension) {
+ public void addExtension(IExtensionTracker tracker, IExtension addedExtension) {
for (IConfigurationElement addedElement : addedExtension.getConfigurationElements()) {
DecoratorRegistryReader reader = new DecoratorRegistryReader();
reader.readElement(addedElement);
@@ -1126,16 +1042,12 @@ public class DecoratorManager implements ILabelProviderListener,
int idx = getFullDecoratorDefinitionIdx(definition.getId());
if (idx != -1) {
FullDecoratorDefinition[] oldDefs = getFullDefinitions();
- Util
- .arrayCopyWithRemoval(
- oldDefs,
- fullDefinitions = new FullDecoratorDefinition[fullDefinitions.length - 1],
- idx);
+ Util.arrayCopyWithRemoval(oldDefs,
+ fullDefinitions = new FullDecoratorDefinition[fullDefinitions.length - 1], idx);
shouldClear = true;
}
} else {
- shouldClear |= getLightweightManager().removeDecorator(
- (LightweightDecoratorDefinition) definition);
+ shouldClear |= getLightweightManager().removeDecorator((LightweightDecoratorDefinition) definition);
}
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecoratorRegistryReader.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecoratorRegistryReader.java
index e71f3ba3b20..6f082962cda 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecoratorRegistryReader.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecoratorRegistryReader.java
@@ -24,100 +24,101 @@ import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants;
import org.eclipse.ui.internal.registry.RegistryReader;
/**
- * The DecoratorRegistryReader is the class that reads the
- * decorator descriptions from the registry
+ * The DecoratorRegistryReader is the class that reads the decorator
+ * descriptions from the registry
*/
public class DecoratorRegistryReader extends RegistryReader {
- //The registry values are the ones read from the registry
- private Collection values = new ArrayList();
+ // The registry values are the ones read from the registry
+ private Collection values = new ArrayList();
- private Collection ids = new HashSet();
+ private Collection ids = new HashSet();
- /**
- * Constructor for DecoratorRegistryReader.
- */
- public DecoratorRegistryReader() {
- super();
- }
+ /**
+ * Constructor for DecoratorRegistryReader.
+ */
+ public DecoratorRegistryReader() {
+ super();
+ }
- /*
- * @see RegistryReader#readElement(IConfigurationElement)
- */
- @Override
+ /*
+ * @see RegistryReader#readElement(IConfigurationElement)
+ */
+ @Override
public boolean readElement(IConfigurationElement element) {
- DecoratorDefinition desc = getDecoratorDefinition(element);
+ DecoratorDefinition desc = getDecoratorDefinition(element);
- if (desc == null) {
+ if (desc == null) {
return false;
}
- values.add(desc);
-
- return true;
-
- }
-
- /**
- * Return the DecoratorDefinition defined by element or <code>null</code>
- * if it cannot be determined.
- * @param element
- * @return DecoratorDefinition
- */
- DecoratorDefinition getDecoratorDefinition(IConfigurationElement element){
-
- String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
- if (ids.contains(id)) {
- logDuplicateId(element);
- return null;
- }
- ids.add(id);
-
- boolean noClass = element.getAttribute(DecoratorDefinition.ATT_CLASS) == null;
-
- //Lightweight or Full? It is lightweight if it is declared lightweight or if there is no class
- if (Boolean.parseBoolean(element.getAttribute(IWorkbenchRegistryConstants.ATT_LIGHTWEIGHT)) || noClass) {
-
- String iconPath = element.getAttribute(LightweightDecoratorDefinition.ATT_ICON);
-
- if (noClass && iconPath == null) {
- logMissingElement(element, LightweightDecoratorDefinition.ATT_ICON);
- return null;
- }
-
- return new LightweightDecoratorDefinition(id, element);
- }
- return new FullDecoratorDefinition(id, element);
-
- }
-
- /**
- * Read the decorator extensions within a registry and set
- * up the registry values.
- */
- Collection readRegistry(IExtensionRegistry in) {
- values.clear();
- ids.clear();
- readRegistry(in, PlatformUI.PLUGIN_ID,
- IWorkbenchRegistryConstants.PL_DECORATORS);
- return values;
- }
-
- /**
- * Return the values.
- *
- * @return the values
- */
- public Collection getValues() {
- return values;
- }
-
- /**
- * Logs a registry error when the configuration element is unknown.
- */
- protected void logDuplicateId(IConfigurationElement element) {
- logError(element, "Duplicate id found: " + element.getAttribute(IWorkbenchRegistryConstants.ATT_ID));//$NON-NLS-1$
- }
+ values.add(desc);
+
+ return true;
+
+ }
+
+ /**
+ * Return the DecoratorDefinition defined by element or <code>null</code> if it
+ * cannot be determined.
+ *
+ * @param element
+ * @return DecoratorDefinition
+ */
+ DecoratorDefinition getDecoratorDefinition(IConfigurationElement element) {
+
+ String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
+ if (ids.contains(id)) {
+ logDuplicateId(element);
+ return null;
+ }
+ ids.add(id);
+
+ boolean noClass = element.getAttribute(DecoratorDefinition.ATT_CLASS) == null;
+
+ // Lightweight or Full? It is lightweight if it is declared lightweight or if
+ // there is no class
+ if (Boolean.parseBoolean(element.getAttribute(IWorkbenchRegistryConstants.ATT_LIGHTWEIGHT)) || noClass) {
+
+ String iconPath = element.getAttribute(LightweightDecoratorDefinition.ATT_ICON);
+
+ if (noClass && iconPath == null) {
+ logMissingElement(element, LightweightDecoratorDefinition.ATT_ICON);
+ return null;
+ }
+
+ return new LightweightDecoratorDefinition(id, element);
+ }
+ return new FullDecoratorDefinition(id, element);
+
+ }
+
+ /**
+ * Read the decorator extensions within a registry and set up the registry
+ * values.
+ */
+ Collection readRegistry(IExtensionRegistry in) {
+ values.clear();
+ ids.clear();
+ readRegistry(in, PlatformUI.PLUGIN_ID, IWorkbenchRegistryConstants.PL_DECORATORS);
+ return values;
+ }
+
+ /**
+ * Return the values.
+ *
+ * @return the values
+ */
+ public Collection getValues() {
+ return values;
+ }
+
+ /**
+ * Logs a registry error when the configuration element is unknown.
+ */
+ protected void logDuplicateId(IConfigurationElement element) {
+ logError(element, "Duplicate id found: " + element.getAttribute(IWorkbenchRegistryConstants.ATT_ID));//$NON-NLS-1$
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/FullDecoratorDefinition.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/FullDecoratorDefinition.java
index 460a93cfd9d..725b349666c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/FullDecoratorDefinition.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/FullDecoratorDefinition.java
@@ -25,140 +25,131 @@ import org.eclipse.ui.internal.WorkbenchMessages;
import org.eclipse.ui.internal.WorkbenchPlugin;
/**
- * The RunnableDecoratorDefinition is the definition for
- * decorators that have an ILabelDecorator class to instantiate.
+ * The RunnableDecoratorDefinition is the definition for decorators that have an
+ * ILabelDecorator class to instantiate.
*/
class FullDecoratorDefinition extends DecoratorDefinition {
ILabelDecorator decorator;
- /**
- * Create a new instance of the receiver with the
- * supplied values.
- */
-
- FullDecoratorDefinition(String identifier, IConfigurationElement element) {
- super(identifier, element);
- }
-
- /**
- * Gets the decorator and creates it if it does
- * not exist yet. Throws a CoreException if there is a problem
- * creating the decorator.
- * This method should not be called unless a check for
- * enabled to be true is done first.
- * @return Returns a ILabelDecorator
- */
- protected ILabelDecorator internalGetDecorator() throws CoreException {
- if (labelProviderCreationFailed) {
+ /**
+ * Create a new instance of the receiver with the supplied values.
+ */
+
+ FullDecoratorDefinition(String identifier, IConfigurationElement element) {
+ super(identifier, element);
+ }
+
+ /**
+ * Gets the decorator and creates it if it does not exist yet. Throws a
+ * CoreException if there is a problem creating the decorator. This method
+ * should not be called unless a check for enabled to be true is done first.
+ *
+ * @return Returns a ILabelDecorator
+ */
+ protected ILabelDecorator internalGetDecorator() throws CoreException {
+ if (labelProviderCreationFailed) {
return null;
}
- final CoreException[] exceptions = new CoreException[1];
+ final CoreException[] exceptions = new CoreException[1];
- if (decorator == null) {
- Platform
- .run(new SafeRunnable(
- NLS.bind(WorkbenchMessages.DecoratorManager_ErrorActivatingDecorator, getName() )) {
- @Override
+ if (decorator == null) {
+ Platform.run(
+ new SafeRunnable(NLS.bind(WorkbenchMessages.DecoratorManager_ErrorActivatingDecorator, getName())) {
+ @Override
public void run() {
- try {
- decorator = (ILabelDecorator) WorkbenchPlugin
- .createExtension(
- definingElement,
- DecoratorDefinition.ATT_CLASS);
- decorator.addListener(WorkbenchPlugin
- .getDefault().getDecoratorManager());
- } catch (CoreException exception) {
- exceptions[0] = exception;
- }
- }
- });
- } else {
+ try {
+ decorator = (ILabelDecorator) WorkbenchPlugin.createExtension(definingElement,
+ DecoratorDefinition.ATT_CLASS);
+ decorator.addListener(WorkbenchPlugin.getDefault().getDecoratorManager());
+ } catch (CoreException exception) {
+ exceptions[0] = exception;
+ }
+ }
+ });
+ } else {
return decorator;
}
- if (decorator == null) {
- this.labelProviderCreationFailed = true;
- setEnabled(false);
- }
+ if (decorator == null) {
+ this.labelProviderCreationFailed = true;
+ setEnabled(false);
+ }
- if (exceptions[0] != null) {
+ if (exceptions[0] != null) {
throw exceptions[0];
}
- return decorator;
- }
+ return decorator;
+ }
- @Override
+ @Override
protected void refreshDecorator() {
- //Only do something if disabled so as to prevent
- //gratutitous activation
- if (!this.enabled && decorator != null) {
- IBaseLabelProvider cached = decorator;
- decorator = null;
- disposeCachedDecorator(cached);
- }
- }
-
- /**
- * Decorate the image provided for the element type.
- * This method should not be called unless a check for
- * isEnabled() has been done first.
- * Return null if there is no image or if an error occurs.
- */
- Image decorateImage(Image image, Object element) {
- try {
- //Internal decorator might be null so be prepared
- ILabelDecorator currentDecorator = internalGetDecorator();
- if (currentDecorator != null) {
+ // Only do something if disabled so as to prevent
+ // gratutitous activation
+ if (!this.enabled && decorator != null) {
+ IBaseLabelProvider cached = decorator;
+ decorator = null;
+ disposeCachedDecorator(cached);
+ }
+ }
+
+ /**
+ * Decorate the image provided for the element type. This method should not be
+ * called unless a check for isEnabled() has been done first. Return null if
+ * there is no image or if an error occurs.
+ */
+ Image decorateImage(Image image, Object element) {
+ try {
+ // Internal decorator might be null so be prepared
+ ILabelDecorator currentDecorator = internalGetDecorator();
+ if (currentDecorator != null) {
return currentDecorator.decorateImage(image, element);
}
- } catch (CoreException exception) {
- handleCoreException(exception);
- }
- return null;
- }
-
- /**
- * Decorate the text provided for the element type.
- * This method should not be called unless a check for
- * isEnabled() has been done first.
- * Return null if there is no text or if there is an exception.
- */
- String decorateText(String text, Object element) {
- try {
- //Internal decorator might be null so be prepared
- ILabelDecorator currentDecorator = internalGetDecorator();
- if (currentDecorator != null) {
+ } catch (CoreException exception) {
+ handleCoreException(exception);
+ }
+ return null;
+ }
+
+ /**
+ * Decorate the text provided for the element type. This method should not be
+ * called unless a check for isEnabled() has been done first. Return null if
+ * there is no text or if there is an exception.
+ */
+ String decorateText(String text, Object element) {
+ try {
+ // Internal decorator might be null so be prepared
+ ILabelDecorator currentDecorator = internalGetDecorator();
+ if (currentDecorator != null) {
return currentDecorator.decorateText(text, element);
}
- } catch (CoreException exception) {
- handleCoreException(exception);
- }
- return null;
- }
-
- /**
- * Returns the decorator, or <code>null</code> if not enabled.
- *
- * @return the decorator, or <code>null</code> if not enabled
- */
- public ILabelDecorator getDecorator() {
- return decorator;
- }
-
- @Override
- protected IBaseLabelProvider internalGetLabelProvider()
- throws CoreException {
- return internalGetDecorator();
- }
-
- @Override
+ } catch (CoreException exception) {
+ handleCoreException(exception);
+ }
+ return null;
+ }
+
+ /**
+ * Returns the decorator, or <code>null</code> if not enabled.
+ *
+ * @return the decorator, or <code>null</code> if not enabled
+ */
+ public ILabelDecorator getDecorator() {
+ return decorator;
+ }
+
+ @Override
+ protected IBaseLabelProvider internalGetLabelProvider() throws CoreException {
+ return internalGetDecorator();
+ }
+
+ @Override
public boolean isFull() {
- return true;
- }
+ return true;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/FullDecoratorRunnable.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/FullDecoratorRunnable.java
index b0e3b31f32b..92496f400b6 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/FullDecoratorRunnable.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/FullDecoratorRunnable.java
@@ -21,36 +21,34 @@ import org.eclipse.ui.internal.WorkbenchPlugin;
import org.eclipse.ui.internal.misc.StatusUtil;
/**
- * The FullDecoratorRunnable is the ISafeRunnable that runs
- * the full decorators
+ * The FullDecoratorRunnable is the ISafeRunnable that runs the full decorators
*/
abstract class FullDecoratorRunnable implements ISafeRunnable {
- protected Object element;
+ protected Object element;
- protected FullDecoratorDefinition decorator;
+ protected FullDecoratorDefinition decorator;
- /**
- * Set the values for the element and the decorator.
- * @param object
- * @param definition
- */
- protected void setValues(Object object, FullDecoratorDefinition definition) {
- element = object;
- decorator = definition;
+ /**
+ * Set the values for the element and the decorator.
+ *
+ * @param object
+ * @param definition
+ */
+ protected void setValues(Object object, FullDecoratorDefinition definition) {
+ element = object;
+ decorator = definition;
- }
+ }
- /*
- * @see ISafeRunnable.handleException(Throwable).
- */
- @Override
+ /*
+ * @see ISafeRunnable.handleException(Throwable).
+ */
+ @Override
public void handleException(Throwable exception) {
- IStatus status = StatusUtil.newStatus(IStatus.ERROR, exception
- .getMessage(), exception);
- String message = NLS.bind(WorkbenchMessages.DecoratorWillBeDisabled,
- decorator.getName());
- WorkbenchPlugin.log(message, status);
- decorator.crashDisable();
- }
+ IStatus status = StatusUtil.newStatus(IStatus.ERROR, exception.getMessage(), exception);
+ String message = NLS.bind(WorkbenchMessages.DecoratorWillBeDisabled, decorator.getName());
+ WorkbenchPlugin.log(message, status);
+ decorator.crashDisable();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/FullImageDecoratorRunnable.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/FullImageDecoratorRunnable.java
index 24e891071fe..5424058c790 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/FullImageDecoratorRunnable.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/FullImageDecoratorRunnable.java
@@ -16,46 +16,44 @@ package org.eclipse.ui.internal.decorators;
import org.eclipse.swt.graphics.Image;
/**
- * The FullImageDecoratorRunnable is the runnable for decorating
- * images
+ * The FullImageDecoratorRunnable is the runnable for decorating images
*/
class FullImageDecoratorRunnable extends FullDecoratorRunnable {
- Image result = null;
+ Image result = null;
- Image start;
+ Image start;
- @Override
+ @Override
public void run() throws Exception {
- result = decorator.decorateImage(start, element);
- }
-
- /**
- * Get the result of the decoration or <code>null</code>
- * if there was a failure.
- * @return Image
- */
- Image getResult() {
- return result;
- }
+ result = decorator.decorateImage(start, element);
+ }
- /**
- * Set the values of the initialString and the decorator
- * and object that are going to be used to determine the
- * result.
- * @param initialImage
- * @param object
- * @param definition
- */
- void setValues(Image initialImage, Object object,
- FullDecoratorDefinition definition) {
- setValues(object, definition);
- start = initialImage;
- result = null;
- }
+ /**
+ * Get the result of the decoration or <code>null</code> if there was a failure.
+ *
+ * @return Image
+ */
+ Image getResult() {
+ return result;
+ }
+ /**
+ * Set the values of the initialString and the decorator and object that are
+ * going to be used to determine the result.
+ *
+ * @param initialImage
+ * @param object
+ * @param definition
+ */
+ void setValues(Image initialImage, Object object, FullDecoratorDefinition definition) {
+ setValues(object, definition);
+ start = initialImage;
+ result = null;
+ }
/**
* Clear decorator references.
+ *
* @since 3.1
*/
void clearReferences() {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/FullTextDecoratorRunnable.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/FullTextDecoratorRunnable.java
index 0a790816dd2..021468aea1c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/FullTextDecoratorRunnable.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/FullTextDecoratorRunnable.java
@@ -14,45 +14,44 @@
package org.eclipse.ui.internal.decorators;
/**
- * FullTextDecoratorRunnable is the decorator that runs the text
- * decoration.
+ * FullTextDecoratorRunnable is the decorator that runs the text decoration.
*/
public class FullTextDecoratorRunnable extends FullDecoratorRunnable {
- String result = null;
+ String result = null;
- String start;
+ String start;
- @Override
+ @Override
public void run() throws Exception {
- result = decorator.decorateText(start, element);
- }
+ result = decorator.decorateText(start, element);
+ }
- /**
- * Get the result of the decoration or <code>null</code>
- * if there was a failure.
- * @return the result
- */
- String getResult() {
- return result;
- }
+ /**
+ * Get the result of the decoration or <code>null</code> if there was a failure.
+ *
+ * @return the result
+ */
+ String getResult() {
+ return result;
+ }
- /**
- * Set the values of the initialString and the decorator
- * and object that are going to be used to determine the
- * result.
- * @param initialString
- * @param object
- * @param definition
- */
- void setValues(String initialString, Object object,
- FullDecoratorDefinition definition) {
- setValues(object, definition);
- start = initialString;
- result = null;
- }
+ /**
+ * Set the values of the initialString and the decorator and object that are
+ * going to be used to determine the result.
+ *
+ * @param initialString
+ * @param object
+ * @param definition
+ */
+ void setValues(String initialString, Object object, FullDecoratorDefinition definition) {
+ setValues(object, definition);
+ start = initialString;
+ result = null;
+ }
/**
* Clear decorator references.
+ *
* @since 3.1
*/
void clearReferences() {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/LightweightActionDescriptor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/LightweightActionDescriptor.java
index fbe351eb9ab..9ff40e0b290 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/LightweightActionDescriptor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/LightweightActionDescriptor.java
@@ -23,123 +23,118 @@ import org.eclipse.ui.model.IWorkbenchAdapter;
import org.eclipse.ui.plugin.AbstractUIPlugin;
/**
- * Represent the description of an action within
- * an action set. It does not create an action.
+ * Represent the description of an action within an action set. It does not
+ * create an action.
*
- * [Issue: This class overlaps with ActionDescriptor
- * and should be reviewed to determine if code
- * reuse if possible.]
+ * [Issue: This class overlaps with ActionDescriptor and should be reviewed to
+ * determine if code reuse if possible.]
*/
-public class LightweightActionDescriptor implements IAdaptable,
- IWorkbenchAdapter {
- private static final Object[] NO_CHILDREN = new Object[0];
-
- private String id;
-
- private String label;
-
- private String description;
-
- private ImageDescriptor image;
-
- /**
- * Create a new instance of <code>LightweightActionDescriptor</code>.
- *
- * @param actionElement the configuration element
- */
- public LightweightActionDescriptor(IConfigurationElement actionElement) {
- super();
-
- this.id = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
- this.label = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_LABEL);
- this.description = actionElement
- .getAttribute(IWorkbenchRegistryConstants.TAG_DESCRIPTION);
-
- String iconName = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_ICON);
- if (iconName != null) {
- IExtension extension = actionElement.getDeclaringExtension();
- this.image = AbstractUIPlugin.imageDescriptorFromPlugin(extension
- .getContributor().getName(), iconName);
- }
- }
-
- /**
- * Returns an object which is an instance of the given class
- * associated with this object. Returns <code>null</code> if
- * no such object can be found.
- */
+public class LightweightActionDescriptor implements IAdaptable, IWorkbenchAdapter {
+ private static final Object[] NO_CHILDREN = new Object[0];
+
+ private String id;
+
+ private String label;
+
+ private String description;
+
+ private ImageDescriptor image;
+
+ /**
+ * Create a new instance of <code>LightweightActionDescriptor</code>.
+ *
+ * @param actionElement the configuration element
+ */
+ public LightweightActionDescriptor(IConfigurationElement actionElement) {
+ super();
+
+ this.id = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
+ this.label = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_LABEL);
+ this.description = actionElement.getAttribute(IWorkbenchRegistryConstants.TAG_DESCRIPTION);
+
+ String iconName = actionElement.getAttribute(IWorkbenchRegistryConstants.ATT_ICON);
+ if (iconName != null) {
+ IExtension extension = actionElement.getDeclaringExtension();
+ this.image = AbstractUIPlugin.imageDescriptorFromPlugin(extension.getContributor().getName(), iconName);
+ }
+ }
+
+ /**
+ * Returns an object which is an instance of the given class associated with
+ * this object. Returns <code>null</code> if no such object can be found.
+ */
@Override
public <T> T getAdapter(Class<T> adapter) {
- if (adapter == IWorkbenchAdapter.class) {
+ if (adapter == IWorkbenchAdapter.class) {
return adapter.cast(this);
}
- return null;
- }
-
- /**
- * Returns the action's description.
- *
- * @return the description
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Returns the action's id.
- *
- * @return the id
- */
- public String getId() {
- return id;
- }
-
- /**
- * Returns the action's image descriptor.
- *
- * @return the image descriptor
- */
- public ImageDescriptor getImageDescriptor() {
- return image;
- }
-
- @Override
+ return null;
+ }
+
+ /**
+ * Returns the action's description.
+ *
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Returns the action's id.
+ *
+ * @return the id
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Returns the action's image descriptor.
+ *
+ * @return the image descriptor
+ */
+ public ImageDescriptor getImageDescriptor() {
+ return image;
+ }
+
+ @Override
public ImageDescriptor getImageDescriptor(Object o) {
- if (o == this) {
+ if (o == this) {
return getImageDescriptor();
}
- return null;
- }
-
- /**
- * Returns the action's label.
- *
- * @return the label
- */
- public String getLabel() {
- return label;
- }
-
- @Override
+ return null;
+ }
+
+ /**
+ * Returns the action's label.
+ *
+ * @return the label
+ */
+ public String getLabel() {
+ return label;
+ }
+
+ @Override
public String getLabel(Object o) {
- if (o == this) {
- String text = getLabel();
- int end = text.lastIndexOf('@');
- if (end >= 0) {
+ if (o == this) {
+ String text = getLabel();
+ int end = text.lastIndexOf('@');
+ if (end >= 0) {
text = text.substring(0, end);
}
- return DialogUtil.removeAccel(text);
- }
- return o == null ? "" : o.toString();//$NON-NLS-1$
- }
+ return DialogUtil.removeAccel(text);
+ }
+ return o == null ? "" : o.toString();//$NON-NLS-1$
+ }
- @Override
+ @Override
public Object[] getChildren(Object o) {
- return NO_CHILDREN;
- }
+ return NO_CHILDREN;
+ }
- @Override
+ @Override
public Object getParent(Object o) {
- return null;
- }
+ return null;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/LightweightDecoratorDefinition.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/LightweightDecoratorDefinition.java
index 38e85ef1622..e1156bef7e3 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/LightweightDecoratorDefinition.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/LightweightDecoratorDefinition.java
@@ -30,8 +30,7 @@ import org.eclipse.ui.internal.WorkbenchPlugin;
* entirely from xml and will not require the activation of its defining
* plug-in.
*/
-class LightweightDecoratorDefinition extends DecoratorDefinition implements
- IObjectContributor {
+class LightweightDecoratorDefinition extends DecoratorDefinition implements IObjectContributor {
private static final String ATT_LOCATION = "location"; //$NON-NLS-1$
@@ -82,8 +81,8 @@ class LightweightDecoratorDefinition extends DecoratorDefinition implements
private static final String BOTTOM_LEFT_STRING = "BOTTOM_LEFT"; //$NON-NLS-1$
/**
- * The DeclarativeDecorator is the internal decorator supplied by the
- * decorator definition.
+ * The DeclarativeDecorator is the internal decorator supplied by the decorator
+ * definition.
*/
private ILightweightLabelDecorator decorator;
@@ -93,8 +92,7 @@ class LightweightDecoratorDefinition extends DecoratorDefinition implements
private String[] objectClasses;
- LightweightDecoratorDefinition(String identifier,
- IConfigurationElement element) {
+ LightweightDecoratorDefinition(String identifier, IConfigurationElement element) {
super(identifier, element);
}
@@ -105,8 +103,7 @@ class LightweightDecoratorDefinition extends DecoratorDefinition implements
*
* @return Returns a ILabelDecorator
*/
- protected ILightweightLabelDecorator internalGetDecorator()
- throws CoreException {
+ protected ILightweightLabelDecorator internalGetDecorator() throws CoreException {
if (labelProviderCreationFailed) {
return null;
}
@@ -116,19 +113,16 @@ class LightweightDecoratorDefinition extends DecoratorDefinition implements
if (decorator == null) {
if (isDeclarative()) {
- decorator = new DeclarativeDecorator(definingElement,
- getIconLocation());
+ decorator = new DeclarativeDecorator(definingElement, getIconLocation());
} else {
SafeRunner.run(new ISafeRunnable() {
@Override
public void run() {
try {
- decorator = (ILightweightLabelDecorator) WorkbenchPlugin
- .createExtension(definingElement,
- DecoratorDefinition.ATT_CLASS);
- decorator.addListener(WorkbenchPlugin.getDefault()
- .getDecoratorManager());
+ decorator = (ILightweightLabelDecorator) WorkbenchPlugin.createExtension(definingElement,
+ DecoratorDefinition.ATT_CLASS);
+ decorator.addListener(WorkbenchPlugin.getDefault().getDecoratorManager());
} catch (CoreException exception) {
exceptions[0] = exception;
}
@@ -175,8 +169,7 @@ class LightweightDecoratorDefinition extends DecoratorDefinition implements
}
@Override
- protected IBaseLabelProvider internalGetLabelProvider()
- throws CoreException {
+ protected IBaseLabelProvider internalGetLabelProvider() throws CoreException {
return internalGetDecorator();
}
@@ -187,16 +180,15 @@ class LightweightDecoratorDefinition extends DecoratorDefinition implements
/**
* Returns the quadrant.One of the following constants in
- * DecoratorRegistryReader: TOP_LEFT TOP_RIGHT BOTTOM_LEFT BOTTOM_RIGHT
- * UNDERLAY REPLACE
+ * DecoratorRegistryReader: TOP_LEFT TOP_RIGHT BOTTOM_LEFT BOTTOM_RIGHT UNDERLAY
+ * REPLACE
*
* @return int
*/
public int getQuadrant() {
if (!hasReadQuadrant) {
hasReadQuadrant = true;
- quadrant = getLocationConstant(definingElement
- .getAttribute(ATT_LOCATION), definingElement);
+ quadrant = getLocationConstant(definingElement.getAttribute(ATT_LOCATION), definingElement);
}
return quadrant;
}
@@ -207,8 +199,7 @@ class LightweightDecoratorDefinition extends DecoratorDefinition implements
*
* @since 3.1
*/
- private int getLocationConstant(String locationDefinition,
- IConfigurationElement element) {
+ private int getLocationConstant(String locationDefinition, IConfigurationElement element) {
// Backwards compatibility
if (locationDefinition == null) {
@@ -236,6 +227,7 @@ class LightweightDecoratorDefinition extends DecoratorDefinition implements
/**
* Decorate the element using the decoration to store the result.
+ *
* @param element
* @param decoration
*/
@@ -243,21 +235,19 @@ class LightweightDecoratorDefinition extends DecoratorDefinition implements
try {
// Internal decorator might be null so be prepared
ILightweightLabelDecorator currentDecorator = internalGetDecorator();
- if(currentDecorator == null) {
+ if (currentDecorator == null) {
return;
}
if (isAdaptable()) {
String[] classes = getObjectClasses();
for (String className : classes) {
- Object adapted = LegacyResourceSupport.getAdapter(element,
- className);
+ Object adapted = LegacyResourceSupport.getAdapter(element, className);
if (adapted != null) {
currentDecorator.decorate(adapted, decoration);
}
}
- }
- else if (element != null) {
+ } else if (element != null) {
currentDecorator.decorate(element, decoration);
}
} catch (CoreException exception) {
@@ -299,8 +289,7 @@ class LightweightDecoratorDefinition extends DecoratorDefinition implements
/**
* Get the object classes to which this decorator is registered.
*
- * @return String [] the object classes to which this decorator is
- * registered
+ * @return String [] the object classes to which this decorator is registered
*/
public String[] getObjectClasses() {
if (objectClasses == null) {
@@ -319,7 +308,7 @@ class LightweightDecoratorDefinition extends DecoratorDefinition implements
// If the class is null set it to Object
if (objectClasses == null) {
- objectClasses = new String[] {Object.class.getName()};
+ objectClasses = new String[] { Object.class.getName() };
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/LightweightDecoratorManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/LightweightDecoratorManager.java
index 3db9c5afaae..ac7be38d5c6 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/LightweightDecoratorManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/LightweightDecoratorManager.java
@@ -35,8 +35,8 @@ import org.eclipse.ui.internal.util.Util;
public class LightweightDecoratorManager extends ObjectContributorManager {
/**
- * The runnable is the object used to run the decorations so that an error
- * in someones decorator will not kill the thread. It is implemented here to
+ * The runnable is the object used to run the decorations so that an error in
+ * someones decorator will not kill the thread. It is implemented here to
* prevent aborting of decoration i.e. successful decorations will still be
* applied.
*/
@@ -64,8 +64,7 @@ public class LightweightDecoratorManager extends ObjectContributorManager {
private volatile RunnableData data = new RunnableData(null, null, null);
- void setValues(Object object, DecorationBuilder builder,
- LightweightDecoratorDefinition definition) {
+ void setValues(Object object, DecorationBuilder builder, LightweightDecoratorDefinition definition) {
data = new RunnableData(object, builder, definition);
}
@@ -74,8 +73,7 @@ public class LightweightDecoratorManager extends ObjectContributorManager {
*/
@Override
public void handleException(Throwable exception) {
- IStatus status = StatusUtil.newStatus(IStatus.ERROR, exception
- .getMessage(), exception);
+ IStatus status = StatusUtil.newStatus(IStatus.ERROR, exception.getMessage(), exception);
LightweightDecoratorDefinition decorator = data.decorator;
String message;
if (decorator == null) {
@@ -142,8 +140,8 @@ public class LightweightDecoratorManager extends ObjectContributorManager {
}
/**
- * Register the decorators as object contributions so that adaptable lookup
- * can occur.
+ * Register the decorators as object contributions so that adaptable lookup can
+ * occur.
*/
private void buildContributors() {
for (LightweightDecoratorDefinition decorator : lightweightDefinitions) {
@@ -156,8 +154,7 @@ public class LightweightDecoratorManager extends ObjectContributorManager {
/**
* For dynamic UI
*
- * @param decorator
- * the definition to add
+ * @param decorator the definition to add
* @return whether the definition was added
* @since 3.0
*/
@@ -165,8 +162,7 @@ public class LightweightDecoratorManager extends ObjectContributorManager {
if (getLightweightDecoratorDefinition(decorator.getId()) == null) {
LightweightDecoratorDefinition[] oldDefs = lightweightDefinitions;
lightweightDefinitions = new LightweightDecoratorDefinition[lightweightDefinitions.length + 1];
- System.arraycopy(oldDefs, 0, lightweightDefinitions, 0,
- oldDefs.length);
+ System.arraycopy(oldDefs, 0, lightweightDefinitions, 0, oldDefs.length);
lightweightDefinitions[oldDefs.length] = decorator;
// no reset - handled in the DecoratorManager
String[] types = getTargetTypes(decorator);
@@ -191,8 +187,7 @@ public class LightweightDecoratorManager extends ObjectContributorManager {
/**
* For dynamic-ui
*
- * @param decorator
- * the definition to remove
+ * @param decorator the definition to remove
* @return whether the definition was removed
* @since 3.1
*/
@@ -200,10 +195,9 @@ public class LightweightDecoratorManager extends ObjectContributorManager {
int idx = getLightweightDecoratorDefinitionIdx(decorator.getId());
if (idx != -1) {
LightweightDecoratorDefinition[] oldDefs = lightweightDefinitions;
- Util.arrayCopyWithRemoval(
- oldDefs,
- lightweightDefinitions = new LightweightDecoratorDefinition[lightweightDefinitions.length - 1],
- idx);
+ Util.arrayCopyWithRemoval(oldDefs,
+ lightweightDefinitions = new LightweightDecoratorDefinition[lightweightDefinitions.length - 1],
+ idx);
// no reset - handled in the DecoratorManager
for (String type : getTargetTypes(decorator)) {
unregisterContributor(decorator, type);
@@ -217,14 +211,12 @@ public class LightweightDecoratorManager extends ObjectContributorManager {
/**
* Get the LightweightDecoratorDefinition with the supplied id
*
- * @return LightweightDecoratorDefinition or <code>null</code> if it is
- * not found
- * @param decoratorId
- * String
+ * @return LightweightDecoratorDefinition or <code>null</code> if it is not
+ * found
+ * @param decoratorId String
* @since 3.0
*/
- private LightweightDecoratorDefinition getLightweightDecoratorDefinition(
- String decoratorId) {
+ private LightweightDecoratorDefinition getLightweightDecoratorDefinition(String decoratorId) {
int idx = getLightweightDecoratorDefinitionIdx(decoratorId);
if (idx != -1) {
return lightweightDefinitions[idx];
@@ -235,8 +227,7 @@ public class LightweightDecoratorManager extends ObjectContributorManager {
/**
* Return the index of the definition in the array.
*
- * @param decoratorId
- * the id
+ * @param decoratorId the id
* @return the index of the definition in the array or <code>-1</code>
* @since 3.1
*/
@@ -261,8 +252,7 @@ public class LightweightDecoratorManager extends ObjectContributorManager {
result.add(lightweightDefinition);
}
}
- LightweightDecoratorDefinition[] returnArray = new LightweightDecoratorDefinition[result
- .size()];
+ LightweightDecoratorDefinition[] returnArray = new LightweightDecoratorDefinition[result.size()];
result.toArray(returnArray);
return returnArray;
}
@@ -305,10 +295,9 @@ public class LightweightDecoratorManager extends ObjectContributorManager {
/**
* Get the LightweightDecoratorDefinition with the supplied id
*
- * @return LightweightDecoratorDefinition or <code>null</code> if it is
- * not found
- * @param decoratorId
- * String
+ * @return LightweightDecoratorDefinition or <code>null</code> if it is not
+ * found
+ * @param decoratorId String
*/
LightweightDecoratorDefinition getDecoratorDefinition(String decoratorId) {
for (LightweightDecoratorDefinition lightweightDefinition : lightweightDefinitions) {
@@ -334,12 +323,9 @@ public class LightweightDecoratorManager extends ObjectContributorManager {
List contributors = getContributors(elements);
if (!contributors.isEmpty()) {
Collection decorators = DecoratorManager.getDecoratorsFor(element,
- (DecoratorDefinition[]) contributors
- .toArray(new DecoratorDefinition[contributors
- .size()]));
+ (DecoratorDefinition[]) contributors.toArray(new DecoratorDefinition[contributors.size()]));
if (decorators.size() > 0) {
- decoratorArray = new LightweightDecoratorDefinition[decorators
- .size()];
+ decoratorArray = new LightweightDecoratorDefinition[decorators.size()];
decorators.toArray(decoratorArray);
}
}
@@ -350,11 +336,9 @@ public class LightweightDecoratorManager extends ObjectContributorManager {
/**
* Fill the decoration with all of the results of the decorators.
*
- * @param element
- * The source element
- * @param decoration
- * The DecorationResult we are working on. where adaptable is
- * true.
+ * @param element The source element
+ * @param decoration The DecorationResult we are working on. where adaptable is
+ * true.
*/
public void getDecorations(Object element, DecorationBuilder decoration) {
for (LightweightDecoratorDefinition decorator : getDecoratorsFor(element)) {
@@ -366,26 +350,20 @@ public class LightweightDecoratorManager extends ObjectContributorManager {
/**
* Decorate the element receiver in a SafeRunnable.
*
- * @param element
- * The Object to be decorated
- * @param decoration
- * The object building decorations.
- * @param decorator
- * The decorator being applied.
+ * @param element The Object to be decorated
+ * @param decoration The object building decorations.
+ * @param decorator The decorator being applied.
*/
- private void decorate(Object element, DecorationBuilder decoration,
- LightweightDecoratorDefinition decorator) {
+ private void decorate(Object element, DecorationBuilder decoration, LightweightDecoratorDefinition decorator) {
runnable.setValues(element, decoration, decorator);
SafeRunner.run(runnable);
}
-
/**
* Method for use by test cases
*
- * @param object
- * the object to be decorated
+ * @param object the object to be decorated
* @return the decoration result
*/
public DecorationResult getDecorationResult(Object object) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/AboutDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/AboutDialog.java
index 6c972bfc807..d91166e976a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/AboutDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/AboutDialog.java
@@ -77,68 +77,68 @@ public class AboutDialog extends TrayDialog {
private static final int MAX_IMAGE_WIDTH_FOR_TEXT = 250;
- private static final int DETAILS_ID = IDialogConstants.CLIENT_ID + 1;
+ private static final int DETAILS_ID = IDialogConstants.CLIENT_ID + 1;
- private String productName;
+ private String productName;
- private IProduct product;
+ private IProduct product;
- private AboutBundleGroupData[] bundleGroupInfos;
+ private AboutBundleGroupData[] bundleGroupInfos;
- private ArrayList<Image> images = new ArrayList<>();
+ private ArrayList<Image> images = new ArrayList<>();
- private AboutFeaturesButtonManager buttonManager = new AboutFeaturesButtonManager();
+ private AboutFeaturesButtonManager buttonManager = new AboutFeaturesButtonManager();
- private StyledText text;
+ private StyledText text;
- private AboutTextManager aboutTextManager;
+ private AboutTextManager aboutTextManager;
- /**
- * Create an instance of the AboutDialog for the given window.
- * @param parentShell The parent of the dialog.
- */
- public AboutDialog(Shell parentShell) {
- super(parentShell);
+ /**
+ * Create an instance of the AboutDialog for the given window.
+ *
+ * @param parentShell The parent of the dialog.
+ */
+ public AboutDialog(Shell parentShell) {
+ super(parentShell);
- product = Platform.getProduct();
- if (product != null) {
+ product = Platform.getProduct();
+ if (product != null) {
productName = product.getName();
}
- if (productName == null) {
+ if (productName == null) {
productName = WorkbenchMessages.AboutDialog_defaultProductName;
}
- // create a descriptive object for each BundleGroup
- IBundleGroupProvider[] providers = Platform.getBundleGroupProviders();
+ // create a descriptive object for each BundleGroup
+ IBundleGroupProvider[] providers = Platform.getBundleGroupProviders();
LinkedList<AboutBundleGroupData> groups = new LinkedList<>();
- if (providers != null) {
+ if (providers != null) {
for (IBundleGroupProvider provider : providers) {
- IBundleGroup[] bundleGroups = provider.getBundleGroups();
- for (IBundleGroup bundleGroup : bundleGroups) {
+ IBundleGroup[] bundleGroups = provider.getBundleGroups();
+ for (IBundleGroup bundleGroup : bundleGroups) {
groups.add(new AboutBundleGroupData(bundleGroup));
}
- }
+ }
}
- bundleGroupInfos = groups
- .toArray(new AboutBundleGroupData[0]);
- }
+ bundleGroupInfos = groups.toArray(new AboutBundleGroupData[0]);
+ }
- @Override
+ @Override
protected void buttonPressed(int buttonId) {
- switch (buttonId) {
- case DETAILS_ID:
+ switch (buttonId) {
+ case DETAILS_ID:
BusyIndicator.showWhile(getShell().getDisplay(), () -> {
IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
InstallationDialog dialog = new InstallationDialog(getShell(), workbenchWindow);
dialog.setModalParent(AboutDialog.this);
dialog.open();
});
- break;
- default:
- super.buttonPressed(buttonId);
- break;
- }
- }
+ break;
+ default:
+ super.buttonPressed(buttonId);
+ break;
+ }
+ }
@Override
public boolean close() {
@@ -150,246 +150,238 @@ public class AboutDialog extends TrayDialog {
return super.close();
}
- @Override
+ @Override
protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(NLS.bind(WorkbenchMessages.AboutDialog_shellTitle,productName ));
- PlatformUI.getWorkbench().getHelpSystem().setHelp(newShell,
- IWorkbenchHelpContextIds.ABOUT_DIALOG);
- }
-
- /**
- * Add buttons to the dialog's button bar.
- *
- * Subclasses should override.
- *
- * @param parent
- * the button bar composite
- */
- @Override
+ super.configureShell(newShell);
+ newShell.setText(NLS.bind(WorkbenchMessages.AboutDialog_shellTitle, productName));
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(newShell, IWorkbenchHelpContextIds.ABOUT_DIALOG);
+ }
+
+ /**
+ * Add buttons to the dialog's button bar.
+ *
+ * Subclasses should override.
+ *
+ * @param parent the button bar composite
+ */
+ @Override
protected void createButtonsForButtonBar(Composite parent) {
- parent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ parent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- createButton(parent, DETAILS_ID, WorkbenchMessages.AboutDialog_DetailsButton, false);
+ createButton(parent, DETAILS_ID, WorkbenchMessages.AboutDialog_DetailsButton, false);
- Label l = new Label(parent, SWT.NONE);
- l.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- GridLayout layout = (GridLayout) parent.getLayout();
- layout.numColumns++;
- layout.makeColumnsEqualWidth = false;
+ Label l = new Label(parent, SWT.NONE);
+ l.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ GridLayout layout = (GridLayout) parent.getLayout();
+ layout.numColumns++;
+ layout.makeColumnsEqualWidth = false;
Button b = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.CLOSE_LABEL, true);
- b.setFocus();
- }
+ b.setFocus();
+ }
- @Override
+ @Override
protected Control createDialogArea(Composite parent) {
- // brand the about box if there is product info
- Image aboutImage = null;
- AboutItem item = null;
- if (product != null) {
- ImageDescriptor imageDescriptor = ProductProperties
- .getAboutImage(product);
- if (imageDescriptor != null) {
+ // brand the about box if there is product info
+ Image aboutImage = null;
+ AboutItem item = null;
+ if (product != null) {
+ ImageDescriptor imageDescriptor = ProductProperties.getAboutImage(product);
+ if (imageDescriptor != null) {
aboutImage = imageDescriptor.createImage();
}
- // if the about image is small enough, then show the text
- if (aboutImage == null
- || aboutImage.getBounds().width <= MAX_IMAGE_WIDTH_FOR_TEXT) {
- String aboutText = ProductProperties.getAboutText(product);
- if (aboutText != null) {
+ // if the about image is small enough, then show the text
+ if (aboutImage == null || aboutImage.getBounds().width <= MAX_IMAGE_WIDTH_FOR_TEXT) {
+ String aboutText = ProductProperties.getAboutText(product);
+ if (aboutText != null) {
item = AboutTextManager.scan(aboutText);
}
- }
+ }
- if (aboutImage != null) {
+ if (aboutImage != null) {
images.add(aboutImage);
}
- }
-
- // create a composite which is the parent of the top area and the bottom
- // button bar, this allows there to be a second child of this composite with
- // a banner background on top but not have on the bottom
- Composite workArea = new Composite(parent, SWT.NONE);
- GridLayout workLayout = new GridLayout();
- workLayout.marginHeight = 0;
- workLayout.marginWidth = 0;
- workLayout.verticalSpacing = 0;
- workLayout.horizontalSpacing = 0;
- workArea.setLayout(workLayout);
- workArea.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- // page group
- Color background = JFaceColors.getBannerBackground(parent.getDisplay());
- Color foreground = JFaceColors.getBannerForeground(parent.getDisplay());
- Composite top = (Composite) super.createDialogArea(workArea);
-
- // override any layout inherited from createDialogArea
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.verticalSpacing = 0;
- layout.horizontalSpacing = 0;
- top.setLayout(layout);
- top.setLayoutData(new GridData(GridData.FILL_BOTH));
- top.setBackground(background);
- top.setForeground(foreground);
-
- // the image & text
- final Composite topContainer = new Composite(top, SWT.NONE);
- topContainer.setBackground(background);
- topContainer.setForeground(foreground);
-
- layout = new GridLayout();
- layout.numColumns = (aboutImage == null || item == null ? 1 : 2);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.verticalSpacing = 0;
- layout.horizontalSpacing = 0;
- topContainer.setLayout(layout);
-
-
- GC gc = new GC(parent);
- // arbitrary default
- int topContainerHeightHint = 100;
- try {
+ }
+
+ // create a composite which is the parent of the top area and the bottom
+ // button bar, this allows there to be a second child of this composite with
+ // a banner background on top but not have on the bottom
+ Composite workArea = new Composite(parent, SWT.NONE);
+ GridLayout workLayout = new GridLayout();
+ workLayout.marginHeight = 0;
+ workLayout.marginWidth = 0;
+ workLayout.verticalSpacing = 0;
+ workLayout.horizontalSpacing = 0;
+ workArea.setLayout(workLayout);
+ workArea.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ // page group
+ Color background = JFaceColors.getBannerBackground(parent.getDisplay());
+ Color foreground = JFaceColors.getBannerForeground(parent.getDisplay());
+ Composite top = (Composite) super.createDialogArea(workArea);
+
+ // override any layout inherited from createDialogArea
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.verticalSpacing = 0;
+ layout.horizontalSpacing = 0;
+ top.setLayout(layout);
+ top.setLayoutData(new GridData(GridData.FILL_BOTH));
+ top.setBackground(background);
+ top.setForeground(foreground);
+
+ // the image & text
+ final Composite topContainer = new Composite(top, SWT.NONE);
+ topContainer.setBackground(background);
+ topContainer.setForeground(foreground);
+
+ layout = new GridLayout();
+ layout.numColumns = (aboutImage == null || item == null ? 1 : 2);
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ layout.verticalSpacing = 0;
+ layout.horizontalSpacing = 0;
+ topContainer.setLayout(layout);
+
+ GC gc = new GC(parent);
+ // arbitrary default
+ int topContainerHeightHint = 100;
+ try {
// default height enough for 6 lines of text
- topContainerHeightHint = Math.max(topContainerHeightHint, gc
- .getFontMetrics().getHeight() * 6);
- }
- finally {
- gc.dispose();
- }
-
- //image on left side of dialog
- if (aboutImage != null) {
- Label imageLabel = new Label(topContainer, SWT.NONE);
- imageLabel.setBackground(background);
- imageLabel.setForeground(foreground);
-
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.verticalAlignment = GridData.BEGINNING;
- data.grabExcessHorizontalSpace = false;
- imageLabel.setLayoutData(data);
- imageLabel.setImage(aboutImage);
- topContainerHeightHint = Math.max(topContainerHeightHint, aboutImage.getBounds().height);
- }
-
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.verticalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- data.grabExcessVerticalSpace = true;
- data.heightHint = topContainerHeightHint;
- topContainer.setLayoutData(data);
-
- if (item != null) {
+ topContainerHeightHint = Math.max(topContainerHeightHint, gc.getFontMetrics().getHeight() * 6);
+ } finally {
+ gc.dispose();
+ }
+
+ // image on left side of dialog
+ if (aboutImage != null) {
+ Label imageLabel = new Label(topContainer, SWT.NONE);
+ imageLabel.setBackground(background);
+ imageLabel.setForeground(foreground);
+
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.verticalAlignment = GridData.BEGINNING;
+ data.grabExcessHorizontalSpace = false;
+ imageLabel.setLayoutData(data);
+ imageLabel.setImage(aboutImage);
+ topContainerHeightHint = Math.max(topContainerHeightHint, aboutImage.getBounds().height);
+ }
+
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.verticalAlignment = GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ data.grabExcessVerticalSpace = true;
+ data.heightHint = topContainerHeightHint;
+ topContainer.setLayoutData(data);
+
+ if (item != null) {
final int minWidth = 400; // This value should really be calculated
- // from the computeSize(SWT.DEFAULT,
- // SWT.DEFAULT) of all the
- // children in infoArea excluding the
- // wrapped styled text
- // There is no easy way to do this.
- final ScrolledComposite scroller = new ScrolledComposite(topContainer,
- SWT.V_SCROLL | SWT.H_SCROLL);
- data = new GridData(GridData.FILL_BOTH);
- data.widthHint = minWidth;
- scroller.setLayoutData(data);
-
- final Composite textComposite = new Composite(scroller, SWT.NONE);
- textComposite.setBackground(background);
-
- layout = new GridLayout();
- textComposite.setLayout(layout);
-
- text = new StyledText(textComposite, SWT.MULTI | SWT.WRAP | SWT.READ_ONLY);
-
- // Don't set caret to 'null' as this causes https://bugs.eclipse.org/293263.
+ // from the computeSize(SWT.DEFAULT,
+ // SWT.DEFAULT) of all the
+ // children in infoArea excluding the
+ // wrapped styled text
+ // There is no easy way to do this.
+ final ScrolledComposite scroller = new ScrolledComposite(topContainer, SWT.V_SCROLL | SWT.H_SCROLL);
+ data = new GridData(GridData.FILL_BOTH);
+ data.widthHint = minWidth;
+ scroller.setLayoutData(data);
+
+ final Composite textComposite = new Composite(scroller, SWT.NONE);
+ textComposite.setBackground(background);
+
+ layout = new GridLayout();
+ textComposite.setLayout(layout);
+
+ text = new StyledText(textComposite, SWT.MULTI | SWT.WRAP | SWT.READ_ONLY);
+
+ // Don't set caret to 'null' as this causes https://bugs.eclipse.org/293263.
// text.setCaret(null);
- text.setFont(parent.getFont());
- text.setText(item.getText());
- text.setCursor(null);
- text.setBackground(background);
- text.setForeground(foreground);
+ text.setFont(parent.getFont());
+ text.setText(item.getText());
+ text.setCursor(null);
+ text.setBackground(background);
+ text.setForeground(foreground);
- aboutTextManager = new AboutTextManager(text);
- aboutTextManager.setItem(item);
+ aboutTextManager = new AboutTextManager(text);
+ aboutTextManager.setItem(item);
- createTextMenu();
+ createTextMenu();
- GridData gd = new GridData();
- gd.verticalAlignment = GridData.BEGINNING;
- gd.horizontalAlignment = GridData.FILL;
- gd.grabExcessHorizontalSpace = true;
- text.setLayoutData(gd);
+ GridData gd = new GridData();
+ gd.verticalAlignment = GridData.BEGINNING;
+ gd.horizontalAlignment = GridData.FILL;
+ gd.grabExcessHorizontalSpace = true;
+ text.setLayoutData(gd);
- // Adjust the scrollbar increments
- scroller.getHorizontalBar().setIncrement(20);
- scroller.getVerticalBar().setIncrement(20);
+ // Adjust the scrollbar increments
+ scroller.getHorizontalBar().setIncrement(20);
+ scroller.getVerticalBar().setIncrement(20);
- final boolean[] inresize = new boolean[1]; // flag to stop unneccesary
- // recursion
- textComposite.addControlListener(new ControlAdapter() {
- @Override
+ final boolean[] inresize = new boolean[1]; // flag to stop unneccesary
+ // recursion
+ textComposite.addControlListener(new ControlAdapter() {
+ @Override
public void controlResized(ControlEvent e) {
- if (inresize[0]) {
+ if (inresize[0]) {
return;
}
- inresize[0] = true;
- // required because of bugzilla report 4579
- textComposite.layout(true);
- // required because you want to change the height that the
- // scrollbar will scroll over when the width changes.
- int width = textComposite.getClientArea().width;
- Point p = textComposite.computeSize(width, SWT.DEFAULT);
- scroller.setMinSize(minWidth, p.y);
- inresize[0] = false;
- }
- });
-
- scroller.setExpandHorizontal(true);
- scroller.setExpandVertical(true);
- Point p = textComposite.computeSize(minWidth, SWT.DEFAULT);
- textComposite.setSize(p.x, p.y);
- scroller.setMinWidth(minWidth);
- scroller.setMinHeight(p.y);
-
- scroller.setContent(textComposite);
- }
-
- // horizontal bar
- Label bar = new Label(workArea, SWT.HORIZONTAL | SWT.SEPARATOR);
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- bar.setLayoutData(data);
-
- // add image buttons for bundle groups that have them
- Composite bottom = (Composite) super.createDialogArea(workArea);
- // override any layout inherited from createDialogArea
- layout = new GridLayout();
- bottom.setLayout(layout);
- data = new GridData();
- data.horizontalAlignment = SWT.FILL;
- data.verticalAlignment = SWT.FILL;
- data.grabExcessHorizontalSpace = true;
-
- bottom.setLayoutData(data);
-
- createFeatureImageButtonRow(bottom);
-
- // spacer
- bar = new Label(bottom, SWT.NONE);
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- bar.setLayoutData(data);
-
- return workArea;
- }
-
- /**
+ inresize[0] = true;
+ // required because of bugzilla report 4579
+ textComposite.layout(true);
+ // required because you want to change the height that the
+ // scrollbar will scroll over when the width changes.
+ int width = textComposite.getClientArea().width;
+ Point p = textComposite.computeSize(width, SWT.DEFAULT);
+ scroller.setMinSize(minWidth, p.y);
+ inresize[0] = false;
+ }
+ });
+
+ scroller.setExpandHorizontal(true);
+ scroller.setExpandVertical(true);
+ Point p = textComposite.computeSize(minWidth, SWT.DEFAULT);
+ textComposite.setSize(p.x, p.y);
+ scroller.setMinWidth(minWidth);
+ scroller.setMinHeight(p.y);
+
+ scroller.setContent(textComposite);
+ }
+
+ // horizontal bar
+ Label bar = new Label(workArea, SWT.HORIZONTAL | SWT.SEPARATOR);
+ data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ bar.setLayoutData(data);
+
+ // add image buttons for bundle groups that have them
+ Composite bottom = (Composite) super.createDialogArea(workArea);
+ // override any layout inherited from createDialogArea
+ layout = new GridLayout();
+ bottom.setLayout(layout);
+ data = new GridData();
+ data.horizontalAlignment = SWT.FILL;
+ data.verticalAlignment = SWT.FILL;
+ data.grabExcessHorizontalSpace = true;
+
+ bottom.setLayoutData(data);
+
+ createFeatureImageButtonRow(bottom);
+
+ // spacer
+ bar = new Label(bottom, SWT.NONE);
+ data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ bar.setLayoutData(data);
+
+ return workArea;
+ }
+
+ /**
* Create the context menu for the text widget.
*
* @since 3.4
@@ -398,66 +390,63 @@ public class AboutDialog extends TrayDialog {
final MenuManager textManager = new MenuManager();
IServiceLocator serviceLocator = PlatformUI.getWorkbench();
ICommandService commandService = serviceLocator.getService(ICommandService.class);
- textManager.add(new CommandContributionItem(
- new CommandContributionItemParameter(serviceLocator, null, IWorkbenchCommandConstants.EDIT_COPY,
- CommandContributionItem.STYLE_PUSH)));
+ textManager.add(new CommandContributionItem(new CommandContributionItemParameter(serviceLocator, null,
+ IWorkbenchCommandConstants.EDIT_COPY, CommandContributionItem.STYLE_PUSH)));
if (commandService.getCommand(COPY_BUILD_ID_COMMAND).isDefined()) {
textManager.add(new CommandContributionItem(new CommandContributionItemParameter(serviceLocator, null,
COPY_BUILD_ID_COMMAND, CommandContributionItem.STYLE_PUSH)));
}
textManager.add(new CommandContributionItem(new CommandContributionItemParameter(serviceLocator, null,
- IWorkbenchCommandConstants.EDIT_SELECT_ALL,
- CommandContributionItem.STYLE_PUSH)));
+ IWorkbenchCommandConstants.EDIT_SELECT_ALL, CommandContributionItem.STYLE_PUSH)));
text.setMenu(textManager.createContextMenu(text));
text.addDisposeListener(e -> textManager.dispose());
}
private void createFeatureImageButtonRow(Composite parent) {
- Composite featureContainer = new Composite(parent, SWT.NONE);
- RowLayout rowLayout = new RowLayout();
- rowLayout.wrap = true;
- featureContainer.setLayout(rowLayout);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- featureContainer.setLayoutData(data);
-
- for (AboutBundleGroupData bundleGroupInfo : bundleGroupInfos) {
+ Composite featureContainer = new Composite(parent, SWT.NONE);
+ RowLayout rowLayout = new RowLayout();
+ rowLayout.wrap = true;
+ featureContainer.setLayout(rowLayout);
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ featureContainer.setLayoutData(data);
+
+ for (AboutBundleGroupData bundleGroupInfo : bundleGroupInfos) {
createFeatureButton(featureContainer, bundleGroupInfo);
}
- }
+ }
- private Button createFeatureButton(Composite parent,
- final AboutBundleGroupData info) {
- if (!buttonManager.add(info)) {
+ private Button createFeatureButton(Composite parent, final AboutBundleGroupData info) {
+ if (!buttonManager.add(info)) {
return null;
}
- ImageDescriptor desc = info.getFeatureImage();
- Image featureImage = null;
+ ImageDescriptor desc = info.getFeatureImage();
+ Image featureImage = null;
- Button button = new Button(parent, SWT.FLAT | SWT.PUSH);
- button.setData(info);
- featureImage = desc.createImage();
- images.add(featureImage);
- button.setImage(featureImage);
- button.setToolTipText(info.getProviderName());
+ Button button = new Button(parent, SWT.FLAT | SWT.PUSH);
+ button.setData(info);
+ featureImage = desc.createImage();
+ images.add(featureImage);
+ button.setImage(featureImage);
+ button.setToolTipText(info.getProviderName());
- button.getAccessible().addAccessibleListener(new AccessibleAdapter(){
+ button.getAccessible().addAccessibleListener(new AccessibleAdapter() {
@Override
public void getName(AccessibleEvent e) {
e.result = info.getProviderName();
}
- });
- button.addSelectionListener(widgetSelectedAdapter(event -> {
+ });
+ button.addSelectionListener(widgetSelectedAdapter(event -> {
AboutBundleGroupData[] groupInfos = buttonManager.getRelatedInfos(info);
AboutBundleGroupData selection = (AboutBundleGroupData) event.widget.getData();
AboutFeaturesDialog d = new AboutFeaturesDialog(getShell(), productName, groupInfos, selection);
- d.open();
+ d.open();
}));
- return button;
- }
+ return button;
+ }
@Override
protected boolean isResizable() {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/AboutFeaturesDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/AboutFeaturesDialog.java
index f4b6e81202d..87d672d18fa 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/AboutFeaturesDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/AboutFeaturesDialog.java
@@ -30,25 +30,25 @@ import org.eclipse.ui.internal.about.ProductInfoDialog;
* outside the workbench.
*/
public class AboutFeaturesDialog extends ProductInfoDialog {
- /**
- * Constructor for AboutFeaturesDialog.
- *
- * @param parentShell the parent shell
- * @param productName the product name
- * @param bundleGroupInfos the bundle info
- */
- public AboutFeaturesDialog(Shell parentShell, String productName,
- AboutBundleGroupData[] bundleGroupInfos, AboutBundleGroupData initialSelection) {
- super(parentShell);
- AboutFeaturesPage page = new AboutFeaturesPage();
- page.setProductName(productName);
- page.setBundleGroupInfos(bundleGroupInfos);
- page.setInitialSelection(initialSelection);
- String title;
- if (productName != null)
+ /**
+ * Constructor for AboutFeaturesDialog.
+ *
+ * @param parentShell the parent shell
+ * @param productName the product name
+ * @param bundleGroupInfos the bundle info
+ */
+ public AboutFeaturesDialog(Shell parentShell, String productName, AboutBundleGroupData[] bundleGroupInfos,
+ AboutBundleGroupData initialSelection) {
+ super(parentShell);
+ AboutFeaturesPage page = new AboutFeaturesPage();
+ page.setProductName(productName);
+ page.setBundleGroupInfos(bundleGroupInfos);
+ page.setInitialSelection(initialSelection);
+ String title;
+ if (productName != null)
title = NLS.bind(WorkbenchMessages.AboutFeaturesDialog_shellTitle, productName);
- else
- title = WorkbenchMessages.AboutFeaturesDialog_SimpleTitle;
- initializeDialog(page, title, IWorkbenchHelpContextIds.ABOUT_FEATURES_DIALOG);
- }
+ else
+ title = WorkbenchMessages.AboutFeaturesDialog_SimpleTitle;
+ initializeDialog(page, title, IWorkbenchHelpContextIds.ABOUT_FEATURES_DIALOG);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/AboutPluginsDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/AboutPluginsDialog.java
index 73e6f1430f7..547d2ffdd0a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/AboutPluginsDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/AboutPluginsDialog.java
@@ -28,15 +28,15 @@ import org.eclipse.ui.internal.about.ProductInfoDialog;
* PRIVATE this class is internal to the ide
*/
public class AboutPluginsDialog extends ProductInfoDialog {
- public AboutPluginsDialog(Shell parentShell, String productName,
- Bundle[] bundles, String title, String message, String helpContextId) {
- super(parentShell);
- AboutPluginsPage page = new AboutPluginsPage();
- page.setHelpContextId(helpContextId);
- page.setBundles(bundles);
- page.setMessage(message);
- if (title == null && page.getProductName() != null)
- title = NLS.bind(WorkbenchMessages.AboutPluginsDialog_shellTitle, productName);
- initializeDialog(page, title, helpContextId);
+ public AboutPluginsDialog(Shell parentShell, String productName, Bundle[] bundles, String title, String message,
+ String helpContextId) {
+ super(parentShell);
+ AboutPluginsPage page = new AboutPluginsPage();
+ page.setHelpContextId(helpContextId);
+ page.setBundles(bundles);
+ page.setMessage(message);
+ if (title == null && page.getProductName() != null)
+ title = NLS.bind(WorkbenchMessages.AboutPluginsDialog_shellTitle, productName);
+ initializeDialog(page, title, helpContextId);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/AbstractWorkingSetDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/AbstractWorkingSetDialog.java
index fd537171889..422554238d1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/AbstractWorkingSetDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/AbstractWorkingSetDialog.java
@@ -106,8 +106,7 @@ public abstract class AbstractWorkingSetDialog extends SelectionDialog implement
/**
* Adds the modify buttons to the dialog.
*
- * @param composite
- * Composite to add the buttons to
+ * @param composite Composite to add the buttons to
*/
protected void addModifyButtons(Composite composite) {
Composite buttonComposite = new Composite(composite, SWT.RIGHT);
@@ -142,8 +141,7 @@ public abstract class AbstractWorkingSetDialog extends SelectionDialog implement
/**
* Add the select/deselect buttons.
*
- * @param composite
- * Composite to add the buttons to
+ * @param composite Composite to add the buttons to
*/
protected void addSelectionButtons(Composite composite) {
Composite buttonComposite = new Composite(composite, SWT.NONE);
@@ -174,8 +172,7 @@ public abstract class AbstractWorkingSetDialog extends SelectionDialog implement
protected abstract void deselectAllSets();
/**
- * Opens a working set wizard for editing the currently selected working
- * set.
+ * Opens a working set wizard for editing the currently selected working set.
*
* @see org.eclipse.ui.dialogs.IWorkingSetPage
*/
@@ -238,13 +235,12 @@ public abstract class AbstractWorkingSetDialog extends SelectionDialog implement
protected abstract List<IWorkingSet> getSelectedWorkingSets();
/**
- * Notifies the dialog that there has been a change to the sets available
- * for use. In other words, the user has either added, deleted or renamed a
- * set.
+ * Notifies the dialog that there has been a change to the sets available for
+ * use. In other words, the user has either added, deleted or renamed a set.
* <p>
* Subclasses should override, but should call
- * <code>super.availableWorkingSetsChanged</code> to update the selection
- * button enablements.
+ * <code>super.availableWorkingSetsChanged</code> to update the selection button
+ * enablements.
* </p>
*/
protected void availableWorkingSetsChanged() {
@@ -259,16 +255,15 @@ public abstract class AbstractWorkingSetDialog extends SelectionDialog implement
/**
* Notifies the dialog that the given working set was added to the sets
- * available for use. In other words, the user has just added the given
- * working set.
+ * available for use. In other words, the user has just added the given working
+ * set.
*
* <p>
* This implementation doesn't do anything. Subclasses can override it to
* auto-select the added working set.
* </p>
*
- * @param addedSet
- * the added working set.
+ * @param addedSet the added working set.
*/
protected void workingSetAdded(IWorkingSet addedSet) {
}
@@ -313,8 +308,8 @@ public abstract class AbstractWorkingSetDialog extends SelectionDialog implement
}
/**
- * Return the list of working sets that were removed from the MRU list
- * during the life of this dialog.
+ * Return the list of working sets that were removed from the MRU list during
+ * the life of this dialog.
*
* @return the working sets
*/
@@ -369,11 +364,10 @@ public abstract class AbstractWorkingSetDialog extends SelectionDialog implement
}
/**
- * Remove the working sets contained in the provided selection from the
- * working set manager.
+ * Remove the working sets contained in the provided selection from the working
+ * set manager.
*
- * @param selection
- * the sets
+ * @param selection the sets
*/
protected void removeSelectedWorkingSets(List<IWorkingSet> selection) {
IWorkingSetManager manager = WorkbenchPlugin.getDefault().getWorkingSetManager();
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ActionSetComparator.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ActionSetComparator.java
index ecdb9000755..4c5b7a5c12f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ActionSetComparator.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ActionSetComparator.java
@@ -22,26 +22,23 @@ import org.eclipse.ui.internal.registry.IActionSetDescriptor;
*/
public class ActionSetComparator extends ViewerComparator {
- /**
- * Creates a new sorter.
- */
- public ActionSetComparator() {
- }
+ /**
+ * Creates a new sorter.
+ */
+ public ActionSetComparator() {
+ }
- /**
- * Returns a negative, zero, or positive number depending on whether
- * the first element is less than, equal to, or greater than
- * the second element.
- */
- @Override
+ /**
+ * Returns a negative, zero, or positive number depending on whether the first
+ * element is less than, equal to, or greater than the second element.
+ */
+ @Override
public int compare(Viewer viewer, Object e1, Object e2) {
- if (e1 instanceof IActionSetDescriptor) {
- String str1 = DialogUtil.removeAccel(((IActionSetDescriptor) e1)
- .getLabel());
- String str2 = DialogUtil.removeAccel(((IActionSetDescriptor) e2)
- .getLabel());
- return getComparator().compare(str1, str2);
- }
- return 0;
- }
+ if (e1 instanceof IActionSetDescriptor) {
+ String str1 = DialogUtil.removeAccel(((IActionSetDescriptor) e1).getLabel());
+ String str2 = DialogUtil.removeAccel(((IActionSetDescriptor) e2).getLabel());
+ return getComparator().compare(str1, str2);
+ }
+ return 0;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/AdaptableForwarder.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/AdaptableForwarder.java
index c63ca8f02a1..ca66b18b5b5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/AdaptableForwarder.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/AdaptableForwarder.java
@@ -18,8 +18,8 @@ import org.eclipse.core.runtime.IAdaptable;
/**
* Class that wraps an object and forwards adapter calls if possible, otherwise
- * returns the object. This is used to maintain API compatibility with methods that
- * need an IAdaptable but when the operation supports a broader type.
+ * returns the object. This is used to maintain API compatibility with methods
+ * that need an IAdaptable but when the operation supports a broader type.
*
* @since 3.2
*/
@@ -29,6 +29,7 @@ public class AdaptableForwarder implements IAdaptable {
/**
* Create a new instance of the receiver.
+ *
* @param element
*/
public AdaptableForwarder(Object element) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/CapabilityFilter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/CapabilityFilter.java
index 36c12838a6b..3613057d23d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/CapabilityFilter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/CapabilityFilter.java
@@ -18,8 +18,8 @@ import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.ui.activities.WorkbenchActivityHelper;
/**
- * The CapabilityFilter is a filter that uses the capabilities
- * support as filter for items.
+ * The CapabilityFilter is a filter that uses the capabilities support as filter
+ * for items.
*/
public class CapabilityFilter extends ViewerFilter {
@@ -33,7 +33,7 @@ public class CapabilityFilter extends ViewerFilter {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
- return ! WorkbenchActivityHelper.filterItem(element);
+ return !WorkbenchActivityHelper.filterItem(element);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ContentTypeFilenameAssociationDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ContentTypeFilenameAssociationDialog.java
index 7b03c06f46f..bf32423d22f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ContentTypeFilenameAssociationDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ContentTypeFilenameAssociationDialog.java
@@ -41,13 +41,13 @@ public class ContentTypeFilenameAssociationDialog extends TitleAreaDialog {
private static final String DIALOG_SETTINGS_SECTION = "ContentTypeFilenameAssociationDialog"; //$NON-NLS-1$
- private String filename = ""; //$NON-NLS-1$
+ private String filename = ""; //$NON-NLS-1$
- private String initialValue;
+ private String initialValue;
- private Text filenameField;
+ private Text filenameField;
- private Button okButton;
+ private Button okButton;
private String title;
@@ -67,37 +67,37 @@ public class ContentTypeFilenameAssociationDialog extends TitleAreaDialog {
*/
private int specType;
- /**
- * Constructs a new file extension dialog.
- *
- * @param parentShell the parent shell
- * @param title the dialog title
- * @param helpContextId the help context for this dialog
- * @param headerTitle the dialog header
- * @param message the dialog message
- * @param label the label for the "file type" field
- * @since 3.4
- */
- public ContentTypeFilenameAssociationDialog(Shell parentShell, String title, String helpContextId, String headerTitle, String message, String label) {
- super(parentShell);
- this.title = title;
- this.helpContextId = helpContextId;
+ /**
+ * Constructs a new file extension dialog.
+ *
+ * @param parentShell the parent shell
+ * @param title the dialog title
+ * @param helpContextId the help context for this dialog
+ * @param headerTitle the dialog header
+ * @param message the dialog message
+ * @param label the label for the "file type" field
+ * @since 3.4
+ */
+ public ContentTypeFilenameAssociationDialog(Shell parentShell, String title, String helpContextId,
+ String headerTitle, String message, String label) {
+ super(parentShell);
+ this.title = title;
+ this.helpContextId = helpContextId;
this.headerTitle = headerTitle;
message2 = message;
this.label = label;
setShellStyle(getShellStyle() | SWT.SHEET);
- }
+ }
- @Override
+ @Override
protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(title);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(shell, helpContextId);
- }
-
+ super.configureShell(shell);
+ shell.setText(title);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(shell, helpContextId);
+ }
- @Override
+ @Override
protected Control createDialogArea(Composite parent) {
Composite parentComposite = (Composite) super.createDialogArea(parent);
@@ -107,8 +107,7 @@ public class ContentTypeFilenameAssociationDialog extends TitleAreaDialog {
setTitle(headerTitle);
setMessage(message2);
- new Label(contents, SWT.LEFT)
- .setText(label);
+ new Label(contents, SWT.LEFT).setText(label);
filenameField = new Text(contents, SWT.SINGLE | SWT.BORDER);
if (initialValue != null) {
@@ -125,54 +124,51 @@ public class ContentTypeFilenameAssociationDialog extends TitleAreaDialog {
Dialog.applyDialogFont(parentComposite);
Point defaultMargins = LayoutConstants.getMargins();
- GridLayoutFactory.fillDefaults().numColumns(2).margins(
- defaultMargins.x, defaultMargins.y).generateLayout(contents);
+ GridLayoutFactory.fillDefaults().numColumns(2).margins(defaultMargins.x, defaultMargins.y)
+ .generateLayout(contents);
return contents;
}
-
- @Override
+ @Override
protected void createButtonsForButtonBar(Composite parent) {
- okButton = createButton(parent, IDialogConstants.OK_ID,
- IDialogConstants.OK_LABEL, true);
- okButton.setEnabled(false);
- createButton(parent, IDialogConstants.CANCEL_ID,
- IDialogConstants.CANCEL_LABEL, false);
- }
-
- /**
- * Validate the user input for a file type
- */
- private boolean validateFileType() {
- // We need kernel api to validate the extension or a filename
-
- // check for empty name and extension
- if (filename.length() == 0) {
- setErrorMessage(null);
- return false;
- }
-
- // check for empty extension if there is no name
- int index = filename.lastIndexOf('.');
- if (index == filename.length() - 1) {
- if (index == 0 || (index == 1 && filename.charAt(0) == '*')) {
- setErrorMessage(WorkbenchMessages.FileExtension_extensionEmptyMessage);
- return false;
- }
- }
-
- // check for characters before *
- // or no other characters
- // or next chatacter not '.'
- // or another *
- index = filename.indexOf('*');
- if (index > -1) {
- if (filename.length() == 1) {
- setErrorMessage(WorkbenchMessages.FileExtension_extensionEmptyMessage);
- return false;
- }
- }
+ okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
+ okButton.setEnabled(false);
+ createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
+ }
+
+ /**
+ * Validate the user input for a file type
+ */
+ private boolean validateFileType() {
+ // We need kernel api to validate the extension or a filename
+
+ // check for empty name and extension
+ if (filename.length() == 0) {
+ setErrorMessage(null);
+ return false;
+ }
+
+ // check for empty extension if there is no name
+ int index = filename.lastIndexOf('.');
+ if (index == filename.length() - 1) {
+ if (index == 0 || (index == 1 && filename.charAt(0) == '*')) {
+ setErrorMessage(WorkbenchMessages.FileExtension_extensionEmptyMessage);
+ return false;
+ }
+ }
+
+ // check for characters before *
+ // or no other characters
+ // or next chatacter not '.'
+ // or another *
+ index = filename.indexOf('*');
+ if (index > -1) {
+ if (filename.length() == 1) {
+ setErrorMessage(WorkbenchMessages.FileExtension_extensionEmptyMessage);
+ return false;
+ }
+ }
if (hasWildcards(filename)) {
this.specType = IContentType.FILE_PATTERN_SPEC; // start with most general, then refine
@@ -186,37 +182,37 @@ public class ContentTypeFilenameAssociationDialog extends TitleAreaDialog {
} else {
this.specType = IContentType.FILE_NAME_SPEC;
}
- setErrorMessage(null);
- return true;
- }
+ setErrorMessage(null);
+ return true;
+ }
private static boolean hasWildcards(String s) {
return s.contains("?") || s.contains("*"); //$NON-NLS-1$ //$NON-NLS-2$
}
- /**
+ /**
* Sets the initial value that should be prepopulated in this dialog.
*
- * @param initialValue
- * the value to be displayed to the user
+ * @param initialValue the value to be displayed to the user
* @since 3.4
*/
- public void setInitialValue(String initialValue) {
- this.initialValue = initialValue;
- }
+ public void setInitialValue(String initialValue) {
+ this.initialValue = initialValue;
+ }
- @Override
+ @Override
protected IDialogSettings getDialogBoundsSettings() {
- IDialogSettings settings = WorkbenchPlugin.getDefault().getDialogSettings();
- IDialogSettings section = settings.getSection(DIALOG_SETTINGS_SECTION);
- if (section == null) section = settings.addNewSection(DIALOG_SETTINGS_SECTION);
- return section;
- }
+ IDialogSettings settings = WorkbenchPlugin.getDefault().getDialogSettings();
+ IDialogSettings section = settings.getSection(DIALOG_SETTINGS_SECTION);
+ if (section == null)
+ section = settings.addNewSection(DIALOG_SETTINGS_SECTION);
+ return section;
+ }
- @Override
+ @Override
protected boolean isResizable() {
- return true;
- }
+ return true;
+ }
/**
* @return the text for the spec. For the case of extensions, it's only the
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ContentTypesPreferencePage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ContentTypesPreferencePage.java
index 2c830bb2a64..e2289fc393c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ContentTypesPreferencePage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ContentTypesPreferencePage.java
@@ -85,8 +85,7 @@ import org.eclipse.ui.statushandlers.StatusManager;
*
* @since 3.1
*/
-public class ContentTypesPreferencePage extends PreferencePage implements
- IWorkbenchPreferencePage {
+public class ContentTypesPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
public ContentTypesPreferencePage() {
}
@@ -134,14 +133,11 @@ public class ContentTypesPreferencePage extends PreferencePage implements
final int sortValue;
/**
- * @param specText
- * the spec text (filename, extension or pattern)
- * @param specType
- * one of {@link IContentType#FILE_NAME_SPEC},
- * {@link IContentType#FILE_EXTENSION_SPEC},
- * {@link IContentType#FILE_PATTERN_SPEC}
- * @param isPredefined
- * true if predefined, false is user-defined
+ * @param specText the spec text (filename, extension or pattern)
+ * @param specType one of {@link IContentType#FILE_NAME_SPEC},
+ * {@link IContentType#FILE_EXTENSION_SPEC},
+ * {@link IContentType#FILE_PATTERN_SPEC}
+ * @param isPredefined true if predefined, false is user-defined
* @param sortValue
*/
public Spec(String specText, int specType, boolean isPredefined, int sortValue) {
@@ -214,13 +210,12 @@ public class ContentTypesPreferencePage extends PreferencePage implements
String[] prePatternFileSpecs = contentType
.getFileSpecs(IContentType.FILE_PATTERN_SPEC | IContentType.IGNORE_USER_DEFINED);
- return createSpecs(userextfileSpecs, usernamefileSpecs, userPatternFileSpecs,
- preextfileSpecs, prenamefileSpecs, prePatternFileSpecs);
+ return createSpecs(userextfileSpecs, usernamefileSpecs, userPatternFileSpecs, preextfileSpecs,
+ prenamefileSpecs, prePatternFileSpecs);
}
- private Spec[] createSpecs(String[] userextfileSpecs,
- String[] usernamefileSpecs, String[] userPatternFileSpecs, String[] preextfileSpecs,
- String[] prenamefileSpecs, String[] prePatternFileSpecs) {
+ private Spec[] createSpecs(String[] userextfileSpecs, String[] usernamefileSpecs, String[] userPatternFileSpecs,
+ String[] preextfileSpecs, String[] prenamefileSpecs, String[] prePatternFileSpecs) {
List<Spec> returnValues = new ArrayList<>();
for (String usernamefileSpec : usernamefileSpecs) {
Spec spec = new Spec(usernamefileSpec, IContentType.FILE_NAME_SPEC, false, 0);
@@ -444,8 +439,7 @@ public class ContentTypesPreferencePage extends PreferencePage implements
charsetField.setLayoutData(data);
setButton = new Button(composite, SWT.PUSH);
setButton.setFont(parent.getFont());
- setButton
- .setText(WorkbenchMessages.ContentTypes_characterSetUpdateLabel);
+ setButton.setText(WorkbenchMessages.ContentTypes_characterSetUpdateLabel);
setButton.setEnabled(false);
setButtonLayoutData(setButton);
setButton.addSelectionListener(widgetSelectedAdapter(e -> {
@@ -457,8 +451,7 @@ public class ContentTypesPreferencePage extends PreferencePage implements
getSelectedContentType().setDefaultCharset(text);
setButton.setEnabled(false);
} catch (CoreException e1) {
- StatusUtil.handleStatus(e1.getStatus(), StatusManager.SHOW,
- parent.getShell());
+ StatusUtil.handleStatus(e1.getStatus(), StatusManager.SHOW, parent.getShell());
}
}));
@@ -470,8 +463,7 @@ public class ContentTypesPreferencePage extends PreferencePage implements
if (charset == null) {
charset = ""; //$NON-NLS-1$
}
- setButton.setEnabled(!charset.equals(charsetField.getText())
- && getErrorMessage() == null);
+ setButton.setEnabled(!charset.equals(charsetField.getText()) && getErrorMessage() == null);
}
});
@@ -540,8 +532,7 @@ public class ContentTypesPreferencePage extends PreferencePage implements
Shell shell = composite.getShell();
IContentType selectedContentType = getSelectedContentType();
ContentTypeFilenameAssociationDialog dialog = new ContentTypeFilenameAssociationDialog(shell,
- WorkbenchMessages.ContentTypes_addDialog_title,
- IWorkbenchHelpContextIds.FILE_EXTENSION_DIALOG,
+ WorkbenchMessages.ContentTypes_addDialog_title, IWorkbenchHelpContextIds.FILE_EXTENSION_DIALOG,
WorkbenchMessages.ContentTypes_addDialog_messageHeader,
WorkbenchMessages.ContentTypes_addDialog_message, WorkbenchMessages.ContentTypes_addDialog_label);
if (dialog.open() == Window.OK) {
@@ -566,8 +557,7 @@ public class ContentTypesPreferencePage extends PreferencePage implements
IContentType selectedContentType = getSelectedContentType();
Spec spec = getSelectedSpecs()[0];
ContentTypeFilenameAssociationDialog dialog = new ContentTypeFilenameAssociationDialog(shell,
- WorkbenchMessages.ContentTypes_editDialog_title,
- IWorkbenchHelpContextIds.FILE_EXTENSION_DIALOG,
+ WorkbenchMessages.ContentTypes_editDialog_title, IWorkbenchHelpContextIds.FILE_EXTENSION_DIALOG,
WorkbenchMessages.ContentTypes_editDialog_messageHeader,
WorkbenchMessages.ContentTypes_editDialog_message, WorkbenchMessages.ContentTypes_editDialog_label);
dialog.setInitialValue(spec.toString());
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/DataTransferWizardCollectionComparator.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/DataTransferWizardCollectionComparator.java
index d1885089349..55b1fc65781 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/DataTransferWizardCollectionComparator.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/DataTransferWizardCollectionComparator.java
@@ -19,54 +19,54 @@ import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.ui.internal.registry.WizardsRegistryReader;
/**
- * A Viewer element sorter that sorts Elements by their name attribute.
- * Note that capitalization differences are not considered by this
- * sorter, so a < B < c.
+ * A Viewer element sorter that sorts Elements by their name attribute. Note
+ * that capitalization differences are not considered by this sorter, so a < B <
+ * c.
*
- * NOTE exceptions to the above: an element with the system's reserved
- * category for Other Wizards will always be sorted such that it will
- * ultimately be placed at the end of the sorted result, and an elemen
- * with the reserved category name for General wizards will always be
- * placed at the beginning of the sorted result.
+ * NOTE exceptions to the above: an element with the system's reserved category
+ * for Other Wizards will always be sorted such that it will ultimately be
+ * placed at the end of the sorted result, and an elemen with the reserved
+ * category name for General wizards will always be placed at the beginning of
+ * the sorted result.
*
- * @since 3.2
+ * @since 3.2
*/
class DataTransferWizardCollectionComparator extends ViewerComparator {
/**
* Static instance of this class.
*/
- public static final DataTransferWizardCollectionComparator INSTANCE = new DataTransferWizardCollectionComparator();
+ public static final DataTransferWizardCollectionComparator INSTANCE = new DataTransferWizardCollectionComparator();
- /**
- * Creates an instance of <code>DataTransferWizardCollectionSorter</code>. Since this
- * is a stateless sorter, it is only accessible as a singleton; the private
- * visibility of this constructor ensures this.
- */
- private DataTransferWizardCollectionComparator() {
- super();
- }
+ /**
+ * Creates an instance of <code>DataTransferWizardCollectionSorter</code>. Since
+ * this is a stateless sorter, it is only accessible as a singleton; the private
+ * visibility of this constructor ensures this.
+ */
+ private DataTransferWizardCollectionComparator() {
+ super();
+ }
- @Override
+ @Override
public int category(Object element) {
- if (element instanceof WizardCollectionElement){
- String id = ((WizardCollectionElement)element).getId();
- if (WizardsRegistryReader.GENERAL_WIZARD_CATEGORY.equals(id)) {
+ if (element instanceof WizardCollectionElement) {
+ String id = ((WizardCollectionElement) element).getId();
+ if (WizardsRegistryReader.GENERAL_WIZARD_CATEGORY.equals(id)) {
return 1;
}
- if (WizardsRegistryReader.UNCATEGORIZED_WIZARD_CATEGORY.equals(id)) {
+ if (WizardsRegistryReader.UNCATEGORIZED_WIZARD_CATEGORY.equals(id)) {
return 3;
}
- return 2;
+ return 2;
}
return super.category(element);
}
/**
- * Return true if this sorter is affected by a property
- * change of propertyName on the specified element.
- */
- @Override
+ * Return true if this sorter is affected by a property change of propertyName
+ * on the specified element.
+ */
+ @Override
public boolean isSorterProperty(Object object, String propertyId) {
- return propertyId.equals(IBasicPropertyConstants.P_TEXT);
- }
+ return propertyId.equals(IBasicPropertyConstants.P_TEXT);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/DecoratorsPreferencePage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/DecoratorsPreferencePage.java
index b8629f31715..2dfaa9de30d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/DecoratorsPreferencePage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/DecoratorsPreferencePage.java
@@ -43,15 +43,15 @@ import org.eclipse.ui.internal.decorators.DecoratorDefinition;
import org.eclipse.ui.internal.decorators.DecoratorManager;
/**
- * The DecoratorsPreferencePage is the preference page for enabling and disabling
- * the decorators in the image and for giving the user a description of the decorator.
+ * The DecoratorsPreferencePage is the preference page for enabling and
+ * disabling the decorators in the image and for giving the user a description
+ * of the decorator.
*/
-public class DecoratorsPreferencePage extends PreferencePage implements
- IWorkbenchPreferencePage {
+public class DecoratorsPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
- private Text descriptionText;
+ private Text descriptionText;
- private CheckboxTableViewer checkboxViewer;
+ private CheckboxTableViewer checkboxViewer;
/**
* Create decorators preference page with description header.
@@ -60,100 +60,97 @@ public class DecoratorsPreferencePage extends PreferencePage implements
setDescription(WorkbenchMessages.DecoratorsPreferencePage_explanation);
}
- /**
- * @see PreferencePage#createContents(Composite)
- */
- @Override
+ /**
+ * @see PreferencePage#createContents(Composite)
+ */
+ @Override
protected Control createContents(Composite parent) {
- Font font = parent.getFont();
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
- IWorkbenchHelpContextIds.DECORATORS_PREFERENCE_PAGE);
-
- Composite mainComposite = new Composite(parent, SWT.NONE);
- mainComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- mainComposite.setFont(font);
-
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.verticalSpacing = 10;
- mainComposite.setLayout(layout);
-
- createDecoratorsArea(mainComposite);
- createDescriptionArea(mainComposite);
- populateDecorators();
-
- return mainComposite;
- }
-
- /**
- * Creates the widgets for the list of decorators.
- */
- private void createDecoratorsArea(Composite mainComposite) {
-
- Font mainFont = mainComposite.getFont();
- Composite decoratorsComposite = new Composite(mainComposite, SWT.NONE);
- decoratorsComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
- GridLayout decoratorsLayout = new GridLayout();
- decoratorsLayout.marginWidth = 0;
- decoratorsLayout.marginHeight = 0;
- decoratorsComposite.setLayout(decoratorsLayout);
- decoratorsComposite.setFont(mainFont);
-
- Label decoratorsLabel = new Label(decoratorsComposite, SWT.NONE);
- decoratorsLabel.setText(WorkbenchMessages.DecoratorsPreferencePage_decoratorsLabel);
- decoratorsLabel.setFont(mainFont);
-
- // Checkbox table viewer of decorators
- checkboxViewer = CheckboxTableViewer.newCheckList(decoratorsComposite,
- SWT.SINGLE | SWT.TOP | SWT.BORDER);
- GridData layoutData = new GridData(GridData.FILL_BOTH);
+ Font font = parent.getFont();
+
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IWorkbenchHelpContextIds.DECORATORS_PREFERENCE_PAGE);
+
+ Composite mainComposite = new Composite(parent, SWT.NONE);
+ mainComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ mainComposite.setFont(font);
+
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ layout.verticalSpacing = 10;
+ mainComposite.setLayout(layout);
+
+ createDecoratorsArea(mainComposite);
+ createDescriptionArea(mainComposite);
+ populateDecorators();
+
+ return mainComposite;
+ }
+
+ /**
+ * Creates the widgets for the list of decorators.
+ */
+ private void createDecoratorsArea(Composite mainComposite) {
+
+ Font mainFont = mainComposite.getFont();
+ Composite decoratorsComposite = new Composite(mainComposite, SWT.NONE);
+ decoratorsComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ GridLayout decoratorsLayout = new GridLayout();
+ decoratorsLayout.marginWidth = 0;
+ decoratorsLayout.marginHeight = 0;
+ decoratorsComposite.setLayout(decoratorsLayout);
+ decoratorsComposite.setFont(mainFont);
+
+ Label decoratorsLabel = new Label(decoratorsComposite, SWT.NONE);
+ decoratorsLabel.setText(WorkbenchMessages.DecoratorsPreferencePage_decoratorsLabel);
+ decoratorsLabel.setFont(mainFont);
+
+ // Checkbox table viewer of decorators
+ checkboxViewer = CheckboxTableViewer.newCheckList(decoratorsComposite, SWT.SINGLE | SWT.TOP | SWT.BORDER);
+ GridData layoutData = new GridData(GridData.FILL_BOTH);
layoutData.heightHint = 300;
checkboxViewer.getTable().setLayoutData(layoutData);
- checkboxViewer.getTable().setFont(decoratorsComposite.getFont());
- checkboxViewer.setLabelProvider(new LabelProvider() {
- @Override
+ checkboxViewer.getTable().setFont(decoratorsComposite.getFont());
+ checkboxViewer.setLabelProvider(new LabelProvider() {
+ @Override
public String getText(Object element) {
- return ((DecoratorDefinition) element).getName();
- }
- });
- checkboxViewer.getTable().setFont(mainFont);
+ return ((DecoratorDefinition) element).getName();
+ }
+ });
+ checkboxViewer.getTable().setFont(mainFont);
- checkboxViewer.setContentProvider(new IStructuredContentProvider() {
- private final Comparator comparer = new Comparator() {
- private Collator collator = Collator.getInstance();
+ checkboxViewer.setContentProvider(new IStructuredContentProvider() {
+ private final Comparator comparer = new Comparator() {
+ private Collator collator = Collator.getInstance();
- @Override
+ @Override
public int compare(Object arg0, Object arg1) {
- String s1 = ((DecoratorDefinition) arg0).getName();
- String s2 = ((DecoratorDefinition) arg1).getName();
- return collator.compare(s1, s2);
- }
- };
+ String s1 = ((DecoratorDefinition) arg0).getName();
+ String s2 = ((DecoratorDefinition) arg1).getName();
+ return collator.compare(s1, s2);
+ }
+ };
- @Override
+ @Override
public void dispose() {
- //Nothing to do on dispose
- }
+ // Nothing to do on dispose
+ }
- @Override
- public void inputChanged(Viewer viewer, Object oldInput,
- Object newInput) {
- }
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
- @Override
+ @Override
public Object[] getElements(Object inputElement) {
- //Make an entry for each decorator definition
- Object[] elements = (Object[]) inputElement;
- Object[] results = new Object[elements.length];
- System.arraycopy(elements, 0, results, 0, elements.length);
- Collections.sort(Arrays.asList(results), comparer);
- return results;
- }
+ // Make an entry for each decorator definition
+ Object[] elements = (Object[]) inputElement;
+ Object[] results = new Object[elements.length];
+ System.arraycopy(elements, 0, results, 0, elements.length);
+ Collections.sort(Arrays.asList(results), comparer);
+ return results;
+ }
- });
+ });
checkboxViewer.addSelectionChangedListener(event -> {
if (event.getSelection() instanceof IStructuredSelection) {
@@ -167,130 +164,127 @@ public class DecoratorsPreferencePage extends PreferencePage implements
}
});
- checkboxViewer.addCheckStateListener(event -> checkboxViewer.setSelection(new StructuredSelection(event
- .getElement())));
- }
-
- /**
- * Creates the widgets for the description.
- */
- private void createDescriptionArea(Composite mainComposite) {
-
- Font mainFont = mainComposite.getFont();
- Composite textComposite = new Composite(mainComposite, SWT.NONE);
- textComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
- GridLayout textLayout = new GridLayout();
- textLayout.marginWidth = 0;
- textLayout.marginHeight = 0;
- textComposite.setLayout(textLayout);
- textComposite.setFont(mainFont);
-
- Label descriptionLabel = new Label(textComposite, SWT.NONE);
- descriptionLabel.setText(WorkbenchMessages.DecoratorsPreferencePage_description);
- descriptionLabel.setFont(mainFont);
-
- descriptionText = new Text(textComposite, SWT.MULTI | SWT.WRAP
- | SWT.READ_ONLY | SWT.BORDER | SWT.H_SCROLL);
+ checkboxViewer.addCheckStateListener(
+ event -> checkboxViewer.setSelection(new StructuredSelection(event.getElement())));
+ }
+
+ /**
+ * Creates the widgets for the description.
+ */
+ private void createDescriptionArea(Composite mainComposite) {
+
+ Font mainFont = mainComposite.getFont();
+ Composite textComposite = new Composite(mainComposite, SWT.NONE);
+ textComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ GridLayout textLayout = new GridLayout();
+ textLayout.marginWidth = 0;
+ textLayout.marginHeight = 0;
+ textComposite.setLayout(textLayout);
+ textComposite.setFont(mainFont);
+
+ Label descriptionLabel = new Label(textComposite, SWT.NONE);
+ descriptionLabel.setText(WorkbenchMessages.DecoratorsPreferencePage_description);
+ descriptionLabel.setFont(mainFont);
+
+ descriptionText = new Text(textComposite, SWT.MULTI | SWT.WRAP | SWT.READ_ONLY | SWT.BORDER | SWT.H_SCROLL);
GridData layoutData = new GridData(GridData.FILL_BOTH);
layoutData.minimumHeight = 50;
descriptionText.setLayoutData(layoutData);
- descriptionText.setFont(mainFont);
- }
-
- /**
- * Populates the list of decorators.
- */
- private void populateDecorators() {
- DecoratorDefinition[] definitions = getAllDefinitions();
- checkboxViewer.setInput(definitions);
- for (DecoratorDefinition definition : definitions) {
- checkboxViewer.setChecked(definition, definition
- .isEnabled());
- }
- }
-
- /**
- * Show the selected description in the text.
- */
- private void showDescription(DecoratorDefinition definition) {
- if (descriptionText == null || descriptionText.isDisposed()) {
- return;
- }
- String text = definition.getDescription();
- if (text == null || text.length() == 0) {
+ descriptionText.setFont(mainFont);
+ }
+
+ /**
+ * Populates the list of decorators.
+ */
+ private void populateDecorators() {
+ DecoratorDefinition[] definitions = getAllDefinitions();
+ checkboxViewer.setInput(definitions);
+ for (DecoratorDefinition definition : definitions) {
+ checkboxViewer.setChecked(definition, definition.isEnabled());
+ }
+ }
+
+ /**
+ * Show the selected description in the text.
+ */
+ private void showDescription(DecoratorDefinition definition) {
+ if (descriptionText == null || descriptionText.isDisposed()) {
+ return;
+ }
+ String text = definition.getDescription();
+ if (text == null || text.length() == 0) {
descriptionText.setText(WorkbenchMessages.PreferencePage_noDescription);
} else {
descriptionText.setText(text);
}
- }
-
- /**
- * Clear the selected description in the text.
- */
- private void clearDescription() {
- if (descriptionText == null || descriptionText.isDisposed()) {
- return;
- }
- descriptionText.setText(""); //$NON-NLS-1$
- }
-
- /**
- * @see PreferencePage#performDefaults()
- */
- @Override
+ }
+
+ /**
+ * Clear the selected description in the text.
+ */
+ private void clearDescription() {
+ if (descriptionText == null || descriptionText.isDisposed()) {
+ return;
+ }
+ descriptionText.setText(""); //$NON-NLS-1$
+ }
+
+ /**
+ * @see PreferencePage#performDefaults()
+ */
+ @Override
protected void performDefaults() {
- super.performDefaults();
+ super.performDefaults();
DecoratorManager manager = WorkbenchPlugin.getDefault().getDecoratorManager();
for (DecoratorDefinition definition : manager.getAllDecoratorDefinitions()) {
- checkboxViewer.setChecked(definition, definition
- .getDefaultValue());
- }
- }
-
- /**
- * @see IPreferencePage#performOk()
- */
- @Override
+ checkboxViewer.setChecked(definition, definition.getDefaultValue());
+ }
+ }
+
+ /**
+ * @see IPreferencePage#performOk()
+ */
+ @Override
public boolean performOk() {
- if (super.performOk()) {
- DecoratorManager manager = getDecoratorManager();
- //Clear the caches first to avoid unneccessary updates
- manager.clearCaches();
+ if (super.performOk()) {
+ DecoratorManager manager = getDecoratorManager();
+ // Clear the caches first to avoid unneccessary updates
+ manager.clearCaches();
for (DecoratorDefinition definition : manager.getAllDecoratorDefinitions()) {
- boolean checked = checkboxViewer.getChecked(definition);
- definition.setEnabled(checked);
-
- }
- //Have the manager clear again as there may have been
- //extra updates fired by the enablement changes.
- manager.clearCaches();
- manager.updateForEnablementChange();
- return true;
- }
- return false;
- }
-
- /**
- * @see IWorkbenchPreferencePage#init(IWorkbench)
- */
- @Override
+ boolean checked = checkboxViewer.getChecked(definition);
+ definition.setEnabled(checked);
+
+ }
+ // Have the manager clear again as there may have been
+ // extra updates fired by the enablement changes.
+ manager.clearCaches();
+ manager.updateForEnablementChange();
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @see IWorkbenchPreferencePage#init(IWorkbench)
+ */
+ @Override
public void init(IWorkbench workbench) {
- }
-
- /**
- * Get the decorator definitions for the workbench.
- */
- private DecoratorDefinition[] getAllDefinitions() {
- return getDecoratorManager().getAllDecoratorDefinitions();
- }
-
- /**
- * Get the DecoratorManager being used for this page.
- *
- * @return the decorator manager
- */
- private DecoratorManager getDecoratorManager() {
- return WorkbenchPlugin.getDefault().getDecoratorManager();
- }
+ }
+
+ /**
+ * Get the decorator definitions for the workbench.
+ */
+ private DecoratorDefinition[] getAllDefinitions() {
+ return getDecoratorManager().getAllDecoratorDefinitions();
+ }
+
+ /**
+ * Get the DecoratorManager being used for this page.
+ *
+ * @return the decorator manager
+ */
+ private DecoratorManager getDecoratorManager() {
+ return WorkbenchPlugin.getDefault().getDecoratorManager();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/DialogUtil.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/DialogUtil.java
index 0879b747229..63781aa4269 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/DialogUtil.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/DialogUtil.java
@@ -26,99 +26,96 @@ import org.eclipse.ui.statushandlers.StatusManager;
/**
* Utility class to help with dialogs.
* <p>
- * Note that a copy of this class exists in the
- * org.eclipse.ui.internal.ide package.
+ * Note that a copy of this class exists in the org.eclipse.ui.internal.ide
+ * package.
* </p>
*/
public class DialogUtil {
- /**
- * Prevent instantiation.
- */
- private DialogUtil() {
- }
-
- /**
- * Open an error style dialog for PartInitException by
- * including any extra information from the nested
- * CoreException if present.
- */
- public static void openError(Shell parent, String title, String message,
- PartInitException exception) {
- // Check for a nested CoreException
- CoreException nestedException = null;
- IStatus status = exception.getStatus();
- if (status != null && status.getException() instanceof CoreException) {
+ /**
+ * Prevent instantiation.
+ */
+ private DialogUtil() {
+ }
+
+ /**
+ * Open an error style dialog for PartInitException by including any extra
+ * information from the nested CoreException if present.
+ */
+ public static void openError(Shell parent, String title, String message, PartInitException exception) {
+ // Check for a nested CoreException
+ CoreException nestedException = null;
+ IStatus status = exception.getStatus();
+ if (status != null && status.getException() instanceof CoreException) {
nestedException = (CoreException) status.getException();
}
- IStatus errorStatus = null;
+ IStatus errorStatus = null;
if (nestedException != null) {
// Open an error dialog and include the extra
// status information from the nested CoreException
- errorStatus = StatusUtil.newStatus(nestedException.getStatus(),
- message);
+ errorStatus = StatusUtil.newStatus(nestedException.getStatus(), message);
} else {
// Open a regular error dialog since there is no
// extra information to displa
- errorStatus = new Status(IStatus.ERROR,
- WorkbenchPlugin.PI_WORKBENCH, message);
+ errorStatus = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, message);
}
StatusUtil.handleStatus(errorStatus, StatusManager.SHOW, parent);
- }
+ }
- /**
- * Removes the '&' accelerator indicator from a label, if any. Also removes
- * the () accelerators which are used in Asian languages.
+ /**
+ * Removes the '&' accelerator indicator from a label, if any. Also removes the
+ * () accelerators which are used in Asian languages.
*/
- public static String removeAccel(String label) {
+ public static String removeAccel(String label) {
- int startBracket = label.indexOf("(&"); //$NON-NLS-1$
- //Non latin accelerator?
- if (startBracket >= 0) {
- int endBracket = label.indexOf(')');
+ int startBracket = label.indexOf("(&"); //$NON-NLS-1$
+ // Non latin accelerator?
+ if (startBracket >= 0) {
+ int endBracket = label.indexOf(')');
- //If there is more than one character it is not an accelerator
- if ((endBracket - startBracket) == 3) {
- return label.substring(0, startBracket)
- + label.substring(endBracket + 1);
+ // If there is more than one character it is not an accelerator
+ if ((endBracket - startBracket) == 3) {
+ return label.substring(0, startBracket) + label.substring(endBracket + 1);
}
- }
+ }
- int i = label.indexOf('&');
- if (i >= 0) {
+ int i = label.indexOf('&');
+ if (i >= 0) {
label = label.substring(0, i) + label.substring(i + 1);
}
- return label;
- }
-
- /**
- * Return the number of rows available in the current display using the
- * current font.
- * @param parent The Composite whose Font will be queried.
- * @return int The result of the display size divided by the font size.
- */
- public static int availableRows(Composite parent) {
-
- int fontHeight = (parent.getFont().getFontData())[0].getHeight();
- int displayHeight = parent.getDisplay().getClientArea().height;
-
- return displayHeight / fontHeight;
- }
-
- /**
- * Return whether or not the font in the parent is the size of a result
- * font (i.e. smaller than the High Contrast Font). This method is used to
- * make layout decisions based on screen space.
- * @param parent The Composite whose Font will be queried.
- * @return boolean. True if there are more than 50 lines of possible
- * text in the display.
- */
- public static boolean inRegularFontMode(Composite parent) {
-
- return availableRows(parent) > 50;
- }
+ return label;
+ }
+
+ /**
+ * Return the number of rows available in the current display using the current
+ * font.
+ *
+ * @param parent The Composite whose Font will be queried.
+ * @return int The result of the display size divided by the font size.
+ */
+ public static int availableRows(Composite parent) {
+
+ int fontHeight = (parent.getFont().getFontData())[0].getHeight();
+ int displayHeight = parent.getDisplay().getClientArea().height;
+
+ return displayHeight / fontHeight;
+ }
+
+ /**
+ * Return whether or not the font in the parent is the size of a result font
+ * (i.e. smaller than the High Contrast Font). This method is used to make
+ * layout decisions based on screen space.
+ *
+ * @param parent The Composite whose Font will be queried.
+ * @return boolean. True if there are more than 50 lines of possible text in the
+ * display.
+ */
+ public static boolean inRegularFontMode(Composite parent) {
+
+ return availableRows(parent) > 50;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/EditorsPreferencePage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/EditorsPreferencePage.java
index 7e630899bb8..753592c272c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/EditorsPreferencePage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/EditorsPreferencePage.java
@@ -45,29 +45,27 @@ import org.eclipse.ui.internal.util.PrefUtil;
/**
* The Editors preference page of the workbench.
*/
-public class EditorsPreferencePage extends PreferencePage implements
- IWorkbenchPreferencePage {
+public class EditorsPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
private static final int REUSE_INDENT = 20;
- protected Composite editorReuseGroup;
+ protected Composite editorReuseGroup;
- private Button reuseEditors;
+ private Button reuseEditors;
- protected Button showMultipleEditorTabs;
+ protected Button showMultipleEditorTabs;
- protected Button useIPersistableEditor;
+ protected Button useIPersistableEditor;
- private Composite editorReuseIndentGroup;
+ private Composite editorReuseIndentGroup;
- private Composite editorReuseThresholdGroup;
+ private Composite editorReuseThresholdGroup;
- private IntegerFieldEditor reuseEditorsThreshold;
+ private IntegerFieldEditor reuseEditorsThreshold;
+ private IntegerFieldEditor recentFilesEditor;
- private IntegerFieldEditor recentFilesEditor;
-
- private IPropertyChangeListener validityChangeListener = event -> {
- if (event.getProperty().equals(FieldEditor.IS_VALID)) {
+ private IPropertyChangeListener validityChangeListener = event -> {
+ if (event.getProperty().equals(FieldEditor.IS_VALID)) {
updateValidState();
}
};
@@ -78,252 +76,229 @@ public class EditorsPreferencePage extends PreferencePage implements
@Override
protected Control createContents(Composite parent) {
- Composite composite = createComposite(parent);
+ Composite composite = createComposite(parent);
- createEditorHistoryGroup(composite);
+ createEditorHistoryGroup(composite);
- createSpace(composite);
- createShowMultipleEditorTabsPref(composite);
- createAllowInplaceEditorPref(composite);
- createUseIPersistablePref(composite);
- createPromptWhenStillOpenPref(composite);
+ createSpace(composite);
+ createShowMultipleEditorTabsPref(composite);
+ createAllowInplaceEditorPref(composite);
+ createUseIPersistablePref(composite);
+ createPromptWhenStillOpenPref(composite);
createEditorReuseGroup(composite);
// ((TabBehaviour)Tweaklets.get(TabBehaviour.KEY)).setPreferenceVisibility(editorReuseGroup,
// showMultipleEditorTabs);
- updateValidState();
+ updateValidState();
- applyDialogFont(composite);
+ applyDialogFont(composite);
- setHelpContext(parent);
+ setHelpContext(parent);
- return composite;
- }
+ return composite;
+ }
protected void setHelpContext(Composite parent) {
// @issue the IDE subclasses this, but should provide its own help
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
IWorkbenchHelpContextIds.WORKBENCH_EDITOR_PREFERENCE_PAGE);
}
- protected void createSpace(Composite parent) {
- WorkbenchPreferencePage.createSpace(parent);
- }
-
- protected void createShowMultipleEditorTabsPref(Composite composite) {
- showMultipleEditorTabs = new Button(composite, SWT.CHECK);
- showMultipleEditorTabs.setText(WorkbenchMessages.WorkbenchPreference_showMultipleEditorTabsButton);
- showMultipleEditorTabs.setSelection(getAPIPreferenceStore().getBoolean(
- IWorkbenchPreferenceConstants.SHOW_MULTIPLE_EDITOR_TABS));
- setButtonLayoutData(showMultipleEditorTabs);
- }
-
- protected void createAllowInplaceEditorPref(Composite composite) {
- allowInplaceEditor = new Button(composite, SWT.CHECK);
- allowInplaceEditor.setText(WorkbenchMessages.WorkbenchPreference_allowInplaceEditingButton);
- allowInplaceEditor.setSelection(!getAPIPreferenceStore().getBoolean(
- IWorkbenchPreferenceConstants.DISABLE_OPEN_EDITOR_IN_PLACE));
- setButtonLayoutData(allowInplaceEditor);
- }
-
- protected void createUseIPersistablePref(Composite composite) {
- useIPersistableEditor = new Button(composite, SWT.CHECK);
- useIPersistableEditor.setText(WorkbenchMessages.WorkbenchPreference_useIPersistableEditorButton);
- useIPersistableEditor.setSelection(getPreferenceStore().getBoolean(
- IPreferenceConstants.USE_IPERSISTABLE_EDITORS));
- setButtonLayoutData(useIPersistableEditor);
- }
-
- protected void createPromptWhenStillOpenPref(Composite composite) {
- promptWhenStillOpenEditor = new Button(composite, SWT.CHECK);
- promptWhenStillOpenEditor.setText(WorkbenchMessages.WorkbenchPreference_promptWhenStillOpenButton);
- promptWhenStillOpenEditor.setSelection(getAPIPreferenceStore().getBoolean(
- IWorkbenchPreferenceConstants.PROMPT_WHEN_SAVEABLE_STILL_OPEN));
- setButtonLayoutData(promptWhenStillOpenEditor);
- }
-
- protected Composite createComposite(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
- return composite;
- }
-
- @Override
+ protected void createSpace(Composite parent) {
+ WorkbenchPreferencePage.createSpace(parent);
+ }
+
+ protected void createShowMultipleEditorTabsPref(Composite composite) {
+ showMultipleEditorTabs = new Button(composite, SWT.CHECK);
+ showMultipleEditorTabs.setText(WorkbenchMessages.WorkbenchPreference_showMultipleEditorTabsButton);
+ showMultipleEditorTabs.setSelection(
+ getAPIPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.SHOW_MULTIPLE_EDITOR_TABS));
+ setButtonLayoutData(showMultipleEditorTabs);
+ }
+
+ protected void createAllowInplaceEditorPref(Composite composite) {
+ allowInplaceEditor = new Button(composite, SWT.CHECK);
+ allowInplaceEditor.setText(WorkbenchMessages.WorkbenchPreference_allowInplaceEditingButton);
+ allowInplaceEditor.setSelection(
+ !getAPIPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.DISABLE_OPEN_EDITOR_IN_PLACE));
+ setButtonLayoutData(allowInplaceEditor);
+ }
+
+ protected void createUseIPersistablePref(Composite composite) {
+ useIPersistableEditor = new Button(composite, SWT.CHECK);
+ useIPersistableEditor.setText(WorkbenchMessages.WorkbenchPreference_useIPersistableEditorButton);
+ useIPersistableEditor
+ .setSelection(getPreferenceStore().getBoolean(IPreferenceConstants.USE_IPERSISTABLE_EDITORS));
+ setButtonLayoutData(useIPersistableEditor);
+ }
+
+ protected void createPromptWhenStillOpenPref(Composite composite) {
+ promptWhenStillOpenEditor = new Button(composite, SWT.CHECK);
+ promptWhenStillOpenEditor.setText(WorkbenchMessages.WorkbenchPreference_promptWhenStillOpenButton);
+ promptWhenStillOpenEditor.setSelection(
+ getAPIPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.PROMPT_WHEN_SAVEABLE_STILL_OPEN));
+ setButtonLayoutData(promptWhenStillOpenEditor);
+ }
+
+ protected Composite createComposite(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
+ return composite;
+ }
+
+ @Override
public void init(IWorkbench workbench) {
- // do nothing
- }
+ // do nothing
+ }
- @Override
+ @Override
protected void performDefaults() {
- IPreferenceStore store = getPreferenceStore();
- showMultipleEditorTabs
- .setSelection(getAPIPreferenceStore()
- .getDefaultBoolean(IWorkbenchPreferenceConstants.SHOW_MULTIPLE_EDITOR_TABS));
- allowInplaceEditor
- .setSelection(!getAPIPreferenceStore()
- .getDefaultBoolean(IWorkbenchPreferenceConstants.DISABLE_OPEN_EDITOR_IN_PLACE));
- useIPersistableEditor
- .setSelection(store
- .getDefaultBoolean(IPreferenceConstants.USE_IPERSISTABLE_EDITORS));
- promptWhenStillOpenEditor
- .setSelection(getAPIPreferenceStore()
- .getDefaultBoolean(IWorkbenchPreferenceConstants.PROMPT_WHEN_SAVEABLE_STILL_OPEN));
- reuseEditors.setSelection(store
- .getDefaultBoolean(IPreferenceConstants.REUSE_EDITORS_BOOLEAN));
- reuseEditorsThreshold.loadDefault();
- reuseEditorsThreshold.getLabelControl(editorReuseThresholdGroup)
- .setEnabled(reuseEditors.getSelection());
- reuseEditorsThreshold.getTextControl(editorReuseThresholdGroup)
- .setEnabled(reuseEditors.getSelection());
- recentFilesEditor.loadDefault();
- }
-
- @Override
+ IPreferenceStore store = getPreferenceStore();
+ showMultipleEditorTabs.setSelection(
+ getAPIPreferenceStore().getDefaultBoolean(IWorkbenchPreferenceConstants.SHOW_MULTIPLE_EDITOR_TABS));
+ allowInplaceEditor.setSelection(
+ !getAPIPreferenceStore().getDefaultBoolean(IWorkbenchPreferenceConstants.DISABLE_OPEN_EDITOR_IN_PLACE));
+ useIPersistableEditor.setSelection(store.getDefaultBoolean(IPreferenceConstants.USE_IPERSISTABLE_EDITORS));
+ promptWhenStillOpenEditor.setSelection(getAPIPreferenceStore()
+ .getDefaultBoolean(IWorkbenchPreferenceConstants.PROMPT_WHEN_SAVEABLE_STILL_OPEN));
+ reuseEditors.setSelection(store.getDefaultBoolean(IPreferenceConstants.REUSE_EDITORS_BOOLEAN));
+ reuseEditorsThreshold.loadDefault();
+ reuseEditorsThreshold.getLabelControl(editorReuseThresholdGroup).setEnabled(reuseEditors.getSelection());
+ reuseEditorsThreshold.getTextControl(editorReuseThresholdGroup).setEnabled(reuseEditors.getSelection());
+ recentFilesEditor.loadDefault();
+ }
+
+ @Override
public boolean performOk() {
- IPreferenceStore store = getPreferenceStore();
- getAPIPreferenceStore().setValue(IWorkbenchPreferenceConstants.SHOW_MULTIPLE_EDITOR_TABS,
- showMultipleEditorTabs.getSelection());
- getAPIPreferenceStore().setValue(IWorkbenchPreferenceConstants.DISABLE_OPEN_EDITOR_IN_PLACE,
- !allowInplaceEditor.getSelection());
- store.setValue(IPreferenceConstants.USE_IPERSISTABLE_EDITORS,
- useIPersistableEditor.getSelection());
- getAPIPreferenceStore().setValue(IWorkbenchPreferenceConstants.PROMPT_WHEN_SAVEABLE_STILL_OPEN,
- promptWhenStillOpenEditor.getSelection());
-
- // store the reuse editors setting
- store.setValue(IPreferenceConstants.REUSE_EDITORS_BOOLEAN, reuseEditors
- .getSelection());
- reuseEditorsThreshold.store();
-
- // store the recent files setting
- recentFilesEditor.store();
-
- PrefUtil.savePrefs();
- return super.performOk();
- }
-
- /**
- * Returns preference store that belongs to the our plugin.
- *
- * @return the preference store for this plugin
- */
- @Override
+ IPreferenceStore store = getPreferenceStore();
+ getAPIPreferenceStore().setValue(IWorkbenchPreferenceConstants.SHOW_MULTIPLE_EDITOR_TABS,
+ showMultipleEditorTabs.getSelection());
+ getAPIPreferenceStore().setValue(IWorkbenchPreferenceConstants.DISABLE_OPEN_EDITOR_IN_PLACE,
+ !allowInplaceEditor.getSelection());
+ store.setValue(IPreferenceConstants.USE_IPERSISTABLE_EDITORS, useIPersistableEditor.getSelection());
+ getAPIPreferenceStore().setValue(IWorkbenchPreferenceConstants.PROMPT_WHEN_SAVEABLE_STILL_OPEN,
+ promptWhenStillOpenEditor.getSelection());
+
+ // store the reuse editors setting
+ store.setValue(IPreferenceConstants.REUSE_EDITORS_BOOLEAN, reuseEditors.getSelection());
+ reuseEditorsThreshold.store();
+
+ // store the recent files setting
+ recentFilesEditor.store();
+
+ PrefUtil.savePrefs();
+ return super.performOk();
+ }
+
+ /**
+ * Returns preference store that belongs to the our plugin.
+ *
+ * @return the preference store for this plugin
+ */
+ @Override
protected IPreferenceStore doGetPreferenceStore() {
- return WorkbenchPlugin.getDefault().getPreferenceStore();
- }
-
- protected IPreferenceStore getAPIPreferenceStore() {
- return PrefUtil.getAPIPreferenceStore();
- }
-
- protected void updateValidState() {
- if (!recentFilesEditor.isValid()) {
- setErrorMessage(recentFilesEditor.getErrorMessage());
- setValid(false);
- } else if (!reuseEditorsThreshold.isValid()) {
- setErrorMessage(reuseEditorsThreshold.getErrorMessage());
- setValid(false);
- } else {
- setErrorMessage(null);
- setValid(true);
- }
- }
-
- /**
- * Create a composite that contains entry fields specifying editor reuse preferences.
- */
- protected void createEditorReuseGroup(Composite composite) {
- editorReuseGroup = new Composite(composite, SWT.LEFT);
- GridLayout layout = new GridLayout();
- // Line up with other entries in preference page
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- editorReuseGroup.setLayout(layout);
- editorReuseGroup.setLayoutData(new GridData(
- GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
-
- reuseEditors = new Button(editorReuseGroup, SWT.CHECK);
- reuseEditors.setText(WorkbenchMessages.WorkbenchPreference_reuseEditors);
- reuseEditors.setLayoutData(new GridData());
-
- IPreferenceStore store = WorkbenchPlugin.getDefault()
- .getPreferenceStore();
- reuseEditors.setSelection(store
- .getBoolean(IPreferenceConstants.REUSE_EDITORS_BOOLEAN));
- reuseEditors.addSelectionListener(widgetSelectedAdapter(e -> {
+ return WorkbenchPlugin.getDefault().getPreferenceStore();
+ }
+
+ protected IPreferenceStore getAPIPreferenceStore() {
+ return PrefUtil.getAPIPreferenceStore();
+ }
+
+ protected void updateValidState() {
+ if (!recentFilesEditor.isValid()) {
+ setErrorMessage(recentFilesEditor.getErrorMessage());
+ setValid(false);
+ } else if (!reuseEditorsThreshold.isValid()) {
+ setErrorMessage(reuseEditorsThreshold.getErrorMessage());
+ setValid(false);
+ } else {
+ setErrorMessage(null);
+ setValid(true);
+ }
+ }
+
+ /**
+ * Create a composite that contains entry fields specifying editor reuse
+ * preferences.
+ */
+ protected void createEditorReuseGroup(Composite composite) {
+ editorReuseGroup = new Composite(composite, SWT.LEFT);
+ GridLayout layout = new GridLayout();
+ // Line up with other entries in preference page
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ editorReuseGroup.setLayout(layout);
+ editorReuseGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
+
+ reuseEditors = new Button(editorReuseGroup, SWT.CHECK);
+ reuseEditors.setText(WorkbenchMessages.WorkbenchPreference_reuseEditors);
+ reuseEditors.setLayoutData(new GridData());
+
+ IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
+ reuseEditors.setSelection(store.getBoolean(IPreferenceConstants.REUSE_EDITORS_BOOLEAN));
+ reuseEditors.addSelectionListener(widgetSelectedAdapter(e -> {
reuseEditorsThreshold.getLabelControl(editorReuseThresholdGroup).setEnabled(reuseEditors.getSelection());
reuseEditorsThreshold.getTextControl(editorReuseThresholdGroup).setEnabled(reuseEditors.getSelection());
}));
- editorReuseIndentGroup = new Composite(editorReuseGroup, SWT.LEFT);
- GridLayout indentLayout = new GridLayout();
- indentLayout.marginLeft = REUSE_INDENT;
- indentLayout.marginWidth = 0;
- editorReuseIndentGroup.setLayout(indentLayout);
- editorReuseIndentGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ editorReuseIndentGroup = new Composite(editorReuseGroup, SWT.LEFT);
+ GridLayout indentLayout = new GridLayout();
+ indentLayout.marginLeft = REUSE_INDENT;
+ indentLayout.marginWidth = 0;
+ editorReuseIndentGroup.setLayout(indentLayout);
+ editorReuseIndentGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- editorReuseThresholdGroup = new Composite(editorReuseIndentGroup,
- SWT.LEFT);
- layout = new GridLayout();
+ editorReuseThresholdGroup = new Composite(editorReuseIndentGroup, SWT.LEFT);
+ layout = new GridLayout();
layout.marginWidth = 0;
- editorReuseThresholdGroup.setLayout(layout);
- editorReuseThresholdGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-
- reuseEditorsThreshold = new IntegerFieldEditor(
- IPreferenceConstants.REUSE_EDITORS,
- WorkbenchMessages.WorkbenchPreference_reuseEditorsThreshold, editorReuseThresholdGroup);
-
- reuseEditorsThreshold.setPreferenceStore(WorkbenchPlugin.getDefault()
- .getPreferenceStore());
- reuseEditorsThreshold.setPage(this);
- reuseEditorsThreshold.setTextLimit(2);
- reuseEditorsThreshold.setErrorMessage(WorkbenchMessages.WorkbenchPreference_reuseEditorsThresholdError);
- reuseEditorsThreshold
- .setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE);
- reuseEditorsThreshold.setValidRange(1, 99);
- reuseEditorsThreshold.load();
- reuseEditorsThreshold.getLabelControl(editorReuseThresholdGroup)
- .setEnabled(reuseEditors.getSelection());
- reuseEditorsThreshold.getTextControl(editorReuseThresholdGroup)
- .setEnabled(reuseEditors.getSelection());
- reuseEditorsThreshold.setPropertyChangeListener(validityChangeListener);
-
- }
-
- /**
- * Create a composite that contains entry fields specifying editor history preferences.
- */
- protected void createEditorHistoryGroup(Composite composite) {
- Composite groupComposite = new Composite(composite, SWT.LEFT);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- groupComposite.setLayout(layout);
- GridData gd = new GridData();
- gd.horizontalAlignment = GridData.FILL;
- gd.grabExcessHorizontalSpace = true;
- groupComposite.setLayoutData(gd);
-
- recentFilesEditor = new IntegerFieldEditor(
- IPreferenceConstants.RECENT_FILES,
- WorkbenchMessages.WorkbenchPreference_recentFiles, groupComposite);
-
- recentFilesEditor.setPreferenceStore(WorkbenchPlugin.getDefault()
- .getPreferenceStore());
- recentFilesEditor.setPage(this);
- recentFilesEditor.setTextLimit(Integer.toString(EditorHistory.MAX_SIZE)
- .length());
- recentFilesEditor
- .setErrorMessage(NLS.bind(WorkbenchMessages.WorkbenchPreference_recentFilesError,
- Integer.valueOf(EditorHistory.MAX_SIZE)));
- recentFilesEditor
- .setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE);
- recentFilesEditor.setValidRange(0, EditorHistory.MAX_SIZE);
- recentFilesEditor.load();
- recentFilesEditor.setPropertyChangeListener(validityChangeListener);
- }
-}
+ editorReuseThresholdGroup.setLayout(layout);
+ editorReuseThresholdGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+
+ reuseEditorsThreshold = new IntegerFieldEditor(IPreferenceConstants.REUSE_EDITORS,
+ WorkbenchMessages.WorkbenchPreference_reuseEditorsThreshold, editorReuseThresholdGroup);
+
+ reuseEditorsThreshold.setPreferenceStore(WorkbenchPlugin.getDefault().getPreferenceStore());
+ reuseEditorsThreshold.setPage(this);
+ reuseEditorsThreshold.setTextLimit(2);
+ reuseEditorsThreshold.setErrorMessage(WorkbenchMessages.WorkbenchPreference_reuseEditorsThresholdError);
+ reuseEditorsThreshold.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE);
+ reuseEditorsThreshold.setValidRange(1, 99);
+ reuseEditorsThreshold.load();
+ reuseEditorsThreshold.getLabelControl(editorReuseThresholdGroup).setEnabled(reuseEditors.getSelection());
+ reuseEditorsThreshold.getTextControl(editorReuseThresholdGroup).setEnabled(reuseEditors.getSelection());
+ reuseEditorsThreshold.setPropertyChangeListener(validityChangeListener);
+
+ }
+ /**
+ * Create a composite that contains entry fields specifying editor history
+ * preferences.
+ */
+ protected void createEditorHistoryGroup(Composite composite) {
+ Composite groupComposite = new Composite(composite, SWT.LEFT);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ groupComposite.setLayout(layout);
+ GridData gd = new GridData();
+ gd.horizontalAlignment = GridData.FILL;
+ gd.grabExcessHorizontalSpace = true;
+ groupComposite.setLayoutData(gd);
+
+ recentFilesEditor = new IntegerFieldEditor(IPreferenceConstants.RECENT_FILES,
+ WorkbenchMessages.WorkbenchPreference_recentFiles, groupComposite);
+
+ recentFilesEditor.setPreferenceStore(WorkbenchPlugin.getDefault().getPreferenceStore());
+ recentFilesEditor.setPage(this);
+ recentFilesEditor.setTextLimit(Integer.toString(EditorHistory.MAX_SIZE).length());
+ recentFilesEditor.setErrorMessage(NLS.bind(WorkbenchMessages.WorkbenchPreference_recentFilesError,
+ Integer.valueOf(EditorHistory.MAX_SIZE)));
+ recentFilesEditor.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE);
+ recentFilesEditor.setValidRange(0, EditorHistory.MAX_SIZE);
+ recentFilesEditor.load();
+ recentFilesEditor.setPropertyChangeListener(validityChangeListener);
+ }
+}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/EmptyPreferencePage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/EmptyPreferencePage.java
index 711ba1d6760..84246dd23da 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/EmptyPreferencePage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/EmptyPreferencePage.java
@@ -26,26 +26,25 @@ import org.eclipse.ui.internal.WorkbenchPlugin;
* A page used as a filler for nodes in the preference tree
* for which no page is suppplied.
*/
-public class EmptyPreferencePage extends PreferencePage implements
- IWorkbenchPreferencePage {
- @Override
+public class EmptyPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
+ @Override
protected Control createContents(Composite parent) {
- return new Composite(parent, SWT.NULL);
- }
+ return new Composite(parent, SWT.NULL);
+ }
- /**
- * Hook method to get a page specific preference store. Reimplement this
- * method if a page don't want to use its parent's preference store.
- */
- @Override
+ /**
+ * Hook method to get a page specific preference store. Reimplement this method
+ * if a page don't want to use its parent's preference store.
+ */
+ @Override
protected IPreferenceStore doGetPreferenceStore() {
- return WorkbenchPlugin.getDefault().getPreferenceStore();
- }
+ return WorkbenchPlugin.getDefault().getPreferenceStore();
+ }
- /**
- * @see IWorkbenchPreferencePage
- */
- @Override
+ /**
+ * @see IWorkbenchPreferencePage
+ */
+ @Override
public void init(IWorkbench workbench) {
- }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/EmptyPropertyPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/EmptyPropertyPage.java
index 1312230b232..bb336ddcb23 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/EmptyPropertyPage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/EmptyPropertyPage.java
@@ -23,12 +23,12 @@ import org.eclipse.ui.dialogs.PropertyPage;
* for which no page is suppplied.
*/
public class EmptyPropertyPage extends PropertyPage {
- /**
- * Creates empty composite for this page content.
- */
+ /**
+ * Creates empty composite for this page content.
+ */
- @Override
+ @Override
protected Control createContents(Composite parent) {
- return new Composite(parent, SWT.NULL);
- }
+ return new Composite(parent, SWT.NULL);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ErrorPreferencePage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ErrorPreferencePage.java
index 7c55c63405c..6c5de70d54a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ErrorPreferencePage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ErrorPreferencePage.java
@@ -28,13 +28,12 @@ import org.eclipse.ui.internal.WorkbenchMessages;
*/
public class ErrorPreferencePage extends EmptyPreferencePage {
- @Override
+ @Override
protected Control createContents(Composite parent) {
- Text text = new Text(parent, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP);
- text.setForeground(JFaceColors.getErrorText(text.getDisplay()));
- text.setBackground(text.getDisplay().getSystemColor(
- SWT.COLOR_WIDGET_BACKGROUND));
- text.setText(WorkbenchMessages.ErrorPreferencePage_errorMessage);
- return text;
- }
+ Text text = new Text(parent, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP);
+ text.setForeground(JFaceColors.getErrorText(text.getDisplay()));
+ text.setBackground(text.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
+ text.setText(WorkbenchMessages.ErrorPreferencePage_errorMessage);
+ return text;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/EventLoopProgressMonitor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/EventLoopProgressMonitor.java
index 83e27190227..b460dfa597e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/EventLoopProgressMonitor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/EventLoopProgressMonitor.java
@@ -22,178 +22,178 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.internal.ExceptionHandler;
/**
- * Used to run an event loop whenever progress monitor methods
- * are invoked. <p>
+ * Used to run an event loop whenever progress monitor methods are invoked.
+ * <p>
* This is needed since editor save operations are done in the UI thread.
- * Although save operations should be written to do the work in the non-UI thread,
- * this was not done for 1.0, so this was added to keep the UI live
+ * Although save operations should be written to do the work in the non-UI
+ * thread, this was not done for 1.0, so this was added to keep the UI live
* (including allowing the cancel button to work).
*/
-public class EventLoopProgressMonitor extends ProgressMonitorWrapper implements
- IProgressMonitorWithBlocking {
- /**
- * Threshold for how often the event loop is spun, in ms.
- */
- private static int T_THRESH = 100;
-
- /**
- * Maximum amount of time to spend processing events, in ms.
- */
- private static int T_MAX = 50;
-
- /**
- * Last time the event loop was spun.
- */
- private long lastTime = System.currentTimeMillis();
-
- /**
- * The task name is the name of the current task
- * in the event loop.
- */
- private String taskName;
-
- /**
- * Constructs a new instance of the receiver and forwards to monitor.
- * @param monitor
- */
- public EventLoopProgressMonitor(IProgressMonitor monitor) {
- super(monitor);
- }
-
- /**
- * @see IProgressMonitor#beginTask
- */
- @Override
+public class EventLoopProgressMonitor extends ProgressMonitorWrapper implements IProgressMonitorWithBlocking {
+ /**
+ * Threshold for how often the event loop is spun, in ms.
+ */
+ private static int T_THRESH = 100;
+
+ /**
+ * Maximum amount of time to spend processing events, in ms.
+ */
+ private static int T_MAX = 50;
+
+ /**
+ * Last time the event loop was spun.
+ */
+ private long lastTime = System.currentTimeMillis();
+
+ /**
+ * The task name is the name of the current task in the event loop.
+ */
+ private String taskName;
+
+ /**
+ * Constructs a new instance of the receiver and forwards to monitor.
+ *
+ * @param monitor
+ */
+ public EventLoopProgressMonitor(IProgressMonitor monitor) {
+ super(monitor);
+ }
+
+ /**
+ * @see IProgressMonitor#beginTask
+ */
+ @Override
public void beginTask(String name, int totalWork) {
- super.beginTask(name, totalWork);
- taskName = name;
- runEventLoop();
- }
+ super.beginTask(name, totalWork);
+ taskName = name;
+ runEventLoop();
+ }
- @Override
+ @Override
public void clearBlocked() {
- Dialog.getBlockedHandler().clearBlocked();
- }
+ Dialog.getBlockedHandler().clearBlocked();
+ }
- /**
- * @see IProgressMonitor#done
- */
- @Override
+ /**
+ * @see IProgressMonitor#done
+ */
+ @Override
public void done() {
- super.done();
- taskName = null;
- runEventLoop();
- }
-
- /**
- * @see IProgressMonitor#internalWorked
- */
- @Override
+ super.done();
+ taskName = null;
+ runEventLoop();
+ }
+
+ /**
+ * @see IProgressMonitor#internalWorked
+ */
+ @Override
public void internalWorked(double work) {
- super.internalWorked(work);
- runEventLoop();
- }
-
- /**
- * @see IProgressMonitor#isCanceled
- */
- @Override
+ super.internalWorked(work);
+ runEventLoop();
+ }
+
+ /**
+ * @see IProgressMonitor#isCanceled
+ */
+ @Override
public boolean isCanceled() {
- runEventLoop();
- return super.isCanceled();
- }
-
- /**
- * Runs an event loop.
- */
- private void runEventLoop() {
- // Only run the event loop so often, as it is expensive on some platforms
- // (namely Motif).
- long t = System.currentTimeMillis();
- if (t - lastTime < T_THRESH) {
- return;
- }
- lastTime = t;
- // Run the event loop.
- Display disp = Display.getDefault();
- if (disp == null) {
- return;
- }
-
- //Initialize an exception handler from the window class.
- ExceptionHandler handler = ExceptionHandler.getInstance();
-
- for (;;) {
- try {
- if (!disp.readAndDispatch()) {
+ runEventLoop();
+ return super.isCanceled();
+ }
+
+ /**
+ * Runs an event loop.
+ */
+ private void runEventLoop() {
+ // Only run the event loop so often, as it is expensive on some platforms
+ // (namely Motif).
+ long t = System.currentTimeMillis();
+ if (t - lastTime < T_THRESH) {
+ return;
+ }
+ lastTime = t;
+ // Run the event loop.
+ Display disp = Display.getDefault();
+ if (disp == null) {
+ return;
+ }
+
+ // Initialize an exception handler from the window class.
+ ExceptionHandler handler = ExceptionHandler.getInstance();
+
+ for (;;) {
+ try {
+ if (!disp.readAndDispatch()) {
break;
}
- } catch (Throwable e) {//Handle the exception the same way as the workbench
- handler.handleException(e);
- break;
- }
-
- // Only run the event loop for so long.
- // Otherwise, this would never return if some other thread was
- // constantly generating events.
- if (System.currentTimeMillis() - t > T_MAX) {
- break;
- }
- }
- }
-
- @Override
+ } catch (Throwable e) {// Handle the exception the same way as the workbench
+ handler.handleException(e);
+ break;
+ }
+
+ // Only run the event loop for so long.
+ // Otherwise, this would never return if some other thread was
+ // constantly generating events.
+ if (System.currentTimeMillis() - t > T_MAX) {
+ break;
+ }
+ }
+ }
+
+ @Override
public void setBlocked(IStatus reason) {
- Dialog.getBlockedHandler().showBlocked(this, reason, taskName);
- }
+ Dialog.getBlockedHandler().showBlocked(this, reason, taskName);
+ }
- /**
- * @see IProgressMonitor#setCanceled
- */
- @Override
+ /**
+ * @see IProgressMonitor#setCanceled
+ */
+ @Override
public void setCanceled(boolean b) {
- super.setCanceled(b);
- taskName = null;
- runEventLoop();
- }
-
- /**
- * @see IProgressMonitor#setTaskName
- */
- @Override
+ super.setCanceled(b);
+ taskName = null;
+ runEventLoop();
+ }
+
+ /**
+ * @see IProgressMonitor#setTaskName
+ */
+ @Override
public void setTaskName(String name) {
- super.setTaskName(name);
- taskName = name;
- runEventLoop();
- }
-
- /**
- * @see IProgressMonitor#subTask
- */
- @Override
+ super.setTaskName(name);
+ taskName = name;
+ runEventLoop();
+ }
+
+ /**
+ * @see IProgressMonitor#subTask
+ */
+ @Override
public void subTask(String name) {
- //Be prepared in case the first task was null
- if (taskName == null) {
+ // Be prepared in case the first task was null
+ if (taskName == null) {
taskName = name;
}
- super.subTask(name);
- runEventLoop();
- }
-
- /**
- * @see IProgressMonitor#worked
- */
- @Override
+ super.subTask(name);
+ runEventLoop();
+ }
+
+ /**
+ * @see IProgressMonitor#worked
+ */
+ @Override
public void worked(int work) {
- super.worked(work);
- runEventLoop();
- }
-
- /**
- * Return the name of the current task.
- * @return Returns the taskName.
- */
- protected String getTaskName() {
- return taskName;
- }
+ super.worked(work);
+ runEventLoop();
+ }
+
+ /**
+ * Return the name of the current task.
+ *
+ * @return Returns the taskName.
+ */
+ protected String getTaskName() {
+ return taskName;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ExportPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ExportPage.java
index c8ecf399c45..9d49fbde262 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ExportPage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ExportPage.java
@@ -32,10 +32,10 @@ import org.eclipse.ui.wizards.IWizardCategory;
*/
public class ExportPage extends ImportExportPage {
private static final String STORE_SELECTED_EXPORT_WIZARD_ID = DIALOG_SETTING_SECTION_NAME
- + "STORE_SELECTED_EXPORT_WIZARD_ID"; //$NON-NLS-1$
+ + "STORE_SELECTED_EXPORT_WIZARD_ID"; //$NON-NLS-1$
private static final String STORE_EXPANDED_EXPORT_CATEGORIES = DIALOG_SETTING_SECTION_NAME
- + "STORE_EXPANDED_EXPORT_CATEGORIES"; //$NON-NLS-1$
+ + "STORE_EXPANDED_EXPORT_CATEGORIES"; //$NON-NLS-1$
CategorizedWizardSelectionTree exportTree;
@@ -45,53 +45,49 @@ public class ExportPage extends ImportExportPage {
* @param aWorkbench
* @param currentSelection
*/
- public ExportPage(IWorkbench aWorkbench,
- IStructuredSelection currentSelection) {
+ public ExportPage(IWorkbench aWorkbench, IStructuredSelection currentSelection) {
super(aWorkbench, currentSelection);
}
@Override
protected void initialize() {
- workbench.getHelpSystem().setHelp(getControl(),
- IWorkbenchHelpContextIds.EXPORT_WIZARD_SELECTION_WIZARD_PAGE);
+ workbench.getHelpSystem().setHelp(getControl(), IWorkbenchHelpContextIds.EXPORT_WIZARD_SELECTION_WIZARD_PAGE);
}
@Override
protected Composite createTreeViewer(Composite parent) {
- IWizardCategory root = WorkbenchPlugin.getDefault()
- .getExportWizardRegistry().getRootCategory();
- exportTree = new CategorizedWizardSelectionTree(
- root, WorkbenchMessages.ExportWizard_selectWizard);
+ IWizardCategory root = WorkbenchPlugin.getDefault().getExportWizardRegistry().getRootCategory();
+ exportTree = new CategorizedWizardSelectionTree(root, WorkbenchMessages.ExportWizard_selectWizard);
Composite exportComp = exportTree.createControl(parent);
exportTree.getViewer().addSelectionChangedListener(event -> listSelectionChanged(event.getSelection()));
exportTree.getViewer().addDoubleClickListener(event -> treeDoubleClicked(event));
setTreeViewer(exportTree.getViewer());
- return exportComp;
+ return exportComp;
}
@Override
- public void saveWidgetValues(){
- storeExpandedCategories(STORE_EXPANDED_EXPORT_CATEGORIES, exportTree.getViewer());
- storeSelectedCategoryAndWizard(STORE_SELECTED_EXPORT_WIZARD_ID, exportTree.getViewer());
- super.saveWidgetValues();
+ public void saveWidgetValues() {
+ storeExpandedCategories(STORE_EXPANDED_EXPORT_CATEGORIES, exportTree.getViewer());
+ storeSelectedCategoryAndWizard(STORE_SELECTED_EXPORT_WIZARD_ID, exportTree.getViewer());
+ super.saveWidgetValues();
}
@Override
- protected void restoreWidgetValues(){
- IWizardCategory exportRoot = WorkbenchPlugin.getDefault().getExportWizardRegistry().getRootCategory();
- expandPreviouslyExpandedCategories(STORE_EXPANDED_EXPORT_CATEGORIES, exportRoot, exportTree.getViewer());
- selectPreviouslySelected(STORE_SELECTED_EXPORT_WIZARD_ID, exportRoot, exportTree.getViewer());
- super.restoreWidgetValues();
+ protected void restoreWidgetValues() {
+ IWizardCategory exportRoot = WorkbenchPlugin.getDefault().getExportWizardRegistry().getRootCategory();
+ expandPreviouslyExpandedCategories(STORE_EXPANDED_EXPORT_CATEGORIES, exportRoot, exportTree.getViewer());
+ selectPreviouslySelected(STORE_SELECTED_EXPORT_WIZARD_ID, exportRoot, exportTree.getViewer());
+ super.restoreWidgetValues();
}
@Override
- protected ITriggerPoint getTriggerPoint(){
- return getWorkbench().getActivitySupport()
- .getTriggerPointManager().getTriggerPoint(WorkbenchTriggerPoints.EXPORT_WIZARDS);
+ protected ITriggerPoint getTriggerPoint() {
+ return getWorkbench().getActivitySupport().getTriggerPointManager()
+ .getTriggerPoint(WorkbenchTriggerPoints.EXPORT_WIZARDS);
}
@Override
- protected void updateMessage(){
+ protected void updateMessage() {
setMessage(WorkbenchMessages.ImportExportPage_chooseExportWizard);
super.updateMessage();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ExportWizard.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ExportWizard.java
index a8d2cd1dacc..f5aa988fe38 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ExportWizard.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ExportWizard.java
@@ -33,89 +33,86 @@ import org.eclipse.ui.model.AdaptableList;
import org.eclipse.ui.wizards.IWizardCategory;
/**
- * The export wizard allows the user to choose which nested export wizard to run.
- * The set of available wizards comes from the export wizard extension point.
+ * The export wizard allows the user to choose which nested export wizard to
+ * run. The set of available wizards comes from the export wizard extension
+ * point.
*/
public class ExportWizard extends Wizard {
- private IWorkbench theWorkbench;
+ private IWorkbench theWorkbench;
- private IStructuredSelection selection;
+ private IStructuredSelection selection;
- //the list selection page
- static class SelectionPage extends WorkbenchWizardListSelectionPage {
- SelectionPage(IWorkbench w, IStructuredSelection ss, AdaptableList e,
- String s) {
- super(w, ss, e, s, WorkbenchTriggerPoints.EXPORT_WIZARDS);
- }
+ // the list selection page
+ static class SelectionPage extends WorkbenchWizardListSelectionPage {
+ SelectionPage(IWorkbench w, IStructuredSelection ss, AdaptableList e, String s) {
+ super(w, ss, e, s, WorkbenchTriggerPoints.EXPORT_WIZARDS);
+ }
- @Override
+ @Override
public void createControl(Composite parent) {
- super.createControl(parent);
- workbench.getHelpSystem().setHelp(getControl(),
- IWorkbenchHelpContextIds.EXPORT_WIZARD_SELECTION_WIZARD_PAGE);
- }
+ super.createControl(parent);
+ workbench.getHelpSystem().setHelp(getControl(),
+ IWorkbenchHelpContextIds.EXPORT_WIZARD_SELECTION_WIZARD_PAGE);
+ }
- @Override
+ @Override
protected IWizardNode createWizardNode(WorkbenchWizardElement element) {
- return new WorkbenchWizardNode(this, element) {
- @Override
+ return new WorkbenchWizardNode(this, element) {
+ @Override
public IWorkbenchWizard createWizard() throws CoreException {
- return wizardElement.createWizard();
- }
- };
- }
- }
+ return wizardElement.createWizard();
+ }
+ };
+ }
+ }
- /**
- * Creates the wizard's pages lazily.
- */
- @Override
+ /**
+ * Creates the wizard's pages lazily.
+ */
+ @Override
public void addPages() {
- addPage(new SelectionPage(this.theWorkbench, this.selection,
- getAvailableExportWizards(), WorkbenchMessages.ExportWizard_selectWizard));
- }
+ addPage(new SelectionPage(this.theWorkbench, this.selection, getAvailableExportWizards(),
+ WorkbenchMessages.ExportWizard_selectWizard));
+ }
- /**
- * Returns the export wizards that are available for invocation.
- */
- protected AdaptableList getAvailableExportWizards() {
- // TODO: exports are still flat - we need to get at the flat list. All
+ /**
+ * Returns the export wizards that are available for invocation.
+ */
+ protected AdaptableList getAvailableExportWizards() {
+ // TODO: exports are still flat - we need to get at the flat list. All
// wizards will be in the "other" category.
- IWizardCategory root = WorkbenchPlugin.getDefault()
- .getExportWizardRegistry().getRootCategory();
+ IWizardCategory root = WorkbenchPlugin.getDefault().getExportWizardRegistry().getRootCategory();
WizardCollectionElement otherCategory = (WizardCollectionElement) root
- .findCategory(new Path(
- WizardsRegistryReader.UNCATEGORIZED_WIZARD_CATEGORY));
+ .findCategory(new Path(WizardsRegistryReader.UNCATEGORIZED_WIZARD_CATEGORY));
if (otherCategory == null) {
return new AdaptableList();
}
return otherCategory.getWizardAdaptableList();
}
- /**
- * Initializes the wizard.
- *
- * @param aWorkbench the workbench
- * @param currentSelection the current selectio
- */
- public void init(IWorkbench aWorkbench,
- IStructuredSelection currentSelection) {
- this.theWorkbench = aWorkbench;
- this.selection = currentSelection;
+ /**
+ * Initializes the wizard.
+ *
+ * @param aWorkbench the workbench
+ * @param currentSelection the current selectio
+ */
+ public void init(IWorkbench aWorkbench, IStructuredSelection currentSelection) {
+ this.theWorkbench = aWorkbench;
+ this.selection = currentSelection;
- setWindowTitle(WorkbenchMessages.ExportWizard_title);
- setDefaultPageImageDescriptor(WorkbenchImages
- .getImageDescriptor(IWorkbenchGraphicConstants.IMG_WIZBAN_EXPORT_WIZ));
- setNeedsProgressMonitor(true);
- }
+ setWindowTitle(WorkbenchMessages.ExportWizard_title);
+ setDefaultPageImageDescriptor(
+ WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_WIZBAN_EXPORT_WIZ));
+ setNeedsProgressMonitor(true);
+ }
- /**
- * Subclasses must implement this <code>IWizard</code> method
- * to perform any special finish processing for their wizard.
- */
- @Override
+ /**
+ * Subclasses must implement this <code>IWizard</code> method to perform any
+ * special finish processing for their wizard.
+ */
+ @Override
public boolean performFinish() {
- ((SelectionPage) getPages()[0]).saveWidgetValues();
- return true;
- }
+ ((SelectionPage) getPages()[0]).saveWidgetValues();
+ return true;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FileEditorsPreferencePage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FileEditorsPreferencePage.java
index 24b767a9b32..d2a5411ab54 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FileEditorsPreferencePage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FileEditorsPreferencePage.java
@@ -63,284 +63,275 @@ import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
* The user can add an editor for either a specific file name and extension
* (e.g. report.doc), or for all file names of a given extension (e.g. *.doc)
*
- * The set of registered editors is tracked by the EditorRegistery
- * available from the workbench plugin.
+ * The set of registered editors is tracked by the EditorRegistery available
+ * from the workbench plugin.
*/
-public class FileEditorsPreferencePage extends PreferencePage implements
- IWorkbenchPreferencePage, Listener {
+public class FileEditorsPreferencePage extends PreferencePage implements IWorkbenchPreferencePage, Listener {
- private static final String DATA_EDITOR = "editor"; //$NON-NLS-1$
+ private static final String DATA_EDITOR = "editor"; //$NON-NLS-1$
- private static final String DATA_FROM_CONTENT_TYPE = "type"; //$NON-NLS-1$
+ private static final String DATA_FROM_CONTENT_TYPE = "type"; //$NON-NLS-1$
protected Table resourceTypeTable;
- protected Button addResourceTypeButton;
-
- protected Button removeResourceTypeButton;
-
- protected Table editorTable;
-
- protected Button addEditorButton;
-
- protected Button removeEditorButton;
-
- protected Button defaultEditorButton;
-
- protected Label editorLabel;
-
- protected IWorkbench workbench;
-
- protected List imagesToDispose;
-
- protected Map editorsToImages;
-
- /**
- * Add a new resource type to the collection shown in the top of the page.
- * This is typically called after the extension dialog is shown to the user.
- *
- * @param newName the new name
- * @param newExtension the new extension
- */
- public void addResourceType(String newName, String newExtension) {
- // Either a file name or extension must be provided
- Assert.isTrue((newName != null && newName.length() != 0)
- || (newExtension != null && newExtension.length() != 0));
-
- // Wild card only valid by itself (i.e. rep* is not valid)
- // And must have an extension
- int index = newName.indexOf('*');
- if (index > -1) {
- Assert.isTrue(index == 0 && newName.length() == 1);
- Assert.isTrue(newExtension != null && newExtension.length() != 0);
- }
-
- // Find the index at which to insert the new entry.
- String newFilename = (newName + (newExtension == null
- || newExtension.length() == 0 ? "" : "." + newExtension)).toUpperCase();//$NON-NLS-1$ //$NON-NLS-2$
- IFileEditorMapping resourceType;
- TableItem[] items = resourceTypeTable.getItems();
- boolean found = false;
- int i = 0;
-
- while (i < items.length && !found) {
- resourceType = (IFileEditorMapping) items[i].getData();
- int result = newFilename.compareToIgnoreCase(resourceType
- .getLabel());
- if (result == 0) {
- // Same resource type not allowed!
- MessageDialog
- .openInformation(
- getControl().getShell(),
- WorkbenchMessages.FileEditorPreference_existsTitle,
- WorkbenchMessages.FileEditorPreference_existsMessage);
- return;
- }
-
- if (result < 0) {
+ protected Button addResourceTypeButton;
+
+ protected Button removeResourceTypeButton;
+
+ protected Table editorTable;
+
+ protected Button addEditorButton;
+
+ protected Button removeEditorButton;
+
+ protected Button defaultEditorButton;
+
+ protected Label editorLabel;
+
+ protected IWorkbench workbench;
+
+ protected List imagesToDispose;
+
+ protected Map editorsToImages;
+
+ /**
+ * Add a new resource type to the collection shown in the top of the page. This
+ * is typically called after the extension dialog is shown to the user.
+ *
+ * @param newName the new name
+ * @param newExtension the new extension
+ */
+ public void addResourceType(String newName, String newExtension) {
+ // Either a file name or extension must be provided
+ Assert.isTrue(
+ (newName != null && newName.length() != 0) || (newExtension != null && newExtension.length() != 0));
+
+ // Wild card only valid by itself (i.e. rep* is not valid)
+ // And must have an extension
+ int index = newName.indexOf('*');
+ if (index > -1) {
+ Assert.isTrue(index == 0 && newName.length() == 1);
+ Assert.isTrue(newExtension != null && newExtension.length() != 0);
+ }
+
+ // Find the index at which to insert the new entry.
+ String newFilename = (newName + (newExtension == null || newExtension.length() == 0 ? "" : "." + newExtension)) //$NON-NLS-1$ //$NON-NLS-2$
+ .toUpperCase();
+ IFileEditorMapping resourceType;
+ TableItem[] items = resourceTypeTable.getItems();
+ boolean found = false;
+ int i = 0;
+
+ while (i < items.length && !found) {
+ resourceType = (IFileEditorMapping) items[i].getData();
+ int result = newFilename.compareToIgnoreCase(resourceType.getLabel());
+ if (result == 0) {
+ // Same resource type not allowed!
+ MessageDialog.openInformation(getControl().getShell(),
+ WorkbenchMessages.FileEditorPreference_existsTitle,
+ WorkbenchMessages.FileEditorPreference_existsMessage);
+ return;
+ }
+
+ if (result < 0) {
found = true;
} else {
i++;
}
- }
-
- // Create the new type and insert it
- resourceType = new FileEditorMapping(newName, newExtension);
- TableItem item = newResourceTableItem(resourceType, i, true);
- resourceTypeTable.setFocus();
- resourceTypeTable.showItem(item);
- fillEditorTable();
- }
-
- /**
- * Creates the page's UI content.
- */
- @Override
+ }
+
+ // Create the new type and insert it
+ resourceType = new FileEditorMapping(newName, newExtension);
+ TableItem item = newResourceTableItem(resourceType, i, true);
+ resourceTypeTable.setFocus();
+ resourceTypeTable.showItem(item);
+ fillEditorTable();
+ }
+
+ /**
+ * Creates the page's UI content.
+ */
+ @Override
protected Control createContents(Composite parent) {
- imagesToDispose = new ArrayList();
- editorsToImages = new HashMap(50);
-
- // define container & its gridding
- Composite pageComponent = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- pageComponent.setLayout(layout);
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- pageComponent.setLayoutData(data);
-
- //layout the contents
-
- PreferenceLinkArea contentTypeArea = new PreferenceLinkArea(pageComponent, SWT.NONE,
- "org.eclipse.ui.preferencePages.ContentTypes", WorkbenchMessages.FileEditorPreference_contentTypesRelatedLink,//$NON-NLS-1$
- (IWorkbenchPreferenceContainer) getContainer(),null);
-
- data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- contentTypeArea.getControl().setLayoutData(data);
-
- //layout the top table & its buttons
- Label label = new Label(pageComponent, SWT.LEFT);
- label.setText(WorkbenchMessages.FileEditorPreference_fileTypes);
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.horizontalSpan = 2;
- label.setLayoutData(data);
-
- resourceTypeTable = new Table(pageComponent, SWT.MULTI | SWT.BORDER
- | SWT.FULL_SELECTION);
- resourceTypeTable.addListener(SWT.Selection, this);
- resourceTypeTable.addListener(SWT.DefaultSelection, this);
- data = new GridData(GridData.FILL_HORIZONTAL);
-
- int availableRows = DialogUtil.availableRows(pageComponent);
-
- data.heightHint = resourceTypeTable.getItemHeight()
- * (availableRows / 8);
- resourceTypeTable.setLayoutData(data);
-
- Composite groupComponent = new Composite(pageComponent, SWT.NULL);
- GridLayout groupLayout = new GridLayout();
- groupLayout.marginWidth = 0;
- groupLayout.marginHeight = 0;
- groupComponent.setLayout(groupLayout);
- data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- groupComponent.setLayoutData(data);
-
- addResourceTypeButton = new Button(groupComponent, SWT.PUSH);
- addResourceTypeButton.setText(WorkbenchMessages.FileEditorPreference_add);
- addResourceTypeButton.addListener(SWT.Selection, this);
- setButtonLayoutData(addResourceTypeButton);
-
- removeResourceTypeButton = new Button(groupComponent, SWT.PUSH);
- removeResourceTypeButton.setText(WorkbenchMessages.FileEditorPreference_remove);
- removeResourceTypeButton.addListener(SWT.Selection, this);
- setButtonLayoutData(removeResourceTypeButton);
-
- //Spacer
- label = new Label(pageComponent, SWT.LEFT);
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.horizontalSpan = 2;
- label.setLayoutData(data);
-
- // layout the bottom table & its buttons
- editorLabel = new Label(pageComponent, SWT.LEFT);
- editorLabel.setText(WorkbenchMessages.FileEditorPreference_associatedEditors);
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.horizontalSpan = 2;
- editorLabel.setLayoutData(data);
-
- editorTable = new Table(pageComponent, SWT.MULTI | SWT.BORDER);
- editorTable.addListener(SWT.Selection, this);
- editorTable.addListener(SWT.DefaultSelection, this);
- data = new GridData(GridData.FILL_BOTH);
- data.heightHint = editorTable.getItemHeight() * 7;
- editorTable.setLayoutData(data);
-
- groupComponent = new Composite(pageComponent, SWT.NULL);
- groupLayout = new GridLayout();
- groupLayout.marginWidth = 0;
- groupLayout.marginHeight = 0;
- groupComponent.setLayout(groupLayout);
- data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- groupComponent.setLayoutData(data);
-
- addEditorButton = new Button(groupComponent, SWT.PUSH);
- addEditorButton.setText(WorkbenchMessages.FileEditorPreference_addEditor);
- addEditorButton.addListener(SWT.Selection, this);
- addEditorButton.setLayoutData(data);
- setButtonLayoutData(addEditorButton);
-
- removeEditorButton = new Button(groupComponent, SWT.PUSH);
- removeEditorButton.setText(WorkbenchMessages.FileEditorPreference_removeEditor);
- removeEditorButton.addListener(SWT.Selection, this);
- setButtonLayoutData(removeEditorButton);
-
- defaultEditorButton = new Button(groupComponent, SWT.PUSH);
- defaultEditorButton.setText(WorkbenchMessages.FileEditorPreference_default);
- defaultEditorButton.addListener(SWT.Selection, this);
- setButtonLayoutData(defaultEditorButton);
-
- fillResourceTypeTable();
- if (resourceTypeTable.getItemCount() > 0) {
- resourceTypeTable.setSelection(0);
- }
- fillEditorTable();
- updateEnabledState();
-
- workbench.getHelpSystem().setHelp(parent,
- IWorkbenchHelpContextIds.FILE_EDITORS_PREFERENCE_PAGE);
- applyDialogFont(pageComponent);
-
- return pageComponent;
- }
-
- /**
- * The preference page is going to be disposed. So deallocate all allocated
- * SWT resources that aren't disposed automatically by disposing the page
- * (i.e fonts, cursors, etc). Subclasses should reimplement this method to
- * release their own allocated SWT resources.
- */
- @Override
+ imagesToDispose = new ArrayList();
+ editorsToImages = new HashMap(50);
+
+ // define container & its gridding
+ Composite pageComponent = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ pageComponent.setLayout(layout);
+ GridData data = new GridData();
+ data.verticalAlignment = GridData.FILL;
+ data.horizontalAlignment = GridData.FILL;
+ pageComponent.setLayoutData(data);
+
+ // layout the contents
+
+ PreferenceLinkArea contentTypeArea = new PreferenceLinkArea(pageComponent, SWT.NONE,
+ "org.eclipse.ui.preferencePages.ContentTypes", //$NON-NLS-1$
+ WorkbenchMessages.FileEditorPreference_contentTypesRelatedLink, (IWorkbenchPreferenceContainer) getContainer(), null);
+
+ data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ contentTypeArea.getControl().setLayoutData(data);
+
+ // layout the top table & its buttons
+ Label label = new Label(pageComponent, SWT.LEFT);
+ label.setText(WorkbenchMessages.FileEditorPreference_fileTypes);
+ data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.horizontalSpan = 2;
+ label.setLayoutData(data);
+
+ resourceTypeTable = new Table(pageComponent, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION);
+ resourceTypeTable.addListener(SWT.Selection, this);
+ resourceTypeTable.addListener(SWT.DefaultSelection, this);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+
+ int availableRows = DialogUtil.availableRows(pageComponent);
+
+ data.heightHint = resourceTypeTable.getItemHeight() * (availableRows / 8);
+ resourceTypeTable.setLayoutData(data);
+
+ Composite groupComponent = new Composite(pageComponent, SWT.NULL);
+ GridLayout groupLayout = new GridLayout();
+ groupLayout.marginWidth = 0;
+ groupLayout.marginHeight = 0;
+ groupComponent.setLayout(groupLayout);
+ data = new GridData();
+ data.verticalAlignment = GridData.FILL;
+ data.horizontalAlignment = GridData.FILL;
+ groupComponent.setLayoutData(data);
+
+ addResourceTypeButton = new Button(groupComponent, SWT.PUSH);
+ addResourceTypeButton.setText(WorkbenchMessages.FileEditorPreference_add);
+ addResourceTypeButton.addListener(SWT.Selection, this);
+ setButtonLayoutData(addResourceTypeButton);
+
+ removeResourceTypeButton = new Button(groupComponent, SWT.PUSH);
+ removeResourceTypeButton.setText(WorkbenchMessages.FileEditorPreference_remove);
+ removeResourceTypeButton.addListener(SWT.Selection, this);
+ setButtonLayoutData(removeResourceTypeButton);
+
+ // Spacer
+ label = new Label(pageComponent, SWT.LEFT);
+ data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.horizontalSpan = 2;
+ label.setLayoutData(data);
+
+ // layout the bottom table & its buttons
+ editorLabel = new Label(pageComponent, SWT.LEFT);
+ editorLabel.setText(WorkbenchMessages.FileEditorPreference_associatedEditors);
+ data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.horizontalSpan = 2;
+ editorLabel.setLayoutData(data);
+
+ editorTable = new Table(pageComponent, SWT.MULTI | SWT.BORDER);
+ editorTable.addListener(SWT.Selection, this);
+ editorTable.addListener(SWT.DefaultSelection, this);
+ data = new GridData(GridData.FILL_BOTH);
+ data.heightHint = editorTable.getItemHeight() * 7;
+ editorTable.setLayoutData(data);
+
+ groupComponent = new Composite(pageComponent, SWT.NULL);
+ groupLayout = new GridLayout();
+ groupLayout.marginWidth = 0;
+ groupLayout.marginHeight = 0;
+ groupComponent.setLayout(groupLayout);
+ data = new GridData();
+ data.verticalAlignment = GridData.FILL;
+ data.horizontalAlignment = GridData.FILL;
+ groupComponent.setLayoutData(data);
+
+ addEditorButton = new Button(groupComponent, SWT.PUSH);
+ addEditorButton.setText(WorkbenchMessages.FileEditorPreference_addEditor);
+ addEditorButton.addListener(SWT.Selection, this);
+ addEditorButton.setLayoutData(data);
+ setButtonLayoutData(addEditorButton);
+
+ removeEditorButton = new Button(groupComponent, SWT.PUSH);
+ removeEditorButton.setText(WorkbenchMessages.FileEditorPreference_removeEditor);
+ removeEditorButton.addListener(SWT.Selection, this);
+ setButtonLayoutData(removeEditorButton);
+
+ defaultEditorButton = new Button(groupComponent, SWT.PUSH);
+ defaultEditorButton.setText(WorkbenchMessages.FileEditorPreference_default);
+ defaultEditorButton.addListener(SWT.Selection, this);
+ setButtonLayoutData(defaultEditorButton);
+
+ fillResourceTypeTable();
+ if (resourceTypeTable.getItemCount() > 0) {
+ resourceTypeTable.setSelection(0);
+ }
+ fillEditorTable();
+ updateEnabledState();
+
+ workbench.getHelpSystem().setHelp(parent, IWorkbenchHelpContextIds.FILE_EDITORS_PREFERENCE_PAGE);
+ applyDialogFont(pageComponent);
+
+ return pageComponent;
+ }
+
+ /**
+ * The preference page is going to be disposed. So deallocate all allocated SWT
+ * resources that aren't disposed automatically by disposing the page (i.e
+ * fonts, cursors, etc). Subclasses should reimplement this method to release
+ * their own allocated SWT resources.
+ */
+ @Override
public void dispose() {
- super.dispose();
- if (imagesToDispose != null) {
- for (Iterator e = imagesToDispose.iterator(); e.hasNext();) {
- ((Image) e.next()).dispose();
- }
- imagesToDispose = null;
- }
- if (editorsToImages != null) {
- for (Iterator e = editorsToImages.values().iterator(); e.hasNext();) {
- ((Image) e.next()).dispose();
- }
- editorsToImages = null;
- }
- }
-
- /**
- * Hook method to get a page specific preference store. Reimplement this
- * method if a page don't want to use its parent's preference store.
- */
- @Override
+ super.dispose();
+ if (imagesToDispose != null) {
+ for (Iterator e = imagesToDispose.iterator(); e.hasNext();) {
+ ((Image) e.next()).dispose();
+ }
+ imagesToDispose = null;
+ }
+ if (editorsToImages != null) {
+ for (Iterator e = editorsToImages.values().iterator(); e.hasNext();) {
+ ((Image) e.next()).dispose();
+ }
+ editorsToImages = null;
+ }
+ }
+
+ /**
+ * Hook method to get a page specific preference store. Reimplement this method
+ * if a page don't want to use its parent's preference store.
+ */
+ @Override
protected IPreferenceStore doGetPreferenceStore() {
- return WorkbenchPlugin.getDefault().getPreferenceStore();
- }
+ return WorkbenchPlugin.getDefault().getPreferenceStore();
+ }
- protected void fillEditorTable() {
- editorTable.removeAll();
- FileEditorMapping resourceType = getSelectedResourceType();
- if (resourceType != null) {
+ protected void fillEditorTable() {
+ editorTable.removeAll();
+ FileEditorMapping resourceType = getSelectedResourceType();
+ if (resourceType != null) {
for (IEditorDescriptor editor : resourceType.getEditors()) {
- TableItem item = new TableItem(editorTable, SWT.NULL);
- item.setData(DATA_EDITOR, editor);
- // Check if it is the default editor
- String defaultString = null;
+ TableItem item = new TableItem(editorTable, SWT.NULL);
+ item.setData(DATA_EDITOR, editor);
+ // Check if it is the default editor
+ String defaultString = null;
if (resourceType.getDefaultEditor() == editor && resourceType.isDeclaredDefaultEditor(editor)) {
defaultString = WorkbenchMessages.FileEditorPreference_defaultLabel;
}
- if (defaultString != null) {
- item.setText(editor.getLabel() + " " + defaultString); //$NON-NLS-1$
- } else {
- item.setText(editor.getLabel());
- }
- item.setImage(getImage(editor));
- }
-
- // now add any content type editors
- EditorRegistry registry = (EditorRegistry) WorkbenchPlugin
- .getDefault().getEditorRegistry();
- IContentType[] contentTypes = Platform.getContentTypeManager()
- .findContentTypesFor(resourceType.getLabel());
+ if (defaultString != null) {
+ item.setText(editor.getLabel() + " " + defaultString); //$NON-NLS-1$
+ } else {
+ item.setText(editor.getLabel());
+ }
+ item.setImage(getImage(editor));
+ }
+
+ // now add any content type editors
+ EditorRegistry registry = (EditorRegistry) WorkbenchPlugin.getDefault().getEditorRegistry();
+ IContentType[] contentTypes = Platform.getContentTypeManager().findContentTypesFor(resourceType.getLabel());
for (IContentType contentType : contentTypes) {
for (IEditorDescriptor editor : registry.getEditorsForContentType(contentType)) {
// don't add duplicates
@@ -365,293 +356,275 @@ public class FileEditorsPreferencePage extends PreferencePage implements
}
}
- }
- }
+ }
+ }
- /**
+ /**
* Set the locked message on the item. Assumes the item has an instance of
* IContentType in the data map.
*
- * @param item the item to set
+ * @param item the item to set
* @param baseLabel the base label
*/
private void setLockedItemText(TableItem item, String baseLabel) {
- item.setText(NLS
- .bind(WorkbenchMessages.FileEditorPreference_isLocked,
- baseLabel, ((IContentType) item
- .getData(DATA_FROM_CONTENT_TYPE)).getName()));
+ item.setText(NLS.bind(WorkbenchMessages.FileEditorPreference_isLocked, baseLabel,
+ ((IContentType) item.getData(DATA_FROM_CONTENT_TYPE)).getName()));
}
- /**
+ /**
* Place the existing resource types in the table
*/
- protected void fillResourceTypeTable() {
- // Populate the table with the items
- IFileEditorMapping[] array = WorkbenchPlugin.getDefault()
- .getEditorRegistry().getFileEditorMappings();
- for (int i = 0; i < array.length; i++) {
- FileEditorMapping mapping = (FileEditorMapping) array[i];
- mapping = (FileEditorMapping) mapping.clone(); // want a copy
- newResourceTableItem(mapping, i, false);
- }
- }
-
- /**
- * Returns the image associated with the given editor.
- */
- protected Image getImage(IEditorDescriptor editor) {
- Image image = (Image) editorsToImages.get(editor);
- if (image == null) {
- image = editor.getImageDescriptor().createImage();
- editorsToImages.put(editor, image);
- }
- return image;
- }
-
- protected FileEditorMapping getSelectedResourceType() {
- TableItem[] items = resourceTypeTable.getSelection();
- if (items.length == 1) {
- return (FileEditorMapping) items[0].getData();
- }
- return null;
- }
-
- protected IEditorDescriptor[] getAssociatedEditors() {
- if (getSelectedResourceType() == null) {
+ protected void fillResourceTypeTable() {
+ // Populate the table with the items
+ IFileEditorMapping[] array = WorkbenchPlugin.getDefault().getEditorRegistry().getFileEditorMappings();
+ for (int i = 0; i < array.length; i++) {
+ FileEditorMapping mapping = (FileEditorMapping) array[i];
+ mapping = (FileEditorMapping) mapping.clone(); // want a copy
+ newResourceTableItem(mapping, i, false);
+ }
+ }
+
+ /**
+ * Returns the image associated with the given editor.
+ */
+ protected Image getImage(IEditorDescriptor editor) {
+ Image image = (Image) editorsToImages.get(editor);
+ if (image == null) {
+ image = editor.getImageDescriptor().createImage();
+ editorsToImages.put(editor, image);
+ }
+ return image;
+ }
+
+ protected FileEditorMapping getSelectedResourceType() {
+ TableItem[] items = resourceTypeTable.getSelection();
+ if (items.length == 1) {
+ return (FileEditorMapping) items[0].getData();
+ }
+ return null;
+ }
+
+ protected IEditorDescriptor[] getAssociatedEditors() {
+ if (getSelectedResourceType() == null) {
return null;
}
- if (editorTable.getItemCount() > 0) {
- ArrayList editorList = new ArrayList();
- for (int i = 0; i < editorTable.getItemCount(); i++) {
+ if (editorTable.getItemCount() > 0) {
+ ArrayList editorList = new ArrayList();
+ for (int i = 0; i < editorTable.getItemCount(); i++) {
editorList.add(editorTable.getItem(i).getData(DATA_EDITOR));
}
- return (IEditorDescriptor[]) editorList
- .toArray(new IEditorDescriptor[editorList.size()]);
- }
- return null;
- }
+ return (IEditorDescriptor[]) editorList.toArray(new IEditorDescriptor[editorList.size()]);
+ }
+ return null;
+ }
- @Override
+ @Override
public void handleEvent(Event event) {
- if (event.widget == addResourceTypeButton) {
- promptForResourceType();
- } else if (event.widget == removeResourceTypeButton) {
- removeSelectedResourceType();
- } else if (event.widget == addEditorButton) {
- promptForEditor();
- } else if (event.widget == removeEditorButton) {
- removeSelectedEditor();
- } else if (event.widget == defaultEditorButton) {
- setSelectedEditorAsDefault();
- } else if (event.widget == resourceTypeTable) {
- fillEditorTable();
- }
-
- updateEnabledState();
-
- }
-
- /**
- * @see IWorkbenchPreferencePage
- */
- @Override
+ if (event.widget == addResourceTypeButton) {
+ promptForResourceType();
+ } else if (event.widget == removeResourceTypeButton) {
+ removeSelectedResourceType();
+ } else if (event.widget == addEditorButton) {
+ promptForEditor();
+ } else if (event.widget == removeEditorButton) {
+ removeSelectedEditor();
+ } else if (event.widget == defaultEditorButton) {
+ setSelectedEditorAsDefault();
+ } else if (event.widget == resourceTypeTable) {
+ fillEditorTable();
+ }
+
+ updateEnabledState();
+
+ }
+
+ /**
+ * @see IWorkbenchPreferencePage
+ */
+ @Override
public void init(IWorkbench aWorkbench) {
- this.workbench = aWorkbench;
- noDefaultAndApplyButton();
- }
-
- /*
- * Create a new <code>TableItem</code> to represent the resource
- * type editor description supplied.
- */
- protected TableItem newResourceTableItem(IFileEditorMapping mapping,
- int index, boolean selected) {
- Image image = mapping.getImageDescriptor().createImage(false);
- if (image != null) {
+ this.workbench = aWorkbench;
+ noDefaultAndApplyButton();
+ }
+
+ /*
+ * Create a new <code>TableItem</code> to represent the resource type editor
+ * description supplied.
+ */
+ protected TableItem newResourceTableItem(IFileEditorMapping mapping, int index, boolean selected) {
+ Image image = mapping.getImageDescriptor().createImage(false);
+ if (image != null) {
imagesToDispose.add(image);
}
- TableItem item = new TableItem(resourceTypeTable, SWT.NULL, index);
- if (image != null) {
- item.setImage(image);
- }
- item.setText(mapping.getLabel());
- item.setData(mapping);
- if (selected) {
- resourceTypeTable.setSelection(index);
- }
-
- return item;
- }
-
- /**
- * This is a hook for sublcasses to do special things when the ok
- * button is pressed.
- * For example reimplement this method if you want to save the
- * page's data into the preference bundle.
- */
- @Override
+ TableItem item = new TableItem(resourceTypeTable, SWT.NULL, index);
+ if (image != null) {
+ item.setImage(image);
+ }
+ item.setText(mapping.getLabel());
+ item.setData(mapping);
+ if (selected) {
+ resourceTypeTable.setSelection(index);
+ }
+
+ return item;
+ }
+
+ /**
+ * This is a hook for sublcasses to do special things when the ok button is
+ * pressed. For example reimplement this method if you want to save the page's
+ * data into the preference bundle.
+ */
+ @Override
public boolean performOk() {
- TableItem[] items = resourceTypeTable.getItems();
- FileEditorMapping[] resourceTypes = new FileEditorMapping[items.length];
- for (int i = 0; i < items.length; i++) {
- resourceTypes[i] = (FileEditorMapping) (items[i].getData());
- }
- EditorRegistry registry = (EditorRegistry) WorkbenchPlugin.getDefault()
- .getEditorRegistry(); // cast to allow save to be called
- registry.setFileEditorMappings(resourceTypes);
- registry.saveAssociations();
-
- PrefUtil.savePrefs();
- return true;
- }
-
- /**
- * Prompt for editor.
- */
- public void promptForEditor() {
- EditorSelectionDialog dialog = new EditorSelectionDialog(getControl()
- .getShell());
- dialog.setEditorsToFilter(getAssociatedEditors());
- dialog
- .setMessage(NLS.bind(WorkbenchMessages.Choose_the_editor_for_file,getSelectedResourceType().getLabel() ));
- if (dialog.open() == Window.OK) {
- EditorDescriptor editor = (EditorDescriptor) dialog
- .getSelectedEditor();
- if (editor != null) {
- int i = editorTable.getItemCount();
- boolean isEmpty = i < 1;
- TableItem item = new TableItem(editorTable, SWT.NULL, i);
- item.setData(DATA_EDITOR, editor);
- if (isEmpty) {
- item
- .setText(editor.getLabel()
- + " " + WorkbenchMessages.FileEditorPreference_defaultLabel); //$NON-NLS-1$
+ TableItem[] items = resourceTypeTable.getItems();
+ FileEditorMapping[] resourceTypes = new FileEditorMapping[items.length];
+ for (int i = 0; i < items.length; i++) {
+ resourceTypes[i] = (FileEditorMapping) (items[i].getData());
+ }
+ EditorRegistry registry = (EditorRegistry) WorkbenchPlugin.getDefault().getEditorRegistry(); // cast to allow
+ // save to be
+ // called
+ registry.setFileEditorMappings(resourceTypes);
+ registry.saveAssociations();
+
+ PrefUtil.savePrefs();
+ return true;
+ }
+
+ /**
+ * Prompt for editor.
+ */
+ public void promptForEditor() {
+ EditorSelectionDialog dialog = new EditorSelectionDialog(getControl().getShell());
+ dialog.setEditorsToFilter(getAssociatedEditors());
+ dialog.setMessage(NLS.bind(WorkbenchMessages.Choose_the_editor_for_file, getSelectedResourceType().getLabel()));
+ if (dialog.open() == Window.OK) {
+ EditorDescriptor editor = (EditorDescriptor) dialog.getSelectedEditor();
+ if (editor != null) {
+ int i = editorTable.getItemCount();
+ boolean isEmpty = i < 1;
+ TableItem item = new TableItem(editorTable, SWT.NULL, i);
+ item.setData(DATA_EDITOR, editor);
+ if (isEmpty) {
+ item.setText(editor.getLabel() + " " + WorkbenchMessages.FileEditorPreference_defaultLabel); //$NON-NLS-1$
} else {
item.setText(editor.getLabel());
}
- item.setImage(getImage(editor));
- editorTable.setSelection(i);
- editorTable.setFocus();
- getSelectedResourceType().addEditor(editor);
+ item.setImage(getImage(editor));
+ editorTable.setSelection(i);
+ editorTable.setFocus();
+ getSelectedResourceType().addEditor(editor);
if (isEmpty) {
getSelectedResourceType().setDefaultEditor(editor);
}
- updateSelectedResourceType(); //in case of new default
- }
- }
- }
-
- /**
- * Prompt for resource type.
- */
- public void promptForResourceType() {
- FileExtensionDialog dialog = new FileExtensionDialog(getControl()
- .getShell(), WorkbenchMessages.FileExtension_shellTitle,
- IWorkbenchHelpContextIds.FILE_EXTENSION_DIALOG,
- WorkbenchMessages.FileExtension_dialogTitle,
- WorkbenchMessages.FileExtension_fileTypeMessage,
+ updateSelectedResourceType(); // in case of new default
+ }
+ }
+ }
+
+ /**
+ * Prompt for resource type.
+ */
+ public void promptForResourceType() {
+ FileExtensionDialog dialog = new FileExtensionDialog(getControl().getShell(),
+ WorkbenchMessages.FileExtension_shellTitle, IWorkbenchHelpContextIds.FILE_EXTENSION_DIALOG,
+ WorkbenchMessages.FileExtension_dialogTitle, WorkbenchMessages.FileExtension_fileTypeMessage,
WorkbenchMessages.FileExtension_fileTypeLabel);
- if (dialog.open() == Window.OK) {
- String name = dialog.getName();
- String extension = dialog.getExtension();
- addResourceType(name, extension);
- }
- }
-
- /**
- * Remove the editor from the table
- */
- public void removeSelectedEditor() {
- TableItem[] items = editorTable.getSelection();
- boolean defaultEditor = editorTable.getSelectionIndex() == 0;
- if (items.length > 0) {
- for (TableItem item : items) {
- getSelectedResourceType().removeEditor(
- (EditorDescriptor) item.getData(DATA_EDITOR));
- item.dispose();
- }
- }
- if (defaultEditor && editorTable.getItemCount() > 0) {
- TableItem item = editorTable.getItem(0);
- // explicitly set the first editor as the default
- getSelectedResourceType().setDefaultEditor(
- (EditorDescriptor) item.getData(DATA_EDITOR));
- item.setText(((EditorDescriptor) (item.getData(DATA_EDITOR))).getLabel()
- + " " + WorkbenchMessages.FileEditorPreference_defaultLabel); //$NON-NLS-1$
+ if (dialog.open() == Window.OK) {
+ String name = dialog.getName();
+ String extension = dialog.getExtension();
+ addResourceType(name, extension);
+ }
+ }
+
+ /**
+ * Remove the editor from the table
+ */
+ public void removeSelectedEditor() {
+ TableItem[] items = editorTable.getSelection();
+ boolean defaultEditor = editorTable.getSelectionIndex() == 0;
+ if (items.length > 0) {
+ for (TableItem item : items) {
+ getSelectedResourceType().removeEditor((EditorDescriptor) item.getData(DATA_EDITOR));
+ item.dispose();
+ }
+ }
+ if (defaultEditor && editorTable.getItemCount() > 0) {
+ TableItem item = editorTable.getItem(0);
+ // explicitly set the first editor as the default
+ getSelectedResourceType().setDefaultEditor((EditorDescriptor) item.getData(DATA_EDITOR));
+ item.setText(((EditorDescriptor) (item.getData(DATA_EDITOR))).getLabel() + " " //$NON-NLS-1$
+ + WorkbenchMessages.FileEditorPreference_defaultLabel);
if (!isEditorRemovable(item)) {
setLockedItemText(item, item.getText());
}
}
- }
+ }
- /**
- * Remove the type from the table
- */
- public void removeSelectedResourceType() {
+ /**
+ * Remove the type from the table
+ */
+ public void removeSelectedResourceType() {
for (TableItem item : resourceTypeTable.getSelection()) {
- item.dispose();
- }
- //Clear out the editors too
- editorTable.removeAll();
- }
-
- /**
- * Add the selected editor to the default list.
- */
- public void setSelectedEditorAsDefault() {
- TableItem[] items = editorTable.getSelection();
- if (items.length > 0) {
- // First change the label of the old default
- TableItem oldDefaultItem = editorTable.getItem(0);
- oldDefaultItem
- .setText(((EditorDescriptor) oldDefaultItem.getData(DATA_EDITOR))
- .getLabel());
- // update the label to reflect the locked state
- if (!isEditorRemovable(oldDefaultItem)) {
+ item.dispose();
+ }
+ // Clear out the editors too
+ editorTable.removeAll();
+ }
+
+ /**
+ * Add the selected editor to the default list.
+ */
+ public void setSelectedEditorAsDefault() {
+ TableItem[] items = editorTable.getSelection();
+ if (items.length > 0) {
+ // First change the label of the old default
+ TableItem oldDefaultItem = editorTable.getItem(0);
+ oldDefaultItem.setText(((EditorDescriptor) oldDefaultItem.getData(DATA_EDITOR)).getLabel());
+ // update the label to reflect the locked state
+ if (!isEditorRemovable(oldDefaultItem)) {
setLockedItemText(oldDefaultItem, oldDefaultItem.getText());
}
- // Now set the new default
- EditorDescriptor editor = (EditorDescriptor) items[0].getData(DATA_EDITOR);
- getSelectedResourceType().setDefaultEditor(editor);
- IContentType fromContentType = (IContentType) items[0].getData(DATA_FROM_CONTENT_TYPE);
- items[0].dispose(); //Table is single selection
- TableItem item = new TableItem(editorTable, SWT.NULL, 0);
- item.setData(DATA_EDITOR, editor);
- if (fromContentType != null) {
+ // Now set the new default
+ EditorDescriptor editor = (EditorDescriptor) items[0].getData(DATA_EDITOR);
+ getSelectedResourceType().setDefaultEditor(editor);
+ IContentType fromContentType = (IContentType) items[0].getData(DATA_FROM_CONTENT_TYPE);
+ items[0].dispose(); // Table is single selection
+ TableItem item = new TableItem(editorTable, SWT.NULL, 0);
+ item.setData(DATA_EDITOR, editor);
+ if (fromContentType != null) {
item.setData(DATA_FROM_CONTENT_TYPE, fromContentType);
}
- item
- .setText(editor.getLabel()
- + " " + WorkbenchMessages.FileEditorPreference_defaultLabel); //$NON-NLS-1$
- item.setImage(getImage(editor));
- if (!isEditorRemovable(item)) {
+ item.setText(editor.getLabel() + " " + WorkbenchMessages.FileEditorPreference_defaultLabel); //$NON-NLS-1$
+ item.setImage(getImage(editor));
+ if (!isEditorRemovable(item)) {
setLockedItemText(item, item.getText());
}
editorTable.setSelection(new TableItem[] { item });
- }
- }
-
- /**
- * Update the enabled state.
- */
- public void updateEnabledState() {
- //Update enabled state
- int selectedResources = resourceTypeTable.getSelectionCount();
- int selectedEditors = editorTable.getSelectionCount();
-
- removeResourceTypeButton.setEnabled(selectedResources != 0);
+ }
+ }
+
+ /**
+ * Update the enabled state.
+ */
+ public void updateEnabledState() {
+ // Update enabled state
+ int selectedResources = resourceTypeTable.getSelectionCount();
+ int selectedEditors = editorTable.getSelectionCount();
+
+ removeResourceTypeButton.setEnabled(selectedResources != 0);
editorLabel.setEnabled(selectedResources == 1);
- addEditorButton.setEnabled(selectedResources == 1);
+ addEditorButton.setEnabled(selectedResources == 1);
removeEditorButton.setEnabled(areEditorsRemovable());
- defaultEditorButton.setEnabled(selectedEditors == 1);
- }
+ defaultEditorButton.setEnabled(selectedEditors == 1);
+ }
- /**
- * Return whether the selected editors are removable. An editor is removable
- * if it was not submitted via a content-type binding.
+ /**
+ * Return whether the selected editors are removable. An editor is removable if
+ * it was not submitted via a content-type binding.
*
* @return whether all the selected editors are removable or not
* @since 3.1
@@ -670,15 +643,15 @@ public class FileEditorsPreferencePage extends PreferencePage implements
return true;
}
- /**
- * Return whether the given editor is removable. An editor is removable
- * if it is not submitted via a content-type binding.
+ /**
+ * Return whether the given editor is removable. An editor is removable if it is
+ * not submitted via a content-type binding.
*
* @param item the item to test
* @return whether the selected editor is removable
* @since 3.1
*/
- private boolean isEditorRemovable(TableItem item) {
+ private boolean isEditorRemovable(TableItem item) {
IContentType fromContentType = (IContentType) item.getData(DATA_FROM_CONTENT_TYPE);
return fromContentType == null;
}
@@ -686,10 +659,11 @@ public class FileEditorsPreferencePage extends PreferencePage implements
/**
* Update the selected type.
*/
- public void updateSelectedResourceType() {
- // TableItem item = resourceTypeTable.getSelection()[0]; //Single select
- // Image image = ((IFileEditorMapping)item.getData()).getImageDescriptor().getImage();
- // imagesToDispose.addElement(image);
- // item.setImage(image);
- }
+ public void updateSelectedResourceType() {
+ // TableItem item = resourceTypeTable.getSelection()[0]; //Single select
+ // Image image =
+ // ((IFileEditorMapping)item.getData()).getImageDescriptor().getImage();
+ // imagesToDispose.addElement(image);
+ // item.setImage(image);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FileExtensionDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FileExtensionDialog.java
index fcab03347d8..add9682a58a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FileExtensionDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FileExtensionDialog.java
@@ -40,13 +40,13 @@ public class FileExtensionDialog extends TitleAreaDialog {
private static final String DIALOG_SETTINGS_SECTION = "FileExtensionDialogSettings"; //$NON-NLS-1$
- private String filename = ""; //$NON-NLS-1$
+ private String filename = ""; //$NON-NLS-1$
- private String initialValue;
+ private String initialValue;
- private Text filenameField;
+ private Text filenameField;
- private Button okButton;
+ private Button okButton;
private String title;
@@ -58,50 +58,49 @@ public class FileExtensionDialog extends TitleAreaDialog {
private final String label;
- /**
- * Constructs a new file extension dialog.
- * @param parentShell the parent shell
- */
- public FileExtensionDialog(Shell parentShell) {
- this(parentShell, WorkbenchMessages.FileExtension_shellTitle,
- IWorkbenchHelpContextIds.FILE_EXTENSION_DIALOG,
- WorkbenchMessages.FileExtension_dialogTitle,
- WorkbenchMessages.FileExtension_fileTypeMessage,
+ /**
+ * Constructs a new file extension dialog.
+ *
+ * @param parentShell the parent shell
+ */
+ public FileExtensionDialog(Shell parentShell) {
+ this(parentShell, WorkbenchMessages.FileExtension_shellTitle, IWorkbenchHelpContextIds.FILE_EXTENSION_DIALOG,
+ WorkbenchMessages.FileExtension_dialogTitle, WorkbenchMessages.FileExtension_fileTypeMessage,
WorkbenchMessages.FileExtension_fileTypeLabel);
setShellStyle(getShellStyle() | SWT.SHEET);
}
- /**
- * Constructs a new file extension dialog.
- *
- * @param parentShell the parent shell
- * @param title the dialog title
- * @param helpContextId the help context for this dialog
- * @param headerTitle the dialog header
- * @param message the dialog message
- * @param label the label for the "file type" field
- * @since 3.4
- */
- public FileExtensionDialog(Shell parentShell, String title, String helpContextId, String headerTitle, String message, String label) {
- super(parentShell);
- this.title = title;
- this.helpContextId = helpContextId;
+ /**
+ * Constructs a new file extension dialog.
+ *
+ * @param parentShell the parent shell
+ * @param title the dialog title
+ * @param helpContextId the help context for this dialog
+ * @param headerTitle the dialog header
+ * @param message the dialog message
+ * @param label the label for the "file type" field
+ * @since 3.4
+ */
+ public FileExtensionDialog(Shell parentShell, String title, String helpContextId, String headerTitle,
+ String message, String label) {
+ super(parentShell);
+ this.title = title;
+ this.helpContextId = helpContextId;
this.headerTitle = headerTitle;
message2 = message;
this.label = label;
setShellStyle(getShellStyle() | SWT.SHEET);
- }
+ }
- @Override
+ @Override
protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(title);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(shell, helpContextId);
- }
-
+ super.configureShell(shell);
+ shell.setText(title);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(shell, helpContextId);
+ }
- @Override
+ @Override
protected Control createDialogArea(Composite parent) {
Composite parentComposite = (Composite) super.createDialogArea(parent);
@@ -111,8 +110,7 @@ public class FileExtensionDialog extends TitleAreaDialog {
setTitle(headerTitle);
setMessage(message2);
- new Label(contents, SWT.LEFT)
- .setText(label);
+ new Label(contents, SWT.LEFT).setText(label);
filenameField = new Text(contents, SWT.SINGLE | SWT.BORDER);
if (initialValue != null) {
@@ -129,124 +127,121 @@ public class FileExtensionDialog extends TitleAreaDialog {
Dialog.applyDialogFont(parentComposite);
Point defaultMargins = LayoutConstants.getMargins();
- GridLayoutFactory.fillDefaults().numColumns(2).margins(
- defaultMargins.x, defaultMargins.y).generateLayout(contents);
+ GridLayoutFactory.fillDefaults().numColumns(2).margins(defaultMargins.x, defaultMargins.y)
+ .generateLayout(contents);
return contents;
}
-
- @Override
+ @Override
protected void createButtonsForButtonBar(Composite parent) {
- okButton = createButton(parent, IDialogConstants.OK_ID,
- IDialogConstants.OK_LABEL, true);
- okButton.setEnabled(false);
- createButton(parent, IDialogConstants.CANCEL_ID,
- IDialogConstants.CANCEL_LABEL, false);
- }
-
- /**
- * Validate the user input for a file type
- */
- private boolean validateFileType() {
- // We need kernel api to validate the extension or a filename
-
- // check for empty name and extension
- if (filename.length() == 0) {
- setErrorMessage(null);
- return false;
- }
-
- // check for empty extension if there is no name
- int index = filename.lastIndexOf('.');
- if (index == filename.length() - 1) {
- if (index == 0 || (index == 1 && filename.charAt(0) == '*')) {
- setErrorMessage(WorkbenchMessages.FileExtension_extensionEmptyMessage);
- return false;
- }
- }
-
- // check for characters before *
- // or no other characters
- // or next chatacter not '.'
- // or another *
- index = filename.indexOf('*');
- if (index > -1) {
- if (filename.length() == 1) {
- setErrorMessage(WorkbenchMessages.FileExtension_extensionEmptyMessage);
- return false;
- }
- if (index != 0 || filename.charAt(1) != '.') {
- setErrorMessage(WorkbenchMessages.FileExtension_fileNameInvalidMessage);
- return false;
- }
- if (filename.length() > index && filename.indexOf('*', index + 1) != -1) {
- setErrorMessage(WorkbenchMessages.FileExtension_fileNameInvalidMessage);
- return false;
- }
- }
-
- setErrorMessage(null);
- return true;
- }
-
- /**
- * Get the extension.
- *
- * @return the extension
- */
- public String getExtension() {
- // We need kernel api to validate the extension or a filename
-
- int index = filename.lastIndexOf('.');
- if (index == -1) {
+ okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
+ okButton.setEnabled(false);
+ createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
+ }
+
+ /**
+ * Validate the user input for a file type
+ */
+ private boolean validateFileType() {
+ // We need kernel api to validate the extension or a filename
+
+ // check for empty name and extension
+ if (filename.length() == 0) {
+ setErrorMessage(null);
+ return false;
+ }
+
+ // check for empty extension if there is no name
+ int index = filename.lastIndexOf('.');
+ if (index == filename.length() - 1) {
+ if (index == 0 || (index == 1 && filename.charAt(0) == '*')) {
+ setErrorMessage(WorkbenchMessages.FileExtension_extensionEmptyMessage);
+ return false;
+ }
+ }
+
+ // check for characters before *
+ // or no other characters
+ // or next chatacter not '.'
+ // or another *
+ index = filename.indexOf('*');
+ if (index > -1) {
+ if (filename.length() == 1) {
+ setErrorMessage(WorkbenchMessages.FileExtension_extensionEmptyMessage);
+ return false;
+ }
+ if (index != 0 || filename.charAt(1) != '.') {
+ setErrorMessage(WorkbenchMessages.FileExtension_fileNameInvalidMessage);
+ return false;
+ }
+ if (filename.length() > index && filename.indexOf('*', index + 1) != -1) {
+ setErrorMessage(WorkbenchMessages.FileExtension_fileNameInvalidMessage);
+ return false;
+ }
+ }
+
+ setErrorMessage(null);
+ return true;
+ }
+
+ /**
+ * Get the extension.
+ *
+ * @return the extension
+ */
+ public String getExtension() {
+ // We need kernel api to validate the extension or a filename
+
+ int index = filename.lastIndexOf('.');
+ if (index == -1) {
return ""; //$NON-NLS-1$
}
- if (index == filename.length()) {
+ if (index == filename.length()) {
return ""; //$NON-NLS-1$
}
- return filename.substring(index + 1, filename.length());
- }
-
- /**
- * Get the name.
- *
- * @return the name
- */
- public String getName() {
- // We need kernel api to validate the extension or a filename
-
- int index = filename.lastIndexOf('.');
- if (index == -1) {
+ return filename.substring(index + 1, filename.length());
+ }
+
+ /**
+ * Get the name.
+ *
+ * @return the name
+ */
+ public String getName() {
+ // We need kernel api to validate the extension or a filename
+
+ int index = filename.lastIndexOf('.');
+ if (index == -1) {
return filename;
}
- if (index == 0) {
+ if (index == 0) {
return "*"; //$NON-NLS-1$
}
- return filename.substring(0, index);
- }
+ return filename.substring(0, index);
+ }
- /**
+ /**
* Sets the initial value that should be prepopulated in this dialog.
*
- * @param initialValue
- * the value to be displayed to the user
+ * @param initialValue the value to be displayed to the user
* @since 3.4
*/
- public void setInitialValue(String initialValue) {
- this.initialValue = initialValue;
- }
+ public void setInitialValue(String initialValue) {
+ this.initialValue = initialValue;
+ }
- @Override
+ @Override
protected IDialogSettings getDialogBoundsSettings() {
- IDialogSettings settings = WorkbenchPlugin.getDefault().getDialogSettings();
- IDialogSettings section = settings.getSection(DIALOG_SETTINGS_SECTION);
- if (section == null) section = settings.addNewSection(DIALOG_SETTINGS_SECTION);
- return section;
- }
+ IDialogSettings settings = WorkbenchPlugin.getDefault().getDialogSettings();
+ IDialogSettings section = settings.getSection(DIALOG_SETTINGS_SECTION);
+ if (section == null)
+ section = settings.addNewSection(DIALOG_SETTINGS_SECTION);
+ return section;
+ }
- @Override
+ @Override
protected boolean isResizable() {
- return true;
- }
+ return true;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FilteredPreferenceDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FilteredPreferenceDialog.java
index 87c87d4e7c9..5339a06a25c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FilteredPreferenceDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FilteredPreferenceDialog.java
@@ -84,15 +84,13 @@ import org.eclipse.ui.preferences.WorkingCopyManager;
import org.eclipse.ui.statushandlers.StatusManager;
import org.osgi.service.prefs.BackingStoreException;
-
/**
* Baseclass for preference dialogs that will show two tabs of preferences -
* filtered and unfiltered.
*
* @since 3.0
*/
-public abstract class FilteredPreferenceDialog extends PreferenceDialog
- implements IWorkbenchPreferenceContainer {
+public abstract class FilteredPreferenceDialog extends PreferenceDialog implements IWorkbenchPreferenceContainer {
/**
*
@@ -111,29 +109,25 @@ public abstract class FilteredPreferenceDialog extends PreferenceDialog
private ViewerFilter viewerFilter;
/**
- * Initial title of dialog. This is only used if the additional filter
- * provided by the addFilter(ViewerFilter) method is utilized.
+ * Initial title of dialog. This is only used if the additional filter provided
+ * by the addFilter(ViewerFilter) method is utilized.
*/
private String cachedTitle;
/**
* Constructor.
*
- * @param parent
- * parent Composite
- * @param treeStyle
- * SWT style bits for Tree
- * @param filter
- * the PatternFilter to use for the TreeViewer
+ * @param parent parent Composite
+ * @param treeStyle SWT style bits for Tree
+ * @param filter the PatternFilter to use for the TreeViewer
*/
- PreferenceFilteredTree(Composite parent, int treeStyle,
- PatternFilter filter) {
+ PreferenceFilteredTree(Composite parent, int treeStyle, PatternFilter filter) {
super(parent, treeStyle, filter, true);
}
/**
- * Add an additional, optional filter to the viewer. If the filter text
- * is cleared, this filter will be removed from the TreeViewer.
+ * Add an additional, optional filter to the viewer. If the filter text is
+ * cleared, this filter will be removed from the TreeViewer.
*
* @param filter
*/
@@ -147,10 +141,7 @@ public abstract class FilteredPreferenceDialog extends PreferenceDialog
}
cachedTitle = getShell().getText();
- getShell().setText(
- NLS.bind(
- WorkbenchMessages.FilteredTree_FilteredDialogTitle,
- cachedTitle));
+ getShell().setText(NLS.bind(WorkbenchMessages.FilteredTree_FilteredDialogTitle, cachedTitle));
}
@Override
@@ -200,10 +191,8 @@ public abstract class FilteredPreferenceDialog extends PreferenceDialog
* Creates a new preference dialog under the control of the given preference
* manager.
*
- * @param parentShell
- * the parent shell
- * @param manager
- * the preference manager
+ * @param parentShell the parent shell
+ * @param manager the preference manager
*/
public FilteredPreferenceDialog(Shell parentShell, PreferenceManager manager) {
super(parentShell, manager);
@@ -211,10 +200,9 @@ public abstract class FilteredPreferenceDialog extends PreferenceDialog
}
/**
- * Differs from super implementation in that if the node is found but should
- * be filtered based on a call to
- * <code>WorkbenchActivityHelper.filterItem()</code> then
- * <code>null</code> is returned.
+ * Differs from super implementation in that if the node is found but should be
+ * filtered based on a call to <code>WorkbenchActivityHelper.filterItem()</code>
+ * then <code>null</code> is returned.
*
* @see org.eclipse.jface.preference.PreferenceDialog#findNodeMatching(java.lang.String)
*/
@@ -232,17 +220,16 @@ public abstract class FilteredPreferenceDialog extends PreferenceDialog
int styleBits = SWT.SINGLE;
TreeViewer tree;
if (!hasAtMostOnePage()) {
- filteredTree= new PreferenceFilteredTree(parent, styleBits, new PreferencePatternFilter());
+ filteredTree = new PreferenceFilteredTree(parent, styleBits, new PreferencePatternFilter());
filteredTree.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
- tree= filteredTree.getViewer();
+ tree = filteredTree.getViewer();
} else
- tree= new TreeViewer(parent, styleBits);
+ tree = new TreeViewer(parent, styleBits);
setContentAndLabelProviders(tree);
tree.setInput(getPreferenceManager());
-
tree.addFilter(new CapabilityFilter());
tree.addSelectionChangedListener(event -> handleTreeSelectionChanged(event));
@@ -257,9 +244,9 @@ public abstract class FilteredPreferenceDialog extends PreferenceDialog
* @return <code>true</code> if there are less than two pages.
*/
private boolean hasAtMostOnePage() {
- ITreeContentProvider contentProvider= new PreferenceContentProvider();
+ ITreeContentProvider contentProvider = new PreferenceContentProvider();
try {
- Object[] children= contentProvider.getElements(getPreferenceManager());
+ Object[] children = contentProvider.getElements(getPreferenceManager());
return children.length == 0 || children.length == 1 && !contentProvider.hasChildren(children[0]);
} finally {
contentProvider.dispose();
@@ -277,9 +264,8 @@ public abstract class FilteredPreferenceDialog extends PreferenceDialog
} else {
treeViewer.setLabelProvider(new PreferenceBoldLabelProvider(filteredTree));
}
- IContributionService cs = PlatformUI
- .getWorkbench().getActiveWorkbenchWindow().getService(
- IContributionService.class);
+ IContributionService cs = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getService(IContributionService.class);
treeViewer.setComparator(cs.getComparatorFor(getContributionType()));
treeViewer.setContentProvider(new PreferenceContentProvider());
}
@@ -298,8 +284,7 @@ public abstract class FilteredPreferenceDialog extends PreferenceDialog
/**
* A selection has been made in the tree.
*
- * @param event
- * SelectionChangedEvent
+ * @param event SelectionChangedEvent
*/
protected void handleTreeSelectionChanged(SelectionChangedEvent event) {
// Do nothing by default
@@ -308,8 +293,7 @@ public abstract class FilteredPreferenceDialog extends PreferenceDialog
@Override
protected Control createTreeAreaContents(Composite parent) {
Composite leftArea = new Composite(parent, SWT.NONE);
- leftArea.setBackground(parent.getDisplay().getSystemColor(
- SWT.COLOR_LIST_BACKGROUND));
+ leftArea.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
leftArea.setFont(parent.getFont());
GridLayout leftLayout = new GridLayout();
leftLayout.numColumns = 1;
@@ -325,8 +309,7 @@ public abstract class FilteredPreferenceDialog extends PreferenceDialog
setTreeViewer(viewer);
updateTreeFont(JFaceResources.getDialogFont());
- GridData viewerData = new GridData(GridData.FILL_BOTH
- | GridData.GRAB_VERTICAL);
+ GridData viewerData = new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL);
viewer.getControl().getParent().setLayoutData(viewerData);
layoutTreeAreaControl(leftArea);
@@ -348,8 +331,7 @@ public abstract class FilteredPreferenceDialog extends PreferenceDialog
/**
* Set the data to be applied to a page after it is created.
*
- * @param pageData
- * Object
+ * @param pageData Object
*/
public void setPageData(Object pageData) {
this.pageData = pageData;
@@ -383,15 +365,13 @@ public abstract class FilteredPreferenceDialog extends PreferenceDialog
ToolBar toolBar = (ToolBar) control;
ToolItem importButton = new ToolItem(toolBar, SWT.PUSH);
- importImage = WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_PREF_IMPORT)
- .createImage();
+ importImage = WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_PREF_IMPORT).createImage();
importButton.setImage(importImage);
importButton.setToolTipText(WorkbenchMessages.Preference_import);
importButton.addListener(SWT.Selection, e -> openImportWizard(parent));
ToolItem exportButton = new ToolItem(toolBar, SWT.PUSH);
- exportImage = WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_PREF_EXPORT)
- .createImage();
+ exportImage = WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_PREF_EXPORT).createImage();
exportButton.setImage(exportImage);
exportButton.setToolTipText(WorkbenchMessages.Preference_export);
exportButton.addListener(SWT.Selection, e -> openExportWizard(parent));
@@ -459,12 +439,11 @@ public abstract class FilteredPreferenceDialog extends PreferenceDialog
}
/**
- * Selects the current page based on the given preference page identifier.
- * If no node can be found, then nothing will change.
+ * Selects the current page based on the given preference page identifier. If no
+ * node can be found, then nothing will change.
*
- * @param preferencePageId
- * The preference page identifier to select; should not be
- * <code>null</code>.
+ * @param preferencePageId The preference page identifier to select; should not
+ * be <code>null</code>.
*/
public final void setCurrentPageId(final String preferencePageId) {
final IPreferenceNode node = findNodeMatching(preferencePageId);
@@ -498,11 +477,8 @@ public abstract class FilteredPreferenceDialog extends PreferenceDialog
if (msg == null) {
msg = WorkbenchMessages.FilteredPreferenceDialog_PreferenceSaveFailed;
}
- StatusUtil
- .handleStatus(
- WorkbenchMessages.PreferencesExportDialog_ErrorDialogTitle
- + ": " + msg, e, StatusManager.SHOW, //$NON-NLS-1$
- getShell());
+ StatusUtil.handleStatus(WorkbenchMessages.PreferencesExportDialog_ErrorDialogTitle + ": " + msg, e, //$NON-NLS-1$
+ StatusManager.SHOW, getShell());
}
}
@@ -522,18 +498,15 @@ public abstract class FilteredPreferenceDialog extends PreferenceDialog
*/
Control getContainerToolBar(Composite composite) {
- final ToolBarManager historyManager = new ToolBarManager(SWT.HORIZONTAL
- | SWT.FLAT);
+ final ToolBarManager historyManager = new ToolBarManager(SWT.HORIZONTAL | SWT.FLAT);
historyManager.createControl(composite);
- history.createHistoryControls(historyManager.getControl(),
- historyManager);
+ history.createHistoryControls(historyManager.getControl(), historyManager);
Action popupMenuAction = new Action() {
@Override
public ImageDescriptor getImageDescriptor() {
- return WorkbenchImages
- .getImageDescriptor(IWorkbenchGraphicConstants.IMG_LCL_VIEW_MENU);
+ return WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_LCL_VIEW_MENU);
}
@Override
@@ -546,15 +519,12 @@ public abstract class FilteredPreferenceDialog extends PreferenceDialog
sash.addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
- sash.setBackground(sash.getDisplay()
- .getSystemColor(
- SWT.COLOR_LIST_SELECTION));
+ sash.setBackground(sash.getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION));
}
@Override
public void focusLost(FocusEvent e) {
- sash.setBackground(sash.getDisplay()
- .getSystemColor(SWT.COLOR_LIST_BACKGROUND));
+ sash.setBackground(sash.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
}
});
sash.setFocus();
@@ -586,13 +556,9 @@ public abstract class FilteredPreferenceDialog extends PreferenceDialog
};
popupMenuAction.setToolTipText(WorkbenchMessages.FilteredPreferenceDialog_FilterToolTip);
historyManager.add(popupMenuAction);
- IHandlerService service = PlatformUI.getWorkbench()
- .getService(IHandlerService.class);
- showViewHandler = service
- .activateHandler(
- IWorkbenchCommandConstants.WINDOW_SHOW_VIEW_MENU,
- new ActionHandler(popupMenuAction),
- new ActiveShellExpression(getShell()));
+ IHandlerService service = PlatformUI.getWorkbench().getService(IHandlerService.class);
+ showViewHandler = service.activateHandler(IWorkbenchCommandConstants.WINDOW_SHOW_VIEW_MENU,
+ new ActionHandler(popupMenuAction), new ActiveShellExpression(getShell()));
historyManager.update(false);
@@ -615,28 +581,22 @@ public abstract class FilteredPreferenceDialog extends PreferenceDialog
}
switch (event.keyCode) {
case SWT.ARROW_DOWN:
- sc.setOrigin(sc.getOrigin().x, sc.getOrigin().y
- + INCREMENT);
+ sc.setOrigin(sc.getOrigin().x, sc.getOrigin().y + INCREMENT);
break;
case SWT.ARROW_UP:
- sc.setOrigin(sc.getOrigin().x, sc.getOrigin().y
- - INCREMENT);
+ sc.setOrigin(sc.getOrigin().x, sc.getOrigin().y - INCREMENT);
break;
case SWT.ARROW_LEFT:
- sc.setOrigin(sc.getOrigin().x - INCREMENT, sc
- .getOrigin().y);
+ sc.setOrigin(sc.getOrigin().x - INCREMENT, sc.getOrigin().y);
break;
case SWT.ARROW_RIGHT:
- sc.setOrigin(sc.getOrigin().x + INCREMENT, sc
- .getOrigin().y);
+ sc.setOrigin(sc.getOrigin().x + INCREMENT, sc.getOrigin().y);
break;
case SWT.PAGE_DOWN:
- sc.setOrigin(sc.getOrigin().x, sc.getOrigin().y
- + PAGE_MULTIPLIER * INCREMENT);
+ sc.setOrigin(sc.getOrigin().x, sc.getOrigin().y + PAGE_MULTIPLIER * INCREMENT);
break;
case SWT.PAGE_UP:
- sc.setOrigin(sc.getOrigin().x, sc.getOrigin().y
- - PAGE_MULTIPLIER * INCREMENT);
+ sc.setOrigin(sc.getOrigin().x, sc.getOrigin().y - PAGE_MULTIPLIER * INCREMENT);
break;
case SWT.HOME:
sc.setOrigin(0, 0);
@@ -674,8 +634,7 @@ public abstract class FilteredPreferenceDialog extends PreferenceDialog
protected boolean showPage(IPreferenceNode node) {
final boolean success = super.showPage(node);
if (success) {
- history.addHistoryEntry(new PreferenceHistoryEntry(node.getId(),
- node.getLabelText(), null));
+ history.addHistoryEntry(new PreferenceHistoryEntry(node.getId(), node.getLabelText(), null));
}
return success;
}
@@ -683,8 +642,7 @@ public abstract class FilteredPreferenceDialog extends PreferenceDialog
@Override
public boolean close() {
if (showViewHandler != null) {
- IHandlerService service = PlatformUI
- .getWorkbench().getService(IHandlerService.class);
+ IHandlerService service = PlatformUI.getWorkbench().getService(IHandlerService.class);
service.deactivateHandler(showViewHandler);
showViewHandler.getHandler().dispose();
showViewHandler = null;
@@ -738,7 +696,7 @@ public abstract class FilteredPreferenceDialog extends PreferenceDialog
@Override
protected void updateTreeFont(Font dialogFont) {
if (hasAtMostOnePage()) {
- Composite composite= getTreeViewer().getTree();
+ Composite composite = getTreeViewer().getTree();
applyDialogFont(composite, dialogFont);
composite.layout(true);
} else {
@@ -750,7 +708,7 @@ public abstract class FilteredPreferenceDialog extends PreferenceDialog
/**
* Apply the dialog font to the given control and it's children.
*
- * @param control the control
+ * @param control the control
* @param dialogFont the dialog font
*/
private void applyDialogFont(Control control, Font dialogFont) {
@@ -770,8 +728,8 @@ public abstract class FilteredPreferenceDialog extends PreferenceDialog
}
/**
- * <code>true</code> if upon clearing the filter field, the list of pages
- * should not be reset to all property or preference pages.
+ * <code>true</code> if upon clearing the filter field, the list of pages should
+ * not be reset to all property or preference pages.
*
* @param b
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/GlobalizationPreferencePage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/GlobalizationPreferencePage.java
index 0453311dd68..bd782796bb0 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/GlobalizationPreferencePage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/GlobalizationPreferencePage.java
@@ -63,8 +63,8 @@ public class GlobalizationPreferencePage extends PreferencePage implements IWork
@Override
protected Control createContents(Composite parent) {
- PlatformUI.getWorkbench().getHelpSystem()
- .setHelp(parent, IWorkbenchHelpContextIds.GLOBALIZATION_PREFERENCE_PAGE);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
+ IWorkbenchHelpContextIds.GLOBALIZATION_PREFERENCE_PAGE);
Composite composite = createComposite(parent);
createNlsExtensionsGroup(composite);
@@ -77,11 +77,10 @@ public class GlobalizationPreferencePage extends PreferencePage implements IWork
}
/**
- * Creates the composite which will contain all the preference controls for
- * this page.
+ * Creates the composite which will contain all the preference controls for this
+ * page.
*
- * @param parent
- * the parent composite
+ * @param parent the parent composite
* @return the composite for this page
*/
private static Composite createComposite(Composite parent) {
@@ -90,8 +89,7 @@ public class GlobalizationPreferencePage extends PreferencePage implements IWork
layout.marginWidth = 0;
layout.marginHeight = 0;
composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL
- | GridData.HORIZONTAL_ALIGN_FILL));
+ composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
return composite;
}
@@ -106,8 +104,7 @@ public class GlobalizationPreferencePage extends PreferencePage implements IWork
private void createBidiPreferencesGroup(Composite composite) {
- layoutDirectionCombo = addComboBox(composite,
- WorkbenchMessages.GlobalizationPreference_layoutDirection, 0);
+ layoutDirectionCombo = addComboBox(composite, WorkbenchMessages.GlobalizationPreference_layoutDirection, 0);
layoutDirectionCombo.setItems(new String[] { DEFAULT_DIR, LTR_DIR, RTL_DIR });
layoutDirectionCombo.select(getLayoutDirectionIndex(layoutDirection));
layoutDirectionCombo.addSelectionListener(widgetSelectedAdapter(
@@ -119,15 +116,16 @@ public class GlobalizationPreferencePage extends PreferencePage implements IWork
bidiSupportClickButton.setLayoutData(GridDataFactory.swtDefaults().span(2, 1).create());
bidiSupportClickButton.setText(WorkbenchMessages.GlobalizationPreference_bidiSupport);
bidiSupportClickButton.setSelection(bidiSupport);
- bidiSupportClickButton.addSelectionListener(widgetSelectedAdapter(e -> selectClickMode(bidiSupportClickButton.getSelection())));
+ bidiSupportClickButton.addSelectionListener(
+ widgetSelectedAdapter(e -> selectClickMode(bidiSupportClickButton.getSelection())));
- textDirectionCombo = addComboBox(composite,
- WorkbenchMessages.GlobalizationPreference_textDirection,
+ textDirectionCombo = addComboBox(composite, WorkbenchMessages.GlobalizationPreference_textDirection,
LayoutConstants.getIndent());
textDirectionCombo.setItems(new String[] { DEFAULT_DIR, LTR_DIR, AUTO_DIR, RTL_DIR });
textDirectionCombo.setEnabled(bidiSupport);
textDirectionCombo.select(getTextDirectionIndex(textDirection));
- textDirectionCombo.addSelectionListener(widgetSelectedAdapter(e -> textDirection = getTextDirectionString(textDirectionCombo.getSelectionIndex())));
+ textDirectionCombo.addSelectionListener(widgetSelectedAdapter(
+ e -> textDirection = getTextDirectionString(textDirectionCombo.getSelectionIndex())));
createSpace(composite);
@@ -208,7 +206,7 @@ public class GlobalizationPreferencePage extends PreferencePage implements IWork
private static void createSpace(Composite parent) {
Label vfiller = new Label(parent, SWT.LEFT);
GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gridData.horizontalSpan= 2;
+ gridData.horizontalSpan = 2;
GC gc = new GC(parent);
gridData.heightHint = Dialog.convertHeightInCharsToPixels(gc.getFontMetrics(), 1) / 2;
@@ -239,8 +237,7 @@ public class GlobalizationPreferencePage extends PreferencePage implements IWork
@Override
protected void performDefaults() {
IPreferenceStore store = getPreferenceStore();
- nlExtensionsField
- .setStringValue(store.getDefaultString(IPreferenceConstants.NL_EXTENSIONS));
+ nlExtensionsField.setStringValue(store.getDefaultString(IPreferenceConstants.NL_EXTENSIONS));
layoutDirection = store.getDefaultInt(IPreferenceConstants.LAYOUT_DIRECTION);
bidiSupport = store.getDefaultBoolean(IPreferenceConstants.BIDI_SUPPORT);
textDirection = store.getDefaultString(IPreferenceConstants.TEXT_DIRECTION);
@@ -272,4 +269,3 @@ public class GlobalizationPreferencePage extends PreferencePage implements IWork
return true;
}
}
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/IPropertyPageContributor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/IPropertyPageContributor.java
index 8eb36a9f844..0e297ffce6c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/IPropertyPageContributor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/IPropertyPageContributor.java
@@ -18,20 +18,19 @@ import org.eclipse.jface.preference.PreferenceNode;
import org.eclipse.ui.internal.IObjectContributor;
/**
- * Implement this interface in order to register property
- * pages for a given object. During property dialog building
- * sequence, all property page contributors for a given object
- * are given a chance to add their pages.
+ * Implement this interface in order to register property pages for a given
+ * object. During property dialog building sequence, all property page
+ * contributors for a given object are given a chance to add their pages.
*/
public interface IPropertyPageContributor extends IObjectContributor {
- /**
- * Implement this method to add an instance of PropertyPage class to the
- * property page manager.
- * @param manager the contributor manager onto which to contribute the
- * property page.
- * @param object the type for which page should be contributed.
- * @return true the page that was added, <code>null</code> if no page was added.
- */
- PreferenceNode contributePropertyPage(PropertyPageManager manager,
- Object object);
+ /**
+ * Implement this method to add an instance of PropertyPage class to the
+ * property page manager.
+ *
+ * @param manager the contributor manager onto which to contribute the property
+ * page.
+ * @param object the type for which page should be contributed.
+ * @return true the page that was added, <code>null</code> if no page was added.
+ */
+ PreferenceNode contributePropertyPage(PropertyPageManager manager, Object object);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ImportExportPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ImportExportPage.java
index 201162d9d6b..587f7ca0d8d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ImportExportPage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ImportExportPage.java
@@ -44,16 +44,17 @@ import org.eclipse.ui.wizards.IWizardCategory;
import org.eclipse.ui.wizards.IWizardDescriptor;
/**
- * Abstract wizard page class from which an import or export wizard can be chosen.
+ * Abstract wizard page class from which an import or export wizard can be
+ * chosen.
*
* @since 3.2
*
*/
-public abstract class ImportExportPage extends WorkbenchWizardSelectionPage{
- protected static final String DIALOG_SETTING_SECTION_NAME = "ImportExportPage."; //$NON-NLS-1$
+public abstract class ImportExportPage extends WorkbenchWizardSelectionPage {
+ protected static final String DIALOG_SETTING_SECTION_NAME = "ImportExportPage."; //$NON-NLS-1$
- // tree viewer of wizard selections
- private TreeViewer treeViewer;
+ // tree viewer of wizard selections
+ private TreeViewer treeViewer;
/*
* Class to create a control that shows a categorized tree of wizard types.
@@ -69,9 +70,10 @@ public abstract class ImportExportPage extends WorkbenchWizardSelectionPage{
* Constructor for CategorizedWizardSelectionTree
*
* @param categories root wizard category for the wizard type
- * @param msg message describing what the user should choose from the tree.
+ * @param msg message describing what the user should choose from the
+ * tree.
*/
- protected CategorizedWizardSelectionTree(IWizardCategory categories, String msg){
+ protected CategorizedWizardSelectionTree(IWizardCategory categories, String msg) {
this.wizardCategories = categories;
this.message = msg;
}
@@ -83,25 +85,25 @@ public abstract class ImportExportPage extends WorkbenchWizardSelectionPage{
* @param parent Composite on which the tree viewer is to be created
* @return Comoposite with all widgets
*/
- protected Composite createControl(Composite parent){
- Font font = parent.getFont();
+ protected Composite createControl(Composite parent) {
+ Font font = parent.getFont();
- // create composite for page.
- Composite outerContainer = new Composite(parent, SWT.NONE);
- outerContainer.setLayout(new GridLayout());
- outerContainer.setLayoutData(new GridData(GridData.FILL_BOTH));
- outerContainer.setFont(font);
+ // create composite for page.
+ Composite outerContainer = new Composite(parent, SWT.NONE);
+ outerContainer.setLayout(new GridLayout());
+ outerContainer.setLayoutData(new GridData(GridData.FILL_BOTH));
+ outerContainer.setFont(font);
- Label messageLabel = new Label(outerContainer, SWT.NONE);
- if (message != null) {
+ Label messageLabel = new Label(outerContainer, SWT.NONE);
+ if (message != null) {
messageLabel.setText(message);
}
- messageLabel.setFont(font);
+ messageLabel.setFont(font);
- createFilteredTree(outerContainer);
- layoutTopControl(viewer.getControl());
+ createFilteredTree(outerContainer);
+ layoutTopControl(viewer.getControl());
- return outerContainer;
+ return outerContainer;
}
/**
@@ -109,50 +111,51 @@ public abstract class ImportExportPage extends WorkbenchWizardSelectionPage{
*
* @param parent
*/
- private void createFilteredTree(Composite parent){
+ private void createFilteredTree(Composite parent) {
// Create a FilteredTree for the categories and wizards
- FilteredTree filteredTree = new FilteredTree(parent, SWT.SINGLE | SWT.H_SCROLL
- | SWT.V_SCROLL | SWT.BORDER, new WizardPatternFilter(), true);
- viewer = filteredTree.getViewer();
- filteredTree.setFont(parent.getFont());
+ FilteredTree filteredTree = new FilteredTree(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER,
+ new WizardPatternFilter(), true);
+ viewer = filteredTree.getViewer();
+ filteredTree.setFont(parent.getFont());
filteredTree.setQuickSelectionMode(true);
- viewer.setContentProvider(new WizardContentProvider());
+ viewer.setContentProvider(new WizardContentProvider());
viewer.setLabelProvider(new WorkbenchLabelProvider());
- viewer.setComparator(DataTransferWizardCollectionComparator.INSTANCE);
+ viewer.setComparator(DataTransferWizardCollectionComparator.INSTANCE);
- ArrayList inputArray = new ArrayList();
- boolean expandTop = false;
+ ArrayList inputArray = new ArrayList();
+ boolean expandTop = false;
- if (wizardCategories != null) {
- if (wizardCategories.getParent() == null) {
+ if (wizardCategories != null) {
+ if (wizardCategories.getParent() == null) {
for (IWizardCategory wizardCategory : wizardCategories.getCategories()) {
inputArray.add(wizardCategory);
- }
- } else {
- expandTop = true;
- inputArray.add(wizardCategories);
- }
- }
-
- // ensure the category is expanded. If there is a remembered expansion it will be set later.
- if (expandTop) {
+ }
+ } else {
+ expandTop = true;
+ inputArray.add(wizardCategories);
+ }
+ }
+
+ // ensure the category is expanded. If there is a remembered expansion it will
+ // be set later.
+ if (expandTop) {
viewer.setAutoExpandLevel(2);
}
- AdaptableList input = new AdaptableList(inputArray);
+ AdaptableList input = new AdaptableList(inputArray);
- // filter wizard list according to capabilities that are enabled
- viewer.addFilter(new WizardActivityFilter());
+ // filter wizard list according to capabilities that are enabled
+ viewer.addFilter(new WizardActivityFilter());
- viewer.setInput(input);
+ viewer.setInput(input);
}
/**
*
* @return the categorized tree viewer
*/
- protected TreeViewer getViewer(){
+ protected TreeViewer getViewer() {
return viewer;
}
@@ -161,307 +164,298 @@ public abstract class ImportExportPage extends WorkbenchWizardSelectionPage{
*
* @param control
*/
- private void layoutTopControl(Control control) {
- GridData data = new GridData(GridData.FILL_BOTH);
+ private void layoutTopControl(Control control) {
+ GridData data = new GridData(GridData.FILL_BOTH);
- int availableRows = DialogUtil.availableRows(control.getParent());
+ int availableRows = DialogUtil.availableRows(control.getParent());
- //Only give a height hint if the dialog is going to be too small
- if (availableRows > 50) {
- data.heightHint = SIZING_LISTS_HEIGHT;
- } else {
- data.heightHint = availableRows * 3;
- }
+ // Only give a height hint if the dialog is going to be too small
+ if (availableRows > 50) {
+ data.heightHint = SIZING_LISTS_HEIGHT;
+ } else {
+ data.heightHint = availableRows * 3;
+ }
- control.setLayoutData(data);
- }
+ control.setLayoutData(data);
+ }
}
/**
* Constructor for import/export wizard page.
*
- * @param aWorkbench current workbench
+ * @param aWorkbench current workbench
* @param currentSelection current selection
*/
- protected ImportExportPage(IWorkbench aWorkbench, IStructuredSelection currentSelection){
- super("importExportPage", aWorkbench, currentSelection, null, null); //$NON-NLS-1$
+ protected ImportExportPage(IWorkbench aWorkbench, IStructuredSelection currentSelection) {
+ super("importExportPage", aWorkbench, currentSelection, null, null); //$NON-NLS-1$
setTitle(WorkbenchMessages.Select);
}
@Override
public void createControl(Composite parent) {
- Font font = parent.getFont();
+ Font font = parent.getFont();
- // create composite for page.
- Composite outerContainer = new Composite(parent, SWT.NONE);
- outerContainer.setLayout(new GridLayout());
- outerContainer.setLayoutData(new GridData(GridData.FILL_BOTH));
- outerContainer.setFont(font);
+ // create composite for page.
+ Composite outerContainer = new Composite(parent, SWT.NONE);
+ outerContainer.setLayout(new GridLayout());
+ outerContainer.setLayoutData(new GridData(GridData.FILL_BOTH));
+ outerContainer.setFont(font);
- Composite comp = createTreeViewer(outerContainer);
+ Composite comp = createTreeViewer(outerContainer);
Dialog.applyDialogFont(comp);
- restoreWidgetValues();
+ restoreWidgetValues();
- setControl(outerContainer);
+ setControl(outerContainer);
- initialize();
+ initialize();
}
/**
* Create the tree viewer from which a wizard is selected.
*/
- protected abstract Composite createTreeViewer(Composite parent);
-
- /**
- * Method to call when an item in one of the lists is double-clicked.
- * Shows the first page of the selected wizard or expands a collapsed
- * tree.
- * @param event
- */
- protected void treeDoubleClicked(DoubleClickEvent event){
- ISelection selection = event.getViewer().getSelection();
- IStructuredSelection ss = (IStructuredSelection) selection;
- listSelectionChanged(ss);
+ protected abstract Composite createTreeViewer(Composite parent);
+
+ /**
+ * Method to call when an item in one of the lists is double-clicked. Shows the
+ * first page of the selected wizard or expands a collapsed tree.
+ *
+ * @param event
+ */
+ protected void treeDoubleClicked(DoubleClickEvent event) {
+ ISelection selection = event.getViewer().getSelection();
+ IStructuredSelection ss = (IStructuredSelection) selection;
+ listSelectionChanged(ss);
Object element = ss.getFirstElement();
- TreeViewer v = (TreeViewer)event.getViewer();
+ TreeViewer v = (TreeViewer) event.getViewer();
if (v.isExpandable(element)) {
- v.setExpandedState(element, !v.getExpandedState(element));
+ v.setExpandedState(element, !v.getExpandedState(element));
} else if (element instanceof WorkbenchWizardElement) {
if (canFlipToNextPage()) {
getContainer().showPage(getNextPage());
return;
}
}
- getContainer().showPage(getNextPage());
- }
-
- /*
- * Update the wizard's message based on the given (selected) wizard element.
- */
- private void updateSelectedNode(WorkbenchWizardElement wizardElement){
- setErrorMessage(null);
- if (wizardElement == null) {
- updateMessage();
- setSelectedNode(null);
- return;
- }
-
- setSelectedNode(createWizardNode(wizardElement));
- setMessage(wizardElement.getDescription());
- }
-
- /*
- * Update the wizard's message based on the currently selected tab
- * and the selected wizard on that tab.
- */
- protected void updateMessage(){
- TreeViewer viewer = getTreeViewer();
- if (viewer != null){
- ISelection selection = viewer.getSelection();
- IStructuredSelection ss = (IStructuredSelection) selection;
- Object sel = ss.getFirstElement();
- if (sel instanceof WorkbenchWizardElement){
- updateSelectedNode((WorkbenchWizardElement)sel);
- }
- else{
- setSelectedNode(null);
- }
- } else {
+ getContainer().showPage(getNextPage());
+ }
+
+ /*
+ * Update the wizard's message based on the given (selected) wizard element.
+ */
+ private void updateSelectedNode(WorkbenchWizardElement wizardElement) {
+ setErrorMessage(null);
+ if (wizardElement == null) {
+ updateMessage();
+ setSelectedNode(null);
+ return;
+ }
+
+ setSelectedNode(createWizardNode(wizardElement));
+ setMessage(wizardElement.getDescription());
+ }
+
+ /*
+ * Update the wizard's message based on the currently selected tab and the
+ * selected wizard on that tab.
+ */
+ protected void updateMessage() {
+ TreeViewer viewer = getTreeViewer();
+ if (viewer != null) {
+ ISelection selection = viewer.getSelection();
+ IStructuredSelection ss = (IStructuredSelection) selection;
+ Object sel = ss.getFirstElement();
+ if (sel instanceof WorkbenchWizardElement) {
+ updateSelectedNode((WorkbenchWizardElement) sel);
+ } else {
+ setSelectedNode(null);
+ }
+ } else {
setMessage(null);
}
- }
-
- /*
- * Method to call whenever the selection in one of the lists has changed.
- * Updates the wizard's message to relect the description of the currently
- * selected wizard.
- */
- protected void listSelectionChanged(ISelection selection){
- setErrorMessage(null);
- IStructuredSelection ss = (IStructuredSelection) selection;
- Object sel = ss.getFirstElement();
- if (sel instanceof WorkbenchWizardElement){
- WorkbenchWizardElement currentWizardSelection = (WorkbenchWizardElement) sel;
- updateSelectedNode(currentWizardSelection);
- } else {
+ }
+
+ /*
+ * Method to call whenever the selection in one of the lists has changed.
+ * Updates the wizard's message to relect the description of the currently
+ * selected wizard.
+ */
+ protected void listSelectionChanged(ISelection selection) {
+ setErrorMessage(null);
+ IStructuredSelection ss = (IStructuredSelection) selection;
+ Object sel = ss.getFirstElement();
+ if (sel instanceof WorkbenchWizardElement) {
+ WorkbenchWizardElement currentWizardSelection = (WorkbenchWizardElement) sel;
+ updateSelectedNode(currentWizardSelection);
+ } else {
updateSelectedNode(null);
}
- }
+ }
- /*
- * Create a wizard node given a wizard's descriptor.
- */
+ /*
+ * Create a wizard node given a wizard's descriptor.
+ */
private IWizardNode createWizardNode(IWizardDescriptor element) {
- return new WorkbenchWizardNode(this, element) {
- @Override
+ return new WorkbenchWizardNode(this, element) {
+ @Override
public IWorkbenchWizard createWizard() throws CoreException {
- return wizardElement.createWizard();
- }
- };
- }
-
- /**
- * Uses the dialog store to restore widget values to the values that they
- * held last time this wizard was used to completion.
- */
- protected void restoreWidgetValues() {
- updateMessage();
- }
-
- /**
- * Expands the wizard categories in this page's category viewer that were
- * expanded last time this page was used. If a category that was previously
- * expanded no longer exists then it is ignored.
- */
- protected void expandPreviouslyExpandedCategories(String setting, IWizardCategory wizardCategories, TreeViewer viewer) {
- String[] expandedCategoryPaths = getDialogSettings()
- .getArray(setting);
- if (expandedCategoryPaths == null || expandedCategoryPaths.length == 0) {
+ return wizardElement.createWizard();
+ }
+ };
+ }
+
+ /**
+ * Uses the dialog store to restore widget values to the values that they held
+ * last time this wizard was used to completion.
+ */
+ protected void restoreWidgetValues() {
+ updateMessage();
+ }
+
+ /**
+ * Expands the wizard categories in this page's category viewer that were
+ * expanded last time this page was used. If a category that was previously
+ * expanded no longer exists then it is ignored.
+ */
+ protected void expandPreviouslyExpandedCategories(String setting, IWizardCategory wizardCategories,
+ TreeViewer viewer) {
+ String[] expandedCategoryPaths = getDialogSettings().getArray(setting);
+ if (expandedCategoryPaths == null || expandedCategoryPaths.length == 0) {
return;
}
- List categoriesToExpand = new ArrayList(expandedCategoryPaths.length);
+ List categoriesToExpand = new ArrayList(expandedCategoryPaths.length);
- if (wizardCategories != null) {
- for (String expandedCategoryPath : expandedCategoryPaths) {
- IWizardCategory category = wizardCategories
- .findCategory(new Path(expandedCategoryPath));
- if (category != null) {
+ if (wizardCategories != null) {
+ for (String expandedCategoryPath : expandedCategoryPaths) {
+ IWizardCategory category = wizardCategories.findCategory(new Path(expandedCategoryPath));
+ if (category != null) {
categoriesToExpand.add(category);
}
- }
- }
+ }
+ }
- if (!categoriesToExpand.isEmpty()) {
+ if (!categoriesToExpand.isEmpty()) {
viewer.setExpandedElements(categoriesToExpand.toArray());
}
- }
+ }
- /**
- * Selects the wizard category and wizard in this page that were selected
- * last time this page was used. If a category or wizard that was
- * previously selected no longer exists then it is ignored.
- */
- protected void selectPreviouslySelected(String setting, IWizardCategory wizardCategories, final TreeViewer viewer) {
- String selectedId = getDialogSettings().get(setting);
- if (selectedId == null) {
+ /**
+ * Selects the wizard category and wizard in this page that were selected last
+ * time this page was used. If a category or wizard that was previously selected
+ * no longer exists then it is ignored.
+ */
+ protected void selectPreviouslySelected(String setting, IWizardCategory wizardCategories, final TreeViewer viewer) {
+ String selectedId = getDialogSettings().get(setting);
+ if (selectedId == null) {
return;
}
- if (wizardCategories == null) {
+ if (wizardCategories == null) {
return;
}
- Object selected = wizardCategories.findCategory(new Path(
- selectedId));
+ Object selected = wizardCategories.findCategory(new Path(selectedId));
- if (selected == null) {
- selected = wizardCategories.findWizard(selectedId);
+ if (selected == null) {
+ selected = wizardCategories.findWizard(selectedId);
- if (selected == null) {
+ if (selected == null) {
// if we cant find either a category or a wizard, abort.
- return;
+ return;
}
- }
-
- viewer.setSelection(new StructuredSelection(selected), true);
- }
-
- /**
- * Stores the collection of currently-expanded categories in this page's
- * dialog store, in order to recreate this page's state in the next
- * instance of this page.
- */
- protected void storeExpandedCategories(String setting, TreeViewer viewer) {
- Object[] expandedElements = viewer.getExpandedElements();
- List expandedElementPaths = new ArrayList(expandedElements.length);
- for (Object expandedElement : expandedElements) {
- if (expandedElement instanceof IWizardCategory) {
- expandedElementPaths
- .add(((IWizardCategory) expandedElement)
- .getPath().toString());
+ }
+
+ viewer.setSelection(new StructuredSelection(selected), true);
+ }
+
+ /**
+ * Stores the collection of currently-expanded categories in this page's dialog
+ * store, in order to recreate this page's state in the next instance of this
+ * page.
+ */
+ protected void storeExpandedCategories(String setting, TreeViewer viewer) {
+ Object[] expandedElements = viewer.getExpandedElements();
+ List expandedElementPaths = new ArrayList(expandedElements.length);
+ for (Object expandedElement : expandedElements) {
+ if (expandedElement instanceof IWizardCategory) {
+ expandedElementPaths.add(((IWizardCategory) expandedElement).getPath().toString());
}
- }
- getDialogSettings().put(setting,
- (String[]) expandedElementPaths
- .toArray(new String[expandedElementPaths.size()]));
- }
-
- /**
- * Stores the currently-selected element in this page's dialog store, in
- * order to recreate this page's state in the next instance of this page.
- */
- protected void storeSelectedCategoryAndWizard(String setting, TreeViewer viewer) {
+ }
+ getDialogSettings().put(setting,
+ (String[]) expandedElementPaths.toArray(new String[expandedElementPaths.size()]));
+ }
+
+ /**
+ * Stores the currently-selected element in this page's dialog store, in order
+ * to recreate this page's state in the next instance of this page.
+ */
+ protected void storeSelectedCategoryAndWizard(String setting, TreeViewer viewer) {
Object selected = viewer.getStructuredSelection().getFirstElement();
- if (selected != null) {
- if (selected instanceof IWizardCategory) {
- getDialogSettings().put(setting,
- ((IWizardCategory) selected).getPath()
- .toString());
+ if (selected != null) {
+ if (selected instanceof IWizardCategory) {
+ getDialogSettings().put(setting, ((IWizardCategory) selected).getPath().toString());
} else {
// else its a wizard
- getDialogSettings().put(setting,
- ((IWizardDescriptor) selected).getId());
+ getDialogSettings().put(setting, ((IWizardDescriptor) selected).getId());
}
- }
- }
-
- /**
- * When Finish is pressed, write widget values to the dialog store so
- * that they will persist into the next invocation of the wizard page.
- *
- */
- public void saveWidgetValues(){
- // do nothing by default - subclasses should override
- }
-
- @Override
+ }
+ }
+
+ /**
+ * When Finish is pressed, write widget values to the dialog store so that they
+ * will persist into the next invocation of the wizard page.
+ *
+ */
+ public void saveWidgetValues() {
+ // do nothing by default - subclasses should override
+ }
+
+ @Override
public IWizardPage getNextPage() {
- ITriggerPoint triggerPoint = getTriggerPoint();
+ ITriggerPoint triggerPoint = getTriggerPoint();
- if (triggerPoint == null || WorkbenchActivityHelper.allowUseOf(triggerPoint, getSelectedNode())) {
+ if (triggerPoint == null || WorkbenchActivityHelper.allowUseOf(triggerPoint, getSelectedNode())) {
return super.getNextPage();
}
- return null;
- }
-
- /**
- * Get the trigger point for the wizard type, if one exists.
- *
- * @return the wizard's trigger point
- */
- protected ITriggerPoint getTriggerPoint(){
- return null; // default implementation
- }
-
- /**
- * Set the tree viewer that is used for this wizard selection page.
- *
- * @param viewer
- */
- protected void setTreeViewer(TreeViewer viewer){
- treeViewer = viewer;
- }
-
- /**
- * Get the tree viewer that is used for this wizard selection page.
- *
- * @return tree viewer used for this wizard's selection page
- */
- protected TreeViewer getTreeViewer(){
- return treeViewer;
- }
-
- /**
- * Perform any initialization of the wizard page that needs to be done
- * after widgets are created and main control is set.
- */
- protected void initialize(){
- // do nothing by default
- }
+ return null;
+ }
+
+ /**
+ * Get the trigger point for the wizard type, if one exists.
+ *
+ * @return the wizard's trigger point
+ */
+ protected ITriggerPoint getTriggerPoint() {
+ return null; // default implementation
+ }
+
+ /**
+ * Set the tree viewer that is used for this wizard selection page.
+ *
+ * @param viewer
+ */
+ protected void setTreeViewer(TreeViewer viewer) {
+ treeViewer = viewer;
+ }
+
+ /**
+ * Get the tree viewer that is used for this wizard selection page.
+ *
+ * @return tree viewer used for this wizard's selection page
+ */
+ protected TreeViewer getTreeViewer() {
+ return treeViewer;
+ }
+
+ /**
+ * Perform any initialization of the wizard page that needs to be done after
+ * widgets are created and main control is set.
+ */
+ protected void initialize() {
+ // do nothing by default
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ImportExportWizard.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ImportExportWizard.java
index d13dd42304f..011e928512c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ImportExportWizard.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ImportExportWizard.java
@@ -22,89 +22,84 @@ import org.eclipse.ui.internal.WorkbenchImages;
import org.eclipse.ui.internal.WorkbenchMessages;
/**
- * The import/export wizard allows users to choose whether to
- * show the import wizard or the export wizard.
+ * The import/export wizard allows users to choose whether to show the import
+ * wizard or the export wizard.
*
* @since 3.2
*
*/
public class ImportExportWizard extends Wizard {
/**
- * Constant used to to specify to the import/export wizard
- * which page should initially be shown.
+ * Constant used to to specify to the import/export wizard which page should
+ * initially be shown.
*/
- public static final String IMPORT = "import"; //$NON-NLS-1$
+ public static final String IMPORT = "import"; //$NON-NLS-1$
/**
- * Constant used to to specify to the import/export wizard
- * which page should initially be shown.
+ * Constant used to to specify to the import/export wizard which page should
+ * initially be shown.
*/
- public static final String EXPORT = "export"; //$NON-NLS-1$
+ public static final String EXPORT = "export"; //$NON-NLS-1$
- private IWorkbench workbench;
- private IStructuredSelection selection;
- private ImportExportPage importExportPage;
- private String page = null;
+ private IWorkbench workbench;
+ private IStructuredSelection selection;
+ private ImportExportPage importExportPage;
+ private String page = null;
- /**
- * Create an import/export wizard and show the page
- * with the given id.
- *
- * @param pageId
- */
- public ImportExportWizard(String pageId){
- page = pageId;
- }
+ /**
+ * Create an import/export wizard and show the page with the given id.
+ *
+ * @param pageId
+ */
+ public ImportExportWizard(String pageId) {
+ page = pageId;
+ }
- /**
- * Subclasses must implement this <code>IWizard</code> method
- * to perform any special finish processing for their wizard.
- */
- @Override
+ /**
+ * Subclasses must implement this <code>IWizard</code> method to perform any
+ * special finish processing for their wizard.
+ */
+ @Override
public boolean performFinish() {
- importExportPage.saveWidgetValues();
- return true;
- }
+ importExportPage.saveWidgetValues();
+ return true;
+ }
- /**
- * Creates the wizard's pages lazily.
- */
- @Override
+ /**
+ * Creates the wizard's pages lazily.
+ */
+ @Override
public void addPages() {
- if (page.equals(IMPORT)) {
+ if (page.equals(IMPORT)) {
importExportPage = new ImportPage(this.workbench, this.selection);
} else if (page.equals(EXPORT)) {
importExportPage = new ExportPage(this.workbench, this.selection);
}
- if (importExportPage != null) {
+ if (importExportPage != null) {
addPage(importExportPage);
}
- }
+ }
- /**
- * Initializes the wizard.
- *
- * @param aWorkbench the workbench
- * @param currentSelection the current selectio
- */
- public void init(IWorkbench aWorkbench,
- IStructuredSelection currentSelection) {
- this.workbench = aWorkbench;
- this.selection = currentSelection;
+ /**
+ * Initializes the wizard.
+ *
+ * @param aWorkbench the workbench
+ * @param currentSelection the current selectio
+ */
+ public void init(IWorkbench aWorkbench, IStructuredSelection currentSelection) {
+ this.workbench = aWorkbench;
+ this.selection = currentSelection;
- ImageDescriptor wizardBannerImage = null;
- if (IMPORT.equals(page)){
- wizardBannerImage = WorkbenchImages
- .getImageDescriptor(IWorkbenchGraphicConstants.IMG_WIZBAN_IMPORT_WIZ);
- setWindowTitle(WorkbenchMessages.ImportWizard_title);
- }
- else if (EXPORT.equals(page)){
- wizardBannerImage = WorkbenchImages
- .getImageDescriptor(IWorkbenchGraphicConstants.IMG_WIZBAN_EXPORT_WIZ);
- setWindowTitle(WorkbenchMessages.ExportWizard_title);
- }
- if (wizardBannerImage != null) {
+ ImageDescriptor wizardBannerImage = null;
+ if (IMPORT.equals(page)) {
+ wizardBannerImage = WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_WIZBAN_IMPORT_WIZ);
+ setWindowTitle(WorkbenchMessages.ImportWizard_title);
+ } else if (EXPORT.equals(page)) {
+ wizardBannerImage = WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_WIZBAN_EXPORT_WIZ);
+ setWindowTitle(WorkbenchMessages.ExportWizard_title);
+ }
+ if (wizardBannerImage != null) {
setDefaultPageImageDescriptor(wizardBannerImage);
}
- setNeedsProgressMonitor(true);
- }
+ setNeedsProgressMonitor(true);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ImportPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ImportPage.java
index a72fbc471e7..d76914d99a5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ImportPage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ImportPage.java
@@ -31,38 +31,33 @@ import org.eclipse.ui.wizards.IWizardCategory;
*
*/
public class ImportPage extends ImportExportPage {
- private static final String STORE_SELECTED_IMPORT_WIZARD_ID = DIALOG_SETTING_SECTION_NAME
- + "STORE_SELECTED_IMPORT_WIZARD_ID"; //$NON-NLS-1$
+ private static final String STORE_SELECTED_IMPORT_WIZARD_ID = DIALOG_SETTING_SECTION_NAME
+ + "STORE_SELECTED_IMPORT_WIZARD_ID"; //$NON-NLS-1$
- private static final String STORE_EXPANDED_IMPORT_CATEGORIES = DIALOG_SETTING_SECTION_NAME
- + "STORE_EXPANDED_IMPORT_CATEGORIES"; //$NON-NLS-1$
+ private static final String STORE_EXPANDED_IMPORT_CATEGORIES = DIALOG_SETTING_SECTION_NAME
+ + "STORE_EXPANDED_IMPORT_CATEGORIES"; //$NON-NLS-1$
- protected CategorizedWizardSelectionTree importTree;
+ protected CategorizedWizardSelectionTree importTree;
- /**
- * Constructor for import wizard selection page.
- *
- * @param aWorkbench
- * @param currentSelection
- */
- public ImportPage(IWorkbench aWorkbench,
- IStructuredSelection currentSelection) {
+ /**
+ * Constructor for import wizard selection page.
+ *
+ * @param aWorkbench
+ * @param currentSelection
+ */
+ public ImportPage(IWorkbench aWorkbench, IStructuredSelection currentSelection) {
super(aWorkbench, currentSelection);
}
@Override
protected void initialize() {
- workbench.getHelpSystem().setHelp(
- getControl(),
- IWorkbenchHelpContextIds.IMPORT_WIZARD_SELECTION_WIZARD_PAGE);
+ workbench.getHelpSystem().setHelp(getControl(), IWorkbenchHelpContextIds.IMPORT_WIZARD_SELECTION_WIZARD_PAGE);
}
@Override
protected Composite createTreeViewer(Composite parent) {
- IWizardCategory root = WorkbenchPlugin.getDefault()
- .getImportWizardRegistry().getRootCategory();
- importTree = new CategorizedWizardSelectionTree(
- root, WorkbenchMessages.ImportWizard_selectWizard);
+ IWizardCategory root = WorkbenchPlugin.getDefault().getImportWizardRegistry().getRootCategory();
+ importTree = new CategorizedWizardSelectionTree(root, WorkbenchMessages.ImportWizard_selectWizard);
Composite importComp = importTree.createControl(parent);
importTree.getViewer().addSelectionChangedListener(event -> listSelectionChanged(event.getSelection()));
importTree.getViewer().addDoubleClickListener(event -> treeDoubleClicked(event));
@@ -71,28 +66,28 @@ public class ImportPage extends ImportExportPage {
}
@Override
- public void saveWidgetValues(){
- storeExpandedCategories(STORE_EXPANDED_IMPORT_CATEGORIES, importTree.getViewer());
- storeSelectedCategoryAndWizard(STORE_SELECTED_IMPORT_WIZARD_ID, importTree.getViewer());
- super.saveWidgetValues();
+ public void saveWidgetValues() {
+ storeExpandedCategories(STORE_EXPANDED_IMPORT_CATEGORIES, importTree.getViewer());
+ storeSelectedCategoryAndWizard(STORE_SELECTED_IMPORT_WIZARD_ID, importTree.getViewer());
+ super.saveWidgetValues();
}
@Override
- protected void restoreWidgetValues(){
- IWizardCategory importRoot = WorkbenchPlugin.getDefault().getImportWizardRegistry().getRootCategory();
- expandPreviouslyExpandedCategories(STORE_EXPANDED_IMPORT_CATEGORIES, importRoot,importTree.getViewer());
- selectPreviouslySelected(STORE_SELECTED_IMPORT_WIZARD_ID, importRoot, importTree.getViewer());
- super.restoreWidgetValues();
+ protected void restoreWidgetValues() {
+ IWizardCategory importRoot = WorkbenchPlugin.getDefault().getImportWizardRegistry().getRootCategory();
+ expandPreviouslyExpandedCategories(STORE_EXPANDED_IMPORT_CATEGORIES, importRoot, importTree.getViewer());
+ selectPreviouslySelected(STORE_SELECTED_IMPORT_WIZARD_ID, importRoot, importTree.getViewer());
+ super.restoreWidgetValues();
}
@Override
- protected ITriggerPoint getTriggerPoint(){
- return getWorkbench().getActivitySupport()
- .getTriggerPointManager().getTriggerPoint(WorkbenchTriggerPoints.IMPORT_WIZARDS);
+ protected ITriggerPoint getTriggerPoint() {
+ return getWorkbench().getActivitySupport().getTriggerPointManager()
+ .getTriggerPoint(WorkbenchTriggerPoints.IMPORT_WIZARDS);
}
@Override
- protected void updateMessage(){
+ protected void updateMessage() {
setMessage(WorkbenchMessages.ImportExportPage_chooseImportWizard);
super.updateMessage();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ImportWizard.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ImportWizard.java
index 46c4e363ca4..12fe05d9a71 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ImportWizard.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ImportWizard.java
@@ -39,86 +39,78 @@ import org.eclipse.ui.wizards.IWizardCategory;
*/
public class ImportWizard extends Wizard {
- //the list selection page
+ // the list selection page
static class SelectionPage extends WorkbenchWizardListSelectionPage {
- SelectionPage(IWorkbench w, IStructuredSelection ss, AdaptableList e,
- String s) {
- super(w, ss, e, s, WorkbenchTriggerPoints.IMPORT_WIZARDS);
- }
+ SelectionPage(IWorkbench w, IStructuredSelection ss, AdaptableList e, String s) {
+ super(w, ss, e, s, WorkbenchTriggerPoints.IMPORT_WIZARDS);
+ }
- @Override
+ @Override
public void createControl(Composite parent) {
- super.createControl(parent);
- getWorkbench()
- .getHelpSystem()
- .setHelp(
- getControl(),
- IWorkbenchHelpContextIds.IMPORT_WIZARD_SELECTION_WIZARD_PAGE);
- }
+ super.createControl(parent);
+ getWorkbench().getHelpSystem().setHelp(getControl(),
+ IWorkbenchHelpContextIds.IMPORT_WIZARD_SELECTION_WIZARD_PAGE);
+ }
- @Override
+ @Override
public IWizardNode createWizardNode(WorkbenchWizardElement element) {
- return new WorkbenchWizardNode(this, element) {
- @Override
+ return new WorkbenchWizardNode(this, element) {
+ @Override
public IWorkbenchWizard createWizard() throws CoreException {
- return wizardElement.createWizard();
- }
- };
- }
-
+ return wizardElement.createWizard();
+ }
+ };
+ }
- }
+ }
- private IStructuredSelection selection;
+ private IStructuredSelection selection;
- private IWorkbench workbench;
+ private IWorkbench workbench;
- /**
- * Creates the wizard's pages lazily.
- */
- @Override
+ /**
+ * Creates the wizard's pages lazily.
+ */
+ @Override
public void addPages() {
- addPage(new SelectionPage(this.workbench, this.selection,
- getAvailableImportWizards(), WorkbenchMessages.ImportWizard_selectWizard));
- }
+ addPage(new SelectionPage(this.workbench, this.selection, getAvailableImportWizards(),
+ WorkbenchMessages.ImportWizard_selectWizard));
+ }
- /**
- * Returns the import wizards that are available for invocation.
- */
- protected AdaptableList getAvailableImportWizards() {
- // TODO: imports are still flat - we need to get at the flat list. All
+ /**
+ * Returns the import wizards that are available for invocation.
+ */
+ protected AdaptableList getAvailableImportWizards() {
+ // TODO: imports are still flat - we need to get at the flat list. All
// wizards will be in the "other" category.
- IWizardCategory root = WorkbenchPlugin.getDefault()
- .getImportWizardRegistry().getRootCategory();
+ IWizardCategory root = WorkbenchPlugin.getDefault().getImportWizardRegistry().getRootCategory();
WizardCollectionElement otherCategory = (WizardCollectionElement) root
- .findCategory(new Path(
- WizardsRegistryReader.UNCATEGORIZED_WIZARD_CATEGORY));
+ .findCategory(new Path(WizardsRegistryReader.UNCATEGORIZED_WIZARD_CATEGORY));
if (otherCategory == null) {
return new AdaptableList();
}
return otherCategory.getWizardAdaptableList();
- }
+ }
- /**
- * Initializes the wizard.
- *
- * @param aWorkbench the workbench
- * @param currentSelection the current selection
- */
- public void init(IWorkbench aWorkbench,
- IStructuredSelection currentSelection) {
- this.workbench = aWorkbench;
- this.selection = currentSelection;
+ /**
+ * Initializes the wizard.
+ *
+ * @param aWorkbench the workbench
+ * @param currentSelection the current selection
+ */
+ public void init(IWorkbench aWorkbench, IStructuredSelection currentSelection) {
+ this.workbench = aWorkbench;
+ this.selection = currentSelection;
- setWindowTitle(WorkbenchMessages.ImportWizard_title);
- setDefaultPageImageDescriptor(WorkbenchImages
- .getImageDescriptor(IWorkbenchGraphicConstants.IMG_WIZBAN_IMPORT_WIZ));
- setNeedsProgressMonitor(true);
- }
+ setWindowTitle(WorkbenchMessages.ImportWizard_title);
+ setDefaultPageImageDescriptor(
+ WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_WIZBAN_IMPORT_WIZ));
+ setNeedsProgressMonitor(true);
+ }
- @Override
+ @Override
public boolean performFinish() {
- ((SelectionPage) getPages()[0]).saveWidgetValues();
- return true;
- }
+ ((SelectionPage) getPages()[0]).saveWidgetValues();
+ return true;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewContentTypeDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewContentTypeDialog.java
index d5c6af78c82..9407374b96c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewContentTypeDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewContentTypeDialog.java
@@ -65,8 +65,7 @@ public class NewContentTypeDialog extends TitleAreaDialog {
/*
* (non-Javadoc)
*
- * @see
- * org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.
+ * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.
* Shell)
*/
@Override
@@ -95,8 +94,8 @@ public class NewContentTypeDialog extends TitleAreaDialog {
}
});
decorator = new ControlDecoration(nameText, SWT.TOP | SWT.LEFT);
- decorator.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_ERROR)
- .getImage());
+ decorator.setImage(
+ FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_ERROR).getImage());
decorator.setDescriptionText(WorkbenchMessages.ContentTypes_newContentTypeDialog_invalidContentTypeName);
decorator.hide();
setTitle(WorkbenchMessages.ContentTypes_newContentTypeDialog_title);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewWizard.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewWizard.java
index 522d602510d..0c73c88397d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewWizard.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewWizard.java
@@ -31,80 +31,76 @@ import org.eclipse.ui.wizards.IWizardDescriptor;
* extension point.
*/
public class NewWizard extends Wizard {
- private static final String CATEGORY_SEPARATOR = "/"; //$NON-NLS-1$
+ private static final String CATEGORY_SEPARATOR = "/"; //$NON-NLS-1$
- private String categoryId = null;
+ private String categoryId = null;
- private NewWizardSelectionPage mainPage;
+ private NewWizardSelectionPage mainPage;
- private boolean projectsOnly = false;
+ private boolean projectsOnly = false;
- private IStructuredSelection selection;
+ private IStructuredSelection selection;
- private IWorkbench workbench;
+ private IWorkbench workbench;
- /**
- * Create the wizard pages
- */
- @Override
+ /**
+ * Create the wizard pages
+ */
+ @Override
public void addPages() {
- IWizardCategory root = WorkbenchPlugin.getDefault().getNewWizardRegistry().getRootCategory();
- IWizardDescriptor [] primary = WorkbenchPlugin.getDefault().getNewWizardRegistry().getPrimaryWizards();
-
- if (categoryId != null) {
- IWizardCategory categories = root;
- StringTokenizer familyTokenizer = new StringTokenizer(categoryId,
- CATEGORY_SEPARATOR);
- while (familyTokenizer.hasMoreElements()) {
- categories = getChildWithID(categories, familyTokenizer
- .nextToken());
- if (categories == null) {
+ IWizardCategory root = WorkbenchPlugin.getDefault().getNewWizardRegistry().getRootCategory();
+ IWizardDescriptor[] primary = WorkbenchPlugin.getDefault().getNewWizardRegistry().getPrimaryWizards();
+
+ if (categoryId != null) {
+ IWizardCategory categories = root;
+ StringTokenizer familyTokenizer = new StringTokenizer(categoryId, CATEGORY_SEPARATOR);
+ while (familyTokenizer.hasMoreElements()) {
+ categories = getChildWithID(categories, familyTokenizer.nextToken());
+ if (categories == null) {
break;
}
- }
- if (categories != null) {
+ }
+ if (categories != null) {
root = categories;
}
- }
-
- mainPage = new NewWizardSelectionPage(workbench, selection, root,
- primary, projectsOnly);
- addPage(mainPage);
- }
-
- /**
- * Returns the id of the category of wizards to show or <code>null</code>
- * to show all categories. If no entries can be found with this id then all
- * categories are shown.
- *
- * @return String or <code>null</code>.
- */
- public String getCategoryId() {
- return categoryId;
- }
-
- /**
- * Returns the child collection element for the given id
- */
- private IWizardCategory getChildWithID(
- IWizardCategory parent, String id) {
+ }
+
+ mainPage = new NewWizardSelectionPage(workbench, selection, root, primary, projectsOnly);
+ addPage(mainPage);
+ }
+
+ /**
+ * Returns the id of the category of wizards to show or <code>null</code> to
+ * show all categories. If no entries can be found with this id then all
+ * categories are shown.
+ *
+ * @return String or <code>null</code>.
+ */
+ public String getCategoryId() {
+ return categoryId;
+ }
+
+ /**
+ * Returns the child collection element for the given id
+ */
+ private IWizardCategory getChildWithID(IWizardCategory parent, String id) {
for (IWizardCategory wizardCategory : parent.getCategories()) {
if (wizardCategory.getId().equals(id)) {
return wizardCategory;
}
- }
- return null;
- }
-
- /**
- * Lazily create the wizards pages
- * @param aWorkbench the workbench
- * @param currentSelection the current selection
- */
- public void init(IWorkbench aWorkbench,
- IStructuredSelection currentSelection) {
- this.workbench = aWorkbench;
- this.selection = currentSelection;
+ }
+ return null;
+ }
+
+ /**
+ * Lazily create the wizards pages
+ *
+ * @param aWorkbench the workbench
+ * @param currentSelection the current selection
+ */
+ public void init(IWorkbench aWorkbench, IStructuredSelection currentSelection) {
+ this.workbench = aWorkbench;
+ this.selection = currentSelection;
if (getWindowTitle() == null) {
// No title supplied. Set the default title
@@ -114,61 +110,63 @@ public class NewWizard extends Wizard {
setWindowTitle(WorkbenchMessages.NewWizard_title);
}
}
- setDefaultPageImageDescriptor(WorkbenchImages
- .getImageDescriptor(IWorkbenchGraphicConstants.IMG_WIZBAN_NEW_WIZ));
- setNeedsProgressMonitor(true);
- }
-
- /**
- * The user has pressed Finish. Instruct self's pages to finish, and answer
- * a boolean indicating success.
- *
- * @return boolean
- */
- @Override
+ setDefaultPageImageDescriptor(
+ WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_WIZBAN_NEW_WIZ));
+ setNeedsProgressMonitor(true);
+ }
+
+ /**
+ * The user has pressed Finish. Instruct self's pages to finish, and answer a
+ * boolean indicating success.
+ *
+ * @return boolean
+ */
+ @Override
public boolean performFinish() {
- //save our selection state
- mainPage.saveWidgetValues();
- // if we're finishing from the main page then perform finish on the selected wizard.
- if (getContainer().getCurrentPage() == mainPage) {
+ // save our selection state
+ mainPage.saveWidgetValues();
+ // if we're finishing from the main page then perform finish on the selected
+ // wizard.
+ if (getContainer().getCurrentPage() == mainPage) {
if (mainPage.canFinishEarly()) {
IWizard wizard = mainPage.getSelectedNode().getWizard();
wizard.setContainer(getContainer());
return wizard.performFinish();
}
}
- return true;
- }
-
- /**
- * Sets the id of the category of wizards to show or <code>null</code> to
- * show all categories. If no entries can be found with this id then all
- * categories are shown.
- *
- * @param id may be <code>null</code>.
- */
- public void setCategoryId(String id) {
- categoryId = id;
- }
-
- /**
- * Sets the projects only flag. If <code>true</code> only projects will
- * be shown in this wizard.
- * @param b if only projects should be shown
- */
- public void setProjectsOnly(boolean b) {
- projectsOnly = b;
- }
-
- @Override
+ return true;
+ }
+
+ /**
+ * Sets the id of the category of wizards to show or <code>null</code> to show
+ * all categories. If no entries can be found with this id then all categories
+ * are shown.
+ *
+ * @param id may be <code>null</code>.
+ */
+ public void setCategoryId(String id) {
+ categoryId = id;
+ }
+
+ /**
+ * Sets the projects only flag. If <code>true</code> only projects will be shown
+ * in this wizard.
+ *
+ * @param b if only projects should be shown
+ */
+ public void setProjectsOnly(boolean b) {
+ projectsOnly = b;
+ }
+
+ @Override
public boolean canFinish() {
- // we can finish if the first page is current and the the page can finish early.
- if (getContainer().getCurrentPage() == mainPage) {
- if (mainPage.canFinishEarly()) {
- return true;
- }
- }
- return super.canFinish();
- }
+ // we can finish if the first page is current and the the page can finish early.
+ if (getContainer().getCurrentPage() == mainPage) {
+ if (mainPage.canFinishEarly()) {
+ return true;
+ }
+ }
+ return super.canFinish();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewWizardCollectionComparator.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewWizardCollectionComparator.java
index 4f2a7af03b6..2c5f041cec8 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewWizardCollectionComparator.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewWizardCollectionComparator.java
@@ -19,57 +19,56 @@ import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.ui.internal.registry.WizardsRegistryReader;
/**
- * A Viewer element sorter that sorts Elements by their name attribute.
- * Note that capitalization differences are not considered by this
- * sorter, so a < B < c.
+ * A Viewer element sorter that sorts Elements by their name attribute. Note
+ * that capitalization differences are not considered by this sorter, so a < B <
+ * c.
*
- * NOTE one exception to the above: an element with the system's reserved
- * name for base Wizards will always be sorted such that it will
- * ultimately be placed at the beginning of the sorted result.
+ * NOTE one exception to the above: an element with the system's reserved name
+ * for base Wizards will always be sorted such that it will ultimately be placed
+ * at the beginning of the sorted result.
*/
class NewWizardCollectionComparator extends ViewerComparator {
/**
* Static instance of this class.
*/
- public static final NewWizardCollectionComparator INSTANCE = new NewWizardCollectionComparator();
+ public static final NewWizardCollectionComparator INSTANCE = new NewWizardCollectionComparator();
+ /**
+ * Creates an instance of <code>NewWizardCollectionSorter</code>. Since this is
+ * a stateless sorter, it is only accessible as a singleton; the private
+ * visibility of this constructor ensures this.
+ */
+ private NewWizardCollectionComparator() {
+ super();
+ }
- /**
- * Creates an instance of <code>NewWizardCollectionSorter</code>. Since this
- * is a stateless sorter, it is only accessible as a singleton; the private
- * visibility of this constructor ensures this.
- */
- private NewWizardCollectionComparator() {
- super();
- }
-
- @Override
+ @Override
public int category(Object element) {
- if (element instanceof WorkbenchWizardElement) {
+ if (element instanceof WorkbenchWizardElement) {
return -1;
}
- if (element instanceof WizardCollectionElement){
- String id = ((WizardCollectionElement)element).getId();
- if (WizardsRegistryReader.GENERAL_WIZARD_CATEGORY.equals(id)) {
+ if (element instanceof WizardCollectionElement) {
+ String id = ((WizardCollectionElement) element).getId();
+ if (WizardsRegistryReader.GENERAL_WIZARD_CATEGORY.equals(id)) {
return 1;
}
- if (WizardsRegistryReader.UNCATEGORIZED_WIZARD_CATEGORY.equals(id)) {
+ if (WizardsRegistryReader.UNCATEGORIZED_WIZARD_CATEGORY.equals(id)) {
return 3;
}
- if (WizardsRegistryReader.FULL_EXAMPLES_WIZARD_CATEGORY.equals(id)) {
+ if (WizardsRegistryReader.FULL_EXAMPLES_WIZARD_CATEGORY.equals(id)) {
return 4;
}
- return 2;
- }
- return super.category(element);
+ return 2;
+ }
+ return super.category(element);
}
/**
- * Return true if this sorter is affected by a property
- * change of propertyName on the specified element.
- */
- @Override
+ * Return true if this sorter is affected by a property change of propertyName
+ * on the specified element.
+ */
+ @Override
public boolean isSorterProperty(Object object, String propertyId) {
- return propertyId.equals(IBasicPropertyConstants.P_TEXT);
- }
+ return propertyId.equals(IBasicPropertyConstants.P_TEXT);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewWizardNewPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewWizardNewPage.java
index 321429b42b4..ad8e3dcf7e8 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewWizardNewPage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewWizardNewPage.java
@@ -62,97 +62,96 @@ import org.eclipse.ui.wizards.IWizardDescriptor;
*/
class NewWizardNewPage implements ISelectionChangedListener {
- // id constants
- private static final String DIALOG_SETTING_SECTION_NAME = "NewWizardSelectionPage."; //$NON-NLS-1$
+ // id constants
+ private static final String DIALOG_SETTING_SECTION_NAME = "NewWizardSelectionPage."; //$NON-NLS-1$
- private static final int SIZING_LISTS_HEIGHT = 200;
+ private static final int SIZING_LISTS_HEIGHT = 200;
- private static final int SIZING_VIEWER_WIDTH = 300;
+ private static final int SIZING_VIEWER_WIDTH = 300;
- private static final String STORE_EXPANDED_CATEGORIES_ID = DIALOG_SETTING_SECTION_NAME
- + "STORE_EXPANDED_CATEGORIES_ID"; //$NON-NLS-1$
+ private static final String STORE_EXPANDED_CATEGORIES_ID = DIALOG_SETTING_SECTION_NAME
+ + "STORE_EXPANDED_CATEGORIES_ID"; //$NON-NLS-1$
- private static final String STORE_SELECTED_ID = DIALOG_SETTING_SECTION_NAME
- + "STORE_SELECTED_ID"; //$NON-NLS-1$
+ private static final String STORE_SELECTED_ID = DIALOG_SETTING_SECTION_NAME + "STORE_SELECTED_ID"; //$NON-NLS-1$
- private NewWizardSelectionPage page;
+ private NewWizardSelectionPage page;
- private FilteredTree filteredTree;
+ private FilteredTree filteredTree;
- private WizardPatternFilter filteredTreeFilter;
+ private WizardPatternFilter filteredTreeFilter;
- //Keep track of the wizards we have previously selected
- private Hashtable selectedWizards = new Hashtable();
+ // Keep track of the wizards we have previously selected
+ private Hashtable selectedWizards = new Hashtable();
- private IDialogSettings settings;
+ private IDialogSettings settings;
- private Button showAllCheck;
+ private Button showAllCheck;
- private IWizardCategory wizardCategories;
+ private IWizardCategory wizardCategories;
- private IWizardDescriptor [] primaryWizards;
+ private IWizardDescriptor[] primaryWizards;
- private CLabel descImageCanvas;
+ private CLabel descImageCanvas;
- private Map imageTable = new HashMap();
+ private Map imageTable = new HashMap();
- private IWizardDescriptor selectedElement;
+ private IWizardDescriptor selectedElement;
- private WizardActivityFilter filter = new WizardActivityFilter();
+ private WizardActivityFilter filter = new WizardActivityFilter();
- private boolean needShowAll;
+ private boolean needShowAll;
private boolean projectsOnly;
- private ViewerFilter projectFilter = new WizardTagFilter(new String[] {WorkbenchWizardElement.TAG_PROJECT});
-
- /**
- * Create an instance of this class
- * @param mainPage
- * @param wizardCategories
- * @param primaryWizards
- * @param projectsOnly
- */
- public NewWizardNewPage(NewWizardSelectionPage mainPage,
- IWizardCategory wizardCategories,
+ private ViewerFilter projectFilter = new WizardTagFilter(new String[] { WorkbenchWizardElement.TAG_PROJECT });
+
+ /**
+ * Create an instance of this class
+ *
+ * @param mainPage
+ * @param wizardCategories
+ * @param primaryWizards
+ * @param projectsOnly
+ */
+ public NewWizardNewPage(NewWizardSelectionPage mainPage, IWizardCategory wizardCategories,
IWizardDescriptor[] primaryWizards, boolean projectsOnly) {
- this.page = mainPage;
- this.wizardCategories = wizardCategories;
- this.primaryWizards = primaryWizards;
- this.projectsOnly = projectsOnly;
-
- trimPrimaryWizards();
-
- if (this.primaryWizards.length > 0) {
- if (allPrimary(wizardCategories)) {
- this.wizardCategories = null; // dont bother considering the categories as all wizards are primary
- needShowAll = false;
- } else {
- needShowAll = !allActivityEnabled(wizardCategories);
- }
- } else {
- needShowAll = !allActivityEnabled(wizardCategories);
- }
+ this.page = mainPage;
+ this.wizardCategories = wizardCategories;
+ this.primaryWizards = primaryWizards;
+ this.projectsOnly = projectsOnly;
+
+ trimPrimaryWizards();
+
+ if (this.primaryWizards.length > 0) {
+ if (allPrimary(wizardCategories)) {
+ this.wizardCategories = null; // dont bother considering the categories as all wizards are primary
+ needShowAll = false;
+ } else {
+ needShowAll = !allActivityEnabled(wizardCategories);
+ }
+ } else {
+ needShowAll = !allActivityEnabled(wizardCategories);
+ }
IWizard wizard = mainPage.getWizard();
if (wizard instanceof NewWizard) {
- if (WizardsRegistryReader.FULL_EXAMPLES_WIZARD_CATEGORY.equals(((NewWizard) wizard)
- .getCategoryId())) {
+ if (WizardsRegistryReader.FULL_EXAMPLES_WIZARD_CATEGORY.equals(((NewWizard) wizard).getCategoryId())) {
filter.setFilterPrimaryWizards(true);
}
}
- }
-
- /**
- * @param category the wizard category
- * @return whether all of the wizards in the category are enabled via activity filtering
- */
- private boolean allActivityEnabled(IWizardCategory category) {
+ }
+
+ /**
+ * @param category the wizard category
+ * @return whether all of the wizards in the category are enabled via activity
+ * filtering
+ */
+ private boolean allActivityEnabled(IWizardCategory category) {
for (IWizardDescriptor wizard : category.getWizards()) {
- if (WorkbenchActivityHelper.filterItem(wizard)) {
+ if (WorkbenchActivityHelper.filterItem(wizard)) {
return false;
}
- }
+ }
for (IWizardCategory wizard : category.getCategories()) {
if (!allActivityEnabled(wizard)) {
@@ -160,39 +159,39 @@ class NewWizardNewPage implements ISelectionChangedListener {
}
}
- return true;
- }
+ return true;
+ }
- /**
- * Remove all primary wizards that are not in the wizard collection
- */
- private void trimPrimaryWizards() {
- ArrayList newPrimaryWizards = new ArrayList(primaryWizards.length);
+ /**
+ * Remove all primary wizards that are not in the wizard collection
+ */
+ private void trimPrimaryWizards() {
+ ArrayList newPrimaryWizards = new ArrayList(primaryWizards.length);
- if (wizardCategories == null) {
- return;//No categories so nothing to trim
+ if (wizardCategories == null) {
+ return;// No categories so nothing to trim
}
- for (IWizardDescriptor primaryWizard : primaryWizards) {
- if (wizardCategories.findWizard(primaryWizard.getId()) != null) {
+ for (IWizardDescriptor primaryWizard : primaryWizards) {
+ if (wizardCategories.findWizard(primaryWizard.getId()) != null) {
newPrimaryWizards.add(primaryWizard);
}
- }
+ }
- primaryWizards = (WorkbenchWizardElement[]) newPrimaryWizards
- .toArray(new WorkbenchWizardElement[newPrimaryWizards.size()]);
- }
+ primaryWizards = (WorkbenchWizardElement[]) newPrimaryWizards
+ .toArray(new WorkbenchWizardElement[newPrimaryWizards.size()]);
+ }
- /**
- * @param category the wizard category
- * @return whether all wizards in the category are considered primary
- */
- private boolean allPrimary(IWizardCategory category) {
+ /**
+ * @param category the wizard category
+ * @return whether all wizards in the category are considered primary
+ */
+ private boolean allPrimary(IWizardCategory category) {
for (IWizardDescriptor wizard : category.getWizards()) {
- if (!isPrimary(wizard)) {
+ if (!isPrimary(wizard)) {
return false;
}
- }
+ }
for (IWizardCategory wizard : category.getCategories()) {
if (!allPrimary(wizard)) {
@@ -200,103 +199,103 @@ class NewWizardNewPage implements ISelectionChangedListener {
}
}
- return true;
- }
+ return true;
+ }
- /**
- * @param wizard
- * @return whether the given wizard is primary
- */
- private boolean isPrimary(IWizardDescriptor wizard) {
- for (IWizardDescriptor primaryWizard : primaryWizards) {
- if (primaryWizard.equals(wizard)) {
+ /**
+ * @param wizard
+ * @return whether the given wizard is primary
+ */
+ private boolean isPrimary(IWizardDescriptor wizard) {
+ for (IWizardDescriptor primaryWizard : primaryWizards) {
+ if (primaryWizard.equals(wizard)) {
return true;
}
- }
-
- return false;
- }
-
- /**
- * @since 3.0
- */
- public void activate() {
- page.setDescription(WorkbenchMessages.NewWizardNewPage_description);
- }
-
- /**
- * Create this tab's visual components
- *
- * @param parent Composite
- * @return Control
- */
- protected Control createControl(Composite parent) {
-
- Font wizardFont = parent.getFont();
- // top level group
- Composite outerContainer = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- outerContainer.setLayout(layout);
-
- Label wizardLabel = new Label(outerContainer, SWT.NONE);
- GridData data = new GridData(SWT.BEGINNING, SWT.FILL, false, true);
- outerContainer.setLayoutData(data);
- wizardLabel.setFont(wizardFont);
- wizardLabel.setText(WorkbenchMessages.NewWizardNewPage_wizardsLabel);
-
- Composite innerContainer = new Composite(outerContainer, SWT.NONE);
- layout = new GridLayout(2, false);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- innerContainer.setLayout(layout);
- innerContainer.setFont(wizardFont);
- data = new GridData(SWT.FILL, SWT.FILL, true, true);
- innerContainer.setLayoutData(data);
-
- filteredTree = createFilteredTree(innerContainer);
- createOptionsButtons(innerContainer);
-
- createImage(innerContainer);
-
- updateDescription(null);
-
- // wizard actions pane...create SWT table directly to
- // get single selection mode instead of multi selection.
- restoreWidgetValues();
-
- return outerContainer;
- }
-
- /**
- * Create a new FilteredTree in the parent.
- *
- * @param parent the parent <code>Composite</code>.
- * @since 3.0
- */
- protected FilteredTree createFilteredTree(Composite parent){
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- composite.setLayout(layout);
-
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
- data.widthHint = SIZING_VIEWER_WIDTH;
- data.horizontalSpan = 2;
- data.grabExcessHorizontalSpace = true;
- data.grabExcessVerticalSpace = true;
-
- boolean needsHint = DialogUtil.inRegularFontMode(parent);
-
- //Only give a height hint if the dialog is going to be too small
- if (needsHint) {
- data.heightHint = SIZING_LISTS_HEIGHT;
- }
- composite.setLayoutData(data);
-
- filteredTreeFilter = new WizardPatternFilter();
- FilteredTree filterTree = new FilteredTree(composite,
- SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER, filteredTreeFilter, true);
+ }
+
+ return false;
+ }
+
+ /**
+ * @since 3.0
+ */
+ public void activate() {
+ page.setDescription(WorkbenchMessages.NewWizardNewPage_description);
+ }
+
+ /**
+ * Create this tab's visual components
+ *
+ * @param parent Composite
+ * @return Control
+ */
+ protected Control createControl(Composite parent) {
+
+ Font wizardFont = parent.getFont();
+ // top level group
+ Composite outerContainer = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ outerContainer.setLayout(layout);
+
+ Label wizardLabel = new Label(outerContainer, SWT.NONE);
+ GridData data = new GridData(SWT.BEGINNING, SWT.FILL, false, true);
+ outerContainer.setLayoutData(data);
+ wizardLabel.setFont(wizardFont);
+ wizardLabel.setText(WorkbenchMessages.NewWizardNewPage_wizardsLabel);
+
+ Composite innerContainer = new Composite(outerContainer, SWT.NONE);
+ layout = new GridLayout(2, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ innerContainer.setLayout(layout);
+ innerContainer.setFont(wizardFont);
+ data = new GridData(SWT.FILL, SWT.FILL, true, true);
+ innerContainer.setLayoutData(data);
+
+ filteredTree = createFilteredTree(innerContainer);
+ createOptionsButtons(innerContainer);
+
+ createImage(innerContainer);
+
+ updateDescription(null);
+
+ // wizard actions pane...create SWT table directly to
+ // get single selection mode instead of multi selection.
+ restoreWidgetValues();
+
+ return outerContainer;
+ }
+
+ /**
+ * Create a new FilteredTree in the parent.
+ *
+ * @param parent the parent <code>Composite</code>.
+ * @since 3.0
+ */
+ protected FilteredTree createFilteredTree(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ composite.setLayout(layout);
+
+ GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
+ data.widthHint = SIZING_VIEWER_WIDTH;
+ data.horizontalSpan = 2;
+ data.grabExcessHorizontalSpace = true;
+ data.grabExcessVerticalSpace = true;
+
+ boolean needsHint = DialogUtil.inRegularFontMode(parent);
+
+ // Only give a height hint if the dialog is going to be too small
+ if (needsHint) {
+ data.heightHint = SIZING_LISTS_HEIGHT;
+ }
+ composite.setLayoutData(data);
+
+ filteredTreeFilter = new WizardPatternFilter();
+ FilteredTree filterTree = new FilteredTree(composite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER,
+ filteredTreeFilter, true);
filterTree.setQuickSelectionMode(true);
final TreeViewer treeViewer = filterTree.getViewer();
@@ -305,423 +304,406 @@ class NewWizardNewPage implements ISelectionChangedListener {
treeViewer.setComparator(NewWizardCollectionComparator.INSTANCE);
treeViewer.addSelectionChangedListener(this);
- ArrayList inputArray = new ArrayList();
+ ArrayList inputArray = new ArrayList();
- for (IWizardDescriptor primaryWizard : primaryWizards) {
- inputArray.add(primaryWizard);
- }
+ for (IWizardDescriptor primaryWizard : primaryWizards) {
+ inputArray.add(primaryWizard);
+ }
- boolean expandTop = false;
+ boolean expandTop = false;
- if (wizardCategories != null) {
- if (wizardCategories.getParent() == null) {
+ if (wizardCategories != null) {
+ if (wizardCategories.getParent() == null) {
for (IWizardCategory wizardCategory : wizardCategories.getCategories()) {
inputArray.add(wizardCategory);
- }
- } else {
- expandTop = true;
- inputArray.add(wizardCategories);
- }
- }
-
- // ensure the category is expanded. If there is a remembered expansion it will be set later.
- if (expandTop) {
+ }
+ } else {
+ expandTop = true;
+ inputArray.add(wizardCategories);
+ }
+ }
+
+ // ensure the category is expanded. If there is a remembered expansion it will
+ // be set later.
+ if (expandTop) {
treeViewer.setAutoExpandLevel(2);
}
- AdaptableList input = new AdaptableList(inputArray);
+ AdaptableList input = new AdaptableList(inputArray);
- treeViewer.setInput(input);
+ treeViewer.setInput(input);
- filterTree.setBackground(parent.getDisplay().getSystemColor(
- SWT.COLOR_WIDGET_BACKGROUND));
+ filterTree.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- treeViewer.getTree().setFont(parent.getFont());
+ treeViewer.getTree().setFont(parent.getFont());
- treeViewer.addDoubleClickListener(event -> {
- IStructuredSelection s = (IStructuredSelection) event
- .getSelection();
+ treeViewer.addDoubleClickListener(event -> {
+ IStructuredSelection s = (IStructuredSelection) event.getSelection();
selectionChanged(new SelectionChangedEvent(event.getViewer(), s));
Object element = s.getFirstElement();
- if (treeViewer.isExpandable(element)) {
- treeViewer.setExpandedState(element, !treeViewer
- .getExpandedState(element));
- } else if (element instanceof WorkbenchWizardElement) {
- page.advanceToNextPageOrFinish();
- }
+ if (treeViewer.isExpandable(element)) {
+ treeViewer.setExpandedState(element, !treeViewer.getExpandedState(element));
+ } else if (element instanceof WorkbenchWizardElement) {
+ page.advanceToNextPageOrFinish();
+ }
});
- treeViewer.addFilter(filter);
+ treeViewer.addFilter(filter);
- if (projectsOnly) {
+ if (projectsOnly) {
treeViewer.addFilter(projectFilter);
}
Dialog.applyDialogFont(filterTree);
return filterTree;
- }
-
- /**
- * Create the Show All and help buttons at the bottom of the page.
- *
- * @param parent the parent composite on which to create the widgets
- */
- private void createOptionsButtons(Composite parent){
- if (needShowAll) {
- showAllCheck = new Button(parent, SWT.CHECK);
- GridData data = new GridData();
- showAllCheck.setLayoutData(data);
- showAllCheck.setFont(parent.getFont());
- showAllCheck.setText(WorkbenchMessages.NewWizardNewPage_showAll);
- showAllCheck.setSelection(false);
-
- // flipping tabs updates the selected node
- showAllCheck.addSelectionListener(new SelectionAdapter() {
-
- // the delta of expanded elements between the last 'show all'
- // and the current 'no show all'
- private Object[] delta = new Object[0];
-
- @Override
+ }
+
+ /**
+ * Create the Show All and help buttons at the bottom of the page.
+ *
+ * @param parent the parent composite on which to create the widgets
+ */
+ private void createOptionsButtons(Composite parent) {
+ if (needShowAll) {
+ showAllCheck = new Button(parent, SWT.CHECK);
+ GridData data = new GridData();
+ showAllCheck.setLayoutData(data);
+ showAllCheck.setFont(parent.getFont());
+ showAllCheck.setText(WorkbenchMessages.NewWizardNewPage_showAll);
+ showAllCheck.setSelection(false);
+
+ // flipping tabs updates the selected node
+ showAllCheck.addSelectionListener(new SelectionAdapter() {
+
+ // the delta of expanded elements between the last 'show all'
+ // and the current 'no show all'
+ private Object[] delta = new Object[0];
+
+ @Override
public void widgetSelected(SelectionEvent e) {
- boolean showAll = showAllCheck.getSelection();
-
- if (showAll) {
- filteredTree.getViewer().getControl().setRedraw(false);
- } else {
- // get the inital expanded elements when going from show
- // all-> no show all.
- // this isnt really the delta yet, we're just reusing
- // the variable.
- delta = filteredTree.getViewer().getExpandedElements();
- }
-
- try {
- if (showAll) {
- filteredTree.getViewer().resetFilters();
- filteredTree.getViewer().addFilter(filteredTreeFilter);
- if (projectsOnly) {
+ boolean showAll = showAllCheck.getSelection();
+
+ if (showAll) {
+ filteredTree.getViewer().getControl().setRedraw(false);
+ } else {
+ // get the inital expanded elements when going from show
+ // all-> no show all.
+ // this isnt really the delta yet, we're just reusing
+ // the variable.
+ delta = filteredTree.getViewer().getExpandedElements();
+ }
+
+ try {
+ if (showAll) {
+ filteredTree.getViewer().resetFilters();
+ filteredTree.getViewer().addFilter(filteredTreeFilter);
+ if (projectsOnly) {
filteredTree.getViewer().addFilter(projectFilter);
}
- // restore the expanded elements that were present
- // in the last show all state but not in the 'no
- // show all' state.
- Object[] currentExpanded = filteredTree.getViewer()
- .getExpandedElements();
- Object[] expanded = new Object[delta.length
- + currentExpanded.length];
- System.arraycopy(currentExpanded, 0, expanded, 0,
- currentExpanded.length);
- System.arraycopy(delta, 0, expanded,
- currentExpanded.length, delta.length);
- filteredTree.getViewer().setExpandedElements(expanded);
- } else {
- filteredTree.getViewer().addFilter(filter);
- if (projectsOnly) {
+ // restore the expanded elements that were present
+ // in the last show all state but not in the 'no
+ // show all' state.
+ Object[] currentExpanded = filteredTree.getViewer().getExpandedElements();
+ Object[] expanded = new Object[delta.length + currentExpanded.length];
+ System.arraycopy(currentExpanded, 0, expanded, 0, currentExpanded.length);
+ System.arraycopy(delta, 0, expanded, currentExpanded.length, delta.length);
+ filteredTree.getViewer().setExpandedElements(expanded);
+ } else {
+ filteredTree.getViewer().addFilter(filter);
+ if (projectsOnly) {
filteredTree.getViewer().addFilter(projectFilter);
}
- }
- filteredTree.getViewer().refresh(false);
-
- if (!showAll) {
- // if we're going from show all -> no show all
- // record the elements that were expanded in the
- // 'show all' state but not the 'no show all' state
- // (because they didnt exist).
- Object[] newExpanded = filteredTree.getViewer().getExpandedElements();
- List deltaList = new ArrayList(Arrays.asList(delta));
- deltaList.removeAll(Arrays.asList(newExpanded));
- }
- } finally {
- if (showAll) {
+ }
+ filteredTree.getViewer().refresh(false);
+
+ if (!showAll) {
+ // if we're going from show all -> no show all
+ // record the elements that were expanded in the
+ // 'show all' state but not the 'no show all' state
+ // (because they didnt exist).
+ Object[] newExpanded = filteredTree.getViewer().getExpandedElements();
+ List deltaList = new ArrayList(Arrays.asList(delta));
+ deltaList.removeAll(Arrays.asList(newExpanded));
+ }
+ } finally {
+ if (showAll) {
filteredTree.getViewer().getControl().setRedraw(true);
}
- }
- }
- });
- }
- }
-
- /**
- * Create the image controls.
- *
- * @param parent the parent <code>Composite</code>.
- * @since 3.0
- */
- private void createImage(Composite parent) {
- descImageCanvas = new CLabel(parent, SWT.NONE);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING
- | GridData.VERTICAL_ALIGN_BEGINNING);
- data.widthHint = 0;
- data.heightHint = 0;
- descImageCanvas.setLayoutData(data);
-
- // hook a listener to get rid of cached images.
- descImageCanvas.addDisposeListener(e -> {
- for (Iterator i = imageTable.values().iterator(); i.hasNext();) {
- ((Image) i.next()).dispose();
- }
- imageTable.clear();
+ }
+ }
+ });
+ }
+ }
+
+ /**
+ * Create the image controls.
+ *
+ * @param parent the parent <code>Composite</code>.
+ * @since 3.0
+ */
+ private void createImage(Composite parent) {
+ descImageCanvas = new CLabel(parent, SWT.NONE);
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING);
+ data.widthHint = 0;
+ data.heightHint = 0;
+ descImageCanvas.setLayoutData(data);
+
+ // hook a listener to get rid of cached images.
+ descImageCanvas.addDisposeListener(e -> {
+ for (Iterator i = imageTable.values().iterator(); i.hasNext();) {
+ ((Image) i.next()).dispose();
+ }
+ imageTable.clear();
});
- }
-
- /**
- * Expands the wizard categories in this page's category viewer that were
- * expanded last time this page was used. If a category that was previously
- * expanded no longer exists then it is ignored.
- */
- protected void expandPreviouslyExpandedCategories() {
- String[] expandedCategoryPaths = settings
- .getArray(STORE_EXPANDED_CATEGORIES_ID);
- if (expandedCategoryPaths == null || expandedCategoryPaths.length == 0) {
+ }
+
+ /**
+ * Expands the wizard categories in this page's category viewer that were
+ * expanded last time this page was used. If a category that was previously
+ * expanded no longer exists then it is ignored.
+ */
+ protected void expandPreviouslyExpandedCategories() {
+ String[] expandedCategoryPaths = settings.getArray(STORE_EXPANDED_CATEGORIES_ID);
+ if (expandedCategoryPaths == null || expandedCategoryPaths.length == 0) {
return;
}
- List categoriesToExpand = new ArrayList(expandedCategoryPaths.length);
+ List categoriesToExpand = new ArrayList(expandedCategoryPaths.length);
- if (wizardCategories != null) {
- for (String expandedCategoryPath : expandedCategoryPaths) {
- IWizardCategory category = wizardCategories
- .findCategory(new Path(expandedCategoryPath));
- if (category != null) {
+ if (wizardCategories != null) {
+ for (String expandedCategoryPath : expandedCategoryPaths) {
+ IWizardCategory category = wizardCategories.findCategory(new Path(expandedCategoryPath));
+ if (category != null) {
categoriesToExpand.add(category);
}
- }
- }
+ }
+ }
- if (!categoriesToExpand.isEmpty()) {
+ if (!categoriesToExpand.isEmpty()) {
filteredTree.getViewer().setExpandedElements(categoriesToExpand.toArray());
}
- }
-
- /**
- * Returns the single selected object contained in the passed
- * selectionEvent, or <code>null</code> if the selectionEvent contains
- * either 0 or 2+ selected objects.
- */
- protected Object getSingleSelection(IStructuredSelection selection) {
- return selection.size() == 1 ? selection.getFirstElement() : null;
- }
-
- /**
- * Set self's widgets to the values that they held last time this page was
- * open
- *
- */
- protected void restoreWidgetValues() {
- expandPreviouslyExpandedCategories();
- selectPreviouslySelected();
- }
-
- /**
- * Store the current values of self's widgets so that they can be restored
- * in the next instance of self
- *
- */
- public void saveWidgetValues() {
- storeExpandedCategories();
- storeSelectedCategoryAndWizard();
- }
-
- /**
- * The user selected either new wizard category(s) or wizard element(s).
- * Proceed accordingly.
- *
- * @param selectionEvent ISelection
- */
- @Override
+ }
+
+ /**
+ * Returns the single selected object contained in the passed selectionEvent, or
+ * <code>null</code> if the selectionEvent contains either 0 or 2+ selected
+ * objects.
+ */
+ protected Object getSingleSelection(IStructuredSelection selection) {
+ return selection.size() == 1 ? selection.getFirstElement() : null;
+ }
+
+ /**
+ * Set self's widgets to the values that they held last time this page was open
+ *
+ */
+ protected void restoreWidgetValues() {
+ expandPreviouslyExpandedCategories();
+ selectPreviouslySelected();
+ }
+
+ /**
+ * Store the current values of self's widgets so that they can be restored in
+ * the next instance of self
+ *
+ */
+ public void saveWidgetValues() {
+ storeExpandedCategories();
+ storeSelectedCategoryAndWizard();
+ }
+
+ /**
+ * The user selected either new wizard category(s) or wizard element(s). Proceed
+ * accordingly.
+ *
+ * @param selectionEvent ISelection
+ */
+ @Override
public void selectionChanged(SelectionChangedEvent selectionEvent) {
- page.setErrorMessage(null);
- page.setMessage(null);
+ page.setErrorMessage(null);
+ page.setMessage(null);
Object selectedObject = getSingleSelection(selectionEvent.getStructuredSelection());
- if (selectedObject instanceof IWizardDescriptor) {
- if (selectedObject == selectedElement) {
+ if (selectedObject instanceof IWizardDescriptor) {
+ if (selectedObject == selectedElement) {
return;
}
- updateWizardSelection((IWizardDescriptor) selectedObject);
- } else {
- selectedElement = null;
- page.setHasPages(false);
- page.setCanFinishEarly(false);
- page.selectWizardNode(null);
- updateDescription(null);
- }
- }
-
- /**
- * Selects the wizard category and wizard in this page that were selected
- * last time this page was used. If a category or wizard that was
- * previously selected no longer exists then it is ignored.
- */
- protected void selectPreviouslySelected() {
- String selectedId = settings.get(STORE_SELECTED_ID);
- if (selectedId == null) {
+ updateWizardSelection((IWizardDescriptor) selectedObject);
+ } else {
+ selectedElement = null;
+ page.setHasPages(false);
+ page.setCanFinishEarly(false);
+ page.selectWizardNode(null);
+ updateDescription(null);
+ }
+ }
+
+ /**
+ * Selects the wizard category and wizard in this page that were selected last
+ * time this page was used. If a category or wizard that was previously selected
+ * no longer exists then it is ignored.
+ */
+ protected void selectPreviouslySelected() {
+ String selectedId = settings.get(STORE_SELECTED_ID);
+ if (selectedId == null) {
return;
}
- if (wizardCategories == null) {
+ if (wizardCategories == null) {
return;
}
- Object selected = wizardCategories.findCategory(new Path(
- selectedId));
+ Object selected = wizardCategories.findCategory(new Path(selectedId));
- if (selected == null) {
- selected = wizardCategories.findWizard(selectedId);
+ if (selected == null) {
+ selected = wizardCategories.findWizard(selectedId);
- if (selected == null) {
+ if (selected == null) {
// if we cant find either a category or a wizard, abort.
- return;
+ return;
}
- }
-
- //work around for 62039
- final StructuredSelection selection = new StructuredSelection(selected);
- filteredTree.getViewer().getControl().getDisplay().asyncExec(() -> filteredTree.getViewer().setSelection(selection, true));
- }
-
- /**
- * Set the dialog store to use for widget value storage and retrieval
- *
- * @param settings IDialogSettings
- */
- public void setDialogSettings(IDialogSettings settings) {
- this.settings = settings;
- }
-
- /**
- * Stores the collection of currently-expanded categories in this page's
- * dialog store, in order to recreate this page's state in the next
- * instance of this page.
- */
- protected void storeExpandedCategories() {
- Object[] expandedElements = filteredTree.getViewer().getExpandedElements();
- List expandedElementPaths = new ArrayList(expandedElements.length);
- for (Object expandedElement : expandedElements) {
- if (expandedElement instanceof IWizardCategory) {
- expandedElementPaths
- .add(((IWizardCategory) expandedElement)
- .getPath().toString());
+ }
+
+ // work around for 62039
+ final StructuredSelection selection = new StructuredSelection(selected);
+ filteredTree.getViewer().getControl().getDisplay()
+ .asyncExec(() -> filteredTree.getViewer().setSelection(selection, true));
+ }
+
+ /**
+ * Set the dialog store to use for widget value storage and retrieval
+ *
+ * @param settings IDialogSettings
+ */
+ public void setDialogSettings(IDialogSettings settings) {
+ this.settings = settings;
+ }
+
+ /**
+ * Stores the collection of currently-expanded categories in this page's dialog
+ * store, in order to recreate this page's state in the next instance of this
+ * page.
+ */
+ protected void storeExpandedCategories() {
+ Object[] expandedElements = filteredTree.getViewer().getExpandedElements();
+ List expandedElementPaths = new ArrayList(expandedElements.length);
+ for (Object expandedElement : expandedElements) {
+ if (expandedElement instanceof IWizardCategory) {
+ expandedElementPaths.add(((IWizardCategory) expandedElement).getPath().toString());
}
- }
- settings.put(STORE_EXPANDED_CATEGORIES_ID,
- (String[]) expandedElementPaths
- .toArray(new String[expandedElementPaths.size()]));
- }
-
- /**
- * Stores the currently-selected element in this page's dialog store, in
- * order to recreate this page's state in the next instance of this page.
- */
- protected void storeSelectedCategoryAndWizard() {
+ }
+ settings.put(STORE_EXPANDED_CATEGORIES_ID,
+ (String[]) expandedElementPaths.toArray(new String[expandedElementPaths.size()]));
+ }
+
+ /**
+ * Stores the currently-selected element in this page's dialog store, in order
+ * to recreate this page's state in the next instance of this page.
+ */
+ protected void storeSelectedCategoryAndWizard() {
Object selected = getSingleSelection(filteredTree.getViewer().getStructuredSelection());
- if (selected != null) {
- if (selected instanceof IWizardCategory) {
- settings.put(STORE_SELECTED_ID,
- ((IWizardCategory) selected).getPath()
- .toString());
+ if (selected != null) {
+ if (selected instanceof IWizardCategory) {
+ settings.put(STORE_SELECTED_ID, ((IWizardCategory) selected).getPath().toString());
} else {
// else its a wizard
- settings.put(STORE_SELECTED_ID,
- ((IWizardDescriptor) selected).getId());
+ settings.put(STORE_SELECTED_ID, ((IWizardDescriptor) selected).getId());
}
- }
- }
-
- /**
- * Update the current description controls.
- *
- * @param selectedObject the new wizard
- * @since 3.0
- */
- private void updateDescription(IWizardDescriptor selectedObject) {
- String string = ""; //$NON-NLS-1$
- if (selectedObject != null) {
+ }
+ }
+
+ /**
+ * Update the current description controls.
+ *
+ * @param selectedObject the new wizard
+ * @since 3.0
+ */
+ private void updateDescription(IWizardDescriptor selectedObject) {
+ String string = ""; //$NON-NLS-1$
+ if (selectedObject != null) {
string = selectedObject.getDescription();
}
- page.setDescription(string);
-
- if (hasImage(selectedObject)) {
- ImageDescriptor descriptor = null;
- if (selectedObject != null) {
- descriptor = selectedObject.getDescriptionImage();
- }
-
- if (descriptor != null) {
- GridData data = (GridData)descImageCanvas.getLayoutData();
- data.widthHint = SWT.DEFAULT;
- data.heightHint = SWT.DEFAULT;
- Image image = (Image) imageTable.get(descriptor);
- if (image == null) {
- image = descriptor.createImage(false);
- imageTable.put(descriptor, image);
- }
- descImageCanvas.setImage(image);
- }
- } else {
- GridData data = (GridData)descImageCanvas.getLayoutData();
- data.widthHint = 0;
- data.heightHint = 0;
- descImageCanvas.setImage(null);
- }
-
- descImageCanvas.getParent().layout(true);
- filteredTree.getViewer().getTree().showSelection();
-
- IWizardContainer container = page.getWizard().getContainer();
- if (container instanceof IWizardContainer2) {
- ((IWizardContainer2) container).updateSize();
- }
- }
-
- /**
- * Tests whether the given wizard has an associated image.
- *
- * @param selectedObject the wizard to test
- * @return whether the given wizard has an associated image
- */
- private boolean hasImage(IWizardDescriptor selectedObject) {
- if (selectedObject == null) {
+ page.setDescription(string);
+
+ if (hasImage(selectedObject)) {
+ ImageDescriptor descriptor = null;
+ if (selectedObject != null) {
+ descriptor = selectedObject.getDescriptionImage();
+ }
+
+ if (descriptor != null) {
+ GridData data = (GridData) descImageCanvas.getLayoutData();
+ data.widthHint = SWT.DEFAULT;
+ data.heightHint = SWT.DEFAULT;
+ Image image = (Image) imageTable.get(descriptor);
+ if (image == null) {
+ image = descriptor.createImage(false);
+ imageTable.put(descriptor, image);
+ }
+ descImageCanvas.setImage(image);
+ }
+ } else {
+ GridData data = (GridData) descImageCanvas.getLayoutData();
+ data.widthHint = 0;
+ data.heightHint = 0;
+ descImageCanvas.setImage(null);
+ }
+
+ descImageCanvas.getParent().layout(true);
+ filteredTree.getViewer().getTree().showSelection();
+
+ IWizardContainer container = page.getWizard().getContainer();
+ if (container instanceof IWizardContainer2) {
+ ((IWizardContainer2) container).updateSize();
+ }
+ }
+
+ /**
+ * Tests whether the given wizard has an associated image.
+ *
+ * @param selectedObject the wizard to test
+ * @return whether the given wizard has an associated image
+ */
+ private boolean hasImage(IWizardDescriptor selectedObject) {
+ if (selectedObject == null) {
return false;
}
- if (selectedObject.getDescriptionImage() != null) {
+ if (selectedObject.getDescriptionImage() != null) {
return true;
}
- return false;
- }
-
- /**
- * @param selectedObject
- */
- private void updateWizardSelection(IWizardDescriptor selectedObject) {
- selectedElement = selectedObject;
- WorkbenchWizardNode selectedNode;
- if (selectedWizards.containsKey(selectedObject)) {
- selectedNode = (WorkbenchWizardNode) selectedWizards
- .get(selectedObject);
- } else {
- selectedNode = new WorkbenchWizardNode(page, selectedObject) {
- @Override
+ return false;
+ }
+
+ /**
+ * @param selectedObject
+ */
+ private void updateWizardSelection(IWizardDescriptor selectedObject) {
+ selectedElement = selectedObject;
+ WorkbenchWizardNode selectedNode;
+ if (selectedWizards.containsKey(selectedObject)) {
+ selectedNode = (WorkbenchWizardNode) selectedWizards.get(selectedObject);
+ } else {
+ selectedNode = new WorkbenchWizardNode(page, selectedObject) {
+ @Override
public IWorkbenchWizard createWizard() throws CoreException {
- return wizardElement.createWizard();
- }
- };
- selectedWizards.put(selectedObject, selectedNode);
- }
-
- page.setCanFinishEarly(selectedObject.canFinishEarly());
- page.setHasPages(selectedObject.hasPages());
- page.selectWizardNode(selectedNode);
-
- updateDescription(selectedObject);
- }
+ return wizardElement.createWizard();
+ }
+ };
+ selectedWizards.put(selectedObject, selectedNode);
+ }
+
+ page.setCanFinishEarly(selectedObject.canFinishEarly());
+ page.setHasPages(selectedObject.hasPages());
+ page.selectWizardNode(selectedNode);
+
+ updateDescription(selectedObject);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewWizardSelectionPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewWizardSelectionPage.java
index ae8bb2f8044..1fc475163f2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewWizardSelectionPage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewWizardSelectionPage.java
@@ -26,95 +26,93 @@ import org.eclipse.ui.wizards.IWizardCategory;
import org.eclipse.ui.wizards.IWizardDescriptor;
/**
- * New wizard selection tab that allows the user to either select a
- * registered 'New' wizard to be launched, or to select a solution or
- * projects to be retrieved from an available server. This page
- * contains two visual tabs that allow the user to perform these tasks.
+ * New wizard selection tab that allows the user to either select a registered
+ * 'New' wizard to be launched, or to select a solution or projects to be
+ * retrieved from an available server. This page contains two visual tabs that
+ * allow the user to perform these tasks.
*
- * Temporarily has two inner pages. The new format page is used if the system
- * is currently aware of activity categories.
+ * Temporarily has two inner pages. The new format page is used if the system is
+ * currently aware of activity categories.
*/
class NewWizardSelectionPage extends WorkbenchWizardSelectionPage {
- private IWizardCategory wizardCategories;
+ private IWizardCategory wizardCategories;
- // widgets
- private NewWizardNewPage newResourcePage;
+ // widgets
+ private NewWizardNewPage newResourcePage;
- private IWizardDescriptor [] primaryWizards;
+ private IWizardDescriptor[] primaryWizards;
private boolean projectsOnly;
private boolean canFinishEarly = false, hasPages = true;
- /**
- * Create an instance of this class.
- *
- * @param workbench the workbench
- * @param selection the current selection
- * @param root the wizard root element
- * @param primary the primary wizard elements
- * @param projectsOnly if only projects should be shown
- */
- public NewWizardSelectionPage(IWorkbench workbench,
- IStructuredSelection selection, IWizardCategory root,
+ /**
+ * Create an instance of this class.
+ *
+ * @param workbench the workbench
+ * @param selection the current selection
+ * @param root the wizard root element
+ * @param primary the primary wizard elements
+ * @param projectsOnly if only projects should be shown
+ */
+ public NewWizardSelectionPage(IWorkbench workbench, IStructuredSelection selection, IWizardCategory root,
IWizardDescriptor[] primary, boolean projectsOnly) {
- super("newWizardSelectionPage", workbench, selection, null, WorkbenchTriggerPoints.NEW_WIZARDS);//$NON-NLS-1$
+ super("newWizardSelectionPage", workbench, selection, null, WorkbenchTriggerPoints.NEW_WIZARDS);//$NON-NLS-1$
- setTitle(WorkbenchMessages.NewWizardSelectionPage_description);
- wizardCategories = root;
- primaryWizards = primary;
- this.projectsOnly = projectsOnly;
+ setTitle(WorkbenchMessages.NewWizardSelectionPage_description);
+ wizardCategories = root;
+ primaryWizards = primary;
+ this.projectsOnly = projectsOnly;
}
- /**
- * Makes the next page visible.
- */
- public void advanceToNextPageOrFinish() {
- if (canFlipToNextPage()) {
- getContainer().showPage(getNextPage());
- } else if (canFinishEarly()) {
- if (getWizard().performFinish()) {
- ((WizardDialog)getContainer()).close();
- }
- }
- }
-
- @Override
+ /**
+ * Makes the next page visible.
+ */
+ public void advanceToNextPageOrFinish() {
+ if (canFlipToNextPage()) {
+ getContainer().showPage(getNextPage());
+ } else if (canFinishEarly()) {
+ if (getWizard().performFinish()) {
+ ((WizardDialog) getContainer()).close();
+ }
+ }
+ }
+
+ @Override
public void createControl(Composite parent) {
- IDialogSettings settings = getDialogSettings();
- newResourcePage = new NewWizardNewPage(this, wizardCategories,
- primaryWizards, projectsOnly);
- newResourcePage.setDialogSettings(settings);
-
- Control control = newResourcePage.createControl(parent);
- getWorkbench().getHelpSystem().setHelp(control,
- IWorkbenchHelpContextIds.NEW_WIZARD_SELECTION_WIZARD_PAGE);
- setControl(control);
- }
-
- /**
- * Since Finish was pressed, write widget values to the dialog store so that they
- *will persist into the next invocation of this wizard page
- */
- protected void saveWidgetValues() {
- newResourcePage.saveWidgetValues();
- }
-
- @Override
+ IDialogSettings settings = getDialogSettings();
+ newResourcePage = new NewWizardNewPage(this, wizardCategories, primaryWizards, projectsOnly);
+ newResourcePage.setDialogSettings(settings);
+
+ Control control = newResourcePage.createControl(parent);
+ getWorkbench().getHelpSystem().setHelp(control, IWorkbenchHelpContextIds.NEW_WIZARD_SELECTION_WIZARD_PAGE);
+ setControl(control);
+ }
+
+ /**
+ * Since Finish was pressed, write widget values to the dialog store so that
+ * they will persist into the next invocation of this wizard page
+ */
+ protected void saveWidgetValues() {
+ newResourcePage.saveWidgetValues();
+ }
+
+ @Override
public boolean canFlipToNextPage() {
- // if the current page advertises that it does have pages then ask it via the super call
- if (hasPages) {
- return super.canFlipToNextPage();
- }
- return false;
- }
-
- /**
- * Sets whether the selected wizard advertises that it does provide pages.
- *
- * @param newValue whether the selected wizard has pages
- * @since 3.1
- */
+ // if the current page advertises that it does have pages then ask it via the
+ // super call
+ if (hasPages) {
+ return super.canFlipToNextPage();
+ }
+ return false;
+ }
+
+ /**
+ * Sets whether the selected wizard advertises that it does provide pages.
+ *
+ * @param newValue whether the selected wizard has pages
+ * @since 3.1
+ */
public void setHasPages(boolean newValue) {
hasPages = newValue;
}
@@ -130,7 +128,8 @@ class NewWizardSelectionPage extends WorkbenchWizardSelectionPage {
}
/**
- * Answers whether the currently selected page, if any, advertises that it may finish early.
+ * Answers whether the currently selected page, if any, advertises that it may
+ * finish early.
*
* @return whether the page can finish early
* @since 3.1
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PerspContentProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PerspContentProvider.java
index 3c52e4247b8..3efe6d94e51 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PerspContentProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PerspContentProvider.java
@@ -17,11 +17,11 @@ import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.ui.IPerspectiveRegistry;
public class PerspContentProvider implements IStructuredContentProvider {
- @Override
+ @Override
public Object[] getElements(Object element) {
- if (element instanceof IPerspectiveRegistry) {
- return ((IPerspectiveRegistry) element).getPerspectives();
- }
- return null;
- }
+ if (element instanceof IPerspectiveRegistry) {
+ return ((IPerspectiveRegistry) element).getPerspectives();
+ }
+ return null;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PerspectivesPreferencePage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PerspectivesPreferencePage.java
index 85aaec61daf..94345e34154 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PerspectivesPreferencePage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PerspectivesPreferencePage.java
@@ -66,8 +66,7 @@ import org.eclipse.ui.internal.util.Util;
/**
* The Workbench / Perspectives preference page.
*/
-public class PerspectivesPreferencePage extends PreferencePage implements
- IWorkbenchPreferencePage {
+public class PerspectivesPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
private IWorkbench workbench;
private PerspectiveRegistry perspectiveRegistry;
@@ -107,15 +106,15 @@ public class PerspectivesPreferencePage extends PreferencePage implements
* <code>Comparator</code> to compare two perspective descriptors
*/
private Comparator<IPerspectiveDescriptor> comparator = new Comparator<IPerspectiveDescriptor>() {
- private Collator collator = Collator.getInstance();
+ private Collator collator = Collator.getInstance();
@Override
public int compare(IPerspectiveDescriptor ob1, IPerspectiveDescriptor ob2) {
IPerspectiveDescriptor d1 = ob1;
IPerspectiveDescriptor d2 = ob2;
- return collator.compare(d1.getLabel(), d2.getLabel());
- }
- };
+ return collator.compare(d1.getLabel(), d2.getLabel());
+ }
+ };
/**
* Creates the page's UI content.
@@ -136,11 +135,10 @@ public class PerspectivesPreferencePage extends PreferencePage implements
}
/**
- * Creates the composite which will contain all the preference controls for
- * this page.
+ * Creates the composite which will contain all the preference controls for this
+ * page.
*
- * @param parent
- * the parent composite
+ * @param parent the parent composite
* @return the composite for this page
*/
protected Composite createComposite(Composite parent) {
@@ -157,11 +155,10 @@ public class PerspectivesPreferencePage extends PreferencePage implements
}
/**
- * Create a composite that contains buttons for selecting the open
- * perspective mode.
+ * Create a composite that contains buttons for selecting the open perspective
+ * mode.
*
- * @param composite
- * the parent composite
+ * @param composite the parent composite
*/
protected void createOpenPerspButtonGroup(Composite composite) {
@@ -177,17 +174,17 @@ public class PerspectivesPreferencePage extends PreferencePage implements
openSameWindowButton = new Button(buttonComposite, SWT.RADIO);
openSameWindowButton.setText(OPM_SAME_WINDOW);
- openSameWindowButton
- .setSelection(IPreferenceConstants.OPM_ACTIVE_PAGE == openPerspMode);
+ openSameWindowButton.setSelection(IPreferenceConstants.OPM_ACTIVE_PAGE == openPerspMode);
openSameWindowButton.setFont(font);
- openSameWindowButton.addSelectionListener(widgetSelectedAdapter(e -> openPerspMode = IPreferenceConstants.OPM_ACTIVE_PAGE));
+ openSameWindowButton
+ .addSelectionListener(widgetSelectedAdapter(e -> openPerspMode = IPreferenceConstants.OPM_ACTIVE_PAGE));
openNewWindowButton = new Button(buttonComposite, SWT.RADIO);
openNewWindowButton.setText(OPM_NEW_WINDOW);
- openNewWindowButton
- .setSelection(IPreferenceConstants.OPM_NEW_WINDOW == openPerspMode);
+ openNewWindowButton.setSelection(IPreferenceConstants.OPM_NEW_WINDOW == openPerspMode);
openNewWindowButton.setFont(font);
- openNewWindowButton.addSelectionListener(widgetSelectedAdapter(e -> openPerspMode = IPreferenceConstants.OPM_NEW_WINDOW));
+ openNewWindowButton
+ .addSelectionListener(widgetSelectedAdapter(e -> openPerspMode = IPreferenceConstants.OPM_NEW_WINDOW));
}
@@ -195,8 +192,7 @@ public class PerspectivesPreferencePage extends PreferencePage implements
* Create a table of 3 buttons to enable the user to manage customized
* perspectives.
*
- * @param parent
- * the parent for the button parent
+ * @param parent the parent for the button parent
* @return Composite that the buttons are created in.
*/
protected Composite createCustomizePerspective(Composite parent) {
@@ -223,10 +219,9 @@ public class PerspectivesPreferencePage extends PreferencePage implements
label.setFont(font);
// Add perspectivesTable.
- perspectivesTable = new Table(perspectivesComponent, SWT.H_SCROLL | SWT.V_SCROLL
- | SWT.BORDER);
- perspectivesTable.addSelectionListener(widgetSelectedAdapter(e -> updateButtons()));
- perspectivesTable.setFont(font);
+ perspectivesTable = new Table(perspectivesComponent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ perspectivesTable.addSelectionListener(widgetSelectedAdapter(e -> updateButtons()));
+ perspectivesTable.setFont(font);
data = new GridData(GridData.FILL_BOTH);
data.grabExcessHorizontalSpace = true;
@@ -248,37 +243,32 @@ public class PerspectivesPreferencePage extends PreferencePage implements
data = new GridData(GridData.FILL_VERTICAL);
buttonBar.setLayoutData(data);
- //Add note label
+ // Add note label
String NOTE_LABEL = WorkbenchMessages.Preference_note;
String REVERT_NOTE = WorkbenchMessages.RevertPerspective_note;
- Composite noteComposite = createNoteComposite(font, parent,
- NOTE_LABEL, REVERT_NOTE);
- GridData noteData = new GridData();
- noteData.horizontalSpan = 2;
- noteComposite.setLayoutData(noteData);
+ Composite noteComposite = createNoteComposite(font, parent, NOTE_LABEL, REVERT_NOTE);
+ GridData noteData = new GridData();
+ noteData.horizontalSpan = 2;
+ noteComposite.setLayoutData(noteData);
return perspectivesComponent;
}
/**
* Creates a new vertical button with the given id.
* <p>
- * The default implementation of this framework method creates a standard
- * push button, registers for selection events including button presses and
- * help requests, and registers default buttons with its shell. The button
- * id is stored as the buttons client data.
+ * The default implementation of this framework method creates a standard push
+ * button, registers for selection events including button presses and help
+ * requests, and registers default buttons with its shell. The button id is
+ * stored as the buttons client data.
* </p>
*
- * @param parent
- * the parent composite
- * @param label
- * the label from the button
- * @param defaultButton
- * <code>true</code> if the button is to be the default button,
- * and <code>false</code> otherwise
+ * @param parent the parent composite
+ * @param label the label from the button
+ * @param defaultButton <code>true</code> if the button is to be the default
+ * button, and <code>false</code> otherwise
* @return Button The created button.
*/
- protected Button createVerticalButton(Composite parent, String label,
- boolean defaultButton) {
+ protected Button createVerticalButton(Composite parent, String label, boolean defaultButton) {
Button button = new Button(parent, SWT.PUSH);
button.setText(label);
@@ -301,8 +291,7 @@ public class PerspectivesPreferencePage extends PreferencePage implements
/**
* Creates and returns the vertical button bar.
*
- * @param parent
- * the parent composite to contain the button bar
+ * @param parent the parent composite to contain the button bar
* @return the button bar control
*/
protected Control createVerticalButtonBar(Composite parent) {
@@ -340,10 +329,8 @@ public class PerspectivesPreferencePage extends PreferencePage implements
@Override
public void init(IWorkbench aWorkbench) {
this.workbench = aWorkbench;
- this.perspectiveRegistry = (PerspectiveRegistry) workbench
- .getPerspectiveRegistry();
- IPreferenceStore store = WorkbenchPlugin.getDefault()
- .getPreferenceStore();
+ this.perspectiveRegistry = (PerspectiveRegistry) workbench.getPerspectiveRegistry();
+ IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
setPreferenceStore(store);
openPerspMode = store.getInt(IPreferenceConstants.OPEN_PERSP_MODE);
@@ -354,44 +341,41 @@ public class PerspectivesPreferencePage extends PreferencePage implements
*/
@Override
protected void performDefaults() {
- //Project perspective preferences
- IPreferenceStore store = WorkbenchPlugin.getDefault()
- .getPreferenceStore();
+ // Project perspective preferences
+ IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
- openPerspMode = store
- .getDefaultInt(IPreferenceConstants.OPEN_PERSP_MODE);
- openSameWindowButton
- .setSelection(IPreferenceConstants.OPM_ACTIVE_PAGE == openPerspMode);
- openNewWindowButton
- .setSelection(IPreferenceConstants.OPM_NEW_WINDOW == openPerspMode);
+ openPerspMode = store.getDefaultInt(IPreferenceConstants.OPEN_PERSP_MODE);
+ openSameWindowButton.setSelection(IPreferenceConstants.OPM_ACTIVE_PAGE == openPerspMode);
+ openNewWindowButton.setSelection(IPreferenceConstants.OPM_NEW_WINDOW == openPerspMode);
String currentDefault = perspectiveRegistry.getDefaultPerspective();
int index = indexOf(currentDefault);
- if (index >= 0){
+ if (index >= 0) {
defaultPerspectiveId = currentDefault;
updatePerspectivesTable();
perspectivesTable.setSelection(index);
}
- String newDefault = PrefUtil.getAPIPreferenceStore().getDefaultString(
- IWorkbenchPreferenceConstants.DEFAULT_PERSPECTIVE_ID);
+ String newDefault = PrefUtil.getAPIPreferenceStore()
+ .getDefaultString(IWorkbenchPreferenceConstants.DEFAULT_PERSPECTIVE_ID);
IPerspectiveDescriptor desc = null;
- if (newDefault != null) {
+ if (newDefault != null) {
desc = workbench.getPerspectiveRegistry().findPerspectiveWithId(newDefault);
}
- if (desc == null) {
- newDefault = workbench.getPerspectiveRegistry().getDefaultPerspective();
- }
+ if (desc == null) {
+ newDefault = workbench.getPerspectiveRegistry().getDefaultPerspective();
+ }
- defaultPerspectiveId = newDefault;
- updatePerspectivesTable();
+ defaultPerspectiveId = newDefault;
+ updatePerspectivesTable();
}
/**
* Look up the index of the perpective with the given if.
+ *
* @param perspectiveId or <code>null</code>
* @return int -1 if it cannot be found
*/
@@ -399,12 +383,11 @@ public class PerspectivesPreferencePage extends PreferencePage implements
if (perspectiveId == null) {
return -1;
}
- PerspectiveDescriptor[] descriptors =
- new PerspectiveDescriptor[perspectives.size()];
+ PerspectiveDescriptor[] descriptors = new PerspectiveDescriptor[perspectives.size()];
perspectives.toArray(descriptors);
for (int i = 0; i < descriptors.length; i++) {
PerspectiveDescriptor descriptor = descriptors[i];
- if(descriptor.getId().equals(perspectiveId)) {
+ if (descriptor.getId().equals(perspectiveId)) {
return i;
}
}
@@ -412,28 +395,24 @@ public class PerspectivesPreferencePage extends PreferencePage implements
}
/**
- * Return true if there are no open instances of the perspective. If there are open
- * instances of the perspective prompt the user and return true if the user answers "yes"
- * to the delete prompt.
+ * Return true if there are no open instances of the perspective. If there are
+ * open instances of the perspective prompt the user and return true if the user
+ * answers "yes" to the delete prompt.
*
* @return boolean <code>true</code> if it is OK to delete the perspective
- * either because there are no open instances or the user has
- * confirmed the deletion.
+ * either because there are no open instances or the user has confirmed
+ * the deletion.
*/
private boolean canDeletePerspective(IPerspectiveDescriptor desc) {
MApplication application = ((Workbench) workbench).getApplication();
EModelService modelService = application.getContext().get(EModelService.class);
- if (modelService.findElements(application, desc.getId(), MPerspective.class)
- .isEmpty())
+ if (modelService.findElements(application, desc.getId(), MPerspective.class).isEmpty())
return true;
- return MessageDialog.openQuestion(
- getShell(),
- WorkbenchMessages.PerspectivesPreference_perspectiveopen_title,
- NLS.bind(WorkbenchMessages.PerspectivesPreference_perspectiveopen_message,
- desc.getLabel()));
+ return MessageDialog.openQuestion(getShell(), WorkbenchMessages.PerspectivesPreference_perspectiveopen_title,
+ NLS.bind(WorkbenchMessages.PerspectivesPreference_perspectiveopen_message, desc.getLabel()));
}
/**
@@ -460,7 +439,7 @@ public class PerspectivesPreferencePage extends PreferencePage implements
perspectiveRegistry.deletePerspectives(perspToDelete);
}
- // Revert perspectives
+ // Revert perspectives
for (IPerspectiveDescriptor perspective : perspToRevert) {
perspectiveRegistry.revertPerspective(perspective);
}
@@ -493,8 +472,7 @@ public class PerspectivesPreferencePage extends PreferencePage implements
// Do enable.
if (desc != null) {
- revertButton.setEnabled(desc.isPredefined() && desc.hasCustomDefinition()
- && !perspToRevert.contains(desc));
+ revertButton.setEnabled(desc.isPredefined() && desc.hasCustomDefinition() && !perspToRevert.contains(desc));
deleteButton.setEnabled(!desc.isPredefined());
setDefaultButton.setEnabled(true);
} else {
@@ -508,45 +486,44 @@ public class PerspectivesPreferencePage extends PreferencePage implements
* Update the perspectivesTable.
*/
protected void updatePerspectivesTable() {
- // Populate the table with the items
+ // Populate the table with the items
perspectivesTable.removeAll();
for (int i = 0; i < perspectives.size(); i++) {
- PerspectiveDescriptor persp = (PerspectiveDescriptor) perspectives.get(i);
- newPerspectivesTableItem(persp, i, false);
- }
- }
+ PerspectiveDescriptor persp = (PerspectiveDescriptor) perspectives.get(i);
+ newPerspectivesTableItem(persp, i, false);
+ }
+ }
/**
- * Create a new tableItem using given perspective, and set image for the new item.
+ * Create a new tableItem using given perspective, and set image for the new
+ * item.
*/
- protected TableItem newPerspectivesTableItem(IPerspectiveDescriptor persp,
- int index, boolean selected) {
+ protected TableItem newPerspectivesTableItem(IPerspectiveDescriptor persp, int index, boolean selected) {
- ImageDescriptor image = persp.getImageDescriptor();
+ ImageDescriptor image = persp.getImageDescriptor();
- TableItem item = new TableItem(perspectivesTable, SWT.NULL, index);
- if (image != null) {
- Descriptors.setImage(item, image);
- }
- String label=persp.getLabel();
- if (persp.getId().equals(defaultPerspectiveId)){
- label = NLS.bind(WorkbenchMessages.PerspectivesPreference_defaultLabel, label );
+ TableItem item = new TableItem(perspectivesTable, SWT.NULL, index);
+ if (image != null) {
+ Descriptors.setImage(item, image);
+ }
+ String label = persp.getLabel();
+ if (persp.getId().equals(defaultPerspectiveId)) {
+ label = NLS.bind(WorkbenchMessages.PerspectivesPreference_defaultLabel, label);
}
- item.setText(label);
- item.setData(persp);
- if (selected) {
- perspectivesTable.setSelection(index);
- }
+ item.setText(label);
+ item.setData(persp);
+ if (selected) {
+ perspectivesTable.setSelection(index);
+ }
- return item;
- }
+ return item;
+ }
- /**
+ /**
* Notifies that this page's button with the given id has been pressed.
*
- * @param button
- * the button that was pressed
+ * @param button the button that was pressed
*/
protected void verticalButtonPressed(Widget button) {
// Get selection.
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PreferenceBoldLabelProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PreferenceBoldLabelProvider.java
index 31b3c3becf2..c4dca4b2f36 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PreferenceBoldLabelProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PreferenceBoldLabelProvider.java
@@ -31,13 +31,12 @@ public class PreferenceBoldLabelProvider extends PreferenceLabelProvider impleme
PreferenceBoldLabelProvider(FilteredTree filterTree) {
this.filterTree = filterTree;
- this.filterForBoldElements= filterTree.getPatternFilter();
+ this.filterForBoldElements = filterTree.getPatternFilter();
}
@Override
public Font getFont(Object element) {
- return FilteredTree.getBoldFont(element, filterTree,
- filterForBoldElements);
+ return FilteredTree.getBoldFont(element, filterTree, filterForBoldElements);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PreferenceHistoryEntry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PreferenceHistoryEntry.java
index 5b632ef45dc..870de0cdb17 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PreferenceHistoryEntry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PreferenceHistoryEntry.java
@@ -28,18 +28,19 @@ final class PreferenceHistoryEntry {
/**
* Creates a new entry.
*
- * @param id the preference page id
- * @param label the label to display, usually the preference page label
+ * @param id the preference page id
+ * @param label the label to display, usually the preference page label
* @param argument an argument to pass to the preference page, may be
- * <code>null</code>
+ * <code>null</code>
*/
public PreferenceHistoryEntry(String id, String label, Object argument) {
Assert.isLegal(id != null);
Assert.isLegal(label != null);
- this.id= id;
- this.label= label;
- this.argument= argument;
+ this.id = id;
+ this.label = label;
+ this.argument = argument;
}
+
/**
* Returns the preference page id.
*
@@ -48,6 +49,7 @@ final class PreferenceHistoryEntry {
public String getId() {
return id;
}
+
/**
* Returns the preference page argument.
*
@@ -56,6 +58,7 @@ final class PreferenceHistoryEntry {
public Object getArgument() {
return argument;
}
+
/**
* Returns the preference page label.
*
@@ -76,17 +79,16 @@ final class PreferenceHistoryEntry {
@Override
public boolean equals(Object obj) {
if (obj instanceof PreferenceHistoryEntry) {
- PreferenceHistoryEntry other= (PreferenceHistoryEntry) obj;
+ PreferenceHistoryEntry other = (PreferenceHistoryEntry) obj;
return id.equals(other.id)
- && (argument == null && other.argument == null
- || argument.equals(other.argument));
+ && (argument == null && other.argument == null || argument.equals(other.argument));
}
return super.equals(obj);
}
@Override
public int hashCode() {
- int argHash= argument == null ? 0 : argument.hashCode() & 0x0000ffff;
+ int argHash = argument == null ? 0 : argument.hashCode() & 0x0000ffff;
return id.hashCode() << 16 | argHash;
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PreferenceNodeFilter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PreferenceNodeFilter.java
index aa4ec938892..b30673fc145 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PreferenceNodeFilter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PreferenceNodeFilter.java
@@ -20,18 +20,16 @@ import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
/**
- * The PreferenceNodeFilter is a filter that only matches
- * a set of ids.
+ * The PreferenceNodeFilter is a filter that only matches a set of ids.
*/
public class PreferenceNodeFilter extends ViewerFilter {
Collection ids = new HashSet();
/**
- * Create a new instance of the receiver on a
- * list of filteredIds.
- * @param filteredIds The collection of ids that
- * will be shown.
+ * Create a new instance of the receiver on a list of filteredIds.
+ *
+ * @param filteredIds The collection of ids that will be shown.
*/
public PreferenceNodeFilter(String[] filteredIds) {
super();
@@ -46,19 +44,19 @@ public class PreferenceNodeFilter extends ViewerFilter {
}
/**
- * Check to see if the node or any of its children
- * have an id in the ids.
+ * Check to see if the node or any of its children have an id in the ids.
+ *
* @param node WorkbenchPreferenceNode
- * @return boolean <code>true</code> if node or oe of its children
- * has an id in the ids.
+ * @return boolean <code>true</code> if node or oe of its children has an id in
+ * the ids.
*/
private boolean checkNodeAndChildren(IPreferenceNode node) {
- if(ids.contains(node.getId())) {
+ if (ids.contains(node.getId())) {
return true;
}
for (IPreferenceNode subNode : node.getSubNodes()) {
- if(checkNodeAndChildren(subNode)) {
+ if (checkNodeAndChildren(subNode)) {
return true;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PreferencePageHistory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PreferencePageHistory.java
index 83cc1f0b09f..236a75f0685 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PreferencePageHistory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PreferencePageHistory.java
@@ -54,8 +54,8 @@ class PreferencePageHistory {
private ToolBarManager historyToolbar;
/**
- * A list of preference history domain elements that stores the history of
- * the visited preference pages.
+ * A list of preference history domain elements that stores the history of the
+ * visited preference pages.
*/
private List history = new ArrayList();
@@ -78,8 +78,7 @@ class PreferencePageHistory {
/**
* Creates a new history for the given dialog.
*
- * @param dialog
- * the preference dialog to create a history for
+ * @param dialog the preference dialog to create a history for
*/
public PreferencePageHistory(FilteredPreferenceDialog dialog) {
this.dialog = dialog;
@@ -89,11 +88,9 @@ class PreferencePageHistory {
* Returns the preference page path (for now: its id) for the history at
* <code>index</code>.
*
- * @param index
- * the index into the history
- * @return the preference page path at <code>index</code> or
- * <code>null</code> if <code>index</code> is not a valid
- * history index
+ * @param index the index into the history
+ * @return the preference page path at <code>index</code> or <code>null</code>
+ * if <code>index</code> is not a valid history index
*/
private PreferenceHistoryEntry getHistoryEntry(int index) {
if (index >= 0 && index < history.size()) {
@@ -105,8 +102,7 @@ class PreferencePageHistory {
/**
* Adds the preference page path and its label to the page history.
*
- * @param entry
- * the preference page history entry
+ * @param entry the preference page history entry
*/
public void addHistoryEntry(PreferenceHistoryEntry entry) {
if (historyIndex == -1 || !history.get(historyIndex).equals(entry)) {
@@ -118,11 +114,10 @@ class PreferencePageHistory {
}
/**
- * Sets the current page to be the one corresponding to the given index in
- * the page history.
+ * Sets the current page to be the one corresponding to the given index in the
+ * page history.
*
- * @param index
- * the index into the page history
+ * @param index the index into the page history
*/
private void jumpToHistory(int index) {
if (index >= 0 && index < history.size()) {
@@ -151,15 +146,13 @@ class PreferencePageHistory {
* @param manager
* @return the control of the history toolbar
*/
- public ToolBar createHistoryControls(ToolBar historyBar,
- ToolBarManager manager) {
+ public ToolBar createHistoryControls(ToolBar historyBar, ToolBarManager manager) {
historyToolbar = manager;
/**
* Superclass of the two for-/backward actions for the history.
*/
- abstract class HistoryNavigationAction extends Action implements
- IMenuCreator {
+ abstract class HistoryNavigationAction extends Action implements IMenuCreator {
private Menu lastMenu;
protected static final int MAX_ENTRIES = 5;
@@ -206,8 +199,8 @@ class PreferencePageHistory {
}
/**
- * Menu entry for the toolbar dropdowns. Instances are direct-jump
- * entries in the navigation history.
+ * Menu entry for the toolbar dropdowns. Instances are direct-jump entries in
+ * the navigation history.
*/
class HistoryItemAction extends Action {
@@ -234,7 +227,8 @@ class PreferencePageHistory {
public boolean isEnabled() {
boolean enabled = historyIndex > 0;
if (enabled) {
- setToolTipText(NLS.bind(WorkbenchMessages.NavigationHistoryAction_backward_toolTipName,getHistoryEntry(historyIndex - 1).getLabel() ));
+ setToolTipText(NLS.bind(WorkbenchMessages.NavigationHistoryAction_backward_toolTipName,
+ getHistoryEntry(historyIndex - 1).getLabel()));
} else {
setToolTipText(WorkbenchMessages.NavigationHistoryAction_backward_toolTip);
}
@@ -245,21 +239,17 @@ class PreferencePageHistory {
protected void createEntries(Menu menu) {
int limit = Math.max(0, historyIndex - MAX_ENTRIES);
for (int i = historyIndex - 1; i >= limit; i--) {
- IAction action = new HistoryItemAction(i,
- getHistoryEntry(i).getLabel());
+ IAction action = new HistoryItemAction(i, getHistoryEntry(i).getLabel());
addActionToMenu(menu, action);
}
}
};
backward.setText(WorkbenchMessages.NavigationHistoryAction_backward_text);
- backward
- .setActionDefinitionId(IWorkbenchCommandConstants.NAVIGATE_BACKWARD_HISTORY);
- backward.setImageDescriptor(WorkbenchPlugin.getDefault()
- .getSharedImages().getImageDescriptor(
- ISharedImages.IMG_TOOL_BACK));
- backward.setDisabledImageDescriptor(WorkbenchPlugin.getDefault()
- .getSharedImages().getImageDescriptor(
- ISharedImages.IMG_TOOL_BACK_DISABLED));
+ backward.setActionDefinitionId(IWorkbenchCommandConstants.NAVIGATE_BACKWARD_HISTORY);
+ backward.setImageDescriptor(
+ WorkbenchPlugin.getDefault().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_BACK));
+ backward.setDisabledImageDescriptor(WorkbenchPlugin.getDefault().getSharedImages()
+ .getImageDescriptor(ISharedImages.IMG_TOOL_BACK_DISABLED));
registerKeybindings(backward);
historyToolbar.add(backward);
@@ -273,7 +263,8 @@ class PreferencePageHistory {
public boolean isEnabled() {
boolean enabled = historyIndex < history.size() - 1;
if (enabled) {
- setToolTipText(NLS.bind(WorkbenchMessages.NavigationHistoryAction_forward_toolTipName, getHistoryEntry(historyIndex + 1).getLabel() ));
+ setToolTipText(NLS.bind(WorkbenchMessages.NavigationHistoryAction_forward_toolTipName,
+ getHistoryEntry(historyIndex + 1).getLabel()));
} else {
setToolTipText(WorkbenchMessages.NavigationHistoryAction_forward_toolTip);
}
@@ -282,23 +273,19 @@ class PreferencePageHistory {
@Override
protected void createEntries(Menu menu) {
- int limit = Math.min(history.size(), historyIndex + MAX_ENTRIES
- + 1);
+ int limit = Math.min(history.size(), historyIndex + MAX_ENTRIES + 1);
for (int i = historyIndex + 1; i < limit; i++) {
- IAction action = new HistoryItemAction(i,
- getHistoryEntry(i).getLabel());
+ IAction action = new HistoryItemAction(i, getHistoryEntry(i).getLabel());
addActionToMenu(menu, action);
}
}
};
forward.setText(WorkbenchMessages.NavigationHistoryAction_forward_text);
forward.setActionDefinitionId(IWorkbenchCommandConstants.NAVIGATE_FORWARD_HISTORY);
- forward.setImageDescriptor(WorkbenchPlugin.getDefault()
- .getSharedImages().getImageDescriptor(
- ISharedImages.IMG_TOOL_FORWARD));
- forward.setDisabledImageDescriptor(WorkbenchPlugin.getDefault()
- .getSharedImages().getImageDescriptor(
- ISharedImages.IMG_TOOL_FORWARD_DISABLED));
+ forward.setImageDescriptor(
+ WorkbenchPlugin.getDefault().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD));
+ forward.setDisabledImageDescriptor(WorkbenchPlugin.getDefault().getSharedImages()
+ .getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD_DISABLED));
registerKeybindings(forward);
historyToolbar.add(forward);
@@ -308,14 +295,12 @@ class PreferencePageHistory {
/**
* Registers the given action with the workbench command support.
*
- * @param action
- * the action to register.
+ * @param action the action to register.
*/
private void registerKeybindings(IAction action) {
final IHandler handler = new ActionHandler(action);
final IHandlerService handlerService = PlatformUI.getWorkbench().getService(IHandlerService.class);
- final IHandlerActivation activation = handlerService.activateHandler(
- action.getActionDefinitionId(), handler,
+ final IHandlerActivation activation = handlerService.activateHandler(action.getActionDefinitionId(), handler,
new ActiveShellExpression(dialog.getShell()));
activations.add(activation);
}
@@ -328,8 +313,7 @@ class PreferencePageHistory {
final IHandlerService handlerService = PlatformUI.getWorkbench().getService(IHandlerService.class);
final Iterator iterator = activations.iterator();
while (iterator.hasNext()) {
- handlerService.deactivateHandler((IHandlerActivation) iterator
- .next());
+ handlerService.deactivateHandler((IHandlerActivation) iterator.next());
}
activations.clear();
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PreferencePatternFilter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PreferencePatternFilter.java
index 17609776bc0..5bad9b6085a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PreferencePatternFilter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PreferencePatternFilter.java
@@ -49,9 +49,9 @@ public class PreferencePatternFilter extends PatternFilter {
}
/*
- * Return true if the given Object matches with any possible keywords that
- * have been provided. Currently this is only applicable for preference and
- * property pages.
+ * Return true if the given Object matches with any possible keywords that have
+ * been provided. Currently this is only applicable for preference and property
+ * pages.
*/
private String[] getKeywords(Object element) {
if (element instanceof WorkbenchPreferenceExtensionNode) {
@@ -74,9 +74,8 @@ public class PreferencePatternFilter extends PatternFilter {
@Override
public boolean isElementVisible(Viewer viewer, Object element) {
- if (WorkbenchActivityHelper.restrictUseOf(
- element))
- return false;
+ if (WorkbenchActivityHelper.restrictUseOf(element))
+ return false;
// Preference nodes are not differentiated based on category since
// categories are selectable nodes.
@@ -84,8 +83,7 @@ public class PreferencePatternFilter extends PatternFilter {
return true;
}
- ITreeContentProvider contentProvider = (ITreeContentProvider) ((TreeViewer) viewer)
- .getContentProvider();
+ ITreeContentProvider contentProvider = (ITreeContentProvider) ((TreeViewer) viewer).getContentProvider();
IPreferenceNode node = (IPreferenceNode) element;
Object[] children = contentProvider.getChildren(node);
// Will return true if any subnode of the element matches the search
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PropertyDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PropertyDialog.java
index 9233ace387d..7406fba4ca0 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PropertyDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PropertyDialog.java
@@ -45,16 +45,12 @@ public class PropertyDialog extends FilteredPreferenceDialog {
/**
* Create a new property dialog.
*
- * @param shell
- * the parent shell
- * @param propertyPageId
- * the property page id
- * @param element
- * the adaptable element
+ * @param shell the parent shell
+ * @param propertyPageId the property page id
+ * @param element the adaptable element
* @return the property dialog
*/
- public static PropertyDialog createDialogOn(Shell shell,
- final String propertyPageId, Object element) {
+ public static PropertyDialog createDialogOn(Shell shell, final String propertyPageId, Object element) {
PropertyPageManager pageManager = new PropertyPageManager();
String title = "";//$NON-NLS-1$
@@ -64,23 +60,17 @@ public class PropertyDialog extends FilteredPreferenceDialog {
}
// load pages for the selection
// fill the manager with contributions from the matching contributors
- PropertyPageContributorManager.getManager().contribute(pageManager,
- element);
+ PropertyPageContributorManager.getManager().contribute(pageManager, element);
// testing if there are pages in the manager
- Iterator pages = pageManager.getElements(PreferenceManager.PRE_ORDER)
- .iterator();
+ Iterator pages = pageManager.getElements(PreferenceManager.PRE_ORDER).iterator();
String name = getName(element);
if (!pages.hasNext()) {
- MessageDialog.openInformation(shell,
- WorkbenchMessages.PropertyDialog_messageTitle, NLS.bind(
- WorkbenchMessages.PropertyDialog_noPropertyMessage,
- name));
+ MessageDialog.openInformation(shell, WorkbenchMessages.PropertyDialog_messageTitle,
+ NLS.bind(WorkbenchMessages.PropertyDialog_noPropertyMessage, name));
return null;
}
- title = NLS
- .bind(WorkbenchMessages.PropertyDialog_propertyMessage, name);
- PropertyDialog propertyDialog = new PropertyDialog(shell, pageManager,
- new StructuredSelection(element));
+ title = NLS.bind(WorkbenchMessages.PropertyDialog_propertyMessage, name);
+ PropertyDialog propertyDialog = new PropertyDialog(shell, pageManager, new StructuredSelection(element));
if (propertyPageId != null) {
propertyDialog.setSelectedNode(propertyPageId);
@@ -88,8 +78,7 @@ public class PropertyDialog extends FilteredPreferenceDialog {
propertyDialog.create();
propertyDialog.getShell().setText(title);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(
- propertyDialog.getShell(),
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(propertyDialog.getShell(),
IWorkbenchHelpContextIds.PROPERTY_DIALOG);
return propertyDialog;
@@ -104,8 +93,7 @@ public class PropertyDialog extends FilteredPreferenceDialog {
/**
* Returns the name of the given element(s). Prints at most 3 names.
*
- * @param element
- * the element / IStructuredSelection
+ * @param element the element / IStructuredSelection
* @return the name of the element
*/
private static String getName(Object element) {
@@ -139,8 +127,7 @@ public class PropertyDialog extends FilteredPreferenceDialog {
* @param mng
* @param selection
*/
- public PropertyDialog(Shell parentShell, PreferenceManager mng,
- ISelection selection) {
+ public PropertyDialog(Shell parentShell, PreferenceManager mng, ISelection selection) {
super(parentShell, mng);
setSelection(selection);
}
@@ -157,8 +144,7 @@ public class PropertyDialog extends FilteredPreferenceDialog {
/**
* Sets the selection that will be used to determine target object.
*
- * @param newSelection
- * the new selection
+ * @param newSelection the new selection
*/
public void setSelection(ISelection newSelection) {
selection = newSelection;
@@ -192,6 +178,4 @@ public class PropertyDialog extends FilteredPreferenceDialog {
return IContributionService.TYPE_PROPERTY;
}
-
-
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PropertyPageContributorManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PropertyPageContributorManager.java
index e5a71abd455..bf84ea66316 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PropertyPageContributorManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PropertyPageContributorManager.java
@@ -68,12 +68,12 @@ public class PropertyPageContributorManager extends ObjectContributorManager {
/**
* Given the object class, this method will find all the registered matching
- * contributors and sequentially invoke them to contribute to the property
- * page manager. Matching algorithm will also check subclasses and
- * implemented interfaces.
+ * contributors and sequentially invoke them to contribute to the property page
+ * manager. Matching algorithm will also check subclasses and implemented
+ * interfaces.
*
- * If object is an IStructuredSelection then attempt to match all the
- * contained objects.
+ * If object is an IStructuredSelection then attempt to match all the contained
+ * objects.
*
* @param manager
* @param object
@@ -108,8 +108,7 @@ public class PropertyPageContributorManager extends ObjectContributorManager {
// Allow each contributor to add its page to the manager.
boolean actualContributions = false;
while (resultIterator.hasNext()) {
- CategorizedPageNode next = (CategorizedPageNode) resultIterator
- .next();
+ CategorizedPageNode next = (CategorizedPageNode) resultIterator.next();
IPropertyPageContributor ppcont = next.contributor;
if (!ppcont.isApplicableTo(object)) {
continue;
@@ -125,8 +124,7 @@ public class PropertyPageContributorManager extends ObjectContributorManager {
if (actualContributions) {
resultIterator = catNodes.iterator();
while (resultIterator.hasNext()) {
- CategorizedPageNode next = (CategorizedPageNode) resultIterator
- .next();
+ CategorizedPageNode next = (CategorizedPageNode) resultIterator.next();
PreferenceNode child = (PreferenceNode) catPageNodeToPages.get(next);
if (child == null)
continue;
@@ -146,6 +144,7 @@ public class PropertyPageContributorManager extends ObjectContributorManager {
/**
* Build the list of nodes to be sorted.
+ *
* @param nodes
* @return List of CategorizedPageNode
*/
@@ -153,21 +152,21 @@ public class PropertyPageContributorManager extends ObjectContributorManager {
Hashtable mapping = new Hashtable();
Iterator nodesIterator = nodes.iterator();
- while(nodesIterator.hasNext()){
+ while (nodesIterator.hasNext()) {
RegistryPageContributor page = (RegistryPageContributor) nodesIterator.next();
- mapping.put(page.getPageId(),new CategorizedPageNode(page));
+ mapping.put(page.getPageId(), new CategorizedPageNode(page));
}
Iterator values = mapping.values().iterator();
List returnValue = new ArrayList();
- while(values.hasNext()){
+ while (values.hasNext()) {
CategorizedPageNode next = (CategorizedPageNode) values.next();
returnValue.add(next);
- if(next.contributor.getCategory() == null) {
+ if (next.contributor.getCategory() == null) {
continue;
}
Object parent = mapping.get(next.contributor.getCategory());
- if(parent != null) {
+ if (parent != null) {
next.setParent((CategorizedPageNode) parent);
}
}
@@ -175,8 +174,9 @@ public class PropertyPageContributorManager extends ObjectContributorManager {
}
/**
- * Ideally, shared instance should not be used and manager should be located
- * in the workbench class.
+ * Ideally, shared instance should not be used and manager should be located in
+ * the workbench class.
+ *
* @return PropertyPageContributorManager
*/
public static PropertyPageContributorManager getManager() {
@@ -190,21 +190,21 @@ public class PropertyPageContributorManager extends ObjectContributorManager {
* Loads property page contributors from the registry.
*/
private void loadContributors() {
- PropertyPagesRegistryReader reader = new PropertyPagesRegistryReader(
- this);
+ PropertyPagesRegistryReader reader = new PropertyPagesRegistryReader(this);
reader.registerPropertyPages(Platform.getExtensionRegistry());
}
- @Override
+ @Override
public void addExtension(IExtensionTracker tracker, IExtension extension) {
for (IConfigurationElement addedElement : extension.getConfigurationElements()) {
- PropertyPagesRegistryReader reader = new PropertyPagesRegistryReader(this);
- reader.readElement(addedElement);
- }
- }
+ PropertyPagesRegistryReader reader = new PropertyPagesRegistryReader(this);
+ reader.readElement(addedElement);
+ }
+ }
/**
* Return the contributors for element filters on the enablement.
+ *
* @param element
* @return Collection of PropertyPageContribution
*/
@@ -215,7 +215,7 @@ public class PropertyPageContributorManager extends ObjectContributorManager {
Collection result = new ArrayList();
for (Iterator iter = contributors.iterator(); iter.hasNext();) {
RegistryPageContributor contributor = (RegistryPageContributor) iter.next();
- if(contributor.isApplicableTo(element))
+ if (contributor.isApplicableTo(element))
result.add(contributor);
}
@@ -244,8 +244,7 @@ public class PropertyPageContributorManager extends ObjectContributorManager {
// only add contributors which can handle multi selection
it = result.iterator();
while (it.hasNext()) {
- RegistryPageContributor contrib = (RegistryPageContributor) it
- .next();
+ RegistryPageContributor contrib = (RegistryPageContributor) it.next();
if (!contrib.supportsMultipleSelection())
it.remove();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PropertyPageManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PropertyPageManager.java
index 110019f0142..5d97933f8d3 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PropertyPageManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PropertyPageManager.java
@@ -20,10 +20,9 @@ import org.eclipse.ui.internal.WorkbenchPlugin;
import org.eclipse.ui.internal.preferences.WorkbenchPreferenceExpressionNode;
/**
- * This class is created to avoid mentioning preferences
- * in this context. Ideally, JFace preference classes should be
- * renamed into something more generic (for example,
- * 'TreeNavigationDialog').
+ * This class is created to avoid mentioning preferences in this context.
+ * Ideally, JFace preference classes should be renamed into something more
+ * generic (for example, 'TreeNavigationDialog').
*/
public class PropertyPageManager extends PreferenceManager {
@@ -31,8 +30,7 @@ public class PropertyPageManager extends PreferenceManager {
* The constructor.
*/
public PropertyPageManager() {
- super(WorkbenchPlugin.PREFERENCE_PAGE_CATEGORY_SEPARATOR,
- new WorkbenchPreferenceExpressionNode("")); //$NON-NLS-1$
+ super(WorkbenchPlugin.PREFERENCE_PAGE_CATEGORY_SEPARATOR, new WorkbenchPreferenceExpressionNode("")); //$NON-NLS-1$
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PropertyPageNode.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PropertyPageNode.java
index 06766238fcc..ffc0d665a1f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PropertyPageNode.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PropertyPageNode.java
@@ -25,82 +25,82 @@ import org.eclipse.ui.statushandlers.StatusManager;
/**
* Property page node allows us to achieve presence in the property page dialog
- * without loading the page itself, thus loading the contributing plugin.
- * Only when the user selects the page will it be loaded.
+ * without loading the page itself, thus loading the contributing plugin. Only
+ * when the user selects the page will it be loaded.
*/
public class PropertyPageNode extends WorkbenchPreferenceExtensionNode {
- private RegistryPageContributor contributor;
+ private RegistryPageContributor contributor;
private IPreferencePage page;
- private Image icon;
+ private Image icon;
- private Object element;
+ private Object element;
- /**
- * Create a new instance of the receiver.
- * @param contributor
- * @param element
- */
- public PropertyPageNode(RegistryPageContributor contributor,
- Object element) {
- super(contributor.getPageId(), contributor.getConfigurationElement());
- this.contributor = contributor;
- this.element = element;
- }
+ /**
+ * Create a new instance of the receiver.
+ *
+ * @param contributor
+ * @param element
+ */
+ public PropertyPageNode(RegistryPageContributor contributor, Object element) {
+ super(contributor.getPageId(), contributor.getConfigurationElement());
+ this.contributor = contributor;
+ this.element = element;
+ }
- /**
- * Creates the preference page this node stands for. If the page is null,
- * it will be created by loading the class. If loading fails,
- * empty filler page will be created instead.
- */
- @Override
+ /**
+ * Creates the preference page this node stands for. If the page is null, it
+ * will be created by loading the class. If loading fails, empty filler page
+ * will be created instead.
+ */
+ @Override
public void createPage() {
- try {
- page = contributor.createPage(element);
- } catch (CoreException e) {
- // Just inform the user about the error. The details are
- // written to the log by now.
- IStatus errStatus = StatusUtil.newStatus(e.getStatus(), WorkbenchMessages.PropertyPageNode_errorMessage);
- StatusManager.getManager().handle(errStatus, StatusManager.SHOW);
- page = new EmptyPropertyPage();
- }
- setPage(page);
- }
+ try {
+ page = contributor.createPage(element);
+ } catch (CoreException e) {
+ // Just inform the user about the error. The details are
+ // written to the log by now.
+ IStatus errStatus = StatusUtil.newStatus(e.getStatus(), WorkbenchMessages.PropertyPageNode_errorMessage);
+ StatusManager.getManager().handle(errStatus, StatusManager.SHOW);
+ page = new EmptyPropertyPage();
+ }
+ setPage(page);
+ }
- @Override
+ @Override
public void disposeResources() {
- if (page != null) {
- page.dispose();
- page = null;
- }
- if (icon != null) {
- icon.dispose();
- icon = null;
- }
- }
+ if (page != null) {
+ page.dispose();
+ page = null;
+ }
+ if (icon != null) {
+ icon.dispose();
+ icon = null;
+ }
+ }
- /**
- * Returns page icon, if defined.
- */
- @Override
+ /**
+ * Returns page icon, if defined.
+ */
+ @Override
public Image getLabelImage() {
- if (icon == null) {
- ImageDescriptor desc = contributor.getPageIcon();
- if (desc != null) {
- icon = desc.createImage();
- }
- }
- return icon;
- }
+ if (icon == null) {
+ ImageDescriptor desc = contributor.getPageIcon();
+ if (desc != null) {
+ icon = desc.createImage();
+ }
+ }
+ return icon;
+ }
- /**
- * Returns page label as defined in the registry.
- */
- @Override
+ /**
+ * Returns page label as defined in the registry.
+ */
+ @Override
public String getLabelText() {
- return contributor.getPageName();
- }
+ return contributor.getPageName();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/RegistryPageContributor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/RegistryPageContributor.java
index 034e51295e8..5c3289aeb91 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/RegistryPageContributor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/RegistryPageContributor.java
@@ -58,10 +58,7 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
* danger of premature loading of plugins.
*/
-public class RegistryPageContributor implements IPropertyPageContributor,
- IAdaptable,
- IPluginContribution
- {
+public class RegistryPageContributor implements IPropertyPageContributor, IAdaptable, IPluginContribution {
private static final String CHILD_ENABLED_WHEN = "enabledWhen"; //$NON-NLS-1$
private String pageId;
@@ -88,27 +85,20 @@ public class RegistryPageContributor implements IPropertyPageContributor,
/**
* PropertyPageContributor constructor.
*
- * @param pageId
- * the id
- * @param element
- * the element
+ * @param pageId the id
+ * @param element the element
*/
public RegistryPageContributor(String pageId, IConfigurationElement element) {
this.pageId = pageId;
this.pageElement = element;
- adaptable = Boolean
- .valueOf(
- pageElement
- .getAttribute(PropertyPagesRegistryReader.ATT_ADAPTABLE))
- .booleanValue();
+ adaptable = Boolean.valueOf(pageElement.getAttribute(PropertyPagesRegistryReader.ATT_ADAPTABLE)).booleanValue();
supportsMultiSelect = PropertyPagesRegistryReader.ATT_SELECTION_FILTER_MULTI
.equals(pageElement.getAttribute(PropertyPagesRegistryReader.ATT_SELECTION_FILTER));
initializeEnablement(element);
}
@Override
- public PreferenceNode contributePropertyPage(PropertyPageManager mng,
- Object element) {
+ public PreferenceNode contributePropertyPage(PropertyPageManager mng, Object element) {
PropertyPageNode node = new PropertyPageNode(this, element);
if (IWorkbenchConstants.WORKBENCH_PROPERTIES_PAGE_INFO.equals(node.getId()))
node.setPriority(-1);
@@ -118,17 +108,13 @@ public class RegistryPageContributor implements IPropertyPageContributor,
/**
* Creates the page based on the information in the configuration element.
*
- * @param element
- * the adaptable element
+ * @param element the adaptable element
* @return the property page
- * @throws CoreException
- * thrown if there is a problem creating the apge
+ * @throws CoreException thrown if there is a problem creating the apge
*/
- public IPreferencePage createPage(Object element)
- throws CoreException {
+ public IPreferencePage createPage(Object element) throws CoreException {
IPreferencePage ppage = null;
- ppage = (IPreferencePage) WorkbenchPlugin.createExtension(
- pageElement, IWorkbenchRegistryConstants.ATT_CLASS);
+ ppage = (IPreferencePage) WorkbenchPlugin.createExtension(pageElement, IWorkbenchRegistryConstants.ATT_CLASS);
ppage.setTitle(getPageName());
@@ -141,26 +127,20 @@ public class RegistryPageContributor implements IPropertyPageContributor,
adapted = getAdaptedElement(adapted);
if (adapted == null) {
String message = "Error adapting selection to Property page " + pageId + " is being ignored"; //$NON-NLS-1$ //$NON-NLS-2$
- throw new CoreException(new Status(IStatus.ERROR,
- WorkbenchPlugin.PI_WORKBENCH, IStatus.ERROR,
- message, null));
+ throw new CoreException(
+ new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, IStatus.ERROR, message, null));
}
}
- adapt[i] = (IAdaptable) ((adapted instanceof IAdaptable) ? adapted
- : new AdaptableForwarder(adapted));
+ adapt[i] = (IAdaptable) ((adapted instanceof IAdaptable) ? adapted : new AdaptableForwarder(adapted));
}
if (supportsMultiSelect) {
if ((ppage instanceof IWorkbenchPropertyPageMulti))
((IWorkbenchPropertyPageMulti) ppage).setElements(adapt);
else
- throw new CoreException(
- new Status(
- IStatus.ERROR,
- WorkbenchPlugin.PI_WORKBENCH,
- IStatus.ERROR,
- "Property page must implement IWorkbenchPropertyPageMulti: " + getPageName(), //$NON-NLS-1$
- null));
+ throw new CoreException(new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, IStatus.ERROR,
+ "Property page must implement IWorkbenchPropertyPageMulti: " + getPageName(), //$NON-NLS-1$
+ null));
} else
((IWorkbenchPropertyPage) ppage).setElement(adapt[0]);
@@ -171,12 +151,10 @@ public class RegistryPageContributor implements IPropertyPageContributor,
* Find an adapted element from the receiver.
*
* @param element
- * @return the adapted element or <code>null</code> if it could not be
- * found.
+ * @return the adapted element or <code>null</code> if it could not be found.
*/
private Object getAdaptedElement(Object element) {
- Object adapted = LegacyResourceSupport.getAdapter(element,
- getObjectClass());
+ Object adapted = LegacyResourceSupport.getAdapter(element, getObjectClass());
if (adapted != null)
return adapted;
@@ -189,8 +167,7 @@ public class RegistryPageContributor implements IPropertyPageContributor,
* @return the object class name
*/
public String getObjectClass() {
- return pageElement
- .getAttribute(PropertyPagesRegistryReader.ATT_OBJECTCLASS);
+ return pageElement.getAttribute(PropertyPagesRegistryReader.ATT_OBJECTCLASS);
}
/**
@@ -199,12 +176,10 @@ public class RegistryPageContributor implements IPropertyPageContributor,
* @return the page icon
*/
public ImageDescriptor getPageIcon() {
- String iconName = pageElement
- .getAttribute(IWorkbenchRegistryConstants.ATT_ICON);
+ String iconName = pageElement.getAttribute(IWorkbenchRegistryConstants.ATT_ICON);
if (iconName == null)
return null;
- return AbstractUIPlugin.imageDescriptorFromPlugin(pageElement
- .getNamespaceIdentifier(), iconName);
+ return AbstractUIPlugin.imageDescriptorFromPlugin(pageElement.getNamespaceIdentifier(), iconName);
}
/**
@@ -227,8 +202,8 @@ public class RegistryPageContributor implements IPropertyPageContributor,
}
/**
- * Calculate whether the Property page is applicable to the current
- * selection. Checks:
+ * Calculate whether the Property page is applicable to the current selection.
+ * Checks:
* <ul>
* <li>multiSelect</li>
* <li>enabledWhen enablement expression/li>
@@ -252,8 +227,7 @@ public class RegistryPageContributor implements IPropertyPageContributor,
return false;
// Test name filter
- String nameFilter = pageElement
- .getAttribute(PropertyPagesRegistryReader.ATT_NAME_FILTER);
+ String nameFilter = pageElement.getAttribute(PropertyPagesRegistryReader.ATT_NAME_FILTER);
for (Object obj : objs) {
object = obj;
@@ -277,8 +251,7 @@ public class RegistryPageContributor implements IPropertyPageContributor,
IActionFilter filter = null;
// Do the free IResource adapting
- Object adaptedObject = LegacyResourceSupport
- .getAdaptedResource(object);
+ Object adaptedObject = LegacyResourceSupport.getAdaptedResource(object);
if (adaptedObject != null) {
object = adaptedObject;
}
@@ -293,9 +266,10 @@ public class RegistryPageContributor implements IPropertyPageContributor,
}
/**
- * Return whether or not object fails the enabledWhen enablement criterea.
- * For multi-select pages, evaluate the enabledWhen expression using the
- * structured selection as a Collection (which should be iterated over).
+ * Return whether or not object fails the enabledWhen enablement criterea. For
+ * multi-select pages, evaluate the enabledWhen expression using the structured
+ * selection as a Collection (which should be iterated over).
+ *
* @return boolean <code>true</code> if it fails the enablement test
*/
private boolean failsEnablement(Object[] objs) {
@@ -306,9 +280,7 @@ public class RegistryPageContributor implements IPropertyPageContributor,
Object object = (supportsMultiSelect) ? Arrays.asList(objs) : objs[0];
EvaluationContext context = new EvaluationContext(null, object);
context.setAllowPluginActivation(true);
- return enablementExpression.evaluate(
- context).equals(
- EvaluationResult.FALSE);
+ return enablementExpression.evaluate(context).equals(EvaluationResult.FALSE);
} catch (CoreException e) {
WorkbenchPlugin.log(e);
return false;
@@ -333,8 +305,7 @@ public class RegistryPageContributor implements IPropertyPageContributor,
* Initialize the enablement expression for this decorator
*/
protected void initializeEnablement(IConfigurationElement definingElement) {
- IConfigurationElement[] elements = definingElement
- .getChildren(CHILD_ENABLED_WHEN);
+ IConfigurationElement[] elements = definingElement.getChildren(CHILD_ENABLED_WHEN);
if (elements.length == 0)
return;
@@ -343,8 +314,7 @@ public class RegistryPageContributor implements IPropertyPageContributor,
IConfigurationElement[] enablement = elements[0].getChildren();
if (enablement.length == 0)
return;
- enablementExpression = ExpressionConverter.getDefault().perform(
- enablement[0]);
+ enablementExpression = ExpressionConverter.getDefault().perform(enablement[0]);
} catch (CoreException e) {
WorkbenchPlugin.log(e);
}
@@ -352,8 +322,8 @@ public class RegistryPageContributor implements IPropertyPageContributor,
}
/**
- * Returns whether the object passes a custom key value filter implemented
- * by a matcher.
+ * Returns whether the object passes a custom key value filter implemented by a
+ * matcher.
*/
private boolean testCustom(Object object, IActionFilter filter) {
Map<String, String> filterProperties = getFilterProperties();
@@ -384,8 +354,7 @@ public class RegistryPageContributor implements IPropertyPageContributor,
* @since 3.1
*/
public String getCategory() {
- return pageElement
- .getAttribute(CategorizedPageRegistryReader.ATT_CATEGORY);
+ return pageElement.getAttribute(CategorizedPageRegistryReader.ATT_CATEGORY);
}
/**
@@ -427,8 +396,7 @@ public class RegistryPageContributor implements IPropertyPageContributor,
public Object getChild(String id) {
Iterator iterator = subPages.iterator();
while (iterator.hasNext()) {
- RegistryPageContributor next = (RegistryPageContributor) iterator
- .next();
+ RegistryPageContributor next = (RegistryPageContributor) iterator.next();
if (next.getPageId().equals(id))
return next;
}
@@ -443,10 +411,8 @@ public class RegistryPageContributor implements IPropertyPageContributor,
private void processChildElement(Map<String, String> map, IConfigurationElement element) {
String tag = element.getName();
if (tag.equals(PropertyPagesRegistryReader.TAG_FILTER)) {
- String key = element
- .getAttribute(PropertyPagesRegistryReader.ATT_FILTER_NAME);
- String value = element
- .getAttribute(PropertyPagesRegistryReader.ATT_FILTER_VALUE);
+ String key = element.getAttribute(PropertyPagesRegistryReader.ATT_FILTER_NAME);
+ String value = element.getAttribute(PropertyPagesRegistryReader.ATT_FILTER_VALUE);
if (key == null || value == null)
return;
map.put(key, value);
@@ -482,8 +448,8 @@ public class RegistryPageContributor implements IPropertyPageContributor,
return pageId;
}
- @Override
+ @Override
public String getPluginId() {
- return pageElement.getContributor().getName();
- }
+ return pageElement.getContributor().getName();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SavePerspectiveDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SavePerspectiveDialog.java
index 7063f82516d..17ab8437486 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SavePerspectiveDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SavePerspectiveDialog.java
@@ -43,215 +43,211 @@ import org.eclipse.ui.internal.registry.PerspectiveRegistry;
import org.eclipse.ui.model.PerspectiveLabelProvider;
/**
- * The SavePerspectiveDialog can be used to get the name of a new
- * perspective or the descriptor of an old perspective. The results
- * are returned by <code>getNewPerspName</code> and
- * <code>getOldPersp</code>.
+ * The SavePerspectiveDialog can be used to get the name of a new perspective or
+ * the descriptor of an old perspective. The results are returned by
+ * <code>getNewPerspName</code> and <code>getOldPersp</code>.
*/
public class SavePerspectiveDialog extends org.eclipse.jface.dialogs.Dialog
- implements ISelectionChangedListener, ModifyListener {
- private Text text;
+ implements ISelectionChangedListener, ModifyListener {
+ private Text text;
- private TableViewer list;
+ private TableViewer list;
- private Button okButton;
+ private Button okButton;
- private PerspectiveRegistry perspReg;
+ private PerspectiveRegistry perspReg;
- private String perspName;
+ private String perspName;
- private IPerspectiveDescriptor persp;
+ private IPerspectiveDescriptor persp;
- private IPerspectiveDescriptor initialSelection;
+ private IPerspectiveDescriptor initialSelection;
- private boolean ignoreSelection = false;
+ private boolean ignoreSelection = false;
- final private static int LIST_WIDTH = 40;
+ final private static int LIST_WIDTH = 40;
- final private static int TEXT_WIDTH = 40;
+ final private static int TEXT_WIDTH = 40;
- final private static int LIST_HEIGHT = 14;
+ final private static int LIST_HEIGHT = 14;
- /**
- * PerspectiveDialog constructor comment.
- * @param parentShell the parent shell
- * @param perspReg the perspective registry
- */
- public SavePerspectiveDialog(Shell parentShell, PerspectiveRegistry perspReg) {
- super(parentShell);
- this.perspReg = perspReg;
+ /**
+ * PerspectiveDialog constructor comment.
+ *
+ * @param parentShell the parent shell
+ * @param perspReg the perspective registry
+ */
+ public SavePerspectiveDialog(Shell parentShell, PerspectiveRegistry perspReg) {
+ super(parentShell);
+ this.perspReg = perspReg;
setShellStyle(getShellStyle() | SWT.SHEET);
- }
+ }
- @Override
+ @Override
protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell
- .setText(WorkbenchMessages.SavePerspective_shellTitle);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(shell,
- IWorkbenchHelpContextIds.SAVE_PERSPECTIVE_DIALOG);
- }
-
- /**
- * Add buttons to the dialog's button bar.
- *
- * @param parent the button bar composite
- */
- @Override
+ super.configureShell(shell);
+ shell.setText(WorkbenchMessages.SavePerspective_shellTitle);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(shell, IWorkbenchHelpContextIds.SAVE_PERSPECTIVE_DIALOG);
+ }
+
+ /**
+ * Add buttons to the dialog's button bar.
+ *
+ * @param parent the button bar composite
+ */
+ @Override
protected void createButtonsForButtonBar(Composite parent) {
okButton = createButton(parent, IDialogConstants.OK_ID, WorkbenchMessages.SavePerspective_saveButtonLabel,
true);
createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
updateButtons();
text.setFocus();
- }
-
- /**
- * Creates and returns the contents of the upper part
- * of this dialog (above the button bar).
- *
- * @param parent the parent composite to contain the dialog area
- * @return the dialog area control
- */
- @Override
+ }
+
+ /**
+ * Creates and returns the contents of the upper part of this dialog (above the
+ * button bar).
+ *
+ * @param parent the parent composite to contain the dialog area
+ * @return the dialog area control
+ */
+ @Override
protected Control createDialogArea(Composite parent) {
- Font font = parent.getFont();
- // Run super.
- Composite composite = (Composite) super.createDialogArea(parent);
-
- // description
- Label descLabel = new Label(composite, SWT.WRAP);
- descLabel.setText(WorkbenchMessages.SavePerspectiveDialog_description);
- descLabel.setFont(parent.getFont());
-
- // Spacer.
- Label label = new Label(composite, SWT.NONE);
- GridData data = new GridData();
- data.heightHint = 8;
- label.setLayoutData(data);
-
- // Create name group.
- Composite nameGroup = new Composite(composite, SWT.NONE);
- nameGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginWidth = layout.marginHeight = 0;
- nameGroup.setLayout(layout);
-
- // Create name label.
- label = new Label(nameGroup, SWT.NONE);
- label.setText(WorkbenchMessages.SavePerspective_name);
- label.setFont(font);
-
- // Add text field.
- text = new Text(nameGroup, SWT.BORDER);
- text.setFocus();
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = convertWidthInCharsToPixels(TEXT_WIDTH);
- text.setLayoutData(data);
- text.setFont(font);
- text.addModifyListener(this);
-
- // Spacer.
- label = new Label(composite, SWT.NONE);
- data = new GridData();
- data.heightHint = 5;
- label.setLayoutData(data);
-
- // Another label.
- label = new Label(composite, SWT.NONE);
- label.setText(WorkbenchMessages.SavePerspective_existing);
- label.setFont(font);
-
- // Add perspective list.
- list = new TableViewer(composite, SWT.H_SCROLL | SWT.V_SCROLL
- | SWT.BORDER);
- list.setLabelProvider(new PerspectiveLabelProvider());
- list.setContentProvider(new PerspContentProvider());
- list.addFilter(new ActivityViewerFilter());
- list.setComparator(new ViewerComparator());
- list.setInput(perspReg);
- list.addSelectionChangedListener(this);
- list.getTable().setFont(font);
-
- // Set perspective list size.
- Control ctrl = list.getControl();
- GridData spec = new GridData(GridData.FILL_BOTH);
- spec.widthHint = convertWidthInCharsToPixels(LIST_WIDTH);
- spec.heightHint = convertHeightInCharsToPixels(LIST_HEIGHT);
- ctrl.setLayoutData(spec);
-
- // Set the initial selection
- if (initialSelection != null) {
- StructuredSelection sel = new StructuredSelection(initialSelection);
- list.setSelection(sel, true);
- }
- text.selectAll();
-
- // Return results.
- return composite;
- }
-
- /**
- * Returns the target name.
- *
- * @return the target name
- */
- public IPerspectiveDescriptor getPersp() {
- return persp;
- }
-
- /**
- * Returns the target name.
- *
- * @return the target name
- */
- public String getPerspName() {
- return perspName;
- }
-
- /**
- * The user has typed some text.
- */
- @Override
+ Font font = parent.getFont();
+ // Run super.
+ Composite composite = (Composite) super.createDialogArea(parent);
+
+ // description
+ Label descLabel = new Label(composite, SWT.WRAP);
+ descLabel.setText(WorkbenchMessages.SavePerspectiveDialog_description);
+ descLabel.setFont(parent.getFont());
+
+ // Spacer.
+ Label label = new Label(composite, SWT.NONE);
+ GridData data = new GridData();
+ data.heightHint = 8;
+ label.setLayoutData(data);
+
+ // Create name group.
+ Composite nameGroup = new Composite(composite, SWT.NONE);
+ nameGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginWidth = layout.marginHeight = 0;
+ nameGroup.setLayout(layout);
+
+ // Create name label.
+ label = new Label(nameGroup, SWT.NONE);
+ label.setText(WorkbenchMessages.SavePerspective_name);
+ label.setFont(font);
+
+ // Add text field.
+ text = new Text(nameGroup, SWT.BORDER);
+ text.setFocus();
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.widthHint = convertWidthInCharsToPixels(TEXT_WIDTH);
+ text.setLayoutData(data);
+ text.setFont(font);
+ text.addModifyListener(this);
+
+ // Spacer.
+ label = new Label(composite, SWT.NONE);
+ data = new GridData();
+ data.heightHint = 5;
+ label.setLayoutData(data);
+
+ // Another label.
+ label = new Label(composite, SWT.NONE);
+ label.setText(WorkbenchMessages.SavePerspective_existing);
+ label.setFont(font);
+
+ // Add perspective list.
+ list = new TableViewer(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ list.setLabelProvider(new PerspectiveLabelProvider());
+ list.setContentProvider(new PerspContentProvider());
+ list.addFilter(new ActivityViewerFilter());
+ list.setComparator(new ViewerComparator());
+ list.setInput(perspReg);
+ list.addSelectionChangedListener(this);
+ list.getTable().setFont(font);
+
+ // Set perspective list size.
+ Control ctrl = list.getControl();
+ GridData spec = new GridData(GridData.FILL_BOTH);
+ spec.widthHint = convertWidthInCharsToPixels(LIST_WIDTH);
+ spec.heightHint = convertHeightInCharsToPixels(LIST_HEIGHT);
+ ctrl.setLayoutData(spec);
+
+ // Set the initial selection
+ if (initialSelection != null) {
+ StructuredSelection sel = new StructuredSelection(initialSelection);
+ list.setSelection(sel, true);
+ }
+ text.selectAll();
+
+ // Return results.
+ return composite;
+ }
+
+ /**
+ * Returns the target name.
+ *
+ * @return the target name
+ */
+ public IPerspectiveDescriptor getPersp() {
+ return persp;
+ }
+
+ /**
+ * Returns the target name.
+ *
+ * @return the target name
+ */
+ public String getPerspName() {
+ return perspName;
+ }
+
+ /**
+ * The user has typed some text.
+ */
+ @Override
public void modifyText(org.eclipse.swt.events.ModifyEvent e) {
- // Get text.
- perspName = text.getText();
-
- // Transfer text to persp list.
- ignoreSelection = true;
- persp = perspReg.findPerspectiveWithLabel(perspName);
- if (persp == null) {
- StructuredSelection sel = new StructuredSelection();
- list.setSelection(sel);
- } else {
- StructuredSelection sel = new StructuredSelection(persp);
- list.setSelection(sel);
- }
- ignoreSelection = false;
-
- updateButtons();
- }
-
- /**
- * Notifies that the ok button of this dialog has been pressed.
- * <p>
- * The default implementation of this framework method sets
- * this dialog's return code to <code>Window.OK</code>
- * and closes the dialog. Subclasses may override.
- * </p>
- */
- @Override
+ // Get text.
+ perspName = text.getText();
+
+ // Transfer text to persp list.
+ ignoreSelection = true;
+ persp = perspReg.findPerspectiveWithLabel(perspName);
+ if (persp == null) {
+ StructuredSelection sel = new StructuredSelection();
+ list.setSelection(sel);
+ } else {
+ StructuredSelection sel = new StructuredSelection(persp);
+ list.setSelection(sel);
+ }
+ ignoreSelection = false;
+
+ updateButtons();
+ }
+
+ /**
+ * Notifies that the ok button of this dialog has been pressed.
+ * <p>
+ * The default implementation of this framework method sets this dialog's return
+ * code to <code>Window.OK</code> and closes the dialog. Subclasses may
+ * override.
+ * </p>
+ */
+ @Override
protected void okPressed() {
- perspName = text.getText();
- persp = perspReg.findPerspectiveWithLabel(perspName);
- if (persp != null) {
- // Confirm ok to overwrite
- String message = NLS.bind(WorkbenchMessages.SavePerspective_overwriteQuestion,perspName );
- String[] buttons = new String[] { IDialogConstants.YES_LABEL,
- IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL };
- MessageDialog d = new MessageDialog(this.getShell(),
- WorkbenchMessages.SavePerspective_overwriteTitle, null,
+ perspName = text.getText();
+ persp = perspReg.findPerspectiveWithLabel(perspName);
+ if (persp != null) {
+ // Confirm ok to overwrite
+ String message = NLS.bind(WorkbenchMessages.SavePerspective_overwriteQuestion, perspName);
+ String[] buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL,
+ IDialogConstants.CANCEL_LABEL };
+ MessageDialog d = new MessageDialog(this.getShell(), WorkbenchMessages.SavePerspective_overwriteTitle, null,
message, MessageDialog.QUESTION, 0, buttons) {
@Override
protected int getShellStyle() {
@@ -259,66 +255,66 @@ public class SavePerspectiveDialog extends org.eclipse.jface.dialogs.Dialog
}
};
- switch (d.open()) {
- case 0: //yes
- break;
- case 1: //no
- return;
- case 2: //cancel
- cancelPressed();
- return;
- default:
- return;
- }
- }
-
- super.okPressed();
- }
-
- /**
- * Notifies that the selection has changed.
- *
- * @param event event object describing the change
- */
- @Override
+ switch (d.open()) {
+ case 0: // yes
+ break;
+ case 1: // no
+ return;
+ case 2: // cancel
+ cancelPressed();
+ return;
+ default:
+ return;
+ }
+ }
+
+ super.okPressed();
+ }
+
+ /**
+ * Notifies that the selection has changed.
+ *
+ * @param event event object describing the change
+ */
+ @Override
public void selectionChanged(SelectionChangedEvent event) {
- // If a selection is caused by modifyText ignore it.
- if (ignoreSelection) {
+ // If a selection is caused by modifyText ignore it.
+ if (ignoreSelection) {
return;
}
- // Get selection.
+ // Get selection.
IStructuredSelection sel = list.getStructuredSelection();
- persp = null;
- if (!sel.isEmpty()) {
+ persp = null;
+ if (!sel.isEmpty()) {
persp = (IPerspectiveDescriptor) sel.getFirstElement();
}
- // Transfer selection to text field.
- if (persp != null) {
- perspName = persp.getLabel();
- text.setText(perspName);
- }
-
- updateButtons();
- }
-
- /**
- * Sets the initial selection in this dialog.
- *
- * @param selectedElement the perspective descriptor to select
- */
- public void setInitialSelection(IPerspectiveDescriptor selectedElement) {
- initialSelection = selectedElement;
- }
-
- /**
- * Update the OK button.
- */
- private void updateButtons() {
- if (okButton != null) {
- String label = text.getText();
- okButton.setEnabled(perspReg.validateLabel(label));
- }
- }
+ // Transfer selection to text field.
+ if (persp != null) {
+ perspName = persp.getLabel();
+ text.setText(perspName);
+ }
+
+ updateButtons();
+ }
+
+ /**
+ * Sets the initial selection in this dialog.
+ *
+ * @param selectedElement the perspective descriptor to select
+ */
+ public void setInitialSelection(IPerspectiveDescriptor selectedElement) {
+ initialSelection = selectedElement;
+ }
+
+ /**
+ * Update the OK button.
+ */
+ private void updateButtons() {
+ if (okButton != null) {
+ String label = text.getText();
+ okButton.setEnabled(perspReg.validateLabel(label));
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SelectPerspectiveDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SelectPerspectiveDialog.java
index 1e9bce4122e..c3f53d2de1d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SelectPerspectiveDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SelectPerspectiveDialog.java
@@ -58,84 +58,84 @@ import org.eclipse.ui.model.PerspectiveLabelProvider;
*/
public class SelectPerspectiveDialog extends Dialog implements ISelectionChangedListener {
- final private static int LIST_HEIGHT = 300;
+ final private static int LIST_HEIGHT = 300;
- final private static int LIST_WIDTH = 300;
+ final private static int LIST_WIDTH = 300;
- private TableViewer list;
+ private TableViewer list;
- private Button okButton;
+ private Button okButton;
- private IPerspectiveDescriptor perspDesc;
+ private IPerspectiveDescriptor perspDesc;
- private IPerspectiveRegistry perspReg;
+ private IPerspectiveRegistry perspReg;
- private ActivityViewerFilter activityViewerFilter = new ActivityViewerFilter();
+ private ActivityViewerFilter activityViewerFilter = new ActivityViewerFilter();
private Label descriptionHint;
- private Button showAllButton;
+ private Button showAllButton;
private PopupDialog perspDescPopupDialog;
- /**
- * PerspectiveDialog constructor comment.
- *
- * @param parentShell the parent shell
- * @param perspReg the perspective registry
- */
+ /**
+ * PerspectiveDialog constructor comment.
+ *
+ * @param parentShell the parent shell
+ * @param perspReg the perspective registry
+ */
public SelectPerspectiveDialog(Shell parentShell, IPerspectiveRegistry perspReg) {
- super(parentShell);
- this.perspReg = perspReg;
+ super(parentShell);
+ this.perspReg = perspReg;
setShellStyle(getShellStyle() | SWT.SHEET);
- }
+ }
- @Override
+ @Override
protected void cancelPressed() {
- perspDesc = null;
- super.cancelPressed();
- }
+ perspDesc = null;
+ super.cancelPressed();
+ }
- @Override
+ @Override
protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(WorkbenchMessages.SelectPerspective_shellTitle);
+ super.configureShell(shell);
+ shell.setText(WorkbenchMessages.SelectPerspective_shellTitle);
PlatformUI.getWorkbench().getHelpSystem().setHelp(shell, IWorkbenchHelpContextIds.SELECT_PERSPECTIVE_DIALOG);
- }
-
- /**
- * Adds buttons to this dialog's button bar.
- * <p>
- * The default implementation of this framework method adds standard ok and
- * cancel buttons using the <code>createButton</code> framework method.
- * Subclasses may override.
- * </p>
- *
- * @param parent the button bar composite
- */
- @Override
+ }
+
+ /**
+ * Adds buttons to this dialog's button bar.
+ * <p>
+ * The default implementation of this framework method adds standard ok and
+ * cancel buttons using the <code>createButton</code> framework method.
+ * Subclasses may override.
+ * </p>
+ *
+ * @param parent the button bar composite
+ */
+ @Override
protected void createButtonsForButtonBar(Composite parent) {
okButton = createButton(parent, IDialogConstants.OK_ID, WorkbenchMessages.SelectPerspective_open_button_label,
true);
createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
- updateButtons();
- }
-
- /**
- * Creates and returns the contents of the upper part of this dialog (above
- * the button bar).
- *
- * @param parent the parent composite to contain the dialog area
- * @return the dialog area control
- */
- @Override
+ updateButtons();
+ }
+
+ /**
+ * Creates and returns the contents of the upper part of this dialog (above the
+ * button bar).
+ *
+ * @param parent the parent composite to contain the dialog area
+ * @return the dialog area control
+ */
+ @Override
protected Control createDialogArea(Composite parent) {
- // Run super.
- Composite composite = (Composite) super.createDialogArea(parent);
- composite.setFont(parent.getFont());
+ // Run super.
+ Composite composite = (Composite) super.createDialogArea(parent);
+ composite.setFont(parent.getFont());
- createViewer(composite);
- layoutTopControl(list.getControl());
+ createViewer(composite);
+ layoutTopControl(list.getControl());
// Use F2... label
descriptionHint = new Label(composite, SWT.WRAP);
@@ -143,126 +143,125 @@ public class SelectPerspectiveDialog extends Dialog implements ISelectionChanged
descriptionHint.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
descriptionHint.setVisible(false);
- if (needsShowAllButton()) {
- createShowAllButton(composite);
- }
- // Return results.
- return composite;
- }
-
- /**
- * @return whether a show-all button is needed. A show all button is needed only if the list contains filtered items.
- */
- private boolean needsShowAllButton() {
- return activityViewerFilter.getHasEncounteredFilteredItem();
- }
-
- /**
- * Create a show all button in the parent.
- *
- * @param parent the parent <code>Composite</code>.
- */
- private void createShowAllButton(Composite parent) {
- showAllButton = new Button(parent, SWT.CHECK);
- showAllButton
- .setText(ActivityMessages.Perspective_showAll);
- showAllButton.addSelectionListener(widgetSelectedAdapter(e -> {
- if (showAllButton.getSelection()) {
- list.resetFilters();
- } else {
- list.addFilter(activityViewerFilter);
- }
+ if (needsShowAllButton()) {
+ createShowAllButton(composite);
+ }
+ // Return results.
+ return composite;
+ }
+
+ /**
+ * @return whether a show-all button is needed. A show all button is needed only
+ * if the list contains filtered items.
+ */
+ private boolean needsShowAllButton() {
+ return activityViewerFilter.getHasEncounteredFilteredItem();
+ }
+
+ /**
+ * Create a show all button in the parent.
+ *
+ * @param parent the parent <code>Composite</code>.
+ */
+ private void createShowAllButton(Composite parent) {
+ showAllButton = new Button(parent, SWT.CHECK);
+ showAllButton.setText(ActivityMessages.Perspective_showAll);
+ showAllButton.addSelectionListener(widgetSelectedAdapter(e -> {
+ if (showAllButton.getSelection()) {
+ list.resetFilters();
+ } else {
+ list.addFilter(activityViewerFilter);
+ }
}));
- }
-
- /**
- * Create a new viewer in the parent.
- *
- * @param parent the parent <code>Composite</code>.
- */
- private void createViewer(Composite parent) {
- // Add perspective list.
- list = new TableViewer(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL
- | SWT.BORDER);
- list.getTable().setFont(parent.getFont());
+ }
+
+ /**
+ * Create a new viewer in the parent.
+ *
+ * @param parent the parent <code>Composite</code>.
+ */
+ private void createViewer(Composite parent) {
+ // Add perspective list.
+ list = new TableViewer(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ list.getTable().setFont(parent.getFont());
list.setLabelProvider(new PerspectiveLabelProvider());
- list.setContentProvider(new PerspContentProvider());
- list.addFilter(activityViewerFilter);
- list.setComparator(new ViewerComparator());
- list.setInput(perspReg);
- list.addSelectionChangedListener(this);
- list.addDoubleClickListener(event -> handleDoubleClickEvent());
+ list.setContentProvider(new PerspContentProvider());
+ list.addFilter(activityViewerFilter);
+ list.setComparator(new ViewerComparator());
+ list.setInput(perspReg);
+ list.addSelectionChangedListener(this);
+ list.addDoubleClickListener(event -> handleDoubleClickEvent());
list.getControl().addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
handleTableViewerKeyPressed(e);
}
});
- }
-
- /**
- * Returns the current selection.
- *
- * @return the current selection
- */
- public IPerspectiveDescriptor getSelection() {
- return perspDesc;
- }
-
- /**
- * Handle a double click event on the list
- */
- protected void handleDoubleClickEvent() {
- okPressed();
- }
-
- /**
- * Layout the top control.
- *
- * @param control the control.
- */
- private void layoutTopControl(Control control) {
- GridData spec = new GridData(GridData.FILL_BOTH);
- spec.widthHint = LIST_WIDTH;
- spec.heightHint = LIST_HEIGHT;
- control.setLayoutData(spec);
- }
-
- /**
- * Notifies that the selection has changed.
- *
- * @param event event object describing the change
- */
- @Override
+ }
+
+ /**
+ * Returns the current selection.
+ *
+ * @return the current selection
+ */
+ public IPerspectiveDescriptor getSelection() {
+ return perspDesc;
+ }
+
+ /**
+ * Handle a double click event on the list
+ */
+ protected void handleDoubleClickEvent() {
+ okPressed();
+ }
+
+ /**
+ * Layout the top control.
+ *
+ * @param control the control.
+ */
+ private void layoutTopControl(Control control) {
+ GridData spec = new GridData(GridData.FILL_BOTH);
+ spec.widthHint = LIST_WIDTH;
+ spec.heightHint = LIST_HEIGHT;
+ control.setLayoutData(spec);
+ }
+
+ /**
+ * Notifies that the selection has changed.
+ *
+ * @param event event object describing the change
+ */
+ @Override
public void selectionChanged(SelectionChangedEvent event) {
- updateSelection(event);
- updateButtons();
+ updateSelection(event);
+ updateButtons();
updateTooltip();
- }
-
- /**
- * Update the button enablement state.
- */
- protected void updateButtons() {
- okButton.setEnabled(getSelection() != null);
- }
-
- /**
- * Update the selection object.
- */
- protected void updateSelection(SelectionChangedEvent event) {
- perspDesc = null;
+ }
+
+ /**
+ * Update the button enablement state.
+ */
+ protected void updateButtons() {
+ okButton.setEnabled(getSelection() != null);
+ }
+
+ /**
+ * Update the selection object.
+ */
+ protected void updateSelection(SelectionChangedEvent event) {
+ perspDesc = null;
IStructuredSelection sel = event.getStructuredSelection();
- if (!sel.isEmpty()) {
- Object obj = sel.getFirstElement();
- if (obj instanceof IPerspectiveDescriptor) {
+ if (!sel.isEmpty()) {
+ Object obj = sel.getFirstElement();
+ if (obj instanceof IPerspectiveDescriptor) {
perspDesc = (IPerspectiveDescriptor) obj;
}
- }
- }
+ }
+ }
- private void updateTooltip() {
+ private void updateTooltip() {
String tooltip = ""; //$NON-NLS-1$
if (perspDesc != null) {
tooltip = perspDesc.getDescription();
@@ -281,15 +280,15 @@ public class SelectPerspectiveDialog extends Dialog implements ISelectionChanged
protected void okPressed() {
ITriggerPoint triggerPoint = PlatformUI.getWorkbench().getActivitySupport().getTriggerPointManager()
.getTriggerPoint(WorkbenchTriggerPoints.OPEN_PERSPECITVE_DIALOG);
- if (WorkbenchActivityHelper.allowUseOf(triggerPoint, getSelection())) {
+ if (WorkbenchActivityHelper.allowUseOf(triggerPoint, getSelection())) {
super.okPressed();
}
- }
+ }
- @Override
+ @Override
protected boolean isResizable() {
- return true;
- }
+ return true;
+ }
private void handleTableViewerKeyPressed(KeyEvent event) {
// popup the description for the selected perspective
@@ -310,7 +309,8 @@ public class SelectPerspectiveDialog extends Dialog implements ISelectionChanged
}
private void popUp(final String description) {
- perspDescPopupDialog = new PopupDialog(getShell(), PopupDialog.HOVER_SHELLSTYLE, true, false, false, false, false, null, null) {
+ perspDescPopupDialog = new PopupDialog(getShell(), PopupDialog.HOVER_SHELLSTYLE, true, false, false, false,
+ false, null, null) {
private static final int CURSOR_SIZE = 15;
private Label label = null;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ShowViewDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ShowViewDialog.java
index 340bd560f59..2d67931e142 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ShowViewDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ShowViewDialog.java
@@ -75,8 +75,7 @@ public class ShowViewDialog extends Dialog implements ISelectionChangedListener,
private static final String STORE_EXPANDED_CATEGORIES_ID = DIALOG_SETTING_SECTION_NAME
+ ".STORE_EXPANDED_CATEGORIES_ID"; //$NON-NLS-1$
- private static final String STORE_SELECTED_VIEW_ID = DIALOG_SETTING_SECTION_NAME
- + ".STORE_SELECTED_VIEW_ID"; //$NON-NLS-1$
+ private static final String STORE_SELECTED_VIEW_ID = DIALOG_SETTING_SECTION_NAME + ".STORE_SELECTED_VIEW_ID"; //$NON-NLS-1$
private FilteredTree filteredTree;
@@ -151,8 +150,7 @@ public class ShowViewDialog extends Dialog implements ISelectionChangedListener,
@Override
protected void createButtonsForButtonBar(Composite parent) {
- okButton = createButton(parent, IDialogConstants.OK_ID, WorkbenchMessages.ShowView_open_button_label,
- true);
+ okButton = createButton(parent, IDialogConstants.OK_ID, WorkbenchMessages.ShowView_open_button_label, true);
createButton(parent, IDialogConstants.CANCEL_ID, JFaceResources.getString(IDialogLabelKeys.CANCEL_LABEL_KEY),
false);
updateButtons();
@@ -186,12 +184,9 @@ public class ShowViewDialog extends Dialog implements ISelectionChangedListener,
/**
* Blends c1 and c2 based in the provided ratio.
*
- * @param c1
- * first color
- * @param c2
- * second color
- * @param ratio
- * percentage of the first color in the blend (0-100)
+ * @param c1 first color
+ * @param c2 second color
+ * @param ratio percentage of the first color in the blend (0-100)
* @return the RGB value of the blended color
*
* copied from FormColors.java
@@ -211,8 +206,7 @@ public class ShowViewDialog extends Dialog implements ISelectionChangedListener,
/**
* Create a new filtered tree viewer in the parent.
*
- * @param parent
- * the parent <code>Composite</code>.
+ * @param parent the parent <code>Composite</code>.
*/
private void createFilteredTreeViewer(Composite parent) {
PatternFilter filter = new ViewPatternFilter();
@@ -223,12 +217,12 @@ public class ShowViewDialog extends Dialog implements ISelectionChangedListener,
TreeViewer treeViewer = filteredTree.getViewer();
Control treeControl = treeViewer.getControl();
- RGB dimmedRGB = blend(treeControl.getForeground().getRGB(), treeControl.getBackground()
- .getRGB(), 60);
+ RGB dimmedRGB = blend(treeControl.getForeground().getRGB(), treeControl.getBackground().getRGB(), 60);
dimmedForeground = new Color(treeControl.getDisplay(), dimmedRGB);
treeControl.addDisposeListener(e -> dimmedForeground.dispose());
- treeViewer.setLabelProvider(new ViewLabelProvider(context, modelService, partService, window,dimmedForeground));
+ treeViewer
+ .setLabelProvider(new ViewLabelProvider(context, modelService, partService, window, dimmedForeground));
treeViewer.setContentProvider(new ViewContentProvider(application));
treeViewer.setComparator(new ViewComparator());
treeViewer.setInput(application);
@@ -275,8 +269,7 @@ public class ShowViewDialog extends Dialog implements ISelectionChangedListener,
IStructuredSelection s = (IStructuredSelection) event.getSelection();
Object element = s.getFirstElement();
if (filteredTree.getViewer().isExpandable(element)) {
- filteredTree.getViewer().setExpandedState(element,
- !filteredTree.getViewer().getExpandedState(element));
+ filteredTree.getViewer().setExpandedState(element, !filteredTree.getViewer().getExpandedState(element));
} else if (viewDescs.length > 0) {
saveWidgetValues();
setReturnCode(OK);
@@ -308,8 +301,7 @@ public class ShowViewDialog extends Dialog implements ISelectionChangedListener,
/**
* Layout the top control.
*
- * @param control
- * the control.
+ * @param control the control.
*/
private void layoutTopControl(Control control) {
GridData spec = new GridData(GridData.FILL_BOTH);
@@ -319,8 +311,8 @@ public class ShowViewDialog extends Dialog implements ISelectionChangedListener,
}
/**
- * Use the dialog store to restore widget values to the values that they
- * held last time this dialog was used to completion.
+ * Use the dialog store to restore widget values to the values that they held
+ * last time this dialog was used to completion.
*/
protected void restoreWidgetValues() {
IDialogSettings settings = getDialogSettings();
@@ -337,8 +329,7 @@ public class ShowViewDialog extends Dialog implements ISelectionChangedListener,
List<MPartDescriptor> descriptors = application.getDescriptors();
for (MPartDescriptor descriptor : descriptors) {
if (selectedPartId.equals(descriptor.getElementId())) {
- filteredTree.getViewer()
- .setSelection(new StructuredSelection(descriptor), true);
+ filteredTree.getViewer().setSelection(new StructuredSelection(descriptor), true);
break;
}
}
@@ -346,8 +337,8 @@ public class ShowViewDialog extends Dialog implements ISelectionChangedListener,
}
/**
- * Since OK was pressed, write widget values to the dialog store so that
- * they will persist into the next invocation of this dialog
+ * Since OK was pressed, write widget values to the dialog store so that they
+ * will persist into the next invocation of this dialog
*/
protected void saveWidgetValues() {
IDialogSettings settings = getDialogSettings();
@@ -377,8 +368,7 @@ public class ShowViewDialog extends Dialog implements ISelectionChangedListener,
/**
* Notifies that the selection has changed.
*
- * @param event
- * event object describing the change
+ * @param event event object describing the change
*/
@Override
public void selectionChanged(SelectionChangedEvent event) {
@@ -434,8 +424,7 @@ public class ShowViewDialog extends Dialog implements ISelectionChangedListener,
Object o = selection.getFirstElement();
if (o instanceof MPartDescriptor) {
String description = ((MPartDescriptor) o).getTooltip();
- description = LocalizationHelper.getLocalized(description, (MPartDescriptor) o,
- context);
+ description = LocalizationHelper.getLocalized(description, (MPartDescriptor) o, context);
if (description != null && description.length() == 0)
description = WorkbenchMessages.ShowView_noDesc;
popUp(description);
@@ -445,8 +434,8 @@ public class ShowViewDialog extends Dialog implements ISelectionChangedListener,
}
private void popUp(final String description) {
- new PopupDialog(filteredTree.getShell(), PopupDialog.HOVER_SHELLSTYLE, true, false, false,
- false, false, null, null) {
+ new PopupDialog(filteredTree.getShell(), PopupDialog.HOVER_SHELLSTYLE, true, false, false, false, false, null,
+ null) {
private static final int CURSOR_SIZE = 15;
@Override
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SimpleWorkingSetSelectionDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SimpleWorkingSetSelectionDialog.java
index 0073eda6e36..f0efce96dc8 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SimpleWorkingSetSelectionDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SimpleWorkingSetSelectionDialog.java
@@ -45,8 +45,7 @@ public class SimpleWorkingSetSelectionDialog extends AbstractWorkingSetDialog {
private class Filter extends ViewerFilter {
@Override
- public boolean select(Viewer viewer, Object parentElement,
- Object element) {
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
return isCompatible((IWorkingSet) element);
}
@@ -88,14 +87,12 @@ public class SimpleWorkingSetSelectionDialog extends AbstractWorkingSetDialog {
/**
* Create a new instance of this class.
*
- * @param shell
- * the shell to parent this dialog on
- * @param workingSetTypeIds
- * the types of working set IDs that will be shown in this dialog
- * @param selectedWorkingSets
- * the currently selected working sets (if any)
- * @param canEdit
- * whether or not this dialog will display edit controls
+ * @param shell the shell to parent this dialog on
+ * @param workingSetTypeIds the types of working set IDs that will be shown in
+ * this dialog
+ * @param selectedWorkingSets the currently selected working sets (if any)
+ * @param canEdit whether or not this dialog will display edit
+ * controls
*/
public SimpleWorkingSetSelectionDialog(Shell shell, String[] workingSetTypeIds, IWorkingSet[] selectedWorkingSets,
boolean canEdit) {
@@ -124,8 +121,7 @@ public class SimpleWorkingSetSelectionDialog extends AbstractWorkingSetDialog {
viewer.setLabelProvider(new WorkingSetLabelProvider());
viewer.setContentProvider(new ArrayContentProvider());
viewer.addFilter(new WorkingSetFilter(null));
- IWorkingSet[] workingSets = PlatformUI.getWorkbench().getWorkingSetManager()
- .getWorkingSets();
+ IWorkingSet[] workingSets = PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSets();
viewer.setInput(workingSets);
viewer.setFilters(new Filter());
@@ -144,8 +140,7 @@ public class SimpleWorkingSetSelectionDialog extends AbstractWorkingSetDialog {
Dialog.applyDialogFont(composite);
- viewerData.heightHint = viewer.getTable().getItemHeight()
- * Math.min(30, Math.max(10, workingSets.length));
+ viewerData.heightHint = viewer.getTable().getItemHeight() * Math.min(30, Math.max(10, workingSets.length));
return composite;
}
@@ -166,8 +161,7 @@ public class SimpleWorkingSetSelectionDialog extends AbstractWorkingSetDialog {
@Override
protected void availableWorkingSetsChanged() {
- viewer.setInput(PlatformUI.getWorkbench().getWorkingSetManager()
- .getWorkingSets());
+ viewer.setInput(PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSets());
super.availableWorkingSetsChanged();
}
@@ -186,8 +180,7 @@ public class SimpleWorkingSetSelectionDialog extends AbstractWorkingSetDialog {
@Override
protected void selectAllSets() {
- viewer.setCheckedElements(PlatformUI.getWorkbench()
- .getWorkingSetManager().getWorkingSets());
+ viewer.setCheckedElements(PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSets());
updateButtonAvailability();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/StartupPreferencePage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/StartupPreferencePage.java
index 2ca4230f055..8e93d48a802 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/StartupPreferencePage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/StartupPreferencePage.java
@@ -44,45 +44,45 @@ import org.osgi.framework.Constants;
* The Startup preference page.
*/
public class StartupPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
- private Table pluginsList;
+ private Table pluginsList;
- private Workbench workbench;
+ private Workbench workbench;
- @Override
+ @Override
protected Control createContents(Composite parent) {
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,IWorkbenchHelpContextIds.STARTUP_PREFERENCE_PAGE);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IWorkbenchHelpContextIds.STARTUP_PREFERENCE_PAGE);
- Composite composite = createComposite(parent);
+ Composite composite = createComposite(parent);
- createEarlyStartupSelection(composite);
+ createEarlyStartupSelection(composite);
- return composite;
- }
+ return composite;
+ }
- protected Composite createComposite(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- composite.setLayout(layout);
+ protected Composite createComposite(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ composite.setLayout(layout);
GridData data = new GridData(
GridData.FILL_BOTH | GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
- composite.setLayoutData(data);
- composite.setFont(parent.getFont());
+ composite.setLayoutData(data);
+ composite.setFont(parent.getFont());
- return composite;
- }
+ return composite;
+ }
- protected void createEarlyStartupSelection(Composite parent) {
- Label label = new Label(parent, SWT.NONE);
- label.setText(WorkbenchMessages.StartupPreferencePage_label);
- label.setFont(parent.getFont());
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- label.setLayoutData(data);
+ protected void createEarlyStartupSelection(Composite parent) {
+ Label label = new Label(parent, SWT.NONE);
+ label.setText(WorkbenchMessages.StartupPreferencePage_label);
+ label.setFont(parent.getFont());
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ label.setLayoutData(data);
pluginsList = new Table(parent, SWT.BORDER | SWT.CHECK | SWT.H_SCROLL | SWT.V_SCROLL);
- data = new GridData(GridData.FILL_BOTH);
- pluginsList.setFont(parent.getFont());
- pluginsList.setLayoutData(data);
+ data = new GridData(GridData.FILL_BOTH);
+ pluginsList.setFont(parent.getFont());
+ pluginsList.setLayoutData(data);
TableViewer viewer = new TableViewer(pluginsList);
viewer.setLabelProvider(new LabelProvider() {
@Override
@@ -94,43 +94,43 @@ public class StartupPreferencePage extends PreferencePage implements IWorkbenchP
viewer.setContentProvider(ArrayContentProvider.getInstance());
viewer.setInput(workbench.getEarlyActivatedPlugins());
updateCheckState();
- }
+ }
private void updateCheckState() {
HashSet<String> disabledPlugins = new HashSet<>(Arrays.asList(workbench.getDisabledEarlyActivatedPlugins()));
for (int i = 0; i < pluginsList.getItemCount(); i++) {
TableItem item = pluginsList.getItem(i);
String pluginId = ((ContributionInfo) item.getData()).getBundleId();
- item.setChecked(!disabledPlugins.contains(pluginId));
- }
- }
+ item.setChecked(!disabledPlugins.contains(pluginId));
+ }
+ }
- @Override
+ @Override
public void init(IWorkbench workbench) {
- this.workbench = (Workbench) workbench;
- }
+ this.workbench = (Workbench) workbench;
+ }
- @Override
+ @Override
protected void performDefaults() {
IPreferenceStore store = PrefUtil.getInternalPreferenceStore();
store.setToDefault(IPreferenceConstants.PLUGINS_NOT_ACTIVATED_ON_STARTUP);
updateCheckState();
- }
+ }
- @Override
+ @Override
public boolean performOk() {
- StringBuilder preference = new StringBuilder();
+ StringBuilder preference = new StringBuilder();
TableItem[] items = pluginsList.getItems();
- for (int i = 0; i < items.length; i++) {
- if (!items[i].getChecked()) {
+ for (int i = 0; i < items.length; i++) {
+ if (!items[i].getChecked()) {
preference.append(((ContributionInfo) items[i].getData()).getBundleId());
- preference.append(IPreferenceConstants.SEPARATOR);
- }
- }
- String pref = preference.toString();
- IPreferenceStore store = PrefUtil.getInternalPreferenceStore();
+ preference.append(IPreferenceConstants.SEPARATOR);
+ }
+ }
+ String pref = preference.toString();
+ IPreferenceStore store = PrefUtil.getInternalPreferenceStore();
store.setValue(IPreferenceConstants.PLUGINS_NOT_ACTIVATED_ON_STARTUP, pref);
- PrefUtil.savePrefs();
- return true;
- }
+ PrefUtil.savePrefs();
+ return true;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewComparator.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewComparator.java
index 6eb1f514304..418f7c8b401 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewComparator.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewComparator.java
@@ -27,8 +27,8 @@ public class ViewComparator extends ViewerComparator {
private static final String EMPTY_STRING = ""; //$NON-NLS-1$
/**
- * Returns a negative, zero, or positive number depending on whether the
- * first element is less than, equal to, or greater than the second element.
+ * Returns a negative, zero, or positive number depending on whether the first
+ * element is less than, equal to, or greater than the second element.
*/
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewContentProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewContentProvider.java
index 521b7905c6d..4618413526b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewContentProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewContentProvider.java
@@ -35,8 +35,8 @@ import org.eclipse.ui.views.IViewRegistry;
public class ViewContentProvider implements ITreeContentProvider {
/**
- * Child cache. Map from Object->Object[]. Our hasChildren() method is
- * expensive so it's better to cache the results of getChildren().
+ * Child cache. Map from Object->Object[]. Our hasChildren() method is expensive
+ * so it's better to cache the results of getChildren().
*/
private Map<Object, Object[]> childMap = new HashMap<>();
@@ -155,7 +155,6 @@ public class ViewContentProvider implements ITreeContentProvider {
return combinedTopElements;
}
-
/**
* Determines if the part is a view or and editor
*
@@ -168,8 +167,8 @@ public class ViewContentProvider implements ITreeContentProvider {
}
/**
- * Remove Eclipse introview from this list, as it opened via the Help ->
- * Welcome menu
+ * Remove Eclipse introview from this list, as it opened via the Help -> Welcome
+ * menu
*/
private boolean isIntroView(String id) {
return (id.equals(IIntroConstants.INTRO_VIEW_ID));
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewLabelProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewLabelProvider.java
index 9cfc1f34408..b732539c99f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewLabelProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewLabelProvider.java
@@ -60,15 +60,12 @@ public class ViewLabelProvider extends ColumnLabelProvider {
* @param context
* @param modelService
* @param partService
- * @param window
- * the workbench window
- * @param dimmedForeground
- * the dimmed foreground color to use for views that are already
- * open
+ * @param window the workbench window
+ * @param dimmedForeground the dimmed foreground color to use for views that are
+ * already open
*/
public ViewLabelProvider(IEclipseContext context, EModelService modelService, EPartService partService,
- MWindow window,
- Color dimmedForeground) {
+ MWindow window, Color dimmedForeground) {
this.context = context;
this.modelService = modelService;
this.partService = partService;
@@ -91,8 +88,7 @@ public class ViewLabelProvider extends ColumnLabelProvider {
if (iconURI != null && iconURI.length() > 0) {
Image image = imageMap.get(iconURI);
if (image == null) {
- ISWTResourceUtilities resUtils = (ISWTResourceUtilities) context
- .get(IResourceUtilities.class);
+ ISWTResourceUtilities resUtils = (ISWTResourceUtilities) context.get(IResourceUtilities.class);
image = resUtils.imageDescriptorFromURI(URI.createURI(iconURI)).createImage();
imageMap.put(iconURI, image);
}
@@ -102,8 +98,7 @@ public class ViewLabelProvider extends ColumnLabelProvider {
} else if (element instanceof String) {
Image image = imageMap.get(FOLDER_ICON);
if (image == null) {
- ImageDescriptor desc = WorkbenchImages
- .getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER);
+ ImageDescriptor desc = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER);
image = desc.createImage();
imageMap.put(FOLDER_ICON, desc.createImage());
}
@@ -128,7 +123,7 @@ public class ViewLabelProvider extends ColumnLabelProvider {
if (element instanceof MApplicationElement) {
String elementId = ((MApplicationElement) element).getElementId();
MPerspective activePerspective = modelService.getActivePerspective(window);
- if(partService.isPartOrPlaceholderInPerspective(elementId, activePerspective)){
+ if (partService.isPartOrPlaceholderInPerspective(elementId, activePerspective)) {
return dimmedForeground;
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewPatternFilter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewPatternFilter.java
index 17d0a278a71..07cbc1ccfe3 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewPatternFilter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewPatternFilter.java
@@ -28,7 +28,6 @@ import org.eclipse.ui.dialogs.PatternFilter;
*/
public class ViewPatternFilter extends PatternFilter {
-
@Override
public boolean isElementSelectable(Object element) {
return element instanceof MPartDescriptor;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewsPreferencePage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewsPreferencePage.java
index aeac09fe5dc..4f2b23637b6 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewsPreferencePage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewsPreferencePage.java
@@ -83,8 +83,7 @@ import org.osgi.service.prefs.BackingStoreException;
* appearance of the workbench. Originally this applied only to views but now
* applies to the overall appearance, hence the name.
*/
-public class ViewsPreferencePage extends PreferencePage implements
- IWorkbenchPreferencePage {
+public class ViewsPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
private static final String E4_THEME_EXTENSION_POINT = "org.eclipse.e4.ui.css.swt.theme"; //$NON-NLS-1$
/** The workbench theme engine; may be {@code null} if no engine */
@@ -159,8 +158,7 @@ public class ViewsPreferencePage extends PreferencePage implements
themeComboDecorator.hide();
}
try {
- ((PreferencePageEnhancer) Tweaklets.get(PreferencePageEnhancer.KEY))
- .setSelection(selection);
+ ((PreferencePageEnhancer) Tweaklets.get(PreferencePageEnhancer.KEY)).setSelection(selection);
} catch (SWTException e) {
WorkbenchPlugin.log("Failed to set CSS preferences", e); //$NON-NLS-1$
}
@@ -173,15 +171,12 @@ public class ViewsPreferencePage extends PreferencePage implements
createThemeIndependentComposits(comp);
- ((PreferencePageEnhancer) Tweaklets.get(PreferencePageEnhancer.KEY))
- .setSelection(currentTheme);
+ ((PreferencePageEnhancer) Tweaklets.get(PreferencePageEnhancer.KEY)).setSelection(currentTheme);
((PreferencePageEnhancer) Tweaklets.get(PreferencePageEnhancer.KEY)).createContents(comp);
if (currentTheme != null) {
- String colorsAndFontsThemeId = getColorAndFontThemeIdByThemeId(currentTheme
- .getId());
- if (colorsAndFontsThemeId != null
- && !currentColorsAndFontsTheme.getId().equals(colorsAndFontsThemeId)) {
+ String colorsAndFontsThemeId = getColorAndFontThemeIdByThemeId(currentTheme.getId());
+ if (colorsAndFontsThemeId != null && !currentColorsAndFontsTheme.getId().equals(colorsAndFontsThemeId)) {
colorsAndFontsThemeId = currentColorsAndFontsTheme.getId();
}
selectColorsAndFontsTheme(colorsAndFontsThemeId);
@@ -201,18 +196,16 @@ public class ViewsPreferencePage extends PreferencePage implements
ArrayList<ITheme> themes = new ArrayList<>();
for (ITheme theme : engine.getThemes()) {
/*
- * When we have Win32 OS - when the high contrast mode is enabled on
- * the platform, we display the 'high-contrast' special theme only.
- * If not, we don't want to mess the themes combo with the theme
- * since it is the special variation of the 'classic' one
+ * When we have Win32 OS - when the high contrast mode is enabled on the
+ * platform, we display the 'high-contrast' special theme only. If not, we don't
+ * want to mess the themes combo with the theme since it is the special
+ * variation of the 'classic' one
*
- * When we have GTK - we have to display the entire list of the
- * themes since we are not able to figure out if the high contrast
- * mode is enabled on the platform. The user has to manually select
- * the theme if they need it
+ * When we have GTK - we have to display the entire list of the themes since we
+ * are not able to figure out if the high contrast mode is enabled on the
+ * platform. The user has to manually select the theme if they need it
*/
- if (!highContrastMode && !Util.isGtk()
- && theme.getId().equals(E4Application.HIGH_CONTRAST_THEME_ID)) {
+ if (!highContrastMode && !Util.isGtk() && theme.getId().equals(E4Application.HIGH_CONTRAST_THEME_ID)) {
continue;
}
themes.add(theme);
@@ -224,8 +217,7 @@ public class ViewsPreferencePage extends PreferencePage implements
private void createColoredLabelsPref(Composite composite) {
IPreferenceStore apiStore = PrefUtil.getAPIPreferenceStore();
- useColoredLabels = createCheckButton(composite,
- WorkbenchMessages.ViewsPreference_useColoredLabels,
+ useColoredLabels = createCheckButton(composite, WorkbenchMessages.ViewsPreference_useColoredLabels,
apiStore.getBoolean(IWorkbenchPreferenceConstants.USE_COLORED_LABELS));
}
@@ -264,8 +256,7 @@ public class ViewsPreferencePage extends PreferencePage implements
protected void createEnableAnimationsPref(Composite composite) {
IPreferenceStore apiStore = PrefUtil.getAPIPreferenceStore();
- enableAnimations = createCheckButton(composite,
- WorkbenchMessages.ViewsPreference_enableAnimations,
+ enableAnimations = createCheckButton(composite, WorkbenchMessages.ViewsPreference_enableAnimations,
apiStore.getBoolean(IWorkbenchPreferenceConstants.ENABLE_ANIMATIONS));
}
@@ -318,8 +309,7 @@ public class ViewsPreferencePage extends PreferencePage implements
}
private void setColorsAndFontsTheme(ColorsAndFontsTheme theme) {
- org.eclipse.ui.themes.ITheme currentTheme = PlatformUI.getWorkbench().getThemeManager()
- .getCurrentTheme();
+ org.eclipse.ui.themes.ITheme currentTheme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme();
if (theme != null && !currentTheme.getId().equals(theme.getId())) {
PlatformUI.getWorkbench().getThemeManager().setCurrentTheme(theme.getId());
}
@@ -379,9 +369,7 @@ public class ViewsPreferencePage extends PreferencePage implements
themeComboDecorator.hide();
colorFontsDecorator.hide();
-
-
- if (themeChanged || colorsAndFontsThemeChanged) {
+ if (themeChanged || colorsAndFontsThemeChanged) {
MessageDialog.openWarning(getShell(), WorkbenchMessages.ThemeChangeWarningTitle,
WorkbenchMessages.ThemeChangeWarningText);
}
@@ -392,16 +380,14 @@ public class ViewsPreferencePage extends PreferencePage implements
private void createColorsAndFontsThemeCombo(Composite composite) {
new Label(composite, SWT.NONE).setText(WorkbenchMessages.ViewsPreference_currentTheme);
colorsAndFontsThemeCombo = new ComboViewer(composite, SWT.READ_ONLY);
- colorsAndFontsThemeCombo.getControl().setLayoutData(
- new GridData(SWT.FILL, SWT.CENTER, true, false));
+ colorsAndFontsThemeCombo.getControl().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
colorsAndFontsThemeCombo.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
return ((ColorsAndFontsTheme) element).getLabel();
}
});
- colorFontsDecorator = new ControlDecoration(colorsAndFontsThemeCombo.getCombo(), SWT.TOP
- | SWT.LEFT);
+ colorFontsDecorator = new ControlDecoration(colorsAndFontsThemeCombo.getCombo(), SWT.TOP | SWT.LEFT);
colorsAndFontsThemeCombo.setContentProvider(new ArrayContentProvider());
colorsAndFontsThemeCombo.setInput(getColorsAndFontsThemes());
colorsAndFontsThemeCombo.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
@@ -411,8 +397,7 @@ public class ViewsPreferencePage extends PreferencePage implements
Image decorationImage = FieldDecorationRegistry.getDefault()
.getFieldDecoration(FieldDecorationRegistry.DEC_WARNING).getImage();
colorFontsDecorator.setImage(decorationImage);
- colorFontsDecorator
- .setDescriptionText(WorkbenchMessages.ThemeChangeWarningText);
+ colorFontsDecorator.setDescriptionText(WorkbenchMessages.ThemeChangeWarningText);
colorFontsDecorator.show();
} else
colorFontsDecorator.hide();
@@ -422,19 +407,16 @@ public class ViewsPreferencePage extends PreferencePage implements
}
/**
- * Create the text box that will contain the current theme description text
- * (if any).
+ * Create the text box that will contain the current theme description text (if
+ * any).
*
- * @param parent
- * the parent <code>Composite</code>.
+ * @param parent the parent <code>Composite</code>.
*/
private void createColorsAndFontsThemeDescriptionText(Composite parent) {
- new Label(parent, SWT.NONE)
- .setText(WorkbenchMessages.ViewsPreference_currentThemeDescription);
+ new Label(parent, SWT.NONE).setText(WorkbenchMessages.ViewsPreference_currentThemeDescription);
- colorsAndFontsThemeDescriptionText = new Text(parent, SWT.H_SCROLL | SWT.V_SCROLL
- | SWT.READ_ONLY
- | SWT.BORDER | SWT.WRAP);
+ colorsAndFontsThemeDescriptionText = new Text(parent,
+ SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY | SWT.BORDER | SWT.WRAP);
GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
// give a height hint that'll show at least two lines (and let the
// scroll bars draw nicely if necessary)
@@ -501,12 +483,11 @@ public class ViewsPreferencePage extends PreferencePage implements
private List<ColorsAndFontsTheme> getColorsAndFontsThemes() {
List<ColorsAndFontsTheme> result = new ArrayList<>();
- org.eclipse.ui.themes.ITheme currentTheme = PlatformUI.getWorkbench().getThemeManager()
- .getCurrentTheme();
+ org.eclipse.ui.themes.ITheme currentTheme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme();
IThemeDescriptor[] descs = WorkbenchPlugin.getDefault().getThemeRegistry().getThemes();
- String defaultThemeString = PlatformUI.getWorkbench().getThemeManager()
- .getTheme(IThemeManager.DEFAULT_THEME).getLabel();
+ String defaultThemeString = PlatformUI.getWorkbench().getThemeManager().getTheme(IThemeManager.DEFAULT_THEME)
+ .getLabel();
if (currentTheme.getId().equals(IThemeManager.DEFAULT_THEME)) {
defaultThemeString = NLS.bind(WorkbenchMessages.ViewsPreference_currentThemeFormat,
new Object[] { defaultThemeString });
@@ -544,13 +525,11 @@ public class ViewsPreferencePage extends PreferencePage implements
}
private ColorsAndFontsTheme getCurrentColorsAndFontsTheme() {
- org.eclipse.ui.themes.ITheme theme = PlatformUI.getWorkbench().getThemeManager()
- .getCurrentTheme();
+ org.eclipse.ui.themes.ITheme theme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme();
return new ColorsAndFontsTheme(theme.getId(), theme.getLabel());
}
-
private static class ColorsAndFontsTheme {
private String label;
private String id;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardActivityFilter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardActivityFilter.java
index a08616d1f6e..2cc0e7221ee 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardActivityFilter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardActivityFilter.java
@@ -21,8 +21,9 @@ import org.eclipse.ui.activities.WorkbenchActivityHelper;
import org.eclipse.ui.model.AdaptableList;
/**
- * Viewer filter designed to work with the new wizard page (and its input/content provider).
- * This will filter all non-primary wizards that are not enabled by activity.
+ * Viewer filter designed to work with the new wizard page (and its
+ * input/content provider). This will filter all non-primary wizards that are
+ * not enabled by activity.
*
* @since 3.0
*/
@@ -33,18 +34,18 @@ public class WizardActivityFilter extends ViewerFilter {
filterPrimaryWizards = filter;
}
- @Override
+ @Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (parentElement.getClass().equals(AdaptableList.class) && !filterPrimaryWizards) {
- return true; //top-level ("primary") wizards should always be returned
+ return true; // top-level ("primary") wizards should always be returned
}
- if (WorkbenchActivityHelper.filterItem(element)) {
+ if (WorkbenchActivityHelper.filterItem(element)) {
return false;
}
- return true;
- }
+ return true;
+ }
@Override
public Object[] filter(Viewer viewer, Object parent, Object[] elements) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardCollectionElement.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardCollectionElement.java
index 59631cc6718..ea2e129dd0e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardCollectionElement.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardCollectionElement.java
@@ -36,49 +36,46 @@ import org.eclipse.ui.wizards.IWizardCategory;
import org.eclipse.ui.wizards.IWizardDescriptor;
/**
- * Instances of this class are a collection of WizardCollectionElements,
- * thereby facilitating the definition of tree structures composed of these
- * elements. Instances also store a list of wizards.
+ * Instances of this class are a collection of WizardCollectionElements, thereby
+ * facilitating the definition of tree structures composed of these elements.
+ * Instances also store a list of wizards.
*/
-public class WizardCollectionElement extends AdaptableList implements IPluginContribution,
- IWizardCategory {
- private String id;
+public class WizardCollectionElement extends AdaptableList implements IPluginContribution, IWizardCategory {
+ private String id;
- private String pluginId;
+ private String pluginId;
- private String name;
+ private String name;
- private WizardCollectionElement parent;
+ private WizardCollectionElement parent;
- private AdaptableList wizards = new AdaptableList();
+ private AdaptableList wizards = new AdaptableList();
private IConfigurationElement configElement;
- /**
- * Creates a new <code>WizardCollectionElement</code>. Parent can be
- * null.
- * @param id the id
- * @param pluginId the plugin
- * @param name the name
- * @param parent the parent
- */
- public WizardCollectionElement(String id, String pluginId, String name,
- WizardCollectionElement parent) {
- this.name = name;
- this.id = id;
- this.pluginId = pluginId;
- this.parent = parent;
- }
-
- /**
- * Creates a new <code>WizardCollectionElement</code>. Parent can be
- * null.
- *
- * @param element
- * @param parent
- * @since 3.1
- */
- public WizardCollectionElement(IConfigurationElement element, WizardCollectionElement parent) {
+ /**
+ * Creates a new <code>WizardCollectionElement</code>. Parent can be null.
+ *
+ * @param id the id
+ * @param pluginId the plugin
+ * @param name the name
+ * @param parent the parent
+ */
+ public WizardCollectionElement(String id, String pluginId, String name, WizardCollectionElement parent) {
+ this.name = name;
+ this.id = id;
+ this.pluginId = pluginId;
+ this.parent = parent;
+ }
+
+ /**
+ * Creates a new <code>WizardCollectionElement</code>. Parent can be null.
+ *
+ * @param element
+ * @param parent
+ * @since 3.1
+ */
+ public WizardCollectionElement(IConfigurationElement element, WizardCollectionElement parent) {
configElement = element;
id = configElement.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
this.parent = parent;
@@ -95,302 +92,290 @@ public class WizardCollectionElement extends AdaptableList implements IPluginCon
}
/**
- * Adds a wizard collection to this collection.
- */
- @Override
+ * Adds a wizard collection to this collection.
+ */
+ @Override
public AdaptableList add(IAdaptable a) {
- if (a instanceof WorkbenchWizardElement) {
- wizards.add(a);
- } else {
- super.add(a);
- }
- return this;
- }
-
-
- /**
- * Remove a wizard from this collection.
- */
- @Override
+ if (a instanceof WorkbenchWizardElement) {
+ wizards.add(a);
+ } else {
+ super.add(a);
+ }
+ return this;
+ }
+
+ /**
+ * Remove a wizard from this collection.
+ */
+ @Override
public void remove(IAdaptable a) {
- if (a instanceof WorkbenchWizardElement) {
- wizards.remove(a);
- } else {
- super.remove(a);
- }
+ if (a instanceof WorkbenchWizardElement) {
+ wizards.remove(a);
+ } else {
+ super.remove(a);
+ }
}
/**
- * Returns the wizard collection child object corresponding to the passed
- * path (relative to this object), or <code>null</code> if such an object
- * could not be found.
- *
- * @param searchPath
- * org.eclipse.core.runtime.IPath
- * @return WizardCollectionElement
- */
- public WizardCollectionElement findChildCollection(IPath searchPath) {
- String searchString = searchPath.segment(0);
+ * Returns the wizard collection child object corresponding to the passed path
+ * (relative to this object), or <code>null</code> if such an object could not
+ * be found.
+ *
+ * @param searchPath org.eclipse.core.runtime.IPath
+ * @return WizardCollectionElement
+ */
+ public WizardCollectionElement findChildCollection(IPath searchPath) {
+ String searchString = searchPath.segment(0);
for (Object element : getChildren(null)) {
- WizardCollectionElement currentCategory = (WizardCollectionElement) element;
- if (currentCategory.getId().equals(searchString)) {
- if (searchPath.segmentCount() == 1) {
+ WizardCollectionElement currentCategory = (WizardCollectionElement) element;
+ if (currentCategory.getId().equals(searchString)) {
+ if (searchPath.segmentCount() == 1) {
return currentCategory;
}
- return currentCategory.findChildCollection(searchPath
- .removeFirstSegments(1));
- }
- }
-
- return null;
- }
-
- /**
- * Returns the wizard category corresponding to the passed
- * id, or <code>null</code> if such an object could not be found.
- * This recurses through child categories.
- *
- * @param id the id for the child category
- * @return the category, or <code>null</code> if not found
- * @since 3.1
- */
- public WizardCollectionElement findCategory(String id) {
+ return currentCategory.findChildCollection(searchPath.removeFirstSegments(1));
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the wizard category corresponding to the passed id, or
+ * <code>null</code> if such an object could not be found. This recurses through
+ * child categories.
+ *
+ * @param id the id for the child category
+ * @return the category, or <code>null</code> if not found
+ * @since 3.1
+ */
+ public WizardCollectionElement findCategory(String id) {
for (Object element : getChildren(null)) {
- WizardCollectionElement currentCategory = (WizardCollectionElement) element;
- if (id.equals(currentCategory.getId())) {
- return currentCategory;
- }
- WizardCollectionElement childCategory = currentCategory.findCategory(id);
- if (childCategory != null) {
- return childCategory;
- }
- }
- return null;
- }
-
- /**
- * Returns this collection's associated wizard object corresponding to the
- * passed id, or <code>null</code> if such an object could not be found.
- *
- * @param searchId the id to search on
- * @param recursive whether to search recursivly
- * @return the element
- */
- public WorkbenchWizardElement findWizard(String searchId, boolean recursive) {
+ WizardCollectionElement currentCategory = (WizardCollectionElement) element;
+ if (id.equals(currentCategory.getId())) {
+ return currentCategory;
+ }
+ WizardCollectionElement childCategory = currentCategory.findCategory(id);
+ if (childCategory != null) {
+ return childCategory;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns this collection's associated wizard object corresponding to the
+ * passed id, or <code>null</code> if such an object could not be found.
+ *
+ * @param searchId the id to search on
+ * @param recursive whether to search recursivly
+ * @return the element
+ */
+ public WorkbenchWizardElement findWizard(String searchId, boolean recursive) {
for (Object wizard : getWizards()) {
- WorkbenchWizardElement currentWizard = (WorkbenchWizardElement) wizard;
- if (currentWizard.getId().equals(searchId)) {
+ WorkbenchWizardElement currentWizard = (WorkbenchWizardElement) wizard;
+ if (currentWizard.getId().equals(searchId)) {
return currentWizard;
}
- }
- if (!recursive) {
+ }
+ if (!recursive) {
return null;
}
- for (Iterator iterator = children.iterator(); iterator.hasNext();) {
- WizardCollectionElement child = (WizardCollectionElement) iterator
- .next();
- WorkbenchWizardElement result = child.findWizard(searchId, true);
- if (result != null) {
+ for (Iterator iterator = children.iterator(); iterator.hasNext();) {
+ WizardCollectionElement child = (WizardCollectionElement) iterator.next();
+ WorkbenchWizardElement result = child.findWizard(searchId, true);
+ if (result != null) {
return result;
}
- }
- return null;
- }
-
- /**
- * Returns an object which is an instance of the given class associated
- * with this object. Returns <code>null</code> if no such object can be
- * found.
- */
+ }
+ return null;
+ }
+
+ /**
+ * Returns an object which is an instance of the given class associated with
+ * this object. Returns <code>null</code> if no such object can be found.
+ */
@Override
public <T> T getAdapter(Class<T> adapter) {
- if (adapter == IWorkbenchAdapter.class) {
+ if (adapter == IWorkbenchAdapter.class) {
return adapter.cast(this);
- }
- return Platform.getAdapterManager().getAdapter(this, adapter);
- }
-
- /**
- * Returns the unique ID of this element.
- */
- @Override
+ }
+ return Platform.getAdapterManager().getAdapter(this, adapter);
+ }
+
+ /**
+ * Returns the unique ID of this element.
+ */
+ @Override
public String getId() {
- return id;
- }
+ return id;
+ }
- /**
- * Returns the label for this collection.
- */
- @Override
+ /**
+ * Returns the label for this collection.
+ */
+ @Override
public String getLabel(Object o) {
- return configElement != null ? configElement
- .getAttribute(IWorkbenchRegistryConstants.ATT_NAME) : name;
- }
-
- /**
- * Returns the logical parent of the given object in its tree.
- */
- @Override
+ return configElement != null ? configElement.getAttribute(IWorkbenchRegistryConstants.ATT_NAME) : name;
+ }
+
+ /**
+ * Returns the logical parent of the given object in its tree.
+ */
+ @Override
public Object getParent(Object o) {
- return parent;
- }
+ return parent;
+ }
- @Override
+ @Override
public IPath getPath() {
- if (parent == null) {
+ if (parent == null) {
return new Path(""); //$NON-NLS-1$
}
- return parent.getPath().append(getId());
- }
-
-
- @Override
- public IWizardDescriptor [] getWizards() {
- return getWizardsExpression((IWizardDescriptor[]) wizards
- .getTypedChildren(IWizardDescriptor.class));
- }
-
- /**
- * Takes an array of <code>IWizardDescriptor</code> and removes all
- * entries which fail the Expressions check.
- *
- * @param wizardDescriptors Array of <code>IWizardDescriptor</code>.
- * @return The array minus the elements which faled the Expressions check.
- */
- private IWizardDescriptor[] getWizardsExpression(IWizardDescriptor[] wizardDescriptors) {
- int size = wizardDescriptors.length;
- List result = new ArrayList(size);
- for (int i = 0; i < size; i++) {
- if (!WorkbenchActivityHelper.restrictUseOf(wizardDescriptors[i]))
- result.add(wizardDescriptors[i]);
- }
- return (IWizardDescriptor[])result
- .toArray(new IWizardDescriptor[result.size()]);
- }
-
- /**
- * Return the wizards minus the wizards which failed the expressions check.
- *
- * @return the wizards
- * @since 3.1
- */
- public WorkbenchWizardElement [] getWorkbenchWizardElements() {
- return getWorkbenchWizardElementsExpression(
- (WorkbenchWizardElement[]) wizards
- .getTypedChildren(WorkbenchWizardElement.class));
- }
-
- /**
- * Takes an array of <code>WorkbenchWizardElement</code> and removes all
- * entries which fail the Expressions check.
- *
- * @param workbenchWizardElements Array of <code>WorkbenchWizardElement</code>.
- * @return The array minus the elements which faled the Expressions check.
- */
- private WorkbenchWizardElement[] getWorkbenchWizardElementsExpression(
- WorkbenchWizardElement[] workbenchWizardElements) {
- int size = workbenchWizardElements.length;
- List result = new ArrayList(size);
- for (int i=0; i<size; i++) {
- WorkbenchWizardElement element = workbenchWizardElements[i];
- if (!WorkbenchActivityHelper.restrictUseOf(element))
- result.add(element);
- }
- return (WorkbenchWizardElement[])result.toArray(new WorkbenchWizardElement[result.size()]);
- }
-
-
- /**
- * Returns true if this element has no children and no wizards.
- *
- * @return whether it is empty
- */
- public boolean isEmpty() {
- return size() == 0 && wizards.size() == 0;
- }
-
- /**
- * For debugging purposes.
- */
- @Override
+ return parent.getPath().append(getId());
+ }
+
+ @Override
+ public IWizardDescriptor[] getWizards() {
+ return getWizardsExpression((IWizardDescriptor[]) wizards.getTypedChildren(IWizardDescriptor.class));
+ }
+
+ /**
+ * Takes an array of <code>IWizardDescriptor</code> and removes all entries
+ * which fail the Expressions check.
+ *
+ * @param wizardDescriptors Array of <code>IWizardDescriptor</code>.
+ * @return The array minus the elements which faled the Expressions check.
+ */
+ private IWizardDescriptor[] getWizardsExpression(IWizardDescriptor[] wizardDescriptors) {
+ int size = wizardDescriptors.length;
+ List result = new ArrayList(size);
+ for (int i = 0; i < size; i++) {
+ if (!WorkbenchActivityHelper.restrictUseOf(wizardDescriptors[i]))
+ result.add(wizardDescriptors[i]);
+ }
+ return (IWizardDescriptor[]) result.toArray(new IWizardDescriptor[result.size()]);
+ }
+
+ /**
+ * Return the wizards minus the wizards which failed the expressions check.
+ *
+ * @return the wizards
+ * @since 3.1
+ */
+ public WorkbenchWizardElement[] getWorkbenchWizardElements() {
+ return getWorkbenchWizardElementsExpression(
+ (WorkbenchWizardElement[]) wizards.getTypedChildren(WorkbenchWizardElement.class));
+ }
+
+ /**
+ * Takes an array of <code>WorkbenchWizardElement</code> and removes all entries
+ * which fail the Expressions check.
+ *
+ * @param workbenchWizardElements Array of <code>WorkbenchWizardElement</code>.
+ * @return The array minus the elements which faled the Expressions check.
+ */
+ private WorkbenchWizardElement[] getWorkbenchWizardElementsExpression(
+ WorkbenchWizardElement[] workbenchWizardElements) {
+ int size = workbenchWizardElements.length;
+ List result = new ArrayList(size);
+ for (int i = 0; i < size; i++) {
+ WorkbenchWizardElement element = workbenchWizardElements[i];
+ if (!WorkbenchActivityHelper.restrictUseOf(element))
+ result.add(element);
+ }
+ return (WorkbenchWizardElement[]) result.toArray(new WorkbenchWizardElement[result.size()]);
+ }
+
+ /**
+ * Returns true if this element has no children and no wizards.
+ *
+ * @return whether it is empty
+ */
+ public boolean isEmpty() {
+ return size() == 0 && wizards.size() == 0;
+ }
+
+ /**
+ * For debugging purposes.
+ */
+ @Override
public String toString() {
- StringBuilder buf = new StringBuilder("WizardCollection, "); //$NON-NLS-1$
- buf.append(children.size());
- buf.append(" children, "); //$NON-NLS-1$
- buf.append(wizards.size());
- buf.append(" wizards"); //$NON-NLS-1$
- return buf.toString();
- }
-
- @Override
+ StringBuilder buf = new StringBuilder("WizardCollection, "); //$NON-NLS-1$
+ buf.append(children.size());
+ buf.append(" children, "); //$NON-NLS-1$
+ buf.append(wizards.size());
+ buf.append(" wizards"); //$NON-NLS-1$
+ return buf.toString();
+ }
+
+ @Override
public ImageDescriptor getImageDescriptor(Object object) {
- return WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER);
- }
+ return WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER);
+ }
- @Override
+ @Override
public String getLocalId() {
- return getId();
- }
+ return getId();
+ }
- @Override
+ @Override
public String getPluginId() {
return configElement != null ? configElement.getContributor().getName() : pluginId;
- }
-
+ }
- @Override
+ @Override
public IWizardCategory getParent() {
return parent;
}
- @Override
+ @Override
public IWizardCategory[] getCategories() {
- return (IWizardCategory []) getTypedChildren(IWizardCategory.class);
- }
-
- /**
- * Return the collection elements.
- *
- * @return the collection elements
- * @since 3.1
- */
- public WizardCollectionElement [] getCollectionElements() {
- return (WizardCollectionElement[]) getTypedChildren(WizardCollectionElement.class);
- }
-
- /**
- * Return the raw adapted list of wizards.
- *
- * @return the list of wizards
- * @since 3.1
- */
- public AdaptableList getWizardAdaptableList() {
- return wizards;
- }
-
- @Override
+ return (IWizardCategory[]) getTypedChildren(IWizardCategory.class);
+ }
+
+ /**
+ * Return the collection elements.
+ *
+ * @return the collection elements
+ * @since 3.1
+ */
+ public WizardCollectionElement[] getCollectionElements() {
+ return (WizardCollectionElement[]) getTypedChildren(WizardCollectionElement.class);
+ }
+
+ /**
+ * Return the raw adapted list of wizards.
+ *
+ * @return the list of wizards
+ * @since 3.1
+ */
+ public AdaptableList getWizardAdaptableList() {
+ return wizards;
+ }
+
+ @Override
public String getLabel() {
return getLabel(this);
}
- /**
- * Return the configuration element.
- *
- * @return the configuration element
- * @since 3.1
- */
- public IConfigurationElement getConfigurationElement() {
- return configElement;
- }
-
- /**
- * Return the parent collection element.
- *
- * @return the parent
- * @since 3.1
- */
+ /**
+ * Return the configuration element.
+ *
+ * @return the configuration element
+ * @since 3.1
+ */
+ public IConfigurationElement getConfigurationElement() {
+ return configElement;
+ }
+
+ /**
+ * Return the parent collection element.
+ *
+ * @return the parent
+ * @since 3.1
+ */
public WizardCollectionElement getParentCollection() {
return parent;
}
@@ -406,22 +391,20 @@ public class WizardCollectionElement extends AdaptableList implements IPluginCon
}
/**
- * The helper method used to filter <code>WizardCollectionElement</code>
- * using <code>ViewerFilter</code>.<br>
+ * The helper method used to filter <code>WizardCollectionElement</code> using
+ * <code>ViewerFilter</code>.<br>
* It returns the result in the following way:<br>
* - if some of the wizards from the input collection is skipped by the
* viewerFilter then the modified copy of the collection (without skipped
* wizards) is returned<br>
* - when all wizards are skipped then null will be returned<br>
- * - if none of the wizards is skipped during filtering then the original
- * input collection is returned
+ * - if none of the wizards is skipped during filtering then the original input
+ * collection is returned
*
- * @param viewer
- * the Viewer used by <code>ViewerFilter.select</code> method
- * @param viewerFilter
- * the ViewerFilter
- * @param inputCollection
- * collection to filter
+ * @param viewer the Viewer used by <code>ViewerFilter.select</code>
+ * method
+ * @param viewerFilter the ViewerFilter
+ * @param inputCollection collection to filter
* @return inputCollection, modified copy of inputCollection or null
*
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardContentProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardContentProvider.java
index 11c036c9c30..7912af85a58 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardContentProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardContentProvider.java
@@ -25,100 +25,99 @@ import org.eclipse.ui.model.AdaptableList;
*/
public class WizardContentProvider implements ITreeContentProvider {
- private AdaptableList input;
+ private AdaptableList input;
- @Override
+ @Override
public void dispose() {
- input = null;
- }
+ input = null;
+ }
- @Override
+ @Override
public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof WizardCollectionElement) {
- ArrayList list = new ArrayList();
- WizardCollectionElement element = (WizardCollectionElement) parentElement;
+ if (parentElement instanceof WizardCollectionElement) {
+ ArrayList list = new ArrayList();
+ WizardCollectionElement element = (WizardCollectionElement) parentElement;
for (Object childCollection : element.getChildren()) {
- handleChild(childCollection, list);
- }
+ handleChild(childCollection, list);
+ }
for (Object childWizard : element.getWizards()) {
- handleChild(childWizard, list);
- }
+ handleChild(childWizard, list);
+ }
- // flatten lists with only one category
- if (list.size() == 1
- && list.get(0) instanceof WizardCollectionElement) {
- return getChildren(list.get(0));
- }
+ // flatten lists with only one category
+ if (list.size() == 1 && list.get(0) instanceof WizardCollectionElement) {
+ return getChildren(list.get(0));
+ }
- return list.toArray();
- } else if (parentElement instanceof AdaptableList) {
- AdaptableList aList = (AdaptableList) parentElement;
- Object[] children = aList.getChildren();
- ArrayList list = new ArrayList(children.length);
- for (Object element : children) {
- handleChild(element, list);
- }
- // if there is only one category, return it's children directly (flatten list)
- if (list.size() == 1
- && list.get(0) instanceof WizardCollectionElement) {
- return getChildren(list.get(0));
- }
+ return list.toArray();
+ } else if (parentElement instanceof AdaptableList) {
+ AdaptableList aList = (AdaptableList) parentElement;
+ Object[] children = aList.getChildren();
+ ArrayList list = new ArrayList(children.length);
+ for (Object element : children) {
+ handleChild(element, list);
+ }
+ // if there is only one category, return it's children directly (flatten list)
+ if (list.size() == 1 && list.get(0) instanceof WizardCollectionElement) {
+ return getChildren(list.get(0));
+ }
- return list.toArray();
- } else {
+ return list.toArray();
+ } else {
return new Object[0];
}
- }
+ }
- @Override
+ @Override
public Object[] getElements(Object inputElement) {
- return getChildren(inputElement);
- }
+ return getChildren(inputElement);
+ }
- @Override
+ @Override
public Object getParent(Object element) {
- if (element instanceof WizardCollectionElement) {
+ if (element instanceof WizardCollectionElement) {
for (Object child : input.getChildren()) {
- if (child.equals(element)) {
+ if (child.equals(element)) {
return input;
}
- }
- return ((WizardCollectionElement) element).getParent(element);
- }
- return null;
- }
+ }
+ return ((WizardCollectionElement) element).getParent(element);
+ }
+ return null;
+ }
- /**
- * Adds the item to the list, unless it's a collection element without any children.
- *
- * @param element the element to test and add
- * @param list the <code>Collection</code> to add to.
- * @since 3.0
- */
- private void handleChild(Object element, ArrayList list) {
- if (element instanceof WizardCollectionElement) {
- if (hasChildren(element)) {
+ /**
+ * Adds the item to the list, unless it's a collection element without any
+ * children.
+ *
+ * @param element the element to test and add
+ * @param list the <code>Collection</code> to add to.
+ * @since 3.0
+ */
+ private void handleChild(Object element, ArrayList list) {
+ if (element instanceof WizardCollectionElement) {
+ if (hasChildren(element)) {
list.add(element);
}
- } else {
- list.add(element);
- }
- }
+ } else {
+ list.add(element);
+ }
+ }
- @Override
+ @Override
public boolean hasChildren(Object element) {
- if (element instanceof WizardCollectionElement) {
- if (getChildren(element).length > 0) {
+ if (element instanceof WizardCollectionElement) {
+ if (getChildren(element).length > 0) {
return true;
}
- }
- return false;
- }
+ }
+ return false;
+ }
- @Override
+ @Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- input = (AdaptableList) newInput;
- }
+ input = (AdaptableList) newInput;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardPatternFilter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardPatternFilter.java
index c03beeac305..4bf12250b32 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardPatternFilter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardPatternFilter.java
@@ -28,6 +28,7 @@ import org.eclipse.ui.dialogs.PatternFilter;
public class WizardPatternFilter extends PatternFilter {
/**
* Create a new instance of a WizardPatternFilter
+ *
* @param isMatchItem
*/
public WizardPatternFilter() {
@@ -70,8 +71,7 @@ public class WizardPatternFilter extends PatternFilter {
for (Object elem : super.filter(viewer, parent, elements)) {
if (elem instanceof WizardCollectionElement) {
- Object wizardCollection = WizardCollectionElement.filter(viewer, this,
- (WizardCollectionElement) elem);
+ Object wizardCollection = WizardCollectionElement.filter(viewer, this, (WizardCollectionElement) elem);
if (wizardCollection != null) {
result.add(wizardCollection);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardTagFilter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardTagFilter.java
index 057c2b42554..63040b0e78c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardTagFilter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardTagFilter.java
@@ -27,20 +27,21 @@ import org.eclipse.ui.wizards.IWizardDescriptor;
*/
public class WizardTagFilter extends ViewerFilter {
- private String [] myTags;
+ private String[] myTags;
/**
* Create a new instance of this filter
+ *
* @param tags the wizard tags to allow
*/
- public WizardTagFilter(String [] tags) {
+ public WizardTagFilter(String[] tags) {
myTags = tags;
}
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (element instanceof IWizardDescriptor) {
- IWizardDescriptor desc = (IWizardDescriptor)element;
+ IWizardDescriptor desc = (IWizardDescriptor) element;
for (String tag : desc.getTags()) {
for (String myTag : myTags) {
if (tag.equals(myTag)) {
@@ -50,9 +51,9 @@ public class WizardTagFilter extends ViewerFilter {
}
return false;
}
- Object[] children = ((ITreeContentProvider) ((AbstractTreeViewer) viewer)
- .getContentProvider()).getChildren(element);
- if (children.length > 0) {
+ Object[] children = ((ITreeContentProvider) ((AbstractTreeViewer) viewer).getContentProvider())
+ .getChildren(element);
+ if (children.length > 0) {
return filter(viewer, element, children).length > 0;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchDialogBlockedHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchDialogBlockedHandler.java
index e4ba0e4533c..b66b3d08a5c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchDialogBlockedHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchDialogBlockedHandler.java
@@ -24,54 +24,51 @@ import org.eclipse.ui.internal.progress.BlockedJobsDialog;
* handler for the workbench.
*/
public class WorkbenchDialogBlockedHandler implements IDialogBlockedHandler {
- IProgressMonitor outerMonitor;
+ IProgressMonitor outerMonitor;
- int nestingDepth = 0;
+ int nestingDepth = 0;
- /**
- * Create a new instance of the receiver.
- */
- public WorkbenchDialogBlockedHandler() {
- //No default behavior
- }
+ /**
+ * Create a new instance of the receiver.
+ */
+ public WorkbenchDialogBlockedHandler() {
+ // No default behavior
+ }
- @Override
+ @Override
public void clearBlocked() {
- if (nestingDepth == 0) {
+ if (nestingDepth == 0) {
return;
}
- nestingDepth--;
+ nestingDepth--;
- if (nestingDepth <= 0) {
- BlockedJobsDialog.clear(outerMonitor);
- outerMonitor = null;
- nestingDepth = 0;
- }
+ if (nestingDepth <= 0) {
+ BlockedJobsDialog.clear(outerMonitor);
+ outerMonitor = null;
+ nestingDepth = 0;
+ }
- }
+ }
- @Override
- public void showBlocked(Shell parentShell,
- IProgressMonitor blockingMonitor, IStatus blockingStatus,
- String blockedName) {
+ @Override
+ public void showBlocked(Shell parentShell, IProgressMonitor blockingMonitor, IStatus blockingStatus,
+ String blockedName) {
- nestingDepth++;
- if (outerMonitor == null) {
- outerMonitor = blockingMonitor;
- //Try to get a name as best as possible
- if (blockedName == null && parentShell != null) {
+ nestingDepth++;
+ if (outerMonitor == null) {
+ outerMonitor = blockingMonitor;
+ // Try to get a name as best as possible
+ if (blockedName == null && parentShell != null) {
blockedName = parentShell.getText();
}
- BlockedJobsDialog.createBlockedDialog(parentShell, blockingMonitor,
- blockingStatus, blockedName);
- }
+ BlockedJobsDialog.createBlockedDialog(parentShell, blockingMonitor, blockingStatus, blockedName);
+ }
- }
+ }
- @Override
- public void showBlocked(IProgressMonitor blocking, IStatus blockingStatus,
- String blockedName) {
- showBlocked(null, blocking, blockingStatus, blockedName);
- }
+ @Override
+ public void showBlocked(IProgressMonitor blocking, IStatus blockingStatus, String blockedName) {
+ showBlocked(null, blocking, blockingStatus, blockedName);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchEditorsDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchEditorsDialog.java
index 993efbb2cb2..e3acb2fe790 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchEditorsDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchEditorsDialog.java
@@ -69,360 +69,349 @@ import org.eclipse.ui.internal.layout.Row;
import org.eclipse.ui.internal.progress.ProgressMonitorJobsDialog;
/**
- * Implements a dialog showing all opened editors in the workbench
- * and the recent closed editors
+ * Implements a dialog showing all opened editors in the workbench and the
+ * recent closed editors
*/
public class WorkbenchEditorsDialog extends SelectionDialog {
- private IWorkbenchWindow window;
+ private IWorkbenchWindow window;
- private Table editorsTable;
+ private Table editorsTable;
- private Button saveSelected;
+ private Button saveSelected;
- private Button closeSelected;
+ private Button closeSelected;
- private Button selectClean;
+ private Button selectClean;
- private Button invertSelection;
+ private Button invertSelection;
- private Button allSelection;
+ private Button allSelection;
- private boolean showAllPersp = false;
+ private boolean showAllPersp = false;
- private int sortColumn;
+ private int sortColumn;
- private List elements = new ArrayList();
+ private List elements = new ArrayList();
- private HashMap imageCache = new HashMap(11);
+ private HashMap imageCache = new HashMap(11);
- private HashMap disabledImageCache = new HashMap(11);
+ private HashMap disabledImageCache = new HashMap(11);
- private boolean reverse = false;
+ private boolean reverse = false;
- private Collator collator = Collator.getInstance();
+ private Collator collator = Collator.getInstance();
- private Rectangle bounds;
+ private Rectangle bounds;
- private int columnsWidth[];
+ private int columnsWidth[];
- private static final String SORT = "sort"; //$NON-NLS-1$
+ private static final String SORT = "sort"; //$NON-NLS-1$
- private static final String ALLPERSP = "allPersp"; //$NON-NLS-1$
+ private static final String ALLPERSP = "allPersp"; //$NON-NLS-1$
- private static final String BOUNDS = "bounds"; //$NON-NLS-1$
+ private static final String BOUNDS = "bounds"; //$NON-NLS-1$
- private static final String COLUMNS = "columns"; //$NON-NLS-1$
+ private static final String COLUMNS = "columns"; //$NON-NLS-1$
- private SelectionListener headerListener = widgetSelectedAdapter(e -> {
+ private SelectionListener headerListener = widgetSelectedAdapter(e -> {
TableColumn column = (TableColumn) e.widget;
int index = editorsTable.indexOf(column);
- if (index == sortColumn) {
+ if (index == sortColumn) {
reverse = !reverse;
} else {
sortColumn = index;
}
editorsTable.setSortDirection(reverse ? SWT.DOWN : SWT.UP);
editorsTable.setSortColumn(column);
- updateItems();
+ updateItems();
});
- /**
- * Constructor for WorkbenchEditorsDialog.
- *
- * @param window the window
- */
- public WorkbenchEditorsDialog(IWorkbenchWindow window) {
- super(window.getShell());
- this.window = window;
- setTitle(WorkbenchMessages.WorkbenchEditorsDialog_title);
-
- IDialogSettings s = getDialogSettings();
- if (s.get(ALLPERSP) == null) {
- sortColumn = 0;
- } else {
- showAllPersp = s.getBoolean(ALLPERSP);
- sortColumn = s.getInt(SORT);
- String[] array = s.getArray(BOUNDS);
- if (array != null) {
- bounds = new Rectangle(0, 0, 0, 0);
- bounds.x = Integer.valueOf(array[0]).intValue();
- bounds.y = Integer.valueOf(array[1]).intValue();
- bounds.width = Integer.valueOf(array[2]).intValue();
- bounds.height = Integer.valueOf(array[3]).intValue();
- }
- array = s.getArray(COLUMNS);
- if (array != null) {
- columnsWidth = new int[array.length];
- for (int i = 0; i < columnsWidth.length; i++) {
+ /**
+ * Constructor for WorkbenchEditorsDialog.
+ *
+ * @param window the window
+ */
+ public WorkbenchEditorsDialog(IWorkbenchWindow window) {
+ super(window.getShell());
+ this.window = window;
+ setTitle(WorkbenchMessages.WorkbenchEditorsDialog_title);
+
+ IDialogSettings s = getDialogSettings();
+ if (s.get(ALLPERSP) == null) {
+ sortColumn = 0;
+ } else {
+ showAllPersp = s.getBoolean(ALLPERSP);
+ sortColumn = s.getInt(SORT);
+ String[] array = s.getArray(BOUNDS);
+ if (array != null) {
+ bounds = new Rectangle(0, 0, 0, 0);
+ bounds.x = Integer.valueOf(array[0]).intValue();
+ bounds.y = Integer.valueOf(array[1]).intValue();
+ bounds.width = Integer.valueOf(array[2]).intValue();
+ bounds.height = Integer.valueOf(array[3]).intValue();
+ }
+ array = s.getArray(COLUMNS);
+ if (array != null) {
+ columnsWidth = new int[array.length];
+ for (int i = 0; i < columnsWidth.length; i++) {
columnsWidth[i] = Integer.valueOf(array[i]).intValue();
}
- }
- }
+ }
+ }
setShellStyle(getShellStyle() | SWT.SHEET);
- }
+ }
- @Override
+ @Override
protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(newShell,
- IWorkbenchHelpContextIds.WORKBENCH_EDITORS_DIALOG);
- }
+ super.configureShell(newShell);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(newShell, IWorkbenchHelpContextIds.WORKBENCH_EDITORS_DIALOG);
+ }
- @Override
+ @Override
protected void createButtonsForButtonBar(Composite parent) {
- // Typically we would use the parent's createButtonsForButtonBar.
- // However, we only want a Cancel button and not an OK button. The
- // OK button will be used later (in createDialogArea) to activate
- // the selected editor.
- createButton(parent, IDialogConstants.CANCEL_ID,
- IDialogConstants.CANCEL_LABEL, false);
- Button button = getButton(IDialogConstants.CANCEL_ID);
- if (button != null) {
+ // Typically we would use the parent's createButtonsForButtonBar.
+ // However, we only want a Cancel button and not an OK button. The
+ // OK button will be used later (in createDialogArea) to activate
+ // the selected editor.
+ createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
+ Button button = getButton(IDialogConstants.CANCEL_ID);
+ if (button != null) {
button.setText(WorkbenchMessages.WorkbenchEditorsDialog_close);
}
- }
+ }
- /**
- * Initialize the dialog bounds with the bounds saved
- * from the settings.
- */
- @Override
+ /**
+ * Initialize the dialog bounds with the bounds saved from the settings.
+ */
+ @Override
protected void initializeBounds() {
- if (bounds != null) {
- getShell().setBounds(bounds);
- } else {
- super.initializeBounds();
- }
- }
-
- /**
- * Creates the contents of this dialog, initializes the
- * listener and the update thread.
- */
- @Override
+ if (bounds != null) {
+ getShell().setBounds(bounds);
+ } else {
+ super.initializeBounds();
+ }
+ }
+
+ /**
+ * Creates the contents of this dialog, initializes the listener and the update
+ * thread.
+ */
+ @Override
protected Control createDialogArea(Composite parent) {
- initializeDialogUnits(parent);
-
- Font font = parent.getFont();
-
- Composite dialogArea = new Composite(parent, SWT.NONE);
- CellLayout dialogAreaLayout = new CellLayout(1)
- .setMargins(
- convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN),
- convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN))
- .setSpacing(
- convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING),
- convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING))
- .setRow(1, Row.growing());
- dialogArea.setLayout(dialogAreaLayout);
- dialogArea.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- //Label over the table
- Label l = new Label(dialogArea, SWT.NONE);
- l.setText(WorkbenchMessages.WorkbenchEditorsDialog_label);
- l.setFont(font);
- l.setLayoutData(new CellData().align(SWT.FILL, SWT.CENTER));
- //Table showing the editors name, full path and perspective
- editorsTable = new Table(dialogArea, SWT.MULTI | SWT.BORDER
- | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
- editorsTable.setLinesVisible(true);
- editorsTable.setHeaderVisible(true);
- editorsTable.setFont(font);
-
- final int height = 16 * editorsTable.getItemHeight();
- final int width = (int) (2.5 * height);
-
- CellData tableData = new CellData().align(SWT.FILL, SWT.FILL).setHint(
- CellData.OVERRIDE, width, height);
-
- editorsTable.setLayoutData(tableData);
- editorsTable.setLayout(new Layout() {
- @Override
- protected Point computeSize(Composite composite, int wHint,
- int hHint, boolean flushCache) {
- return new Point(width, height);
- }
-
- @Override
+ initializeDialogUnits(parent);
+
+ Font font = parent.getFont();
+
+ Composite dialogArea = new Composite(parent, SWT.NONE);
+ CellLayout dialogAreaLayout = new CellLayout(1)
+ .setMargins(convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN),
+ convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN))
+ .setSpacing(convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING),
+ convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING))
+ .setRow(1, Row.growing());
+ dialogArea.setLayout(dialogAreaLayout);
+ dialogArea.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ // Label over the table
+ Label l = new Label(dialogArea, SWT.NONE);
+ l.setText(WorkbenchMessages.WorkbenchEditorsDialog_label);
+ l.setFont(font);
+ l.setLayoutData(new CellData().align(SWT.FILL, SWT.CENTER));
+ // Table showing the editors name, full path and perspective
+ editorsTable = new Table(dialogArea, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
+ editorsTable.setLinesVisible(true);
+ editorsTable.setHeaderVisible(true);
+ editorsTable.setFont(font);
+
+ final int height = 16 * editorsTable.getItemHeight();
+ final int width = (int) (2.5 * height);
+
+ CellData tableData = new CellData().align(SWT.FILL, SWT.FILL).setHint(CellData.OVERRIDE, width, height);
+
+ editorsTable.setLayoutData(tableData);
+ editorsTable.setLayout(new Layout() {
+ @Override
+ protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) {
+ return new Point(width, height);
+ }
+
+ @Override
protected void layout(Composite composite, boolean flushCache) {
- TableColumn c[] = editorsTable.getColumns();
- if (columnsWidth == null) {
- int w = editorsTable.getClientArea().width;
- c[0].setWidth(w * 1 / 3);
- c[1].setWidth(w - c[0].getWidth());
- } else {
- c[0].setWidth(columnsWidth[0]);
- c[1].setWidth(columnsWidth[1]);
- }
- editorsTable.setLayout(null);
- }
- });
- //Name column
- TableColumn tc = new TableColumn(editorsTable, SWT.NONE);
- tc.setResizable(true);
- tc.setText(WorkbenchMessages.WorkbenchEditorsDialog_name);
- tc.addSelectionListener(headerListener);
- //Full path column
- tc = new TableColumn(editorsTable, SWT.NONE);
- tc.setResizable(true);
- tc.setText(WorkbenchMessages.WorkbenchEditorsDialog_path);
- tc.addSelectionListener(headerListener);
-
- // A composite for selection option buttons
- Composite selectionButtons = new Composite(dialogArea, SWT.NULL);
- Label compLabel = new Label(selectionButtons, SWT.NULL);
- compLabel.setFont(font);
- GridLayout layout = new GridLayout();
- layout.numColumns = 4;
- selectionButtons.setLayout(layout);
-
- //Select clean editors button
- selectClean = new Button(selectionButtons, SWT.PUSH);
- selectClean.setText(WorkbenchMessages.WorkbenchEditorsDialog_selectClean);
- selectClean.addSelectionListener(widgetSelectedAdapter(e -> {
- editorsTable.setSelection(selectClean(editorsTable.getItems()));
- updateButtons();
+ TableColumn c[] = editorsTable.getColumns();
+ if (columnsWidth == null) {
+ int w = editorsTable.getClientArea().width;
+ c[0].setWidth(w * 1 / 3);
+ c[1].setWidth(w - c[0].getWidth());
+ } else {
+ c[0].setWidth(columnsWidth[0]);
+ c[1].setWidth(columnsWidth[1]);
+ }
+ editorsTable.setLayout(null);
+ }
+ });
+ // Name column
+ TableColumn tc = new TableColumn(editorsTable, SWT.NONE);
+ tc.setResizable(true);
+ tc.setText(WorkbenchMessages.WorkbenchEditorsDialog_name);
+ tc.addSelectionListener(headerListener);
+ // Full path column
+ tc = new TableColumn(editorsTable, SWT.NONE);
+ tc.setResizable(true);
+ tc.setText(WorkbenchMessages.WorkbenchEditorsDialog_path);
+ tc.addSelectionListener(headerListener);
+
+ // A composite for selection option buttons
+ Composite selectionButtons = new Composite(dialogArea, SWT.NULL);
+ Label compLabel = new Label(selectionButtons, SWT.NULL);
+ compLabel.setFont(font);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 4;
+ selectionButtons.setLayout(layout);
+
+ // Select clean editors button
+ selectClean = new Button(selectionButtons, SWT.PUSH);
+ selectClean.setText(WorkbenchMessages.WorkbenchEditorsDialog_selectClean);
+ selectClean.addSelectionListener(widgetSelectedAdapter(e -> {
+ editorsTable.setSelection(selectClean(editorsTable.getItems()));
+ updateButtons();
}));
- selectClean.setFont(font);
- setButtonLayoutData(selectClean);
+ selectClean.setFont(font);
+ setButtonLayoutData(selectClean);
- //Invert selection button
- invertSelection = new Button(selectionButtons, SWT.PUSH);
- invertSelection.setText(WorkbenchMessages.WorkbenchEditorsDialog_invertSelection);
- invertSelection.addSelectionListener(widgetSelectedAdapter(e -> {
+ // Invert selection button
+ invertSelection = new Button(selectionButtons, SWT.PUSH);
+ invertSelection.setText(WorkbenchMessages.WorkbenchEditorsDialog_invertSelection);
+ invertSelection.addSelectionListener(widgetSelectedAdapter(e -> {
editorsTable.setSelection(invertedSelection(editorsTable.getItems(), editorsTable.getSelection()));
- updateButtons();
+ updateButtons();
}));
- invertSelection.setFont(font);
- setButtonLayoutData(invertSelection);
-
- //Select all button
- allSelection = new Button(selectionButtons, SWT.PUSH);
- allSelection.setText(WorkbenchMessages.WorkbenchEditorsDialog_allSelection);
- allSelection.addSelectionListener(widgetSelectedAdapter(e -> {
- editorsTable.setSelection(editorsTable.getItems());
- updateButtons();
+ invertSelection.setFont(font);
+ setButtonLayoutData(invertSelection);
+
+ // Select all button
+ allSelection = new Button(selectionButtons, SWT.PUSH);
+ allSelection.setText(WorkbenchMessages.WorkbenchEditorsDialog_allSelection);
+ allSelection.addSelectionListener(widgetSelectedAdapter(e -> {
+ editorsTable.setSelection(editorsTable.getItems());
+ updateButtons();
}));
- allSelection.setFont(font);
- setButtonLayoutData(allSelection);
-
- // A composite for selected editor action buttons
- Composite actionButtons = new Composite(dialogArea, SWT.NULL);
- Label actLabel = new Label(actionButtons, SWT.NULL);
- actLabel.setFont(font);
- GridLayout actLayout = new GridLayout();
- actLayout.numColumns = 4;
- actionButtons.setLayout(actLayout);
-
- // Activate selected editor button
- createButton(actionButtons, IDialogConstants.OK_ID, WorkbenchMessages.WorkbenchEditorsDialog_activate,
- true);
-
- //Close selected editors button
- closeSelected = new Button(actionButtons, SWT.PUSH);
- closeSelected.setText(WorkbenchMessages.WorkbenchEditorsDialog_closeSelected);
- closeSelected.addSelectionListener(widgetSelectedAdapter(e -> closeItems(editorsTable.getSelection())));
- closeSelected.setFont(font);
- setButtonLayoutData(closeSelected);
-
- //Save selected editors button
- saveSelected = new Button(actionButtons, SWT.PUSH);
- saveSelected.setText(WorkbenchMessages.WorkbenchEditorsDialog_saveSelected);
- saveSelected.addSelectionListener(widgetSelectedAdapter(e -> saveItems(editorsTable.getSelection())));
- saveSelected.setFont(font);
- setButtonLayoutData(saveSelected);
-
- //Show only active perspective button
- final Button showAllPerspButton = new Button(dialogArea, SWT.CHECK);
- showAllPerspButton.setText(WorkbenchMessages.WorkbenchEditorsDialog_showAllPersp);
- showAllPerspButton.setSelection(showAllPersp);
- showAllPerspButton.setFont(font);
- setButtonLayoutData(showAllPerspButton);
- showAllPerspButton.addSelectionListener(widgetSelectedAdapter(e -> {
- showAllPersp = showAllPerspButton.getSelection();
- updateItems();
+ allSelection.setFont(font);
+ setButtonLayoutData(allSelection);
+
+ // A composite for selected editor action buttons
+ Composite actionButtons = new Composite(dialogArea, SWT.NULL);
+ Label actLabel = new Label(actionButtons, SWT.NULL);
+ actLabel.setFont(font);
+ GridLayout actLayout = new GridLayout();
+ actLayout.numColumns = 4;
+ actionButtons.setLayout(actLayout);
+
+ // Activate selected editor button
+ createButton(actionButtons, IDialogConstants.OK_ID, WorkbenchMessages.WorkbenchEditorsDialog_activate, true);
+
+ // Close selected editors button
+ closeSelected = new Button(actionButtons, SWT.PUSH);
+ closeSelected.setText(WorkbenchMessages.WorkbenchEditorsDialog_closeSelected);
+ closeSelected.addSelectionListener(widgetSelectedAdapter(e -> closeItems(editorsTable.getSelection())));
+ closeSelected.setFont(font);
+ setButtonLayoutData(closeSelected);
+
+ // Save selected editors button
+ saveSelected = new Button(actionButtons, SWT.PUSH);
+ saveSelected.setText(WorkbenchMessages.WorkbenchEditorsDialog_saveSelected);
+ saveSelected.addSelectionListener(widgetSelectedAdapter(e -> saveItems(editorsTable.getSelection())));
+ saveSelected.setFont(font);
+ setButtonLayoutData(saveSelected);
+
+ // Show only active perspective button
+ final Button showAllPerspButton = new Button(dialogArea, SWT.CHECK);
+ showAllPerspButton.setText(WorkbenchMessages.WorkbenchEditorsDialog_showAllPersp);
+ showAllPerspButton.setSelection(showAllPersp);
+ showAllPerspButton.setFont(font);
+ setButtonLayoutData(showAllPerspButton);
+ showAllPerspButton.addSelectionListener(widgetSelectedAdapter(e -> {
+ showAllPersp = showAllPerspButton.getSelection();
+ updateItems();
}));
- //Create the items and update buttons state
- updateItems();
- updateButtons();
+ // Create the items and update buttons state
+ updateItems();
+ updateButtons();
- editorsTable.addSelectionListener(new SelectionAdapter() {
- @Override
+ editorsTable.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
- updateButtons();
- }
+ updateButtons();
+ }
- @Override
+ @Override
public void widgetDefaultSelected(SelectionEvent e) {
- okPressed();
- }
- });
- editorsTable.addDisposeListener(e -> {
- for (Iterator images1 = imageCache.values().iterator(); images1
- .hasNext();) {
- Image i1 = (Image) images1.next();
- i1.dispose();
- }
- for (Iterator images2 = disabledImageCache.values().iterator(); images2
- .hasNext();) {
- Image i2 = (Image) images2.next();
- i2.dispose();
- }
+ okPressed();
+ }
+ });
+ editorsTable.addDisposeListener(e -> {
+ for (Iterator images1 = imageCache.values().iterator(); images1.hasNext();) {
+ Image i1 = (Image) images1.next();
+ i1.dispose();
+ }
+ for (Iterator images2 = disabledImageCache.values().iterator(); images2.hasNext();) {
+ Image i2 = (Image) images2.next();
+ i2.dispose();
+ }
});
- editorsTable.setFocus();
- applyDialogFont(dialogArea);
- return dialogArea;
- }
-
- /**
- * Updates the button state (enabled/disabled)
- */
- private void updateButtons() {
- TableItem selectedItems[] = editorsTable.getSelection();
- boolean hasDirty = false;
- for (TableItem selectedItem : selectedItems) {
- Adapter editor = (Adapter) selectedItem.getData();
- if (editor.isDirty()) {
- hasDirty = true;
- break;
- }
- }
- saveSelected.setEnabled(hasDirty);
-
- TableItem allItems[] = editorsTable.getItems();
- boolean hasClean = false;
- for (TableItem tableItem : allItems) {
- Adapter editor = (Adapter) tableItem.getData();
- if (!editor.isDirty()) {
- hasClean = true;
- break;
- }
- }
- selectClean.setEnabled(hasClean);
- invertSelection.setEnabled(allItems.length > 0);
- closeSelected.setEnabled(selectedItems.length > 0);
-
- Button ok = getOkButton();
- if (ok != null) {
+ editorsTable.setFocus();
+ applyDialogFont(dialogArea);
+ return dialogArea;
+ }
+
+ /**
+ * Updates the button state (enabled/disabled)
+ */
+ private void updateButtons() {
+ TableItem selectedItems[] = editorsTable.getSelection();
+ boolean hasDirty = false;
+ for (TableItem selectedItem : selectedItems) {
+ Adapter editor = (Adapter) selectedItem.getData();
+ if (editor.isDirty()) {
+ hasDirty = true;
+ break;
+ }
+ }
+ saveSelected.setEnabled(hasDirty);
+
+ TableItem allItems[] = editorsTable.getItems();
+ boolean hasClean = false;
+ for (TableItem tableItem : allItems) {
+ Adapter editor = (Adapter) tableItem.getData();
+ if (!editor.isDirty()) {
+ hasClean = true;
+ break;
+ }
+ }
+ selectClean.setEnabled(hasClean);
+ invertSelection.setEnabled(allItems.length > 0);
+ closeSelected.setEnabled(selectedItems.length > 0);
+
+ Button ok = getOkButton();
+ if (ok != null) {
ok.setEnabled(selectedItems.length == 1);
}
- }
+ }
- /**
- * Closes the specified editors
- */
- private void closeItems(TableItem items[]) {
- if (items.length == 0) {
+ /**
+ * Closes the specified editors
+ */
+ private void closeItems(TableItem items[]) {
+ if (items.length == 0) {
return;
}
- // collect all instantiated editors that have been selected
+ // collect all instantiated editors that have been selected
List selectedEditors = new ArrayList();
- for (TableItem item : items) {
- Adapter e = (Adapter) item.getData();
+ for (TableItem item : items) {
+ Adapter e = (Adapter) item.getData();
if (e.editorRef != null) {
IWorkbenchPart part = e.editorRef.getPart(false);
if (part != null) {
@@ -431,8 +420,7 @@ public class WorkbenchEditorsDialog extends SelectionDialog {
}
}
- SaveablesList saveablesList = (SaveablesList) window
- .getService(ISaveablesLifecycleListener.class);
+ SaveablesList saveablesList = (SaveablesList) window.getService(ISaveablesLifecycleListener.class);
// prompt for save
if (saveablesList.preCloseParts(selectedEditors, true, this, window) != null) {
// close all editors
@@ -442,96 +430,94 @@ public class WorkbenchEditorsDialog extends SelectionDialog {
}
// update the list
updateItems();
- }
- }
-
- /**
- * Saves the specified editors
- */
- private void saveItems(TableItem items[]) {
- if (items.length == 0) {
+ }
+ }
+
+ /**
+ * Saves the specified editors
+ */
+ private void saveItems(TableItem items[]) {
+ if (items.length == 0) {
return;
}
- ProgressMonitorDialog pmd = new ProgressMonitorJobsDialog(getShell());
- pmd.open();
- for (TableItem item : items) {
- Adapter editor = (Adapter) item.getData();
- editor.save(pmd.getProgressMonitor());
- updateItem(item, editor);
- }
- pmd.close();
- updateItems();
- }
-
- /**
- * Returns all clean editors from items[];
- */
- private TableItem[] selectClean(TableItem items[]) {
- if (items.length == 0) {
+ ProgressMonitorDialog pmd = new ProgressMonitorJobsDialog(getShell());
+ pmd.open();
+ for (TableItem item : items) {
+ Adapter editor = (Adapter) item.getData();
+ editor.save(pmd.getProgressMonitor());
+ updateItem(item, editor);
+ }
+ pmd.close();
+ updateItems();
+ }
+
+ /**
+ * Returns all clean editors from items[];
+ */
+ private TableItem[] selectClean(TableItem items[]) {
+ if (items.length == 0) {
return new TableItem[0];
}
- ArrayList cleanItems = new ArrayList(items.length);
- for (TableItem item : items) {
- Adapter editor = (Adapter) item.getData();
- if (!editor.isDirty()) {
+ ArrayList cleanItems = new ArrayList(items.length);
+ for (TableItem item : items) {
+ Adapter editor = (Adapter) item.getData();
+ if (!editor.isDirty()) {
cleanItems.add(item);
}
- }
- TableItem result[] = new TableItem[cleanItems.size()];
- cleanItems.toArray(result);
- return result;
- }
-
- /**
- * Returns all clean editors from items[];
- */
- private TableItem[] invertedSelection(TableItem allItems[],
- TableItem selectedItems[]) {
- if (allItems.length == 0) {
+ }
+ TableItem result[] = new TableItem[cleanItems.size()];
+ cleanItems.toArray(result);
+ return result;
+ }
+
+ /**
+ * Returns all clean editors from items[];
+ */
+ private TableItem[] invertedSelection(TableItem allItems[], TableItem selectedItems[]) {
+ if (allItems.length == 0) {
return allItems;
}
- ArrayList invertedSelection = new ArrayList(allItems.length
- - selectedItems.length);
- outerLoop: for (int i = 0; i < allItems.length; i++) {
- for (int j = 0; j < selectedItems.length; j++) {
- if (allItems[i] == selectedItems[j]) {
+ ArrayList invertedSelection = new ArrayList(allItems.length - selectedItems.length);
+ outerLoop: for (int i = 0; i < allItems.length; i++) {
+ for (int j = 0; j < selectedItems.length; j++) {
+ if (allItems[i] == selectedItems[j]) {
continue outerLoop;
}
- }
- invertedSelection.add(allItems[i]);
- }
- TableItem result[] = new TableItem[invertedSelection.size()];
- invertedSelection.toArray(result);
- return result;
- }
-
- /**
- * Updates the specified item
- */
- private void updateItem(TableItem item, Adapter editor) {
- item.setData(editor);
- item.setText(editor.getText());
- Image image = editor.getImage();
- if (image != null)
- item.setImage(0, image);
- }
-
- /**
- * Adds all editors to elements
- */
- private void updateEditors(IWorkbenchPage[] pages) {
- for (IWorkbenchPage page : pages) {
+ }
+ invertedSelection.add(allItems[i]);
+ }
+ TableItem result[] = new TableItem[invertedSelection.size()];
+ invertedSelection.toArray(result);
+ return result;
+ }
+
+ /**
+ * Updates the specified item
+ */
+ private void updateItem(TableItem item, Adapter editor) {
+ item.setData(editor);
+ item.setText(editor.getText());
+ Image image = editor.getImage();
+ if (image != null)
+ item.setImage(0, image);
+ }
+
+ /**
+ * Adds all editors to elements
+ */
+ private void updateEditors(IWorkbenchPage[] pages) {
+ for (IWorkbenchPage page : pages) {
for (IEditorReference editor : page.getEditorReferences()) {
- elements.add(new Adapter(editor));
- }
- }
- }
-
- /**
- * Updates all items in the table
- */
- private void updateItems() {
- // record what the user has selected
+ elements.add(new Adapter(editor));
+ }
+ }
+ }
+
+ /**
+ * Updates all items in the table
+ */
+ private void updateItems() {
+ // record what the user has selected
TableItem[] selectedItems = editorsTable.getSelection();
Adapter[] selectedAdapters = new Adapter[selectedItems.length];
for (int i = 0; i < selectedItems.length; i++) {
@@ -539,75 +525,75 @@ public class WorkbenchEditorsDialog extends SelectionDialog {
}
// remove all the items
- editorsTable.removeAll();
- elements = new ArrayList();
- if (showAllPersp) {
+ editorsTable.removeAll();
+ elements = new ArrayList();
+ if (showAllPersp) {
for (IWorkbenchWindow workbenchWindow : window.getWorkbench().getWorkbenchWindows()) {
updateEditors(workbenchWindow.getPages());
}
- } else {
- IWorkbenchPage page = window.getActivePage();
- if (page != null) {
- updateEditors(new IWorkbenchPage[] { page });
- }
- }
+ } else {
+ IWorkbenchPage page = window.getActivePage();
+ if (page != null) {
+ updateEditors(new IWorkbenchPage[] { page });
+ }
+ }
- // sort the items
- sort();
+ // sort the items
+ sort();
List selection = new ArrayList(selectedItems.length);
- for (Iterator iterator = elements.iterator(); iterator.hasNext();) {
- Adapter e = (Adapter) iterator.next();
- TableItem item = new TableItem(editorsTable, SWT.NULL);
- updateItem(item, e);
+ for (Iterator iterator = elements.iterator(); iterator.hasNext();) {
+ Adapter e = (Adapter) iterator.next();
+ TableItem item = new TableItem(editorsTable, SWT.NULL);
+ updateItem(item, e);
- // try to match this item's editor to one that was previously selected
+ // try to match this item's editor to one that was previously selected
for (Adapter selectedAdapter : selectedAdapters) {
if (selectedAdapter.editorRef == e.editorRef) {
selection.add(item);
}
}
- }
+ }
- // set the selection back to the table
+ // set the selection back to the table
editorsTable.setSelection((TableItem[]) selection.toArray(new TableItem[selection.size()]));
- // update the buttons, because the selection may have changed
- updateButtons();
- }
+ // update the buttons, because the selection may have changed
+ updateButtons();
+ }
- /**
- * Sorts all the editors according to the table header
- */
- private void sort() {
- //Backward compatible. Table used to have 3 columns.
- if (sortColumn > (editorsTable.getColumnCount() - 1)) {
+ /**
+ * Sorts all the editors according to the table header
+ */
+ private void sort() {
+ // Backward compatible. Table used to have 3 columns.
+ if (sortColumn > (editorsTable.getColumnCount() - 1)) {
sortColumn = 0;
}
- Adapter a[] = new Adapter[elements.size()];
- elements.toArray(a);
- Arrays.sort(a);
- elements = Arrays.asList(a);
- }
+ Adapter a[] = new Adapter[elements.size()];
+ elements.toArray(a);
+ Arrays.sort(a);
+ elements = Arrays.asList(a);
+ }
- /**
- * The user has selected a resource and the dialog is closing.
- */
- @Override
+ /**
+ * The user has selected a resource and the dialog is closing.
+ */
+ @Override
protected void okPressed() {
- TableItem items[] = editorsTable.getSelection();
- if (items.length != 1) {
- super.okPressed();
- return;
- }
-
- Adapter selection = (Adapter) items[0].getData();
- //It would be better to activate before closing the
- //dialog but it does not work when the editor is in other
- //window. Must investigate.
- super.okPressed();
- selection.activate();
- }
+ TableItem items[] = editorsTable.getSelection();
+ if (items.length != 1) {
+ super.okPressed();
+ return;
+ }
+
+ Adapter selection = (Adapter) items[0].getData();
+ // It would be better to activate before closing the
+ // dialog but it does not work when the editor is in other
+ // window. Must investigate.
+ super.okPressed();
+ selection.activate();
+ }
@Override
public boolean close() {
@@ -615,185 +601,179 @@ public class WorkbenchEditorsDialog extends SelectionDialog {
return super.close();
}
- /**
- * Saves the dialog settings.
- */
- private void saveDialogSettings() {
- IDialogSettings s = getDialogSettings();
- s.put(ALLPERSP, showAllPersp);
- s.put(SORT, sortColumn);
- bounds = getShell().getBounds();
- String array[] = new String[4];
- array[0] = String.valueOf(bounds.x);
- array[1] = String.valueOf(bounds.y);
- array[2] = String.valueOf(bounds.width);
- array[3] = String.valueOf(bounds.height);
- s.put(BOUNDS, array);
- array = new String[editorsTable.getColumnCount()];
- for (int i = 0; i < array.length; i++) {
+ /**
+ * Saves the dialog settings.
+ */
+ private void saveDialogSettings() {
+ IDialogSettings s = getDialogSettings();
+ s.put(ALLPERSP, showAllPersp);
+ s.put(SORT, sortColumn);
+ bounds = getShell().getBounds();
+ String array[] = new String[4];
+ array[0] = String.valueOf(bounds.x);
+ array[1] = String.valueOf(bounds.y);
+ array[2] = String.valueOf(bounds.width);
+ array[3] = String.valueOf(bounds.height);
+ s.put(BOUNDS, array);
+ array = new String[editorsTable.getColumnCount()];
+ for (int i = 0; i < array.length; i++) {
array[i] = String.valueOf(editorsTable.getColumn(i).getWidth());
}
- s.put(COLUMNS, array);
- }
-
- /**
- * Return a dialog setting section for this dialog
- */
- private IDialogSettings getDialogSettings() {
- IDialogSettings settings = WorkbenchPlugin.getDefault()
- .getDialogSettings();
- IDialogSettings thisSettings = settings
- .getSection(getClass().getName());
- if (thisSettings == null) {
+ s.put(COLUMNS, array);
+ }
+
+ /**
+ * Return a dialog setting section for this dialog
+ */
+ private IDialogSettings getDialogSettings() {
+ IDialogSettings settings = WorkbenchPlugin.getDefault().getDialogSettings();
+ IDialogSettings thisSettings = settings.getSection(getClass().getName());
+ if (thisSettings == null) {
thisSettings = settings.addNewSection(getClass().getName());
}
- return thisSettings;
- }
+ return thisSettings;
+ }
- /**
- * A helper inner class to adapt EditorHistoryItem and IEditorPart
- * in the same type.
- */
- private class Adapter implements Comparable {
- IEditorReference editorRef;
+ /**
+ * A helper inner class to adapt EditorHistoryItem and IEditorPart in the same
+ * type.
+ */
+ private class Adapter implements Comparable {
+ IEditorReference editorRef;
- IEditorInput input;
+ IEditorInput input;
- IEditorDescriptor desc;
+ IEditorDescriptor desc;
- String text[];
+ String text[];
- Image image;
+ Image image;
- Adapter(IEditorReference ref) {
- editorRef = ref;
- }
+ Adapter(IEditorReference ref) {
+ editorRef = ref;
+ }
- boolean isDirty() {
- if (editorRef == null) {
+ boolean isDirty() {
+ if (editorRef == null) {
return false;
}
- return editorRef.isDirty();
- }
+ return editorRef.isDirty();
+ }
- void close() {
- if (editorRef == null) {
+ void close() {
+ if (editorRef == null) {
return;
}
WorkbenchPage p = (WorkbenchPage) editorRef.getPage();
- // already saved when the i
- p.closeEditor(editorRef, false);
- }
+ // already saved when the i
+ p.closeEditor(editorRef, false);
+ }
- void save(IProgressMonitor monitor) {
- if (editorRef == null) {
+ void save(IProgressMonitor monitor) {
+ if (editorRef == null) {
return;
}
- IEditorPart editor = (IEditorPart) editorRef.getPart(true);
- if (editor != null) {
+ IEditorPart editor = (IEditorPart) editorRef.getPart(true);
+ if (editor != null) {
editor.doSave(monitor);
}
- }
+ }
- String[] getText() {
- if (text != null) {
+ String[] getText() {
+ if (text != null) {
return text;
}
- text = new String[2];
- if (editorRef != null) {
- if (editorRef.isDirty()) {
+ text = new String[2];
+ if (editorRef != null) {
+ if (editorRef.isDirty()) {
text[0] = "*" + editorRef.getTitle(); //$NON-NLS-1$
} else {
text[0] = editorRef.getTitle();
}
- text[1] = editorRef.getTitleToolTip();
- } else {
- text[0] = input.getName();
- text[1] = input.getToolTipText();
- }
+ text[1] = editorRef.getTitleToolTip();
+ } else {
+ text[0] = input.getName();
+ text[1] = input.getToolTipText();
+ }
if (text[0] != null) {
text[0] = TextProcessor.process(text[0]);
}
if (text[1] != null) {
text[1] = TextProcessor.process(text[1]);
}
- return text;
- }
+ return text;
+ }
- Image getImage() {
- if (image != null) {
+ Image getImage() {
+ if (image != null) {
return image;
}
- if (editorRef != null) {
- image = editorRef.getTitleImage();
- } else {
- ImageDescriptor imageDesc = null;
- if (desc != null) {
- imageDesc = desc.getImageDescriptor();
+ if (editorRef != null) {
+ image = editorRef.getTitleImage();
+ } else {
+ ImageDescriptor imageDesc = null;
+ if (desc != null) {
+ imageDesc = desc.getImageDescriptor();
+ }
+ if (imageDesc == null) {
+ IEditorRegistry registry = WorkbenchPlugin.getDefault().getEditorRegistry();
+ imageDesc = registry.getImageDescriptor(input.getName());
+ // TODO: how can this honour content types? Guessing at the content type
+ // perhaps?
+
+ if (imageDesc == null) {
+ // @issue what should be the default image?
+ // image = registry.getDefaultEditor().getImageDescriptor();
+ }
+ }
+ if (imageDesc != null) {
+ image = (Image) disabledImageCache.get(imageDesc);
+ if (image == null) {
+ Image enabled = imageDesc.createImage();
+ Image disabled = new Image(editorsTable.getDisplay(), enabled, SWT.IMAGE_DISABLE);
+ enabled.dispose();
+ disabledImageCache.put(imageDesc, disabled);
+ image = disabled;
+ }
}
- if (imageDesc == null) {
- IEditorRegistry registry = WorkbenchPlugin.getDefault()
- .getEditorRegistry();
- imageDesc = registry.getImageDescriptor(input.getName());
- //TODO: how can this honour content types? Guessing at the content type perhaps?
-
- if (imageDesc == null) {
- // @issue what should be the default image?
- // image = registry.getDefaultEditor().getImageDescriptor();
- }
- }
- if (imageDesc != null) {
- image = (Image) disabledImageCache.get(imageDesc);
- if (image == null) {
- Image enabled = imageDesc.createImage();
- Image disabled = new Image(editorsTable.getDisplay(),
- enabled, SWT.IMAGE_DISABLE);
- enabled.dispose();
- disabledImageCache.put(imageDesc, disabled);
- image = disabled;
- }
- }
- }
- return image;
- }
-
- private void activate() {
- if (editorRef != null) {
- IEditorPart editor = editorRef.getEditor(true);
- WorkbenchPage p = (WorkbenchPage) editor.getEditorSite()
- .getPage();
- Shell s = p.getWorkbenchWindow().getShell();
- if (s.getMinimized()) {
+ }
+ return image;
+ }
+
+ private void activate() {
+ if (editorRef != null) {
+ IEditorPart editor = editorRef.getEditor(true);
+ WorkbenchPage p = (WorkbenchPage) editor.getEditorSite().getPage();
+ Shell s = p.getWorkbenchWindow().getShell();
+ if (s.getMinimized()) {
s.setMinimized(false);
}
- s.moveAbove(null);
- p.getWorkbenchWindow().setActivePage(p);
- p.activate(editor);
- } else {
- IWorkbenchPage p = window.getActivePage();
- if (p != null) {
- try {
- p.openEditor(input, desc.getId(), true);
- } catch (PartInitException e) {
- }
- }
- }
- }
-
- @Override
+ s.moveAbove(null);
+ p.getWorkbenchWindow().setActivePage(p);
+ p.activate(editor);
+ } else {
+ IWorkbenchPage p = window.getActivePage();
+ if (p != null) {
+ try {
+ p.openEditor(input, desc.getId(), true);
+ } catch (PartInitException e) {
+ }
+ }
+ }
+ }
+
+ @Override
public int compareTo(Object another) {
- Adapter adapter = (Adapter) another;
- int result = collator.compare(getText()[sortColumn], adapter
- .getText()[sortColumn]);
- if (result == 0) {
- int column = sortColumn == 0 ? 1 : 0;
- result = collator.compare(getText()[column],
- adapter.getText()[column]);
- }
- if (reverse) {
+ Adapter adapter = (Adapter) another;
+ int result = collator.compare(getText()[sortColumn], adapter.getText()[sortColumn]);
+ if (result == 0) {
+ int column = sortColumn == 0 ? 1 : 0;
+ result = collator.compare(getText()[column], adapter.getText()[column]);
+ }
+ if (reverse) {
return result * -1;
}
- return result;
- }
- }
+ return result;
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchPreferenceDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchPreferenceDialog.java
index db9fbe517c4..8b876afb9d5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchPreferenceDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchPreferenceDialog.java
@@ -40,31 +40,29 @@ public class WorkbenchPreferenceDialog extends FilteredPreferenceDialog {
private static WorkbenchPreferenceDialog instance = null;
/**
- * The bounds of this dialog will be persisted in the dialog settings.
- * This is defined at the most concrete level of the hierarchy so that
- * different concrete implementations don't necessarily store their bounds
- * in the same settings.
+ * The bounds of this dialog will be persisted in the dialog settings. This is
+ * defined at the most concrete level of the hierarchy so that different
+ * concrete implementations don't necessarily store their bounds in the same
+ * settings.
*
* @since 3.2
*/
private static final String DIALOG_SETTINGS_SECTION = "WorkbenchPreferenceDialogSettings"; //$NON-NLS-1$
-
/**
- * Creates a workbench preference dialog to a particular preference page. It
- * is the responsibility of the caller to then call <code>open()</code>.
- * The call to <code>open()</code> will not return until the dialog
- * closes, so this is the last chance to manipulate the dialog.
+ * Creates a workbench preference dialog to a particular preference page. It is
+ * the responsibility of the caller to then call <code>open()</code>. The call
+ * to <code>open()</code> will not return until the dialog closes, so this is
+ * the last chance to manipulate the dialog.
*
- * @param shell
- * The Shell to parent the dialog off of if it is not
- * already created. May be <code>null</code>
- * in which case the active workbench window will be used
- * if available.
- * @param preferencePageId
- * The identifier of the preference page to open; may be
- * <code>null</code>. If it is <code>null</code>, then the
- * preference page is not selected or modified in any way.
+ * @param shell The Shell to parent the dialog off of if it is not
+ * already created. May be <code>null</code> in which
+ * case the active workbench window will be used if
+ * available.
+ * @param preferencePageId The identifier of the preference page to open; may be
+ * <code>null</code>. If it is <code>null</code>, then
+ * the preference page is not selected or modified in
+ * any way.
* @return The selected preference page.
* @since 3.1
*/
@@ -73,8 +71,8 @@ public class WorkbenchPreferenceDialog extends FilteredPreferenceDialog {
if (instance == null) {
/*
- * There is no existing preference dialog, so open a new one with
- * the given selected page.
+ * There is no existing preference dialog, so open a new one with the given
+ * selected page.
*/
Shell parentShell = shell;
@@ -90,8 +88,7 @@ public class WorkbenchPreferenceDialog extends FilteredPreferenceDialog {
}
// Create the dialog
- final PreferenceManager preferenceManager = PlatformUI.getWorkbench()
- .getPreferenceManager();
+ final PreferenceManager preferenceManager = PlatformUI.getWorkbench().getPreferenceManager();
dialog = new WorkbenchPreferenceDialog(parentShell, preferenceManager);
if (preferencePageId != null) {
dialog.setSelectedNode(preferencePageId);
@@ -100,14 +97,13 @@ public class WorkbenchPreferenceDialog extends FilteredPreferenceDialog {
if (preferencePageId != null) {
dialog.getCurrentPage().getControl().setFocus();
}
- PlatformUI.getWorkbench().getHelpSystem().setHelp(
- dialog.getShell(),
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(dialog.getShell(),
IWorkbenchHelpContextIds.PREFERENCE_DIALOG);
} else {
/*
- * There is an existing preference dialog, so let's just select the
- * given preference page.
+ * There is an existing preference dialog, so let's just select the given
+ * preference page.
*/
dialog = instance;
if (preferencePageId != null) {
@@ -125,32 +121,26 @@ public class WorkbenchPreferenceDialog extends FilteredPreferenceDialog {
* Creates a new preference dialog under the control of the given preference
* manager.
*
- * @param parentShell
- * the parent shell
- * @param manager
- * the preference manager
+ * @param parentShell the parent shell
+ * @param manager the preference manager
*/
public WorkbenchPreferenceDialog(Shell parentShell, PreferenceManager manager) {
super(parentShell, manager);
- Assert.isTrue((instance == null),
- "There cannot be two preference dialogs at once in the workbench."); //$NON-NLS-1$
+ Assert.isTrue((instance == null), "There cannot be two preference dialogs at once in the workbench."); //$NON-NLS-1$
instance = this;
}
-
@Override
public boolean close() {
instance = null;
return super.close();
}
-
/**
- * Differs from super implementation in that if the node is found but should
- * be filtered based on a call to
- * <code>WorkbenchActivityHelper.filterItem()</code> then
- * <code>null</code> is returned.
+ * Differs from super implementation in that if the node is found but should be
+ * filtered based on a call to <code>WorkbenchActivityHelper.filterItem()</code>
+ * then <code>null</code> is returned.
*
* @see org.eclipse.jface.preference.PreferenceDialog#findNodeMatching(java.lang.String)
*/
@@ -170,17 +160,17 @@ public class WorkbenchPreferenceDialog extends FilteredPreferenceDialog {
@Override
protected IDialogSettings getDialogBoundsSettings() {
- IDialogSettings settings = WorkbenchPlugin.getDefault().getDialogSettings();
- IDialogSettings section = settings.getSection(DIALOG_SETTINGS_SECTION);
- if (section == null) {
- section = settings.addNewSection(DIALOG_SETTINGS_SECTION);
- }
- return section;
+ IDialogSettings settings = WorkbenchPlugin.getDefault().getDialogSettings();
+ IDialogSettings section = settings.getSection(DIALOG_SETTINGS_SECTION);
+ if (section == null) {
+ section = settings.addNewSection(DIALOG_SETTINGS_SECTION);
+ }
+ return section;
}
/**
- * Overridden to persist only the location, not the size, since the current
- * page dictates the most appropriate size for the dialog.
+ * Overridden to persist only the location, not the size, since the current page
+ * dictates the most appropriate size for the dialog.
*
* @since 3.2
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchPreferenceManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchPreferenceManager.java
index 1517cb757c5..a06a9e4c08d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchPreferenceManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchPreferenceManager.java
@@ -37,8 +37,7 @@ import org.eclipse.ui.internal.registry.PreferencePageRegistryReader;
* The WorkbenchPreferenceManager is the manager that can handle categories and
* preference nodes.
*/
-public class WorkbenchPreferenceManager extends PreferenceManager implements
- IExtensionChangeHandler {
+public class WorkbenchPreferenceManager extends PreferenceManager implements IExtensionChangeHandler {
/**
* Create a new instance of the receiver with the specified seperatorChar
@@ -52,15 +51,13 @@ public class WorkbenchPreferenceManager extends PreferenceManager implements
tracker.registerHandler(this, ExtensionTracker.createExtensionPointFilter(getExtensionPointFilter()));
// add a listener for keyword deltas. If any occur clear all page caches
- Platform.getExtensionRegistry().addRegistryChangeListener(
- event -> {
- if (event.getExtensionDeltas(PlatformUI.PLUGIN_ID,
- IWorkbenchRegistryConstants.PL_KEYWORDS).length > 0) {
- for (Object element : getElements(PreferenceManager.POST_ORDER)) {
- ((WorkbenchPreferenceNode) element).clearKeywords();
- }
- }
- });
+ Platform.getExtensionRegistry().addRegistryChangeListener(event -> {
+ if (event.getExtensionDeltas(PlatformUI.PLUGIN_ID, IWorkbenchRegistryConstants.PL_KEYWORDS).length > 0) {
+ for (Object element : getElements(PreferenceManager.POST_ORDER)) {
+ ((WorkbenchPreferenceNode) element).clearKeywords();
+ }
+ }
+ });
}
/**
@@ -86,14 +83,12 @@ public class WorkbenchPreferenceManager extends PreferenceManager implements
/**
* Register a node with the extension tracker.
*
- * @param node
- * register the given node and its subnodes with the extension
- * tracker
+ * @param node register the given node and its subnodes with the extension
+ * tracker
*/
private void registerNode(WorkbenchPreferenceNode node) {
PlatformUI.getWorkbench().getExtensionTracker().registerObject(
- node.getConfigurationElement().getDeclaringExtension(), node,
- IExtensionTracker.REF_WEAK);
+ node.getConfigurationElement().getDeclaringExtension(), node, IExtensionTracker.REF_WEAK);
for (IPreferenceNode subNode : node.getSubNodes()) {
registerNode((WorkbenchPreferenceNode) subNode);
}
@@ -103,8 +98,7 @@ public class WorkbenchPreferenceManager extends PreferenceManager implements
@Override
public void addExtension(IExtensionTracker tracker, IExtension extension) {
for (IConfigurationElement configElement : extension.getConfigurationElements()) {
- WorkbenchPreferenceNode node = PreferencePageRegistryReader
- .createNode(configElement);
+ WorkbenchPreferenceNode node = PreferencePageRegistryReader.createNode(configElement);
if (node == null) {
continue;
}
@@ -122,7 +116,8 @@ public class WorkbenchPreferenceManager extends PreferenceManager implements
}
if (parent == null) {
// Could not find the parent - log
- String message = "Invalid preference category path: " + category + " (bundle: " + node.getPluginId() + ", page: " + node.getId() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ String message = "Invalid preference category path: " + category + " (bundle: " + node.getPluginId() //$NON-NLS-1$ //$NON-NLS-2$
+ + ", page: " + node.getId() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
WorkbenchPlugin.log(StatusUtil.newStatus(IStatus.WARNING, message, null));
addToRoot(node);
} else {
@@ -133,8 +128,8 @@ public class WorkbenchPreferenceManager extends PreferenceManager implements
}
private IExtensionPoint getExtensionPointFilter() {
- return Platform.getExtensionRegistry().getExtensionPoint(
- PlatformUI.PLUGIN_ID, IWorkbenchRegistryConstants.PL_PREFERENCES);
+ return Platform.getExtensionRegistry().getExtensionPoint(PlatformUI.PLUGIN_ID,
+ IWorkbenchRegistryConstants.PL_PREFERENCES);
}
@Override
@@ -151,14 +146,11 @@ public class WorkbenchPreferenceManager extends PreferenceManager implements
/**
* Removes the node from the manager, searching through all subnodes.
*
- * @param parent
- * the node to search
- * @param nodeToRemove
- * the node to remove
+ * @param parent the node to search
+ * @param nodeToRemove the node to remove
* @return whether the node was removed
*/
- private boolean deepRemove(IPreferenceNode parent,
- IPreferenceNode nodeToRemove) {
+ private boolean deepRemove(IPreferenceNode parent, IPreferenceNode nodeToRemove) {
if (parent == nodeToRemove) {
if (parent == getRoot()) {
removeAll(); // we're removing the root
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchPreferenceNode.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchPreferenceNode.java
index 3e84a2739ec..2620893fdc4 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchPreferenceNode.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchPreferenceNode.java
@@ -34,6 +34,7 @@ public class WorkbenchPreferenceNode extends WorkbenchPreferenceExtensionNode {
/**
* Create a new instance of the receiver.
+ *
* @param nodeId
* @param element
*/
@@ -48,8 +49,8 @@ public class WorkbenchPreferenceNode extends WorkbenchPreferenceExtensionNode {
public void createPage() {
IWorkbenchPreferencePage page;
try {
- page = (IWorkbenchPreferencePage) WorkbenchPlugin.createExtension(
- getConfigurationElement(), IWorkbenchRegistryConstants.ATT_CLASS);
+ page = (IWorkbenchPreferencePage) WorkbenchPlugin.createExtension(getConfigurationElement(),
+ IWorkbenchRegistryConstants.ATT_CLASS);
} catch (CoreException e) {
// Just inform the user about the error. The details are
// written to the log by now.
@@ -68,10 +69,10 @@ public class WorkbenchPreferenceNode extends WorkbenchPreferenceExtensionNode {
/**
* Return the category name for the node.
+ *
* @return java.lang.String
*/
public String getCategory() {
- return getConfigurationElement().getAttribute(
- CategorizedPageRegistryReader.ATT_CATEGORY);
+ return getConfigurationElement().getAttribute(CategorizedPageRegistryReader.ATT_CATEGORY);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchPreferencePage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchPreferencePage.java
index 5c76549801c..deea2ce8999 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchPreferencePage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchPreferencePage.java
@@ -16,7 +16,6 @@
*******************************************************************************/
package org.eclipse.ui.internal.dialogs;
-
import static org.eclipse.swt.events.SelectionListener.widgetSelectedAdapter;
import org.eclipse.jface.dialogs.IDialogConstants;
@@ -53,123 +52,117 @@ import org.eclipse.ui.internal.util.PrefUtil;
/**
* Generic workbench main preference page.
*/
-public class WorkbenchPreferencePage extends PreferencePage implements
- IWorkbenchPreferencePage {
- private Button stickyCycleButton;
+public class WorkbenchPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
+ private Button stickyCycleButton;
- private Button doubleClickButton;
+ private Button doubleClickButton;
- private Button singleClickButton;
+ private Button singleClickButton;
- private Button selectOnHoverButton;
+ private Button selectOnHoverButton;
- private Button openAfterDelayButton;
+ private Button openAfterDelayButton;
- private Button showUserDialogButton;
+ private Button showUserDialogButton;
private IntegerFieldEditor saveInterval;
- private boolean openOnSingleClick;
+ private boolean openOnSingleClick;
- private boolean selectOnHover;
+ private boolean selectOnHover;
- private boolean openAfterDelay;
+ private boolean openAfterDelay;
private Button showHeapStatusButton;
protected static int MAX_SAVE_INTERVAL = 9999;
- @Override
+ @Override
protected Control createContents(Composite parent) {
- // @issue if the product subclasses this page, then it should provide
- // the help content
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
- IWorkbenchHelpContextIds.WORKBENCH_PREFERENCE_PAGE);
+ // @issue if the product subclasses this page, then it should provide
+ // the help content
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IWorkbenchHelpContextIds.WORKBENCH_PREFERENCE_PAGE);
- Composite composite = createComposite(parent);
+ Composite composite = createComposite(parent);
createSettings(composite);
- createSpace(composite);
- createOpenModeGroup(composite);
+ createSpace(composite);
+ createOpenModeGroup(composite);
- applyDialogFont(composite);
+ applyDialogFont(composite);
- return composite;
- }
+ return composite;
+ }
- /**
- * Create the buttons at the top of the preference page.
- * @param composite
- */
+ /**
+ * Create the buttons at the top of the preference page.
+ *
+ * @param composite
+ */
protected void createSettings(Composite composite) {
createShowUserDialogPref(composite);
- createStickyCyclePref(composite);
- createHeapStatusPref(composite);
+ createStickyCyclePref(composite);
+ createHeapStatusPref(composite);
createSaveIntervalGroup(composite);
}
- /**
- * Create the widget for the user dialog preference.
- *
- * @param composite
- */
- protected void createShowUserDialogPref(Composite composite) {
- showUserDialogButton = new Button(composite, SWT.CHECK);
- showUserDialogButton.setText(WorkbenchMessages.WorkbenchPreference_RunInBackgroundButton);
- showUserDialogButton.setToolTipText(WorkbenchMessages.WorkbenchPreference_RunInBackgroundToolTip);
- showUserDialogButton.setSelection(WorkbenchPlugin.getDefault()
- .getPreferenceStore().getBoolean(
- IPreferenceConstants.RUN_IN_BACKGROUND));
- }
-
- /**
- * Create the widget for the heap status preference.
- *
- * @param composite
- */
- protected void createHeapStatusPref(Composite composite) {
- showHeapStatusButton = new Button(composite, SWT.CHECK);
- showHeapStatusButton.setText(WorkbenchMessages.WorkbenchPreference_HeapStatusButton);
- showHeapStatusButton.setToolTipText(WorkbenchMessages.WorkbenchPreference_HeapStatusButtonToolTip);
-
- showHeapStatusButton.setSelection(PrefUtil.getAPIPreferenceStore().getBoolean(
- IWorkbenchPreferenceConstants.SHOW_MEMORY_MONITOR));
- }
-
- /**
- * Creates the composite which will contain all the preference controls for
- * this page.
- *
- * @param parent
- * the parent composite
- * @return the composite for this page
- */
- protected Composite createComposite(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL
- | GridData.HORIZONTAL_ALIGN_FILL));
- return composite;
- }
-
- protected void createStickyCyclePref(Composite composite) {
- stickyCycleButton = new Button(composite, SWT.CHECK);
- stickyCycleButton.setText(WorkbenchMessages.WorkbenchPreference_stickyCycleButton);
- stickyCycleButton.setSelection(getPreferenceStore().getBoolean(
- IPreferenceConstants.STICKY_CYCLE));
- }
+ /**
+ * Create the widget for the user dialog preference.
+ *
+ * @param composite
+ */
+ protected void createShowUserDialogPref(Composite composite) {
+ showUserDialogButton = new Button(composite, SWT.CHECK);
+ showUserDialogButton.setText(WorkbenchMessages.WorkbenchPreference_RunInBackgroundButton);
+ showUserDialogButton.setToolTipText(WorkbenchMessages.WorkbenchPreference_RunInBackgroundToolTip);
+ showUserDialogButton.setSelection(
+ WorkbenchPlugin.getDefault().getPreferenceStore().getBoolean(IPreferenceConstants.RUN_IN_BACKGROUND));
+ }
+
+ /**
+ * Create the widget for the heap status preference.
+ *
+ * @param composite
+ */
+ protected void createHeapStatusPref(Composite composite) {
+ showHeapStatusButton = new Button(composite, SWT.CHECK);
+ showHeapStatusButton.setText(WorkbenchMessages.WorkbenchPreference_HeapStatusButton);
+ showHeapStatusButton.setToolTipText(WorkbenchMessages.WorkbenchPreference_HeapStatusButtonToolTip);
+
+ showHeapStatusButton.setSelection(
+ PrefUtil.getAPIPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.SHOW_MEMORY_MONITOR));
+ }
+
+ /**
+ * Creates the composite which will contain all the preference controls for this
+ * page.
+ *
+ * @param parent the parent composite
+ * @return the composite for this page
+ */
+ protected Composite createComposite(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
+ return composite;
+ }
+
+ protected void createStickyCyclePref(Composite composite) {
+ stickyCycleButton = new Button(composite, SWT.CHECK);
+ stickyCycleButton.setText(WorkbenchMessages.WorkbenchPreference_stickyCycleButton);
+ stickyCycleButton.setSelection(getPreferenceStore().getBoolean(IPreferenceConstants.STICKY_CYCLE));
+ }
/**
* Create a composite that contains entry fields specifying save interval
* preference.
*
- * @param composite
- * the Composite the group is created in.
+ * @param composite the Composite the group is created in.
*/
private void createSaveIntervalGroup(Composite composite) {
Composite groupComposite = new Composite(composite, SWT.LEFT);
@@ -190,8 +183,8 @@ public class WorkbenchPreferencePage extends PreferencePage implements
saveInterval.setPreferenceStore(getPreferenceStore());
saveInterval.setPage(this);
saveInterval.setTextLimit(Integer.toString(MAX_SAVE_INTERVAL).length());
- saveInterval.setErrorMessage(NLS.bind(
- WorkbenchMessages.WorkbenchPreference_workbenchSaveIntervalError, Integer.valueOf(MAX_SAVE_INTERVAL)));
+ saveInterval.setErrorMessage(NLS.bind(WorkbenchMessages.WorkbenchPreference_workbenchSaveIntervalError,
+ Integer.valueOf(MAX_SAVE_INTERVAL)));
saveInterval.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE);
saveInterval.setValidRange(0, MAX_SAVE_INTERVAL);
@@ -205,223 +198,210 @@ public class WorkbenchPreferencePage extends PreferencePage implements
}
- protected void createOpenModeGroup(Composite composite) {
-
- Font font = composite.getFont();
-
- Group buttonComposite = new Group(composite, SWT.LEFT);
- GridLayout layout = new GridLayout();
- buttonComposite.setLayout(layout);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL
- | GridData.GRAB_HORIZONTAL);
- buttonComposite.setLayoutData(data);
- buttonComposite.setText(WorkbenchMessages.WorkbenchPreference_openMode);
-
- String label = WorkbenchMessages.WorkbenchPreference_doubleClick;
- doubleClickButton = createRadioButton(buttonComposite, label);
- doubleClickButton.addSelectionListener(widgetSelectedAdapter(e -> selectClickMode(singleClickButton.getSelection())));
- doubleClickButton.setSelection(!openOnSingleClick);
-
- label = WorkbenchMessages.WorkbenchPreference_singleClick;
- singleClickButton = createRadioButton(buttonComposite, label);
- singleClickButton.addSelectionListener(widgetSelectedAdapter(e -> selectClickMode(singleClickButton.getSelection())));
- singleClickButton.setSelection(openOnSingleClick);
-
- label = WorkbenchMessages.WorkbenchPreference_singleClick_SelectOnHover;
- selectOnHoverButton = new Button(buttonComposite, SWT.CHECK | SWT.LEFT);
- selectOnHoverButton.setText(label);
- selectOnHoverButton.setEnabled(openOnSingleClick);
- selectOnHoverButton.setSelection(selectOnHover);
- selectOnHoverButton.addSelectionListener(widgetSelectedAdapter(e -> selectOnHover = selectOnHoverButton.getSelection()));
- data = new GridData();
+ protected void createOpenModeGroup(Composite composite) {
+
+ Font font = composite.getFont();
+
+ Group buttonComposite = new Group(composite, SWT.LEFT);
+ GridLayout layout = new GridLayout();
+ buttonComposite.setLayout(layout);
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
+ buttonComposite.setLayoutData(data);
+ buttonComposite.setText(WorkbenchMessages.WorkbenchPreference_openMode);
+
+ String label = WorkbenchMessages.WorkbenchPreference_doubleClick;
+ doubleClickButton = createRadioButton(buttonComposite, label);
+ doubleClickButton
+ .addSelectionListener(widgetSelectedAdapter(e -> selectClickMode(singleClickButton.getSelection())));
+ doubleClickButton.setSelection(!openOnSingleClick);
+
+ label = WorkbenchMessages.WorkbenchPreference_singleClick;
+ singleClickButton = createRadioButton(buttonComposite, label);
+ singleClickButton
+ .addSelectionListener(widgetSelectedAdapter(e -> selectClickMode(singleClickButton.getSelection())));
+ singleClickButton.setSelection(openOnSingleClick);
+
+ label = WorkbenchMessages.WorkbenchPreference_singleClick_SelectOnHover;
+ selectOnHoverButton = new Button(buttonComposite, SWT.CHECK | SWT.LEFT);
+ selectOnHoverButton.setText(label);
+ selectOnHoverButton.setEnabled(openOnSingleClick);
+ selectOnHoverButton.setSelection(selectOnHover);
+ selectOnHoverButton
+ .addSelectionListener(widgetSelectedAdapter(e -> selectOnHover = selectOnHoverButton.getSelection()));
+ data = new GridData();
data.horizontalIndent = LayoutConstants.getIndent();
- selectOnHoverButton.setLayoutData(data);
-
- label = WorkbenchMessages.WorkbenchPreference_singleClick_OpenAfterDelay;
- openAfterDelayButton = new Button(buttonComposite, SWT.CHECK | SWT.LEFT);
- openAfterDelayButton.setText(label);
- openAfterDelayButton.setEnabled(openOnSingleClick);
- openAfterDelayButton.setSelection(openAfterDelay);
- openAfterDelayButton.addSelectionListener(widgetSelectedAdapter(e -> openAfterDelay = openAfterDelayButton.getSelection()));
- data = new GridData();
+ selectOnHoverButton.setLayoutData(data);
+
+ label = WorkbenchMessages.WorkbenchPreference_singleClick_OpenAfterDelay;
+ openAfterDelayButton = new Button(buttonComposite, SWT.CHECK | SWT.LEFT);
+ openAfterDelayButton.setText(label);
+ openAfterDelayButton.setEnabled(openOnSingleClick);
+ openAfterDelayButton.setSelection(openAfterDelay);
+ openAfterDelayButton
+ .addSelectionListener(widgetSelectedAdapter(e -> openAfterDelay = openAfterDelayButton.getSelection()));
+ data = new GridData();
data.horizontalIndent = LayoutConstants.getIndent();
- openAfterDelayButton.setLayoutData(data);
-
- createNoteComposite(font, buttonComposite, WorkbenchMessages.Preference_note,
- WorkbenchMessages.WorkbenchPreference_noEffectOnAllViews);
- }
-
- private void selectClickMode(boolean singleClick) {
- openOnSingleClick = singleClick;
- selectOnHoverButton.setEnabled(openOnSingleClick);
- openAfterDelayButton.setEnabled(openOnSingleClick);
- }
-
- /**
- * Utility method that creates a radio button instance and sets the default
- * layout data.
- *
- * @param parent
- * the parent for the new button
- * @param label
- * the label for the new button
- * @return the newly-created button
- */
- protected static Button createRadioButton(Composite parent, String label) {
- Button button = new Button(parent, SWT.RADIO | SWT.LEFT);
- button.setText(label);
- return button;
- }
-
- /**
- * Utility method that creates a combo box
- *
- * @param parent
- * the parent for the new label
- * @return the new widget
- */
- protected static Combo createCombo(Composite parent) {
- Combo combo = new Combo(parent, SWT.READ_ONLY);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
- combo.setLayoutData(data);
- return combo;
- }
-
- /**
- * Utility method that creates a label instance and sets the default layout
- * data.
- *
- * @param parent
- * the parent for the new label
- * @param text
- * the text for the new label
- * @return the new label
- */
- protected static Label createLabel(Composite parent, String text) {
- Label label = new Label(parent, SWT.LEFT);
- label.setText(text);
- GridData data = new GridData();
- data.horizontalSpan = 1;
- data.horizontalAlignment = GridData.FILL;
- label.setLayoutData(data);
- return label;
- }
-
- /**
- * Creates a tab of one horizontal spans.
- *
- * @param parent
- * the parent in which the tab should be created
- */
- protected static void createSpace(Composite parent) {
- Label vfiller = new Label(parent, SWT.LEFT);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.BEGINNING;
- gridData.grabExcessHorizontalSpace = false;
- gridData.verticalAlignment = GridData.CENTER;
- gridData.grabExcessVerticalSpace = false;
- vfiller.setLayoutData(gridData);
- }
-
- /**
- * Returns preference store that belongs to the our plugin.
- *
- * @return the preference store for this plugin
- */
- @Override
+ openAfterDelayButton.setLayoutData(data);
+
+ createNoteComposite(font, buttonComposite, WorkbenchMessages.Preference_note,
+ WorkbenchMessages.WorkbenchPreference_noEffectOnAllViews);
+ }
+
+ private void selectClickMode(boolean singleClick) {
+ openOnSingleClick = singleClick;
+ selectOnHoverButton.setEnabled(openOnSingleClick);
+ openAfterDelayButton.setEnabled(openOnSingleClick);
+ }
+
+ /**
+ * Utility method that creates a radio button instance and sets the default
+ * layout data.
+ *
+ * @param parent the parent for the new button
+ * @param label the label for the new button
+ * @return the newly-created button
+ */
+ protected static Button createRadioButton(Composite parent, String label) {
+ Button button = new Button(parent, SWT.RADIO | SWT.LEFT);
+ button.setText(label);
+ return button;
+ }
+
+ /**
+ * Utility method that creates a combo box
+ *
+ * @param parent the parent for the new label
+ * @return the new widget
+ */
+ protected static Combo createCombo(Composite parent) {
+ Combo combo = new Combo(parent, SWT.READ_ONLY);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
+ combo.setLayoutData(data);
+ return combo;
+ }
+
+ /**
+ * Utility method that creates a label instance and sets the default layout
+ * data.
+ *
+ * @param parent the parent for the new label
+ * @param text the text for the new label
+ * @return the new label
+ */
+ protected static Label createLabel(Composite parent, String text) {
+ Label label = new Label(parent, SWT.LEFT);
+ label.setText(text);
+ GridData data = new GridData();
+ data.horizontalSpan = 1;
+ data.horizontalAlignment = GridData.FILL;
+ label.setLayoutData(data);
+ return label;
+ }
+
+ /**
+ * Creates a tab of one horizontal spans.
+ *
+ * @param parent the parent in which the tab should be created
+ */
+ protected static void createSpace(Composite parent) {
+ Label vfiller = new Label(parent, SWT.LEFT);
+ GridData gridData = new GridData();
+ gridData.horizontalAlignment = GridData.BEGINNING;
+ gridData.grabExcessHorizontalSpace = false;
+ gridData.verticalAlignment = GridData.CENTER;
+ gridData.grabExcessVerticalSpace = false;
+ vfiller.setLayoutData(gridData);
+ }
+
+ /**
+ * Returns preference store that belongs to the our plugin.
+ *
+ * @return the preference store for this plugin
+ */
+ @Override
protected IPreferenceStore doGetPreferenceStore() {
- return WorkbenchPlugin.getDefault().getPreferenceStore();
- }
+ return WorkbenchPlugin.getDefault().getPreferenceStore();
+ }
- /**
- * @see IWorkbenchPreferencePage
- */
- @Override
+ /**
+ * @see IWorkbenchPreferencePage
+ */
+ @Override
public void init(IWorkbench aWorkbench) {
- IPreferenceStore store = getPreferenceStore();
- openOnSingleClick = store
- .getBoolean(IPreferenceConstants.OPEN_ON_SINGLE_CLICK);
- selectOnHover = store.getBoolean(IPreferenceConstants.SELECT_ON_HOVER);
- openAfterDelay = store
- .getBoolean(IPreferenceConstants.OPEN_AFTER_DELAY);
- }
-
- /**
- * The default button has been pressed.
- */
- @Override
+ IPreferenceStore store = getPreferenceStore();
+ openOnSingleClick = store.getBoolean(IPreferenceConstants.OPEN_ON_SINGLE_CLICK);
+ selectOnHover = store.getBoolean(IPreferenceConstants.SELECT_ON_HOVER);
+ openAfterDelay = store.getBoolean(IPreferenceConstants.OPEN_AFTER_DELAY);
+ }
+
+ /**
+ * The default button has been pressed.
+ */
+ @Override
protected void performDefaults() {
- IPreferenceStore store = getPreferenceStore();
+ IPreferenceStore store = getPreferenceStore();
saveInterval.loadDefault();
- stickyCycleButton.setSelection(store
- .getBoolean(IPreferenceConstants.STICKY_CYCLE));
- openOnSingleClick = store
- .getDefaultBoolean(IPreferenceConstants.OPEN_ON_SINGLE_CLICK);
- selectOnHover = store
- .getDefaultBoolean(IPreferenceConstants.SELECT_ON_HOVER);
- openAfterDelay = store
- .getDefaultBoolean(IPreferenceConstants.OPEN_AFTER_DELAY);
- singleClickButton.setSelection(openOnSingleClick);
- doubleClickButton.setSelection(!openOnSingleClick);
- selectOnHoverButton.setSelection(selectOnHover);
- openAfterDelayButton.setSelection(openAfterDelay);
- selectOnHoverButton.setEnabled(openOnSingleClick);
- openAfterDelayButton.setEnabled(openOnSingleClick);
- stickyCycleButton.setSelection(store
- .getDefaultBoolean(IPreferenceConstants.STICKY_CYCLE));
- showUserDialogButton.setSelection(store.getDefaultBoolean(
- IPreferenceConstants.RUN_IN_BACKGROUND));
- showHeapStatusButton.setSelection(PrefUtil.getAPIPreferenceStore().getDefaultBoolean(
- IWorkbenchPreferenceConstants.SHOW_MEMORY_MONITOR));
-
- super.performDefaults();
- }
-
- /**
- * The user has pressed Ok. Store/apply this page's values appropriately.
- */
- @Override
+ stickyCycleButton.setSelection(store.getBoolean(IPreferenceConstants.STICKY_CYCLE));
+ openOnSingleClick = store.getDefaultBoolean(IPreferenceConstants.OPEN_ON_SINGLE_CLICK);
+ selectOnHover = store.getDefaultBoolean(IPreferenceConstants.SELECT_ON_HOVER);
+ openAfterDelay = store.getDefaultBoolean(IPreferenceConstants.OPEN_AFTER_DELAY);
+ singleClickButton.setSelection(openOnSingleClick);
+ doubleClickButton.setSelection(!openOnSingleClick);
+ selectOnHoverButton.setSelection(selectOnHover);
+ openAfterDelayButton.setSelection(openAfterDelay);
+ selectOnHoverButton.setEnabled(openOnSingleClick);
+ openAfterDelayButton.setEnabled(openOnSingleClick);
+ stickyCycleButton.setSelection(store.getDefaultBoolean(IPreferenceConstants.STICKY_CYCLE));
+ showUserDialogButton.setSelection(store.getDefaultBoolean(IPreferenceConstants.RUN_IN_BACKGROUND));
+ showHeapStatusButton.setSelection(
+ PrefUtil.getAPIPreferenceStore().getDefaultBoolean(IWorkbenchPreferenceConstants.SHOW_MEMORY_MONITOR));
+
+ super.performDefaults();
+ }
+
+ /**
+ * The user has pressed Ok. Store/apply this page's values appropriately.
+ */
+ @Override
public boolean performOk() {
- IPreferenceStore store = getPreferenceStore();
-
- // store the keep cycle part dialogs sticky preference
- store.setValue(IPreferenceConstants.STICKY_CYCLE, stickyCycleButton
- .getSelection());
- store.setValue(IPreferenceConstants.OPEN_ON_SINGLE_CLICK,
- openOnSingleClick);
- store.setValue(IPreferenceConstants.SELECT_ON_HOVER, selectOnHover);
- store.setValue(IPreferenceConstants.OPEN_AFTER_DELAY, openAfterDelay);
- store.setValue(IPreferenceConstants.RUN_IN_BACKGROUND,
- showUserDialogButton.getSelection());
+ IPreferenceStore store = getPreferenceStore();
+
+ // store the keep cycle part dialogs sticky preference
+ store.setValue(IPreferenceConstants.STICKY_CYCLE, stickyCycleButton.getSelection());
+ store.setValue(IPreferenceConstants.OPEN_ON_SINGLE_CLICK, openOnSingleClick);
+ store.setValue(IPreferenceConstants.SELECT_ON_HOVER, selectOnHover);
+ store.setValue(IPreferenceConstants.OPEN_AFTER_DELAY, openAfterDelay);
+ store.setValue(IPreferenceConstants.RUN_IN_BACKGROUND, showUserDialogButton.getSelection());
store.setValue(IPreferenceConstants.WORKBENCH_SAVE_INTERVAL, saveInterval.getIntValue());
- PrefUtil.getAPIPreferenceStore().setValue(IWorkbenchPreferenceConstants.SHOW_MEMORY_MONITOR, showHeapStatusButton.getSelection());
- updateHeapStatus(showHeapStatusButton.getSelection());
-
- int singleClickMethod = openOnSingleClick ? OpenStrategy.SINGLE_CLICK
- : OpenStrategy.DOUBLE_CLICK;
- if (openOnSingleClick) {
- if (selectOnHover) {
- singleClickMethod |= OpenStrategy.SELECT_ON_HOVER;
- }
- if (openAfterDelay) {
- singleClickMethod |= OpenStrategy.ARROW_KEYS_OPEN;
- }
- }
- OpenStrategy.setOpenMethod(singleClickMethod);
-
- PrefUtil.savePrefs();
- return true;
- }
+ PrefUtil.getAPIPreferenceStore().setValue(IWorkbenchPreferenceConstants.SHOW_MEMORY_MONITOR,
+ showHeapStatusButton.getSelection());
+ updateHeapStatus(showHeapStatusButton.getSelection());
+
+ int singleClickMethod = openOnSingleClick ? OpenStrategy.SINGLE_CLICK : OpenStrategy.DOUBLE_CLICK;
+ if (openOnSingleClick) {
+ if (selectOnHover) {
+ singleClickMethod |= OpenStrategy.SELECT_ON_HOVER;
+ }
+ if (openAfterDelay) {
+ singleClickMethod |= OpenStrategy.ARROW_KEYS_OPEN;
+ }
+ }
+ OpenStrategy.setOpenMethod(singleClickMethod);
+
+ PrefUtil.savePrefs();
+ return true;
+ }
/**
* Show or hide the heap status based on selection.
+ *
* @param selection
*/
private void updateHeapStatus(boolean selection) {
IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
for (IWorkbenchWindow window : windows) {
- if(window instanceof WorkbenchWindow){
+ if (window instanceof WorkbenchWindow) {
((WorkbenchWindow) window).showHeapStatus(selection);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchWizardElement.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchWizardElement.java
index 3523d01550c..b214ab095f1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchWizardElement.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchWizardElement.java
@@ -41,223 +41,211 @@ import org.eclipse.ui.wizards.IWizardDescriptor;
/**
* Instances represent registered wizards.
*/
-public class WorkbenchWizardElement extends WorkbenchAdapter implements
- IAdaptable, IPluginContribution, IWizardDescriptor {
- private String id;
+public class WorkbenchWizardElement extends WorkbenchAdapter
+ implements IAdaptable, IPluginContribution, IWizardDescriptor {
+ private String id;
- private ImageDescriptor imageDescriptor;
+ private ImageDescriptor imageDescriptor;
- private SelectionEnabler selectionEnabler;
+ private SelectionEnabler selectionEnabler;
- private IConfigurationElement configurationElement;
+ private IConfigurationElement configurationElement;
- private ImageDescriptor descriptionImage;
+ private ImageDescriptor descriptionImage;
- private WizardCollectionElement parentCategory;
+ private WizardCollectionElement parentCategory;
/**
- * TODO: DO we need to make this API?
+ * TODO: DO we need to make this API?
*/
public static final String TAG_PROJECT = "project"; //$NON-NLS-1$
- private static final String [] EMPTY_TAGS = new String[0];
+ private static final String[] EMPTY_TAGS = new String[0];
- private static final String [] PROJECT_TAGS = new String[] {TAG_PROJECT};
+ private static final String[] PROJECT_TAGS = new String[] { TAG_PROJECT };
private String[] keywordLabels;
+ /**
+ * Create a new instance of this class
+ *
+ * @param configurationElement
+ * @since 3.1
+ */
+ public WorkbenchWizardElement(IConfigurationElement configurationElement) {
+ this.configurationElement = configurationElement;
+ id = configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
+ }
- /**
- * Create a new instance of this class
- *
- * @param configurationElement
- * @since 3.1
- */
- public WorkbenchWizardElement(IConfigurationElement configurationElement) {
- this.configurationElement = configurationElement;
- id = configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
- }
-
- /**
- * Answer a boolean indicating whether the receiver is able to handle the
- * passed selection
- *
- * @return boolean
- * @param selection
- * IStructuredSelection
- */
- public boolean canHandleSelection(IStructuredSelection selection) {
- return getSelectionEnabler().isEnabledForSelection(selection);
- }
-
- /**
- * Answer the selection for the receiver based on whether the it can handle
- * the selection. If it can return the selection. If it can handle the
- * adapted to IResource value of the selection. If it satisfies neither of
- * these conditions return an empty IStructuredSelection.
- *
- * @return IStructuredSelection
- * @param selection
- * IStructuredSelection
- */
- @Override
+ /**
+ * Answer a boolean indicating whether the receiver is able to handle the passed
+ * selection
+ *
+ * @return boolean
+ * @param selection IStructuredSelection
+ */
+ public boolean canHandleSelection(IStructuredSelection selection) {
+ return getSelectionEnabler().isEnabledForSelection(selection);
+ }
+
+ /**
+ * Answer the selection for the receiver based on whether the it can handle the
+ * selection. If it can return the selection. If it can handle the adapted to
+ * IResource value of the selection. If it satisfies neither of these conditions
+ * return an empty IStructuredSelection.
+ *
+ * @return IStructuredSelection
+ * @param selection IStructuredSelection
+ */
+ @Override
public IStructuredSelection adaptedSelection(IStructuredSelection selection) {
- if (canHandleSelection(selection)) {
+ if (canHandleSelection(selection)) {
return selection;
}
- IStructuredSelection adaptedSelection = convertToResources(selection);
- if (canHandleSelection(adaptedSelection)) {
+ IStructuredSelection adaptedSelection = convertToResources(selection);
+ if (canHandleSelection(adaptedSelection)) {
return adaptedSelection;
}
- //Couldn't find one that works so just return
- return StructuredSelection.EMPTY;
- }
-
- /**
- * Create an the instance of the object described by the configuration
- * element. That is, create the instance of the class the isv supplied in
- * the extension point.
- * @return the new object
- * @throws CoreException
- */
- public Object createExecutableExtension() throws CoreException {
- return WorkbenchPlugin.createExtension(configurationElement,
- IWorkbenchRegistryConstants.ATT_CLASS);
- }
-
- /**
- * Returns an object which is an instance of the given class associated
- * with this object. Returns <code>null</code> if no such object can be
- * found.
- */
+ // Couldn't find one that works so just return
+ return StructuredSelection.EMPTY;
+ }
+
+ /**
+ * Create an the instance of the object described by the configuration element.
+ * That is, create the instance of the class the isv supplied in the extension
+ * point.
+ *
+ * @return the new object
+ * @throws CoreException
+ */
+ public Object createExecutableExtension() throws CoreException {
+ return WorkbenchPlugin.createExtension(configurationElement, IWorkbenchRegistryConstants.ATT_CLASS);
+ }
+
+ /**
+ * Returns an object which is an instance of the given class associated with
+ * this object. Returns <code>null</code> if no such object can be found.
+ */
@Override
public <T> T getAdapter(Class<T> adapter) {
- if (adapter == IWorkbenchAdapter.class
- || adapter == IWorkbenchAdapter2.class
- || adapter == IWorkbenchAdapter3.class) {
+ if (adapter == IWorkbenchAdapter.class || adapter == IWorkbenchAdapter2.class
+ || adapter == IWorkbenchAdapter3.class) {
return adapter.cast(this);
- }
- else if (adapter == IPluginContribution.class) {
+ } else if (adapter == IPluginContribution.class) {
return adapter.cast(this);
- }
- else if (adapter == IConfigurationElement.class) {
+ } else if (adapter == IConfigurationElement.class) {
return adapter.cast(configurationElement);
- }
- return Platform.getAdapterManager().getAdapter(this, adapter);
- }
-
- /**
- * @return IConfigurationElement
- */
- public IConfigurationElement getConfigurationElement() {
- return configurationElement;
- }
-
- /**
- * Answer the description parameter of this element
- *
- * @return java.lang.String
- */
- @Override
+ }
+ return Platform.getAdapterManager().getAdapter(this, adapter);
+ }
+
+ /**
+ * @return IConfigurationElement
+ */
+ public IConfigurationElement getConfigurationElement() {
+ return configurationElement;
+ }
+
+ /**
+ * Answer the description parameter of this element
+ *
+ * @return java.lang.String
+ */
+ @Override
public String getDescription() {
- return RegistryReader.getDescription(configurationElement);
- }
+ return RegistryReader.getDescription(configurationElement);
+ }
- /**
- * Answer the icon of this element.
- */
- @Override
+ /**
+ * Answer the icon of this element.
+ */
+ @Override
public ImageDescriptor getImageDescriptor() {
- if (imageDescriptor == null) {
- String iconName = configurationElement
- .getAttribute(IWorkbenchRegistryConstants.ATT_ICON);
- if (iconName == null) {
+ if (imageDescriptor == null) {
+ String iconName = configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_ICON);
+ if (iconName == null) {
return null;
}
- imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(
- configurationElement.getNamespaceIdentifier(), iconName);
- }
- return imageDescriptor;
- }
-
- /**
- * Returns the name of this wizard element.
- */
- @Override
+ imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(configurationElement.getNamespaceIdentifier(),
+ iconName);
+ }
+ return imageDescriptor;
+ }
+
+ /**
+ * Returns the name of this wizard element.
+ */
+ @Override
public ImageDescriptor getImageDescriptor(Object element) {
- return getImageDescriptor();
- }
+ return getImageDescriptor();
+ }
- /**
- * Returns the name of this wizard element.
- */
- @Override
+ /**
+ * Returns the name of this wizard element.
+ */
+ @Override
public String getLabel(Object element) {
- return configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_NAME);
- }
-
- /**
- * Answer self's action enabler, creating it first iff necessary
- */
- protected SelectionEnabler getSelectionEnabler() {
- if (selectionEnabler == null) {
+ return configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_NAME);
+ }
+
+ /**
+ * Answer self's action enabler, creating it first iff necessary
+ */
+ protected SelectionEnabler getSelectionEnabler() {
+ if (selectionEnabler == null) {
selectionEnabler = new SelectionEnabler(configurationElement);
}
- return selectionEnabler;
- }
-
- /**
- * Attempt to convert the elements in the passed selection into resources
- * by asking each for its IResource property (iff it isn't already a
- * resource). If all elements in the initial selection can be converted to
- * resources then answer a new selection containing these resources;
- * otherwise answer an empty selection.
- *
- * @param originalSelection the original selection
- * @return the converted selection or an empty selection
- */
- private IStructuredSelection convertToResources(
- IStructuredSelection originalSelection) {
- Object selectionService = PlatformUI.getWorkbench().getService(
- ISelectionConversionService.class);
+ return selectionEnabler;
+ }
+
+ /**
+ * Attempt to convert the elements in the passed selection into resources by
+ * asking each for its IResource property (iff it isn't already a resource). If
+ * all elements in the initial selection can be converted to resources then
+ * answer a new selection containing these resources; otherwise answer an empty
+ * selection.
+ *
+ * @param originalSelection the original selection
+ * @return the converted selection or an empty selection
+ */
+ private IStructuredSelection convertToResources(IStructuredSelection originalSelection) {
+ Object selectionService = PlatformUI.getWorkbench().getService(ISelectionConversionService.class);
if (selectionService == null || originalSelection == null) {
return StructuredSelection.EMPTY;
}
- return ((ISelectionConversionService) selectionService)
- .convertToResources(originalSelection);
- }
+ return ((ISelectionConversionService) selectionService).convertToResources(originalSelection);
+ }
- @Override
+ @Override
public String getLocalId() {
- return getId();
- }
+ return getId();
+ }
- @Override
+ @Override
public String getPluginId() {
- return (configurationElement != null) ? configurationElement
- .getNamespaceIdentifier() : null;
- }
+ return (configurationElement != null) ? configurationElement.getNamespaceIdentifier() : null;
+ }
- @Override
+ @Override
public ImageDescriptor getDescriptionImage() {
- if (descriptionImage == null) {
- String descImage = configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_DESCRIPTION_IMAGE);
- if (descImage == null) {
+ if (descriptionImage == null) {
+ String descImage = configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_DESCRIPTION_IMAGE);
+ if (descImage == null) {
return null;
}
- descriptionImage = AbstractUIPlugin.imageDescriptorFromPlugin(
- configurationElement.getNamespaceIdentifier(), descImage);
- }
- return descriptionImage;
- }
+ descriptionImage = AbstractUIPlugin.imageDescriptorFromPlugin(configurationElement.getNamespaceIdentifier(),
+ descImage);
+ }
+ return descriptionImage;
+ }
- @Override
+ @Override
public String getHelpHref() {
- return configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_HELP_HREF);
- }
+ return configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_HELP_HREF);
+ }
@Override
public IWorkbenchWizard createWizard() throws CoreException {
@@ -290,14 +278,14 @@ public class WorkbenchWizardElement extends WorkbenchAdapter implements
}
@Override
- public String [] getTags() {
+ public String[] getTags() {
- String flag = configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_PROJECT);
- if (Boolean.parseBoolean(flag)) {
- return PROJECT_TAGS;
- }
+ String flag = configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_PROJECT);
+ if (Boolean.parseBoolean(flag)) {
+ return PROJECT_TAGS;
+ }
- return EMPTY_TAGS;
+ return EMPTY_TAGS;
}
@Override
@@ -317,7 +305,8 @@ public class WorkbenchWizardElement extends WorkbenchAdapter implements
@Override
public boolean canFinishEarly() {
- return Boolean.parseBoolean(configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_CAN_FINISH_EARLY));
+ return Boolean
+ .parseBoolean(configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_CAN_FINISH_EARLY));
}
@Override
@@ -338,8 +327,7 @@ public class WorkbenchWizardElement extends WorkbenchAdapter implements
keywordLabels = new String[children.length];
KeywordRegistry registry = KeywordRegistry.getInstance();
for (int i = 0; i < children.length; i++) {
- String id = children[i]
- .getAttribute(IWorkbenchRegistryConstants.ATT_ID);
+ String id = children[i].getAttribute(IWorkbenchRegistryConstants.ATT_ID);
keywordLabels[i] = registry.getKeywordLabel(id);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchWizardListSelectionPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchWizardListSelectionPage.java
index 8fea7b20a08..b3df5f1e648 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchWizardListSelectionPage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchWizardListSelectionPage.java
@@ -42,183 +42,173 @@ import org.eclipse.ui.model.WorkbenchViewerComparator;
* launched. Subclasses just need to provide a method which creates an
* appropriate wizard node based upon a user selection.
*/
-public abstract class WorkbenchWizardListSelectionPage extends
- WorkbenchWizardSelectionPage implements ISelectionChangedListener,
- IDoubleClickListener {
-
- // id constants
- private static final String DIALOG_SETTING_SECTION_NAME = "WizardListSelectionPage."; //$NON-NLS-1$
-
- private static final int SIZING_LISTS_HEIGHT = 200;
-
- private static final String STORE_SELECTED_WIZARD_ID = DIALOG_SETTING_SECTION_NAME
- + "STORE_SELECTED_WIZARD_ID"; //$NON-NLS-1$
-
- private TableViewer viewer;
-
- private String message;
-
- /**
- * Creates a <code>WorkbenchWizardListSelectionPage</code>.
- *
- * @param aWorkbench the current workbench
- * @param currentSelection the workbench's current resource selection
- * @param wizardElements the collection of <code>WorkbenchWizardElements</code>
- * to display for selection
- * @param message the message to display above the selection list
- * @param triggerPointId the trigger point id
- */
- protected WorkbenchWizardListSelectionPage(IWorkbench aWorkbench,
- IStructuredSelection currentSelection,
- AdaptableList wizardElements, String message, String triggerPointId) {
- super(
- "singleWizardSelectionPage", aWorkbench, currentSelection, wizardElements, triggerPointId); //$NON-NLS-1$
- setDescription(WorkbenchMessages.WizardList_description);
- this.message = message;
- }
-
- @Override
+public abstract class WorkbenchWizardListSelectionPage extends WorkbenchWizardSelectionPage
+ implements ISelectionChangedListener, IDoubleClickListener {
+
+ // id constants
+ private static final String DIALOG_SETTING_SECTION_NAME = "WizardListSelectionPage."; //$NON-NLS-1$
+
+ private static final int SIZING_LISTS_HEIGHT = 200;
+
+ private static final String STORE_SELECTED_WIZARD_ID = DIALOG_SETTING_SECTION_NAME + "STORE_SELECTED_WIZARD_ID"; //$NON-NLS-1$
+
+ private TableViewer viewer;
+
+ private String message;
+
+ /**
+ * Creates a <code>WorkbenchWizardListSelectionPage</code>.
+ *
+ * @param aWorkbench the current workbench
+ * @param currentSelection the workbench's current resource selection
+ * @param wizardElements the collection of
+ * <code>WorkbenchWizardElements</code> to display for
+ * selection
+ * @param message the message to display above the selection list
+ * @param triggerPointId the trigger point id
+ */
+ protected WorkbenchWizardListSelectionPage(IWorkbench aWorkbench, IStructuredSelection currentSelection,
+ AdaptableList wizardElements, String message, String triggerPointId) {
+ super("singleWizardSelectionPage", aWorkbench, currentSelection, wizardElements, triggerPointId); //$NON-NLS-1$
+ setDescription(WorkbenchMessages.WizardList_description);
+ this.message = message;
+ }
+
+ @Override
public void createControl(Composite parent) {
- Font font = parent.getFont();
-
- // create composite for page.
- Composite outerContainer = new Composite(parent, SWT.NONE);
- outerContainer.setLayout(new GridLayout());
- outerContainer.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL
- | GridData.HORIZONTAL_ALIGN_FILL));
- outerContainer.setFont(font);
-
- Label messageLabel = new Label(outerContainer, SWT.NONE);
- messageLabel.setText(message);
- messageLabel.setFont(font);
-
- createViewer(outerContainer);
- layoutTopControl(viewer.getControl());
-
- restoreWidgetValues();
-
- setControl(outerContainer);
- }
-
- /**
- * Create a new viewer in the parent.
- *
- * @param parent the parent <code>Composite</code>.
- */
- private void createViewer(Composite parent) {
- //Create a table for the list
- Table table = new Table(parent, SWT.BORDER);
- table.setFont(parent.getFont());
-
- // the list viewer
- viewer = new TableViewer(table);
- viewer.setContentProvider(new WizardContentProvider());
- viewer.setLabelProvider(new WorkbenchLabelProvider());
- viewer.setComparator(new WorkbenchViewerComparator());
- viewer.addSelectionChangedListener(this);
- viewer.addDoubleClickListener(this);
- viewer.setInput(wizardElements);
- }
-
- /**
- * Returns an <code>IWizardNode</code> representing the specified
- * workbench wizard which has been selected by the user. <b>Subclasses
- * </b> must override this abstract implementation.
- *
- * @param element the wizard element that an <code>IWizardNode</code> is
- * needed for
- * @return org.eclipse.jface.wizards.IWizardNode
- */
- protected abstract IWizardNode createWizardNode(
- WorkbenchWizardElement element);
-
- /**
- * An item in a viewer has been double-clicked.
- */
- @Override
+ Font font = parent.getFont();
+
+ // create composite for page.
+ Composite outerContainer = new Composite(parent, SWT.NONE);
+ outerContainer.setLayout(new GridLayout());
+ outerContainer.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
+ outerContainer.setFont(font);
+
+ Label messageLabel = new Label(outerContainer, SWT.NONE);
+ messageLabel.setText(message);
+ messageLabel.setFont(font);
+
+ createViewer(outerContainer);
+ layoutTopControl(viewer.getControl());
+
+ restoreWidgetValues();
+
+ setControl(outerContainer);
+ }
+
+ /**
+ * Create a new viewer in the parent.
+ *
+ * @param parent the parent <code>Composite</code>.
+ */
+ private void createViewer(Composite parent) {
+ // Create a table for the list
+ Table table = new Table(parent, SWT.BORDER);
+ table.setFont(parent.getFont());
+
+ // the list viewer
+ viewer = new TableViewer(table);
+ viewer.setContentProvider(new WizardContentProvider());
+ viewer.setLabelProvider(new WorkbenchLabelProvider());
+ viewer.setComparator(new WorkbenchViewerComparator());
+ viewer.addSelectionChangedListener(this);
+ viewer.addDoubleClickListener(this);
+ viewer.setInput(wizardElements);
+ }
+
+ /**
+ * Returns an <code>IWizardNode</code> representing the specified workbench
+ * wizard which has been selected by the user. <b>Subclasses </b> must override
+ * this abstract implementation.
+ *
+ * @param element the wizard element that an <code>IWizardNode</code> is needed
+ * for
+ * @return org.eclipse.jface.wizards.IWizardNode
+ */
+ protected abstract IWizardNode createWizardNode(WorkbenchWizardElement element);
+
+ /**
+ * An item in a viewer has been double-clicked.
+ */
+ @Override
public void doubleClick(DoubleClickEvent event) {
- selectionChanged(new SelectionChangedEvent(event.getViewer(), event
- .getViewer().getSelection()));
- getContainer().showPage(getNextPage());
- }
-
- /**
- * Layout the top control.
- *
- * @param control the control.
- * @since 3.0
- */
- private void layoutTopControl(Control control) {
- GridData data = new GridData(GridData.FILL_BOTH);
-
- int availableRows = DialogUtil.availableRows(control.getParent());
-
- //Only give a height hint if the dialog is going to be too small
- if (availableRows > 50) {
- data.heightHint = SIZING_LISTS_HEIGHT;
- } else {
- data.heightHint = availableRows * 3;
- }
-
- control.setLayoutData(data);
-
- }
-
- /**
- * Uses the dialog store to restore widget values to the values that they
- * held last time this wizard was used to completion.
- */
- private void restoreWidgetValues() {
-
- IDialogSettings settings = getDialogSettings();
- if (settings == null) {
+ selectionChanged(new SelectionChangedEvent(event.getViewer(), event.getViewer().getSelection()));
+ getContainer().showPage(getNextPage());
+ }
+
+ /**
+ * Layout the top control.
+ *
+ * @param control the control.
+ * @since 3.0
+ */
+ private void layoutTopControl(Control control) {
+ GridData data = new GridData(GridData.FILL_BOTH);
+
+ int availableRows = DialogUtil.availableRows(control.getParent());
+
+ // Only give a height hint if the dialog is going to be too small
+ if (availableRows > 50) {
+ data.heightHint = SIZING_LISTS_HEIGHT;
+ } else {
+ data.heightHint = availableRows * 3;
+ }
+
+ control.setLayoutData(data);
+
+ }
+
+ /**
+ * Uses the dialog store to restore widget values to the values that they held
+ * last time this wizard was used to completion.
+ */
+ private void restoreWidgetValues() {
+
+ IDialogSettings settings = getDialogSettings();
+ if (settings == null) {
return;
}
- String wizardId = settings.get(STORE_SELECTED_WIZARD_ID);
- WorkbenchWizardElement wizard = findWizard(wizardId);
- if (wizard == null) {
+ String wizardId = settings.get(STORE_SELECTED_WIZARD_ID);
+ WorkbenchWizardElement wizard = findWizard(wizardId);
+ if (wizard == null) {
return;
}
- StructuredSelection selection = new StructuredSelection(wizard);
- viewer.setSelection(selection);
- }
+ StructuredSelection selection = new StructuredSelection(wizard);
+ viewer.setSelection(selection);
+ }
- /**
- * Since Finish was pressed, write widget values to the dialog store so
- * that they will persist into the next invocation of this wizard page
- */
- public void saveWidgetValues() {
+ /**
+ * Since Finish was pressed, write widget values to the dialog store so that
+ * they will persist into the next invocation of this wizard page
+ */
+ public void saveWidgetValues() {
IStructuredSelection sel = viewer.getStructuredSelection();
- if (sel.size() > 0) {
- WorkbenchWizardElement selectedWizard = (WorkbenchWizardElement) sel
- .getFirstElement();
- getDialogSettings().put(STORE_SELECTED_WIZARD_ID,
- selectedWizard.getId());
- }
- }
-
- /**
- * Notes the newly-selected wizard element and updates the page
- * accordingly.
- *
- * @param event the selection changed event
- */
- @Override
+ if (sel.size() > 0) {
+ WorkbenchWizardElement selectedWizard = (WorkbenchWizardElement) sel.getFirstElement();
+ getDialogSettings().put(STORE_SELECTED_WIZARD_ID, selectedWizard.getId());
+ }
+ }
+
+ /**
+ * Notes the newly-selected wizard element and updates the page accordingly.
+ *
+ * @param event the selection changed event
+ */
+ @Override
public void selectionChanged(SelectionChangedEvent event) {
- setErrorMessage(null);
+ setErrorMessage(null);
IStructuredSelection selection = event.getStructuredSelection();
- WorkbenchWizardElement currentWizardSelection = (WorkbenchWizardElement) selection
- .getFirstElement();
- if (currentWizardSelection == null) {
- setMessage(null);
- setSelectedNode(null);
- return;
- }
-
- setSelectedNode(createWizardNode(currentWizardSelection));
- setMessage(currentWizardSelection.getDescription());
- }
+ WorkbenchWizardElement currentWizardSelection = (WorkbenchWizardElement) selection.getFirstElement();
+ if (currentWizardSelection == null) {
+ setMessage(null);
+ setSelectedNode(null);
+ return;
+ }
+
+ setSelectedNode(createWizardNode(currentWizardSelection));
+ setMessage(currentWizardSelection.getDescription());
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchWizardNode.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchWizardNode.java
index eaf96e06ffd..5773dfab912 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchWizardNode.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchWizardNode.java
@@ -35,166 +35,155 @@ import org.eclipse.ui.statushandlers.StatusManager;
import org.eclipse.ui.wizards.IWizardDescriptor;
/**
- * A wizard node represents a "potential" wizard. Wizard nodes
- * are used by wizard selection pages to allow the user to pick
- * from several available nested wizards.
+ * A wizard node represents a "potential" wizard. Wizard nodes are used by
+ * wizard selection pages to allow the user to pick from several available
+ * nested wizards.
* <p>
* <b>Subclasses</b> simply need to override method <code>createWizard()</code>,
- * which is responsible for creating an instance of the wizard it represents
- * AND ensuring that this wizard is the "right" type of wizard (e.g.-
- * New, Import, etc.).</p>
+ * which is responsible for creating an instance of the wizard it represents AND
+ * ensuring that this wizard is the "right" type of wizard (e.g.- New, Import,
+ * etc.).
+ * </p>
*/
-public abstract class WorkbenchWizardNode implements IWizardNode,
- IPluginContribution {
- protected WorkbenchWizardSelectionPage parentWizardPage;
-
- protected IWizard wizard;
-
- protected IWizardDescriptor wizardElement;
-
- /**
- * Creates a <code>WorkbenchWizardNode</code> that holds onto a wizard
- * element. The wizard element provides information on how to create
- * the wizard supplied by the ISV's extension.
- *
- * @param aWizardPage the wizard page
- * @param element the wizard descriptor
- */
- public WorkbenchWizardNode(WorkbenchWizardSelectionPage aWizardPage,
- IWizardDescriptor element) {
- super();
- this.parentWizardPage = aWizardPage;
- this.wizardElement = element;
- }
-
- /**
- * Returns the wizard represented by this wizard node. <b>Subclasses</b>
- * must override this method.
- *
- * @return the wizard object
- * @throws CoreException
- */
- public abstract IWorkbenchWizard createWizard() throws CoreException;
-
- @Override
+public abstract class WorkbenchWizardNode implements IWizardNode, IPluginContribution {
+ protected WorkbenchWizardSelectionPage parentWizardPage;
+
+ protected IWizard wizard;
+
+ protected IWizardDescriptor wizardElement;
+
+ /**
+ * Creates a <code>WorkbenchWizardNode</code> that holds onto a wizard element.
+ * The wizard element provides information on how to create the wizard supplied
+ * by the ISV's extension.
+ *
+ * @param aWizardPage the wizard page
+ * @param element the wizard descriptor
+ */
+ public WorkbenchWizardNode(WorkbenchWizardSelectionPage aWizardPage, IWizardDescriptor element) {
+ super();
+ this.parentWizardPage = aWizardPage;
+ this.wizardElement = element;
+ }
+
+ /**
+ * Returns the wizard represented by this wizard node. <b>Subclasses</b> must
+ * override this method.
+ *
+ * @return the wizard object
+ * @throws CoreException
+ */
+ public abstract IWorkbenchWizard createWizard() throws CoreException;
+
+ @Override
public void dispose() {
- // Do nothing since the wizard wasn't created via reflection.
- }
+ // Do nothing since the wizard wasn't created via reflection.
+ }
- /**
- * Returns the current resource selection that is being given to the wizard.
- */
- protected IStructuredSelection getCurrentResourceSelection() {
- return parentWizardPage.getCurrentResourceSelection();
- }
+ /**
+ * Returns the current resource selection that is being given to the wizard.
+ */
+ protected IStructuredSelection getCurrentResourceSelection() {
+ return parentWizardPage.getCurrentResourceSelection();
+ }
- @Override
+ @Override
public Point getExtent() {
- return new Point(-1, -1);
- }
+ return new Point(-1, -1);
+ }
- @Override
+ @Override
public String getLocalId() {
- IPluginContribution contribution = Adapters.adapt(wizardElement, IPluginContribution.class);
+ IPluginContribution contribution = Adapters.adapt(wizardElement, IPluginContribution.class);
if (contribution != null) {
return contribution.getLocalId();
}
return wizardElement.getId();
- }
+ }
- @Override
+ @Override
public String getPluginId() {
- IPluginContribution contribution = Adapters.adapt(wizardElement, IPluginContribution.class);
+ IPluginContribution contribution = Adapters.adapt(wizardElement, IPluginContribution.class);
if (contribution != null) {
return contribution.getPluginId();
}
return null;
- }
+ }
- @Override
+ @Override
public IWizard getWizard() {
- if (wizard != null) {
+ if (wizard != null) {
return wizard; // we've already created it
}
- final IWorkbenchWizard[] workbenchWizard = new IWorkbenchWizard[1];
- final IStatus statuses[] = new IStatus[1];
- // Start busy indicator.
- BusyIndicator.showWhile(parentWizardPage.getShell().getDisplay(),
- () -> SafeRunner.run(new SafeRunnable() {
- /**
- * Add the exception details to status is one happens.
- */
- @Override
- public void handleException(Throwable e) {
- IPluginContribution contribution = Adapters.adapt(wizardElement, IPluginContribution.class);
- statuses[0] = new Status(
- IStatus.ERROR,
- contribution != null ? contribution.getPluginId() : WorkbenchPlugin.PI_WORKBENCH,
- IStatus.OK,
- WorkbenchMessages.WorkbenchWizard_errorMessage,
- e);
- }
-
- @Override
- public void run() {
- try {
- workbenchWizard[0] = createWizard();
- // create instance of target wizard
- } catch (CoreException e) {
- IPluginContribution contribution = Adapters.adapt(wizardElement, IPluginContribution.class);
- statuses[0] = new Status(
- IStatus.ERROR,
- contribution != null ? contribution.getPluginId() : WorkbenchPlugin.PI_WORKBENCH,
- IStatus.OK,
- WorkbenchMessages.WorkbenchWizard_errorMessage,
- e);
- }
- }
- }));
-
- if (statuses[0] != null) {
- parentWizardPage
- .setErrorMessage(WorkbenchMessages.WorkbenchWizard_errorMessage);
+ final IWorkbenchWizard[] workbenchWizard = new IWorkbenchWizard[1];
+ final IStatus statuses[] = new IStatus[1];
+ // Start busy indicator.
+ BusyIndicator.showWhile(parentWizardPage.getShell().getDisplay(), () -> SafeRunner.run(new SafeRunnable() {
+ /**
+ * Add the exception details to status is one happens.
+ */
+ @Override
+ public void handleException(Throwable e) {
+ IPluginContribution contribution = Adapters.adapt(wizardElement, IPluginContribution.class);
+ statuses[0] = new Status(IStatus.ERROR,
+ contribution != null ? contribution.getPluginId() : WorkbenchPlugin.PI_WORKBENCH, IStatus.OK,
+ WorkbenchMessages.WorkbenchWizard_errorMessage, e);
+ }
+
+ @Override
+ public void run() {
+ try {
+ workbenchWizard[0] = createWizard();
+ // create instance of target wizard
+ } catch (CoreException e) {
+ IPluginContribution contribution = Adapters.adapt(wizardElement, IPluginContribution.class);
+ statuses[0] = new Status(IStatus.ERROR,
+ contribution != null ? contribution.getPluginId() : WorkbenchPlugin.PI_WORKBENCH,
+ IStatus.OK, WorkbenchMessages.WorkbenchWizard_errorMessage, e);
+ }
+ }
+ }));
+
+ if (statuses[0] != null) {
+ parentWizardPage.setErrorMessage(WorkbenchMessages.WorkbenchWizard_errorMessage);
StatusAdapter statusAdapter = new StatusAdapter(statuses[0]);
statusAdapter.addAdapter(Shell.class, parentWizardPage.getShell());
- statusAdapter.setProperty(StatusAdapter.TITLE_PROPERTY,
- WorkbenchMessages.WorkbenchWizard_errorTitle);
- StatusManager.getManager()
- .handle(statusAdapter, StatusManager.SHOW);
+ statusAdapter.setProperty(StatusAdapter.TITLE_PROPERTY, WorkbenchMessages.WorkbenchWizard_errorTitle);
+ StatusManager.getManager().handle(statusAdapter, StatusManager.SHOW);
return null;
- }
+ }
- IStructuredSelection currentSelection = getCurrentResourceSelection();
+ IStructuredSelection currentSelection = getCurrentResourceSelection();
- //Get the adapted version of the selection that works for the
- //wizard node
- currentSelection = wizardElement.adaptedSelection(currentSelection);
+ // Get the adapted version of the selection that works for the
+ // wizard node
+ currentSelection = wizardElement.adaptedSelection(currentSelection);
- workbenchWizard[0].init(getWorkbench(), currentSelection);
+ workbenchWizard[0].init(getWorkbench(), currentSelection);
- wizard = workbenchWizard[0];
- return wizard;
- }
+ wizard = workbenchWizard[0];
+ return wizard;
+ }
- /**
- * Returns the wizard element.
- *
- * @return the wizard descriptor
- */
- public IWizardDescriptor getWizardElement() {
- return wizardElement;
- }
+ /**
+ * Returns the wizard element.
+ *
+ * @return the wizard descriptor
+ */
+ public IWizardDescriptor getWizardElement() {
+ return wizardElement;
+ }
- /**
- * Returns the current workbench.
- */
- protected IWorkbench getWorkbench() {
- return parentWizardPage.getWorkbench();
- }
+ /**
+ * Returns the current workbench.
+ */
+ protected IWorkbench getWorkbench() {
+ return parentWizardPage.getWorkbench();
+ }
- @Override
+ @Override
public boolean isContentCreated() {
- return wizard != null;
- }
+ return wizard != null;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchWizardSelectionPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchWizardSelectionPage.java
index b4c2d7e9caa..4763a7b7ddd 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchWizardSelectionPage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchWizardSelectionPage.java
@@ -29,76 +29,74 @@ import org.eclipse.ui.model.AdaptableList;
*/
public abstract class WorkbenchWizardSelectionPage extends WizardSelectionPage {
- // variables
- protected IWorkbench workbench;
+ // variables
+ protected IWorkbench workbench;
- protected AdaptableList wizardElements;
+ protected AdaptableList wizardElements;
- public TableViewer wizardSelectionViewer;
+ public TableViewer wizardSelectionViewer;
- protected IStructuredSelection currentResourceSelection;
+ protected IStructuredSelection currentResourceSelection;
- protected String triggerPointId;
+ protected String triggerPointId;
- /**
- * Create an instance of this class
- */
- public WorkbenchWizardSelectionPage(String name, IWorkbench aWorkbench,
- IStructuredSelection currentSelection, AdaptableList elements,
- String triggerPointId) {
- super(name);
- this.wizardElements = elements;
- this.currentResourceSelection = currentSelection;
- this.workbench = aWorkbench;
- this.triggerPointId = triggerPointId;
- setTitle(WorkbenchMessages.Select);
- }
+ /**
+ * Create an instance of this class
+ */
+ public WorkbenchWizardSelectionPage(String name, IWorkbench aWorkbench, IStructuredSelection currentSelection,
+ AdaptableList elements, String triggerPointId) {
+ super(name);
+ this.wizardElements = elements;
+ this.currentResourceSelection = currentSelection;
+ this.workbench = aWorkbench;
+ this.triggerPointId = triggerPointId;
+ setTitle(WorkbenchMessages.Select);
+ }
- /**
- * Answer the wizard object corresponding to the passed id, or null
- * if such an object could not be found
- *
- * @return WizardElement
- * @param searchId the id to search on
- */
- protected WorkbenchWizardElement findWizard(String searchId) {
+ /**
+ * Answer the wizard object corresponding to the passed id, or null if such an
+ * object could not be found
+ *
+ * @return WizardElement
+ * @param searchId the id to search on
+ */
+ protected WorkbenchWizardElement findWizard(String searchId) {
for (Object element : wizardElements.getChildren()) {
- WorkbenchWizardElement currentWizard = (WorkbenchWizardElement) element;
- if (currentWizard.getId().equals(searchId)) {
+ WorkbenchWizardElement currentWizard = (WorkbenchWizardElement) element;
+ if (currentWizard.getId().equals(searchId)) {
return currentWizard;
}
- }
+ }
- return null;
- }
+ return null;
+ }
- public IStructuredSelection getCurrentResourceSelection() {
- return currentResourceSelection;
- }
+ public IStructuredSelection getCurrentResourceSelection() {
+ return currentResourceSelection;
+ }
- public IWorkbench getWorkbench() {
- return this.workbench;
- }
+ public IWorkbench getWorkbench() {
+ return this.workbench;
+ }
- /**
- * Specify the passed wizard node as being selected, meaning that if
- * it's non-null then the wizard to be displayed when the user next
- * presses the Next button should be determined by asking the passed
- * node.
- *
- * @param node org.eclipse.jface.wizards.IWizardNode
- */
- public void selectWizardNode(IWizardNode node) {
- setSelectedNode(node);
- }
+ /**
+ * Specify the passed wizard node as being selected, meaning that if it's
+ * non-null then the wizard to be displayed when the user next presses the Next
+ * button should be determined by asking the passed node.
+ *
+ * @param node org.eclipse.jface.wizards.IWizardNode
+ */
+ public void selectWizardNode(IWizardNode node) {
+ setSelectedNode(node);
+ }
- @Override
+ @Override
public IWizardPage getNextPage() {
- ITriggerPoint triggerPoint = getWorkbench().getActivitySupport()
- .getTriggerPointManager().getTriggerPoint(triggerPointId);
- if (triggerPoint == null || WorkbenchActivityHelper.allowUseOf(triggerPoint, getSelectedNode())) {
+ ITriggerPoint triggerPoint = getWorkbench().getActivitySupport().getTriggerPointManager()
+ .getTriggerPoint(triggerPointId);
+ if (triggerPoint == null || WorkbenchActivityHelper.allowUseOf(triggerPoint, getSelectedNode())) {
return super.getNextPage();
}
- return null;
- }
+ return null;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetEditWizard.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetEditWizard.java
index cbec02bf604..9115431f329 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetEditWizard.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetEditWizard.java
@@ -20,81 +20,80 @@ import org.eclipse.ui.dialogs.IWorkingSetPage;
import org.eclipse.ui.internal.WorkbenchMessages;
/**
- * A working set edit wizard allows the user to edit a
- * working set using a plugin specified working set page.
+ * A working set edit wizard allows the user to edit a working set using a
+ * plugin specified working set page.
*
* @since 2.0
* @see org.eclipse.ui.dialog.IWorkingSetPage
*/
-public class WorkingSetEditWizard extends Wizard implements
- IWorkingSetEditWizard {
- private IWorkingSetPage workingSetEditPage;
+public class WorkingSetEditWizard extends Wizard implements IWorkingSetEditWizard {
+ private IWorkingSetPage workingSetEditPage;
- private IWorkingSet workingSet;
+ private IWorkingSet workingSet;
- /**
- * Creates a new instance of the receiver.
- *
- * @param editPage the working set page that is going to
- * be used for editing a working set.
- */
- public WorkingSetEditWizard(IWorkingSetPage editPage) {
- super();
- workingSetEditPage = editPage;
- workingSetEditPage.setWizard(this);
- setWindowTitle(WorkbenchMessages.WorkingSetEditWizard_title);
- }
+ /**
+ * Creates a new instance of the receiver.
+ *
+ * @param editPage the working set page that is going to be used for editing a
+ * working set.
+ */
+ public WorkingSetEditWizard(IWorkingSetPage editPage) {
+ super();
+ workingSetEditPage = editPage;
+ workingSetEditPage.setWizard(this);
+ setWindowTitle(WorkbenchMessages.WorkingSetEditWizard_title);
+ }
- /**
- * Overrides Wizard.
- *
- * @see org.eclipse.jface.wizard.Wizard#addPages
- */
- @Override
+ /**
+ * Overrides Wizard.
+ *
+ * @see org.eclipse.jface.wizard.Wizard#addPages
+ */
+ @Override
public void addPages() {
- super.addPages();
- addPage(workingSetEditPage);
- }
+ super.addPages();
+ addPage(workingSetEditPage);
+ }
- /**
- * Overrides Wizard.
- *
- * @see org.eclipse.jface.wizard.Wizard#canFinish()
- */
- @Override
+ /**
+ * Overrides Wizard.
+ *
+ * @see org.eclipse.jface.wizard.Wizard#canFinish()
+ */
+ @Override
public boolean canFinish() {
- return workingSetEditPage.isPageComplete();
- }
+ return workingSetEditPage.isPageComplete();
+ }
- /**
- * Returns the working set that is being edited.
- *
- * @return the working set that is being edited.
- */
- @Override
+ /**
+ * Returns the working set that is being edited.
+ *
+ * @return the working set that is being edited.
+ */
+ @Override
public IWorkingSet getSelection() {
- return workingSet;
- }
+ return workingSet;
+ }
- /**
- * Overrides Wizard.
- * Notifies the IWorkingSetPage that the wizard is being closed.
- *
- * @see org.eclipse.jface.wizard.Wizard#performFinish
- */
- @Override
+ /**
+ * Overrides Wizard. Notifies the IWorkingSetPage that the wizard is being
+ * closed.
+ *
+ * @see org.eclipse.jface.wizard.Wizard#performFinish
+ */
+ @Override
public boolean performFinish() {
- workingSetEditPage.finish();
- return true;
- }
+ workingSetEditPage.finish();
+ return true;
+ }
- /**
- * Sets the working set that should be edited.
- *
- * @param workingSet the working set that should be edited.
- */
- public void setSelection(IWorkingSet workingSet) {
- this.workingSet = workingSet;
- workingSetEditPage.setSelection(workingSet);
- }
+ /**
+ * Sets the working set that should be edited.
+ *
+ * @param workingSet the working set that should be edited.
+ */
+ public void setSelection(IWorkingSet workingSet) {
+ this.workingSet = workingSet;
+ workingSetEditPage.setSelection(workingSet);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetFilter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetFilter.java
index bce3d8e1a38..8a66da35676 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetFilter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetFilter.java
@@ -21,23 +21,23 @@ import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.ui.IWorkingSet;
public class WorkingSetFilter extends ViewerFilter {
- Set workingSetIds;
+ Set workingSetIds;
- public WorkingSetFilter(Set workingSetIds) {
- this.workingSetIds = workingSetIds;
- }
+ public WorkingSetFilter(Set workingSetIds) {
+ this.workingSetIds = workingSetIds;
+ }
- @Override
+ @Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
- if (element instanceof IWorkingSet) {
- IWorkingSet workingSet = (IWorkingSet) element;
+ if (element instanceof IWorkingSet) {
+ IWorkingSet workingSet = (IWorkingSet) element;
String id = workingSet.getId();
- //if (!workingSet.isVisible())
- // return false;
- if (workingSetIds != null && id != null) {
- return workingSetIds.contains(id);
- }
- }
- return true;
- }
+ // if (!workingSet.isVisible())
+ // return false;
+ if (workingSetIds != null && id != null) {
+ return workingSetIds.contains(id);
+ }
+ }
+ return true;
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetLabelProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetLabelProvider.java
index fa304d1a336..a9b1333577f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetLabelProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetLabelProvider.java
@@ -24,40 +24,40 @@ import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IWorkingSet;
public class WorkingSetLabelProvider extends LabelProvider {
- private ResourceManager images;
+ private ResourceManager images;
- /**
- * Create a new instance of the receiver.
- */
- public WorkingSetLabelProvider() {
- images = new LocalResourceManager(JFaceResources.getResources());
- }
+ /**
+ * Create a new instance of the receiver.
+ */
+ public WorkingSetLabelProvider() {
+ images = new LocalResourceManager(JFaceResources.getResources());
+ }
- @Override
+ @Override
public void dispose() {
- images.dispose();
+ images.dispose();
- super.dispose();
- }
+ super.dispose();
+ }
- @Override
+ @Override
public Image getImage(Object object) {
- Assert.isTrue(object instanceof IWorkingSet);
- IWorkingSet workingSet = (IWorkingSet) object;
- ImageDescriptor imageDescriptor = workingSet.getImageDescriptor();
+ Assert.isTrue(object instanceof IWorkingSet);
+ IWorkingSet workingSet = (IWorkingSet) object;
+ ImageDescriptor imageDescriptor = workingSet.getImageDescriptor();
- if (imageDescriptor == null) {
+ if (imageDescriptor == null) {
return null;
}
- Image icon = (Image) images.get(imageDescriptor);
- return icon;
- }
+ Image icon = (Image) images.get(imageDescriptor);
+ return icon;
+ }
- @Override
+ @Override
public String getText(Object object) {
- Assert.isTrue(object instanceof IWorkingSet);
- IWorkingSet workingSet = (IWorkingSet) object;
- return workingSet.getLabel();
- }
+ Assert.isTrue(object instanceof IWorkingSet);
+ IWorkingSet workingSet = (IWorkingSet) object;
+ return workingSet.getLabel();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetNewWizard.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetNewWizard.java
index cc51529f196..54f630739ae 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetNewWizard.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetNewWizard.java
@@ -25,122 +25,115 @@ import org.eclipse.ui.internal.registry.WorkingSetDescriptor;
import org.eclipse.ui.internal.registry.WorkingSetRegistry;
/**
- * A new working set wizard allows the user to create a
- * new working set using a plugin specified working set page.
+ * A new working set wizard allows the user to create a new working set using a
+ * plugin specified working set page.
*
* @since 2.0
* @see org.eclipse.ui.dialog.IWorkingSetPage
*/
public class WorkingSetNewWizard extends Wizard implements IWorkingSetNewWizard {
- private WorkingSetTypePage workingSetTypePage;
+ private WorkingSetTypePage workingSetTypePage;
- private IWorkingSetPage workingSetEditPage;
+ private IWorkingSetPage workingSetEditPage;
- private String editPageId;
+ private String editPageId;
- private IWorkingSet workingSet;
+ private IWorkingSet workingSet;
- private WorkingSetDescriptor[] descriptors;
+ private WorkingSetDescriptor[] descriptors;
- /**
- * Creates a new instance of the receiver.
- *
- * @param descriptors the choice of descriptors
- */
- public WorkingSetNewWizard(WorkingSetDescriptor[] descriptors) {
- super();
- Assert.isTrue(descriptors != null && descriptors.length > 0);
- this.descriptors= descriptors;
- setWindowTitle(WorkbenchMessages.WorkingSetNewWizard_title);
- }
+ /**
+ * Creates a new instance of the receiver.
+ *
+ * @param descriptors the choice of descriptors
+ */
+ public WorkingSetNewWizard(WorkingSetDescriptor[] descriptors) {
+ super();
+ Assert.isTrue(descriptors != null && descriptors.length > 0);
+ this.descriptors = descriptors;
+ setWindowTitle(WorkbenchMessages.WorkingSetNewWizard_title);
+ }
- /**
- * Overrides method in Wizard.
- * Adds a page listing the available kinds of working sets.
- * The second wizard page will depend on the selected working set
- * type.
- *
- * @see org.eclipse.jface.wizard.Wizard#addPages()
- */
- @Override
+ /**
+ * Overrides method in Wizard. Adds a page listing the available kinds of
+ * working sets. The second wizard page will depend on the selected working set
+ * type.
+ *
+ * @see org.eclipse.jface.wizard.Wizard#addPages()
+ */
+ @Override
public void addPages() {
- super.addPages();
+ super.addPages();
- IWizardPage page;
- WorkingSetRegistry registry = WorkbenchPlugin.getDefault().getWorkingSetRegistry();
+ IWizardPage page;
+ WorkingSetRegistry registry = WorkbenchPlugin.getDefault().getWorkingSetRegistry();
- if (descriptors.length > 1) {
- page = workingSetTypePage = new WorkingSetTypePage(this.descriptors);
- } else {
- editPageId = descriptors[0].getId();
- page = workingSetEditPage = registry.getWorkingSetPage(editPageId);
- }
- page.setWizard(this);
- addPage(page);
- setForcePreviousAndNextButtons(descriptors.length > 1);
- }
+ if (descriptors.length > 1) {
+ page = workingSetTypePage = new WorkingSetTypePage(this.descriptors);
+ } else {
+ editPageId = descriptors[0].getId();
+ page = workingSetEditPage = registry.getWorkingSetPage(editPageId);
+ }
+ page.setWizard(this);
+ addPage(page);
+ setForcePreviousAndNextButtons(descriptors.length > 1);
+ }
/**
- * Overrides method in Wizard.
- *
- * @see org.eclipse.jface.wizard.Wizard#canFinish()
- */
- @Override
+ * Overrides method in Wizard.
+ *
+ * @see org.eclipse.jface.wizard.Wizard#canFinish()
+ */
+ @Override
public boolean canFinish() {
- return (workingSetEditPage != null && workingSetEditPage
- .isPageComplete());
- }
+ return (workingSetEditPage != null && workingSetEditPage.isPageComplete());
+ }
- /**
- * Overrides method in Wizard.
- * Returns a working set page for creating the new working set.
- * This second page is loaded from the plugin that defined the
- * selected working set type.
- *
- * @see org.eclipse.jface.wizard.Wizard#getNextPage(IWizardPage)
- */
- @Override
+ /**
+ * Overrides method in Wizard. Returns a working set page for creating the new
+ * working set. This second page is loaded from the plugin that defined the
+ * selected working set type.
+ *
+ * @see org.eclipse.jface.wizard.Wizard#getNextPage(IWizardPage)
+ */
+ @Override
public IWizardPage getNextPage(IWizardPage page) {
- if (workingSetTypePage != null && page == workingSetTypePage) {
- String pageId = workingSetTypePage.getSelection();
- if (pageId != null) {
- if (workingSetEditPage == null || pageId != editPageId) {
- WorkingSetRegistry registry = WorkbenchPlugin.getDefault()
- .getWorkingSetRegistry();
- workingSetEditPage = registry.getWorkingSetPage(pageId);
- addPage(workingSetEditPage);
- editPageId = pageId;
- }
- return workingSetEditPage;
- }
- }
- return null;
- }
+ if (workingSetTypePage != null && page == workingSetTypePage) {
+ String pageId = workingSetTypePage.getSelection();
+ if (pageId != null) {
+ if (workingSetEditPage == null || pageId != editPageId) {
+ WorkingSetRegistry registry = WorkbenchPlugin.getDefault().getWorkingSetRegistry();
+ workingSetEditPage = registry.getWorkingSetPage(pageId);
+ addPage(workingSetEditPage);
+ editPageId = pageId;
+ }
+ return workingSetEditPage;
+ }
+ }
+ return null;
+ }
- /**
- * Returns the new working set. Returns null if the wizard has
- * been cancelled.
- *
- * @return the new working set or null if the wizard has been
- * cancelled.
- */
- @Override
+ /**
+ * Returns the new working set. Returns null if the wizard has been cancelled.
+ *
+ * @return the new working set or null if the wizard has been cancelled.
+ */
+ @Override
public IWorkingSet getSelection() {
- return workingSet;
- }
+ return workingSet;
+ }
- /**
- * Overrides method in Wizard.
- * Stores the newly created working set and the id of the page
- * used to create it.
- *
- * @see org.eclipse.jface.wizard.Wizard#performFinish()
- */
- @Override
+ /**
+ * Overrides method in Wizard. Stores the newly created working set and the id
+ * of the page used to create it.
+ *
+ * @see org.eclipse.jface.wizard.Wizard#performFinish()
+ */
+ @Override
public boolean performFinish() {
- workingSetEditPage.finish();
- workingSet = workingSetEditPage.getSelection();
- workingSet.setId(editPageId);
- return true;
- }
+ workingSetEditPage.finish();
+ workingSet = workingSetEditPage.getSelection();
+ workingSet.setId(editPageId);
+ return true;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetSelectionDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetSelectionDialog.java
index bb08ea16dd2..6018b7eed83 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetSelectionDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetSelectionDialog.java
@@ -49,26 +49,26 @@ import org.eclipse.ui.internal.util.Util;
import org.eclipse.ui.model.WorkbenchViewerComparator;
/**
- * A working set selection dialog displays a list of working
- * sets available in the workbench.
+ * A working set selection dialog displays a list of working sets available in
+ * the workbench.
*
* @see IWorkingSetSelectionDialog
* @since 2.0
*/
public class WorkingSetSelectionDialog extends AbstractWorkingSetDialog {
- private static final int SIZING_SELECTION_WIDGET_HEIGHT = 200;
+ private static final int SIZING_SELECTION_WIDGET_HEIGHT = 200;
- private static final int SIZING_SELECTION_WIDGET_WIDTH = 50;
+ private static final int SIZING_SELECTION_WIDGET_WIDTH = 50;
- private ILabelProvider labelProvider;
+ private ILabelProvider labelProvider;
- private IStructuredContentProvider contentProvider;
+ private IStructuredContentProvider contentProvider;
- private CheckboxTableViewer listViewer;
+ private CheckboxTableViewer listViewer;
- private boolean multiSelect;
+ private boolean multiSelect;
- private IWorkbenchWindow workbenchWindow;
+ private IWorkbenchWindow workbenchWindow;
private Button buttonWindowSet;
@@ -76,86 +76,86 @@ public class WorkingSetSelectionDialog extends AbstractWorkingSetDialog {
private Button buttonSelectedSets;
- /**
- * Creates a working set selection dialog.
- *
- * @param parentShell the parent shell
- * @param multi decides how the results are returned with
- * <code>WorkingSetSelectionDialog#getSelection()</code> or
- * <code>WorkingSetSelectionDialog#getResult()</code>. true= working sets
- * chosen in the dialog are returned as an array of working set.false= returns
- * an array having a single aggregate working set of all working sets selected
- * in the dialog.
- * @param workingSetIds a list of working set ids which are valid workings sets
- * to be selected, created, removed or edited, or <code>null</code> if all currently
- * available working set types are valid
- */
- public WorkingSetSelectionDialog(Shell parentShell, boolean multi, String[] workingSetIds) {
- super(parentShell, workingSetIds, true);
- initWorkbenchWindow();
-
- contentProvider = new ArrayContentProvider();
- labelProvider = new WorkingSetLabelProvider();
- multiSelect = multi;
- if (multiSelect) {
- setTitle(WorkbenchMessages.WorkingSetSelectionDialog_title_multiSelect);
- setMessage(WorkbenchMessages.WorkingSetSelectionDialog_message_multiSelect);
- } else {
- setTitle(WorkbenchMessages.WorkingSetSelectionDialog_title);
- setMessage(WorkbenchMessages.WorkingSetSelectionDialog_message);
- }
-
- }
-
- /**
+ /**
+ * Creates a working set selection dialog.
+ *
+ * @param parentShell the parent shell
+ * @param multi decides how the results are returned with
+ * <code>WorkingSetSelectionDialog#getSelection()</code> or
+ * <code>WorkingSetSelectionDialog#getResult()</code>.
+ * true= working sets chosen in the dialog are returned as
+ * an array of working set.false= returns an array having a
+ * single aggregate working set of all working sets
+ * selected in the dialog.
+ * @param workingSetIds a list of working set ids which are valid workings sets
+ * to be selected, created, removed or edited, or
+ * <code>null</code> if all currently available working set
+ * types are valid
+ */
+ public WorkingSetSelectionDialog(Shell parentShell, boolean multi, String[] workingSetIds) {
+ super(parentShell, workingSetIds, true);
+ initWorkbenchWindow();
+
+ contentProvider = new ArrayContentProvider();
+ labelProvider = new WorkingSetLabelProvider();
+ multiSelect = multi;
+ if (multiSelect) {
+ setTitle(WorkbenchMessages.WorkingSetSelectionDialog_title_multiSelect);
+ setMessage(WorkbenchMessages.WorkingSetSelectionDialog_message_multiSelect);
+ } else {
+ setTitle(WorkbenchMessages.WorkingSetSelectionDialog_title);
+ setMessage(WorkbenchMessages.WorkingSetSelectionDialog_message);
+ }
+
+ }
+
+ /**
* Determine what window this dialog is being opened on. This impacts the
* returned working set in the case where the user chooses the window set.
*
* @since 3.2
*/
- private void initWorkbenchWindow() {
+ private void initWorkbenchWindow() {
Shell shellToCheck = getShell();
workbenchWindow = Util.getWorkbenchWindowForShell(shellToCheck);
}
- /**
- * Overrides method from Dialog.
- *
- * @see org.eclipse.jface.dialogs.Dialog#cancelPressed()
- */
- @Override
+ /**
+ * Overrides method from Dialog.
+ *
+ * @see org.eclipse.jface.dialogs.Dialog#cancelPressed()
+ */
+ @Override
protected void cancelPressed() {
- restoreAddedWorkingSets();
- restoreChangedWorkingSets();
- restoreRemovedWorkingSets();
- setSelection(null);
- super.cancelPressed();
- }
-
- /**
- * Overrides method from Window.
- *
- * @see org.eclipse.jface.window.Window#configureShell(Shell)
- */
- @Override
+ restoreAddedWorkingSets();
+ restoreChangedWorkingSets();
+ restoreRemovedWorkingSets();
+ setSelection(null);
+ super.cancelPressed();
+ }
+
+ /**
+ * Overrides method from Window.
+ *
+ * @see org.eclipse.jface.window.Window#configureShell(Shell)
+ */
+ @Override
protected void configureShell(Shell shell) {
- super.configureShell(shell);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(shell,
- IWorkbenchHelpContextIds.WORKING_SET_SELECTION_DIALOG);
- }
-
- /**
- * Overrides method from Dialog.
- * Create the dialog widgets.
- *
- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(Composite)
- */
- @Override
+ super.configureShell(shell);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(shell, IWorkbenchHelpContextIds.WORKING_SET_SELECTION_DIALOG);
+ }
+
+ /**
+ * Overrides method from Dialog. Create the dialog widgets.
+ *
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(Composite)
+ */
+ @Override
protected Control createDialogArea(Composite parent) {
- initializeDialogUnits(parent);
+ initializeDialogUnits(parent);
- Composite composite = (Composite) super.createDialogArea(parent);
+ Composite composite = (Composite) super.createDialogArea(parent);
createMessageArea(composite);
@@ -186,8 +186,7 @@ public class WorkingSetSelectionDialog extends AbstractWorkingSetDialog {
buttonSelectedSets.setSelection(true);
break;
}
- buttonSelectedSets
- .setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ buttonSelectedSets.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Composite viewerComposite = new Composite(composite, SWT.NONE);
GridLayout layout = new GridLayout(2, false);
@@ -198,46 +197,43 @@ public class WorkingSetSelectionDialog extends AbstractWorkingSetDialog {
GridData data = new GridData(GridData.FILL_BOTH);
data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT;
- data.widthHint = SIZING_SELECTION_WIDGET_WIDTH + 300; // fudge? I like fudge.
+ data.widthHint = SIZING_SELECTION_WIDGET_WIDTH + 300; // fudge? I like fudge.
viewerComposite.setLayoutData(data);
- listViewer = CheckboxTableViewer.newCheckList(viewerComposite,
- SWT.BORDER | SWT.MULTI);
+ listViewer = CheckboxTableViewer.newCheckList(viewerComposite, SWT.BORDER | SWT.MULTI);
data = new GridData(GridData.FILL_BOTH);
data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT;
data.widthHint = SIZING_SELECTION_WIDGET_WIDTH;
listViewer.getTable().setLayoutData(data);
- listViewer.setLabelProvider(labelProvider);
- listViewer.setContentProvider(contentProvider);
- listViewer.setComparator(new WorkbenchViewerComparator());
+ listViewer.setLabelProvider(labelProvider);
+ listViewer.setContentProvider(contentProvider);
+ listViewer.setComparator(new WorkbenchViewerComparator());
- listViewer.addFilter(new WorkingSetFilter(getSupportedWorkingSetIds()));
+ listViewer.addFilter(new WorkingSetFilter(getSupportedWorkingSetIds()));
- listViewer.addSelectionChangedListener(event -> handleSelectionChanged());
- listViewer.addDoubleClickListener(event -> {
+ listViewer.addSelectionChangedListener(event -> handleSelectionChanged());
+ listViewer.addDoubleClickListener(event -> {
Object obj = listViewer.getStructuredSelection().getFirstElement();
- listViewer.setCheckedElements(new Object[] {obj});
+ listViewer.setCheckedElements(new Object[] { obj });
buttonWindowSet.setSelection(false);
buttonNoSet.setSelection(false);
buttonSelectedSets.setSelection(true);
okPressed();
});
- listViewer.addCheckStateListener(event -> {
+ listViewer.addCheckStateListener(event -> {
// implicitly select the third radio button
buttonWindowSet.setSelection(false);
buttonNoSet.setSelection(false);
buttonSelectedSets.setSelection(true);
});
- addModifyButtons(viewerComposite);
-
- addSelectionButtons(composite);
+ addModifyButtons(viewerComposite);
+ addSelectionButtons(composite);
- listViewer.setInput(Arrays.asList(WorkbenchPlugin.getDefault()
- .getWorkingSetManager().getWorkingSets()));
- List initialElementSelections = getInitialElementSelections();
+ listViewer.setInput(Arrays.asList(WorkbenchPlugin.getDefault().getWorkingSetManager().getWorkingSets()));
+ List initialElementSelections = getInitialElementSelections();
if (multiSelect) {
listViewer.setCheckedElements(initialElementSelections.toArray());
} else if (!initialElementSelections.isEmpty()) {
@@ -245,8 +241,7 @@ public class WorkingSetSelectionDialog extends AbstractWorkingSetDialog {
if (set instanceof AggregateWorkingSet) {
AggregateWorkingSet aggregate = (AggregateWorkingSet) set;
listViewer.setCheckedElements(aggregate.getComponents());
- }
- else {
+ } else {
listViewer.setCheckedElements(initialElementSelections.toArray());
}
}
@@ -255,83 +250,77 @@ public class WorkingSetSelectionDialog extends AbstractWorkingSetDialog {
Dialog.applyDialogFont(composite);
return composite;
- }
-
- private int getInitialRadioSelection() {
- IWorkingSet windowSet = workbenchWindow.getActivePage().getAggregateWorkingSet();
-
- int selectionIndex;
- if (getSelection() != null && getSelection().length > 0) {
- if (windowSet.equals(getSelection()[0])) {
- selectionIndex = 0;
- }
- else {
- selectionIndex = 2;
- }
- }
- else {
- selectionIndex = 1;
- }
+ }
+
+ private int getInitialRadioSelection() {
+ IWorkingSet windowSet = workbenchWindow.getActivePage().getAggregateWorkingSet();
+
+ int selectionIndex;
+ if (getSelection() != null && getSelection().length > 0) {
+ if (windowSet.equals(getSelection()[0])) {
+ selectionIndex = 0;
+ } else {
+ selectionIndex = 2;
+ }
+ } else {
+ selectionIndex = 1;
+ }
return selectionIndex;
}
/**
- * Overrides method from Dialog.
- * Sets the initial selection, if any.
- *
- * @see org.eclipse.jface.dialogs.Dialog#createContents(Composite)
- */
- @Override
+ * Overrides method from Dialog. Sets the initial selection, if any.
+ *
+ * @see org.eclipse.jface.dialogs.Dialog#createContents(Composite)
+ */
+ @Override
protected Control createContents(Composite parent) {
- Control control = super.createContents(parent);
- List selections = getInitialElementSelections();
- if (!selections.isEmpty()) {
- listViewer.setSelection(new StructuredSelection(selections), true);
- }
- updateButtonAvailability();
- return control;
- }
-
- /**
- * Returns the selected working sets.
- *
- * @return the selected working sets
- */
- @Override
+ Control control = super.createContents(parent);
+ List selections = getInitialElementSelections();
+ if (!selections.isEmpty()) {
+ listViewer.setSelection(new StructuredSelection(selections), true);
+ }
+ updateButtonAvailability();
+ return control;
+ }
+
+ /**
+ * Returns the selected working sets.
+ *
+ * @return the selected working sets
+ */
+ @Override
protected List getSelectedWorkingSets() {
return listViewer.getStructuredSelection().toList();
- }
-
- /**
- * Called when the selection has changed.
- */
- void handleSelectionChanged() {
- updateButtonAvailability();
- }
-
- /**
- * Sets the selected working sets as the dialog result.
- * Overrides method from Dialog
- *
- * @see org.eclipse.jface.dialogs.Dialog#okPressed()
- */
- @Override
+ }
+
+ /**
+ * Called when the selection has changed.
+ */
+ void handleSelectionChanged() {
+ updateButtonAvailability();
+ }
+
+ /**
+ * Sets the selected working sets as the dialog result. Overrides method from
+ * Dialog
+ *
+ * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+ */
+ @Override
protected void okPressed() {
- if (buttonWindowSet.getSelection()) {
- IWorkingSet [] windowSet = new IWorkingSet[] {workbenchWindow.getActivePage().getAggregateWorkingSet()};
- setSelection(windowSet);
- setResult(Arrays.asList(getSelection()));
- }
- else if (buttonNoSet.getSelection()) {
+ if (buttonWindowSet.getSelection()) {
+ IWorkingSet[] windowSet = new IWorkingSet[] { workbenchWindow.getActivePage().getAggregateWorkingSet() };
+ setSelection(windowSet);
+ setResult(Arrays.asList(getSelection()));
+ } else if (buttonNoSet.getSelection()) {
setSelection(new IWorkingSet[0]);
setResult(Arrays.asList(getSelection()));
- }
- else if (buttonSelectedSets.getSelection()) {
+ } else if (buttonSelectedSets.getSelection()) {
Object[] untypedResult = listViewer.getCheckedElements();
IWorkingSet[] typedResult = new IWorkingSet[untypedResult.length];
- System.arraycopy(untypedResult, 0, typedResult, 0,
- untypedResult.length);
+ System.arraycopy(untypedResult, 0, typedResult, 0, untypedResult.length);
// if multiselect is allowed or there was only one selected then dont create
// an aggregate
if (multiSelect || typedResult.length <= 1) {
@@ -339,8 +328,7 @@ public class WorkingSetSelectionDialog extends AbstractWorkingSetDialog {
setResult(Arrays.asList(typedResult));
} else {
String setId = getAggregateIdForSets(typedResult);
- IWorkingSetManager workingSetManager = workbenchWindow.getWorkbench()
- .getWorkingSetManager();
+ IWorkingSetManager workingSetManager = workbenchWindow.getWorkbench().getWorkingSetManager();
IWorkingSet aggregate = workingSetManager.getWorkingSet(setId);
if (aggregate != null) {
workingSetManager.removeWorkingSet(aggregate);
@@ -351,86 +339,84 @@ public class WorkingSetSelectionDialog extends AbstractWorkingSetDialog {
setSelection(new IWorkingSet[] { aggregate });
setResult(Collections.singletonList(aggregate));
}
- }
+ }
- super.okPressed();
- }
+ super.okPressed();
+ }
- /**
- * Create a string that represents the name of the aggregate set composed of
- * the supplied working sets. It's very long and not printworthy.
+ /**
+ * Create a string that represents the name of the aggregate set composed of the
+ * supplied working sets. It's very long and not printworthy.
*
* @param typedResult the sets
* @return the name
*/
- private String getAggregateIdForSets(IWorkingSet[] typedResult) {
- StringBuilder buffer = new StringBuilder();
- buffer.append("Aggregate:"); //$NON-NLS-1$
- for (IWorkingSet element : typedResult) {
+ private String getAggregateIdForSets(IWorkingSet[] typedResult) {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append("Aggregate:"); //$NON-NLS-1$
+ for (IWorkingSet element : typedResult) {
buffer.append(element.getName()).append(':');
}
return buffer.toString();
}
/**
- * Removes newly created working sets from the working set manager.
- */
- private void restoreAddedWorkingSets() {
- IWorkingSetManager manager = WorkbenchPlugin.getDefault()
- .getWorkingSetManager();
- Iterator iterator = getAddedWorkingSets().iterator();
-
- while (iterator.hasNext()) {
- manager.removeWorkingSet(((IWorkingSet) iterator.next()));
- }
- }
-
- /**
- * Rolls back changes to working sets.
- */
- private void restoreChangedWorkingSets() {
- Iterator iterator = getEditedWorkingSets().keySet().iterator();
-
- while (iterator.hasNext()) {
- IWorkingSet editedWorkingSet = (IWorkingSet) iterator.next();
+ * Removes newly created working sets from the working set manager.
+ */
+ private void restoreAddedWorkingSets() {
+ IWorkingSetManager manager = WorkbenchPlugin.getDefault().getWorkingSetManager();
+ Iterator iterator = getAddedWorkingSets().iterator();
+
+ while (iterator.hasNext()) {
+ manager.removeWorkingSet(((IWorkingSet) iterator.next()));
+ }
+ }
+
+ /**
+ * Rolls back changes to working sets.
+ */
+ private void restoreChangedWorkingSets() {
+ Iterator iterator = getEditedWorkingSets().keySet().iterator();
+
+ while (iterator.hasNext()) {
+ IWorkingSet editedWorkingSet = (IWorkingSet) iterator.next();
IWorkingSet originalWorkingSet = getEditedWorkingSets().get(editedWorkingSet);
- if (editedWorkingSet.getName().equals(originalWorkingSet.getName()) == false) {
- editedWorkingSet.setName(originalWorkingSet.getName());
- }
+ if (editedWorkingSet.getName().equals(originalWorkingSet.getName()) == false) {
+ editedWorkingSet.setName(originalWorkingSet.getName());
+ }
if (!Arrays.equals(editedWorkingSet.getElements(), originalWorkingSet.getElements())) {
- editedWorkingSet.setElements(originalWorkingSet.getElements());
- }
- }
- }
-
- /**
- * Adds back removed working sets to the working set manager.
- */
- private void restoreRemovedWorkingSets() {
- IWorkingSetManager manager = WorkbenchPlugin.getDefault()
- .getWorkingSetManager();
- Iterator iterator = getRemovedWorkingSets().iterator();
-
- while (iterator.hasNext()) {
- manager.addWorkingSet(((IWorkingSet) iterator.next()));
- }
- iterator = getRemovedMRUWorkingSets().iterator();
- while (iterator.hasNext()) {
- manager.addRecentWorkingSet(((IWorkingSet) iterator.next()));
- }
- }
-
- /**
- * Implements IWorkingSetSelectionDialog.
- *
- * @see org.eclipse.ui.dialogs.IWorkingSetSelectionDialog#setSelection(IWorkingSet[])
- */
- @Override
+ editedWorkingSet.setElements(originalWorkingSet.getElements());
+ }
+ }
+ }
+
+ /**
+ * Adds back removed working sets to the working set manager.
+ */
+ private void restoreRemovedWorkingSets() {
+ IWorkingSetManager manager = WorkbenchPlugin.getDefault().getWorkingSetManager();
+ Iterator iterator = getRemovedWorkingSets().iterator();
+
+ while (iterator.hasNext()) {
+ manager.addWorkingSet(((IWorkingSet) iterator.next()));
+ }
+ iterator = getRemovedMRUWorkingSets().iterator();
+ while (iterator.hasNext()) {
+ manager.addRecentWorkingSet(((IWorkingSet) iterator.next()));
+ }
+ }
+
+ /**
+ * Implements IWorkingSetSelectionDialog.
+ *
+ * @see org.eclipse.ui.dialogs.IWorkingSetSelectionDialog#setSelection(IWorkingSet[])
+ */
+ @Override
public void setSelection(IWorkingSet[] workingSets) {
- super.setSelection(workingSets);
- setInitialSelections(workingSets == null ? new Object[0] : workingSets);
- }
+ super.setSelection(workingSets);
+ setInitialSelections(workingSets == null ? new Object[0] : workingSets);
+ }
@Override
protected void availableWorkingSetsChanged() {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetTypePage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetTypePage.java
index 6c221714dc3..1b0a892e24e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetTypePage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetTypePage.java
@@ -40,84 +40,82 @@ import org.eclipse.ui.internal.WorkbenchPlugin;
import org.eclipse.ui.internal.registry.WorkingSetDescriptor;
/**
- * The working set type page is used in the new working set
- * wizard to select from a list of plugin defined working set
- * types.
+ * The working set type page is used in the new working set wizard to select
+ * from a list of plugin defined working set types.
*
* @since 2.0
*/
public class WorkingSetTypePage extends WizardPage {
- private static final int SIZING_SELECTION_WIDGET_WIDTH = 50;
+ private static final int SIZING_SELECTION_WIDGET_WIDTH = 50;
- private static final int SIZING_SELECTION_WIDGET_HEIGHT = 200;
+ private static final int SIZING_SELECTION_WIDGET_HEIGHT = 200;
- private TableViewer typesListViewer;
+ private TableViewer typesListViewer;
private WorkingSetDescriptor[] descriptors;
- /**
- * Creates a new instance of the receiver
- */
- public WorkingSetTypePage() {
- this(WorkbenchPlugin.getDefault().getWorkingSetRegistry().getNewPageWorkingSetDescriptors());
- }
+ /**
+ * Creates a new instance of the receiver
+ */
+ public WorkingSetTypePage() {
+ this(WorkbenchPlugin.getDefault().getWorkingSetRegistry().getNewPageWorkingSetDescriptors());
+ }
- /**
- * @param descriptors a set of working set descriptors which can be selected on the page
+ /**
+ * @param descriptors a set of working set descriptors which can be selected on
+ * the page
*/
public WorkingSetTypePage(WorkingSetDescriptor[] descriptors) {
- super(
- "workingSetTypeSelectionPage", WorkbenchMessages.WorkingSetTypePage_description, WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_WIZBAN_WORKINGSET_WIZ)); //$NON-NLS-1$
+ super("workingSetTypeSelectionPage", WorkbenchMessages.WorkingSetTypePage_description, //$NON-NLS-1$
+ WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_WIZBAN_WORKINGSET_WIZ));
this.descriptors = descriptors;
}
- /**
+ /**
* Overrides method in WizardPage
*
* @see org.eclipse.jface.wizard.IWizardPage#canFlipToNextPage()
*/
- @Override
+ @Override
public boolean canFlipToNextPage() {
- return isPageComplete();
- }
-
- /**
- * Implements IDialogPage
- *
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(Composite)
- */
- @Override
+ return isPageComplete();
+ }
+
+ /**
+ * Implements IDialogPage
+ *
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(Composite)
+ */
+ @Override
public void createControl(Composite parent) {
- Font font = parent.getFont();
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- setControl(composite);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite,
- IWorkbenchHelpContextIds.WORKING_SET_TYPE_PAGE);
- Label typesLabel = new Label(composite, SWT.NONE);
- typesLabel.setText(WorkbenchMessages.WorkingSetTypePage_typesLabel);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- typesLabel.setLayoutData(data);
- typesLabel.setFont(font);
-
- typesListViewer = new TableViewer(composite, SWT.BORDER | SWT.SINGLE);
- data = new GridData(GridData.FILL_BOTH);
- data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT;
- data.widthHint = SIZING_SELECTION_WIDGET_WIDTH;
- typesListViewer.getTable().setLayoutData(data);
- typesListViewer.getTable().setFont(font);
- typesListViewer
- .addSelectionChangedListener(event -> handleSelectionChanged());
- typesListViewer.addDoubleClickListener(event -> handleDoubleClick());
- typesListViewer.setContentProvider(new ArrayContentProvider());
- typesListViewer.setLabelProvider(new LabelProvider() {
- private ResourceManager images = new LocalResourceManager(
- JFaceResources.getResources());
+ Font font = parent.getFont();
+ Composite composite = new Composite(parent, SWT.NULL);
+ composite.setLayout(new GridLayout());
+ composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+ setControl(composite);
+
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IWorkbenchHelpContextIds.WORKING_SET_TYPE_PAGE);
+ Label typesLabel = new Label(composite, SWT.NONE);
+ typesLabel.setText(WorkbenchMessages.WorkingSetTypePage_typesLabel);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ typesLabel.setLayoutData(data);
+ typesLabel.setFont(font);
+
+ typesListViewer = new TableViewer(composite, SWT.BORDER | SWT.SINGLE);
+ data = new GridData(GridData.FILL_BOTH);
+ data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT;
+ data.widthHint = SIZING_SELECTION_WIDGET_WIDTH;
+ typesListViewer.getTable().setLayoutData(data);
+ typesListViewer.getTable().setFont(font);
+ typesListViewer.addSelectionChangedListener(event -> handleSelectionChanged());
+ typesListViewer.addDoubleClickListener(event -> handleDoubleClick());
+ typesListViewer.setContentProvider(new ArrayContentProvider());
+ typesListViewer.setLabelProvider(new LabelProvider() {
+ private ResourceManager images = new LocalResourceManager(JFaceResources.getResources());
+
@Override
public String getText(Object element) {
- return ((WorkingSetDescriptor)element).getName();
+ return ((WorkingSetDescriptor) element).getName();
}
@Override
@@ -128,68 +126,65 @@ public class WorkingSetTypePage extends WizardPage {
@Override
public Image getImage(Object element) {
- ImageDescriptor imageDescriptor = ((WorkingSetDescriptor) element)
- .getIcon();
- return imageDescriptor == null ? null : (Image) images
- .get(imageDescriptor);
+ ImageDescriptor imageDescriptor = ((WorkingSetDescriptor) element).getIcon();
+ return imageDescriptor == null ? null : (Image) images.get(imageDescriptor);
}
});
- typesListViewer.setInput(descriptors);
- setPageComplete(false);
- }
-
- /**
- * Overrides method in DialogPage
- *
- * @see org.eclipse.jface.dialogs.IDialogPage#dispose()
- */
- @Override
+ typesListViewer.setInput(descriptors);
+ setPageComplete(false);
+ }
+
+ /**
+ * Overrides method in DialogPage
+ *
+ * @see org.eclipse.jface.dialogs.IDialogPage#dispose()
+ */
+ @Override
public void dispose() {
- super.dispose();
- }
-
- /**
- * Returns the page id of the selected working set type.
- *
- * @return the page id of the selected working set type.
- */
- public String getSelection() {
- WorkingSetDescriptor descriptor = getSelectedWorkingSet();
- if (descriptor != null)
- return descriptor.getId();
-
- return null;
- }
+ super.dispose();
+ }
+
+ /**
+ * Returns the page id of the selected working set type.
+ *
+ * @return the page id of the selected working set type.
+ */
+ public String getSelection() {
+ WorkingSetDescriptor descriptor = getSelectedWorkingSet();
+ if (descriptor != null)
+ return descriptor.getId();
+
+ return null;
+ }
/**
- * Return the selected working set.
- *
+ * Return the selected working set.
+ *
* @return the selected working set or <code>null</code>
- * @since 3.4
+ * @since 3.4
*/
private WorkingSetDescriptor getSelectedWorkingSet() {
return (WorkingSetDescriptor) typesListViewer.getStructuredSelection().getFirstElement();
}
- /**
- * Called when a working set type is double clicked.
- */
- private void handleDoubleClick() {
- handleSelectionChanged();
- getContainer().showPage(getNextPage());
- }
-
- /**
- * Called when the selection has changed.
- */
- private void handleSelectionChanged() {
+ /**
+ * Called when a working set type is double clicked.
+ */
+ private void handleDoubleClick() {
+ handleSelectionChanged();
+ getContainer().showPage(getNextPage());
+ }
+
+ /**
+ * Called when the selection has changed.
+ */
+ private void handleSelectionChanged() {
IStructuredSelection selection = typesListViewer.getStructuredSelection();
- boolean hasSelection = selection != null
- && selection.isEmpty() == false;
+ boolean hasSelection = selection != null && selection.isEmpty() == false;
- WorkingSetDescriptor descriptor = getSelectedWorkingSet();
+ WorkingSetDescriptor descriptor = getSelectedWorkingSet();
setDescription(descriptor == null ? "" : descriptor.getDescription()); //$NON-NLS-1$
- setPageComplete(hasSelection);
- }
+ setPageComplete(hasSelection);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/CategoryCheckProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/CategoryCheckProvider.java
index 44bf88a4890..8637806818c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/CategoryCheckProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/CategoryCheckProvider.java
@@ -22,9 +22,8 @@ import org.eclipse.ui.internal.dialogs.cpd.TreeManager.TreeItem;
/**
* Provides the check logic for the categories viewer in the shortcuts tab.
* Categories have a dual concept of children - their proper children
- * (sub-Categories, as in the wizards), and the actual elements they
- * contribute to the menu system. The check state must take this into
- * account.
+ * (sub-Categories, as in the wizards), and the actual elements they contribute
+ * to the menu system. The check state must take this into account.
*
* @since 3.5
*/
@@ -33,8 +32,7 @@ class CategoryCheckProvider implements ICheckStateProvider {
public boolean isChecked(Object element) {
Category category = (Category) element;
- if (category.getChildren().isEmpty()
- && category.getContributionItems().isEmpty()) {
+ if (category.getChildren().isEmpty() && category.getContributionItems().isEmpty()) {
return false;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/CustomizeActionBars.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/CustomizeActionBars.java
index fda1989e91d..8606e71aad4 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/CustomizeActionBars.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/CustomizeActionBars.java
@@ -65,10 +65,8 @@ public class CustomizeActionBars implements IActionBarConfigurer2, IActionBars2
/**
* Create a new instance of this class.
*
- * @param configurer
- * non null
- * @param context
- * non null
+ * @param configurer non null
+ * @param context non null
*/
public CustomizeActionBars(IWorkbenchWindowConfigurer configurer, IEclipseContext context) {
this.configurer = configurer;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/CustomizePerspectiveDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/CustomizePerspectiveDialog.java
index 9e3d659513c..d707a5cd056 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/CustomizePerspectiveDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/CustomizePerspectiveDialog.java
@@ -172,8 +172,7 @@ public class CustomizePerspectiveDialog extends TrayDialog {
private static final int TAB_HEIGHT_IN_DLUS = 230;
- private final String shortcutMenuColumnHeaders[] = {
- WorkbenchMessages.ActionSetSelection_menuColumnHeader,
+ private final String shortcutMenuColumnHeaders[] = { WorkbenchMessages.ActionSetSelection_menuColumnHeader,
WorkbenchMessages.ActionSetSelection_descriptionColumnHeader };
private int[] shortcutMenuColumnWidths = { 125, 300 };
@@ -243,8 +242,7 @@ public class CustomizePerspectiveDialog extends TrayDialog {
ActionSet actionSet;
public DisplayItem(String label, IContributionItem item) {
- treeManager.super(label == null ? null : DialogUtil
- .removeAccel(removeShortcut(label)));
+ treeManager.super(label == null ? null : DialogUtil.removeAccel(removeShortcut(label)));
this.item = item;
}
@@ -297,8 +295,7 @@ public class CustomizePerspectiveDialog extends TrayDialog {
* @param window
* @return the appropriate {@link IContributionItem} for the given wizard
*/
- private static ActionContributionItem getIContributionItem(
- IWizardDescriptor descriptor, IWorkbenchWindow window) {
+ private static ActionContributionItem getIContributionItem(IWizardDescriptor descriptor, IWorkbenchWindow window) {
IAction action = new NewWizardShortcutAction(window, descriptor);
return new ActionContributionItem(action);
}
@@ -306,11 +303,10 @@ public class CustomizePerspectiveDialog extends TrayDialog {
/**
* @param descriptor
* @param window
- * @return the appropriate {@link IContributionItem} for the given
- * perspective
+ * @return the appropriate {@link IContributionItem} for the given perspective
*/
- private static ActionContributionItem getIContributionItem(
- IPerspectiveDescriptor descriptor, IWorkbenchWindow window) {
+ private static ActionContributionItem getIContributionItem(IPerspectiveDescriptor descriptor,
+ IWorkbenchWindow window) {
IAction action = new OpenPerspectiveAction(window, descriptor, null);
return new ActionContributionItem(action);
}
@@ -319,8 +315,7 @@ public class CustomizePerspectiveDialog extends TrayDialog {
* @param window
* @return the appropriate {@link IContributionItem} for showing views
*/
- private static ActionContributionItem getIContributionItem(
- IWorkbenchWindow window) {
+ private static ActionContributionItem getIContributionItem(IWorkbenchWindow window) {
IAction action = ActionFactory.SHOW_VIEW_MENU.create(window);
return new ActionContributionItem(action);
}
@@ -340,20 +335,17 @@ public class CustomizePerspectiveDialog extends TrayDialog {
private Object descriptor;
public ShortcutItem(String label, IWizardDescriptor descriptor) {
- super(label, CustomizePerspectiveDialog.getIContributionItem(
- descriptor, window));
+ super(label, CustomizePerspectiveDialog.getIContributionItem(descriptor, window));
this.descriptor = descriptor;
}
public ShortcutItem(String label, IPerspectiveDescriptor descriptor) {
- super(label, CustomizePerspectiveDialog.getIContributionItem(
- descriptor, window));
+ super(label, CustomizePerspectiveDialog.getIContributionItem(descriptor, window));
this.descriptor = descriptor;
}
public ShortcutItem(String label, IViewDescriptor descriptor) {
- super(label, CustomizePerspectiveDialog
- .getIContributionItem(window));
+ super(label, CustomizePerspectiveDialog.getIContributionItem(window));
this.descriptor = descriptor;
}
@@ -380,9 +372,9 @@ public class CustomizePerspectiveDialog extends TrayDialog {
/**
* Represents a category in the shortcuts menu. Since categories can have a
- * tree-structure, the functionality provided by the TreeManager and
- * TreeItem classes is used, however the logic for visibility changes and
- * gray states is more sophisticated.
+ * tree-structure, the functionality provided by the TreeManager and TreeItem
+ * classes is used, however the logic for visibility changes and gray states is
+ * more sophisticated.
*
* @since 3.5
*/
@@ -392,8 +384,7 @@ public class CustomizePerspectiveDialog extends TrayDialog {
private List<ShortcutItem> contributionItems;
public Category(String label) {
- treeManager.super(label == null ? null : DialogUtil
- .removeAccel(removeShortcut(label)));
+ treeManager.super(label == null ? null : DialogUtil.removeAccel(removeShortcut(label)));
this.contributionItems = new ArrayList<>();
}
@@ -402,11 +393,10 @@ public class CustomizePerspectiveDialog extends TrayDialog {
}
/**
- * Adds another ShortcutItem to this Category's list of ShortcutItems
- * and creates a pseudo-child/parent relationship.
+ * Adds another ShortcutItem to this Category's list of ShortcutItems and
+ * creates a pseudo-child/parent relationship.
*
- * @param item
- * the item to add
+ * @param item the item to add
*/
public void addShortcutItem(ShortcutItem item) {
contributionItems.add(item);
@@ -414,10 +404,10 @@ public class CustomizePerspectiveDialog extends TrayDialog {
}
/**
- * While the child/parent state in the Category hierarchy is
- * automatically maintained, the pseudo-child/parent relationship must
- * be explicitly updated. This method will update Categories if their
- * states need to change as a result of their ShortcutItems.
+ * While the child/parent state in the Category hierarchy is automatically
+ * maintained, the pseudo-child/parent relationship must be explicitly updated.
+ * This method will update Categories if their states need to change as a result
+ * of their ShortcutItems.
*/
public void update() {
for (ShortcutItem shortcutItem : contributionItems) {
@@ -435,8 +425,7 @@ public class CustomizePerspectiveDialog extends TrayDialog {
* Changes the state of all pseudo-descendant ShortcutItems, causing the
* effective state of this Category and all its sub-Categories to match.
*
- * @param state
- * The state to set this branch to.
+ * @param state The state to set this branch to.
*/
public void setItemsState(boolean state) {
for (ShortcutItem shortcutItem : contributionItems) {
@@ -451,9 +440,9 @@ public class CustomizePerspectiveDialog extends TrayDialog {
}
/**
- * Represents an action set, under which ContributionItems exist. There is
- * no inherent hierarchy in action sets - they exist independent of one
- * another, simply contribution menu items and tool bar items.
+ * Represents an action set, under which ContributionItems exist. There is no
+ * inherent hierarchy in action sets - they exist independent of one another,
+ * simply contribution menu items and tool bar items.
*
* @since 3.5
*/
@@ -510,12 +499,9 @@ public class CustomizePerspectiveDialog extends TrayDialog {
/**
* Create an instance of this Dialog.
*
- * @param configurer
- * the configurer
- * @param persp
- * the perspective
- * @param context
- * The runtime context for this window
+ * @param configurer the configurer
+ * @param persp the perspective
+ * @param context The runtime context for this window
*/
public CustomizePerspectiveDialog(IWorkbenchWindowConfigurer configurer, Perspective persp,
IEclipseContext context) {
@@ -543,8 +529,7 @@ public class CustomizePerspectiveDialog extends TrayDialog {
title = NLS.bind(WorkbenchMessages.ActionSetSelection_customize, title);
shell.setText(title);
- window.getWorkbench().getHelpSystem().setHelp(shell,
- IWorkbenchHelpContextIds.ACTION_SET_SELECTION_DIALOG);
+ window.getWorkbench().getHelpSystem().setHelp(shell, IWorkbenchHelpContextIds.ACTION_SET_SELECTION_DIALOG);
}
@Override
@@ -581,8 +566,7 @@ public class CustomizePerspectiveDialog extends TrayDialog {
// Action Set Availability Page
actionSetTab = new TabItem(tabFolder, SWT.NONE);
- actionSetTab
- .setText(WorkbenchMessages.ActionSetSelection_actionSetsTab);
+ actionSetTab.setText(WorkbenchMessages.ActionSetSelection_actionSetsTab);
actionSetTab.setControl(createActionSetAvailabilityPage(tabFolder));
// Shortcuts Page
@@ -606,9 +590,7 @@ public class CustomizePerspectiveDialog extends TrayDialog {
// Select... label
Label label = new Label(menusComposite, SWT.WRAP);
- label.setText(NLS.bind(
- WorkbenchMessages.Shortcuts_selectShortcutsLabel, perspective
- .getDesc().getLabel()));
+ label.setText(NLS.bind(WorkbenchMessages.Shortcuts_selectShortcutsLabel, perspective.getDesc().getLabel()));
data = new GridData(SWT.FILL, SWT.CENTER, true, false);
label.setLayoutData(data);
@@ -632,8 +614,7 @@ public class CustomizePerspectiveDialog extends TrayDialog {
label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
Combo menusCombo = new Combo(menusGroup, SWT.READ_ONLY);
- menusCombo
- .setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ menusCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
ComboViewer menusViewer = new ComboViewer(menusCombo);
menusViewer.setContentProvider(TreeManager.getTreeContentProvider());
menusViewer.setLabelProvider(TreeManager.getLabelProvider());
@@ -643,13 +624,10 @@ public class CustomizePerspectiveDialog extends TrayDialog {
label.setText(WorkbenchMessages.Shortcuts_availableCategories);
label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- final CheckboxTreeViewer menuCategoriesViewer = new CheckboxTreeViewer(
- menusGroup);
- menuCategoriesViewer.getControl().setLayoutData(
- new GridData(SWT.FILL, SWT.FILL, true, true));
+ final CheckboxTreeViewer menuCategoriesViewer = new CheckboxTreeViewer(menusGroup);
+ menuCategoriesViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
menuCategoriesViewer.setLabelProvider(TreeManager.getLabelProvider());
- menuCategoriesViewer.setContentProvider(TreeManager
- .getTreeContentProvider());
+ menuCategoriesViewer.setContentProvider(TreeManager.getTreeContentProvider());
menuCategoriesViewer.setComparator(new WorkbenchViewerComparator());
menuCategoriesViewer.setCheckStateProvider(new CategoryCheckProvider());
menuCategoriesViewer.addCheckStateListener(event -> {
@@ -665,8 +643,7 @@ public class CustomizePerspectiveDialog extends TrayDialog {
ShortcutItem item = (ShortcutItem) changedItem;
if (item.getCategory() != null) {
item.getCategory().update();
- updateCategoryAndParents(menuCategoriesViewer, item
- .getCategory());
+ updateCategoryAndParents(menuCategoriesViewer, item.getCategory());
}
}
});
@@ -677,57 +654,48 @@ public class CustomizePerspectiveDialog extends TrayDialog {
layout.marginHeight = 0;
layout.marginWidth = 0;
menuItemsGroup.setLayout(layout);
- menuItemsGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true,
- true));
+ menuItemsGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
label = new Label(menuItemsGroup, SWT.WRAP);
label.setText(WorkbenchMessages.Shortcuts_allShortcuts);
label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- final CheckboxTableViewer menuItemsViewer = CheckboxTableViewer
- .newCheckList(menuItemsGroup, SWT.BORDER | SWT.H_SCROLL
- | SWT.V_SCROLL);
+ final CheckboxTableViewer menuItemsViewer = CheckboxTableViewer.newCheckList(menuItemsGroup,
+ SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
Table menuTable = menuItemsViewer.getTable();
menuTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
menuItemsViewer.setLabelProvider(new ShortcutLabelProvider());
- menuItemsViewer.setCheckStateProvider(TreeManager
- .getCheckStateProvider());
- menuItemsViewer.addCheckStateListener(treeManager
- .getViewerCheckStateListener());
+ menuItemsViewer.setCheckStateProvider(TreeManager.getCheckStateProvider());
+ menuItemsViewer.addCheckStateListener(treeManager.getViewerCheckStateListener());
treeManager.getCheckListener(menuItemsViewer);
- menuItemsViewer
- .setContentProvider(new TreeManager.TreeItemContentProvider() {
- @Override
- public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof Category) {
- return ((Category) parentElement)
- .getContributionItems().toArray();
- }
- return super.getChildren(parentElement);
- }
- });
+ menuItemsViewer.setContentProvider(new TreeManager.TreeItemContentProvider() {
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof Category) {
+ return ((Category) parentElement).getContributionItems().toArray();
+ }
+ return super.getChildren(parentElement);
+ }
+ });
menuItemsViewer.setComparator(new WorkbenchViewerComparator());
// update menuCategoriesViewer, and menuItemsViewer on a change to
// menusViewer
- menusViewer
- .addSelectionChangedListener(event -> {
- Category category = (Category) event.getStructuredSelection().getFirstElement();
- menuCategoriesViewer.setInput(category);
- menuItemsViewer.setInput(category);
- if (category.getChildrenCount() != 0) {
- setSelectionOn(menuCategoriesViewer, category
- .getChildren().get(0));
- }
- });
+ menusViewer.addSelectionChangedListener(event -> {
+ Category category = (Category) event.getStructuredSelection().getFirstElement();
+ menuCategoriesViewer.setInput(category);
+ menuItemsViewer.setInput(category);
+ if (category.getChildrenCount() != 0) {
+ setSelectionOn(menuCategoriesViewer, category.getChildren().get(0));
+ }
+ });
// update menuItemsViewer on a change to menuCategoriesViewer
- menuCategoriesViewer
- .addSelectionChangedListener(event -> {
- Category category = (Category) event.getStructuredSelection().getFirstElement();
- menuItemsViewer.setInput(category);
- });
+ menuCategoriesViewer.addSelectionChangedListener(event -> {
+ Category category = (Category) event.getStructuredSelection().getFirstElement();
+ menuItemsViewer.setInput(category);
+ });
menuTable.setHeaderVisible(true);
int[] columnWidths = new int[shortcutMenuColumnWidths.length];
@@ -760,18 +728,15 @@ public class CustomizePerspectiveDialog extends TrayDialog {
// Select... label
Label label = new Label(actionSetsComposite, SWT.WRAP);
- label.setText(NLS.bind(
- WorkbenchMessages.ActionSetSelection_selectActionSetsLabel,
- perspective.getDesc().getLabel()));
+ label.setText(
+ NLS.bind(WorkbenchMessages.ActionSetSelection_selectActionSetsLabel, perspective.getDesc().getLabel()));
data = new GridData(SWT.FILL, SWT.CENTER, true, false);
label.setLayoutData(data);
- Label sep = new Label(actionSetsComposite, SWT.HORIZONTAL
- | SWT.SEPARATOR);
+ Label sep = new Label(actionSetsComposite, SWT.HORIZONTAL | SWT.SEPARATOR);
sep.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- SashForm sashComposite = new SashForm(actionSetsComposite,
- SWT.HORIZONTAL);
+ SashForm sashComposite = new SashForm(actionSetsComposite, SWT.HORIZONTAL);
data = new GridData(SWT.FILL, SWT.FILL, true, true);
sashComposite.setLayoutData(data);
@@ -781,19 +746,16 @@ public class CustomizePerspectiveDialog extends TrayDialog {
layout.marginHeight = 0;
layout.marginWidth = 0;
actionSetGroup.setLayout(layout);
- actionSetGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true,
- true));
+ actionSetGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
label = new Label(actionSetGroup, SWT.WRAP);
label.setText(WorkbenchMessages.ActionSetSelection_availableActionSets);
label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- final CheckboxTableViewer actionSetsViewer = CheckboxTableViewer
- .newCheckList(actionSetGroup, SWT.BORDER | SWT.H_SCROLL
- | SWT.V_SCROLL);
+ final CheckboxTableViewer actionSetsViewer = CheckboxTableViewer.newCheckList(actionSetGroup,
+ SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
actionSetAvailabilityTable = actionSetsViewer;
- actionSetsViewer.getTable().setLayoutData(
- new GridData(SWT.FILL, SWT.FILL, true, true));
+ actionSetsViewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
actionSetsViewer.setContentProvider(new ArrayContentProvider());
actionSetsViewer.setComparator(new WorkbenchViewerComparator());
actionSetsViewer.setCheckStateProvider(new ICheckStateProvider() {
@@ -817,13 +779,11 @@ public class CustomizePerspectiveDialog extends TrayDialog {
// Filter to show only branches necessary for the selected action set.
final ViewerFilter setFilter = new ViewerFilter() {
@Override
- public boolean select(Viewer viewer, Object parentElement,
- Object element) {
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
if (selectedActionSet[0] == null) {
return false;
}
- return includeInSetStructure((DisplayItem) element,
- selectedActionSet[0]);
+ return includeInSetStructure((DisplayItem) element, selectedActionSet[0]);
}
};
@@ -856,8 +816,7 @@ public class CustomizePerspectiveDialog extends TrayDialog {
layout.marginHeight = 0;
layout.marginWidth = 0;
menubarGroup.setLayout(layout);
- menubarGroup
- .setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ menubarGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
label = new Label(menubarGroup, SWT.WRAP);
label.setText(WorkbenchMessages.ActionSetSelection_menubarActions);
@@ -865,11 +824,9 @@ public class CustomizePerspectiveDialog extends TrayDialog {
actionSetMenuViewer = new TreeViewer(menubarGroup);
actionSetMenuViewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);
- actionSetMenuViewer.getControl().setLayoutData(
- new GridData(SWT.FILL, SWT.FILL, true, true));
+ actionSetMenuViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
actionSetMenuViewer.setUseHashlookup(true);
- actionSetMenuViewer.setContentProvider(TreeManager
- .getTreeContentProvider());
+ actionSetMenuViewer.setContentProvider(TreeManager.getTreeContentProvider());
actionSetMenuViewer.setLabelProvider(new GrayOutUnavailableLabelProvider(null));
actionSetMenuViewer.addFilter(setFilter);
actionSetMenuViewer.setInput(menuItems);
@@ -882,20 +839,16 @@ public class CustomizePerspectiveDialog extends TrayDialog {
layout.marginHeight = 0;
layout.marginWidth = 0;
toolbarGroup.setLayout(layout);
- toolbarGroup
- .setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ toolbarGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
label = new Label(toolbarGroup, SWT.WRAP);
label.setText(WorkbenchMessages.ActionSetSelection_toolbarActions);
label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
actionSetToolbarViewer = new TreeViewer(toolbarGroup);
- actionSetToolbarViewer
- .setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);
- actionSetToolbarViewer.getControl().setLayoutData(
- new GridData(SWT.FILL, SWT.FILL, true, true));
- actionSetToolbarViewer.setContentProvider(TreeManager
- .getTreeContentProvider());
+ actionSetToolbarViewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);
+ actionSetToolbarViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ actionSetToolbarViewer.setContentProvider(TreeManager.getTreeContentProvider());
actionSetToolbarViewer.setLabelProvider(new GrayOutUnavailableLabelProvider(null));
actionSetToolbarViewer.addFilter(setFilter);
actionSetToolbarViewer.setInput(toolBarItems);
@@ -905,12 +858,11 @@ public class CustomizePerspectiveDialog extends TrayDialog {
// Updates the menu item and toolbar items tree viewers when the
// selection changes
- actionSetsViewer
- .addSelectionChangedListener(event -> {
- selectedActionSet[0] = (ActionSet) event.getStructuredSelection().getFirstElement();
- actionSetMenuViewer.setInput(menuItems);
- actionSetToolbarViewer.setInput(toolBarItems);
- });
+ actionSetsViewer.addSelectionChangedListener(event -> {
+ selectedActionSet[0] = (ActionSet) event.getStructuredSelection().getFirstElement();
+ actionSetMenuViewer.setInput(menuItems);
+ actionSetToolbarViewer.setInput(toolBarItems);
+ });
sashComposite.setWeights(new int[] { 30, 70 });
@@ -933,8 +885,7 @@ public class CustomizePerspectiveDialog extends TrayDialog {
data = new GridData(SWT.FILL, SWT.CENTER, true, false);
label.setLayoutData(data);
- Label sep = new Label(hideMenuItemsComposite, SWT.HORIZONTAL
- | SWT.SEPARATOR);
+ Label sep = new Label(hideMenuItemsComposite, SWT.HORIZONTAL | SWT.SEPARATOR);
sep.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
// Main contents of tab
@@ -943,18 +894,15 @@ public class CustomizePerspectiveDialog extends TrayDialog {
book.setLayoutData(data);
// Simple view: just the menu structure
- final Composite simpleComposite = createItemStructureGroup(book,
- WorkbenchMessages.HideMenuItems_menuStructure);
- menuStructureViewer1 = initStructureViewer(simpleComposite,
- new TreeManager.ViewerCheckStateListener(), null);
+ final Composite simpleComposite = createItemStructureGroup(book, WorkbenchMessages.HideMenuItems_menuStructure);
+ menuStructureViewer1 = initStructureViewer(simpleComposite, new TreeManager.ViewerCheckStateListener(), null);
// Update the viewer when the model changes
treeManager.getCheckListener(menuStructureViewer1); // To update ctv on
// model changes
// Simply grab the checkstate out of the model
- menuStructureViewer1.setCheckStateProvider(TreeManager
- .getCheckStateProvider());
+ menuStructureViewer1.setCheckStateProvider(TreeManager.getCheckStateProvider());
// Init with input
menuStructureViewer1.setInput(menuItems);
@@ -976,31 +924,25 @@ public class CustomizePerspectiveDialog extends TrayDialog {
// Filter to only show items in the current action set
final ActionSetFilter menuStructureFilterByActionSet = new ActionSetFilter();
- final Composite menuStructureComposite = createItemStructureGroup(
- advancedComposite,
+ final Composite menuStructureComposite = createItemStructureGroup(advancedComposite,
WorkbenchMessages.HideMenuItems_menuStructure);
final ICheckStateListener menuStructureFilter = new FilteredViewerCheckListener(
- TreeManager.getTreeContentProvider(),
+ TreeManager.getTreeContentProvider(), menuStructureFilterByActionSet);
+ menuStructureViewer2 = initStructureViewer(menuStructureComposite, menuStructureFilter,
menuStructureFilterByActionSet);
- menuStructureViewer2 = initStructureViewer(menuStructureComposite,
- menuStructureFilter, menuStructureFilterByActionSet);
- treeManager.addListener(new FilteredModelCheckListener(
- menuStructureFilterByActionSet, menuStructureViewer2));
+ treeManager.addListener(new FilteredModelCheckListener(menuStructureFilterByActionSet, menuStructureViewer2));
menuStructureViewer2.addFilter(menuStructureFilterByActionSet);
// Update filter when a new action set is selected
- actionSetViewer
- .addSelectionChangedListener(new ActionSetSelectionChangedListener(
- menuStructureViewer2, menuStructureFilterByActionSet));
+ actionSetViewer.addSelectionChangedListener(
+ new ActionSetSelectionChangedListener(menuStructureViewer2, menuStructureFilterByActionSet));
// Check state provider to emulate standard SWT
// behaviour on visual tree
- menuStructureViewer2
- .setCheckStateProvider(new FilteredTreeCheckProvider(
- TreeManager.getTreeContentProvider(),
- menuStructureFilterByActionSet));
+ menuStructureViewer2.setCheckStateProvider(
+ new FilteredTreeCheckProvider(TreeManager.getTreeContentProvider(), menuStructureFilterByActionSet));
// Init input
menuStructureViewer2.setInput(menuItems);
@@ -1020,43 +962,37 @@ public class CustomizePerspectiveDialog extends TrayDialog {
changedItem.setCheckState(false);
});
- final Button showCommandGroupFilterButton = new Button(
- hideMenuItemsComposite, SWT.CHECK);
- showCommandGroupFilterButton
- .setText(WorkbenchMessages.HideItems_turnOnActionSets);
- showCommandGroupFilterButton
- .addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (showCommandGroupFilterButton.getSelection()) {
- Object o = ((StructuredSelection) menuStructureViewer1
- .getSelection()).getFirstElement();
- ActionSet initSelectAS = null;
- DisplayItem initSelectCI = null;
- if (o instanceof DisplayItem) {
- initSelectCI = ((DisplayItem) o);
- initSelectAS = initSelectCI.getActionSet();
- }
- if (initSelectAS == null) {
- initSelectAS = (ActionSet) actionSetViewer
- .getElementAt(0);
- }
- if (initSelectAS != null) {
- setSelectionOn(actionSetViewer, initSelectAS);
- actionSetViewer.reveal(initSelectAS);
- }
- if (initSelectCI != null) {
- setSelectionOn(menuStructureViewer2,
- initSelectCI);
- menuStructureViewer2.reveal(initSelectCI);
- }
- book.showPage(advancedComposite);
- } else {
- book.showPage(simpleComposite);
- }
+ final Button showCommandGroupFilterButton = new Button(hideMenuItemsComposite, SWT.CHECK);
+ showCommandGroupFilterButton.setText(WorkbenchMessages.HideItems_turnOnActionSets);
+ showCommandGroupFilterButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (showCommandGroupFilterButton.getSelection()) {
+ Object o = ((StructuredSelection) menuStructureViewer1.getSelection()).getFirstElement();
+ ActionSet initSelectAS = null;
+ DisplayItem initSelectCI = null;
+ if (o instanceof DisplayItem) {
+ initSelectCI = ((DisplayItem) o);
+ initSelectAS = initSelectCI.getActionSet();
+ }
+ if (initSelectAS == null) {
+ initSelectAS = (ActionSet) actionSetViewer.getElementAt(0);
}
- });
+ if (initSelectAS != null) {
+ setSelectionOn(actionSetViewer, initSelectAS);
+ actionSetViewer.reveal(initSelectAS);
+ }
+ if (initSelectCI != null) {
+ setSelectionOn(menuStructureViewer2, initSelectCI);
+ menuStructureViewer2.reveal(initSelectCI);
+ }
+ book.showPage(advancedComposite);
+ } else {
+ book.showPage(simpleComposite);
+ }
+ }
+ });
book.showPage(simpleComposite);
advancedComposite.setWeights(new int[] { 30, 70 });
@@ -1076,13 +1012,11 @@ public class CustomizePerspectiveDialog extends TrayDialog {
// Label for entire tab
Label label = new Label(hideToolbarItemsComposite, SWT.WRAP);
- label
- .setText(WorkbenchMessages.HideToolBarItems_chooseToolBarItemsLabel);
+ label.setText(WorkbenchMessages.HideToolBarItems_chooseToolBarItemsLabel);
data = new GridData(SWT.FILL, SWT.CENTER, true, false);
label.setLayoutData(data);
- Label sep = new Label(hideToolbarItemsComposite, SWT.HORIZONTAL
- | SWT.SEPARATOR);
+ Label sep = new Label(hideToolbarItemsComposite, SWT.HORIZONTAL | SWT.SEPARATOR);
sep.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
// Main contents of tab
@@ -1093,8 +1027,8 @@ public class CustomizePerspectiveDialog extends TrayDialog {
// Simple view: just the toolbar structure
final Composite simpleComposite = createItemStructureGroup(book,
WorkbenchMessages.HideToolBarItems_toolBarStructure);
- toolbarStructureViewer1 = initStructureViewer(simpleComposite,
- new TreeManager.ViewerCheckStateListener(), null);
+ toolbarStructureViewer1 = initStructureViewer(simpleComposite, new TreeManager.ViewerCheckStateListener(),
+ null);
// Update the viewer when the model changes
treeManager.getCheckListener(toolbarStructureViewer1); // To update ctv
@@ -1102,8 +1036,7 @@ public class CustomizePerspectiveDialog extends TrayDialog {
// changes
// Simply grab the check state out of the model
- toolbarStructureViewer1.setCheckStateProvider(TreeManager
- .getCheckStateProvider());
+ toolbarStructureViewer1.setCheckStateProvider(TreeManager.getCheckStateProvider());
// Init with input
toolbarStructureViewer1.setInput(toolBarItems);
@@ -1125,33 +1058,26 @@ public class CustomizePerspectiveDialog extends TrayDialog {
// Filter to only show items in the current action set
final ActionSetFilter toolbarStructureFilterByActionSet = new ActionSetFilter();
- final Composite toolbarStructureComposite = createItemStructureGroup(
- advancedComposite,
+ final Composite toolbarStructureComposite = createItemStructureGroup(advancedComposite,
WorkbenchMessages.HideToolBarItems_toolBarStructure);
final ICheckStateListener toolbarStructureFilter = new FilteredViewerCheckListener(
- TreeManager.getTreeContentProvider(),
- toolbarStructureFilterByActionSet);
- toolbarStructureViewer2 = initStructureViewer(
- toolbarStructureComposite, toolbarStructureFilter,
+ TreeManager.getTreeContentProvider(), toolbarStructureFilterByActionSet);
+ toolbarStructureViewer2 = initStructureViewer(toolbarStructureComposite, toolbarStructureFilter,
toolbarStructureFilterByActionSet);
toolbarStructureViewer2.addFilter(toolbarStructureFilterByActionSet);
- treeManager.addListener(new FilteredModelCheckListener(
- toolbarStructureFilterByActionSet, toolbarStructureViewer2));
+ treeManager.addListener(
+ new FilteredModelCheckListener(toolbarStructureFilterByActionSet, toolbarStructureViewer2));
// Update filter when a new action set is selected
- actionSetViewer
- .addSelectionChangedListener(new ActionSetSelectionChangedListener(
- toolbarStructureViewer2,
- toolbarStructureFilterByActionSet));
+ actionSetViewer.addSelectionChangedListener(
+ new ActionSetSelectionChangedListener(toolbarStructureViewer2, toolbarStructureFilterByActionSet));
// Check state provider to emulate standard SWT
// behaviour on visual tree
- toolbarStructureViewer2
- .setCheckStateProvider(new FilteredTreeCheckProvider(
- TreeManager.getTreeContentProvider(),
- toolbarStructureFilterByActionSet));
+ toolbarStructureViewer2.setCheckStateProvider(
+ new FilteredTreeCheckProvider(TreeManager.getTreeContentProvider(), toolbarStructureFilterByActionSet));
// Init input
toolbarStructureViewer2.setInput(toolBarItems);
@@ -1171,43 +1097,37 @@ public class CustomizePerspectiveDialog extends TrayDialog {
changedItem.setCheckState(false);
});
- final Button showCommandGroupFilterButton = new Button(
- hideToolbarItemsComposite, SWT.CHECK);
- showCommandGroupFilterButton
- .setText(WorkbenchMessages.HideItems_turnOnActionSets);
- showCommandGroupFilterButton
- .addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (showCommandGroupFilterButton.getSelection()) {
- Object o = ((StructuredSelection) toolbarStructureViewer1
- .getSelection()).getFirstElement();
- ActionSet initSelectAS = null;
- DisplayItem initSelectCI = null;
- if (o instanceof DisplayItem) {
- initSelectCI = ((DisplayItem) o);
- initSelectAS = initSelectCI.getActionSet();
- }
- if (initSelectAS == null) {
- initSelectAS = (ActionSet) actionSetViewer
- .getElementAt(0);
- }
- if (initSelectAS != null) {
- setSelectionOn(actionSetViewer, initSelectAS);
- actionSetViewer.reveal(initSelectAS);
- }
- if (initSelectCI != null) {
- setSelectionOn(toolbarStructureViewer2,
- initSelectCI);
- toolbarStructureViewer2.reveal(initSelectCI);
- }
- book.showPage(advancedComposite);
- } else {
- book.showPage(simpleComposite);
- }
+ final Button showCommandGroupFilterButton = new Button(hideToolbarItemsComposite, SWT.CHECK);
+ showCommandGroupFilterButton.setText(WorkbenchMessages.HideItems_turnOnActionSets);
+ showCommandGroupFilterButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (showCommandGroupFilterButton.getSelection()) {
+ Object o = ((StructuredSelection) toolbarStructureViewer1.getSelection()).getFirstElement();
+ ActionSet initSelectAS = null;
+ DisplayItem initSelectCI = null;
+ if (o instanceof DisplayItem) {
+ initSelectCI = ((DisplayItem) o);
+ initSelectAS = initSelectCI.getActionSet();
}
- });
+ if (initSelectAS == null) {
+ initSelectAS = (ActionSet) actionSetViewer.getElementAt(0);
+ }
+ if (initSelectAS != null) {
+ setSelectionOn(actionSetViewer, initSelectAS);
+ actionSetViewer.reveal(initSelectAS);
+ }
+ if (initSelectCI != null) {
+ setSelectionOn(toolbarStructureViewer2, initSelectCI);
+ toolbarStructureViewer2.reveal(initSelectCI);
+ }
+ book.showPage(advancedComposite);
+ } else {
+ book.showPage(simpleComposite);
+ }
+ }
+ });
book.showPage(simpleComposite);
advancedComposite.setWeights(new int[] { 30, 70 });
@@ -1223,10 +1143,8 @@ public class CustomizePerspectiveDialog extends TrayDialog {
*/
private static TableViewer initActionSetViewer(Composite parent) {
// List of categories
- final TableViewer actionSetViewer = new TableViewer(parent, SWT.BORDER
- | SWT.H_SCROLL | SWT.V_SCROLL);
- actionSetViewer.getTable().setLayoutData(
- new GridData(GridData.FILL_BOTH));
+ final TableViewer actionSetViewer = new TableViewer(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
+ actionSetViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
actionSetViewer.setLabelProvider(new GrayOutUnavailableLabelProvider(null));
actionSetViewer.setComparator(new WorkbenchViewerComparator());
actionSetViewer.setContentProvider(new ArrayContentProvider());
@@ -1241,37 +1159,32 @@ public class CustomizePerspectiveDialog extends TrayDialog {
* Creates a CheckboxTreeViewer to display menu or toolbar structure.
*
* @param parent
- * @param checkStateListener
- * the listener which listens to the viewer for check changes
- * @param filter
- * the filter used in the viewer (null for none)
- * @return A viewer within <code>parent</code> which will show menu or
- * toolbar structure. It comes setup, only missing a
- * CheckStateProvider and its input.
+ * @param checkStateListener the listener which listens to the viewer for check
+ * changes
+ * @param filter the filter used in the viewer (null for none)
+ * @return A viewer within <code>parent</code> which will show menu or toolbar
+ * structure. It comes setup, only missing a CheckStateProvider and its
+ * input.
*/
- private CheckboxTreeViewer initStructureViewer(Composite parent,
- ICheckStateListener checkStateListener, ViewerFilter filter) {
- CheckboxTreeViewer ctv = new CheckboxTreeViewer(parent, SWT.BORDER
- | SWT.H_SCROLL | SWT.V_SCROLL);
+ private CheckboxTreeViewer initStructureViewer(Composite parent, ICheckStateListener checkStateListener,
+ ViewerFilter filter) {
+ CheckboxTreeViewer ctv = new CheckboxTreeViewer(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
ctv.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
ctv.setUseHashlookup(true);
ctv.setContentProvider(TreeManager.getTreeContentProvider());
// use an UnavailableContributionItemCheckListener to filter check
// events: if it is legal, forward it to the actual checkStateListener,
// if not, inform the user
- ctv.addCheckStateListener(new UnavailableContributionItemCheckListener(
- this, ctv, checkStateListener));
+ ctv.addCheckStateListener(new UnavailableContributionItemCheckListener(this, ctv, checkStateListener));
ctv.setLabelProvider(new GrayOutUnavailableLabelProvider(filter));
new ItemDetailToolTip(this, ctv, ctv.getTree(), true, true, filter);
return ctv;
}
/**
- * Creates a composite to put a tree viewer in to display menu or toolbar
- * items.
+ * Creates a composite to put a tree viewer in to display menu or toolbar items.
*/
- private static Composite createItemStructureGroup(
- final Composite composite, String labelText) {
+ private static Composite createItemStructureGroup(final Composite composite, String labelText) {
GridLayout layout;
Label label;
layout = new GridLayout();
@@ -1279,8 +1192,7 @@ public class CustomizePerspectiveDialog extends TrayDialog {
layout.marginHeight = 0;
layout.marginWidth = 0;
menubarGroup.setLayout(layout);
- menubarGroup
- .setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ menubarGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
label = new Label(menubarGroup, SWT.WRAP);
label.setText(labelText);
@@ -1300,8 +1212,7 @@ public class CustomizePerspectiveDialog extends TrayDialog {
layout.marginHeight = 0;
layout.marginWidth = 0;
actionSetGroup.setLayout(layout);
- actionSetGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true,
- true));
+ actionSetGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
label = new Label(actionSetGroup, SWT.WRAP);
label.setText(WorkbenchMessages.HideItems_commandGroupTitle);
@@ -1328,13 +1239,11 @@ public class CustomizePerspectiveDialog extends TrayDialog {
}
/**
- * Searches deeply to see if <code>item</code> is a node in a branch
- * containing a ContributionItem contributed by <code>set</code>.
+ * Searches deeply to see if <code>item</code> is a node in a branch containing
+ * a ContributionItem contributed by <code>set</code>.
*
- * @param item
- * the item in question
- * @param set
- * the action set to look for
+ * @param item the item in question
+ * @param set the action set to look for
* @return true iff <code>item</code> is required in build a tree including
* elements in <code>set</code>
*/
@@ -1353,9 +1262,9 @@ public class CustomizePerspectiveDialog extends TrayDialog {
/**
* @param item
- * @return true iff the item is available - i.e. if it belongs to an action
- * set, that that action set is available, or has a child which is
- * available thus must be displayed in order to display the child
+ * @return true iff the item is available - i.e. if it belongs to an action set,
+ * that that action set is available, or has a child which is available
+ * thus must be displayed in order to display the child
*/
static boolean isAvailable(DisplayItem item) {
if (item.getActionSet() != null && item.getChildren().isEmpty()) {
@@ -1372,9 +1281,9 @@ public class CustomizePerspectiveDialog extends TrayDialog {
/**
* @param item
- * @return true iff the item will show up in a menu or tool bar structure -
- * i.e. it is available, or has a child which is available thus must
- * be displayed in order to display the child
+ * @return true iff the item will show up in a menu or tool bar structure - i.e.
+ * it is available, or has a child which is available thus must be
+ * displayed in order to display the child
*/
static boolean isEffectivelyAvailable(DisplayItem item, ViewerFilter filter) {
if (!isAvailable(item)) {
@@ -1386,7 +1295,7 @@ public class CustomizePerspectiveDialog extends TrayDialog {
}
for (TreeItem treeItem : children) {
DisplayItem child = (DisplayItem) treeItem;
- if(filter != null && !filter.select(null, null, child)) {
+ if (filter != null && !filter.select(null, null, child)) {
continue;
}
if (isAvailable(child)) {
@@ -1395,7 +1304,7 @@ public class CustomizePerspectiveDialog extends TrayDialog {
}
for (TreeItem treeItem : children) {
DisplayItem child = (DisplayItem) treeItem;
- if(filter != null && !filter.select(null, null, child)) {
+ if (filter != null && !filter.select(null, null, child)) {
continue;
}
if (isEffectivelyAvailable(child, filter)) {
@@ -1422,11 +1331,9 @@ public class CustomizePerspectiveDialog extends TrayDialog {
private void initializeActionSetInput() {
// Just get the action sets at this point. Do not load the action set
// until it is actually selected in the dialog.
- ActionSetRegistry reg = WorkbenchPlugin.getDefault()
- .getActionSetRegistry();
+ ActionSetRegistry reg = WorkbenchPlugin.getDefault().getActionSetRegistry();
IActionSetDescriptor[] sets = reg.getActionSets();
- IActionSetDescriptor[] actionSetDescriptors = ((WorkbenchPage) window
- .getActivePage()).getActionSets();
+ IActionSetDescriptor[] actionSetDescriptors = ((WorkbenchPage) window.getActivePage()).getActionSets();
List<IActionSetDescriptor> initiallyAvailableActionSets = Arrays.asList(actionSetDescriptors);
for (IActionSetDescriptor set : sets) {
@@ -1434,8 +1341,7 @@ public class CustomizePerspectiveDialog extends TrayDialog {
if (WorkbenchActivityHelper.filterItem(actionSetDesc)) {
continue;
}
- ActionSet actionSet = new ActionSet(actionSetDesc,
- initiallyAvailableActionSets.contains(actionSetDesc));
+ ActionSet actionSet = new ActionSet(actionSetDesc, initiallyAvailableActionSets.contains(actionSetDesc));
idToActionSet.put(actionSetDesc.getId(), actionSet);
actionSets.add(actionSet);
}
@@ -1476,8 +1382,8 @@ public class CustomizePerspectiveDialog extends TrayDialog {
warningImageDescriptor = ImageDescriptor.createFromURL(url);
}
- private void initializeNewWizardsMenu(DisplayItem menu,
- Category parentCategory, IWizardCategory element, List<String> activeIds) {
+ private void initializeNewWizardsMenu(DisplayItem menu, Category parentCategory, IWizardCategory element,
+ List<String> activeIds) {
Category category = new Category(element.getLabel());
parentCategory.addChild(category);
@@ -1502,12 +1408,10 @@ public class CustomizePerspectiveDialog extends TrayDialog {
}
private void initializeNewWizardsMenu(DisplayItem menu) {
- Category rootForNewWizards = new Category(
- WorkbenchMessages.ActionSetDialogInput_wizardCategory);
+ Category rootForNewWizards = new Category(WorkbenchMessages.ActionSetDialogInput_wizardCategory);
shortcuts.addChild(rootForNewWizards);
- IWizardCategory wizardCollection = WorkbenchPlugin.getDefault()
- .getNewWizardRegistry().getRootCategory();
+ IWizardCategory wizardCollection = WorkbenchPlugin.getDefault().getNewWizardRegistry().getRootCategory();
IWizardCategory[] wizardCategories = wizardCollection.getCategories();
List<String> activeIDs = Arrays.asList(perspective.getNewWizardShortcuts());
@@ -1515,18 +1419,15 @@ public class CustomizePerspectiveDialog extends TrayDialog {
if (WorkbenchActivityHelper.filterItem(element)) {
continue;
}
- initializeNewWizardsMenu(menu, rootForNewWizards, element,
- activeIDs);
+ initializeNewWizardsMenu(menu, rootForNewWizards, element, activeIDs);
}
}
private void initializePerspectivesMenu(DisplayItem menu) {
- Category rootForPerspectives = new Category(
- WorkbenchMessages.ActionSetDialogInput_perspectiveCategory);
+ Category rootForPerspectives = new Category(WorkbenchMessages.ActionSetDialogInput_perspectiveCategory);
shortcuts.addChild(rootForPerspectives);
- IPerspectiveRegistry perspReg = WorkbenchPlugin.getDefault()
- .getPerspectiveRegistry();
+ IPerspectiveRegistry perspReg = WorkbenchPlugin.getDefault().getPerspectiveRegistry();
IPerspectiveDescriptor[] persps = perspReg.getPerspectives();
List<String> activeIds = Arrays.asList(perspective.getPerspectiveShortcuts());
@@ -1536,8 +1437,7 @@ public class CustomizePerspectiveDialog extends TrayDialog {
continue;
}
- ShortcutItem child = new ShortcutItem(perspective.getLabel(),
- perspective);
+ ShortcutItem child = new ShortcutItem(perspective.getLabel(), perspective);
child.setImageDescriptor(perspective.getImageDescriptor());
child.setDescription(perspective.getDescription());
child.setCheckState(activeIds.contains(perspective.getId()));
@@ -1548,8 +1448,7 @@ public class CustomizePerspectiveDialog extends TrayDialog {
}
private void initializeViewsMenu(DisplayItem menu) {
- Category rootForViews = new Category(
- WorkbenchMessages.ActionSetDialogInput_viewCategory);
+ Category rootForViews = new Category(WorkbenchMessages.ActionSetDialogInput_viewCategory);
shortcuts.addChild(rootForViews);
@@ -1596,18 +1495,15 @@ public class CustomizePerspectiveDialog extends TrayDialog {
customizeActionBars = new CustomizeActionBars(configurer, context);
// Fill fake action bars with static menu information.
- window.fillActionBars(customizeActionBars, ActionBarAdvisor.FILL_PROXY
- | ActionBarAdvisor.FILL_MENU_BAR
- | ActionBarAdvisor.FILL_COOL_BAR);
+ window.fillActionBars(customizeActionBars,
+ ActionBarAdvisor.FILL_PROXY | ActionBarAdvisor.FILL_MENU_BAR | ActionBarAdvisor.FILL_COOL_BAR);
- window.fill(customizeActionBars.menuRenderer,
- customizeActionBars.mainMenu, customizeActionBars.menuManager);
+ window.fill(customizeActionBars.menuRenderer, customizeActionBars.mainMenu, customizeActionBars.menuManager);
// Populate the action bars with the action sets' data
for (ActionSet actionSet : actionSets) {
ActionSetDescriptor descriptor = actionSet.descriptor;
- PluginActionSet pluginActionSet = buildMenusAndToolbarsFor(
- customizeActionBars, descriptor);
+ PluginActionSet pluginActionSet = buildMenusAndToolbarsFor(customizeActionBars, descriptor);
if (pluginActionSet != null) {
pluginActionSet.dispose();
@@ -1653,12 +1549,10 @@ public class CustomizePerspectiveDialog extends TrayDialog {
menuItems = createMenuStructure(customizeActionBars.mainMenu);
}
- private PluginActionSet buildMenusAndToolbarsFor(
- CustomizeActionBars customizeActionBars,
+ private PluginActionSet buildMenusAndToolbarsFor(CustomizeActionBars customizeActionBars,
ActionSetDescriptor actionSetDesc) {
String id = actionSetDesc.getId();
- ActionSetActionBars bars = new ActionSetActionBars(customizeActionBars,
- window, customizeActionBars, id);
+ ActionSetActionBars bars = new ActionSetActionBars(customizeActionBars, window, customizeActionBars, id);
bars.getMenuManager().setVisible(true);
PluginActionSetBuilder builder = new PluginActionSetBuilder();
PluginActionSet actionSet = null;
@@ -1666,8 +1560,7 @@ public class CustomizePerspectiveDialog extends TrayDialog {
actionSet = (PluginActionSet) actionSetDesc.createActionSet();
actionSet.init(null, bars);
} catch (CoreException ex) {
- WorkbenchPlugin.log(
- "Unable to create action set " + actionSetDesc.getId(), ex); //$NON-NLS-1$
+ WorkbenchPlugin.log("Unable to create action set " + actionSetDesc.getId(), ex); //$NON-NLS-1$
return null;
}
builder.buildMenuAndToolBarStructure(actionSet, window);
@@ -1690,13 +1583,11 @@ public class CustomizePerspectiveDialog extends TrayDialog {
/**
* Given an object, tries to find an id which will uniquely identify it.
*
- * @param object
- * an instance of {@link IContributionItem},
- * {@link IPerspectiveDescriptor}, {@link IViewDescriptor} or
- * {@link WorkbenchWizardElement}.
+ * @param object an instance of {@link IContributionItem},
+ * {@link IPerspectiveDescriptor}, {@link IViewDescriptor} or
+ * {@link WorkbenchWizardElement}.
* @return an id, can return null
- * @throws IllegalArgumentException
- * if object is not one of the listed types
+ * @throws IllegalArgumentException if object is not one of the listed types
*/
public static String getIDFromIContributionItem(Object object) {
if (object instanceof ActionContributionItem) {
@@ -1746,7 +1637,7 @@ public class CustomizePerspectiveDialog extends TrayDialog {
}
return object.getClass().getName();
}
- return null; //couldn't determine the id
+ return null; // couldn't determine the id
}
static String getParamID(DisplayItem object) {
@@ -1754,24 +1645,19 @@ public class CustomizePerspectiveDialog extends TrayDialog {
ShortcutItem shortcutItem = (ShortcutItem) object;
if (isNewWizard(shortcutItem)) {
- ActionContributionItem item = (ActionContributionItem) object
- .getIContributionItem();
- NewWizardShortcutAction nwsa = (NewWizardShortcutAction) item
- .getAction();
+ ActionContributionItem item = (ActionContributionItem) object.getIContributionItem();
+ NewWizardShortcutAction nwsa = (NewWizardShortcutAction) item.getAction();
return nwsa.getLocalId();
}
if (isShowPerspective(shortcutItem)) {
- ActionContributionItem item = (ActionContributionItem) object
- .getIContributionItem();
- OpenPerspectiveAction opa = (OpenPerspectiveAction) item
- .getAction();
+ ActionContributionItem item = (ActionContributionItem) object.getIContributionItem();
+ OpenPerspectiveAction opa = (OpenPerspectiveAction) item.getAction();
return opa.getLocalId();
}
if (isShowView(shortcutItem)) {
- IViewDescriptor descriptor = (IViewDescriptor) shortcutItem
- .getDescriptor();
+ IViewDescriptor descriptor = (IViewDescriptor) shortcutItem.getDescriptor();
return descriptor.getId();
}
}
@@ -1908,8 +1794,8 @@ public class CustomizePerspectiveDialog extends TrayDialog {
if (text == null || text.length() == 0) {
text = menuItem.getLabel();
}
- if ((text != null && text.length() != 0)
- || (menuItem instanceof MHandledMenuItem) || menuItem.getWidget() != null) {
+ if ((text != null && text.length() != 0) || (menuItem instanceof MHandledMenuItem)
+ || menuItem.getWidget() != null) {
IContributionItem contributionItem;
if (menuItem instanceof MMenu) {
contributionItem = menuMngrRenderer.getManager((MMenu) menuItem);
@@ -1919,8 +1805,7 @@ public class CustomizePerspectiveDialog extends TrayDialog {
if (contributionItem == null) {
return dynamicEntry;
}
- if (dynamicEntry != null
- && contributionItem.equals(dynamicEntry.getIContributionItem())) {
+ if (dynamicEntry != null && contributionItem.equals(dynamicEntry.getIContributionItem())) {
// If the last item added is the item meant to go before the
// given dynamic entry, add the dynamic entry so it is in
// the correct order.
@@ -1971,12 +1856,10 @@ public class CustomizePerspectiveDialog extends TrayDialog {
if (ActionFactory.NEW.getId().equals(contributionItem.getId())) {
initializeNewWizardsMenu(menuEntry);
wizards = menuEntry;
- } else if (SHORTCUT_CONTRIBUTION_ITEM_ID_OPEN_PERSPECTIVE
- .equals(contributionItem.getId())) {
+ } else if (SHORTCUT_CONTRIBUTION_ITEM_ID_OPEN_PERSPECTIVE.equals(contributionItem.getId())) {
initializePerspectivesMenu(menuEntry);
perspectives = menuEntry;
- } else if (SHORTCUT_CONTRIBUTION_ITEM_ID_SHOW_VIEW.equals(contributionItem
- .getId())) {
+ } else if (SHORTCUT_CONTRIBUTION_ITEM_ID_SHOW_VIEW.equals(contributionItem.getId())) {
initializeViewsMenu(menuEntry);
views = menuEntry;
} else {
@@ -2048,8 +1931,7 @@ public class CustomizePerspectiveDialog extends TrayDialog {
* @param viewer
* @param category
*/
- private void updateCategoryAndParents(StructuredViewer viewer,
- Category category) {
+ private void updateCategoryAndParents(StructuredViewer viewer, Category category) {
while (category.getParent() != shortcuts) {
viewer.update(category, null);
category = (Category) category.getParent();
@@ -2079,8 +1961,8 @@ public class CustomizePerspectiveDialog extends TrayDialog {
ToolBarManager manager = toolbarMngrRenderer.getManager(toolBar);
if (manager != null) {
toolbarMngrRenderer.reconcileManagerToModel(manager, toolBar);
- IContributionItem contributionItem = (IContributionItem) toolBar.getTransientData().get(
- CoolBarToTrimManager.OBJECT);
+ IContributionItem contributionItem = (IContributionItem) toolBar.getTransientData()
+ .get(CoolBarToTrimManager.OBJECT);
String text = getToolbarLabel(toolBar);
DisplayItem toolBarEntry = new DisplayItem(text, contributionItem);
toolBarEntry.setImageDescriptor(toolbarImageDescriptor);
@@ -2168,8 +2050,7 @@ public class CustomizePerspectiveDialog extends TrayDialog {
private static boolean isGroupOrSeparator(MToolBarElement element, IContributionItem contributionItem) {
return element instanceof MToolBarSeparator
- || (contributionItem == null || contributionItem.isGroupMarker() || contributionItem
- .isSeparator());
+ || (contributionItem == null || contributionItem.isGroupMarker() || contributionItem.isSeparator());
}
private static ParameterizedCommand generateParameterizedCommand(final MHandledItem item,
@@ -2183,8 +2064,7 @@ public class CustomizePerspectiveDialog extends TrayDialog {
parameters.put(mParm.getName(), mParm.getValue());
}
}
- ParameterizedCommand cmd = cmdService.createCommand(item.getCommand().getElementId(),
- parameters);
+ ParameterizedCommand cmd = cmdService.createCommand(item.getCommand().getElementId(), parameters);
item.setWbCommand(cmd);
return cmd;
}
@@ -2233,8 +2113,7 @@ public class CustomizePerspectiveDialog extends TrayDialog {
*/
private boolean showShortcutTab() {
return window.containsSubmenu(WorkbenchWindow.NEW_WIZARD_SUBMENU)
- || window
- .containsSubmenu(WorkbenchWindow.OPEN_PERSPECTIVE_SUBMENU)
+ || window.containsSubmenu(WorkbenchWindow.OPEN_PERSPECTIVE_SUBMENU)
|| window.containsSubmenu(WorkbenchWindow.SHOW_VIEW_SUBMENU);
}
@@ -2411,7 +2290,6 @@ public class CustomizePerspectiveDialog extends TrayDialog {
return label;
}
-
@Override
protected boolean isResizable() {
return true;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/FilteredModelCheckListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/FilteredModelCheckListener.java
index 66b146ce5f7..e71a107a3e4 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/FilteredModelCheckListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/FilteredModelCheckListener.java
@@ -19,9 +19,8 @@ import org.eclipse.ui.internal.dialogs.cpd.TreeManager.TreeItem;
/**
* On a model change, update a filtered listener. While the check listener
- * provided by the model will take care of the elements which change, since
- * we simulate our own check state of parents, the parents may need to be
- * updated.
+ * provided by the model will take care of the elements which change, since we
+ * simulate our own check state of parents, the parents may need to be updated.
*
* @since 3.5
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/FilteredTreeCheckProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/FilteredTreeCheckProvider.java
index e892de5018e..064ee6403b0 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/FilteredTreeCheckProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/FilteredTreeCheckProvider.java
@@ -19,8 +19,8 @@ import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.ui.internal.dialogs.cpd.TreeManager.TreeItem;
/**
- * A check provider which calculates checked state based on leaf states in
- * the tree (as opposed to children in a model).
+ * A check provider which calculates checked state based on leaf states in the
+ * tree (as opposed to children in a model).
*
* @since 3.5
*/
@@ -28,8 +28,7 @@ class FilteredTreeCheckProvider implements ICheckStateProvider {
private ITreeContentProvider contentProvider;
private ViewerFilter filter;
- public FilteredTreeCheckProvider(ITreeContentProvider contentProvider,
- ViewerFilter filter) {
+ public FilteredTreeCheckProvider(ITreeContentProvider contentProvider, ViewerFilter filter) {
this.contentProvider = contentProvider;
this.filter = filter;
}
@@ -47,18 +46,14 @@ class FilteredTreeCheckProvider implements ICheckStateProvider {
}
/**
- * Determines the state <code>item</code> should be (checked, gray or
- * unchecked) based only on the leafs underneath it (unless it is indeed a
- * leaf).
+ * Determines the state <code>item</code> should be (checked, gray or unchecked)
+ * based only on the leafs underneath it (unless it is indeed a leaf).
*
- * @param item
- * the item to find the state of
- * @param provider
- * the content provider which will provide <code>item</code>'s
- * children
- * @param filter
- * the filter that will only select elements in the currently
- * chosen action set
+ * @param item the item to find the state of
+ * @param provider the content provider which will provide <code>item</code>'s
+ * children
+ * @param filter the filter that will only select elements in the currently
+ * chosen action set
* @return {@link TreeManager#CHECKSTATE_CHECKED},
* {@link TreeManager#CHECKSTATE_GRAY} or
* {@link TreeManager#CHECKSTATE_UNCHECKED}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/FilteredViewerCheckListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/FilteredViewerCheckListener.java
index 3232fb36482..21cd6d90638 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/FilteredViewerCheckListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/FilteredViewerCheckListener.java
@@ -21,10 +21,10 @@ import org.eclipse.ui.internal.dialogs.cpd.CustomizePerspectiveDialog.DisplayIte
/**
* A check listener to bring about the expected change in a model based on a
- * check event in a filtered viewer. Since the checked state of a parent in
- * a filtered viewer is not based on its model state, but rather its leafs'
- * states, when a non-leaf element's check state changes, its model state
- * does not necessarily change, but its leafs' model states do.
+ * check event in a filtered viewer. Since the checked state of a parent in a
+ * filtered viewer is not based on its model state, but rather its leafs'
+ * states, when a non-leaf element's check state changes, its model state does
+ * not necessarily change, but its leafs' model states do.
*
* @since 3.5
*/
@@ -32,35 +32,30 @@ class FilteredViewerCheckListener implements ICheckStateListener {
private ITreeContentProvider contentProvider;
private ViewerFilter filter;
- public FilteredViewerCheckListener(
- ITreeContentProvider contentProvider, ViewerFilter filter) {
+ public FilteredViewerCheckListener(ITreeContentProvider contentProvider, ViewerFilter filter) {
this.contentProvider = contentProvider;
this.filter = filter;
}
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
- setAllLeafs((DisplayItem) event.getElement(), event
- .getChecked(), contentProvider, filter);
+ setAllLeafs((DisplayItem) event.getElement(), event.getChecked(), contentProvider, filter);
}
/**
- * Sets all leafs under a {@link DisplayItem} to either visible or
- * invisible. This is for use with the action set trees, where the only
- * state used is that of leafs, and the rest is rolled up to the parents.
- * Thus, this method effectively sets the state of the entire branch.
+ * Sets all leafs under a {@link DisplayItem} to either visible or invisible.
+ * This is for use with the action set trees, where the only state used is that
+ * of leafs, and the rest is rolled up to the parents. Thus, this method
+ * effectively sets the state of the entire branch.
*
- * @param item
- * the item whose leafs underneath (or itself, if it is a leaf)
- * to <code>value</code>
- * @param value
- * <code>true</code>for visible, <code>false</code> for invisible
- * @param provider
- * the content provider which will provide <code>item</code>'s
- * children
- * @param filter
- * the filter that will only select elements in the currently
- * chosen action set
+ * @param item the item whose leafs underneath (or itself, if it is a leaf)
+ * to <code>value</code>
+ * @param value <code>true</code>for visible, <code>false</code> for
+ * invisible
+ * @param provider the content provider which will provide <code>item</code>'s
+ * children
+ * @param filter the filter that will only select elements in the currently
+ * chosen action set
*/
static void setAllLeafs(DisplayItem item, boolean value, ITreeContentProvider provider, ViewerFilter filter) {
Object[] children = provider.getChildren(item);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/GrayOutUnavailableLabelProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/GrayOutUnavailableLabelProvider.java
index 4a4fe5e4c4c..965cd790537 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/GrayOutUnavailableLabelProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/GrayOutUnavailableLabelProvider.java
@@ -29,9 +29,9 @@ import org.eclipse.ui.internal.dialogs.cpd.CustomizePerspectiveDialog.ActionSet;
import org.eclipse.ui.internal.dialogs.cpd.CustomizePerspectiveDialog.DisplayItem;
/**
- * A label provider which takes the default label provider in the
- * TreeManager, and adds on functionality to gray out text and icons of
- * contribution items whose action sets are unavailable.
+ * A label provider which takes the default label provider in the TreeManager,
+ * and adds on functionality to gray out text and icons of contribution items
+ * whose action sets are unavailable.
*
* @since 3.5
*
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/ItemDetailToolTip.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/ItemDetailToolTip.java
index 3033d770995..3b951f818ca 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/ItemDetailToolTip.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/ItemDetailToolTip.java
@@ -58,10 +58,10 @@ import org.eclipse.ui.internal.util.Util;
import org.eclipse.ui.keys.IBindingService;
/**
- * A tooltip with useful information based on the type of ContributionItem
- * the cursor hovers over in a Tree. In addition to the content provided by
- * the {@link NameAndDescriptionToolTip} this includes action set
- * information and key binding data.
+ * A tooltip with useful information based on the type of ContributionItem the
+ * cursor hovers over in a Tree. In addition to the content provided by the
+ * {@link NameAndDescriptionToolTip} this includes action set information and
+ * key binding data.
*
* @since 3.5
*/
@@ -75,12 +75,11 @@ class ItemDetailToolTip extends NameAndDescriptionToolTip {
/**
* @param dialog
- * @param tree
- * The tree for the tooltip to hover over
+ * @param tree The tree for the tooltip to hover over
*/
ItemDetailToolTip(CustomizePerspectiveDialog dialog, TreeViewer v, Tree tree, boolean showActionSet,
boolean showKeyBindings, ViewerFilter filter) {
- super(tree,NO_RECREATE);
+ super(tree, NO_RECREATE);
this.dialog = dialog;
this.tree = tree;
this.v = v;
@@ -95,8 +94,8 @@ class ItemDetailToolTip extends NameAndDescriptionToolTip {
// try to position the tooltip at the bottom of the cell
ViewerCell cell = v.getCell(new Point(event.x, event.y));
- if( cell != null ) {
- return tree.toDisplay(event.x,cell.getBounds().y+cell.getBounds().height);
+ if (cell != null) {
+ return tree.toDisplay(event.x, cell.getBounds().y + cell.getBounds().height);
}
return super.getLocation(tipSize, event);
@@ -117,78 +116,64 @@ class ItemDetailToolTip extends NameAndDescriptionToolTip {
String text = null;
Image image = null;
- if(CustomizePerspectiveDialog.isEffectivelyAvailable(item, filter)) {
- if(item.actionSet != null) {
- //give information on which command group the item is in
+ if (CustomizePerspectiveDialog.isEffectivelyAvailable(item, filter)) {
+ if (item.actionSet != null) {
+ // give information on which command group the item is in
- final String actionSetName = item.getActionSet().descriptor
- .getLabel();
+ final String actionSetName = item.getActionSet().descriptor.getLabel();
- text = NLS.bind(
- WorkbenchMessages.HideItems_itemInActionSet,
- actionSetName);
+ text = NLS.bind(WorkbenchMessages.HideItems_itemInActionSet, actionSetName);
}
} else {
- //give feedback on why item is unavailable
+ // give feedback on why item is unavailable
image = dialog.warningImageDescriptor.createImage();
if (item.getChildren().isEmpty() && item.getActionSet() != null) {
- //i.e. is a leaf
+ // i.e. is a leaf
- final String actionSetName = item.getActionSet().
- descriptor.getLabel();
+ final String actionSetName = item.getActionSet().descriptor.getLabel();
- text = NLS.bind(
- WorkbenchMessages.HideItems_itemInUnavailableActionSet,
- actionSetName);
+ text = NLS.bind(WorkbenchMessages.HideItems_itemInUnavailableActionSet, actionSetName);
} else if (item.getChildren().isEmpty() && item.getActionSet() == null
&& item.getIContributionItem() instanceof HandledContributionItem) {
text = WorkbenchMessages.HideItems_itemInUnavailableCommand;
} else {
- //i.e. has children
+ // i.e. has children
Set<ActionSet> actionGroup = new LinkedHashSet<>();
- ItemDetailToolTip.collectDescendantCommandGroups(actionGroup, item,
- filter);
+ ItemDetailToolTip.collectDescendantCommandGroups(actionGroup, item, filter);
if (actionGroup.size() == 1) {
- //i.e. only one child
- ActionSet actionSet = actionGroup.
- iterator().next();
- text = NLS.bind(
- WorkbenchMessages.HideItems_unavailableChildCommandGroup,
- actionSet.descriptor.getId(),
- actionSet.descriptor.getLabel());
+ // i.e. only one child
+ ActionSet actionSet = actionGroup.iterator().next();
+ text = NLS.bind(WorkbenchMessages.HideItems_unavailableChildCommandGroup,
+ actionSet.descriptor.getId(), actionSet.descriptor.getLabel());
} else {
- //i.e. multiple children
+ // i.e. multiple children
String commandGroupList = null;
for (ActionSet actionSet : actionGroup) {
// For each action set, make a link for it, set
// the href to its id
- String commandGroupLink = MessageFormat.format(
- "<a href=\"{0}\">{1}</a>", //$NON-NLS-1$
+ String commandGroupLink = MessageFormat.format("<a href=\"{0}\">{1}</a>", //$NON-NLS-1$
actionSet.descriptor.getId(), actionSet.descriptor.getLabel());
if (commandGroupList == null) {
commandGroupList = commandGroupLink;
} else {
- commandGroupList = Util.createList(
- commandGroupList, commandGroupLink);
+ commandGroupList = Util.createList(commandGroupList, commandGroupLink);
}
}
- commandGroupList = NLS.bind(
- "{0}{1}", new Object[] { CustomizePerspectiveDialog.NEW_LINE, commandGroupList }); //$NON-NLS-1$
- text = NLS.bind(
- WorkbenchMessages.HideItems_unavailableChildCommandGroups,
- commandGroupList);
+ commandGroupList = NLS.bind("{0}{1}", //$NON-NLS-1$
+ new Object[] { CustomizePerspectiveDialog.NEW_LINE, commandGroupList });
+ text = NLS.bind(WorkbenchMessages.HideItems_unavailableChildCommandGroups, commandGroupList);
}
}
}
- if(text != null) {
+ if (text != null) {
Link link = createEntryWithLink(destination, image, text);
link.addSelectionListener(new SelectionListener() {
@Override
@@ -214,8 +199,7 @@ class ItemDetailToolTip extends NameAndDescriptionToolTip {
// Show key binding info
if (showKeyBindings && CustomizePerspectiveDialog.getCommandID(item) != null) {
// See if there is a command associated with the command id
- ICommandService commandService = dialog.window
- .getService(ICommandService.class);
+ ICommandService commandService = dialog.window.getService(ICommandService.class);
Command command = commandService.getCommand(CustomizePerspectiveDialog.getCommandID(item));
if (command != null && command.isDefined()) {
@@ -226,19 +210,13 @@ class ItemDetailToolTip extends NameAndDescriptionToolTip {
String text = null;
// Is it possible for this item to be visible?
- final boolean available = (item.getActionSet() == null)
- || (item.getActionSet().isActive());
+ final boolean available = (item.getActionSet() == null) || (item.getActionSet().isActive());
if (bindings.length > 0) {
if (available) {
- text = NLS.bind(
- WorkbenchMessages.HideItems_keyBindings,
- keybindings);
+ text = NLS.bind(WorkbenchMessages.HideItems_keyBindings, keybindings);
} else {
- text = NLS
- .bind(
- WorkbenchMessages.HideItems_keyBindingsActionSetUnavailable,
- keybindings);
+ text = NLS.bind(WorkbenchMessages.HideItems_keyBindingsActionSetUnavailable, keybindings);
}
} else {
if (available) {
@@ -259,30 +237,24 @@ class ItemDetailToolTip extends NameAndDescriptionToolTip {
// the correct item
if (item instanceof ShortcutItem) {
if (CustomizePerspectiveDialog.isNewWizard(item)) {
- parameters.put(
- IWorkbenchCommandConstants.FILE_NEW_PARM_WIZARDID,
+ parameters.put(IWorkbenchCommandConstants.FILE_NEW_PARM_WIZARDID,
CustomizePerspectiveDialog.getParamID(item));
} else if (CustomizePerspectiveDialog.isShowPerspective(item)) {
- parameters
- .put(
- IWorkbenchCommandConstants.PERSPECTIVES_SHOW_PERSPECTIVE_PARM_ID,
- CustomizePerspectiveDialog.getParamID(item));
+ parameters.put(IWorkbenchCommandConstants.PERSPECTIVES_SHOW_PERSPECTIVE_PARM_ID,
+ CustomizePerspectiveDialog.getParamID(item));
} else if (CustomizePerspectiveDialog.isShowView(item)) {
- parameters.put(
- IWorkbenchCommandConstants.VIEWS_SHOW_VIEW_PARM_ID,
+ parameters.put(IWorkbenchCommandConstants.VIEWS_SHOW_VIEW_PARM_ID,
CustomizePerspectiveDialog.getParamID(item));
}
}
- ParameterizedCommand pc = ParameterizedCommand
- .generateCommand(command, parameters);
+ ParameterizedCommand pc = ParameterizedCommand.generateCommand(command, parameters);
highlight = pc;
} else {
highlight = bindings[0];
}
- Link bindingLink = createEntryWithLink(destination, null,
- text);
+ Link bindingLink = createEntryWithLink(destination, null, text);
bindingLink.addSelectionListener(new SelectionListener() {
@Override
@@ -293,8 +265,7 @@ class ItemDetailToolTip extends NameAndDescriptionToolTip {
@Override
public void widgetSelected(SelectionEvent e) {
PreferenceDialog pdialog = PreferencesUtil.createPreferenceDialogOn(dialog.getShell(),
- CustomizePerspectiveDialog.KEYS_PREFERENCE_PAGE_ID,
- new String[0], highlight);
+ CustomizePerspectiveDialog.KEYS_PREFERENCE_PAGE_ID, new String[0], highlight);
hide();
pdialog.open();
}
@@ -316,8 +287,7 @@ class ItemDetailToolTip extends NameAndDescriptionToolTip {
.append(menuItem.getText());
}
} else {
- text
- .append(WorkbenchMessages.HideItems_dynamicItemEmptyList);
+ text.append(WorkbenchMessages.HideItems_dynamicItemEmptyList);
}
createEntry(destination, null, text.toString());
}
@@ -325,8 +295,7 @@ class ItemDetailToolTip extends NameAndDescriptionToolTip {
@Override
protected Object getModelElement(Event event) {
- org.eclipse.swt.widgets.TreeItem treeItem = tree.getItem(new Point(
- event.x, event.y));
+ org.eclipse.swt.widgets.TreeItem treeItem = tree.getItem(new Point(event.x, event.y));
if (treeItem == null) {
return null;
}
@@ -334,22 +303,18 @@ class ItemDetailToolTip extends NameAndDescriptionToolTip {
}
/**
- * @param collection
- * a collection, into which all command groups (action sets)
- * which contribute <code>item</code> or its descendants will be
- * placed
- * @param item
- * the item to collect descendants of
- * @param filter
- * the filter currently being used
+ * @param collection a collection, into which all command groups (action sets)
+ * which contribute <code>item</code> or its descendants will
+ * be placed
+ * @param item the item to collect descendants of
+ * @param filter the filter currently being used
*/
- static void collectDescendantCommandGroups(Collection<ActionSet> collection,
- DisplayItem item, ViewerFilter filter) {
+ static void collectDescendantCommandGroups(Collection<ActionSet> collection, DisplayItem item,
+ ViewerFilter filter) {
List<TreeItem> children = item.getChildren();
for (TreeItem treeItem : children) {
DisplayItem child = (DisplayItem) treeItem;
- if ((filter == null || filter.select(null, null, child))
- && child.getActionSet() != null) {
+ if ((filter == null || filter.select(null, null, child)) && child.getActionSet() != null) {
collection.add(child.getActionSet());
}
collectDescendantCommandGroups(collection, child, filter);
@@ -367,8 +332,7 @@ class ItemDetailToolTip extends NameAndDescriptionToolTip {
// check to see if this one has already been recorded.
boolean alreadyRecorded = false;
for (int j = 0; j < i && !alreadyRecorded; j++) {
- if (bindings[i].getTriggerSequence().equals(
- bindings[j].getTriggerSequence())) {
+ if (bindings[i].getTriggerSequence().equals(bindings[j].getTriggerSequence())) {
alreadyRecorded = true;
}
}
@@ -397,11 +361,9 @@ class ItemDetailToolTip extends NameAndDescriptionToolTip {
String id = CustomizePerspectiveDialog.getCommandID(item);
String param = CustomizePerspectiveDialog.getParamID(item);
- BindingManager bindingManager = ((BindingService) bindingService)
- .getBindingManager();
+ BindingManager bindingManager = ((BindingService) bindingService).getBindingManager();
- Collection<?> allBindings = bindingManager
- .getActiveBindingsDisregardingContextFlat();
+ Collection<?> allBindings = bindingManager.getActiveBindingsDisregardingContextFlat();
List<Binding> foundBindings = new ArrayList<>(2);
@@ -438,8 +400,7 @@ class ItemDetailToolTip extends NameAndDescriptionToolTip {
}
}
- Binding[] bindings = foundBindings
- .toArray(new Binding[foundBindings.size()]);
+ Binding[] bindings = foundBindings.toArray(new Binding[foundBindings.size()]);
return bindings;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/NameAndDescriptionToolTip.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/NameAndDescriptionToolTip.java
index 6544aea8926..273bf2f5298 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/NameAndDescriptionToolTip.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/NameAndDescriptionToolTip.java
@@ -41,8 +41,8 @@ import org.eclipse.ui.views.IViewDescriptor;
import org.eclipse.ui.wizards.IWizardDescriptor;
/**
- * A tooltip which, given a model element, will display its icon (if there
- * is one), name, and a description (if there is one).
+ * A tooltip which, given a model element, will display its icon (if there is
+ * one), name, and a description (if there is one).
*
* @since 3.5
*/
@@ -54,18 +54,15 @@ abstract class NameAndDescriptionToolTip extends ToolTip {
protected abstract Object getModelElement(Event event);
/**
- * Adds logic to only show a tooltip if a meaningful item is under the
- * cursor.
+ * Adds logic to only show a tooltip if a meaningful item is under the cursor.
*/
@Override
protected boolean shouldCreateToolTip(Event event) {
- return super.shouldCreateToolTip(event)
- && getModelElement(event) != null;
+ return super.shouldCreateToolTip(event) && getModelElement(event) != null;
}
@Override
- protected Composite createToolTipContentArea(Event event,
- Composite parent) {
+ protected Composite createToolTipContentArea(Event event, Composite parent) {
Object modelElement = getModelElement(event);
Image iconImage = null;
@@ -80,17 +77,14 @@ abstract class NameAndDescriptionToolTip extends ToolTip {
// Create the content area
Composite composite = new Composite(parent, SWT.NONE);
- composite.setBackground(parent.getDisplay().getSystemColor(
- SWT.COLOR_INFO_BACKGROUND));
+ composite.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
composite.setLayout(new GridLayout(2, false));
// The title area with the icon (if there is one) and label.
Label title = createEntry(composite, iconImage, nameString);
title.setFont(getTitleFont());
- GridDataFactory.createFrom((GridData)title.getLayoutData())
- .hint(SWT.DEFAULT, SWT.DEFAULT)
- .minSize(CustomizePerspectiveDialog.MIN_TOOLTIP_WIDTH, 1)
- .applyTo(title);
+ GridDataFactory.createFrom((GridData) title.getLayoutData()).hint(SWT.DEFAULT, SWT.DEFAULT)
+ .minSize(CustomizePerspectiveDialog.MIN_TOOLTIP_WIDTH, 1).applyTo(title);
// The description (if there is one)
String descriptionString = NameAndDescriptionToolTip.getDescription(modelElement);
@@ -112,17 +106,13 @@ abstract class NameAndDescriptionToolTip extends ToolTip {
}
/**
- * Adds a line of information to <code>parent</code>. If
- * <code>icon</code> is not <code>null</code>, an icon is placed on the
- * left, and then a label with <code>text</code>.
+ * Adds a line of information to <code>parent</code>. If <code>icon</code> is
+ * not <code>null</code>, an icon is placed on the left, and then a label with
+ * <code>text</code>.
*
- * @param parent
- * the composite to add the entry to
- * @param icon
- * the icon to place next to the text. <code>null</code> for
- * none.
- * @param text
- * the text to display
+ * @param parent the composite to add the entry to
+ * @param icon the icon to place next to the text. <code>null</code> for none.
+ * @param text the text to display
* @return the created label
*/
protected Label createEntry(Composite parent, Image icon, String text) {
@@ -138,7 +128,7 @@ abstract class NameAndDescriptionToolTip extends ToolTip {
Label textLabel = new Label(parent, SWT.WRAP);
- if(icon == null) {
+ if (icon == null) {
GridDataFactory.generate(textLabel, 2, 1);
} else {
GridDataFactory.generate(textLabel, 1, 1);
@@ -153,22 +143,16 @@ abstract class NameAndDescriptionToolTip extends ToolTip {
}
/**
- * Adds a line of information to <code>parent</code>. If
- * <code>icon</code> is not <code>null</code>, an icon is placed on the
- * left, and then a label with <code>text</code>, which supports using
- * anchor tags to creates links
+ * Adds a line of information to <code>parent</code>. If <code>icon</code> is
+ * not <code>null</code>, an icon is placed on the left, and then a label with
+ * <code>text</code>, which supports using anchor tags to creates links
*
- * @param parent
- * the composite to add the entry to
- * @param icon
- * the icon to place next to the text. <code>null</code> for
- * none.
- * @param text
- * the text to display
+ * @param parent the composite to add the entry to
+ * @param icon the icon to place next to the text. <code>null</code> for none.
+ * @param text the text to display
* @return the created link
*/
- protected Link createEntryWithLink(Composite parent, Image icon,
- String text) {
+ protected Link createEntryWithLink(Composite parent, Image icon, String text) {
Color fg = parent.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND);
Color bg = parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND);
if (icon != null) {
@@ -181,7 +165,7 @@ abstract class NameAndDescriptionToolTip extends ToolTip {
Link textLink = new Link(parent, SWT.WRAP);
- if(icon == null) {
+ if (icon == null) {
GridDataFactory.generate(textLink, 2, 1);
}
@@ -221,22 +205,19 @@ abstract class NameAndDescriptionToolTip extends ToolTip {
if (CustomizePerspectiveDialog.isNewWizard(item)) {
ShortcutItem shortcut = (ShortcutItem) item;
- IWizardDescriptor descriptor = (IWizardDescriptor) shortcut
- .getDescriptor();
+ IWizardDescriptor descriptor = (IWizardDescriptor) shortcut.getDescriptor();
return descriptor.getDescription();
}
if (CustomizePerspectiveDialog.isShowPerspective(item)) {
ShortcutItem shortcut = (ShortcutItem) item;
- IPerspectiveDescriptor descriptor = (IPerspectiveDescriptor) shortcut
- .getDescriptor();
+ IPerspectiveDescriptor descriptor = (IPerspectiveDescriptor) shortcut.getDescriptor();
return descriptor.getDescription();
}
if (CustomizePerspectiveDialog.isShowView(item)) {
ShortcutItem shortcut = (ShortcutItem) item;
- IViewDescriptor descriptor = (IViewDescriptor) shortcut
- .getDescriptor();
+ IViewDescriptor descriptor = (IViewDescriptor) shortcut.getDescriptor();
return descriptor.getDescription();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/ShortcutLabelProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/ShortcutLabelProvider.java
index 99a3d400d2f..ba726e8aa74 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/ShortcutLabelProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/ShortcutLabelProvider.java
@@ -24,8 +24,7 @@ import org.eclipse.ui.internal.dialogs.cpd.CustomizePerspectiveDialog.ShortcutIt
*
* @since 3.5
*/
-class ShortcutLabelProvider extends
- TreeManager.TreeItemLabelProvider implements ITableLabelProvider {
+class ShortcutLabelProvider extends TreeManager.TreeItemLabelProvider implements ITableLabelProvider {
@Override
public Image getColumnImage(Object element, int columnIndex) {
if (columnIndex == 0) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/ShowUsedActionSetsFilter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/ShowUsedActionSetsFilter.java
index 09cfbae784b..ca58725c46a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/ShowUsedActionSetsFilter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/ShowUsedActionSetsFilter.java
@@ -19,8 +19,8 @@ import org.eclipse.ui.internal.dialogs.cpd.CustomizePerspectiveDialog.ActionSet;
import org.eclipse.ui.internal.dialogs.cpd.CustomizePerspectiveDialog.DisplayItem;
/**
- * A filter which will only show action sets which contribute items in the
- * given tree structure.
+ * A filter which will only show action sets which contribute items in the given
+ * tree structure.
*
* @since 3.5
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/TableToolTip.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/TableToolTip.java
index 075e4dada77..76d05495d1e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/TableToolTip.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/TableToolTip.java
@@ -19,8 +19,8 @@ import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;
/**
- * A tooltip with useful information based on the type of ContributionItem
- * the cursor hovers over in a Table.
+ * A tooltip with useful information based on the type of ContributionItem the
+ * cursor hovers over in a Table.
*
* @since 3.5
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/TreeManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/TreeManager.java
index 93b303c761b..f2e13f13eb2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/TreeManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/TreeManager.java
@@ -37,16 +37,17 @@ import org.eclipse.swt.graphics.Image;
* Manages a tree which provides "standard checkbox tree behavior". I.e. it
* follows these rules:
* <ol>
- * <li>If a check box is checked, all its children must be checked.</li>
- * <li>If a check box is unchecked, all its children must be unchecked.</li>
- * <li>If a check box is grayed, each of its children may be either checked or
- * unchecked, however, there must be one of each.</li>
- * <li>If a user checks a check box, its children or parents must change state
- * accordingly.</li>
+ * <li>If a check box is checked, all its children must be checked.</li>
+ * <li>If a check box is unchecked, all its children must be unchecked.</li>
+ * <li>If a check box is grayed, each of its children may be either checked or
+ * unchecked, however, there must be one of each.</li>
+ * <li>If a user checks a check box, its children or parents must change state
+ * accordingly.</li>
* </ol>
* <p>
* <b>Note:</b> be sure to call dispose()
* </p>
+ *
* @since 3.5
*
*/
@@ -64,25 +65,25 @@ public class TreeManager {
private LocalResourceManager resourceManager = new LocalResourceManager(JFaceResources.getResources());
/**
- * Instances of this interface will handle changes in the model
- * representation of checkstates.
+ * Instances of this interface will handle changes in the model representation
+ * of checkstates.
*/
public interface CheckListener {
/**
- * Invoked when a {@link TreeManager.TreeItem}'s check state has
- * changed.
+ * Invoked when a {@link TreeManager.TreeItem}'s check state has changed.
*
- * @param changedItem
- * The item whose check state has changed
+ * @param changedItem The item whose check state has changed
*/
void checkChanged(TreeItem changedItem);
}
/**
- * Implementation of {@link TreeManager.CheckListener} for use in a {@link CheckboxTreeViewer}.
+ * Implementation of {@link TreeManager.CheckListener} for use in a
+ * {@link CheckboxTreeViewer}.
*/
public static class ModelListenerForCheckboxTree implements CheckListener {
private CheckboxTreeViewer treeViewer;
+
public ModelListenerForCheckboxTree(TreeManager manager, CheckboxTreeViewer treeViewer) {
this.treeViewer = treeViewer;
manager.addListener(this);
@@ -100,6 +101,7 @@ public class TreeManager {
*/
public static class ModelListenerForCheckboxTable implements CheckListener {
private CheckboxTableViewer tableViewer;
+
public ModelListenerForCheckboxTable(TreeManager manager, CheckboxTableViewer tableViewer) {
this.tableViewer = tableViewer;
manager.addListener(this);
@@ -115,9 +117,9 @@ public class TreeManager {
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
Object checked = event.getElement();
- if(checked instanceof TreeItem) {
- ((TreeItem)checked).setChangedByUser(true);
- ((TreeItem)checked).setCheckState(event.getChecked());
+ if (checked instanceof TreeItem) {
+ ((TreeItem) checked).setChangedByUser(true);
+ ((TreeItem) checked).setCheckState(event.getChecked());
}
}
}
@@ -129,12 +131,12 @@ public class TreeManager {
public static class CheckStateProvider implements ICheckStateProvider {
@Override
public boolean isChecked(Object element) {
- return ((TreeItem)element).checkState != CHECKSTATE_UNCHECKED;
+ return ((TreeItem) element).checkState != CHECKSTATE_UNCHECKED;
}
@Override
public boolean isGrayed(Object element) {
- return ((TreeItem)element).checkState == CHECKSTATE_GRAY;
+ return ((TreeItem) element).checkState == CHECKSTATE_GRAY;
}
}
@@ -160,18 +162,19 @@ public class TreeManager {
}
/**
- * An {@link ITreeContentProvider} for {@link TreeManager.TreeItem}s - will completely build the
- * tree structure represented by {@link TreeManager.TreeItem}s.
+ * An {@link ITreeContentProvider} for {@link TreeManager.TreeItem}s - will
+ * completely build the tree structure represented by
+ * {@link TreeManager.TreeItem}s.
*/
public static class TreeItemContentProvider implements ITreeContentProvider {
@Override
public Object[] getChildren(Object parentElement) {
- return ((TreeItem)parentElement).getChildren().toArray();
+ return ((TreeItem) parentElement).getChildren().toArray();
}
@Override
public Object getParent(Object element) {
- return ((TreeItem)element).getParent();
+ return ((TreeItem) element).getParent();
}
@Override
@@ -185,51 +188,52 @@ public class TreeManager {
}
@Override
- public void dispose() {}
+ public void dispose() {
+ }
@Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
}
/**
- * @return an {@link ICheckStateProvider} which will operate on
- * {@link TreeItem}s
+ * @return an {@link ICheckStateProvider} which will operate on
+ * {@link TreeItem}s
*/
public static ICheckStateProvider getCheckStateProvider() {
- if(checkStateProvider == null) {
+ if (checkStateProvider == null) {
checkStateProvider = new CheckStateProvider();
}
return checkStateProvider;
}
/**
- * @return an {@link IBaseLabelProvider} which will provide the labels and
- * images of {@link TreeItem}s
+ * @return an {@link IBaseLabelProvider} which will provide the labels and
+ * images of {@link TreeItem}s
*/
public static IBaseLabelProvider getLabelProvider() {
- if(labelProvider == null) {
+ if (labelProvider == null) {
labelProvider = new TreeItemLabelProvider();
}
return labelProvider;
}
/**
- * @return an {@link ITreeContentProvider} which will provide
- * {@link TreeItem} content in tree format.
+ * @return an {@link ITreeContentProvider} which will provide {@link TreeItem}
+ * content in tree format.
*/
public static ITreeContentProvider getTreeContentProvider() {
- if(treeContentProvider == null)
+ if (treeContentProvider == null)
treeContentProvider = new TreeItemContentProvider();
return treeContentProvider;
}
/**
- * @return an {@link ICheckStateListener} which will respond to
- * {@link CheckStateChangedEvent}s by updating the model to reflect
- * them
+ * @return an {@link ICheckStateListener} which will respond to
+ * {@link CheckStateChangedEvent}s by updating the model to reflect them
*/
public ICheckStateListener getViewerCheckStateListener() {
- if(viewerCheckListener == null)
+ if (viewerCheckListener == null)
viewerCheckListener = new ViewerCheckStateListener();
return viewerCheckListener;
}
@@ -260,8 +264,8 @@ public class TreeManager {
}
public Image getImage() {
- if(image == null) {
- if(imageDescriptor == null) {
+ if (image == null) {
+ if (imageDescriptor == null) {
return null;
}
image = resourceManager.createImage(imageDescriptor);
@@ -274,10 +278,10 @@ public class TreeManager {
}
public void addChild(TreeItem newChild) {
- newChild.parent = this;
- children.add(newChild);
- synchParents(newChild);
- }
+ newChild.parent = this;
+ children.add(newChild);
+ synchParents(newChild);
+ }
public List<TreeItem> getChildren() {
return children;
@@ -291,24 +295,24 @@ public class TreeManager {
return parent;
}
- /**
- * An internal call that forwards the change events but does <b>not</b>
- * cause any iterative synchronization to take place.
+ /**
+ * An internal call that forwards the change events but does <b>not</b> cause
+ * any iterative synchronization to take place.
*
* @param newState
*/
- private void internalSetCheckState(int newState) {
+ private void internalSetCheckState(int newState) {
if (newState == checkState)
return;
checkState = newState;
fireListeners(this);
- }
+ }
/**
* External call to explicitly set the particular state of a
- * {@link TreeManager.TreeItem}. This is usually a response to an SWT
- * check changed event generated by a Tree/Table.
+ * {@link TreeManager.TreeItem}. This is usually a response to an SWT check
+ * changed event generated by a Tree/Table.
*
* @param checked
*/
@@ -338,8 +342,8 @@ public class TreeManager {
}
/**
- * If the new state is not "GRAY" then force all children to match that
- * state (recursively).
+ * If the new state is not "GRAY" then force all children to match that state
+ * (recursively).
*
* @param changedItem
*/
@@ -359,8 +363,8 @@ public class TreeManager {
}
/**
- * Set the parent's state based on the aggregate state of its children
- * using the following rules:
+ * Set the parent's state based on the aggregate state of its children using the
+ * following rules:
* <ul>
* <li>All children checked...parent checked</li>
* <li>All children unchecked...parent unchecked</li>
@@ -370,7 +374,7 @@ public class TreeManager {
* @param changedItem
*/
private void synchParents(TreeItem changedItem) {
- if(changedItem.parent == null)
+ if (changedItem.parent == null)
return;
int newState = changedItem.checkState;
@@ -393,28 +397,31 @@ public class TreeManager {
for (Iterator<TreeItem> i = changedItem.parent.children.iterator(); i.hasNext()
&& (!checkedFound || !uncheckedFound);) {
TreeItem item = i.next();
- switch(item.checkState) {
+ switch (item.checkState) {
case CHECKSTATE_CHECKED: {
checkedFound = true;
break;
- } case CHECKSTATE_GRAY: {
+ }
+ case CHECKSTATE_GRAY: {
checkedFound = uncheckedFound = true;
break;
- } case CHECKSTATE_UNCHECKED: {
+ }
+ case CHECKSTATE_UNCHECKED: {
uncheckedFound = true;
break;
- }}
+ }
+ }
}
int oldState = changedItem.parent.checkState;
- if(checkedFound && uncheckedFound) {
+ if (checkedFound && uncheckedFound) {
changedItem.parent.internalSetCheckState(CHECKSTATE_GRAY);
} else if (checkedFound) {
changedItem.parent.internalSetCheckState(CHECKSTATE_CHECKED);
} else {
changedItem.parent.internalSetCheckState(CHECKSTATE_UNCHECKED);
}
- if(oldState != changedItem.parent.checkState) {
+ if (oldState != changedItem.parent.checkState) {
if (changedItem.isChangedByUser()) {
changedItem.parent.setChangedByUser(true);
}
@@ -466,35 +473,37 @@ public class TreeManager {
/**
* Provides a {@link CheckListener} which updates a viewer whenever the
* {@link TreeManager} model changes.
- * @param viewer The viewer whose check states will be appropriately
- * updated on a change to the model.
- * @return The created {@link CheckListener}.
+ *
+ * @param viewer The viewer whose check states will be appropriately updated on
+ * a change to the model.
+ * @return The created {@link CheckListener}.
*/
public CheckListener getCheckListener(ICheckable viewer) {
- if(viewer instanceof CheckboxTreeViewer)
- return new ModelListenerForCheckboxTree(this, (CheckboxTreeViewer)viewer);
- if(viewer instanceof CheckboxTableViewer)
- return new ModelListenerForCheckboxTable(this, (CheckboxTableViewer)viewer);
+ if (viewer instanceof CheckboxTreeViewer)
+ return new ModelListenerForCheckboxTree(this, (CheckboxTreeViewer) viewer);
+ if (viewer instanceof CheckboxTableViewer)
+ return new ModelListenerForCheckboxTable(this, (CheckboxTableViewer) viewer);
return null;
}
/**
- * Sets up this {@link TreeManager} for standard interaction with the
- * provided {@link CheckboxTreeViewer}. In particular:
+ * Sets up this {@link TreeManager} for standard interaction with the provided
+ * {@link CheckboxTreeViewer}. In particular:
* <ul>
- * <li>Adds a Label Provider for {@link TreeItem}s which provides both
- * labels and images.</li>
- * <li>Adds a {@link CheckStateProvider} for {@link TreeItem}s.</li>
- * <li>Adds an {@link IContentProvider} to build a tree from input
- * {@link TreeItem}s.</li>
- * <li>Adds an {@link ICheckStateListener} to the viewer to update the
- * appropriate {@link TreeItem}s upon a check box state change in the
- * viewer.</li>
- * <li>Adds a {@link CheckListener} to the {@link TreeManager} which will
- * automatically update the viewer on a {@link TreeItem} check state
- * change.</li>
+ * <li>Adds a Label Provider for {@link TreeItem}s which provides both labels
+ * and images.</li>
+ * <li>Adds a {@link CheckStateProvider} for {@link TreeItem}s.</li>
+ * <li>Adds an {@link IContentProvider} to build a tree from input
+ * {@link TreeItem}s.</li>
+ * <li>Adds an {@link ICheckStateListener} to the viewer to update the
+ * appropriate {@link TreeItem}s upon a check box state change in the
+ * viewer.</li>
+ * <li>Adds a {@link CheckListener} to the {@link TreeManager} which will
+ * automatically update the viewer on a {@link TreeItem} check state
+ * change.</li>
* </ul>
- * @param viewer the viewer to configure with this TreeManager.
+ *
+ * @param viewer the viewer to configure with this TreeManager.
*/
public void attachAll(CheckboxTreeViewer viewer) {
viewer.setLabelProvider(getLabelProvider());
@@ -505,22 +514,23 @@ public class TreeManager {
}
/**
- * Sets up this {@link TreeManager} for standard interaction with the
- * provided {@link CheckboxTableViewer}. In particular:
+ * Sets up this {@link TreeManager} for standard interaction with the provided
+ * {@link CheckboxTableViewer}. In particular:
* <ul>
- * <li>Adds a Label Provider for {@link TreeItem}s which provides both
- * labels and images.</li>
- * <li>Adds a {@link CheckStateProvider} for {@link TreeItem}s.</li>
- * <li>Adds an {@link IContentProvider} to build a tree from input
- * {@link TreeItem}s.</li>
- * <li>Adds an {@link ICheckStateListener} to the viewer to update the
- * appropriate {@link TreeItem}s upon a check box state change in the
- * viewer.</li>
- * <li>Adds a {@link CheckListener} to the {@link TreeManager} which will
- * automatically update the viewer on a {@link TreeItem} check state
- * change.</li>
+ * <li>Adds a Label Provider for {@link TreeItem}s which provides both labels
+ * and images.</li>
+ * <li>Adds a {@link CheckStateProvider} for {@link TreeItem}s.</li>
+ * <li>Adds an {@link IContentProvider} to build a tree from input
+ * {@link TreeItem}s.</li>
+ * <li>Adds an {@link ICheckStateListener} to the viewer to update the
+ * appropriate {@link TreeItem}s upon a check box state change in the
+ * viewer.</li>
+ * <li>Adds a {@link CheckListener} to the {@link TreeManager} which will
+ * automatically update the viewer on a {@link TreeItem} check state
+ * change.</li>
* </ul>
- * @param viewer the viewer to configure with this TreeManager.
+ *
+ * @param viewer the viewer to configure with this TreeManager.
*/
public void attachAll(CheckboxTableViewer viewer) {
viewer.setLabelProvider(getLabelProvider());
@@ -532,7 +542,8 @@ public class TreeManager {
/**
* Dissociates a listener.
- * @param listener The listener to remove.
+ *
+ * @param listener The listener to remove.
*/
public void removeListener(CheckListener listener) {
listeners.remove(listener);
@@ -540,7 +551,8 @@ public class TreeManager {
/**
* Fires all listeners.
- * @param item The {@link TreeItem} that changed.
+ *
+ * @param item The {@link TreeItem} that changed.
*/
private void fireListeners(TreeItem item) {
for (CheckListener checkListener : listeners) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/UnavailableContributionItemCheckListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/UnavailableContributionItemCheckListener.java
index 15b5d447d01..1aaf3a677ce 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/UnavailableContributionItemCheckListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/cpd/UnavailableContributionItemCheckListener.java
@@ -27,11 +27,11 @@ import org.eclipse.ui.internal.WorkbenchMessages;
import org.eclipse.ui.internal.dialogs.cpd.CustomizePerspectiveDialog.DisplayItem;
/**
- * A check listener which, upon changing the check state of a contribution
- * item, checks if that item is eligible to be checked (i.e. it is in an
- * available action set), and if not, informs the user of the illegal
- * operation. If the operation is legal, the event is forwarded to the check
- * listener to actually perform a useful action.
+ * A check listener which, upon changing the check state of a contribution item,
+ * checks if that item is eligible to be checked (i.e. it is in an available
+ * action set), and if not, informs the user of the illegal operation. If the
+ * operation is legal, the event is forwarded to the check listener to actually
+ * perform a useful action.
*
* @since 3.5
*/
@@ -42,12 +42,9 @@ class UnavailableContributionItemCheckListener implements ICheckStateListener {
private ICheckStateListener originalListener;
/**
- * @param viewer
- * the viewer being listened to
- * @param originalListener
- * the listener to invoke upon a legal action
- * @param dialog
- * parent
+ * @param viewer the viewer being listened to
+ * @param originalListener the listener to invoke upon a legal action
+ * @param dialog parent
*/
public UnavailableContributionItemCheckListener(CustomizePerspectiveDialog dialog, CheckboxTreeViewer viewer,
ICheckStateListener originalListener) {
@@ -60,7 +57,8 @@ class UnavailableContributionItemCheckListener implements ICheckStateListener {
public void checkStateChanged(CheckStateChangedEvent event) {
DisplayItem item = (DisplayItem) event.getElement();
ViewerFilter[] filters = viewer.getFilters();
- boolean isEffectivelyAvailable = CustomizePerspectiveDialog.isEffectivelyAvailable(item, filters.length > 0 ? filters[0] : null);
+ boolean isEffectivelyAvailable = CustomizePerspectiveDialog.isEffectivelyAvailable(item,
+ filters.length > 0 ? filters[0] : null);
if (isEffectivelyAvailable) {
// legal action - invoke the listener which will do actual work
@@ -80,8 +78,8 @@ class UnavailableContributionItemCheckListener implements ICheckStateListener {
}
MessageBox mb = new MessageBox(viewer.getControl().getShell(), SWT.OK | SWT.ICON_WARNING | SWT.SHEET);
mb.setText(WorkbenchMessages.HideItemsCannotMakeVisible_dialogTitle);
- mb.setMessage(NLS.bind(WorkbenchMessages.HideItemsCannotMakeVisible_unavailableChildrenText,
- item.getLabel()));
+ mb.setMessage(
+ NLS.bind(WorkbenchMessages.HideItemsCannotMakeVisible_unavailableChildrenText, item.getLabel()));
mb.open();
} else {
MessageBox mb;
@@ -91,8 +89,8 @@ class UnavailableContributionItemCheckListener implements ICheckStateListener {
// the case of a command contribution which has its own
// enablement rules, e.g. "org.eclipse.ui.window.pinEditor"
// command
- final String errorExplanation = NLS.bind(
- WorkbenchMessages.HideItemsCannotMakeVisible_unavailableCommandItemText, item.getLabel());
+ final String errorExplanation = NLS
+ .bind(WorkbenchMessages.HideItemsCannotMakeVisible_unavailableCommandItemText, item.getLabel());
mb.setMessage(errorExplanation);
} else {
// the case where this item is unavailable because it belongs to
@@ -102,8 +100,9 @@ class UnavailableContributionItemCheckListener implements ICheckStateListener {
final String errorExplanation = NLS.bind(
WorkbenchMessages.HideItemsCannotMakeVisible_unavailableCommandGroupText, item.getLabel(),
item.getActionSet());
- final String message = NLS
- .bind("{0}{1}{1}{2}", new Object[] { errorExplanation, CustomizePerspectiveDialog.NEW_LINE, WorkbenchMessages.HideItemsCannotMakeVisible_switchToCommandGroupTab }); //$NON-NLS-1$
+ final String message = NLS.bind("{0}{1}{1}{2}", //$NON-NLS-1$
+ new Object[] { errorExplanation, CustomizePerspectiveDialog.NEW_LINE,
+ WorkbenchMessages.HideItemsCannotMakeVisible_switchToCommandGroupTab });
mb.setMessage(message);
}
if (mb.open() == SWT.YES) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ActionBars.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ActionBars.java
index 9b7c8f25e8f..ba082303e90 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ActionBars.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ActionBars.java
@@ -56,7 +56,6 @@ public class ActionBars extends SubActionBars {
return menuManager;
}
-
@Override
public IToolBarManager getToolBarManager() {
if (toolbarManager == null) {
@@ -71,7 +70,8 @@ public class ActionBars extends SubActionBars {
getStatusLineManager().update(false);
getMenuManager().update(false);
if (toolbarManager != null) {
- // System.err.println("update toolbar manager for " + part.getElementId()); //$NON-NLS-1$
+ // System.err.println("update toolbar manager for " + part.getElementId());
+ // //$NON-NLS-1$
Control tbCtrl = toolbarManager.getControl();
if (tbCtrl == null || tbCtrl.isDisposed()) {
if (part.getContext() != null) {
@@ -94,8 +94,7 @@ public class ActionBars extends SubActionBars {
Object renderer = toolbar.getRenderer();
if (renderer instanceof ToolBarManagerRenderer) {
// update the mapping of opaque items
- ((ToolBarManagerRenderer) renderer).reconcileManagerToModel(toolbarManager,
- toolbar);
+ ((ToolBarManagerRenderer) renderer).reconcileManagerToModel(toolbarManager, toolbar);
}
}
}
@@ -161,8 +160,7 @@ public class ActionBars extends SubActionBars {
}
parent = placeholder.getParent();
- return parent instanceof MGenericStack ? parent.getSelectedElement() == placeholder
- : parent != null;
+ return parent instanceof MGenericStack ? parent.getSelectedElement() == placeholder : parent != null;
}
return !(parent instanceof MGenericStack) || parent.getSelectedElement() == part;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/CompatibilityEditor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/CompatibilityEditor.java
index c67371302be..0e2fae9db85 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/CompatibilityEditor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/CompatibilityEditor.java
@@ -71,8 +71,7 @@ public class CompatibilityEditor extends CompatibilityPart {
return part;
}
- private void createMultiEditorChildren(IWorkbenchPart part, IEditorInput input)
- throws PartInitException {
+ private void createMultiEditorChildren(IWorkbenchPart part, IEditorInput input) throws PartInitException {
IWorkbenchPage page = reference.getPage();
MPart model = getModel();
MWindow window = modelService.getTopLevelWindowFor(model);
@@ -84,12 +83,12 @@ public class CompatibilityEditor extends CompatibilityPart {
for (int i = 0; i < editorIds.length; i++) {
EditorDescriptor innerDesc = (EditorDescriptor) registry.findEditor(editorIds[i]);
if (innerDesc == null) {
- throw new PartInitException(NLS.bind(
- WorkbenchMessages.EditorManager_unknownEditorIDMessage, editorIds[i]));
+ throw new PartInitException(
+ NLS.bind(WorkbenchMessages.EditorManager_unknownEditorIDMessage, editorIds[i]));
}
- EditorReference innerReference = new EditorReference(window.getContext(), page, model,
- inputs[i], innerDesc, null);
+ EditorReference innerReference = new EditorReference(window.getContext(), page, model, inputs[i], innerDesc,
+ null);
editors[i] = (IEditorPart) innerReference.createPart();
innerReference.initialize(editors[i]);
}
@@ -109,8 +108,7 @@ public class CompatibilityEditor extends CompatibilityPart {
if (descriptor != null) {
IConfigurationElement element = descriptor.getConfigurationElement();
if (element != null) {
- String iconURI = MenuHelper.getIconURI(element,
- IWorkbenchRegistryConstants.ATT_ICON);
+ String iconURI = MenuHelper.getIconURI(element, IWorkbenchRegistryConstants.ATT_ICON);
part.setIconURI(iconURI);
}
if (descriptor.getPluginId() != null) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/CompatibilityPart.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/CompatibilityPart.java
index 730d2307199..048e3bdf4b2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/CompatibilityPart.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/CompatibilityPart.java
@@ -99,8 +99,7 @@ public abstract class CompatibilityPart implements ISelectionChangedListener {
// being unset
if (event.getProperty(UIEvents.EventTags.ELEMENT) == part
&& event.getProperty(UIEvents.EventTags.NEW_VALUE) == null) {
- Assert.isTrue(!composite.isDisposed(),
- "The widget should not have been disposed at this point"); //$NON-NLS-1$
+ Assert.isTrue(!composite.isDisposed(), "The widget should not have been disposed at this point"); //$NON-NLS-1$
beingDisposed = true;
WorkbenchPartReference reference = getReference();
// notify the workbench we're being closed
@@ -111,8 +110,7 @@ public abstract class CompatibilityPart implements ISelectionChangedListener {
};
/**
- * This handler will be notified when the part's client object has been
- * un/set.
+ * This handler will be notified when the part's client object has been un/set.
*/
private EventHandler objectSetHandler = event -> {
// check that we're looking at our own part and that the object is
@@ -191,8 +189,7 @@ public abstract class CompatibilityPart implements ISelectionChangedListener {
selectionProvider.addSelectionChangedListener(this);
if (selectionProvider instanceof IPostSelectionProvider) {
- ((IPostSelectionProvider) selectionProvider)
- .addPostSelectionChangedListener(postListener);
+ ((IPostSelectionProvider) selectionProvider).addPostSelectionChangedListener(postListener);
} else {
selectionProvider.addSelectionChangedListener(postListener);
}
@@ -247,8 +244,7 @@ public abstract class CompatibilityPart implements ISelectionChangedListener {
selectionProvider.removeSelectionChangedListener(this);
if (selectionProvider instanceof IPostSelectionProvider) {
- ((IPostSelectionProvider) selectionProvider)
- .removePostSelectionChangedListener(postListener);
+ ((IPostSelectionProvider) selectionProvider).removePostSelectionChangedListener(postListener);
} else {
selectionProvider.removeSelectionChangedListener(postListener);
}
@@ -287,9 +283,8 @@ public abstract class CompatibilityPart implements ISelectionChangedListener {
}
/**
- * Returns whether this part is being disposed. This is used for
- * invalidating this part so that it is not returned when a method expects a
- * "working" part.
+ * Returns whether this part is being disposed. This is used for invalidating
+ * this part so that it is not returned when a method expects a "working" part.
* <p>
* See bug 308492.
* </p>
@@ -387,8 +382,7 @@ public abstract class CompatibilityPart implements ISelectionChangedListener {
if (wrapped.getTitleImage() != null) {
Image newImage = wrapped.getTitleImage();
- part.getTransientData().put(IPresentationEngine.OVERRIDE_ICON_IMAGE_KEY,
- newImage);
+ part.getTransientData().put(IPresentationEngine.OVERRIDE_ICON_IMAGE_KEY, newImage);
}
String titleToolTip = wrapped.getTitleToolTip();
if (titleToolTip != null) {
@@ -429,8 +423,8 @@ public abstract class CompatibilityPart implements ISelectionChangedListener {
}
/**
- * Disposes of the 3.x part's site if it has one. Subclasses may override
- * but must call <code>super.disposeSite()</code> in its implementation.
+ * Disposes of the 3.x part's site if it has one. Subclasses may override but
+ * must call <code>super.disposeSite()</code> in its implementation.
*/
private void internalDisposeSite(IWorkbenchPartSite site) {
if (site instanceof PartSite) {
@@ -439,8 +433,8 @@ public abstract class CompatibilityPart implements ISelectionChangedListener {
}
/**
- * Disposes of the 3.x part's site if it has one. Subclasses may override
- * but must call <code>super.disposeSite()</code> in its implementation.
+ * Disposes of the 3.x part's site if it has one. Subclasses may override but
+ * must call <code>super.disposeSite()</code> in its implementation.
*/
void disposeSite(PartSite site) {
site.dispose();
@@ -454,10 +448,10 @@ public abstract class CompatibilityPart implements ISelectionChangedListener {
void doSave() {
ISaveablePart saveable = SaveableHelper.getSaveable(wrapped);
if (saveable != null) {
- SaveableHelper.savePart(saveable, wrapped, getReference().getSite()
- .getWorkbenchWindow(), false);
+ SaveableHelper.savePart(saveable, wrapped, getReference().getSite().getWorkbenchWindow(), false);
}
- // ContextInjectionFactory.invoke(wrapped, Persist.class, part.getContext(), null);
+ // ContextInjectionFactory.invoke(wrapped, Persist.class, part.getContext(),
+ // null);
}
public IWorkbenchPart getPart() {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/CompatibilityView.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/CompatibilityView.java
index bb3118cfff5..600c8d969af 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/CompatibilityView.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/CompatibilityView.java
@@ -156,8 +156,8 @@ public class CompatibilityView extends CompatibilityPart {
ViewDescriptor desc = reference.getDescriptor();
if (desc != null && desc.getPluginId() != null) {
- parent.setData(new ContributionInfo(desc.getPluginId(),
- ContributionInfoMessages.ContributionInfo_View, null));
+ parent.setData(
+ new ContributionInfo(desc.getPluginId(), ContributionInfoMessages.ContributionInfo_View, null));
}
// dispose the tb, it will be re-created when the tab is shown
@@ -196,8 +196,7 @@ public class CompatibilityView extends CompatibilityPart {
IAction action = actionDescriptor.getAction();
if (action != null && action.getActionDefinitionId() != null) {
- hs.activateHandler(action.getActionDefinitionId(),
- new ActionHandler(action));
+ hs.activateHandler(action.getActionDefinitionId(), new ActionHandler(action));
}
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/E4Util.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/E4Util.java
index 08d1ee790b5..05b21758614 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/E4Util.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/E4Util.java
@@ -23,7 +23,7 @@ import org.eclipse.ui.internal.WorkbenchPlugin;
public class E4Util {
// debug tracing
- private static final String OPTION_DEBUG_E4 = "org.eclipse.ui.workbench/debug/e4"; //$NON-NLS-1$;
+ private static final String OPTION_DEBUG_E4 = "org.eclipse.ui.workbench/debug/e4"; //$NON-NLS-1$ ;
public static final boolean DEBUG_E4;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ModeledFolderLayout.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ModeledFolderLayout.java
index 8e692aacc51..37035bbf8f4 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ModeledFolderLayout.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ModeledFolderLayout.java
@@ -21,19 +21,15 @@ import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
import org.eclipse.e4.ui.model.application.ui.basic.MStackElement;
import org.eclipse.ui.IFolderLayout;
-public class ModeledFolderLayout extends ModeledPlaceholderFolderLayout
- implements IFolderLayout {
- public ModeledFolderLayout(ModeledPageLayout layout, MApplication application,
- MPartStack stackModel) {
+public class ModeledFolderLayout extends ModeledPlaceholderFolderLayout implements IFolderLayout {
+ public ModeledFolderLayout(ModeledPageLayout layout, MApplication application, MPartStack stackModel) {
super(layout, application, stackModel);
}
@Override
public void addView(String viewId) {
- MStackElement viewModel = ModeledPageLayout.createViewModel(application, viewId, true,
- layout.page,
- layout.partService,
- layout.createReferences);
+ MStackElement viewModel = ModeledPageLayout.createViewModel(application, viewId, true, layout.page,
+ layout.partService, layout.createReferences);
if (viewModel != null) {
// adding a non-placeholder to this folder, make sure the folder
// will be rendered
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ModeledPageLayout.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ModeledPageLayout.java
index f60989f899f..dfb4a180482 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ModeledPageLayout.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ModeledPageLayout.java
@@ -124,10 +124,8 @@ public class ModeledPageLayout implements IPageLayout {
}
}
- public ModeledPageLayout(MWindow window, EModelService modelService,
- EPartService partService,
- MPerspective perspModel, IPerspectiveDescriptor descriptor, WorkbenchPage page,
- boolean createReferences) {
+ public ModeledPageLayout(MWindow window, EModelService modelService, EPartService partService,
+ MPerspective perspModel, IPerspectiveDescriptor descriptor, WorkbenchPage page, boolean createReferences) {
// this.window = window;
MUIElement winParent = window.getParent();
this.application = (MApplication) winParent;
@@ -221,8 +219,7 @@ public class ModeledPageLayout implements IPageLayout {
}
@Override
- public void addPlaceholder(String viewId, int relationship, float ratio,
- String refId) {
+ public void addPlaceholder(String viewId, int relationship, float ratio, String refId) {
insertView(viewId, relationship, ratio, refId, false, true);
}
@@ -237,8 +234,7 @@ public class ModeledPageLayout implements IPageLayout {
}
@Override
- public void addStandaloneView(String viewId, boolean showTitle,
- int relationship, float ratio, String refId) {
+ public void addStandaloneView(String viewId, boolean showTitle, int relationship, float ratio, String refId) {
MUIElement newElement = insertView(viewId, relationship, ratio, refId, true, showTitle);
if (newElement instanceof MPartStack) {
MPartStack stack = (MPartStack) newElement;
@@ -250,8 +246,8 @@ public class ModeledPageLayout implements IPageLayout {
}
@Override
- public void addStandaloneViewPlaceholder(String viewId, int relationship,
- float ratio, String refId, boolean showTitle) {
+ public void addStandaloneViewPlaceholder(String viewId, int relationship, float ratio, String refId,
+ boolean showTitle) {
MUIElement newElement = insertView(viewId, relationship, ratio, refId, false, showTitle);
if (newElement instanceof MPartStack) {
MPartStack stack = (MPartStack) newElement;
@@ -267,8 +263,7 @@ public class ModeledPageLayout implements IPageLayout {
insertView(viewId, relationship, ratio, refId, true, true);
}
- public void addView(String viewId, int relationship, float ratio, String refId,
- boolean minimized) {
+ public void addView(String viewId, int relationship, float ratio, String refId, boolean minimized) {
if (minimized) {
E4Util.unsupported("addView: use of minimized for " + viewId + " ref " + refId); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -285,27 +280,23 @@ public class ModeledPageLayout implements IPageLayout {
}
protected void addViewActivator(MUIElement element) {
- IPluginContribution contribution = (IPluginContribution) viewRegistry.find(element
- .getElementId());
+ IPluginContribution contribution = (IPluginContribution) viewRegistry.find(element.getElementId());
IWorkbenchActivitySupport support = PlatformUI.getWorkbench().getActivitySupport();
- IIdentifier identifier = support.getActivityManager().getIdentifier(
- WorkbenchActivityHelper.createUnifiedId(contribution));
+ IIdentifier identifier = support.getActivityManager()
+ .getIdentifier(WorkbenchActivityHelper.createUnifiedId(contribution));
identifier.addIdentifierListener(new ViewActivator(element));
}
@Override
- public IFolderLayout createFolder(String folderId, int relationship,
- float ratio, String refId) {
- MPartStack stack = insertStack(folderId, relationship, ratio, refId,
- false);
+ public IFolderLayout createFolder(String folderId, int relationship, float ratio, String refId) {
+ MPartStack stack = insertStack(folderId, relationship, ratio, refId, false);
return new ModeledFolderLayout(this, application, stack);
}
@Override
- public IPlaceholderFolderLayout createPlaceholderFolder(String folderId,
- int relationship, float ratio, String refId) {
- MPartStack Stack = insertStack(folderId, relationship, ratio, refId,
- false);
+ public IPlaceholderFolderLayout createPlaceholderFolder(String folderId, int relationship, float ratio,
+ String refId) {
+ MPartStack Stack = insertStack(folderId, relationship, ratio, refId, false);
return new ModeledPlaceholderFolderLayout(this, application, Stack);
}
@@ -379,8 +370,7 @@ public class ModeledPageLayout implements IPageLayout {
// perspModel.setFixed(isFixed);
}
- public static MStackElement createViewModel(MApplication application, String id,
- boolean visible,
+ public static MStackElement createViewModel(MApplication application, String id, boolean visible,
WorkbenchPage page, EPartService partService, boolean createReferences) {
EModelService ms = application.getContext().get(EModelService.class);
MPartDescriptor partDesc = ms.getPartDescriptor(id);
@@ -397,10 +387,8 @@ public class ModeledPageLayout implements IPageLayout {
// there should only be view references for 3.x views that are
// visible to the end user, that is, the tab items are being
// drawn
- if (visible
- && createReferences
- && CompatibilityPart.COMPATIBILITY_VIEW_URI.equals(partDesc
- .getContributionURI())) {
+ if (visible && createReferences
+ && CompatibilityPart.COMPATIBILITY_VIEW_URI.equals(partDesc.getContributionURI())) {
page.createViewReferenceForPart(part, id);
}
return ph;
@@ -408,22 +396,20 @@ public class ModeledPageLayout implements IPageLayout {
return null;
}
- private MUIElement insertView(String viewId, int relationship, float ratio,
- String refId, boolean visible, boolean withStack) {
+ private MUIElement insertView(String viewId, int relationship, float ratio, String refId, boolean visible,
+ boolean withStack) {
// Hide views that are filtered by capabilities
boolean isFiltered = isViewFiltered(viewId);
- MStackElement viewModel = createViewModel(application, viewId, visible && !isFiltered,
- page, partService,
+ MStackElement viewModel = createViewModel(application, viewId, visible && !isFiltered, page, partService,
createReferences);
MUIElement retVal = viewModel;
if (viewModel != null) {
if (withStack) {
String stackId = viewId + "MStack"; // Default id...basically unusable //$NON-NLS-1$
- MPartStack stack = insertStack(stackId, relationship, ratio, refId, visible
- & !isFiltered);
+ MPartStack stack = insertStack(stackId, relationship, ratio, refId, visible & !isFiltered);
stack.getChildren().add(viewModel);
retVal = stack;
} else {
@@ -458,8 +444,7 @@ public class ModeledPageLayout implements IPageLayout {
if (element instanceof MElementContainer<?>) {
MElementContainer<?> container = (MElementContainer<?>) element;
List<?> children = container.getChildren();
- return children.isEmpty() ? container : getLastElement((MUIElement) children
- .get(children.size() - 1));
+ return children.isEmpty() ? container : getLastElement((MUIElement) children.get(children.size() - 1));
}
MUIElement parent = element.getParent();
@@ -467,14 +452,14 @@ public class ModeledPageLayout implements IPageLayout {
}
/**
- * Returns the element that is the deepest and last element of the
- * containers underneath the current perspective. If this element's parent
- * is the perspective itself, the element will be returned. The perspective
- * will only be returned if the perspective itself has no children.
+ * Returns the element that is the deepest and last element of the containers
+ * underneath the current perspective. If this element's parent is the
+ * perspective itself, the element will be returned. The perspective will only
+ * be returned if the perspective itself has no children.
*
- * @return the parent of the final element in the recursion chain of
- * children, or the element itself if its parent is the perspective,
- * or the perspective if the perspective itself has no children
+ * @return the parent of the final element in the recursion chain of children,
+ * or the element itself if its parent is the perspective, or the
+ * perspective if the perspective itself has no children
*/
private MUIElement getLastElement() {
List<MPartSashContainerElement> children = perspModel.getChildren();
@@ -484,8 +469,7 @@ public class ModeledPageLayout implements IPageLayout {
return getLastElement(children.get(children.size() - 1));
}
- private MPartStack insertStack(String stackId, int relationship,
- float ratio, String refId, boolean visible) {
+ private MPartStack insertStack(String stackId, int relationship, float ratio, String refId, boolean visible) {
MUIElement refModel = findElement(perspModel, refId);
if (refModel == null) {
WorkbenchPlugin.log(NLS.bind(WorkbenchMessages.PageLayout_missingRefPart, refId));
@@ -518,8 +502,7 @@ public class ModeledPageLayout implements IPageLayout {
return stack;
}
- public static void replace(MUIElement relTo,
- MElementContainer<MUIElement> newParent) {
+ public static void replace(MUIElement relTo, MElementContainer<MUIElement> newParent) {
if (relTo == null || newParent == null)
return;
@@ -535,8 +518,7 @@ public class ModeledPageLayout implements IPageLayout {
kids.remove(relTo);
}
- public static void insertParent(MElementContainer<MUIElement> newParent,
- MUIElement relTo) {
+ public static void insertParent(MElementContainer<MUIElement> newParent, MUIElement relTo) {
if (newParent == null || relTo == null)
return;
@@ -550,8 +532,7 @@ public class ModeledPageLayout implements IPageLayout {
}
MUIElement findElement(MUIElement toSearch, String id) {
- List<Object> found = modelService.findElements(toSearch, id, null, null,
- EModelService.IN_ANY_PERSPECTIVE);
+ List<Object> found = modelService.findElements(toSearch, id, null, null, EModelService.IN_ANY_PERSPECTIVE);
if (found.size() > 0)
return (MUIElement) found.get(0);
@@ -594,8 +575,7 @@ public class ModeledPageLayout implements IPageLayout {
}
public void stackView(String id, String refId, boolean visible) {
- MUIElement refModel = refId.equals(getEditorArea()) ? editorStack : findElement(perspModel,
- refId);
+ MUIElement refModel = refId.equals(getEditorArea()) ? editorStack : findElement(perspModel, refId);
if (refModel == null && visible) {
addView(id, LEFT, DEFAULT_VIEW_RATIO, refId);
return;
@@ -613,8 +593,7 @@ public class ModeledPageLayout implements IPageLayout {
boolean isFiltered = isViewFiltered(id);
boolean toBeRendered = visible && !isFiltered;
- MStackElement viewModel = createViewModel(application, id, toBeRendered, page, partService,
- createReferences);
+ MStackElement viewModel = createViewModel(application, id, toBeRendered, page, partService, createReferences);
if (viewModel != null) {
MPartStack stack = (MPartStack) refModel;
boolean wasEmpty = stack.getChildren().isEmpty();
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ModeledPlaceholderFolderLayout.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ModeledPlaceholderFolderLayout.java
index da20d32309e..679f9f5578d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ModeledPlaceholderFolderLayout.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ModeledPlaceholderFolderLayout.java
@@ -28,8 +28,7 @@ public class ModeledPlaceholderFolderLayout implements IPlaceholderFolderLayout
protected ModeledPageLayout layout;
protected IViewRegistry viewRegistry;
- public ModeledPlaceholderFolderLayout(ModeledPageLayout l, MApplication application,
- MPartStack stackModel) {
+ public ModeledPlaceholderFolderLayout(ModeledPageLayout l, MApplication application, MPartStack stackModel) {
this.application = application;
this.viewRegistry = PlatformUI.getWorkbench().getViewRegistry();
folderModel = stackModel;
@@ -44,8 +43,8 @@ public class ModeledPlaceholderFolderLayout implements IPlaceholderFolderLayout
return;
}
- MStackElement viewModel = ModeledPageLayout.createViewModel(application, viewId, false,
- layout.page, layout.partService, layout.createReferences);
+ MStackElement viewModel = ModeledPageLayout.createViewModel(application, viewId, false, layout.page,
+ layout.partService, layout.createReferences);
if (viewModel != null) {
folderModel.getChildren().add(viewModel);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/SelectionService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/SelectionService.java
index cac246de942..54d1c4b3393 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/SelectionService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/SelectionService.java
@@ -64,13 +64,17 @@ public class SelectionService implements ISelectionChangedListener, ISelectionSe
private Map<String, Set<ISelectionListener>> targetedListeners = new HashMap<>();
private Map<String, Set<ISelectionListener>> targetedPostSelectionListeners = new HashMap<>();
- private org.eclipse.e4.ui.workbench.modeling.ISelectionListener listener = (part, selection) -> handleSelectionChanged(part, selection, false);
+ private org.eclipse.e4.ui.workbench.modeling.ISelectionListener listener = (part,
+ selection) -> handleSelectionChanged(part, selection, false);
- private org.eclipse.e4.ui.workbench.modeling.ISelectionListener targetedListener = (part, selection) -> handleSelectionChanged(part, selection, true);
+ private org.eclipse.e4.ui.workbench.modeling.ISelectionListener targetedListener = (part,
+ selection) -> handleSelectionChanged(part, selection, true);
- private org.eclipse.e4.ui.workbench.modeling.ISelectionListener postListener = (part, selection) -> handlePostSelectionChanged(part, selection, false);
+ private org.eclipse.e4.ui.workbench.modeling.ISelectionListener postListener = (part,
+ selection) -> handlePostSelectionChanged(part, selection, false);
- private org.eclipse.e4.ui.workbench.modeling.ISelectionListener targetedPostListener = (part, selection) -> handlePostSelectionChanged(part, selection, true);
+ private org.eclipse.e4.ui.workbench.modeling.ISelectionListener targetedPostListener = (part,
+ selection) -> handlePostSelectionChanged(part, selection, true);
private void handleSelectionChanged(MPart part, Object selection, boolean targeted) {
selection = createCompatibilitySelection(selection);
@@ -85,8 +89,7 @@ public class SelectionService implements ISelectionChangedListener, ISelectionSe
if (client instanceof CompatibilityPart) {
IWorkbenchPart workbenchPart = ((CompatibilityPart) client).getPart();
if (targeted) {
- notifyListeners(workbenchPart, (ISelection) selection, part.getElementId(),
- targetedListeners);
+ notifyListeners(workbenchPart, (ISelection) selection, part.getElementId(), targetedListeners);
} else {
notifyListeners(workbenchPart, (ISelection) selection, listeners);
}
@@ -133,16 +136,13 @@ public class SelectionService implements ISelectionChangedListener, ISelectionSe
if (selection instanceof ISelection) {
return (ISelection) selection;
}
- return selection == null ? StructuredSelection.EMPTY : new StructuredSelection(
- selection);
+ return selection == null ? StructuredSelection.EMPTY : new StructuredSelection(selection);
}
/**
- * Updates the selection of the workbench window with that of the active
- * part's.
+ * Updates the selection of the workbench window with that of the active part's.
*
- * @param activePart
- * the currently active part
+ * @param activePart the currently active part
*/
public void updateSelection(IWorkbenchPart activePart) {
if (activePart != null) {
@@ -163,8 +163,7 @@ public class SelectionService implements ISelectionChangedListener, ISelectionSe
* Notifies selection listeners about selection change caused by active part
* change.
*
- * @param activePart
- * the currently active part
+ * @param activePart the currently active part
*/
public void notifyListeners(IWorkbenchPart activePart) {
if (activePart != null) {
@@ -190,8 +189,7 @@ public class SelectionService implements ISelectionChangedListener, ISelectionSe
activePart = workbenchPart;
} else if (client != null) {
if (part.getTransientData().get(E4PartWrapper.E4_WRAPPER_KEY) instanceof E4PartWrapper) {
- activePart = (IWorkbenchPart) part.getTransientData().get(
- E4PartWrapper.E4_WRAPPER_KEY);
+ activePart = (IWorkbenchPart) part.getTransientData().get(E4PartWrapper.E4_WRAPPER_KEY);
}
}
}
@@ -223,7 +221,7 @@ public class SelectionService implements ISelectionChangedListener, ISelectionSe
}
this.selectionService = selectionService;
}
- }
+ }
@PreDestroy
public void dispose() {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/migration/PerspectiveBuilder.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/migration/PerspectiveBuilder.java
index 1b0480510f5..7cf6fc3f9d2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/migration/PerspectiveBuilder.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/migration/PerspectiveBuilder.java
@@ -253,7 +253,8 @@ public class PerspectiveBuilder {
private void hideEmptyStacks() {
for (MPartStack stack : modelService.findElements(perspective, null, MPartStack.class)) {
- if (ID_EDITOR_AREA.equals(stack.getElementId()) || ID_EDITOR_AREA.equals(stack.getParent().getElementId())) {
+ if (ID_EDITOR_AREA.equals(stack.getElementId())
+ || ID_EDITOR_AREA.equals(stack.getParent().getElementId())) {
continue;
}
if (!hasRenderableContent(stack)) {
@@ -628,11 +629,11 @@ public class PerspectiveBuilder {
private static IExtension[] getPerspectiveExtensions() {
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(PlatformUI.PLUGIN_ID,
IWorkbenchRegistryConstants.PL_PERSPECTIVE_EXTENSIONS);
- if (point == null) {
+ if (point == null) {
return null;
}
IExtension[] extensions = point.getExtensions();
- extensions = RegistryReader.orderExtensions(extensions);
+ extensions = RegistryReader.orderExtensions(extensions);
return extensions;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/migration/PerspectiveReader.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/migration/PerspectiveReader.java
index 90bbc8e4fff..7fd23c35162 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/migration/PerspectiveReader.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/migration/PerspectiveReader.java
@@ -117,8 +117,7 @@ public class PerspectiveReader extends MementoReader {
Map<String, Integer> getFastViewBars() {
Map<String, Integer> bars = new HashMap<>();
for (IMemento bar : getFastViewBarMems()) {
- bars.put(bar.getString(IWorkbenchConstants.TAG_ID),
- bar.getInteger(IWorkbenchConstants.TAG_FAST_VIEW_SIDE));
+ bars.put(bar.getString(IWorkbenchConstants.TAG_ID), bar.getInteger(IWorkbenchConstants.TAG_FAST_VIEW_SIDE));
}
return bars;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/migration/WindowBuilder.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/migration/WindowBuilder.java
index 1c3d1940ecb..319cf9b9efb 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/migration/WindowBuilder.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/migration/WindowBuilder.java
@@ -176,8 +176,7 @@ public class WindowBuilder {
if (activePerspectiveId != null) {
for (MPerspective persp : perspectiveStack.getChildren()) {
String id = persp.getElementId();
- String originalId = (String) persp.getTransientData().get(
- PerspectiveBuilder.ORIGINAL_ID);
+ String originalId = (String) persp.getTransientData().get(PerspectiveBuilder.ORIGINAL_ID);
if (originalId != null) {
id = originalId;
}
@@ -380,8 +379,7 @@ public class WindowBuilder {
}
private MPerspectiveStack createPerspectiveStack() {
- MPerspectiveStack perspStack = modelService
- .createModelElement(MPerspectiveStack.class);
+ MPerspectiveStack perspStack = modelService.createModelElement(MPerspectiveStack.class);
perspStack.setElementId("PerspectiveStack"); //$NON-NLS-1$
return perspStack;
}
@@ -403,15 +401,12 @@ public class WindowBuilder {
}
}
/*
- * if (part == null) { part =
- * modelService.createModelElement(MPart.class); part.setElementId(id);
+ * if (part == null) { part = modelService.createModelElement(MPart.class);
+ * part.setElementId(id);
* part.setContributionURI(CompatibilityPart.COMPATIBILITY_VIEW_URI);
- * part.getTags().add(ViewRegistry.VIEW_TAG); sharedElements.add(part);
- * }
+ * part.getTags().add(ViewRegistry.VIEW_TAG); sharedElements.add(part); }
*/
return part;
}
-
-
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/migration/WindowReader.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/migration/WindowReader.java
index 385f850275d..8bd9a516b8e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/migration/WindowReader.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/migration/WindowReader.java
@@ -122,8 +122,7 @@ public class WindowReader extends MementoReader {
List<PerspectiveReader> perspectives = new ArrayList<>();
IMemento perspContainer = getPerspectiveContainer();
if (perspContainer != null) {
- IMemento[] perspectiveMems = perspContainer
- .getChildren(IWorkbenchConstants.TAG_PERSPECTIVE);
+ IMemento[] perspectiveMems = perspContainer.getChildren(IWorkbenchConstants.TAG_PERSPECTIVE);
for (IMemento perspectiveMem : perspectiveMems) {
PerspectiveReader perspective = new PerspectiveReader(perspectiveMem);
perspectives.add(perspective);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/migration/WorkbenchMigrationProcessor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/migration/WorkbenchMigrationProcessor.java
index d7302fd6eda..a036f117b5f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/migration/WorkbenchMigrationProcessor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/migration/WorkbenchMigrationProcessor.java
@@ -93,8 +93,8 @@ public class WorkbenchMigrationProcessor {
IModelBuilderFactory builderFactory = ContextInjectionFactory.make(ModelBuilderFactoryImpl.class,
builderContext);
builderContext.set(IModelBuilderFactory.class, builderFactory);
- ApplicationBuilder modelBuilder = builderFactory.createApplicationBuilder(new WorkbenchMementoReader(
- workbenchMemento));
+ ApplicationBuilder modelBuilder = builderFactory
+ .createApplicationBuilder(new WorkbenchMementoReader(workbenchMemento));
modelBuilder.createApplication();
context.remove(E4Workbench.NO_SAVED_MODEL_FOUND);
PrefUtil.getAPIPreferenceStore().setValue(IWorkbenchPreferenceConstants.SHOW_INTRO, false);
@@ -104,7 +104,7 @@ public class WorkbenchMigrationProcessor {
private IMemento loadMemento() {
IMemento memento = null;
try (BufferedReader reader = new BufferedReader(
- new InputStreamReader(new FileInputStream(legacyWorkbenchFile), StandardCharsets.UTF_8))){
+ new InputStreamReader(new FileInputStream(legacyWorkbenchFile), StandardCharsets.UTF_8))) {
memento = XMLMemento.createReadRoot(reader);
} catch (IOException | WorkbenchException e) {
WorkbenchPlugin.log("Failed to load " + legacyWorkbenchFile.getAbsolutePath(), e); //$NON-NLS-1$
@@ -176,8 +176,8 @@ public class WorkbenchMigrationProcessor {
}
private void removeStickyViewFromPerspectives(IStickyViewDescriptor stickyView, MWindow window) {
- for (MPlaceholder placeholder : modelService.findElements(window, stickyView.getId(),
- MPlaceholder.class, null)) {
+ for (MPlaceholder placeholder : modelService.findElements(window, stickyView.getId(), MPlaceholder.class,
+ null)) {
MElementContainer<MUIElement> parent = placeholder.getParent();
if (StickyViewDescriptor.STICKY_FOLDER_RIGHT.equals(parent.getElementId())) {
continue;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/ActivePartExpression.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/ActivePartExpression.java
index 82bfc3cc683..3d604c46952 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/ActivePartExpression.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/ActivePartExpression.java
@@ -37,8 +37,7 @@ public final class ActivePartExpression extends Expression {
/**
* The seed for the hash code for all schemes.
*/
- private static final int HASH_INITIAL = ActivePartExpression.class
- .getName().hashCode();
+ private static final int HASH_INITIAL = ActivePartExpression.class.getName().hashCode();
/**
* The part that must be active for this expression to evaluate to
@@ -49,9 +48,8 @@ public final class ActivePartExpression extends Expression {
/**
* Constructs a new instance of <code>ActivePartExpression</code>
*
- * @param activePart
- * The part to match with the active part; may be
- * <code>null</code>
+ * @param activePart The part to match with the active part; may be
+ * <code>null</code>
*/
public ActivePartExpression(final IWorkbenchPart activePart) {
if (activePart == null) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/AlwaysEnabledExpression.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/AlwaysEnabledExpression.java
index dd6f32780e8..813fc0ce68d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/AlwaysEnabledExpression.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/AlwaysEnabledExpression.java
@@ -29,7 +29,6 @@ public final class AlwaysEnabledExpression extends Expression {
public static final AlwaysEnabledExpression INSTANCE = new AlwaysEnabledExpression();
-
/**
* Not to be instantiated
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/AndExpression.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/AndExpression.java
index 1977e364fe3..7c8c1c615fe 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/AndExpression.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/AndExpression.java
@@ -25,8 +25,7 @@ public final class AndExpression extends CompositeExpression {
/**
* The seed for the hash code for all schemes.
*/
- private static final int HASH_INITIAL = AndExpression.class.getName()
- .hashCode();
+ private static final int HASH_INITIAL = AndExpression.class.getName().hashCode();
@Override
protected int computeHashCode() {
@@ -44,8 +43,7 @@ public final class AndExpression extends CompositeExpression {
}
@Override
- public EvaluationResult evaluate(final IEvaluationContext context)
- throws CoreException {
+ public EvaluationResult evaluate(final IEvaluationContext context) throws CoreException {
return evaluateAnd(context);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/CompositeExpression.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/CompositeExpression.java
index c87c4881d9f..fdd5d7b9881 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/CompositeExpression.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/CompositeExpression.java
@@ -43,12 +43,10 @@ public abstract class CompositeExpression extends Expression {
if (fExpressions == null) {
return EMPTY_ARRAY;
}
- return (Expression[]) fExpressions.toArray(new Expression[fExpressions
- .size()]);
+ return (Expression[]) fExpressions.toArray(new Expression[fExpressions.size()]);
}
- protected EvaluationResult evaluateAnd(IEvaluationContext scope)
- throws CoreException {
+ protected EvaluationResult evaluateAnd(IEvaluationContext scope) throws CoreException {
if (fExpressions == null) {
return EvaluationResult.TRUE;
}
@@ -65,8 +63,7 @@ public abstract class CompositeExpression extends Expression {
return result;
}
- protected EvaluationResult evaluateOr(IEvaluationContext scope)
- throws CoreException {
+ protected EvaluationResult evaluateOr(IEvaluationContext scope) throws CoreException {
if (fExpressions == null) {
return EvaluationResult.TRUE;
}
@@ -105,4 +102,3 @@ public abstract class CompositeExpression extends Expression {
}
}
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/LegacyActionExpressionWrapper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/LegacyActionExpressionWrapper.java
index 3919750d765..d114d85c02e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/LegacyActionExpressionWrapper.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/LegacyActionExpressionWrapper.java
@@ -36,14 +36,12 @@ import org.eclipse.ui.internal.ActionExpression;
*
* @since 3.2
*/
-public final class LegacyActionExpressionWrapper extends
- WorkbenchWindowExpression {
+public final class LegacyActionExpressionWrapper extends WorkbenchWindowExpression {
/**
* The seed for the hash code for all schemes.
*/
- private static final int HASH_INITIAL = LegacyActionExpressionWrapper.class
- .getName().hashCode();
+ private static final int HASH_INITIAL = LegacyActionExpressionWrapper.class.getName().hashCode();
/**
* The legacy action expression being wrapped; never <code>null</code>.
@@ -53,20 +51,16 @@ public final class LegacyActionExpressionWrapper extends
/**
* Constructs a new instance of {@link LegacyActionExpressionWrapper}.
*
- * @param expression
- * The expression to wrap; must not be <code>null</code>.
- * @param window
- * The workbench window which must be active for this expression
- * to evaluate to <code>true</code>; may be <code>null</code>
- * if the window should be disregarded.
+ * @param expression The expression to wrap; must not be <code>null</code>.
+ * @param window The workbench window which must be active for this
+ * expression to evaluate to <code>true</code>; may be
+ * <code>null</code> if the window should be disregarded.
*/
- public LegacyActionExpressionWrapper(final ActionExpression expression,
- final IWorkbenchWindow window) {
+ public LegacyActionExpressionWrapper(final ActionExpression expression, final IWorkbenchWindow window) {
super(window);
if (expression == null) {
- throw new NullPointerException(
- "The action expression cannot be null"); //$NON-NLS-1$
+ throw new NullPointerException("The action expression cannot be null"); //$NON-NLS-1$
}
this.expression = expression;
}
@@ -88,23 +82,20 @@ public final class LegacyActionExpressionWrapper extends
public boolean equals(final Object object) {
if (object instanceof LegacyActionExpressionWrapper) {
final LegacyActionExpressionWrapper that = (LegacyActionExpressionWrapper) object;
- return equals(this.expression, that.expression)
- && equals(this.getWindow(), that.getWindow());
+ return equals(this.expression, that.expression) && equals(this.getWindow(), that.getWindow());
}
return false;
}
@Override
- public EvaluationResult evaluate(final IEvaluationContext context)
- throws CoreException {
+ public EvaluationResult evaluate(final IEvaluationContext context) throws CoreException {
final EvaluationResult result = super.evaluate(context);
if (result == EvaluationResult.FALSE) {
return result;
}
- final Object defaultVariable = context
- .getVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME);
+ final Object defaultVariable = context.getVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME);
if (defaultVariable instanceof IStructuredSelection) {
final IStructuredSelection selection = (IStructuredSelection) defaultVariable;
if (expression.isEnabledFor(selection)) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/LegacyActionSetExpression.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/LegacyActionSetExpression.java
index 39f22e8b82a..436d08b2f1e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/LegacyActionSetExpression.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/LegacyActionSetExpression.java
@@ -38,34 +38,28 @@ public final class LegacyActionSetExpression extends WorkbenchWindowExpression {
/**
* The seed for the hash code for all schemes.
*/
- private static final int HASH_INITIAL = LegacyActionSetExpression.class
- .getName().hashCode();
+ private static final int HASH_INITIAL = LegacyActionSetExpression.class.getName().hashCode();
/**
- * The identifier of the action set that must be active for this expression
- * to evaluate to <code>true</code>. This value is never
- * <code>null</code>.
+ * The identifier of the action set that must be active for this expression to
+ * evaluate to <code>true</code>. This value is never <code>null</code>.
*/
private final String actionSetId;
/**
* Constructs a new instance of {@link LegacyActionSetExpression}.
*
- * @param actionSetId
- * The identifier of the action set that must be active for this
- * expression to evaluate to <code>true</code>; must not be
- * <code>null</code>.
- * @param window
- * The workbench window in which this handler should be active.
- * This avoids conflicts between handlers from different windows.
- * This should not be <code>null</code>.
+ * @param actionSetId The identifier of the action set that must be active for
+ * this expression to evaluate to <code>true</code>; must not
+ * be <code>null</code>.
+ * @param window The workbench window in which this handler should be
+ * active. This avoids conflicts between handlers from
+ * different windows. This should not be <code>null</code>.
*/
- public LegacyActionSetExpression(final String actionSetId,
- final IWorkbenchWindow window) {
+ public LegacyActionSetExpression(final String actionSetId, final IWorkbenchWindow window) {
super(window);
if (actionSetId == null) {
- throw new NullPointerException(
- "The action set identifier cannot be null"); //$NON-NLS-1$
+ throw new NullPointerException("The action set identifier cannot be null"); //$NON-NLS-1$
}
this.actionSetId = actionSetId;
}
@@ -86,16 +80,14 @@ public final class LegacyActionSetExpression extends WorkbenchWindowExpression {
public boolean equals(final Object object) {
if (object instanceof LegacyActionSetExpression) {
final LegacyActionSetExpression that = (LegacyActionSetExpression) object;
- return equals(this.actionSetId, that.actionSetId)
- && equals(this.getWindow(), that.getWindow());
+ return equals(this.actionSetId, that.actionSetId) && equals(this.getWindow(), that.getWindow());
}
return false;
}
@Override
- public EvaluationResult evaluate(final IEvaluationContext context)
- throws CoreException {
+ public EvaluationResult evaluate(final IEvaluationContext context) throws CoreException {
final EvaluationResult result = super.evaluate(context);
if (result == EvaluationResult.FALSE) {
return result;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/LegacyEditorActionBarExpression.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/LegacyEditorActionBarExpression.java
index b347cb9a4c8..a2ab67afb21 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/LegacyEditorActionBarExpression.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/LegacyEditorActionBarExpression.java
@@ -37,8 +37,7 @@ public class LegacyEditorActionBarExpression extends Expression {
/**
* The seed for the hash code for all schemes.
*/
- private static final int HASH_INITIAL = LegacyEditorActionBarExpression.class
- .getName().hashCode();
+ private static final int HASH_INITIAL = LegacyEditorActionBarExpression.class.getName().hashCode();
/**
* The identifier for the editor that must be active for this expression to
@@ -49,15 +48,13 @@ public class LegacyEditorActionBarExpression extends Expression {
/**
* Constructs a new instance of <code>LegacyEditorActionBarExpression</code>
*
- * @param editorId
- * The identifier of the editor to match with the active editor;
- * must not be <code>null</code>
+ * @param editorId The identifier of the editor to match with the active editor;
+ * must not be <code>null</code>
*/
public LegacyEditorActionBarExpression(final String editorId) {
if (editorId == null) {
- throw new IllegalArgumentException(
- "The targetId for an editor contribution must not be null"); //$NON-NLS-1$
+ throw new IllegalArgumentException("The targetId for an editor contribution must not be null"); //$NON-NLS-1$
}
activeEditorId = editorId;
}
@@ -65,8 +62,7 @@ public class LegacyEditorActionBarExpression extends Expression {
@Override
public final void collectExpressionInfo(final ExpressionInfo info) {
info.addVariableNameAccess(ISources.ACTIVE_PART_ID_NAME);
- info
- .addVariableNameAccess(SourcePriorityNameMapping.LEGACY_LEGACY_NAME);
+ info.addVariableNameAccess(SourcePriorityNameMapping.LEGACY_LEGACY_NAME);
}
@Override
@@ -87,8 +83,7 @@ public class LegacyEditorActionBarExpression extends Expression {
@Override
public final EvaluationResult evaluate(final IEvaluationContext context) {
- final Object variable = context
- .getVariable(ISources.ACTIVE_PART_ID_NAME);
+ final Object variable = context.getVariable(ISources.ACTIVE_PART_ID_NAME);
if (equals(activeEditorId, variable)) {
return EvaluationResult.TRUE;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/LegacyEditorContributionExpression.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/LegacyEditorContributionExpression.java
index 8c3e5db36ac..bbc2268f753 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/LegacyEditorContributionExpression.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/LegacyEditorContributionExpression.java
@@ -33,14 +33,12 @@ import org.eclipse.ui.IWorkbenchWindow;
*
* @since 3.2
*/
-public final class LegacyEditorContributionExpression extends
- WorkbenchWindowExpression {
+public final class LegacyEditorContributionExpression extends WorkbenchWindowExpression {
/**
* The seed for the hash code for all schemes.
*/
- private static final int HASH_INITIAL = LegacyEditorContributionExpression.class
- .getName().hashCode();
+ private static final int HASH_INITIAL = LegacyEditorContributionExpression.class.getName().hashCode();
/**
* The identifier for the editor that must be active for this expression to
@@ -49,23 +47,18 @@ public final class LegacyEditorContributionExpression extends
private final String activeEditorId;
/**
- * Constructs a new instance of
- * <code>LegacyEditorContributionExpression</code>
+ * Constructs a new instance of <code>LegacyEditorContributionExpression</code>
*
- * @param activeEditorId
- * The identifier of the editor to match with the active editor;
- * may be <code>null</code>
- * @param window
- * The workbench window in which this handler should be active.
- * This value is never <code>null</code>.
+ * @param activeEditorId The identifier of the editor to match with the active
+ * editor; may be <code>null</code>
+ * @param window The workbench window in which this handler should be
+ * active. This value is never <code>null</code>.
*/
- public LegacyEditorContributionExpression(final String activeEditorId,
- final IWorkbenchWindow window) {
+ public LegacyEditorContributionExpression(final String activeEditorId, final IWorkbenchWindow window) {
super(window);
if (activeEditorId == null) {
- throw new NullPointerException(
- "The targetId for an editor contribution must not be null"); //$NON-NLS-1$
+ throw new NullPointerException("The targetId for an editor contribution must not be null"); //$NON-NLS-1$
}
this.activeEditorId = activeEditorId;
}
@@ -87,23 +80,20 @@ public final class LegacyEditorContributionExpression extends
public boolean equals(final Object object) {
if (object instanceof LegacyEditorContributionExpression) {
final LegacyEditorContributionExpression that = (LegacyEditorContributionExpression) object;
- return equals(this.activeEditorId, that.activeEditorId)
- && equals(this.getWindow(), that.getWindow());
+ return equals(this.activeEditorId, that.activeEditorId) && equals(this.getWindow(), that.getWindow());
}
return false;
}
@Override
- public EvaluationResult evaluate(final IEvaluationContext context)
- throws CoreException {
+ public EvaluationResult evaluate(final IEvaluationContext context) throws CoreException {
final EvaluationResult result = super.evaluate(context);
if (result == EvaluationResult.FALSE) {
return result;
}
- final Object variable = context
- .getVariable(ISources.ACTIVE_PART_ID_NAME);
+ final Object variable = context.getVariable(ISources.ACTIVE_PART_ID_NAME);
if (equals(activeEditorId, variable)) {
return EvaluationResult.TRUE;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/LegacySelectionEnablerWrapper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/LegacySelectionEnablerWrapper.java
index 9df42c4a9bd..66b5a5309f0 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/LegacySelectionEnablerWrapper.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/LegacySelectionEnablerWrapper.java
@@ -36,14 +36,12 @@ import org.eclipse.ui.SelectionEnabler;
*
* @since 3.2
*/
-public final class LegacySelectionEnablerWrapper extends
- WorkbenchWindowExpression {
+public final class LegacySelectionEnablerWrapper extends WorkbenchWindowExpression {
/**
* The seed for the hash code for all schemes.
*/
- private static final int HASH_INITIAL = LegacySelectionEnablerWrapper.class
- .getName().hashCode();
+ private static final int HASH_INITIAL = LegacySelectionEnablerWrapper.class.getName().hashCode();
/**
* The enabler for this expression; never <code>null</code>.
@@ -53,15 +51,12 @@ public final class LegacySelectionEnablerWrapper extends
/**
* Constructs a new instance of <code>SelectionEnablerExpression</code>.
*
- * @param enabler
- * The enabler; must not be <code>null</code>.
- * @param window
- * The workbench window which must be active for this expression
- * to evaluate to <code>true</code>; may be <code>null</code>
- * if the window should be disregarded.
+ * @param enabler The enabler; must not be <code>null</code>.
+ * @param window The workbench window which must be active for this expression
+ * to evaluate to <code>true</code>; may be <code>null</code> if
+ * the window should be disregarded.
*/
- public LegacySelectionEnablerWrapper(final SelectionEnabler enabler,
- final IWorkbenchWindow window) {
+ public LegacySelectionEnablerWrapper(final SelectionEnabler enabler, final IWorkbenchWindow window) {
super(window);
if (enabler == null) {
@@ -87,23 +82,20 @@ public final class LegacySelectionEnablerWrapper extends
public boolean equals(final Object object) {
if (object instanceof LegacySelectionEnablerWrapper) {
final LegacySelectionEnablerWrapper that = (LegacySelectionEnablerWrapper) object;
- return equals(this.enabler, that.enabler)
- && equals(this.getWindow(), that.getWindow());
+ return equals(this.enabler, that.enabler) && equals(this.getWindow(), that.getWindow());
}
return false;
}
@Override
- public EvaluationResult evaluate(final IEvaluationContext context)
- throws CoreException {
+ public EvaluationResult evaluate(final IEvaluationContext context) throws CoreException {
final EvaluationResult result = super.evaluate(context);
if (result == EvaluationResult.FALSE) {
return result;
}
- final Object defaultVariable = context
- .getVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME);
+ final Object defaultVariable = context.getVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME);
if (defaultVariable instanceof ISelection) {
final ISelection selection = (ISelection) defaultVariable;
if (enabler.isEnabledForSelection(selection)) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/LegacyViewContributionExpression.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/LegacyViewContributionExpression.java
index 8ea568ff1ea..2debb62ab92 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/LegacyViewContributionExpression.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/LegacyViewContributionExpression.java
@@ -33,14 +33,12 @@ import org.eclipse.ui.IWorkbenchWindow;
*
* @since 3.2
*/
-public final class LegacyViewContributionExpression extends
- WorkbenchWindowExpression {
+public final class LegacyViewContributionExpression extends WorkbenchWindowExpression {
/**
* The seed for the hash code for all schemes.
*/
- private static final int HASH_INITIAL = LegacyViewContributionExpression.class
- .getName().hashCode();
+ private static final int HASH_INITIAL = LegacyViewContributionExpression.class.getName().hashCode();
/**
* The identifier for the part that must be active for this expression to
@@ -49,23 +47,18 @@ public final class LegacyViewContributionExpression extends
private final String activePartId;
/**
- * Constructs a new instance of
- * <code>LegacyViewContributionExpression</code>
+ * Constructs a new instance of <code>LegacyViewContributionExpression</code>
*
- * @param activePartId
- * The identifier of the part to match with the active part; may
- * be <code>null</code>
- * @param window
- * The workbench window in which this handler should be active.
- * This value is never <code>null</code>.
+ * @param activePartId The identifier of the part to match with the active part;
+ * may be <code>null</code>
+ * @param window The workbench window in which this handler should be
+ * active. This value is never <code>null</code>.
*/
- public LegacyViewContributionExpression(final String activePartId,
- final IWorkbenchWindow window) {
+ public LegacyViewContributionExpression(final String activePartId, final IWorkbenchWindow window) {
super(window);
if (activePartId == null) {
- throw new NullPointerException(
- "The targetId for a view contribution must not be null"); //$NON-NLS-1$
+ throw new NullPointerException("The targetId for a view contribution must not be null"); //$NON-NLS-1$
}
this.activePartId = activePartId;
}
@@ -87,23 +80,20 @@ public final class LegacyViewContributionExpression extends
public boolean equals(final Object object) {
if (object instanceof LegacyViewContributionExpression) {
final LegacyViewContributionExpression that = (LegacyViewContributionExpression) object;
- return equals(this.activePartId, that.activePartId)
- && equals(this.getWindow(), that.getWindow());
+ return equals(this.activePartId, that.activePartId) && equals(this.getWindow(), that.getWindow());
}
return false;
}
@Override
- public EvaluationResult evaluate(final IEvaluationContext context)
- throws CoreException {
+ public EvaluationResult evaluate(final IEvaluationContext context) throws CoreException {
final EvaluationResult result = super.evaluate(context);
if (result == EvaluationResult.FALSE) {
return result;
}
- final Object variable = context
- .getVariable(ISources.ACTIVE_PART_ID_NAME);
+ final Object variable = context.getVariable(ISources.ACTIVE_PART_ID_NAME);
if (equals(activePartId, variable)) {
return EvaluationResult.TRUE;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/LegacyViewerContributionExpression.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/LegacyViewerContributionExpression.java
index 87530aa8250..71dc503f52c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/LegacyViewerContributionExpression.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/LegacyViewerContributionExpression.java
@@ -39,14 +39,12 @@ import org.eclipse.ui.IWorkbenchWindow;
* @see ISources#ACTIVE_MENU_NAME
* @since 3.2
*/
-public final class LegacyViewerContributionExpression extends
- WorkbenchWindowExpression {
+public final class LegacyViewerContributionExpression extends WorkbenchWindowExpression {
/**
* The seed for the hash code for all schemes.
*/
- private static final int HASH_INITIAL = LegacyViewerContributionExpression.class
- .getName().hashCode();
+ private static final int HASH_INITIAL = LegacyViewerContributionExpression.class.getName().hashCode();
/**
* The child expression for this viewer contribution. This value may be
@@ -55,27 +53,24 @@ public final class LegacyViewerContributionExpression extends
private final Expression expression;
/**
- * The identifier of the menu to which this viewer contribution applies.
- * This value is never <code>null</code>.
+ * The identifier of the menu to which this viewer contribution applies. This
+ * value is never <code>null</code>.
*/
private final String targetId;
/**
* Constructs a new {@link LegacyViewerContributionExpression}.
*
- * @param targetId
- * The identifier of the menu to which this viewer contribution
- * applies; never <code>null</code>.
- * @param window
- * The workbench window which must be active for this expression
- * to evaluate to <code>true</code>; may be <code>null</code>
- * if the window should be disregarded.
- * @param childExpression
- * The child expression for this viewer contribution; may be
- * <code>null</code>.
+ * @param targetId The identifier of the menu to which this viewer
+ * contribution applies; never <code>null</code>.
+ * @param window The workbench window which must be active for this
+ * expression to evaluate to <code>true</code>; may be
+ * <code>null</code> if the window should be disregarded.
+ * @param childExpression The child expression for this viewer contribution; may
+ * be <code>null</code>.
*/
- public LegacyViewerContributionExpression(final String targetId,
- final IWorkbenchWindow window, final Expression childExpression) {
+ public LegacyViewerContributionExpression(final String targetId, final IWorkbenchWindow window,
+ final Expression childExpression) {
super(window);
if (targetId == null) {
@@ -106,8 +101,7 @@ public final class LegacyViewerContributionExpression extends
public boolean equals(final Object object) {
if (object instanceof LegacyViewerContributionExpression) {
final LegacyViewerContributionExpression that = (LegacyViewerContributionExpression) object;
- return equals(this.targetId, that.targetId)
- && equals(this.expression, that.expression)
+ return equals(this.targetId, that.targetId) && equals(this.expression, that.expression)
&& equals(this.getWindow(), that.getWindow());
}
@@ -115,8 +109,7 @@ public final class LegacyViewerContributionExpression extends
}
@Override
- public EvaluationResult evaluate(final IEvaluationContext context)
- throws CoreException {
+ public EvaluationResult evaluate(final IEvaluationContext context) throws CoreException {
final EvaluationResult result = super.evaluate(context);
if (result == EvaluationResult.FALSE) {
return result;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/WorkbenchWindowExpression.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/WorkbenchWindowExpression.java
index 5bda75a220c..01d7ef93d92 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/WorkbenchWindowExpression.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/expressions/WorkbenchWindowExpression.java
@@ -35,23 +35,21 @@ public class WorkbenchWindowExpression extends Expression {
/**
* The seed for the hash code for all schemes.
*/
- private static final int HASH_INITIAL = WorkbenchWindowExpression.class
- .getName().hashCode();
+ private static final int HASH_INITIAL = WorkbenchWindowExpression.class.getName().hashCode();
/**
- * The workbench window that must be active for this expression to evaluate
- * to <code>true</code>. If this value is <code>null</code>, then any
- * workbench window may be active.
+ * The workbench window that must be active for this expression to evaluate to
+ * <code>true</code>. If this value is <code>null</code>, then any workbench
+ * window may be active.
*/
private final IWorkbenchWindow window;
/**
* Constructs a new instance.
*
- * @param window
- * The workbench window which must be active for this expression
- * to evaluate to <code>true</code>; may be <code>null</code>
- * if this expression is always <code>true</code>.
+ * @param window The workbench window which must be active for this expression
+ * to evaluate to <code>true</code>; may be <code>null</code> if
+ * this expression is always <code>true</code>.
*/
public WorkbenchWindowExpression(final IWorkbenchWindow window) {
this.window = window;
@@ -80,11 +78,9 @@ public class WorkbenchWindowExpression extends Expression {
}
@Override
- public EvaluationResult evaluate(final IEvaluationContext context)
- throws CoreException {
+ public EvaluationResult evaluate(final IEvaluationContext context) throws CoreException {
if (window != null) {
- Object value = context
- .getVariable(ISources.ACTIVE_WORKBENCH_WINDOW_NAME);
+ Object value = context.getVariable(ISources.ACTIVE_WORKBENCH_WINDOW_NAME);
if (window.equals(value)) {
return EvaluationResult.TRUE;
}
@@ -112,4 +108,3 @@ public class WorkbenchWindowExpression extends Expression {
return buffer.toString();
}
}
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ActionCommandMappingService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ActionCommandMappingService.java
index c48d8cd2c87..366334346ea 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ActionCommandMappingService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ActionCommandMappingService.java
@@ -32,20 +32,18 @@ import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants;
*
* @since 3.2
*/
-public final class ActionCommandMappingService implements
- IActionCommandMappingService {
+public final class ActionCommandMappingService implements IActionCommandMappingService {
/**
- * The map of action identifiers ({@link String}) to command identifiers ({@link String}).
- * This value is never <code>null</code>.
+ * The map of action identifiers ({@link String}) to command identifiers
+ * ({@link String}). This value is never <code>null</code>.
*/
private final Map mapping = new HashMap();
@Override
public String getCommandId(final String actionId) {
if (actionId == null) {
- throw new NullPointerException(
- "Cannot get the command identifier for a null action id"); //$NON-NLS-1$
+ throw new NullPointerException("Cannot get the command identifier for a null action id"); //$NON-NLS-1$
}
return (String) mapping.get(actionId);
@@ -66,7 +64,6 @@ public final class ActionCommandMappingService implements
@Override
public String getGeneratedCommandId(String targetId, String actionId) {
- return IWorkbenchRegistryConstants.AUTOGENERATED_PREFIX + targetId
- + '/' + actionId;
+ return IWorkbenchRegistryConstants.AUTOGENERATED_PREFIX + targetId + '/' + actionId;
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ActionDelegateHandlerProxy.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ActionDelegateHandlerProxy.java
index c1ca4f8ef23..c490c7ff77c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ActionDelegateHandlerProxy.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ActionDelegateHandlerProxy.java
@@ -71,13 +71,12 @@ import org.eclipse.ui.internal.util.BundleUtility;
*
* @since 3.2
*/
-public final class ActionDelegateHandlerProxy implements ISelectionListener,
- ISelectionChangedListener, INullSelectionListener, IHandler2,
- IObjectWithState, IPartListener2 {
+public final class ActionDelegateHandlerProxy implements ISelectionListener, ISelectionChangedListener,
+ INullSelectionListener, IHandler2, IObjectWithState, IPartListener2 {
/**
- * The fake action that proxies all of the command-based services. This
- * value is never <code>null</code>.
+ * The fake action that proxies all of the command-based services. This value is
+ * never <code>null</code>.
*/
private CommandLegacyActionWrapper action;
@@ -88,8 +87,8 @@ public final class ActionDelegateHandlerProxy implements ISelectionListener,
private String actionId;
/**
- * The command that will back the dummy actions exposed to this delegate.
- * This value is never <code>null</code>.
+ * The command that will back the dummy actions exposed to this delegate. This
+ * value is never <code>null</code>.
*/
private ParameterizedCommand command;
@@ -121,98 +120,86 @@ public final class ActionDelegateHandlerProxy implements ISelectionListener,
private String delegateAttributeName;
/**
- * The configuration element from which the handler can be created. This
- * value will exist until the element is converted into a real class -- at
- * which point this value will be set to <code>null</code>.
+ * The configuration element from which the handler can be created. This value
+ * will exist until the element is converted into a real class -- at which point
+ * this value will be set to <code>null</code>.
*/
private IConfigurationElement element;
/**
* The <code>enabledWhen</code> expression for the handler. Only if this
- * expression evaluates to <code>true</code> (or the value is
- * <code>null</code>) should we consult the handler.
+ * expression evaluates to <code>true</code> (or the value is <code>null</code>)
+ * should we consult the handler.
*/
private final Expression enabledWhenExpression;
/**
- * A collection of objects listening to changes to this manager. This
- * collection is <code>null</code> if there are no listeners.
+ * A collection of objects listening to changes to this manager. This collection
+ * is <code>null</code> if there are no listeners.
*/
private transient ListenerList<IHandlerListener> listenerList = null;
/**
* The image style to use when selecting the images to display for this
- * delegate. This value may be <code>null</code>, if the default style
- * should be used.
+ * delegate. This value may be <code>null</code>, if the default style should be
+ * used.
*/
private final String style;
/**
- * The identifier of the view with which this delegate must be associated.
- * This value is not <code>null</code> iff the delegate is an
+ * The identifier of the view with which this delegate must be associated. This
+ * value is not <code>null</code> iff the delegate is an
* {@link IViewActionDelegate}.
*/
private final String viewId;
/**
- * The workbench window in which this delegate is active. This value is
- * never <code>null</code>.
+ * The workbench window in which this delegate is active. This value is never
+ * <code>null</code>.
*/
private final IWorkbenchWindow window;
/**
- * Constructs a new instance of <code>ActionDelegateHandlerProxy</code>
- * with all the information it needs to try to avoid loading until it is
- * needed.
+ * Constructs a new instance of <code>ActionDelegateHandlerProxy</code> with all
+ * the information it needs to try to avoid loading until it is needed.
*
- * @param element
- * The configuration element from which the real class can be
- * loaded at run-time; must not be <code>null</code>.
- * @param delegateAttributeName
- * The name of the attibute or element containing the action
- * delegate; must not be <code>null</code>.
- * @param actionId
- * The identifier of the underlying action; may be
- * <code>null</code>.
- * @param command
- * The command with which the action delegate will be associated;
- * must not be <code>null</code>.
- * @param window
- * The workbench window in which this delegate will be active;
- * must not be <code>null</code>.
- * @param style
- * The image style with which the icons are associated; may be
- * <code>null</code>.
- * @param enabledWhenExpression
- * The name of the element containing the enabledWhen expression.
- * This should be a child of the
- * <code>configurationElement</code>. If this value is
- * <code>null</code>, then there is no enablement expression
- * (i.e., enablement will be delegated to the handler when
- * possible).
- * @param viewId
- * The identifier of the view to which this proxy is bound; may
- * be <code>null</code> if this proxy is not for an
- * {@link IViewActionDelegate}.
+ * @param element The configuration element from which the real
+ * class can be loaded at run-time; must not be
+ * <code>null</code>.
+ * @param delegateAttributeName The name of the attibute or element containing
+ * the action delegate; must not be
+ * <code>null</code>.
+ * @param actionId The identifier of the underlying action; may be
+ * <code>null</code>.
+ * @param command The command with which the action delegate will
+ * be associated; must not be <code>null</code>.
+ * @param window The workbench window in which this delegate will
+ * be active; must not be <code>null</code>.
+ * @param style The image style with which the icons are
+ * associated; may be <code>null</code>.
+ * @param enabledWhenExpression The name of the element containing the
+ * enabledWhen expression. This should be a child
+ * of the <code>configurationElement</code>. If
+ * this value is <code>null</code>, then there is
+ * no enablement expression (i.e., enablement will
+ * be delegated to the handler when possible).
+ * @param viewId The identifier of the view to which this proxy
+ * is bound; may be <code>null</code> if this proxy
+ * is not for an {@link IViewActionDelegate}.
*/
- public ActionDelegateHandlerProxy(final IConfigurationElement element,
- final String delegateAttributeName, final String actionId,
- final ParameterizedCommand command, final IWorkbenchWindow window,
- final String style, final Expression enabledWhenExpression,
- final String viewId) {
+ public ActionDelegateHandlerProxy(final IConfigurationElement element, final String delegateAttributeName,
+ final String actionId, final ParameterizedCommand command, final IWorkbenchWindow window,
+ final String style, final Expression enabledWhenExpression, final String viewId) {
if (element == null) {
- throw new NullPointerException(
- "The configuration element backing a handler proxy cannot be null"); //$NON-NLS-1$
+ throw new NullPointerException("The configuration element backing a handler proxy cannot be null"); //$NON-NLS-1$
}
if (delegateAttributeName == null) {
- throw new NullPointerException(
- "The attribute containing the action delegate must be known"); //$NON-NLS-1$
+ throw new NullPointerException("The attribute containing the action delegate must be known"); //$NON-NLS-1$
}
if (window == null) {
- throw new NullPointerException(
- "The workbench window for a delegate must not be null"); //$NON-NLS-1$
+ throw new NullPointerException("The workbench window for a delegate must not be null"); //$NON-NLS-1$
}
this.element = element;
@@ -238,7 +225,6 @@ public final class ActionDelegateHandlerProxy implements ISelectionListener,
public void addState(String id, State state) {
}
-
@Override
public void dispose() {
stopPartListening();
@@ -283,20 +269,17 @@ public final class ActionDelegateHandlerProxy implements ISelectionListener,
updateDelegate(action, context);
}
- if ((action.getStyle() == IAction.AS_CHECK_BOX)
- || (action.getStyle() == IAction.AS_RADIO_BUTTON)) {
+ if ((action.getStyle() == IAction.AS_CHECK_BOX) || (action.getStyle() == IAction.AS_RADIO_BUTTON)) {
action.setChecked(!action.isChecked());
}
// Decide what type of delegate we have.
- if ((delegate instanceof IActionDelegate2)
- && (trigger instanceof Event)) {
+ if ((delegate instanceof IActionDelegate2) && (trigger instanceof Event)) {
// This supports Eclipse 2.1 to Eclipse 3.1.
final IActionDelegate2 delegate2 = (IActionDelegate2) delegate;
final Event triggeringEvent = (Event) trigger;
delegate2.runWithEvent(action, triggeringEvent);
- } else if ((delegate instanceof IActionDelegateWithEvent)
- && (trigger instanceof Event)) {
+ } else if ((delegate instanceof IActionDelegateWithEvent) && (trigger instanceof Event)) {
// This supports Eclipse 2.0
final IActionDelegateWithEvent delegateWithEvent = (IActionDelegateWithEvent) delegate;
final Event triggeringEvent = (Event) trigger;
@@ -313,8 +296,7 @@ public final class ActionDelegateHandlerProxy implements ISelectionListener,
* @param action
* @param context
*/
- private void updateDelegate(final IAction action,
- final IEvaluationContext context) {
+ private void updateDelegate(final IAction action, final IEvaluationContext context) {
if (action == null) {
return;
}
@@ -325,23 +307,18 @@ public final class ActionDelegateHandlerProxy implements ISelectionListener,
}
if (editorDelegate != null) {
- final Object activeEditor = context
- .getVariable(ISources.ACTIVE_EDITOR_NAME);
+ final Object activeEditor = context.getVariable(ISources.ACTIVE_EDITOR_NAME);
if (activeEditor != IEvaluationContext.UNDEFINED_VARIABLE) {
- editorDelegate.setActiveEditor(action,
- (IEditorPart) activeEditor);
+ editorDelegate.setActiveEditor(action, (IEditorPart) activeEditor);
}
- updateActivePart(activeEditor==IEvaluationContext.UNDEFINED_VARIABLE
- ?null:(IWorkbenchPart)activeEditor);
+ updateActivePart(
+ activeEditor == IEvaluationContext.UNDEFINED_VARIABLE ? null : (IWorkbenchPart) activeEditor);
} else if (objectDelegate != null) {
- final Object activePart = context
- .getVariable(ISources.ACTIVE_PART_NAME);
+ final Object activePart = context.getVariable(ISources.ACTIVE_PART_NAME);
if (activePart != IEvaluationContext.UNDEFINED_VARIABLE) {
- objectDelegate.setActivePart(action,
- (IWorkbenchPart) activePart);
+ objectDelegate.setActivePart(action, (IWorkbenchPart) activePart);
}
- updateActivePart(activePart==IEvaluationContext.UNDEFINED_VARIABLE
- ?null:(IWorkbenchPart) activePart);
+ updateActivePart(activePart == IEvaluationContext.UNDEFINED_VARIABLE ? null : (IWorkbenchPart) activePart);
}
final Object selectionObject = getCurrentSelection(context);
@@ -368,7 +345,7 @@ public final class ActionDelegateHandlerProxy implements ISelectionListener,
} else {
selectionChanged(StructuredSelection.EMPTY);
disposeDelegate();
- if (action!=null) {
+ if (action != null) {
action.setEnabled(true);
}
}
@@ -389,29 +366,26 @@ public final class ActionDelegateHandlerProxy implements ISelectionListener,
* @return
*/
private Object getCurrentSelection(final IEvaluationContext context) {
- Object obj = context
- .getVariable(ISources.ACTIVE_MENU_EDITOR_INPUT_NAME);
+ Object obj = context.getVariable(ISources.ACTIVE_MENU_EDITOR_INPUT_NAME);
if (obj == null || obj == IEvaluationContext.UNDEFINED_VARIABLE) {
obj = context.getVariable(ISources.ACTIVE_MENU_SELECTION_NAME);
if (obj == null || obj == IEvaluationContext.UNDEFINED_VARIABLE) {
- obj = context
- .getVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME);
+ obj = context.getVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME);
}
}
return obj;
}
/**
- * Retrieves the action corresponding to the currently active workbench
- * window, if any.
+ * Retrieves the action corresponding to the currently active workbench window,
+ * if any.
*
- * @return The current action; <code>null</code> if there is no currently
- * active workbench window.
+ * @return The current action; <code>null</code> if there is no currently active
+ * workbench window.
*/
public CommandLegacyActionWrapper getAction() {
if (action == null) {
- action = new CommandLegacyActionWrapper(actionId, command, style,
- window);
+ action = new CommandLegacyActionWrapper(actionId, command, style, window);
action.addPropertyChangeListener(event -> {
// TODO Update the state somehow.
});
@@ -490,8 +464,7 @@ public final class ActionDelegateHandlerProxy implements ISelectionListener,
} else if (editorDelegate != null) {
editorDelegate.setActiveEditor(action, activeEditor);
updateActivePart(activeEditor);
- } else if ((viewId != null) && (page != null)
- && (viewDelegate != null)) {
+ } else if ((viewId != null) && (page != null) && (viewDelegate != null)) {
final IViewPart viewPart = page.findView(viewId);
viewDelegate.init(viewPart);
} else if (windowDelegate != null) {
@@ -513,8 +486,7 @@ public final class ActionDelegateHandlerProxy implements ISelectionListener,
final CommandLegacyActionWrapper action = getAction();
if (enabledWhenExpression != null) {
try {
- final EvaluationResult result = enabledWhenExpression
- .evaluate(context);
+ final EvaluationResult result = enabledWhenExpression.evaluate(context);
if (action != null) {
action.setEnabled(result != EvaluationResult.FALSE);
}
@@ -528,8 +500,7 @@ public final class ActionDelegateHandlerProxy implements ISelectionListener,
message.append(element.getAttribute(delegateAttributeName));
}
message.append("' could not be loaded"); //$NON-NLS-1$
- final IStatus status = new Status(IStatus.WARNING,
- WorkbenchPlugin.PI_WORKBENCH, 0, e.getMessage(), e);
+ final IStatus status = new Status(IStatus.WARNING, WorkbenchPlugin.PI_WORKBENCH, 0, e.getMessage(), e);
WorkbenchPlugin.log(message.toString(), status);
return;
}
@@ -548,11 +519,11 @@ public final class ActionDelegateHandlerProxy implements ISelectionListener,
}
/**
- * Checks if the declaring plugin has been loaded. This means that there
- * will be no need to delay creating the delegate.
+ * Checks if the declaring plugin has been loaded. This means that there will be
+ * no need to delay creating the delegate.
*
- * @return <code>true</code> if the bundle containing the delegate is
- * already loaded -- making it safe to load the delegate.
+ * @return <code>true</code> if the bundle containing the delegate is already
+ * loaded -- making it safe to load the delegate.
*/
private boolean isSafeToLoadDelegate() {
return false;
@@ -563,18 +534,18 @@ public final class ActionDelegateHandlerProxy implements ISelectionListener,
}
/**
- * Loads the delegate, if possible. If the delegate is loaded, then the
- * member variables are updated accordingly.
+ * Loads the delegate, if possible. If the delegate is loaded, then the member
+ * variables are updated accordingly.
*
- * @return <code>true</code> if the delegate is now non-null;
- * <code>false</code> otherwise.
+ * @return <code>true</code> if the delegate is now non-null; <code>false</code>
+ * otherwise.
*/
public boolean loadDelegate() {
// Try to load the delegate, if it hasn't been loaded already.
if (delegate == null) {
/*
- * If this is an IViewActionDelegate, then check to see if we have a
- * view ready yet. If not, then we'll have to wait.
+ * If this is an IViewActionDelegate, then check to see if we have a view ready
+ * yet. If not, then we'll have to wait.
*/
if (viewId != null) {
final IWorkbenchPage activePage = window.getActivePage();
@@ -590,10 +561,8 @@ public final class ActionDelegateHandlerProxy implements ISelectionListener,
// Load the delegate.
try {
- delegate = (IActionDelegate) element
- .createExecutableExtension(delegateAttributeName);
- String name = element.getDeclaringExtension()
- .getExtensionPointUniqueIdentifier();
+ delegate = (IActionDelegate) element.createExecutableExtension(delegateAttributeName);
+ String name = element.getDeclaringExtension().getExtensionPointUniqueIdentifier();
if ("org.eclipse.ui.actionSets".equals(name) //$NON-NLS-1$
&& delegate instanceof IWorkbenchWindowActionDelegate) {
windowDelegate = (IWorkbenchWindowActionDelegate) delegate;
@@ -604,16 +573,13 @@ public final class ActionDelegateHandlerProxy implements ISelectionListener,
&& delegate instanceof IViewActionDelegate) {
viewDelegate = (IViewActionDelegate) delegate;
} else if ("org.eclipse.ui.popupMenus".equals(name)) { //$NON-NLS-1$
- IConfigurationElement parent = (IConfigurationElement) element
- .getParent();
+ IConfigurationElement parent = (IConfigurationElement) element.getParent();
if ("objectContribution".equals(parent.getName()) //$NON-NLS-1$
&& delegate instanceof IObjectActionDelegate) {
objectDelegate = (IObjectActionDelegate) delegate;
- } else if (viewId == null
- && delegate instanceof IEditorActionDelegate) {
+ } else if (viewId == null && delegate instanceof IEditorActionDelegate) {
editorDelegate = (IEditorActionDelegate) delegate;
- } else if (viewId != null
- && delegate instanceof IViewActionDelegate) {
+ } else if (viewId != null && delegate instanceof IViewActionDelegate) {
viewDelegate = (IViewActionDelegate) delegate;
}
}
@@ -630,17 +596,14 @@ public final class ActionDelegateHandlerProxy implements ISelectionListener,
} catch (final ClassCastException e) {
final String message = "The proxied delegate was the wrong class"; //$NON-NLS-1$
- final IStatus status = new Status(IStatus.ERROR,
- WorkbenchPlugin.PI_WORKBENCH, 0, message, e);
+ final IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 0, message, e);
WorkbenchPlugin.log(message, status);
return false;
} catch (final CoreException e) {
final String message = "The proxied delegate for '" //$NON-NLS-1$
- + element.getAttribute(delegateAttributeName)
- + "' could not be loaded"; //$NON-NLS-1$
- IStatus status = new Status(IStatus.ERROR,
- WorkbenchPlugin.PI_WORKBENCH, 0, message, e);
+ + element.getAttribute(delegateAttributeName) + "' could not be loaded"; //$NON-NLS-1$
+ IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 0, message, e);
WorkbenchPlugin.log(message, status);
return false;
}
@@ -696,8 +659,7 @@ public final class ActionDelegateHandlerProxy implements ISelectionListener,
}
@Override
- public void selectionChanged(final IWorkbenchPart part,
- final ISelection selection) {
+ public void selectionChanged(final IWorkbenchPart part, final ISelection selection) {
selectionChanged(selection);
}
@@ -716,8 +678,7 @@ public final class ActionDelegateHandlerProxy implements ISelectionListener,
if (element != null) {
buffer.append(',');
try {
- final String className = element
- .getAttribute(delegateAttributeName);
+ final String className = element.getAttribute(delegateAttributeName);
buffer.append(className);
final String namespaceId = element.getNamespaceIdentifier();
buffer.append(" in ").append(namespaceId); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ActiveContextInfoHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ActiveContextInfoHandler.java
index e0aab75ba2e..542d3ee49e4 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ActiveContextInfoHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ActiveContextInfoHandler.java
@@ -27,8 +27,7 @@ public class ActiveContextInfoHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
final IWorkbenchPart part = HandlerUtil.getActivePartChecked(event);
- EContextService service = part.getSite()
- .getService(EContextService.class);
+ EContextService service = part.getSite().getService(EContextService.class);
for (String id : service.getActiveContextIds()) {
System.out.println("activeContext: " + id); //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ClosePerspectiveHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ClosePerspectiveHandler.java
index 436dc2d5063..a892f16d750 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ClosePerspectiveHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ClosePerspectiveHandler.java
@@ -27,23 +27,18 @@ import org.eclipse.ui.internal.e4.compatibility.E4Util;
public class ClosePerspectiveHandler extends AbstractHandler {
-
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- IWorkbenchWindow activeWorkbenchWindow = HandlerUtil
- .getActiveWorkbenchWindow(event);
+ IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);
if (activeWorkbenchWindow != null) {
- WorkbenchPage page = (WorkbenchPage) activeWorkbenchWindow
- .getActivePage();
+ WorkbenchPage page = (WorkbenchPage) activeWorkbenchWindow.getActivePage();
if (page != null) {
Map parameters = event.getParameters();
- String value = (String) parameters
- .get(IWorkbenchCommandConstants.WINDOW_CLOSE_PERSPECTIVE_PARM_ID);
+ String value = (String) parameters.get(IWorkbenchCommandConstants.WINDOW_CLOSE_PERSPECTIVE_PARM_ID);
if (value == null) {
page.closePerspective(page.getPerspective(), true, true);
} else {
- IPerspectiveDescriptor perspective = activeWorkbenchWindow
- .getWorkbench().getPerspectiveRegistry()
+ IPerspectiveDescriptor perspective = activeWorkbenchWindow.getWorkbench().getPerspectiveRegistry()
.findPerspectiveWithId(value);
if (perspective != null) {
page.closePerspective(perspective, true, true);
@@ -55,12 +50,11 @@ public class ClosePerspectiveHandler extends AbstractHandler {
}
/**
- * Closes the specified perspective. Nothing will happen if the given page
- * or perspective are <code>null</null>.
- * @param page
- * a reference to the page
- * @param persp
- * the perspective to close
+ * Closes the specified perspective. Nothing will happen if the given page or
+ * perspective are <code>null</null>.
+ *
+ * @param page a reference to the page
+ * @param persp the perspective to close
*/
public static void closePerspective(WorkbenchPage page, Object persp) {
// if (page != null && persp != null) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/CommandLegacyActionWrapper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/CommandLegacyActionWrapper.java
index 356239ba43f..11d887f3c7d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/CommandLegacyActionWrapper.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/CommandLegacyActionWrapper.java
@@ -55,9 +55,9 @@ import org.eclipse.ui.services.IServiceLocator;
* Clients may instantiate this class, but must not extend.
* </p>
* <p>
- * <strong>PROVISIONAL</strong>. This class or interface has been added as
- * part of a work in progress. There is a guarantee neither that this API will
- * work nor that it will remain the same. Please do not use this API without
+ * <strong>PROVISIONAL</strong>. This class or interface has been added as part
+ * of a work in progress. There is a guarantee neither that this API will work
+ * nor that it will remain the same. Please do not use this API without
* consulting with the Platform/UI team.
* </p>
* <p>
@@ -70,8 +70,8 @@ import org.eclipse.ui.services.IServiceLocator;
public final class CommandLegacyActionWrapper extends AbstractAction {
/**
- * Listens to changes to one or more commands, and forwards them out through
- * the property change event mechanism.
+ * Listens to changes to one or more commands, and forwards them out through the
+ * property change event mechanism.
*/
private final class CommandListener implements ICommandListener {
@Override
@@ -108,11 +108,9 @@ public final class CommandLegacyActionWrapper extends AbstractAction {
// Check if the handled property changed.
if (commandEvent.isHandledChanged()) {
if (baseCommand.isHandled()) {
- firePropertyChange(IAction.HANDLED, Boolean.FALSE,
- Boolean.TRUE);
+ firePropertyChange(IAction.HANDLED, Boolean.FALSE, Boolean.TRUE);
} else {
- firePropertyChange(IAction.HANDLED, Boolean.TRUE,
- Boolean.FALSE);
+ firePropertyChange(IAction.HANDLED, Boolean.TRUE, Boolean.FALSE);
}
}
}
@@ -125,8 +123,8 @@ public final class CommandLegacyActionWrapper extends AbstractAction {
private ParameterizedCommand command;
/**
- * Listens to changes in a command, and forwards them out through the
- * property change event mechanism.
+ * Listens to changes in a command, and forwards them out through the property
+ * change event mechanism.
*/
private final ICommandListener commandListener = new CommandListener();
@@ -147,37 +145,30 @@ public final class CommandLegacyActionWrapper extends AbstractAction {
private IServiceLocator serviceLocator;
/**
- * The image style to use for this action. This value may be
- * <code>null</code>.
+ * The image style to use for this action. This value may be <code>null</code>.
*/
private final String style;
/**
* Constructs a new instance of <code>ActionProxy</code>.
*
- * @param id
- * The initial action identifier; may be <code>null</code>.
- * @param command
- * The command with which this action is associated; must not be
- * <code>null</code>.
- * @param style
- * The image style to use for this action, may be
- * <code>null</code>.
- * @param serviceLocator
- * A service locator that can be used to find various
- * command-based services; must not be <code>null</code>.
+ * @param id The initial action identifier; may be
+ * <code>null</code>.
+ * @param command The command with which this action is associated; must
+ * not be <code>null</code>.
+ * @param style The image style to use for this action, may be
+ * <code>null</code>.
+ * @param serviceLocator A service locator that can be used to find various
+ * command-based services; must not be <code>null</code>.
*/
- public CommandLegacyActionWrapper(final String id,
- final ParameterizedCommand command, final String style,
+ public CommandLegacyActionWrapper(final String id, final ParameterizedCommand command, final String style,
final IServiceLocator serviceLocator) {
if (command == null) {
- throw new NullPointerException(
- "An action proxy can't be created without a command"); //$NON-NLS-1$
+ throw new NullPointerException("An action proxy can't be created without a command"); //$NON-NLS-1$
}
if (serviceLocator == null) {
- throw new NullPointerException(
- "An action proxy can't be created without a service locator"); //$NON-NLS-1$
+ throw new NullPointerException("An action proxy can't be created without a service locator"); //$NON-NLS-1$
}
this.command = command;
@@ -192,10 +183,8 @@ public final class CommandLegacyActionWrapper extends AbstractAction {
@Override
public int getAccelerator() {
final String commandId = getActionDefinitionId();
- final IBindingService bindingService = serviceLocator
- .getService(IBindingService.class);
- final TriggerSequence triggerSequence = bindingService
- .getBestActiveBindingFor(commandId);
+ final IBindingService bindingService = serviceLocator.getService(IBindingService.class);
+ final TriggerSequence triggerSequence = bindingService.getBestActiveBindingFor(commandId);
if (triggerSequence instanceof KeySequence) {
final KeySequence keySequence = (KeySequence) triggerSequence;
final KeyStroke[] keyStrokes = keySequence.getKeyStrokes();
@@ -225,10 +214,8 @@ public final class CommandLegacyActionWrapper extends AbstractAction {
@Override
public ImageDescriptor getDisabledImageDescriptor() {
final String commandId = getActionDefinitionId();
- final ICommandImageService commandImageService = serviceLocator
- .getService(ICommandImageService.class);
- return commandImageService.getImageDescriptor(commandId,
- CommandImageManager.TYPE_DISABLED, style);
+ final ICommandImageService commandImageService = serviceLocator.getService(ICommandImageService.class);
+ return commandImageService.getImageDescriptor(commandId, CommandImageManager.TYPE_DISABLED, style);
}
@Override
@@ -240,10 +227,8 @@ public final class CommandLegacyActionWrapper extends AbstractAction {
@Override
public ImageDescriptor getHoverImageDescriptor() {
final String commandId = getActionDefinitionId();
- final ICommandImageService commandImageService = serviceLocator
- .getService(ICommandImageService.class);
- return commandImageService.getImageDescriptor(commandId,
- CommandImageManager.TYPE_HOVER, style);
+ final ICommandImageService commandImageService = serviceLocator.getService(ICommandImageService.class);
+ return commandImageService.getImageDescriptor(commandId, CommandImageManager.TYPE_HOVER, style);
}
@Override
@@ -254,8 +239,7 @@ public final class CommandLegacyActionWrapper extends AbstractAction {
@Override
public ImageDescriptor getImageDescriptor() {
final String commandId = getActionDefinitionId();
- final ICommandImageService commandImageService = serviceLocator
- .getService(ICommandImageService.class);
+ final ICommandImageService commandImageService = serviceLocator.getService(ICommandImageService.class);
return commandImageService.getImageDescriptor(commandId, style);
}
@@ -309,16 +293,15 @@ public final class CommandLegacyActionWrapper extends AbstractAction {
}
/**
- * Whether this action's local <code>enabled</code> property is set. This
- * can be used by handlers that are trying to check if
- * {@link #setEnabled(boolean)} has been called. This is typically used by
- * legacy action proxies who are trying to avoid a <a
- * href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=117496">stack
+ * Whether this action's local <code>enabled</code> property is set. This can be
+ * used by handlers that are trying to check if {@link #setEnabled(boolean)} has
+ * been called. This is typically used by legacy action proxies who are trying
+ * to avoid a
+ * <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=117496">stack
* overflow</a>.
*
- * @return <code>false</code> if someone has called
- * {@link #setEnabled(boolean)} with <code>false</code>;
- * <code>true</code> otherwise.
+ * @return <code>false</code> if someone has called {@link #setEnabled(boolean)}
+ * with <code>false</code>; <code>true</code> otherwise.
*/
public boolean isEnabledDisregardingCommand() {
return enabled;
@@ -338,8 +321,8 @@ public final class CommandLegacyActionWrapper extends AbstractAction {
@Override
public void runWithEvent(final Event event) {
final Command baseCommand = command.getCommand();
- final ExecutionEvent executionEvent = new ExecutionEvent(command
- .getCommand(), command.getParameterMap(), event, null);
+ final ExecutionEvent executionEvent = new ExecutionEvent(command.getCommand(), command.getParameterMap(), event,
+ null);
try {
baseCommand.execute(executionEvent);
firePropertyChange(IAction.RESULT, null, Boolean.TRUE);
@@ -374,8 +357,7 @@ public final class CommandLegacyActionWrapper extends AbstractAction {
// Update the command.
final Command oldBaseCommand = command.getCommand();
oldBaseCommand.removeCommandListener(commandListener);
- final ICommandService commandService = serviceLocator
- .getService(ICommandService.class);
+ final ICommandService commandService = serviceLocator.getService(ICommandService.class);
final Command newBaseCommand = commandService.getCommand(id);
command = new ParameterizedCommand(newBaseCommand, null);
newBaseCommand.addCommandListener(commandListener);
@@ -400,10 +382,8 @@ public final class CommandLegacyActionWrapper extends AbstractAction {
}
if (!Objects.equals(oldDescription, newDescription)) {
- firePropertyChange(IAction.DESCRIPTION, oldDescription,
- newDescription);
- firePropertyChange(IAction.TOOL_TIP_TEXT, oldDescription,
- newDescription);
+ firePropertyChange(IAction.DESCRIPTION, oldDescription, newDescription);
+ firePropertyChange(IAction.TOOL_TIP_TEXT, oldDescription, newDescription);
}
if (newEnabled != oldEnabled) {
@@ -427,8 +407,7 @@ public final class CommandLegacyActionWrapper extends AbstractAction {
}
if (!Objects.equals(oldDisabledImage, newDisabledImage)) {
- firePropertyChange(IAction.IMAGE, oldDisabledImage,
- newDisabledImage);
+ firePropertyChange(IAction.IMAGE, oldDisabledImage, newDisabledImage);
}
if (!Objects.equals(oldHoverImage, newHoverImage)) {
@@ -457,8 +436,7 @@ public final class CommandLegacyActionWrapper extends AbstractAction {
@Override
public void setDescription(final String text) {
- final State state = command.getCommand().getState(
- INamedHandleStateIds.DESCRIPTION);
+ final State state = command.getCommand().getState(INamedHandleStateIds.DESCRIPTION);
if (state instanceof TextState) {
final String currentValue = (String) state.getValue();
if (!Objects.equals(text, currentValue)) {
@@ -471,19 +449,16 @@ public final class CommandLegacyActionWrapper extends AbstractAction {
public void setDisabledImageDescriptor(final ImageDescriptor newImage) {
final String commandId = getActionDefinitionId();
final int type = CommandImageManager.TYPE_DISABLED;
- final ICommandImageService commandImageService = serviceLocator
- .getService(ICommandImageService.class);
+ final ICommandImageService commandImageService = serviceLocator.getService(ICommandImageService.class);
if (commandImageService instanceof CommandImageService) {
- ((CommandImageService) commandImageService).bind(commandId, type,
- style, newImage);
+ ((CommandImageService) commandImageService).bind(commandId, type, style, newImage);
}
}
@Override
public void setEnabled(final boolean enabled) {
if (enabled != this.enabled) {
- final Boolean oldValue = this.enabled ? Boolean.TRUE
- : Boolean.FALSE;
+ final Boolean oldValue = this.enabled ? Boolean.TRUE : Boolean.FALSE;
final Boolean newValue = enabled ? Boolean.TRUE : Boolean.FALSE;
this.enabled = enabled;
firePropertyChange(ENABLED, oldValue, newValue);
@@ -500,11 +475,9 @@ public final class CommandLegacyActionWrapper extends AbstractAction {
public void setHoverImageDescriptor(final ImageDescriptor newImage) {
final String commandId = getActionDefinitionId();
final int type = CommandImageManager.TYPE_HOVER;
- final ICommandImageService commandImageService = serviceLocator
- .getService(ICommandImageService.class);
+ final ICommandImageService commandImageService = serviceLocator.getService(ICommandImageService.class);
if (commandImageService instanceof CommandImageService) {
- ((CommandImageService) commandImageService).bind(commandId, type,
- style, newImage);
+ ((CommandImageService) commandImageService).bind(commandId, type, style, newImage);
}
}
@@ -517,11 +490,9 @@ public final class CommandLegacyActionWrapper extends AbstractAction {
public void setImageDescriptor(final ImageDescriptor newImage) {
final String commandId = getActionDefinitionId();
final int type = CommandImageManager.TYPE_DEFAULT;
- final ICommandImageService commandImageService = serviceLocator
- .getService(ICommandImageService.class);
+ final ICommandImageService commandImageService = serviceLocator.getService(ICommandImageService.class);
if (commandImageService instanceof CommandImageService) {
- ((CommandImageService) commandImageService).bind(commandId, type,
- style, newImage);
+ ((CommandImageService) commandImageService).bind(commandId, type, style, newImage);
}
}
@@ -532,8 +503,7 @@ public final class CommandLegacyActionWrapper extends AbstractAction {
@Override
public void setText(final String text) {
- final State state = command.getCommand().getState(
- INamedHandleStateIds.NAME);
+ final State state = command.getCommand().getState(INamedHandleStateIds.NAME);
if (state instanceof TextState) {
final String currentValue = (String) state.getValue();
if (!Objects.equals(text, currentValue)) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ContextMenuHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ContextMenuHandler.java
index 001373184d4..455bd9aa313 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ContextMenuHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ContextMenuHandler.java
@@ -28,8 +28,7 @@ import org.eclipse.ui.handlers.HandlerUtil;
public class ContextMenuHandler extends AbstractHandler {
/**
- * @throws ExecutionException
- * {@inheritDoc}
+ * @throws ExecutionException {@inheritDoc}
*/
@Override
public Object execute(ExecutionEvent exEvent) throws ExecutionException {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/CyclePageHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/CyclePageHandler.java
index e03c81151ea..782687d16e3 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/CyclePageHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/CyclePageHandler.java
@@ -70,7 +70,7 @@ public class CyclePageHandler extends FilteredTableBaseHandler {
protected Object getInput(WorkbenchPage page) {
List<FilteredTableItem> rows = new ArrayList<>();
- for(int i=0; i<pageSwitcher.getPages().length; i++){
+ for (int i = 0; i < pageSwitcher.getPages().length; i++) {
Object viewPage = pageSwitcher.getPages()[i];
FilteredTableItem item = new FilteredTableItem();
ImageDescriptor imageDescriptor = pageSwitcher.getImageDescriptor(viewPage);
@@ -98,8 +98,7 @@ public class CyclePageHandler extends FilteredTableBaseHandler {
@Override
protected ParameterizedCommand getBackwardCommand() {
- final ICommandService commandService = window
- .getWorkbench().getService(ICommandService.class);
+ final ICommandService commandService = window.getWorkbench().getService(ICommandService.class);
final Command command = commandService.getCommand(IWorkbenchCommandConstants.NAVIGATE_PREVIOUS_PAGE);
ParameterizedCommand commandF = new ParameterizedCommand(command, null);
return commandF;
@@ -107,9 +106,8 @@ public class CyclePageHandler extends FilteredTableBaseHandler {
@Override
protected ParameterizedCommand getForwardCommand() {
- final ICommandService commandService = window
- .getWorkbench().getService(ICommandService.class);
- final Command command= commandService.getCommand(IWorkbenchCommandConstants.NAVIGATE_NEXT_PAGE);
+ final ICommandService commandService = window.getWorkbench().getService(ICommandService.class);
+ final Command command = commandService.getCommand(IWorkbenchCommandConstants.NAVIGATE_NEXT_PAGE);
ParameterizedCommand commandF = new ParameterizedCommand(command, null);
return commandF;
}
@@ -139,8 +137,7 @@ public class CyclePageHandler extends FilteredTableBaseHandler {
}
@Override
- protected void setDialogLocation(final Shell dialog,
- IWorkbenchPart activePart) {
+ protected void setDialogLocation(final Shell dialog, IWorkbenchPart activePart) {
if (dialog == null)
return;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/DisplayHelpHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/DisplayHelpHandler.java
index 63da79a2d6f..6303cf03a67 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/DisplayHelpHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/DisplayHelpHandler.java
@@ -33,8 +33,7 @@ public final class DisplayHelpHandler extends AbstractHandler {
@Override
public Object execute(final ExecutionEvent event) {
- final IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench()
- .getHelpSystem();
+ final IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
final String href = event.getParameter(PARAM_ID_HREF);
if (href == null) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/E4HandlerProxy.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/E4HandlerProxy.java
index 1ea8ea6186a..307be75ccbc 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/E4HandlerProxy.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/E4HandlerProxy.java
@@ -77,10 +77,9 @@ public class E4HandlerProxy implements IHandler2, IHandlerListener, IElementUpda
}
@Execute
- public Object execute(IEclipseContext context,
- @Optional @Named(HandlerServiceImpl.PARM_MAP) Map parms, @Optional Event trigger,
- @Optional IEvaluationContext staticContext) throws ExecutionException,
- NotHandledException {
+ public Object execute(IEclipseContext context, @Optional @Named(HandlerServiceImpl.PARM_MAP) Map parms,
+ @Optional Event trigger, @Optional IEvaluationContext staticContext)
+ throws ExecutionException, NotHandledException {
if (Policy.DEBUG_CMDS) {
Activator.trace(Policy.DEBUG_CMDS_FLAG, "execute " + command + " and " //$NON-NLS-1$ //$NON-NLS-2$
+ handler + " with: " + context, null); //$NON-NLS-1$
@@ -89,8 +88,8 @@ public class E4HandlerProxy implements IHandler2, IHandlerListener, IElementUpda
if (appContext == null) {
appContext = new ExpressionContext(context);
}
- ExecutionEvent event = new ExecutionEvent(command, parms == null ? Collections.EMPTY_MAP
- : parms, trigger, appContext);
+ ExecutionEvent event = new ExecutionEvent(command, parms == null ? Collections.EMPTY_MAP : parms, trigger,
+ appContext);
if (handler != null) {
if (handler.isHandled()) {
final Object returnValue = handler.execute(event);
@@ -110,8 +109,7 @@ public class E4HandlerProxy implements IHandler2, IHandlerListener, IElementUpda
public void handlerChanged(HandlerEvent handlerEvent) {
IHandler handler = command.getHandler();
if (handler instanceof HandlerServiceHandler) {
- IEclipseContext appContext = ((Workbench) PlatformUI.getWorkbench()).getApplication()
- .getContext();
+ IEclipseContext appContext = ((Workbench) PlatformUI.getWorkbench()).getApplication().getContext();
if (HandlerServiceImpl.lookUpHandler(appContext, command.getId()) == this) {
((HandlerServiceHandler) handler).fireHandlerChanged(handlerEvent);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/EditActionSetsHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/EditActionSetsHandler.java
index 809e0609ac0..edc585b16a6 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/EditActionSetsHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/EditActionSetsHandler.java
@@ -30,12 +30,10 @@ public class EditActionSetsHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- IWorkbenchWindow activeWorkbenchWindow = HandlerUtil
- .getActiveWorkbenchWindow(event);
+ IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);
if (activeWorkbenchWindow != null) {
- WorkbenchPage page = (WorkbenchPage) activeWorkbenchWindow
- .getActivePage();
+ WorkbenchPage page = (WorkbenchPage) activeWorkbenchWindow.getActivePage();
if (page != null) {
page.editActionSets();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ExecutableExtensionHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ExecutableExtensionHandler.java
index 15448d5acfb..620b686d721 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ExecutableExtensionHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ExecutableExtensionHandler.java
@@ -28,37 +28,32 @@ import org.eclipse.core.runtime.IExecutableExtension;
*
* @since 3.1
*/
-public abstract class ExecutableExtensionHandler extends AbstractHandler
- implements IExecutableExtension {
+public abstract class ExecutableExtensionHandler extends AbstractHandler implements IExecutableExtension {
- /**
- * Initializes this handler with data provided from XML. By default, an
- * <code>ExecutableExtensionHandler</code> will do nothing with this
- * information. Subclasses should override if they expect parameters from
- * XML.
- *
- * @param config
- * the configuration element used to trigger this execution. It
- * can be queried by the executable extension for specific
- * configuration properties
- * @param propertyName
- * the name of an attribute of the configuration element used on
- * the <code>createExecutableExtension(String)</code> call.
- * This argument can be used in the cases where a single
- * configuration element is used to define multiple executable
- * extensions.
- * @param data
- * adapter data in the form of a <code>String</code>, a
- * <code>Hashtable</code>, or <code>null</code>.
- * @throws CoreException
- * if error(s) detected during initialization processing
- *
- * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement,
- * java.lang.String, java.lang.Object)
- */
- @Override
- public void setInitializationData(final IConfigurationElement config,
- final String propertyName, final Object data) throws CoreException {
- // Do nothing, by default
- }
+ /**
+ * Initializes this handler with data provided from XML. By default, an
+ * <code>ExecutableExtensionHandler</code> will do nothing with this
+ * information. Subclasses should override if they expect parameters from XML.
+ *
+ * @param config the configuration element used to trigger this execution.
+ * It can be queried by the executable extension for
+ * specific configuration properties
+ * @param propertyName the name of an attribute of the configuration element
+ * used on the
+ * <code>createExecutableExtension(String)</code> call. This
+ * argument can be used in the cases where a single
+ * configuration element is used to define multiple
+ * executable extensions.
+ * @param data adapter data in the form of a <code>String</code>, a
+ * <code>Hashtable</code>, or <code>null</code>.
+ * @throws CoreException if error(s) detected during initialization processing
+ *
+ * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement,
+ * java.lang.String, java.lang.Object)
+ */
+ @Override
+ public void setInitializationData(final IConfigurationElement config, final String propertyName, final Object data)
+ throws CoreException {
+ // Do nothing, by default
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/FullScreenHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/FullScreenHandler.java
index 1b7d4502bee..5c890b43dff 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/FullScreenHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/FullScreenHandler.java
@@ -91,8 +91,8 @@ public class FullScreenHandler extends AbstractHandler {
message = NLS.bind(WorkbenchMessages.ToggleFullScreenMode_ActivationPopup_Description, keybinding);
}
if (showInfoPopup) {
- fullScreenInfoPopup = new FullScreenInfoPopup(shell, PopupDialog.HOVER_SHELLSTYLE, true, false,
- false, false, false, null, null, message);
+ fullScreenInfoPopup = new FullScreenInfoPopup(shell, PopupDialog.HOVER_SHELLSTYLE, true, false, false,
+ false, false, null, null, message);
fullScreenInfoPopup.open();
}
} else {
@@ -105,9 +105,9 @@ public class FullScreenHandler extends AbstractHandler {
}
/**
- * Check if an event is duplicate, by recording and comparing the time of
- * the trigger event. Returns true if an event is triggered twice with an
- * event with the same time
+ * Check if an event is duplicate, by recording and comparing the time of the
+ * trigger event. Returns true if an event is triggered twice with an event with
+ * the same time
*/
boolean checkDuplicatedEvent(ExecutionEvent event) {
if (event != null && event.getTrigger() != null && event.getTrigger() instanceof Event) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/HandlerActivation.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/HandlerActivation.java
index 6cbfea0193c..2afefb14752 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/HandlerActivation.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/HandlerActivation.java
@@ -56,8 +56,8 @@ final class HandlerActivation implements IHandlerActivation {
private int sourcePriority;
boolean participating = true;
- public HandlerActivation(IEclipseContext context, String cmdId, IHandler handler,
- E4HandlerProxy handlerProxy, Expression expr) {
+ public HandlerActivation(IEclipseContext context, String cmdId, IHandler handler, E4HandlerProxy handlerProxy,
+ Expression expr) {
this.context = context;
this.commandId = cmdId;
this.handler = handler;
@@ -91,11 +91,10 @@ final class HandlerActivation implements IHandlerActivation {
active = activeWhen.evaluate(context) != EvaluationResult.FALSE;
} catch (CoreException e) {
/*
- * Swallow the exception. It simply means the variable is not
- * valid (most frequently, that the value is null or has a
- * complex core expression with a property tester). This kind of
- * information is not really useful to us, so we can just treat
- * it as false.
+ * Swallow the exception. It simply means the variable is not valid (most
+ * frequently, that the value is null or has a complex core expression with a
+ * property tester). This kind of information is not really useful to us, so we
+ * can just treat it as false.
*/
if (Policy.DEBUG_CMDS) {
Activator.trace(Policy.DEBUG_CMDS_FLAG, "Failed to calculate active", e); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/HandlerPersistence.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/HandlerPersistence.java
index d74ad26f3bc..891a701e985 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/HandlerPersistence.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/HandlerPersistence.java
@@ -82,26 +82,22 @@ public final class HandlerPersistence extends RegistryPersistence {
/**
* Constructs a new instance of <code>HandlerPersistence</code>.
*
- * @param handlerService
- * The handler service with which the handlers should be
- * registered; must not be <code>null</code>.
- * @param evaluationService
- * The evaluation service used by handler proxies with enabled
- * when expressions
+ * @param handlerService The handler service with which the handlers should
+ * be registered; must not be <code>null</code>.
+ * @param evaluationService The evaluation service used by handler proxies with
+ * enabled when expressions
*/
- HandlerPersistence(final IHandlerService handlerService,
- IEvaluationService evaluationService) {
+ HandlerPersistence(final IHandlerService handlerService, IEvaluationService evaluationService) {
this.handlerService = handlerService;
this.evaluationService = evaluationService;
}
/**
- * Deactivates all of the activations made by this class, and then clears
- * the collection. This should be called before every read.
+ * Deactivates all of the activations made by this class, and then clears the
+ * collection. This should be called before every read.
*
- * @param handlerService
- * The service handling the activations; must not be
- * <code>null</code>.
+ * @param handlerService The service handling the activations; must not be
+ * <code>null</code>.
*/
private void clearActivations(final IHandlerService handlerService) {
handlerService.deactivateHandlers(handlerActivations);
@@ -136,21 +132,18 @@ public final class HandlerPersistence extends RegistryPersistence {
public boolean handlersNeedUpdating(final IRegistryChangeEvent event) {
/*
- * Handlers will need to be re-read (i.e., re-verified) if any of the
- * handler extensions change (i.e., handlers, commands), or if any of
- * the command extensions change (i.e., action definitions).
+ * Handlers will need to be re-read (i.e., re-verified) if any of the handler
+ * extensions change (i.e., handlers, commands), or if any of the command
+ * extensions change (i.e., action definitions).
*/
- final IExtensionDelta[] handlerDeltas = event.getExtensionDeltas(
- PlatformUI.PLUGIN_ID, IWorkbenchRegistryConstants.PL_HANDLERS);
+ final IExtensionDelta[] handlerDeltas = event.getExtensionDeltas(PlatformUI.PLUGIN_ID,
+ IWorkbenchRegistryConstants.PL_HANDLERS);
if (handlerDeltas.length == 0) {
- final IExtensionDelta[] commandDeltas = event.getExtensionDeltas(
- PlatformUI.PLUGIN_ID,
+ final IExtensionDelta[] commandDeltas = event.getExtensionDeltas(PlatformUI.PLUGIN_ID,
IWorkbenchRegistryConstants.PL_COMMANDS);
if (commandDeltas.length == 0) {
- final IExtensionDelta[] actionDefinitionDeltas = event
- .getExtensionDeltas(
- PlatformUI.PLUGIN_ID,
- IWorkbenchRegistryConstants.PL_ACTION_DEFINITIONS);
+ final IExtensionDelta[] actionDefinitionDeltas = event.getExtensionDeltas(PlatformUI.PLUGIN_ID,
+ IWorkbenchRegistryConstants.PL_ACTION_DEFINITIONS);
if (actionDefinitionDeltas.length == 0) {
return false;
}
@@ -163,9 +156,9 @@ public final class HandlerPersistence extends RegistryPersistence {
/**
* Reads all of the handlers from the registry
*
- * @param handlerService
- * The handler service which should be populated with the values
- * from the registry; must not be <code>null</code>.
+ * @param handlerService The handler service which should be populated with the
+ * values from the registry; must not be
+ * <code>null</code>.
*/
@Override
protected void read() {
@@ -182,70 +175,58 @@ public final class HandlerPersistence extends RegistryPersistence {
final IConfigurationElement[][] indexedConfigurationElements = new IConfigurationElement[3][];
// Sort the commands extension point based on element name.
- final IConfigurationElement[] commandsExtensionPoint = registry
- .getConfigurationElementsFor(EXTENSION_COMMANDS);
+ final IConfigurationElement[] commandsExtensionPoint = registry.getConfigurationElementsFor(EXTENSION_COMMANDS);
for (final IConfigurationElement configurationElement : commandsExtensionPoint) {
final String name = configurationElement.getName();
// Check if it is a handler submission or a command definition.
if (TAG_HANDLER_SUBMISSION.equals(name)) {
- addElementToIndexedArray(configurationElement,
- indexedConfigurationElements,
- INDEX_HANDLER_SUBMISSIONS, handlerSubmissionCount++);
+ addElementToIndexedArray(configurationElement, indexedConfigurationElements, INDEX_HANDLER_SUBMISSIONS,
+ handlerSubmissionCount++);
} else if (TAG_COMMAND.equals(name)) {
- addElementToIndexedArray(configurationElement,
- indexedConfigurationElements,
- INDEX_COMMAND_DEFINITIONS, commandDefinitionCount++);
+ addElementToIndexedArray(configurationElement, indexedConfigurationElements, INDEX_COMMAND_DEFINITIONS,
+ commandDefinitionCount++);
}
}
// Sort the handler extension point based on element name.
- final IConfigurationElement[] handlersExtensionPoint = registry
- .getConfigurationElementsFor(EXTENSION_HANDLERS);
+ final IConfigurationElement[] handlersExtensionPoint = registry.getConfigurationElementsFor(EXTENSION_HANDLERS);
for (final IConfigurationElement configurationElement : handlersExtensionPoint) {
final String name = configurationElement.getName();
// Check if it is a handler submission or a command definition.
if (TAG_HANDLER.equals(name)) {
- addElementToIndexedArray(configurationElement,
- indexedConfigurationElements,
- INDEX_HANDLER_DEFINITIONS, handlerDefinitionCount++);
+ addElementToIndexedArray(configurationElement, indexedConfigurationElements, INDEX_HANDLER_DEFINITIONS,
+ handlerDefinitionCount++);
}
}
clearActivations(handlerService);
- readDefaultHandlersFromRegistry(
- indexedConfigurationElements[INDEX_COMMAND_DEFINITIONS],
+ readDefaultHandlersFromRegistry(indexedConfigurationElements[INDEX_COMMAND_DEFINITIONS],
commandDefinitionCount);
- readHandlerSubmissionsFromRegistry(
- indexedConfigurationElements[INDEX_HANDLER_SUBMISSIONS],
+ readHandlerSubmissionsFromRegistry(indexedConfigurationElements[INDEX_HANDLER_SUBMISSIONS],
handlerSubmissionCount);
- readHandlersFromRegistry(
- indexedConfigurationElements[INDEX_HANDLER_DEFINITIONS],
- handlerDefinitionCount);
+ readHandlersFromRegistry(indexedConfigurationElements[INDEX_HANDLER_DEFINITIONS], handlerDefinitionCount);
}
/**
* Reads the default handlers from an array of command elements from the
* commands extension point.
*
- * @param configurationElements
- * The configuration elements in the commands extension point;
- * must not be <code>null</code>, but may be empty.
- * @param configurationElementCount
- * The number of configuration elements that are really in the
- * array.
+ * @param configurationElements The configuration elements in the commands
+ * extension point; must not be
+ * <code>null</code>, but may be empty.
+ * @param configurationElementCount The number of configuration elements that
+ * are really in the array.
*/
- private void readDefaultHandlersFromRegistry(
- final IConfigurationElement[] configurationElements,
+ private void readDefaultHandlersFromRegistry(final IConfigurationElement[] configurationElements,
final int configurationElementCount) {
for (int i = 0; i < configurationElementCount; i++) {
final IConfigurationElement configurationElement = configurationElements[i];
/*
* Read out the command identifier. This was already checked by
- * <code>CommandPersistence</code>, so we'll just ignore any
- * problems here.
+ * <code>CommandPersistence</code>, so we'll just ignore any problems here.
*/
final String commandId = readOptional(configurationElement, ATT_ID);
if (commandId == null) {
@@ -258,27 +239,24 @@ public final class HandlerPersistence extends RegistryPersistence {
continue;
}
- handlerActivations.add(handlerService
- .activateHandler(commandId, new HandlerProxy(commandId,
- configurationElement, ATT_DEFAULT_HANDLER)));
+ handlerActivations.add(handlerService.activateHandler(commandId,
+ new HandlerProxy(commandId, configurationElement, ATT_DEFAULT_HANDLER)));
}
}
/**
* Reads all of the handlers from the handlers extension point.
*
- * @param configurationElements
- * The configuration elements in the commands extension point;
- * must not be <code>null</code>, but may be empty.
- * @param configurationElementCount
- * The number of configuration elements that are really in the
- * array.
- * @param handlerService
- * The handler service to which the handlers should be added;
- * must not be <code>null</code>.
+ * @param configurationElements The configuration elements in the commands
+ * extension point; must not be
+ * <code>null</code>, but may be empty.
+ * @param configurationElementCount The number of configuration elements that
+ * are really in the array.
+ * @param handlerService The handler service to which the handlers
+ * should be added; must not be
+ * <code>null</code>.
*/
- private void readHandlersFromRegistry(
- final IConfigurationElement[] configurationElements,
+ private void readHandlersFromRegistry(final IConfigurationElement[] configurationElements,
final int configurationElementCount) {
final List warningsToLog = new ArrayList(1);
@@ -286,63 +264,55 @@ public final class HandlerPersistence extends RegistryPersistence {
final IConfigurationElement configurationElement = configurationElements[i];
// Read out the command identifier.
- final String commandId = readRequired(configurationElement,
- ATT_COMMAND_ID, warningsToLog, "Handlers need a command id"); //$NON-NLS-1$
+ final String commandId = readRequired(configurationElement, ATT_COMMAND_ID, warningsToLog,
+ "Handlers need a command id"); //$NON-NLS-1$
if (commandId == null) {
continue;
}
// Check to see if we have a handler class.
- if (!checkClass(configurationElement, warningsToLog,
- "Handlers need a class", commandId)) { //$NON-NLS-1$
+ if (!checkClass(configurationElement, warningsToLog, "Handlers need a class", commandId)) { //$NON-NLS-1$
continue;
}
// Get the activeWhen and enabledWhen expressions.
- final Expression activeWhenExpression = readWhenElement(
- configurationElement, TAG_ACTIVE_WHEN, commandId,
+ final Expression activeWhenExpression = readWhenElement(configurationElement, TAG_ACTIVE_WHEN, commandId,
warningsToLog);
if (activeWhenExpression == ERROR_EXPRESSION) {
continue;
}
- final Expression enabledWhenExpression = readWhenElement(
- configurationElement, TAG_ENABLED_WHEN, commandId,
+ final Expression enabledWhenExpression = readWhenElement(configurationElement, TAG_ENABLED_WHEN, commandId,
warningsToLog);
if (enabledWhenExpression == ERROR_EXPRESSION) {
continue;
}
- final IHandler proxy = new HandlerProxy(commandId, configurationElement,
- ATT_CLASS, enabledWhenExpression, evaluationService);
- handlerActivations.add(handlerService.activateHandler(commandId,
- proxy, activeWhenExpression));
+ final IHandler proxy = new HandlerProxy(commandId, configurationElement, ATT_CLASS, enabledWhenExpression,
+ evaluationService);
+ handlerActivations.add(handlerService.activateHandler(commandId, proxy, activeWhenExpression));
// Read out the help context identifier.
- final String helpContextId = readOptional(configurationElement,
- ATT_HELP_CONTEXT_ID);
+ final String helpContextId = readOptional(configurationElement, ATT_HELP_CONTEXT_ID);
handlerService.setHelpContextId(proxy, helpContextId);
}
- logWarnings(
- warningsToLog,
+ logWarnings(warningsToLog,
"Warnings while parsing the handlers from the 'org.eclipse.ui.handlers' extension point."); //$NON-NLS-1$
}
/**
* Reads all of the handler submissions from the commands extension point.
*
- * @param configurationElements
- * The configuration elements in the commands extension point;
- * must not be <code>null</code>, but may be empty.
- * @param configurationElementCount
- * The number of configuration elements that are really in the
- * array.
- * @param handlerService
- * The handler service to which the handlers should be added;
- * must not be <code>null</code>.
+ * @param configurationElements The configuration elements in the commands
+ * extension point; must not be
+ * <code>null</code>, but may be empty.
+ * @param configurationElementCount The number of configuration elements that
+ * are really in the array.
+ * @param handlerService The handler service to which the handlers
+ * should be added; must not be
+ * <code>null</code>.
*/
- private void readHandlerSubmissionsFromRegistry(
- final IConfigurationElement[] configurationElements,
+ private void readHandlerSubmissionsFromRegistry(final IConfigurationElement[] configurationElements,
final int configurationElementCount) {
final List warningsToLog = new ArrayList(1);
@@ -350,20 +320,17 @@ public final class HandlerPersistence extends RegistryPersistence {
final IConfigurationElement configurationElement = configurationElements[i];
// Read out the command identifier.
- final String commandId = readRequired(configurationElement,
- ATT_COMMAND_ID, warningsToLog,
+ final String commandId = readRequired(configurationElement, ATT_COMMAND_ID, warningsToLog,
"Handler submissions need a command id"); //$NON-NLS-1$
if (commandId == null) {
continue;
}
handlerActivations.add(handlerService.activateHandler(commandId,
- new LegacyHandlerWrapper(new LegacyHandlerProxy(
- configurationElement))));
+ new LegacyHandlerWrapper(new LegacyHandlerProxy(configurationElement))));
}
- logWarnings(
- warningsToLog,
+ logWarnings(warningsToLog,
"Warnings while parsing the handler submissions from the 'org.eclipse.ui.commands' extension point."); //$NON-NLS-1$
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/HandlerProxy.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/HandlerProxy.java
index 5dfe6c8c133..a86dde22ba7 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/HandlerProxy.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/HandlerProxy.java
@@ -60,8 +60,7 @@ import org.eclipse.ui.services.IEvaluationService;
*
* @since 3.0
*/
-public final class HandlerProxy extends AbstractHandlerWithState implements
- IElementUpdater {
+public final class HandlerProxy extends AbstractHandlerWithState implements IElementUpdater {
private static Map CEToProxyMap = new HashMap();
@@ -71,23 +70,23 @@ public final class HandlerProxy extends AbstractHandlerWithState implements
private static final String PROP_ENABLED = "enabled"; //$NON-NLS-1$
/**
- * The configuration element from which the handler can be created. This
- * value will exist until the element is converted into a real class -- at
- * which point this value will be set to <code>null</code>.
+ * The configuration element from which the handler can be created. This value
+ * will exist until the element is converted into a real class -- at which point
+ * this value will be set to <code>null</code>.
*/
private IConfigurationElement configurationElement;
/**
* The <code>enabledWhen</code> expression for the handler. Only if this
- * expression evaluates to <code>true</code> (or the value is
- * <code>null</code>) should we consult the handler.
+ * expression evaluates to <code>true</code> (or the value is <code>null</code>)
+ * should we consult the handler.
*/
private final Expression enabledWhenExpression;
/**
- * The real handler. This value is <code>null</code> until the proxy is
- * forced to load the real handler. At this point, the configuration element
- * is converted, nulled out, and this handler gains a reference.
+ * The real handler. This value is <code>null</code> until the proxy is forced
+ * to load the real handler. At this point, the configuration element is
+ * converted, nulled out, and this handler gains a reference.
*/
private IHandler handler;
@@ -101,9 +100,8 @@ public final class HandlerProxy extends AbstractHandlerWithState implements
/**
* The evaluation service to use when evaluating
- * <code>enabledWhenExpression</code>. This value may be
- * <code>null</code> only if the <code>enabledWhenExpression</code> is
- * <code>null</code>.
+ * <code>enabledWhenExpression</code>. This value may be <code>null</code> only
+ * if the <code>enabledWhenExpression</code> is <code>null</code>.
*/
private IEvaluationService evaluationService;
@@ -128,13 +126,13 @@ public final class HandlerProxy extends AbstractHandlerWithState implements
* Constructs a new instance of <code>HandlerProxy</code> with all the
* information it needs to try to avoid loading until it is needed.
*
- * @param commandId the id for this handler
- * @param configurationElement
- * The configuration element from which the real class can be
- * loaded at run-time; must not be <code>null</code>.
- * @param handlerAttributeName
- * The name of the attibute or element containing the handler
- * executable extension; must not be <code>null</code>.
+ * @param commandId the id for this handler
+ * @param configurationElement The configuration element from which the real
+ * class can be loaded at run-time; must not be
+ * <code>null</code>.
+ * @param handlerAttributeName The name of the attibute or element containing
+ * the handler executable extension; must not be
+ * <code>null</code>.
*/
public HandlerProxy(final String commandId, final IConfigurationElement configurationElement,
final String handlerAttributeName) {
@@ -145,39 +143,35 @@ public final class HandlerProxy extends AbstractHandlerWithState implements
* Constructs a new instance of <code>HandlerProxy</code> with all the
* information it needs to try to avoid loading until it is needed.
*
- * @param commandId the id for this handler
- * @param configurationElement
- * The configuration element from which the real class can be
- * loaded at run-time; must not be <code>null</code>.
- * @param handlerAttributeName
- * The name of the attribute or element containing the handler
- * executable extension; must not be <code>null</code>.
- * @param enabledWhenExpression
- * The name of the element containing the enabledWhen expression.
- * This should be a child of the
- * <code>configurationElement</code>. If this value is
- * <code>null</code>, then there is no enablement expression
- * (i.e., enablement will be delegated to the handler when
- * possible).
- * @param evaluationService
- * The evaluation service to manage enabledWhen expressions
- * trying to evaluate the <code>enabledWhenExpression</code>.
- * This value may be <code>null</code> only if the
- * <code>enabledWhenExpression</code> is <code>null</code>.
+ * @param commandId the id for this handler
+ * @param configurationElement The configuration element from which the real
+ * class can be loaded at run-time; must not be
+ * <code>null</code>.
+ * @param handlerAttributeName The name of the attribute or element containing
+ * the handler executable extension; must not be
+ * <code>null</code>.
+ * @param enabledWhenExpression The name of the element containing the
+ * enabledWhen expression. This should be a child
+ * of the <code>configurationElement</code>. If
+ * this value is <code>null</code>, then there is
+ * no enablement expression (i.e., enablement will
+ * be delegated to the handler when possible).
+ * @param evaluationService The evaluation service to manage enabledWhen
+ * expressions trying to evaluate the
+ * <code>enabledWhenExpression</code>. This value
+ * may be <code>null</code> only if the
+ * <code>enabledWhenExpression</code> is
+ * <code>null</code>.
*/
- public HandlerProxy(final String commandId,
- final IConfigurationElement configurationElement,
- final String handlerAttributeName,
- final Expression enabledWhenExpression,
+ public HandlerProxy(final String commandId, final IConfigurationElement configurationElement,
+ final String handlerAttributeName, final Expression enabledWhenExpression,
final IEvaluationService evaluationService) {
if (configurationElement == null) {
- throw new NullPointerException(
- "The configuration element backing a handler proxy cannot be null"); //$NON-NLS-1$
+ throw new NullPointerException("The configuration element backing a handler proxy cannot be null"); //$NON-NLS-1$
}
if (handlerAttributeName == null) {
- throw new NullPointerException(
- "The attribute containing the handler class must be known"); //$NON-NLS-1$
+ throw new NullPointerException("The attribute containing the handler class must be known"); //$NON-NLS-1$
}
if ((enabledWhenExpression != null) && (evaluationService == null)) {
@@ -202,8 +196,7 @@ public final class HandlerProxy extends AbstractHandlerWithState implements
public static void updateStaleCEs(IConfigurationElement[] replacements) {
for (IConfigurationElement replacement : replacements) {
- HandlerProxy proxy = (HandlerProxy) CEToProxyMap
- .get(replacement);
+ HandlerProxy proxy = (HandlerProxy) CEToProxyMap.get(replacement);
if (proxy != null)
proxy.configurationElement = replacement;
}
@@ -213,8 +206,8 @@ public final class HandlerProxy extends AbstractHandlerWithState implements
*
*/
private void registerEnablement() {
- enablementRef = evaluationService.addEvaluationListener(
- enabledWhenExpression, getEnablementListener(), PROP_ENABLED);
+ enablementRef = evaluationService.addEvaluationListener(enabledWhenExpression, getEnablementListener(),
+ PROP_ENABLED);
}
@Override
@@ -250,11 +243,9 @@ public final class HandlerProxy extends AbstractHandlerWithState implements
if (enablementListener == null) {
enablementListener = event -> {
if (event.getProperty() == PROP_ENABLED) {
- setProxyEnabled(event.getNewValue() == null ? false
- : ((Boolean) event.getNewValue())
- .booleanValue());
- fireHandlerChanged(new HandlerEvent(HandlerProxy.this,
- true, false));
+ setProxyEnabled(
+ event.getNewValue() == null ? false : ((Boolean) event.getNewValue()).booleanValue());
+ fireHandlerChanged(new HandlerEvent(HandlerProxy.this, true, false));
}
};
}
@@ -282,19 +273,17 @@ public final class HandlerProxy extends AbstractHandlerWithState implements
}
@Override
- public Object execute(final ExecutionEvent event)
- throws ExecutionException {
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
if (loadHandler()) {
if (!isEnabled()) {
- MessageDialog.openInformation(Util.getShellToParentOn(),
- WorkbenchMessages.Information,
+ MessageDialog.openInformation(Util.getShellToParentOn(), WorkbenchMessages.Information,
WorkbenchMessages.PluginAction_disabledMessage);
return null;
}
return handler.execute(event);
}
- if(loadException !=null)
+ if (loadException != null)
throw new ExecutionException("Exception occured when loading the handler", loadException); //$NON-NLS-1$
return null;
@@ -315,8 +304,7 @@ public final class HandlerProxy extends AbstractHandlerWithState implements
}
/*
- * There is no enabled when expression, so we just need to consult the
- * handler.
+ * There is no enabled when expression, so we just need to consult the handler.
*/
if (isOkToLoad() && loadHandler()) {
return handler.isEnabled();
@@ -343,36 +331,32 @@ public final class HandlerProxy extends AbstractHandlerWithState implements
* Loads the handler, if possible. If the handler is loaded, then the member
* variables are updated accordingly.
*
- * @return <code>true</code> if the handler is now non-null;
- * <code>false</code> otherwise.
+ * @return <code>true</code> if the handler is now non-null; <code>false</code>
+ * otherwise.
*/
private boolean loadHandler() {
if (handler == null) {
// Load the handler.
try {
if (configurationElement != null) {
- handler = (IHandler) configurationElement
- .createExecutableExtension(handlerAttributeName);
+ handler = (IHandler) configurationElement.createExecutableExtension(handlerAttributeName);
handler.addHandlerListener(getHandlerListener());
- setEnabled(evaluationService == null ? null
- : evaluationService.getCurrentState());
+ setEnabled(evaluationService == null ? null : evaluationService.getCurrentState());
refreshElements();
return true;
}
} catch (final ClassCastException e) {
final String message = "The proxied handler was the wrong class"; //$NON-NLS-1$
- final IStatus status = new Status(IStatus.ERROR,
- WorkbenchPlugin.PI_WORKBENCH, 0, message, e);
+ final IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 0, message, e);
WorkbenchPlugin.log(message, status);
configurationElement = null;
loadException = e;
} catch (final CoreException e) {
- final String message = "The proxied handler for '" + configurationElement.getAttribute(handlerAttributeName) //$NON-NLS-1$
- + "' could not be loaded"; //$NON-NLS-1$
- IStatus status = new Status(IStatus.ERROR,
- WorkbenchPlugin.PI_WORKBENCH, 0, message, e);
+ final String message = "The proxied handler for '" //$NON-NLS-1$
+ + configurationElement.getAttribute(handlerAttributeName) + "' could not be loaded"; //$NON-NLS-1$
+ IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 0, message, e);
WorkbenchPlugin.log(message, status);
configurationElement = null;
loadException = e;
@@ -386,8 +370,7 @@ public final class HandlerProxy extends AbstractHandlerWithState implements
private IHandlerListener getHandlerListener() {
if (handlerListener == null) {
handlerListener = handlerEvent -> fireHandlerChanged(new HandlerEvent(HandlerProxy.this,
- handlerEvent.isEnabledChanged(), handlerEvent
- .isHandledChanged()));
+ handlerEvent.isEnabledChanged(), handlerEvent.isHandledChanged()));
}
return handlerListener;
}
@@ -414,12 +397,10 @@ public final class HandlerProxy extends AbstractHandlerWithState implements
* @return the handlerAttributeName value, may be <code>null</code>.
*/
private String getConfigurationElementAttribute() {
- String attribute = configurationElement
- .getAttribute(handlerAttributeName);
+ String attribute = configurationElement.getAttribute(handlerAttributeName);
if (attribute == null) {
for (IConfigurationElement configElement : configurationElement.getChildren(handlerAttributeName)) {
- String childAttribute = configElement
- .getAttribute(IWorkbenchRegistryConstants.ATT_CLASS);
+ String childAttribute = configElement.getAttribute(IWorkbenchRegistryConstants.ATT_CLASS);
if (childAttribute != null) {
return childAttribute;
}
@@ -433,8 +414,7 @@ public final class HandlerProxy extends AbstractHandlerWithState implements
return handler != null;
if (configurationElement != null && handler == null) {
- final String bundleId = configurationElement.getContributor()
- .getName();
+ final String bundleId = configurationElement.getContributor().getName();
return BundleUtility.isActive(bundleId);
}
return true;
@@ -456,12 +436,11 @@ public final class HandlerProxy extends AbstractHandlerWithState implements
}
private void refreshElements() {
- if (commandId == null || !(handler instanceof IElementUpdater)
- && (checkedState == null && radioState == null)) {
+ if (commandId == null
+ || !(handler instanceof IElementUpdater) && (checkedState == null && radioState == null)) {
return;
}
- ICommandService cs = PlatformUI.getWorkbench()
- .getService(ICommandService.class);
+ ICommandService cs = PlatformUI.getWorkbench().getService(ICommandService.class);
cs.refreshElements(commandId, null);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/IActionCommandMappingService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/IActionCommandMappingService.java
index 0c91646659b..fa9d3a4a588 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/IActionCommandMappingService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/IActionCommandMappingService.java
@@ -29,30 +29,27 @@ package org.eclipse.ui.internal.handlers;
public interface IActionCommandMappingService {
/**
- * Returns the command identifier corresponding to the given action
- * identifier, if any.
+ * Returns the command identifier corresponding to the given action identifier,
+ * if any.
*
- * @param actionId
- * The identifier of the retarget action for which the command
- * identifier should be retrieved; must not be <code>null</code>.
- * @return The identifier of the corresponding command; <code>null</code>
- * if none.
+ * @param actionId The identifier of the retarget action for which the command
+ * identifier should be retrieved; must not be
+ * <code>null</code>.
+ * @return The identifier of the corresponding command; <code>null</code> if
+ * none.
*/
String getCommandId(String actionId);
/**
- * Maps an action identifier to a command identifier. This is used for
- * retarget action, so that global action handlers can be registered with
- * the correct command.
+ * Maps an action identifier to a command identifier. This is used for retarget
+ * action, so that global action handlers can be registered with the correct
+ * command.
*
- * @param actionId
- * The identifier of the retarget action; must not be
- * <code>null</code>.
- * @param commandId
- * The identifier of the command; must not be <code>null</code>
+ * @param actionId The identifier of the retarget action; must not be
+ * <code>null</code>.
+ * @param commandId The identifier of the command; must not be <code>null</code>
*/
void map(String actionId, String commandId);
String getGeneratedCommandId(String targetId, String actionId);
}
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/IWorkbenchWindowHandlerDelegate.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/IWorkbenchWindowHandlerDelegate.java
index 39f24d21add..b7c36712a71 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/IWorkbenchWindowHandlerDelegate.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/IWorkbenchWindowHandlerDelegate.java
@@ -21,7 +21,6 @@ import org.eclipse.ui.IWorkbenchWindowActionDelegate;
*
* @since 3.1
*/
-public interface IWorkbenchWindowHandlerDelegate extends
- IWorkbenchWindowActionDelegate {
+public interface IWorkbenchWindowHandlerDelegate extends IWorkbenchWindowActionDelegate {
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/IntroHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/IntroHandler.java
index 47c3df20601..f927bdf7773 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/IntroHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/IntroHandler.java
@@ -44,12 +44,11 @@ public class IntroHandler extends AbstractHandler {
public Object execute(ExecutionEvent event) {
if (introDescriptor == null) {
- MessageDialog.openWarning(HandlerUtil.getActiveShell(event),
- IntroMessages.Intro_missing_product_title,
- IntroMessages.Intro_missing_product_message);
+ MessageDialog.openWarning(HandlerUtil.getActiveShell(event), IntroMessages.Intro_missing_product_title,
+ IntroMessages.Intro_missing_product_message);
} else {
- IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
- workbench.getIntroManager().showIntro(window, false);
+ IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
+ workbench.getIntroManager().showIntro(window, false);
}
return null;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerListenerWrapper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerListenerWrapper.java
index a81c7239006..a314fbc7536 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerListenerWrapper.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerListenerWrapper.java
@@ -39,19 +39,16 @@ public final class LegacyHandlerListenerWrapper implements IHandlerListener {
/**
* Constructs a new instance of <code>LegacyHandlerListenerWrapper</code>.
*
- * @param listener
- * The listener to wrap; must not be <code>null</code>.
+ * @param listener The listener to wrap; must not be <code>null</code>.
*/
public LegacyHandlerListenerWrapper(final IHandler handler,
final org.eclipse.core.commands.IHandlerListener listener) {
if (handler == null) {
- throw new NullPointerException(
- "A listener wrapper cannot be created on a null handler"); //$NON-NLS-1$
+ throw new NullPointerException("A listener wrapper cannot be created on a null handler"); //$NON-NLS-1$
}
if (listener == null) {
- throw new NullPointerException(
- "A listener wrapper cannot be created on a null listener"); //$NON-NLS-1$
+ throw new NullPointerException("A listener wrapper cannot be created on a null listener"); //$NON-NLS-1$
}
this.handler = handler;
@@ -60,15 +57,10 @@ public final class LegacyHandlerListenerWrapper implements IHandlerListener {
@Override
public void handlerChanged(HandlerEvent event) {
- final boolean enabledChanged = ((Boolean) event
- .getPreviousAttributeValuesByName().get(
- ILegacyAttributeNames.ENABLED)).booleanValue() != handler
- .isEnabled();
- final boolean handledChanged = ((Boolean) event
- .getPreviousAttributeValuesByName().get(
- ILegacyAttributeNames.HANDLED)).booleanValue() != handler
- .isHandled();
- listener.handlerChanged(new org.eclipse.core.commands.HandlerEvent(
- handler, enabledChanged, handledChanged));
+ final boolean enabledChanged = ((Boolean) event.getPreviousAttributeValuesByName()
+ .get(ILegacyAttributeNames.ENABLED)).booleanValue() != handler.isEnabled();
+ final boolean handledChanged = ((Boolean) event.getPreviousAttributeValuesByName()
+ .get(ILegacyAttributeNames.HANDLED)).booleanValue() != handler.isHandled();
+ listener.handlerChanged(new org.eclipse.core.commands.HandlerEvent(handler, enabledChanged, handledChanged));
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerProxy.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerProxy.java
index 3080f424af5..ad0289d84d0 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerProxy.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerProxy.java
@@ -45,16 +45,16 @@ public final class LegacyHandlerProxy extends AbstractHandler {
private static final String HANDLER_ATTRIBUTE_NAME = "handler"; //$NON-NLS-1$
/**
- * The configuration element from which the handler can be created. This
- * value will exist until the element is converted into a real class -- at
- * which point this value will be set to <code>null</code>.
+ * The configuration element from which the handler can be created. This value
+ * will exist until the element is converted into a real class -- at which point
+ * this value will be set to <code>null</code>.
*/
private IConfigurationElement configurationElement;
/**
- * The real handler. This value is <code>null</code> until the proxy is
- * forced to load the real handler. At this point, the configuration element
- * is converted, nulled out, and this handler gains a reference.
+ * The real handler. This value is <code>null</code> until the proxy is forced
+ * to load the real handler. At this point, the configuration element is
+ * converted, nulled out, and this handler gains a reference.
*/
private IHandler handler;
@@ -62,12 +62,10 @@ public final class LegacyHandlerProxy extends AbstractHandler {
* Constructs a new instance of <code>HandlerProxy</code> with all the
* information it needs to try to avoid loading until it is needed.
*
- * @param newConfigurationElement
- * The configuration element from which the real class can be
- * loaded at run-time.
+ * @param newConfigurationElement The configuration element from which the real
+ * class can be loaded at run-time.
*/
- public LegacyHandlerProxy(
- final IConfigurationElement newConfigurationElement) {
+ public LegacyHandlerProxy(final IConfigurationElement newConfigurationElement) {
configurationElement = newConfigurationElement;
handler = null;
}
@@ -109,26 +107,24 @@ public final class LegacyHandlerProxy extends AbstractHandler {
* Loads the handler, if possible. If the handler is loaded, then the member
* variables are updated accordingly.
*
- * @return <code>true</code> if the handler is now non-null;
- * <code>false</code> otherwise.
+ * @return <code>true</code> if the handler is now non-null; <code>false</code>
+ * otherwise.
*/
private boolean loadHandler() {
if (handler == null) {
// Load the handler.
try {
- handler = (IHandler) configurationElement
- .createExecutableExtension(HANDLER_ATTRIBUTE_NAME);
+ handler = (IHandler) configurationElement.createExecutableExtension(HANDLER_ATTRIBUTE_NAME);
configurationElement = null;
return true;
} catch (final CoreException e) {
/*
- * TODO If it can't be instantiated, should future attempts to
- * instantiate be blocked?
+ * TODO If it can't be instantiated, should future attempts to instantiate be
+ * blocked?
*/
- final String message = "The proxied handler for '" + configurationElement.getAttribute(HANDLER_ATTRIBUTE_NAME) //$NON-NLS-1$
- + "' could not be loaded"; //$NON-NLS-1$
- IStatus status = new Status(IStatus.ERROR,
- WorkbenchPlugin.PI_WORKBENCH, 0, message, e);
+ final String message = "The proxied handler for '" //$NON-NLS-1$
+ + configurationElement.getAttribute(HANDLER_ATTRIBUTE_NAME) + "' could not be loaded"; //$NON-NLS-1$
+ IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 0, message, e);
WorkbenchPlugin.log(message, status);
return false;
}
@@ -143,8 +139,7 @@ public final class LegacyHandlerProxy extends AbstractHandler {
buffer.append("LegacyProxy("); //$NON-NLS-1$
if (handler == null) {
- final String className = configurationElement
- .getAttribute(HANDLER_ATTRIBUTE_NAME);
+ final String className = configurationElement.getAttribute(HANDLER_ATTRIBUTE_NAME);
buffer.append(className);
} else {
buffer.append(handler);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerService.java
index d5efb23e284..c6caeff9c7a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerService.java
@@ -79,8 +79,7 @@ public class LegacyHandlerService implements IHandlerService {
private static final String[] SELECTION_VARIABLES = { ISources.ACTIVE_CURRENT_SELECTION_NAME,
ISources.ACTIVE_FOCUS_CONTROL_ID_NAME, ISources.ACTIVE_FOCUS_CONTROL_NAME,
- ISources.ACTIVE_MENU_EDITOR_INPUT_NAME, ISources.ACTIVE_MENU_NAME,
- ISources.ACTIVE_MENU_SELECTION_NAME };
+ ISources.ACTIVE_MENU_EDITOR_INPUT_NAME, ISources.ACTIVE_MENU_NAME, ISources.ACTIVE_MENU_SELECTION_NAME };
public static final String LEGACY_H_ID = "legacy::handler::"; //$NON-NLS-1$
@@ -154,15 +153,13 @@ public class LegacyHandlerService implements IHandlerService {
private static IHandlerActivation systemHandlerActivation;
-
-
- public static IHandlerActivation registerLegacyHandler(final IEclipseContext context,
- String id, final String cmdId, IHandler handler, Expression activeWhen) {
+ public static IHandlerActivation registerLegacyHandler(final IEclipseContext context, String id, final String cmdId,
+ IHandler handler, Expression activeWhen) {
return registerLegacyHandler(context, id, cmdId, handler, activeWhen, null, null);
}
- private static IHandlerActivation registerLegacyHandler(final IEclipseContext context,
- String id, final String cmdId, IHandler handler, Expression activeWhen, String helpContextId,
+ private static IHandlerActivation registerLegacyHandler(final IEclipseContext context, String id,
+ final String cmdId, IHandler handler, Expression activeWhen, String helpContextId,
Collection<HandlerActivation> handlerActivations) {
ECommandService cs = context.get(ECommandService.class);
Command command = cs.getCommand(cmdId);
@@ -170,8 +167,7 @@ public class LegacyHandlerService implements IHandlerService {
if (helpContextId != null) {
setHelpContextId(handler, helpContextId, context);
}
- HandlerActivation activation = new HandlerActivation(context, cmdId, handler, handlerProxy,
- activeWhen);
+ HandlerActivation activation = new HandlerActivation(context, cmdId, handler, handlerProxy, activeWhen);
addHandlerActivation(activation);
EHandlerService hs = context.get(EHandlerService.class);
hs.activateHandler(cmdId, new HandlerSelectionFunction(cmdId));
@@ -184,8 +180,7 @@ public class LegacyHandlerService implements IHandlerService {
static void addHandlerActivation(HandlerActivation eActivation) {
@SuppressWarnings("unchecked")
List<HandlerActivation> handlerActivations = (List<HandlerActivation>) eActivation.context
- .getLocal(LEGACY_H_ID
- + eActivation.getCommandId());
+ .getLocal(LEGACY_H_ID + eActivation.getCommandId());
if (handlerActivations == null) {
handlerActivations = new ArrayList<>();
} else {
@@ -202,8 +197,7 @@ public class LegacyHandlerService implements IHandlerService {
static void removeHandlerActivation(HandlerActivation eActivation) {
@SuppressWarnings("unchecked")
List<HandlerActivation> handlerActivations = (List<HandlerActivation>) eActivation.context
- .getLocal(LEGACY_H_ID
- + eActivation.getCommandId());
+ .getLocal(LEGACY_H_ID + eActivation.getCommandId());
if (handlerActivations == null) {
handlerActivations = new ArrayList<>();
} else {
@@ -249,8 +243,8 @@ public class LegacyHandlerService implements IHandlerService {
}
/**
- * Deactivates all of the activations read from the registry, and then
- * clears the collection. This should be called before every read.
+ * Deactivates all of the activations read from the registry, and then clears
+ * the collection. This should be called before every read.
*/
private void clearActivations() {
deactivateHandlers(handlerActivations);
@@ -301,14 +295,13 @@ public class LegacyHandlerService implements IHandlerService {
}
@Override
- public IHandlerActivation activateHandler(String commandId, IHandler handler,
- Expression expression) {
+ public IHandlerActivation activateHandler(String commandId, IHandler handler, Expression expression) {
return activateHandler(commandId, handler, expression, false);
}
@Override
- public IHandlerActivation activateHandler(String commandId, IHandler handler,
- Expression expression, boolean global) {
+ public IHandlerActivation activateHandler(String commandId, IHandler handler, Expression expression,
+ boolean global) {
if (global || defaultExpression == null) {
return registerLegacyHandler(eclipseContext, commandId, commandId, handler, expression);
}
@@ -325,25 +318,22 @@ public class LegacyHandlerService implements IHandlerService {
}
@Override
- public IHandlerActivation activateHandler(String commandId, IHandler handler,
- Expression expression, int sourcePriorities) {
+ public IHandlerActivation activateHandler(String commandId, IHandler handler, Expression expression,
+ int sourcePriorities) {
return activateHandler(commandId, handler, expression, false);
}
@Override
public ExecutionEvent createExecutionEvent(Command command, Event event) {
- EvaluationContext legacy = new EvaluationContext(evalContext,
- evalContext.getDefaultVariable());
+ EvaluationContext legacy = new EvaluationContext(evalContext, evalContext.getDefaultVariable());
ExecutionEvent e = new ExecutionEvent(command, Collections.EMPTY_MAP, event, legacy);
return e;
}
@Override
public ExecutionEvent createExecutionEvent(ParameterizedCommand command, Event event) {
- EvaluationContext legacy = new EvaluationContext(evalContext,
- evalContext.getDefaultVariable());
- ExecutionEvent e = new ExecutionEvent(command.getCommand(), command.getParameterMap(),
- event, legacy);
+ EvaluationContext legacy = new EvaluationContext(evalContext, evalContext.getDefaultVariable());
+ ExecutionEvent e = new ExecutionEvent(command.getCommand(), command.getParameterMap(), event, legacy);
return e;
}
@@ -372,8 +362,8 @@ public class LegacyHandlerService implements IHandlerService {
}
@Override
- public Object executeCommand(String commandId, Event event) throws ExecutionException,
- NotDefinedException, NotEnabledException, NotHandledException {
+ public Object executeCommand(String commandId, Event event)
+ throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException {
ECommandService cs = eclipseContext.get(ECommandService.class);
final Command command = cs.getCommand(commandId);
return executeCommand(ParameterizedCommand.generateCommand(command, null), event);
@@ -381,8 +371,7 @@ public class LegacyHandlerService implements IHandlerService {
@Override
public Object executeCommand(ParameterizedCommand command, Event event)
- throws ExecutionException, NotDefinedException, NotEnabledException,
- NotHandledException {
+ throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException {
EHandlerService hs = eclipseContext.get(EHandlerService.class);
if (hs == null) {
@@ -423,9 +412,8 @@ public class LegacyHandlerService implements IHandlerService {
}
@Override
- public Object executeCommandInContext(ParameterizedCommand command, Event event,
- IEvaluationContext context) throws ExecutionException, NotDefinedException,
- NotEnabledException, NotHandledException {
+ public Object executeCommandInContext(ParameterizedCommand command, Event event, IEvaluationContext context)
+ throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException {
IHandler handler = command.getCommand().getHandler();
boolean enabled = handler.isEnabled();
IEclipseContext staticContext = null;
@@ -529,11 +517,11 @@ public class LegacyHandlerService implements IHandlerService {
}
/**
- * Checks the cause of the provided exception and rethrows the cause instead
- * if it was one of the expected exception types.
+ * Checks the cause of the provided exception and rethrows the cause instead if
+ * it was one of the expected exception types.
*/
- private void rethrow(InjectionException e) throws ExecutionException, NotDefinedException,
- NotEnabledException, NotHandledException {
+ private void rethrow(InjectionException e)
+ throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException {
Throwable cause = e.getCause();
if (cause instanceof ExecutionException) {
throw (ExecutionException) cause;
@@ -549,8 +537,7 @@ public class LegacyHandlerService implements IHandlerService {
@Override
public IEvaluationContext createContextSnapshot(boolean includeSelection) {
IEvaluationContext tmpContext = getCurrentState();
- IEvaluationContext context = new EvaluationContext(null,
- IEvaluationContext.UNDEFINED_VARIABLE);
+ IEvaluationContext context = new EvaluationContext(null, IEvaluationContext.UNDEFINED_VARIABLE);
if (includeSelection) {
for (String variable : SELECTION_VARIABLES) {
@@ -601,17 +588,14 @@ public class LegacyHandlerService implements IHandlerService {
private void readHandlers() {
IExtensionRegistry registry = eclipseContext.get(IExtensionRegistry.class);
- IExtensionPoint extPoint = registry
- .getExtensionPoint(IWorkbenchRegistryConstants.EXTENSION_HANDLERS);
+ IExtensionPoint extPoint = registry.getExtensionPoint(IWorkbenchRegistryConstants.EXTENSION_HANDLERS);
IConfigurationElement[] elements = extPoint.getConfigurationElements();
for (IConfigurationElement configElement : elements) {
- String commandId = configElement
- .getAttribute(IWorkbenchRegistryConstants.ATT_COMMAND_ID);
+ String commandId = configElement.getAttribute(IWorkbenchRegistryConstants.ATT_COMMAND_ID);
if (commandId == null || commandId.length() == 0) {
continue;
}
- String defaultHandler = configElement
- .getAttribute(IWorkbenchRegistryConstants.ATT_CLASS);
+ String defaultHandler = configElement.getAttribute(IWorkbenchRegistryConstants.ATT_CLASS);
if ((defaultHandler == null)
&& (configElement.getChildren(IWorkbenchRegistryConstants.TAG_CLASS).length == 0)) {
continue;
@@ -623,8 +607,7 @@ public class LegacyHandlerService implements IHandlerService {
final IConfigurationElement[] subChildren = awChildren[0].getChildren();
if (subChildren.length != 1) {
if (Policy.DEBUG_CMDS) {
- Activator.trace(Policy.DEBUG_CMDS_FLAG,
- "Incorrect activeWhen element " + commandId, null); //$NON-NLS-1$
+ Activator.trace(Policy.DEBUG_CMDS_FLAG, "Incorrect activeWhen element " + commandId, null); //$NON-NLS-1$
}
continue;
}
@@ -634,8 +617,7 @@ public class LegacyHandlerService implements IHandlerService {
activeWhen = elementHandler.create(converter, subChildren[0]);
} catch (CoreException e) {
if (Policy.DEBUG_CMDS) {
- Activator.trace(Policy.DEBUG_CMDS_FLAG,
- "Incorrect activeWhen element " + commandId, e); //$NON-NLS-1$
+ Activator.trace(Policy.DEBUG_CMDS_FLAG, "Incorrect activeWhen element " + commandId, e); //$NON-NLS-1$
}
}
}
@@ -646,8 +628,7 @@ public class LegacyHandlerService implements IHandlerService {
final IConfigurationElement[] subChildren = ewChildren[0].getChildren();
if (subChildren.length != 1) {
if (Policy.DEBUG_CMDS) {
- Activator.trace(Policy.DEBUG_CMDS_FLAG,
- "Incorrect enableWhen element " + commandId, null); //$NON-NLS-1$
+ Activator.trace(Policy.DEBUG_CMDS_FLAG, "Incorrect enableWhen element " + commandId, null); //$NON-NLS-1$
}
continue;
}
@@ -657,42 +638,35 @@ public class LegacyHandlerService implements IHandlerService {
enabledWhen = elementHandler.create(converter, subChildren[0]);
} catch (CoreException e) {
if (Policy.DEBUG_CMDS) {
- Activator.trace(Policy.DEBUG_CMDS_FLAG,
- "Incorrect enableWhen element " + commandId, e); //$NON-NLS-1$
+ Activator.trace(Policy.DEBUG_CMDS_FLAG, "Incorrect enableWhen element " + commandId, e); //$NON-NLS-1$
}
}
}
- registerLegacyHandler(
- eclipseContext,
- commandId,
- commandId,
+ registerLegacyHandler(eclipseContext, commandId, commandId,
new org.eclipse.ui.internal.handlers.HandlerProxy(commandId, configElement,
- IWorkbenchRegistryConstants.ATT_CLASS, enabledWhen, eclipseContext
- .get(IEvaluationService.class)), activeWhen,
- configElement.getAttribute(IWorkbenchRegistryConstants.ATT_HELP_CONTEXT_ID), handlerActivations);
+ IWorkbenchRegistryConstants.ATT_CLASS, enabledWhen,
+ eclipseContext.get(IEvaluationService.class)),
+ activeWhen, configElement.getAttribute(IWorkbenchRegistryConstants.ATT_HELP_CONTEXT_ID),
+ handlerActivations);
}
}
private void readDefaultHandlers() {
IExtensionRegistry registry = eclipseContext.get(IExtensionRegistry.class);
- IExtensionPoint extPoint = registry
- .getExtensionPoint(IWorkbenchRegistryConstants.EXTENSION_COMMANDS);
+ IExtensionPoint extPoint = registry.getExtensionPoint(IWorkbenchRegistryConstants.EXTENSION_COMMANDS);
IConfigurationElement[] elements = extPoint.getConfigurationElements();
for (IConfigurationElement configElement : elements) {
String id = configElement.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
if (id == null || id.length() == 0) {
continue;
}
- String defaultHandler = configElement
- .getAttribute(IWorkbenchRegistryConstants.ATT_DEFAULT_HANDLER);
+ String defaultHandler = configElement.getAttribute(IWorkbenchRegistryConstants.ATT_DEFAULT_HANDLER);
if ((defaultHandler == null)
&& (configElement.getChildren(IWorkbenchRegistryConstants.TAG_DEFAULT_HANDLER).length == 0)) {
continue;
}
- registerLegacyHandler(eclipseContext, id, id,
- new org.eclipse.ui.internal.handlers.HandlerProxy(id, configElement,
- IWorkbenchRegistryConstants.ATT_DEFAULT_HANDLER),
- null, null, handlerActivations);
+ registerLegacyHandler(eclipseContext, id, id, new org.eclipse.ui.internal.handlers.HandlerProxy(id,
+ configElement, IWorkbenchRegistryConstants.ATT_DEFAULT_HANDLER), null, null, handlerActivations);
}
}
@@ -702,8 +676,7 @@ public class LegacyHandlerService implements IHandlerService {
setHelpContextId(handler, helpContextId, eclipseContext);
}
- private static void setHelpContextId(IHandler handler, String helpContextId,
- IEclipseContext eclipseContext) {
+ private static void setHelpContextId(IHandler handler, String helpContextId, IEclipseContext eclipseContext) {
ICommandHelpService commandHelpService = eclipseContext.get(ICommandHelpService.class);
commandHelpService.setHelpContextId(handler, helpContextId);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerWrapper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerWrapper.java
index 85ffdafdb7e..7eca6010e15 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerWrapper.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerWrapper.java
@@ -33,8 +33,7 @@ public final class LegacyHandlerWrapper implements IHandler {
* This flag can be set to <code>true</code> if commands should print
* information to <code>System.out</code> when changing handlers.
*/
- private static final boolean DEBUG_HANDLERS = Policy.DEBUG_HANDLERS
- && Policy.DEBUG_HANDLERS_VERBOSE;
+ private static final boolean DEBUG_HANDLERS = Policy.DEBUG_HANDLERS && Policy.DEBUG_HANDLERS_VERBOSE;
/**
* The wrapped handler; never <code>null</code>.
@@ -44,14 +43,12 @@ public final class LegacyHandlerWrapper implements IHandler {
/**
* Constructs a new instance of <code>HandlerWrapper</code>.
*
- * @param handler
- * The handler that should be wrapped; must not be
- * <code>null</code>.
+ * @param handler The handler that should be wrapped; must not be
+ * <code>null</code>.
*/
public LegacyHandlerWrapper(final org.eclipse.ui.commands.IHandler handler) {
if (handler == null) {
- throw new NullPointerException(
- "A handler wrapper cannot be constructed on a null handler"); //$NON-NLS-1$
+ throw new NullPointerException("A handler wrapper cannot be constructed on a null handler"); //$NON-NLS-1$
}
this.handler = handler;
@@ -59,8 +56,7 @@ public final class LegacyHandlerWrapper implements IHandler {
@Override
public void addHandlerListener(final IHandlerListener handlerListener) {
- handler.addHandlerListener(new LegacyHandlerListenerWrapper(this,
- handlerListener));
+ handler.addHandlerListener(new LegacyHandlerListenerWrapper(this, handlerListener));
}
@Override
@@ -82,8 +78,7 @@ public final class LegacyHandlerWrapper implements IHandler {
}
@Override
- public Object execute(final ExecutionEvent event)
- throws ExecutionException {
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
// Debugging output
if (DEBUG_HANDLERS) {
final StringBuilder buffer = new StringBuilder("Executing LegacyHandlerWrapper for "); //$NON-NLS-1$
@@ -111,8 +106,7 @@ public final class LegacyHandlerWrapper implements IHandler {
@Override
public boolean isEnabled() {
- final Object enabled = handler.getAttributeValuesByName().get(
- ILegacyAttributeNames.ENABLED);
+ final Object enabled = handler.getAttributeValuesByName().get(ILegacyAttributeNames.ENABLED);
if (enabled instanceof Boolean) {
return ((Boolean) enabled).booleanValue();
}
@@ -122,8 +116,7 @@ public final class LegacyHandlerWrapper implements IHandler {
@Override
public boolean isHandled() {
- final Object handled = handler.getAttributeValuesByName().get(
- ILegacyAttributeNames.HANDLED);
+ final Object handled = handler.getAttributeValuesByName().get(ILegacyAttributeNames.HANDLED);
if (handled instanceof Boolean) {
return ((Boolean) handled).booleanValue();
}
@@ -132,10 +125,8 @@ public final class LegacyHandlerWrapper implements IHandler {
}
@Override
- public void removeHandlerListener(
- final IHandlerListener handlerListener) {
- handler.removeHandlerListener(new LegacyHandlerListenerWrapper(this,
- handlerListener));
+ public void removeHandlerListener(final IHandlerListener handlerListener) {
+ handler.removeHandlerListener(new LegacyHandlerListenerWrapper(this, handlerListener));
}
@Override
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LockToolBarHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LockToolBarHandler.java
index f823e28deb8..b28a312e7b3 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LockToolBarHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LockToolBarHandler.java
@@ -36,6 +36,7 @@ import org.eclipse.ui.internal.WorkbenchWindow;
public class LockToolBarHandler extends AbstractHandler {
private static final String TOOLBAR_SEPARATOR = "toolbarSeparator"; //$NON-NLS-1$
+
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/MinimizePartHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/MinimizePartHandler.java
index 89327823bc7..b22092836ff 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/MinimizePartHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/MinimizePartHandler.java
@@ -31,8 +31,7 @@ public class MinimizePartHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- IWorkbenchWindow activeWorkbenchWindow = HandlerUtil
- .getActiveWorkbenchWindow(event);
+ IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);
if (activeWorkbenchWindow != null) {
IWorkbenchPage page = activeWorkbenchWindow.getActivePage();
if (page != null) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/NewEditorHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/NewEditorHandler.java
index bd80e34ea61..76d3f2399b7 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/NewEditorHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/NewEditorHandler.java
@@ -39,8 +39,7 @@ public class NewEditorHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- IWorkbenchWindow activeWorkbenchWindow = HandlerUtil
- .getActiveWorkbenchWindow(event);
+ IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);
IWorkbenchPage page = activeWorkbenchWindow.getActivePage();
if (page == null) {
return null;
@@ -55,19 +54,15 @@ public class NewEditorHandler extends AbstractHandler {
}
try {
if (editor instanceof IPersistableEditor) {
- XMLMemento editorState = XMLMemento
- .createWriteRoot(IWorkbenchConstants.TAG_EDITOR_STATE);
+ XMLMemento editorState = XMLMemento.createWriteRoot(IWorkbenchConstants.TAG_EDITOR_STATE);
((IPersistableEditor) editor).saveState(editorState);
- ((WorkbenchPage) page).openEditor(editor.getEditorInput(),
- editorId, true,
- IWorkbenchPage.MATCH_NONE, editorState, true);
+ ((WorkbenchPage) page).openEditor(editor.getEditorInput(), editorId, true, IWorkbenchPage.MATCH_NONE,
+ editorState, true);
} else {
- page.openEditor(editor.getEditorInput(), editorId, true,
- IWorkbenchPage.MATCH_NONE);
+ page.openEditor(editor.getEditorInput(), editorId, true, IWorkbenchPage.MATCH_NONE);
}
} catch (PartInitException e) {
- DialogUtil.openError(activeWorkbenchWindow.getShell(),
- WorkbenchMessages.Error, e.getMessage(), e);
+ DialogUtil.openError(activeWorkbenchWindow.getShell(), WorkbenchMessages.Error, e.getMessage(), e);
}
return null;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/OpenInNewWindowHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/OpenInNewWindowHandler.java
index b1d2cf8f010..e21bb315cdb 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/OpenInNewWindowHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/OpenInNewWindowHandler.java
@@ -35,8 +35,7 @@ public class OpenInNewWindowHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- IWorkbenchWindow activeWorkbenchWindow = HandlerUtil
- .getActiveWorkbenchWindow(event);
+ IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);
if (activeWorkbenchWindow == null) {
return null;
}
@@ -44,22 +43,18 @@ public class OpenInNewWindowHandler extends AbstractHandler {
String perspId = null;
IWorkbenchPage page = activeWorkbenchWindow.getActivePage();
- IAdaptable pageInput = ((Workbench) activeWorkbenchWindow
- .getWorkbench()).getDefaultPageInput();
+ IAdaptable pageInput = ((Workbench) activeWorkbenchWindow.getWorkbench()).getDefaultPageInput();
if (page != null && page.getPerspective() != null) {
perspId = page.getPerspective().getId();
pageInput = page.getInput();
} else {
- perspId = activeWorkbenchWindow.getWorkbench()
- .getPerspectiveRegistry().getDefaultPerspective();
+ perspId = activeWorkbenchWindow.getWorkbench().getPerspectiveRegistry().getDefaultPerspective();
}
- activeWorkbenchWindow.getWorkbench().openWorkbenchWindow(perspId,
- pageInput);
+ activeWorkbenchWindow.getWorkbench().openWorkbenchWindow(perspId, pageInput);
} catch (WorkbenchException e) {
StatusUtil.handleStatus(e.getStatus(),
- WorkbenchMessages.OpenInNewWindowAction_errorTitle
- + ": " + e.getMessage(), //$NON-NLS-1$
+ WorkbenchMessages.OpenInNewWindowAction_errorTitle + ": " + e.getMessage(), //$NON-NLS-1$
StatusManager.SHOW);
}
return null;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/PinEditorHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/PinEditorHandler.java
index 1c93c9a33ce..57d4a0f77e6 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/PinEditorHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/PinEditorHandler.java
@@ -32,8 +32,7 @@ import org.eclipse.ui.menus.UIElement;
* Replacement for the PinEditorAction.
*
*/
-public class PinEditorHandler extends AbstractHandler implements
- IElementUpdater {
+public class PinEditorHandler extends AbstractHandler implements IElementUpdater {
@Override
public Object execute(ExecutionEvent event) {
@@ -45,14 +44,12 @@ public class PinEditorHandler extends AbstractHandler implements
if (editor == null) {
return null;
}
- IWorkbenchPartReference ref = window.getActivePage().getReference(
- editor);
+ IWorkbenchPartReference ref = window.getActivePage().getReference(editor);
if (ref instanceof WorkbenchPartReference) {
WorkbenchPartReference concreteRef = (WorkbenchPartReference) ref;
concreteRef.setPinned(!concreteRef.isPinned());
- ICommandService commandService = window
- .getService(ICommandService.class);
+ ICommandService commandService = window.getService(ICommandService.class);
commandService.refreshElements(event.getCommand().getId(), null);
}
return null;
@@ -60,8 +57,7 @@ public class PinEditorHandler extends AbstractHandler implements
@Override
public void updateElement(UIElement element, Map parameters) {
- IWorkbenchWindow window = element
- .getServiceLocator().getService(IWorkbenchWindow.class);
+ IWorkbenchWindow window = element.getServiceLocator().getService(IWorkbenchWindow.class);
if (window == null) {
return;
}
@@ -73,8 +69,7 @@ public class PinEditorHandler extends AbstractHandler implements
if (editor == null) {
return;
}
- IWorkbenchPartReference ref = page.getReference(
- editor);
+ IWorkbenchPartReference ref = page.getReference(editor);
if (ref instanceof WorkbenchPartReference) {
WorkbenchPartReference concreteRef = (WorkbenchPartReference) ref;
element.setChecked(concreteRef.isPinned());
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/PropertyDialogHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/PropertyDialogHandler.java
index e438cbf02e1..d38bfbf5e3a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/PropertyDialogHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/PropertyDialogHandler.java
@@ -31,6 +31,7 @@ import org.eclipse.ui.internal.dialogs.PropertyDialog;
public class PropertyDialogHandler extends AbstractHandler {
private String initialPageId = null;
+
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
PreferenceDialog dialog;
@@ -41,10 +42,9 @@ public class PropertyDialogHandler extends AbstractHandler {
element = currentSelection.getFirstElement();
- if (activeWorkbenchWindow != null){
+ if (activeWorkbenchWindow != null) {
shell = activeWorkbenchWindow.getShell();
- dialog = PropertyDialog.createDialogOn(shell,
- initialPageId, element);
+ dialog = PropertyDialog.createDialogOn(shell, initialPageId, element);
if (dialog != null) {
dialog.open();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/QuickMenuHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/QuickMenuHandler.java
index 37d7f535d31..be7d23116eb 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/QuickMenuHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/QuickMenuHandler.java
@@ -46,10 +46,8 @@ public class QuickMenuHandler extends AbstractHandler implements IMenuListener2
if (!(menu instanceof ContributionManager)) {
return;
}
- IMenuService service = PlatformUI.getWorkbench()
- .getService(IMenuService.class);
- service.populateContributionManager((ContributionManager) menu,
- locationURI);
+ IMenuService service = PlatformUI.getWorkbench().getService(IMenuService.class);
+ service.populateContributionManager((ContributionManager) menu, locationURI);
menu.addMenuListener(QuickMenuHandler.this);
}
@@ -81,8 +79,7 @@ public class QuickMenuHandler extends AbstractHandler implements IMenuListener2
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
- IMenuService service = PlatformUI.getWorkbench()
- .getService(IMenuService.class);
+ IMenuService service = PlatformUI.getWorkbench().getService(IMenuService.class);
service.releaseContributions((ContributionManager) managerM);
return Status.OK_STATUS;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ResetPerspectiveHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ResetPerspectiveHandler.java
index 870391d781d..f8de33c1ec5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ResetPerspectiveHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ResetPerspectiveHandler.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2011, 2014 IBM Corporation and others.
- *
+ *
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
@@ -53,18 +53,15 @@ public class ResetPerspectiveHandler extends AbstractHandler {
}
if (offerRevertToBase) {
- String message = NLS.bind(WorkbenchMessages.RevertPerspective_message,
- descriptor.getLabel());
+ String message = NLS.bind(WorkbenchMessages.RevertPerspective_message, descriptor.getLabel());
boolean toggleState = false;
- MessageDialogWithToggle dialog = MessageDialogWithToggle.open(
- MessageDialog.QUESTION, activeWorkbenchWindow.getShell(),
- WorkbenchMessages.RevertPerspective_title, message,
- WorkbenchMessages.RevertPerspective_option, toggleState, null,
- null, SWT.SHEET);
+ MessageDialogWithToggle dialog = MessageDialogWithToggle.open(MessageDialog.QUESTION,
+ activeWorkbenchWindow.getShell(), WorkbenchMessages.RevertPerspective_title, message,
+ WorkbenchMessages.RevertPerspective_option, toggleState, null, null, SWT.SHEET);
if (dialog.getReturnCode() == IDialogConstants.YES_ID) {
if (dialog.getToggleState()) {
- PerspectiveRegistry reg = (PerspectiveRegistry) PlatformUI
- .getWorkbench().getPerspectiveRegistry();
+ PerspectiveRegistry reg = (PerspectiveRegistry) PlatformUI.getWorkbench()
+ .getPerspectiveRegistry();
reg.revertPerspective(descriptor);
}
page.resetPerspective();
@@ -73,8 +70,8 @@ public class ResetPerspectiveHandler extends AbstractHandler {
String message = NLS.bind(WorkbenchMessages.ResetPerspective_message, descriptor.getLabel());
int result = MessageDialog.open(MessageDialog.CONFIRM, activeWorkbenchWindow.getShell(),
- WorkbenchMessages.ResetPerspective_title, message, SWT.SHEET, WorkbenchMessages.ResetPerspective_buttonLabel,
- IDialogConstants.NO_LABEL);
+ WorkbenchMessages.ResetPerspective_title, message, SWT.SHEET,
+ WorkbenchMessages.ResetPerspective_buttonLabel, IDialogConstants.NO_LABEL);
if (result == Window.OK) {
page.resetPerspective();
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/RestartWorkbenchHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/RestartWorkbenchHandler.java
index e051e6192d5..877847a08d8 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/RestartWorkbenchHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/RestartWorkbenchHandler.java
@@ -25,7 +25,7 @@ import org.eclipse.ui.PlatformUI;
public class RestartWorkbenchHandler extends AbstractHandler {
@Override
- public Object execute(ExecutionEvent event){
+ public Object execute(ExecutionEvent event) {
PlatformUI.getWorkbench().restart(true);
return null;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ReuseEditorTester.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ReuseEditorTester.java
index f66d1da9d4b..8caadd7a5ec 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ReuseEditorTester.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ReuseEditorTester.java
@@ -26,10 +26,8 @@ import org.eclipse.ui.internal.WorkbenchPlugin;
public class ReuseEditorTester extends PropertyTester {
@Override
- public boolean test(Object receiver, String property, Object[] args,
- Object expectedValue) {
- IPreferenceStore store = WorkbenchPlugin.getDefault()
- .getPreferenceStore();
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
return store.getBoolean(IPreferenceConstants.REUSE_EDITORS_BOOLEAN);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/SaveAllHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/SaveAllHandler.java
index 1be4b484d1c..885c6044b6b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/SaveAllHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/SaveAllHandler.java
@@ -44,8 +44,7 @@ public class SaveAllHandler extends AbstractSaveHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- IWorkbenchWindow window = HandlerUtil
- .getActiveWorkbenchWindowChecked(event);
+ IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
IWorkbenchPage page = window.getActivePage();
if (page != null) {
((WorkbenchPage) page).saveAllEditors(false, false, true);
@@ -73,8 +72,8 @@ public class SaveAllHandler extends AbstractSaveHandler {
// Since Save All also saves saveables from non-part sources,
// look if any such saveables exist and are dirty.
- SaveablesList saveablesList = (SaveablesList) window.getWorkbench().getService(
- ISaveablesLifecycleListener.class);
+ SaveablesList saveablesList = (SaveablesList) window.getWorkbench()
+ .getService(ISaveablesLifecycleListener.class);
if (saveablesList == null) {
return EvaluationResult.FALSE;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/SavePerspectiveHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/SavePerspectiveHandler.java
index 83fc657b2c3..e635458b1f7 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/SavePerspectiveHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/SavePerspectiveHandler.java
@@ -1,16 +1,16 @@
/*******************************************************************************
* Copyright (c) 2010, 2015 IBM Corporation and others.
- *
+ *
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
- ******************************************************************************/
+ ******************************************************************************/
package org.eclipse.ui.internal.handlers;
@@ -42,7 +42,7 @@ public class SavePerspectiveHandler extends AbstractHandler {
@Inject
EModelService modelService;
-
+
@Override
public Object execute(ExecutionEvent event) {
@@ -81,12 +81,10 @@ public class SavePerspectiveHandler extends AbstractHandler {
*/
private void saveNonSingleton(IWorkbenchPage page, PerspectiveDescriptor oldDesc) {
// Get reg.
- PerspectiveRegistry reg = (PerspectiveRegistry) WorkbenchPlugin.getDefault()
- .getPerspectiveRegistry();
+ PerspectiveRegistry reg = (PerspectiveRegistry) WorkbenchPlugin.getDefault().getPerspectiveRegistry();
// Get persp name.
- SavePerspectiveDialog dlg = new SavePerspectiveDialog(page.getWorkbenchWindow().getShell(),
- reg);
+ SavePerspectiveDialog dlg = new SavePerspectiveDialog(page.getWorkbenchWindow().getShell(), reg);
// Look up the descriptor by id again to ensure it is still valid.
IPerspectiveDescriptor description = reg.findPerspectiveWithId(oldDesc.getId());
dlg.setInitialSelection(description);
@@ -100,8 +98,7 @@ public class SavePerspectiveHandler extends AbstractHandler {
String name = dlg.getPerspName();
newDesc = reg.createPerspective(name, (PerspectiveDescriptor) description);
if (newDesc == null) {
- MessageDialog.openError(dlg.getShell(),
- WorkbenchMessages.SavePerspective_errorTitle,
+ MessageDialog.openError(dlg.getShell(), WorkbenchMessages.SavePerspective_errorTitle,
WorkbenchMessages.SavePerspective_errorMessage);
return;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/SelectAllHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/SelectAllHandler.java
index c74d7b6abb9..d9386048a53 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/SelectAllHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/SelectAllHandler.java
@@ -42,18 +42,16 @@ public class SelectAllHandler extends WidgetMethodHandler {
private static final Class[] METHOD_PARAMETERS = { Point.class };
@Override
- public final Object execute(final ExecutionEvent event)
- throws ExecutionException {
+ public final Object execute(final ExecutionEvent event) throws ExecutionException {
final Method methodToExecute = getMethodToExecute();
if (methodToExecute != null) {
try {
- final Control focusControl = Display.getCurrent()
- .getFocusControl();
+ final Control focusControl = Display.getCurrent().getFocusControl();
final int numParams = methodToExecute.getParameterTypes().length;
if ((focusControl instanceof Composite)
- && ((((Composite) focusControl).getStyle() & SWT.EMBEDDED) != 0)) {
+ && ((((Composite) focusControl).getStyle() & SWT.EMBEDDED) != 0)) {
// we only support selectAll for swing components
if (numParams != 0) {
@@ -61,17 +59,14 @@ public class SelectAllHandler extends WidgetMethodHandler {
}
/*
- * Okay. Have a seat. Relax a while. This is going to be a
- * bumpy ride. If it is an embedded widget, then it *might*
- * be a Swing widget. At the point where this handler is
- * executing, the key event is already bound to be
- * swallowed. If I don't do something, then the key will be
- * gone for good. So, I will try to forward the event to the
- * Swing widget. Unfortunately, we can't even count on the
- * Swing libraries existing, so I need to use reflection
- * everywhere. And, to top it off, I need to dispatch the
- * event on the Swing event queue, which means that it will
- * be carried out asynchronously to the SWT event queue.
+ * Okay. Have a seat. Relax a while. This is going to be a bumpy ride. If it is
+ * an embedded widget, then it *might* be a Swing widget. At the point where
+ * this handler is executing, the key event is already bound to be swallowed. If
+ * I don't do something, then the key will be gone for good. So, I will try to
+ * forward the event to the Swing widget. Unfortunately, we can't even count on
+ * the Swing libraries existing, so I need to use reflection everywhere. And, to
+ * top it off, I need to dispatch the event on the Swing event queue, which
+ * means that it will be carried out asynchronously to the SWT event queue.
*/
try {
final Object focusComponent = getFocusComponent();
@@ -80,37 +75,25 @@ public class SelectAllHandler extends WidgetMethodHandler {
try {
methodToExecute.invoke(focusComponent);
// and back to the UI thread :-)
- focusControl.getDisplay().asyncExec(
- () -> {
- if (!focusControl
- .isDisposed()) {
- focusControl
- .notifyListeners(
- SWT.Selection,
- null);
- }
- });
+ focusControl.getDisplay().asyncExec(() -> {
+ if (!focusControl.isDisposed()) {
+ focusControl.notifyListeners(SWT.Selection, null);
+ }
+ });
} catch (final IllegalAccessException e1) {
// The method is protected, so do
// nothing.
} catch (final InvocationTargetException e2) {
/*
- * I would like to log this exception --
- * and possibly show a dialog to the
- * user -- but I have to go back to the
- * SWT event loop to do this. So, back
- * we go....
+ * I would like to log this exception -- and possibly show a dialog to the user
+ * -- but I have to go back to the SWT event loop to do this. So, back we go....
*/
- focusControl.getDisplay().asyncExec(
- () -> ExceptionHandler
- .getInstance()
- .handleException(
- new ExecutionException(
- "An exception occurred while executing " //$NON-NLS-1$
- + methodToExecute
- .getName(),
- e2
- .getTargetException())));
+ focusControl.getDisplay()
+ .asyncExec(() -> ExceptionHandler.getInstance()
+ .handleException(new ExecutionException(
+ "An exception occurred while executing " //$NON-NLS-1$
+ + methodToExecute.getName(),
+ e2.getTargetException())));
}
};
@@ -130,12 +113,9 @@ public class SelectAllHandler extends WidgetMethodHandler {
} else if (numParams == 1) {
// This is a single-point selection method.
- final Method textLimitAccessor = focusControl.getClass()
- .getMethod("getTextLimit"); //$NON-NLS-1$
- final Integer textLimit = (Integer) textLimitAccessor
- .invoke(focusControl);
- final Object[] parameters = { new Point(0, textLimit
- .intValue()) };
+ final Method textLimitAccessor = focusControl.getClass().getMethod("getTextLimit"); //$NON-NLS-1$
+ final Integer textLimit = (Integer) textLimitAccessor.invoke(focusControl);
+ final Object[] parameters = { new Point(0, textLimit.intValue()) };
methodToExecute.invoke(focusControl, parameters);
if (!(focusControl instanceof Combo)) {
focusControl.notifyListeners(SWT.Selection, null);
@@ -143,11 +123,10 @@ public class SelectAllHandler extends WidgetMethodHandler {
} else {
/*
- * This means that getMethodToExecute() has been changed,
- * while this method hasn't.
+ * This means that getMethodToExecute() has been changed, while this method
+ * hasn't.
*/
- throw new ExecutionException(
- "Too many parameters on select all", new Exception()); //$NON-NLS-1$
+ throw new ExecutionException("Too many parameters on select all", new Exception()); //$NON-NLS-1$
}
@@ -155,9 +134,8 @@ public class SelectAllHandler extends WidgetMethodHandler {
// The method is protected, so do nothing.
} catch (InvocationTargetException e) {
- throw new ExecutionException(
- "An exception occurred while executing " //$NON-NLS-1$
- + getMethodToExecute(), e.getTargetException());
+ throw new ExecutionException("An exception occurred while executing " //$NON-NLS-1$
+ + getMethodToExecute(), e.getTargetException());
} catch (NoSuchMethodException e) {
// I can't get the text limit. Do nothing.
@@ -198,8 +176,7 @@ public class SelectAllHandler extends WidgetMethodHandler {
* java.lang.String, java.lang.Object)
*/
@Override
- public void setInitializationData(IConfigurationElement config,
- String propertyName, Object data) {
+ public void setInitializationData(IConfigurationElement config, String propertyName, Object data) {
// The name is always "selectAll".
methodName = "selectAll"; //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ShowKeyAssistHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ShowKeyAssistHandler.java
index fb5b40cc315..a06aea8316e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ShowKeyAssistHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ShowKeyAssistHandler.java
@@ -31,8 +31,7 @@ public class ShowKeyAssistHandler extends WorkbenchWindowHandlerDelegate {
* Opens the key assistant. This should never be called until initialization
* occurs.
*
- * @param event
- * Ignored
+ * @param event Ignored
* @return <code>null</code>
*/
@Override
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ShowPreferencePageHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ShowPreferencePageHandler.java
index ae6dfcc287c..ef279a808ac 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ShowPreferencePageHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ShowPreferencePageHandler.java
@@ -38,17 +38,14 @@ import org.eclipse.ui.handlers.HandlerUtil;
*/
public final class ShowPreferencePageHandler extends AbstractHandler {
-
public ShowPreferencePageHandler() {
super();
}
@Override
public Object execute(final ExecutionEvent event) {
- final String preferencePageId = event
- .getParameter(IWorkbenchCommandConstants.WINDOW_PREFERENCES_PARM_PAGEID);
- final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil
- .getActiveWorkbenchWindow(event);
+ final String preferencePageId = event.getParameter(IWorkbenchCommandConstants.WINDOW_PREFERENCES_PARM_PAGEID);
+ final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);
final Shell shell;
if (activeWorkbenchWindow == null) {
@@ -57,8 +54,7 @@ public final class ShowPreferencePageHandler extends AbstractHandler {
shell = activeWorkbenchWindow.getShell();
}
- final PreferenceDialog dialog = PreferencesUtil
- .createPreferenceDialogOn(shell, preferencePageId, null, null);
+ final PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(shell, preferencePageId, null, null);
dialog.open();
return null;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/SpyHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/SpyHandler.java
index 09ca813417c..90a8e297016 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/SpyHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/SpyHandler.java
@@ -111,8 +111,7 @@ public class SpyHandler extends AbstractHandler {
* @param offset
* @param contributionInfo
*/
- protected void doShowTooltip(Control control, Point offset,
- final ContributionInfo contributionInfo) {
+ protected void doShowTooltip(Control control, Point offset, final ContributionInfo contributionInfo) {
ToolTip toolTip = new ToolTip(control, ToolTip.NO_RECREATE, true) {
@Override
@@ -140,11 +139,11 @@ public class SpyHandler extends AbstractHandler {
/**
* Returns a ContributionInfo for the given data object (typically, a data
- * object associated with a widget). If the data object is a
- * ContributionInfo, return it. If it can be adapted to ContributionInfo,
- * return the result of the adaptation. Otherwise, if a non-null
- * 'optionalElementType' string is given, return a contribution info based
- * on it and the bundle that contains the given object's class.
+ * object associated with a widget). If the data object is a ContributionInfo,
+ * return it. If it can be adapted to ContributionInfo, return the result of the
+ * adaptation. Otherwise, if a non-null 'optionalElementType' string is given,
+ * return a contribution info based on it and the bundle that contains the given
+ * object's class.
*/
ContributionInfo getContributionInfo(Object data, String optionalElementType) {
if (data instanceof ContributionInfo) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ToggleCoolbarHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ToggleCoolbarHandler.java
index 99bb5519207..43992764767 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ToggleCoolbarHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ToggleCoolbarHandler.java
@@ -33,13 +33,11 @@ import org.eclipse.ui.menus.UIElement;
*
* @since 3.3
*/
-public class ToggleCoolbarHandler extends AbstractHandler implements
- IElementUpdater {
+public class ToggleCoolbarHandler extends AbstractHandler implements IElementUpdater {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil
- .getActiveWorkbenchWindowChecked(event);
+ final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindowChecked(event);
if (activeWorkbenchWindow instanceof WorkbenchWindow) {
WorkbenchWindow window = (WorkbenchWindow) activeWorkbenchWindow;
window.toggleToolbarVisibility();
@@ -50,22 +48,19 @@ public class ToggleCoolbarHandler extends AbstractHandler implements
@Override
public void updateElement(UIElement element, Map parameters) {
- IWorkbenchLocationService wls = element
- .getServiceLocator()
- .getService(IWorkbenchLocationService.class);
+ IWorkbenchLocationService wls = element.getServiceLocator().getService(IWorkbenchLocationService.class);
IWorkbenchWindow window = wls.getWorkbenchWindow();
if (window == null || !(window instanceof WorkbenchWindow))
return;
- element
- .setText(isCoolbarVisible((WorkbenchWindow) window) ? WorkbenchMessages.ToggleCoolbarVisibilityAction_hide_text
+ element.setText(
+ isCoolbarVisible((WorkbenchWindow) window) ? WorkbenchMessages.ToggleCoolbarVisibilityAction_hide_text
: WorkbenchMessages.ToggleCoolbarVisibilityAction_show_text);
}
/**
* Return whether the coolbar is currently visible.
*
- * @param window
- * the window to test
+ * @param window the window to test
* @return whether or not the coolbar is visible
*/
private boolean isCoolbarVisible(WorkbenchWindow window) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ToggleStatusBarHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ToggleStatusBarHandler.java
index e3fd9a46917..0c997b33174 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ToggleStatusBarHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/ToggleStatusBarHandler.java
@@ -110,14 +110,12 @@ public class ToggleStatusBarHandler extends AbstractHandler implements IElementU
*/
@Override
public void updateElement(UIElement element, Map parameters) {
- IWorkbenchLocationService wls = element
- .getServiceLocator()
- .getService(IWorkbenchLocationService.class);
+ IWorkbenchLocationService wls = element.getServiceLocator().getService(IWorkbenchLocationService.class);
IWorkbenchWindow window = wls.getWorkbenchWindow();
if (!(window instanceof WorkbenchWindow))
return;
MUIElement trimStatus = getTrimStatus((WorkbenchWindow) window);
- if(trimStatus != null) {
+ if (trimStatus != null) {
element.setText(trimStatus.isVisible() ? WorkbenchMessages.ToggleStatusBarVisibilityAction_hide_text
: WorkbenchMessages.ToggleStatusBarVisibilityAction_show_text);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/TraversePageHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/TraversePageHandler.java
index 0fa73d8f2e3..d942b7def5f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/TraversePageHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/TraversePageHandler.java
@@ -40,10 +40,10 @@ public class TraversePageHandler extends WidgetMethodHandler {
public final Object execute(final ExecutionEvent event) {
Control focusControl = Display.getCurrent().getFocusControl();
if (focusControl != null) {
- int traversal= "next".equals(methodName) ? SWT.TRAVERSE_PAGE_NEXT : SWT.TRAVERSE_PAGE_PREVIOUS; //$NON-NLS-1$
+ int traversal = "next".equals(methodName) ? SWT.TRAVERSE_PAGE_NEXT : SWT.TRAVERSE_PAGE_PREVIOUS; //$NON-NLS-1$
Control control = focusControl;
do {
- if (control.traverse (traversal))
+ if (control.traverse(traversal))
return null;
if (control instanceof Shell)
return null;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/WidgetMethodHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/WidgetMethodHandler.java
index 319020975da..7a2fcfc5689 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/WidgetMethodHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/WidgetMethodHandler.java
@@ -34,8 +34,7 @@ import org.eclipse.ui.internal.ExceptionHandler;
*
* @since 3.0
*/
-public class WidgetMethodHandler extends AbstractHandler implements
- IExecutableExtension {
+public class WidgetMethodHandler extends AbstractHandler implements IExecutableExtension {
/**
* The parameters to pass to the method this handler invokes. This handler
@@ -57,8 +56,8 @@ public class WidgetMethodHandler extends AbstractHandler implements
}
/**
- * The name of the method to be invoked by this handler. This value should
- * never be <code>null</code>.
+ * The name of the method to be invoked by this handler. This value should never
+ * be <code>null</code>.
*/
protected String methodName;
private Listener focusListener;
@@ -69,22 +68,18 @@ public class WidgetMethodHandler extends AbstractHandler implements
final Method methodToExecute = getMethodToExecute();
if (methodToExecute != null) {
try {
- final Control focusControl = Display.getCurrent()
- .getFocusControl();
+ final Control focusControl = Display.getCurrent().getFocusControl();
if ((focusControl instanceof Composite)
&& ((((Composite) focusControl).getStyle() & SWT.EMBEDDED) != 0)) {
/*
- * Okay. Have a seat. Relax a while. This is going to be a
- * bumpy ride. If it is an embedded widget, then it *might*
- * be a Swing widget. At the point where this handler is
- * executing, the key event is already bound to be
- * swallowed. If I don't do something, then the key will be
- * gone for good. So, I will try to forward the event to the
- * Swing widget. Unfortunately, we can't even count on the
- * Swing libraries existing, so I need to use reflection
- * everywhere. And, to top it off, I need to dispatch the
- * event on the Swing event queue, which means that it will
- * be carried out asynchronously to the SWT event queue.
+ * Okay. Have a seat. Relax a while. This is going to be a bumpy ride. If it is
+ * an embedded widget, then it *might* be a Swing widget. At the point where
+ * this handler is executing, the key event is already bound to be swallowed. If
+ * I don't do something, then the key will be gone for good. So, I will try to
+ * forward the event to the Swing widget. Unfortunately, we can't even count on
+ * the Swing libraries existing, so I need to use reflection everywhere. And, to
+ * top it off, I need to dispatch the event on the Swing event queue, which
+ * means that it will be carried out asynchronously to the SWT event queue.
*/
try {
final Object focusComponent = getFocusComponent();
@@ -97,22 +92,15 @@ public class WidgetMethodHandler extends AbstractHandler implements
// nothing.
} catch (final InvocationTargetException e2) {
/*
- * I would like to log this exception --
- * and possibly show a dialog to the
- * user -- but I have to go back to the
- * SWT event loop to do this. So, back
- * we go....
+ * I would like to log this exception -- and possibly show a dialog to the user
+ * -- but I have to go back to the SWT event loop to do this. So, back we go....
*/
- focusControl.getDisplay().asyncExec(
- () -> ExceptionHandler
- .getInstance()
- .handleException(
- new ExecutionException(
- "An exception occurred while executing " //$NON-NLS-1$
- + methodToExecute
- .getName(),
- e2
- .getTargetException())));
+ focusControl.getDisplay()
+ .asyncExec(() -> ExceptionHandler.getInstance()
+ .handleException(new ExecutionException(
+ "An exception occurred while executing " //$NON-NLS-1$
+ + methodToExecute.getName(),
+ e2.getTargetException())));
}
};
@@ -135,10 +123,8 @@ public class WidgetMethodHandler extends AbstractHandler implements
// The method is protected, so do nothing.
} catch (InvocationTargetException e) {
- throw new ExecutionException(
- "An exception occurred while executing " //$NON-NLS-1$
- + methodToExecute.getName(), e
- .getTargetException());
+ throw new ExecutionException("An exception occurred while executing " //$NON-NLS-1$
+ + methodToExecute.getName(), e.getTargetException());
}
}
@@ -156,8 +142,7 @@ public class WidgetMethodHandler extends AbstractHandler implements
* @throws InvocationTargetException
*/
protected void swingInvokeLater(Runnable methodRunnable)
- throws ClassNotFoundException, NoSuchMethodException,
- IllegalAccessException, InvocationTargetException {
+ throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
final Class swingUtilitiesClass = Class.forName("javax.swing.SwingUtilities"); //$NON-NLS-1$
final Method swingUtilitiesInvokeLaterMethod = swingUtilitiesClass.getMethod("invokeLater", //$NON-NLS-1$
Runnable.class);
@@ -168,28 +153,25 @@ public class WidgetMethodHandler extends AbstractHandler implements
* Find the swing focus component, if it is available.
*
* @return Hopefully, the swing focus component, but it can return
- * <code>null</code>.
+ * <code>null</code>.
* @throws ClassNotFoundException
* @throws NoSuchMethodException
* @throws IllegalAccessException
* @throws InvocationTargetException
*/
- protected Object getFocusComponent() throws ClassNotFoundException,
- NoSuchMethodException, IllegalAccessException,
- InvocationTargetException {
+ protected Object getFocusComponent()
+ throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
/*
* Before JRE 1.4, one has to use
- * javax.swing.FocusManager.getCurrentManager().getFocusOwner(). Since
- * JRE 1.4, one has to use
- * java.awt.KeyboardFocusManager.getCurrentKeyboardFocusManager
+ * javax.swing.FocusManager.getCurrentManager().getFocusOwner(). Since JRE 1.4,
+ * one has to use java.awt.KeyboardFocusManager.getCurrentKeyboardFocusManager
* ().getFocusOwner(); the use of the older API would install a
- * LegacyGlueFocusTraversalPolicy which causes endless recursions in
- * some situations.
+ * LegacyGlueFocusTraversalPolicy which causes endless recursions in some
+ * situations.
*/
Class keyboardFocusManagerClass = null;
try {
- keyboardFocusManagerClass = Class
- .forName("java.awt.KeyboardFocusManager"); //$NON-NLS-1$
+ keyboardFocusManagerClass = Class.forName("java.awt.KeyboardFocusManager"); //$NON-NLS-1$
} catch (ClassNotFoundException e) {
// switch to the old guy
}
@@ -199,23 +181,16 @@ public class WidgetMethodHandler extends AbstractHandler implements
.getMethod("getCurrentKeyboardFocusManager"); //$NON-NLS-1$
final Object keyboardFocusManager = keyboardFocusManagerGetCurrentKeyboardFocusManagerMethod
.invoke(keyboardFocusManagerClass);
- final Method keyboardFocusManagerGetFocusOwner = keyboardFocusManagerClass
- .getMethod("getFocusOwner"); //$NON-NLS-1$
- final Object focusComponent = keyboardFocusManagerGetFocusOwner
- .invoke(keyboardFocusManager);
+ final Method keyboardFocusManagerGetFocusOwner = keyboardFocusManagerClass.getMethod("getFocusOwner"); //$NON-NLS-1$
+ final Object focusComponent = keyboardFocusManagerGetFocusOwner.invoke(keyboardFocusManager);
return focusComponent;
}
// Use JRE 1.3 API
- final Class focusManagerClass = Class
- .forName("javax.swing.FocusManager"); //$NON-NLS-1$
- final Method focusManagerGetCurrentManagerMethod = focusManagerClass
- .getMethod("getCurrentManager"); //$NON-NLS-1$
- final Object focusManager = focusManagerGetCurrentManagerMethod
- .invoke(focusManagerClass);
- final Method focusManagerGetFocusOwner = focusManagerClass
- .getMethod("getFocusOwner"); //$NON-NLS-1$
- final Object focusComponent = focusManagerGetFocusOwner
- .invoke(focusManager);
+ final Class focusManagerClass = Class.forName("javax.swing.FocusManager"); //$NON-NLS-1$
+ final Method focusManagerGetCurrentManagerMethod = focusManagerClass.getMethod("getCurrentManager"); //$NON-NLS-1$
+ final Object focusManager = focusManagerGetCurrentManagerMethod.invoke(focusManagerClass);
+ final Method focusManagerGetFocusOwner = focusManagerClass.getMethod("getFocusOwner"); //$NON-NLS-1$
+ final Object focusComponent = focusManagerGetFocusOwner.invoke(focusManager);
return focusComponent;
}
@@ -246,16 +221,14 @@ public class WidgetMethodHandler extends AbstractHandler implements
}
}
- if ((method == null)
- && (focusControl instanceof Composite)
+ if ((method == null) && (focusControl instanceof Composite)
&& ((((Composite) focusControl).getStyle() & SWT.EMBEDDED) != 0)) {
/*
- * We couldn't find the appropriate method on the current focus
- * control. It is possible that the current focus control is an
- * embedded SWT composite, which could be containing some Swing
- * components. If this is the case, then we should try to pass
- * through to the underlying Swing component hierarchy. Insha'allah,
- * this will work.
+ * We couldn't find the appropriate method on the current focus control. It is
+ * possible that the current focus control is an embedded SWT composite, which
+ * could be containing some Swing components. If this is the case, then we
+ * should try to pass through to the underlying Swing component hierarchy.
+ * Insha'allah, this will work.
*/
try {
final Object focusComponent = getFocusComponent();
@@ -287,15 +260,14 @@ public class WidgetMethodHandler extends AbstractHandler implements
}
@Override
- public void setInitializationData(IConfigurationElement config,
- String propertyName, Object data) {
+ public void setInitializationData(IConfigurationElement config, String propertyName, Object data) {
// The data is really just a string (i.e., the method name).
methodName = data.toString();
}
@Override
public void dispose() {
- if (display!=null && !display.isDisposed()) {
+ if (display != null && !display.isDisposed()) {
display.removeFilter(SWT.FocusIn, focusListener);
}
display = null;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/WizardHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/WizardHandler.java
index dd2314f2062..1e31e17043c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/WizardHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/WizardHandler.java
@@ -49,8 +49,8 @@ import org.eclipse.ui.wizards.IWizardRegistry;
/**
* Abstract handler for commands that launch the import, export and new wizards.
* <p>
- * This class is only intended to be extended by the three inner classes (<code>Export</code>,
- * <code>Import</code> and <code>New</code>) defined here.
+ * This class is only intended to be extended by the three inner classes
+ * (<code>Export</code>, <code>Import</code> and <code>New</code>) defined here.
* </p>
*
* @since 3.2
@@ -61,8 +61,8 @@ public abstract class WizardHandler extends AbstractHandler implements IElementU
* Default handler for launching export wizards.
*/
public static final class Export extends WizardHandler {
- private static final int SIZING_WIZARD_WIDTH = 470;
- private static final int SIZING_WIZARD_HEIGHT = 550;
+ private static final int SIZING_WIZARD_WIDTH = 470;
+ private static final int SIZING_WIZARD_HEIGHT = 550;
@Override
protected String getWizardIdParameterId() {
@@ -76,24 +76,19 @@ public abstract class WizardHandler extends AbstractHandler implements IElementU
@Override
protected void executeHandler(ExecutionEvent event) {
- IWorkbenchWindow activeWorkbenchWindow = HandlerUtil
- .getActiveWorkbenchWindow(event);
+ IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);
if (activeWorkbenchWindow == null) {
// action has been disposed
return;
}
- ImportExportWizard wizard = new ImportExportWizard(
- ImportExportWizard.EXPORT);
+ ImportExportWizard wizard = new ImportExportWizard(ImportExportWizard.EXPORT);
IStructuredSelection selectionToPass = getSelectionToUse(event);
wizard.init(activeWorkbenchWindow.getWorkbench(), selectionToPass);
- IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault()
- .getDialogSettings();
- IDialogSettings wizardSettings = workbenchSettings
- .getSection("ImportExportAction"); //$NON-NLS-1$
+ IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
+ IDialogSettings wizardSettings = workbenchSettings.getSection("ImportExportAction"); //$NON-NLS-1$
if (wizardSettings == null) {
- wizardSettings = workbenchSettings
- .addNewSection("ImportExportAction"); //$NON-NLS-1$
+ wizardSettings = workbenchSettings.addNewSection("ImportExportAction"); //$NON-NLS-1$
}
wizard.setDialogSettings(wizardSettings);
wizard.setForcePreviousAndNextButtons(true);
@@ -101,11 +96,10 @@ public abstract class WizardHandler extends AbstractHandler implements IElementU
Shell parent = activeWorkbenchWindow.getShell();
WizardDialog dialog = new WizardDialog(parent, wizard);
dialog.create();
- dialog.getShell().setSize(
- Math.max(SIZING_WIZARD_WIDTH, dialog.getShell()
- .getSize().x), SIZING_WIZARD_HEIGHT);
- activeWorkbenchWindow.getWorkbench().getHelpSystem().setHelp(
- dialog.getShell(), IWorkbenchHelpContextIds.EXPORT_WIZARD);
+ dialog.getShell().setSize(Math.max(SIZING_WIZARD_WIDTH, dialog.getShell().getSize().x),
+ SIZING_WIZARD_HEIGHT);
+ activeWorkbenchWindow.getWorkbench().getHelpSystem().setHelp(dialog.getShell(),
+ IWorkbenchHelpContextIds.EXPORT_WIZARD);
dialog.open();
}
@@ -115,8 +109,8 @@ public abstract class WizardHandler extends AbstractHandler implements IElementU
* Default handler for launching import wizards.
*/
public static final class Import extends WizardHandler {
- private static final int SIZING_WIZARD_WIDTH = 470;
- private static final int SIZING_WIZARD_HEIGHT = 550;
+ private static final int SIZING_WIZARD_WIDTH = 470;
+ private static final int SIZING_WIZARD_HEIGHT = 550;
@Override
protected String getWizardIdParameterId() {
@@ -131,34 +125,30 @@ public abstract class WizardHandler extends AbstractHandler implements IElementU
@Override
protected void executeHandler(ExecutionEvent event) {
IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);
- if (activeWorkbenchWindow == null) {
- // action has been disposed
- return;
- }
- ImportExportWizard wizard = new ImportExportWizard(ImportExportWizard.IMPORT);
+ if (activeWorkbenchWindow == null) {
+ // action has been disposed
+ return;
+ }
+ ImportExportWizard wizard = new ImportExportWizard(ImportExportWizard.IMPORT);
IStructuredSelection selectionToPass = getSelectionToUse(event);
- wizard.init(activeWorkbenchWindow.getWorkbench(), selectionToPass);
- IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault()
- .getDialogSettings();
- IDialogSettings wizardSettings = workbenchSettings
- .getSection("ImportExportAction"); //$NON-NLS-1$
- if (wizardSettings == null) {
- wizardSettings = workbenchSettings
- .addNewSection("ImportExportAction"); //$NON-NLS-1$
+ wizard.init(activeWorkbenchWindow.getWorkbench(), selectionToPass);
+ IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
+ IDialogSettings wizardSettings = workbenchSettings.getSection("ImportExportAction"); //$NON-NLS-1$
+ if (wizardSettings == null) {
+ wizardSettings = workbenchSettings.addNewSection("ImportExportAction"); //$NON-NLS-1$
}
- wizard.setDialogSettings(wizardSettings);
- wizard.setForcePreviousAndNextButtons(true);
-
- Shell parent = activeWorkbenchWindow.getShell();
- WizardDialog dialog = new WizardDialog(parent, wizard);
- dialog.create();
- dialog.getShell().setSize(
- Math.max(SIZING_WIZARD_WIDTH, dialog.getShell().getSize().x),
- SIZING_WIZARD_HEIGHT);
- activeWorkbenchWindow.getWorkbench().getHelpSystem().setHelp(
- dialog.getShell(), IWorkbenchHelpContextIds.IMPORT_WIZARD);
- dialog.open();
+ wizard.setDialogSettings(wizardSettings);
+ wizard.setForcePreviousAndNextButtons(true);
+
+ Shell parent = activeWorkbenchWindow.getShell();
+ WizardDialog dialog = new WizardDialog(parent, wizard);
+ dialog.create();
+ dialog.getShell().setSize(Math.max(SIZING_WIZARD_WIDTH, dialog.getShell().getSize().x),
+ SIZING_WIZARD_HEIGHT);
+ activeWorkbenchWindow.getWorkbench().getHelpSystem().setHelp(dialog.getShell(),
+ IWorkbenchHelpContextIds.IMPORT_WIZARD);
+ dialog.open();
}
}
@@ -169,20 +159,20 @@ public abstract class WizardHandler extends AbstractHandler implements IElementU
public static final class New extends WizardHandler {
/**
- * The wizard dialog width
- */
- private static final int SIZING_WIZARD_WIDTH = 500;
+ * The wizard dialog width
+ */
+ private static final int SIZING_WIZARD_WIDTH = 500;
- /**
- * The wizard dialog height
- */
- private static final int SIZING_WIZARD_HEIGHT = 500;
+ /**
+ * The wizard dialog height
+ */
+ private static final int SIZING_WIZARD_HEIGHT = 500;
- /**
- * The id of the category to show or <code>null</code> to
- * show all the categories.
- */
- private String categoryId = null;
+ /**
+ * The id of the category to show or <code>null</code> to show all the
+ * categories.
+ */
+ private String categoryId = null;
@Override
protected String getWizardIdParameterId() {
@@ -194,89 +184,87 @@ public abstract class WizardHandler extends AbstractHandler implements IElementU
return PlatformUI.getWorkbench().getNewWizardRegistry();
}
- /**
- * Returns the id of the category of wizards to show
- * or <code>null</code> to show all categories.
- * @return String
- */
- public String getCategoryId() {
- return categoryId;
- }
-
- /**
- * Sets the id of the category of wizards to show
- * or <code>null</code> to show all categories.
- * @param id
- */
- public void setCategoryId(String id) {
- categoryId = id;
- }
-
- @Override
+ /**
+ * Returns the id of the category of wizards to show or <code>null</code> to
+ * show all categories.
+ *
+ * @return String
+ */
+ public String getCategoryId() {
+ return categoryId;
+ }
+
+ /**
+ * Sets the id of the category of wizards to show or <code>null</code> to show
+ * all categories.
+ *
+ * @param id
+ */
+ public void setCategoryId(String id) {
+ categoryId = id;
+ }
+
+ @Override
protected IStructuredSelection getSelectionToUse(ExecutionEvent event) {
- ISelection selection = HandlerUtil.getCurrentSelection(event);
- IStructuredSelection selectionToPass = StructuredSelection.EMPTY;
- if (selection instanceof IStructuredSelection) {
- selectionToPass = (IStructuredSelection) selection;
- } else {
- // @issue the following is resource-specific legacy code
- // Build the selection from the IFile of the editor
- Class resourceClass = LegacyResourceSupport.getResourceClass();
- if (resourceClass != null) {
- IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);
- IWorkbenchPart part = activeWorkbenchWindow.getPartService()
- .getActivePart();
- if (part instanceof IEditorPart) {
- IEditorInput input = ((IEditorPart) part).getEditorInput();
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ IStructuredSelection selectionToPass = StructuredSelection.EMPTY;
+ if (selection instanceof IStructuredSelection) {
+ selectionToPass = (IStructuredSelection) selection;
+ } else {
+ // @issue the following is resource-specific legacy code
+ // Build the selection from the IFile of the editor
+ Class resourceClass = LegacyResourceSupport.getResourceClass();
+ if (resourceClass != null) {
+ IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);
+ IWorkbenchPart part = activeWorkbenchWindow.getPartService().getActivePart();
+ if (part instanceof IEditorPart) {
+ IEditorInput input = ((IEditorPart) part).getEditorInput();
Object resource = Adapters.adapt(input, resourceClass);
- if (resource != null) {
- selectionToPass = new StructuredSelection(resource);
- }
- }
- }
- }
- return selectionToPass;
- }
+ if (resource != null) {
+ selectionToPass = new StructuredSelection(resource);
+ }
+ }
+ }
+ }
+ return selectionToPass;
+ }
@Override
protected void executeHandler(ExecutionEvent event) {
IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);
- if (activeWorkbenchWindow == null) {
- // action has been disposed
- return;
- }
- NewWizard wizard = new NewWizard();
- wizard.setCategoryId(categoryId);
+ if (activeWorkbenchWindow == null) {
+ // action has been disposed
+ return;
+ }
+ NewWizard wizard = new NewWizard();
+ wizard.setCategoryId(categoryId);
IStructuredSelection selectionToPass = getSelectionToUse(event);
- wizard.init(activeWorkbenchWindow.getWorkbench(), selectionToPass);
+ wizard.init(activeWorkbenchWindow.getWorkbench(), selectionToPass);
- IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault()
- .getDialogSettings();
- IDialogSettings wizardSettings = workbenchSettings
- .getSection("NewWizardAction"); //$NON-NLS-1$
- if (wizardSettings == null) {
+ IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
+ IDialogSettings wizardSettings = workbenchSettings.getSection("NewWizardAction"); //$NON-NLS-1$
+ if (wizardSettings == null) {
wizardSettings = workbenchSettings.addNewSection("NewWizardAction"); //$NON-NLS-1$
}
- wizard.setDialogSettings(wizardSettings);
- wizard.setForcePreviousAndNextButtons(true);
-
- Shell parent = activeWorkbenchWindow.getShell();
- WizardDialog dialog = new WizardDialog(parent, wizard);
- dialog.create();
- dialog.getShell().setSize(
- Math.max(SIZING_WIZARD_WIDTH, dialog.getShell().getSize().x),
- SIZING_WIZARD_HEIGHT);
- activeWorkbenchWindow.getWorkbench().getHelpSystem().setHelp(
- dialog.getShell(), IWorkbenchHelpContextIds.NEW_WIZARD);
- dialog.open();
+ wizard.setDialogSettings(wizardSettings);
+ wizard.setForcePreviousAndNextButtons(true);
+
+ Shell parent = activeWorkbenchWindow.getShell();
+ WizardDialog dialog = new WizardDialog(parent, wizard);
+ dialog.create();
+ dialog.getShell().setSize(Math.max(SIZING_WIZARD_WIDTH, dialog.getShell().getSize().x),
+ SIZING_WIZARD_HEIGHT);
+ activeWorkbenchWindow.getWorkbench().getHelpSystem().setHelp(dialog.getShell(),
+ IWorkbenchHelpContextIds.NEW_WIZARD);
+ dialog.open();
}
}
-
/**
* This is the execution of the handler to open a wizard dialog.
+ *
* @param event
*/
protected abstract void executeHandler(ExecutionEvent event);
@@ -286,16 +274,14 @@ public abstract class WizardHandler extends AbstractHandler implements IElementU
String wizardId = event.getParameter(getWizardIdParameterId());
- IWorkbenchWindow activeWindow = HandlerUtil
- .getActiveWorkbenchWindowChecked(event);
+ IWorkbenchWindow activeWindow = HandlerUtil.getActiveWorkbenchWindowChecked(event);
if (wizardId == null) {
executeHandler(event);
} else {
IWizardRegistry wizardRegistry = getWizardRegistry();
- IWizardDescriptor wizardDescriptor = wizardRegistry
- .findWizard(wizardId);
+ IWizardDescriptor wizardDescriptor = wizardRegistry.findWizard(wizardId);
if (wizardDescriptor == null) {
throw new ExecutionException("unknown wizard: " + wizardId); //$NON-NLS-1$
}
@@ -324,9 +310,11 @@ public abstract class WizardHandler extends AbstractHandler implements IElementU
}
/**
- * Returns a structured selection based on the event to initialize the
- * wizard with.
- * @param event the event object containing information about the current state of the application
+ * Returns a structured selection based on the event to initialize the wizard
+ * with.
+ *
+ * @param event the event object containing information about the current state
+ * of the application
* @return the current structured selection of the application
*/
protected IStructuredSelection getSelectionToUse(ExecutionEvent event) {
@@ -352,11 +340,11 @@ public abstract class WizardHandler extends AbstractHandler implements IElementU
}
/**
- * Returns the id of the parameter used to indicate which wizard this
- * command should launch.
+ * Returns the id of the parameter used to indicate which wizard this command
+ * should launch.
*
- * @return The id of the parameter used to indicate which wizard this
- * command should launch.
+ * @return The id of the parameter used to indicate which wizard this command
+ * should launch.
*/
protected abstract String getWizardIdParameterId();
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/WorkbenchWindowHandlerDelegate.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/WorkbenchWindowHandlerDelegate.java
index 545ac3f86a3..8dc58e4a02e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/WorkbenchWindowHandlerDelegate.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/WorkbenchWindowHandlerDelegate.java
@@ -25,14 +25,13 @@ import org.eclipse.ui.IWorkbenchWindow;
*
* @since 3.1
*/
-public abstract class WorkbenchWindowHandlerDelegate extends
- ExecutableExtensionHandler implements IWorkbenchWindowHandlerDelegate {
+public abstract class WorkbenchWindowHandlerDelegate extends ExecutableExtensionHandler
+ implements IWorkbenchWindowHandlerDelegate {
/**
* By default, this will do nothing. Subclasses may override.
*
- * @param window
- * the window that provides the context for this delegate
+ * @param window the window that provides the context for this delegate
* @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(IWorkbenchWindow)
*/
@Override
@@ -41,13 +40,12 @@ public abstract class WorkbenchWindowHandlerDelegate extends
}
/**
- * This simply calls execute with a <code>null</code> map of parameter
- * values. If an <code>ExecutionException</code> occurs, then this should
- * be handle somehow. It's not clear what we'll do yet.
+ * This simply calls execute with a <code>null</code> map of parameter values.
+ * If an <code>ExecutionException</code> occurs, then this should be handle
+ * somehow. It's not clear what we'll do yet.
*
- * @param action
- * The action proxy that handles the presentation portion of the
- * action
+ * @param action The action proxy that handles the presentation portion of the
+ * action
* @see org.eclipse.ui.IActionDelegate#run(IAction)
*/
@Override
@@ -62,12 +60,10 @@ public abstract class WorkbenchWindowHandlerDelegate extends
/**
* By default, this will do nothing. Subclasses may override.
*
- * @param action
- * The action proxy that handles presentation portion of the
- * action
- * @param selection
- * The current selection, or <code>null</code> if there is no
- * selection.
+ * @param action The action proxy that handles presentation portion of the
+ * action
+ * @param selection The current selection, or <code>null</code> if there is no
+ * selection.
*
* @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection)
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/help/WorkbenchHelpSystem.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/help/WorkbenchHelpSystem.java
index 148d5d6113e..1a532c75076 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/help/WorkbenchHelpSystem.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/help/WorkbenchHelpSystem.java
@@ -66,7 +66,8 @@ public final class WorkbenchHelpSystem implements IWorkbenchHelpSystem {
/**
* Id of extension point where the help UI is contributed.
*/
- private static final String HELP_SYSTEM_EXTENSION_ID = PlatformUI.PLUGIN_ID + '.' + IWorkbenchRegistryConstants.PL_HELPSUPPORT;
+ private static final String HELP_SYSTEM_EXTENSION_ID = PlatformUI.PLUGIN_ID + '.'
+ + IWorkbenchRegistryConstants.PL_HELPSUPPORT;
/**
* Attribute id for class attribute of help UI extension point.
@@ -162,28 +163,27 @@ public final class WorkbenchHelpSystem implements IWorkbenchHelpSystem {
*
* @since 3.1
*/
- private IExtensionChangeHandler handler = new IExtensionChangeHandler() {
+ private IExtensionChangeHandler handler = new IExtensionChangeHandler() {
- @Override
- public void addExtension(IExtensionTracker tracker,IExtension extension) {
- //Do nothing
- }
+ @Override
+ public void addExtension(IExtensionTracker tracker, IExtension extension) {
+ // Do nothing
+ }
- @Override
+ @Override
public void removeExtension(IExtension source, Object[] objects) {
- for (Object object : objects) {
- if (object == pluggableHelpUI) {
- isInitialized = false;
- pluggableHelpUI = null;
- helpCompatibilityWrapper = null;
- // remove ourselves - we'll be added again in initalize if
- // needed
- PlatformUI.getWorkbench().getExtensionTracker()
- .unregisterHandler(handler);
- }
- }
- }
- };
+ for (Object object : objects) {
+ if (object == pluggableHelpUI) {
+ isInitialized = false;
+ pluggableHelpUI = null;
+ helpCompatibilityWrapper = null;
+ // remove ourselves - we'll be added again in initalize if
+ // needed
+ PlatformUI.getWorkbench().getExtensionTracker().unregisterHandler(handler);
+ }
+ }
+ }
+ };
/**
* Compatibility implementation of old IHelp interface.
@@ -301,8 +301,9 @@ public final class WorkbenchHelpSystem implements IWorkbenchHelpSystem {
}
/**
- * A wrapper for action help context that passes the action
- * text to be used as a title.
+ * A wrapper for action help context that passes the action text to be used as a
+ * title.
+ *
* @since 3.1
*/
private static class ContextWithTitle implements IContext2 {
@@ -317,8 +318,8 @@ public final class WorkbenchHelpSystem implements IWorkbenchHelpSystem {
@Override
public String getTitle() {
if (context instanceof IContext2) {
- String ctitle = ((IContext2)context).getTitle();
- if (ctitle!=null) {
+ String ctitle = ((IContext2) context).getTitle();
+ if (ctitle != null) {
return ctitle;
}
}
@@ -328,7 +329,7 @@ public final class WorkbenchHelpSystem implements IWorkbenchHelpSystem {
@Override
public String getStyledText() {
if (context instanceof IContext2) {
- return ((IContext2)context).getStyledText();
+ return ((IContext2) context).getStyledText();
}
return context.getText();
}
@@ -336,7 +337,7 @@ public final class WorkbenchHelpSystem implements IWorkbenchHelpSystem {
@Override
public String getCategory(IHelpResource topic) {
if (context instanceof IContext2) {
- return ((IContext2)context).getCategory(topic);
+ return ((IContext2) context).getCategory(topic);
}
return null;
}
@@ -353,8 +354,8 @@ public final class WorkbenchHelpSystem implements IWorkbenchHelpSystem {
}
/**
- * Compatibility wrapper, or <code>null</code> if none. Do not access
- * directly; see getHelpSupport().
+ * Compatibility wrapper, or <code>null</code> if none. Do not access directly;
+ * see getHelpSupport().
*/
private IHelp helpCompatibilityWrapper = null;
@@ -418,8 +419,7 @@ public final class WorkbenchHelpSystem implements IWorkbenchHelpSystem {
pluggableHelpUI = null;
helpCompatibilityWrapper = null;
isInitialized = false;
- PlatformUI.getWorkbench().getExtensionTracker()
- .unregisterHandler(handler);
+ PlatformUI.getWorkbench().getExtensionTracker().unregisterHandler(handler);
}
/**
@@ -436,8 +436,8 @@ public final class WorkbenchHelpSystem implements IWorkbenchHelpSystem {
}
/**
- * Initializes the pluggable help UI by getting an instance via the
- * extension point.
+ * Initializes the pluggable help UI by getting an instance via the extension
+ * point.
*/
private boolean initializePluggableHelpUI() {
final boolean[] ret = new boolean[] { false };
@@ -447,8 +447,7 @@ public final class WorkbenchHelpSystem implements IWorkbenchHelpSystem {
@Override
public void run() {
// get the help UI extension from the registry
- IExtensionPoint point = Platform.getExtensionRegistry()
- .getExtensionPoint(HELP_SYSTEM_EXTENSION_ID);
+ IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(HELP_SYSTEM_EXTENSION_ID);
if (point == null) {
// our extension point is missing (!) - act like there was
// no help UI
@@ -472,12 +471,10 @@ public final class WorkbenchHelpSystem implements IWorkbenchHelpSystem {
}
}
- private IConfigurationElement findElement(
- String desiredHelpSystemId, IExtension[] extensions) {
+ private IConfigurationElement findElement(String desiredHelpSystemId, IExtension[] extensions) {
for (IExtension extension : extensions) {
if (desiredHelpSystemId.equals(extension.getUniqueIdentifier())) {
- IConfigurationElement[] elements = extension
- .getConfigurationElements();
+ IConfigurationElement[] elements = extension.getConfigurationElements();
if (elements.length == 0) {
// help UI present but mangled - act like there was
// no help
@@ -491,12 +488,10 @@ public final class WorkbenchHelpSystem implements IWorkbenchHelpSystem {
return null;
}
- private IConfigurationElement getFirstElement(
- IExtension[] extensions) {
+ private IConfigurationElement getFirstElement(IExtension[] extensions) {
// There should only be one extension/config element so we just
// take the first
- IConfigurationElement[] elements = extensions[0]
- .getConfigurationElements();
+ IConfigurationElement[] elements = extensions[0].getConfigurationElements();
if (elements.length == 0) {
// help UI present but mangled - act like there was no help
// UI
@@ -505,26 +500,19 @@ public final class WorkbenchHelpSystem implements IWorkbenchHelpSystem {
return elements[0];
}
- private boolean initializePluggableHelpUI(
- IConfigurationElement element) {
+ private boolean initializePluggableHelpUI(IConfigurationElement element) {
// Instantiate the help UI
try {
- pluggableHelpUI = (AbstractHelpUI) WorkbenchPlugin
- .createExtension(element,
- HELP_SYSTEM_CLASS_ATTRIBUTE);
+ pluggableHelpUI = (AbstractHelpUI) WorkbenchPlugin.createExtension(element,
+ HELP_SYSTEM_CLASS_ATTRIBUTE);
// start listening for removals
- PlatformUI.getWorkbench().getExtensionTracker()
- .registerHandler(handler, null);
+ PlatformUI.getWorkbench().getExtensionTracker().registerHandler(handler, null);
// register the new help UI for removal notification
- PlatformUI
- .getWorkbench()
- .getExtensionTracker()
- .registerObject(element.getDeclaringExtension(),
- pluggableHelpUI, IExtensionTracker.REF_WEAK);
+ PlatformUI.getWorkbench().getExtensionTracker().registerObject(element.getDeclaringExtension(),
+ pluggableHelpUI, IExtensionTracker.REF_WEAK);
return true;
} catch (CoreException e) {
- WorkbenchPlugin.log(
- "Unable to instantiate help UI" + e.getStatus(), e);//$NON-NLS-1$
+ WorkbenchPlugin.log("Unable to instantiate help UI" + e.getStatus(), e);//$NON-NLS-1$
}
return false;
}
@@ -537,8 +525,7 @@ public final class WorkbenchHelpSystem implements IWorkbenchHelpSystem {
* Determines the location for the help popup shell given the widget which
* orginated the request for help.
*
- * @param display
- * the display where the help will appear
+ * @param display the display where the help will appear
*/
private static Point computePopUpLocation(Display display) {
Point point = display.getCursorLocation();
@@ -580,27 +567,23 @@ public final class WorkbenchHelpSystem implements IWorkbenchHelpSystem {
* Sets the given help contexts on the given action.
* <p>
* Use this method when the list of help contexts is known in advance. Help
- * contexts can either supplied as a static list, or calculated with a
- * context computer (but not both).
+ * contexts can either supplied as a static list, or calculated with a context
+ * computer (but not both).
* </p>
*
- * @param action
- * the action on which to register the computer
- * @param contexts
- * the contexts to use when F1 help is invoked; a mixed-type
- * array of context ids (type <code>String</code>) and/or help
- * contexts (type <code>IContext</code>)
+ * @param action the action on which to register the computer
+ * @param contexts the contexts to use when F1 help is invoked; a mixed-type
+ * array of context ids (type <code>String</code>) and/or help
+ * contexts (type <code>IContext</code>)
* @deprecated use setHelp with a single context id parameter
*/
@Deprecated
public void setHelp(IAction action, final Object[] contexts) {
for (Object context : contexts) {
- Assert.isTrue(context instanceof String
- || context instanceof IContext);
+ Assert.isTrue(context instanceof String || context instanceof IContext);
}
action.setHelpListener(event -> {
- if (contexts != null && contexts.length > 0
- && getHelpUI() != null) {
+ if (contexts != null && contexts.length > 0 && getHelpUI() != null) {
// determine the context
IContext context = null;
if (contexts[0] instanceof String) {
@@ -609,36 +592,31 @@ public final class WorkbenchHelpSystem implements IWorkbenchHelpSystem {
context = (IContext) contexts[0];
}
if (context != null) {
- Point point = computePopUpLocation(event.widget
- .getDisplay());
+ Point point = computePopUpLocation(event.widget.getDisplay());
displayContext(context, point.x, point.y);
}
}
});
}
-
/**
* Sets the given help contexts on the given control.
* <p>
* Use this method when the list of help contexts is known in advance. Help
- * contexts can either supplied as a static list, or calculated with a
- * context computer (but not both).
+ * contexts can either supplied as a static list, or calculated with a context
+ * computer (but not both).
* </p>
*
- * @param control
- * the control on which to register the contexts
- * @param contexts
- * the contexts to use when F1 help is invoked; a mixed-type
- * array of context ids (type <code>String</code>) and/or help
- * contexts (type <code>IContext</code>)
+ * @param control the control on which to register the contexts
+ * @param contexts the contexts to use when F1 help is invoked; a mixed-type
+ * array of context ids (type <code>String</code>) and/or help
+ * contexts (type <code>IContext</code>)
* @deprecated use setHelp with single context id parameter
*/
@Deprecated
public void setHelp(Control control, Object[] contexts) {
for (Object context : contexts) {
- Assert.isTrue(context instanceof String
- || context instanceof IContext);
+ Assert.isTrue(context instanceof String || context instanceof IContext);
}
control.setData(HELP_KEY, contexts);
@@ -651,23 +629,20 @@ public final class WorkbenchHelpSystem implements IWorkbenchHelpSystem {
* Sets the given help contexts on the given menu.
* <p>
* Use this method when the list of help contexts is known in advance. Help
- * contexts can either supplied as a static list, or calculated with a
- * context computer (but not both).
+ * contexts can either supplied as a static list, or calculated with a context
+ * computer (but not both).
* </p>
*
- * @param menu
- * the menu on which to register the context
- * @param contexts
- * the contexts to use when F1 help is invoked; a mixed-type
- * array of context ids (type <code>String</code>) and/or help
- * contexts (type <code>IContext</code>)
+ * @param menu the menu on which to register the context
+ * @param contexts the contexts to use when F1 help is invoked; a mixed-type
+ * array of context ids (type <code>String</code>) and/or help
+ * contexts (type <code>IContext</code>)
* @deprecated use setHelp with single context id parameter
*/
@Deprecated
public void setHelp(Menu menu, Object[] contexts) {
for (Object context : contexts) {
- Assert.isTrue(context instanceof String
- || context instanceof IContext);
+ Assert.isTrue(context instanceof String || context instanceof IContext);
}
menu.setData(HELP_KEY, contexts);
// ensure that the listener is only registered once
@@ -679,23 +654,20 @@ public final class WorkbenchHelpSystem implements IWorkbenchHelpSystem {
* Sets the given help contexts on the given menu item.
* <p>
* Use this method when the list of help contexts is known in advance. Help
- * contexts can either supplied as a static list, or calculated with a
- * context computer (but not both).
+ * contexts can either supplied as a static list, or calculated with a context
+ * computer (but not both).
* </p>
*
- * @param item
- * the menu item on which to register the context
- * @param contexts
- * the contexts to use when F1 help is invoked; a mixed-type
- * array of context ids (type <code>String</code>) and/or help
- * contexts (type <code>IContext</code>)
+ * @param item the menu item on which to register the context
+ * @param contexts the contexts to use when F1 help is invoked; a mixed-type
+ * array of context ids (type <code>String</code>) and/or help
+ * contexts (type <code>IContext</code>)
* @deprecated use setHelp with single context id parameter
*/
@Deprecated
public void setHelp(MenuItem item, Object[] contexts) {
for (Object context : contexts) {
- Assert.isTrue(context instanceof String
- || context instanceof IContext);
+ Assert.isTrue(context instanceof String || context instanceof IContext);
}
item.setData(HELP_KEY, contexts);
// ensure that the listener is only registered once
@@ -703,16 +675,15 @@ public final class WorkbenchHelpSystem implements IWorkbenchHelpSystem {
item.addHelpListener(getHelpListener());
}
- /**
- * Creates a new help listener for the given command. This retrieves the
- * help context ID from the command, and creates an appropriate listener
- * based on this.
- *
- * @param command
- * The command for which the listener should be created; must
- * not be <code>null</code>.
- * @return A help listener; never <code>null</code>.
- */
+ /**
+ * Creates a new help listener for the given command. This retrieves the help
+ * context ID from the command, and creates an appropriate listener based on
+ * this.
+ *
+ * @param command The command for which the listener should be created; must not
+ * be <code>null</code>.
+ * @return A help listener; never <code>null</code>.
+ */
public HelpListener createHelpListener(ICommand command) {
// TODO Need a help ID from the context
// final String contextId = command.getHelpId();
@@ -721,8 +692,7 @@ public final class WorkbenchHelpSystem implements IWorkbenchHelpSystem {
if (getHelpUI() != null) {
IContext context = HelpSystem.getContext(contextId);
if (context != null) {
- Point point = computePopUpLocation(event.widget
- .getDisplay());
+ Point point = computePopUpLocation(event.widget.getDisplay());
displayContext(context, point.x, point.y);
}
}
@@ -827,8 +797,7 @@ public final class WorkbenchHelpSystem implements IWorkbenchHelpSystem {
if (getHelpUI() != null) {
IContext context = HelpSystem.getContext(contextId);
if (context != null) {
- Point point = computePopUpLocation(event.widget
- .getDisplay());
+ Point point = computePopUpLocation(event.widget.getDisplay());
String title = LegacyActionTools.removeMnemonics(action.getText());
displayContext(new ContextWithTitle(context, title), point.x, point.y);
}
@@ -891,8 +860,7 @@ public final class WorkbenchHelpSystem implements IWorkbenchHelpSystem {
if (!registeredIDTable.containsKey(contextId))
registeredIDTable.put(contextId, currentElement);
else if (!registeredIDTable.get(contextId).equals(currentElement)) {
- StackTraceElement initialElement = (StackTraceElement) registeredIDTable
- .get(contextId);
+ StackTraceElement initialElement = (StackTraceElement) registeredIDTable.get(contextId);
String error = "UI Duplicate Context ID found: '" + contextId + "'\n" + //$NON-NLS-1$ //$NON-NLS-2$
" 1 at " + initialElement + '\n' + //$NON-NLS-1$
" 2 at " + currentElement; //$NON-NLS-1$
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/intro/IIntroConstants.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/intro/IIntroConstants.java
index 638548af27c..3f2bb95584c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/intro/IIntroConstants.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/intro/IIntroConstants.java
@@ -20,9 +20,9 @@ package org.eclipse.ui.internal.intro;
*/
public interface IIntroConstants {
- /**
- * The id of the view that is used as the intro host.
- */
- String INTRO_VIEW_ID = "org.eclipse.ui.internal.introview"; //$NON-NLS-1$
+ /**
+ * The id of the view that is used as the intro host.
+ */
+ String INTRO_VIEW_ID = "org.eclipse.ui.internal.introview"; //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/intro/IIntroDescriptor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/intro/IIntroDescriptor.java
index 3ba404a2c0d..53926e4e51d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/intro/IIntroDescriptor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/intro/IIntroDescriptor.java
@@ -24,31 +24,31 @@ import org.eclipse.ui.intro.IIntroPart;
*/
public interface IIntroDescriptor {
- /**
- * Creates an instance of the intro part defined in the descriptor.
- */
- IIntroPart createIntro() throws CoreException;
+ /**
+ * Creates an instance of the intro part defined in the descriptor.
+ */
+ IIntroPart createIntro() throws CoreException;
- /**
- * Returns the part id.
- *
- * @return the id of the part
- */
- String getId();
+ /**
+ * Returns the part id.
+ *
+ * @return the id of the part
+ */
+ String getId();
- /**
- * Returns the descriptor of the image for this part.
- *
- * @return the descriptor of the image to display next to this part
- */
- ImageDescriptor getImageDescriptor();
+ /**
+ * Returns the descriptor of the image for this part.
+ *
+ * @return the descriptor of the image to display next to this part
+ */
+ ImageDescriptor getImageDescriptor();
- /**
+ /**
* Return the label override string for this part.
*
- * @return the label override string or <code>null</code> if one has not
- * been specified
- * @since 3.2
+ * @return the label override string or <code>null</code> if one has not been
+ * specified
+ * @since 3.2
*/
String getLabelOverride();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/intro/IIntroRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/intro/IIntroRegistry.java
index 6f10327a405..8ef44ba9673 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/intro/IIntroRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/intro/IIntroRegistry.java
@@ -20,34 +20,34 @@ package org.eclipse.ui.internal.intro;
*/
public interface IIntroRegistry {
- /**
- * Return the number of introduction extensions known by this registry.
- *
- * @return the number of introduction extensions known by this registry
- */
- int getIntroCount();
+ /**
+ * Return the number of introduction extensions known by this registry.
+ *
+ * @return the number of introduction extensions known by this registry
+ */
+ int getIntroCount();
- /**
- * Return the introduction extensions known by this registry.
- *
- * @return the introduction extensions known by this registry
- */
- IIntroDescriptor[] getIntros();
+ /**
+ * Return the introduction extensions known by this registry.
+ *
+ * @return the introduction extensions known by this registry
+ */
+ IIntroDescriptor[] getIntros();
- /**
- * Return the introduction extension that is bound to the given product.
- *
- * @param productId the product identifier
- * @return the introduction extension that is bound to the given product,
- * or <code>null</code> if there is no such binding
- */
- IIntroDescriptor getIntroForProduct(String productId);
+ /**
+ * Return the introduction extension that is bound to the given product.
+ *
+ * @param productId the product identifier
+ * @return the introduction extension that is bound to the given product, or
+ * <code>null</code> if there is no such binding
+ */
+ IIntroDescriptor getIntroForProduct(String productId);
- /**
- * Find an intro descriptor with the given identifier.
- *
- * @param id the id
- * @return the intro descriptor, or <code>null</code>
- */
- IIntroDescriptor getIntro(String id);
+ /**
+ * Find an intro descriptor with the given identifier.
+ *
+ * @param id the id
+ * @return the intro descriptor, or <code>null</code>
+ */
+ IIntroDescriptor getIntro(String id);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/intro/IntroDescriptor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/intro/IntroDescriptor.java
index fb035490924..b3631e74885 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/intro/IntroDescriptor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/intro/IntroDescriptor.java
@@ -31,46 +31,44 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
*/
public class IntroDescriptor implements IIntroDescriptor, IPluginContribution {
+ private IConfigurationElement element;
- private IConfigurationElement element;
+ private ImageDescriptor imageDescriptor;
- private ImageDescriptor imageDescriptor;
+ /**
+ * Create a new IntroDescriptor for an extension.
+ */
+ public IntroDescriptor(IConfigurationElement configElement) throws CoreException {
+ element = configElement;
- /**
- * Create a new IntroDescriptor for an extension.
- */
- public IntroDescriptor(IConfigurationElement configElement)
- throws CoreException {
- element = configElement;
-
- if (configElement.getAttribute(IWorkbenchRegistryConstants.ATT_CLASS) == null) {
- throw new CoreException(new Status(IStatus.ERROR, configElement
- .getContributor().getName(), 0,
- "Invalid extension (Missing class name): " + getId(), //$NON-NLS-1$
- null));
- }
- }
+ if (configElement.getAttribute(IWorkbenchRegistryConstants.ATT_CLASS) == null) {
+ throw new CoreException(new Status(IStatus.ERROR, configElement.getContributor().getName(), 0,
+ "Invalid extension (Missing class name): " + getId(), //$NON-NLS-1$
+ null));
+ }
+ }
- @Override
+ @Override
public IIntroPart createIntro() throws CoreException {
- return (IIntroPart) element.createExecutableExtension(IWorkbenchRegistryConstants.ATT_CLASS);
- }
+ return (IIntroPart) element.createExecutableExtension(IWorkbenchRegistryConstants.ATT_CLASS);
+ }
- public IntroContentDetector getIntroContentDetector() throws CoreException {
- if (element.getAttribute(IWorkbenchRegistryConstants.ATT_CONTENT_DETECTOR) == null) {
- return null;
- }
- return (IntroContentDetector) element.createExecutableExtension(IWorkbenchRegistryConstants.ATT_CONTENT_DETECTOR);
- }
+ public IntroContentDetector getIntroContentDetector() throws CoreException {
+ if (element.getAttribute(IWorkbenchRegistryConstants.ATT_CONTENT_DETECTOR) == null) {
+ return null;
+ }
+ return (IntroContentDetector) element
+ .createExecutableExtension(IWorkbenchRegistryConstants.ATT_CONTENT_DETECTOR);
+ }
- @Override
+ @Override
public String getId() {
- return element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
- }
+ return element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
+ }
- @Override
+ @Override
public ImageDescriptor getImageDescriptor() {
- if (imageDescriptor != null) {
+ if (imageDescriptor != null) {
return imageDescriptor;
}
String iconName = element.getAttribute(IWorkbenchRegistryConstants.ATT_ICON);
@@ -78,30 +76,29 @@ public class IntroDescriptor implements IIntroDescriptor, IPluginContribution {
return null;
}
- imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(element
- .getContributor().getName(), iconName);
- return imageDescriptor;
- }
+ imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(element.getContributor().getName(), iconName);
+ return imageDescriptor;
+ }
- @Override
+ @Override
public String getLocalId() {
- return element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
- }
+ return element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
+ }
- @Override
+ @Override
public String getPluginId() {
return element.getContributor().getName();
- }
+ }
- /**
- * Returns the configuration element.
- *
- * @return the configuration element
- * @since 3.1
- */
- public IConfigurationElement getConfigurationElement() {
- return element;
- }
+ /**
+ * Returns the configuration element.
+ *
+ * @return the configuration element
+ * @since 3.1
+ */
+ public IConfigurationElement getConfigurationElement() {
+ return element;
+ }
@Override
public String getLabelOverride() {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/intro/IntroMessages.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/intro/IntroMessages.java
index 9c0cbf8dd86..82242ae7b7d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/intro/IntroMessages.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/intro/IntroMessages.java
@@ -15,7 +15,6 @@ package org.eclipse.ui.internal.intro;
import org.eclipse.osgi.util.NLS;
-
/**
* The IntroMessages are the messages used in the intro support.
*/
@@ -27,8 +26,8 @@ public class IntroMessages extends NLS {
public static String Intro_could_not_create_descriptor;
public static String Intro_action_text;
public static String Intro_default_title;
- public static String Intro_missing_product_title;
- public static String Intro_missing_product_message;
+ public static String Intro_missing_product_title;
+ public static String Intro_missing_product_message;
static {
// load message values from bundle file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/intro/IntroRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/intro/IntroRegistry.java
index 833678220eb..c44a6bebd01 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/intro/IntroRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/intro/IntroRegistry.java
@@ -47,9 +47,8 @@ public class IntroRegistry implements IIntroRegistry {
@Override
public IIntroDescriptor[] getIntros() {
- IExtensionPoint point = Platform.getExtensionRegistry()
- .getExtensionPoint(PlatformUI.PLUGIN_ID,
- IWorkbenchRegistryConstants.PL_INTRO);
+ IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(PlatformUI.PLUGIN_ID,
+ IWorkbenchRegistryConstants.PL_INTRO);
if (point == null) {
return new IIntroDescriptor[0];
}
@@ -59,33 +58,27 @@ public class IntroRegistry implements IIntroRegistry {
ArrayList list = new ArrayList(extensions.length);
for (IExtension extension : extensions) {
- IConfigurationElement[] elements = extension
- .getConfigurationElements();
+ IConfigurationElement[] elements = extension.getConfigurationElements();
for (IConfigurationElement element : elements) {
if (element.getName().equals(TAG_INTRO)) {
try {
- IIntroDescriptor descriptor = new IntroDescriptor(
- element);
+ IIntroDescriptor descriptor = new IntroDescriptor(element);
list.add(descriptor);
} catch (CoreException e) {
// log an error since its not safe to open a dialog here
- WorkbenchPlugin
- .log(
- IntroMessages.Intro_could_not_create_descriptor, e.getStatus());
+ WorkbenchPlugin.log(IntroMessages.Intro_could_not_create_descriptor, e.getStatus());
}
}
}
}
- return (IIntroDescriptor[]) list.toArray(new IIntroDescriptor[list
- .size()]);
+ return (IIntroDescriptor[]) list.toArray(new IIntroDescriptor[list.size()]);
}
@Override
public IIntroDescriptor getIntroForProduct(String targetProductId) {
- IExtensionPoint point = Platform.getExtensionRegistry()
- .getExtensionPoint(PlatformUI.PLUGIN_ID,
- IWorkbenchRegistryConstants.PL_INTRO);
+ IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(PlatformUI.PLUGIN_ID,
+ IWorkbenchRegistryConstants.PL_INTRO);
if (point == null) {
return null;
}
@@ -116,22 +109,17 @@ public class IntroRegistry implements IIntroRegistry {
* @param extensions
* @return
*/
- private String getIntroForProduct(String targetProductId,
- IExtension[] extensions) {
+ private String getIntroForProduct(String targetProductId, IExtension[] extensions) {
for (IExtension extension : extensions) {
- IConfigurationElement[] elements = extension
- .getConfigurationElements();
+ IConfigurationElement[] elements = extension.getConfigurationElements();
for (IConfigurationElement element : elements) {
if (element.getName().equals(TAG_INTROPRODUCTBINDING)) {
String introId = element.getAttribute(ATT_INTROID);
String productId = element.getAttribute(ATT_PRODUCTID);
if (introId == null || productId == null) {
- IStatus status = new Status(
- IStatus.ERROR,
- element.getDeclaringExtension()
- .getContributor().getName(),
- IStatus.ERROR,
+ IStatus status = new Status(IStatus.ERROR,
+ element.getDeclaringExtension().getContributor().getName(), IStatus.ERROR,
"introId and productId must be defined.", new IllegalArgumentException()); //$NON-NLS-1$
WorkbenchPlugin.log("Invalid intro binding", status); //$NON-NLS-1$
continue;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/AbstractKeyFormatter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/AbstractKeyFormatter.java
index 867c983b720..391c3b5bd02 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/AbstractKeyFormatter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/AbstractKeyFormatter.java
@@ -38,97 +38,98 @@ import org.eclipse.ui.keys.NaturalKey;
*/
public abstract class AbstractKeyFormatter implements IKeyFormatter {
- /**
- * The key for the delimiter between keys. This is used in the
- * internationalization bundles.
- */
- protected static final String KEY_DELIMITER_KEY = "KEY_DELIMITER"; //$NON-NLS-1$
-
- /**
- * The key for the delimiter between key strokes. This is used in the
- * internationalization bundles.
- */
- protected static final String KEY_STROKE_DELIMITER_KEY = "KEY_STROKE_DELIMITER"; //$NON-NLS-1$
-
- /**
- * The bundle in which to look up the internationalized text for all of the
- * individual keys in the system. This is the platform-agnostic version of
- * the internationalized strings. Some platforms (namely Carbon) provide
- * special Unicode characters and glyphs for some keys.
- */
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
- .getBundle(AbstractKeyFormatter.class.getName());
-
- @Override
+ /**
+ * The key for the delimiter between keys. This is used in the
+ * internationalization bundles.
+ */
+ protected static final String KEY_DELIMITER_KEY = "KEY_DELIMITER"; //$NON-NLS-1$
+
+ /**
+ * The key for the delimiter between key strokes. This is used in the
+ * internationalization bundles.
+ */
+ protected static final String KEY_STROKE_DELIMITER_KEY = "KEY_STROKE_DELIMITER"; //$NON-NLS-1$
+
+ /**
+ * The bundle in which to look up the internationalized text for all of the
+ * individual keys in the system. This is the platform-agnostic version of the
+ * internationalized strings. Some platforms (namely Carbon) provide special
+ * Unicode characters and glyphs for some keys.
+ */
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+ .getBundle(AbstractKeyFormatter.class.getName());
+
+ @Override
public String format(Key key) {
- String name = key.toString();
- return Util.translateString(RESOURCE_BUNDLE, name, name, false, false);
- }
+ String name = key.toString();
+ return Util.translateString(RESOURCE_BUNDLE, name, name, false, false);
+ }
- @Override
+ @Override
public String format(KeySequence keySequence) {
- StringBuilder stringBuffer = new StringBuilder();
+ StringBuilder stringBuffer = new StringBuilder();
- Iterator keyStrokeItr = keySequence.getKeyStrokes().iterator();
- while (keyStrokeItr.hasNext()) {
- stringBuffer.append(format((KeyStroke) keyStrokeItr.next()));
+ Iterator keyStrokeItr = keySequence.getKeyStrokes().iterator();
+ while (keyStrokeItr.hasNext()) {
+ stringBuffer.append(format((KeyStroke) keyStrokeItr.next()));
- if (keyStrokeItr.hasNext()) {
- stringBuffer.append(getKeyStrokeDelimiter());
- }
- }
+ if (keyStrokeItr.hasNext()) {
+ stringBuffer.append(getKeyStrokeDelimiter());
+ }
+ }
- return stringBuffer.toString();
- }
+ return stringBuffer.toString();
+ }
- @Override
+ @Override
public String format(KeyStroke keyStroke) {
- String keyDelimiter = getKeyDelimiter();
-
- // Format the modifier keys, in sorted order.
- SortedSet modifierKeys = new TreeSet(getModifierKeyComparator());
- modifierKeys.addAll(keyStroke.getModifierKeys());
- StringBuilder stringBuffer = new StringBuilder();
- Iterator modifierKeyItr = modifierKeys.iterator();
- while (modifierKeyItr.hasNext()) {
- stringBuffer.append(format((ModifierKey) modifierKeyItr.next()));
- stringBuffer.append(keyDelimiter);
- }
-
- // Format the natural key, if any.
- NaturalKey naturalKey = keyStroke.getNaturalKey();
- if (naturalKey != null) {
- stringBuffer.append(format(naturalKey));
- }
-
- return stringBuffer.toString();
-
- }
-
- /**
- * An accessor for the delimiter you wish to use between keys. This is used
- * by the default format implementations to determine the key delimiter.
- *
- * @return The delimiter to use between keys; should not be <code>null</code>.
- */
- protected abstract String getKeyDelimiter();
-
- /**
- * An accessor for the delimiter you wish to use between key strokes. This
- * used by the default format implementations to determine the key stroke
- * delimiter.
- *
- * @return The delimiter to use between key strokes; should not be <code>null</code>.
- */
- protected abstract String getKeyStrokeDelimiter();
-
- /**
- * An accessor for the comparator to use for sorting modifier keys. This is
- * used by the default format implementations to sort the modifier keys
- * before formatting them into a string.
- *
- * @return The comparator to use to sort modifier keys; must not be <code>null</code>.
- */
- protected abstract Comparator getModifierKeyComparator();
+ String keyDelimiter = getKeyDelimiter();
+
+ // Format the modifier keys, in sorted order.
+ SortedSet modifierKeys = new TreeSet(getModifierKeyComparator());
+ modifierKeys.addAll(keyStroke.getModifierKeys());
+ StringBuilder stringBuffer = new StringBuilder();
+ Iterator modifierKeyItr = modifierKeys.iterator();
+ while (modifierKeyItr.hasNext()) {
+ stringBuffer.append(format((ModifierKey) modifierKeyItr.next()));
+ stringBuffer.append(keyDelimiter);
+ }
+
+ // Format the natural key, if any.
+ NaturalKey naturalKey = keyStroke.getNaturalKey();
+ if (naturalKey != null) {
+ stringBuffer.append(format(naturalKey));
+ }
+
+ return stringBuffer.toString();
+
+ }
+
+ /**
+ * An accessor for the delimiter you wish to use between keys. This is used by
+ * the default format implementations to determine the key delimiter.
+ *
+ * @return The delimiter to use between keys; should not be <code>null</code>.
+ */
+ protected abstract String getKeyDelimiter();
+
+ /**
+ * An accessor for the delimiter you wish to use between key strokes. This used
+ * by the default format implementations to determine the key stroke delimiter.
+ *
+ * @return The delimiter to use between key strokes; should not be
+ * <code>null</code>.
+ */
+ protected abstract String getKeyStrokeDelimiter();
+
+ /**
+ * An accessor for the comparator to use for sorting modifier keys. This is used
+ * by the default format implementations to sort the modifier keys before
+ * formatting them into a string.
+ *
+ * @return The comparator to use to sort modifier keys; must not be
+ * <code>null</code>.
+ */
+ protected abstract Comparator getModifierKeyComparator();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/AbstractModifierKeyComparator.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/AbstractModifierKeyComparator.java
index 0463ca0c64c..66d7d2e6e32 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/AbstractModifierKeyComparator.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/AbstractModifierKeyComparator.java
@@ -18,18 +18,18 @@ import org.eclipse.ui.keys.ModifierKey;
abstract class AbstractModifierKeyComparator implements Comparator {
- @Override
+ @Override
public int compare(Object left, Object right) {
- ModifierKey modifierKeyLeft = (ModifierKey) left;
- ModifierKey modifierKeyRight = (ModifierKey) right;
- int modifierKeyLeftRank = rank(modifierKeyLeft);
- int modifierKeyRightRank = rank(modifierKeyRight);
+ ModifierKey modifierKeyLeft = (ModifierKey) left;
+ ModifierKey modifierKeyRight = (ModifierKey) right;
+ int modifierKeyLeftRank = rank(modifierKeyLeft);
+ int modifierKeyRightRank = rank(modifierKeyRight);
- if (modifierKeyLeftRank != modifierKeyRightRank) {
+ if (modifierKeyLeftRank != modifierKeyRightRank) {
return modifierKeyLeftRank - modifierKeyRightRank;
}
return modifierKeyLeft.compareTo(modifierKeyRight);
- }
+ }
- protected abstract int rank(ModifierKey modifierKey);
+ protected abstract int rank(ModifierKey modifierKey);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/AlphabeticModifierKeyComparator.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/AlphabeticModifierKeyComparator.java
index b89eadc289d..5cedd849706 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/AlphabeticModifierKeyComparator.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/AlphabeticModifierKeyComparator.java
@@ -25,11 +25,10 @@ import org.eclipse.ui.keys.ModifierKey;
*/
public class AlphabeticModifierKeyComparator implements Comparator {
- @Override
+ @Override
public int compare(Object left, Object right) {
- ModifierKey modifierKeyLeft = (ModifierKey) left;
- ModifierKey modifierKeyRight = (ModifierKey) right;
- return modifierKeyLeft.toString()
- .compareTo(modifierKeyRight.toString());
- }
+ ModifierKey modifierKeyLeft = (ModifierKey) left;
+ ModifierKey modifierKeyRight = (ModifierKey) right;
+ return modifierKeyLeft.toString().compareTo(modifierKeyRight.toString());
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/BindingPersistence.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/BindingPersistence.java
index e5cf0802915..86a32dbf58c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/BindingPersistence.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/BindingPersistence.java
@@ -76,14 +76,13 @@ import org.eclipse.ui.keys.IBindingService;
public class BindingPersistence extends PreferencePersistence {
/**
- * Whether this class should print out debugging information when it reads
- * in data, or writes to the preference store.
+ * Whether this class should print out debugging information when it reads in
+ * data, or writes to the preference store.
*/
private static final boolean DEBUG = Policy.DEBUG_KEY_BINDINGS;
/**
- * The index of the active scheme configuration elements in the indexed
- * array.
+ * The index of the active scheme configuration elements in the indexed array.
*
* @see BindingPersistence#read()
*/
@@ -118,90 +117,52 @@ public class BindingPersistence extends PreferencePersistence {
static {
final IKeyLookup lookup = KeyLookupFactory.getDefault();
- r2_1KeysByName.put(IKeyLookup.BACKSPACE_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.BACKSPACE_NAME));
- r2_1KeysByName.put(IKeyLookup.TAB_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.TAB_NAME));
- r2_1KeysByName.put(IKeyLookup.RETURN_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.RETURN_NAME));
- r2_1KeysByName.put(IKeyLookup.ENTER_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.ENTER_NAME));
- r2_1KeysByName.put(IKeyLookup.ESCAPE_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.ESCAPE_NAME));
- r2_1KeysByName.put(IKeyLookup.ESC_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.ESC_NAME));
- r2_1KeysByName.put(IKeyLookup.DELETE_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.DELETE_NAME));
- r2_1KeysByName.put(IKeyLookup.SPACE_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.SPACE_NAME));
- r2_1KeysByName.put(IKeyLookup.ARROW_UP_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.ARROW_UP_NAME));
- r2_1KeysByName.put(IKeyLookup.ARROW_DOWN_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.ARROW_DOWN_NAME));
- r2_1KeysByName.put(IKeyLookup.ARROW_LEFT_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.ARROW_LEFT_NAME));
- r2_1KeysByName.put(IKeyLookup.ARROW_RIGHT_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.ARROW_RIGHT_NAME));
- r2_1KeysByName.put(IKeyLookup.PAGE_UP_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.PAGE_UP_NAME));
- r2_1KeysByName.put(IKeyLookup.PAGE_DOWN_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.PAGE_DOWN_NAME));
- r2_1KeysByName.put(IKeyLookup.HOME_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.HOME_NAME));
- r2_1KeysByName.put(IKeyLookup.END_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.END_NAME));
- r2_1KeysByName.put(IKeyLookup.INSERT_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.INSERT_NAME));
- r2_1KeysByName.put(IKeyLookup.F1_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.F1_NAME));
- r2_1KeysByName.put(IKeyLookup.F2_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.F2_NAME));
- r2_1KeysByName.put(IKeyLookup.F3_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.F3_NAME));
- r2_1KeysByName.put(IKeyLookup.F4_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.F4_NAME));
- r2_1KeysByName.put(IKeyLookup.F5_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.F5_NAME));
- r2_1KeysByName.put(IKeyLookup.F6_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.F6_NAME));
- r2_1KeysByName.put(IKeyLookup.F7_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.F7_NAME));
- r2_1KeysByName.put(IKeyLookup.F8_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.F8_NAME));
- r2_1KeysByName.put(IKeyLookup.F9_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.F9_NAME));
- r2_1KeysByName.put(IKeyLookup.F10_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.F10_NAME));
- r2_1KeysByName.put(IKeyLookup.F11_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.F11_NAME));
- r2_1KeysByName.put(IKeyLookup.F12_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.F12_NAME));
- r2_1KeysByName.put(IKeyLookup.F13_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.F13_NAME));
- r2_1KeysByName.put(IKeyLookup.F14_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.F14_NAME));
- r2_1KeysByName.put(IKeyLookup.F15_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.F15_NAME));
- r2_1KeysByName.put(IKeyLookup.F16_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.F16_NAME));
- r2_1KeysByName.put(IKeyLookup.F17_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.F17_NAME));
- r2_1KeysByName.put(IKeyLookup.F18_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.F18_NAME));
- r2_1KeysByName.put(IKeyLookup.F19_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.F19_NAME));
- r2_1KeysByName.put(IKeyLookup.F20_NAME, lookup
- .formalKeyLookupInteger(IKeyLookup.F20_NAME));
+ r2_1KeysByName.put(IKeyLookup.BACKSPACE_NAME, lookup.formalKeyLookupInteger(IKeyLookup.BACKSPACE_NAME));
+ r2_1KeysByName.put(IKeyLookup.TAB_NAME, lookup.formalKeyLookupInteger(IKeyLookup.TAB_NAME));
+ r2_1KeysByName.put(IKeyLookup.RETURN_NAME, lookup.formalKeyLookupInteger(IKeyLookup.RETURN_NAME));
+ r2_1KeysByName.put(IKeyLookup.ENTER_NAME, lookup.formalKeyLookupInteger(IKeyLookup.ENTER_NAME));
+ r2_1KeysByName.put(IKeyLookup.ESCAPE_NAME, lookup.formalKeyLookupInteger(IKeyLookup.ESCAPE_NAME));
+ r2_1KeysByName.put(IKeyLookup.ESC_NAME, lookup.formalKeyLookupInteger(IKeyLookup.ESC_NAME));
+ r2_1KeysByName.put(IKeyLookup.DELETE_NAME, lookup.formalKeyLookupInteger(IKeyLookup.DELETE_NAME));
+ r2_1KeysByName.put(IKeyLookup.SPACE_NAME, lookup.formalKeyLookupInteger(IKeyLookup.SPACE_NAME));
+ r2_1KeysByName.put(IKeyLookup.ARROW_UP_NAME, lookup.formalKeyLookupInteger(IKeyLookup.ARROW_UP_NAME));
+ r2_1KeysByName.put(IKeyLookup.ARROW_DOWN_NAME, lookup.formalKeyLookupInteger(IKeyLookup.ARROW_DOWN_NAME));
+ r2_1KeysByName.put(IKeyLookup.ARROW_LEFT_NAME, lookup.formalKeyLookupInteger(IKeyLookup.ARROW_LEFT_NAME));
+ r2_1KeysByName.put(IKeyLookup.ARROW_RIGHT_NAME, lookup.formalKeyLookupInteger(IKeyLookup.ARROW_RIGHT_NAME));
+ r2_1KeysByName.put(IKeyLookup.PAGE_UP_NAME, lookup.formalKeyLookupInteger(IKeyLookup.PAGE_UP_NAME));
+ r2_1KeysByName.put(IKeyLookup.PAGE_DOWN_NAME, lookup.formalKeyLookupInteger(IKeyLookup.PAGE_DOWN_NAME));
+ r2_1KeysByName.put(IKeyLookup.HOME_NAME, lookup.formalKeyLookupInteger(IKeyLookup.HOME_NAME));
+ r2_1KeysByName.put(IKeyLookup.END_NAME, lookup.formalKeyLookupInteger(IKeyLookup.END_NAME));
+ r2_1KeysByName.put(IKeyLookup.INSERT_NAME, lookup.formalKeyLookupInteger(IKeyLookup.INSERT_NAME));
+ r2_1KeysByName.put(IKeyLookup.F1_NAME, lookup.formalKeyLookupInteger(IKeyLookup.F1_NAME));
+ r2_1KeysByName.put(IKeyLookup.F2_NAME, lookup.formalKeyLookupInteger(IKeyLookup.F2_NAME));
+ r2_1KeysByName.put(IKeyLookup.F3_NAME, lookup.formalKeyLookupInteger(IKeyLookup.F3_NAME));
+ r2_1KeysByName.put(IKeyLookup.F4_NAME, lookup.formalKeyLookupInteger(IKeyLookup.F4_NAME));
+ r2_1KeysByName.put(IKeyLookup.F5_NAME, lookup.formalKeyLookupInteger(IKeyLookup.F5_NAME));
+ r2_1KeysByName.put(IKeyLookup.F6_NAME, lookup.formalKeyLookupInteger(IKeyLookup.F6_NAME));
+ r2_1KeysByName.put(IKeyLookup.F7_NAME, lookup.formalKeyLookupInteger(IKeyLookup.F7_NAME));
+ r2_1KeysByName.put(IKeyLookup.F8_NAME, lookup.formalKeyLookupInteger(IKeyLookup.F8_NAME));
+ r2_1KeysByName.put(IKeyLookup.F9_NAME, lookup.formalKeyLookupInteger(IKeyLookup.F9_NAME));
+ r2_1KeysByName.put(IKeyLookup.F10_NAME, lookup.formalKeyLookupInteger(IKeyLookup.F10_NAME));
+ r2_1KeysByName.put(IKeyLookup.F11_NAME, lookup.formalKeyLookupInteger(IKeyLookup.F11_NAME));
+ r2_1KeysByName.put(IKeyLookup.F12_NAME, lookup.formalKeyLookupInteger(IKeyLookup.F12_NAME));
+ r2_1KeysByName.put(IKeyLookup.F13_NAME, lookup.formalKeyLookupInteger(IKeyLookup.F13_NAME));
+ r2_1KeysByName.put(IKeyLookup.F14_NAME, lookup.formalKeyLookupInteger(IKeyLookup.F14_NAME));
+ r2_1KeysByName.put(IKeyLookup.F15_NAME, lookup.formalKeyLookupInteger(IKeyLookup.F15_NAME));
+ r2_1KeysByName.put(IKeyLookup.F16_NAME, lookup.formalKeyLookupInteger(IKeyLookup.F16_NAME));
+ r2_1KeysByName.put(IKeyLookup.F17_NAME, lookup.formalKeyLookupInteger(IKeyLookup.F17_NAME));
+ r2_1KeysByName.put(IKeyLookup.F18_NAME, lookup.formalKeyLookupInteger(IKeyLookup.F18_NAME));
+ r2_1KeysByName.put(IKeyLookup.F19_NAME, lookup.formalKeyLookupInteger(IKeyLookup.F19_NAME));
+ r2_1KeysByName.put(IKeyLookup.F20_NAME, lookup.formalKeyLookupInteger(IKeyLookup.F20_NAME));
}
/**
- * Converts a 2.1.x style key sequence (as parsed from the
- * <code>string</code> attribute of the <code>keyBinding</code>) to a
- * 3.1 key sequence.
+ * Converts a 2.1.x style key sequence (as parsed from the <code>string</code>
+ * attribute of the <code>keyBinding</code>) to a 3.1 key sequence.
*
- * @param r21KeySequence
- * The sequence of 2.1.x key strokes that should be converted
- * into a 3.1 key sequence; never <code>null</code>.
+ * @param r21KeySequence The sequence of 2.1.x key strokes that should be
+ * converted into a 3.1 key sequence; never
+ * <code>null</code>.
* @return A 3.1 key sequence; never <code>null</code>.
*/
private static final KeySequence convert2_1Sequence(int[] r21KeySequence) {
@@ -218,8 +179,8 @@ public class BindingPersistence extends PreferencePersistence {
* Converts a 2.1.x style key stroke (as parsed from the <code>string</code>
* attribute of the <code>keyBinding</code> to a 3.1 key stroke.
*
- * @param r21Stroke
- * The 2.1.x stroke to convert; must never be <code>null</code>.
+ * @param r21Stroke The 2.1.x stroke to convert; must never be
+ * <code>null</code>.
* @return A 3.1 key stroke; never <code>null</code>.
*/
private static final KeyStroke convert2_1Stroke(final int r21Stroke) {
@@ -227,28 +188,23 @@ public class BindingPersistence extends PreferencePersistence {
}
/**
- * Returns the default scheme identifier for the currently running
- * application.
+ * Returns the default scheme identifier for the currently running application.
*
* @return The default scheme identifier (<code>String</code>); never
- * <code>null</code>, but may be empty or point to an undefined
- * scheme.
+ * <code>null</code>, but may be empty or point to an undefined scheme.
*/
public static final String getDefaultSchemeId() {
final IPreferenceStore store = PlatformUI.getPreferenceStore();
- return store
- .getDefaultString(IWorkbenchPreferenceConstants.KEY_CONFIGURATION_ID);
+ return store.getDefaultString(IWorkbenchPreferenceConstants.KEY_CONFIGURATION_ID);
}
/**
- * Parses a 2.1.x <code>string</code> attribute of the
- * <code>keyBinding</code> element.
+ * Parses a 2.1.x <code>string</code> attribute of the <code>keyBinding</code>
+ * element.
*
- * @param string
- * The string to parse; must not be <code>null</code>.
- * @return An array of integer values -- each integer representing a single
- * key stroke. This array may be empty, but it is never
- * <code>null</code>.
+ * @param string The string to parse; must not be <code>null</code>.
+ * @return An array of integer values -- each integer representing a single key
+ * stroke. This array may be empty, but it is never <code>null</code>.
*/
private static final int[] parse2_1Sequence(final String string) {
final StringTokenizer stringTokenizer = new StringTokenizer(string);
@@ -266,13 +222,11 @@ public class BindingPersistence extends PreferencePersistence {
* Parses a single 2.1.x key stroke string, as provided by
* <code>parse2_1Sequence</code>.
*
- * @param string
- * The string to parse; must not be <code>null</code>.
+ * @param string The string to parse; must not be <code>null</code>.
* @return An single integer value representing this key stroke.
*/
private static final int parse2_1Stroke(final String string) {
- final StringTokenizer stringTokenizer = new StringTokenizer(string,
- KeyStroke.KEY_DELIMITER, true);
+ final StringTokenizer stringTokenizer = new StringTokenizer(string, KeyStroke.KEY_DELIMITER, true);
// Copy out the tokens so we have random access.
final int size = stringTokenizer.countTokens();
@@ -284,8 +238,7 @@ public class BindingPersistence extends PreferencePersistence {
int value = 0;
if (size % 2 == 1) {
String token = tokens[size - 1];
- final Integer integer = (Integer) r2_1KeysByName.get(token
- .toUpperCase(Locale.ENGLISH));
+ final Integer integer = (Integer) r2_1KeysByName.get(token.toUpperCase(Locale.ENGLISH));
if (integer != null) {
value = integer.intValue();
@@ -312,16 +265,14 @@ public class BindingPersistence extends PreferencePersistence {
value |= SWT.ALT;
- } else if (token
- .equalsIgnoreCase(IKeyLookup.SHIFT_NAME)) {
+ } else if (token.equalsIgnoreCase(IKeyLookup.SHIFT_NAME)) {
if ((value & SWT.SHIFT) != 0) {
return 0;
}
value |= SWT.SHIFT;
- } else if (token
- .equalsIgnoreCase(IKeyLookup.COMMAND_NAME)) {
+ } else if (token.equalsIgnoreCase(IKeyLookup.COMMAND_NAME)) {
if ((value & SWT.COMMAND) != 0) {
return 0;
}
@@ -345,50 +296,42 @@ public class BindingPersistence extends PreferencePersistence {
/**
* <p>
- * Reads the registry and the preference store, and determines the
- * identifier for the scheme that should be active. There is a complicated
- * order of priorities for this. The registry will only be read if there is
- * no user preference, and the default active scheme id is different than
- * the default default active scheme id.
+ * Reads the registry and the preference store, and determines the identifier
+ * for the scheme that should be active. There is a complicated order of
+ * priorities for this. The registry will only be read if there is no user
+ * preference, and the default active scheme id is different than the default
+ * default active scheme id.
* </p>
* <ol>
* <li>A non-default preference.</li>
* <li>The legacy preference XML memento.</li>
- * <li>A default preference value that is different than the default
- * default active scheme id.</li>
+ * <li>A default preference value that is different than the default default
+ * active scheme id.</li>
* <li>The registry.</li>
* <li>The default default active scheme id.</li>
* </ol>
*
- * @param configurationElements
- * The configuration elements from the commands extension point;
- * must not be <code>null</code>.
- * @param configurationElementCount
- * The number of configuration elements that are really in the
- * array.
- * @param preferences
- * The memento wrapping the commands preference key; may be
- * <code>null</code>.
- * @param bindingManager
- * The binding manager that should be updated with the active
- * scheme. This binding manager must already have its schemes
- * defined. This value must not be <code>null</code>.
+ * @param configurationElements The configuration elements from the commands
+ * extension point; must not be
+ * <code>null</code>.
+ * @param configurationElementCount The number of configuration elements that
+ * are really in the array.
+ * @param preferences The memento wrapping the commands preference
+ * key; may be <code>null</code>.
+ * @param bindingManager The binding manager that should be updated
+ * with the active scheme. This binding manager
+ * must already have its schemes defined. This
+ * value must not be <code>null</code>.
*/
- private static final void readActiveScheme(
- final IConfigurationElement[] configurationElements,
- final int configurationElementCount, final IMemento preferences,
- final BindingManager bindingManager) {
+ private static final void readActiveScheme(final IConfigurationElement[] configurationElements,
+ final int configurationElementCount, final IMemento preferences, final BindingManager bindingManager) {
// A non-default preference.
final IPreferenceStore store = PlatformUI.getPreferenceStore();
- final String defaultActiveSchemeId = store
- .getDefaultString(IWorkbenchPreferenceConstants.KEY_CONFIGURATION_ID);
- final String preferenceActiveSchemeId = store
- .getString(IWorkbenchPreferenceConstants.KEY_CONFIGURATION_ID);
- if ((preferenceActiveSchemeId != null)
- && (!preferenceActiveSchemeId.equals(defaultActiveSchemeId))) {
+ final String defaultActiveSchemeId = store.getDefaultString(IWorkbenchPreferenceConstants.KEY_CONFIGURATION_ID);
+ final String preferenceActiveSchemeId = store.getString(IWorkbenchPreferenceConstants.KEY_CONFIGURATION_ID);
+ if ((preferenceActiveSchemeId != null) && (!preferenceActiveSchemeId.equals(defaultActiveSchemeId))) {
try {
- bindingManager.setActiveScheme(bindingManager
- .getScheme(preferenceActiveSchemeId));
+ bindingManager.setActiveScheme(bindingManager.getScheme(preferenceActiveSchemeId));
return;
} catch (final NotDefinedException e) {
// Let's keep looking....
@@ -397,16 +340,14 @@ public class BindingPersistence extends PreferencePersistence {
// A legacy preference XML memento.
if (preferences != null) {
- final IMemento[] preferenceMementos = preferences
- .getChildren(TAG_ACTIVE_KEY_CONFIGURATION);
+ final IMemento[] preferenceMementos = preferences.getChildren(TAG_ACTIVE_KEY_CONFIGURATION);
int preferenceMementoCount = preferenceMementos.length;
for (int i = preferenceMementoCount - 1; i >= 0; i--) {
final IMemento memento = preferenceMementos[i];
String id = memento.getString(ATT_KEY_CONFIGURATION_ID);
if (id != null) {
try {
- bindingManager.setActiveScheme(bindingManager
- .getScheme(id));
+ bindingManager.setActiveScheme(bindingManager.getScheme(id));
return;
} catch (final NotDefinedException e) {
// Let's keep looking....
@@ -417,11 +358,9 @@ public class BindingPersistence extends PreferencePersistence {
// A default preference value that is different than the default.
if ((defaultActiveSchemeId != null && defaultActiveSchemeId.length() > 0)
- && (!defaultActiveSchemeId
- .equals(IBindingService.DEFAULT_DEFAULT_ACTIVE_SCHEME_ID))) {
+ && (!defaultActiveSchemeId.equals(IBindingService.DEFAULT_DEFAULT_ACTIVE_SCHEME_ID))) {
try {
- bindingManager.setActiveScheme(bindingManager
- .getScheme(defaultActiveSchemeId));
+ bindingManager.setActiveScheme(bindingManager.getScheme(defaultActiveSchemeId));
return;
} catch (final NotDefinedException e) {
// Let's keep looking....
@@ -432,12 +371,10 @@ public class BindingPersistence extends PreferencePersistence {
for (int i = configurationElementCount - 1; i >= 0; i--) {
final IConfigurationElement configurationElement = configurationElements[i];
- String id = configurationElement
- .getAttribute(ATT_KEY_CONFIGURATION_ID);
+ String id = configurationElement.getAttribute(ATT_KEY_CONFIGURATION_ID);
if (id != null) {
try {
- bindingManager
- .setActiveScheme(bindingManager.getScheme(id));
+ bindingManager.setActiveScheme(bindingManager.getScheme(id));
return;
} catch (final NotDefinedException e) {
// Let's keep looking....
@@ -447,8 +384,7 @@ public class BindingPersistence extends PreferencePersistence {
id = configurationElement.getAttribute(ATT_VALUE);
if (id != null) {
try {
- bindingManager
- .setActiveScheme(bindingManager.getScheme(id));
+ bindingManager.setActiveScheme(bindingManager.getScheme(id));
return;
} catch (final NotDefinedException e) {
// Let's keep looking....
@@ -458,35 +394,28 @@ public class BindingPersistence extends PreferencePersistence {
// The default default active scheme id.
try {
- bindingManager
- .setActiveScheme(bindingManager
- .getScheme(IBindingService.DEFAULT_DEFAULT_ACTIVE_SCHEME_ID));
+ bindingManager.setActiveScheme(bindingManager.getScheme(IBindingService.DEFAULT_DEFAULT_ACTIVE_SCHEME_ID));
} catch (final NotDefinedException e) {
- //this is bad - the default default scheme should always exist
- throw new Error(
- "The default default active scheme id is not defined."); //$NON-NLS-1$
+ // this is bad - the default default scheme should always exist
+ throw new Error("The default default active scheme id is not defined."); //$NON-NLS-1$
}
}
/**
* Reads all of the binding definitions from the preferences.
*
- * @param preferences
- * The memento for the commands preferences key.
- * @param bindingManager
- * The binding manager to which the bindings should be added;
- * must not be <code>null</code>.
- * @param commandService
- * The command service for the workbench; must not be
- * <code>null</code>.
+ * @param preferences The memento for the commands preferences key.
+ * @param bindingManager The binding manager to which the bindings should be
+ * added; must not be <code>null</code>.
+ * @param commandService The command service for the workbench; must not be
+ * <code>null</code>.
*/
private static final void readBindingsFromPreferences(final IMemento preferences,
final BindingManager bindingManager, final CommandManager commandService) {
List warningsToLog = new ArrayList(1);
if (preferences != null) {
- final IMemento[] preferenceMementos = preferences
- .getChildren(TAG_KEY_BINDING);
+ final IMemento[] preferenceMementos = preferences.getChildren(TAG_KEY_BINDING);
int preferenceMementoCount = preferenceMementos.length;
for (int i = preferenceMementoCount - 1; i >= 0; i--) {
final IMemento memento = preferenceMementos[i];
@@ -504,11 +433,9 @@ public class BindingPersistence extends PreferencePersistence {
}
// Read out the scheme id.
- String schemeId = readOptional(memento,
- ATT_KEY_CONFIGURATION_ID);
+ String schemeId = readOptional(memento, ATT_KEY_CONFIGURATION_ID);
if (schemeId == null) {
- schemeId = readRequired(memento, ATT_CONFIGURATION,
- warningsToLog,
+ schemeId = readRequired(memento, ATT_CONFIGURATION, warningsToLog,
"Key bindings need a scheme or key configuration"); //$NON-NLS-1$
if (schemeId == null) {
continue;
@@ -531,8 +458,7 @@ public class BindingPersistence extends PreferencePersistence {
String keySequenceText = readOptional(memento, ATT_KEY_SEQUENCE);
KeySequence keySequence = null;
if (keySequenceText == null) {
- keySequenceText = readRequired(memento, ATT_STRING,
- warningsToLog,
+ keySequenceText = readRequired(memento, ATT_STRING, warningsToLog,
"Key bindings need a key sequence or string"); //$NON-NLS-1$
if (keySequenceText == null) {
continue;
@@ -551,9 +477,7 @@ public class BindingPersistence extends PreferencePersistence {
continue;
}
if (keySequence.isEmpty() || !keySequence.isComplete()) {
- addWarning(
- warningsToLog,
- "Key bindings cannot use an empty or incomplete key sequence", //$NON-NLS-1$
+ addWarning(warningsToLog, "Key bindings cannot use an empty or incomplete key sequence", //$NON-NLS-1$
null, commandId, "keySequence", keySequence //$NON-NLS-1$
.toString());
continue;
@@ -566,41 +490,36 @@ public class BindingPersistence extends PreferencePersistence {
final String platform = readOptional(memento, ATT_PLATFORM);
// Read out the parameters
- final ParameterizedCommand parameterizedCommand = command != null ? readParameters(
- memento, warningsToLog, command) : null;
+ final ParameterizedCommand parameterizedCommand = command != null
+ ? readParameters(memento, warningsToLog, command)
+ : null;
- final Binding binding = new KeyBinding(keySequence,
- parameterizedCommand, schemeId, contextId, locale,
+ final Binding binding = new KeyBinding(keySequence, parameterizedCommand, schemeId, contextId, locale,
platform, null, Binding.USER);
bindingManager.addBinding(binding);
}
}
// If there were any warnings, then log them now.
- logWarnings(warningsToLog,
- "Warnings while parsing the key bindings from the preference store"); //$NON-NLS-1$
+ logWarnings(warningsToLog, "Warnings while parsing the key bindings from the preference store"); //$NON-NLS-1$
}
/**
* Reads all of the binding definitions from the commands extension point.
*
- * @param configurationElements
- * The configuration elements in the commands extension point;
- * must not be <code>null</code>, but may be empty.
- * @param configurationElementCount
- * The number of configuration elements that are really in the
- * array.
- * @param bindingManager
- * The binding manager to which the bindings should be added;
- * must not be <code>null</code>.
- * @param commandService
- * The command service for the workbench; must not be
- * <code>null</code>.
+ * @param configurationElements The configuration elements in the commands
+ * extension point; must not be
+ * <code>null</code>, but may be empty.
+ * @param configurationElementCount The number of configuration elements that
+ * are really in the array.
+ * @param bindingManager The binding manager to which the bindings
+ * should be added; must not be
+ * <code>null</code>.
+ * @param commandService The command service for the workbench; must
+ * not be <code>null</code>.
*/
- private static final void readBindingsFromRegistry(
- final IConfigurationElement[] configurationElements,
- final int configurationElementCount,
- final BindingManager bindingManager,
+ private static final void readBindingsFromRegistry(final IConfigurationElement[] configurationElements,
+ final int configurationElementCount, final BindingManager bindingManager,
final CommandManager commandService) {
final Collection bindings = new ArrayList(configurationElementCount);
final List warningsToLog = new ArrayList(1);
@@ -611,21 +530,21 @@ public class BindingPersistence extends PreferencePersistence {
// the local cache for the sequence modifiers
IConfigurationElement[] sequenceModifiers = new IConfigurationElement[0];
- if(configurationElementCount >0)
- sequenceModifiers = getSequenceModifierElements(configurationElements[0]);
+ if (configurationElementCount > 0)
+ sequenceModifiers = getSequenceModifierElements(configurationElements[0]);
for (int i = 0; i < configurationElementCount; i++) {
final IConfigurationElement configurationElement = configurationElements[i];
// different extension. update the cache ...
- if( i>0 && !configurationElement.getDeclaringExtension().equals(configurationElements[i-1].getDeclaringExtension()))
+ if (i > 0 && !configurationElement.getDeclaringExtension()
+ .equals(configurationElements[i - 1].getDeclaringExtension()))
sequenceModifiers = getSequenceModifierElements(configurationElement);
/*
- * Read out the command id. Doing this before determining if the key
- * binding is actually valid is a bit wasteful. However, it is
- * helpful to have the command identifier when logging syntax
- * errors.
+ * Read out the command id. Doing this before determining if the key binding is
+ * actually valid is a bit wasteful. However, it is helpful to have the command
+ * identifier when logging syntax errors.
*/
String commandId = readCommandId(configurationElement);
@@ -647,27 +566,23 @@ public class BindingPersistence extends PreferencePersistence {
// Read out the scheme id.
String schemeId = readSchemeId(configurationElement, warningsToLog, commandId);
- if(isEmpty(schemeId))
+ if (isEmpty(schemeId))
continue;
// Read out the context id.
String contextId = readContextId(configurationElement);
String keySequenceText = readKeySequenceText(configurationElement);
- if(isEmpty(keySequenceText)) {
+ if (isEmpty(keySequenceText)) {
// The key sequence should never be null. This is pointless
- addWarning(
- warningsToLog,
- "Defining a key binding with no key sequence has no effect", //$NON-NLS-1$
+ addWarning(warningsToLog, "Defining a key binding with no key sequence has no effect", //$NON-NLS-1$
configurationElement, commandId);
continue;
}
-
-
// Read out the key sequence.
KeySequence keySequence = readKeySequence(configurationElement, warningsToLog, commandId, keySequenceText);
- if(keySequence == null)
+ if (keySequence == null)
continue;
// Read out the locale and platform.
@@ -676,13 +591,14 @@ public class BindingPersistence extends PreferencePersistence {
String platform = readNonEmptyAttribute(configurationElement, ATT_PLATFORM);
// Read out the parameters, if any.
- ParameterizedCommand parameterizedCommand =
- readParameterizedCommand(warningsToLog, configurationElement, viewParameter, command);
+ ParameterizedCommand parameterizedCommand = readParameterizedCommand(warningsToLog, configurationElement,
+ viewParameter, command);
- List modifiedBindings = applyModifiers(keySequence, keySequenceText, platform, sequenceModifiers, parameterizedCommand, schemeId, contextId, locale, warningsToLog);
+ List modifiedBindings = applyModifiers(keySequence, keySequenceText, platform, sequenceModifiers,
+ parameterizedCommand, schemeId, contextId, locale, warningsToLog);
KeyBinding binding = (KeyBinding) modifiedBindings.get(0);
- if(modifiedBindings.size() > 1) {
+ if (modifiedBindings.size() > 1) {
for (int j = 1; j < modifiedBindings.size(); j++) {
bindings.add(modifiedBindings.get(j));
}
@@ -694,8 +610,7 @@ public class BindingPersistence extends PreferencePersistence {
bindings.add(binding);
// temp work around ... simply honour the carbon
// bindings for cocoa.
- cocoaTempList.add(new KeyBinding(keySequence,
- parameterizedCommand, schemeId, contextId, locale,
+ cocoaTempList.add(new KeyBinding(keySequence, parameterizedCommand, schemeId, contextId, locale,
Util.WS_COCOA, null, Binding.SYSTEM));
} else {
bindings.add(binding);
@@ -705,18 +620,15 @@ public class BindingPersistence extends PreferencePersistence {
bindings.addAll(cocoaTempList);
}
- final Binding[] bindingArray = (Binding[]) bindings
- .toArray(new Binding[bindings.size()]);
+ final Binding[] bindingArray = (Binding[]) bindings.toArray(new Binding[bindings.size()]);
bindingManager.setBindings(bindingArray);
- logWarnings(
- warningsToLog,
+ logWarnings(warningsToLog,
"Warnings while parsing the key bindings from the 'org.eclipse.ui.commands' and 'org.eclipse.ui.bindings' extension point"); //$NON-NLS-1$
}
- private static List applyModifiers(KeySequence keySequence, String keySequenceText,
- String platform, IConfigurationElement[] sequenceModifiers,
- ParameterizedCommand parameterizedCommand, String schemeId,
+ private static List applyModifiers(KeySequence keySequence, String keySequenceText, String platform,
+ IConfigurationElement[] sequenceModifiers, ParameterizedCommand parameterizedCommand, String schemeId,
String contextId, String locale, List warningsToLog) {
List bindings = new ArrayList();
@@ -734,31 +646,26 @@ public class BindingPersistence extends PreferencePersistence {
try {
if (platform == null) {
- addGenericBindings(keySequence, parameterizedCommand, schemeId, contextId, locale,
- bindings, modifiedSequence, platforms);
+ addGenericBindings(keySequence, parameterizedCommand, schemeId, contextId, locale, bindings,
+ modifiedSequence, platforms);
} else {
- getBindingForPlatform(keySequence, platform,
- parameterizedCommand, schemeId, contextId, locale,
+ getBindingForPlatform(keySequence, platform, parameterizedCommand, schemeId, contextId, locale,
bindings, modifiedSequence, platforms);
}
- }catch(ParseException e) {
+ } catch (ParseException e) {
bindings.clear();
- addWarning(
- warningsToLog,
- "Cannot create modified sequence for key binding", //$NON-NLS-1$
- sequenceModifier, parameterizedCommand.getId(), ATT_REPLACE,
- replaceSequence);
+ addWarning(warningsToLog, "Cannot create modified sequence for key binding", //$NON-NLS-1$
+ sequenceModifier, parameterizedCommand.getId(), ATT_REPLACE, replaceSequence);
}
break;
}
}
- if(bindings.isEmpty()) {
- // no modifier was applied/error occurred ...
- KeyBinding binding = new KeyBinding(keySequence,
- parameterizedCommand, schemeId, contextId, locale,
+ if (bindings.isEmpty()) {
+ // no modifier was applied/error occurred ...
+ KeyBinding binding = new KeyBinding(keySequence, parameterizedCommand, schemeId, contextId, locale,
platform, null, Binding.SYSTEM);
bindings.add(binding);
}
@@ -766,58 +673,50 @@ public class BindingPersistence extends PreferencePersistence {
return bindings;
}
- private static void getBindingForPlatform(KeySequence keySequence,
- String platform, ParameterizedCommand parameterizedCommand,
- String schemeId, String contextId, String locale, List bindings,
+ private static void getBindingForPlatform(KeySequence keySequence, String platform,
+ ParameterizedCommand parameterizedCommand, String schemeId, String contextId, String locale, List bindings,
String modifiedSequence, String[] platforms) throws ParseException {
int j = 0;
for (; j < platforms.length; j++) {
- if(platforms[j].equals(SWT.getPlatform())) {
- KeyBinding newBinding = new KeyBinding(KeySequence
- .getInstance(modifiedSequence),
- parameterizedCommand, schemeId, contextId,
- locale, platforms[j], null, Binding.SYSTEM);
+ if (platforms[j].equals(SWT.getPlatform())) {
+ KeyBinding newBinding = new KeyBinding(KeySequence.getInstance(modifiedSequence), parameterizedCommand,
+ schemeId, contextId, locale, platforms[j], null, Binding.SYSTEM);
bindings.add(newBinding);
break;
}
}
- if(j == platforms.length) {
+ if (j == platforms.length) {
// platform doesn't match. use the unmodified sequence
- KeyBinding newBinding = new KeyBinding(keySequence,
- parameterizedCommand, schemeId, contextId,
- locale, null, null, Binding.SYSTEM);
+ KeyBinding newBinding = new KeyBinding(keySequence, parameterizedCommand, schemeId, contextId, locale, null,
+ null, Binding.SYSTEM);
bindings.add(newBinding);
}
}
private static void addGenericBindings(KeySequence keySequence, ParameterizedCommand parameterizedCommand,
- String schemeId, String contextId, String locale, List bindings,
- String modifiedSequence, String[] platforms) throws ParseException {
+ String schemeId, String contextId, String locale, List bindings, String modifiedSequence,
+ String[] platforms) throws ParseException {
-
- KeyBinding originalBinding = new KeyBinding(keySequence,
- parameterizedCommand, schemeId, contextId, locale, null, null,
- Binding.SYSTEM);
+ KeyBinding originalBinding = new KeyBinding(keySequence, parameterizedCommand, schemeId, contextId, locale,
+ null, null, Binding.SYSTEM);
bindings.add(originalBinding);
String platform = SWT.getPlatform();
boolean modifierExists = false;
for (String currentPlatform : platforms) {
- if(currentPlatform.equals(platform)) {
+ if (currentPlatform.equals(platform)) {
modifierExists = true;
break;
}
}
- if(modifierExists) {
- KeyBinding newBinding = new KeyBinding(KeySequence.getInstance(modifiedSequence),
- parameterizedCommand, schemeId, contextId,
- locale, SWT.getPlatform(), null, Binding.SYSTEM);
+ if (modifierExists) {
+ KeyBinding newBinding = new KeyBinding(KeySequence.getInstance(modifiedSequence), parameterizedCommand,
+ schemeId, contextId, locale, SWT.getPlatform(), null, Binding.SYSTEM);
- KeyBinding deleteBinding = new KeyBinding(keySequence,
- null, schemeId, contextId,
- locale, SWT.getPlatform(), null, Binding.SYSTEM);
+ KeyBinding deleteBinding = new KeyBinding(keySequence, null, schemeId, contextId, locale, SWT.getPlatform(),
+ null, Binding.SYSTEM);
bindings.add(newBinding);
bindings.add(deleteBinding);
@@ -830,23 +729,22 @@ public class BindingPersistence extends PreferencePersistence {
IExtension extension = configurationElement.getDeclaringExtension();
List modifierElements = new ArrayList();
for (final IConfigurationElement configElement : extension.getConfigurationElements()) {
- if(TAG_SEQUENCE_MODIFIER.equals(configElement.getName()))
+ if (TAG_SEQUENCE_MODIFIER.equals(configElement.getName()))
modifierElements.add(configElement);
}
return (IConfigurationElement[]) modifierElements.toArray(new IConfigurationElement[modifierElements.size()]);
}
public static String[] parseCommaSeparatedString(String commaSeparatedString) {
- StringTokenizer tokenizer = new StringTokenizer(commaSeparatedString, ", "); //$NON-NLS-1$
- int count = tokenizer.countTokens();
- String[] tokens = new String[count];
- for (int i = 0; i < tokens.length; i++) {
- tokens[i] = tokenizer.nextToken();
- }
- return tokens;
+ StringTokenizer tokenizer = new StringTokenizer(commaSeparatedString, ", "); //$NON-NLS-1$
+ int count = tokenizer.countTokens();
+ String[] tokens = new String[count];
+ for (int i = 0; i < tokens.length; i++) {
+ tokens[i] = tokenizer.nextToken();
+ }
+ return tokens;
}
-
private static String readKeySequenceText(IConfigurationElement configurationElement) {
String keySequenceText = configurationElement.getAttribute(ATT_SEQUENCE);
@@ -860,10 +758,11 @@ public class BindingPersistence extends PreferencePersistence {
}
- private static KeySequence readKeySequence(IConfigurationElement configurationElement, List warningsToLog, String commandId, String keySequenceText) {
+ private static KeySequence readKeySequence(IConfigurationElement configurationElement, List warningsToLog,
+ String commandId, String keySequenceText) {
KeySequence keySequence = null;
- if(keySequenceText.equals(configurationElement.getAttribute(ATT_STRING))){
+ if (keySequenceText.equals(configurationElement.getAttribute(ATT_STRING))) {
// The key sequence is in the old-style format.
try {
keySequence = convert2_1Sequence(parse2_1Sequence(keySequenceText));
@@ -884,9 +783,7 @@ public class BindingPersistence extends PreferencePersistence {
return null;
}
if (keySequence.isEmpty() || !keySequence.isComplete()) {
- addWarning(
- warningsToLog,
- "Key bindings should not have an empty or incomplete key sequence", //$NON-NLS-1$
+ addWarning(warningsToLog, "Key bindings should not have an empty or incomplete key sequence", //$NON-NLS-1$
configurationElement, commandId, "keySequence", //$NON-NLS-1$
keySequence.toString());
return null;
@@ -896,10 +793,8 @@ public class BindingPersistence extends PreferencePersistence {
return keySequence;
}
- private static ParameterizedCommand readParameterizedCommand(
- final List warningsToLog,
- final IConfigurationElement configurationElement,
- String viewParameter, final Command command) {
+ private static ParameterizedCommand readParameterizedCommand(final List warningsToLog,
+ final IConfigurationElement configurationElement, String viewParameter, final Command command) {
final ParameterizedCommand parameterizedCommand;
if (command == null) {
parameterizedCommand = null;
@@ -908,15 +803,14 @@ public class BindingPersistence extends PreferencePersistence {
parms.put(ShowViewMenu.VIEW_ID_PARM, viewParameter);
parameterizedCommand = ParameterizedCommand.generateCommand(command, parms);
} else {
- parameterizedCommand = readParameters(configurationElement,
- warningsToLog, command);
+ parameterizedCommand = readParameters(configurationElement, warningsToLog, command);
}
return parameterizedCommand;
}
/**
- * Reads the specified attribute from the configuration element.
- * If the value is an empty string, will return null.
+ * Reads the specified attribute from the configuration element. If the value is
+ * an empty string, will return null.
*
* @param configurationElement
* @return the attribute value
@@ -929,11 +823,8 @@ public class BindingPersistence extends PreferencePersistence {
return attributeValue;
}
-
- private static String readContextId(
- final IConfigurationElement configurationElement) {
- String contextId = configurationElement
- .getAttribute(ATT_CONTEXT_ID);
+ private static String readContextId(final IConfigurationElement configurationElement) {
+ String contextId = configurationElement.getAttribute(ATT_CONTEXT_ID);
if (LEGACY_DEFAULT_SCOPE.equals(contextId)) {
contextId = null;
} else if ((contextId == null) || (contextId.length() == 0)) {
@@ -948,16 +839,14 @@ public class BindingPersistence extends PreferencePersistence {
return contextId;
}
-
- private static String readSchemeId(IConfigurationElement configurationElement, List warningsToLog, String commandId) {
+ private static String readSchemeId(IConfigurationElement configurationElement, List warningsToLog,
+ String commandId) {
String schemeId = configurationElement.getAttribute(ATT_SCHEME_ID);
if ((schemeId == null) || (schemeId.length() == 0)) {
- schemeId = configurationElement
- .getAttribute(ATT_KEY_CONFIGURATION_ID);
+ schemeId = configurationElement.getAttribute(ATT_KEY_CONFIGURATION_ID);
if ((schemeId == null) || (schemeId.length() == 0)) {
- schemeId = configurationElement
- .getAttribute(ATT_CONFIGURATION);
+ schemeId = configurationElement.getAttribute(ATT_CONFIGURATION);
if ((schemeId == null) || (schemeId.length() == 0)) {
// The scheme id should never be null. This is invalid.
addWarning(warningsToLog, "Key bindings need a scheme", //$NON-NLS-1$
@@ -968,10 +857,8 @@ public class BindingPersistence extends PreferencePersistence {
return schemeId;
}
- private static String readCommandId(
- final IConfigurationElement configurationElement) {
- String commandId = configurationElement
- .getAttribute(ATT_COMMAND_ID);
+ private static String readCommandId(final IConfigurationElement configurationElement) {
+ String commandId = configurationElement.getAttribute(ATT_COMMAND_ID);
if ((commandId == null) || (commandId.length() == 0)) {
commandId = configurationElement.getAttribute(ATT_COMMAND);
}
@@ -988,20 +875,17 @@ public class BindingPersistence extends PreferencePersistence {
/**
* Reads all of the scheme definitions from the registry.
*
- * @param configurationElements
- * The configuration elements in the commands extension point;
- * must not be <code>null</code>, but may be empty.
- * @param configurationElementCount
- * The number of configuration elements that are really in the
- * array.
- * @param bindingManager
- * The binding manager to which the schemes should be added; must
- * not be <code>null</code>.
+ * @param configurationElements The configuration elements in the commands
+ * extension point; must not be
+ * <code>null</code>, but may be empty.
+ * @param configurationElementCount The number of configuration elements that
+ * are really in the array.
+ * @param bindingManager The binding manager to which the schemes
+ * should be added; must not be
+ * <code>null</code>.
*/
- private static final void readSchemesFromRegistry(
- final IConfigurationElement[] configurationElements,
- final int configurationElementCount,
- final BindingManager bindingManager) {
+ private static final void readSchemesFromRegistry(final IConfigurationElement[] configurationElements,
+ final int configurationElementCount, final BindingManager bindingManager) {
// Undefine all the previous handle objects.
final HandleObject[] handleObjects = bindingManager.getDefinedSchemes();
if (handleObjects != null) {
@@ -1016,18 +900,16 @@ public class BindingPersistence extends PreferencePersistence {
final IConfigurationElement configurationElement = configurationElements[i];
// Read out the attributes.
- final String id = readRequired(configurationElement, ATT_ID,
- warningsToLog, "Schemes need an id"); //$NON-NLS-1$
+ final String id = readRequired(configurationElement, ATT_ID, warningsToLog, "Schemes need an id"); //$NON-NLS-1$
if (id == null) {
continue;
}
- final String name = readRequired(configurationElement, ATT_NAME,
- warningsToLog, "A scheme needs a name", id); //$NON-NLS-1$
+ final String name = readRequired(configurationElement, ATT_NAME, warningsToLog, "A scheme needs a name", //$NON-NLS-1$
+ id);
if (name == null) {
continue;
}
- final String description = readOptional(configurationElement,
- ATT_DESCRIPTION);
+ final String description = readOptional(configurationElement, ATT_DESCRIPTION);
String parentId = configurationElement.getAttribute(ATT_PARENT_ID);
if ((parentId != null) && (parentId.length() == 0)) {
@@ -1042,27 +924,23 @@ public class BindingPersistence extends PreferencePersistence {
scheme.define(name, description, parentId);
}
- logWarnings(
- warningsToLog,
+ logWarnings(warningsToLog,
"Warnings while parsing the key bindings from the 'org.eclipse.ui.bindings', 'org.eclipse.ui.acceleratorConfigurations' and 'org.eclipse.ui.commands' extension point"); //$NON-NLS-1$
}
/**
* Writes the given active scheme and bindings to the preference store. Only
- * bindings that are of the <code>Binding.USER</code> type will be
- * written; the others will be ignored.
+ * bindings that are of the <code>Binding.USER</code> type will be written; the
+ * others will be ignored.
*
- * @param activeScheme
- * The scheme which should be persisted; may be <code>null</code>.
- * @param bindings
- * The bindings which should be persisted; may be
- * <code>null</code>
- * @throws IOException
- * If something happens while trying to write to the workbench
- * preference store.
+ * @param activeScheme The scheme which should be persisted; may be
+ * <code>null</code>.
+ * @param bindings The bindings which should be persisted; may be
+ * <code>null</code>
+ * @throws IOException If something happens while trying to write to the
+ * workbench preference store.
*/
- static final void write(final Scheme activeScheme, final Binding[] bindings)
- throws IOException {
+ static final void write(final Scheme activeScheme, final Binding[] bindings) throws IOException {
// Print out debugging information, if requested.
if (DEBUG) {
Tracing.printTrace("BINDINGS", "Persisting active scheme '" //$NON-NLS-1$ //$NON-NLS-2$
@@ -1074,8 +952,7 @@ public class BindingPersistence extends PreferencePersistence {
writeActiveScheme(activeScheme);
// Build the XML block for writing the bindings and active scheme.
- final XMLMemento xmlMemento = XMLMemento
- .createWriteRoot(EXTENSION_COMMANDS);
+ final XMLMemento xmlMemento = XMLMemento.createWriteRoot(EXTENSION_COMMANDS);
if (activeScheme != null) {
writeActiveSchemeToPreferences(xmlMemento, activeScheme);
}
@@ -1090,8 +967,7 @@ public class BindingPersistence extends PreferencePersistence {
}
// Write the XML block to the workbench preference store.
- final IPreferenceStore preferenceStore = WorkbenchPlugin.getDefault()
- .getPreferenceStore();
+ final IPreferenceStore preferenceStore = WorkbenchPlugin.getDefault().getPreferenceStore();
final Writer writer = new StringWriter();
try {
xmlMemento.save(writer);
@@ -1102,89 +978,69 @@ public class BindingPersistence extends PreferencePersistence {
}
/**
- * Writes the active scheme to its own preference key. This key is used by
- * RCP applications as part of their plug-in customization.
+ * Writes the active scheme to its own preference key. This key is used by RCP
+ * applications as part of their plug-in customization.
*
- * @param scheme
- * The scheme to write to the preference store. If the scheme is
- * <code>null</code>, then it is removed.
+ * @param scheme The scheme to write to the preference store. If the scheme is
+ * <code>null</code>, then it is removed.
*/
private static final void writeActiveScheme(final Scheme scheme) {
final IPreferenceStore store = PlatformUI.getPreferenceStore();
final String schemeId = (scheme == null) ? null : scheme.getId();
- final String defaultSchemeId = store
- .getDefaultString(IWorkbenchPreferenceConstants.KEY_CONFIGURATION_ID);
- if ((defaultSchemeId == null) ? (scheme != null) : (!defaultSchemeId
- .equals(schemeId))) {
- store.setValue(IWorkbenchPreferenceConstants.KEY_CONFIGURATION_ID,
- scheme.getId());
+ final String defaultSchemeId = store.getDefaultString(IWorkbenchPreferenceConstants.KEY_CONFIGURATION_ID);
+ if ((defaultSchemeId == null) ? (scheme != null) : (!defaultSchemeId.equals(schemeId))) {
+ store.setValue(IWorkbenchPreferenceConstants.KEY_CONFIGURATION_ID, scheme.getId());
} else {
- store
- .setToDefault(IWorkbenchPreferenceConstants.KEY_CONFIGURATION_ID);
+ store.setToDefault(IWorkbenchPreferenceConstants.KEY_CONFIGURATION_ID);
}
}
/**
- * Writes the active scheme to the memento. If the scheme is
- * <code>null</code>, then all schemes in the memento are removed.
+ * Writes the active scheme to the memento. If the scheme is <code>null</code>,
+ * then all schemes in the memento are removed.
*
- * @param memento
- * The memento to which the scheme should be written; must not be
- * <code>null</code>.
- * @param scheme
- * The scheme that should be written; must not be
- * <code>null</code>.
+ * @param memento The memento to which the scheme should be written; must not be
+ * <code>null</code>.
+ * @param scheme The scheme that should be written; must not be
+ * <code>null</code>.
*/
- private static final void writeActiveSchemeToPreferences(
- final IMemento memento, final Scheme scheme) {
+ private static final void writeActiveSchemeToPreferences(final IMemento memento, final Scheme scheme) {
// Add this active scheme, if it is not the default.
final IPreferenceStore store = PlatformUI.getPreferenceStore();
final String schemeId = scheme.getId();
- final String defaultSchemeId = store
- .getDefaultString(IWorkbenchPreferenceConstants.KEY_CONFIGURATION_ID);
- if ((defaultSchemeId == null) ? (schemeId != null) : (!defaultSchemeId
- .equals(schemeId))) {
- final IMemento child = memento
- .createChild(TAG_ACTIVE_KEY_CONFIGURATION);
+ final String defaultSchemeId = store.getDefaultString(IWorkbenchPreferenceConstants.KEY_CONFIGURATION_ID);
+ if ((defaultSchemeId == null) ? (schemeId != null) : (!defaultSchemeId.equals(schemeId))) {
+ final IMemento child = memento.createChild(TAG_ACTIVE_KEY_CONFIGURATION);
child.putString(ATT_KEY_CONFIGURATION_ID, schemeId);
}
}
/**
- * Writes the binding to the memento. This creates a new child element on
- * the memento, and places the properties of the binding as its attributes.
+ * Writes the binding to the memento. This creates a new child element on the
+ * memento, and places the properties of the binding as its attributes.
*
- * @param parent
- * The parent memento for the binding element; must not be
- * <code>null</code>.
- * @param binding
- * The binding to write; must not be <code>null</code>.
+ * @param parent The parent memento for the binding element; must not be
+ * <code>null</code>.
+ * @param binding The binding to write; must not be <code>null</code>.
*/
- private static final void writeBindingToPreferences(final IMemento parent,
- final Binding binding) {
+ private static final void writeBindingToPreferences(final IMemento parent, final Binding binding) {
final IMemento element = parent.createChild(TAG_KEY_BINDING);
element.putString(ATT_CONTEXT_ID, binding.getContextId());
- final ParameterizedCommand parameterizedCommand = binding
- .getParameterizedCommand();
- final String commandId = (parameterizedCommand == null) ? null
- : parameterizedCommand.getId();
+ final ParameterizedCommand parameterizedCommand = binding.getParameterizedCommand();
+ final String commandId = (parameterizedCommand == null) ? null : parameterizedCommand.getId();
element.putString(ATT_COMMAND_ID, commandId);
element.putString(ATT_KEY_CONFIGURATION_ID, binding.getSchemeId());
- element.putString(ATT_KEY_SEQUENCE, binding.getTriggerSequence()
- .toString());
+ element.putString(ATT_KEY_SEQUENCE, binding.getTriggerSequence().toString());
element.putString(ATT_LOCALE, binding.getLocale());
element.putString(ATT_PLATFORM, binding.getPlatform());
if (parameterizedCommand != null) {
- final Map parameterizations = parameterizedCommand
- .getParameterMap();
- final Iterator parameterizationItr = parameterizations.entrySet()
- .iterator();
+ final Map parameterizations = parameterizedCommand.getParameterMap();
+ final Iterator parameterizationItr = parameterizations.entrySet().iterator();
while (parameterizationItr.hasNext()) {
final Map.Entry entry = (Map.Entry) parameterizationItr.next();
final String id = (String) entry.getKey();
final String value = (String) entry.getValue();
- final IMemento parameterElement = element
- .createChild(TAG_PARAMETER);
+ final IMemento parameterElement = element.createChild(TAG_PARAMETER);
parameterElement.putString(ATT_ID, id);
parameterElement.putString(ATT_VALUE, value);
}
@@ -1205,19 +1061,16 @@ public class BindingPersistence extends PreferencePersistence {
/**
* Constructs a new instance of <code>BindingPersistence</code>.
*
- * @param bindingManager
- * The binding manager which should be populated with the values
- * from the registry and preference store; must not be
- * <code>null</code>.
- * @param commandService
- * The command service for the workbench; must not be
- * <code>null</code>.
+ * @param bindingManager The binding manager which should be populated with the
+ * values from the registry and preference store; must not
+ * be <code>null</code>.
+ * @param commandService The command service for the workbench; must not be
+ * <code>null</code>.
*/
- public BindingPersistence(final BindingManager bindingManager,
- final CommandManager commandManager) {
+ public BindingPersistence(final BindingManager bindingManager, final CommandManager commandManager) {
this.bindingManager = bindingManager;
this.commandManager = commandManager;
- // HACK. Calling super.read() installs a required preferences change listener.
+ // HACK. Calling super.read() installs a required preferences change listener.
// See bug 266604.
super.read();
}
@@ -1228,32 +1081,23 @@ public class BindingPersistence extends PreferencePersistence {
}
public boolean bindingsNeedUpdating(final IRegistryChangeEvent event) {
- final IExtensionDelta[] acceleratorConfigurationDeltas = event
- .getExtensionDeltas(
- PlatformUI.PLUGIN_ID,
- IWorkbenchRegistryConstants.PL_ACCELERATOR_CONFIGURATIONS);
+ final IExtensionDelta[] acceleratorConfigurationDeltas = event.getExtensionDeltas(PlatformUI.PLUGIN_ID,
+ IWorkbenchRegistryConstants.PL_ACCELERATOR_CONFIGURATIONS);
if (acceleratorConfigurationDeltas.length == 0) {
- final IExtensionDelta[] bindingDeltas = event.getExtensionDeltas(
- PlatformUI.PLUGIN_ID,
+ final IExtensionDelta[] bindingDeltas = event.getExtensionDeltas(PlatformUI.PLUGIN_ID,
IWorkbenchRegistryConstants.PL_BINDINGS);
if (bindingDeltas.length == 0) {
- final IExtensionDelta[] commandDeltas = event
- .getExtensionDeltas(PlatformUI.PLUGIN_ID,
- IWorkbenchRegistryConstants.PL_COMMANDS);
+ final IExtensionDelta[] commandDeltas = event.getExtensionDeltas(PlatformUI.PLUGIN_ID,
+ IWorkbenchRegistryConstants.PL_COMMANDS);
if (commandDeltas.length == 0) {
- final IExtensionDelta[] acceleratorScopeDeltas = event
- .getExtensionDeltas(
- PlatformUI.PLUGIN_ID,
- IWorkbenchRegistryConstants.PL_ACCELERATOR_SCOPES);
+ final IExtensionDelta[] acceleratorScopeDeltas = event.getExtensionDeltas(PlatformUI.PLUGIN_ID,
+ IWorkbenchRegistryConstants.PL_ACCELERATOR_SCOPES);
if (acceleratorScopeDeltas.length == 0) {
- final IExtensionDelta[] contextDeltas = event
- .getExtensionDeltas(PlatformUI.PLUGIN_ID,
- IWorkbenchRegistryConstants.PL_CONTEXTS);
+ final IExtensionDelta[] contextDeltas = event.getExtensionDeltas(PlatformUI.PLUGIN_ID,
+ IWorkbenchRegistryConstants.PL_CONTEXTS);
if (contextDeltas.length == 0) {
- final IExtensionDelta[] actionDefinitionDeltas = event
- .getExtensionDeltas(
- PlatformUI.PLUGIN_ID,
- IWorkbenchRegistryConstants.PL_ACTION_DEFINITIONS);
+ final IExtensionDelta[] actionDefinitionDeltas = event.getExtensionDeltas(
+ PlatformUI.PLUGIN_ID, IWorkbenchRegistryConstants.PL_ACTION_DEFINITIONS);
if (actionDefinitionDeltas.length == 0) {
return false;
}
@@ -1290,48 +1134,41 @@ public class BindingPersistence extends PreferencePersistence {
final IConfigurationElement[][] indexedConfigurationElements = new IConfigurationElement[3][];
// Sort the bindings extension point based on element name.
- final IConfigurationElement[] bindingsExtensionPoint = registry
- .getConfigurationElementsFor(EXTENSION_BINDINGS);
+ final IConfigurationElement[] bindingsExtensionPoint = registry.getConfigurationElementsFor(EXTENSION_BINDINGS);
for (final IConfigurationElement configurationElement : bindingsExtensionPoint) {
final String name = configurationElement.getName();
// Check if it is a binding definition.
if (TAG_KEY.equals(name)) {
- addElementToIndexedArray(configurationElement,
- indexedConfigurationElements,
- INDEX_BINDING_DEFINITIONS, bindingDefinitionCount++);
+ addElementToIndexedArray(configurationElement, indexedConfigurationElements, INDEX_BINDING_DEFINITIONS,
+ bindingDefinitionCount++);
} else
// Check to see if it is a scheme definition.
if (TAG_SCHEME.equals(name)) {
- addElementToIndexedArray(configurationElement,
- indexedConfigurationElements, INDEX_SCHEME_DEFINITIONS,
+ addElementToIndexedArray(configurationElement, indexedConfigurationElements, INDEX_SCHEME_DEFINITIONS,
schemeDefinitionCount++);
}
}
// Sort the commands extension point based on element name.
- final IConfigurationElement[] commandsExtensionPoint = registry
- .getConfigurationElementsFor(EXTENSION_COMMANDS);
+ final IConfigurationElement[] commandsExtensionPoint = registry.getConfigurationElementsFor(EXTENSION_COMMANDS);
for (final IConfigurationElement configurationElement : commandsExtensionPoint) {
final String name = configurationElement.getName();
// Check if it is a binding definition.
if (TAG_KEY_BINDING.equals(name)) {
- addElementToIndexedArray(configurationElement,
- indexedConfigurationElements,
- INDEX_BINDING_DEFINITIONS, bindingDefinitionCount++);
+ addElementToIndexedArray(configurationElement, indexedConfigurationElements, INDEX_BINDING_DEFINITIONS,
+ bindingDefinitionCount++);
// Check if it is a scheme defintion.
} else if (TAG_KEY_CONFIGURATION.equals(name)) {
- addElementToIndexedArray(configurationElement,
- indexedConfigurationElements, INDEX_SCHEME_DEFINITIONS,
+ addElementToIndexedArray(configurationElement, indexedConfigurationElements, INDEX_SCHEME_DEFINITIONS,
schemeDefinitionCount++);
// Check if it is an active scheme identifier.
} else if (TAG_ACTIVE_KEY_CONFIGURATION.equals(name)) {
- addElementToIndexedArray(configurationElement,
- indexedConfigurationElements, INDEX_ACTIVE_SCHEME,
+ addElementToIndexedArray(configurationElement, indexedConfigurationElements, INDEX_ACTIVE_SCHEME,
activeSchemeElementCount++);
}
}
@@ -1347,15 +1184,13 @@ public class BindingPersistence extends PreferencePersistence {
// Check if the name matches the accelerator configuration element
if (TAG_ACCELERATOR_CONFIGURATION.equals(name)) {
- addElementToIndexedArray(configurationElement,
- indexedConfigurationElements, INDEX_SCHEME_DEFINITIONS,
+ addElementToIndexedArray(configurationElement, indexedConfigurationElements, INDEX_SCHEME_DEFINITIONS,
schemeDefinitionCount++);
}
}
// Create the preference memento.
- final IPreferenceStore store = WorkbenchPlugin.getDefault()
- .getPreferenceStore();
+ final IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
final String preferenceString = store.getString(EXTENSION_COMMANDS);
IMemento preferenceMemento = null;
if ((preferenceString != null) && (preferenceString.length() > 0)) {
@@ -1368,15 +1203,12 @@ public class BindingPersistence extends PreferencePersistence {
}
// Read the scheme definitions.
- readSchemesFromRegistry(
- indexedConfigurationElements[INDEX_SCHEME_DEFINITIONS],
- schemeDefinitionCount, bindingManager);
- readActiveScheme(indexedConfigurationElements[INDEX_ACTIVE_SCHEME],
- activeSchemeElementCount, preferenceMemento, bindingManager);
- readBindingsFromRegistry(
- indexedConfigurationElements[INDEX_BINDING_DEFINITIONS],
- bindingDefinitionCount, bindingManager, commandManager);
- readBindingsFromPreferences(preferenceMemento, bindingManager,
- commandManager);
+ readSchemesFromRegistry(indexedConfigurationElements[INDEX_SCHEME_DEFINITIONS], schemeDefinitionCount,
+ bindingManager);
+ readActiveScheme(indexedConfigurationElements[INDEX_ACTIVE_SCHEME], activeSchemeElementCount, preferenceMemento,
+ bindingManager);
+ readBindingsFromRegistry(indexedConfigurationElements[INDEX_BINDING_DEFINITIONS], bindingDefinitionCount,
+ bindingManager, commandManager);
+ readBindingsFromPreferences(preferenceMemento, bindingManager, commandManager);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/BindingService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/BindingService.java
index 60faf029fbb..2d243436101 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/BindingService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/BindingService.java
@@ -175,8 +175,7 @@ public final class BindingService implements IBindingService {
@Override
public String getBestActiveBindingFormattedFor(String commandId) {
- TriggerSequence sequence = bindingService.getBestSequenceFor(commandService.createCommand(
- commandId, null));
+ TriggerSequence sequence = bindingService.getBestSequenceFor(commandService.createCommand(commandId, null));
return sequence == null ? null : sequence.format();
}
@@ -211,8 +210,7 @@ public final class BindingService implements IBindingService {
@Override
public Map getPartialMatches(TriggerSequence trigger) {
final Collection<Binding> partialMatches = bindingService.getPartialMatches(trigger);
- final Map<TriggerSequence, Binding> result = new HashMap<>(
- partialMatches.size());
+ final Map<TriggerSequence, Binding> result = new HashMap<>(partialMatches.size());
for (Binding binding : partialMatches) {
result.put(binding.getTriggerSequence(), binding);
@@ -300,8 +298,7 @@ public final class BindingService implements IBindingService {
HashMap<Binding, MKeyBinding> bindingToKey = new HashMap<>();
for (MBindingTable table : application.getBindingTables()) {
for (MKeyBinding modelBinding : table.getBindings()) {
- final Object obj = modelBinding.getTransientData().get(
- EBindingService.MODEL_TO_BINDING_KEY);
+ final Object obj = modelBinding.getTransientData().get(EBindingService.MODEL_TO_BINDING_KEY);
if (obj instanceof Binding) {
bindingToKey.put((Binding) obj, modelBinding);
}
@@ -398,8 +395,8 @@ public final class BindingService implements IBindingService {
}
/*
- * Copied from
- * org.eclipse.jface.bindings.BindingManager.compareSchemes(String, String)
+ * Copied from org.eclipse.jface.bindings.BindingManager.compareSchemes(String,
+ * String)
*
* Returns an in based on scheme 1 < scheme 2
*/
@@ -422,10 +419,8 @@ public final class BindingService implements IBindingService {
/**
* Compare 2 bindings, taking into account Scheme and type.
*
- * @param current
- * the existing binding
- * @param addition
- * the incoming binding
+ * @param current the existing binding
+ * @param addition the incoming binding
* @return an int indicating current > addition
*/
private int compareTo(Binding current, Binding addition) {
@@ -441,7 +436,6 @@ public final class BindingService implements IBindingService {
return current.getType() - addition.getType();
}
-
private void writeSchemeToModel(Scheme activeScheme) {
List<String> tags = application.getTags();
boolean found = false;
@@ -510,16 +504,15 @@ public final class BindingService implements IBindingService {
/**
* TODO Promote this method to API.
* <p>
- * Adds a single new binding to the existing array of bindings. If the array
- * is currently <code>null</code>, then a new array is created and this
- * binding is added to it. This method does not detect duplicates.
+ * Adds a single new binding to the existing array of bindings. If the array is
+ * currently <code>null</code>, then a new array is created and this binding is
+ * added to it. This method does not detect duplicates.
* </p>
* <p>
* This method completes in amortized <code>O(1)</code>.
* </p>
*
- * @param binding
- * The binding to be added; must not be <code>null</code>.
+ * @param binding The binding to be added; must not be <code>null</code>.
*/
public void addBinding(final Binding binding) {
MBindingTable table = getMTable(binding.getContextId());
@@ -589,8 +582,7 @@ public final class BindingService implements IBindingService {
// Add some sort of timestamp on the source files and update
// only when it changes
// TBD placement: this should be in the "3.x bridge" code
- static public MKeyBinding createORupdateMKeyBinding(MApplication application,
- MBindingTable table,
+ static public MKeyBinding createORupdateMKeyBinding(MApplication application, MBindingTable table,
Binding binding) {
boolean addToTable = false;
@@ -604,8 +596,7 @@ public final class BindingService implements IBindingService {
MKeyBinding keyBinding = null;
for (MKeyBinding existingBinding : table.getBindings()) {
- Binding b = (Binding) existingBinding.getTransientData().get(
- EBindingService.MODEL_TO_BINDING_KEY);
+ Binding b = (Binding) existingBinding.getTransientData().get(EBindingService.MODEL_TO_BINDING_KEY);
if (binding.equals(b)) {
keyBinding = existingBinding;
break;
@@ -683,8 +674,7 @@ public final class BindingService implements IBindingService {
String commandId = binding.getParameterizedCommand().getId();
for (MKeyBinding curr : mBindings) {
- Binding transientBinding = (Binding) curr.getTransientData().get(
- EBindingService.MODEL_TO_BINDING_KEY);
+ Binding transientBinding = (Binding) curr.getTransientData().get(EBindingService.MODEL_TO_BINDING_KEY);
if (transientBinding != null) {
if (binding.equals(transientBinding)) {
return curr;
@@ -692,8 +682,7 @@ public final class BindingService implements IBindingService {
continue;
}
// check equality
- if (curr.getKeySequence().equals(binding.getTriggerSequence().toString())
- && curr.getCommand() != null
+ if (curr.getKeySequence().equals(binding.getTriggerSequence().toString()) && curr.getCommand() != null
&& curr.getCommand().getElementId().equals(commandId)) {
String schemeId = IBindingService.DEFAULT_DEFAULT_ACTIVE_SCHEME_ID;
@@ -717,11 +706,10 @@ public final class BindingService implements IBindingService {
}
/**
- * Remove the specific binding by identity. Does nothing if the binding is
- * not in the manager.
+ * Remove the specific binding by identity. Does nothing if the binding is not
+ * in the manager.
*
- * @param binding
- * The binding to be removed; must not be <code>null</code>.
+ * @param binding The binding to be removed; must not be <code>null</code>.
*/
public void removeBinding(final Binding binding) {
MKeyBinding mKeyBinding;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/CancelOnModifyListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/CancelOnModifyListener.java
index 9d92d79048f..b98f2c6c7f2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/CancelOnModifyListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/CancelOnModifyListener.java
@@ -27,27 +27,26 @@ import org.eclipse.swt.widgets.Widget;
*/
final class CancelOnModifyListener implements Listener {
- /**
- * The listener to remove when this listener catches any event. This value
- * should not be <code>null</code>.
- */
- private final Listener chainedListener;
+ /**
+ * The listener to remove when this listener catches any event. This value
+ * should not be <code>null</code>.
+ */
+ private final Listener chainedListener;
- /**
- * Constructs a new instance of <code>CancelOnModifyListener</code>
- *
- * @param listener
- * The listener which should be removed in the event of a
- * modification event arriving; should not be <code>null</code>.
- */
- CancelOnModifyListener(Listener listener) {
- chainedListener = listener;
- }
+ /**
+ * Constructs a new instance of <code>CancelOnModifyListener</code>
+ *
+ * @param listener The listener which should be removed in the event of a
+ * modification event arriving; should not be <code>null</code>.
+ */
+ CancelOnModifyListener(Listener listener) {
+ chainedListener = listener;
+ }
- @Override
+ @Override
public void handleEvent(Event event) {
- Widget widget = event.widget;
- widget.removeListener(SWT.Modify, this);
- widget.removeListener(SWT.KeyDown, chainedListener);
- }
+ Widget widget = event.widget;
+ widget.removeListener(SWT.Modify, this);
+ widget.removeListener(SWT.KeyDown, chainedListener);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/CategoryPatternFilter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/CategoryPatternFilter.java
index dfeaf5e4bb0..3822adaef4e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/CategoryPatternFilter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/CategoryPatternFilter.java
@@ -49,8 +49,7 @@ class CategoryPatternFilter extends PatternFilter {
if (filterCategories) {
final ParameterizedCommand cmd = getCommand(element);
try {
- if (cmd != null
- && cmd.getCommand().getCategory() == uncategorized) {
+ if (cmd != null && cmd.getCommand().getCategory() == uncategorized) {
return false;
}
} catch (NotDefinedException e) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/CompactKeyFormatter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/CompactKeyFormatter.java
index 55c58eb0011..233a5449685 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/CompactKeyFormatter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/CompactKeyFormatter.java
@@ -35,69 +35,65 @@ import org.eclipse.ui.keys.NaturalKey;
*/
public class CompactKeyFormatter extends NativeKeyFormatter {
- @Override
+ @Override
public String format(KeySequence keySequence) {
- StringBuilder stringBuffer = new StringBuilder();
-
- List keyStrokes = keySequence.getKeyStrokes();
- KeyStroke[] keyStrokeArray = (KeyStroke[]) keyStrokes
- .toArray(new KeyStroke[keyStrokes.size()]);
- Set previousModifierKeys = Collections.EMPTY_SET;
- List naturalKeys = new ArrayList();
- for (int i = 0; i < keyStrokeArray.length; i++) {
- KeyStroke keyStroke = keyStrokeArray[i];
- Set currentModifierKeys = keyStroke.getModifierKeys();
-
- if (!previousModifierKeys.equals(currentModifierKeys)) {
- // End the old sequence fragment.
- if (i > 0) {
- stringBuffer.append(formatKeyStrokes(previousModifierKeys,
- naturalKeys));
- stringBuffer.append(getKeyStrokeDelimiter());
- }
-
- // Start a new one.
- previousModifierKeys = currentModifierKeys;
- naturalKeys.clear();
-
- }
-
- naturalKeys.add(keyStroke.getNaturalKey());
- }
-
- stringBuffer
- .append(formatKeyStrokes(previousModifierKeys, naturalKeys));
-
- return stringBuffer.toString();
- }
-
- public String formatKeyStrokes(Set modifierKeys, List naturalKeys) {
- StringBuilder stringBuffer = new StringBuilder();
- String keyDelimiter = getKeyDelimiter();
-
- // Format the modifier keys, in sorted order.
- SortedSet sortedModifierKeys = new TreeSet(getModifierKeyComparator());
- sortedModifierKeys.addAll(modifierKeys);
- Iterator sortedModifierKeyItr = sortedModifierKeys.iterator();
- while (sortedModifierKeyItr.hasNext()) {
- stringBuffer.append(format((ModifierKey) sortedModifierKeyItr
- .next()));
- stringBuffer.append(keyDelimiter);
- }
-
- // Format the natural key, if any.
- Iterator naturalKeyItr = naturalKeys.iterator();
- while (naturalKeyItr.hasNext()) {
- Object naturalKey = naturalKeyItr.next();
- if (naturalKey instanceof NaturalKey) {
- stringBuffer.append(format((NaturalKey) naturalKey));
- if (naturalKeyItr.hasNext()) {
- stringBuffer.append(keyDelimiter);
- }
- }
- }
-
- return stringBuffer.toString();
-
- }
+ StringBuilder stringBuffer = new StringBuilder();
+
+ List keyStrokes = keySequence.getKeyStrokes();
+ KeyStroke[] keyStrokeArray = (KeyStroke[]) keyStrokes.toArray(new KeyStroke[keyStrokes.size()]);
+ Set previousModifierKeys = Collections.EMPTY_SET;
+ List naturalKeys = new ArrayList();
+ for (int i = 0; i < keyStrokeArray.length; i++) {
+ KeyStroke keyStroke = keyStrokeArray[i];
+ Set currentModifierKeys = keyStroke.getModifierKeys();
+
+ if (!previousModifierKeys.equals(currentModifierKeys)) {
+ // End the old sequence fragment.
+ if (i > 0) {
+ stringBuffer.append(formatKeyStrokes(previousModifierKeys, naturalKeys));
+ stringBuffer.append(getKeyStrokeDelimiter());
+ }
+
+ // Start a new one.
+ previousModifierKeys = currentModifierKeys;
+ naturalKeys.clear();
+
+ }
+
+ naturalKeys.add(keyStroke.getNaturalKey());
+ }
+
+ stringBuffer.append(formatKeyStrokes(previousModifierKeys, naturalKeys));
+
+ return stringBuffer.toString();
+ }
+
+ public String formatKeyStrokes(Set modifierKeys, List naturalKeys) {
+ StringBuilder stringBuffer = new StringBuilder();
+ String keyDelimiter = getKeyDelimiter();
+
+ // Format the modifier keys, in sorted order.
+ SortedSet sortedModifierKeys = new TreeSet(getModifierKeyComparator());
+ sortedModifierKeys.addAll(modifierKeys);
+ Iterator sortedModifierKeyItr = sortedModifierKeys.iterator();
+ while (sortedModifierKeyItr.hasNext()) {
+ stringBuffer.append(format((ModifierKey) sortedModifierKeyItr.next()));
+ stringBuffer.append(keyDelimiter);
+ }
+
+ // Format the natural key, if any.
+ Iterator naturalKeyItr = naturalKeys.iterator();
+ while (naturalKeyItr.hasNext()) {
+ Object naturalKey = naturalKeyItr.next();
+ if (naturalKey instanceof NaturalKey) {
+ stringBuffer.append(format((NaturalKey) naturalKey));
+ if (naturalKeyItr.hasNext()) {
+ stringBuffer.append(keyDelimiter);
+ }
+ }
+ }
+
+ return stringBuffer.toString();
+
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/EmacsKeyFormatter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/EmacsKeyFormatter.java
index 57fbd199f47..f3c233ba222 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/EmacsKeyFormatter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/EmacsKeyFormatter.java
@@ -31,55 +31,51 @@ import org.eclipse.ui.keys.ModifierKey;
*/
public class EmacsKeyFormatter extends AbstractKeyFormatter {
- /**
- * A comparator that guarantees that modifier keys will be sorted the same
- * across different platforms.
- */
- private static final Comparator EMACS_MODIFIER_KEY_COMPARATOR = new AlphabeticModifierKeyComparator();
+ /**
+ * A comparator that guarantees that modifier keys will be sorted the same
+ * across different platforms.
+ */
+ private static final Comparator EMACS_MODIFIER_KEY_COMPARATOR = new AlphabeticModifierKeyComparator();
- /**
- * The resource bundle used by <code>format()</code> to translate formal
- * string representations by locale.
- */
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
- .getBundle(EmacsKeyFormatter.class.getName());
+ /**
+ * The resource bundle used by <code>format()</code> to translate formal string
+ * representations by locale.
+ */
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(EmacsKeyFormatter.class.getName());
- /**
- * Formats an individual key into a human readable format. This converts
- * the key into a format similar to Xemacs.
- *
- * @param key
- * The key to format; must not be <code>null</code>.
- * @return The key formatted as a string; should not be <code>null</code>.
- */
- @Override
+ /**
+ * Formats an individual key into a human readable format. This converts the key
+ * into a format similar to Xemacs.
+ *
+ * @param key The key to format; must not be <code>null</code>.
+ * @return The key formatted as a string; should not be <code>null</code>.
+ */
+ @Override
public String format(Key key) {
- if (key instanceof ModifierKey) {
- String formattedName = Util.translateString(RESOURCE_BUNDLE, key
- .toString(), null, false, false);
- if (formattedName != null) {
- return formattedName;
- }
- }
+ if (key instanceof ModifierKey) {
+ String formattedName = Util.translateString(RESOURCE_BUNDLE, key.toString(), null, false, false);
+ if (formattedName != null) {
+ return formattedName;
+ }
+ }
- return super.format(key).toLowerCase();
- }
+ return super.format(key).toLowerCase();
+ }
- @Override
+ @Override
protected String getKeyDelimiter() {
- return Util.translateString(RESOURCE_BUNDLE, KEY_DELIMITER_KEY,
- KeyStroke.KEY_DELIMITER, false, false);
- }
+ return Util.translateString(RESOURCE_BUNDLE, KEY_DELIMITER_KEY, KeyStroke.KEY_DELIMITER, false, false);
+ }
- @Override
+ @Override
protected String getKeyStrokeDelimiter() {
- return Util.translateString(RESOURCE_BUNDLE, KEY_STROKE_DELIMITER_KEY,
- KeySequence.KEY_STROKE_DELIMITER, false, false);
- }
+ return Util.translateString(RESOURCE_BUNDLE, KEY_STROKE_DELIMITER_KEY, KeySequence.KEY_STROKE_DELIMITER, false,
+ false);
+ }
- @Override
+ @Override
protected Comparator getModifierKeyComparator() {
- return EMACS_MODIFIER_KEY_COMPARATOR;
- }
+ return EMACS_MODIFIER_KEY_COMPARATOR;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/FormalKeyFormatter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/FormalKeyFormatter.java
index 4c698fb689c..57b976da0e3 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/FormalKeyFormatter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/FormalKeyFormatter.java
@@ -28,30 +28,30 @@ import org.eclipse.ui.keys.KeyStroke;
*/
public class FormalKeyFormatter extends AbstractKeyFormatter {
- /**
- * A comparator that guarantees that modifier keys will be sorted the same
- * across different platforms.
- */
- private static final Comparator FORMAL_MODIFIER_KEY_COMPARATOR = new AlphabeticModifierKeyComparator();
+ /**
+ * A comparator that guarantees that modifier keys will be sorted the same
+ * across different platforms.
+ */
+ private static final Comparator FORMAL_MODIFIER_KEY_COMPARATOR = new AlphabeticModifierKeyComparator();
- @Override
+ @Override
public String format(Key key) {
- return key.toString();
- }
+ return key.toString();
+ }
- @Override
+ @Override
protected String getKeyDelimiter() {
- return KeyStroke.KEY_DELIMITER;
- }
+ return KeyStroke.KEY_DELIMITER;
+ }
- @Override
+ @Override
protected String getKeyStrokeDelimiter() {
- return KeySequence.KEY_STROKE_DELIMITER;
- }
+ return KeySequence.KEY_STROKE_DELIMITER;
+ }
- @Override
+ @Override
protected Comparator getModifierKeyComparator() {
- return FORMAL_MODIFIER_KEY_COMPARATOR;
- }
+ return FORMAL_MODIFIER_KEY_COMPARATOR;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/GlobalKeyAssistDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/GlobalKeyAssistDialog.java
index 1b0c2354eb0..63eadc9c7e6 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/GlobalKeyAssistDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/GlobalKeyAssistDialog.java
@@ -47,8 +47,8 @@ public class GlobalKeyAssistDialog extends KeyAssistDialog {
private final String keysPageId = "org.eclipse.ui.preferencePages.Keys"; //$NON-NLS-1$
/**
- * Whether this dialog is currently open, if the dialog is opened again, we
- * open the preference page instead
+ * Whether this dialog is currently open, if the dialog is opened again, we open
+ * the preference page instead
*/
private boolean isOpen;
@@ -79,9 +79,9 @@ public class GlobalKeyAssistDialog extends KeyAssistDialog {
}
/**
- * Determines what keybinding was used to open this dialog and returns an
- * info string using that binding. ex:
- * "Press 'Ctrl-Shift-L') to open the preference page";
+ * Determines what keybinding was used to open this dialog and returns an info
+ * string using that binding. ex: "Press 'Ctrl-Shift-L') to open the preference
+ * page";
*
* @return info text for this dialog
*/
@@ -91,8 +91,7 @@ public class GlobalKeyAssistDialog extends KeyAssistDialog {
if (cmd != null) {
EBindingService bindingService = context.getActiveLeaf().get(EBindingService.class);
- TriggerSequence keySeq = bindingService.getBestSequenceFor(new ParameterizedCommand(
- cmd, null));
+ TriggerSequence keySeq = bindingService.getBestSequenceFor(new ParameterizedCommand(cmd, null));
if (keySeq != null) {
return NLS.bind(KeyAssistMessages.openPreferencePage, keySeq.format());
@@ -113,8 +112,8 @@ public class GlobalKeyAssistDialog extends KeyAssistDialog {
shell = shell.getParent().getShell();
}
- PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(shell,
- keysPageId, null, getSelectedBinding());
+ PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(shell, keysPageId, null,
+ getSelectedBinding());
close();
return dialog.open();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/ImageFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/ImageFactory.java
index 8176fd0d28a..0e04c75f39e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/ImageFactory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/ImageFactory.java
@@ -33,8 +33,7 @@ final class ImageFactory {
put("change", "$nl$/icons/full/obj16/change_obj.png"); //$NON-NLS-1$//$NON-NLS-2$
/*
- * TODO Remove these images from the registry if they are no longer
- * needed.
+ * TODO Remove these images from the registry if they are no longer needed.
*/
put("minus", "$nl$/icons/full/obj16/delete_obj.png"); //$NON-NLS-1$//$NON-NLS-2$
put("plus", "$nl$/icons/full/obj16/add_obj.png"); //$NON-NLS-1$//$NON-NLS-2$
@@ -50,7 +49,7 @@ final class ImageFactory {
image = imageDescriptor.createImage(false);
if (image == null) {
- WorkbenchPlugin.log(ImageFactory.class +": error creating image for " + key); //$NON-NLS-1$
+ WorkbenchPlugin.log(ImageFactory.class + ": error creating image for " + key); //$NON-NLS-1$
}
imageRegistry.put(key, image);
@@ -64,7 +63,7 @@ final class ImageFactory {
ImageDescriptor imageDescriptor = (ImageDescriptor) map.get(key);
if (imageDescriptor == null) {
- WorkbenchPlugin.log(ImageFactory.class +": no image descriptor for " + key); //$NON-NLS-1$
+ WorkbenchPlugin.log(ImageFactory.class + ": no image descriptor for " + key); //$NON-NLS-1$
}
return imageDescriptor;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KdeKeyFormatter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KdeKeyFormatter.java
index 21dc3290e11..3f33cae13d0 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KdeKeyFormatter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KdeKeyFormatter.java
@@ -24,46 +24,43 @@ import org.eclipse.ui.keys.ModifierKey;
public final class KdeKeyFormatter extends AbstractKeyFormatter {
- private static final class KdeModifierKeyComparator extends
- AbstractModifierKeyComparator {
+ private static final class KdeModifierKeyComparator extends AbstractModifierKeyComparator {
- @Override
+ @Override
protected int rank(ModifierKey modifierKey) {
- if (ModifierKey.ALT.equals(modifierKey)) {
- return 0;
- }
+ if (ModifierKey.ALT.equals(modifierKey)) {
+ return 0;
+ }
- if (ModifierKey.CTRL.equals(modifierKey)) {
- return 1;
- }
+ if (ModifierKey.CTRL.equals(modifierKey)) {
+ return 1;
+ }
- if (ModifierKey.SHIFT.equals(modifierKey)) {
- return 2;
- }
+ if (ModifierKey.SHIFT.equals(modifierKey)) {
+ return 2;
+ }
- return Integer.MAX_VALUE;
- }
- }
+ return Integer.MAX_VALUE;
+ }
+ }
- private static final Comparator MODIFIER_KEY_COMPARATOR = new KdeModifierKeyComparator();
+ private static final Comparator MODIFIER_KEY_COMPARATOR = new KdeModifierKeyComparator();
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
- .getBundle(KdeKeyFormatter.class.getName());
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(KdeKeyFormatter.class.getName());
- @Override
+ @Override
protected String getKeyDelimiter() {
- return Util.translateString(RESOURCE_BUNDLE, KEY_DELIMITER_KEY,
- KeyStroke.KEY_DELIMITER, false, false);
- }
+ return Util.translateString(RESOURCE_BUNDLE, KEY_DELIMITER_KEY, KeyStroke.KEY_DELIMITER, false, false);
+ }
- @Override
+ @Override
protected String getKeyStrokeDelimiter() {
- return Util.translateString(RESOURCE_BUNDLE, KEY_STROKE_DELIMITER_KEY,
- KeySequence.KEY_STROKE_DELIMITER, false, false);
- }
+ return Util.translateString(RESOURCE_BUNDLE, KEY_STROKE_DELIMITER_KEY, KeySequence.KEY_STROKE_DELIMITER, false,
+ false);
+ }
- @Override
+ @Override
protected Comparator getModifierKeyComparator() {
- return MODIFIER_KEY_COMPARATOR;
- }
+ return MODIFIER_KEY_COMPARATOR;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KeyAssistMessages.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KeyAssistMessages.java
index 2e9607b2b7e..3249fcf0f55 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KeyAssistMessages.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KeyAssistMessages.java
@@ -15,11 +15,9 @@ package org.eclipse.ui.internal.keys;
import org.eclipse.osgi.util.NLS;
-
-
/**
- * The KeyAssistMessages class is the class that manages the messages
- * used in the KeyAssistDialog.
+ * The KeyAssistMessages class is the class that manages the messages used in
+ * the KeyAssistDialog.
*
*/
public class KeyAssistMessages extends NLS {
@@ -28,7 +26,6 @@ public class KeyAssistMessages extends NLS {
public static String NoMatches_Message;
public static String openPreferencePage;
-
static {
// load message values from bundle file
NLS.initializeMessages(BUNDLE_NAME, KeyAssistMessages.class);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KeyBindingState.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KeyBindingState.java
index d70097ed343..38d8be3a604 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KeyBindingState.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KeyBindingState.java
@@ -32,144 +32,140 @@ import org.eclipse.ui.internal.WorkbenchWindow;
* keys would the sequence reset itself.
* </p>
* <p>
- * In the current implementation, a partial reset results in only one key
- * stroke being left in the sequence. However, this may change in the future.
+ * In the current implementation, a partial reset results in only one key stroke
+ * being left in the sequence. However, this may change in the future.
* </p>
*
* @since 3.0
*/
class KeyBindingState {
- /**
- * The workbench window associated with this state. The state can only
- * exist for one window. When the focus leaves this window then the mode
- * must automatically be reset.
- */
- private IWorkbenchWindow associatedWindow;
+ /**
+ * The workbench window associated with this state. The state can only exist for
+ * one window. When the focus leaves this window then the mode must
+ * automatically be reset.
+ */
+ private IWorkbenchWindow associatedWindow;
- /**
- * This is the current extent of the sequence entered by the user. In an
- * application with only single-stroke key bindings, this will also be
- * empty. However, in applications with multi-stroke key bindings, this is
- * the sequence entered by the user that partially matches another one of
- * the application's active key bindings.
- */
- private KeySequence currentSequence;
+ /**
+ * This is the current extent of the sequence entered by the user. In an
+ * application with only single-stroke key bindings, this will also be empty.
+ * However, in applications with multi-stroke key bindings, this is the sequence
+ * entered by the user that partially matches another one of the application's
+ * active key bindings.
+ */
+ private KeySequence currentSequence;
- /**
- * The workbench that should be notified of changes to the key binding
- * state. This is done by updating one of the contribution items on the
- * status line.
- */
- private final IWorkbench workbench;
+ /**
+ * The workbench that should be notified of changes to the key binding state.
+ * This is done by updating one of the contribution items on the status line.
+ */
+ private final IWorkbench workbench;
- /**
- * Constructs a new instance of <code>KeyBindingState</code> with an
- * empty key sequence, set to reset fully.
- *
- * @param workbenchToNotify
- * The workbench that this state should keep advised of changes
- * to the key binding state; must not be <code>null</code>.
- */
- KeyBindingState(IWorkbench workbenchToNotify) {
- currentSequence = KeySequence.getInstance();
- workbench = workbenchToNotify;
- associatedWindow = workbench.getActiveWorkbenchWindow();
- }
+ /**
+ * Constructs a new instance of <code>KeyBindingState</code> with an empty key
+ * sequence, set to reset fully.
+ *
+ * @param workbenchToNotify The workbench that this state should keep advised of
+ * changes to the key binding state; must not be
+ * <code>null</code>.
+ */
+ KeyBindingState(IWorkbench workbenchToNotify) {
+ currentSequence = KeySequence.getInstance();
+ workbench = workbenchToNotify;
+ associatedWindow = workbench.getActiveWorkbenchWindow();
+ }
- /**
- * An accessor for the workbench window associated with this state. This
- * should never be <code>null</code>, as the setting follows the last
- * workbench window to have focus.
- *
- * @return The workbench window to which the key binding architecture is
- * currently attached; should never be <code>null</code>.
- */
- IWorkbenchWindow getAssociatedWindow() {
- return associatedWindow;
- }
+ /**
+ * An accessor for the workbench window associated with this state. This should
+ * never be <code>null</code>, as the setting follows the last workbench window
+ * to have focus.
+ *
+ * @return The workbench window to which the key binding architecture is
+ * currently attached; should never be <code>null</code>.
+ */
+ IWorkbenchWindow getAssociatedWindow() {
+ return associatedWindow;
+ }
- /**
- * An accessor for the current key sequence waiting for completion.
- *
- * @return The current incomplete key sequence; never <code>null</code>,
- * but may be empty.
- */
- KeySequence getCurrentSequence() {
- return currentSequence;
- }
+ /**
+ * An accessor for the current key sequence waiting for completion.
+ *
+ * @return The current incomplete key sequence; never <code>null</code>, but may
+ * be empty.
+ */
+ KeySequence getCurrentSequence() {
+ return currentSequence;
+ }
- /**
- * Gets the status line contribution item which the key binding
- * architecture uses to keep the user up-to-date as to the current state.
- *
- * @return The status line contribution item, if any; <code>null</code>,
- * if none.
- */
- StatusLineContributionItem getStatusLine() {
- if (associatedWindow instanceof WorkbenchWindow) {
- WorkbenchWindow window = (WorkbenchWindow) associatedWindow;
- IStatusLineManager statusLine = window.getStatusLineManager();
- // TODO implicit dependency on IDE's action builder
- // @issue implicit dependency on IDE's action builder
- if (statusLine != null) { // this can be null if we're exiting
- IContributionItem item = statusLine
- .find("ModeContributionItem"); //$NON-NLS-1$
- if (item instanceof StatusLineContributionItem) {
- return ((StatusLineContributionItem) item);
- }
- }
- }
+ /**
+ * Gets the status line contribution item which the key binding architecture
+ * uses to keep the user up-to-date as to the current state.
+ *
+ * @return The status line contribution item, if any; <code>null</code>, if
+ * none.
+ */
+ StatusLineContributionItem getStatusLine() {
+ if (associatedWindow instanceof WorkbenchWindow) {
+ WorkbenchWindow window = (WorkbenchWindow) associatedWindow;
+ IStatusLineManager statusLine = window.getStatusLineManager();
+ // TODO implicit dependency on IDE's action builder
+ // @issue implicit dependency on IDE's action builder
+ if (statusLine != null) { // this can be null if we're exiting
+ IContributionItem item = statusLine.find("ModeContributionItem"); //$NON-NLS-1$
+ if (item instanceof StatusLineContributionItem) {
+ return ((StatusLineContributionItem) item);
+ }
+ }
+ }
- return null;
- }
+ return null;
+ }
- /**
- * <p>
- * Resets the state based on the current properties. If the state is to
- * collapse fully or if there are no key strokes, then it sets the state to
- * have an empty key sequence. Otherwise, it leaves the first key stroke in
- * the sequence.
- * </p>
- * <p>
- * The workbench's status lines are updated, if appropriate.
- * </p>
- */
- void reset() {
- currentSequence = KeySequence.getInstance();
- updateStatusLines();
- }
+ /**
+ * <p>
+ * Resets the state based on the current properties. If the state is to collapse
+ * fully or if there are no key strokes, then it sets the state to have an empty
+ * key sequence. Otherwise, it leaves the first key stroke in the sequence.
+ * </p>
+ * <p>
+ * The workbench's status lines are updated, if appropriate.
+ * </p>
+ */
+ void reset() {
+ currentSequence = KeySequence.getInstance();
+ updateStatusLines();
+ }
- /**
- * A mutator for the workbench window to which this state is associated.
- *
- * @param window
- * The workbench window to associated; should never be <code>null</code>.
- */
- void setAssociatedWindow(IWorkbenchWindow window) {
- associatedWindow = window;
- }
+ /**
+ * A mutator for the workbench window to which this state is associated.
+ *
+ * @param window The workbench window to associated; should never be
+ * <code>null</code>.
+ */
+ void setAssociatedWindow(IWorkbenchWindow window) {
+ associatedWindow = window;
+ }
- /**
- * A mutator for the partial sequence entered by the user.
- *
- * @param sequence
- * The current key sequence; should not be <code>null</code>,
- * but may be empty.
- */
- void setCurrentSequence(KeySequence sequence) {
- currentSequence = sequence;
- updateStatusLines();
- }
+ /**
+ * A mutator for the partial sequence entered by the user.
+ *
+ * @param sequence The current key sequence; should not be <code>null</code>,
+ * but may be empty.
+ */
+ void setCurrentSequence(KeySequence sequence) {
+ currentSequence = sequence;
+ updateStatusLines();
+ }
- /**
- * Updates the text of the status line of the associated shell with the
- * current sequence.
- */
- private void updateStatusLines() {
- StatusLineContributionItem statusLine = getStatusLine();
- if (statusLine != null) {
- statusLine.setText(getCurrentSequence().format());
- }
- }
+ /**
+ * Updates the text of the status line of the associated shell with the current
+ * sequence.
+ */
+ private void updateStatusLines() {
+ StatusLineContributionItem statusLine = getStatusLine();
+ if (statusLine != null) {
+ statusLine.setText(getCurrentSequence().format());
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KeySequenceBinding.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KeySequenceBinding.java
index 5d594680ba0..c6a107aaee1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KeySequenceBinding.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KeySequenceBinding.java
@@ -20,101 +20,100 @@ import org.eclipse.ui.keys.KeySequence;
public final class KeySequenceBinding implements IKeySequenceBinding {
- /**
- * This is the identifier for the default context. This is used wherever
- * some default is needed. For example, this is the context that is used
- * for key bindings that specify no context. This is also used to select a
- * default context in the keys preference page.
- */
- public static final String DEFAULT_CONTEXT_ID = "org.eclipse.ui.contexts.window"; //$NON-NLS-1$
+ /**
+ * This is the identifier for the default context. This is used wherever some
+ * default is needed. For example, this is the context that is used for key
+ * bindings that specify no context. This is also used to select a default
+ * context in the keys preference page.
+ */
+ public static final String DEFAULT_CONTEXT_ID = "org.eclipse.ui.contexts.window"; //$NON-NLS-1$
- private static final int HASH_FACTOR = 89;
+ private static final int HASH_FACTOR = 89;
- private static final int HASH_INITIAL = KeySequenceBinding.class.getName()
- .hashCode();
+ private static final int HASH_INITIAL = KeySequenceBinding.class.getName().hashCode();
- private transient int hashCode;
+ private transient int hashCode;
- private transient boolean hashCodeComputed;
+ private transient boolean hashCodeComputed;
- private KeySequence keySequence;
+ private KeySequence keySequence;
- private int match;
+ private int match;
- private transient String string;
+ private transient String string;
- public KeySequenceBinding(KeySequence keySequence, int match) {
- if (keySequence == null) {
+ public KeySequenceBinding(KeySequence keySequence, int match) {
+ if (keySequence == null) {
throw new NullPointerException();
}
- if (match < 0) {
+ if (match < 0) {
throw new IllegalArgumentException();
}
- this.keySequence = keySequence;
- this.match = match;
- }
+ this.keySequence = keySequence;
+ this.match = match;
+ }
- @Override
+ @Override
public int compareTo(Object object) {
- KeySequenceBinding castedObject = (KeySequenceBinding) object;
- int compareTo = Util.compare(match, castedObject.match);
+ KeySequenceBinding castedObject = (KeySequenceBinding) object;
+ int compareTo = Util.compare(match, castedObject.match);
- if (compareTo == 0) {
+ if (compareTo == 0) {
compareTo = Util.compare(keySequence, castedObject.keySequence);
}
- return compareTo;
- }
+ return compareTo;
+ }
- @Override
+ @Override
public boolean equals(Object object) {
- if (!(object instanceof KeySequenceBinding)) {
+ if (!(object instanceof KeySequenceBinding)) {
return false;
}
- final KeySequenceBinding castedObject = (KeySequenceBinding) object;
- if (!Util.equals(keySequence, castedObject.keySequence)) {
- return false;
- }
+ final KeySequenceBinding castedObject = (KeySequenceBinding) object;
+ if (!Util.equals(keySequence, castedObject.keySequence)) {
+ return false;
+ }
- return Util.equals(match, castedObject.match);
- }
+ return Util.equals(match, castedObject.match);
+ }
- @Override
+ @Override
public KeySequence getKeySequence() {
- return keySequence;
- }
+ return keySequence;
+ }
- public int getMatch() {
- return match;
- }
+ public int getMatch() {
+ return match;
+ }
- @Override
+ @Override
public int hashCode() {
- if (!hashCodeComputed) {
- hashCode = HASH_INITIAL;
- hashCode = hashCode * HASH_FACTOR + Util.hashCode(keySequence);
- hashCode = hashCode * HASH_FACTOR + Util.hashCode(match);
- hashCodeComputed = true;
- }
+ if (!hashCodeComputed) {
+ hashCode = HASH_INITIAL;
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(keySequence);
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(match);
+ hashCodeComputed = true;
+ }
- return hashCode;
- }
+ return hashCode;
+ }
- @Override
+ @Override
public String toString() {
- if (string == null) {
- final StringBuilder stringBuffer = new StringBuilder();
- stringBuffer.append('[');
- stringBuffer.append(keySequence);
- stringBuffer.append(',');
- stringBuffer.append(match);
- stringBuffer.append(']');
- string = stringBuffer.toString();
- }
-
- return string;
- }
+ if (string == null) {
+ final StringBuilder stringBuffer = new StringBuilder();
+ stringBuffer.append('[');
+ stringBuffer.append(keySequence);
+ stringBuffer.append(',');
+ stringBuffer.append(match);
+ stringBuffer.append(']');
+ string = stringBuffer.toString();
+ }
+
+ return string;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KeysPreferenceFiltersDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KeysPreferenceFiltersDialog.java
index a8785e939a6..f8e0e93f6db 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KeysPreferenceFiltersDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KeysPreferenceFiltersDialog.java
@@ -87,14 +87,11 @@ public class KeysPreferenceFiltersDialog extends ViewSettingsDialog {
topComposite.setLayout(layout);
topComposite.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL));
actionSetFilterCheckBox = new Button(topComposite, SWT.CHECK);
- actionSetFilterCheckBox
- .setText(NewKeysPreferenceMessages.ActionSetFilterCheckBox_Text);
+ actionSetFilterCheckBox.setText(NewKeysPreferenceMessages.ActionSetFilterCheckBox_Text);
internalFilterCheckBox = new Button(topComposite, SWT.CHECK);
- internalFilterCheckBox
- .setText(NewKeysPreferenceMessages.InternalFilterCheckBox_Text);
+ internalFilterCheckBox.setText(NewKeysPreferenceMessages.InternalFilterCheckBox_Text);
uncategorizedFilterCheckBox = new Button(topComposite, SWT.CHECK);
- uncategorizedFilterCheckBox
- .setText(NewKeysPreferenceMessages.UncategorizedFilterCheckBox_Text);
+ uncategorizedFilterCheckBox.setText(NewKeysPreferenceMessages.UncategorizedFilterCheckBox_Text);
actionSetFilterCheckBox.setSelection(filterActionSet);
internalFilterCheckBox.setSelection(filterInternal);
@@ -115,8 +112,7 @@ public class KeysPreferenceFiltersDialog extends ViewSettingsDialog {
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
- newShell
- .setText(NewKeysPreferenceMessages.KeysPreferenceFilterDialog_Title);
+ newShell.setText(NewKeysPreferenceMessages.KeysPreferenceFilterDialog_Title);
}
boolean getFilterShowUnboundCommands() {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KeysPreferencePage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KeysPreferencePage.java
index cfcec93eef1..8e5aca43971 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KeysPreferencePage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KeysPreferencePage.java
@@ -110,31 +110,29 @@ import org.eclipse.ui.statushandlers.StatusManager;
*
* @since 3.0
*/
-public final class KeysPreferencePage extends PreferencePage implements
- IWorkbenchPreferencePage {
+public final class KeysPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
/**
- * A selection listener to be used on the columns in the table on the view
- * tab. This selection listener modifies the sort order so that the
- * appropriate column is in the first position.
+ * A selection listener to be used on the columns in the table on the view tab.
+ * This selection listener modifies the sort order so that the appropriate
+ * column is in the first position.
*
* @since 3.1
*/
private class SortOrderSelectionListener extends SelectionAdapter {
/**
- * The column to be put in the first position. This value should be one
- * of the constants defined by <code>SORT_COLUMN_</code>.
+ * The column to be put in the first position. This value should be one of the
+ * constants defined by <code>SORT_COLUMN_</code>.
*/
private final int columnSelected;
/**
* Constructs a new instance of <code>SortOrderSelectionListener</code>.
*
- * @param columnSelected
- * The column to be given first priority in the sort order;
- * this value should be one of the constants defined as
- * <code>SORT_COLUMN_</code>.
+ * @param columnSelected The column to be given first priority in the sort
+ * order; this value should be one of the constants
+ * defined as <code>SORT_COLUMN_</code>.
*/
private SortOrderSelectionListener(final int columnSelected) {
this.columnSelected = columnSelected;
@@ -144,11 +142,9 @@ public final class KeysPreferencePage extends PreferencePage implements
public void widgetSelected(SelectionEvent e) {
// Change the column titles.
final int oldSortIndex = sortOrder[0];
- final TableColumn oldSortColumn = tableBindings
- .getColumn(oldSortIndex);
+ final TableColumn oldSortColumn = tableBindings.getColumn(oldSortIndex);
oldSortColumn.setText(UNSORTED_COLUMN_NAMES[oldSortIndex]);
- final TableColumn newSortColumn = tableBindings
- .getColumn(columnSelected);
+ final TableColumn newSortColumn = tableBindings.getColumn(columnSelected);
newSortColumn.setText(SORTED_COLUMN_NAMES[columnSelected]);
// Change the sort order.
@@ -158,9 +154,8 @@ public final class KeysPreferencePage extends PreferencePage implements
for (int i = 0; i < sortOrder.length; i++) {
if (sortOrder[i] == columnSelected) {
/*
- * We've found the place where the column existing in the
- * old sort order. No matter what at this point, we have
- * completed the reshuffling.
+ * We've found the place where the column existing in the old sort order. No
+ * matter what at this point, we have completed the reshuffling.
*/
enoughRoom = true;
if (bumpedColumn != -1) {
@@ -181,8 +176,7 @@ public final class KeysPreferencePage extends PreferencePage implements
} else {
/*
- * We are not currently bumping, so drop the column and
- * start bumping.
+ * We are not currently bumping, so drop the column and start bumping.
*/
bumpedColumn = sortOrder[i];
sortOrder[i] = columnSelected;
@@ -193,8 +187,7 @@ public final class KeysPreferencePage extends PreferencePage implements
// Grow the sort order.
if (!enoughRoom) {
final int[] newSortOrder = new int[sortOrder.length + 1];
- System.arraycopy(sortOrder, 0, newSortOrder, 0,
- sortOrder.length);
+ System.arraycopy(sortOrder, 0, newSortOrder, 0, sortOrder.length);
newSortOrder[sortOrder.length] = bumpedColumn;
sortOrder = newSortOrder;
}
@@ -206,8 +199,8 @@ public final class KeysPreferencePage extends PreferencePage implements
/**
* The data key for the binding stored on an SWT widget. The key is a
- * fully-qualified name, but in reverse order. This is so that the equals
- * method will detect misses faster.
+ * fully-qualified name, but in reverse order. This is so that the equals method
+ * will detect misses faster.
*/
private static final String BINDING_KEY = "Binding.bindings.jface.eclipse.org"; //$NON-NLS-1$
@@ -223,8 +216,8 @@ public final class KeysPreferencePage extends PreferencePage implements
private static final Image IMAGE_CHANGE = ImageFactory.getImage("change"); //$NON-NLS-1$
/**
- * The data key at which the <code>Binding</code> instance for a table
- * item is stored.
+ * The data key at which the <code>Binding</code> instance for a table item is
+ * stored.
*/
private static final String ITEM_DATA_KEY = "org.eclipse.jface.bindings"; //$NON-NLS-1$
@@ -236,8 +229,7 @@ public final class KeysPreferencePage extends PreferencePage implements
/**
* The resource bundle from which translations can be retrieved.
*/
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
- .getBundle(KeysPreferencePage.class.getName());
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(KeysPreferencePage.class.getName());
/**
* The total number of columns on the view tab.
@@ -258,8 +250,8 @@ public final class KeysPreferencePage extends PreferencePage implements
private static final int TAB_INDEX_MODIFY = 1;
/**
- * The translated names for the columns when they are not the primary sort
- * key (e.g., "Category").
+ * The translated names for the columns when they are not the primary sort key
+ * (e.g., "Category").
*/
private static final String[] UNSORTED_COLUMN_NAMES = new String[VIEW_TOTAL_COLUMNS];
@@ -284,24 +276,21 @@ public final class KeysPreferencePage extends PreferencePage implements
private static final int VIEW_KEY_SEQUENCE_COLUMN_INDEX = 2;
static {
- UNSORTED_COLUMN_NAMES[VIEW_CATEGORY_COLUMN_INDEX] = Util
- .translateString(RESOURCE_BUNDLE, "tableColumnCategory"); //$NON-NLS-1$
- UNSORTED_COLUMN_NAMES[VIEW_COMMAND_COLUMN_INDEX] = Util
- .translateString(RESOURCE_BUNDLE, "tableColumnCommand"); //$NON-NLS-1$
- UNSORTED_COLUMN_NAMES[VIEW_KEY_SEQUENCE_COLUMN_INDEX] = Util
- .translateString(RESOURCE_BUNDLE, "tableColumnKeySequence"); //$NON-NLS-1$
- UNSORTED_COLUMN_NAMES[VIEW_CONTEXT_COLUMN_INDEX] = Util
- .translateString(RESOURCE_BUNDLE, "tableColumnContext"); //$NON-NLS-1$
-
- SORTED_COLUMN_NAMES[VIEW_CATEGORY_COLUMN_INDEX] = Util.translateString(
- RESOURCE_BUNDLE, "tableColumnCategorySorted"); //$NON-NLS-1$
- SORTED_COLUMN_NAMES[VIEW_COMMAND_COLUMN_INDEX] = Util.translateString(
- RESOURCE_BUNDLE, "tableColumnCommandSorted"); //$NON-NLS-1$
- SORTED_COLUMN_NAMES[VIEW_KEY_SEQUENCE_COLUMN_INDEX] = Util
- .translateString(RESOURCE_BUNDLE,
- "tableColumnKeySequenceSorted"); //$NON-NLS-1$
- SORTED_COLUMN_NAMES[VIEW_CONTEXT_COLUMN_INDEX] = Util.translateString(
- RESOURCE_BUNDLE, "tableColumnContextSorted"); //$NON-NLS-1$
+ UNSORTED_COLUMN_NAMES[VIEW_CATEGORY_COLUMN_INDEX] = Util.translateString(RESOURCE_BUNDLE,
+ "tableColumnCategory"); //$NON-NLS-1$
+ UNSORTED_COLUMN_NAMES[VIEW_COMMAND_COLUMN_INDEX] = Util.translateString(RESOURCE_BUNDLE, "tableColumnCommand"); //$NON-NLS-1$
+ UNSORTED_COLUMN_NAMES[VIEW_KEY_SEQUENCE_COLUMN_INDEX] = Util.translateString(RESOURCE_BUNDLE,
+ "tableColumnKeySequence"); //$NON-NLS-1$
+ UNSORTED_COLUMN_NAMES[VIEW_CONTEXT_COLUMN_INDEX] = Util.translateString(RESOURCE_BUNDLE, "tableColumnContext"); //$NON-NLS-1$
+
+ SORTED_COLUMN_NAMES[VIEW_CATEGORY_COLUMN_INDEX] = Util.translateString(RESOURCE_BUNDLE,
+ "tableColumnCategorySorted"); //$NON-NLS-1$
+ SORTED_COLUMN_NAMES[VIEW_COMMAND_COLUMN_INDEX] = Util.translateString(RESOURCE_BUNDLE,
+ "tableColumnCommandSorted"); //$NON-NLS-1$
+ SORTED_COLUMN_NAMES[VIEW_KEY_SEQUENCE_COLUMN_INDEX] = Util.translateString(RESOURCE_BUNDLE,
+ "tableColumnKeySequenceSorted"); //$NON-NLS-1$
+ SORTED_COLUMN_NAMES[VIEW_CONTEXT_COLUMN_INDEX] = Util.translateString(RESOURCE_BUNDLE,
+ "tableColumnContextSorted"); //$NON-NLS-1$
}
/**
@@ -311,15 +300,14 @@ public final class KeysPreferencePage extends PreferencePage implements
private IActivityManager activityManager;
/**
- * The workbench's binding service. This binding service is used to access
- * the current set of bindings, and to persist changes.
+ * The workbench's binding service. This binding service is used to access the
+ * current set of bindings, and to persist changes.
*/
private IBindingService bindingService;
/**
- * The add button located on the bottom left of the preference page. This
- * button adds the current trigger sequence to the currently selected
- * command.
+ * The add button located on the bottom left of the preference page. This button
+ * adds the current trigger sequence to the currently selected command.
*/
private Button buttonAdd;
@@ -330,15 +318,15 @@ public final class KeysPreferencePage extends PreferencePage implements
private Button buttonRemove;
/**
- * The restore button located on the bottom left of the preference page.
- * This button attempts to restore the currently trigger sequence to its
- * initial (i.e., Binding.SYSTEM) state -- undoing all user modifications.
+ * The restore button located on the bottom left of the preference page. This
+ * button attempts to restore the currently trigger sequence to its initial
+ * (i.e., Binding.SYSTEM) state -- undoing all user modifications.
*/
private Button buttonRestore;
/**
- * A map of all the category identifiers indexed by the names that appear in
- * the user interface. This look-up table is built during initialization.
+ * A map of all the category identifiers indexed by the names that appear in the
+ * user interface. This look-up table is built during initialization.
*/
private Map categoryIdsByUniqueName;
@@ -370,34 +358,34 @@ public final class KeysPreferencePage extends PreferencePage implements
private Combo comboScheme;
/**
- * A map of all the command identifiers indexed by the categories to which
- * they belong. This look-up table is built during initialization.
+ * A map of all the command identifiers indexed by the categories to which they
+ * belong. This look-up table is built during initialization.
*/
private Map commandIdsByCategoryId;
/**
* The parameterized commands corresponding to the current contents of
- * <code>comboCommand</code>. The commands in this array are in the same
- * order as in the combo. This value can be <code>null</code> if nothing
- * is selected in the combo.
+ * <code>comboCommand</code>. The commands in this array are in the same order
+ * as in the combo. This value can be <code>null</code> if nothing is selected
+ * in the combo.
*/
private ParameterizedCommand[] commands = null;
/**
- * The workbench's command service. This command service is used to access
- * the list of commands.
+ * The workbench's command service. This command service is used to access the
+ * list of commands.
*/
private ICommandService commandService;
/**
- * A map of all the context identifiers indexed by the names that appear in
- * the user interface. This look-up table is built during initialization.
+ * A map of all the context identifiers indexed by the names that appear in the
+ * user interface. This look-up table is built during initialization.
*/
private Map contextIdsByUniqueName;
/**
- * The workbench's context service. This context service is used to access
- * the list of contexts.
+ * The workbench's context service. This context service is used to access the
+ * list of contexts.
*/
private IContextService contextService;
@@ -408,54 +396,53 @@ public final class KeysPreferencePage extends PreferencePage implements
private Map contextUniqueNamesById;
/**
- * The workbench's help system. This is used to register the page with the
- * help system.
+ * The workbench's help system. This is used to register the page with the help
+ * system.
*
* TODO Add a help context
*/
// private IWorkbenchHelpSystem helpSystem;
/**
* This is the label next to the table showing the bindings matching a
- * particular command. The label is disabled if there isn't a selected
- * command identifier.
+ * particular command. The label is disabled if there isn't a selected command
+ * identifier.
*/
private Label labelBindingsForCommand;
/**
* This is the label next to the table showing the bindings matching a
- * particular trigger sequence. The label is disabled if there isn't a
- * current key sequence.
+ * particular trigger sequence. The label is disabled if there isn't a current
+ * key sequence.
*/
private Label labelBindingsForTriggerSequence;
/**
* The label next to the context combo box. This label indicates whether the
- * context is a child of another context. If the current context is not a
- * child, then this label is blank.
+ * context is a child of another context. If the current context is not a child,
+ * then this label is blank.
*/
private Label labelContextExtends;
/**
* The label next to the scheme combo box. This label indicates whether the
- * scheme is a child of another scheme. If the current scheme is not a
- * child, then this label is blank.
+ * scheme is a child of another scheme. If the current scheme is not a child,
+ * then this label is blank.
*/
private Label labelSchemeExtends;
/**
* A binding manager local to this preference page. When the page is
- * initialized, the current bindings are read out from the binding service
- * and placed in this manager. This manager is then updated as the user
- * makes changes. When the user has finished, the contents of this manager
- * are compared with the contents of the binding service. The changes are
- * then persisted.
+ * initialized, the current bindings are read out from the binding service and
+ * placed in this manager. This manager is then updated as the user makes
+ * changes. When the user has finished, the contents of this manager are
+ * compared with the contents of the binding service. The changes are then
+ * persisted.
*/
- private final BindingManager localChangeManager = new BindingManager(
- new ContextManager(), new CommandManager());
+ private final BindingManager localChangeManager = new BindingManager(new ContextManager(), new CommandManager());
/**
- * A map of all the scheme identifiers indexed by the names that appear in
- * the user interface. This look-up table is built during initialization.
+ * A map of all the scheme identifiers indexed by the names that appear in the
+ * user interface. This look-up table is built during initialization.
*/
private Map schemeIdsByUniqueName;
@@ -466,25 +453,24 @@ public final class KeysPreferencePage extends PreferencePage implements
private Map schemeUniqueNamesById;
/**
- * The sort order to be used on the view tab to display all of the key
- * bindings. This sort order can be changed by the user. This array is never
+ * The sort order to be used on the view tab to display all of the key bindings.
+ * This sort order can be changed by the user. This array is never
* <code>null</code>, but may be empty.
*/
- private int[] sortOrder = { VIEW_CATEGORY_COLUMN_INDEX,
- VIEW_COMMAND_COLUMN_INDEX, VIEW_KEY_SEQUENCE_COLUMN_INDEX,
+ private int[] sortOrder = { VIEW_CATEGORY_COLUMN_INDEX, VIEW_COMMAND_COLUMN_INDEX, VIEW_KEY_SEQUENCE_COLUMN_INDEX,
VIEW_CONTEXT_COLUMN_INDEX };
/**
- * The top-most tab folder for the preference page -- containing a view and
- * a modify tab.
+ * The top-most tab folder for the preference page -- containing a view and a
+ * modify tab.
*/
private TabFolder tabFolder;
/**
- * A table of the key bindings currently defined. This table appears on the
- * view tab; it is intended to be an easy way for users to learn the key
- * bindings in Eclipse. This value is only <code>null</code> until the
- * controls are first created.
+ * A table of the key bindings currently defined. This table appears on the view
+ * tab; it is intended to be an easy way for users to learn the key bindings in
+ * Eclipse. This value is only <code>null</code> until the controls are first
+ * created.
*/
private Table tableBindings;
@@ -507,24 +493,23 @@ public final class KeysPreferencePage extends PreferencePage implements
private Text textTriggerSequence;
/**
- * The manager for the text widget that traps incoming key events. This
- * manager should be used to access the widget, rather than accessing the
- * widget directly.
+ * The manager for the text widget that traps incoming key events. This manager
+ * should be used to access the widget, rather than accessing the widget
+ * directly.
*/
private KeySequenceText textTriggerSequenceManager;
-
@Override
public void applyData(Object data) {
- if(data instanceof Binding) {
+ if (data instanceof Binding) {
editBinding((Binding) data);
}
}
+
@Override
protected Control createContents(final Composite parent) {
- PlatformUI.getWorkbench().getHelpSystem()
- .setHelp(parent, IWorkbenchHelpContextIds.KEYS_PREFERENCE_PAGE);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IWorkbenchHelpContextIds.KEYS_PREFERENCE_PAGE);
tabFolder = new TabFolder(parent, SWT.NULL);
@@ -535,15 +520,13 @@ public final class KeysPreferencePage extends PreferencePage implements
// Modify tab
final TabItem modifyTab = new TabItem(tabFolder, SWT.NULL);
- modifyTab.setText(Util.translateString(RESOURCE_BUNDLE,
- "modifyTab.Text")); //$NON-NLS-1$
+ modifyTab.setText(Util.translateString(RESOURCE_BUNDLE, "modifyTab.Text")); //$NON-NLS-1$
modifyTab.setControl(createModifyTab(tabFolder));
// Do some fancy stuff.
applyDialogFont(tabFolder);
final IPreferenceStore store = getPreferenceStore();
- final int selectedTab = store
- .getInt(IPreferenceConstants.KEYS_PREFERENCE_SELECTED_TAB);
+ final int selectedTab = store.getInt(IPreferenceConstants.KEYS_PREFERENCE_SELECTED_TAB);
if ((tabFolder.getItemCount() > selectedTab) && (selectedTab > 0)) {
tabFolder.setSelection(selectedTab);
}
@@ -554,9 +537,8 @@ public final class KeysPreferencePage extends PreferencePage implements
/**
* Creates the tab that allows the user to change the keyboard shortcuts.
*
- * @param parent
- * The tab folder in which the tab should be created; must not be
- * <code>null</code>.
+ * @param parent The tab folder in which the tab should be created; must not be
+ * <code>null</code>.
* @return The composite which represents the contents of the tab; never
* <code>null</code>.
*/
@@ -565,17 +547,14 @@ public final class KeysPreferencePage extends PreferencePage implements
composite.setLayout(new GridLayout());
GridData gridData = new GridData(GridData.FILL_BOTH);
composite.setLayoutData(gridData);
- final Composite compositeKeyConfiguration = new Composite(composite,
- SWT.NULL);
+ final Composite compositeKeyConfiguration = new Composite(composite, SWT.NULL);
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 3;
compositeKeyConfiguration.setLayout(gridLayout);
gridData = new GridData(GridData.FILL_HORIZONTAL);
compositeKeyConfiguration.setLayoutData(gridData);
- final Label labelKeyConfiguration = new Label(
- compositeKeyConfiguration, SWT.LEFT);
- labelKeyConfiguration.setText(Util.translateString(RESOURCE_BUNDLE,
- "labelScheme")); //$NON-NLS-1$
+ final Label labelKeyConfiguration = new Label(compositeKeyConfiguration, SWT.LEFT);
+ labelKeyConfiguration.setText(Util.translateString(RESOURCE_BUNDLE, "labelScheme")); //$NON-NLS-1$
comboScheme = new Combo(compositeKeyConfiguration, SWT.READ_ONLY);
gridData = new GridData();
gridData.widthHint = 200;
@@ -598,13 +577,11 @@ public final class KeysPreferencePage extends PreferencePage implements
groupCommand.setLayout(gridLayout);
gridData = new GridData(GridData.FILL_BOTH);
groupCommand.setLayoutData(gridData);
- groupCommand.setText(Util.translateString(RESOURCE_BUNDLE,
- "groupCommand")); //$NON-NLS-1$
+ groupCommand.setText(Util.translateString(RESOURCE_BUNDLE, "groupCommand")); //$NON-NLS-1$
final Label labelCategory = new Label(groupCommand, SWT.LEFT);
gridData = new GridData();
labelCategory.setLayoutData(gridData);
- labelCategory.setText(Util.translateString(RESOURCE_BUNDLE,
- "labelCategory")); //$NON-NLS-1$
+ labelCategory.setText(Util.translateString(RESOURCE_BUNDLE, "labelCategory")); //$NON-NLS-1$
comboCategory = new Combo(groupCommand, SWT.READ_ONLY);
gridData = new GridData();
gridData.horizontalSpan = 2;
@@ -617,8 +594,7 @@ public final class KeysPreferencePage extends PreferencePage implements
final Label labelCommand = new Label(groupCommand, SWT.LEFT);
gridData = new GridData();
labelCommand.setLayoutData(gridData);
- labelCommand.setText(Util.translateString(RESOURCE_BUNDLE,
- "labelCommand")); //$NON-NLS-1$
+ labelCommand.setText(Util.translateString(RESOURCE_BUNDLE, "labelCommand")); //$NON-NLS-1$
comboCommand = new Combo(groupCommand, SWT.READ_ONLY);
gridData = new GridData();
gridData.horizontalSpan = 2;
@@ -632,34 +608,28 @@ public final class KeysPreferencePage extends PreferencePage implements
gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
gridData.verticalAlignment = GridData.FILL_VERTICAL;
labelBindingsForCommand.setLayoutData(gridData);
- labelBindingsForCommand.setText(Util.translateString(RESOURCE_BUNDLE,
- "labelAssignmentsForCommand")); //$NON-NLS-1$
- tableBindingsForCommand = new Table(groupCommand, SWT.BORDER
- | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
+ labelBindingsForCommand.setText(Util.translateString(RESOURCE_BUNDLE, "labelAssignmentsForCommand")); //$NON-NLS-1$
+ tableBindingsForCommand = new Table(groupCommand,
+ SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
tableBindingsForCommand.setHeaderVisible(true);
gridData = new GridData(GridData.FILL_BOTH);
gridData.heightHint = 60;
gridData.horizontalSpan = 2;
boolean isMac = org.eclipse.jface.util.Util.isMac();
- gridData.widthHint = isMac ? 620 : 520;
+ gridData.widthHint = isMac ? 620 : 520;
tableBindingsForCommand.setLayoutData(gridData);
- TableColumn tableColumnDelta = new TableColumn(tableBindingsForCommand,
- SWT.NULL, 0);
+ TableColumn tableColumnDelta = new TableColumn(tableBindingsForCommand, SWT.NULL, 0);
tableColumnDelta.setResizable(false);
tableColumnDelta.setText(Util.ZERO_LENGTH_STRING);
tableColumnDelta.setWidth(20);
- TableColumn tableColumnContext = new TableColumn(
- tableBindingsForCommand, SWT.NULL, 1);
+ TableColumn tableColumnContext = new TableColumn(tableBindingsForCommand, SWT.NULL, 1);
tableColumnContext.setResizable(true);
- tableColumnContext.setText(Util.translateString(RESOURCE_BUNDLE,
- "tableColumnContext")); //$NON-NLS-1$
+ tableColumnContext.setText(Util.translateString(RESOURCE_BUNDLE, "tableColumnContext")); //$NON-NLS-1$
tableColumnContext.pack();
tableColumnContext.setWidth(200);
- final TableColumn tableColumnKeySequence = new TableColumn(
- tableBindingsForCommand, SWT.NULL, 2);
+ final TableColumn tableColumnKeySequence = new TableColumn(tableBindingsForCommand, SWT.NULL, 2);
tableColumnKeySequence.setResizable(true);
- tableColumnKeySequence.setText(Util.translateString(RESOURCE_BUNDLE,
- "tableColumnKeySequence")); //$NON-NLS-1$
+ tableColumnKeySequence.setText(Util.translateString(RESOURCE_BUNDLE, "tableColumnKeySequence")); //$NON-NLS-1$
tableColumnKeySequence.pack();
tableColumnKeySequence.setWidth(300);
@@ -671,7 +641,8 @@ public final class KeysPreferencePage extends PreferencePage implements
}
});
- tableBindingsForCommand.addSelectionListener(widgetSelectedAdapter(selectionEvent -> selectedTableBindingsForCommand()));
+ tableBindingsForCommand
+ .addSelectionListener(widgetSelectedAdapter(selectionEvent -> selectedTableBindingsForCommand()));
final Group groupKeySequence = new Group(composite, SWT.SHADOW_NONE);
gridLayout = new GridLayout();
@@ -679,13 +650,11 @@ public final class KeysPreferencePage extends PreferencePage implements
groupKeySequence.setLayout(gridLayout);
gridData = new GridData(GridData.FILL_BOTH);
groupKeySequence.setLayoutData(gridData);
- groupKeySequence.setText(Util.translateString(RESOURCE_BUNDLE,
- "groupKeySequence")); //$NON-NLS-1$
+ groupKeySequence.setText(Util.translateString(RESOURCE_BUNDLE, "groupKeySequence")); //$NON-NLS-1$
final Label labelKeySequence = new Label(groupKeySequence, SWT.LEFT);
gridData = new GridData();
labelKeySequence.setLayoutData(gridData);
- labelKeySequence.setText(Util.translateString(RESOURCE_BUNDLE,
- "labelKeySequence")); //$NON-NLS-1$
+ labelKeySequence.setText(Util.translateString(RESOURCE_BUNDLE, "labelKeySequence")); //$NON-NLS-1$
// The text widget into which the key strokes will be entered.
textTriggerSequence = new Text(groupKeySequence, SWT.BORDER);
@@ -718,10 +687,8 @@ public final class KeysPreferencePage extends PreferencePage implements
textTriggerSequenceManager.setKeyStrokeLimit(4);
// Button for adding trapped key strokes
- final Button buttonAddKey = new Button(groupKeySequence, SWT.LEFT
- | SWT.ARROW);
- buttonAddKey.setToolTipText(Util.translateString(RESOURCE_BUNDLE,
- "buttonAddKey.ToolTipText")); //$NON-NLS-1$
+ final Button buttonAddKey = new Button(groupKeySequence, SWT.LEFT | SWT.ARROW);
+ buttonAddKey.setToolTipText(Util.translateString(RESOURCE_BUNDLE, "buttonAddKey.ToolTipText")); //$NON-NLS-1$
gridData = new GridData();
gridData.heightHint = comboCategory.getTextHeight();
buttonAddKey.setLayoutData(gridData);
@@ -735,8 +702,7 @@ public final class KeysPreferencePage extends PreferencePage implements
newTabStops.add(buttonAddKey);
}
}
- final Control[] newTabStopArray = (Control[]) newTabStops
- .toArray(new Control[newTabStops.size()]);
+ final Control[] newTabStopArray = (Control[]) newTabStops.toArray(new Control[newTabStops.size()]);
groupKeySequence.setTabList(newTabStopArray);
// Construct the menu to attach to the above button.
@@ -764,8 +730,8 @@ public final class KeysPreferencePage extends PreferencePage implements
gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
gridData.verticalAlignment = GridData.FILL_VERTICAL;
labelBindingsForTriggerSequence.setLayoutData(gridData);
- labelBindingsForTriggerSequence.setText(Util.translateString(
- RESOURCE_BUNDLE, "labelAssignmentsForKeySequence")); //$NON-NLS-1$
+ labelBindingsForTriggerSequence
+ .setText(Util.translateString(RESOURCE_BUNDLE, "labelAssignmentsForKeySequence")); //$NON-NLS-1$
tableBindingsForTriggerSequence = new Table(groupKeySequence,
SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
tableBindingsForTriggerSequence.setHeaderVisible(true);
@@ -774,23 +740,18 @@ public final class KeysPreferencePage extends PreferencePage implements
gridData.horizontalSpan = 3;
gridData.widthHint = isMac ? 620 : 520;
tableBindingsForTriggerSequence.setLayoutData(gridData);
- tableColumnDelta = new TableColumn(tableBindingsForTriggerSequence,
- SWT.NULL, 0);
+ tableColumnDelta = new TableColumn(tableBindingsForTriggerSequence, SWT.NULL, 0);
tableColumnDelta.setResizable(false);
tableColumnDelta.setText(Util.ZERO_LENGTH_STRING);
tableColumnDelta.setWidth(20);
- tableColumnContext = new TableColumn(tableBindingsForTriggerSequence,
- SWT.NULL, 1);
+ tableColumnContext = new TableColumn(tableBindingsForTriggerSequence, SWT.NULL, 1);
tableColumnContext.setResizable(true);
- tableColumnContext.setText(Util.translateString(RESOURCE_BUNDLE,
- "tableColumnContext")); //$NON-NLS-1$
+ tableColumnContext.setText(Util.translateString(RESOURCE_BUNDLE, "tableColumnContext")); //$NON-NLS-1$
tableColumnContext.pack();
tableColumnContext.setWidth(200);
- final TableColumn tableColumnCommand = new TableColumn(
- tableBindingsForTriggerSequence, SWT.NULL, 2);
+ final TableColumn tableColumnCommand = new TableColumn(tableBindingsForTriggerSequence, SWT.NULL, 2);
tableColumnCommand.setResizable(true);
- tableColumnCommand.setText(Util.translateString(RESOURCE_BUNDLE,
- "tableColumnCommand")); //$NON-NLS-1$
+ tableColumnCommand.setText(Util.translateString(RESOURCE_BUNDLE, "tableColumnCommand")); //$NON-NLS-1$
tableColumnCommand.pack();
tableColumnCommand.setWidth(300);
@@ -802,8 +763,8 @@ public final class KeysPreferencePage extends PreferencePage implements
}
});
- tableBindingsForTriggerSequence
- .addSelectionListener(widgetSelectedAdapter(selectionEvent -> selectedTableBindingsForTriggerSequence()));
+ tableBindingsForTriggerSequence.addSelectionListener(
+ widgetSelectedAdapter(selectionEvent -> selectedTableBindingsForTriggerSequence()));
final Composite compositeContext = new Composite(composite, SWT.NULL);
gridLayout = new GridLayout();
@@ -812,8 +773,7 @@ public final class KeysPreferencePage extends PreferencePage implements
gridData = new GridData(GridData.FILL_HORIZONTAL);
compositeContext.setLayoutData(gridData);
final Label labelContext = new Label(compositeContext, SWT.LEFT);
- labelContext.setText(Util.translateString(RESOURCE_BUNDLE,
- "labelContext")); //$NON-NLS-1$
+ labelContext.setText(Util.translateString(RESOURCE_BUNDLE, "labelContext")); //$NON-NLS-1$
comboContext = new Combo(compositeContext, SWT.READ_ONLY);
gridData = new GridData();
gridData.widthHint = 250;
@@ -837,8 +797,7 @@ public final class KeysPreferencePage extends PreferencePage implements
gridData = new GridData();
int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
buttonAdd.setText(Util.translateString(RESOURCE_BUNDLE, "buttonAdd")); //$NON-NLS-1$
- gridData.widthHint = Math.max(widthHint, buttonAdd.computeSize(
- SWT.DEFAULT, SWT.DEFAULT, true).x) + 5;
+ gridData.widthHint = Math.max(widthHint, buttonAdd.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x) + 5;
buttonAdd.setLayoutData(gridData);
buttonAdd.addSelectionListener(widgetSelectedAdapter(selectionEvent -> selectedButtonAdd()));
@@ -846,10 +805,8 @@ public final class KeysPreferencePage extends PreferencePage implements
buttonRemove = new Button(compositeButton, SWT.CENTER | SWT.PUSH);
gridData = new GridData();
widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- buttonRemove.setText(Util.translateString(RESOURCE_BUNDLE,
- "buttonRemove")); //$NON-NLS-1$
- gridData.widthHint = Math.max(widthHint, buttonRemove.computeSize(
- SWT.DEFAULT, SWT.DEFAULT, true).x) + 5;
+ buttonRemove.setText(Util.translateString(RESOURCE_BUNDLE, "buttonRemove")); //$NON-NLS-1$
+ gridData.widthHint = Math.max(widthHint, buttonRemove.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x) + 5;
buttonRemove.setLayoutData(gridData);
buttonRemove.addSelectionListener(widgetSelectedAdapter(selectionEvent -> selectedButtonRemove()));
@@ -857,10 +814,8 @@ public final class KeysPreferencePage extends PreferencePage implements
buttonRestore = new Button(compositeButton, SWT.CENTER | SWT.PUSH);
gridData = new GridData();
widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- buttonRestore.setText(Util.translateString(RESOURCE_BUNDLE,
- "buttonRestore")); //$NON-NLS-1$
- gridData.widthHint = Math.max(widthHint, buttonRestore.computeSize(
- SWT.DEFAULT, SWT.DEFAULT, true).x) + 5;
+ buttonRestore.setText(Util.translateString(RESOURCE_BUNDLE, "buttonRestore")); //$NON-NLS-1$
+ gridData.widthHint = Math.max(widthHint, buttonRestore.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x) + 5;
buttonRestore.setLayoutData(gridData);
buttonRestore.addSelectionListener(widgetSelectedAdapter(selectionEvent -> selectedButtonRestore()));
@@ -870,13 +825,12 @@ public final class KeysPreferencePage extends PreferencePage implements
/**
* Creates a tab on the main page for displaying an uneditable list of the
- * current key bindings. This is intended as a discovery tool for new users.
- * It shows all of the key bindings for the current key configuration,
- * platform and locale.
+ * current key bindings. This is intended as a discovery tool for new users. It
+ * shows all of the key bindings for the current key configuration, platform and
+ * locale.
*
- * @param parent
- * The tab folder in which the tab should be created; must not be
- * <code>null</code>.
+ * @param parent The tab folder in which the tab should be created; must not be
+ * <code>null</code>.
* @return The newly created composite containing all of the controls; never
* <code>null</code>.
* @since 3.1
@@ -891,39 +845,25 @@ public final class KeysPreferencePage extends PreferencePage implements
composite.setLayout(new GridLayout());
// Place a table inside the tab.
- tableBindings = new Table(composite, SWT.BORDER | SWT.FULL_SELECTION
- | SWT.H_SCROLL | SWT.V_SCROLL);
+ tableBindings = new Table(composite, SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
tableBindings.setHeaderVisible(true);
gridData = new GridData(GridData.FILL_BOTH);
gridData.heightHint = 400;
gridData.horizontalSpan = 2;
tableBindings.setLayoutData(gridData);
- final TableColumn tableColumnCategory = new TableColumn(tableBindings,
- SWT.NONE, VIEW_CATEGORY_COLUMN_INDEX);
- tableColumnCategory
- .setText(SORTED_COLUMN_NAMES[VIEW_CATEGORY_COLUMN_INDEX]);
- tableColumnCategory
- .addSelectionListener(new SortOrderSelectionListener(
- VIEW_CATEGORY_COLUMN_INDEX));
- final TableColumn tableColumnCommand = new TableColumn(tableBindings,
- SWT.NONE, VIEW_COMMAND_COLUMN_INDEX);
- tableColumnCommand
- .setText(UNSORTED_COLUMN_NAMES[VIEW_COMMAND_COLUMN_INDEX]);
- tableColumnCommand.addSelectionListener(new SortOrderSelectionListener(
- VIEW_COMMAND_COLUMN_INDEX));
- final TableColumn tableColumnKeySequence = new TableColumn(
- tableBindings, SWT.NONE, VIEW_KEY_SEQUENCE_COLUMN_INDEX);
- tableColumnKeySequence
- .setText(UNSORTED_COLUMN_NAMES[VIEW_KEY_SEQUENCE_COLUMN_INDEX]);
- tableColumnKeySequence
- .addSelectionListener(new SortOrderSelectionListener(
- VIEW_KEY_SEQUENCE_COLUMN_INDEX));
- final TableColumn tableColumnContext = new TableColumn(tableBindings,
- SWT.NONE, VIEW_CONTEXT_COLUMN_INDEX);
- tableColumnContext
- .setText(UNSORTED_COLUMN_NAMES[VIEW_CONTEXT_COLUMN_INDEX]);
- tableColumnContext.addSelectionListener(new SortOrderSelectionListener(
- VIEW_CONTEXT_COLUMN_INDEX));
+ final TableColumn tableColumnCategory = new TableColumn(tableBindings, SWT.NONE, VIEW_CATEGORY_COLUMN_INDEX);
+ tableColumnCategory.setText(SORTED_COLUMN_NAMES[VIEW_CATEGORY_COLUMN_INDEX]);
+ tableColumnCategory.addSelectionListener(new SortOrderSelectionListener(VIEW_CATEGORY_COLUMN_INDEX));
+ final TableColumn tableColumnCommand = new TableColumn(tableBindings, SWT.NONE, VIEW_COMMAND_COLUMN_INDEX);
+ tableColumnCommand.setText(UNSORTED_COLUMN_NAMES[VIEW_COMMAND_COLUMN_INDEX]);
+ tableColumnCommand.addSelectionListener(new SortOrderSelectionListener(VIEW_COMMAND_COLUMN_INDEX));
+ final TableColumn tableColumnKeySequence = new TableColumn(tableBindings, SWT.NONE,
+ VIEW_KEY_SEQUENCE_COLUMN_INDEX);
+ tableColumnKeySequence.setText(UNSORTED_COLUMN_NAMES[VIEW_KEY_SEQUENCE_COLUMN_INDEX]);
+ tableColumnKeySequence.addSelectionListener(new SortOrderSelectionListener(VIEW_KEY_SEQUENCE_COLUMN_INDEX));
+ final TableColumn tableColumnContext = new TableColumn(tableBindings, SWT.NONE, VIEW_CONTEXT_COLUMN_INDEX);
+ tableColumnContext.setText(UNSORTED_COLUMN_NAMES[VIEW_CONTEXT_COLUMN_INDEX]);
+ tableColumnContext.addSelectionListener(new SortOrderSelectionListener(VIEW_CONTEXT_COLUMN_INDEX));
tableBindings.addSelectionListener(widgetDefaultSelectedAdapter(e -> selectedTableKeyBindings()));
// A composite for the buttons.
@@ -938,8 +878,7 @@ public final class KeysPreferencePage extends PreferencePage implements
gridData = new GridData();
widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
editButton.setText(Util.translateString(RESOURCE_BUNDLE, "buttonEdit")); //$NON-NLS-1$
- gridData.widthHint = Math.max(widthHint, editButton.computeSize(
- SWT.DEFAULT, SWT.DEFAULT, true).x) + 5;
+ gridData.widthHint = Math.max(widthHint, editButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x) + 5;
editButton.setLayoutData(gridData);
editButton.addSelectionListener(new SelectionListener() {
@@ -958,10 +897,8 @@ public final class KeysPreferencePage extends PreferencePage implements
final Button buttonExport = new Button(buttonBar, SWT.PUSH);
gridData = new GridData();
widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- buttonExport.setText(Util.translateString(RESOURCE_BUNDLE,
- "buttonExport")); //$NON-NLS-1$
- gridData.widthHint = Math.max(widthHint, buttonExport.computeSize(
- SWT.DEFAULT, SWT.DEFAULT, true).x) + 5;
+ buttonExport.setText(Util.translateString(RESOURCE_BUNDLE, "buttonExport")); //$NON-NLS-1$
+ gridData.widthHint = Math.max(widthHint, buttonExport.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x) + 5;
buttonExport.setLayoutData(gridData);
buttonExport.addSelectionListener(new SelectionListener() {
@@ -985,16 +922,15 @@ public final class KeysPreferencePage extends PreferencePage implements
}
/**
- * Allows the user to change the key bindings for a particular command.
- * Switches the tab to the modify tab, and then selects the category and
- * command that corresponds with the given command name. It then selects the
- * given key sequence and gives focus to the key sequence text widget.
+ * Allows the user to change the key bindings for a particular command. Switches
+ * the tab to the modify tab, and then selects the category and command that
+ * corresponds with the given command name. It then selects the given key
+ * sequence and gives focus to the key sequence text widget.
*
- * @param binding
- * The binding to be edited; if <code>null</code>, then just
- * switch to the modify tab. If the <code>binding</code> does
- * not correspond to anything in the keys preference page, then
- * this also just switches to the modify tab.
+ * @param binding The binding to be edited; if <code>null</code>, then just
+ * switch to the modify tab. If the <code>binding</code> does not
+ * correspond to anything in the keys preference page, then this
+ * also just switches to the modify tab.
* @since 3.1
*/
public void editBinding(final Binding binding) {
@@ -1007,9 +943,8 @@ public final class KeysPreferencePage extends PreferencePage implements
}
/*
- * Get the corresponding category and command names. If either is
- * undefined, then we can just stop now. We won't be able to find their
- * name.
+ * Get the corresponding category and command names. If either is undefined,
+ * then we can just stop now. We won't be able to find their name.
*/
final ParameterizedCommand command = binding.getParameterizedCommand();
String categoryName = null;
@@ -1069,8 +1004,7 @@ public final class KeysPreferencePage extends PreferencePage implements
int k = 0;
for (; k < items.length; k++) {
final String currentKeySequence = items[k].getText(2);
- if (binding.getTriggerSequence().format()
- .equals(currentKeySequence)) {
+ if (binding.getTriggerSequence().format().equals(currentKeySequence)) {
break;
}
}
@@ -1087,9 +1021,8 @@ public final class KeysPreferencePage extends PreferencePage implements
* @return The selected category; <code>null</code> if none.
*/
private String getCategoryId() {
- return !commandIdsByCategoryId.containsKey(null)
- || comboCategory.getSelectionIndex() > 0 ? (String) categoryIdsByUniqueName
- .get(comboCategory.getText())
+ return !commandIdsByCategoryId.containsKey(null) || comboCategory.getSelectionIndex() > 0
+ ? (String) categoryIdsByUniqueName.get(comboCategory.getText())
: null;
}
@@ -1099,8 +1032,7 @@ public final class KeysPreferencePage extends PreferencePage implements
* @return The selected context; <code>null</code> if none.
*/
private String getContextId() {
- return comboContext.getSelectionIndex() >= 0 ? (String) contextIdsByUniqueName
- .get(comboContext.getText())
+ return comboContext.getSelectionIndex() >= 0 ? (String) contextIdsByUniqueName.get(comboContext.getText())
: null;
}
@@ -1116,13 +1048,11 @@ public final class KeysPreferencePage extends PreferencePage implements
/**
* Returns the currently-selected fully-parameterized command.
*
- * @return The selected fully-parameterized command; <code>null</code> if
- * none.
+ * @return The selected fully-parameterized command; <code>null</code> if none.
*/
private ParameterizedCommand getParameterizedCommand() {
final int selectionIndex = comboCommand.getSelectionIndex();
- if ((selectionIndex >= 0) && (commands != null)
- && (selectionIndex < commands.length)) {
+ if ((selectionIndex >= 0) && (commands != null) && (selectionIndex < commands.length)) {
return commands[selectionIndex];
}
@@ -1135,9 +1065,7 @@ public final class KeysPreferencePage extends PreferencePage implements
* @return The selected scheme; <code>null</code> if none.
*/
private String getSchemeId() {
- return comboScheme.getSelectionIndex() >= 0 ? (String) schemeIdsByUniqueName
- .get(comboScheme.getText())
- : null;
+ return comboScheme.getSelectionIndex() >= 0 ? (String) schemeIdsByUniqueName.get(comboScheme.getText()) : null;
}
@Override
@@ -1150,12 +1078,11 @@ public final class KeysPreferencePage extends PreferencePage implements
/**
* Checks whether the activity manager knows anything about this command
- * identifier. If the activity manager is currently filtering this command,
- * then it does not appear in the user interface.
+ * identifier. If the activity manager is currently filtering this command, then
+ * it does not appear in the user interface.
*
- * @param command
- * The command which should be checked against the activities;
- * must not be <code>null</code>.
+ * @param command The command which should be checked against the activities;
+ * must not be <code>null</code>.
* @return <code>true</code> if the command identifier is not filtered;
* <code>false</code> if it is
*/
@@ -1168,18 +1095,15 @@ public final class KeysPreferencePage extends PreferencePage implements
* went wrong. The exception is assumed to have something to do with the
* preference store.
*
- * @param exception
- * The exception to be logged; must not be <code>null</code>.
+ * @param exception The exception to be logged; must not be <code>null</code>.
*/
private void logPreferenceStoreException(final Throwable exception) {
- final String message = Util.translateString(RESOURCE_BUNDLE,
- "PreferenceStoreError.Message"); //$NON-NLS-1$
+ final String message = Util.translateString(RESOURCE_BUNDLE, "PreferenceStoreError.Message"); //$NON-NLS-1$
String exceptionMessage = exception.getMessage();
if (exceptionMessage == null) {
exceptionMessage = message;
}
- final IStatus status = new Status(IStatus.ERROR,
- WorkbenchPlugin.PI_WORKBENCH, 0, exceptionMessage, exception);
+ final IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 0, exceptionMessage, exception);
WorkbenchPlugin.log(message, status);
StatusUtil.handleStatus(message, exception, StatusManager.SHOW);
}
@@ -1195,18 +1119,14 @@ public final class KeysPreferencePage extends PreferencePage implements
@Override
protected void performDefaults() {
// Ask the user to confirm
- final String title = Util.translateString(RESOURCE_BUNDLE,
- "restoreDefaultsMessageBoxText"); //$NON-NLS-1$
- final String message = Util.translateString(RESOURCE_BUNDLE,
- "restoreDefaultsMessageBoxMessage"); //$NON-NLS-1$
- final boolean confirmed = MessageDialog.open(MessageDialog.CONFIRM,
- getShell(), title, message, SWT.SHEET);
+ final String title = Util.translateString(RESOURCE_BUNDLE, "restoreDefaultsMessageBoxText"); //$NON-NLS-1$
+ final String message = Util.translateString(RESOURCE_BUNDLE, "restoreDefaultsMessageBoxMessage"); //$NON-NLS-1$
+ final boolean confirmed = MessageDialog.open(MessageDialog.CONFIRM, getShell(), title, message, SWT.SHEET);
if (confirmed) {
// Fix the scheme in the local changes.
final String defaultSchemeId = bindingService.getDefaultSchemeId();
- final Scheme defaultScheme = localChangeManager
- .getScheme(defaultSchemeId);
+ final Scheme defaultScheme = localChangeManager.getScheme(defaultSchemeId);
try {
localChangeManager.setActiveScheme(defaultScheme);
} catch (final NotDefinedException e) {
@@ -1229,8 +1149,7 @@ public final class KeysPreferencePage extends PreferencePage implements
// Apply the changes.
try {
- bindingService.savePreferences(defaultScheme,
- trimmedBindingArray);
+ bindingService.savePreferences(defaultScheme, trimmedBindingArray);
} catch (final IOException e) {
logPreferenceStoreException(e);
}
@@ -1245,9 +1164,7 @@ public final class KeysPreferencePage extends PreferencePage implements
public boolean performOk() {
// Save the preferences.
try {
- bindingService.savePreferences(
- localChangeManager.getActiveScheme(), localChangeManager
- .getBindings());
+ bindingService.savePreferences(localChangeManager.getActiveScheme(), localChangeManager.getBindings());
} catch (final IOException e) {
logPreferenceStoreException(e);
}
@@ -1259,46 +1176,40 @@ public final class KeysPreferencePage extends PreferencePage implements
}
/**
- * Remembers the currently selected tab for when the preference page next
- * opens.
+ * Remembers the currently selected tab for when the preference page next opens.
*/
private void persistSelectedTab() {
final IPreferenceStore store = getPreferenceStore();
- store.setValue(IPreferenceConstants.KEYS_PREFERENCE_SELECTED_TAB,
- tabFolder.getSelectionIndex());
+ store.setValue(IPreferenceConstants.KEYS_PREFERENCE_SELECTED_TAB, tabFolder.getSelectionIndex());
}
/**
- * Handles the selection event on the add button. This removes all
- * user-defined bindings matching the given key sequence, scheme and
- * context. It then adds a new binding with the current selections.
+ * Handles the selection event on the add button. This removes all user-defined
+ * bindings matching the given key sequence, scheme and context. It then adds a
+ * new binding with the current selections.
*/
private void selectedButtonAdd() {
final ParameterizedCommand command = getParameterizedCommand();
final String contextId = getContextId();
final String schemeId = getSchemeId();
final KeySequence keySequence = getKeySequence();
- localChangeManager.removeBindings(keySequence, schemeId, contextId,
- null, null, null, Binding.USER);
- localChangeManager.addBinding(new KeyBinding(keySequence, command,
- schemeId, contextId, null, null, null, Binding.USER));
+ localChangeManager.removeBindings(keySequence, schemeId, contextId, null, null, null, Binding.USER);
+ localChangeManager
+ .addBinding(new KeyBinding(keySequence, command, schemeId, contextId, null, null, null, Binding.USER));
update(true);
}
/**
* Provides a facility for exporting the viewable list of key bindings to a
- * file. Currently, this only supports exporting to a list of
- * comma-separated values. The user is prompted for which file should
- * receive our bounty.
+ * file. Currently, this only supports exporting to a list of comma-separated
+ * values. The user is prompted for which file should receive our bounty.
*
* @since 3.1
*/
private void selectedButtonExport() {
- final FileDialog fileDialog = new FileDialog(getShell(), SWT.SAVE
- | SWT.SHEET);
+ final FileDialog fileDialog = new FileDialog(getShell(), SWT.SAVE | SWT.SHEET);
fileDialog.setFilterExtensions(new String[] { "*.csv" }); //$NON-NLS-1$
- fileDialog.setFilterNames(new String[] { Util.translateString(
- RESOURCE_BUNDLE, "csvFilterName") }); //$NON-NLS-1$
+ fileDialog.setFilterNames(new String[] { Util.translateString(RESOURCE_BUNDLE, "csvFilterName") }); //$NON-NLS-1$
final String filePath = fileDialog.open();
if (filePath == null) {
return;
@@ -1316,7 +1227,7 @@ public final class KeysPreferencePage extends PreferencePage implements
for (int j = 0; j < numColumns; j++) {
String buf = Util.replaceAll(item.getText(j), "\"", //$NON-NLS-1$
"\"\""); //$NON-NLS-1$
- fileWriter.write("\"" + buf + "\""); //$NON-NLS-1$//$NON-NLS-2$
+ fileWriter.write("\"" + buf + "\""); //$NON-NLS-1$//$NON-NLS-2$
if (j < numColumns - 1) {
fileWriter.write(',');
}
@@ -1341,32 +1252,28 @@ public final class KeysPreferencePage extends PreferencePage implements
/**
* Handles the selection event on the remove button. This removes all
- * user-defined bindings matching the given key sequence, scheme and
- * context. It then adds a new deletion binding for the selected trigger
- * sequence.
+ * user-defined bindings matching the given key sequence, scheme and context. It
+ * then adds a new deletion binding for the selected trigger sequence.
*/
private void selectedButtonRemove() {
final String contextId = getContextId();
final String schemeId = getSchemeId();
final KeySequence keySequence = getKeySequence();
- localChangeManager.removeBindings(keySequence, schemeId, contextId,
- null, null, null, Binding.USER);
- localChangeManager.addBinding(new KeyBinding(keySequence, null,
- schemeId, contextId, null, null, null, Binding.USER));
+ localChangeManager.removeBindings(keySequence, schemeId, contextId, null, null, null, Binding.USER);
+ localChangeManager
+ .addBinding(new KeyBinding(keySequence, null, schemeId, contextId, null, null, null, Binding.USER));
update(true);
}
/**
* Handles the selection event on the restore button. This removes all
- * user-defined bindings matching the given key sequence, scheme and
- * context.
+ * user-defined bindings matching the given key sequence, scheme and context.
*/
private void selectedButtonRestore() {
String contextId = getContextId();
String schemeId = getSchemeId();
KeySequence keySequence = getKeySequence();
- localChangeManager.removeBindings(keySequence, schemeId, contextId,
- null, null, null, Binding.USER);
+ localChangeManager.removeBindings(keySequence, schemeId, contextId, null, null, null, Binding.USER);
update(true);
}
@@ -1375,8 +1282,7 @@ public final class KeysPreferencePage extends PreferencePage implements
*/
private void selectedComboScheme() {
final String activeSchemeId = getSchemeId();
- final Scheme activeScheme = localChangeManager
- .getScheme(activeSchemeId);
+ final Scheme activeScheme = localChangeManager.getScheme(activeSchemeId);
try {
localChangeManager.setActiveScheme(activeScheme);
} catch (final NotDefinedException e) {
@@ -1387,13 +1293,12 @@ public final class KeysPreferencePage extends PreferencePage implements
/**
* Handles the selection event on the table containing the bindings for a
- * particular command. This updates the context and trigger sequence based
- * on the selected binding.
+ * particular command. This updates the context and trigger sequence based on
+ * the selected binding.
*/
private void selectedTableBindingsForCommand() {
final int selection = tableBindingsForCommand.getSelectionIndex();
- if ((selection >= 0)
- && (selection < tableBindingsForCommand.getItemCount())) {
+ if ((selection >= 0) && (selection < tableBindingsForCommand.getItemCount())) {
final TableItem item = tableBindingsForCommand.getItem(selection);
final KeyBinding binding = (KeyBinding) item.getData(ITEM_DATA_KEY);
setContextId(binding.getContextId());
@@ -1405,16 +1310,13 @@ public final class KeysPreferencePage extends PreferencePage implements
/**
* Handles the selection event on the table containing the bindings for a
- * particular trigger sequence. This updates the context based on the
- * selected binding.
+ * particular trigger sequence. This updates the context based on the selected
+ * binding.
*/
private void selectedTableBindingsForTriggerSequence() {
- final int selection = tableBindingsForTriggerSequence
- .getSelectionIndex();
- if ((selection >= 0)
- && (selection < tableBindingsForTriggerSequence.getItemCount())) {
- final TableItem item = tableBindingsForTriggerSequence
- .getItem(selection);
+ final int selection = tableBindingsForTriggerSequence.getSelectionIndex();
+ if ((selection >= 0) && (selection < tableBindingsForTriggerSequence.getItemCount())) {
+ final TableItem item = tableBindingsForTriggerSequence.getItem(selection);
final Binding binding = (Binding) item.getData(ITEM_DATA_KEY);
setContextId(binding.getContextId());
}
@@ -1424,8 +1326,8 @@ public final class KeysPreferencePage extends PreferencePage implements
/**
* Responds to some kind of trigger on the View tab by taking the current
- * selection on the key bindings table and selecting the appropriate items
- * in the Modify tab.
+ * selection on the key bindings table and selecting the appropriate items in
+ * the Modify tab.
*
* @since 3.1
*/
@@ -1443,13 +1345,12 @@ public final class KeysPreferencePage extends PreferencePage implements
/**
* Changes the selected context name in the context combo box. The context
- * selected is either the one matching the identifier provided (if
- * possible), or the default context identifier. If no matching name can be
- * found in the combo, then the first item is selected.
+ * selected is either the one matching the identifier provided (if possible), or
+ * the default context identifier. If no matching name can be found in the
+ * combo, then the first item is selected.
*
- * @param contextId
- * The context identifier for the context to be selected in the
- * combo box; may be <code>null</code>.
+ * @param contextId The context identifier for the context to be selected in the
+ * combo box; may be <code>null</code>.
*/
private void setContextId(final String contextId) {
// Clear the current selection.
@@ -1459,8 +1360,7 @@ public final class KeysPreferencePage extends PreferencePage implements
// Figure out which name to look for.
String contextName = (String) contextUniqueNamesById.get(contextId);
if (contextName == null) {
- contextName = (String) contextUniqueNamesById
- .get(IContextIds.CONTEXT_ID_WINDOW);
+ contextName = (String) contextUniqueNamesById.get(IContextIds.CONTEXT_ID_WINDOW);
}
if (contextName == null) {
contextName = Util.ZERO_LENGTH_STRING;
@@ -1486,8 +1386,7 @@ public final class KeysPreferencePage extends PreferencePage implements
/**
* Sets the current trigger sequence.
*
- * @param keySequence
- * The trigger sequence; may be <code>null</code>.
+ * @param keySequence The trigger sequence; may be <code>null</code>.
*/
private void setKeySequence(final KeySequence keySequence) {
textTriggerSequenceManager.setKeySequence(keySequence);
@@ -1496,26 +1395,22 @@ public final class KeysPreferencePage extends PreferencePage implements
/**
* Changes the selection in the command combo box.
*
- * @param command
- * The fully-parameterized command to select; may be
- * <code>null</code>.
+ * @param command The fully-parameterized command to select; may be
+ * <code>null</code>.
*/
- private void setParameterizedCommand(
- final ParameterizedCommand command) {
+ private void setParameterizedCommand(final ParameterizedCommand command) {
int i = 0;
if (commands != null) {
final int commandCount = commands.length;
for (; i < commandCount; i++) {
if (commands[i].equals(command)) {
- if ((comboCommand.getSelectionIndex() != i)
- && (i < comboCommand.getItemCount())) {
+ if ((comboCommand.getSelectionIndex() != i) && (i < comboCommand.getItemCount())) {
comboCommand.select(i);
}
break;
}
}
- if ((i >= comboCommand.getItemCount())
- && (comboCommand.getSelectionIndex() != 0)) {
+ if ((i >= comboCommand.getItemCount()) && (comboCommand.getSelectionIndex() != 0)) {
comboCommand.select(0);
}
}
@@ -1524,14 +1419,12 @@ public final class KeysPreferencePage extends PreferencePage implements
/**
* Sets the currently selected scheme
*
- * @param scheme
- * The scheme to select; may be <code>null</code>.
+ * @param scheme The scheme to select; may be <code>null</code>.
*/
private void setScheme(final Scheme scheme) {
comboScheme.clearSelection();
comboScheme.deselectAll();
- final String schemeUniqueName = (String) schemeUniqueNamesById
- .get(scheme.getId());
+ final String schemeUniqueName = (String) schemeUniqueNamesById.get(scheme.getId());
if (schemeUniqueName != null) {
final String items[] = comboScheme.getItems();
@@ -1554,10 +1447,8 @@ public final class KeysPreferencePage extends PreferencePage implements
if (visible == true) {
Map contextsByName = new HashMap();
- for (Iterator iterator = contextService.getDefinedContextIds()
- .iterator(); iterator.hasNext();) {
- Context context = contextService.getContext((String) iterator
- .next());
+ for (Iterator iterator = contextService.getDefinedContextIds().iterator(); iterator.hasNext();) {
+ Context context = contextService.getContext((String) iterator.next());
try {
String name = context.getName();
Collection contexts = (Collection) contextsByName.get(name);
@@ -1575,10 +1466,8 @@ public final class KeysPreferencePage extends PreferencePage implements
Map commandsByName = new HashMap();
- for (Iterator iterator = commandService.getDefinedCommandIds()
- .iterator(); iterator.hasNext();) {
- Command command = commandService.getCommand((String) iterator
- .next());
+ for (Iterator iterator = commandService.getDefinedCommandIds().iterator(); iterator.hasNext();) {
+ Command command = commandService.getCommand((String) iterator.next());
if (!isActive(command)) {
continue;
}
@@ -1601,18 +1490,15 @@ public final class KeysPreferencePage extends PreferencePage implements
// moved here to allow us to remove any empty categories
commandIdsByCategoryId = new HashMap();
- for (Iterator iterator = commandService.getDefinedCommandIds()
- .iterator(); iterator.hasNext();) {
- final Command command = commandService
- .getCommand((String) iterator.next());
+ for (Iterator iterator = commandService.getDefinedCommandIds().iterator(); iterator.hasNext();) {
+ final Command command = commandService.getCommand((String) iterator.next());
if (!isActive(command)) {
continue;
}
try {
String categoryId = command.getCategory().getId();
- Collection commandIds = (Collection) commandIdsByCategoryId
- .get(categoryId);
+ Collection commandIds = (Collection) commandIdsByCategoryId.get(categoryId);
if (commandIds == null) {
commandIds = new HashSet();
@@ -1627,16 +1513,13 @@ public final class KeysPreferencePage extends PreferencePage implements
Map categoriesByName = new HashMap();
- for (Iterator iterator = commandService.getDefinedCategoryIds()
- .iterator(); iterator.hasNext();) {
- Category category = commandService
- .getCategory((String) iterator.next());
+ for (Iterator iterator = commandService.getDefinedCategoryIds().iterator(); iterator.hasNext();) {
+ Category category = commandService.getCategory((String) iterator.next());
try {
if (commandIdsByCategoryId.containsKey(category.getId())) {
String name = category.getName();
- Collection categories = (Collection) categoriesByName
- .get(name);
+ Collection categories = (Collection) categoriesByName.get(name);
if (categories == null) {
categories = new HashSet();
@@ -1672,8 +1555,7 @@ public final class KeysPreferencePage extends PreferencePage implements
contextIdsByUniqueName = new HashMap();
contextUniqueNamesById = new HashMap();
- for (Iterator iterator = contextsByName.entrySet().iterator(); iterator
- .hasNext();) {
+ for (Iterator iterator = contextsByName.entrySet().iterator(); iterator.hasNext();) {
Map.Entry entry = (Map.Entry) iterator.next();
String name = (String) entry.getKey();
Set contexts = (Set) entry.getValue();
@@ -1686,8 +1568,7 @@ public final class KeysPreferencePage extends PreferencePage implements
} else {
while (iterator2.hasNext()) {
Context context = (Context) iterator2.next();
- String uniqueName = MessageFormat.format(
- Util.translateString(RESOURCE_BUNDLE, "uniqueName"), //$NON-NLS-1$
+ String uniqueName = MessageFormat.format(Util.translateString(RESOURCE_BUNDLE, "uniqueName"), //$NON-NLS-1$
name, context.getId());
contextIdsByUniqueName.put(uniqueName, context.getId());
contextUniqueNamesById.put(context.getId(), uniqueName);
@@ -1698,8 +1579,7 @@ public final class KeysPreferencePage extends PreferencePage implements
categoryIdsByUniqueName = new HashMap();
categoryUniqueNamesById = new HashMap();
- for (Iterator iterator = categoriesByName.entrySet().iterator(); iterator
- .hasNext();) {
+ for (Iterator iterator = categoriesByName.entrySet().iterator(); iterator.hasNext();) {
Map.Entry entry = (Map.Entry) iterator.next();
String name = (String) entry.getKey();
Set categories = (Set) entry.getValue();
@@ -1712,14 +1592,10 @@ public final class KeysPreferencePage extends PreferencePage implements
} else {
while (iterator2.hasNext()) {
Category category = (Category) iterator2.next();
- String uniqueName = MessageFormat.format(
- Util.translateString(RESOURCE_BUNDLE,
- "uniqueName"), new Object[] { name, //$NON-NLS-1$
- category.getId() });
- categoryIdsByUniqueName.put(uniqueName, category
- .getId());
- categoryUniqueNamesById.put(category.getId(),
- uniqueName);
+ String uniqueName = MessageFormat.format(Util.translateString(RESOURCE_BUNDLE, "uniqueName"), //$NON-NLS-1$
+ new Object[] { name, category.getId() });
+ categoryIdsByUniqueName.put(uniqueName, category.getId());
+ categoryUniqueNamesById.put(category.getId(), uniqueName);
}
}
}
@@ -1727,8 +1603,7 @@ public final class KeysPreferencePage extends PreferencePage implements
schemeIdsByUniqueName = new HashMap();
schemeUniqueNamesById = new HashMap();
- for (Iterator iterator = schemesByName.entrySet().iterator(); iterator
- .hasNext();) {
+ for (Iterator iterator = schemesByName.entrySet().iterator(); iterator.hasNext();) {
Map.Entry entry = (Map.Entry) iterator.next();
String name = (String) entry.getKey();
Set keyConfigurations = (Set) entry.getValue();
@@ -1741,10 +1616,8 @@ public final class KeysPreferencePage extends PreferencePage implements
} else {
while (iterator2.hasNext()) {
Scheme scheme = (Scheme) iterator2.next();
- String uniqueName = MessageFormat.format(
- Util.translateString(RESOURCE_BUNDLE,
- "uniqueName"), new Object[] { name, //$NON-NLS-1$
- scheme.getId() });
+ String uniqueName = MessageFormat.format(Util.translateString(RESOURCE_BUNDLE, "uniqueName"), //$NON-NLS-1$
+ new Object[] { name, scheme.getId() });
schemeIdsByUniqueName.put(uniqueName, scheme.getId());
schemeUniqueNamesById.put(scheme.getId(), uniqueName);
}
@@ -1756,16 +1629,12 @@ public final class KeysPreferencePage extends PreferencePage implements
// Make an internal copy of the binding manager, for local changes.
try {
for (final Scheme scheme : definedSchemes) {
- final Scheme copy = localChangeManager.getScheme(scheme
- .getId());
- copy.define(scheme.getName(), scheme.getDescription(),
- scheme.getParentId());
+ final Scheme copy = localChangeManager.getScheme(scheme.getId());
+ copy.define(scheme.getName(), scheme.getDescription(), scheme.getParentId());
}
- localChangeManager.setActiveScheme(bindingService
- .getActiveScheme());
+ localChangeManager.setActiveScheme(bindingService.getActiveScheme());
} catch (final NotDefinedException e) {
- throw new Error(
- "There is a programmer error in the keys preference page"); //$NON-NLS-1$
+ throw new Error("There is a programmer error in the keys preference page"); //$NON-NLS-1$
}
localChangeManager.setLocale(bindingService.getLocale());
localChangeManager.setPlatform(bindingService.getPlatform());
@@ -1775,23 +1644,19 @@ public final class KeysPreferencePage extends PreferencePage implements
List categoryNames = new ArrayList(categoryIdsByUniqueName.keySet());
Collections.sort(categoryNames, Collator.getInstance());
if (commandIdsByCategoryId.containsKey(null)) {
- categoryNames.add(0, Util.translateString(RESOURCE_BUNDLE,
- "other")); //$NON-NLS-1$
+ categoryNames.add(0, Util.translateString(RESOURCE_BUNDLE, "other")); //$NON-NLS-1$
}
- comboCategory.setItems((String[]) categoryNames
- .toArray(new String[categoryNames.size()]));
+ comboCategory.setItems((String[]) categoryNames.toArray(new String[categoryNames.size()]));
comboCategory.clearSelection();
comboCategory.deselectAll();
- if (commandIdsByCategoryId.containsKey(null)
- || !categoryNames.isEmpty()) {
+ if (commandIdsByCategoryId.containsKey(null) || !categoryNames.isEmpty()) {
comboCategory.select(0);
}
// Populate the scheme combo box.
List schemeNames = new ArrayList(schemeIdsByUniqueName.keySet());
Collections.sort(schemeNames, Collator.getInstance());
- comboScheme.setItems((String[]) schemeNames
- .toArray(new String[schemeNames.size()]));
+ comboScheme.setItems((String[]) schemeNames.toArray(new String[schemeNames.size()]));
setScheme(activeScheme);
// Update the entire page.
@@ -1802,26 +1667,24 @@ public final class KeysPreferencePage extends PreferencePage implements
}
/**
- * Updates the entire preference page -- except the view tab -- based on
- * current selection sate. This preference page is written so that
- * everything can be made consistent simply by inspecting the state of its
- * widgets. A change is triggered by the user, and an event is fired. The
- * event triggers an update. It is possible for extra work to be done by
- * this page before calling update.
+ * Updates the entire preference page -- except the view tab -- based on current
+ * selection sate. This preference page is written so that everything can be
+ * made consistent simply by inspecting the state of its widgets. A change is
+ * triggered by the user, and an event is fired. The event triggers an update.
+ * It is possible for extra work to be done by this page before calling update.
*/
private void update() {
update(false);
}
/**
- * Updates the entire preference page based on current changes. This
- * preference page is written so that everything can be made consistent
- * simply by inspecting the state of its widgets. A change is triggered by
- * the user, and an event is fired. The event triggers an update. It is
- * possible for extra work to be done by this page before calling update.
+ * Updates the entire preference page based on current changes. This preference
+ * page is written so that everything can be made consistent simply by
+ * inspecting the state of its widgets. A change is triggered by the user, and
+ * an event is fired. The event triggers an update. It is possible for extra
+ * work to be done by this page before calling update.
*
- * @param updateViewTab
- * Whether the view tab should be updated as well.
+ * @param updateViewTab Whether the view tab should be updated as well.
*/
private void update(final boolean updateViewTab) {
if (updateViewTab) {
@@ -1834,8 +1697,7 @@ public final class KeysPreferencePage extends PreferencePage implements
final ParameterizedCommand command = getParameterizedCommand();
updateTableBindingsForCommand(command);
final String contextId = getContextId();
- updateSelection(tableBindingsForTriggerSequence, contextId,
- triggerSequence);
+ updateSelection(tableBindingsForTriggerSequence, contextId, triggerSequence);
updateSelection(tableBindingsForCommand, contextId, triggerSequence);
updateLabelSchemeExtends();
updateLabelContextExtends();
@@ -1853,24 +1715,21 @@ public final class KeysPreferencePage extends PreferencePage implements
// Figure out where command identifiers apply to the selected category.
final String categoryId = getCategoryId();
Set commandIds = (Set) commandIdsByCategoryId.get(categoryId);
- if (commandIds==null) {
+ if (commandIds == null) {
commandIds = Collections.EMPTY_SET;
}
/*
- * Generate an array of parameterized commands based on these
- * identifiers. The parameterized commands will be sorted based on their
- * names.
+ * Generate an array of parameterized commands based on these identifiers. The
+ * parameterized commands will be sorted based on their names.
*/
List commands = new ArrayList();
final Iterator commandIdItr = commandIds.iterator();
while (commandIdItr.hasNext()) {
final String currentCommandId = (String) commandIdItr.next();
- final Command currentCommand = commandService
- .getCommand(currentCommandId);
+ final Command currentCommand = commandService.getCommand(currentCommandId);
try {
- commands.addAll(ParameterizedCommand
- .generateCombinations(currentCommand));
+ commands.addAll(ParameterizedCommand.generateCombinations(currentCommand));
} catch (final NotDefinedException e) {
// It is safe to just ignore undefined commands.
}
@@ -1881,28 +1740,25 @@ public final class KeysPreferencePage extends PreferencePage implements
commands = sortParameterizedCommands(commands);
final int commandCount = commands.size();
- this.commands = (ParameterizedCommand[]) commands
- .toArray(new ParameterizedCommand[commandCount]);
+ this.commands = (ParameterizedCommand[]) commands.toArray(new ParameterizedCommand[commandCount]);
/*
- * Generate an array of command names based on this array of
- * parameterized commands.
+ * Generate an array of command names based on this array of parameterized
+ * commands.
*/
final String[] commandNames = new String[commandCount];
for (int i = 0; i < commandCount; i++) {
try {
commandNames[i] = this.commands[i].getName();
} catch (final NotDefinedException e) {
- throw new Error(
- "Concurrent modification of the command's defined state"); //$NON-NLS-1$
+ throw new Error("Concurrent modification of the command's defined state"); //$NON-NLS-1$
}
}
/*
- * Copy the command names into the combo box, but only if they've
- * changed. We do this to try to avoid unnecessary calls out to the
- * operating system, as well as to defend against bugs in SWT's event
- * mechanism.
+ * Copy the command names into the combo box, but only if they've changed. We do
+ * this to try to avoid unnecessary calls out to the operating system, as well
+ * as to defend against bugs in SWT's event mechanism.
*/
final String[] currentItems = comboCommand.getItems();
if (!Arrays.equals(currentItems, commandNames)) {
@@ -1913,9 +1769,8 @@ public final class KeysPreferencePage extends PreferencePage implements
setParameterizedCommand(command);
/*
- * Just to be extra careful, make sure that we have a selection at this
- * point. This line could probably be removed, but it makes the code a
- * bit more robust.
+ * Just to be extra careful, make sure that we have a selection at this point.
+ * This line could probably be removed, but it makes the code a bit more robust.
*/
if ((comboCommand.getSelectionIndex() == -1) && (commandCount > 0)) {
comboCommand.select(0);
@@ -1924,6 +1779,7 @@ public final class KeysPreferencePage extends PreferencePage implements
/**
* Sort the commands using the correct language.
+ *
* @param commands the List of ParameterizedCommands
* @return The sorted List
*/
@@ -1968,8 +1824,7 @@ public final class KeysPreferencePage extends PreferencePage implements
final List contextNames = new ArrayList(contextIdsByName.keySet());
Collections.sort(contextNames, Collator.getInstance());
- comboContext.setItems((String[]) contextNames
- .toArray(new String[contextNames.size()]));
+ comboContext.setItems((String[]) contextNames.toArray(new String[contextNames.size()]));
setContextId(contextId);
if (comboContext.getSelectionIndex() == -1 && !contextNames.isEmpty()) {
@@ -1978,19 +1833,15 @@ public final class KeysPreferencePage extends PreferencePage implements
}
/**
- * Updates the enabled state of the various widgets on this page. The
- * decision is based on the current trigger sequence and the currently
- * selected command.
+ * Updates the enabled state of the various widgets on this page. The decision
+ * is based on the current trigger sequence and the currently selected command.
*
- * @param triggerSequence
- * The current trigger sequence; may be empty, but never
- * <code>null</code>.
- * @param command
- * The currently selected command, if any; <code>null</code>
- * otherwise.
- */
- private void updateEnabled(final TriggerSequence triggerSequence,
- final ParameterizedCommand command) {
+ * @param triggerSequence The current trigger sequence; may be empty, but never
+ * <code>null</code>.
+ * @param command The currently selected command, if any;
+ * <code>null</code> otherwise.
+ */
+ private void updateEnabled(final TriggerSequence triggerSequence, final ParameterizedCommand command) {
final boolean commandSelected = command != null;
labelBindingsForCommand.setEnabled(commandSelected);
tableBindingsForCommand.setEnabled(commandSelected);
@@ -2002,17 +1853,16 @@ public final class KeysPreferencePage extends PreferencePage implements
/*
* TODO Do some better button enablement.
*/
- final boolean buttonsEnabled = commandSelected
- && triggerSequenceSelected;
+ final boolean buttonsEnabled = commandSelected && triggerSequenceSelected;
buttonAdd.setEnabled(buttonsEnabled);
buttonRemove.setEnabled(buttonsEnabled);
buttonRestore.setEnabled(buttonsEnabled);
}
/**
- * Updates the label next to the context that says "extends" if the context
- * is a child of another context. If the context is not a child of another
- * context, then the label is simply blank.
+ * Updates the label next to the context that says "extends" if the context is a
+ * child of another context. If the context is not a child of another context,
+ * then the label is simply blank.
*/
private void updateLabelContextExtends() {
final String contextId = getContextId();
@@ -2023,12 +1873,11 @@ public final class KeysPreferencePage extends PreferencePage implements
try {
final String parentId = context.getParentId();
if (parentId != null) {
- final String name = (String) contextUniqueNamesById
- .get(parentId);
+ final String name = (String) contextUniqueNamesById.get(parentId);
if (name != null) {
- labelContextExtends.setText(MessageFormat.format(
- Util.translateString(RESOURCE_BUNDLE, "extends"), //$NON-NLS-1$
- name));
+ labelContextExtends
+ .setText(MessageFormat.format(Util.translateString(RESOURCE_BUNDLE, "extends"), //$NON-NLS-1$
+ name));
return;
}
}
@@ -2042,9 +1891,9 @@ public final class KeysPreferencePage extends PreferencePage implements
}
/**
- * Updates the label next to the scheme that says "extends" if the scheme is
- * a child of another scheme. If the scheme is not a child of another
- * scheme, then the label is simply blank.
+ * Updates the label next to the scheme that says "extends" if the scheme is a
+ * child of another scheme. If the scheme is not a child of another scheme, then
+ * the label is simply blank.
*/
private void updateLabelSchemeExtends() {
final String schemeId = getSchemeId();
@@ -2052,11 +1901,9 @@ public final class KeysPreferencePage extends PreferencePage implements
if (schemeId != null) {
final Scheme scheme = bindingService.getScheme(schemeId);
try {
- final String name = (String) schemeUniqueNamesById.get(scheme
- .getParentId());
+ final String name = (String) schemeUniqueNamesById.get(scheme.getParentId());
if (name != null) {
- labelSchemeExtends.setText(MessageFormat.format(Util
- .translateString(RESOURCE_BUNDLE, "extends"), //$NON-NLS-1$
+ labelSchemeExtends.setText(MessageFormat.format(Util.translateString(RESOURCE_BUNDLE, "extends"), //$NON-NLS-1$
name));
return;
}
@@ -2069,22 +1916,19 @@ public final class KeysPreferencePage extends PreferencePage implements
}
/**
- * Tries to select the correct entry in table based on the currently
- * selected context and trigger sequence. If the table hasn't really
- * changed, then this method is essentially trying to restore the selection.
- * If it has changed, then it is trying to select the most entry based on
- * the context.
+ * Tries to select the correct entry in table based on the currently selected
+ * context and trigger sequence. If the table hasn't really changed, then this
+ * method is essentially trying to restore the selection. If it has changed,
+ * then it is trying to select the most entry based on the context.
*
- * @param table
- * The table to be changed; must not be <code>null</code>.
- * @param contextId
- * The currently selected context; should not be
- * <code>null</code>.
- * @param triggerSequence
- * The current trigger sequence; should not be <code>null</code>.
- */
- private void updateSelection(final Table table,
- final String contextId, final TriggerSequence triggerSequence) {
+ * @param table The table to be changed; must not be
+ * <code>null</code>.
+ * @param contextId The currently selected context; should not be
+ * <code>null</code>.
+ * @param triggerSequence The current trigger sequence; should not be
+ * <code>null</code>.
+ */
+ private void updateSelection(final Table table, final String contextId, final TriggerSequence triggerSequence) {
if (table.getSelectionCount() > 1) {
table.deselectAll();
}
@@ -2094,8 +1938,7 @@ public final class KeysPreferencePage extends PreferencePage implements
for (int i = 0; i < items.length; i++) {
final Binding binding = (Binding) items[i].getData(ITEM_DATA_KEY);
if ((Util.equals(contextId, binding.getContextId()))
- && (Util.equals(triggerSequence, binding
- .getTriggerSequence()))) {
+ && (Util.equals(triggerSequence, binding.getTriggerSequence()))) {
selection = i;
break;
}
@@ -2110,33 +1953,28 @@ public final class KeysPreferencePage extends PreferencePage implements
* Updates the contents of the table showing the bindings for the currently
* selected command. The selection is destroyed by this process.
*
- * @param parameterizedCommand
- * The currently selected fully-parameterized command; may be
- * <code>null</code>.
+ * @param parameterizedCommand The currently selected fully-parameterized
+ * command; may be <code>null</code>.
*/
- private void updateTableBindingsForCommand(
- final ParameterizedCommand parameterizedCommand) {
+ private void updateTableBindingsForCommand(final ParameterizedCommand parameterizedCommand) {
// Clear the table of existing items.
tableBindingsForCommand.removeAll();
// Add each of the bindings, if the command identifier matches.
- final Collection bindings = localChangeManager
- .getActiveBindingsDisregardingContextFlat();
+ final Collection bindings = localChangeManager.getActiveBindingsDisregardingContextFlat();
final Iterator bindingItr = bindings.iterator();
while (bindingItr.hasNext()) {
final Binding binding = (Binding) bindingItr.next();
- if (!Util.equals(parameterizedCommand, binding
- .getParameterizedCommand())) {
+ if (!Util.equals(parameterizedCommand, binding.getParameterizedCommand())) {
continue; // binding does not match
}
- final TableItem tableItem = new TableItem(tableBindingsForCommand,
- SWT.NULL);
+ final TableItem tableItem = new TableItem(tableBindingsForCommand, SWT.NULL);
tableItem.setData(ITEM_DATA_KEY, binding);
/*
- * Set the associated image based on the type of binding. Either it
- * is a user binding or a system binding.
+ * Set the associated image based on the type of binding. Either it is a user
+ * binding or a system binding.
*
* TODO Identify more image types.
*/
@@ -2146,8 +1984,7 @@ public final class KeysPreferencePage extends PreferencePage implements
tableItem.setImage(0, IMAGE_CHANGE);
}
- String contextName = (String) contextUniqueNamesById.get(binding
- .getContextId());
+ String contextName = (String) contextUniqueNamesById.get(binding.getContextId());
if (contextName == null) {
contextName = Util.ZERO_LENGTH_STRING;
}
@@ -2160,20 +1997,16 @@ public final class KeysPreferencePage extends PreferencePage implements
* Updates the contents of the table showing the bindings for the current
* trigger sequence. The selection is destroyed by this process.
*
- * @param triggerSequence
- * The current trigger sequence; may be <code>null</code> or
- * empty.
+ * @param triggerSequence The current trigger sequence; may be <code>null</code>
+ * or empty.
*/
- private void updateTableBindingsForTriggerSequence(
- final TriggerSequence triggerSequence) {
+ private void updateTableBindingsForTriggerSequence(final TriggerSequence triggerSequence) {
// Clear the table of its existing items.
tableBindingsForTriggerSequence.removeAll();
// Get the collection of bindings for the current command.
- final Map activeBindings = localChangeManager
- .getActiveBindingsDisregardingContext();
- final Collection bindings = (Collection) activeBindings
- .get(triggerSequence);
+ final Map activeBindings = localChangeManager.getActiveBindingsDisregardingContext();
+ final Collection bindings = (Collection) activeBindings.get(triggerSequence);
if (bindings == null) {
return;
}
@@ -2182,22 +2015,19 @@ public final class KeysPreferencePage extends PreferencePage implements
final Iterator bindingItr = bindings.iterator();
while (bindingItr.hasNext()) {
final Binding binding = (Binding) bindingItr.next();
- final Context context = contextService.getContext(binding
- .getContextId());
- final ParameterizedCommand parameterizedCommand = binding
- .getParameterizedCommand();
+ final Context context = contextService.getContext(binding.getContextId());
+ final ParameterizedCommand parameterizedCommand = binding.getParameterizedCommand();
final Command command = parameterizedCommand.getCommand();
if ((!context.isDefined()) && (!command.isDefined())) {
continue;
}
- final TableItem tableItem = new TableItem(
- tableBindingsForTriggerSequence, SWT.NULL);
+ final TableItem tableItem = new TableItem(tableBindingsForTriggerSequence, SWT.NULL);
tableItem.setData(ITEM_DATA_KEY, binding);
/*
- * Set the associated image based on the type of binding. Either it
- * is a user binding or a system binding.
+ * Set the associated image based on the type of binding. Either it is a user
+ * binding or a system binding.
*
* TODO Identify more image types.
*/
@@ -2218,9 +2048,9 @@ public final class KeysPreferencePage extends PreferencePage implements
}
/**
- * Updates the contents of the view tab. This queries the command manager
- * for a list of key sequence binding definitions, and these definitions are
- * then added to the table.
+ * Updates the contents of the view tab. This queries the command manager for a
+ * list of key sequence binding definitions, and these definitions are then
+ * added to the table.
*
* @since 3.1
*/
@@ -2229,21 +2059,18 @@ public final class KeysPreferencePage extends PreferencePage implements
tableBindings.removeAll();
// Get a sorted list of key binding contents.
- final List bindings = new ArrayList(localChangeManager
- .getActiveBindingsDisregardingContextFlat());
+ final List bindings = new ArrayList(localChangeManager.getActiveBindingsDisregardingContextFlat());
Collections.sort(bindings, new Comparator() {
/**
- * Compares two instances of <code>Binding</code> based on the
- * current sort order.
+ * Compares two instances of <code>Binding</code> based on the current sort
+ * order.
*
- * @param object1
- * The first object to compare; must be an instance of
- * <code>Binding</code> (i.e., not <code>null</code>).
- * @param object2
- * The second object to compare; must be an instance of
- * <code>Binding</code> (i.e., not <code>null</code>).
- * @return The integer value representing the comparison. The
- * comparison is based on the current sort order.
+ * @param object1 The first object to compare; must be an instance of
+ * <code>Binding</code> (i.e., not <code>null</code>).
+ * @param object2 The second object to compare; must be an instance of
+ * <code>Binding</code> (i.e., not <code>null</code>).
+ * @return The integer value representing the comparison. The comparison is
+ * based on the current sort order.
* @since 3.1
*/
@Override
@@ -2252,11 +2079,10 @@ public final class KeysPreferencePage extends PreferencePage implements
final Binding binding2 = (Binding) object2;
/*
- * Get the category name, command name, formatted key sequence
- * and context name for the first binding.
+ * Get the category name, command name, formatted key sequence and context name
+ * for the first binding.
*/
- final Command command1 = binding1.getParameterizedCommand()
- .getCommand();
+ final Command command1 = binding1.getParameterizedCommand().getCommand();
String categoryName1 = Util.ZERO_LENGTH_STRING;
String commandName1 = Util.ZERO_LENGTH_STRING;
try {
@@ -2265,13 +2091,11 @@ public final class KeysPreferencePage extends PreferencePage implements
} catch (final NotDefinedException e) {
// Just use the zero-length string.
}
- final String triggerSequence1 = binding1.getTriggerSequence()
- .format();
+ final String triggerSequence1 = binding1.getTriggerSequence().format();
final String contextId1 = binding1.getContextId();
String contextName1 = Util.ZERO_LENGTH_STRING;
if (contextId1 != null) {
- final Context context = contextService
- .getContext(contextId1);
+ final Context context = contextService.getContext(contextId1);
try {
contextName1 = context.getName();
} catch (final org.eclipse.core.commands.common.NotDefinedException e) {
@@ -2280,11 +2104,10 @@ public final class KeysPreferencePage extends PreferencePage implements
}
/*
- * Get the category name, command name, formatted key sequence
- * and context name for the first binding.
+ * Get the category name, command name, formatted key sequence and context name
+ * for the first binding.
*/
- final Command command2 = binding2.getParameterizedCommand()
- .getCommand();
+ final Command command2 = binding2.getParameterizedCommand().getCommand();
String categoryName2 = Util.ZERO_LENGTH_STRING;
String commandName2 = Util.ZERO_LENGTH_STRING;
try {
@@ -2293,13 +2116,11 @@ public final class KeysPreferencePage extends PreferencePage implements
} catch (final org.eclipse.core.commands.common.NotDefinedException e) {
// Just use the zero-length string.
}
- final String keySequence2 = binding2.getTriggerSequence()
- .format();
+ final String keySequence2 = binding2.getTriggerSequence().format();
final String contextId2 = binding2.getContextId();
String contextName2 = Util.ZERO_LENGTH_STRING;
if (contextId2 != null) {
- final Context context = contextService
- .getContext(contextId2);
+ final Context context = contextService.getContext(contextId2);
try {
contextName2 = context.getName();
} catch (final org.eclipse.core.commands.common.NotDefinedException e) {
@@ -2359,8 +2180,7 @@ public final class KeysPreferencePage extends PreferencePage implements
final Binding binding = (Binding) keyBindingItr.next();
// Get the command and category name.
- final ParameterizedCommand command = binding
- .getParameterizedCommand();
+ final ParameterizedCommand command = binding.getParameterizedCommand();
String commandName = Util.ZERO_LENGTH_STRING;
String categoryName = Util.ZERO_LENGTH_STRING;
try {
@@ -2391,8 +2211,7 @@ public final class KeysPreferencePage extends PreferencePage implements
final TableItem item = new TableItem(tableBindings, SWT.NONE);
item.setText(VIEW_CATEGORY_COLUMN_INDEX, categoryName);
item.setText(VIEW_COMMAND_COLUMN_INDEX, commandName);
- item.setText(VIEW_KEY_SEQUENCE_COLUMN_INDEX, binding
- .getTriggerSequence().format());
+ item.setText(VIEW_KEY_SEQUENCE_COLUMN_INDEX, binding.getTriggerSequence().format());
item.setText(VIEW_CONTEXT_COLUMN_INDEX, contextName);
item.setData(BINDING_KEY, binding);
}
@@ -2403,5 +2222,4 @@ public final class KeysPreferencePage extends PreferencePage implements
}
}
-
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/LegacySchemeListenerWrapper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/LegacySchemeListenerWrapper.java
index aaf740757dd..2b8fef57a35 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/LegacySchemeListenerWrapper.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/LegacySchemeListenerWrapper.java
@@ -38,21 +38,18 @@ final class LegacySchemeListenerWrapper implements ISchemeListener {
private final IKeyConfigurationListener listener;
/**
- * Constructs a new instance of <code>SchemeListenerWrapper</code> with
- * the given listener.
+ * Constructs a new instance of <code>SchemeListenerWrapper</code> with the
+ * given listener.
*
- * @param listener
- * The listener to be wrapped; must mot be <code>null</code>.
+ * @param listener The listener to be wrapped; must mot be <code>null</code>.
*/
- LegacySchemeListenerWrapper(final IKeyConfigurationListener listener,
- final BindingManager bindingManager) {
+ LegacySchemeListenerWrapper(final IKeyConfigurationListener listener, final BindingManager bindingManager) {
if (listener == null) {
throw new NullPointerException("Cannot wrap a null listener"); //$NON-NLS-1$
}
if (bindingManager == null) {
- throw new NullPointerException(
- "Cannot wrap a listener without a binding manager"); //$NON-NLS-1$
+ throw new NullPointerException("Cannot wrap a listener without a binding manager"); //$NON-NLS-1$
}
this.listener = listener;
@@ -81,14 +78,12 @@ final class LegacySchemeListenerWrapper implements ISchemeListener {
@Override
public void schemeChanged(final SchemeEvent schemeEvent) {
- final IKeyConfiguration keyConfiguration = new SchemeLegacyWrapper(
- schemeEvent.getScheme(), bindingManager);
+ final IKeyConfiguration keyConfiguration = new SchemeLegacyWrapper(schemeEvent.getScheme(), bindingManager);
final boolean definedChanged = schemeEvent.isDefinedChanged();
final boolean nameChanged = schemeEvent.isNameChanged();
final boolean parentIdChanged = schemeEvent.isParentIdChanged();
- listener.keyConfigurationChanged(new KeyConfigurationEvent(
- keyConfiguration, false, definedChanged, nameChanged,
- parentIdChanged));
+ listener.keyConfigurationChanged(
+ new KeyConfigurationEvent(keyConfiguration, false, definedChanged, nameChanged, parentIdChanged));
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/MacKeyFormatter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/MacKeyFormatter.java
index 7c5b11c443d..55fd814e221 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/MacKeyFormatter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/MacKeyFormatter.java
@@ -27,82 +27,75 @@ import org.eclipse.ui.keys.SpecialKey;
public final class MacKeyFormatter extends AbstractKeyFormatter {
- private static final class MacModifierKeyComparator extends
- AbstractModifierKeyComparator {
+ private static final class MacModifierKeyComparator extends AbstractModifierKeyComparator {
- @Override
+ @Override
protected int rank(ModifierKey modifierKey) {
- if (ModifierKey.SHIFT.equals(modifierKey)) {
- return 0;
- }
-
- if (ModifierKey.CTRL.equals(modifierKey)) {
- return 1;
- }
-
- if (ModifierKey.ALT.equals(modifierKey)) {
- return 2;
- }
-
- if (ModifierKey.COMMAND.equals(modifierKey)) {
- return 3;
- }
-
- return Integer.MAX_VALUE;
- }
- }
-
- private static final HashMap KEY_LOOKUP = new HashMap();
-
- private static final Comparator MODIFIER_KEY_COMPARATOR = new MacModifierKeyComparator();
-
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
- .getBundle(MacKeyFormatter.class.getName());
-
- static {
- KEY_LOOKUP
- .put(CharacterKey.BS.toString(), "\u232B"); //$NON-NLS-1$
- KEY_LOOKUP
- .put(CharacterKey.CR.toString(), "\u21A9"); //$NON-NLS-1$
- KEY_LOOKUP.put(CharacterKey.DEL.toString(), "\u2326"); //$NON-NLS-1$
- KEY_LOOKUP.put(CharacterKey.SPACE.toString(), "\u2423"); //$NON-NLS-1$
- KEY_LOOKUP
- .put(ModifierKey.ALT.toString(), "\u2325"); //$NON-NLS-1$
- KEY_LOOKUP.put(ModifierKey.COMMAND.toString(), "\u2318"); //$NON-NLS-1$
- KEY_LOOKUP.put(ModifierKey.CTRL.toString(), "\u2303"); //$NON-NLS-1$
- KEY_LOOKUP.put(ModifierKey.SHIFT.toString(), "\u21E7"); //$NON-NLS-1$
- KEY_LOOKUP.put(SpecialKey.ARROW_DOWN.toString(), "\u2193"); //$NON-NLS-1$
- KEY_LOOKUP.put(SpecialKey.ARROW_LEFT.toString(), "\u2190"); //$NON-NLS-1$
- KEY_LOOKUP.put(SpecialKey.ARROW_RIGHT.toString(), "\u2192"); //$NON-NLS-1$
- KEY_LOOKUP.put(SpecialKey.ARROW_UP.toString(), "\u2191"); //$NON-NLS-1$
- KEY_LOOKUP.put(SpecialKey.END.toString(), "\u2198"); //$NON-NLS-1$
- KEY_LOOKUP.put(SpecialKey.NUMPAD_ENTER.toString(), "\u2324"); //$NON-NLS-1$
- KEY_LOOKUP
- .put(SpecialKey.HOME.toString(), "\u2196"); //$NON-NLS-1$
- KEY_LOOKUP.put(SpecialKey.PAGE_DOWN.toString(), "\u21DF"); //$NON-NLS-1$
- KEY_LOOKUP.put(SpecialKey.PAGE_UP.toString(), "\u21DE"); //$NON-NLS-1$
- }
-
- @Override
+ if (ModifierKey.SHIFT.equals(modifierKey)) {
+ return 0;
+ }
+
+ if (ModifierKey.CTRL.equals(modifierKey)) {
+ return 1;
+ }
+
+ if (ModifierKey.ALT.equals(modifierKey)) {
+ return 2;
+ }
+
+ if (ModifierKey.COMMAND.equals(modifierKey)) {
+ return 3;
+ }
+
+ return Integer.MAX_VALUE;
+ }
+ }
+
+ private static final HashMap KEY_LOOKUP = new HashMap();
+
+ private static final Comparator MODIFIER_KEY_COMPARATOR = new MacModifierKeyComparator();
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(MacKeyFormatter.class.getName());
+
+ static {
+ KEY_LOOKUP.put(CharacterKey.BS.toString(), "\u232B"); //$NON-NLS-1$
+ KEY_LOOKUP.put(CharacterKey.CR.toString(), "\u21A9"); //$NON-NLS-1$
+ KEY_LOOKUP.put(CharacterKey.DEL.toString(), "\u2326"); //$NON-NLS-1$
+ KEY_LOOKUP.put(CharacterKey.SPACE.toString(), "\u2423"); //$NON-NLS-1$
+ KEY_LOOKUP.put(ModifierKey.ALT.toString(), "\u2325"); //$NON-NLS-1$
+ KEY_LOOKUP.put(ModifierKey.COMMAND.toString(), "\u2318"); //$NON-NLS-1$
+ KEY_LOOKUP.put(ModifierKey.CTRL.toString(), "\u2303"); //$NON-NLS-1$
+ KEY_LOOKUP.put(ModifierKey.SHIFT.toString(), "\u21E7"); //$NON-NLS-1$
+ KEY_LOOKUP.put(SpecialKey.ARROW_DOWN.toString(), "\u2193"); //$NON-NLS-1$
+ KEY_LOOKUP.put(SpecialKey.ARROW_LEFT.toString(), "\u2190"); //$NON-NLS-1$
+ KEY_LOOKUP.put(SpecialKey.ARROW_RIGHT.toString(), "\u2192"); //$NON-NLS-1$
+ KEY_LOOKUP.put(SpecialKey.ARROW_UP.toString(), "\u2191"); //$NON-NLS-1$
+ KEY_LOOKUP.put(SpecialKey.END.toString(), "\u2198"); //$NON-NLS-1$
+ KEY_LOOKUP.put(SpecialKey.NUMPAD_ENTER.toString(), "\u2324"); //$NON-NLS-1$
+ KEY_LOOKUP.put(SpecialKey.HOME.toString(), "\u2196"); //$NON-NLS-1$
+ KEY_LOOKUP.put(SpecialKey.PAGE_DOWN.toString(), "\u21DF"); //$NON-NLS-1$
+ KEY_LOOKUP.put(SpecialKey.PAGE_UP.toString(), "\u21DE"); //$NON-NLS-1$
+ }
+
+ @Override
public String format(Key key) {
- String string = (String) KEY_LOOKUP.get(key.toString());
- return string != null ? string : super.format(key);
- }
+ String string = (String) KEY_LOOKUP.get(key.toString());
+ return string != null ? string : super.format(key);
+ }
- @Override
+ @Override
protected String getKeyDelimiter() {
- return Util.translateString(RESOURCE_BUNDLE, KEY_DELIMITER_KEY,
- Util.ZERO_LENGTH_STRING, false, false);
- }
+ return Util.translateString(RESOURCE_BUNDLE, KEY_DELIMITER_KEY, Util.ZERO_LENGTH_STRING, false, false);
+ }
- @Override
+ @Override
protected String getKeyStrokeDelimiter() {
- return Util.translateString(RESOURCE_BUNDLE, KEY_STROKE_DELIMITER_KEY,
- KeySequence.KEY_STROKE_DELIMITER, false, false);
- }
+ return Util.translateString(RESOURCE_BUNDLE, KEY_STROKE_DELIMITER_KEY, KeySequence.KEY_STROKE_DELIMITER, false,
+ false);
+ }
- @Override
+ @Override
protected Comparator getModifierKeyComparator() {
- return MODIFIER_KEY_COMPARATOR;
- }
+ return MODIFIER_KEY_COMPARATOR;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/NativeKeyFormatter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/NativeKeyFormatter.java
index 9c83eb65016..00d03e93097 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/NativeKeyFormatter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/NativeKeyFormatter.java
@@ -34,107 +34,103 @@ import org.eclipse.ui.keys.SpecialKey;
*/
public class NativeKeyFormatter extends AbstractKeyFormatter {
- /**
- * The key into the internationalization resource bundle for the delimiter
- * to use between keys (on the Carbon platform).
- */
- private static final String CARBON_KEY_DELIMITER_KEY = "CARBON_KEY_DELIMITER"; //$NON-NLS-1$
-
- /**
- * A look-up table for the string representations of various carbon keys.
- */
- private static final HashMap CARBON_KEY_LOOK_UP = new HashMap();
-
- /**
- * A comparator to sort modifier keys in the order that they would be
- * displayed to a user. This comparator is platform-specific.
- */
- private static final Comparator MODIFIER_KEY_COMPARATOR = new NativeModifierKeyComparator();
-
- /**
- * The resource bundle used by <code>format()</code> to translate formal
- * string representations by locale.
- */
- private static final ResourceBundle RESOURCE_BUNDLE;
-
- /**
- * The key into the internationalization resource bundle for the delimiter
- * to use between key strokes (on the Win32 platform).
- */
- private static final String WIN32_KEY_STROKE_DELIMITER_KEY = "WIN32_KEY_STROKE_DELIMITER"; //$NON-NLS-1$
-
- static {
- RESOURCE_BUNDLE = ResourceBundle.getBundle(NativeKeyFormatter.class
- .getName());
-
- CARBON_KEY_LOOK_UP.put(CharacterKey.BS.toString(), "\u232B"); //$NON-NLS-1$
- CARBON_KEY_LOOK_UP.put(CharacterKey.CR.toString(), "\u21A9"); //$NON-NLS-1$
- CARBON_KEY_LOOK_UP.put(CharacterKey.DEL.toString(), "\u2326"); //$NON-NLS-1$
- CARBON_KEY_LOOK_UP.put(CharacterKey.SPACE.toString(), "\u2423"); //$NON-NLS-1$
- CARBON_KEY_LOOK_UP.put(ModifierKey.ALT.toString(), "\u2325"); //$NON-NLS-1$
- CARBON_KEY_LOOK_UP.put(ModifierKey.COMMAND.toString(), "\u2318"); //$NON-NLS-1$
- CARBON_KEY_LOOK_UP.put(ModifierKey.CTRL.toString(), "\u2303"); //$NON-NLS-1$
- CARBON_KEY_LOOK_UP.put(ModifierKey.SHIFT.toString(), "\u21E7"); //$NON-NLS-1$
- CARBON_KEY_LOOK_UP.put(SpecialKey.ARROW_DOWN.toString(), "\u2193"); //$NON-NLS-1$
- CARBON_KEY_LOOK_UP.put(SpecialKey.ARROW_LEFT.toString(), "\u2190"); //$NON-NLS-1$
- CARBON_KEY_LOOK_UP.put(SpecialKey.ARROW_RIGHT.toString(), "\u2192"); //$NON-NLS-1$
- CARBON_KEY_LOOK_UP.put(SpecialKey.ARROW_UP.toString(), "\u2191"); //$NON-NLS-1$
- CARBON_KEY_LOOK_UP.put(SpecialKey.END.toString(), "\u2198"); //$NON-NLS-1$
- CARBON_KEY_LOOK_UP.put(SpecialKey.NUMPAD_ENTER.toString(), "\u2324"); //$NON-NLS-1$
- CARBON_KEY_LOOK_UP.put(SpecialKey.HOME.toString(), "\u2196"); //$NON-NLS-1$
- CARBON_KEY_LOOK_UP.put(SpecialKey.PAGE_DOWN.toString(), "\u21DF"); //$NON-NLS-1$
- CARBON_KEY_LOOK_UP.put(SpecialKey.PAGE_UP.toString(), "\u21DE"); //$NON-NLS-1$
- }
-
- /**
- * Formats an individual key into a human readable format. This uses an
- * internationalization resource bundle to look up the key. This does the
- * platform-specific formatting for Carbon.
- *
- * @param key
- * The key to format; must not be <code>null</code>.
- * @return The key formatted as a string; should not be <code>null</code>.
- */
- @Override
+ /**
+ * The key into the internationalization resource bundle for the delimiter to
+ * use between keys (on the Carbon platform).
+ */
+ private static final String CARBON_KEY_DELIMITER_KEY = "CARBON_KEY_DELIMITER"; //$NON-NLS-1$
+
+ /**
+ * A look-up table for the string representations of various carbon keys.
+ */
+ private static final HashMap CARBON_KEY_LOOK_UP = new HashMap();
+
+ /**
+ * A comparator to sort modifier keys in the order that they would be displayed
+ * to a user. This comparator is platform-specific.
+ */
+ private static final Comparator MODIFIER_KEY_COMPARATOR = new NativeModifierKeyComparator();
+
+ /**
+ * The resource bundle used by <code>format()</code> to translate formal string
+ * representations by locale.
+ */
+ private static final ResourceBundle RESOURCE_BUNDLE;
+
+ /**
+ * The key into the internationalization resource bundle for the delimiter to
+ * use between key strokes (on the Win32 platform).
+ */
+ private static final String WIN32_KEY_STROKE_DELIMITER_KEY = "WIN32_KEY_STROKE_DELIMITER"; //$NON-NLS-1$
+
+ static {
+ RESOURCE_BUNDLE = ResourceBundle.getBundle(NativeKeyFormatter.class.getName());
+
+ CARBON_KEY_LOOK_UP.put(CharacterKey.BS.toString(), "\u232B"); //$NON-NLS-1$
+ CARBON_KEY_LOOK_UP.put(CharacterKey.CR.toString(), "\u21A9"); //$NON-NLS-1$
+ CARBON_KEY_LOOK_UP.put(CharacterKey.DEL.toString(), "\u2326"); //$NON-NLS-1$
+ CARBON_KEY_LOOK_UP.put(CharacterKey.SPACE.toString(), "\u2423"); //$NON-NLS-1$
+ CARBON_KEY_LOOK_UP.put(ModifierKey.ALT.toString(), "\u2325"); //$NON-NLS-1$
+ CARBON_KEY_LOOK_UP.put(ModifierKey.COMMAND.toString(), "\u2318"); //$NON-NLS-1$
+ CARBON_KEY_LOOK_UP.put(ModifierKey.CTRL.toString(), "\u2303"); //$NON-NLS-1$
+ CARBON_KEY_LOOK_UP.put(ModifierKey.SHIFT.toString(), "\u21E7"); //$NON-NLS-1$
+ CARBON_KEY_LOOK_UP.put(SpecialKey.ARROW_DOWN.toString(), "\u2193"); //$NON-NLS-1$
+ CARBON_KEY_LOOK_UP.put(SpecialKey.ARROW_LEFT.toString(), "\u2190"); //$NON-NLS-1$
+ CARBON_KEY_LOOK_UP.put(SpecialKey.ARROW_RIGHT.toString(), "\u2192"); //$NON-NLS-1$
+ CARBON_KEY_LOOK_UP.put(SpecialKey.ARROW_UP.toString(), "\u2191"); //$NON-NLS-1$
+ CARBON_KEY_LOOK_UP.put(SpecialKey.END.toString(), "\u2198"); //$NON-NLS-1$
+ CARBON_KEY_LOOK_UP.put(SpecialKey.NUMPAD_ENTER.toString(), "\u2324"); //$NON-NLS-1$
+ CARBON_KEY_LOOK_UP.put(SpecialKey.HOME.toString(), "\u2196"); //$NON-NLS-1$
+ CARBON_KEY_LOOK_UP.put(SpecialKey.PAGE_DOWN.toString(), "\u21DF"); //$NON-NLS-1$
+ CARBON_KEY_LOOK_UP.put(SpecialKey.PAGE_UP.toString(), "\u21DE"); //$NON-NLS-1$
+ }
+
+ /**
+ * Formats an individual key into a human readable format. This uses an
+ * internationalization resource bundle to look up the key. This does the
+ * platform-specific formatting for Carbon.
+ *
+ * @param key The key to format; must not be <code>null</code>.
+ * @return The key formatted as a string; should not be <code>null</code>.
+ */
+ @Override
public String format(Key key) {
- String name = key.toString();
+ String name = key.toString();
- // TODO consider platform-specific resource bundles
- if (org.eclipse.jface.util.Util.isMac()) {
- String formattedName = (String) CARBON_KEY_LOOK_UP.get(name);
- if (formattedName != null) {
- return formattedName;
- }
- }
+ // TODO consider platform-specific resource bundles
+ if (org.eclipse.jface.util.Util.isMac()) {
+ String formattedName = (String) CARBON_KEY_LOOK_UP.get(name);
+ if (formattedName != null) {
+ return formattedName;
+ }
+ }
- return super.format(key);
- }
+ return super.format(key);
+ }
- @Override
+ @Override
protected String getKeyDelimiter() {
- // We must do the look up every time, as our locale might change.
- if (org.eclipse.jface.util.Util.isMac()) {
- return Util.translateString(RESOURCE_BUNDLE,
- CARBON_KEY_DELIMITER_KEY, Util.ZERO_LENGTH_STRING, false,
- false);
- }
+ // We must do the look up every time, as our locale might change.
+ if (org.eclipse.jface.util.Util.isMac()) {
+ return Util.translateString(RESOURCE_BUNDLE, CARBON_KEY_DELIMITER_KEY, Util.ZERO_LENGTH_STRING, false,
+ false);
+ }
return Util.translateString(RESOURCE_BUNDLE, KEY_DELIMITER_KEY, KeyStroke.KEY_DELIMITER, false, false);
- }
+ }
- @Override
+ @Override
protected String getKeyStrokeDelimiter() {
- // We must do the look up every time, as our locale might change.
- if (org.eclipse.jface.util.Util.isWindows()) {
- return Util.translateString(RESOURCE_BUNDLE,
- WIN32_KEY_STROKE_DELIMITER_KEY,
- KeySequence.KEY_STROKE_DELIMITER, false, false);
- }
+ // We must do the look up every time, as our locale might change.
+ if (org.eclipse.jface.util.Util.isWindows()) {
+ return Util.translateString(RESOURCE_BUNDLE, WIN32_KEY_STROKE_DELIMITER_KEY,
+ KeySequence.KEY_STROKE_DELIMITER, false, false);
+ }
return Util.translateString(RESOURCE_BUNDLE, KEY_STROKE_DELIMITER_KEY, KeySequence.KEY_STROKE_DELIMITER, false,
false);
- }
+ }
- @Override
+ @Override
protected Comparator getModifierKeyComparator() {
- return MODIFIER_KEY_COMPARATOR;
- }
+ return MODIFIER_KEY_COMPARATOR;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/NativeModifierKeyComparator.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/NativeModifierKeyComparator.java
index b4020e8bef3..c3846a83eda 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/NativeModifierKeyComparator.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/NativeModifierKeyComparator.java
@@ -27,85 +27,82 @@ import org.eclipse.ui.keys.ModifierKey;
*/
class NativeModifierKeyComparator implements Comparator {
- /**
- * The sort order value to use when the modifier key is not recognized.
- */
- private static final int UNKNOWN_KEY = Integer.MAX_VALUE;
+ /**
+ * The sort order value to use when the modifier key is not recognized.
+ */
+ private static final int UNKNOWN_KEY = Integer.MAX_VALUE;
- @Override
+ @Override
public int compare(Object left, Object right) {
- ModifierKey modifierKeyLeft = (ModifierKey) left;
- ModifierKey modifierKeyRight = (ModifierKey) right;
- int modifierKeyLeftRank = rank(modifierKeyLeft);
- int modifierKeyRightRank = rank(modifierKeyRight);
-
- if (modifierKeyLeftRank != modifierKeyRightRank) {
- return modifierKeyLeftRank - modifierKeyRightRank;
- }
+ ModifierKey modifierKeyLeft = (ModifierKey) left;
+ ModifierKey modifierKeyRight = (ModifierKey) right;
+ int modifierKeyLeftRank = rank(modifierKeyLeft);
+ int modifierKeyRightRank = rank(modifierKeyRight);
+
+ if (modifierKeyLeftRank != modifierKeyRightRank) {
+ return modifierKeyLeftRank - modifierKeyRightRank;
+ }
return modifierKeyLeft.compareTo(modifierKeyRight);
- }
-
- /**
- * Calculates a rank for a given modifier key.
- *
- * @param modifierKey
- * The modifier key to rank; may be <code>null</code>.
- * @return The rank of this modifier key. This is a non-negative number
- * where a lower number suggests a higher rank.
- */
- private int rank(ModifierKey modifierKey) {
-
- if (Util.isWindows()) {
- return rankWindows(modifierKey);
- }
-
- if (Util.isGtk()) {
- // TODO Do a look-up on window manager.
- return rankGNOME(modifierKey);
- }
-
- if (Util.isMac()) {
- return rankMacOSX(modifierKey);
- }
-
- return UNKNOWN_KEY;
- }
-
- /**
- * Provides a ranking for the modifier key based on the modifier key
- * ordering used in the GNOME window manager.
- *
- * @param modifierKey
- * The modifier key to rank; may be <code>null</code>.
- * @return The rank of this modifier key. This is a non-negative number
- * where a lower number suggests a higher rank.
- */
- private final int rankGNOME(ModifierKey modifierKey) {
- if (ModifierKey.SHIFT.equals(modifierKey)) {
- return 0;
- }
-
- if (ModifierKey.CTRL.equals(modifierKey)) {
- return 1;
- }
-
- if (ModifierKey.ALT.equals(modifierKey)) {
- return 2;
- }
-
- return UNKNOWN_KEY;
-
- }
-
- /**
- * Provides a ranking for the modifier key based on the modifier key
- * ordering used in the KDE window manager.
- *
- * @param modifierKey
- * The modifier key to rank; may be <code>null</code>.
- * @return The rank of this modifier key. This is a non-negative number
- * where a lower number suggests a higher rank.
- */
+ }
+
+ /**
+ * Calculates a rank for a given modifier key.
+ *
+ * @param modifierKey The modifier key to rank; may be <code>null</code>.
+ * @return The rank of this modifier key. This is a non-negative number where a
+ * lower number suggests a higher rank.
+ */
+ private int rank(ModifierKey modifierKey) {
+
+ if (Util.isWindows()) {
+ return rankWindows(modifierKey);
+ }
+
+ if (Util.isGtk()) {
+ // TODO Do a look-up on window manager.
+ return rankGNOME(modifierKey);
+ }
+
+ if (Util.isMac()) {
+ return rankMacOSX(modifierKey);
+ }
+
+ return UNKNOWN_KEY;
+ }
+
+ /**
+ * Provides a ranking for the modifier key based on the modifier key ordering
+ * used in the GNOME window manager.
+ *
+ * @param modifierKey The modifier key to rank; may be <code>null</code>.
+ * @return The rank of this modifier key. This is a non-negative number where a
+ * lower number suggests a higher rank.
+ */
+ private final int rankGNOME(ModifierKey modifierKey) {
+ if (ModifierKey.SHIFT.equals(modifierKey)) {
+ return 0;
+ }
+
+ if (ModifierKey.CTRL.equals(modifierKey)) {
+ return 1;
+ }
+
+ if (ModifierKey.ALT.equals(modifierKey)) {
+ return 2;
+ }
+
+ return UNKNOWN_KEY;
+
+ }
+
+ /**
+ * Provides a ranking for the modifier key based on the modifier key ordering
+ * used in the KDE window manager.
+ *
+ * @param modifierKey The modifier key to rank; may be <code>null</code>.
+ * @return The rank of this modifier key. This is a non-negative number where a
+ * lower number suggests a higher rank.
+ */
// private final int rankKDE(ModifierKey modifierKey) {
// if (ModifierKey.ALT.equals(modifierKey)) {
// return 0;
@@ -122,57 +119,55 @@ class NativeModifierKeyComparator implements Comparator {
// return UNKNOWN_KEY;
// }
- /**
- * Provides a ranking for the modifier key based on the modifier key
- * ordering used in the MacOS X operating system.
- *
- * @param modifierKey
- * The modifier key to rank; may be <code>null</code>.
- * @return The rank of this modifier key. This is a non-negative number
- * where a lower number suggests a higher rank.
- */
- private final int rankMacOSX(ModifierKey modifierKey) {
- if (ModifierKey.SHIFT.equals(modifierKey)) {
- return 0;
- }
-
- if (ModifierKey.CTRL.equals(modifierKey)) {
- return 1;
- }
-
- if (ModifierKey.ALT.equals(modifierKey)) {
- return 2;
- }
-
- if (ModifierKey.COMMAND.equals(modifierKey)) {
- return 3;
- }
-
- return UNKNOWN_KEY;
- }
-
- /**
- * Provides a ranking for the modifier key based on the modifier key
- * ordering used in the Windows operating system.
- *
- * @param modifierKey
- * The modifier key to rank; may be <code>null</code>.
- * @return The rank of this modifier key. This is a non-negative number
- * where a lower number suggests a higher rank.
- */
- private final int rankWindows(ModifierKey modifierKey) {
- if (ModifierKey.CTRL.equals(modifierKey)) {
- return 0;
- }
-
- if (ModifierKey.ALT.equals(modifierKey)) {
- return 1;
- }
-
- if (ModifierKey.SHIFT.equals(modifierKey)) {
- return 2;
- }
-
- return UNKNOWN_KEY;
- }
+ /**
+ * Provides a ranking for the modifier key based on the modifier key ordering
+ * used in the MacOS X operating system.
+ *
+ * @param modifierKey The modifier key to rank; may be <code>null</code>.
+ * @return The rank of this modifier key. This is a non-negative number where a
+ * lower number suggests a higher rank.
+ */
+ private final int rankMacOSX(ModifierKey modifierKey) {
+ if (ModifierKey.SHIFT.equals(modifierKey)) {
+ return 0;
+ }
+
+ if (ModifierKey.CTRL.equals(modifierKey)) {
+ return 1;
+ }
+
+ if (ModifierKey.ALT.equals(modifierKey)) {
+ return 2;
+ }
+
+ if (ModifierKey.COMMAND.equals(modifierKey)) {
+ return 3;
+ }
+
+ return UNKNOWN_KEY;
+ }
+
+ /**
+ * Provides a ranking for the modifier key based on the modifier key ordering
+ * used in the Windows operating system.
+ *
+ * @param modifierKey The modifier key to rank; may be <code>null</code>.
+ * @return The rank of this modifier key. This is a non-negative number where a
+ * lower number suggests a higher rank.
+ */
+ private final int rankWindows(ModifierKey modifierKey) {
+ if (ModifierKey.CTRL.equals(modifierKey)) {
+ return 0;
+ }
+
+ if (ModifierKey.ALT.equals(modifierKey)) {
+ return 1;
+ }
+
+ if (ModifierKey.SHIFT.equals(modifierKey)) {
+ return 2;
+ }
+
+ return UNKNOWN_KEY;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/NewKeysPreferencePage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/NewKeysPreferencePage.java
index d3e0ca677cb..74a9185eca8 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/NewKeysPreferencePage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/NewKeysPreferencePage.java
@@ -189,8 +189,8 @@ public class NewKeysPreferencePage extends PreferencePage implements IWorkbenchP
private ICommandService commandService;
/**
- * A FilteredTree that provides a combo which is used to organize and
- * display elements in the tree according to the selected criteria.
+ * A FilteredTree that provides a combo which is used to organize and display
+ * elements in the tree according to the selected criteria.
*
*/
protected static class CategoryFilterTree extends FilteredTree {
@@ -251,16 +251,14 @@ public class NewKeysPreferencePage extends PreferencePage implements IWorkbenchP
}
/**
- * @param ascending
- * The ascending to set.
+ * @param ascending The ascending to set.
*/
public void setAscending(boolean ascending) {
this.ascending = ascending;
}
@Override
- public int compare(final Viewer viewer, final Object a,
- final Object b) {
+ public int compare(final Viewer viewer, final Object a, final Object b) {
int result = 0;
Iterator<Integer> i = sortColumns.iterator();
while (i.hasNext() && result == 0) {
@@ -270,8 +268,7 @@ public class NewKeysPreferencePage extends PreferencePage implements IWorkbenchP
return ascending ? result : (-1) * result;
}
- private int compareColumn(final Viewer viewer, final Object a,
- final Object b, final int columnNumber) {
+ private int compareColumn(final Viewer viewer, final Object a, final Object b, final int columnNumber) {
if (columnNumber == USER_DELTA_COLUMN) {
return sortUser(a, b);
}
@@ -313,8 +310,7 @@ public class NewKeysPreferencePage extends PreferencePage implements IWorkbenchP
public void widgetSelected(SelectionEvent e) {
if (comparator.getSortColumn() == column) {
comparator.setAscending(!comparator.isAscending());
- viewer.getTree().setSortDirection(
- comparator.isAscending() ? SWT.UP : SWT.DOWN);
+ viewer.getTree().setSortDirection(comparator.isAscending() ? SWT.UP : SWT.DOWN);
} else {
viewer.getTree().setSortColumn(treeColumn);
comparator.setSortColumn(column);
@@ -376,8 +372,7 @@ public class NewKeysPreferencePage extends PreferencePage implements IWorkbenchP
return seq == null ? Util.ZERO_LENGTH_STRING : seq.format();
case CONTEXT_COLUMN: // when
ModelElement context = bindingElement.getContext();
- return context == null ? Util.ZERO_LENGTH_STRING : context
- .getName();
+ return context == null ? Util.ZERO_LENGTH_STRING : context.getName();
case CATEGORY_COLUMN: // category
return bindingElement.getCategory();
case USER_DELTA_COLUMN: // user
@@ -401,8 +396,7 @@ public class NewKeysPreferencePage extends PreferencePage implements IWorkbenchP
switch (index) {
case COMMAND_NAME_COLUMN:
final String commandId = be.getId();
- final ImageDescriptor imageDescriptor = commandImageService
- .getImageDescriptor(commandId);
+ final ImageDescriptor imageDescriptor = commandImageService.getImageDescriptor(commandId);
if (imageDescriptor == null) {
return null;
}
@@ -411,8 +405,7 @@ public class NewKeysPreferencePage extends PreferencePage implements IWorkbenchP
} catch (final DeviceResourceException e) {
final String message = "Problem retrieving image for a command '" //$NON-NLS-1$
+ commandId + '\'';
- final IStatus status = new Status(IStatus.ERROR,
- WorkbenchPlugin.PI_WORKBENCH, 0, message, e);
+ final IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 0, message, e);
WorkbenchPlugin.log(message, status);
}
return null;
@@ -502,9 +495,8 @@ public class NewKeysPreferencePage extends PreferencePage implements IWorkbenchP
/**
* Creates the button bar with "Filters..." and "Export CVS..." buttons.
*
- * @param parent
- * The composite in which the button bar should be placed; never
- * <code>null</code>.
+ * @param parent The composite in which the button bar should be placed; never
+ * <code>null</code>.
* @return The button bar composite; never <code>null</code>.
*/
private final Control createButtonBar(final Composite parent) {
@@ -527,8 +519,7 @@ public class NewKeysPreferencePage extends PreferencePage implements IWorkbenchP
gridData = new GridData();
widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
filtersButton.setText(NewKeysPreferenceMessages.FiltersButton_Text);
- gridData.widthHint = Math.max(widthHint, filtersButton.computeSize(
- SWT.DEFAULT, SWT.DEFAULT, true).x) + 5;
+ gridData.widthHint = Math.max(widthHint, filtersButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x) + 5;
filtersButton.setLayoutData(gridData);
filtersButton.addSelectionListener(widgetSelectedAdapter(e -> {
KeysPreferenceFiltersDialog dialog = new KeysPreferenceFiltersDialog(getShell());
@@ -554,10 +545,10 @@ public class NewKeysPreferencePage extends PreferencePage implements IWorkbenchP
// gridData = new GridData();
widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
exportButton.setText(NewKeysPreferenceMessages.ExportButton_Text);
- gridData.widthHint = Math.max(widthHint, exportButton.computeSize(
- SWT.DEFAULT, SWT.DEFAULT, true).x) + 5;
+ gridData.widthHint = Math.max(widthHint, exportButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x) + 5;
exportButton.setLayoutData(gridData);
- exportButton.addSelectionListener(widgetSelectedAdapter(e -> keyController.exportCSV(((Button) e.getSource()).getShell())));
+ exportButton.addSelectionListener(
+ widgetSelectedAdapter(e -> keyController.exportCSV(((Button) e.getSource()).getShell())));
return buttonBar;
}
@@ -589,8 +580,7 @@ public class NewKeysPreferencePage extends PreferencePage implements IWorkbenchP
// The command name label.
final Label commandNameLabel = new Label(leftDataArea, SWT.NONE);
- commandNameLabel
- .setText(NewKeysPreferenceMessages.CommandNameLabel_Text);
+ commandNameLabel.setText(NewKeysPreferenceMessages.CommandNameLabel_Text);
// The current command name.
commandNameValueLabel = new Label(leftDataArea, SWT.NONE);
@@ -606,8 +596,7 @@ public class NewKeysPreferencePage extends PreferencePage implements IWorkbenchP
gridData.verticalAlignment = SWT.BEGINNING;
commandDescriptionlabel.setLayoutData(gridData);
- fDescriptionText = new Text(leftDataArea, SWT.MULTI | SWT.WRAP
- | SWT.BORDER | SWT.READ_ONLY);
+ fDescriptionText = new Text(leftDataArea, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.READ_ONLY);
// The binding label.
final Label bindingLabel = new Label(leftDataArea, SWT.NONE);
@@ -640,27 +629,24 @@ public class NewKeysPreferencePage extends PreferencePage implements IWorkbenchP
fKeySequenceText = new KeySequenceText(fBindingText);
fKeySequenceText.setKeyStrokeLimit(4);
- fKeySequenceText
- .addPropertyChangeListener(event -> {
-if (!event.getOldValue().equals(event.getNewValue())) {
+ fKeySequenceText.addPropertyChangeListener(event -> {
+ if (!event.getOldValue().equals(event.getNewValue())) {
final KeySequence keySequence = fKeySequenceText.getKeySequence();
if (!keySequence.isComplete()) {
return;
}
- BindingElement activeBinding = (BindingElement) keyController.getBindingModel()
- .getSelectedElement();
+ BindingElement activeBinding = (BindingElement) keyController.getBindingModel().getSelectedElement();
if (activeBinding != null) {
activeBinding.setTrigger(keySequence);
}
fBindingText.setSelection(fBindingText.getTextLimit());
-}
-});
+ }
+ });
// Button for adding trapped key strokes
final Button addKeyButton = new Button(leftDataArea, SWT.LEFT | SWT.ARROW);
- addKeyButton
- .setToolTipText(NewKeysPreferenceMessages.AddKeyButton_ToolTipText);
+ addKeyButton.setToolTipText(NewKeysPreferenceMessages.AddKeyButton_ToolTipText);
gridData = new GridData();
gridData.heightHint = fSchemeCombo.getCombo().getTextHeight();
addKeyButton.setLayoutData(gridData);
@@ -674,8 +660,7 @@ if (!event.getOldValue().equals(event.getNewValue())) {
newTabStops.add(addKeyButton);
}
}
- final Control[] newTabStopArray = newTabStops
- .toArray(new Control[newTabStops.size()]);
+ final Control[] newTabStopArray = newTabStops.toArray(new Control[newTabStops.size()]);
dataArea.setTabList(newTabStopArray);
// Construct the menu to attach to the above button.
@@ -723,11 +708,9 @@ if (!event.getOldValue().equals(event.getNewValue())) {
});
IPropertyChangeListener whenListener = event -> {
if (event.getSource() == keyController.getContextModel()
- && CommonModel.PROP_SELECTED_ELEMENT.equals(event
- .getProperty())) {
+ && CommonModel.PROP_SELECTED_ELEMENT.equals(event.getProperty())) {
Object newVal = event.getNewValue();
- StructuredSelection structuredSelection = newVal == null ? null
- : new StructuredSelection(newVal);
+ StructuredSelection structuredSelection = newVal == null ? null : new StructuredSelection(newVal);
fWhenCombo.setSelection(structuredSelection, true);
}
};
@@ -751,8 +734,7 @@ if (!event.getOldValue().equals(event.getNewValue())) {
gridData.horizontalAlignment = SWT.FILL;
descriptionLabel.setLayoutData(gridData);
- conflictViewer = new TableViewer(rightDataArea, SWT.SINGLE | SWT.V_SCROLL
- | SWT.BORDER | SWT.FULL_SELECTION);
+ conflictViewer = new TableViewer(rightDataArea, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
Table table = conflictViewer.getTable();
table.setHeaderVisible(true);
TableColumn bindingNameColumn = new TableColumn(table, SWT.LEAD);
@@ -762,7 +744,7 @@ if (!event.getOldValue().equals(event.getNewValue())) {
bindingContextNameColumn.setText(NewKeysPreferenceMessages.WhenColumn_Text);
bindingContextNameColumn.setWidth(150);
gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
- //gridData.horizontalIndent = 10;
+ // gridData.horizontalIndent = 10;
table.setLayoutData(gridData);
TableLayout tableLayout = new TableLayout();
tableLayout.addColumnData(new ColumnWeightData(60));
@@ -813,22 +795,17 @@ if (!event.getOldValue().equals(event.getNewValue())) {
IPropertyChangeListener conflictsListener = event -> {
if (event.getSource() == keyController.getConflictModel()
- && CommonModel.PROP_SELECTED_ELEMENT.equals(event
- .getProperty())) {
+ && CommonModel.PROP_SELECTED_ELEMENT.equals(event.getProperty())) {
if (keyController.getConflictModel().getConflicts() != null) {
Object newVal = event.getNewValue();
- StructuredSelection structuredSelection = newVal == null ? null
- : new StructuredSelection(newVal);
+ StructuredSelection structuredSelection = newVal == null ? null : new StructuredSelection(newVal);
conflictViewer.setSelection(structuredSelection, true);
}
- } else if (ConflictModel.PROP_CONFLICTS.equals(event
- .getProperty())) {
+ } else if (ConflictModel.PROP_CONFLICTS.equals(event.getProperty())) {
conflictViewer.setInput(event.getNewValue());
- } else if (ConflictModel.PROP_CONFLICTS_ADD.equals(event
- .getProperty())) {
+ } else if (ConflictModel.PROP_CONFLICTS_ADD.equals(event.getProperty())) {
conflictViewer.add(event.getNewValue());
- } else if (ConflictModel.PROP_CONFLICTS_REMOVE.equals(event
- .getProperty())) {
+ } else if (ConflictModel.PROP_CONFLICTS_REMOVE.equals(event.getProperty())) {
conflictViewer.remove(event.getNewValue());
}
};
@@ -838,14 +815,11 @@ if (!event.getOldValue().equals(event.getNewValue())) {
BindingElement bindingElement = null;
boolean weCare = false;
if (event.getSource() == keyController.getBindingModel()
- && CommonModel.PROP_SELECTED_ELEMENT.equals(event
- .getProperty())) {
+ && CommonModel.PROP_SELECTED_ELEMENT.equals(event.getProperty())) {
bindingElement = (BindingElement) event.getNewValue();
weCare = true;
- } else if (event.getSource() == keyController.getBindingModel()
- .getSelectedElement()
- && ModelElement.PROP_MODEL_OBJECT.equals(event
- .getProperty())) {
+ } else if (event.getSource() == keyController.getBindingModel().getSelectedElement()
+ && ModelElement.PROP_MODEL_OBJECT.equals(event.getProperty())) {
bindingElement = (BindingElement) event.getSource();
weCare = true;
}
@@ -856,9 +830,8 @@ if (!event.getOldValue().equals(event.getNewValue())) {
} else if (bindingElement != null) {
commandNameValueLabel.setText(bindingElement.getName());
String desc = bindingElement.getDescription();
- fDescriptionText.setText(desc==null?"":desc); //$NON-NLS-1$
- KeySequence trigger = (KeySequence) bindingElement
- .getTrigger();
+ fDescriptionText.setText(desc == null ? "" : desc); //$NON-NLS-1$
+ KeySequence trigger = (KeySequence) bindingElement.getTrigger();
fKeySequenceText.setKeySequence(trigger);
}
};
@@ -907,22 +880,17 @@ if (!event.getOldValue().equals(event.getNewValue())) {
.addSelectionListener(new ResortColumn(comparator, commandNameColumn, viewer, COMMAND_NAME_COLUMN));
final TreeColumn triggerSequenceColumn = new TreeColumn(tree, SWT.LEFT, KEY_SEQUENCE_COLUMN);
- triggerSequenceColumn
- .setText(NewKeysPreferenceMessages.TriggerSequenceColumn_Text);
+ triggerSequenceColumn.setText(NewKeysPreferenceMessages.TriggerSequenceColumn_Text);
triggerSequenceColumn
.addSelectionListener(new ResortColumn(comparator, triggerSequenceColumn, viewer, KEY_SEQUENCE_COLUMN));
- final TreeColumn whenColumn = new TreeColumn(tree, SWT.LEFT,
- CONTEXT_COLUMN);
+ final TreeColumn whenColumn = new TreeColumn(tree, SWT.LEFT, CONTEXT_COLUMN);
whenColumn.setText(NewKeysPreferenceMessages.WhenColumn_Text);
- whenColumn.addSelectionListener(new ResortColumn(comparator,
- whenColumn, viewer, CONTEXT_COLUMN));
+ whenColumn.addSelectionListener(new ResortColumn(comparator, whenColumn, viewer, CONTEXT_COLUMN));
- final TreeColumn categoryColumn = new TreeColumn(tree, SWT.LEFT,
- CATEGORY_COLUMN);
+ final TreeColumn categoryColumn = new TreeColumn(tree, SWT.LEFT, CATEGORY_COLUMN);
categoryColumn.setText(NewKeysPreferenceMessages.CategoryColumn_Text);
- categoryColumn.addSelectionListener(new ResortColumn(comparator,
- categoryColumn, viewer, CATEGORY_COLUMN));
+ categoryColumn.addSelectionListener(new ResortColumn(comparator, categoryColumn, viewer, CATEGORY_COLUMN));
final TreeColumn userMarker = new TreeColumn(tree, SWT.LEFT, USER_DELTA_COLUMN);
userMarker.setText(NewKeysPreferenceMessages.UserColumn_Text);
@@ -954,21 +922,15 @@ if (!event.getOldValue().equals(event.getNewValue())) {
} else if (event.getSource() instanceof BindingElement
&& ModelElement.PROP_MODEL_OBJECT.equals(event.getProperty())) {
viewer.update(event.getSource(), null);
- } else if (BindingElement.PROP_CONFLICT.equals(event
- .getProperty())) {
+ } else if (BindingElement.PROP_CONFLICT.equals(event.getProperty())) {
viewer.update(event.getSource(), null);
- } else if (BindingModel.PROP_BINDINGS.equals(event
- .getProperty())) {
+ } else if (BindingModel.PROP_BINDINGS.equals(event.getProperty())) {
viewer.refresh();
- } else if (BindingModel.PROP_BINDING_ADD.equals(event
- .getProperty())) {
- viewer.add(keyController.getBindingModel(), event
- .getNewValue());
- } else if (BindingModel.PROP_BINDING_REMOVE.equals(event
- .getProperty())) {
+ } else if (BindingModel.PROP_BINDING_ADD.equals(event.getProperty())) {
+ viewer.add(keyController.getBindingModel(), event.getNewValue());
+ } else if (BindingModel.PROP_BINDING_REMOVE.equals(event.getProperty())) {
viewer.remove(event.getNewValue());
- } else if (BindingModel.PROP_BINDING_FILTER.equals(event
- .getProperty())) {
+ } else if (BindingModel.PROP_BINDING_FILTER.equals(event.getProperty())) {
viewer.refresh();
}
};
@@ -994,29 +956,25 @@ if (!event.getOldValue().equals(event.getNewValue())) {
final Button addBindingButton = new Button(treeControls, SWT.PUSH);
gridData = new GridData();
widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- addBindingButton
- .setText(NewKeysPreferenceMessages.AddBindingButton_Text);
- gridData.widthHint = Math.max(widthHint, addBindingButton.computeSize(
- SWT.DEFAULT, SWT.DEFAULT, true).x) + 5;
+ addBindingButton.setText(NewKeysPreferenceMessages.AddBindingButton_Text);
+ gridData.widthHint = Math.max(widthHint, addBindingButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x) + 5;
addBindingButton.setLayoutData(gridData);
addBindingButton.addSelectionListener(widgetSelectedAdapter(event -> keyController.getBindingModel().copy()));
final Button removeBindingButton = new Button(treeControls, SWT.PUSH);
gridData = new GridData();
widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- removeBindingButton
- .setText(NewKeysPreferenceMessages.RemoveBindingButton_Text);
- gridData.widthHint = Math.max(widthHint, removeBindingButton
- .computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x) + 5;
+ removeBindingButton.setText(NewKeysPreferenceMessages.RemoveBindingButton_Text);
+ gridData.widthHint = Math.max(widthHint, removeBindingButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x) + 5;
removeBindingButton.setLayoutData(gridData);
- removeBindingButton.addSelectionListener(widgetSelectedAdapter(event -> keyController.getBindingModel().remove()));
+ removeBindingButton
+ .addSelectionListener(widgetSelectedAdapter(event -> keyController.getBindingModel().remove()));
final Button restore = new Button(treeControls, SWT.PUSH);
gridData = new GridData();
widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
restore.setText(NewKeysPreferenceMessages.RestoreBindingButton_Text);
- gridData.widthHint = Math.max(widthHint, restore.computeSize(
- SWT.DEFAULT, SWT.DEFAULT, true).x) + 5;
+ gridData.widthHint = Math.max(widthHint, restore.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x) + 5;
restore.setLayoutData(gridData);
restore.addSelectionListener(widgetSelectedAdapter(event -> {
try {
@@ -1070,11 +1028,9 @@ if (!event.getOldValue().equals(event.getNewValue())) {
}));
IPropertyChangeListener listener = event -> {
if (event.getSource() == keyController.getSchemeModel()
- && CommonModel.PROP_SELECTED_ELEMENT.equals(event
- .getProperty())) {
+ && CommonModel.PROP_SELECTED_ELEMENT.equals(event.getProperty())) {
Object newVal = event.getNewValue();
- StructuredSelection structuredSelection = newVal == null ? null
- : new StructuredSelection(newVal);
+ StructuredSelection structuredSelection = newVal == null ? null : new StructuredSelection(newVal);
fSchemeCombo.setSelection(structuredSelection, true);
}
};
@@ -1100,17 +1056,15 @@ if (!event.getOldValue().equals(event.getNewValue())) {
keyController.getBindingModel().setSelectedElement((ModelElement) data);
}
if (data instanceof Binding && fFilteredTree != null) {
- BindingElement be = (BindingElement) keyController
- .getBindingModel().getBindingToElement().get(data);
+ BindingElement be = (BindingElement) keyController.getBindingModel().getBindingToElement().get(data);
fFilteredTree.getViewer().setSelection(new StructuredSelection(be), true);
}
if (data instanceof ParameterizedCommand) {
Map commandToElement = keyController.getBindingModel().getCommandToElement();
- BindingElement be = (BindingElement)commandToElement.get(data);
- if(be != null) {
- fFilteredTree.getViewer().setSelection(new StructuredSelection(be),
- true);
+ BindingElement be = (BindingElement) commandToElement.get(data);
+ if (be != null) {
+ fFilteredTree.getViewer().setSelection(new StructuredSelection(be), true);
}
}
}
@@ -1137,11 +1091,9 @@ if (!event.getOldValue().equals(event.getNewValue())) {
}
protected IDialogSettings getDialogSettings() {
- IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault()
- .getDialogSettings();
+ IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
- IDialogSettings settings = workbenchSettings
- .getSection(TAG_DIALOG_SECTION);
+ IDialogSettings settings = workbenchSettings.getSection(TAG_DIALOG_SECTION);
if (settings == null) {
settings = workbenchSettings.addNewSection(TAG_DIALOG_SECTION);
@@ -1155,8 +1107,7 @@ if (!event.getOldValue().equals(event.getNewValue())) {
// Ask the user to confirm
final String title = NewKeysPreferenceMessages.RestoreDefaultsMessageBoxText;
final String message = NewKeysPreferenceMessages.RestoreDefaultsMessageBoxMessage;
- final boolean confirmed = MessageDialog.open(MessageDialog.CONFIRM,
- getShell(), title, message, SWT.SHEET);
+ final boolean confirmed = MessageDialog.open(MessageDialog.CONFIRM, getShell(), title, message, SWT.SHEET);
if (confirmed) {
long startTime = 0L;
@@ -1165,12 +1116,12 @@ if (!event.getOldValue().equals(event.getNewValue())) {
}
fFilteredTree.setRedraw(false);
- BusyIndicator.showWhile(fFilteredTree.getViewer().getTree().getDisplay(), () -> keyController.setDefaultBindings(fBindingService));
+ BusyIndicator.showWhile(fFilteredTree.getViewer().getTree().getDisplay(),
+ () -> keyController.setDefaultBindings(fBindingService));
fFilteredTree.setRedraw(true);
if (DEBUG) {
final long elapsedTime = System.currentTimeMillis() - startTime;
- Tracing.printTrace(TRACING_COMPONENT,
- "performDefaults:model in " + elapsedTime + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
+ Tracing.printTrace(TRACING_COMPONENT, "performDefaults:model in " + elapsedTime + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/NoKeysPreferencePage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/NoKeysPreferencePage.java
index bb500c72a26..6d811067d1f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/NoKeysPreferencePage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/NoKeysPreferencePage.java
@@ -32,7 +32,8 @@ public class NoKeysPreferencePage extends PreferencePage implements IWorkbenchPr
@Override
protected Control createContents(Composite parent) {
Label info = new Label(parent, SWT.NONE);
- info.setText("Custom key preferences are not available at this time.\nPlease create key bindings through the model."); //$NON-NLS-1$
+ info.setText(
+ "Custom key preferences are not available at this time.\nPlease create key bindings through the model."); //$NON-NLS-1$
return info;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/SchemeLegacyWrapper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/SchemeLegacyWrapper.java
index 1f3353dc39e..df48f5ba25c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/SchemeLegacyWrapper.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/SchemeLegacyWrapper.java
@@ -41,21 +41,18 @@ public final class SchemeLegacyWrapper implements IKeyConfiguration {
/**
* Constructs a new instance of <code>SchemeWrapper</code>.
*
- * @param scheme
- * The scheme to be wrapped; must not be <code>null</code>.
- * @param bindingManager
- * The binding manager for this scheme; must not be
- * <code>null</code>.
+ * @param scheme The scheme to be wrapped; must not be
+ * <code>null</code>.
+ * @param bindingManager The binding manager for this scheme; must not be
+ * <code>null</code>.
*/
- public SchemeLegacyWrapper(final Scheme scheme,
- final BindingManager bindingManager) {
+ public SchemeLegacyWrapper(final Scheme scheme, final BindingManager bindingManager) {
if (scheme == null) {
throw new NullPointerException("Cannot wrap a null scheme"); //$NON-NLS-1$
}
if (bindingManager == null) {
- throw new NullPointerException(
- "Cannot wrap a scheme without a binding manager"); //$NON-NLS-1$
+ throw new NullPointerException("Cannot wrap a scheme without a binding manager"); //$NON-NLS-1$
}
this.scheme = scheme;
@@ -63,10 +60,8 @@ public final class SchemeLegacyWrapper implements IKeyConfiguration {
}
@Override
- public void addKeyConfigurationListener(
- IKeyConfigurationListener keyConfigurationListener) {
- scheme.addSchemeListener(new LegacySchemeListenerWrapper(
- keyConfigurationListener, bindingManager));
+ public void addKeyConfigurationListener(IKeyConfigurationListener keyConfigurationListener) {
+ scheme.addSchemeListener(new LegacySchemeListenerWrapper(keyConfigurationListener, bindingManager));
}
@Override
@@ -117,10 +112,8 @@ public final class SchemeLegacyWrapper implements IKeyConfiguration {
}
@Override
- public void removeKeyConfigurationListener(
- IKeyConfigurationListener keyConfigurationListener) {
- scheme.removeSchemeListener(new LegacySchemeListenerWrapper(
- keyConfigurationListener, bindingManager));
+ public void removeKeyConfigurationListener(IKeyConfigurationListener keyConfigurationListener) {
+ scheme.removeSchemeListener(new LegacySchemeListenerWrapper(keyConfigurationListener, bindingManager));
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/BindingElement.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/BindingElement.java
index 7767a9f6959..576c1a4fcf3 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/BindingElement.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/BindingElement.java
@@ -56,8 +56,7 @@ public class BindingElement extends ModelElement {
public void init(Binding b, ContextModel model) {
setCommandInfo(b.getParameterizedCommand());
setTrigger(b.getTriggerSequence());
- setContext((ContextElement) model.getContextIdToElement().get(
- b.getContextId()));
+ setContext((ContextElement) model.getContextIdToElement().get(b.getContextId()));
setUserDelta(Integer.valueOf(b.getType()));
setModelObject(b);
}
@@ -87,8 +86,7 @@ public class BindingElement extends ModelElement {
/**
* @param cmd
- * @param type
- * The binding type. Check {@link Binding} constants.
+ * @param type The binding type. Check {@link Binding} constants.
*/
public void init(ParameterizedCommand cmd) {
setCommandInfo(cmd);
@@ -107,8 +105,7 @@ public class BindingElement extends ModelElement {
}
/**
- * @param trigger
- * The trigger to set.
+ * @param trigger The trigger to set.
*/
public void setTrigger(TriggerSequence trigger) {
Object old = this.trigger;
@@ -124,8 +121,7 @@ public class BindingElement extends ModelElement {
}
/**
- * @param context
- * The context to set.
+ * @param context The context to set.
*/
public void setContext(ContextElement context) {
Object old = this.context;
@@ -141,8 +137,7 @@ public class BindingElement extends ModelElement {
}
/**
- * @param category
- * The category to set.
+ * @param category The category to set.
*/
public void setCategory(String category) {
Object old = this.category;
@@ -158,8 +153,7 @@ public class BindingElement extends ModelElement {
}
/**
- * @param userDelta
- * The userDelta to set.
+ * @param userDelta The userDelta to set.
*/
public void setUserDelta(Integer userDelta) {
Object old = this.userDelta;
@@ -175,8 +169,7 @@ public class BindingElement extends ModelElement {
}
/**
- * @param image
- * The image to set.
+ * @param image The image to set.
*/
public void setImage(Image image) {
Object old = this.image;
@@ -192,8 +185,7 @@ public class BindingElement extends ModelElement {
}
/**
- * @param conflict
- * The conflict to set.
+ * @param conflict The conflict to set.
*/
public void setConflict(Boolean conflict) {
Object old = this.conflict;
@@ -208,8 +200,7 @@ public class BindingElement extends ModelElement {
public void fill(KeyBinding binding, ContextModel contextModel) {
setCommandInfo(binding.getParameterizedCommand());
setTrigger(binding.getTriggerSequence());
- setContext((ContextElement) contextModel.getContextIdToElement().get(
- binding.getContextId()));
+ setContext((ContextElement) contextModel.getContextIdToElement().get(binding.getContextId()));
setUserDelta(Integer.valueOf(binding.getType()));
setModelObject(binding);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/BindingModel.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/BindingModel.java
index 8fccc47ef4b..d096e46532e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/BindingModel.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/BindingModel.java
@@ -49,8 +49,7 @@ public class BindingModel extends CommonModel {
static final boolean deletes(final Binding del, final Binding binding) {
boolean deletes = true;
deletes &= Util.equals(del.getContextId(), binding.getContextId());
- deletes &= Util.equals(del.getTriggerSequence(), binding
- .getTriggerSequence());
+ deletes &= Util.equals(del.getTriggerSequence(), binding.getTriggerSequence());
if (del.getLocale() != null) {
deletes &= Util.equals(del.getLocale(), binding.getLocale());
}
@@ -108,8 +107,7 @@ public class BindingModel extends CommonModel {
return;
}
BindingElement be = new BindingElement(controller);
- ParameterizedCommand parameterizedCommand = ((Binding) element
- .getModelObject()).getParameterizedCommand();
+ ParameterizedCommand parameterizedCommand = ((Binding) element.getModelObject()).getParameterizedCommand();
be.init(parameterizedCommand);
be.setParent(this);
bindingElements.add(be);
@@ -146,8 +144,7 @@ public class BindingModel extends CommonModel {
* @param manager
* @param model
*/
- public void init(IServiceLocator locator, BindingManager manager,
- ContextModel model) {
+ public void init(IServiceLocator locator, BindingManager manager, ContextModel model) {
Set cmdsForBindings = new HashSet();
bindingToElement = new HashMap();
commandToElement = new HashMap();
@@ -155,8 +152,7 @@ public class BindingModel extends CommonModel {
bindingElements = new HashSet();
bindingManager = manager;
- Iterator i = manager.getActiveBindingsDisregardingContextFlat()
- .iterator();
+ Iterator i = manager.getActiveBindingsDisregardingContextFlat().iterator();
while (i.hasNext()) {
Binding b = (Binding) i.next();
BindingElement be = new BindingElement(controller);
@@ -167,18 +163,15 @@ public class BindingModel extends CommonModel {
cmdsForBindings.add(b.getParameterizedCommand());
}
- ICommandService commandService = locator
- .getService(ICommandService.class);
+ ICommandService commandService = locator.getService(ICommandService.class);
final Collection commandIds = commandService.getDefinedCommandIds();
allParameterizedCommands = new HashSet();
final Iterator commandIdItr = commandIds.iterator();
while (commandIdItr.hasNext()) {
final String currentCommandId = (String) commandIdItr.next();
- final Command currentCommand = commandService
- .getCommand(currentCommandId);
+ final Command currentCommand = commandService.getCommand(currentCommandId);
try {
- allParameterizedCommands.addAll(ParameterizedCommand
- .generateCombinations(currentCommand));
+ allParameterizedCommands.addAll(ParameterizedCommand.generateCombinations(currentCommand));
} catch (final NotDefinedException e) {
// It is safe to just ignore undefined commands.
}
@@ -204,15 +197,13 @@ public class BindingModel extends CommonModel {
*/
public void refresh(ContextModel contextModel) {
Set cmdsForBindings = new HashSet();
- Collection activeManagerBindings = bindingManager
- .getActiveBindingsDisregardingContextFlat();
+ Collection activeManagerBindings = bindingManager.getActiveBindingsDisregardingContextFlat();
// add any bindings that we don't already have.
Iterator i = activeManagerBindings.iterator();
while (i.hasNext()) {
KeyBinding b = (KeyBinding) i.next();
- ParameterizedCommand parameterizedCommand = b
- .getParameterizedCommand();
+ ParameterizedCommand parameterizedCommand = b.getParameterizedCommand();
cmdsForBindings.add(parameterizedCommand);
if (!bindingToElement.containsKey(b)) {
BindingElement be = new BindingElement(controller);
@@ -226,8 +217,7 @@ public class BindingModel extends CommonModel {
&& be.getUserDelta().intValue() == Binding.SYSTEM) {
Object remove = commandToElement.remove(parameterizedCommand);
bindingElements.remove(remove);
- controller.firePropertyChange(this, PROP_BINDING_REMOVE,
- null, remove);
+ controller.firePropertyChange(this, PROP_BINDING_REMOVE, null, remove);
}
}
}
@@ -246,8 +236,7 @@ public class BindingModel extends CommonModel {
}
bindingToElement.remove(b);
i.remove();
- controller.firePropertyChange(this, PROP_BINDING_REMOVE,
- null, be);
+ controller.firePropertyChange(this, PROP_BINDING_REMOVE, null, be);
}
} else {
cmdsForBindings.add(obj);
@@ -285,8 +274,7 @@ public class BindingModel extends CommonModel {
* @param bindingElement
*/
public void remove(BindingElement bindingElement) {
- if (bindingElement == null
- || !(bindingElement.getModelObject() instanceof Binding)) {
+ if (bindingElement == null || !(bindingElement.getModelObject() instanceof Binding)) {
return;
}
KeyBinding keyBinding = (KeyBinding) bindingElement.getModelObject();
@@ -296,9 +284,8 @@ public class BindingModel extends CommonModel {
KeySequence keySequence = keyBinding.getKeySequence();
// Add the delete binding
- bindingManager.addBinding(new KeyBinding(keySequence, null,
- keyBinding.getSchemeId(), keyBinding.getContextId(), null,
- null, null, Binding.USER));
+ bindingManager.addBinding(new KeyBinding(keySequence, null, keyBinding.getSchemeId(),
+ keyBinding.getContextId(), null, null, null, Binding.USER));
// Unbind any conflicts affected by the delete binding
ConflictModel conflictModel = controller.getConflictModel();
@@ -317,20 +304,17 @@ public class BindingModel extends CommonModel {
if (binding.getType() != Binding.SYSTEM) {
continue;
}
- ParameterizedCommand pCommand = binding
- .getParameterizedCommand();
+ ParameterizedCommand pCommand = binding.getParameterizedCommand();
be.fill(pCommand);
commandToElement.put(pCommand, be);
}
}
}
}
- ParameterizedCommand parameterizedCommand = keyBinding
- .getParameterizedCommand();
+ ParameterizedCommand parameterizedCommand = keyBinding.getParameterizedCommand();
bindingElement.fill(parameterizedCommand);
commandToElement.put(parameterizedCommand, bindingElement);
- controller.firePropertyChange(this, PROP_CONFLICT_ELEMENT_MAP, null,
- bindingElement);
+ controller.firePropertyChange(this, PROP_CONFLICT_ELEMENT_MAP, null, bindingElement);
}
/**
@@ -350,8 +334,7 @@ public class BindingModel extends CommonModel {
ParameterizedCommand cmd = null;
if (modelObject instanceof ParameterizedCommand) {
cmd = (ParameterizedCommand) modelObject;
- TriggerSequence trigger = bindingManager
- .getBestActiveBindingFor(cmd.getId());
+ TriggerSequence trigger = bindingManager.getBestActiveBindingFor(cmd.getId());
Binding binding = bindingManager.getPerfectMatch(trigger);
if (binding != null && binding.getType() == Binding.SYSTEM) {
return;
@@ -440,8 +423,7 @@ public class BindingModel extends CommonModel {
}
/**
- * @param bindings
- * The bindings to set.
+ * @param bindings The bindings to set.
*/
public void setBindings(HashSet bindings) {
HashSet old = this.bindingElements;
@@ -450,13 +432,11 @@ public class BindingModel extends CommonModel {
}
/**
- * @param bindingToElement
- * The bindingToElement to set.
+ * @param bindingToElement The bindingToElement to set.
*/
public void setBindingToElement(Map bindingToElement) {
Map old = this.bindingToElement;
this.bindingToElement = bindingToElement;
- controller.firePropertyChange(this, PROP_BINDING_ELEMENT_MAP, old,
- bindingToElement);
+ controller.firePropertyChange(this, PROP_BINDING_ELEMENT_MAP, old, bindingToElement);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/CommonModel.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/CommonModel.java
index 2048e099417..96e78cacd71 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/CommonModel.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/CommonModel.java
@@ -38,14 +38,12 @@ public class CommonModel extends ModelElement {
}
/**
- * @param selectedContext
- * The selectedContext to set.
+ * @param selectedContext The selectedContext to set.
*/
public void setSelectedElement(ModelElement selectedContext) {
ModelElement old = this.selectedElement;
this.selectedElement = selectedContext;
- controller.firePropertyChange(this, PROP_SELECTED_ELEMENT, old,
- selectedContext);
+ controller.firePropertyChange(this, PROP_SELECTED_ELEMENT, old, selectedContext);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/ConflictModel.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/ConflictModel.java
index ae31fb9703a..6c62efb2843 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/ConflictModel.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/ConflictModel.java
@@ -63,12 +63,10 @@ public class ConflictModel extends CommonModel {
}
/**
- * Sets the conflicts to the given collection. Any conflicts in the
- * collection that do not exist in the <code>bindingModel</code> are
- * removed.
+ * Sets the conflicts to the given collection. Any conflicts in the collection
+ * that do not exist in the <code>bindingModel</code> are removed.
*
- * @param conflicts
- * The conflicts to set.
+ * @param conflicts The conflicts to set.
*/
public void setConflicts(Collection conflicts) {
Object old = this.conflicts;
@@ -79,8 +77,7 @@ public class ConflictModel extends CommonModel {
Map bindingToElement = bindingModel.getBindingToElement();
while (i.hasNext()) {
Object next = i.next();
- if (!bindingToElement.containsValue(next)
- && !next.equals(getSelectedElement())) {
+ if (!bindingToElement.containsValue(next) && !next.equals(getSelectedElement())) {
i.remove();
}
}
@@ -93,8 +90,7 @@ public class ConflictModel extends CommonModel {
updateConflictsFor(source, false);
}
- public void updateConflictsFor(BindingElement oldValue,
- BindingElement newValue) {
+ public void updateConflictsFor(BindingElement oldValue, BindingElement newValue) {
updateConflictsFor(oldValue, newValue, false);
}
@@ -102,15 +98,12 @@ public class ConflictModel extends CommonModel {
updateConflictsFor(null, source, removal);
}
- private void updateConflictsFor(BindingElement oldValue,
- BindingElement newValue, boolean removal) {
- updateConflictsFor(newValue, oldValue == null ? null : oldValue
- .getTrigger(), newValue == null ? null : newValue.getTrigger(),
- removal);
+ private void updateConflictsFor(BindingElement oldValue, BindingElement newValue, boolean removal) {
+ updateConflictsFor(newValue, oldValue == null ? null : oldValue.getTrigger(),
+ newValue == null ? null : newValue.getTrigger(), removal);
}
- public void updateConflictsFor(BindingElement newValue,
- TriggerSequence oldTrigger, TriggerSequence newTrigger,
+ public void updateConflictsFor(BindingElement newValue, TriggerSequence oldTrigger, TriggerSequence newTrigger,
boolean removal) {
Collection matches = (Collection) conflictsMap.get(newValue);
if (matches != null) {
@@ -119,12 +112,10 @@ public class ConflictModel extends CommonModel {
matches.remove(newValue);
conflictsMap.remove(newValue);
if (matches == conflicts) {
- controller.firePropertyChange(this, PROP_CONFLICTS_REMOVE,
- null, newValue);
+ controller.firePropertyChange(this, PROP_CONFLICTS_REMOVE, null, newValue);
}
if (matches.size() == 1) {
- BindingElement tbe = (BindingElement) matches.iterator()
- .next();
+ BindingElement tbe = (BindingElement) matches.iterator().next();
conflictsMap.remove(tbe);
tbe.setConflict(Boolean.FALSE);
if (matches == conflicts) {
@@ -138,12 +129,10 @@ public class ConflictModel extends CommonModel {
conflictsMap.remove(newValue);
if (matches == conflicts) {
- controller.firePropertyChange(this, PROP_CONFLICTS_REMOVE,
- null, newValue);
+ controller.firePropertyChange(this, PROP_CONFLICTS_REMOVE, null, newValue);
}
if (matches.size() == 1) {
- BindingElement tbe = (BindingElement) matches.iterator()
- .next();
+ BindingElement tbe = (BindingElement) matches.iterator().next();
conflictsMap.remove(tbe);
tbe.setConflict(Boolean.FALSE);
if (matches == conflicts) {
@@ -155,23 +144,20 @@ public class ConflictModel extends CommonModel {
}
}
- if (newValue.getTrigger() == null
- || !(newValue.getModelObject() instanceof Binding)) {
+ if (newValue.getTrigger() == null || !(newValue.getModelObject() instanceof Binding)) {
return;
}
Binding binding = (Binding) newValue.getModelObject();
TriggerSequence trigger = binding.getTriggerSequence();
- matches = (Collection) bindingManager
- .getActiveBindingsDisregardingContext().get(trigger);
+ matches = (Collection) bindingManager.getActiveBindingsDisregardingContext().get(trigger);
ArrayList localConflicts = new ArrayList();
if (matches != null) {
localConflicts.add(newValue);
Iterator i = matches.iterator();
while (i.hasNext()) {
Binding b = (Binding) i.next();
- if (binding != b
- && b.getContextId().equals(binding.getContextId())
+ if (binding != b && b.getContextId().equals(binding.getContextId())
&& b.getSchemeId().equals(binding.getSchemeId())) {
Object element = bindingModel.getBindingToElement().get(b);
if (element != null) {
@@ -194,8 +180,7 @@ public class ConflictModel extends CommonModel {
conflictsMap.put(newValue, knownConflicts);
newValue.setConflict(Boolean.TRUE);
if (knownConflicts == conflicts) {
- controller.firePropertyChange(this, PROP_CONFLICTS_ADD,
- null, newValue);
+ controller.firePropertyChange(this, PROP_CONFLICTS_ADD, null, newValue);
} else if (newValue == getSelectedElement()) {
setConflicts(knownConflicts);
}
@@ -232,21 +217,15 @@ public class ConflictModel extends CommonModel {
}
controller.addPropertyChangeListener(event -> {
if (event.getSource() == ConflictModel.this
- && CommonModel.PROP_SELECTED_ELEMENT.equals(event
- .getProperty())) {
+ && CommonModel.PROP_SELECTED_ELEMENT.equals(event.getProperty())) {
if (event.getNewValue() != null) {
- updateConflictsFor(
- (BindingElement) event.getOldValue(),
- (BindingElement) event.getNewValue());
- setConflicts((Collection) conflictsMap.get(event
- .getNewValue()));
+ updateConflictsFor((BindingElement) event.getOldValue(), (BindingElement) event.getNewValue());
+ setConflicts((Collection) conflictsMap.get(event.getNewValue()));
} else {
setConflicts(null);
}
- } else if (BindingModel.PROP_BINDING_REMOVE.equals(event
- .getProperty())) {
- updateConflictsFor((BindingElement) event.getOldValue(),
- (BindingElement) event.getNewValue(), true);
+ } else if (BindingModel.PROP_BINDING_REMOVE.equals(event.getProperty())) {
+ updateConflictsFor((BindingElement) event.getOldValue(), (BindingElement) event.getNewValue(), true);
}
});
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/ContextModel.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/ContextModel.java
index cc86e595748..d675ed9e72c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/ContextModel.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/ContextModel.java
@@ -49,8 +49,7 @@ public class ContextModel extends CommonModel {
* @param locator
*/
public void init(IServiceLocator locator) {
- contextService = locator
- .getService(IContextService.class);
+ contextService = locator.getService(IContextService.class);
contexts = new ArrayList();
contextIdToFilteredContexts = new HashMap();
contextIdToElement = new HashMap();
@@ -73,8 +72,7 @@ public class ContextModel extends CommonModel {
}
/**
- * @param contexts
- * The contexts to set.
+ * @param contexts The contexts to set.
*/
public void setContexts(List contexts) {
List old = this.contexts;
@@ -90,24 +88,20 @@ public class ContextModel extends CommonModel {
}
/**
- * @param contextToElement
- * The contextToElement to set.
+ * @param contextToElement The contextToElement to set.
*/
public void setContextIdToElement(Map contextToElement) {
Map old = this.contextIdToElement;
this.contextIdToElement = contextToElement;
- controller.firePropertyChange(this, PROP_CONTEXT_MAP, old,
- contextToElement);
+ controller.firePropertyChange(this, PROP_CONTEXT_MAP, old, contextToElement);
}
/**
- * Removes any contexts according to the parameters. The contexts are stored
- * in a {@link List} to they can be easily restored.
+ * Removes any contexts according to the parameters. The contexts are stored in
+ * a {@link List} to they can be easily restored.
*
- * @param actionSets
- * <code>true</code> to filter action set contexts.
- * @param internal
- * <code>true</code> to filter internal contexts
+ * @param actionSets <code>true</code> to filter action set contexts.
+ * @param internal <code>true</code> to filter internal contexts
*/
public void filterContexts(boolean actionSets, boolean internal) {
// Remove undesired contexts
@@ -115,35 +109,29 @@ public class ContextModel extends CommonModel {
boolean removeContext = false;
ContextElement contextElement = (ContextElement) contexts.get(i);
- if (actionSets == true
- && contextElement.getId().equalsIgnoreCase(
- CONTEXT_ID_ACTION_SETS)) {
+ if (actionSets == true && contextElement.getId().equalsIgnoreCase(CONTEXT_ID_ACTION_SETS)) {
removeContext = true;
} else {
String parentId;
try {
- parentId = ((Context) contextElement.getModelObject())
- .getParentId();
+ parentId = ((Context) contextElement.getModelObject()).getParentId();
while (parentId != null) {
if (parentId.equalsIgnoreCase(CONTEXT_ID_ACTION_SETS)) {
removeContext = true;
}
- parentId = contextService.getContext(parentId)
- .getParentId();
+ parentId = contextService.getContext(parentId).getParentId();
}
} catch (NotDefinedException e) {
// No parentId to check
}
}
- if (internal == true
- && contextElement.getId().indexOf(CONTEXT_ID_INTERNAL) != -1) {
+ if (internal == true && contextElement.getId().indexOf(CONTEXT_ID_INTERNAL) != -1) {
removeContext = true;
}
if (removeContext) {
- contextIdToFilteredContexts.put(contextElement.getId(),
- contextElement);
+ contextIdToFilteredContexts.put(contextElement.getId(), contextElement);
contextIdToElement.remove(contextElement);
}
}
@@ -154,8 +142,7 @@ public class ContextModel extends CommonModel {
// Restore desired contexts
while (iterator.hasNext()) {
boolean restoreContext = false;
- ContextElement contextElement = (ContextElement) contextIdToFilteredContexts
- .get(iterator.next());
+ ContextElement contextElement = (ContextElement) contextIdToFilteredContexts.get(iterator.next());
try {
if (actionSets == false) {
@@ -171,8 +158,7 @@ public class ContextModel extends CommonModel {
} catch (NotDefinedException e) {
// No parentId to check
}
- if (internal == false
- && contextElement.getId().indexOf(CONTEXT_ID_INTERNAL) != -1) {
+ if (internal == false && contextElement.getId().indexOf(CONTEXT_ID_INTERNAL) != -1) {
restoreContext = true;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/KeyController.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/KeyController.java
index fc70e427d79..d53d4f58692 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/KeyController.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/KeyController.java
@@ -66,8 +66,7 @@ public class KeyController {
/**
* The resource bundle from which translations can be retrieved.
*/
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
- .getBundle(KeysPreferencePage.class.getName());
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(KeysPreferencePage.class.getName());
private ListenerList<IPropertyChangeListener> eventManager = null;
private BindingManager fBindingManager;
private ContextModel contextModel;
@@ -92,8 +91,7 @@ public class KeyController {
return notifying;
}
- public void firePropertyChange(Object source, String propId, Object oldVal,
- Object newVal) {
+ public void firePropertyChange(Object source, String propId, Object oldVal, Object newVal) {
if (!isNotifying()) {
return;
}
@@ -101,8 +99,7 @@ public class KeyController {
return;
}
- PropertyChangeEvent event = new PropertyChangeEvent(source, propId,
- oldVal, newVal);
+ PropertyChangeEvent event = new PropertyChangeEvent(source, propId, oldVal, newVal);
for (IPropertyChangeListener listener : getEventManager()) {
listener.propertyChange(event);
}
@@ -137,10 +134,8 @@ public class KeyController {
}
private static BindingManager loadModelBackend(IServiceLocator locator) {
- IBindingService bindingService = locator
- .getService(IBindingService.class);
- BindingManager bindingManager = new BindingManager(
- new ContextManager(), new CommandManager());
+ IBindingService bindingService = locator.getService(IBindingService.class);
+ BindingManager bindingManager = new BindingManager(new ContextManager(), new CommandManager());
final Scheme[] definedSchemes = bindingService.getDefinedSchemes();
try {
Scheme modelActiveScheme = null;
@@ -153,17 +148,15 @@ public class KeyController {
}
bindingManager.setActiveScheme(modelActiveScheme);
} catch (final NotDefinedException e) {
- StatusManager.getManager().handle(
- new Status(IStatus.WARNING, WorkbenchPlugin.PI_WORKBENCH,
- "Keys page found an undefined scheme", e)); //$NON-NLS-1$
+ StatusManager.getManager().handle(new Status(IStatus.WARNING, WorkbenchPlugin.PI_WORKBENCH,
+ "Keys page found an undefined scheme", e)); //$NON-NLS-1$
}
bindingManager.setLocale(bindingService.getLocale());
bindingManager.setPlatform(bindingService.getPlatform());
Set<Binding> bindings = new HashSet<>();
- EBindingService eBindingService = locator
- .getService(EBindingService.class);
+ EBindingService eBindingService = locator.getService(EBindingService.class);
bindings.addAll(eBindingService.getActiveBindings());
for (Binding binding : bindingService.getBindings()) {
bindings.add(binding);
@@ -192,9 +185,7 @@ public class KeyController {
private void addSetContextListener() {
addPropertyChangeListener(event -> {
- if (event.getSource() == contextModel
- && CommonModel.PROP_SELECTED_ELEMENT.equals(event
- .getProperty())) {
+ if (event.getSource() == contextModel && CommonModel.PROP_SELECTED_ELEMENT.equals(event.getProperty())) {
updateBindingContext((ContextElement) event.getNewValue());
}
});
@@ -202,11 +193,8 @@ public class KeyController {
private void addSetBindingListener() {
addPropertyChangeListener(event -> {
- if (event.getSource() == bindingModel
- && CommonModel.PROP_SELECTED_ELEMENT.equals(event
- .getProperty())) {
- BindingElement binding = (BindingElement) event
- .getNewValue();
+ if (event.getSource() == bindingModel && CommonModel.PROP_SELECTED_ELEMENT.equals(event.getProperty())) {
+ BindingElement binding = (BindingElement) event.getNewValue();
if (binding == null) {
conflictModel.setSelectedElement(null);
return;
@@ -222,12 +210,9 @@ public class KeyController {
private void addSetConflictListener() {
addPropertyChangeListener(event -> {
- if (event.getSource() == conflictModel
- && CommonModel.PROP_SELECTED_ELEMENT.equals(event
- .getProperty())) {
+ if (event.getSource() == conflictModel && CommonModel.PROP_SELECTED_ELEMENT.equals(event.getProperty())) {
if (event.getNewValue() != null) {
- bindingModel.setSelectedElement((ModelElement) event
- .getNewValue());
+ bindingModel.setSelectedElement((ModelElement) event.getNewValue());
}
}
});
@@ -236,8 +221,7 @@ public class KeyController {
private void addSetKeySequenceListener() {
addPropertyChangeListener(event -> {
if (BindingElement.PROP_TRIGGER.equals(event.getProperty())) {
- updateTrigger((BindingElement) event.getSource(),
- (KeySequence) event.getOldValue(),
+ updateTrigger((BindingElement) event.getSource(), (KeySequence) event.getOldValue(),
(KeySequence) event.getNewValue());
}
});
@@ -246,19 +230,14 @@ public class KeyController {
private void addSetModelObjectListener() {
addPropertyChangeListener(event -> {
if (event.getSource() instanceof BindingElement
- && ModelElement.PROP_MODEL_OBJECT.equals(event
- .getProperty())) {
+ && ModelElement.PROP_MODEL_OBJECT.equals(event.getProperty())) {
if (event.getNewValue() != null) {
- BindingElement element = (BindingElement) event
- .getSource();
+ BindingElement element = (BindingElement) event.getSource();
Object oldValue = event.getOldValue();
Object newValue = event.getNewValue();
- if (oldValue instanceof Binding
- && newValue instanceof Binding) {
- conflictModel.updateConflictsFor(element,
- ((Binding) oldValue).getTriggerSequence(),
- ((Binding) newValue).getTriggerSequence(),
- false);
+ if (oldValue instanceof Binding && newValue instanceof Binding) {
+ conflictModel.updateConflictsFor(element, ((Binding) oldValue).getTriggerSequence(),
+ ((Binding) newValue).getTriggerSequence(), false);
} else {
conflictModel.updateConflictsFor(element, false);
}
@@ -274,11 +253,8 @@ public class KeyController {
private void addSetSchemeListener() {
addPropertyChangeListener(event -> {
- if (event.getSource() == fSchemeModel
- && CommonModel.PROP_SELECTED_ELEMENT.equals(event
- .getProperty())) {
- changeScheme((SchemeElement) event.getOldValue(),
- (SchemeElement) event.getNewValue());
+ if (event.getSource() == fSchemeModel && CommonModel.PROP_SELECTED_ELEMENT.equals(event.getProperty())) {
+ changeScheme((SchemeElement) event.getOldValue(), (SchemeElement) event.getNewValue());
}
});
}
@@ -288,14 +264,11 @@ public class KeyController {
* @param newScheme
*/
protected void changeScheme(SchemeElement oldScheme, SchemeElement newScheme) {
- if (newScheme == null
- || newScheme.getModelObject() == fBindingManager
- .getActiveScheme()) {
+ if (newScheme == null || newScheme.getModelObject() == fBindingManager.getActiveScheme()) {
return;
}
try {
- fBindingManager
- .setActiveScheme((Scheme) newScheme.getModelObject());
+ fBindingManager.setActiveScheme((Scheme) newScheme.getModelObject());
bindingModel.refresh(contextModel);
bindingModel.setSelectedElement(null);
} catch (NotDefinedException e) {
@@ -308,8 +281,7 @@ public class KeyController {
if (context == null) {
return;
}
- BindingElement activeBinding = (BindingElement) bindingModel
- .getSelectedElement();
+ BindingElement activeBinding = (BindingElement) bindingModel.getSelectedElement();
if (activeBinding == null) {
return;
}
@@ -318,20 +290,16 @@ public class KeyController {
if (obj instanceof KeyBinding) {
KeyBinding keyBinding = (KeyBinding) obj;
if (!keyBinding.getContextId().equals(context.getId())) {
- final KeyBinding binding = new KeyBinding(keyBinding
- .getKeySequence(),
- keyBinding.getParameterizedCommand(), activeSchemeId,
- context.getId(), null, null, null, Binding.USER);
+ final KeyBinding binding = new KeyBinding(keyBinding.getKeySequence(),
+ keyBinding.getParameterizedCommand(), activeSchemeId, context.getId(), null, null, null,
+ Binding.USER);
if (keyBinding.getType() == Binding.USER) {
fBindingManager.removeBinding(keyBinding);
} else {
- fBindingManager.addBinding(new KeyBinding(keyBinding
- .getKeySequence(), null, keyBinding.getSchemeId(),
- keyBinding.getContextId(), null, null, null,
- Binding.USER));
+ fBindingManager.addBinding(new KeyBinding(keyBinding.getKeySequence(), null,
+ keyBinding.getSchemeId(), keyBinding.getContextId(), null, null, null, Binding.USER));
}
- bindingModel.getBindingToElement().remove(
- activeBinding.getModelObject());
+ bindingModel.getBindingToElement().remove(activeBinding.getModelObject());
fBindingManager.addBinding(binding);
activeBinding.fill(binding, contextModel);
@@ -345,8 +313,7 @@ public class KeyController {
* @param oldSequence
* @param keySequence
*/
- public void updateTrigger(BindingElement activeBinding,
- KeySequence oldSequence, KeySequence keySequence) {
+ public void updateTrigger(BindingElement activeBinding, KeySequence oldSequence, KeySequence keySequence) {
if (activeBinding == null) {
return;
}
@@ -355,31 +322,24 @@ public class KeyController {
KeyBinding keyBinding = (KeyBinding) obj;
if (!keyBinding.getKeySequence().equals(keySequence)) {
if (keySequence != null && !keySequence.isEmpty()) {
- String activeSchemeId = fSchemeModel.getSelectedElement()
- .getId();
- ModelElement selectedElement = contextModel
- .getSelectedElement();
+ String activeSchemeId = fSchemeModel.getSelectedElement().getId();
+ ModelElement selectedElement = contextModel.getSelectedElement();
String activeContextId = selectedElement == null ? IContextService.CONTEXT_ID_WINDOW
: selectedElement.getId();
- final KeyBinding binding = new KeyBinding(keySequence,
- keyBinding.getParameterizedCommand(),
- activeSchemeId, activeContextId, null, null, null,
- Binding.USER);
+ final KeyBinding binding = new KeyBinding(keySequence, keyBinding.getParameterizedCommand(),
+ activeSchemeId, activeContextId, null, null, null, Binding.USER);
Map bindingToElement = bindingModel.getBindingToElement();
bindingToElement.remove(keyBinding);
if (keyBinding.getType() == Binding.USER) {
fBindingManager.removeBinding(keyBinding);
} else {
- fBindingManager.addBinding(new KeyBinding(keyBinding
- .getKeySequence(), null, keyBinding
- .getSchemeId(), keyBinding.getContextId(),
- null, null, null, Binding.USER));
+ fBindingManager.addBinding(new KeyBinding(keyBinding.getKeySequence(), null,
+ keyBinding.getSchemeId(), keyBinding.getContextId(), null, null, null, Binding.USER));
}
fBindingManager.addBinding(binding);
activeBinding.fill(binding, contextModel);
- bindingModel.getBindingToElement().put(binding,
- activeBinding);
+ bindingModel.getBindingToElement().put(binding, activeBinding);
// Remove binding for any system conflicts
@@ -389,10 +349,8 @@ public class KeyController {
if (keyBinding.getType() == Binding.USER) {
fBindingManager.removeBinding(keyBinding);
} else {
- fBindingManager.addBinding(new KeyBinding(keyBinding
- .getKeySequence(), null, keyBinding
- .getSchemeId(), keyBinding.getContextId(),
- null, null, null, Binding.USER));
+ fBindingManager.addBinding(new KeyBinding(keyBinding.getKeySequence(), null,
+ keyBinding.getSchemeId(), keyBinding.getContextId(), null, null, null, Binding.USER));
}
activeBinding.fill(keyBinding.getParameterizedCommand());
}
@@ -400,15 +358,12 @@ public class KeyController {
} else if (obj instanceof ParameterizedCommand) {
ParameterizedCommand cmd = (ParameterizedCommand) obj;
if (keySequence != null && !keySequence.isEmpty()) {
- String activeSchemeId = fSchemeModel.getSelectedElement()
- .getId();
- ModelElement selectedElement = contextModel
- .getSelectedElement();
+ String activeSchemeId = fSchemeModel.getSelectedElement().getId();
+ ModelElement selectedElement = contextModel.getSelectedElement();
String activeContextId = selectedElement == null ? IContextService.CONTEXT_ID_WINDOW
: selectedElement.getId();
- final KeyBinding binding = new KeyBinding(keySequence, cmd,
- activeSchemeId, activeContextId, null, null, null,
- Binding.USER);
+ final KeyBinding binding = new KeyBinding(keySequence, cmd, activeSchemeId, activeContextId, null, null,
+ null, Binding.USER);
fBindingManager.addBinding(binding);
activeBinding.fill(binding, contextModel);
bindingModel.getBindingToElement().put(binding, activeBinding);
@@ -417,17 +372,15 @@ public class KeyController {
}
/**
- * Replaces all the current bindings with the bindings in the local copy of
- * the binding manager.
+ * Replaces all the current bindings with the bindings in the local copy of the
+ * binding manager.
*
- * @param bindingService
- * The binding service that saves the changes made to the local
- * copy of the binding manager
+ * @param bindingService The binding service that saves the changes made to the
+ * local copy of the binding manager
*/
public void saveBindings(IBindingService bindingService) {
try {
- bindingService.savePreferences(fBindingManager.getActiveScheme(),
- fBindingManager.getBindings());
+ bindingService.savePreferences(fBindingManager.getActiveScheme(), fBindingManager.getBindings());
} catch (IOException e) {
logPreferenceStoreException(e);
}
@@ -438,8 +391,7 @@ public class KeyController {
* went wrong. The exception is assumed to have something to do with the
* preference store.
*
- * @param exception
- * The exception to be logged; must not be <code>null</code>.
+ * @param exception The exception to be logged; must not be <code>null</code>.
*/
private final void logPreferenceStoreException(final Throwable exception) {
final String message = NewKeysPreferenceMessages.PreferenceStoreError_Message;
@@ -447,8 +399,7 @@ public class KeyController {
if (exceptionMessage == null) {
exceptionMessage = message;
}
- final IStatus status = new Status(IStatus.ERROR,
- WorkbenchPlugin.PI_WORKBENCH, 0, exceptionMessage, exception);
+ final IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 0, exceptionMessage, exception);
WorkbenchPlugin.log(message, status);
StatusUtil.handleStatus(message, exception, StatusManager.SHOW);
}
@@ -456,10 +407,8 @@ public class KeyController {
/**
* Filters contexts for the When Combo.
*
- * @param actionSets
- * <code>true</code> to filter action set contexts
- * @param internal
- * <code>false</code> to filter internal contexts
+ * @param actionSets <code>true</code> to filter action set contexts
+ * @param internal <code>false</code> to filter internal contexts
*
*/
public void filterContexts(boolean actionSets, boolean internal) {
@@ -493,11 +442,9 @@ public class KeyController {
}
public void exportCSV(Shell shell) {
- final FileDialog fileDialog = new FileDialog(shell, SWT.SAVE
- | SWT.SHEET);
+ final FileDialog fileDialog = new FileDialog(shell, SWT.SAVE | SWT.SHEET);
fileDialog.setFilterExtensions(new String[] { "*.csv" }); //$NON-NLS-1$
- fileDialog.setFilterNames(new String[] { Util.translateString(
- RESOURCE_BUNDLE, "csvFilterName") }); //$NON-NLS-1$
+ fileDialog.setFilterNames(new String[] { Util.translateString(RESOURCE_BUNDLE, "csvFilterName") }); //$NON-NLS-1$
fileDialog.setOverwrite(true);
final String filePath = fileDialog.open();
if (filePath == null) {
@@ -513,21 +460,15 @@ public class KeyController {
final Object[] bindingElements = bindingModel.getBindings().toArray();
for (Object bindingElement : bindingElements) {
final BindingElement be = (BindingElement) bindingElement;
- if (be.getTrigger() == null
- || be.getTrigger().isEmpty()) {
+ if (be.getTrigger() == null || be.getTrigger().isEmpty()) {
continue;
}
StringBuilder buffer = new StringBuilder();
- buffer.append(ESCAPED_QUOTE
- + Util.replaceAll(be.getCategory(),
- ESCAPED_QUOTE, REPLACEMENT)
- + ESCAPED_QUOTE + DELIMITER);
- buffer.append(ESCAPED_QUOTE + be.getName()
- + ESCAPED_QUOTE + DELIMITER);
- buffer.append(ESCAPED_QUOTE + be.getTrigger().format()
- + ESCAPED_QUOTE + DELIMITER);
- buffer.append(ESCAPED_QUOTE + be.getContext().getName()
+ buffer.append(ESCAPED_QUOTE + Util.replaceAll(be.getCategory(), ESCAPED_QUOTE, REPLACEMENT)
+ ESCAPED_QUOTE + DELIMITER);
+ buffer.append(ESCAPED_QUOTE + be.getName() + ESCAPED_QUOTE + DELIMITER);
+ buffer.append(ESCAPED_QUOTE + be.getTrigger().format() + ESCAPED_QUOTE + DELIMITER);
+ buffer.append(ESCAPED_QUOTE + be.getContext().getName() + ESCAPED_QUOTE + DELIMITER);
buffer.append(ESCAPED_QUOTE + be.getId() + ESCAPED_QUOTE);
buffer.append(System.getProperty("line.separator")); //$NON-NLS-1$
fileWriter.write(buffer.toString());
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/SchemeModel.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/SchemeModel.java
index 66a89685644..1b9a38c1e63 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/SchemeModel.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/SchemeModel.java
@@ -59,8 +59,7 @@ public class SchemeModel extends CommonModel {
}
/**
- * @param schemes
- * The schemes to set.
+ * @param schemes The schemes to set.
*/
public void setSchemes(List schemes) {
List old = this.schemes;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/CacheWrapper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/CacheWrapper.java
index c877d56a51a..83e68f4d61f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/CacheWrapper.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/CacheWrapper.java
@@ -23,22 +23,22 @@ import org.eclipse.swt.widgets.Layout;
/**
* This class wraps a control with a complex computeSize method. It uses caching
- * to reduce the number of times the control's computeSize method is called. This
- * allows controls (such as Coolbars and wrapping text) with slow computeSize
- * operations to be used inside layouts and composites that use inefficient caching.
+ * to reduce the number of times the control's computeSize method is called.
+ * This allows controls (such as Coolbars and wrapping text) with slow
+ * computeSize operations to be used inside layouts and composites that use
+ * inefficient caching.
* <p>
- * For example, you want to use Coolbar A inside composite B. Rather than making A
- * a direct child of B, place it inside a CacheWrapper and insert the CacheWrapper
- * into B. Any layout data that would normally be attached to the control itself
- * should be attached to the wrapper instead:
+ * For example, you want to use Coolbar A inside composite B. Rather than making
+ * A a direct child of B, place it inside a CacheWrapper and insert the
+ * CacheWrapper into B. Any layout data that would normally be attached to the
+ * control itself should be attached to the wrapper instead:
* </p>
* <code>
*
* // Unoptimized code
* Toolbar myToolbar = new Toolbar(someParent, SWT.WRAP);
* myToolbar.setLayoutData(someLayoutData);
- * </code>
- * <code>
+ * </code> <code>
*
* // Optimized code
* CacheWrapper myWrapper = new CacheWrapper(someParent);
@@ -46,95 +46,95 @@ import org.eclipse.swt.widgets.Layout;
* myWrapper.getControl().setLayoutData(someLayoutData);
* </code>
* <p>
- * CacheWrapper creates a Composite which should have exactly one child: the control
- * whose size should be cached. Note that CacheWrapper does NOT respect the flushCache
- * argument to layout() and computeSize(). This is intentional, since the whole point of
- * this class is to workaround layouts with poor caching, and such layouts will typically
- * be too eager about flushing the caches of their children. However, this means that you
- * MUST manually call flushCache() whenver the child's preferred size changes (and before
- * the parent is layed out).
+ * CacheWrapper creates a Composite which should have exactly one child: the
+ * control whose size should be cached. Note that CacheWrapper does NOT respect
+ * the flushCache argument to layout() and computeSize(). This is intentional,
+ * since the whole point of this class is to workaround layouts with poor
+ * caching, and such layouts will typically be too eager about flushing the
+ * caches of their children. However, this means that you MUST manually call
+ * flushCache() whenver the child's preferred size changes (and before the
+ * parent is layed out).
* </p>
*
* @since 3.0
*/
public class CacheWrapper {
- private Composite proxy;
+ private Composite proxy;
- private SizeCache cache = new SizeCache();
+ private SizeCache cache = new SizeCache();
- private Rectangle lastBounds = new Rectangle(0, 0, 0, 0);
+ private Rectangle lastBounds = new Rectangle(0, 0, 0, 0);
- private class WrapperLayout extends Layout implements ICachingLayout {
- @Override
- protected Point computeSize(Composite composite, int wHint, int hHint,
- boolean flushCache) {
- Control[] children = composite.getChildren();
- if (children.length != 1) {
- return new Point(0, 0);
- }
+ private class WrapperLayout extends Layout implements ICachingLayout {
+ @Override
+ protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) {
+ Control[] children = composite.getChildren();
+ if (children.length != 1) {
+ return new Point(0, 0);
+ }
- cache.setControl(children[0]);
+ cache.setControl(children[0]);
- return cache.computeSize(wHint, hHint);
- }
+ return cache.computeSize(wHint, hHint);
+ }
- @Override
+ @Override
protected void layout(Composite composite, boolean flushCache) {
- Control[] children = composite.getChildren();
- if (children.length != 1) {
- return;
- }
+ Control[] children = composite.getChildren();
+ if (children.length != 1) {
+ return;
+ }
- Control child = children[0];
- Rectangle newBounds = composite.getClientArea();
- if (!newBounds.equals(lastBounds)) {
- child.setBounds(newBounds);
- lastBounds = newBounds;
- }
+ Control child = children[0];
+ Rectangle newBounds = composite.getClientArea();
+ if (!newBounds.equals(lastBounds)) {
+ child.setBounds(newBounds);
+ lastBounds = newBounds;
+ }
- }
+ }
- @Override
+ @Override
public void flush(Control dirtyControl) {
- CacheWrapper.this.flushCache();
- }
- }
-
- /**
- * Creates a <code>CacheWrapper</code> with the given parent
- *
- * @param parent
- */
- public CacheWrapper(Composite parent) {
- proxy = new Composite(parent, SWT.NONE);
-
- proxy.setLayout(new WrapperLayout());
- }
-
- /**
- * Flush the cache. Call this when the child has changed in order to force
- * the size to be recomputed in the next resize event.
- */
- public void flushCache() {
- cache.flush();
- }
-
- /**
- * Use this as the parent of the real control.
- *
- * @return the proxy contol. It should be given exactly one child.
- */
- public Composite getControl() {
- return proxy;
- }
-
- /**
- * Dispose of any widgets created by this wrapper.
- */
- public void dispose() {
- if (proxy != null) {
- proxy.dispose();
- proxy = null;
- }
- }
+ CacheWrapper.this.flushCache();
+ }
+ }
+
+ /**
+ * Creates a <code>CacheWrapper</code> with the given parent
+ *
+ * @param parent
+ */
+ public CacheWrapper(Composite parent) {
+ proxy = new Composite(parent, SWT.NONE);
+
+ proxy.setLayout(new WrapperLayout());
+ }
+
+ /**
+ * Flush the cache. Call this when the child has changed in order to force the
+ * size to be recomputed in the next resize event.
+ */
+ public void flushCache() {
+ cache.flush();
+ }
+
+ /**
+ * Use this as the parent of the real control.
+ *
+ * @return the proxy contol. It should be given exactly one child.
+ */
+ public Composite getControl() {
+ return proxy;
+ }
+
+ /**
+ * Dispose of any widgets created by this wrapper.
+ */
+ public void dispose() {
+ if (proxy != null) {
+ proxy.dispose();
+ proxy = null;
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/CellData.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/CellData.java
index 2ae5f549746..ed7762073c9 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/CellData.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/CellData.java
@@ -21,533 +21,540 @@ import org.eclipse.swt.layout.GridData;
/**
* <code>CellData</code> is the layout data object associated with
- * <code>CellLayout</code>. You can attach a CellData object to a
- * control by using the <code>setLayoutData</code> method. CellData
- * objects are optional. If you do not attach any layout data to a control,
- * it will behave just like attaching a CellData created using its default
- * constructor.
+ * <code>CellLayout</code>. You can attach a CellData object to a control by
+ * using the <code>setLayoutData</code> method. CellData objects are optional.
+ * If you do not attach any layout data to a control, it will behave just like
+ * attaching a CellData created using its default constructor.
*
* @since 3.0
**/
public final class CellData {
- /**
- * hintType flag (value = 0) indicating that the control's computeSize method should be used
- * to determine the control size. If modifierType is set to NONE, then the widthHint
- * and heightHint fields will be ignored.
- */
- public static final int NONE = 0;
-
- /**
- * hintType flag (value = 1) indicating that the widthHint and heightHint should be used
- * as the control's size instead of the result of computeSize
- * <p>
- * This flag is useful for list boxes, text boxes, tree controls, and other controls
- * whose contents can change dynamically. For example, create a tree control and set
- * its width and height hints to the default size for that control. This will cause
- * the hints to be used instead of the preferred size of the tree control.</p>
- */
- public static final int OVERRIDE = 1;
-
- /**
- * hintType(value = 2) indicating that the width of the control should be no less than
- * widthHint (if provided) and the height of the control should be no less
- * than heightHint (if provided).
- * <p>
- * This flag is useful for buttons. For example, set the width and height hints to
- * the default button size. This will use the default button size unless the button
- * label is too large to fit on the button.
- * </p>
- */
- public static final int MINIMUM = 2;
-
- /**
- * hintType flag (value = 3) indicating that the width of the control should be no more than
- * widthHint (if provided) and the height of the control should be no more
- * than heightHint (if provided).
- * <p>
- * This flag is useful for wrapping text. For example, set heightHint to SWT.DEFAULT
- * and set widthHint to the desired number of pixels after which text should wrap. This
- * will cause the text to wrap after the given number of pixels, but will not allocate
- * extra space in the column if the text widget does not fill an entire line.
- * </p>
- */
- public static final int MAXIMUM = 3;
-
- /**
- * This flag controls how the width and height hints are to be treated. See the constants
- * above.
- */
- public int hintType = OVERRIDE;
-
- /**
- * Width hint. This modifies the width of the control, in pixels. If set to SWT.DEFAULT,
- * this dimension will not be constrained. Depending on the value of modifierType,
- * this may be a minimum size, a maximum size, or simply replace the preferred control
- * size.
- */
- public int widthHint = SWT.DEFAULT;
-
- /**
- * Height hint. This modifies the height of the control, in pixels. If set to SWT.DEFAULT,
- * this dimension will not be constrained. Depending on the value of modifierType,
- * this will be a minimum size, a maximum size, or a replacement for the control's preferred
- * size.
- */
- public int heightHint = SWT.DEFAULT;
-
- /**
- * Number of rows spanned by this cell (default = 1)
- */
- public int verticalSpan = 1;
-
- /**
- * Number of columns spanned by this cell (default = 1)
- */
- public int horizontalSpan = 1;
-
- /**
- * Horizontal alignment of the control within the cell. May be one
- * of SWT.LEFT, SWT.RIGHT, SWT.CENTER, or SWT.NORMAL. SWT.NORMAL indicates
- * that the control should be made as wide as the cell.
- */
- public int horizontalAlignment = SWT.FILL;
-
- /**
- * Vertical alignment of the control within the cell. May be one of
- * SWT.TOP, SWT.BOTTOM, SWT.CENTER, or SWT.NORMAL. SWT.NORMAL indicates
- * that the control should be made as wide as the cell.
- */
- public int verticalAlignment = SWT.FILL;
-
- /**
- * Horizontal indentation (pixels). Positive values move the control
- * to the right, negative to the left.
- */
- public int horizontalIndent = 0;
-
- /**
- * Vertical indentation (pixels). Positive values move the control
- * down, negative values move the control up.
- */
- public int verticalIndent = 0;
-
- /**
- * Constructs a CellData with default properties
- */
- public CellData() {
- // Use the default values for all fields.
- }
-
- /**
- * Creates a new CellData that with properties that are as close as possible to
- * the given GridData. This is used for converting GridLayouts into CellLayouts.
- *
- * @param data
- */
- public CellData(GridData data) {
- verticalSpan = data.verticalSpan;
- horizontalSpan = data.horizontalSpan;
-
- switch (data.horizontalAlignment) {
- case GridData.BEGINNING:
- horizontalAlignment = SWT.LEFT;
- break;
- case GridData.CENTER:
- horizontalAlignment = SWT.CENTER;
- break;
- case GridData.END:
- horizontalAlignment = SWT.RIGHT;
- break;
- case GridData.FILL:
- horizontalAlignment = SWT.FILL;
- break;
- }
-
- switch (data.verticalAlignment) {
- case GridData.BEGINNING:
- verticalAlignment = SWT.LEFT;
- break;
- case GridData.CENTER:
- verticalAlignment = SWT.CENTER;
- break;
- case GridData.END:
- verticalAlignment = SWT.RIGHT;
- break;
- case GridData.FILL:
- verticalAlignment = SWT.FILL;
- break;
- }
-
- widthHint = data.widthHint;
- heightHint = data.heightHint;
- horizontalIndent = data.horizontalIndent;
- hintType = OVERRIDE;
- }
-
- /**
- * Copies the given CellData
- *
- * @param newData
- */
- public CellData(CellData newData) {
- hintType = newData.hintType;
- widthHint = newData.widthHint;
- heightHint = newData.heightHint;
- horizontalAlignment = newData.horizontalAlignment;
- verticalAlignment = newData.verticalAlignment;
- horizontalSpan = newData.horizontalSpan;
- verticalSpan = newData.verticalSpan;
- }
-
- /**
- * Sets the size hint for this control. This is used to modify the control's
- * preferred size. If one dimension should remain unmodified, that hint can be
- * set to SWT.DEFAULT. Using a size hint of CellData.MINIMUM ensures that the preferred
- * control size is larger than the hint. Using a size hint of CellData.MAXIMUM ensures
- * that the preferred size is smaller than the hint. Using a size hint of CellData.OVERRIDE
- * ensures that the preferred size is always equal to the hint.
- *
- * @param hintType one of CellData.MINIMUM, CellData.MAXIMUM, or CellData.OVERRIDE
- * @param hint size hint (in pixels). If either dimension is set to SWT.DEFAULT, the
- * hint will not affect that dimension
- * @return this
- */
- public CellData setHint(int hintType, Point hint) {
- return setHint(hintType, hint.x, hint.y);
- }
-
- /**
- * Sets the size hint for this control. This is used to modify the control's
- * preferred size. If one dimension should remain unmodified, that hint can be
- * set to SWT.DEFAULT. Using a size hint of CellData.MINIMUM ensures that the preferred
- * control size is larger than the hint. Using a size hint of CellData.MAXIMUM ensures
- * that the preferred size is smaller than the hint. Using a size hint of CellData.OVERRIDE
- * ensures that the preferred size is always equal to the hint. If both hints are equal
- * to SWT.DEFAULT, then the control's preferred size is unmodified.
- *
- * @param hintType one of CellData.MINIMUM, CellData.MAXIMUM, or CellData.OVERRIDE
- * @param horizontal horizontal hint (pixels). A value of SWT.DEFAULT will leave the result
- * of the control's computeSize method unmodified.
- * @param vertical vertical hint (pixels). A value of SWT.DEFAULT will leave the result of
- * the control's computeSize method unmodified.
- * @return this
- */
- public CellData setHint(int hintType, int horizontal, int vertical) {
- this.hintType = hintType;
- this.heightHint = vertical;
- this.widthHint = horizontal;
-
- return this;
- }
-
- /**
- * Sets the alignment for this control
- *
- * @param horizontalAlignment one of SWT.LEFT, SWT.RIGHT, SWT.FILL, or SWT.CENTER
- * @param verticalAlignment one of SWT.TOP, SWT.BOTTOM, SWT.FILL, or SWT.CENTER
- * @return this
- */
- public CellData align(int horizontalAlignment, int verticalAlignment) {
- this.horizontalAlignment = horizontalAlignment;
- this.verticalAlignment = verticalAlignment;
-
- return this;
- }
-
- /**
- * Sets the number of rows and columns spanned by this control.
- *
- * @param horizontalSpan number of columns spanned by the control (> 0)
- * @param verticalSpan number of rows spanned by the control (> 0)
- * @return this
- */
- public CellData span(int horizontalSpan, int verticalSpan) {
- this.horizontalSpan = horizontalSpan;
- this.verticalSpan = verticalSpan;
-
- return this;
- }
-
- /**
- * Sets the indentation for this control. The indentation is added to
- * the control's position within the cell. For example, indentation of
- * (10,4) will move the control right by 10 pixels and down by 4 pixels.
- *
- * @param indent indentation (pixels)
- * @return this
- */
- public CellData indent(Point indent) {
- return this.indent(indent.x, indent.y);
- }
-
- /**
- * Sets the indentation for this cell
- *
- * @param horizontalIndent distance (pixels) to move the control to the right
- * @param verticalIndent distance (pixels) to move the control down
- * @return this
- */
- public CellData indent(int horizontalIndent, int verticalIndent) {
- this.horizontalIndent = horizontalIndent;
- this.verticalIndent = verticalIndent;
-
- return this;
- }
-
- /**
- * Returns the preferred size of the given control, given the known dimensions of
- * its cell.
- *
- * @param toCompute the control whose size is to be computed
- * @param cellWidth width of the cell, in pixels (or SWT.DEFAULT if unknown)
- * @param cellHeight height of the cell, in pixels (or SWT.DEFAULT if unknown)
- * @return the preferred size of the given control, in pixels
- */
- public Point computeSize(SizeCache toCompute, int cellWidth, int cellHeight) {
-
- int absHorizontalIndent = Math.abs(horizontalIndent);
- int absVerticalIndent = Math.abs(verticalIndent);
-
- // If we're going to indent, subtract off the space that will be required for indentation from
- // the available space
- if (cellWidth != SWT.DEFAULT) {
- cellWidth -= absHorizontalIndent;
- }
-
- if (cellHeight != SWT.DEFAULT) {
- cellHeight -= absVerticalIndent;
- }
-
- int controlWidth = horizontalAlignment == SWT.FILL ? cellWidth
- : SWT.DEFAULT;
- int controlHeight = verticalAlignment == SWT.FILL ? cellHeight
- : SWT.DEFAULT;
-
- // Note: this could be optimized further. If we're using a MAXIMUM hint and
- // non-FILL alignment, we could simply call computeMaximumBoundedSize using the
- // minimum of the cell size and the hint as the boundary -- basically, rather
- // than applying two limits for the hint and the cell boundary, we can do it in
- // one step and reduce the size computations by half (for this specific case).
- Point controlSize = computeControlSize(toCompute, controlWidth,
- controlHeight);
-
- if (cellWidth != SWT.DEFAULT && controlSize.x > cellWidth) {
- controlSize = computeControlSize(toCompute, cellWidth,
- controlHeight);
- if (cellHeight != SWT.DEFAULT && controlSize.y > cellHeight) {
- controlSize.y = cellHeight;
- }
- } else if (cellHeight != SWT.DEFAULT && controlSize.y > cellHeight) {
- controlSize = computeControlSize(toCompute, controlWidth,
- cellHeight);
- if (cellWidth != SWT.DEFAULT && controlSize.x > cellWidth) {
- controlSize.x = cellWidth;
- }
- }
-
- // If we're going to indent, add the indentation to the required space
- controlSize.x += absHorizontalIndent;
- controlSize.y += absVerticalIndent;
-
- return controlSize;
- }
-
- /**
- * Arranges the given control within the given rectangle using the
- * criteria described by this CellData.
- *
- * @param control
- * @param cellBounds
- * @since 3.0
- */
- public void positionControl(SizeCache cache, Rectangle cellBounds) {
-
- int startx = cellBounds.x;
- int starty = cellBounds.y;
- int availableWidth = cellBounds.width - horizontalIndent;
- int availableHeight = cellBounds.height - verticalIndent;
-
- Point size = computeSize(cache, availableWidth, availableHeight);
-
- // Horizontal justification
- switch (horizontalAlignment) {
- case SWT.RIGHT:
- startx = cellBounds.x + availableWidth - size.x;
- break;
- case SWT.CENTER:
- startx = cellBounds.x + (availableWidth - size.x) / 2;
- break;
- }
-
- // Vertical justification
- switch (verticalAlignment) {
- case SWT.BOTTOM:
- starty = cellBounds.y + availableHeight - size.y;
- break;
- case SWT.CENTER:
- starty = cellBounds.y + (availableHeight - size.y) / 2;
- break;
- }
-
- // Position the control
- cache.getControl().setBounds(startx + horizontalIndent,
- starty + verticalIndent, size.x, size.y);
- }
-
- /**
- * Returns the preferred size of the given control in this cell, given one or both
- * known dimensions of the control. This differs from computeSize, which takes known
- * dimensions of the <b>cell</b> as arguments.
- *
- * @param toCompute
- * @param controlWidth
- * @param controlHeight
- * @return
- * @since 3.0
- */
- private Point computeControlSize(SizeCache toCompute, int controlWidth,
- int controlHeight) {
- switch (hintType) {
- case OVERRIDE:
- return computeOverrideSize(toCompute, controlWidth, controlHeight,
- widthHint, heightHint);
- case MINIMUM:
- return computeMinimumBoundedSize(toCompute, controlWidth,
- controlHeight, widthHint, heightHint);
- case MAXIMUM:
- return computeMaximumBoundedSize(toCompute, controlWidth,
- controlHeight, widthHint, heightHint);
- }
-
- return computeRawSize(toCompute, controlWidth, controlHeight);
- }
-
- /**
- * Computes the size of the control, given its outer dimensions. This should be used in
- * place of calling Control.computeSize, since Control.computeSize takes control-specific
- * inner dimensions as hints.
- *
- * @param toCompute Control whose size will be computed
- * @param controlWidth width of the control (pixels or SWT.DEFAULT if unknown)
- * @param controlHeight height of the control (pixels or SWT.DEFAULT if unknown)
- * @return preferred dimensions of the control
- */
- private static Point computeRawSize(SizeCache toCompute, int controlWidth,
- int controlHeight) {
- if (controlWidth != SWT.DEFAULT && controlHeight != SWT.DEFAULT) {
- return new Point(controlWidth, controlHeight);
- }
-
- // Known bug: we pass the OUTER dimension of the control into computeSize, even though
- // SWT expects a control-specific inner dimension as width and height hints. Currently,
- // SWT does not provide any means to convert outer dimensions into inner dimensions.
- // Fortunately, the outer and inner dimensions tend to be quite close so we
- // pass in the outer dimension and adjust the result if it differs from one of the
- // hints. This may cause incorrect text wrapping in rare cases, and should be fixed
- // once SWT provides a way to convert the outer dimension of a control into a valid
- // width or height hint for Control.computeSize. Note that the distinction between outer
- // and inner dimensions is undocumented in SWT, and most examples also contain this
- // bug.
- Point result = toCompute.computeSize(controlWidth, controlHeight);
-
- // Hack: If the result of computeSize differs from the width or height-hints, adjust it.
- // See above. Don't remove this hack until SWT provides some way to pass correct width
- // and height hints into computeSize. Once this happens, these conditions should always
- // return false and the hack will have no effect.
- if (controlWidth != SWT.DEFAULT) {
- result.x = controlWidth;
- } else if (controlHeight != SWT.DEFAULT) {
- result.y = controlHeight;
- }
-
- return result;
- }
-
- /**
- * Computes the preferred size of the control. Optionally, one or both dimensions
- * may be fixed to a given size.
- *
- * @param control object that can compute the size of the control of interest
- * @param wHint known width (or SWT.DEFAULT if the width needs to be computed)
- * @param hHint known height (or SWT.DEFAULT if the height needs to be computed)
- * @param overrideW width that should always be returned by the control,
- * or SWT.DEFAULT if the width is not being constrained
- * @param overrideH height that should always be returned by the control,
- * or SWT.DEFAULT if the height is not being constrained
- * @return
- */
- private static Point computeOverrideSize(SizeCache control, int wHint,
- int hHint, int overrideW, int overrideH) {
- int resultWidth = overrideW;
- int resultHeight = overrideH;
-
- if (wHint != SWT.DEFAULT) {
- resultWidth = wHint;
- }
-
- if (hHint != SWT.DEFAULT) {
- resultHeight = hHint;
- }
-
- if (resultWidth == SWT.DEFAULT || resultHeight == SWT.DEFAULT) {
- Point result = computeRawSize(control, resultWidth, resultHeight);
-
- return result;
- }
-
- return new Point(resultWidth, resultHeight);
- }
-
- /**
- * Computes the size for the control, optionally bounding the size in the x and
- * y directions. The various hints are used to determine which dimensions are
- * already known and which dimensions need to be computed.
- *
- * @param control The control whose size should be computed
- * @param wHint known width (or SWT.DEFAULT if the width needs to be computed)
- * @param hHint known height (or SWT.DEFAULT if the height needs to be computed)
- * @param boundedWidth maximum width for the control (or SWT.DEFAULT if the width is unbounded)
- * @param boundedHeight maximum height for the control (or SWT.DEFAULT if the height is unbounded)
- * @return the preferred size of the control, given that it cannot exceed the given bounds
- */
- private static Point computeMaximumBoundedSize(SizeCache control,
- int wHint, int hHint, int boundedWidth, int boundedHeight) {
- Point controlSize = computeRawSize(control, wHint, hHint);
-
- if (wHint == SWT.DEFAULT && boundedWidth != SWT.DEFAULT
- && controlSize.x > boundedWidth) {
- return computeMaximumBoundedSize(control, boundedWidth, hHint,
- boundedWidth, boundedHeight);
- }
-
- if (hHint == SWT.DEFAULT && boundedHeight != SWT.DEFAULT
- && controlSize.y > boundedHeight) {
- return computeMaximumBoundedSize(control, wHint, boundedHeight,
- boundedWidth, boundedHeight);
- }
-
- return controlSize;
- }
-
- private static Point computeMinimumBoundedSize(SizeCache control,
- int wHint, int hHint, int minimumWidth, int minimumHeight) {
-
- Point controlSize = computeRawSize(control, wHint, hHint);
-
- if (minimumWidth != SWT.DEFAULT && wHint == SWT.DEFAULT
- && controlSize.x < minimumWidth) {
- return computeMinimumBoundedSize(control, minimumWidth, hHint,
- minimumWidth, minimumHeight);
- }
-
- if (minimumHeight != SWT.DEFAULT && hHint == SWT.DEFAULT
- && controlSize.y < minimumHeight) {
- return computeMinimumBoundedSize(control, wHint, minimumHeight,
- minimumWidth, minimumHeight);
- }
-
- return controlSize;
- }
+ /**
+ * hintType flag (value = 0) indicating that the control's computeSize method
+ * should be used to determine the control size. If modifierType is set to NONE,
+ * then the widthHint and heightHint fields will be ignored.
+ */
+ public static final int NONE = 0;
+
+ /**
+ * hintType flag (value = 1) indicating that the widthHint and heightHint should
+ * be used as the control's size instead of the result of computeSize
+ * <p>
+ * This flag is useful for list boxes, text boxes, tree controls, and other
+ * controls whose contents can change dynamically. For example, create a tree
+ * control and set its width and height hints to the default size for that
+ * control. This will cause the hints to be used instead of the preferred size
+ * of the tree control.
+ * </p>
+ */
+ public static final int OVERRIDE = 1;
+
+ /**
+ * hintType(value = 2) indicating that the width of the control should be no
+ * less than widthHint (if provided) and the height of the control should be no
+ * less than heightHint (if provided).
+ * <p>
+ * This flag is useful for buttons. For example, set the width and height hints
+ * to the default button size. This will use the default button size unless the
+ * button label is too large to fit on the button.
+ * </p>
+ */
+ public static final int MINIMUM = 2;
+
+ /**
+ * hintType flag (value = 3) indicating that the width of the control should be
+ * no more than widthHint (if provided) and the height of the control should be
+ * no more than heightHint (if provided).
+ * <p>
+ * This flag is useful for wrapping text. For example, set heightHint to
+ * SWT.DEFAULT and set widthHint to the desired number of pixels after which
+ * text should wrap. This will cause the text to wrap after the given number of
+ * pixels, but will not allocate extra space in the column if the text widget
+ * does not fill an entire line.
+ * </p>
+ */
+ public static final int MAXIMUM = 3;
+
+ /**
+ * This flag controls how the width and height hints are to be treated. See the
+ * constants above.
+ */
+ public int hintType = OVERRIDE;
+
+ /**
+ * Width hint. This modifies the width of the control, in pixels. If set to
+ * SWT.DEFAULT, this dimension will not be constrained. Depending on the value
+ * of modifierType, this may be a minimum size, a maximum size, or simply
+ * replace the preferred control size.
+ */
+ public int widthHint = SWT.DEFAULT;
+
+ /**
+ * Height hint. This modifies the height of the control, in pixels. If set to
+ * SWT.DEFAULT, this dimension will not be constrained. Depending on the value
+ * of modifierType, this will be a minimum size, a maximum size, or a
+ * replacement for the control's preferred size.
+ */
+ public int heightHint = SWT.DEFAULT;
+
+ /**
+ * Number of rows spanned by this cell (default = 1)
+ */
+ public int verticalSpan = 1;
+
+ /**
+ * Number of columns spanned by this cell (default = 1)
+ */
+ public int horizontalSpan = 1;
+
+ /**
+ * Horizontal alignment of the control within the cell. May be one of SWT.LEFT,
+ * SWT.RIGHT, SWT.CENTER, or SWT.NORMAL. SWT.NORMAL indicates that the control
+ * should be made as wide as the cell.
+ */
+ public int horizontalAlignment = SWT.FILL;
+
+ /**
+ * Vertical alignment of the control within the cell. May be one of SWT.TOP,
+ * SWT.BOTTOM, SWT.CENTER, or SWT.NORMAL. SWT.NORMAL indicates that the control
+ * should be made as wide as the cell.
+ */
+ public int verticalAlignment = SWT.FILL;
+
+ /**
+ * Horizontal indentation (pixels). Positive values move the control to the
+ * right, negative to the left.
+ */
+ public int horizontalIndent = 0;
+
+ /**
+ * Vertical indentation (pixels). Positive values move the control down,
+ * negative values move the control up.
+ */
+ public int verticalIndent = 0;
+
+ /**
+ * Constructs a CellData with default properties
+ */
+ public CellData() {
+ // Use the default values for all fields.
+ }
+
+ /**
+ * Creates a new CellData that with properties that are as close as possible to
+ * the given GridData. This is used for converting GridLayouts into CellLayouts.
+ *
+ * @param data
+ */
+ public CellData(GridData data) {
+ verticalSpan = data.verticalSpan;
+ horizontalSpan = data.horizontalSpan;
+
+ switch (data.horizontalAlignment) {
+ case GridData.BEGINNING:
+ horizontalAlignment = SWT.LEFT;
+ break;
+ case GridData.CENTER:
+ horizontalAlignment = SWT.CENTER;
+ break;
+ case GridData.END:
+ horizontalAlignment = SWT.RIGHT;
+ break;
+ case GridData.FILL:
+ horizontalAlignment = SWT.FILL;
+ break;
+ }
+
+ switch (data.verticalAlignment) {
+ case GridData.BEGINNING:
+ verticalAlignment = SWT.LEFT;
+ break;
+ case GridData.CENTER:
+ verticalAlignment = SWT.CENTER;
+ break;
+ case GridData.END:
+ verticalAlignment = SWT.RIGHT;
+ break;
+ case GridData.FILL:
+ verticalAlignment = SWT.FILL;
+ break;
+ }
+
+ widthHint = data.widthHint;
+ heightHint = data.heightHint;
+ horizontalIndent = data.horizontalIndent;
+ hintType = OVERRIDE;
+ }
+
+ /**
+ * Copies the given CellData
+ *
+ * @param newData
+ */
+ public CellData(CellData newData) {
+ hintType = newData.hintType;
+ widthHint = newData.widthHint;
+ heightHint = newData.heightHint;
+ horizontalAlignment = newData.horizontalAlignment;
+ verticalAlignment = newData.verticalAlignment;
+ horizontalSpan = newData.horizontalSpan;
+ verticalSpan = newData.verticalSpan;
+ }
+
+ /**
+ * Sets the size hint for this control. This is used to modify the control's
+ * preferred size. If one dimension should remain unmodified, that hint can be
+ * set to SWT.DEFAULT. Using a size hint of CellData.MINIMUM ensures that the
+ * preferred control size is larger than the hint. Using a size hint of
+ * CellData.MAXIMUM ensures that the preferred size is smaller than the hint.
+ * Using a size hint of CellData.OVERRIDE ensures that the preferred size is
+ * always equal to the hint.
+ *
+ * @param hintType one of CellData.MINIMUM, CellData.MAXIMUM, or
+ * CellData.OVERRIDE
+ * @param hint size hint (in pixels). If either dimension is set to
+ * SWT.DEFAULT, the hint will not affect that dimension
+ * @return this
+ */
+ public CellData setHint(int hintType, Point hint) {
+ return setHint(hintType, hint.x, hint.y);
+ }
+
+ /**
+ * Sets the size hint for this control. This is used to modify the control's
+ * preferred size. If one dimension should remain unmodified, that hint can be
+ * set to SWT.DEFAULT. Using a size hint of CellData.MINIMUM ensures that the
+ * preferred control size is larger than the hint. Using a size hint of
+ * CellData.MAXIMUM ensures that the preferred size is smaller than the hint.
+ * Using a size hint of CellData.OVERRIDE ensures that the preferred size is
+ * always equal to the hint. If both hints are equal to SWT.DEFAULT, then the
+ * control's preferred size is unmodified.
+ *
+ * @param hintType one of CellData.MINIMUM, CellData.MAXIMUM, or
+ * CellData.OVERRIDE
+ * @param horizontal horizontal hint (pixels). A value of SWT.DEFAULT will leave
+ * the result of the control's computeSize method unmodified.
+ * @param vertical vertical hint (pixels). A value of SWT.DEFAULT will leave
+ * the result of the control's computeSize method unmodified.
+ * @return this
+ */
+ public CellData setHint(int hintType, int horizontal, int vertical) {
+ this.hintType = hintType;
+ this.heightHint = vertical;
+ this.widthHint = horizontal;
+
+ return this;
+ }
+
+ /**
+ * Sets the alignment for this control
+ *
+ * @param horizontalAlignment one of SWT.LEFT, SWT.RIGHT, SWT.FILL, or
+ * SWT.CENTER
+ * @param verticalAlignment one of SWT.TOP, SWT.BOTTOM, SWT.FILL, or
+ * SWT.CENTER
+ * @return this
+ */
+ public CellData align(int horizontalAlignment, int verticalAlignment) {
+ this.horizontalAlignment = horizontalAlignment;
+ this.verticalAlignment = verticalAlignment;
+
+ return this;
+ }
+
+ /**
+ * Sets the number of rows and columns spanned by this control.
+ *
+ * @param horizontalSpan number of columns spanned by the control (> 0)
+ * @param verticalSpan number of rows spanned by the control (> 0)
+ * @return this
+ */
+ public CellData span(int horizontalSpan, int verticalSpan) {
+ this.horizontalSpan = horizontalSpan;
+ this.verticalSpan = verticalSpan;
+
+ return this;
+ }
+
+ /**
+ * Sets the indentation for this control. The indentation is added to the
+ * control's position within the cell. For example, indentation of (10,4) will
+ * move the control right by 10 pixels and down by 4 pixels.
+ *
+ * @param indent indentation (pixels)
+ * @return this
+ */
+ public CellData indent(Point indent) {
+ return this.indent(indent.x, indent.y);
+ }
+
+ /**
+ * Sets the indentation for this cell
+ *
+ * @param horizontalIndent distance (pixels) to move the control to the right
+ * @param verticalIndent distance (pixels) to move the control down
+ * @return this
+ */
+ public CellData indent(int horizontalIndent, int verticalIndent) {
+ this.horizontalIndent = horizontalIndent;
+ this.verticalIndent = verticalIndent;
+
+ return this;
+ }
+
+ /**
+ * Returns the preferred size of the given control, given the known dimensions
+ * of its cell.
+ *
+ * @param toCompute the control whose size is to be computed
+ * @param cellWidth width of the cell, in pixels (or SWT.DEFAULT if unknown)
+ * @param cellHeight height of the cell, in pixels (or SWT.DEFAULT if unknown)
+ * @return the preferred size of the given control, in pixels
+ */
+ public Point computeSize(SizeCache toCompute, int cellWidth, int cellHeight) {
+
+ int absHorizontalIndent = Math.abs(horizontalIndent);
+ int absVerticalIndent = Math.abs(verticalIndent);
+
+ // If we're going to indent, subtract off the space that will be required for
+ // indentation from
+ // the available space
+ if (cellWidth != SWT.DEFAULT) {
+ cellWidth -= absHorizontalIndent;
+ }
+
+ if (cellHeight != SWT.DEFAULT) {
+ cellHeight -= absVerticalIndent;
+ }
+
+ int controlWidth = horizontalAlignment == SWT.FILL ? cellWidth : SWT.DEFAULT;
+ int controlHeight = verticalAlignment == SWT.FILL ? cellHeight : SWT.DEFAULT;
+
+ // Note: this could be optimized further. If we're using a MAXIMUM hint and
+ // non-FILL alignment, we could simply call computeMaximumBoundedSize using the
+ // minimum of the cell size and the hint as the boundary -- basically, rather
+ // than applying two limits for the hint and the cell boundary, we can do it in
+ // one step and reduce the size computations by half (for this specific case).
+ Point controlSize = computeControlSize(toCompute, controlWidth, controlHeight);
+
+ if (cellWidth != SWT.DEFAULT && controlSize.x > cellWidth) {
+ controlSize = computeControlSize(toCompute, cellWidth, controlHeight);
+ if (cellHeight != SWT.DEFAULT && controlSize.y > cellHeight) {
+ controlSize.y = cellHeight;
+ }
+ } else if (cellHeight != SWT.DEFAULT && controlSize.y > cellHeight) {
+ controlSize = computeControlSize(toCompute, controlWidth, cellHeight);
+ if (cellWidth != SWT.DEFAULT && controlSize.x > cellWidth) {
+ controlSize.x = cellWidth;
+ }
+ }
+
+ // If we're going to indent, add the indentation to the required space
+ controlSize.x += absHorizontalIndent;
+ controlSize.y += absVerticalIndent;
+
+ return controlSize;
+ }
+
+ /**
+ * Arranges the given control within the given rectangle using the criteria
+ * described by this CellData.
+ *
+ * @param control
+ * @param cellBounds
+ * @since 3.0
+ */
+ public void positionControl(SizeCache cache, Rectangle cellBounds) {
+
+ int startx = cellBounds.x;
+ int starty = cellBounds.y;
+ int availableWidth = cellBounds.width - horizontalIndent;
+ int availableHeight = cellBounds.height - verticalIndent;
+
+ Point size = computeSize(cache, availableWidth, availableHeight);
+
+ // Horizontal justification
+ switch (horizontalAlignment) {
+ case SWT.RIGHT:
+ startx = cellBounds.x + availableWidth - size.x;
+ break;
+ case SWT.CENTER:
+ startx = cellBounds.x + (availableWidth - size.x) / 2;
+ break;
+ }
+
+ // Vertical justification
+ switch (verticalAlignment) {
+ case SWT.BOTTOM:
+ starty = cellBounds.y + availableHeight - size.y;
+ break;
+ case SWT.CENTER:
+ starty = cellBounds.y + (availableHeight - size.y) / 2;
+ break;
+ }
+
+ // Position the control
+ cache.getControl().setBounds(startx + horizontalIndent, starty + verticalIndent, size.x, size.y);
+ }
+
+ /**
+ * Returns the preferred size of the given control in this cell, given one or
+ * both known dimensions of the control. This differs from computeSize, which
+ * takes known dimensions of the <b>cell</b> as arguments.
+ *
+ * @param toCompute
+ * @param controlWidth
+ * @param controlHeight
+ * @return
+ * @since 3.0
+ */
+ private Point computeControlSize(SizeCache toCompute, int controlWidth, int controlHeight) {
+ switch (hintType) {
+ case OVERRIDE:
+ return computeOverrideSize(toCompute, controlWidth, controlHeight, widthHint, heightHint);
+ case MINIMUM:
+ return computeMinimumBoundedSize(toCompute, controlWidth, controlHeight, widthHint, heightHint);
+ case MAXIMUM:
+ return computeMaximumBoundedSize(toCompute, controlWidth, controlHeight, widthHint, heightHint);
+ }
+
+ return computeRawSize(toCompute, controlWidth, controlHeight);
+ }
+
+ /**
+ * Computes the size of the control, given its outer dimensions. This should be
+ * used in place of calling Control.computeSize, since Control.computeSize takes
+ * control-specific inner dimensions as hints.
+ *
+ * @param toCompute Control whose size will be computed
+ * @param controlWidth width of the control (pixels or SWT.DEFAULT if unknown)
+ * @param controlHeight height of the control (pixels or SWT.DEFAULT if unknown)
+ * @return preferred dimensions of the control
+ */
+ private static Point computeRawSize(SizeCache toCompute, int controlWidth, int controlHeight) {
+ if (controlWidth != SWT.DEFAULT && controlHeight != SWT.DEFAULT) {
+ return new Point(controlWidth, controlHeight);
+ }
+
+ // Known bug: we pass the OUTER dimension of the control into computeSize, even
+ // though
+ // SWT expects a control-specific inner dimension as width and height hints.
+ // Currently,
+ // SWT does not provide any means to convert outer dimensions into inner
+ // dimensions.
+ // Fortunately, the outer and inner dimensions tend to be quite close so we
+ // pass in the outer dimension and adjust the result if it differs from one of
+ // the
+ // hints. This may cause incorrect text wrapping in rare cases, and should be
+ // fixed
+ // once SWT provides a way to convert the outer dimension of a control into a
+ // valid
+ // width or height hint for Control.computeSize. Note that the distinction
+ // between outer
+ // and inner dimensions is undocumented in SWT, and most examples also contain
+ // this
+ // bug.
+ Point result = toCompute.computeSize(controlWidth, controlHeight);
+
+ // Hack: If the result of computeSize differs from the width or height-hints,
+ // adjust it.
+ // See above. Don't remove this hack until SWT provides some way to pass correct
+ // width
+ // and height hints into computeSize. Once this happens, these conditions should
+ // always
+ // return false and the hack will have no effect.
+ if (controlWidth != SWT.DEFAULT) {
+ result.x = controlWidth;
+ } else if (controlHeight != SWT.DEFAULT) {
+ result.y = controlHeight;
+ }
+
+ return result;
+ }
+
+ /**
+ * Computes the preferred size of the control. Optionally, one or both
+ * dimensions may be fixed to a given size.
+ *
+ * @param control object that can compute the size of the control of interest
+ * @param wHint known width (or SWT.DEFAULT if the width needs to be
+ * computed)
+ * @param hHint known height (or SWT.DEFAULT if the height needs to be
+ * computed)
+ * @param overrideW width that should always be returned by the control, or
+ * SWT.DEFAULT if the width is not being constrained
+ * @param overrideH height that should always be returned by the control, or
+ * SWT.DEFAULT if the height is not being constrained
+ * @return
+ */
+ private static Point computeOverrideSize(SizeCache control, int wHint, int hHint, int overrideW, int overrideH) {
+ int resultWidth = overrideW;
+ int resultHeight = overrideH;
+
+ if (wHint != SWT.DEFAULT) {
+ resultWidth = wHint;
+ }
+
+ if (hHint != SWT.DEFAULT) {
+ resultHeight = hHint;
+ }
+
+ if (resultWidth == SWT.DEFAULT || resultHeight == SWT.DEFAULT) {
+ Point result = computeRawSize(control, resultWidth, resultHeight);
+
+ return result;
+ }
+
+ return new Point(resultWidth, resultHeight);
+ }
+
+ /**
+ * Computes the size for the control, optionally bounding the size in the x and
+ * y directions. The various hints are used to determine which dimensions are
+ * already known and which dimensions need to be computed.
+ *
+ * @param control The control whose size should be computed
+ * @param wHint known width (or SWT.DEFAULT if the width needs to be
+ * computed)
+ * @param hHint known height (or SWT.DEFAULT if the height needs to be
+ * computed)
+ * @param boundedWidth maximum width for the control (or SWT.DEFAULT if the
+ * width is unbounded)
+ * @param boundedHeight maximum height for the control (or SWT.DEFAULT if the
+ * height is unbounded)
+ * @return the preferred size of the control, given that it cannot exceed the
+ * given bounds
+ */
+ private static Point computeMaximumBoundedSize(SizeCache control, int wHint, int hHint, int boundedWidth,
+ int boundedHeight) {
+ Point controlSize = computeRawSize(control, wHint, hHint);
+
+ if (wHint == SWT.DEFAULT && boundedWidth != SWT.DEFAULT && controlSize.x > boundedWidth) {
+ return computeMaximumBoundedSize(control, boundedWidth, hHint, boundedWidth, boundedHeight);
+ }
+
+ if (hHint == SWT.DEFAULT && boundedHeight != SWT.DEFAULT && controlSize.y > boundedHeight) {
+ return computeMaximumBoundedSize(control, wHint, boundedHeight, boundedWidth, boundedHeight);
+ }
+
+ return controlSize;
+ }
+
+ private static Point computeMinimumBoundedSize(SizeCache control, int wHint, int hHint, int minimumWidth,
+ int minimumHeight) {
+
+ Point controlSize = computeRawSize(control, wHint, hHint);
+
+ if (minimumWidth != SWT.DEFAULT && wHint == SWT.DEFAULT && controlSize.x < minimumWidth) {
+ return computeMinimumBoundedSize(control, minimumWidth, hHint, minimumWidth, minimumHeight);
+ }
+
+ if (minimumHeight != SWT.DEFAULT && hHint == SWT.DEFAULT && controlSize.y < minimumHeight) {
+ return computeMinimumBoundedSize(control, wHint, minimumHeight, minimumWidth, minimumHeight);
+ }
+
+ return controlSize;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/CellLayout.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/CellLayout.java
index 0962381419c..25cf28025e9 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/CellLayout.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/CellLayout.java
@@ -24,41 +24,54 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Layout;
/**
- * <p>Instance of this class lay out the control children of a <code>Composite</code>
- * in a grid, using a simple set of rules and a simple API. This class is
- * intended to be more predictable than <code>GridLayout</code> and easier to use than
- * <code>FormLayout</code>, while retaining most of the power of both.</p>
+ * <p>
+ * Instance of this class lay out the control children of a
+ * <code>Composite</code> in a grid, using a simple set of rules and a simple
+ * API. This class is intended to be more predictable than
+ * <code>GridLayout</code> and easier to use than <code>FormLayout</code>, while
+ * retaining most of the power of both.
+ * </p>
*
- * <p>The power of a <code>CellLayout</code> lies in the ability to control
- * the size and resizing properties of each row and column. Unlike other layout
+ * <p>
+ * The power of a <code>CellLayout</code> lies in the ability to control the
+ * size and resizing properties of each row and column. Unlike other layout
* classes, complex layouts can be created without attaching any layout data to
- * individual controls in the layout. </p>
+ * individual controls in the layout.
+ * </p>
*
- * <p>The various subclasses of <code>IColumnInfo</code>
- * can be used to create columns with fixed width, columns whose width is computed
- * from child controls, or width that grows in proportion to the size of other
- * columns. Layouts can be given a default <code>IColumnInfo</code> that will
- * be used to set the size of any column whose properties have not been explicitly
- * set. This is useful for creating layouts where most or all columns have the
- * same properties. Similarly, the subclasses of <code>IRowInfo</code> can be used to
- * control the height of individual rows.</p>
+ * <p>
+ * The various subclasses of <code>IColumnInfo</code> can be used to create
+ * columns with fixed width, columns whose width is computed from child
+ * controls, or width that grows in proportion to the size of other columns.
+ * Layouts can be given a default <code>IColumnInfo</code> that will be used to
+ * set the size of any column whose properties have not been explicitly set.
+ * This is useful for creating layouts where most or all columns have the same
+ * properties. Similarly, the subclasses of <code>IRowInfo</code> can be used to
+ * control the height of individual rows.
+ * </p>
*
- * <p>For a finer grain of control, <code>CellData</code> objects can be attached
- * to individual controls in the layout. These objects serve a similar function as
- * <code>GridData</code> objects serve for <code>GridLayout</code>. They allow
- * controls to span multiple rows or columns, set the justification of the control
- * within its cell, and allow the user to override the preferred size of the control.
+ * <p>
+ * For a finer grain of control, <code>CellData</code> objects can be attached
+ * to individual controls in the layout. These objects serve a similar function
+ * as <code>GridData</code> objects serve for <code>GridLayout</code>. They
+ * allow controls to span multiple rows or columns, set the justification of the
+ * control within its cell, and allow the user to override the preferred size of
+ * the control.
* </p>
*
- * <p>In many cases, it is not necessary to attach any layout data to controls in
- * the layout, since the controls can be arranged based on the properties of rows
- * and columns. However, layout data may be attached to individual controls to
- * allow them to span multiple columns or to control their justification within
- * their cell.
+ * <p>
+ * In many cases, it is not necessary to attach any layout data to controls in
+ * the layout, since the controls can be arranged based on the properties of
+ * rows and columns. However, layout data may be attached to individual controls
+ * to allow them to span multiple columns or to control their justification
+ * within their cell.
* </p>
*
- * <p>All the <code>set</code> methods in this class return <code>this</code>, allowing
- * a layout to be created and initialized in a single line of code. For example: </p>
+ * <p>
+ * All the <code>set</code> methods in this class return <code>this</code>,
+ * allowing a layout to be created and initialized in a single line of code. For
+ * example:
+ * </p>
*
* <code>
* Composite myControl = new Composite(parent, SWT.NONE);
@@ -69,249 +82,250 @@ import org.eclipse.swt.widgets.Layout;
*/
public class CellLayout extends Layout {
- /**
- * Object used to compute the height of rows whose properties have not been
- * explicitly set.
- */
- private Row defaultRowSettings = new Row(false);
-
- /**
- * Object used to compute the width of columns whose properties have not been
- * explicitly set.
- */
- private Row defaultColSettings = new Row(true);
-
- /**
- * horizontalSpacing specifies the number of pixels between the right
- * edge of one cell and the left edge of its neighbouring cell to
- * the right.
- *
- * The default value is 5.
- */
- int horizontalSpacing = 5;
-
- /**
- * verticalSpacing specifies the number of pixels between the bottom
- * edge of one cell and the top edge of its neighbouring cell underneath.
- *
- * The default value is 5.
- */
- int verticalSpacing = 5;
-
- /**
- * marginWidth specifies the number of pixels of horizontal margin
- * that will be placed along the left and right edges of the layout.
- *
- * The default value is 0.
- */
- public int marginWidth = 5;
-
- /**
- * marginHeight specifies the number of pixels of vertical margin
- * that will be placed along the top and bottom edges of the layout.
- *
- * The default value is 0.
- */
- public int marginHeight = 5;
-
- /**
- * Number of columns in this layout, or 0 indicating that the whole layout
- * should be on a single row.
- */
- private int numCols;
-
- /**
- * List of IColumnInfo. The nth object is used to compute the width of the
- * nth column, or null indicating that the default column should be used.
- */
- private List cols;
-
- /**
- * List of RowInfo. The nth object is used to compute the height of the
- * nth row, or null indicating that the default row should be used.
- */
- private List rows = new ArrayList(16);
-
- // Cached information
- private GridInfo gridInfo = new GridInfo();
-
- private int[] cachedRowMin = null;
-
- private int[] cachedColMin = null;
-
- public static int cacheMisses;
-
- public static int cacheHits;
-
- private LayoutCache cache = new LayoutCache();
-
- // End of cached control sizes
-
- /**
- * Creates the layout
- *
- * @param numCols the number of columns in this layout,
- * or 0 indicating that the whole layout should be on one row.
- */
- public CellLayout(int numCols) {
- super();
- this.numCols = numCols;
- cols = new ArrayList(numCols == 0 ? 3 : numCols);
- }
-
- /**
- * Sets the amount empty space between cells
- *
- * @param newSpacing a point (x,y) corresponding to the number of pixels of
- * empty space between adjacent columns and rows respectively
- */
- public CellLayout setSpacing(int horizontalSpacing, int verticalSpacing) {
- this.horizontalSpacing = horizontalSpacing;
- this.verticalSpacing = verticalSpacing;
-
- return this;
- }
-
- /**
- * Sets the amount empty space between cells
- *
- * @param newSpacing a point (x,y) corresponding to the number of pixels of
- * empty space between adjacent columns and rows respectively
- */
- public CellLayout setSpacing(Point newSpacing) {
- horizontalSpacing = newSpacing.x;
- verticalSpacing = newSpacing.y;
- return this;
- }
-
- /**
- * Returns the amount of empty space between adjacent cells
- *
- * @return a point (x,y) corresponding to the number of pixels of empty
- * space between adjacent columns and rows respectively
- */
- public Point getSpacing() {
- return new Point(horizontalSpacing, verticalSpacing);
- }
-
- /**
- * Sets the size of the margin around the outside of the layout.
- *
- * @param marginWidth the size of the margin around the top and
- * bottom of the layout
- * @param marginHeight the size of the margin on the left and right
- * of the layout.
- */
- public CellLayout setMargins(int marginWidth, int marginHeight) {
- this.marginWidth = marginWidth;
- this.marginHeight = marginHeight;
- return this;
- }
-
- /**
- * Sets the size of the margin around the outside of the layout.
- *
- * @param newMargins point indicating the size of the horizontal and vertical
- * margins, in pixels.
- */
- public CellLayout setMargins(Point newMargins) {
- marginWidth = newMargins.x;
- marginHeight = newMargins.y;
- return this;
- }
-
- /**
- * Returns the size of the margins around the outside of the layout.
- *
- * @return the size of the outer margins, in pixels.
- */
- public Point getMargins() {
- return new Point(marginWidth, marginHeight);
- }
-
- /**
- * Sets the default column settings. All columns will use these settings unless
- * they have been explicitly assigned custom settings by setColumn.
- *
- * @param info the properties of all default columns
- * @see setColumn
- */
- public CellLayout setDefaultColumn(Row info) {
- defaultColSettings = info;
- return this;
- }
-
- /**
- * Sets the column info for the given column number (the leftmost column is column 0).
- * This replaces any existing info for the column. Note that more than one column
- * are allowed to share the same IColumnInfo instance if they have identical properties.
- *
- * @param colNum the column number to modify
- * @param info the properties of the column, or null if this column should use the
- * default properties
- */
- public CellLayout setColumn(int colNum, Row info) {
- while (cols.size() <= colNum) {
- cols.add(null);
- }
-
- cols.set(colNum, info);
-
- return this;
- }
-
- /**
- * Sets the default row settings for this layout. Unless this is overridden
- * for an individual row, all rows will use the default settings.
- *
- * @param info the row info object that should be used to set the size
- * of rows, by default.
- */
- public CellLayout setDefaultRow(Row info) {
- defaultRowSettings = info;
-
- return this;
- }
-
- /**
- * Sets the row info for the given rows. The topmost row is row 0. Multiple
- * rows are allowed to share the same RowInfo instance.
- *
- * @param rowNum the row number to set
- * @param info the row info that will control the sizing of the given row,
- * or null if the row should use the default settings for this layout.
- */
- public CellLayout setRow(int rowNum, Row info) {
- while (rows.size() <= rowNum) {
- rows.add(null);
- }
-
- rows.set(rowNum, info);
-
- return this;
- }
-
- /**
- * Returns the row info that controls the size of the given row. Will return
- * the default row settings for this layout if no custom row info has been
- * assigned to the row.
- *
- * @param rowNum
- * @return
- */
- private Row getRow(int rowNum, boolean isHorizontal) {
- if (isHorizontal) {
- if (rowNum >= rows.size()) {
- return defaultRowSettings;
- }
-
- Row result = (Row) rows.get(rowNum);
-
- if (result == null) {
- result = defaultRowSettings;
- }
-
- return result;
+ /**
+ * Object used to compute the height of rows whose properties have not been
+ * explicitly set.
+ */
+ private Row defaultRowSettings = new Row(false);
+
+ /**
+ * Object used to compute the width of columns whose properties have not been
+ * explicitly set.
+ */
+ private Row defaultColSettings = new Row(true);
+
+ /**
+ * horizontalSpacing specifies the number of pixels between the right edge of
+ * one cell and the left edge of its neighbouring cell to the right.
+ *
+ * The default value is 5.
+ */
+ int horizontalSpacing = 5;
+
+ /**
+ * verticalSpacing specifies the number of pixels between the bottom edge of one
+ * cell and the top edge of its neighbouring cell underneath.
+ *
+ * The default value is 5.
+ */
+ int verticalSpacing = 5;
+
+ /**
+ * marginWidth specifies the number of pixels of horizontal margin that will be
+ * placed along the left and right edges of the layout.
+ *
+ * The default value is 0.
+ */
+ public int marginWidth = 5;
+
+ /**
+ * marginHeight specifies the number of pixels of vertical margin that will be
+ * placed along the top and bottom edges of the layout.
+ *
+ * The default value is 0.
+ */
+ public int marginHeight = 5;
+
+ /**
+ * Number of columns in this layout, or 0 indicating that the whole layout
+ * should be on a single row.
+ */
+ private int numCols;
+
+ /**
+ * List of IColumnInfo. The nth object is used to compute the width of the nth
+ * column, or null indicating that the default column should be used.
+ */
+ private List cols;
+
+ /**
+ * List of RowInfo. The nth object is used to compute the height of the nth row,
+ * or null indicating that the default row should be used.
+ */
+ private List rows = new ArrayList(16);
+
+ // Cached information
+ private GridInfo gridInfo = new GridInfo();
+
+ private int[] cachedRowMin = null;
+
+ private int[] cachedColMin = null;
+
+ public static int cacheMisses;
+
+ public static int cacheHits;
+
+ private LayoutCache cache = new LayoutCache();
+
+ // End of cached control sizes
+
+ /**
+ * Creates the layout
+ *
+ * @param numCols the number of columns in this layout, or 0 indicating that the
+ * whole layout should be on one row.
+ */
+ public CellLayout(int numCols) {
+ super();
+ this.numCols = numCols;
+ cols = new ArrayList(numCols == 0 ? 3 : numCols);
+ }
+
+ /**
+ * Sets the amount empty space between cells
+ *
+ * @param newSpacing a point (x,y) corresponding to the number of pixels of
+ * empty space between adjacent columns and rows respectively
+ */
+ public CellLayout setSpacing(int horizontalSpacing, int verticalSpacing) {
+ this.horizontalSpacing = horizontalSpacing;
+ this.verticalSpacing = verticalSpacing;
+
+ return this;
+ }
+
+ /**
+ * Sets the amount empty space between cells
+ *
+ * @param newSpacing a point (x,y) corresponding to the number of pixels of
+ * empty space between adjacent columns and rows respectively
+ */
+ public CellLayout setSpacing(Point newSpacing) {
+ horizontalSpacing = newSpacing.x;
+ verticalSpacing = newSpacing.y;
+ return this;
+ }
+
+ /**
+ * Returns the amount of empty space between adjacent cells
+ *
+ * @return a point (x,y) corresponding to the number of pixels of empty space
+ * between adjacent columns and rows respectively
+ */
+ public Point getSpacing() {
+ return new Point(horizontalSpacing, verticalSpacing);
+ }
+
+ /**
+ * Sets the size of the margin around the outside of the layout.
+ *
+ * @param marginWidth the size of the margin around the top and bottom of the
+ * layout
+ * @param marginHeight the size of the margin on the left and right of the
+ * layout.
+ */
+ public CellLayout setMargins(int marginWidth, int marginHeight) {
+ this.marginWidth = marginWidth;
+ this.marginHeight = marginHeight;
+ return this;
+ }
+
+ /**
+ * Sets the size of the margin around the outside of the layout.
+ *
+ * @param newMargins point indicating the size of the horizontal and vertical
+ * margins, in pixels.
+ */
+ public CellLayout setMargins(Point newMargins) {
+ marginWidth = newMargins.x;
+ marginHeight = newMargins.y;
+ return this;
+ }
+
+ /**
+ * Returns the size of the margins around the outside of the layout.
+ *
+ * @return the size of the outer margins, in pixels.
+ */
+ public Point getMargins() {
+ return new Point(marginWidth, marginHeight);
+ }
+
+ /**
+ * Sets the default column settings. All columns will use these settings unless
+ * they have been explicitly assigned custom settings by setColumn.
+ *
+ * @param info the properties of all default columns
+ * @see setColumn
+ */
+ public CellLayout setDefaultColumn(Row info) {
+ defaultColSettings = info;
+ return this;
+ }
+
+ /**
+ * Sets the column info for the given column number (the leftmost column is
+ * column 0). This replaces any existing info for the column. Note that more
+ * than one column are allowed to share the same IColumnInfo instance if they
+ * have identical properties.
+ *
+ * @param colNum the column number to modify
+ * @param info the properties of the column, or null if this column should use
+ * the default properties
+ */
+ public CellLayout setColumn(int colNum, Row info) {
+ while (cols.size() <= colNum) {
+ cols.add(null);
+ }
+
+ cols.set(colNum, info);
+
+ return this;
+ }
+
+ /**
+ * Sets the default row settings for this layout. Unless this is overridden for
+ * an individual row, all rows will use the default settings.
+ *
+ * @param info the row info object that should be used to set the size of rows,
+ * by default.
+ */
+ public CellLayout setDefaultRow(Row info) {
+ defaultRowSettings = info;
+
+ return this;
+ }
+
+ /**
+ * Sets the row info for the given rows. The topmost row is row 0. Multiple rows
+ * are allowed to share the same RowInfo instance.
+ *
+ * @param rowNum the row number to set
+ * @param info the row info that will control the sizing of the given row, or
+ * null if the row should use the default settings for this
+ * layout.
+ */
+ public CellLayout setRow(int rowNum, Row info) {
+ while (rows.size() <= rowNum) {
+ rows.add(null);
+ }
+
+ rows.set(rowNum, info);
+
+ return this;
+ }
+
+ /**
+ * Returns the row info that controls the size of the given row. Will return the
+ * default row settings for this layout if no custom row info has been assigned
+ * to the row.
+ *
+ * @param rowNum
+ * @return
+ */
+ private Row getRow(int rowNum, boolean isHorizontal) {
+ if (isHorizontal) {
+ if (rowNum >= rows.size()) {
+ return defaultRowSettings;
+ }
+
+ Row result = (Row) rows.get(rowNum);
+
+ if (result == null) {
+ result = defaultRowSettings;
+ }
+
+ return result;
}
if (rowNum >= cols.size()) {
return defaultColSettings;
@@ -324,79 +338,76 @@ public class CellLayout extends Layout {
}
return result;
- }
-
- /**
- * Initializes the gridInfo object.
- *
- * @param children controls that are being layed out
- */
- private void initGrid(Control[] children) {
- cache.setControls(children);
- gridInfo.initGrid(children, this);
- cachedRowMin = null;
- cachedColMin = null;
- }
-
- @Override
- protected Point computeSize(Composite composite, int wHint, int hHint,
- boolean flushCache) {
- Control[] children = composite.getChildren();
- initGrid(children);
-
- if (flushCache) {
- cache.flush();
- }
-
- // Determine the amount of whitespace (area that cannot be used by controls)
- Point emptySpace = totalEmptySpace();
-
- int[] heightConstraints = computeConstraints(true);
-
- int width;
- if (wHint == SWT.DEFAULT) {
- width = preferredSize(heightConstraints, false);
- } else {
- width = wHint - emptySpace.x;
- }
-
- int height = hHint;
- if (hHint == SWT.DEFAULT) {
- height = preferredSize(
- computeSizes(heightConstraints, width, false), true);
- } else {
- height = hHint - emptySpace.y;
- }
-
- Point preferredSize = new Point(width + emptySpace.x, height
- + emptySpace.y);
-
- // At this point we know the layout's preferred size. Now adjust it
- // if we're smaller than the minimum possible size for the composite.
-
- // If exactly one dimension of our preferred size is smaller than
- // the minimum size of our composite, then set that dimension to
- // the minimum size and recompute the other dimension (for example,
- // increasing the width to match a shell's minimum width may reduce
- // the height allocated for a wrapping text widget). There is no
- // point in doing this if both dimensions are smaller than the
- // composite's minimum size, since we're already smaller than
- // we need to be.
- Point minimumSize = CellLayoutUtil.computeMinimumSize(composite);
-
- boolean wider = (preferredSize.x >= minimumSize.x);
- boolean taller = (preferredSize.y >= minimumSize.y);
-
- if (wider) {
- if (taller) {
- // If we're larger in both dimensions, don't adjust the minimum
- // size.
- return preferredSize;
- }
+ }
+
+ /**
+ * Initializes the gridInfo object.
+ *
+ * @param children controls that are being layed out
+ */
+ private void initGrid(Control[] children) {
+ cache.setControls(children);
+ gridInfo.initGrid(children, this);
+ cachedRowMin = null;
+ cachedColMin = null;
+ }
+
+ @Override
+ protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) {
+ Control[] children = composite.getChildren();
+ initGrid(children);
+
+ if (flushCache) {
+ cache.flush();
+ }
+
+ // Determine the amount of whitespace (area that cannot be used by controls)
+ Point emptySpace = totalEmptySpace();
+
+ int[] heightConstraints = computeConstraints(true);
+
+ int width;
+ if (wHint == SWT.DEFAULT) {
+ width = preferredSize(heightConstraints, false);
+ } else {
+ width = wHint - emptySpace.x;
+ }
+
+ int height = hHint;
+ if (hHint == SWT.DEFAULT) {
+ height = preferredSize(computeSizes(heightConstraints, width, false), true);
+ } else {
+ height = hHint - emptySpace.y;
+ }
+
+ Point preferredSize = new Point(width + emptySpace.x, height + emptySpace.y);
+
+ // At this point we know the layout's preferred size. Now adjust it
+ // if we're smaller than the minimum possible size for the composite.
+
+ // If exactly one dimension of our preferred size is smaller than
+ // the minimum size of our composite, then set that dimension to
+ // the minimum size and recompute the other dimension (for example,
+ // increasing the width to match a shell's minimum width may reduce
+ // the height allocated for a wrapping text widget). There is no
+ // point in doing this if both dimensions are smaller than the
+ // composite's minimum size, since we're already smaller than
+ // we need to be.
+ Point minimumSize = CellLayoutUtil.computeMinimumSize(composite);
+
+ boolean wider = (preferredSize.x >= minimumSize.x);
+ boolean taller = (preferredSize.y >= minimumSize.y);
+
+ if (wider) {
+ if (taller) {
+ // If we're larger in both dimensions, don't adjust the minimum
+ // size.
+ return preferredSize;
+ }
// If our preferred height is smaller than the minimum height,
// recompute the preferred width using the minimum height
return computeSize(composite, wHint, minimumSize.y, false);
- }
+ }
if (taller) {
// If our preferred width is smaller than the minimum width,
// recompute the preferred height using the minimum width
@@ -405,476 +416,457 @@ public class CellLayout extends Layout {
// If both dimensions are smaller than the minimum size,
// use the minimum size as our preferred size.
return minimumSize;
- }
-
- int[] computeSizes(int[] constraints, int availableSpace,
- boolean computingRows) {
- int[] result = computeMinSizes(constraints, computingRows);
-
- int totalFixed = sumOfSizes(result);
- int denominator = getResizeDenominator(computingRows);
- int numRows = gridInfo.getNumRows(computingRows);
-
- if (totalFixed < availableSpace) {
- int remaining = availableSpace - totalFixed;
-
- for (int idx = 0; idx < numRows && denominator > 0; idx++) {
- Row row = getRow(idx, computingRows);
-
- if (row.grows) {
- int greed = row.size;
- int amount = remaining * greed / denominator;
-
- result[idx] += amount;
- remaining -= amount;
- denominator -= greed;
- }
- }
- }
-
- return result;
- }
-
- /**
- * Computes one dimension of the preferred size of the layout.
- *
- * @param hint contains the result if already known, or SWT.DEFAULT if it needs to be computed
- * @param constraints contains constraints along the other dimension, or SWT.DEFAULT if none. For
- * example, if we are computing the preferred row sizes, this would be an array of known column sizes.
- * @param computingRows if true, this method returns the height (pixels). Otherwise, it returns the
- * width (pixels).
- */
- int preferredSize(int[] constraints, boolean computingRows) {
- int[] fixedSizes = computeMinSizes(constraints, computingRows);
-
- return sumOfSizes(fixedSizes)
- + getDynamicSize(constraints, fixedSizes, computingRows);
- }
-
- /**
- * Computes the sum of all integers in the given array. If any of the entries are SWT.DEFAULT,
- * the result is SWT.DEFAULT.
- */
- static int sumOfSizes(int[] input) {
- return sumOfSizes(input, 0, input.length);
- }
-
- static int sumOfSizes(int[] input, int start, int length) {
- int sum = 0;
- for (int idx = start; idx < start + length; idx++) {
- int next = input[idx];
-
- if (next == SWT.DEFAULT) {
- return SWT.DEFAULT;
- }
-
- sum += next;
- }
-
- return sum;
- }
-
- /**
- * Returns the preferred dynamic width of the layout
- *
- * @param constraints
- * @param fixedSizes
- * @param computingRows
- * @return
- */
- int getDynamicSize(int[] constraints, int[] fixedSizes,
- boolean computingRows) {
- int result = 0;
- int numerator = getResizeDenominator(computingRows);
-
- // If no resizable columns, return
- if (numerator == 0) {
- return 0;
- }
-
- int rowSpacing = computingRows ? verticalSpacing : horizontalSpacing;
- int colSpacing = computingRows ? horizontalSpacing : verticalSpacing;
-
- int numControls = gridInfo.controls.length;
- for (int idx = 0; idx < numControls; idx++) {
- int controlRowStart = gridInfo.getStartPos(idx, computingRows);
- int controlRowSpan = getSpan(idx, computingRows);
- int controlColStart = gridInfo.getStartPos(idx, !computingRows);
- int controlColSpan = getSpan(idx, !computingRows);
-
- int denominator = getGrowthRatio(controlRowStart, controlRowSpan,
- computingRows);
-
- if (denominator > 0) {
-
- int widthHint = sumOfSizes(constraints, controlColStart,
- controlColSpan);
- if (widthHint != SWT.DEFAULT) {
- widthHint += colSpacing * (controlColSpan - 1);
- }
-
- // Compute the total control size
- int controlSize = computeControlSize(idx, widthHint,
- computingRows);
-
- // Subtract the amount that overlaps fixed-size columns
- controlSize -= sumOfSizes(fixedSizes, controlRowStart,
- controlRowSpan);
-
- // Subtract the amount that overlaps spacing between cells
- controlSize -= (rowSpacing * (controlRowSpan - 1));
-
- result = Math
- .max(result, controlSize * numerator / denominator);
- }
- }
-
- return result;
- }
-
- /**
- * Computes one dimension of a control's size
- *
- * @param control the index of the control being computed
- * @param constraint the other dimension of the control's size, or SWT.DEFAULT if unknown
- * @param computingHeight if true, this method returns a height. Else it returns a width
- * @return the preferred height or width of the control, in pixels
- */
- int computeControlSize(int control, int constraint, boolean computingHeight) {
- CellData data = gridInfo.getCellData(control);
-
- // If we're looking for the preferred size of the control (without hints)
- if (constraint == SWT.DEFAULT) {
- Point result = data.computeSize(cache.getCache(control),
- SWT.DEFAULT, SWT.DEFAULT);
-
- // Return result
- if (computingHeight) {
- return result.y;
- }
- return result.x;
- }
-
- // Compute a height
- if (computingHeight) {
- return data.computeSize(cache.getCache(control), constraint,
- SWT.DEFAULT).y;
- }
-
- return data.computeSize(cache.getCache(control), SWT.DEFAULT,
- constraint).x;
- }
-
- /**
- * Returns the relative amount that a control starting on the given row and spanning
- * the given length will contribute
- *
- * @param start
- * @param length
- * @param computingRows
- * @return
- */
- int getGrowthRatio(int start, int length, boolean computingRows) {
- boolean willGrow = false;
- int sum = 0;
-
- int end = start + length;
- for (int idx = start; idx < end; idx++) {
- Row row = getRow(idx, computingRows);
-
- if (row.largerThanChildren && row.grows) {
- willGrow = true;
- }
-
- sum += row.size;
- }
-
- if (!willGrow) {
- return 0;
- }
-
- return sum;
- }
-
- int[] computeMinSizes(int[] constraints, boolean computingRows) {
- // We cache the result of this function since it might be called more than once
- // for a single size computation
- int[] result = computingRows ? cachedRowMin : cachedColMin;
-
- if (result == null) {
- int columnSpacing;
- int rowSpacing;
-
- if (computingRows) {
- columnSpacing = horizontalSpacing;
- rowSpacing = verticalSpacing;
- } else {
- columnSpacing = verticalSpacing;
- rowSpacing = horizontalSpacing;
- }
-
- int rowCount = gridInfo.getNumRows(computingRows);
- result = new int[rowCount];
- int colCount = gridInfo.getNumRows(!computingRows);
- int[] rowControls = new int[colCount];
-
- int lastGrowingRow = -1;
-
- for (int idx = 0; idx < rowCount; idx++) {
- Row row = getRow(idx, computingRows);
-
- if (row.grows) {
- // There is no minimum size for growing rows
- lastGrowingRow = idx;
- result[idx] = 0;
- } else {
- result[idx] = row.size;
-
- if (row.largerThanChildren) {
- // Determine which controls are in this row
- gridInfo.getRow(rowControls, idx, computingRows);
-
- for (int control : rowControls) {
- // The getRow method will insert -1 into empty cells... skip these.
- if (control != -1) {
- int controlStart = gridInfo.getStartPos(
- control, computingRows);
- int controlSpan = getSpan(control,
- computingRows);
-
- // If the control ends on this row and does not span any growing rows
- if (controlStart + controlSpan - 1 == idx
- && controlStart > lastGrowingRow) {
- int controlColStart = gridInfo.getStartPos(
- control, !computingRows);
- int controlColSpan = getSpan(control,
- !computingRows);
- int controlRowSpan = getSpan(control,
- computingRows);
-
- // Compute the width constraint for this control
- int spannedWidth = sumOfSizes(constraints,
- controlColStart, controlColSpan);
- if (spannedWidth != SWT.DEFAULT) {
- spannedWidth += (columnSpacing * (controlSpan - 1));
- }
-
- int controlHeight = computeControlSize(
- control, spannedWidth,
- computingRows);
-
- // Determine how much of the control spans already allocated columns
- int allocatedHeight = sumOfSizes(result,
- controlColStart, controlRowSpan - 1)
- + (rowSpacing * (controlRowSpan - 1));
-
- result[idx] = Math.max(result[idx],
- controlHeight - allocatedHeight);
- }
- }
- }
- }
- }
- }
- }
-
- // Cache this result
- if (computingRows) {
- cachedRowMin = result;
- } else {
- cachedColMin = result;
- }
-
- return result;
- }
-
- /**
- * Returns the height constraints that should be used when computing column widths. Requires initGrid
- * to have been called first.
- *
- * @param result Will contain the height constraint for row i in the ith position of the array,
- * or SWT.DEFAULT if there is no constraint on that row.
- */
- private int[] computeConstraints(boolean horizontal) {
- // Initialize the height constraints for each row (basically, these will always be SWT.DEFAULT,
- // except for rows of type FixedRow, which have a constant height).
- int numRows = gridInfo.getNumRows(horizontal);
- int[] result = new int[numRows];
-
- for (int idx = 0; idx < numRows; idx++) {
- Row row = getRow(idx, horizontal);
-
- if (!(row.grows || row.largerThanChildren)) {
- result[idx] = row.size;
- } else {
- result[idx] = SWT.DEFAULT;
- }
- }
-
- return result;
- }
-
- /**
- * Computes the total greediness of all rows
- *
- * @return the total greediness of all rows
- */
- private int getResizeDenominator(boolean horizontal) {
- int result = 0;
- int numRows = gridInfo.getNumRows(horizontal);
-
- for (int idx = 0; idx < numRows; idx++) {
- Row row = getRow(idx, horizontal);
-
- if (row.grows) {
- result += row.size;
- }
- }
-
- return result;
- }
-
- // /**
- // * Computes the total fixed height of all rows
- // *
- // * @param widthConstraints array where the nth entry indicates the known width of the
- // * nth column, or SWT.DEFAULT if the width is still unknown
- // *
- // * @return the total fixed height for all rows
- // */
- // private int getMinimumSize(int[] constraints, boolean horizontal) {
- // Control[] controls = new Control[gridInfo.getRows()];
- // int result = 0;
- // int numRows = gridInfo.getRows();
- //
- // for (int idx = 0; idx < numRows; idx++) {
- // result += getRow(idx).getFixedHeight(gridInfo, widthConstraints, idx);
- // }
- //
- // return result;
- // }
-
- protected int getSpan(int controlId, boolean isRow) {
- CellData data = gridInfo.getCellData(controlId);
-
- if (isRow) {
- return data.verticalSpan;
- }
- return data.horizontalSpan;
- }
-
- /**
- * Returns the total space that will be required for margins and spacing between and
- * around cells. initGrid(...) must have been called first.
- *
- * @return
- */
- private Point totalEmptySpace() {
- int numRows = gridInfo.getRows();
-
- return new Point((2 * marginWidth)
- + ((gridInfo.getCols() - 1) * horizontalSpacing),
- (2 * marginHeight) + ((numRows - 1) * verticalSpacing));
- }
-
- /**
- * Returns the absolute positions of each row, given the start position, row sizes,
- * and row spacing
- *
- * @param startPos position of the initial row
- * @param sizes array of row sizes (pixels)
- * @param spacing space between each row (pixels)
- * @return array of row positions. The result size is sizes.length + 1. The last entry is
- * the position of the end of the layout.
- */
- private static int[] computeRowPositions(int startPos, int[] sizes,
- int spacing) {
- int[] result = new int[sizes.length + 1];
-
- result[0] = startPos;
- for (int idx = 0; idx < sizes.length; idx++) {
- result[idx + 1] = result[idx] + sizes[idx] + spacing;
- }
-
- return result;
- }
-
- @Override
+ }
+
+ int[] computeSizes(int[] constraints, int availableSpace, boolean computingRows) {
+ int[] result = computeMinSizes(constraints, computingRows);
+
+ int totalFixed = sumOfSizes(result);
+ int denominator = getResizeDenominator(computingRows);
+ int numRows = gridInfo.getNumRows(computingRows);
+
+ if (totalFixed < availableSpace) {
+ int remaining = availableSpace - totalFixed;
+
+ for (int idx = 0; idx < numRows && denominator > 0; idx++) {
+ Row row = getRow(idx, computingRows);
+
+ if (row.grows) {
+ int greed = row.size;
+ int amount = remaining * greed / denominator;
+
+ result[idx] += amount;
+ remaining -= amount;
+ denominator -= greed;
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Computes one dimension of the preferred size of the layout.
+ *
+ * @param hint contains the result if already known, or SWT.DEFAULT if
+ * it needs to be computed
+ * @param constraints contains constraints along the other dimension, or
+ * SWT.DEFAULT if none. For example, if we are computing
+ * the preferred row sizes, this would be an array of known
+ * column sizes.
+ * @param computingRows if true, this method returns the height (pixels).
+ * Otherwise, it returns the width (pixels).
+ */
+ int preferredSize(int[] constraints, boolean computingRows) {
+ int[] fixedSizes = computeMinSizes(constraints, computingRows);
+
+ return sumOfSizes(fixedSizes) + getDynamicSize(constraints, fixedSizes, computingRows);
+ }
+
+ /**
+ * Computes the sum of all integers in the given array. If any of the entries
+ * are SWT.DEFAULT, the result is SWT.DEFAULT.
+ */
+ static int sumOfSizes(int[] input) {
+ return sumOfSizes(input, 0, input.length);
+ }
+
+ static int sumOfSizes(int[] input, int start, int length) {
+ int sum = 0;
+ for (int idx = start; idx < start + length; idx++) {
+ int next = input[idx];
+
+ if (next == SWT.DEFAULT) {
+ return SWT.DEFAULT;
+ }
+
+ sum += next;
+ }
+
+ return sum;
+ }
+
+ /**
+ * Returns the preferred dynamic width of the layout
+ *
+ * @param constraints
+ * @param fixedSizes
+ * @param computingRows
+ * @return
+ */
+ int getDynamicSize(int[] constraints, int[] fixedSizes, boolean computingRows) {
+ int result = 0;
+ int numerator = getResizeDenominator(computingRows);
+
+ // If no resizable columns, return
+ if (numerator == 0) {
+ return 0;
+ }
+
+ int rowSpacing = computingRows ? verticalSpacing : horizontalSpacing;
+ int colSpacing = computingRows ? horizontalSpacing : verticalSpacing;
+
+ int numControls = gridInfo.controls.length;
+ for (int idx = 0; idx < numControls; idx++) {
+ int controlRowStart = gridInfo.getStartPos(idx, computingRows);
+ int controlRowSpan = getSpan(idx, computingRows);
+ int controlColStart = gridInfo.getStartPos(idx, !computingRows);
+ int controlColSpan = getSpan(idx, !computingRows);
+
+ int denominator = getGrowthRatio(controlRowStart, controlRowSpan, computingRows);
+
+ if (denominator > 0) {
+
+ int widthHint = sumOfSizes(constraints, controlColStart, controlColSpan);
+ if (widthHint != SWT.DEFAULT) {
+ widthHint += colSpacing * (controlColSpan - 1);
+ }
+
+ // Compute the total control size
+ int controlSize = computeControlSize(idx, widthHint, computingRows);
+
+ // Subtract the amount that overlaps fixed-size columns
+ controlSize -= sumOfSizes(fixedSizes, controlRowStart, controlRowSpan);
+
+ // Subtract the amount that overlaps spacing between cells
+ controlSize -= (rowSpacing * (controlRowSpan - 1));
+
+ result = Math.max(result, controlSize * numerator / denominator);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Computes one dimension of a control's size
+ *
+ * @param control the index of the control being computed
+ * @param constraint the other dimension of the control's size, or
+ * SWT.DEFAULT if unknown
+ * @param computingHeight if true, this method returns a height. Else it returns
+ * a width
+ * @return the preferred height or width of the control, in pixels
+ */
+ int computeControlSize(int control, int constraint, boolean computingHeight) {
+ CellData data = gridInfo.getCellData(control);
+
+ // If we're looking for the preferred size of the control (without hints)
+ if (constraint == SWT.DEFAULT) {
+ Point result = data.computeSize(cache.getCache(control), SWT.DEFAULT, SWT.DEFAULT);
+
+ // Return result
+ if (computingHeight) {
+ return result.y;
+ }
+ return result.x;
+ }
+
+ // Compute a height
+ if (computingHeight) {
+ return data.computeSize(cache.getCache(control), constraint, SWT.DEFAULT).y;
+ }
+
+ return data.computeSize(cache.getCache(control), SWT.DEFAULT, constraint).x;
+ }
+
+ /**
+ * Returns the relative amount that a control starting on the given row and
+ * spanning the given length will contribute
+ *
+ * @param start
+ * @param length
+ * @param computingRows
+ * @return
+ */
+ int getGrowthRatio(int start, int length, boolean computingRows) {
+ boolean willGrow = false;
+ int sum = 0;
+
+ int end = start + length;
+ for (int idx = start; idx < end; idx++) {
+ Row row = getRow(idx, computingRows);
+
+ if (row.largerThanChildren && row.grows) {
+ willGrow = true;
+ }
+
+ sum += row.size;
+ }
+
+ if (!willGrow) {
+ return 0;
+ }
+
+ return sum;
+ }
+
+ int[] computeMinSizes(int[] constraints, boolean computingRows) {
+ // We cache the result of this function since it might be called more than once
+ // for a single size computation
+ int[] result = computingRows ? cachedRowMin : cachedColMin;
+
+ if (result == null) {
+ int columnSpacing;
+ int rowSpacing;
+
+ if (computingRows) {
+ columnSpacing = horizontalSpacing;
+ rowSpacing = verticalSpacing;
+ } else {
+ columnSpacing = verticalSpacing;
+ rowSpacing = horizontalSpacing;
+ }
+
+ int rowCount = gridInfo.getNumRows(computingRows);
+ result = new int[rowCount];
+ int colCount = gridInfo.getNumRows(!computingRows);
+ int[] rowControls = new int[colCount];
+
+ int lastGrowingRow = -1;
+
+ for (int idx = 0; idx < rowCount; idx++) {
+ Row row = getRow(idx, computingRows);
+
+ if (row.grows) {
+ // There is no minimum size for growing rows
+ lastGrowingRow = idx;
+ result[idx] = 0;
+ } else {
+ result[idx] = row.size;
+
+ if (row.largerThanChildren) {
+ // Determine which controls are in this row
+ gridInfo.getRow(rowControls, idx, computingRows);
+
+ for (int control : rowControls) {
+ // The getRow method will insert -1 into empty cells... skip these.
+ if (control != -1) {
+ int controlStart = gridInfo.getStartPos(control, computingRows);
+ int controlSpan = getSpan(control, computingRows);
+
+ // If the control ends on this row and does not span any growing rows
+ if (controlStart + controlSpan - 1 == idx && controlStart > lastGrowingRow) {
+ int controlColStart = gridInfo.getStartPos(control, !computingRows);
+ int controlColSpan = getSpan(control, !computingRows);
+ int controlRowSpan = getSpan(control, computingRows);
+
+ // Compute the width constraint for this control
+ int spannedWidth = sumOfSizes(constraints, controlColStart, controlColSpan);
+ if (spannedWidth != SWT.DEFAULT) {
+ spannedWidth += (columnSpacing * (controlSpan - 1));
+ }
+
+ int controlHeight = computeControlSize(control, spannedWidth, computingRows);
+
+ // Determine how much of the control spans already allocated columns
+ int allocatedHeight = sumOfSizes(result, controlColStart, controlRowSpan - 1)
+ + (rowSpacing * (controlRowSpan - 1));
+
+ result[idx] = Math.max(result[idx], controlHeight - allocatedHeight);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // Cache this result
+ if (computingRows) {
+ cachedRowMin = result;
+ } else {
+ cachedColMin = result;
+ }
+
+ return result;
+ }
+
+ /**
+ * Returns the height constraints that should be used when computing column
+ * widths. Requires initGrid to have been called first.
+ *
+ * @param result Will contain the height constraint for row i in the ith
+ * position of the array, or SWT.DEFAULT if there is no constraint
+ * on that row.
+ */
+ private int[] computeConstraints(boolean horizontal) {
+ // Initialize the height constraints for each row (basically, these will always
+ // be SWT.DEFAULT,
+ // except for rows of type FixedRow, which have a constant height).
+ int numRows = gridInfo.getNumRows(horizontal);
+ int[] result = new int[numRows];
+
+ for (int idx = 0; idx < numRows; idx++) {
+ Row row = getRow(idx, horizontal);
+
+ if (!(row.grows || row.largerThanChildren)) {
+ result[idx] = row.size;
+ } else {
+ result[idx] = SWT.DEFAULT;
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Computes the total greediness of all rows
+ *
+ * @return the total greediness of all rows
+ */
+ private int getResizeDenominator(boolean horizontal) {
+ int result = 0;
+ int numRows = gridInfo.getNumRows(horizontal);
+
+ for (int idx = 0; idx < numRows; idx++) {
+ Row row = getRow(idx, horizontal);
+
+ if (row.grows) {
+ result += row.size;
+ }
+ }
+
+ return result;
+ }
+
+ // /**
+ // * Computes the total fixed height of all rows
+ // *
+ // * @param widthConstraints array where the nth entry indicates the known width
+ // of the
+ // * nth column, or SWT.DEFAULT if the width is still unknown
+ // *
+ // * @return the total fixed height for all rows
+ // */
+ // private int getMinimumSize(int[] constraints, boolean horizontal) {
+ // Control[] controls = new Control[gridInfo.getRows()];
+ // int result = 0;
+ // int numRows = gridInfo.getRows();
+ //
+ // for (int idx = 0; idx < numRows; idx++) {
+ // result += getRow(idx).getFixedHeight(gridInfo, widthConstraints, idx);
+ // }
+ //
+ // return result;
+ // }
+
+ protected int getSpan(int controlId, boolean isRow) {
+ CellData data = gridInfo.getCellData(controlId);
+
+ if (isRow) {
+ return data.verticalSpan;
+ }
+ return data.horizontalSpan;
+ }
+
+ /**
+ * Returns the total space that will be required for margins and spacing between
+ * and around cells. initGrid(...) must have been called first.
+ *
+ * @return
+ */
+ private Point totalEmptySpace() {
+ int numRows = gridInfo.getRows();
+
+ return new Point((2 * marginWidth) + ((gridInfo.getCols() - 1) * horizontalSpacing),
+ (2 * marginHeight) + ((numRows - 1) * verticalSpacing));
+ }
+
+ /**
+ * Returns the absolute positions of each row, given the start position, row
+ * sizes, and row spacing
+ *
+ * @param startPos position of the initial row
+ * @param sizes array of row sizes (pixels)
+ * @param spacing space between each row (pixels)
+ * @return array of row positions. The result size is sizes.length + 1. The last
+ * entry is the position of the end of the layout.
+ */
+ private static int[] computeRowPositions(int startPos, int[] sizes, int spacing) {
+ int[] result = new int[sizes.length + 1];
+
+ result[0] = startPos;
+ for (int idx = 0; idx < sizes.length; idx++) {
+ result[idx + 1] = result[idx] + sizes[idx] + spacing;
+ }
+
+ return result;
+ }
+
+ @Override
protected void layout(Composite composite, boolean flushCache) {
- Control[] children = composite.getChildren();
+ Control[] children = composite.getChildren();
- // If there are no children then this is a NO-OP
+ // If there are no children then this is a NO-OP
if (children.length == 0) {
- return;
+ return;
}
- initGrid(children);
+ initGrid(children);
- if (flushCache) {
- cache.flush();
- }
+ if (flushCache) {
+ cache.flush();
+ }
- Point emptySpace = totalEmptySpace();
+ Point emptySpace = totalEmptySpace();
- // Compute the area actually available for controls (once the margins and spacing is removed)
- int availableWidth = composite.getClientArea().width - emptySpace.x;
- int availableHeight = composite.getClientArea().height - emptySpace.y;
+ // Compute the area actually available for controls (once the margins and
+ // spacing is removed)
+ int availableWidth = composite.getClientArea().width - emptySpace.x;
+ int availableHeight = composite.getClientArea().height - emptySpace.y;
- int[] heights = computeConstraints(true);
+ int[] heights = computeConstraints(true);
- // Compute the actual column widths
+ // Compute the actual column widths
int[] widths = computeSizes(heights, availableWidth, false);
- // Compute the actual row heights (based on the actual column widths)
- heights = computeSizes(widths, availableHeight, true);
+ // Compute the actual row heights (based on the actual column widths)
+ heights = computeSizes(widths, availableHeight, true);
- Rectangle currentCell = new Rectangle(0, 0, 0, 0);
+ Rectangle currentCell = new Rectangle(0, 0, 0, 0);
- int[] starty = computeRowPositions(composite.getClientArea().y
- + marginHeight, heights, verticalSpacing);
- int[] startx = computeRowPositions(composite.getClientArea().x
- + marginWidth, widths, horizontalSpacing);
+ int[] starty = computeRowPositions(composite.getClientArea().y + marginHeight, heights, verticalSpacing);
+ int[] startx = computeRowPositions(composite.getClientArea().x + marginWidth, widths, horizontalSpacing);
- int numChildren = gridInfo.controls.length;
- for (int controlId = 0; controlId < numChildren; controlId++) {
- CellData data = gridInfo.getCellData(controlId);
+ int numChildren = gridInfo.controls.length;
+ for (int controlId = 0; controlId < numChildren; controlId++) {
+ CellData data = gridInfo.getCellData(controlId);
- int row = gridInfo.controlRow[controlId];
- int col = gridInfo.controlCol[controlId];
+ int row = gridInfo.controlRow[controlId];
+ int col = gridInfo.controlCol[controlId];
- currentCell.x = startx[col];
- currentCell.width = startx[col + data.horizontalSpan]
- - currentCell.x - horizontalSpacing;
+ currentCell.x = startx[col];
+ currentCell.width = startx[col + data.horizontalSpan] - currentCell.x - horizontalSpacing;
- currentCell.y = starty[row];
- currentCell.height = starty[row + data.verticalSpan]
- - currentCell.y - verticalSpacing;
+ currentCell.y = starty[row];
+ currentCell.height = starty[row + data.verticalSpan] - currentCell.y - verticalSpacing;
- data.positionControl(cache.getCache(controlId), currentCell);
- }
- }
+ data.positionControl(cache.getCache(controlId), currentCell);
+ }
+ }
- /**
- * @return
- */
- public int getColumns() {
- return numCols;
- }
+ /**
+ * @return
+ */
+ public int getColumns() {
+ return numCols;
+ }
- public boolean canGrow(Composite composite, boolean horizontally) {
- initGrid(composite.getChildren());
+ public boolean canGrow(Composite composite, boolean horizontally) {
+ initGrid(composite.getChildren());
- int numRows = gridInfo.getNumRows(horizontally);
+ int numRows = gridInfo.getNumRows(horizontally);
- for (int idx = 0; idx < numRows; idx++) {
- Row row = getRow(idx, horizontally);
+ for (int idx = 0; idx < numRows; idx++) {
+ Row row = getRow(idx, horizontally);
- if (row.grows) {
- return true;
- }
- }
+ if (row.grows) {
+ return true;
+ }
+ }
- return false;
+ return false;
- }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/CellLayoutUtil.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/CellLayoutUtil.java
index 0a9e6d3f1a2..bdff90ae9ca 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/CellLayoutUtil.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/CellLayoutUtil.java
@@ -22,94 +22,94 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
/**
- * Contains helper methods for CellLayout. Many of these methods are workarounds for
- * known SWT bugs. They should be updated once the original bugs are fixed in SWT.
+ * Contains helper methods for CellLayout. Many of these methods are workarounds
+ * for known SWT bugs. They should be updated once the original bugs are fixed
+ * in SWT.
*
* @since 3.0
*/
class CellLayoutUtil {
- private static Point zero = new Point(0, 0);
+ private static Point zero = new Point(0, 0);
- private static Point minimumShellSize;
+ private static Point minimumShellSize;
- private static CellData defaultData = new CellData();
+ private static CellData defaultData = new CellData();
- /**
- * Returns the minimum size for the given composite. That is,
- * this returns the smallest values that will have any effect
- * when passed into the composite's setSize method. Passing any
- * smaller value is equivalent to passing the minimum size.
- * <p>
- * This method is intended for use by layouts. The layout can
- * use this information when determining its preferred size.
- * Returning a preferred size smaller than the composite's
- * minimum size is pointless since the composite could never
- * be set to that size. The layout may choose a different preferred
- * size in this situation.
- * </p><p>
- * Note that this method is only concerned with restrictions imposed
- * by the composite; not it's layout. If the only restriction on the
- * composite's size is imposed by the layout, then this method returns (0,0).
- * </p><p>
- * Currently SWT does not expose this information through
- * API, so this method is developed using trial-and-error. Whenever
- * a composite is discovered that will not accept sizes below
- * a certain threshold on some platform, this method should be
- * updated to reflect that fact.
- * </p><p>
- * At this time, the only known composite that has a minimum size
- * are Shells.
- * </p>
- *
- * @param toCompute the composite whose minimum size is being computed
- * @return a size, in pixels, which is the smallest value that can be
- * passed into the composite's setSize(...) method.
- */
- static Point computeMinimumSize(Composite toCompute) {
- if (toCompute instanceof Shell) {
- if (minimumShellSize == null) {
- Shell testShell = new Shell((Shell) toCompute, SWT.DIALOG_TRIM
- | SWT.RESIZE);
- testShell.setSize(0, 0);
- minimumShellSize = testShell.getSize();
- testShell.dispose();
- }
+ /**
+ * Returns the minimum size for the given composite. That is, this returns the
+ * smallest values that will have any effect when passed into the composite's
+ * setSize method. Passing any smaller value is equivalent to passing the
+ * minimum size.
+ * <p>
+ * This method is intended for use by layouts. The layout can use this
+ * information when determining its preferred size. Returning a preferred size
+ * smaller than the composite's minimum size is pointless since the composite
+ * could never be set to that size. The layout may choose a different preferred
+ * size in this situation.
+ * </p>
+ * <p>
+ * Note that this method is only concerned with restrictions imposed by the
+ * composite; not it's layout. If the only restriction on the composite's size
+ * is imposed by the layout, then this method returns (0,0).
+ * </p>
+ * <p>
+ * Currently SWT does not expose this information through API, so this method is
+ * developed using trial-and-error. Whenever a composite is discovered that will
+ * not accept sizes below a certain threshold on some platform, this method
+ * should be updated to reflect that fact.
+ * </p>
+ * <p>
+ * At this time, the only known composite that has a minimum size are Shells.
+ * </p>
+ *
+ * @param toCompute the composite whose minimum size is being computed
+ * @return a size, in pixels, which is the smallest value that can be passed
+ * into the composite's setSize(...) method.
+ */
+ static Point computeMinimumSize(Composite toCompute) {
+ if (toCompute instanceof Shell) {
+ if (minimumShellSize == null) {
+ Shell testShell = new Shell((Shell) toCompute, SWT.DIALOG_TRIM | SWT.RESIZE);
+ testShell.setSize(0, 0);
+ minimumShellSize = testShell.getSize();
+ testShell.dispose();
+ }
- return minimumShellSize;
- }
+ return minimumShellSize;
+ }
- // If any other composites are discovered to have minimum sizes,
- // add heuristics for them here.
+ // If any other composites are discovered to have minimum sizes,
+ // add heuristics for them here.
- // Otherwise, the composite can be reduced to size (0,0)
+ // Otherwise, the composite can be reduced to size (0,0)
- return zero;
- }
+ return zero;
+ }
- /**
- * Returns the CellData associated with the given control. If the control
- * does not have any layout data associated with it, a default object is returned.
- * If the control has a GridData object associated with it, an equivalent
- * CellData object will be returned.
- *
- * @param control
- * @return
- */
- static CellData getData(Control control) {
- Object layoutData = control.getLayoutData();
- CellData data = null;
+ /**
+ * Returns the CellData associated with the given control. If the control does
+ * not have any layout data associated with it, a default object is returned. If
+ * the control has a GridData object associated with it, an equivalent CellData
+ * object will be returned.
+ *
+ * @param control
+ * @return
+ */
+ static CellData getData(Control control) {
+ Object layoutData = control.getLayoutData();
+ CellData data = null;
- if (layoutData instanceof CellData) {
- data = (CellData) layoutData;
- } else if (layoutData instanceof GridData) {
- data = new CellData((GridData) layoutData);
- }
+ if (layoutData instanceof CellData) {
+ data = (CellData) layoutData;
+ } else if (layoutData instanceof GridData) {
+ data = new CellData((GridData) layoutData);
+ }
- if (data == null) {
- data = defaultData;
- }
+ if (data == null) {
+ data = defaultData;
+ }
- return data;
- }
+ return data;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/GridInfo.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/GridInfo.java
index e739a5664fc..6516860f47f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/GridInfo.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/GridInfo.java
@@ -20,153 +20,154 @@ import org.eclipse.swt.widgets.Control;
* Computes and the positions of controls in a CellLayout, based on their span.
*/
class GridInfo {
- private int cols = 0;
-
- private int rows = 0;
-
- private int[] gridInfo;
-
- int[] controlRow;
-
- int[] controlCol;
-
- private CellData[] cellData;
-
- Control[] controls;
-
- /**
- * Initialize the grid
- *
- * @param newControls
- * @param cols
- */
- public void initGrid(Control[] newControls, CellLayout layout) {
- cols = layout.getColumns();
- controls = newControls;
-
- int area = 0;
- int totalWidth = 0;
-
- controlRow = new int[controls.length];
- controlCol = new int[controls.length];
-
- // Get the CellData objects for each control, and compute
- // the total number of cells spanned by controls in this layout.
- cellData = new CellData[controls.length];
- for (int idx = 0; idx < controls.length; idx++) {
- if (controls[idx] == null) {
- continue;
- }
-
- CellData next = CellLayoutUtil.getData(controls[idx]);
- cellData[idx] = next;
- area += next.horizontalSpan * next.verticalSpan;
- totalWidth += next.horizontalSpan;
- }
-
- // Compute the number of columns
- if (cols == 0) {
- cols = totalWidth;
- }
-
- // Compute the number of rows
- rows = area / cols;
- if (area % cols > 0) {
- // Ensure we count any partial rows
- rows++;
- }
-
- area = rows * cols;
-
- // Allocate the gridInfo array
- gridInfo = new int[area];
- for (int idx = 0; idx < area; idx++) {
- gridInfo[idx] = -1;
- }
-
- int infoIdx = 0;
- // Compute the positions of each control
- for (int idx = 0; idx < controls.length; idx++) {
- CellData data = cellData[idx];
-
- // Find an empty position to insert the control
- while (gridInfo[infoIdx] >= 0) {
- infoIdx++;
- }
-
- controlRow[idx] = infoIdx / cols;
- controlCol[idx] = infoIdx % cols;
-
- // Insert the new control here
- for (int rowIdx = 0; rowIdx < data.verticalSpan; rowIdx++) {
- for (int colIdx = 0; colIdx < data.horizontalSpan; colIdx++) {
- gridInfo[infoIdx + rowIdx * cols + colIdx] = idx;
- }
- }
-
- infoIdx += data.horizontalSpan;
- }
- }
-
- public int getRows() {
- return rows;
- }
-
- public int getStartPos(int control, boolean row) {
- if (row) {
- return controlRow[control];
- }
+ private int cols = 0;
+
+ private int rows = 0;
+
+ private int[] gridInfo;
+
+ int[] controlRow;
+
+ int[] controlCol;
+
+ private CellData[] cellData;
+
+ Control[] controls;
+
+ /**
+ * Initialize the grid
+ *
+ * @param newControls
+ * @param cols
+ */
+ public void initGrid(Control[] newControls, CellLayout layout) {
+ cols = layout.getColumns();
+ controls = newControls;
+
+ int area = 0;
+ int totalWidth = 0;
+
+ controlRow = new int[controls.length];
+ controlCol = new int[controls.length];
+
+ // Get the CellData objects for each control, and compute
+ // the total number of cells spanned by controls in this layout.
+ cellData = new CellData[controls.length];
+ for (int idx = 0; idx < controls.length; idx++) {
+ if (controls[idx] == null) {
+ continue;
+ }
+
+ CellData next = CellLayoutUtil.getData(controls[idx]);
+ cellData[idx] = next;
+ area += next.horizontalSpan * next.verticalSpan;
+ totalWidth += next.horizontalSpan;
+ }
+
+ // Compute the number of columns
+ if (cols == 0) {
+ cols = totalWidth;
+ }
+
+ // Compute the number of rows
+ rows = area / cols;
+ if (area % cols > 0) {
+ // Ensure we count any partial rows
+ rows++;
+ }
+
+ area = rows * cols;
+
+ // Allocate the gridInfo array
+ gridInfo = new int[area];
+ for (int idx = 0; idx < area; idx++) {
+ gridInfo[idx] = -1;
+ }
+
+ int infoIdx = 0;
+ // Compute the positions of each control
+ for (int idx = 0; idx < controls.length; idx++) {
+ CellData data = cellData[idx];
+
+ // Find an empty position to insert the control
+ while (gridInfo[infoIdx] >= 0) {
+ infoIdx++;
+ }
+
+ controlRow[idx] = infoIdx / cols;
+ controlCol[idx] = infoIdx % cols;
+
+ // Insert the new control here
+ for (int rowIdx = 0; rowIdx < data.verticalSpan; rowIdx++) {
+ for (int colIdx = 0; colIdx < data.horizontalSpan; colIdx++) {
+ gridInfo[infoIdx + rowIdx * cols + colIdx] = idx;
+ }
+ }
+
+ infoIdx += data.horizontalSpan;
+ }
+ }
+
+ public int getRows() {
+ return rows;
+ }
+
+ public int getStartPos(int control, boolean row) {
+ if (row) {
+ return controlRow[control];
+ }
return controlCol[control];
- }
-
- /**
- * Returns the number of rows or columns
- *
- * @param isRow if true, returns the number of rows. If false, returns the number of columns
- * @return
- */
- public int getNumRows(boolean isRow) {
- if (isRow) {
- return rows;
+ }
+
+ /**
+ * Returns the number of rows or columns
+ *
+ * @param isRow if true, returns the number of rows. If false, returns the
+ * number of columns
+ * @return
+ */
+ public int getNumRows(boolean isRow) {
+ if (isRow) {
+ return rows;
}
return cols;
- }
+ }
- public void getRow(int[] result, int rowId, boolean horizontal) {
- if (horizontal) {
- int prev = -1;
- for (int colIdx = 0; colIdx < cols; colIdx++) {
- int next = gridInfo[cols * rowId + colIdx];
+ public void getRow(int[] result, int rowId, boolean horizontal) {
+ if (horizontal) {
+ int prev = -1;
+ for (int colIdx = 0; colIdx < cols; colIdx++) {
+ int next = gridInfo[cols * rowId + colIdx];
- if (prev == next) {
- result[colIdx] = -1;
- } else {
+ if (prev == next) {
+ result[colIdx] = -1;
+ } else {
result[colIdx] = next;
}
- prev = next;
- }
- } else {
- int prev = -1;
- for (int rowIdx = 0; rowIdx < rows; rowIdx++) {
- int next = gridInfo[cols * rowIdx + rowId];
+ prev = next;
+ }
+ } else {
+ int prev = -1;
+ for (int rowIdx = 0; rowIdx < rows; rowIdx++) {
+ int next = gridInfo[cols * rowIdx + rowId];
- if (prev == next) {
- result[rowIdx] = -1;
- } else {
+ if (prev == next) {
+ result[rowIdx] = -1;
+ } else {
result[rowIdx] = next;
}
- prev = next;
- }
- }
- }
+ prev = next;
+ }
+ }
+ }
- public CellData getCellData(int controlId) {
- return cellData[controlId];
- }
+ public CellData getCellData(int controlId) {
+ return cellData[controlId];
+ }
- public int getCols() {
- return cols;
- }
+ public int getCols() {
+ return cols;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/ICachingLayout.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/ICachingLayout.java
index 1fe8e8a0958..9eba97b52e1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/ICachingLayout.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/ICachingLayout.java
@@ -17,22 +17,22 @@ package org.eclipse.ui.internal.layout;
import org.eclipse.swt.widgets.Control;
/**
- * Layouts that implement this interface are capable of caching the
- * sizes of child controls in a manner that allows the information
- * for a single control to be flushed without affecting the remaining
- * controls. These layouts will ignore the "changed" arguments to layout(...)
- * and computeSize(...), however they will flush their cache for individual
- * controls when the flush(...) method is called.
+ * Layouts that implement this interface are capable of caching the sizes of
+ * child controls in a manner that allows the information for a single control
+ * to be flushed without affecting the remaining controls. These layouts will
+ * ignore the "changed" arguments to layout(...) and computeSize(...), however
+ * they will flush their cache for individual controls when the flush(...)
+ * method is called.
* <p>
- * This allows for much more efficient layouts, since most of the cache
- * can be reused when a child control changes.
+ * This allows for much more efficient layouts, since most of the cache can be
+ * reused when a child control changes.
* </p>
*
* @since 3.0
*/
public interface ICachingLayout {
- /**
- * Flushes cached data for the given control
- */
- void flush(Control dirtyControl);
+ /**
+ * Flushes cached data for the given control
+ */
+ void flush(Control dirtyControl);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/LayoutCache.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/LayoutCache.java
index 4cc15d6d4d3..25c744f9c66 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/LayoutCache.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/LayoutCache.java
@@ -22,102 +22,102 @@ import org.eclipse.swt.widgets.Control;
* @since 3.0
*/
public class LayoutCache {
- private SizeCache[] caches = new SizeCache[0];
+ private SizeCache[] caches = new SizeCache[0];
- /**
- * Creates an empty layout cache
- */
- public LayoutCache() {
- }
+ /**
+ * Creates an empty layout cache
+ */
+ public LayoutCache() {
+ }
- /**
- * Creates a cache for the given array of controls
- *
- * @param controls
- */
- public LayoutCache(Control[] controls) {
- rebuildCache(controls);
- }
+ /**
+ * Creates a cache for the given array of controls
+ *
+ * @param controls
+ */
+ public LayoutCache(Control[] controls) {
+ rebuildCache(controls);
+ }
- /**
- * Returns the size cache for the given control
- *
- * @param idx
- * @return
- */
- public SizeCache getCache(int idx) {
- return caches[idx];
- }
+ /**
+ * Returns the size cache for the given control
+ *
+ * @param idx
+ * @return
+ */
+ public SizeCache getCache(int idx) {
+ return caches[idx];
+ }
- /**
- * Sets the controls that are being cached here. If these are the same
- * controls that were used last time, this method does nothing. Otherwise,
- * the cache is flushed and a new cache is created for the new controls.
- *
- * @param controls
- */
- public void setControls(Control[] controls) {
- // If the number of controls has changed, discard the entire cache
- if (controls.length != caches.length) {
- rebuildCache(controls);
- return;
- }
+ /**
+ * Sets the controls that are being cached here. If these are the same controls
+ * that were used last time, this method does nothing. Otherwise, the cache is
+ * flushed and a new cache is created for the new controls.
+ *
+ * @param controls
+ */
+ public void setControls(Control[] controls) {
+ // If the number of controls has changed, discard the entire cache
+ if (controls.length != caches.length) {
+ rebuildCache(controls);
+ return;
+ }
- for (int idx = 0; idx < controls.length; idx++) {
- caches[idx].setControl(controls[idx]);
- }
- }
+ for (int idx = 0; idx < controls.length; idx++) {
+ caches[idx].setControl(controls[idx]);
+ }
+ }
- /**
- * Creates a new size cache for the given set of controls, discarding any
- * existing cache.
- *
- * @param controls the controls whose size is being cached
- */
- private void rebuildCache(Control[] controls) {
- SizeCache[] newCache = new SizeCache[controls.length];
+ /**
+ * Creates a new size cache for the given set of controls, discarding any
+ * existing cache.
+ *
+ * @param controls the controls whose size is being cached
+ */
+ private void rebuildCache(Control[] controls) {
+ SizeCache[] newCache = new SizeCache[controls.length];
- for (int idx = 0; idx < controls.length; idx++) {
- // Try to reuse existing caches if possible
- if (idx < caches.length) {
- newCache[idx] = caches[idx];
- newCache[idx].setControl(controls[idx]);
- } else {
- newCache[idx] = new SizeCache(controls[idx]);
- }
- }
+ for (int idx = 0; idx < controls.length; idx++) {
+ // Try to reuse existing caches if possible
+ if (idx < caches.length) {
+ newCache[idx] = caches[idx];
+ newCache[idx].setControl(controls[idx]);
+ } else {
+ newCache[idx] = new SizeCache(controls[idx]);
+ }
+ }
- caches = newCache;
- }
+ caches = newCache;
+ }
- /**
- * Computes the preferred size of the nth control
- *
- * @param controlIndex index of the control whose size will be computed
- * @param widthHint width of the control (or SWT.DEFAULT if unknown)
- * @param heightHint height of the control (or SWT.DEFAULT if unknown)
- * @return the preferred size of the control
- */
- public Point computeSize(int controlIndex, int widthHint, int heightHint) {
- return caches[controlIndex].computeSize(widthHint, heightHint);
- }
+ /**
+ * Computes the preferred size of the nth control
+ *
+ * @param controlIndex index of the control whose size will be computed
+ * @param widthHint width of the control (or SWT.DEFAULT if unknown)
+ * @param heightHint height of the control (or SWT.DEFAULT if unknown)
+ * @return the preferred size of the control
+ */
+ public Point computeSize(int controlIndex, int widthHint, int heightHint) {
+ return caches[controlIndex].computeSize(widthHint, heightHint);
+ }
- /**
- * Flushes the cache for the given control. This should be called if exactly
- * one of the controls has changed but the remaining controls remain unmodified
- *
- * @param controlIndex
- */
- public void flush(int controlIndex) {
- caches[controlIndex].flush();
- }
+ /**
+ * Flushes the cache for the given control. This should be called if exactly one
+ * of the controls has changed but the remaining controls remain unmodified
+ *
+ * @param controlIndex
+ */
+ public void flush(int controlIndex) {
+ caches[controlIndex].flush();
+ }
- /**
- * Flushes the cache.
- */
- public void flush() {
- for (SizeCache cache : caches) {
- cache.flush();
- }
- }
+ /**
+ * Flushes the cache.
+ */
+ public void flush() {
+ for (SizeCache cache : caches) {
+ cache.flush();
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/LayoutUtil.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/LayoutUtil.java
index 444694dc819..1577de4ec42 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/LayoutUtil.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/LayoutUtil.java
@@ -27,33 +27,33 @@ import org.eclipse.swt.widgets.Shell;
*/
public class LayoutUtil {
- /**
- * Should be called whenever a control's contents have changed. Will
- * trigger a layout parent controls if necessary.
- *
- * @param changedControl
- */
- public static void resize(Control changedControl) {
- Composite parent = changedControl.getParent();
-
- Layout parentLayout = parent.getLayout();
-
- if (parentLayout instanceof ICachingLayout) {
- ((ICachingLayout) parentLayout).flush(changedControl);
- }
-
- if (parent instanceof Shell) {
- parent.layout(true);
- } else {
- Rectangle currentBounds = parent.getBounds();
-
- resize(parent);
-
- // If the parent was resized, then it has already triggered a
- // layout. Otherwise, we need to manually force it to layout again.
- if (currentBounds.equals(parent.getBounds())) {
- parent.layout(true);
- }
- }
- }
+ /**
+ * Should be called whenever a control's contents have changed. Will trigger a
+ * layout parent controls if necessary.
+ *
+ * @param changedControl
+ */
+ public static void resize(Control changedControl) {
+ Composite parent = changedControl.getParent();
+
+ Layout parentLayout = parent.getLayout();
+
+ if (parentLayout instanceof ICachingLayout) {
+ ((ICachingLayout) parentLayout).flush(changedControl);
+ }
+
+ if (parent instanceof Shell) {
+ parent.layout(true);
+ } else {
+ Rectangle currentBounds = parent.getBounds();
+
+ resize(parent);
+
+ // If the parent was resized, then it has already triggered a
+ // layout. Otherwise, we need to manually force it to layout again.
+ if (currentBounds.equals(parent.getBounds())) {
+ parent.layout(true);
+ }
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/Row.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/Row.java
index 789ac30d0fd..f32f445ce55 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/Row.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/Row.java
@@ -20,103 +20,106 @@ package org.eclipse.ui.internal.layout;
* @since 3.0
*/
public class Row {
- /**
- * True iff this row will expand to fill available space
- */
- boolean grows = false;
+ /**
+ * True iff this row will expand to fill available space
+ */
+ boolean grows = false;
- /**
- * Size of this row. For growing rows, this is the relative size
- * of the row with respect to other rows (ie: a row of size 100 is twice
- * as wide as a row of size 50). For fixed rows, this is the absolute size
- * of the row, in pixels.
- */
- int size = 0;
+ /**
+ * Size of this row. For growing rows, this is the relative size of the row with
+ * respect to other rows (ie: a row of size 100 is twice as wide as a row of
+ * size 50). For fixed rows, this is the absolute size of the row, in pixels.
+ */
+ int size = 0;
- /**
- * True iff this row should query its child controls for its size.
- */
- boolean largerThanChildren = true;
+ /**
+ * True iff this row should query its child controls for its size.
+ */
+ boolean largerThanChildren = true;
- /**
- * Creates a fixed-size row with the given width (pixels).
- * The preferred sizes of child controls are ignored.
- *
- * @param size
- */
- public Row(int size) {
- largerThanChildren = false;
- this.size = size;
- grows = false;
- }
+ /**
+ * Creates a fixed-size row with the given width (pixels). The preferred sizes
+ * of child controls are ignored.
+ *
+ * @param size
+ */
+ public Row(int size) {
+ largerThanChildren = false;
+ this.size = size;
+ grows = false;
+ }
- /**
- * Creates a row that automatically computes its size based on the preferred
- * sizes of its children.
- *
- * @param growing
- */
- public Row(boolean growing) {
- this.grows = growing;
+ /**
+ * Creates a row that automatically computes its size based on the preferred
+ * sizes of its children.
+ *
+ * @param growing
+ */
+ public Row(boolean growing) {
+ this.grows = growing;
- if (growing) {
- size = 100;
- }
- }
+ if (growing) {
+ size = 100;
+ }
+ }
- /**
- * Creates a growing row.
- *
- * @param sizeRatio determines the size of this row with respect to other growing rows
- * (for example, a row with size = 3 will be 3x as large as a row with size = 1)
- * @param largerThanChildren true iff the preferred size of this row should take into
- * account the preferred sizes of its children.
- */
- public Row(int size, boolean largerThanChildren) {
- this.grows = true;
- this.size = size;
- this.largerThanChildren = largerThanChildren;
- }
+ /**
+ * Creates a growing row.
+ *
+ * @param sizeRatio determines the size of this row with respect to
+ * other growing rows (for example, a row with size =
+ * 3 will be 3x as large as a row with size = 1)
+ * @param largerThanChildren true iff the preferred size of this row should take
+ * into account the preferred sizes of its children.
+ */
+ public Row(int size, boolean largerThanChildren) {
+ this.grows = true;
+ this.size = size;
+ this.largerThanChildren = largerThanChildren;
+ }
- /**
- * Construct and return a typical growing row.
- *
- * @return a growing row
- */
- public static Row growing() {
- return new Row(100, true);
- }
+ /**
+ * Construct and return a typical growing row.
+ *
+ * @return a growing row
+ */
+ public static Row growing() {
+ return new Row(100, true);
+ }
- /**
- * Construct and return a growing row with custom properties
- *
- * @param size relative size of this row with respect to other growing rows
- * @param largerThanChildren true iff the preferred size of this row should
- * be based on the preferred sizes of its children
- * @return a new Row
- */
- public static Row growing(int size, boolean largerThanChildren) {
- return new Row(size, largerThanChildren);
- }
+ /**
+ * Construct and return a growing row with custom properties
+ *
+ * @param size relative size of this row with respect to other
+ * growing rows
+ * @param largerThanChildren true iff the preferred size of this row should be
+ * based on the preferred sizes of its children
+ * @return a new Row
+ */
+ public static Row growing(int size, boolean largerThanChildren) {
+ return new Row(size, largerThanChildren);
+ }
- /**
- * Construct and return a fixed-size row. The row will not grow when the layout
- * is resized, and its size will be computed from the default sizes of its children.
- *
- * @return a new Row
- */
- public static Row fixed() {
- return new Row(false);
- }
+ /**
+ * Construct and return a fixed-size row. The row will not grow when the layout
+ * is resized, and its size will be computed from the default sizes of its
+ * children.
+ *
+ * @return a new Row
+ */
+ public static Row fixed() {
+ return new Row(false);
+ }
- /**
- * Construct and return a fixed-size row. The row will always have the given
- * width, regardless of the size of the layout or the preferred sizes of its children.
- *
- * @param pixels size of the row
- * @return a fixed-size row with the given width (in pixels)
- */
- public static Row fixed(int pixels) {
- return new Row(pixels);
- }
+ /**
+ * Construct and return a fixed-size row. The row will always have the given
+ * width, regardless of the size of the layout or the preferred sizes of its
+ * children.
+ *
+ * @param pixels size of the row
+ * @return a fixed-size row with the given width (in pixels)
+ */
+ public static Row fixed(int pixels) {
+ return new Row(pixels);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/SizeCache.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/SizeCache.java
index 8b76bb5f8fe..8fc8b6084f1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/SizeCache.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/SizeCache.java
@@ -37,331 +37,333 @@ import org.eclipse.swt.widgets.Tree;
* @since 3.0
*/
public class SizeCache {
- private Control control;
-
- private Point preferredSize;
-
- private Point cachedWidth;
-
- private Point cachedHeight;
-
- /**
- * True iff we should recursively flush all children on the next layout
- */
- private boolean flushChildren;
-
- /**
- * True iff changing the height hint does not affect the preferred width and changing
- * the width hint does not change the preferred height
- */
- private boolean independentDimensions = false;
-
- /**
- * True iff the preferred height for any hint larger than the preferred width will not
- * change the preferred height.
- */
- private boolean preferredWidthOrLargerIsMinimumHeight = false;
-
- // HACK: these values estimate how much to subtract from the width and height
- // hints that get passed into computeSize, in order to produce a result
- // that is exactly the desired size. To be removed once bug 46112 is fixed (note:
- // bug 46112 is currently flagged as a duplicate, but there is still no workaround).
- private int widthAdjustment = 0;
-
- private int heightAdjustment = 0;
-
- // END OF HACK
-
- public SizeCache() {
- this(null);
- }
-
- /**
- * Creates a cache for size computations on the given control
- *
- * @param control the control for which sizes will be calculated,
- * or null to always return (0,0)
- */
- public SizeCache(Control control) {
- setControl(control);
- }
-
- /**
- * Sets the control whose size is being cached. Does nothing (will not
- * even flush the cache) if this is the same control as last time or
- * it is already disposed.
- *
- * @param newControl the control whose size is being cached, or null to always return (0,0)
- */
- public void setControl(Control newControl) {
- if (newControl != control && !newControl.isDisposed()) {
- control = newControl;
- if (control == null) {
- independentDimensions = true;
- preferredWidthOrLargerIsMinimumHeight = false;
- widthAdjustment = 0;
- heightAdjustment = 0;
- } else {
- independentDimensions = independentLengthAndWidth(control);
- preferredWidthOrLargerIsMinimumHeight = isPreferredWidthMaximum(control);
- computeHintOffset(control);
- flush();
- }
- }
- }
-
- /**
- * Returns the control whose size is being cached
- *
- * @return the control whose size is being cached, or null if this cache always returns (0,0)
- */
- public Control getControl() {
- return control;
- }
-
- /**
- * Flush the cache (should be called if the control's contents may have changed since the
- * last query)
- */
- public void flush() {
- flush(true);
- }
-
- public void flush(boolean recursive) {
- preferredSize = null;
- cachedWidth = null;
- cachedHeight = null;
- this.flushChildren = recursive;
- }
-
- private Point getPreferredSize() {
- if (preferredSize == null) {
- preferredSize = computeSize(control, SWT.DEFAULT, SWT.DEFAULT);
- }
-
- return preferredSize;
- }
-
- /**
- * Computes the preferred size of the control.
- *
- * @param widthHint the known width of the control (pixels) or SWT.DEFAULT if unknown
- * @param heightHint the known height of the control (pixels) or SWT.DEFAULT if unknown
- * @return the preferred size of the control
- */
- public Point computeSize(int widthHint, int heightHint) {
- if (control == null) {
- return new Point(0, 0);
- }
-
- // If both dimensions were supplied in the input, return them verbatim
- if (widthHint != SWT.DEFAULT && heightHint != SWT.DEFAULT) {
- return new Point(widthHint, heightHint);
- }
-
- // No hints given -- find the preferred size
- if (widthHint == SWT.DEFAULT && heightHint == SWT.DEFAULT) {
- return Geometry.copy(getPreferredSize());
- }
-
- // If the length and width are independent, compute the preferred size
- // and adjust whatever dimension was supplied in the input
- if (independentDimensions) {
- Point result = Geometry.copy(getPreferredSize());
-
- if (widthHint != SWT.DEFAULT) {
- result.x = widthHint;
- }
-
- if (heightHint != SWT.DEFAULT) {
- result.y = heightHint;
- }
-
- return result;
- }
-
- // Computing a height
- if (heightHint == SWT.DEFAULT) {
- // If we know the control's preferred size
- if (preferredSize != null) {
- // If the given width is the preferred width, then return the preferred size
- if (widthHint == preferredSize.x) {
- return Geometry.copy(preferredSize);
- }
- }
-
- // If we have a cached height measurement
- if (cachedHeight != null) {
- // If this was measured with the same width hint
- if (cachedHeight.x == widthHint) {
- return Geometry.copy(cachedHeight);
- }
- }
-
- // If this is a control where any hint larger than the
- // preferred width results in the minimum height, determine if
- // we can compute the result based on the preferred height
- if (preferredWidthOrLargerIsMinimumHeight) {
- // Computed the preferred size (if we don't already know it)
- getPreferredSize();
-
- // If the width hint is larger than the preferred width, then
- // we can compute the result from the preferred width
- if (widthHint >= preferredSize.x) {
- Point result = Geometry.copy(preferredSize);
- result.x = widthHint;
- return result;
- }
- }
-
- // Else we can't find an existing size in the cache, so recompute
- // it from scratch.
- cachedHeight = computeSize(control, widthHint, heightHint);
-
- return Geometry.copy(cachedHeight);
- }
-
- // Computing a width
- if (widthHint == SWT.DEFAULT) {
- // If we know the control's preferred size
- if (preferredSize != null) {
- // If the given height is the preferred height, then return the preferred size
- if (heightHint == preferredSize.y) {
- return Geometry.copy(preferredSize);
- }
- }
-
- // If we have a cached width measurement
- if (cachedWidth != null) {
- // If this was measured with the same height hint
- if (cachedWidth.y == heightHint) {
- return Geometry.copy(cachedWidth);
- }
- }
-
- cachedWidth = computeSize(control, widthHint, heightHint);
-
- return Geometry.copy(cachedWidth);
- }
-
- return computeSize(control, widthHint, heightHint);
- }
-
- /**
- * Compute the control's size, and ensure that non-default hints are returned verbatim
- * (this tries to compensate for SWT's hints, which aren't really the outer width of the
- * control).
- *
- * @param control
- * @param widthHint
- * @param heightHint
- * @return
- */
- private Point computeSize(Control control, int widthHint, int heightHint) {
- int adjustedWidthHint = widthHint == SWT.DEFAULT ? SWT.DEFAULT : Math
- .max(0, widthHint - widthAdjustment);
- int adjustedHeightHint = heightHint == SWT.DEFAULT ? SWT.DEFAULT : Math
- .max(0, heightHint - heightAdjustment);
-
- Point result = control.computeSize(adjustedWidthHint,
- adjustedHeightHint, flushChildren);
- flushChildren = false;
-
- // If the amounts we subtracted off the widthHint and heightHint didn't do the trick, then
- // manually adjust the result to ensure that a non-default hint will return that result verbatim.
-
- if (widthHint != SWT.DEFAULT) {
- result.x = widthHint;
- }
-
- if (heightHint != SWT.DEFAULT) {
- result.y = heightHint;
- }
-
- return result;
- }
-
- /**
- * Returns true if the preferred length of the given control is
- * independent of the width and visa-versa. If this returns true,
- * then changing the widthHint argument to control.computeSize will
- * never change the resulting height and changing the heightHint
- * will never change the resulting width. Returns false if unknown.
- * <p>
- * This information can be used to improve caching. Incorrectly returning
- * a value of false may decrease performance, but incorrectly returning
- * a value of true will generate incorrect layouts... so always return
- * false if unsure.
- * </p>
- *
- * @param control
- * @return
- */
- static boolean independentLengthAndWidth(Control control) {
- if (control == null) {
- return true;
- }
-
- if (control instanceof Button || control instanceof ProgressBar
- || control instanceof Sash || control instanceof Scale
- || control instanceof Slider || control instanceof List
- || control instanceof Combo || control instanceof Tree) {
- return true;
- }
-
- if (control instanceof Label || control instanceof Text) {
- return (control.getStyle() & SWT.WRAP) == 0;
- }
-
- // Unless we're certain that the control has this property, we should
- // return false.
-
- return false;
- }
-
- /**
- * Try to figure out how much we need to subtract from the hints that we
- * pass into the given control's computeSize(...) method. This tries to
- * compensate for bug 46112. To be removed once SWT provides an "official"
- * way to compute one dimension of a control's size given the other known
- * dimension.
- *
- * @param control
- */
- private void computeHintOffset(Control control) {
- if (control instanceof Composite) {
- // For composites, subtract off the trim size
- Composite composite = (Composite) control;
- Rectangle trim = composite.computeTrim(0, 0, 0, 0);
-
- widthAdjustment = trim.width;
- heightAdjustment = trim.height;
- } else {
- // For non-composites, subtract off 2 * the border size
- widthAdjustment = control.getBorderWidth() * 2;
- heightAdjustment = widthAdjustment;
- }
- }
-
- /**
- * Returns true only if the control will return a constant height for any
- * width hint larger than the preferred width. Returns false if there is
- * any situation in which the control does not have this property.
- *
- * <p>
- * Note: this method is only important for wrapping controls, and it can
- * safely return false for anything else. AFAIK, all SWT controls have this
- * property, but to be safe they will only be added to the list once the
- * property has been confirmed.
- * </p>
- *
- * @param control
- * @return
- */
- private static boolean isPreferredWidthMaximum(Control control) {
- return (control instanceof ToolBar
- //|| control instanceof CoolBar
- || control instanceof Label);
- }
+ private Control control;
+
+ private Point preferredSize;
+
+ private Point cachedWidth;
+
+ private Point cachedHeight;
+
+ /**
+ * True iff we should recursively flush all children on the next layout
+ */
+ private boolean flushChildren;
+
+ /**
+ * True iff changing the height hint does not affect the preferred width and
+ * changing the width hint does not change the preferred height
+ */
+ private boolean independentDimensions = false;
+
+ /**
+ * True iff the preferred height for any hint larger than the preferred width
+ * will not change the preferred height.
+ */
+ private boolean preferredWidthOrLargerIsMinimumHeight = false;
+
+ // HACK: these values estimate how much to subtract from the width and height
+ // hints that get passed into computeSize, in order to produce a result
+ // that is exactly the desired size. To be removed once bug 46112 is fixed
+ // (note:
+ // bug 46112 is currently flagged as a duplicate, but there is still no
+ // workaround).
+ private int widthAdjustment = 0;
+
+ private int heightAdjustment = 0;
+
+ // END OF HACK
+
+ public SizeCache() {
+ this(null);
+ }
+
+ /**
+ * Creates a cache for size computations on the given control
+ *
+ * @param control the control for which sizes will be calculated, or null to
+ * always return (0,0)
+ */
+ public SizeCache(Control control) {
+ setControl(control);
+ }
+
+ /**
+ * Sets the control whose size is being cached. Does nothing (will not even
+ * flush the cache) if this is the same control as last time or it is already
+ * disposed.
+ *
+ * @param newControl the control whose size is being cached, or null to always
+ * return (0,0)
+ */
+ public void setControl(Control newControl) {
+ if (newControl != control && !newControl.isDisposed()) {
+ control = newControl;
+ if (control == null) {
+ independentDimensions = true;
+ preferredWidthOrLargerIsMinimumHeight = false;
+ widthAdjustment = 0;
+ heightAdjustment = 0;
+ } else {
+ independentDimensions = independentLengthAndWidth(control);
+ preferredWidthOrLargerIsMinimumHeight = isPreferredWidthMaximum(control);
+ computeHintOffset(control);
+ flush();
+ }
+ }
+ }
+
+ /**
+ * Returns the control whose size is being cached
+ *
+ * @return the control whose size is being cached, or null if this cache always
+ * returns (0,0)
+ */
+ public Control getControl() {
+ return control;
+ }
+
+ /**
+ * Flush the cache (should be called if the control's contents may have changed
+ * since the last query)
+ */
+ public void flush() {
+ flush(true);
+ }
+
+ public void flush(boolean recursive) {
+ preferredSize = null;
+ cachedWidth = null;
+ cachedHeight = null;
+ this.flushChildren = recursive;
+ }
+
+ private Point getPreferredSize() {
+ if (preferredSize == null) {
+ preferredSize = computeSize(control, SWT.DEFAULT, SWT.DEFAULT);
+ }
+
+ return preferredSize;
+ }
+
+ /**
+ * Computes the preferred size of the control.
+ *
+ * @param widthHint the known width of the control (pixels) or SWT.DEFAULT if
+ * unknown
+ * @param heightHint the known height of the control (pixels) or SWT.DEFAULT if
+ * unknown
+ * @return the preferred size of the control
+ */
+ public Point computeSize(int widthHint, int heightHint) {
+ if (control == null) {
+ return new Point(0, 0);
+ }
+
+ // If both dimensions were supplied in the input, return them verbatim
+ if (widthHint != SWT.DEFAULT && heightHint != SWT.DEFAULT) {
+ return new Point(widthHint, heightHint);
+ }
+
+ // No hints given -- find the preferred size
+ if (widthHint == SWT.DEFAULT && heightHint == SWT.DEFAULT) {
+ return Geometry.copy(getPreferredSize());
+ }
+
+ // If the length and width are independent, compute the preferred size
+ // and adjust whatever dimension was supplied in the input
+ if (independentDimensions) {
+ Point result = Geometry.copy(getPreferredSize());
+
+ if (widthHint != SWT.DEFAULT) {
+ result.x = widthHint;
+ }
+
+ if (heightHint != SWT.DEFAULT) {
+ result.y = heightHint;
+ }
+
+ return result;
+ }
+
+ // Computing a height
+ if (heightHint == SWT.DEFAULT) {
+ // If we know the control's preferred size
+ if (preferredSize != null) {
+ // If the given width is the preferred width, then return the preferred size
+ if (widthHint == preferredSize.x) {
+ return Geometry.copy(preferredSize);
+ }
+ }
+
+ // If we have a cached height measurement
+ if (cachedHeight != null) {
+ // If this was measured with the same width hint
+ if (cachedHeight.x == widthHint) {
+ return Geometry.copy(cachedHeight);
+ }
+ }
+
+ // If this is a control where any hint larger than the
+ // preferred width results in the minimum height, determine if
+ // we can compute the result based on the preferred height
+ if (preferredWidthOrLargerIsMinimumHeight) {
+ // Computed the preferred size (if we don't already know it)
+ getPreferredSize();
+
+ // If the width hint is larger than the preferred width, then
+ // we can compute the result from the preferred width
+ if (widthHint >= preferredSize.x) {
+ Point result = Geometry.copy(preferredSize);
+ result.x = widthHint;
+ return result;
+ }
+ }
+
+ // Else we can't find an existing size in the cache, so recompute
+ // it from scratch.
+ cachedHeight = computeSize(control, widthHint, heightHint);
+
+ return Geometry.copy(cachedHeight);
+ }
+
+ // Computing a width
+ if (widthHint == SWT.DEFAULT) {
+ // If we know the control's preferred size
+ if (preferredSize != null) {
+ // If the given height is the preferred height, then return the preferred size
+ if (heightHint == preferredSize.y) {
+ return Geometry.copy(preferredSize);
+ }
+ }
+
+ // If we have a cached width measurement
+ if (cachedWidth != null) {
+ // If this was measured with the same height hint
+ if (cachedWidth.y == heightHint) {
+ return Geometry.copy(cachedWidth);
+ }
+ }
+
+ cachedWidth = computeSize(control, widthHint, heightHint);
+
+ return Geometry.copy(cachedWidth);
+ }
+
+ return computeSize(control, widthHint, heightHint);
+ }
+
+ /**
+ * Compute the control's size, and ensure that non-default hints are returned
+ * verbatim (this tries to compensate for SWT's hints, which aren't really the
+ * outer width of the control).
+ *
+ * @param control
+ * @param widthHint
+ * @param heightHint
+ * @return
+ */
+ private Point computeSize(Control control, int widthHint, int heightHint) {
+ int adjustedWidthHint = widthHint == SWT.DEFAULT ? SWT.DEFAULT : Math.max(0, widthHint - widthAdjustment);
+ int adjustedHeightHint = heightHint == SWT.DEFAULT ? SWT.DEFAULT : Math.max(0, heightHint - heightAdjustment);
+
+ Point result = control.computeSize(adjustedWidthHint, adjustedHeightHint, flushChildren);
+ flushChildren = false;
+
+ // If the amounts we subtracted off the widthHint and heightHint didn't do the
+ // trick, then
+ // manually adjust the result to ensure that a non-default hint will return that
+ // result verbatim.
+
+ if (widthHint != SWT.DEFAULT) {
+ result.x = widthHint;
+ }
+
+ if (heightHint != SWT.DEFAULT) {
+ result.y = heightHint;
+ }
+
+ return result;
+ }
+
+ /**
+ * Returns true if the preferred length of the given control is independent of
+ * the width and visa-versa. If this returns true, then changing the widthHint
+ * argument to control.computeSize will never change the resulting height and
+ * changing the heightHint will never change the resulting width. Returns false
+ * if unknown.
+ * <p>
+ * This information can be used to improve caching. Incorrectly returning a
+ * value of false may decrease performance, but incorrectly returning a value of
+ * true will generate incorrect layouts... so always return false if unsure.
+ * </p>
+ *
+ * @param control
+ * @return
+ */
+ static boolean independentLengthAndWidth(Control control) {
+ if (control == null) {
+ return true;
+ }
+
+ if (control instanceof Button || control instanceof ProgressBar || control instanceof Sash
+ || control instanceof Scale || control instanceof Slider || control instanceof List
+ || control instanceof Combo || control instanceof Tree) {
+ return true;
+ }
+
+ if (control instanceof Label || control instanceof Text) {
+ return (control.getStyle() & SWT.WRAP) == 0;
+ }
+
+ // Unless we're certain that the control has this property, we should
+ // return false.
+
+ return false;
+ }
+
+ /**
+ * Try to figure out how much we need to subtract from the hints that we pass
+ * into the given control's computeSize(...) method. This tries to compensate
+ * for bug 46112. To be removed once SWT provides an "official" way to compute
+ * one dimension of a control's size given the other known dimension.
+ *
+ * @param control
+ */
+ private void computeHintOffset(Control control) {
+ if (control instanceof Composite) {
+ // For composites, subtract off the trim size
+ Composite composite = (Composite) control;
+ Rectangle trim = composite.computeTrim(0, 0, 0, 0);
+
+ widthAdjustment = trim.width;
+ heightAdjustment = trim.height;
+ } else {
+ // For non-composites, subtract off 2 * the border size
+ widthAdjustment = control.getBorderWidth() * 2;
+ heightAdjustment = widthAdjustment;
+ }
+ }
+
+ /**
+ * Returns true only if the control will return a constant height for any width
+ * hint larger than the preferred width. Returns false if there is any situation
+ * in which the control does not have this property.
+ *
+ * <p>
+ * Note: this method is only important for wrapping controls, and it can safely
+ * return false for anything else. AFAIK, all SWT controls have this property,
+ * but to be safe they will only be added to the list once the property has been
+ * confirmed.
+ * </p>
+ *
+ * @param control
+ * @return
+ */
+ private static boolean isPreferredWidthMaximum(Control control) {
+ return (control instanceof ToolBar
+ // || control instanceof CoolBar
+ || control instanceof Label);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/ActionSet.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/ActionSet.java
index 64dcb9105d3..379eb93a9d7 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/ActionSet.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/ActionSet.java
@@ -76,16 +76,14 @@ public class ActionSet {
return id;
}
- public ActionSet(MApplication application, IEclipseContext appContext,
- IConfigurationElement element) {
+ public ActionSet(MApplication application, IEclipseContext appContext, IConfigurationElement element) {
this.application = application;
this.configElement = element;
this.id = MenuHelper.getId(configElement);
}
public void addToModel(ArrayList<MMenuContribution> menuContributions,
- ArrayList<MToolBarContribution> toolBarContributions,
- ArrayList<MTrimContribution> trimContributions) {
+ ArrayList<MToolBarContribution> toolBarContributions, ArrayList<MTrimContribution> trimContributions) {
String idContrib = MenuHelper.getId(configElement);
visibleWhen = createExpression(configElement);
@@ -93,12 +91,11 @@ public class ActionSet {
EContextService contextService = application.getContext().get(EContextService.class);
Context actionSetContext = contextService.getContext(idContrib);
if (!actionSetContext.isDefined()) {
- actionSetContext.define(MenuHelper.getLabel(configElement),
- MenuHelper.getDescription(configElement), "org.eclipse.ui.contexts.actionSet"); //$NON-NLS-1$
+ actionSetContext.define(MenuHelper.getLabel(configElement), MenuHelper.getDescription(configElement),
+ "org.eclipse.ui.contexts.actionSet"); //$NON-NLS-1$
}
- IConfigurationElement[] menus = configElement
- .getChildren(IWorkbenchRegistryConstants.TAG_MENU);
+ IConfigurationElement[] menus = configElement.getChildren(IWorkbenchRegistryConstants.TAG_MENU);
if (menus.length > 0) {
for (int i = menus.length; i > 0; i--) {
IConfigurationElement element = menus[i - 1];
@@ -107,15 +104,13 @@ public class ActionSet {
}
- IConfigurationElement[] actions = configElement
- .getChildren(IWorkbenchRegistryConstants.TAG_ACTION);
+ IConfigurationElement[] actions = configElement.getChildren(IWorkbenchRegistryConstants.TAG_ACTION);
if (actions.length > 0) {
for (int i = 0; i < actions.length; i++) {
IConfigurationElement up = actions[i];
IConfigurationElement down = actions[actions.length - 1 - i];
addContribution(idContrib, menuContributions, down, false, MAIN_MENU);
- addToolBarContribution(idContrib, toolBarContributions, trimContributions, up,
- MAIN_TOOLBAR);
+ addToolBarContribution(idContrib, toolBarContributions, trimContributions, up, MAIN_TOOLBAR);
}
}
}
@@ -129,16 +124,14 @@ public class ActionSet {
private Set<String> actionSetPartAssociations(String actionSetId) {
HashSet<String> result = new HashSet<>();
final IExtensionRegistry registry = Platform.getExtensionRegistry();
- final IConfigurationElement[] associations = registry
- .getConfigurationElementsFor(PlatformUI.PLUGIN_ID + '.'
- + IWorkbenchRegistryConstants.PL_ACTION_SET_PART_ASSOCIATIONS);
+ final IConfigurationElement[] associations = registry.getConfigurationElementsFor(
+ PlatformUI.PLUGIN_ID + '.' + IWorkbenchRegistryConstants.PL_ACTION_SET_PART_ASSOCIATIONS);
for (IConfigurationElement element : associations) {
String targetId = element.getAttribute(IWorkbenchRegistryConstants.ATT_TARGET_ID);
if (!actionSetId.equals(targetId)) {
continue;
}
- IConfigurationElement[] children = element
- .getChildren(IWorkbenchRegistryConstants.TAG_PART);
+ IConfigurationElement[] children = element.getChildren(IWorkbenchRegistryConstants.TAG_PART);
for (IConfigurationElement part : children) {
String id = MenuHelper.getId(part);
if (id != null && id.length() > 0) {
@@ -178,8 +171,7 @@ public class ActionSet {
}
}
if (!partIds.isEmpty()) {
- return EvaluationResult.valueOf(partIds.contains(context
- .getVariable(ISources.ACTIVE_PART_ID_NAME)));
+ return EvaluationResult.valueOf(partIds.contains(context.getVariable(ISources.ACTIVE_PART_ID_NAME)));
}
return EvaluationResult.FALSE;
}
@@ -290,14 +282,12 @@ public class ActionSet {
contributions.add(menuContribution);
}
- private void contributeToolBarGroup(ArrayList<MToolBarContribution> contributions,
- String parentId, String group) {
+ private void contributeToolBarGroup(ArrayList<MToolBarContribution> contributions, String parentId, String group) {
if (toolbarContributionGroupIds.contains(parentId + group)) {
return;
}
toolbarContributionGroupIds.add(parentId + group);
- MToolBarContribution toolBarContribution = MenuFactoryImpl.eINSTANCE
- .createToolBarContribution();
+ MToolBarContribution toolBarContribution = MenuFactoryImpl.eINSTANCE.createToolBarContribution();
toolBarContribution.getTags().add(ContributionsAnalyzer.MC_MENU);
toolBarContribution.getTags().add("scheme:toolbar"); //$NON-NLS-1$
toolBarContribution.setParentId(parentId);
@@ -309,10 +299,8 @@ public class ActionSet {
contributions.add(toolBarContribution);
}
- protected void addToolBarContribution(String idContrib,
- ArrayList<MToolBarContribution> contributions,
- ArrayList<MTrimContribution> trimContributions, IConfigurationElement element,
- String parentId) {
+ protected void addToolBarContribution(String idContrib, ArrayList<MToolBarContribution> contributions,
+ ArrayList<MTrimContribution> trimContributions, IConfigurationElement element, String parentId) {
String tpath = MenuHelper.getToolBarPath(element);
if (tpath == null || isEditorAction(element)) {
return;
@@ -322,14 +310,12 @@ public class ActionSet {
tpath += IWorkbenchActionConstants.MB_ADDITIONS;
}
- MToolBarElement action = MenuHelper
- .createLegacyToolBarActionAdditions(application, element);
+ MToolBarElement action = MenuHelper.createLegacyToolBarActionAdditions(application, element);
action.getTransientData().put("Name", MenuHelper.getLabel(element)); //$NON-NLS-1$
action.getTransientData().put("ActionSet", id); //$NON-NLS-1$
- MToolBarContribution toolBarContribution = MenuFactoryImpl.eINSTANCE
- .createToolBarContribution();
+ MToolBarContribution toolBarContribution = MenuFactoryImpl.eINSTANCE.createToolBarContribution();
toolBarContribution.getTags().add(ContributionsAnalyzer.MC_MENU);
toolBarContribution.getTags().add("scheme:toolbar"); //$NON-NLS-1$
final String elementId = MenuHelper.getId(element);
@@ -359,15 +345,14 @@ public class ActionSet {
tpath = menuPath.segment(0);
if (MAIN_TOOLBAR.equals(parentId)) {
- addTrimContribution(idContrib, contributions, trimContributions, element, parentId,
- tpath, tgroup);
+ addTrimContribution(idContrib, contributions, trimContributions, element, parentId, tpath, tgroup);
} else {
tpath = parentId;
}
// String positionInParent =
// MenuHelper.isSeparatorVisible(configElement) ? null
- // : "after=" + tpath; //$NON-NLS-1$
+ // : "after=" + tpath; //$NON-NLS-1$
String positionInParent = "after=" + tgroup;//$NON-NLS-1$
contributeToolBarGroup(contributions, tpath, tgroup);
toolBarContribution.setParentId(tpath);
@@ -380,14 +365,13 @@ public class ActionSet {
}
private boolean isEditorAction(IConfigurationElement element) {
- return IWorkbenchRegistryConstants.EXTENSION_EDITOR_ACTIONS.equals(element
- .getDeclaringExtension().getExtensionPointUniqueIdentifier());
+ return IWorkbenchRegistryConstants.EXTENSION_EDITOR_ACTIONS
+ .equals(element.getDeclaringExtension().getExtensionPointUniqueIdentifier());
}
- private void addTrimContribution(String idContrib,
- ArrayList<MToolBarContribution> contributions,
- ArrayList<MTrimContribution> trimContributions, IConfigurationElement element,
- String parentId, String tpath, String tgroup) {
+ private void addTrimContribution(String idContrib, ArrayList<MToolBarContribution> contributions,
+ ArrayList<MTrimContribution> trimContributions, IConfigurationElement element, String parentId,
+ String tpath, String tgroup) {
final String elementId = MenuHelper.getId(element);
MTrimContribution trimContribution = MenuFactoryImpl.eINSTANCE.createTrimContribution();
@@ -399,7 +383,7 @@ public class ActionSet {
trimContribution.setElementId(elementId);
}
trimContribution.setParentId(parentId);
- trimContribution.setPositionInParent("after=additions"); //$NON-NLS-1$ trimContribution.setVisibleWhen(createVisibleWhen());
+ trimContribution.setPositionInParent("after=additions"); //$NON-NLS-1$ trimContribution.setVisibleWhen(createVisibleWhen());
MToolBar tb = MenuFactoryImpl.eINSTANCE.createToolBar();
tb.setElementId(tpath);
tb.getTransientData().put("Name", MenuHelper.getLabel(this.configElement)); //$NON-NLS-1$
@@ -439,8 +423,7 @@ public class ActionSet {
}
}
- MElementContainer<MMenuElement> findMenuFromPath(MElementContainer<MMenuElement> menu,
- Path menuPath, int segment) {
+ MElementContainer<MMenuElement> findMenuFromPath(MElementContainer<MMenuElement> menu, Path menuPath, int segment) {
int idx = ContributionsAnalyzer.indexForId(menu, menuPath.segment(segment));
if (idx == -1) {
if (segment + 1 < menuPath.segmentCount() || !menuPath.hasTrailingSeparator()) {
@@ -448,8 +431,7 @@ public class ActionSet {
}
return menu;
}
- MElementContainer<MMenuElement> item = (MElementContainer<MMenuElement>) menu.getChildren()
- .get(idx);
+ MElementContainer<MMenuElement> item = (MElementContainer<MMenuElement>) menu.getChildren().get(idx);
if (item.getChildren().isEmpty()) {
if (segment + 1 == menuPath.segmentCount()) {
return menu;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/CompatibilityWorkbenchWindowControlContribution.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/CompatibilityWorkbenchWindowControlContribution.java
index 9acdc2c687b..f51240e81e8 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/CompatibilityWorkbenchWindowControlContribution.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/CompatibilityWorkbenchWindowControlContribution.java
@@ -42,21 +42,16 @@ public class CompatibilityWorkbenchWindowControlContribution {
/**
* Constructs the control contribution that this proxy represents.
*
- * @param window
- * the window that this control contribution is under
- * @param toolControl
- * the tool control representing this contribution
- * @param composite
- * the composite to create or parent the control under
+ * @param window the window that this control contribution is under
+ * @param toolControl the tool control representing this contribution
+ * @param composite the composite to create or parent the control under
*/
@PostConstruct
void construct(MWindow window, MToolControl toolControl, Composite composite) {
- IConfigurationElement configurationElement = ControlContributionRegistry.get(toolControl
- .getElementId());
+ IConfigurationElement configurationElement = ControlContributionRegistry.get(toolControl.getElementId());
if (configurationElement != null) {
- contribution = (WorkbenchWindowControlContribution) Util.safeLoadExecutableExtension(
- configurationElement, IWorkbenchRegistryConstants.ATT_CLASS,
- WorkbenchWindowControlContribution.class);
+ contribution = (WorkbenchWindowControlContribution) Util.safeLoadExecutableExtension(configurationElement,
+ IWorkbenchRegistryConstants.ATT_CLASS, WorkbenchWindowControlContribution.class);
if (contribution != null) {
IWorkbenchWindow workbenchWindow = window.getContext().get(IWorkbenchWindow.class);
contribution.setWorkbenchWindow(workbenchWindow);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/ContributionFactoryGenerator.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/ContributionFactoryGenerator.java
index 8202d1d9a00..1276d50856c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/ContributionFactoryGenerator.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/ContributionFactoryGenerator.java
@@ -54,8 +54,7 @@ public class ContributionFactoryGenerator extends ContextFunction {
private AbstractContributionFactory getFactory() {
if (factoryImpl == null && configElement != null) {
try {
- factoryImpl = (AbstractContributionFactory) configElement
- .createExecutableExtension("class"); //$NON-NLS-1$
+ factoryImpl = (AbstractContributionFactory) configElement.createExecutableExtension("class"); //$NON-NLS-1$
} catch (CoreException e) {
WorkbenchPlugin.log(e);
return null;
@@ -68,8 +67,7 @@ public class ContributionFactoryGenerator extends ContextFunction {
public Object compute(IEclipseContext context, String contextKey) {
AbstractContributionFactory factory = getFactory();
final IMenuService menuService = context.get(IMenuService.class);
- final ContributionRoot root = new ContributionRoot(menuService, new HashSet<>(),
- null, factory);
+ final ContributionRoot root = new ContributionRoot(menuService, new HashSet<>(), null, factory);
ServiceLocator sl = new ServiceLocator();
sl.setContext(context);
factory.createContributionItems(sl, root);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/ContributionRoot.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/ContributionRoot.java
index 489f3a14a56..072736626df 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/ContributionRoot.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/ContributionRoot.java
@@ -33,8 +33,7 @@ import org.eclipse.ui.menus.IMenuService;
*
* @since 3.3
*/
-final class ContributionRoot implements
- IContributionRoot {
+final class ContributionRoot implements IContributionRoot {
private List topLevelItems = new ArrayList();
private Map<IContributionItem, Expression> itemsToExpressions = new HashMap<>();
@@ -42,16 +41,15 @@ final class ContributionRoot implements
private ContributionManager mgr;
private AbstractContributionFactory factory;
- public ContributionRoot(IMenuService menuService, Set restriction,
- ContributionManager mgr, AbstractContributionFactory factory) {
+ public ContributionRoot(IMenuService menuService, Set restriction, ContributionManager mgr,
+ AbstractContributionFactory factory) {
this.restriction = restriction;
this.mgr = mgr;
this.factory = factory;
}
@Override
- public void addContributionItem(IContributionItem item,
- Expression visibleWhen) {
+ public void addContributionItem(IContributionItem item, Expression visibleWhen) {
if (item == null)
throw new IllegalArgumentException();
topLevelItems.add(item);
@@ -64,17 +62,18 @@ final class ContributionRoot implements
}
/**
- * Create the activity identifier for this contribution item.
- *
+ * Create the activity identifier for this contribution item.
+ *
* @param item the item
* @return the identifier
*/
String createIdentifierId(IContributionItem item) {
String namespace = factory.getNamespace();
- String identifierID = namespace != null ? namespace + '/'
- + item.getId() : null; // create the activity identifier ID. If
- // this factory doesn't have a namespace
- // it will be null.
+ String identifierID = namespace != null ? namespace + '/' + item.getId() : null; // create the activity
+ // identifier ID. If
+ // this factory doesn't have
+ // a namespace
+ // it will be null.
return identifierID;
}
@@ -99,8 +98,7 @@ final class ContributionRoot implements
}
@Override
- public void registerVisibilityForChild(IContributionItem item,
- Expression visibleWhen) {
+ public void registerVisibilityForChild(IContributionItem item, Expression visibleWhen) {
if (item == null)
throw new IllegalArgumentException();
if (visibleWhen == null)
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/DynamicMenuContributionItem.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/DynamicMenuContributionItem.java
index 505c5445548..35f1e242459 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/DynamicMenuContributionItem.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/DynamicMenuContributionItem.java
@@ -49,16 +49,12 @@ public class DynamicMenuContributionItem extends ContributionItem {
/**
* Creates a DynamicMenuContributionItem
*
- * @param id
- * - Id of the menu item
- * @param locator
- * - The Service Locator
- * @param dynamicAddition
- * - The Configuration Element defined in the plugin.xml
+ * @param id - Id of the menu item
+ * @param locator - The Service Locator
+ * @param dynamicAddition - The Configuration Element defined in the plugin.xml
*
*/
- public DynamicMenuContributionItem(String id, IServiceLocator locator,
- IConfigurationElement dynamicAddition) {
+ public DynamicMenuContributionItem(String id, IServiceLocator locator, IConfigurationElement dynamicAddition) {
super(id);
this.locator = locator;
@@ -165,10 +161,8 @@ public class DynamicMenuContributionItem extends ContributionItem {
private void createContributionItem() {
- loadedDynamicContribution = (ContributionItem) Util
- .safeLoadExecutableExtension(dynamicAddition,
- IWorkbenchRegistryConstants.ATT_CLASS,
- ContributionItem.class);
+ loadedDynamicContribution = (ContributionItem) Util.safeLoadExecutableExtension(dynamicAddition,
+ IWorkbenchRegistryConstants.ATT_CLASS, ContributionItem.class);
if (loadedDynamicContribution == null) {
alreadyFailed = true;
@@ -178,8 +172,7 @@ public class DynamicMenuContributionItem extends ContributionItem {
loadedDynamicContribution.setId(getId());
loadedDynamicContribution.setParent(getParent());
if (loadedDynamicContribution instanceof IWorkbenchContribution) {
- ((IWorkbenchContribution) loadedDynamicContribution)
- .initialize(locator);
+ ((IWorkbenchContribution) loadedDynamicContribution).initialize(locator);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/DynamicToolBarContributionItem.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/DynamicToolBarContributionItem.java
index f4cd151f958..7ec6074aa7a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/DynamicToolBarContributionItem.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/DynamicToolBarContributionItem.java
@@ -49,16 +49,12 @@ public class DynamicToolBarContributionItem extends WorkbenchWindowControlContri
/**
* Creates a DynamicToolBarContributionItem
*
- * @param id
- * - Id of the menu item
- * @param locator
- * - The Service Locator
- * @param dynamicAddition
- * - The Configuration Element defined in the plugin.xml
+ * @param id - Id of the menu item
+ * @param locator - The Service Locator
+ * @param dynamicAddition - The Configuration Element defined in the plugin.xml
*
*/
- public DynamicToolBarContributionItem(String id, IServiceLocator locator,
- IConfigurationElement dynamicAddition) {
+ public DynamicToolBarContributionItem(String id, IServiceLocator locator, IConfigurationElement dynamicAddition) {
super(id);
this.locator = locator;
@@ -144,10 +140,8 @@ public class DynamicToolBarContributionItem extends WorkbenchWindowControlContri
private void createContributionItem() {
- loadedDynamicContribution = (WorkbenchWindowControlContribution) Util
- .safeLoadExecutableExtension(dynamicAddition,
- IWorkbenchRegistryConstants.ATT_CLASS,
- WorkbenchWindowControlContribution.class);
+ loadedDynamicContribution = (WorkbenchWindowControlContribution) Util.safeLoadExecutableExtension(
+ dynamicAddition, IWorkbenchRegistryConstants.ATT_CLASS, WorkbenchWindowControlContribution.class);
if (loadedDynamicContribution == null) {
alreadyFailed = true;
@@ -159,8 +153,7 @@ public class DynamicToolBarContributionItem extends WorkbenchWindowControlContri
loadedDynamicContribution.setWorkbenchWindow(getWorkbenchWindow());
loadedDynamicContribution.setCurSide(getCurSide());
if (loadedDynamicContribution instanceof IWorkbenchContribution) {
- ((IWorkbenchContribution) loadedDynamicContribution)
- .initialize(locator);
+ ((IWorkbenchContribution) loadedDynamicContribution).initialize(locator);
}
}
@@ -210,6 +203,7 @@ public class DynamicToolBarContributionItem extends WorkbenchWindowControlContri
loadedDynamicContribution.setCurSide(curSide);
}
}
+
@Override
public Control createControl(Composite parent) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/ExtensionContribution.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/ExtensionContribution.java
index f1ea4d6bad4..9433a092483 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/ExtensionContribution.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/ExtensionContribution.java
@@ -43,8 +43,7 @@ public class ExtensionContribution implements IDelegateInitializer {
CompatibilityPart part = (CompatibilityPart) ((MPart) object).getObject();
return part.getReference().getSite();
} else if (object instanceof MWindow) {
- IWorkbenchWindow workbenchWindow = ((MWindow) object).getContext().get(
- IWorkbenchWindow.class);
+ IWorkbenchWindow workbenchWindow = ((MWindow) object).getContext().get(IWorkbenchWindow.class);
if (workbenchWindow != null) {
return workbenchWindow;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/FocusControlSourceProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/FocusControlSourceProvider.java
index 01e3ca188ad..9b9934b9327 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/FocusControlSourceProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/FocusControlSourceProvider.java
@@ -31,14 +31,12 @@ import org.eclipse.ui.swt.IFocusService;
* @since 3.3
*
*/
-public class FocusControlSourceProvider extends AbstractSourceProvider
- implements IFocusService {
+public class FocusControlSourceProvider extends AbstractSourceProvider implements IFocusService {
/**
* The names of the sources supported by this source provider.
*/
- private static final String[] PROVIDED_SOURCE_NAMES = new String[] {
- ISources.ACTIVE_FOCUS_CONTROL_ID_NAME,
+ private static final String[] PROVIDED_SOURCE_NAMES = new String[] { ISources.ACTIVE_FOCUS_CONTROL_ID_NAME,
ISources.ACTIVE_FOCUS_CONTROL_NAME };
Map controlToId = new HashMap();
@@ -100,10 +98,8 @@ public class FocusControlSourceProvider extends AbstractSourceProvider
if (id == null) {
currentId = null;
currentControl = null;
- m.put(ISources.ACTIVE_FOCUS_CONTROL_ID_NAME,
- IEvaluationContext.UNDEFINED_VARIABLE);
- m.put(ISources.ACTIVE_FOCUS_CONTROL_NAME,
- IEvaluationContext.UNDEFINED_VARIABLE);
+ m.put(ISources.ACTIVE_FOCUS_CONTROL_ID_NAME, IEvaluationContext.UNDEFINED_VARIABLE);
+ m.put(ISources.ACTIVE_FOCUS_CONTROL_NAME, IEvaluationContext.UNDEFINED_VARIABLE);
} else {
currentId = id;
currentControl = (Control) widget;
@@ -148,10 +144,8 @@ public class FocusControlSourceProvider extends AbstractSourceProvider
public Map getCurrentState() {
Map m = new HashMap();
if (currentId == null) {
- m.put(ISources.ACTIVE_FOCUS_CONTROL_ID_NAME,
- IEvaluationContext.UNDEFINED_VARIABLE);
- m.put(ISources.ACTIVE_FOCUS_CONTROL_NAME,
- IEvaluationContext.UNDEFINED_VARIABLE);
+ m.put(ISources.ACTIVE_FOCUS_CONTROL_ID_NAME, IEvaluationContext.UNDEFINED_VARIABLE);
+ m.put(ISources.ACTIVE_FOCUS_CONTROL_NAME, IEvaluationContext.UNDEFINED_VARIABLE);
} else {
m.put(ISources.ACTIVE_FOCUS_CONTROL_ID_NAME, currentId);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/IActionSetsListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/IActionSetsListener.java
index 63fa83121bd..e298c235150 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/IActionSetsListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/IActionSetsListener.java
@@ -16,7 +16,6 @@ package org.eclipse.ui.internal.menus;
import org.eclipse.ui.internal.ActionSetsEvent;
-
/**
* <p>
* A listener to changes in the list of active action sets.
@@ -36,11 +35,9 @@ public interface IActionSetsListener {
/**
* Indicates that the list of active action sets has changed.
*
- * @param event
- * The event carrying information about the new state of the
- * action sets; never <code>null</code>.
+ * @param event The event carrying information about the new state of the action
+ * sets; never <code>null</code>.
*/
void actionSetsChanged(ActionSetsEvent event);
}
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/InternalControlContribution.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/InternalControlContribution.java
index 6984798e2f2..e4ae1b5e5d0 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/InternalControlContribution.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/InternalControlContribution.java
@@ -19,10 +19,10 @@ import org.eclipse.swt.SWT;
import org.eclipse.ui.IWorkbenchWindow;
/**
- * Add workbench specific information to a standard control contribution.
- * Allows the client derivatives to access the IWorkbenchWindow hosting
- * the control as well as the side of the workbench that the control is
- * currently being displayed on.
+ * Add workbench specific information to a standard control contribution. Allows
+ * the client derivatives to access the IWorkbenchWindow hosting the control as
+ * well as the side of the workbench that the control is currently being
+ * displayed on.
*
* @since 3.3
*
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/LegacyActionPersistence.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/LegacyActionPersistence.java
index 7dcf5144aec..79fb2ad5a5c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/LegacyActionPersistence.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/LegacyActionPersistence.java
@@ -87,11 +87,9 @@ public final class LegacyActionPersistence extends RegistryPersistence {
*/
private static final int INDEX_VIEW_CONTRIBUTIONS = INDEX_EDITOR_CONTRIBUTIONS + 1;
-
-
/**
- * The command service which is providing the commands for the workbench;
- * must not be <code>null</code>.
+ * The command service which is providing the commands for the workbench; must
+ * not be <code>null</code>.
*/
private final ICommandService commandService;
@@ -110,32 +108,29 @@ public final class LegacyActionPersistence extends RegistryPersistence {
private final Collection menuContributions = new ArrayList();
/**
- * The service locator from which services can be retrieved in the future;
- * must not be <code>null</code>.
+ * The service locator from which services can be retrieved in the future; must
+ * not be <code>null</code>.
*/
private final IWorkbenchWindow window;
/**
* Constructs a new instance of {@link LegacyActionPersistence}.
*
- * @param window
- * The window from which the services should be retrieved; must
- * not be <code>null</code>.
+ * @param window The window from which the services should be retrieved; must
+ * not be <code>null</code>.
*/
public LegacyActionPersistence(final IWorkbenchWindow window) {
// TODO Blind casts are bad.
- this.commandService = window
- .getService(ICommandService.class);
+ this.commandService = window.getService(ICommandService.class);
this.window = window;
}
/**
- * Deactivates all of the activations made by this class, and then clears
- * the collection. This should be called before every read.
+ * Deactivates all of the activations made by this class, and then clears the
+ * collection. This should be called before every read.
*/
private void clearActivations() {
- final IHandlerService service = window
- .getService(IHandlerService.class);
+ final IHandlerService service = window.getService(IHandlerService.class);
if (service == null) {
handlerActivations.clear();
return;
@@ -143,8 +138,7 @@ public final class LegacyActionPersistence extends RegistryPersistence {
service.deactivateHandlers(handlerActivations);
final Iterator activationItr = handlerActivations.iterator();
while (activationItr.hasNext()) {
- final IHandlerActivation activation = (IHandlerActivation) activationItr
- .next();
+ final IHandlerActivation activation = (IHandlerActivation) activationItr.next();
final IHandler handler = activation.getHandler();
if (handler != null) {
handler.dispose();
@@ -171,29 +165,24 @@ public final class LegacyActionPersistence extends RegistryPersistence {
}
/**
- * Determine which command to use. This is slightly complicated as actions
- * do not have to have commands, but the new architecture requires it. As
- * such, we will auto-generate a command for the action if the definitionId
- * is missing or points to a command that does not yet exist. All such
- * command identifiers are prefixed with AUTOGENERATED_COMMAND_ID_PREFIX.
+ * Determine which command to use. This is slightly complicated as actions do
+ * not have to have commands, but the new architecture requires it. As such, we
+ * will auto-generate a command for the action if the definitionId is missing or
+ * points to a command that does not yet exist. All such command identifiers are
+ * prefixed with AUTOGENERATED_COMMAND_ID_PREFIX.
*
- * @param element
- * The action element from which a command must be generated;
- * must not be <code>null</code>.
- * @param primaryId
- * The primary identifier to use when auto-generating a command;
- * must not be <code>null</code>.
- * @param secondaryId
- * The secondary identifier to use when auto-generating a
- * command; must not be <code>null</code>.
- * @param warningsToLog
- * The collection of warnings logged while reading the extension
- * point; must not be <code>null</code>.
+ * @param element The action element from which a command must be
+ * generated; must not be <code>null</code>.
+ * @param primaryId The primary identifier to use when auto-generating a
+ * command; must not be <code>null</code>.
+ * @param secondaryId The secondary identifier to use when auto-generating a
+ * command; must not be <code>null</code>.
+ * @param warningsToLog The collection of warnings logged while reading the
+ * extension point; must not be <code>null</code>.
* @return the fully-parameterized command; <code>null</code> if an error
* occurred.
*/
- private ParameterizedCommand convertActionToCommand(
- final IConfigurationElement element, final String primaryId,
+ private ParameterizedCommand convertActionToCommand(final IConfigurationElement element, final String primaryId,
final String secondaryId, final List warningsToLog) {
String commandId = readOptional(element, ATT_DEFINITION_ID);
Command command = null;
@@ -201,15 +190,13 @@ public final class LegacyActionPersistence extends RegistryPersistence {
command = commandService.getCommand(commandId);
}
- final IActionCommandMappingService mappingService = window
- .getService(IActionCommandMappingService.class);
+ final IActionCommandMappingService mappingService = window.getService(IActionCommandMappingService.class);
String label = null;
if ((commandId == null) || (!command.isDefined())) {
// Add a mapping from this action id to the command id.
if (commandId == null && mappingService != null) {
- commandId = mappingService.getGeneratedCommandId(primaryId,
- secondaryId);
+ commandId = mappingService.getGeneratedCommandId(primaryId, secondaryId);
}
if (commandId == null) {
WorkbenchPlugin.log("MappingService unavailable"); //$NON-NLS-1$
@@ -217,24 +204,22 @@ public final class LegacyActionPersistence extends RegistryPersistence {
}
// Read the label attribute.
- label = readRequired(element, ATT_LABEL, warningsToLog,
- "Actions require a non-empty label or definitionId", //$NON-NLS-1$
+ label = readRequired(element, ATT_LABEL, warningsToLog, "Actions require a non-empty label or definitionId", //$NON-NLS-1$
commandId);
if (label == null) {
label = WorkbenchMessages.LegacyActionPersistence_AutogeneratedCommandName;
}
/*
- * Read the tooltip attribute. The tooltip is really the description
- * of the command.
+ * Read the tooltip attribute. The tooltip is really the description of the
+ * command.
*/
final String tooltip = readOptional(element, ATT_TOOLTIP);
// Define the command.
command = commandService.getCommand(commandId);
final Category category = commandService.getCategory(null);
- final String name = LegacyActionTools.removeAcceleratorText(Action
- .removeMnemonics(label));
+ final String name = LegacyActionTools.removeAcceleratorText(Action.removeMnemonics(label));
command.define(name, tooltip, category, null);
// TODO Decide the command state.
@@ -256,8 +241,7 @@ public final class LegacyActionPersistence extends RegistryPersistence {
// this allows us to look up a "commandId" give the contributionId
// and the actionId
if (mappingService != null) {
- mappingService.map(mappingService.getGeneratedCommandId(primaryId,
- secondaryId), commandId);
+ mappingService.map(mappingService.getGeneratedCommandId(primaryId, secondaryId), commandId);
}
return new ParameterizedCommand(command, null);
@@ -269,30 +253,22 @@ public final class LegacyActionPersistence extends RegistryPersistence {
* registered with the handler service. They are always active.
* </p>
*
- * @param element
- * The action element from which the handler should be read; must
- * not be <code>null</code>.
- * @param actionId
- * The identifier of the action for which a handler is being
- * created; must not be <code>null</code>.
- * @param command
- * The command for which this handler applies; must not be
- * <code>null</code>.
- * @param activeWhenExpression
- * The expression controlling when the handler is active; may be
- * <code>null</code>.
- * @param viewId
- * The view to which this handler is associated. This value is
- * required if this is a view action; otherwise it can be
- * <code>null</code>.
- * @param warningsToLog
- * The collection of warnings while parsing this extension point;
- * must not be <code>null</code>.
+ * @param element The action element from which the handler should
+ * be read; must not be <code>null</code>.
+ * @param actionId The identifier of the action for which a handler
+ * is being created; must not be <code>null</code>.
+ * @param command The command for which this handler applies; must
+ * not be <code>null</code>.
+ * @param activeWhenExpression The expression controlling when the handler is
+ * active; may be <code>null</code>.
+ * @param viewId The view to which this handler is associated.
+ * This value is required if this is a view action;
+ * otherwise it can be <code>null</code>.
+ * @param warningsToLog The collection of warnings while parsing this
+ * extension point; must not be <code>null</code>.
*/
- private void convertActionToHandler(
- final IConfigurationElement element, final String actionId,
- final ParameterizedCommand command,
- final Expression activeWhenExpression, final String viewId,
+ private void convertActionToHandler(final IConfigurationElement element, final String actionId,
+ final ParameterizedCommand command, final Expression activeWhenExpression, final String viewId,
final List warningsToLog) {
// Check to see if this is a retargettable action.
final boolean retarget = readBoolean(element, ATT_RETARGET, false);
@@ -302,36 +278,29 @@ public final class LegacyActionPersistence extends RegistryPersistence {
// Read the class attribute.
String classString = readOptional(element, ATT_CLASS);
if (classAvailable && classString == null) {
- classString = readOptional(element.getChildren(TAG_CLASS)[0],
- ATT_CLASS);
+ classString = readOptional(element.getChildren(TAG_CLASS)[0], ATT_CLASS);
}
if (retarget) {
if (classAvailable && !isPulldown(element)) {
- addWarning(warningsToLog,
- "The class was not null but retarget was set to true", //$NON-NLS-1$
+ addWarning(warningsToLog, "The class was not null but retarget was set to true", //$NON-NLS-1$
element, actionId, ATT_CLASS, classString);
}
// Add a mapping from this action id to the command id.
- final IActionCommandMappingService mappingService = window
- .getService(IActionCommandMappingService.class);
+ final IActionCommandMappingService mappingService = window.getService(IActionCommandMappingService.class);
if (mappingService != null) {
mappingService.map(actionId, command.getId());
} else {
// this is probably the shutdown case where the service has
// already disposed.
- addWarning(
- warningsToLog,
- "Retarget service unavailable", //$NON-NLS-1$
+ addWarning(warningsToLog, "Retarget service unavailable", //$NON-NLS-1$
element, actionId);
}
return; // This is nothing more to be done.
} else if (!classAvailable) {
- addWarning(
- warningsToLog,
- "There was no class provided, and the action is not retargettable", //$NON-NLS-1$
+ addWarning(warningsToLog, "There was no class provided, and the action is not retargettable", //$NON-NLS-1$
element, actionId);
return; // There is nothing to be done.
}
@@ -350,18 +319,16 @@ public final class LegacyActionPersistence extends RegistryPersistence {
if (enabler == null) {
enabledWhenExpression = null;
} else {
- enabledWhenExpression = new LegacySelectionEnablerWrapper(enabler,
- window);
+ enabledWhenExpression = new LegacySelectionEnablerWrapper(enabler, window);
}
/*
- * Create the handler. TODO The image style is read at the workbench
- * level, but it is hard to communicate this information to this point.
- * For now, I'll pass null, but this ultimately won't work.
+ * Create the handler. TODO The image style is read at the workbench level, but
+ * it is hard to communicate this information to this point. For now, I'll pass
+ * null, but this ultimately won't work.
*/
- final ActionDelegateHandlerProxy handler = new ActionDelegateHandlerProxy(
- element, ATT_CLASS, actionId, command, window, null,
- enabledWhenExpression, viewId);
+ final ActionDelegateHandlerProxy handler = new ActionDelegateHandlerProxy(element, ATT_CLASS, actionId, command,
+ window, null, enabledWhenExpression, viewId);
// Read the help context id.
final String helpContextId = readOptional(element, ATT_HELP_CONTEXT_ID);
@@ -371,20 +338,16 @@ public final class LegacyActionPersistence extends RegistryPersistence {
// Activate the handler.
final String commandId = command.getId();
- final IHandlerService service = window
- .getService(IHandlerService.class);
+ final IHandlerService service = window.getService(IHandlerService.class);
final IHandlerActivation handlerActivation;
if (activeWhenExpression == null) {
handlerActivation = service.activateHandler(commandId, handler);
} else {
- handlerActivation = service.activateHandler(commandId, handler,
- activeWhenExpression);
+ handlerActivation = service.activateHandler(commandId, handler, activeWhenExpression);
}
handlerActivations.add(handlerActivation);
}
-
-
@Override
public void dispose() {
super.dispose();
@@ -404,16 +367,16 @@ public final class LegacyActionPersistence extends RegistryPersistence {
&& (event.getExtensionDeltas(PlatformUI.PLUGIN_ID,
IWorkbenchRegistryConstants.PL_EDITOR_ACTIONS).length == 0)
&& (event.getExtensionDeltas(PlatformUI.PLUGIN_ID,
- IWorkbenchRegistryConstants.PL_POPUP_MENU).length == 0) && (event
- .getExtensionDeltas(PlatformUI.PLUGIN_ID,
+ IWorkbenchRegistryConstants.PL_POPUP_MENU).length == 0)
+ && (event.getExtensionDeltas(PlatformUI.PLUGIN_ID,
IWorkbenchRegistryConstants.PL_VIEW_ACTIONS).length == 0));
}
/**
* <p>
- * Reads all of the actions from the deprecated extension points. Actions
- * have been replaced with commands, command images, handlers, menu elements
- * and action sets.
+ * Reads all of the actions from the deprecated extension points. Actions have
+ * been replaced with commands, command images, handlers, menu elements and
+ * action sets.
* </p>
* <p>
* TODO Before this method is called, all of the extension points must be
@@ -436,8 +399,8 @@ public final class LegacyActionPersistence extends RegistryPersistence {
for (final IConfigurationElement configElement : registry.getConfigurationElementsFor(EXTENSION_ACTION_SETS)) {
final String name = configElement.getName();
if (TAG_ACTION_SET.equals(name)) {
- addElementToIndexedArray(configElement, indexedConfigurationElements,
- INDEX_ACTION_SETS, actionSetCount++);
+ addElementToIndexedArray(configElement, indexedConfigurationElements, INDEX_ACTION_SETS,
+ actionSetCount++);
}
}
@@ -446,8 +409,8 @@ public final class LegacyActionPersistence extends RegistryPersistence {
.getConfigurationElementsFor(EXTENSION_EDITOR_ACTIONS)) {
final String name = configElement.getName();
if (TAG_EDITOR_CONTRIBUTION.equals(name)) {
- addElementToIndexedArray(configElement, indexedConfigurationElements,
- INDEX_EDITOR_CONTRIBUTIONS, editorContributionCount++);
+ addElementToIndexedArray(configElement, indexedConfigurationElements, INDEX_EDITOR_CONTRIBUTIONS,
+ editorContributionCount++);
}
}
@@ -455,54 +418,46 @@ public final class LegacyActionPersistence extends RegistryPersistence {
for (final IConfigurationElement configElement : registry.getConfigurationElementsFor(EXTENSION_VIEW_ACTIONS)) {
final String name = configElement.getName();
if (TAG_VIEW_CONTRIBUTION.equals(name)) {
- addElementToIndexedArray(configElement, indexedConfigurationElements,
- INDEX_VIEW_CONTRIBUTIONS, viewContributionCount++);
+ addElementToIndexedArray(configElement, indexedConfigurationElements, INDEX_VIEW_CONTRIBUTIONS,
+ viewContributionCount++);
}
}
- readActionSets(indexedConfigurationElements[INDEX_ACTION_SETS],
- actionSetCount);
- readEditorContributions(
- indexedConfigurationElements[INDEX_EDITOR_CONTRIBUTIONS],
- editorContributionCount);
- readViewContributions(
- indexedConfigurationElements[INDEX_VIEW_CONTRIBUTIONS],
- viewContributionCount);
+ readActionSets(indexedConfigurationElements[INDEX_ACTION_SETS], actionSetCount);
+ readEditorContributions(indexedConfigurationElements[INDEX_EDITOR_CONTRIBUTIONS], editorContributionCount);
+ readViewContributions(indexedConfigurationElements[INDEX_VIEW_CONTRIBUTIONS], viewContributionCount);
}
/**
- * Reads the actions, and defines all the necessary subcomponents in terms
- * of the command architecture. For each action, there could be a command, a
+ * Reads the actions, and defines all the necessary subcomponents in terms of
+ * the command architecture. For each action, there could be a command, a
* command image binding, a handler and a menu item.
*
- * @param primaryId
- * The identifier of the primary object to which this action
- * belongs. This is used to auto-generate command identifiers
- * when required. The <code>primaryId</code> must not be
- * <code>null</code>.
- * @param elements
- * The action elements to be read; must not be <code>null</code>.
- * @param warningsToLog
- * The collection of warnings while parsing this extension point;
- * must not be <code>null</code>.
- * @param visibleWhenExpression
- * The expression controlling visibility of the corresponding
- * menu elements; may be <code>null</code>.
- * @param viewId
- * The view to which this handler is associated. This value is
- * required if this is a view action; otherwise it can be
- * <code>null</code>.
+ * @param primaryId The identifier of the primary object to which
+ * this action belongs. This is used to
+ * auto-generate command identifiers when required.
+ * The <code>primaryId</code> must not be
+ * <code>null</code>.
+ * @param elements The action elements to be read; must not be
+ * <code>null</code>.
+ * @param warningsToLog The collection of warnings while parsing this
+ * extension point; must not be <code>null</code>.
+ * @param visibleWhenExpression The expression controlling visibility of the
+ * corresponding menu elements; may be
+ * <code>null</code>.
+ * @param viewId The view to which this handler is associated.
+ * This value is required if this is a view action;
+ * otherwise it can be <code>null</code>.
* @return References to the created menu elements; may be <code>null</code>,
* and may be empty.
*/
- private void readActions(final String primaryId,
- final IConfigurationElement[] elements, final List warningsToLog,
+ private void readActions(final String primaryId, final IConfigurationElement[] elements, final List warningsToLog,
final Expression visibleWhenExpression, final String viewId) {
for (final IConfigurationElement configElement : elements) {
/*
- * We might need the identifier to generate the command, so we'll
- * read it out now.
+ * We might need the identifier to generate the command, so we'll read it out
+ * now.
*/
final String id = readRequired(configElement, ATT_ID, warningsToLog, "Actions require an id"); //$NON-NLS-1$
if (id == null) {
@@ -523,55 +478,46 @@ public final class LegacyActionPersistence extends RegistryPersistence {
/**
* Reads all of the action and menu child elements from the given element.
*
- * @param element
- * The configuration element from which the actions and menus
- * should be read; must not be <code>null</code>, but may be
- * empty.
- * @param id
- * The identifier of the contribution being made. This could be
- * an action set, an editor contribution, a view contribution, a
- * viewer contribution or an object contribution. This value must
- * not be <code>null</code>.
- * @param warningsToLog
- * The list of warnings already logged for this extension point;
- * must not be <code>null</code>.
- * @param visibleWhenExpression
- * The expression controlling visibility of the corresponding
- * menu elements; may be <code>null</code>.
- * @param viewId
- * The view to which this handler is associated. This value is
- * required if this is a view action; otherwise it can be
- * <code>null</code>.
- * @return An array of references to the created menu elements. This value
- * may be <code>null</code> if there was a problem parsing the
- * configuration element.
+ * @param element The configuration element from which the actions
+ * and menus should be read; must not be
+ * <code>null</code>, but may be empty.
+ * @param id The identifier of the contribution being made.
+ * This could be an action set, an editor
+ * contribution, a view contribution, a viewer
+ * contribution or an object contribution. This
+ * value must not be <code>null</code>.
+ * @param warningsToLog The list of warnings already logged for this
+ * extension point; must not be <code>null</code>.
+ * @param visibleWhenExpression The expression controlling visibility of the
+ * corresponding menu elements; may be
+ * <code>null</code>.
+ * @param viewId The view to which this handler is associated.
+ * This value is required if this is a view action;
+ * otherwise it can be <code>null</code>.
+ * @return An array of references to the created menu elements. This value may
+ * be <code>null</code> if there was a problem parsing the configuration
+ * element.
*/
- private void readActionsAndMenus(
- final IConfigurationElement element, final String id,
- final List warningsToLog,
+ private void readActionsAndMenus(final IConfigurationElement element, final String id, final List warningsToLog,
final Expression visibleWhenExpression, final String viewId) {
// Read its child elements.
- final IConfigurationElement[] actionElements = element
- .getChildren(TAG_ACTION);
- readActions(id, actionElements,
- warningsToLog, visibleWhenExpression, viewId);
+ final IConfigurationElement[] actionElements = element.getChildren(TAG_ACTION);
+ readActions(id, actionElements, warningsToLog, visibleWhenExpression, viewId);
}
/**
- * Reads the deprecated actions from an array of elements from the action
- * sets extension point.
+ * Reads the deprecated actions from an array of elements from the action sets
+ * extension point.
*
- * @param configurationElements
- * The configuration elements in the extension point; must not be
- * <code>null</code>, but may be empty.
- * @param configurationElementCount
- * The number of configuration elements that are really in the
- * array.
+ * @param configurationElements The configuration elements in the extension
+ * point; must not be <code>null</code>, but
+ * may be empty.
+ * @param configurationElementCount The number of configuration elements that
+ * are really in the array.
*/
- private void readActionSets(
- final IConfigurationElement[] configurationElements,
+ private void readActionSets(final IConfigurationElement[] configurationElements,
final int configurationElementCount) {
//
// this was an even dumber fix than modifying the path
@@ -589,49 +535,41 @@ public final class LegacyActionPersistence extends RegistryPersistence {
final IConfigurationElement element = configurationElements[i];
// Read the action set identifier.
- final String id = readRequired(element, ATT_ID, warningsToLog,
- "Action sets need an id"); //$NON-NLS-1$
+ final String id = readRequired(element, ATT_ID, warningsToLog, "Action sets need an id"); //$NON-NLS-1$
if (id == null) {
continue;
}
// Read the label.
- final String label = readRequired(element, ATT_LABEL,
- warningsToLog, "Actions set need a label", //$NON-NLS-1$
+ final String label = readRequired(element, ATT_LABEL, warningsToLog, "Actions set need a label", //$NON-NLS-1$
id);
if (label == null) {
continue;
}
// Restrict the handler to when the action set is active.
- final LegacyActionSetExpression expression = new LegacyActionSetExpression(
- id, window);
-
+ final LegacyActionSetExpression expression = new LegacyActionSetExpression(id, window);
// Read all of the child elements.
- readActionsAndMenus(element, id,
- warningsToLog, expression, null);
+ readActionsAndMenus(element, id, warningsToLog, expression, null);
// Define the action set.
}
- logWarnings(
- warningsToLog,
+ logWarnings(warningsToLog,
"Warnings while parsing the action sets from the 'org.eclipse.ui.actionSets' extension point"); //$NON-NLS-1$
}
/**
- * Reads the deprecated editor contributions from an array of elements from
- * the editor actions extension point.
+ * Reads the deprecated editor contributions from an array of elements from the
+ * editor actions extension point.
*
- * @param configurationElements
- * The configuration elements in the extension point; must not be
- * <code>null</code>, but may be empty.
- * @param configurationElementCount
- * The number of configuration elements that are really in the
- * array.
+ * @param configurationElements The configuration elements in the extension
+ * point; must not be <code>null</code>, but
+ * may be empty.
+ * @param configurationElementCount The number of configuration elements that
+ * are really in the array.
*/
- private void readEditorContributions(
- final IConfigurationElement[] configurationElements,
+ private void readEditorContributions(final IConfigurationElement[] configurationElements,
final int configurationElementCount) {
final List warningsToLog = new ArrayList(1);
@@ -639,47 +577,41 @@ public final class LegacyActionPersistence extends RegistryPersistence {
final IConfigurationElement element = configurationElements[i];
// Read the editor contribution identifier.
- final String id = readRequired(element, ATT_ID, warningsToLog,
- "Editor contributions need an id"); //$NON-NLS-1$
+ final String id = readRequired(element, ATT_ID, warningsToLog, "Editor contributions need an id"); //$NON-NLS-1$
if (id == null) {
continue;
}
/*
- * Read the target id. This is the identifier of the editor with
- * which these contributions are associated.
+ * Read the target id. This is the identifier of the editor with which these
+ * contributions are associated.
*/
- final String targetId = readRequired(element, ATT_TARGET_ID,
- warningsToLog, "Editor contributions need a target id", id); //$NON-NLS-1$
+ final String targetId = readRequired(element, ATT_TARGET_ID, warningsToLog,
+ "Editor contributions need a target id", id); //$NON-NLS-1$
if (targetId == null) {
continue;
}
- final Expression visibleWhenExpression = new LegacyEditorContributionExpression(
- targetId, window);
+ final Expression visibleWhenExpression = new LegacyEditorContributionExpression(targetId, window);
// Read all of the child elements from the registry.
- readActionsAndMenus(element, id, warningsToLog,
- visibleWhenExpression, null);
+ readActionsAndMenus(element, id, warningsToLog, visibleWhenExpression, null);
}
- logWarnings(
- warningsToLog,
+ logWarnings(warningsToLog,
"Warnings while parsing the editor contributions from the 'org.eclipse.ui.editorActions' extension point"); //$NON-NLS-1$
}
/**
- * Reads the deprecated view contributions from an array of elements from
- * the view actions extension point.
+ * Reads the deprecated view contributions from an array of elements from the
+ * view actions extension point.
*
- * @param configurationElements
- * The configuration elements in the extension point; must not be
- * <code>null</code>, but may be empty.
- * @param configurationElementCount
- * The number of configuration elements that are really in the
- * array.
+ * @param configurationElements The configuration elements in the extension
+ * point; must not be <code>null</code>, but
+ * may be empty.
+ * @param configurationElementCount The number of configuration elements that
+ * are really in the array.
*/
- private void readViewContributions(
- final IConfigurationElement[] configurationElements,
+ private void readViewContributions(final IConfigurationElement[] configurationElements,
final int configurationElementCount) {
final List warningsToLog = new ArrayList(1);
@@ -687,31 +619,27 @@ public final class LegacyActionPersistence extends RegistryPersistence {
final IConfigurationElement element = configurationElements[i];
// Read the view contribution identifier.
- final String id = readRequired(element, ATT_ID, warningsToLog,
- "View contributions need an id"); //$NON-NLS-1$
+ final String id = readRequired(element, ATT_ID, warningsToLog, "View contributions need an id"); //$NON-NLS-1$
if (id == null) {
continue;
}
/*
- * Read the target id. This is the identifier of the view with which
- * these contributions are associated.
+ * Read the target id. This is the identifier of the view with which these
+ * contributions are associated.
*/
- final String targetId = readRequired(element, ATT_TARGET_ID,
- warningsToLog, "View contributions need a target id", id); //$NON-NLS-1$
+ final String targetId = readRequired(element, ATT_TARGET_ID, warningsToLog,
+ "View contributions need a target id", id); //$NON-NLS-1$
if (targetId == null) {
continue;
}
- final Expression visibleWhenExpression = new LegacyViewContributionExpression(
- targetId, window);
+ final Expression visibleWhenExpression = new LegacyViewContributionExpression(targetId, window);
// Read all of the child elements from the registry.
- readActionsAndMenus(element, id, warningsToLog,
- visibleWhenExpression, targetId);
+ readActionsAndMenus(element, id, warningsToLog, visibleWhenExpression, targetId);
}
- logWarnings(
- warningsToLog,
+ logWarnings(warningsToLog,
"Warnings while parsing the view contributions from the 'org.eclipse.ui.viewActions' extension point"); //$NON-NLS-1$
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuAdditionCacheEntry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuAdditionCacheEntry.java
index d404254cd9b..d07e9fc503c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuAdditionCacheEntry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuAdditionCacheEntry.java
@@ -81,9 +81,8 @@ public class MenuAdditionCacheEntry {
*/
static boolean isInWorkbenchTrim(MenuLocationURI location) {
final String path = location.getPath();
- return MAIN_TOOLBAR.equals(path) || TRIM_COMMAND1.equals(path)
- || TRIM_COMMAND2.equals(path) || TRIM_VERTICAL1.equals(path)
- || TRIM_VERTICAL2.equals(path) || TRIM_STATUS.equals(path);
+ return MAIN_TOOLBAR.equals(path) || TRIM_COMMAND1.equals(path) || TRIM_COMMAND2.equals(path)
+ || TRIM_VERTICAL1.equals(path) || TRIM_VERTICAL2.equals(path) || TRIM_STATUS.equals(path);
}
private MApplication application;
@@ -116,20 +115,16 @@ public class MenuAdditionCacheEntry {
* @return <code>true</code> if this is a toolbar contribution
*/
public void mergeIntoModel(ArrayList<MMenuContribution> menuContributions,
- ArrayList<MToolBarContribution> toolBarContributions,
- ArrayList<MTrimContribution> trimContributions) {
+ ArrayList<MToolBarContribution> toolBarContributions, ArrayList<MTrimContribution> trimContributions) {
boolean hasAdditions = false;
if ("menu:help?after=additions".equals(location.toString())) { //$NON-NLS-1$
- IConfigurationElement[] menus = configElement
- .getChildren(IWorkbenchRegistryConstants.TAG_MENU);
- if (menus.length == 1
- && "org.eclipse.update.ui.updateMenu".equals(MenuHelper.getId(menus[0]))) { //$NON-NLS-1$
+ IConfigurationElement[] menus = configElement.getChildren(IWorkbenchRegistryConstants.TAG_MENU);
+ if (menus.length == 1 && "org.eclipse.update.ui.updateMenu".equals(MenuHelper.getId(menus[0]))) { //$NON-NLS-1$
return;
}
}
if (location.getPath() == null || location.getPath().length() == 0) {
- WorkbenchPlugin
- .log("MenuAdditionCacheEntry.mergeIntoModel: Invalid menu URI: " + location); //$NON-NLS-1$
+ WorkbenchPlugin.log("MenuAdditionCacheEntry.mergeIntoModel: Invalid menu URI: " + location); //$NON-NLS-1$
return;
}
if (inToolbar()) {
@@ -141,8 +136,7 @@ public class MenuAdditionCacheEntry {
if (query == null || query.length() == 0) {
query = AFTER_ADDITIONS;
}
- processToolbarChildren(toolBarContributions, configElement, location.getPath(),
- query, hasAdditions);
+ processToolbarChildren(toolBarContributions, configElement, location.getPath(), query, hasAdditions);
}
return;
}
@@ -182,8 +176,8 @@ public class MenuAdditionCacheEntry {
* @param menuContributions
* @param filter
*/
- private void processMenuChildren(ArrayList<MMenuContribution> menuContributions,
- IConfigurationElement element, String filter) {
+ private void processMenuChildren(ArrayList<MMenuContribution> menuContributions, IConfigurationElement element,
+ String filter) {
IConfigurationElement[] menus = element.getChildren(IWorkbenchRegistryConstants.TAG_MENU);
if (menus.length == 0) {
return;
@@ -205,8 +199,8 @@ public class MenuAdditionCacheEntry {
}
}
- private void addMenuChildren(final MElementContainer<MMenuElement> container,
- IConfigurationElement parent, String filter) {
+ private void addMenuChildren(final MElementContainer<MMenuElement> container, IConfigurationElement parent,
+ String filter) {
for (final IConfigurationElement child : parent.getChildren()) {
String itemType = child.getName();
String id = MenuHelper.getId(child);
@@ -228,8 +222,8 @@ public class MenuAdditionCacheEntry {
public Object compute(IEclipseContext context, String contextKey) {
ServiceLocator sl = new ServiceLocator();
sl.setContext(context);
- DynamicMenuContributionItem item = new DynamicMenuContributionItem(
- MenuHelper.getId(child), sl, child);
+ DynamicMenuContributionItem item = new DynamicMenuContributionItem(MenuHelper.getId(child), sl,
+ child);
return item;
}
};
@@ -267,17 +261,15 @@ public class MenuAdditionCacheEntry {
parm.setValue(e.getValue().toString());
item.getParameters().add(parm);
}
- String iconUrl = MenuHelper.getIconURI(commandAddition,
- IWorkbenchRegistryConstants.ATT_ICON);
+ String iconUrl = MenuHelper.getIconURI(commandAddition, IWorkbenchRegistryConstants.ATT_ICON);
if (iconUrl == null) {
- ICommandImageService commandImageService = application.getContext().get(
- ICommandImageService.class);
- ImageDescriptor descriptor = commandImageService == null ? null : commandImageService
- .getImageDescriptor(commandId);
+ ICommandImageService commandImageService = application.getContext().get(ICommandImageService.class);
+ ImageDescriptor descriptor = commandImageService == null ? null
+ : commandImageService.getImageDescriptor(commandId);
if (descriptor == null) {
- descriptor = commandImageService == null ? null : commandImageService
- .getImageDescriptor(item.getElementId());
+ descriptor = commandImageService == null ? null
+ : commandImageService.getImageDescriptor(item.getElementId());
}
if (descriptor != null) {
item.setIconURI(MenuHelper.getImageUrl(descriptor));
@@ -373,8 +365,7 @@ public class MenuAdditionCacheEntry {
private void processTrimChildren(ArrayList<MTrimContribution> trimContributions,
ArrayList<MToolBarContribution> toolBarContributions, IConfigurationElement element) {
- IConfigurationElement[] toolbars = element
- .getChildren(IWorkbenchRegistryConstants.TAG_TOOLBAR);
+ IConfigurationElement[] toolbars = element.getChildren(IWorkbenchRegistryConstants.TAG_TOOLBAR);
if (toolbars.length == 0) {
return;
}
@@ -391,8 +382,7 @@ public class MenuAdditionCacheEntry {
MToolBar item = MenuFactoryImpl.eINSTANCE.createToolBar();
item.setElementId(MenuHelper.getId(toolbar));
item.getTransientData().put("Name", MenuHelper.getLabel(toolbar)); //$NON-NLS-1$
- processToolbarChildren(toolBarContributions, toolbar, item.getElementId(),
- AFTER_ADDITIONS, false);
+ processToolbarChildren(toolBarContributions, toolbar, item.getElementId(), AFTER_ADDITIONS, false);
trimContribution.getChildren().add(item);
}
if (hasAdditions) {
@@ -402,10 +392,9 @@ public class MenuAdditionCacheEntry {
}
}
- private void processToolbarChildren(ArrayList<MToolBarContribution> contributions,
- IConfigurationElement toolbar, String parentId, String position, boolean hasAdditions) {
- MToolBarContribution toolBarContribution = MenuFactoryImpl.eINSTANCE
- .createToolBarContribution();
+ private void processToolbarChildren(ArrayList<MToolBarContribution> contributions, IConfigurationElement toolbar,
+ String parentId, String position, boolean hasAdditions) {
+ MToolBarContribution toolBarContribution = MenuFactoryImpl.eINSTANCE.createToolBarContribution();
String idContrib = MenuHelper.getId(toolbar);
if (idContrib != null && idContrib.length() > 0) {
toolBarContribution.setElementId(idContrib);
@@ -505,17 +494,15 @@ public class MenuAdditionCacheEntry {
parm.setValue(e.getValue().toString());
item.getParameters().add(parm);
}
- String iconUrl = MenuHelper.getIconURI(commandAddition,
- IWorkbenchRegistryConstants.ATT_ICON);
+ String iconUrl = MenuHelper.getIconURI(commandAddition, IWorkbenchRegistryConstants.ATT_ICON);
if (iconUrl == null) {
- ICommandImageService commandImageService = application.getContext().get(
- ICommandImageService.class);
- ImageDescriptor descriptor = commandImageService == null ? null : commandImageService
- .getImageDescriptor(commandId, ICommandImageService.IMAGE_STYLE_TOOLBAR);
+ ICommandImageService commandImageService = application.getContext().get(ICommandImageService.class);
+ ImageDescriptor descriptor = commandImageService == null ? null
+ : commandImageService.getImageDescriptor(commandId, ICommandImageService.IMAGE_STYLE_TOOLBAR);
if (descriptor == null) {
- descriptor = commandImageService == null ? null : commandImageService
- .getImageDescriptor(item.getElementId(),
+ descriptor = commandImageService == null ? null
+ : commandImageService.getImageDescriptor(item.getElementId(),
ICommandImageService.IMAGE_STYLE_TOOLBAR);
if (descriptor == null) {
item.setLabel(MenuHelper.getLabel(commandAddition));
@@ -529,19 +516,15 @@ public class MenuAdditionCacheEntry {
item.setIconURI(iconUrl);
}
- iconUrl = MenuHelper.getIconURI(commandAddition,
- IWorkbenchRegistryConstants.ATT_DISABLEDICON);
+ iconUrl = MenuHelper.getIconURI(commandAddition, IWorkbenchRegistryConstants.ATT_DISABLEDICON);
if (iconUrl == null) {
- ICommandImageService commandImageService = application.getContext().get(
- ICommandImageService.class);
+ ICommandImageService commandImageService = application.getContext().get(ICommandImageService.class);
if (commandImageService != null) {
ImageDescriptor descriptor = commandImageService.getImageDescriptor(commandId,
- ICommandImageService.TYPE_DISABLED,
- ICommandImageService.IMAGE_STYLE_TOOLBAR);
+ ICommandImageService.TYPE_DISABLED, ICommandImageService.IMAGE_STYLE_TOOLBAR);
if (descriptor == null) {
descriptor = commandImageService.getImageDescriptor(item.getElementId(),
- ICommandImageService.TYPE_DISABLED,
- ICommandImageService.IMAGE_STYLE_TOOLBAR);
+ ICommandImageService.TYPE_DISABLED, ICommandImageService.IMAGE_STYLE_TOOLBAR);
}
if (descriptor != null) {
iconUrl = MenuHelper.getImageUrl(descriptor);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuFactoryGenerator.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuFactoryGenerator.java
index f90fa00e2a0..bed1fb70b29 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuFactoryGenerator.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuFactoryGenerator.java
@@ -51,11 +51,9 @@ public class MenuFactoryGenerator {
}
public void mergeIntoModel(ArrayList<MMenuContribution> menuContributions,
- ArrayList<MToolBarContribution> toolBarContributions,
- ArrayList<MTrimContribution> trimContributions) {
+ ArrayList<MToolBarContribution> toolBarContributions, ArrayList<MTrimContribution> trimContributions) {
if (location.getPath() == null || location.getPath().length() == 0) {
- WorkbenchPlugin
- .log("MenuFactoryGenerator.mergeIntoModel: Invalid menu URI: " + location); //$NON-NLS-1$
+ WorkbenchPlugin.log("MenuFactoryGenerator.mergeIntoModel: Invalid menu URI: " + location); //$NON-NLS-1$
return;
}
if (inToolbar()) {
@@ -67,8 +65,7 @@ public class MenuFactoryGenerator {
if (query == null || query.length() == 0) {
query = "after=additions"; //$NON-NLS-1$
}
- processToolbarChildren(toolBarContributions, configElement, location.getPath(),
- query);
+ processToolbarChildren(toolBarContributions, configElement, location.getPath(), query);
}
return;
}
@@ -99,10 +96,9 @@ public class MenuFactoryGenerator {
menuContributions.add(menuContribution);
}
- private void processToolbarChildren(ArrayList<MToolBarContribution> contributions,
- IConfigurationElement toolbar, String parentId, String position) {
- MToolBarContribution toolBarContribution = MenuFactoryImpl.eINSTANCE
- .createToolBarContribution();
+ private void processToolbarChildren(ArrayList<MToolBarContribution> contributions, IConfigurationElement toolbar,
+ String parentId, String position) {
+ MToolBarContribution toolBarContribution = MenuFactoryImpl.eINSTANCE.createToolBarContribution();
String idContrib = MenuHelper.getId(toolbar);
if (idContrib != null && idContrib.length() > 0) {
toolBarContribution.setElementId(idContrib);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuHelper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuHelper.java
index 46f7997d34d..fcd1b55d3f3 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuHelper.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuHelper.java
@@ -192,13 +192,11 @@ public class MenuHelper {
}
/**
- * @param element
- * the configuration element
+ * @param element the configuration element
* @return <code>true</code> if the checkEnabled is <code>true</code>.
*/
static boolean getVisibleEnabled(IConfigurationElement element) {
- IConfigurationElement[] children = element
- .getChildren(IWorkbenchRegistryConstants.TAG_VISIBLE_WHEN);
+ IConfigurationElement[] children = element.getChildren(IWorkbenchRegistryConstants.TAG_VISIBLE_WHEN);
String checkEnabled = null;
if (children.length > 0) {
@@ -215,8 +213,7 @@ public class MenuHelper {
if (visibleConfig.length > 0 && visibleConfig.length < 2) {
IConfigurationElement[] visibleChild = visibleConfig[0].getChildren();
if (visibleChild.length == 0) {
- String checkEnabled = visibleConfig[0]
- .getAttribute(IWorkbenchRegistryConstants.ATT_CHECK_ENABLED);
+ String checkEnabled = visibleConfig[0].getAttribute(IWorkbenchRegistryConstants.ATT_CHECK_ENABLED);
if (Boolean.parseBoolean(checkEnabled)) {
final String commandId = getCommandId(commandAddition);
if (commandId == null) {
@@ -226,21 +223,18 @@ public class MenuHelper {
Expression visWhen = new Expression() {
@Override
public EvaluationResult evaluate(IEvaluationContext context) {
- EHandlerService service = getFromContext(context,
- EHandlerService.class);
- ICommandService commandService = getFromContext(context,
- ICommandService.class);
+ EHandlerService service = getFromContext(context, EHandlerService.class);
+ ICommandService commandService = getFromContext(context, ICommandService.class);
if (service == null || commandService == null) {
- WorkbenchPlugin
- .log("Could not retrieve EHandlerService or ICommandService from context evaluation context for" //$NON-NLS-1$
+ WorkbenchPlugin.log(
+ "Could not retrieve EHandlerService or ICommandService from context evaluation context for" //$NON-NLS-1$
+ commandId);
return EvaluationResult.FALSE;
}
Command c = commandService.getCommand(commandId);
- ParameterizedCommand generateCommand = ParameterizedCommand
- .generateCommand(c, Collections.EMPTY_MAP);
- return EvaluationResult
- .valueOf(service.canExecute(generateCommand));
+ ParameterizedCommand generateCommand = ParameterizedCommand.generateCommand(c,
+ Collections.EMPTY_MAP);
+ return EvaluationResult.valueOf(service.canExecute(generateCommand));
}
};
MCoreExpression exp = UiFactoryImpl.eINSTANCE.createCoreExpression();
@@ -267,13 +261,10 @@ public class MenuHelper {
/**
* Do a type-safe extraction of an object from the evalation context
*
- * @param context
- * the evaluation context
- * @param expectedType
- * the expected type
+ * @param context the evaluation context
+ * @param expectedType the expected type
* @return an object of the expected type or <code>null</code>
- * @throws NullPointerException
- * if either argument is <code>null</code>
+ * @throws NullPointerException if either argument is <code>null</code>
*/
protected static <T> T getFromContext(IEvaluationContext context, Class<T> expectedType) {
if (context == null || expectedType == null) {
@@ -287,8 +278,7 @@ public class MenuHelper {
* Returns id attribute of the element or unique string computed from the
* element registry handle
*
- * @param element
- * non null
+ * @param element non null
* @return non null id
*/
public static String getId(IConfigurationElement element) {
@@ -360,8 +350,7 @@ public class MenuHelper {
if (!SCHEME_PATTERN.matcher(iconPath).matches()) {
// First attempt to resolve in ISharedImages (e.g. "IMG_OBJ_FOLDER")
// as per bug 391232 & AbstractUIPlugin.imageDescriptorFromPlugin().
- ImageDescriptor d = WorkbenchPlugin.getDefault().getSharedImages()
- .getImageDescriptor(iconPath);
+ ImageDescriptor d = WorkbenchPlugin.getDefault().getSharedImages().getImageDescriptor(iconPath);
if (d != null) {
return getImageUrl(d);
}
@@ -430,8 +419,7 @@ public class MenuHelper {
public static Map<String, String> getParameters(IConfigurationElement element) {
HashMap<String, String> map = new HashMap<>();
- IConfigurationElement[] parameters = element
- .getChildren(IWorkbenchRegistryConstants.TAG_PARAMETER);
+ IConfigurationElement[] parameters = element.getChildren(IWorkbenchRegistryConstants.TAG_PARAMETER);
for (IConfigurationElement parameter : parameters) {
String name = parameter.getAttribute(IWorkbenchRegistryConstants.ATT_NAME);
String value = parameter.getAttribute(IWorkbenchRegistryConstants.ATT_VALUE);
@@ -455,15 +443,13 @@ public class MenuHelper {
}
}
element.setVisibleWhen(getVisibleWhen(menuAddition));
- element.setIconURI(MenuHelper
- .getIconURI(menuAddition, IWorkbenchRegistryConstants.ATT_ICON));
+ element.setIconURI(MenuHelper.getIconURI(menuAddition, IWorkbenchRegistryConstants.ATT_ICON));
element.setLabel(Util.safeString(text));
return element;
}
- public static MMenuElement createLegacyMenuActionAdditions(MApplication app,
- final IConfigurationElement element) {
+ public static MMenuElement createLegacyMenuActionAdditions(MApplication app, final IConfigurationElement element) {
final String id = MenuHelper.getId(element);
String text = MenuHelper.getLabel(element);
String mnemonic = MenuHelper.getMnemonic(element);
@@ -482,8 +468,7 @@ public class MenuHelper {
Command command = commandService.getCommand(cmdId);
if (command == null) {
ICommandService ics = app.getContext().get(ICommandService.class);
- command = commandService.defineCommand(cmdId, text, null, ics.getCategory(null),
- null);
+ command = commandService.defineCommand(cmdId, text, null, ics.getCategory(null), null);
}
cmd = CommandsFactoryImpl.eINSTANCE.createCommand();
cmd.setCommandName(text);
@@ -493,8 +478,7 @@ public class MenuHelper {
String style = element.getAttribute(IWorkbenchRegistryConstants.ATT_STYLE);
String pulldown = element.getAttribute("pulldown"); //$NON-NLS-1$
- if (IWorkbenchRegistryConstants.STYLE_PULLDOWN.equals(style)
- || (pulldown != null && pulldown.equals("true"))) { //$NON-NLS-1$
+ if (IWorkbenchRegistryConstants.STYLE_PULLDOWN.equals(style) || (pulldown != null && pulldown.equals("true"))) { //$NON-NLS-1$
MMenuItem item = RenderedElementUtil.createRenderedMenuItem();
item.setLabel(text);
if (iconUri != null) {
@@ -507,8 +491,8 @@ public class MenuHelper {
if (window == null) {
return null;
}
- ActionDescriptor desc = new ActionDescriptor(element,
- ActionDescriptor.T_WORKBENCH_PULLDOWN, window);
+ ActionDescriptor desc = new ActionDescriptor(element, ActionDescriptor.T_WORKBENCH_PULLDOWN,
+ window);
final PluginAction action = desc.getAction();
return new ActionContributionItem(action) {
@Override
@@ -557,17 +541,14 @@ public class MenuHelper {
}
}
String iconUri = MenuHelper.getIconURI(element, IWorkbenchRegistryConstants.ATT_ICON);
- String disabledIconUri = MenuHelper.getIconURI(element,
- IWorkbenchRegistryConstants.ATT_DISABLEDICON);
+ String disabledIconUri = MenuHelper.getIconURI(element, IWorkbenchRegistryConstants.ATT_DISABLEDICON);
MCommand cmd = ContributionsAnalyzer.getCommandById(app, cmdId);
if (cmd == null) {
ECommandService commandService = app.getContext().get(ECommandService.class);
Command command = commandService.getCommand(cmdId);
if (command == null) {
- ICommandService ics = app.getContext().get(
- ICommandService.class);
- command = commandService.defineCommand(cmdId, text, null, ics.getCategory(null),
- null);
+ ICommandService ics = app.getContext().get(ICommandService.class);
+ command = commandService.defineCommand(cmdId, text, null, ics.getCategory(null), null);
}
cmd = CommandsFactoryImpl.eINSTANCE.createCommand();
cmd.setCommandName(text);
@@ -590,8 +571,7 @@ public class MenuHelper {
item.setType(ItemType.PUSH);
}
- if (IWorkbenchRegistryConstants.STYLE_PULLDOWN.equals(style)
- || (pulldown != null && pulldown.equals("true"))) { //$NON-NLS-1$
+ if (IWorkbenchRegistryConstants.STYLE_PULLDOWN.equals(style) || (pulldown != null && pulldown.equals("true"))) { //$NON-NLS-1$
MMenu menu = RenderedElementUtil.createRenderedMenu();
ECommandService cs = app.getContext().get(ECommandService.class);
final ParameterizedCommand parmCmd = cs.createCommand(cmdId, null);
@@ -605,9 +585,7 @@ public class MenuHelper {
if (handlerProxy == null) {
handlerProxy = new ActionDelegateHandlerProxy(element,
IWorkbenchRegistryConstants.ATT_CLASS, id, parmCmd,
- PlatformUI
- .getWorkbench().getActiveWorkbenchWindow(), null, null,
- null);
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow(), null, null, null);
}
return handlerProxy;
}
@@ -620,11 +598,10 @@ public class MenuHelper {
if (handlerProxy.getDelegate() == null) {
handlerProxy.loadDelegate();
- ISelectionService service = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getSelectionService();
+ ISelectionService service = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getSelectionService();
IActionDelegate delegate = handlerProxy.getDelegate();
- delegate.selectionChanged(handlerProxy.getAction(),
- service.getSelection());
+ delegate.selectionChanged(handlerProxy.getAction(), service.getSelection());
}
return (IWorkbenchWindowPulldownDelegate) handlerProxy.getDelegate();
}
@@ -711,8 +688,7 @@ public class MenuHelper {
if (part != null) {
Object object = part.getObject();
if (object instanceof CompatibilityPart) {
- return new ActionDescriptor(element, type,
- ((CompatibilityPart) object).getPart());
+ return new ActionDescriptor(element, type, ((CompatibilityPart) object).getPart());
}
}
return null;
@@ -864,11 +840,9 @@ public class MenuHelper {
toolItem.setContributorURI(command.getContributorURI());
toolItem.setVisible(item.isVisible());
- String iconURI = getIconURI(action.getImageDescriptor(),
- application.getContext());
+ String iconURI = getIconURI(action.getImageDescriptor(), application.getContext());
if (iconURI == null) {
- iconURI = getIconURI(id, application.getContext(),
- ICommandImageService.TYPE_DEFAULT);
+ iconURI = getIconURI(id, application.getContext(), ICommandImageService.TYPE_DEFAULT);
if (iconURI == null) {
toolItem.setLabel(command.getCommandName());
} else {
@@ -881,11 +855,9 @@ public class MenuHelper {
toolItem.setTooltip(action.getToolTipText());
}
- String disabledIconURI = getIconURI(action.getDisabledImageDescriptor(),
- application.getContext());
+ String disabledIconURI = getIconURI(action.getDisabledImageDescriptor(), application.getContext());
if (disabledIconURI == null)
- disabledIconURI = getIconURI(id, application.getContext(),
- ICommandImageService.TYPE_DEFAULT);
+ disabledIconURI = getIconURI(id, application.getContext(), ICommandImageService.TYPE_DEFAULT);
if (disabledIconURI != null)
setDisabledIconURI(toolItem, disabledIconURI);
@@ -919,8 +891,7 @@ public class MenuHelper {
toolItem.setLabel(action.getText());
}
} else {
- iconURI = getIconURI(itemId, application.getContext(),
- ICommandImageService.TYPE_DEFAULT);
+ iconURI = getIconURI(itemId, application.getContext(), ICommandImageService.TYPE_DEFAULT);
if (iconURI == null) {
if (action.getText() != null) {
toolItem.setLabel(action.getText());
@@ -968,7 +939,8 @@ public class MenuHelper {
// property listener is removed in
// DirectContributionItem#handleWidgetDispose()
action.addPropertyChangeListener(propertyListener);
- toolItem.getTransientData().put(AbstractContributionItem.DISPOSABLE, (Runnable) () -> action.removePropertyChangeListener(propertyListener));
+ toolItem.getTransientData().put(AbstractContributionItem.DISPOSABLE,
+ (Runnable) () -> action.removePropertyChangeListener(propertyListener));
return toolItem;
}
return null;
@@ -983,8 +955,7 @@ public class MenuHelper {
MHandledMenuItem menuItem = MenuFactoryImpl.eINSTANCE.createHandledMenuItem();
menuItem.setCommand(command);
menuItem.setLabel(command.getCommandName());
- menuItem.setIconURI(getIconURI(action.getImageDescriptor(),
- application.getContext()));
+ menuItem.setIconURI(getIconURI(action.getImageDescriptor(), application.getContext()));
// extract the mnemonic definition
String text = action.getText();
@@ -1023,8 +994,7 @@ public class MenuHelper {
} else {
menuItem.setLabel(command.getCommandName());
}
- menuItem.setIconURI(getIconURI(action.getImageDescriptor(),
- application.getContext()));
+ menuItem.setIconURI(getIconURI(action.getImageDescriptor(), application.getContext()));
switch (action.getStyle()) {
case IAction.AS_CHECK_BOX:
@@ -1151,11 +1121,10 @@ public class MenuHelper {
}
/**
- * Rewrite certain types of URLs to more durable forms, as these URLs may
- * may be persisted in the model.
+ * Rewrite certain types of URLs to more durable forms, as these URLs may may be
+ * persisted in the model.
*
- * @param url
- * the url
+ * @param url the url
* @return the rewritten URL
*/
private static String rewriteDurableURL(String url) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuLocationURI.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuLocationURI.java
index 85ad412eb7b..94f84f27277 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuLocationURI.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuLocationURI.java
@@ -17,16 +17,18 @@ package org.eclipse.ui.internal.menus;
import org.eclipse.ui.internal.util.Util;
/**
- * Basic implementation of the java.net.URI api. This is
- * needed because the java 'foundation' doesn't contain
- * the actual <code>java.net.URI</code> class.
+ * Basic implementation of the java.net.URI api. This is needed because the java
+ * 'foundation' doesn't contain the actual <code>java.net.URI</code> class.
* <p>
* The expected format for URI Strings managed by this class is:
- * </p><p>
+ * </p>
+ * <p>
* "[scheme]:[path]?[query]"
- * </p><p>
- * with the 'query' format being "[id1]=[val1]&[id2]=[val2]..."
* </p>
+ * <p>
+ * with the 'query' format being "[id1]=[val1]&[id2]=[val2]..."
+ * </p>
+ *
* @since 3.3
*
*/
@@ -42,18 +44,16 @@ public class MenuLocationURI {
}
/**
- * @return The query part of the uri (i.e. the
- * part after the '?').
+ * @return The query part of the uri (i.e. the part after the '?').
*/
public String getQuery() {
// Trim off the scheme
String[] vals = Util.split(rawString, '?');
- return vals.length>1?vals[1]:Util.ZERO_LENGTH_STRING;
+ return vals.length > 1 ? vals[1] : Util.ZERO_LENGTH_STRING;
}
/**
- * @return The scheme part of the uri (i.e. the
- * part before the ':').
+ * @return The scheme part of the uri (i.e. the part before the ':').
*/
public String getScheme() {
String[] vals = Util.split(rawString, ':');
@@ -61,18 +61,17 @@ public class MenuLocationURI {
}
/**
- * @return The path part of the uri (i.e. the
- * part between the ':' and the '?').
+ * @return The path part of the uri (i.e. the part between the ':' and the '?').
*/
public String getPath() {
// Trim off the scheme
String[] vals = Util.split(rawString, ':');
- if (vals.length<2)
+ if (vals.length < 2)
return null;
// Now, trim off any query
vals = Util.split(vals[1], '?');
- return vals.length==0?Util.ZERO_LENGTH_STRING:vals[0];
+ return vals.length == 0 ? Util.ZERO_LENGTH_STRING : vals[0];
}
@Override
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuPersistence.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuPersistence.java
index 5d50bbc8eb7..08b4c7f17d1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuPersistence.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuPersistence.java
@@ -55,7 +55,8 @@ final public class MenuPersistence extends RegistryPersistence {
private ArrayList<MToolBarContribution> toolBarContributions = new ArrayList<>();
private ArrayList<MTrimContribution> trimContributions = new ArrayList<>();
- private final Comparator<IConfigurationElement> comparer = (c1, c2) -> c1.getContributor().getName().compareToIgnoreCase(c2.getContributor().getName());
+ private final Comparator<IConfigurationElement> comparer = (c1, c2) -> c1.getContributor().getName()
+ .compareToIgnoreCase(c2.getContributor().getName());
private Pattern contributorFilter;
/**
@@ -82,6 +83,7 @@ final public class MenuPersistence extends RegistryPersistence {
cacheEntries.clear();
super.dispose();
}
+
@Override
protected boolean isChangeImportant(IRegistryChangeEvent event) {
return false;
@@ -102,8 +104,7 @@ final public class MenuPersistence extends RegistryPersistence {
ContributionsAnalyzer.mergeContributions(tmp, menuContributions);
application.getMenuContributions().addAll(menuContributions);
- ArrayList<MToolBarContribution> tmpToolbar = new ArrayList<>(
- toolBarContributions);
+ ArrayList<MToolBarContribution> tmpToolbar = new ArrayList<>(toolBarContributions);
toolBarContributions.clear();
ContributionsAnalyzer.mergeToolBarContributions(tmpToolbar, toolBarContributions);
application.getToolBarContributions().addAll(toolBarContributions);
@@ -121,8 +122,7 @@ final public class MenuPersistence extends RegistryPersistence {
for (IConfigurationElement configElement : registry.getConfigurationElementsFor(EXTENSION_MENUS)) {
if (PL_MENU_CONTRIBUTION.equals(configElement.getName())) {
if (contributorFilter == null
- || contributorFilter.matcher(
- configElement.getContributor().getName()).matches()) {
+ || contributorFilter.matcher(configElement.getContributor().getName()).matches()) {
configElements.add(configElement);
}
}
@@ -133,23 +133,19 @@ final public class MenuPersistence extends RegistryPersistence {
final IConfigurationElement configElement = i.next();
if (isProgramaticContribution(configElement)) {
- MenuFactoryGenerator gen = new MenuFactoryGenerator(application, appContext,
- configElement,
+ MenuFactoryGenerator gen = new MenuFactoryGenerator(application, appContext, configElement,
configElement.getAttribute(IWorkbenchRegistryConstants.TAG_LOCATION_URI));
gen.mergeIntoModel(menuContributions, toolBarContributions, trimContributions);
} else {
- MenuAdditionCacheEntry menuContribution = new MenuAdditionCacheEntry(application,
- appContext, configElement,
- configElement.getAttribute(IWorkbenchRegistryConstants.TAG_LOCATION_URI),
+ MenuAdditionCacheEntry menuContribution = new MenuAdditionCacheEntry(application, appContext,
+ configElement, configElement.getAttribute(IWorkbenchRegistryConstants.TAG_LOCATION_URI),
configElement.getNamespaceIdentifier());
cacheEntries.add(menuContribution);
- menuContribution.mergeIntoModel(menuContributions, toolBarContributions,
- trimContributions);
+ menuContribution.mergeIntoModel(menuContributions, toolBarContributions, trimContributions);
}
}
}
-
private boolean isProgramaticContribution(IConfigurationElement menuAddition) {
return menuAddition.getAttribute(IWorkbenchRegistryConstants.ATT_CLASS) != null;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/PulldownDelegateWidgetProxy.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/PulldownDelegateWidgetProxy.java
index e919ad714e9..cbd0c26f4ea 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/PulldownDelegateWidgetProxy.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/PulldownDelegateWidgetProxy.java
@@ -68,8 +68,8 @@ final class PulldownDelegateWidgetProxy implements IWidget {
private static final class MenuLoader implements ISafeRunnable {
/**
- * The parent for the menu to be created. This value is
- * <code>null</code> if the parent is a menu.
+ * The parent for the menu to be created. This value is <code>null</code> if the
+ * parent is a menu.
*/
private final Control control;
@@ -79,29 +79,26 @@ final class PulldownDelegateWidgetProxy implements IWidget {
private final IWorkbenchWindowPulldownDelegate delegate;
/**
- * The loaded menu. This value is <code>null</code> if the load
- * failed, or if it hasn't been loaded yet.
+ * The loaded menu. This value is <code>null</code> if the load failed, or if it
+ * hasn't been loaded yet.
*/
private Menu menu = null;
/**
- * The parent for the menu to be created. This value is
- * <code>null</code> if the parent is a control.
+ * The parent for the menu to be created. This value is <code>null</code> if the
+ * parent is a control.
*/
private final Menu parent;
/**
* Constructs a new instance of <code>MenuLoader</code>
*
- * @param delegate
- * The delegate from which the menu will be loaded; this
- * value must not be <code>null</code>.
- * @param parent
- * The parent of the menu to be loaded; this value must not
- * be <code>null</code>.
+ * @param delegate The delegate from which the menu will be loaded; this value
+ * must not be <code>null</code>.
+ * @param parent The parent of the menu to be loaded; this value must not be
+ * <code>null</code>.
*/
- private MenuLoader(final IWorkbenchWindowPulldownDelegate delegate,
- final Control parent) {
+ private MenuLoader(final IWorkbenchWindowPulldownDelegate delegate, final Control parent) {
this.delegate = delegate;
this.parent = null;
this.control = parent;
@@ -110,15 +107,12 @@ final class PulldownDelegateWidgetProxy implements IWidget {
/**
* Constructs a new instance of <code>MenuLoader</code>
*
- * @param delegate
- * The delegate from which the menu will be loaded; this
- * value must not be <code>null</code>.
- * @param parent
- * The parent of the menu to be loaded; this value must not
- * be <code>null</code>.
+ * @param delegate The delegate from which the menu will be loaded; this value
+ * must not be <code>null</code>.
+ * @param parent The parent of the menu to be loaded; this value must not be
+ * <code>null</code>.
*/
- private MenuLoader(final IWorkbenchWindowPulldownDelegate2 delegate,
- final Menu parent) {
+ private MenuLoader(final IWorkbenchWindowPulldownDelegate2 delegate, final Menu parent) {
this.delegate = delegate;
this.parent = parent;
this.control = null;
@@ -149,30 +143,29 @@ final class PulldownDelegateWidgetProxy implements IWidget {
if (parent == null) {
menu = delegate.getMenu(control);
} else {
- menu = ((IWorkbenchWindowPulldownDelegate2) delegate)
- .getMenu(parent);
+ menu = ((IWorkbenchWindowPulldownDelegate2) delegate).getMenu(parent);
}
}
}
/**
- * The command to execute when the pulldown delegate appears in a tool bar,
- * and the arrow is <em>not</em> clicked. This also carries a help context
+ * The command to execute when the pulldown delegate appears in a tool bar, and
+ * the arrow is <em>not</em> clicked. This also carries a help context
* identifier. This value must be <code>null</code>.
*/
private final ParameterizedCommand command;
/**
- * The configuration element from which the delegate can be created. This
- * value will exist until the element is converted into a real class -- at
- * which point this value will be set to <code>null</code>.
+ * The configuration element from which the delegate can be created. This value
+ * will exist until the element is converted into a real class -- at which point
+ * this value will be set to <code>null</code>.
*/
private IConfigurationElement configurationElement;
/**
- * The real delegate. This value is <code>null</code> until the proxy is
- * forced to load the real delegate. At this point, the configuration
- * element is converted, nulled out, and this delegate gains a reference.
+ * The real delegate. This value is <code>null</code> until the proxy is forced
+ * to load the real delegate. At this point, the configuration element is
+ * converted, nulled out, and this delegate gains a reference.
*/
private IWorkbenchWindowPulldownDelegate delegate = null;
@@ -196,9 +189,9 @@ final class PulldownDelegateWidgetProxy implements IWidget {
};
/**
- * The service locator from which a handler service can be retrieved. This
- * is needed if the pulldown appears in the tool bar, and the drop-down
- * arrow is <em>not</em> clicked. This value must not be <code>null</code>.
+ * The service locator from which a handler service can be retrieved. This is
+ * needed if the pulldown appears in the tool bar, and the drop-down arrow is
+ * <em>not</em> clicked. This value must not be <code>null</code>.
*/
private final IServiceLocator locator;
@@ -245,41 +238,32 @@ final class PulldownDelegateWidgetProxy implements IWidget {
/**
* The widget created for this pulldown delegate. If this proxy has not been
- * asked to fill or it has been disposed, then this value is
- * <code>null</code>.
+ * asked to fill or it has been disposed, then this value is <code>null</code>.
*/
private Widget widget = null;
/**
- * Constructs a new instance of <code>PulldownDelegateWidgetProxy</code>
- * with all the information it needs to try to avoid loading until it is
- * needed.
+ * Constructs a new instance of <code>PulldownDelegateWidgetProxy</code> with
+ * all the information it needs to try to avoid loading until it is needed.
*
- * @param configurationElement
- * The configuration element from which the real class can be
- * loaded at run-time; must not be <code>null</code>.
- * @param delegateAttributeName
- * The name of the attibute or element containing the delegate;
- * must not be <code>null</code>.
- * @param command
- * The command to execute if this the pulldown is not shown; must
- * not be <code>null</code>.
- * @param locator
- * A service locator from which a handler service can be
- * retrieved; must not be <code>null</code>.
+ * @param configurationElement The configuration element from which the real
+ * class can be loaded at run-time; must not be
+ * <code>null</code>.
+ * @param delegateAttributeName The name of the attibute or element containing
+ * the delegate; must not be <code>null</code>.
+ * @param command The command to execute if this the pulldown is
+ * not shown; must not be <code>null</code>.
+ * @param locator A service locator from which a handler service
+ * can be retrieved; must not be <code>null</code>.
*/
- public PulldownDelegateWidgetProxy(
- final IConfigurationElement configurationElement,
- final String delegateAttributeName,
- final ParameterizedCommand command, final IServiceLocator locator) {
+ public PulldownDelegateWidgetProxy(final IConfigurationElement configurationElement,
+ final String delegateAttributeName, final ParameterizedCommand command, final IServiceLocator locator) {
if (configurationElement == null) {
- throw new NullPointerException(
- "The configuration element backing a handler proxy cannot be null"); //$NON-NLS-1$
+ throw new NullPointerException("The configuration element backing a handler proxy cannot be null"); //$NON-NLS-1$
}
if (delegateAttributeName == null) {
- throw new NullPointerException(
- "The attribute containing the handler class must be known"); //$NON-NLS-1$
+ throw new NullPointerException("The attribute containing the handler class must be known"); //$NON-NLS-1$
}
if (command == null) {
@@ -329,8 +313,7 @@ final class PulldownDelegateWidgetProxy implements IWidget {
widget = menuItem;
// Create the submenu.
- if (loadDelegate()
- && (delegate instanceof IWorkbenchWindowPulldownDelegate2)) {
+ if (loadDelegate() && (delegate instanceof IWorkbenchWindowPulldownDelegate2)) {
final IWorkbenchWindowPulldownDelegate2 delegate2 = (IWorkbenchWindowPulldownDelegate2) delegate;
final MenuLoader loader = new MenuLoader(delegate2, parent);
SafeRunner.run(loader);
@@ -389,11 +372,11 @@ final class PulldownDelegateWidgetProxy implements IWidget {
}
/**
- * Loads the delegate, if possible. If the delegate is loaded, then the
- * member variables are updated accordingly.
+ * Loads the delegate, if possible. If the delegate is loaded, then the member
+ * variables are updated accordingly.
*
- * @return <code>true</code> if the delegate is now non-null;
- * <code>false</code> otherwise.
+ * @return <code>true</code> if the delegate is now non-null; <code>false</code>
+ * otherwise.
*/
private boolean loadDelegate() {
if (delegate == null) {
@@ -406,16 +389,14 @@ final class PulldownDelegateWidgetProxy implements IWidget {
} catch (final ClassCastException e) {
final String message = "The proxied delegate was the wrong class"; //$NON-NLS-1$
- final IStatus status = new Status(IStatus.ERROR,
- WorkbenchPlugin.PI_WORKBENCH, 0, message, e);
+ final IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 0, message, e);
WorkbenchPlugin.log(message, status);
return false;
} catch (final CoreException e) {
- final String message = "The proxied delegate for '" + configurationElement.getAttribute(delegateAttributeName) //$NON-NLS-1$
- + "' could not be loaded"; //$NON-NLS-1$
- IStatus status = new Status(IStatus.ERROR,
- WorkbenchPlugin.PI_WORKBENCH, 0, message, e);
+ final String message = "The proxied delegate for '" //$NON-NLS-1$
+ + configurationElement.getAttribute(delegateAttributeName) + "' could not be loaded"; //$NON-NLS-1$
+ IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 0, message, e);
WorkbenchPlugin.log(message, status);
return false;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/SlaveMenuService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/SlaveMenuService.java
index 617f8ca7233..8af60b0e56b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/SlaveMenuService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/SlaveMenuService.java
@@ -87,15 +87,14 @@ public class SlaveMenuService implements IMenuService, IMenuServiceWorkaround {
populateContributionManager(model, mgr, location);
}
- public void populateContributionManager(MApplicationElement model, ContributionManager mgr,
- String location) {
+ public void populateContributionManager(MApplicationElement model, ContributionManager mgr, String location) {
if (parentService instanceof SlaveMenuService) {
((SlaveMenuService) parentService).populateContributionManager(model, mgr, location);
} else if (parentService instanceof WorkbenchMenuService) {
- ((WorkbenchMenuService) parentService)
- .populateContributionManager(model, mgr, location);
+ ((WorkbenchMenuService) parentService).populateContributionManager(model, mgr, location);
}
}
+
/**
* @param mgr
* @see org.eclipse.ui.menus.IMenuService#releaseContributions(org.eclipse.jface.action.ContributionManager)
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/ViewAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/ViewAction.java
index e4180e31ebe..4dc79e17f92 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/ViewAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/ViewAction.java
@@ -31,8 +31,8 @@ public class ViewAction extends ActionSet {
private IConfigurationElement parent;
private boolean isMenu;
- public ViewAction(MApplication application, IEclipseContext appContext,
- IConfigurationElement parent, IConfigurationElement element, boolean isMenu) {
+ public ViewAction(MApplication application, IEclipseContext appContext, IConfigurationElement parent,
+ IConfigurationElement element, boolean isMenu) {
super(application, appContext, element);
this.parent = parent;
this.isMenu = isMenu;
@@ -40,23 +40,21 @@ public class ViewAction extends ActionSet {
@Override
public void addToModel(ArrayList<MMenuContribution> menuContributions,
- ArrayList<MToolBarContribution> toolBarContributions,
- ArrayList<MTrimContribution> trimContributions) {
+ ArrayList<MToolBarContribution> toolBarContributions, ArrayList<MTrimContribution> trimContributions) {
String idContrib = MenuHelper.getId(configElement);
visibleWhen = createExpression(configElement);
EContextService contextService = application.getContext().get(EContextService.class);
Context actionSetContext = contextService.getContext(idContrib);
if (!actionSetContext.isDefined()) {
- actionSetContext.define(MenuHelper.getLabel(configElement),
- MenuHelper.getDescription(configElement), "org.eclipse.ui.contexts.actionSet"); //$NON-NLS-1$
+ actionSetContext.define(MenuHelper.getLabel(configElement), MenuHelper.getDescription(configElement),
+ "org.eclipse.ui.contexts.actionSet"); //$NON-NLS-1$
}
String parentId = parent.getAttribute(IWorkbenchRegistryConstants.ATT_TARGET_ID);
addContribution(idContrib, menuContributions, configElement, isMenu, parentId);
if (!isMenu) {
- addToolBarContribution(idContrib, toolBarContributions, trimContributions,
- configElement, parentId);
+ addToolBarContribution(idContrib, toolBarContributions, trimContributions, configElement, parentId);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/WidgetProxy.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/WidgetProxy.java
index ab23cdf6580..d9d62b70a20 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/WidgetProxy.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/WidgetProxy.java
@@ -39,22 +39,22 @@ import org.eclipse.ui.menus.IWorkbenchWidget;
final class WidgetProxy implements IWorkbenchWidget {
/**
- * Used to determine whether the load has been tried to
- * prevent multiple retries at a failed load.
+ * Used to determine whether the load has been tried to prevent multiple retries
+ * at a failed load.
*/
private boolean firstLoad = true;
/**
- * The configuration element from which the widget can be created. This
- * value will exist until the element is converted into a real class -- at
- * which point this value will be set to <code>null</code>.
+ * The configuration element from which the widget can be created. This value
+ * will exist until the element is converted into a real class -- at which point
+ * this value will be set to <code>null</code>.
*/
private IConfigurationElement configurationElement;
/**
- * The real widget. This value is <code>null</code> until the proxy is
- * forced to load the real widget. At this point, the configuration element
- * is converted, nulled out, and this widget gains a reference.
+ * The real widget. This value is <code>null</code> until the proxy is forced to
+ * load the real widget. At this point, the configuration element is converted,
+ * nulled out, and this widget gains a reference.
*/
private IWorkbenchWidget widget = null;
@@ -68,23 +68,20 @@ final class WidgetProxy implements IWorkbenchWidget {
* Constructs a new instance of <code>WidgetProxy</code> with all the
* information it needs to try to load the class at a later point in time.
*
- * @param configurationElement
- * The configuration element from which the real class can be
- * loaded at run-time; must not be <code>null</code>.
- * @param widgetAttributeName
- * The name of the attibute or element containing the widget
- * executable extension; must not be <code>null</code>.
+ * @param configurationElement The configuration element from which the real
+ * class can be loaded at run-time; must not be
+ * <code>null</code>.
+ * @param widgetAttributeName The name of the attibute or element containing
+ * the widget executable extension; must not be
+ * <code>null</code>.
*/
- public WidgetProxy(final IConfigurationElement configurationElement,
- final String widgetAttributeName) {
+ public WidgetProxy(final IConfigurationElement configurationElement, final String widgetAttributeName) {
if (configurationElement == null) {
- throw new NullPointerException(
- "The configuration element backing a widget proxy cannot be null"); //$NON-NLS-1$
+ throw new NullPointerException("The configuration element backing a widget proxy cannot be null"); //$NON-NLS-1$
}
if (widgetAttributeName == null) {
- throw new NullPointerException(
- "The attribute containing the widget class must be known"); //$NON-NLS-1$
+ throw new NullPointerException("The attribute containing the widget class must be known"); //$NON-NLS-1$
}
this.configurationElement = configurationElement;
@@ -134,12 +131,12 @@ final class WidgetProxy implements IWorkbenchWidget {
}
/**
- * Convenience method that allows the trim layout manager to
- * inform widgets if they have changed locations. If the IWidget
- * implementation does not support the method then we default
- * to using the simpler <code>fill(final Composite parent)</code>.
+ * Convenience method that allows the trim layout manager to inform widgets if
+ * they have changed locations. If the IWidget implementation does not support
+ * the method then we default to using the simpler
+ * <code>fill(final Composite parent)</code>.
*
- * @param parent The composite to create the controls in
+ * @param parent The composite to create the controls in
* @param oldSide The side the trim was previously displayed on
* @param newSide The new side that the trim will be displayed on
*/
@@ -157,27 +154,24 @@ final class WidgetProxy implements IWorkbenchWidget {
* Loads the widget, if possible. If the widget is loaded, then the member
* variables are updated accordingly.
*
- * @return <code>true</code> if the widget is now non-null;
- * <code>false</code> otherwise.
+ * @return <code>true</code> if the widget is now non-null; <code>false</code>
+ * otherwise.
*/
private boolean loadWidget() {
if (firstLoad) {
// Load the handler.
try {
- widget = (IWorkbenchWidget) configurationElement
- .createExecutableExtension(widgetAttributeName);
+ widget = (IWorkbenchWidget) configurationElement.createExecutableExtension(widgetAttributeName);
configurationElement = null;
} catch (final ClassCastException e) {
final String message = "The proxied widget was the wrong class"; //$NON-NLS-1$
- final IStatus status = new Status(IStatus.ERROR,
- WorkbenchPlugin.PI_WORKBENCH, 0, message, e);
+ final IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 0, message, e);
WorkbenchPlugin.log(message, status);
} catch (final CoreException e) {
- final String message = "The proxied widget for '" + configurationElement.getAttribute(widgetAttributeName) //$NON-NLS-1$
- + "' could not be loaded"; //$NON-NLS-1$
- IStatus status = new Status(IStatus.ERROR,
- WorkbenchPlugin.PI_WORKBENCH, 0, message, e);
+ final String message = "The proxied widget for '" //$NON-NLS-1$
+ + configurationElement.getAttribute(widgetAttributeName) + "' could not be loaded"; //$NON-NLS-1$
+ IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 0, message, e);
WorkbenchPlugin.log(message, status);
}
}
@@ -190,11 +184,11 @@ final class WidgetProxy implements IWorkbenchWidget {
}
/**
- * Determine if the widget knows how to respond to changes in the
- * workbench 'side' that it is being displayed on.
+ * Determine if the widget knows how to respond to changes in the workbench
+ * 'side' that it is being displayed on.
*
- * @return <code>true</code> iff the <code>IWidget</code> implementation
- * is actually based on <code>AbstractTrimWidget</code>
+ * @return <code>true</code> iff the <code>IWidget</code> implementation is
+ * actually based on <code>AbstractTrimWidget</code>
*/
private boolean isMoveableTrimWidget() {
if (loadWidget()) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/WorkbenchMenuService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/WorkbenchMenuService.java
index 5b620bb7df0..ebc5f2ddc15 100755
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/WorkbenchMenuService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/WorkbenchMenuService.java
@@ -118,8 +118,7 @@ public class WorkbenchMenuService implements IMenuService, IMenuServiceWorkaroun
public void addContributionFactory(final AbstractContributionFactory factory) {
MenuLocationURI location = new MenuLocationURI(factory.getLocation());
if (location.getPath() == null || location.getPath().length() == 0) {
- WorkbenchPlugin
- .log("WorkbenchMenuService.addContributionFactory: Invalid menu URI: " + location); //$NON-NLS-1$
+ WorkbenchPlugin.log("WorkbenchMenuService.addContributionFactory: Invalid menu URI: " + location); //$NON-NLS-1$
return;
}
@@ -163,10 +162,9 @@ public class WorkbenchMenuService implements IMenuService, IMenuServiceWorkaroun
}
- private void processToolbarChildren(AbstractContributionFactory factory,
- MenuLocationURI location, String parentId, String position) {
- MToolBarContribution toolBarContribution = MenuFactoryImpl.eINSTANCE
- .createToolBarContribution();
+ private void processToolbarChildren(AbstractContributionFactory factory, MenuLocationURI location, String parentId,
+ String position) {
+ MToolBarContribution toolBarContribution = MenuFactoryImpl.eINSTANCE.createToolBarContribution();
toolBarContribution.setElementId(factory.getNamespace() + ":" + factory.hashCode()); //$NON-NLS-1$
toolBarContribution.setParentId(parentId);
toolBarContribution.setPositionInParent(position);
@@ -229,8 +227,7 @@ public class WorkbenchMenuService implements IMenuService, IMenuServiceWorkaroun
populateContributionManager(model, mgr, location);
}
- public void populateContributionManager(MApplicationElement model, ContributionManager mgr,
- String location) {
+ public void populateContributionManager(MApplicationElement model, ContributionManager mgr, String location) {
MenuLocationURI uri = new MenuLocationURI(location);
// Now handle registering dynamic additions by querying E4 model
@@ -247,8 +244,7 @@ public class WorkbenchMenuService implements IMenuService, IMenuServiceWorkaroun
MenuManagerRenderer renderer = (MenuManagerRenderer) obj;
mMenu.setRenderer(renderer);
renderer.reconcileManagerToModel(menu, mMenu);
- renderer.processContributions(mMenu, uri.getPath(), false,
- "popup".equals(uri.getScheme())); //$NON-NLS-1$
+ renderer.processContributions(mMenu, uri.getPath(), false, "popup".equals(uri.getScheme())); //$NON-NLS-1$
// double cast because we're bad people
renderer.processContents((MElementContainer<MUIElement>) ((Object) mMenu));
final IEclipseContext evalContext;
@@ -257,8 +253,7 @@ public class WorkbenchMenuService implements IMenuService, IMenuServiceWorkaroun
} else {
evalContext = modelService.getContainingContext(mMenu);
}
- MenuManagerRendererFilter.updateElementVisibility(mMenu, renderer, menu,
- evalContext, 2, true);
+ MenuManagerRendererFilter.updateElementVisibility(mMenu, renderer, menu, evalContext, 2, true);
}
} else if (mgr instanceof ToolBarManager) {
ToolBarManager toolbar = (ToolBarManager) mgr;
@@ -285,8 +280,7 @@ public class WorkbenchMenuService implements IMenuService, IMenuServiceWorkaroun
protected MToolBar getToolbarModel(MApplicationElement model, ToolBarManager toolbarManager,
MenuLocationURI location) {
final IRendererFactory factory = e4Context.get(IRendererFactory.class);
- final AbstractPartRenderer obj = factory.getRenderer(
- MenuFactoryImpl.eINSTANCE.createToolBar(), null);
+ final AbstractPartRenderer obj = factory.getRenderer(MenuFactoryImpl.eINSTANCE.createToolBar(), null);
if (!(obj instanceof ToolBarManagerRenderer)) {
return null;
}
@@ -315,8 +309,7 @@ public class WorkbenchMenuService implements IMenuService, IMenuServiceWorkaroun
}
private void addToolbar(MApplicationElement model, MToolBar tb, IEclipseContext ctx) {
- ArrayList<MToolBar> toolbars = (ArrayList<MToolBar>) model.getTransientData().get(
- POPULATED_TOOL_BARS);
+ ArrayList<MToolBar> toolbars = (ArrayList<MToolBar>) model.getTransientData().get(POPULATED_TOOL_BARS);
if (toolbars == null) {
toolbars = new ArrayList<>();
model.getTransientData().put(POPULATED_TOOL_BARS, toolbars);
@@ -343,12 +336,11 @@ public class WorkbenchMenuService implements IMenuService, IMenuServiceWorkaroun
((Notifier) menu).eAdapters().add(ctx.get(UIEventPublisher.class));
}
- protected MMenu getMenuModel(MApplicationElement model, MenuManager menuManager,
- MenuLocationURI location) {
+ protected MMenu getMenuModel(MApplicationElement model, MenuManager menuManager, MenuLocationURI location) {
final IRendererFactory factory = e4Context.get(IRendererFactory.class);
- final AbstractPartRenderer obj = factory.getRenderer(((WorkbenchWindow) getWindow())
- .getModel().getMainMenu(), null);
+ final AbstractPartRenderer obj = factory.getRenderer(((WorkbenchWindow) getWindow()).getModel().getMainMenu(),
+ null);
if (!(obj instanceof MenuManagerRenderer)) {
return null;
}
@@ -391,7 +383,6 @@ public class WorkbenchMenuService implements IMenuService, IMenuServiceWorkaroun
return mMenu;
}
-
private MPart getPartToExtend() {
return (MPart) e4Context.getActiveLeaf().get(IServiceConstants.ACTIVE_PART);
}
@@ -414,8 +405,7 @@ public class WorkbenchMenuService implements IMenuService, IMenuServiceWorkaroun
*/
private void releaseContributionManager(ToolBarManager toolbarManager) {
final IRendererFactory factory = e4Context.get(IRendererFactory.class);
- final AbstractPartRenderer obj = factory.getRenderer(
- MenuFactoryImpl.eINSTANCE.createToolBar(), null);
+ final AbstractPartRenderer obj = factory.getRenderer(MenuFactoryImpl.eINSTANCE.createToolBar(), null);
if (!(obj instanceof ToolBarManagerRenderer)) {
return;
}
@@ -424,19 +414,16 @@ public class WorkbenchMenuService implements IMenuService, IMenuServiceWorkaroun
if (mToolBar == null) {
return;
}
- MApplicationElement model = (MApplicationElement) mToolBar.getTransientData().get(
- ModelUtils.CONTAINING_PARENT);
+ MApplicationElement model = (MApplicationElement) mToolBar.getTransientData().get(ModelUtils.CONTAINING_PARENT);
if (model != null) {
((Notifier) mToolBar).eAdapters().clear();
- ArrayList<MToolBar> toolbars = (ArrayList<MToolBar>) model.getTransientData().get(
- POPULATED_TOOL_BARS);
+ ArrayList<MToolBar> toolbars = (ArrayList<MToolBar>) model.getTransientData().get(POPULATED_TOOL_BARS);
if (toolbars != null) {
toolbars.remove(mToolBar);
}
}
final ToolBar widget = toolbarManager.getControl();
- if (widget != null && !widget.isDisposed()
- && widget.getData(AbstractPartRenderer.OWNING_ME) == null) {
+ if (widget != null && !widget.isDisposed() && widget.getData(AbstractPartRenderer.OWNING_ME) == null) {
widget.setData(AbstractPartRenderer.OWNING_ME, mToolBar);
}
final IPresentationEngine engine = e4Context.get(IPresentationEngine.class);
@@ -449,8 +436,8 @@ public class WorkbenchMenuService implements IMenuService, IMenuServiceWorkaroun
*/
private void releaseContributionManager(MenuManager menuManager) {
final IRendererFactory factory = e4Context.get(IRendererFactory.class);
- final AbstractPartRenderer obj = factory.getRenderer(((WorkbenchWindow) getWindow())
- .getModel().getMainMenu(), null);
+ final AbstractPartRenderer obj = factory.getRenderer(((WorkbenchWindow) getWindow()).getModel().getMainMenu(),
+ null);
if (!(obj instanceof MenuManagerRenderer)) {
return;
}
@@ -459,19 +446,16 @@ public class WorkbenchMenuService implements IMenuService, IMenuServiceWorkaroun
if (mMenu == null) {
return;
}
- MApplicationElement model = (MApplicationElement) mMenu.getTransientData().get(
- ModelUtils.CONTAINING_PARENT);
+ MApplicationElement model = (MApplicationElement) mMenu.getTransientData().get(ModelUtils.CONTAINING_PARENT);
if (model != null) {
((Notifier) mMenu).eAdapters().clear();
- ArrayList<MMenu> menus = (ArrayList<MMenu>) model.getTransientData().get(
- POPULATED_MENUS);
+ ArrayList<MMenu> menus = (ArrayList<MMenu>) model.getTransientData().get(POPULATED_MENUS);
if (menus != null) {
menus.remove(mMenu);
}
}
final Menu widget = menuManager.getMenu();
- if (widget != null && !widget.isDisposed()
- && widget.getData(AbstractPartRenderer.OWNING_ME) == null) {
+ if (widget != null && !widget.isDisposed() && widget.getData(AbstractPartRenderer.OWNING_ME) == null) {
widget.setData(AbstractPartRenderer.OWNING_ME, mMenu);
}
final IPresentationEngine engine = e4Context.get(IPresentationEngine.class);
@@ -542,8 +526,7 @@ public class WorkbenchMenuService implements IMenuService, IMenuServiceWorkaroun
}
/**
- * read in the menu contributions and turn them into model menu
- * contributions
+ * read in the menu contributions and turn them into model menu contributions
*/
public void readRegistry() {
persistence.read();
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ExternalEditor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ExternalEditor.java
index f2f161231a8..d2732aa4b1e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ExternalEditor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ExternalEditor.java
@@ -32,119 +32,102 @@ import org.eclipse.ui.internal.registry.EditorDescriptor;
import org.osgi.framework.Bundle;
public class ExternalEditor {
- private IPath filePath;
+ private IPath filePath;
- private EditorDescriptor descriptor;
+ private EditorDescriptor descriptor;
- /**
- * Create an external editor.
- */
- public ExternalEditor(IPath newFilePath, EditorDescriptor editorDescriptor) {
- this.filePath = newFilePath;
- this.descriptor = editorDescriptor;
- }
+ /**
+ * Create an external editor.
+ */
+ public ExternalEditor(IPath newFilePath, EditorDescriptor editorDescriptor) {
+ this.filePath = newFilePath;
+ this.descriptor = editorDescriptor;
+ }
- /**
- * open the editor. If the descriptor has a program then use it - otherwise build its
- * info from the descriptor.
- * @exception Throws a CoreException if the external editor could not be opened.
- */
- public void open() throws CoreException {
+ /**
+ * open the editor. If the descriptor has a program then use it - otherwise
+ * build its info from the descriptor.
+ *
+ * @exception Throws a CoreException if the external editor could not be opened.
+ */
+ public void open() throws CoreException {
- Program program = this.descriptor.getProgram();
- if (program == null) {
- openWithUserDefinedProgram();
- } else {
- String path = ""; //$NON-NLS-1$
- if (filePath != null) {
- path = filePath.toOSString();
- if (program.execute(path)) {
+ Program program = this.descriptor.getProgram();
+ if (program == null) {
+ openWithUserDefinedProgram();
+ } else {
+ String path = ""; //$NON-NLS-1$
+ if (filePath != null) {
+ path = filePath.toOSString();
+ if (program.execute(path)) {
return;
}
- }
- throw new CoreException(
- new Status(
- IStatus.ERROR,
- WorkbenchPlugin.PI_WORKBENCH,
- 0,
- NLS.bind(WorkbenchMessages.ExternalEditor_errorMessage, path),
- null));
- }
- }
+ }
+ throw new CoreException(new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 0,
+ NLS.bind(WorkbenchMessages.ExternalEditor_errorMessage, path), null));
+ }
+ }
- /**
- * open the editor.
- * @exception Throws a CoreException if the external editor could not be opened.
- */
- public void openWithUserDefinedProgram() throws CoreException {
- // We need to determine if the command refers to a program in the plugin
- // install directory. Otherwise we assume the program is on the path.
+ /**
+ * open the editor.
+ *
+ * @exception Throws a CoreException if the external editor could not be opened.
+ */
+ public void openWithUserDefinedProgram() throws CoreException {
+ // We need to determine if the command refers to a program in the plugin
+ // install directory. Otherwise we assume the program is on the path.
- String programFileName = null;
- IConfigurationElement configurationElement = descriptor
- .getConfigurationElement();
+ String programFileName = null;
+ IConfigurationElement configurationElement = descriptor.getConfigurationElement();
- // Check if we have a config element (if we don't it is an
- // external editor created on the resource associations page).
- if (configurationElement != null) {
- try {
- Bundle bundle = Platform.getBundle(configurationElement
- .getContributor().getName());
- // See if the program file is in the plugin directory
- URL entry = bundle.getEntry(descriptor.getFileName());
- if (entry != null) {
- // this will bring the file local if the plugin is on a server
- URL localName = Platform.asLocalURL(entry);
- File file = new File(localName.getFile());
- //Check that it exists before we assert it is valid
- if (file.exists()) {
+ // Check if we have a config element (if we don't it is an
+ // external editor created on the resource associations page).
+ if (configurationElement != null) {
+ try {
+ Bundle bundle = Platform.getBundle(configurationElement.getContributor().getName());
+ // See if the program file is in the plugin directory
+ URL entry = bundle.getEntry(descriptor.getFileName());
+ if (entry != null) {
+ // this will bring the file local if the plugin is on a server
+ URL localName = Platform.asLocalURL(entry);
+ File file = new File(localName.getFile());
+ // Check that it exists before we assert it is valid
+ if (file.exists()) {
programFileName = file.getAbsolutePath();
}
- }
- } catch (IOException e) {
- // Program file is not in the plugin directory
- }
- }
+ }
+ } catch (IOException e) {
+ // Program file is not in the plugin directory
+ }
+ }
- if (programFileName == null) {
+ if (programFileName == null) {
// Program file is not in the plugin directory therefore
- // assume it is on the path
- programFileName = descriptor.getFileName();
+ // assume it is on the path
+ programFileName = descriptor.getFileName();
}
- // Get the full path of the file to open
- if (filePath == null) {
- throw new CoreException(
- new Status(
- IStatus.ERROR,
- WorkbenchPlugin.PI_WORKBENCH,
- 0,
- NLS.bind(WorkbenchMessages.ExternalEditor_errorMessage,programFileName),
- null));
- }
- String path = filePath.toOSString();
+ // Get the full path of the file to open
+ if (filePath == null) {
+ throw new CoreException(new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 0,
+ NLS.bind(WorkbenchMessages.ExternalEditor_errorMessage, programFileName), null));
+ }
+ String path = filePath.toOSString();
- // Open the file
+ // Open the file
- // ShellCommand was removed in response to PR 23888. If an exception was
- // thrown, it was not caught in time, and no feedback was given to user
+ // ShellCommand was removed in response to PR 23888. If an exception was
+ // thrown, it was not caught in time, and no feedback was given to user
- try {
+ try {
if (Util.isMac()) {
- Runtime.getRuntime().exec(
- new String[] { "open", "-a", programFileName, path }); //$NON-NLS-1$ //$NON-NLS-2$
+ Runtime.getRuntime().exec(new String[] { "open", "-a", programFileName, path }); //$NON-NLS-1$ //$NON-NLS-2$
} else {
- Runtime.getRuntime().exec(
- new String[] { programFileName, path });
+ Runtime.getRuntime().exec(new String[] { programFileName, path });
}
- } catch (Exception e) {
- throw new CoreException(
- new Status(
- IStatus.ERROR,
- WorkbenchPlugin.PI_WORKBENCH,
- 0,
- NLS.bind(WorkbenchMessages.ExternalEditor_errorMessage,programFileName),
- e));
- }
- }
+ } catch (Exception e) {
+ throw new CoreException(new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 0,
+ NLS.bind(WorkbenchMessages.ExternalEditor_errorMessage, programFileName), e));
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ExternalProgramImageDescriptor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ExternalProgramImageDescriptor.java
index 0c19244f6dc..bd685f79db5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ExternalProgramImageDescriptor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ExternalProgramImageDescriptor.java
@@ -21,82 +21,81 @@ import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.internal.WorkbenchImages;
/**
- * The external program image descriptor is the descriptor used to
- * handle images that are from a Program.
+ * The external program image descriptor is the descriptor used to handle images
+ * that are from a Program.
*/
public class ExternalProgramImageDescriptor extends ImageDescriptor {
- public Program program;
+ public Program program;
- /**
- * Creates a new ImageDescriptor. The image is loaded
- * from a file with the given name <code>name</code>.
- */
- public ExternalProgramImageDescriptor(Program program) {
- this.program = program;
- }
+ /**
+ * Creates a new ImageDescriptor. The image is loaded from a file with the given
+ * name <code>name</code>.
+ */
+ public ExternalProgramImageDescriptor(Program program) {
+ this.program = program;
+ }
- /**
- * @see Object#equals
- */
- @Override
+ /**
+ * @see Object#equals
+ */
+ @Override
public boolean equals(Object o) {
- if (!(o instanceof ExternalProgramImageDescriptor)) {
- return false;
- }
- ExternalProgramImageDescriptor other = (ExternalProgramImageDescriptor) o;
+ if (!(o instanceof ExternalProgramImageDescriptor)) {
+ return false;
+ }
+ ExternalProgramImageDescriptor other = (ExternalProgramImageDescriptor) o;
- //See if there is a name - compare it if so and compare the programs if not
- String otherName = other.program.getName();
- if (otherName == null) {
+ // See if there is a name - compare it if so and compare the programs if not
+ String otherName = other.program.getName();
+ if (otherName == null) {
return other.program.equals(program);
}
return otherName.equals(program.getName());
- }
+ }
- /**
- * Returns an SWT Image that is described by the information
- * in this descriptor. Each call returns a new Image.
- */
- public Image getImage() {
- return createImage();
- }
+ /**
+ * Returns an SWT Image that is described by the information in this descriptor.
+ * Each call returns a new Image.
+ */
+ public Image getImage() {
+ return createImage();
+ }
- /**
- * Returns an SWT Image that is described by the information
- * in this descriptor. Each call returns a new Image.
- */
- @Override
+ /**
+ * Returns an SWT Image that is described by the information in this descriptor.
+ * Each call returns a new Image.
+ */
+ @Override
public ImageData getImageData() {
- ImageData data = null;
- ImageData defaultImage = WorkbenchImages.getImageDescriptor(
- ISharedImages.IMG_OBJ_FILE).getImageData();
- if (defaultImage == null) {
+ ImageData data = null;
+ ImageData defaultImage = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJ_FILE).getImageData();
+ if (defaultImage == null) {
return null;
}
- if (program == null || ((data = program.getImageData()) == null)) {
+ if (program == null || ((data = program.getImageData()) == null)) {
return defaultImage;
}
- //The images in GNOME are too big. Scaling them does not give nice result so return defaultImage;
- if (data.height > defaultImage.height
- || data.width > defaultImage.width) {
+ // The images in GNOME are too big. Scaling them does not give nice result so
+ // return defaultImage;
+ if (data.height > defaultImage.height || data.width > defaultImage.width) {
return defaultImage;
}
- return data;
- }
+ return data;
+ }
- /**
- * @see Object#hashCode
- */
- @Override
+ /**
+ * @see Object#hashCode
+ */
+ @Override
public int hashCode() {
- String programName = program.getName();
- if (programName == null) {
+ String programName = program.getName();
+ if (programName == null) {
return program.hashCode();
}
return programName.hashCode();
- }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/Policy.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/Policy.java
index 3c2b72d9b9c..ca6e3cb07eb 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/Policy.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/Policy.java
@@ -19,188 +19,185 @@ import org.eclipse.ui.ISourceProvider;
import org.eclipse.ui.PlatformUI;
/**
- * A common facility for parsing the <code>org.eclipse.ui/.options</code>
- * file.
+ * A common facility for parsing the <code>org.eclipse.ui/.options</code> file.
*
* @since 2.1
*/
public class Policy {
- public static boolean DEFAULT = false;
+ public static boolean DEFAULT = false;
- public static boolean DEBUG_SWT_GRAPHICS = DEFAULT;
+ public static boolean DEBUG_SWT_GRAPHICS = DEFAULT;
- public static boolean DEBUG_SWT_DEBUG = DEFAULT;
+ public static boolean DEBUG_SWT_DEBUG = DEFAULT;
- public static boolean DEBUG_SWT_DEBUG_GLOBAL = DEFAULT;
+ public static boolean DEBUG_SWT_DEBUG_GLOBAL = DEFAULT;
- public static boolean DEBUG_DRAG_DROP = DEFAULT;
+ public static boolean DEBUG_DRAG_DROP = DEFAULT;
- /**
- * Flag to log stale jobs
- */
- public static boolean DEBUG_STALE_JOBS = DEFAULT;
+ /**
+ * Flag to log stale jobs
+ */
+ public static boolean DEBUG_STALE_JOBS = DEFAULT;
- /**
- * Whether to report all events entering through the common event framework
- * used by the commands architecture.
+ /**
+ * Whether to report all events entering through the common event framework used
+ * by the commands architecture.
*
* @see ISourceProvider
* @since 3.2
*/
- public static boolean DEBUG_SOURCES = DEFAULT;
-
- /**
- * Whether to print information about key bindings that are successfully
- * recognized within the system (as the keys are pressed).
- */
- public static boolean DEBUG_KEY_BINDINGS = DEFAULT;
-
- /**
- * Whether to print information about every key seen by the system.
- */
- public static boolean DEBUG_KEY_BINDINGS_VERBOSE = DEFAULT;
-
- /**
- * Whether to print extra information about error conditions dealing with
- * cool bars in the workbench, and their disposal.
- */
- public static boolean DEBUG_TOOLBAR_DISPOSAL = DEFAULT;
-
- /**
- * Whether to print debugging information about the execution of commands
- */
- public static boolean DEBUG_COMMANDS = DEFAULT;
-
- /**
- * Whether to print debugging information about the internal state of the
- * context support within the workbench.
- */
- public static boolean DEBUG_CONTEXTS = DEFAULT;
-
- /**
- * Whether to print debugging information about the performance of context
- * computations.
- */
- public static boolean DEBUG_CONTEXTS_PERFORMANCE = DEFAULT;
-
- /**
- * Whether to print even more debugging information about the internal state
- * of the context support within the workbench.
- */
- public static boolean DEBUG_CONTEXTS_VERBOSE = DEFAULT;
-
- /**
- * Whether to print debugging information about the internal state of the
- * command support (in relation to handlers) within the workbench.
- */
- public static boolean DEBUG_HANDLERS = DEFAULT;
-
- /**
- * Whether to print debugging information about the performance of handler
- * computations.
- */
- public static boolean DEBUG_HANDLERS_PERFORMANCE = DEFAULT;
-
- /**
- * Whether to print out verbose information about changing handlers in the
- * workbench.
- */
- public static boolean DEBUG_HANDLERS_VERBOSE = DEFAULT;
-
- /**
- * Whether to print debugging information about unexpected occurrences and
- * important state changes in the operation history.
- */
- public static boolean DEBUG_OPERATIONS = DEFAULT;
-
- /**
- * Whether to print out verbose information about the operation histories,
- * including all notifications sent.
- */
- public static boolean DEBUG_OPERATIONS_VERBOSE = DEFAULT;
-
-
- /**
- * Whether or not to show system jobs at all times.
- */
- public static boolean DEBUG_SHOW_ALL_JOBS = DEFAULT;
-
- /**
- * Whether or not to resolve images as they are declared.
- *
- * @since 3.1
- */
- public static boolean DEBUG_DECLARED_IMAGES = DEFAULT;
-
- /**
- * Whether or not to print contribution-related issues.
- *
- * @since 3.1
- */
- public static boolean DEBUG_CONTRIBUTIONS = DEFAULT;
-
- /**
- * Which command identifier to print handler information for. This
- * restricts the debugging output, so a developer can focus on one command
- * at a time.
- */
- public static String DEBUG_HANDLERS_VERBOSE_COMMAND_ID = null;
-
- /**
- * Whether experimental features in the rendering of commands into menus
- * and toolbars should be enabled. This is not guaranteed to provide a
- * working workbench.
- */
- public static boolean EXPERIMENTAL_MENU = DEFAULT;
-
- public static boolean DEBUG_MPE = DEFAULT;
-
- /**
- * Whether or not additional working set logging will occur.
- *
- * @since 3.4
- */
- public static boolean DEBUG_WORKING_SETS = DEFAULT;
-
- static {
- if (getDebugOption("/debug")) { //$NON-NLS-1$
- DEBUG_SWT_GRAPHICS = getDebugOption("/trace/graphics"); //$NON-NLS-1$
- DEBUG_SWT_DEBUG = getDebugOption("/debug/swtdebug"); //$NON-NLS-1$
- DEBUG_SWT_DEBUG_GLOBAL = getDebugOption("/debug/swtdebugglobal"); //$NON-NLS-1$
- DEBUG_DRAG_DROP = getDebugOption("/trace/dragDrop"); //$NON-NLS-1$
- DEBUG_SOURCES = getDebugOption("/trace/sources"); //$NON-NLS-1$
- DEBUG_KEY_BINDINGS = getDebugOption("/trace/keyBindings"); //$NON-NLS-1$
- DEBUG_KEY_BINDINGS_VERBOSE = getDebugOption("/trace/keyBindings.verbose"); //$NON-NLS-1$
- DEBUG_TOOLBAR_DISPOSAL = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.jface/trace/toolbarDisposal")); //$NON-NLS-1$ //$NON-NLS-2$
- DEBUG_COMMANDS = getDebugOption("/trace/commands"); //$NON-NLS-1$
- DEBUG_CONTEXTS = getDebugOption("/trace/contexts"); //$NON-NLS-1$
- DEBUG_CONTEXTS_PERFORMANCE = getDebugOption("/trace/contexts.performance"); //$NON-NLS-1$
- DEBUG_CONTEXTS_VERBOSE = getDebugOption("/trace/contexts.verbose"); //$NON-NLS-1$
- DEBUG_HANDLERS = getDebugOption("/trace/handlers"); //$NON-NLS-1$
- DEBUG_HANDLERS_PERFORMANCE = getDebugOption("/trace/handlers.performance"); //$NON-NLS-1$
- DEBUG_HANDLERS_VERBOSE = getDebugOption("/trace/handlers.verbose"); //$NON-NLS-1$
- DEBUG_OPERATIONS = getDebugOption("/trace/operations"); //$NON-NLS-1$
- DEBUG_OPERATIONS_VERBOSE = getDebugOption("/trace/operations.verbose"); //$NON-NLS-1$
- DEBUG_SHOW_ALL_JOBS = getDebugOption("/debug/showAllJobs"); //$NON-NLS-1$
- DEBUG_STALE_JOBS = getDebugOption("/debug/job.stale"); //$NON-NLS-1$
- DEBUG_HANDLERS_VERBOSE_COMMAND_ID = Platform
- .getDebugOption(PlatformUI.PLUGIN_ID
- + "/trace/handlers.verbose.commandId"); //$NON-NLS-1$
- if ("".equals(DEBUG_HANDLERS_VERBOSE_COMMAND_ID)) { //$NON-NLS-1$
- DEBUG_HANDLERS_VERBOSE_COMMAND_ID = null;
- }
- DEBUG_DECLARED_IMAGES = getDebugOption("/debug/declaredImages"); //$NON-NLS-1$
- DEBUG_CONTRIBUTIONS = getDebugOption("/debug/contributions"); //$NON-NLS-1$
- EXPERIMENTAL_MENU = getDebugOption("/experimental/menus"); //$NON-NLS-1$
- DEBUG_MPE = getDebugOption("/trace/multipageeditor"); //$NON-NLS-1$
- DEBUG_WORKING_SETS = getDebugOption("/debug/workingSets"); //$NON-NLS-1$
-
- if(DEBUG_SWT_DEBUG_GLOBAL)
- Device.DEBUG = true;
- }
- }
-
- private static boolean getDebugOption(String option) {
- return "true".equalsIgnoreCase(Platform.getDebugOption(PlatformUI.PLUGIN_ID + option)); //$NON-NLS-1$
- }
+ public static boolean DEBUG_SOURCES = DEFAULT;
+
+ /**
+ * Whether to print information about key bindings that are successfully
+ * recognized within the system (as the keys are pressed).
+ */
+ public static boolean DEBUG_KEY_BINDINGS = DEFAULT;
+
+ /**
+ * Whether to print information about every key seen by the system.
+ */
+ public static boolean DEBUG_KEY_BINDINGS_VERBOSE = DEFAULT;
+
+ /**
+ * Whether to print extra information about error conditions dealing with cool
+ * bars in the workbench, and their disposal.
+ */
+ public static boolean DEBUG_TOOLBAR_DISPOSAL = DEFAULT;
+
+ /**
+ * Whether to print debugging information about the execution of commands
+ */
+ public static boolean DEBUG_COMMANDS = DEFAULT;
+
+ /**
+ * Whether to print debugging information about the internal state of the
+ * context support within the workbench.
+ */
+ public static boolean DEBUG_CONTEXTS = DEFAULT;
+
+ /**
+ * Whether to print debugging information about the performance of context
+ * computations.
+ */
+ public static boolean DEBUG_CONTEXTS_PERFORMANCE = DEFAULT;
+
+ /**
+ * Whether to print even more debugging information about the internal state of
+ * the context support within the workbench.
+ */
+ public static boolean DEBUG_CONTEXTS_VERBOSE = DEFAULT;
+
+ /**
+ * Whether to print debugging information about the internal state of the
+ * command support (in relation to handlers) within the workbench.
+ */
+ public static boolean DEBUG_HANDLERS = DEFAULT;
+
+ /**
+ * Whether to print debugging information about the performance of handler
+ * computations.
+ */
+ public static boolean DEBUG_HANDLERS_PERFORMANCE = DEFAULT;
+
+ /**
+ * Whether to print out verbose information about changing handlers in the
+ * workbench.
+ */
+ public static boolean DEBUG_HANDLERS_VERBOSE = DEFAULT;
+
+ /**
+ * Whether to print debugging information about unexpected occurrences and
+ * important state changes in the operation history.
+ */
+ public static boolean DEBUG_OPERATIONS = DEFAULT;
+
+ /**
+ * Whether to print out verbose information about the operation histories,
+ * including all notifications sent.
+ */
+ public static boolean DEBUG_OPERATIONS_VERBOSE = DEFAULT;
+
+ /**
+ * Whether or not to show system jobs at all times.
+ */
+ public static boolean DEBUG_SHOW_ALL_JOBS = DEFAULT;
+
+ /**
+ * Whether or not to resolve images as they are declared.
+ *
+ * @since 3.1
+ */
+ public static boolean DEBUG_DECLARED_IMAGES = DEFAULT;
+
+ /**
+ * Whether or not to print contribution-related issues.
+ *
+ * @since 3.1
+ */
+ public static boolean DEBUG_CONTRIBUTIONS = DEFAULT;
+
+ /**
+ * Which command identifier to print handler information for. This restricts the
+ * debugging output, so a developer can focus on one command at a time.
+ */
+ public static String DEBUG_HANDLERS_VERBOSE_COMMAND_ID = null;
+
+ /**
+ * Whether experimental features in the rendering of commands into menus and
+ * toolbars should be enabled. This is not guaranteed to provide a working
+ * workbench.
+ */
+ public static boolean EXPERIMENTAL_MENU = DEFAULT;
+
+ public static boolean DEBUG_MPE = DEFAULT;
+
+ /**
+ * Whether or not additional working set logging will occur.
+ *
+ * @since 3.4
+ */
+ public static boolean DEBUG_WORKING_SETS = DEFAULT;
+
+ static {
+ if (getDebugOption("/debug")) { //$NON-NLS-1$
+ DEBUG_SWT_GRAPHICS = getDebugOption("/trace/graphics"); //$NON-NLS-1$
+ DEBUG_SWT_DEBUG = getDebugOption("/debug/swtdebug"); //$NON-NLS-1$
+ DEBUG_SWT_DEBUG_GLOBAL = getDebugOption("/debug/swtdebugglobal"); //$NON-NLS-1$
+ DEBUG_DRAG_DROP = getDebugOption("/trace/dragDrop"); //$NON-NLS-1$
+ DEBUG_SOURCES = getDebugOption("/trace/sources"); //$NON-NLS-1$
+ DEBUG_KEY_BINDINGS = getDebugOption("/trace/keyBindings"); //$NON-NLS-1$
+ DEBUG_KEY_BINDINGS_VERBOSE = getDebugOption("/trace/keyBindings.verbose"); //$NON-NLS-1$
+ DEBUG_TOOLBAR_DISPOSAL = "true" //$NON-NLS-1$
+ .equalsIgnoreCase(Platform.getDebugOption("org.eclipse.jface/trace/toolbarDisposal")); //$NON-NLS-1$
+ DEBUG_COMMANDS = getDebugOption("/trace/commands"); //$NON-NLS-1$
+ DEBUG_CONTEXTS = getDebugOption("/trace/contexts"); //$NON-NLS-1$
+ DEBUG_CONTEXTS_PERFORMANCE = getDebugOption("/trace/contexts.performance"); //$NON-NLS-1$
+ DEBUG_CONTEXTS_VERBOSE = getDebugOption("/trace/contexts.verbose"); //$NON-NLS-1$
+ DEBUG_HANDLERS = getDebugOption("/trace/handlers"); //$NON-NLS-1$
+ DEBUG_HANDLERS_PERFORMANCE = getDebugOption("/trace/handlers.performance"); //$NON-NLS-1$
+ DEBUG_HANDLERS_VERBOSE = getDebugOption("/trace/handlers.verbose"); //$NON-NLS-1$
+ DEBUG_OPERATIONS = getDebugOption("/trace/operations"); //$NON-NLS-1$
+ DEBUG_OPERATIONS_VERBOSE = getDebugOption("/trace/operations.verbose"); //$NON-NLS-1$
+ DEBUG_SHOW_ALL_JOBS = getDebugOption("/debug/showAllJobs"); //$NON-NLS-1$
+ DEBUG_STALE_JOBS = getDebugOption("/debug/job.stale"); //$NON-NLS-1$
+ DEBUG_HANDLERS_VERBOSE_COMMAND_ID = Platform
+ .getDebugOption(PlatformUI.PLUGIN_ID + "/trace/handlers.verbose.commandId"); //$NON-NLS-1$
+ if ("".equals(DEBUG_HANDLERS_VERBOSE_COMMAND_ID)) { //$NON-NLS-1$
+ DEBUG_HANDLERS_VERBOSE_COMMAND_ID = null;
+ }
+ DEBUG_DECLARED_IMAGES = getDebugOption("/debug/declaredImages"); //$NON-NLS-1$
+ DEBUG_CONTRIBUTIONS = getDebugOption("/debug/contributions"); //$NON-NLS-1$
+ EXPERIMENTAL_MENU = getDebugOption("/experimental/menus"); //$NON-NLS-1$
+ DEBUG_MPE = getDebugOption("/trace/multipageeditor"); //$NON-NLS-1$
+ DEBUG_WORKING_SETS = getDebugOption("/debug/workingSets"); //$NON-NLS-1$
+
+ if (DEBUG_SWT_DEBUG_GLOBAL)
+ Device.DEBUG = true;
+ }
+ }
+
+ private static boolean getDebugOption(String option) {
+ return "true".equalsIgnoreCase(Platform.getDebugOption(PlatformUI.PLUGIN_ID + option)); //$NON-NLS-1$
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ProgramImageDescriptor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ProgramImageDescriptor.java
index 0595f57af60..2f4f4bdb67f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ProgramImageDescriptor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ProgramImageDescriptor.java
@@ -23,57 +23,57 @@ import org.eclipse.ui.internal.WorkbenchImages;
* An image descriptor that loads its data from a program file.
*/
public class ProgramImageDescriptor extends ImageDescriptor {
- private String filename;
+ private String filename;
- private int offset;
+ private int offset;
- /**
- * Creates a new ImageDescriptor. The image is loaded
- * from a file with the given name <code>name</code>.
- */
- public ProgramImageDescriptor(String fullPath, int offsetInFile) {
- filename = fullPath;
- offset = offsetInFile;
- }
+ /**
+ * Creates a new ImageDescriptor. The image is loaded from a file with the given
+ * name <code>name</code>.
+ */
+ public ProgramImageDescriptor(String fullPath, int offsetInFile) {
+ filename = fullPath;
+ offset = offsetInFile;
+ }
- /**
- * @see Object#equals
- */
- @Override
+ /**
+ * @see Object#equals
+ */
+ @Override
public boolean equals(Object o) {
- if (!(o instanceof ProgramImageDescriptor)) {
- return false;
- }
- ProgramImageDescriptor other = (ProgramImageDescriptor) o;
- return filename.equals(other.filename) && offset == other.offset;
- }
+ if (!(o instanceof ProgramImageDescriptor)) {
+ return false;
+ }
+ ProgramImageDescriptor other = (ProgramImageDescriptor) o;
+ return filename.equals(other.filename) && offset == other.offset;
+ }
- /**
- * Returns an SWT Image that is described by the information
- * in this descriptor. Each call returns a new Image.
- */
- public Image getImage() {
- return createImage();
- }
+ /**
+ * Returns an SWT Image that is described by the information in this descriptor.
+ * Each call returns a new Image.
+ */
+ public Image getImage() {
+ return createImage();
+ }
- /**
- * Returns an SWT Image that is described by the information
- * in this descriptor.
- */
- @Override
+ /**
+ * Returns an SWT Image that is described by the information in this descriptor.
+ */
+ @Override
public ImageData getImageData(int zoom) {
- /*This is a user defined offset into the file which always
- *returns us the defualt - return the default regardless*/
+ /*
+ * This is a user defined offset into the file which always returns us the
+ * defualt - return the default regardless
+ */
- return WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJ_FILE)
- .getImageData(zoom);
- }
+ return WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJ_FILE).getImageData(zoom);
+ }
- /**
- * @see Object#hashCode
- */
- @Override
+ /**
+ * @see Object#hashCode
+ */
+ @Override
public int hashCode() {
- return filename.hashCode() + offset;
- }
+ return filename.hashCode() + offset;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/StringMatcher.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/StringMatcher.java
index e06c9418ec9..8884bddf1c8 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/StringMatcher.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/StringMatcher.java
@@ -23,20 +23,20 @@ import java.util.List;
* A string pattern matcher, supporting "*" and "?" wildcards.
*/
public class StringMatcher {
- protected String fPattern;
+ protected String fPattern;
- protected int fLength; // pattern length
+ protected int fLength; // pattern length
- protected boolean fIgnoreWildCards;
+ protected boolean fIgnoreWildCards;
- protected boolean fIgnoreCase;
+ protected boolean fIgnoreCase;
protected String[] patternWords;
protected Word wholePatternWord;
protected Word[] splittedPatternWords;
- protected static final char fSingleWildCard = '\u0000';
+ protected static final char fSingleWildCard = '\u0000';
class Word {
private boolean hasTrailingStar = false;
@@ -215,62 +215,61 @@ public class StringMatcher {
return false;
}
- }
-
- public static class Position {
- int start; //inclusive
-
- int end; //exclusive
-
- public Position(int start, int end) {
- this.start = start;
- this.end = end;
- }
-
- public int getStart() {
- return start;
- }
-
- public int getEnd() {
- return end;
- }
- }
-
- /**
- * StringMatcher constructor takes in a String object that is a simple
- * pattern which may contain '*' for 0 and many characters and
- * '?' for exactly one character.
- *
- * Literal '*' and '?' characters must be escaped in the pattern
- * e.g., "\*" means literal "*", etc.
- *
- * Escaping any other character (including the escape character itself),
- * just results in that character in the pattern.
- * e.g., "\a" means "a" and "\\" means "\"
- *
- * If invoking the StringMatcher with string literals in Java, don't forget
- * escape characters are represented by "\\".
- *
- * @param pattern the pattern to match text against
- * @param ignoreCase if true, case is ignored
- * @param ignoreWildCards if true, wild cards and their escape sequences are ignored
- * (everything is taken literally).
- */
- public StringMatcher(String pattern, boolean ignoreCase,
- boolean ignoreWildCards) {
- if (pattern == null) {
+ }
+
+ public static class Position {
+ int start; // inclusive
+
+ int end; // exclusive
+
+ public Position(int start, int end) {
+ this.start = start;
+ this.end = end;
+ }
+
+ public int getStart() {
+ return start;
+ }
+
+ public int getEnd() {
+ return end;
+ }
+ }
+
+ /**
+ * StringMatcher constructor takes in a String object that is a simple pattern
+ * which may contain '*' for 0 and many characters and '?' for exactly one
+ * character.
+ *
+ * Literal '*' and '?' characters must be escaped in the pattern e.g., "\*"
+ * means literal "*", etc.
+ *
+ * Escaping any other character (including the escape character itself), just
+ * results in that character in the pattern. e.g., "\a" means "a" and "\\" means
+ * "\"
+ *
+ * If invoking the StringMatcher with string literals in Java, don't forget
+ * escape characters are represented by "\\".
+ *
+ * @param pattern the pattern to match text against
+ * @param ignoreCase if true, case is ignored
+ * @param ignoreWildCards if true, wild cards and their escape sequences are
+ * ignored (everything is taken literally).
+ */
+ public StringMatcher(String pattern, boolean ignoreCase, boolean ignoreWildCards) {
+ if (pattern == null) {
throw new IllegalArgumentException();
}
- fIgnoreCase = ignoreCase;
- fIgnoreWildCards = ignoreWildCards;
- fPattern = pattern;
- fLength = pattern.length();
+ fIgnoreCase = ignoreCase;
+ fIgnoreWildCards = ignoreWildCards;
+ fPattern = pattern;
+ fLength = pattern.length();
- parsePatternIntoWords();
+ parsePatternIntoWords();
- if (fIgnoreWildCards) {
- parseNoWildCards();
- } else {
+ if (fIgnoreWildCards) {
+ parseNoWildCards();
+ } else {
if (wholePatternWord != null) {
wholePatternWord.parseWildcards();
}
@@ -279,29 +278,30 @@ public class StringMatcher {
word.parseWildcards();
}
}
- }
- }
-
+ }
+ }
- /**
- * match the given <code>text</code> with the pattern
- * @return true if matched otherwise false
- * @param text a String object
- */
- public boolean match(String text) {
- if(text == null) {
+ /**
+ * match the given <code>text</code> with the pattern
+ *
+ * @return true if matched otherwise false
+ * @param text a String object
+ */
+ public boolean match(String text) {
+ if (text == null) {
return false;
}
- return match(text, 0, text.length());
- }
+ return match(text, 0, text.length());
+ }
/**
* Given the starting (inclusive) and the ending (exclusive) positions in the
* <code>text</code>, determine if the given substring matches with aPattern
+ *
* @return true if the specified portion of the text matches the pattern
- * @param text a String object that contains the substring to match
+ * @param text a String object that contains the substring to match
* @param start marks the starting position (inclusive) of the substring
- * @param end marks the ending index (exclusive) of the substring
+ * @param end marks the ending index (exclusive) of the substring
*/
public boolean match(String text, int start, int end) {
if (null == text) {
@@ -353,133 +353,130 @@ public class StringMatcher {
}
}
- /**
- * This method parses the given pattern into segments seperated by wildcard '*' characters.
- * Since wildcards are not being used in this case, the pattern consists of a single segment.
- */
- private void parseNoWildCards() {
+ /**
+ * This method parses the given pattern into segments seperated by wildcard '*'
+ * characters. Since wildcards are not being used in this case, the pattern
+ * consists of a single segment.
+ */
+ private void parseNoWildCards() {
this.wholePatternWord = new Word(fPattern, fLength, patternWords);
this.wholePatternWord.bound = fLength;
this.wholePatternWord.fragments = patternWords;
- }
-
+ }
- /**
- * @param text a string which contains no wildcard
- * @param start the starting index in the text for search, inclusive
- * @param end the stopping point of search, exclusive
- * @return the starting index in the text of the pattern , or -1 if not found
- */
- protected int posIn(String text, int start, int end) {//no wild card in pattern
- int max = end - fLength;
+ /**
+ * @param text a string which contains no wildcard
+ * @param start the starting index in the text for search, inclusive
+ * @param end the stopping point of search, exclusive
+ * @return the starting index in the text of the pattern , or -1 if not found
+ */
+ protected int posIn(String text, int start, int end) {// no wild card in pattern
+ int max = end - fLength;
- if (!fIgnoreCase) {
- int i = text.indexOf(fPattern, start);
- if (i == -1 || i > max) {
+ if (!fIgnoreCase) {
+ int i = text.indexOf(fPattern, start);
+ if (i == -1 || i > max) {
return -1;
}
- return i;
- }
+ return i;
+ }
- for (int i = start; i <= max; ++i) {
- if (text.regionMatches(true, i, fPattern, 0, fLength)) {
+ for (int i = start; i <= max; ++i) {
+ if (text.regionMatches(true, i, fPattern, 0, fLength)) {
return i;
}
- }
-
- return -1;
- }
-
- /**
- * @param text a simple regular expression that may only contain '?'(s)
- * @param start the starting index in the text for search, inclusive
- * @param end the stopping point of search, exclusive
- * @param p a simple regular expression that may contains '?'
- * @return the starting index in the text of the pattern , or -1 if not found
- */
- protected int regExpPosIn(String text, int start, int end, String p) {
- int plen = p.length();
-
- int max = end - plen;
- for (int i = start; i <= max; ++i) {
- if (regExpRegionMatches(text, i, p, 0, plen)) {
+ }
+
+ return -1;
+ }
+
+ /**
+ * @param text a simple regular expression that may only contain '?'(s)
+ * @param start the starting index in the text for search, inclusive
+ * @param end the stopping point of search, exclusive
+ * @param p a simple regular expression that may contains '?'
+ * @return the starting index in the text of the pattern , or -1 if not found
+ */
+ protected int regExpPosIn(String text, int start, int end, String p) {
+ int plen = p.length();
+
+ int max = end - plen;
+ for (int i = start; i <= max; ++i) {
+ if (regExpRegionMatches(text, i, p, 0, plen)) {
return i;
}
- }
- return -1;
- }
+ }
+ return -1;
+ }
- /**
+ /**
*
* @return boolean
* @param text a String to match
* @param start int that indicates the starting index of match, inclusive
- * @param end</code> int that indicates the ending index of match,
- * exclusive
+ * @param end</code> int that indicates the ending index of match, exclusive
* @param p String, String, a simple regular expression that may
* contain '?'
* @param ignoreCase boolean indicating whether code>p</code> is case sensitive
*/
- protected boolean regExpRegionMatches(String text, int tStart, String p,
- int pStart, int plen) {
- while (plen-- > 0) {
- char tchar = text.charAt(tStart++);
- char pchar = p.charAt(pStart++);
-
- /* process wild cards */
- if (!fIgnoreWildCards) {
- /* skip single wild cards */
- if (pchar == fSingleWildCard) {
- continue;
- }
- }
- if (pchar == tchar) {
+ protected boolean regExpRegionMatches(String text, int tStart, String p, int pStart, int plen) {
+ while (plen-- > 0) {
+ char tchar = text.charAt(tStart++);
+ char pchar = p.charAt(pStart++);
+
+ /* process wild cards */
+ if (!fIgnoreWildCards) {
+ /* skip single wild cards */
+ if (pchar == fSingleWildCard) {
+ continue;
+ }
+ }
+ if (pchar == tchar) {
continue;
}
- if (fIgnoreCase) {
- if (Character.toUpperCase(tchar) == Character
- .toUpperCase(pchar)) {
+ if (fIgnoreCase) {
+ if (Character.toUpperCase(tchar) == Character.toUpperCase(pchar)) {
continue;
}
- // comparing after converting to upper case doesn't handle all cases;
- // also compare after converting to lower case
+ // comparing after converting to upper case doesn't handle all cases;
+ // also compare after converting to lower case
if (Character.toLowerCase(tchar) == Character.toLowerCase(pchar)) {
continue;
}
- }
- return false;
- }
- return true;
- }
-
- /**
- * @param text the string to match
- * @param start the starting index in the text for search, inclusive
- * @param end the stopping point of search, exclusive
- * @param p a pattern string that has no wildcard
- * @return the starting index in the text of the pattern , or -1 if not found
- */
- protected int textPosIn(String text, int start, int end, String p) {
-
- int plen = p.length();
- int max = end - plen;
-
- if (!fIgnoreCase) {
- int i = text.indexOf(p, start);
- if (i == -1 || i > max) {
+ }
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @param text the string to match
+ * @param start the starting index in the text for search, inclusive
+ * @param end the stopping point of search, exclusive
+ * @param p a pattern string that has no wildcard
+ * @return the starting index in the text of the pattern , or -1 if not found
+ */
+ protected int textPosIn(String text, int start, int end, String p) {
+
+ int plen = p.length();
+ int max = end - plen;
+
+ if (!fIgnoreCase) {
+ int i = text.indexOf(p, start);
+ if (i == -1 || i > max) {
return -1;
}
- return i;
- }
+ return i;
+ }
- for (int i = start; i <= max; ++i) {
- if (text.regionMatches(true, i, p, 0, plen)) {
+ for (int i = start; i <= max; ++i) {
+ if (text.regionMatches(true, i, p, 0, plen)) {
return i;
}
- }
+ }
- return -1;
- }
+ return -1;
+ }
/**
* Take the given filter text and break it down into words using a
@@ -517,4 +514,3 @@ public class StringMatcher {
}
}
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/TestPartListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/TestPartListener.java
index 58004e1879f..d3fdbd71f85 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/TestPartListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/TestPartListener.java
@@ -20,72 +20,73 @@ import org.eclipse.ui.IWorkbenchPart;
* Prints out part listener events
*/
public class TestPartListener implements IPartListener {
- /**
- * TestPartListener constructor comment.
- * @issue seems like garbage - no one using it
- */
- public TestPartListener() {
- super();
- }
+ /**
+ * TestPartListener constructor comment.
+ *
+ * @issue seems like garbage - no one using it
+ */
+ public TestPartListener() {
+ super();
+ }
- /**
- * Notifies this listener that the given part has been activated.
- *
- * @param part the part that was activated
- * @see IPerspective#activate
- */
- @Override
+ /**
+ * Notifies this listener that the given part has been activated.
+ *
+ * @param part the part that was activated
+ * @see IPerspective#activate
+ */
+ @Override
public void partActivated(IWorkbenchPart part) {
- System.out.println("partActivated(" + part + ")");//$NON-NLS-2$//$NON-NLS-1$
- }
+ System.out.println("partActivated(" + part + ")");//$NON-NLS-2$//$NON-NLS-1$
+ }
- /**
- * Notifies this listener that the given part has been brought to the top.
- * <p>
- * These events occur when an editor is brought to the top in the editor area,
- * or when a view is brought to the top in a page book with multiple views.
- * They are normally only sent when a part is brought to the top
- * programmatically (via <code>IPerspective.bringToTop</code>). When a part is
- * activated by the user clicking on it, only <code>partActivated</code> is sent.
- * </p>
- *
- * @param part the part that was surfaced
- * @see IPerspective#bringToTop
- */
- @Override
+ /**
+ * Notifies this listener that the given part has been brought to the top.
+ * <p>
+ * These events occur when an editor is brought to the top in the editor area,
+ * or when a view is brought to the top in a page book with multiple views. They
+ * are normally only sent when a part is brought to the top programmatically
+ * (via <code>IPerspective.bringToTop</code>). When a part is activated by the
+ * user clicking on it, only <code>partActivated</code> is sent.
+ * </p>
+ *
+ * @param part the part that was surfaced
+ * @see IPerspective#bringToTop
+ */
+ @Override
public void partBroughtToTop(IWorkbenchPart part) {
- System.out.println("partBroughtToTop(" + part + ")");//$NON-NLS-2$//$NON-NLS-1$
- }
+ System.out.println("partBroughtToTop(" + part + ")");//$NON-NLS-2$//$NON-NLS-1$
+ }
- /**
- * Notifies this listener that the given part has been closed.
- *
- * @param part the part that was closed
- * @see IPerspective#close
- */
- @Override
+ /**
+ * Notifies this listener that the given part has been closed.
+ *
+ * @param part the part that was closed
+ * @see IPerspective#close
+ */
+ @Override
public void partClosed(IWorkbenchPart part) {
- System.out.println("partClosed(" + part + ")");//$NON-NLS-2$//$NON-NLS-1$
- }
+ System.out.println("partClosed(" + part + ")");//$NON-NLS-2$//$NON-NLS-1$
+ }
- /**
- * Notifies this listener that the given part has been deactivated.
- *
- * @param part the part that was deactivated
- * @see IPerspective#activate
- */
- @Override
+ /**
+ * Notifies this listener that the given part has been deactivated.
+ *
+ * @param part the part that was deactivated
+ * @see IPerspective#activate
+ */
+ @Override
public void partDeactivated(IWorkbenchPart part) {
- System.out.println("partDeactivated(" + part + ")");//$NON-NLS-2$//$NON-NLS-1$
- }
+ System.out.println("partDeactivated(" + part + ")");//$NON-NLS-2$//$NON-NLS-1$
+ }
- /**
- * Notifies this listener that the given part has been opened.
- *
- * @param part the part that was opened
- */
- @Override
+ /**
+ * Notifies this listener that the given part has been opened.
+ *
+ * @param part the part that was opened
+ */
+ @Override
public void partOpened(IWorkbenchPart part) {
- System.out.println("partOpened(" + part + ")");//$NON-NLS-2$//$NON-NLS-1$
- }
+ System.out.println("partOpened(" + part + ")");//$NON-NLS-2$//$NON-NLS-1$
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/UIListenerLogging.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/UIListenerLogging.java
index 72b73f59fc2..796b1a5ee14 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/UIListenerLogging.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/UIListenerLogging.java
@@ -23,225 +23,238 @@ import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.util.Util;
-
/**
- * To whom it may concern: Please stop deleting the logging code. This is important for debugging
- * event ordering issues.
+ * To whom it may concern: Please stop deleting the logging code. This is
+ * important for debugging event ordering issues.
*/
public class UIListenerLogging {
- // Types of listeners that can be logged (the names of the options that enable/disable their logging)
- private static final String LISTENER_EVENTS = PlatformUI.PLUGIN_ID + "/debug"; //$NON-NLS-1$
- public static final String PAGE_PARTLISTENER_EVENTS = PlatformUI.PLUGIN_ID + "/listeners/IWorkbenchPage.IPartListener"; //$NON-NLS-1$
- public static final String PAGE_PARTLISTENER2_EVENTS = PlatformUI.PLUGIN_ID + "/listeners/IWorkbenchPage.IPartListener2"; //$NON-NLS-1$
- private static final String PAGE_PROPERTY_EVENTS = PlatformUI.PLUGIN_ID + "/listeners/IWorkbenchPage.IPropertyChangeListener"; //$NON-NLS-1$
- private static final String WINDOW_PAGE_EVENTS = PlatformUI.PLUGIN_ID + "/listeners/IWorkbenchWindow.IPageListener"; //$NON-NLS-1$
- private static final String WINDOW_PERSPECTIVE_EVENTS = PlatformUI.PLUGIN_ID + "/listeners/IWorkbenchWindow.IPerspectiveListener"; //$NON-NLS-1$
- public static final String WINDOW_PARTLISTENER_EVENTS = PlatformUI.PLUGIN_ID + "/listeners/IWorkbenchWindow.IPartListener"; //$NON-NLS-1$
- public static final String WINDOW_PARTLISTENER2_EVENTS = PlatformUI.PLUGIN_ID + "/listeners/IWorkbenchWindow.IPartListener2"; //$NON-NLS-1$
- private static final String PARTREFERENCE_PROPERTY_EVENTS = PlatformUI.PLUGIN_ID + "/listeners/IWorkbenchPartReference"; //$NON-NLS-1$
-
- public static final boolean enabled = internal_isEnabled(LISTENER_EVENTS);
-
- // IPartListener events
- public static final String PE_ACTIVATED = "partActivated"; //$NON-NLS-1$
- public static final String PE_PART_BROUGHT_TO_TOP = "partBroughtToTop"; //$NON-NLS-1$
- public static final String PE_PART_CLOSED = "partClosed"; //$NON-NLS-1$
- public static final String PE_PART_DEACTIVATED = "partDeactivated"; //$NON-NLS-1$
- public static final String PE_PART_OPENED = "partOpened"; //$NON-NLS-1$
-
- // IPartListener2 events
- public static final String PE2_ACTIVATED = "partActivated"; //$NON-NLS-1$
- public static final String PE2_PART_VISIBLE = "partVisible"; //$NON-NLS-1$
- public static final String PE2_PART_HIDDEN = "partHidden"; //$NON-NLS-1$
- public static final String PE2_PART_BROUGHT_TO_TOP = "partBroughtToTop"; //$NON-NLS-1$
- public static final String PE2_PART_CLOSED = "partClosed"; //$NON-NLS-1$
- public static final String PE2_PART_DEACTIVATED = "partDectivated"; //$NON-NLS-1$
- public static final String PE2_PART_OPENED = "partOpened"; //$NON-NLS-1$
- public static final String PE2_PART_INPUT_CHANGED = "partInputChanged"; //$NON-NLS-1$
-
- // IPageListener events
- public static final String WPE_PAGE_ACTIVATED = "pageActivated"; //$NON-NLS-1$
- public static final String WPE_PAGE_OPENED = "pageOpened"; //$NON-NLS-1$
- public static final String WPE_PAGE_CLOSED = "pageClosed"; //$NON-NLS-1$
-
- // IPerspectiveListener events
- public static final String PLE_PERSP_PRE_DEACTIVATE = "perspectivePreDeactivate"; //$NON-NLS-1$
- public static final String PLE_PERSP_DEACTIVATED = "perspectiveDeactivated"; //$NON-NLS-1$
- public static final String PLE_PERSP_ACTIVATED = "perspectiveActivated"; //$NON-NLS-1$
- public static final String PLE_PERSP_OPENED = "perspectiveOpened"; //$NON-NLS-1$
- public static final String PLE_PERSP_CLOSED = "perspectiveClosed"; //$NON-NLS-1$
- public static final String PLE_PERSP_SAVED_AS = "perspectiveSavedAs"; //$NON-NLS-1$
-
- private static String getSourceId(Object source) {
- return Util.safeString(Integer.toString(source.hashCode() % 1000));
- }
-
- private static String getWindowId(IWorkbenchWindow source) {
- return "window " + Util.safeString(Integer.toString(source.hashCode() % 1000)); //$NON-NLS-1$
- }
-
- private static String getPageId(IWorkbenchPage page) {
- return "page " + Util.safeString(Integer.toString(page.hashCode() % 1000)); //$NON-NLS-1$
- }
-
- private static String getPerspectiveId(IPerspectiveDescriptor descriptor) {
- return Util.safeString(descriptor.getId());
- }
-
- public static final void logPageEvent(IWorkbenchWindow window, IWorkbenchPage page, String eventId) {
- if (isEnabled(WINDOW_PAGE_EVENTS)) {
- System.out.println(WINDOW_PAGE_EVENTS
- + " " + getWindowId(window) //$NON-NLS-1$
- + " " + eventId + " (" + getPageId(page) + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- }
-
- public static final void logPerspectiveEvent(IWorkbenchWindow window, IWorkbenchPage page,
- IPerspectiveDescriptor descriptor, String eventId) {
-
- if (isEnabled(WINDOW_PERSPECTIVE_EVENTS)) {
- System.out.println(WINDOW_PERSPECTIVE_EVENTS
- + " " + getWindowId(window) //$NON-NLS-1$
- + " " + eventId + " (" + getPageId(page) + ", " + getPerspectiveId(descriptor) + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
- }
-
- public static final void logPerspectiveChangedEvent(IWorkbenchWindow window, IWorkbenchPage page,
- IPerspectiveDescriptor descriptor, IWorkbenchPartReference ref, String changeId) {
-
- if (isEnabled(WINDOW_PERSPECTIVE_EVENTS)) {
- System.out.println(WINDOW_PERSPECTIVE_EVENTS
- + " "+ getWindowId(window) //$NON-NLS-1$
- + " perspectiveChanged (" + getPageId(page) + ", " + getPerspectiveId(descriptor) //$NON-NLS-1$ //$NON-NLS-2$
- + ", " + getPartId(ref) + ", " + changeId + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- }
- }
-
- public static final void logPerspectiveSavedAs(IWorkbenchWindow window, IWorkbenchPage page,
- IPerspectiveDescriptor oldDescriptor, IPerspectiveDescriptor newDescriptor) {
-
- if (isEnabled(WINDOW_PERSPECTIVE_EVENTS)) {
- System.out.println(WINDOW_PERSPECTIVE_EVENTS
- + " " + getWindowId(window) //$NON-NLS-1$
- + " " + PLE_PERSP_SAVED_AS + " (" + getPageId(page) + ", " + getPerspectiveId(oldDescriptor) + ", " + getPerspectiveId(newDescriptor) + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- }
- }
-
-
- private static String getPartId(IWorkbenchPart part) {
- if (part == null) {
- return "null part"; //$NON-NLS-1$
- }
-
- return Util.safeString(part.getTitle()) + " - " //$NON-NLS-1$
- + Util.safeString(part.getSite().getId());
- }
-
- private static String getPartId(IWorkbenchPartReference ref) {
- if (ref == null) {
- return "null part"; //$NON-NLS-1$
- }
-
- return Util.safeString(ref.getPartName()) + " - " //$NON-NLS-1$
- + Util.safeString(ref.getId());
- }
-
- /**
- * Log a partListener event fired from the workbench window
- *
- * @param page
- * @param eventId
- */
- public static final void logPartListenerEvent(String sourceType, Object source, IWorkbenchPart part, String eventId) {
- if (isEnabled(sourceType)) {
- System.out.println(sourceType + " " + getSourceId(source) //$NON-NLS-1$
- + ", " + eventId + "(" + getPartId(part) + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- }
-
- /**
- * Log a partListener2 event fired from the workbench window
- *
- * @param page
- * @param eventId
- */
- public static final void logPartListener2Event(String sourceType, Object source, IWorkbenchPartReference part, String eventId) {
- if (isEnabled(sourceType)) {
- System.out.println(sourceType + " " + getSourceId(source) //$NON-NLS-1$
- + ", " + eventId + "(" + getPartId(part) + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- }
-
- /**
- * Log an event fired from the workbench page
- *
- * @param page
- * @param eventId
- */
- public static final void logPartListenerEvent(IWorkbenchPage page, IWorkbenchPart part, String eventId) {
- if (isEnabled(PAGE_PARTLISTENER_EVENTS)) {
- System.out.println(PAGE_PARTLISTENER_EVENTS + " page " //$NON-NLS-1$
- + Util.safeString(page.getLabel())
- + ", " + eventId + "(" + getPartId(part) + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- }
-
- /**
- * Log an event fired from the workbench page
- *
- * @param page
- * @param eventId
- */
- public static final void logPartListener2Event(IWorkbenchPage page, IWorkbenchPartReference part, String eventId) {
- if (isEnabled(PAGE_PARTLISTENER2_EVENTS)) {
- System.out.println(PAGE_PARTLISTENER2_EVENTS + " page " //$NON-NLS-1$
- + Util.safeString(page.getLabel())
- + ", " + eventId + "(" + getPartId(part) + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- }
-
- /**
- * Log an event fired from the workbench page
- *
- * @param page
- * @param eventId
- */
- public static final void logPagePropertyChanged(IWorkbenchPage page, String changeId, Object oldValue, Object newValue) {
- if (isEnabled(PAGE_PROPERTY_EVENTS)) {
- System.out.println(PAGE_PROPERTY_EVENTS + " page " //$NON-NLS-1$
- + Util.safeString(page.getLabel())
- + ", " + changeId + " = " + Util.safeString(newValue.toString()) + "( old value = " + newValue.toString() + " )"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
- }
-
- public static final void logPartReferencePropertyChange(IWorkbenchPartReference ref, int changeId) {
- if (isEnabled(PARTREFERENCE_PROPERTY_EVENTS)) {
- String eventDescription;
-
- switch(changeId) {
- case IWorkbenchPartConstants.PROP_TITLE: eventDescription = "title"; break; //$NON-NLS-1$
- case IWorkbenchPartConstants.PROP_DIRTY: eventDescription = "dirty"; break; //$NON-NLS-1$
- case IWorkbenchPartConstants.PROP_INPUT: eventDescription = "input"; break; //$NON-NLS-1$
- case IWorkbenchPartConstants.PROP_PART_NAME: eventDescription = "part_name"; break; //$NON-NLS-1$
- case IWorkbenchPartConstants.PROP_CONTENT_DESCRIPTION: eventDescription = "content_description"; break; //$NON-NLS-1$
- default:
- eventDescription = "unknown event id = " + changeId; //$NON-NLS-1$
- }
-
- System.out.println(PARTREFERENCE_PROPERTY_EVENTS + " " //$NON-NLS-1$
- + getPartId(ref)
- + ", property " + eventDescription); //$NON-NLS-1$
- }
- }
-
- private static boolean isEnabled(String eventName) {
- return enabled && internal_isEnabled(eventName);
- }
-
- private static boolean internal_isEnabled(String eventName) {
- String option = Platform.getDebugOption(eventName);
- return option != null && !option.equalsIgnoreCase("false") && !option.equalsIgnoreCase("-1"); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ // Types of listeners that can be logged (the names of the options that
+ // enable/disable their logging)
+ private static final String LISTENER_EVENTS = PlatformUI.PLUGIN_ID + "/debug"; //$NON-NLS-1$
+ public static final String PAGE_PARTLISTENER_EVENTS = PlatformUI.PLUGIN_ID
+ + "/listeners/IWorkbenchPage.IPartListener"; //$NON-NLS-1$
+ public static final String PAGE_PARTLISTENER2_EVENTS = PlatformUI.PLUGIN_ID
+ + "/listeners/IWorkbenchPage.IPartListener2"; //$NON-NLS-1$
+ private static final String PAGE_PROPERTY_EVENTS = PlatformUI.PLUGIN_ID
+ + "/listeners/IWorkbenchPage.IPropertyChangeListener"; //$NON-NLS-1$
+ private static final String WINDOW_PAGE_EVENTS = PlatformUI.PLUGIN_ID + "/listeners/IWorkbenchWindow.IPageListener"; //$NON-NLS-1$
+ private static final String WINDOW_PERSPECTIVE_EVENTS = PlatformUI.PLUGIN_ID
+ + "/listeners/IWorkbenchWindow.IPerspectiveListener"; //$NON-NLS-1$
+ public static final String WINDOW_PARTLISTENER_EVENTS = PlatformUI.PLUGIN_ID
+ + "/listeners/IWorkbenchWindow.IPartListener"; //$NON-NLS-1$
+ public static final String WINDOW_PARTLISTENER2_EVENTS = PlatformUI.PLUGIN_ID
+ + "/listeners/IWorkbenchWindow.IPartListener2"; //$NON-NLS-1$
+ private static final String PARTREFERENCE_PROPERTY_EVENTS = PlatformUI.PLUGIN_ID
+ + "/listeners/IWorkbenchPartReference"; //$NON-NLS-1$
+
+ public static final boolean enabled = internal_isEnabled(LISTENER_EVENTS);
+
+ // IPartListener events
+ public static final String PE_ACTIVATED = "partActivated"; //$NON-NLS-1$
+ public static final String PE_PART_BROUGHT_TO_TOP = "partBroughtToTop"; //$NON-NLS-1$
+ public static final String PE_PART_CLOSED = "partClosed"; //$NON-NLS-1$
+ public static final String PE_PART_DEACTIVATED = "partDeactivated"; //$NON-NLS-1$
+ public static final String PE_PART_OPENED = "partOpened"; //$NON-NLS-1$
+
+ // IPartListener2 events
+ public static final String PE2_ACTIVATED = "partActivated"; //$NON-NLS-1$
+ public static final String PE2_PART_VISIBLE = "partVisible"; //$NON-NLS-1$
+ public static final String PE2_PART_HIDDEN = "partHidden"; //$NON-NLS-1$
+ public static final String PE2_PART_BROUGHT_TO_TOP = "partBroughtToTop"; //$NON-NLS-1$
+ public static final String PE2_PART_CLOSED = "partClosed"; //$NON-NLS-1$
+ public static final String PE2_PART_DEACTIVATED = "partDectivated"; //$NON-NLS-1$
+ public static final String PE2_PART_OPENED = "partOpened"; //$NON-NLS-1$
+ public static final String PE2_PART_INPUT_CHANGED = "partInputChanged"; //$NON-NLS-1$
+
+ // IPageListener events
+ public static final String WPE_PAGE_ACTIVATED = "pageActivated"; //$NON-NLS-1$
+ public static final String WPE_PAGE_OPENED = "pageOpened"; //$NON-NLS-1$
+ public static final String WPE_PAGE_CLOSED = "pageClosed"; //$NON-NLS-1$
+
+ // IPerspectiveListener events
+ public static final String PLE_PERSP_PRE_DEACTIVATE = "perspectivePreDeactivate"; //$NON-NLS-1$
+ public static final String PLE_PERSP_DEACTIVATED = "perspectiveDeactivated"; //$NON-NLS-1$
+ public static final String PLE_PERSP_ACTIVATED = "perspectiveActivated"; //$NON-NLS-1$
+ public static final String PLE_PERSP_OPENED = "perspectiveOpened"; //$NON-NLS-1$
+ public static final String PLE_PERSP_CLOSED = "perspectiveClosed"; //$NON-NLS-1$
+ public static final String PLE_PERSP_SAVED_AS = "perspectiveSavedAs"; //$NON-NLS-1$
+
+ private static String getSourceId(Object source) {
+ return Util.safeString(Integer.toString(source.hashCode() % 1000));
+ }
+
+ private static String getWindowId(IWorkbenchWindow source) {
+ return "window " + Util.safeString(Integer.toString(source.hashCode() % 1000)); //$NON-NLS-1$
+ }
+
+ private static String getPageId(IWorkbenchPage page) {
+ return "page " + Util.safeString(Integer.toString(page.hashCode() % 1000)); //$NON-NLS-1$
+ }
+
+ private static String getPerspectiveId(IPerspectiveDescriptor descriptor) {
+ return Util.safeString(descriptor.getId());
+ }
+
+ public static final void logPageEvent(IWorkbenchWindow window, IWorkbenchPage page, String eventId) {
+ if (isEnabled(WINDOW_PAGE_EVENTS)) {
+ System.out.println(WINDOW_PAGE_EVENTS + " " + getWindowId(window) //$NON-NLS-1$
+ + " " + eventId + " (" + getPageId(page) + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ }
+
+ public static final void logPerspectiveEvent(IWorkbenchWindow window, IWorkbenchPage page,
+ IPerspectiveDescriptor descriptor, String eventId) {
+
+ if (isEnabled(WINDOW_PERSPECTIVE_EVENTS)) {
+ System.out.println(WINDOW_PERSPECTIVE_EVENTS + " " + getWindowId(window) //$NON-NLS-1$
+ + " " + eventId + " (" + getPageId(page) + ", " + getPerspectiveId(descriptor) + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ }
+ }
+
+ public static final void logPerspectiveChangedEvent(IWorkbenchWindow window, IWorkbenchPage page,
+ IPerspectiveDescriptor descriptor, IWorkbenchPartReference ref, String changeId) {
+
+ if (isEnabled(WINDOW_PERSPECTIVE_EVENTS)) {
+ System.out.println(WINDOW_PERSPECTIVE_EVENTS + " " + getWindowId(window) //$NON-NLS-1$
+ + " perspectiveChanged (" + getPageId(page) + ", " + getPerspectiveId(descriptor) //$NON-NLS-1$ //$NON-NLS-2$
+ + ", " + getPartId(ref) + ", " + changeId + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ }
+ }
+
+ public static final void logPerspectiveSavedAs(IWorkbenchWindow window, IWorkbenchPage page,
+ IPerspectiveDescriptor oldDescriptor, IPerspectiveDescriptor newDescriptor) {
+
+ if (isEnabled(WINDOW_PERSPECTIVE_EVENTS)) {
+ System.out.println(WINDOW_PERSPECTIVE_EVENTS + " " + getWindowId(window) //$NON-NLS-1$
+ + " " + PLE_PERSP_SAVED_AS + " (" + getPageId(page) + ", " + getPerspectiveId(oldDescriptor) + ", " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ + getPerspectiveId(newDescriptor) + ")"); //$NON-NLS-1$
+ }
+ }
+
+ private static String getPartId(IWorkbenchPart part) {
+ if (part == null) {
+ return "null part"; //$NON-NLS-1$
+ }
+
+ return Util.safeString(part.getTitle()) + " - " //$NON-NLS-1$
+ + Util.safeString(part.getSite().getId());
+ }
+
+ private static String getPartId(IWorkbenchPartReference ref) {
+ if (ref == null) {
+ return "null part"; //$NON-NLS-1$
+ }
+
+ return Util.safeString(ref.getPartName()) + " - " //$NON-NLS-1$
+ + Util.safeString(ref.getId());
+ }
+
+ /**
+ * Log a partListener event fired from the workbench window
+ *
+ * @param page
+ * @param eventId
+ */
+ public static final void logPartListenerEvent(String sourceType, Object source, IWorkbenchPart part,
+ String eventId) {
+ if (isEnabled(sourceType)) {
+ System.out.println(sourceType + " " + getSourceId(source) //$NON-NLS-1$
+ + ", " + eventId + "(" + getPartId(part) + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ }
+
+ /**
+ * Log a partListener2 event fired from the workbench window
+ *
+ * @param page
+ * @param eventId
+ */
+ public static final void logPartListener2Event(String sourceType, Object source, IWorkbenchPartReference part,
+ String eventId) {
+ if (isEnabled(sourceType)) {
+ System.out.println(sourceType + " " + getSourceId(source) //$NON-NLS-1$
+ + ", " + eventId + "(" + getPartId(part) + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ }
+
+ /**
+ * Log an event fired from the workbench page
+ *
+ * @param page
+ * @param eventId
+ */
+ public static final void logPartListenerEvent(IWorkbenchPage page, IWorkbenchPart part, String eventId) {
+ if (isEnabled(PAGE_PARTLISTENER_EVENTS)) {
+ System.out.println(PAGE_PARTLISTENER_EVENTS + " page " //$NON-NLS-1$
+ + Util.safeString(page.getLabel()) + ", " + eventId + "(" + getPartId(part) + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ }
+
+ /**
+ * Log an event fired from the workbench page
+ *
+ * @param page
+ * @param eventId
+ */
+ public static final void logPartListener2Event(IWorkbenchPage page, IWorkbenchPartReference part, String eventId) {
+ if (isEnabled(PAGE_PARTLISTENER2_EVENTS)) {
+ System.out.println(PAGE_PARTLISTENER2_EVENTS + " page " //$NON-NLS-1$
+ + Util.safeString(page.getLabel()) + ", " + eventId + "(" + getPartId(part) + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ }
+
+ /**
+ * Log an event fired from the workbench page
+ *
+ * @param page
+ * @param eventId
+ */
+ public static final void logPagePropertyChanged(IWorkbenchPage page, String changeId, Object oldValue,
+ Object newValue) {
+ if (isEnabled(PAGE_PROPERTY_EVENTS)) {
+ System.out.println(PAGE_PROPERTY_EVENTS + " page " //$NON-NLS-1$
+ + Util.safeString(page.getLabel()) + ", " + changeId + " = " + Util.safeString(newValue.toString()) //$NON-NLS-1$ //$NON-NLS-2$
+ + "( old value = " + newValue.toString() + " )"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ public static final void logPartReferencePropertyChange(IWorkbenchPartReference ref, int changeId) {
+ if (isEnabled(PARTREFERENCE_PROPERTY_EVENTS)) {
+ String eventDescription;
+
+ switch (changeId) {
+ case IWorkbenchPartConstants.PROP_TITLE:
+ eventDescription = "title"; //$NON-NLS-1$
+ break;
+ case IWorkbenchPartConstants.PROP_DIRTY:
+ eventDescription = "dirty"; //$NON-NLS-1$
+ break;
+ case IWorkbenchPartConstants.PROP_INPUT:
+ eventDescription = "input"; //$NON-NLS-1$
+ break;
+ case IWorkbenchPartConstants.PROP_PART_NAME:
+ eventDescription = "part_name"; //$NON-NLS-1$
+ break;
+ case IWorkbenchPartConstants.PROP_CONTENT_DESCRIPTION:
+ eventDescription = "content_description"; //$NON-NLS-1$
+ break;
+ default:
+ eventDescription = "unknown event id = " + changeId; //$NON-NLS-1$
+ }
+
+ System.out.println(PARTREFERENCE_PROPERTY_EVENTS + " " //$NON-NLS-1$
+ + getPartId(ref) + ", property " + eventDescription); //$NON-NLS-1$
+ }
+ }
+
+ private static boolean isEnabled(String eventName) {
+ return enabled && internal_isEnabled(eventName);
+ }
+
+ private static boolean internal_isEnabled(String eventName) {
+ String option = Platform.getDebugOption(eventName);
+ return option != null && !option.equalsIgnoreCase("false") && !option.equalsIgnoreCase("-1"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/UIStats.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/UIStats.java
index 05a2ba16763..a9f197edabc 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/UIStats.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/UIStats.java
@@ -19,43 +19,43 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.ui.PlatformUI;
/**
- * This class is used for monitoring performance events. Each performance
- * event has an associated option in the org.eclipse.ui plugin's .options file
- * that specifies an maximum acceptable duration for that event.
+ * This class is used for monitoring performance events. Each performance event
+ * has an associated option in the org.eclipse.ui plugin's .options file that
+ * specifies an maximum acceptable duration for that event.
*
* @see org.eclipse.core.runtime.PerformanceStats
*/
public class UIStats {
- private static HashMap operations = new HashMap();
+ private static HashMap operations = new HashMap();
- public static final int CREATE_PART = 0;
+ public static final int CREATE_PART = 0;
- public static final int CREATE_PART_CONTROL = 1;
+ public static final int CREATE_PART_CONTROL = 1;
- public static final int INIT_PART = 2;
+ public static final int INIT_PART = 2;
- public static final int CREATE_PERSPECTIVE = 3;
+ public static final int CREATE_PERSPECTIVE = 3;
- public static final int RESTORE_WORKBENCH = 4;
+ public static final int RESTORE_WORKBENCH = 4;
- public static final int START_WORKBENCH = 5;
+ public static final int START_WORKBENCH = 5;
- public static final int CREATE_PART_INPUT = 6;
+ public static final int CREATE_PART_INPUT = 6;
- public static final int ACTIVATE_PART = 7;
+ public static final int ACTIVATE_PART = 7;
- public static final int BRING_PART_TO_TOP = 8;
+ public static final int BRING_PART_TO_TOP = 8;
- public static final int NOTIFY_PART_LISTENERS = 9;
+ public static final int NOTIFY_PART_LISTENERS = 9;
- public static final int SWITCH_PERSPECTIVE = 10;
+ public static final int SWITCH_PERSPECTIVE = 10;
- public static final int NOTIFY_PAGE_LISTENERS = 11;
+ public static final int NOTIFY_PAGE_LISTENERS = 11;
- public static final int NOTIFY_PERSPECTIVE_LISTENERS = 12;
+ public static final int NOTIFY_PERSPECTIVE_LISTENERS = 12;
- public static final int UI_JOB = 13;
+ public static final int UI_JOB = 13;
public static final int CONTENT_TYPE_LOOKUP = 14;
@@ -66,88 +66,88 @@ public class UIStats {
*/
public static final int LAST_VALUE = EARLY_STARTUP;
- private static boolean debug[] = new boolean[LAST_VALUE+1];
-
- private static String[] events = new String[LAST_VALUE+1];
-
- static {
- events[CREATE_PART] = PlatformUI.PLUGIN_ID + "/perf/part.create"; //$NON-NLS-1$
- events[CREATE_PART_INPUT] = PlatformUI.PLUGIN_ID + "/perf/part.input"; //$NON-NLS-1$
- events[CREATE_PART_CONTROL] = PlatformUI.PLUGIN_ID + "/perf/part.control"; //$NON-NLS-1$
- events[INIT_PART] = PlatformUI.PLUGIN_ID + "/perf/part.init"; //$NON-NLS-1$
- events[CREATE_PERSPECTIVE] = PlatformUI.PLUGIN_ID + "/perf/perspective.create"; //$NON-NLS-1$
- events[SWITCH_PERSPECTIVE] = PlatformUI.PLUGIN_ID + "/perf/perspective.switch"; //$NON-NLS-1$
- events[RESTORE_WORKBENCH] = PlatformUI.PLUGIN_ID + "/perf/workbench.restore"; //$NON-NLS-1$
- events[START_WORKBENCH] = PlatformUI.PLUGIN_ID + "/perf/workbench.start"; //$NON-NLS-1$
- events[ACTIVATE_PART] = PlatformUI.PLUGIN_ID + "/perf/part.activate"; //$NON-NLS-1$
- events[BRING_PART_TO_TOP] = PlatformUI.PLUGIN_ID + "/perf/part.activate"; //$NON-NLS-1$
- events[NOTIFY_PART_LISTENERS] = PlatformUI.PLUGIN_ID + "/perf/part.listeners"; //$NON-NLS-1$
- events[NOTIFY_PAGE_LISTENERS] = PlatformUI.PLUGIN_ID + "/perf/page.listeners"; //$NON-NLS-1$
- events[NOTIFY_PERSPECTIVE_LISTENERS] = PlatformUI.PLUGIN_ID + "/perf/perspective.listeners"; //$NON-NLS-1$
- events[UI_JOB] = PlatformUI.PLUGIN_ID + "/perf/uijob"; //$NON-NLS-1$
+ private static boolean debug[] = new boolean[LAST_VALUE + 1];
+
+ private static String[] events = new String[LAST_VALUE + 1];
+
+ static {
+ events[CREATE_PART] = PlatformUI.PLUGIN_ID + "/perf/part.create"; //$NON-NLS-1$
+ events[CREATE_PART_INPUT] = PlatformUI.PLUGIN_ID + "/perf/part.input"; //$NON-NLS-1$
+ events[CREATE_PART_CONTROL] = PlatformUI.PLUGIN_ID + "/perf/part.control"; //$NON-NLS-1$
+ events[INIT_PART] = PlatformUI.PLUGIN_ID + "/perf/part.init"; //$NON-NLS-1$
+ events[CREATE_PERSPECTIVE] = PlatformUI.PLUGIN_ID + "/perf/perspective.create"; //$NON-NLS-1$
+ events[SWITCH_PERSPECTIVE] = PlatformUI.PLUGIN_ID + "/perf/perspective.switch"; //$NON-NLS-1$
+ events[RESTORE_WORKBENCH] = PlatformUI.PLUGIN_ID + "/perf/workbench.restore"; //$NON-NLS-1$
+ events[START_WORKBENCH] = PlatformUI.PLUGIN_ID + "/perf/workbench.start"; //$NON-NLS-1$
+ events[ACTIVATE_PART] = PlatformUI.PLUGIN_ID + "/perf/part.activate"; //$NON-NLS-1$
+ events[BRING_PART_TO_TOP] = PlatformUI.PLUGIN_ID + "/perf/part.activate"; //$NON-NLS-1$
+ events[NOTIFY_PART_LISTENERS] = PlatformUI.PLUGIN_ID + "/perf/part.listeners"; //$NON-NLS-1$
+ events[NOTIFY_PAGE_LISTENERS] = PlatformUI.PLUGIN_ID + "/perf/page.listeners"; //$NON-NLS-1$
+ events[NOTIFY_PERSPECTIVE_LISTENERS] = PlatformUI.PLUGIN_ID + "/perf/perspective.listeners"; //$NON-NLS-1$
+ events[UI_JOB] = PlatformUI.PLUGIN_ID + "/perf/uijob"; //$NON-NLS-1$
events[CONTENT_TYPE_LOOKUP] = PlatformUI.PLUGIN_ID + "/perf/contentTypes"; //$NON-NLS-1$
events[EARLY_STARTUP] = PlatformUI.PLUGIN_ID + "/perf/earlyStartup"; //$NON-NLS-1$
- for (int i = 0; i <= LAST_VALUE; i++) {
- //don't log any performance events if the general performance stats is disabled
- if (events[i] != null && PerformanceStats.ENABLED) {
+ for (int i = 0; i <= LAST_VALUE; i++) {
+ // don't log any performance events if the general performance stats is disabled
+ if (events[i] != null && PerformanceStats.ENABLED) {
debug[i] = PerformanceStats.isEnabled(events[i]);
}
- }
- }
-
- /**
- * Returns whether tracing of the given debug event is turned on.
- *
- * @param event The event id
- * @return <code>true</code> if tracing of this event is turned on,
- * and <code>false</code> otherwise.
- */
- public static boolean isDebugging(int event) {
- return debug[event];
- }
-
- /**
- * Indicates the start of a performance event
- *
- * @param event The event id
- * @param label The event label
- */
- public static void start(int event, String label) {
- if (debug[event]) {
+ }
+ }
+
+ /**
+ * Returns whether tracing of the given debug event is turned on.
+ *
+ * @param event The event id
+ * @return <code>true</code> if tracing of this event is turned on, and
+ * <code>false</code> otherwise.
+ */
+ public static boolean isDebugging(int event) {
+ return debug[event];
+ }
+
+ /**
+ * Indicates the start of a performance event
+ *
+ * @param event The event id
+ * @param label The event label
+ */
+ public static void start(int event, String label) {
+ if (debug[event]) {
operations.put(event + label, Long.valueOf(System.currentTimeMillis()));
}
- }
-
- /**
- * Indicates the end of a performance operation
- *
- * @param event The event id
- * @param blame An object that is responsible for the event that occurred,
- * or that uniquely describes the event that occurred
- * @param label The event label
- */
- public static void end(int event, Object blame, String label) {
- if (debug[event]) {
- Long startTime = (Long) operations.remove(event + label);
- if (startTime == null) {
+ }
+
+ /**
+ * Indicates the end of a performance operation
+ *
+ * @param event The event id
+ * @param blame An object that is responsible for the event that occurred, or
+ * that uniquely describes the event that occurred
+ * @param label The event label
+ */
+ public static void end(int event, Object blame, String label) {
+ if (debug[event]) {
+ Long startTime = (Long) operations.remove(event + label);
+ if (startTime == null) {
return;
}
- final long elapsed = System.currentTimeMillis() - startTime.longValue();
+ final long elapsed = System.currentTimeMillis() - startTime.longValue();
// System.out.println("Time - " + //$NON-NLS-1$
// elapsed + events[event] + label);
- PerformanceStats.getStats(events[event], blame).addRun(elapsed, label);
- }
- }
-
- /**
- * Special hook to signal that application startup is complete and the event
- * loop has started running.
- */
- public static void startupComplete() {
- // We use a runtime debug option here for backwards compatibility (bug 96672)
+ PerformanceStats.getStats(events[event], blame).addRun(elapsed, label);
+ }
+ }
+
+ /**
+ * Special hook to signal that application startup is complete and the event
+ * loop has started running.
+ */
+ public static void startupComplete() {
+ // We use a runtime debug option here for backwards compatibility (bug 96672)
// Note that this value is only relevant if the workspace chooser is not used.
- String option = Platform.getDebugOption(Platform.PI_RUNTIME + "/debug"); //$NON-NLS-1$
+ String option = Platform.getDebugOption(Platform.PI_RUNTIME + "/debug"); //$NON-NLS-1$
if (option == null || !"true".equalsIgnoreCase(option)) { //$NON-NLS-1$
return;
}
@@ -160,7 +160,7 @@ public class UIStats {
long end = System.currentTimeMillis();
System.out.println("Startup complete: " + (end - start) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
} catch (NumberFormatException e) {
- //this is just debugging code -- ok to swallow exception
+ // this is just debugging code -- ok to swallow exception
}
- }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/operations/AdvancedValidationUserApprover.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/operations/AdvancedValidationUserApprover.java
index 00bf3ede807..d2c37eb107f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/operations/AdvancedValidationUserApprover.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/operations/AdvancedValidationUserApprover.java
@@ -58,15 +58,14 @@ import org.eclipse.ui.internal.misc.StatusUtil;
*
* @since 3.1
*/
-public class AdvancedValidationUserApprover implements IOperationApprover,
- IOperationApprover2 {
+public class AdvancedValidationUserApprover implements IOperationApprover, IOperationApprover2 {
- /**
- * Static to prevent opening of error dialogs for automated testing.
- *
- * @since 3.3
- */
- public static boolean AUTOMATED_MODE = false;
+ /**
+ * Static to prevent opening of error dialogs for automated testing.
+ *
+ * @since 3.3
+ */
+ public static boolean AUTOMATED_MODE = false;
private IUndoContext context;
@@ -85,8 +84,7 @@ public class AdvancedValidationUserApprover implements IOperationApprover,
IAdaptable uiInfo;
- StatusReportingRunnable(IUndoableOperation operation,
- IOperationHistory history, IAdaptable uiInfo, int doing) {
+ StatusReportingRunnable(IUndoableOperation operation, IOperationHistory history, IAdaptable uiInfo, int doing) {
super();
this.operation = operation;
this.doing = doing;
@@ -101,16 +99,13 @@ public class AdvancedValidationUserApprover implements IOperationApprover,
try {
switch (doing) {
case UNDOING:
- status = ((IAdvancedUndoableOperation) operation)
- .computeUndoableStatus(pm);
+ status = ((IAdvancedUndoableOperation) operation).computeUndoableStatus(pm);
break;
case REDOING:
- status = ((IAdvancedUndoableOperation) operation)
- .computeRedoableStatus(pm);
+ status = ((IAdvancedUndoableOperation) operation).computeRedoableStatus(pm);
break;
case EXECUTING:
- status = ((IAdvancedUndoableOperation2) operation)
- .computeExecutionStatus(pm);
+ status = ((IAdvancedUndoableOperation2) operation).computeExecutionStatus(pm);
break;
}
@@ -126,12 +121,10 @@ public class AdvancedValidationUserApprover implements IOperationApprover,
}
/**
- * Create an AdvancedValidationUserApprover that performs advanced
- * validations on proposed undo and redo operations for a given undo
- * context.
+ * Create an AdvancedValidationUserApprover that performs advanced validations
+ * on proposed undo and redo operations for a given undo context.
*
- * @param context -
- * the undo context of operations in question.
+ * @param context - the undo context of operations in question.
*/
public AdvancedValidationUserApprover(IUndoContext context) {
super();
@@ -139,30 +132,26 @@ public class AdvancedValidationUserApprover implements IOperationApprover,
}
@Override
- public IStatus proceedRedoing(IUndoableOperation operation,
- IOperationHistory history, IAdaptable uiInfo) {
+ public IStatus proceedRedoing(IUndoableOperation operation, IOperationHistory history, IAdaptable uiInfo) {
return proceedWithOperation(operation, history, uiInfo, REDOING);
}
@Override
- public IStatus proceedUndoing(IUndoableOperation operation,
- IOperationHistory history, IAdaptable uiInfo) {
+ public IStatus proceedUndoing(IUndoableOperation operation, IOperationHistory history, IAdaptable uiInfo) {
return proceedWithOperation(operation, history, uiInfo, UNDOING);
}
@Override
- public IStatus proceedExecuting(IUndoableOperation operation,
- IOperationHistory history, IAdaptable uiInfo) {
+ public IStatus proceedExecuting(IUndoableOperation operation, IOperationHistory history, IAdaptable uiInfo) {
return proceedWithOperation(operation, history, uiInfo, EXECUTING);
}
/*
* Determine whether the operation in question is still valid.
*/
- private IStatus proceedWithOperation(final IUndoableOperation operation,
- final IOperationHistory history, final IAdaptable uiInfo,
- final int doing) {
+ private IStatus proceedWithOperation(final IUndoableOperation operation, final IOperationHistory history,
+ final IAdaptable uiInfo, final int doing) {
// return immediately if the operation is not relevant
if (!operation.hasContext(context)) {
@@ -186,15 +175,13 @@ public class AdvancedValidationUserApprover implements IOperationApprover,
final IStatus[] status = new IStatus[1];
PlatformUI.getWorkbench().getDisplay().syncExec(() -> {
// Compute the undoable or redoable status
- status[0] = computeOperationStatus(operation, history, uiInfo,
- doing);
+ status[0] = computeOperationStatus(operation, history, uiInfo, doing);
// Report non-OK statuses to the user. In some cases, the user
// may choose to proceed, and the returned status will be
// different than what is reported.
if (!status[0].isOK()) {
- status[0] = reportAndInterpretStatus(status[0], uiInfo,
- operation, doing);
+ status[0] = reportAndInterpretStatus(status[0], uiInfo, operation, doing);
}
});
@@ -210,14 +197,12 @@ public class AdvancedValidationUserApprover implements IOperationApprover,
return status[0];
}
- private IStatus computeOperationStatus(IUndoableOperation operation,
- IOperationHistory history, IAdaptable uiInfo, int doing) {
+ private IStatus computeOperationStatus(IUndoableOperation operation, IOperationHistory history, IAdaptable uiInfo,
+ int doing) {
try {
- StatusReportingRunnable runnable = new StatusReportingRunnable(
- operation, history, uiInfo, doing);
- TimeTriggeredProgressMonitorDialog progressDialog = new TimeTriggeredProgressMonitorDialog(
- getShell(uiInfo), PlatformUI.getWorkbench()
- .getProgressService().getLongOperationTime());
+ StatusReportingRunnable runnable = new StatusReportingRunnable(operation, history, uiInfo, doing);
+ TimeTriggeredProgressMonitorDialog progressDialog = new TimeTriggeredProgressMonitorDialog(getShell(uiInfo),
+ PlatformUI.getWorkbench().getProgressService().getLongOperationTime());
progressDialog.run(false, true, runnable);
return runnable.getStatus();
@@ -245,8 +230,7 @@ public class AdvancedValidationUserApprover implements IOperationApprover,
if (exceptionMessage == null) {
exceptionMessage = message;
}
- IStatus status = new Status(IStatus.ERROR,
- WorkbenchPlugin.PI_WORKBENCH, 0, exceptionMessage, exception);
+ IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 0, exceptionMessage, exception);
WorkbenchPlugin.log(message, status);
boolean createdShell = false;
@@ -264,9 +248,9 @@ public class AdvancedValidationUserApprover implements IOperationApprover,
/*
* Report a non-OK status to the user
*/
- private IStatus reportAndInterpretStatus(IStatus status, IAdaptable uiInfo,
- IUndoableOperation operation, int doing) {
- // Nothing to report if we are running automated tests. We will treat
+ private IStatus reportAndInterpretStatus(IStatus status, IAdaptable uiInfo, IUndoableOperation operation,
+ int doing) {
+ // Nothing to report if we are running automated tests. We will treat
// warnings as if they were authorized by the user.
if (AUTOMATED_MODE) {
if (status.getSeverity() == IStatus.WARNING) {
@@ -325,10 +309,8 @@ public class AdvancedValidationUserApprover implements IOperationApprover,
}
String message = NLS.bind(warning, new Object[] { status.getMessage(), operation.getLabel() });
- String[] buttons = new String[] { IDialogConstants.YES_LABEL,
- IDialogConstants.NO_LABEL };
- MessageDialog dialog = new MessageDialog(shell, title, null,
- message, MessageDialog.WARNING, 0, buttons);
+ String[] buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL };
+ MessageDialog dialog = new MessageDialog(shell, title, null, message, MessageDialog.WARNING, 0, buttons);
int dialogAnswer = dialog.open();
// The user has been given the specific status and has chosen
// to proceed or to cancel. The user choice determines what
@@ -360,11 +342,9 @@ public class AdvancedValidationUserApprover implements IOperationApprover,
// we only report what has gone on. We use a warning icon instead of
// an error icon since there has not yet been a failure.
- String message = NLS.bind(stopped, status.getMessage(), operation
- .getLabel());
+ String message = NLS.bind(stopped, status.getMessage(), operation.getLabel());
- MessageDialog dialog = new MessageDialog(shell, title, null,
- message, MessageDialog.WARNING,
+ MessageDialog dialog = new MessageDialog(shell, title, null, message, MessageDialog.WARNING,
new String[] { IDialogConstants.OK_LABEL }, 0); // ok
dialog.open();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/operations/TimeTriggeredProgressMonitorDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/operations/TimeTriggeredProgressMonitorDialog.java
index edb3353aafd..42c4a0ac33a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/operations/TimeTriggeredProgressMonitorDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/operations/TimeTriggeredProgressMonitorDialog.java
@@ -13,7 +13,6 @@
*******************************************************************************/
package org.eclipse.ui.internal.operations;
-
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -48,137 +47,129 @@ public class TimeTriggeredProgressMonitorDialog extends ProgressMonitorDialog {
private boolean dialogOpened = false;
/**
- * Wrappered monitor so we can check ticks and open the dialog when
- * appropriate
+ * Wrappered monitor so we can check ticks and open the dialog when appropriate
*/
private IProgressMonitor wrapperedMonitor;
/**
* Create a new instance of the receiver.
*
- * @param parent
- * the parent of the dialog
- * @param longOperationTime
- * the time (in milliseconds) considered to be a long enough
- * execution time to warrant opening a dialog.
+ * @param parent the parent of the dialog
+ * @param longOperationTime the time (in milliseconds) considered to be a long
+ * enough execution time to warrant opening a dialog.
*/
- public TimeTriggeredProgressMonitorDialog(Shell parent,
- int longOperationTime) {
+ public TimeTriggeredProgressMonitorDialog(Shell parent, int longOperationTime) {
super(parent);
setOpenOnRun(false);
this.longOperationTime = longOperationTime;
}
- /**
+ /**
* Create a monitor for the receiver that wrappers the superclasses monitor.
*
*/
- public void createWrapperedMonitor() {
- wrapperedMonitor = new IProgressMonitor() {
+ public void createWrapperedMonitor() {
+ wrapperedMonitor = new IProgressMonitor() {
- IProgressMonitor superMonitor = TimeTriggeredProgressMonitorDialog.super
- .getProgressMonitor();
+ IProgressMonitor superMonitor = TimeTriggeredProgressMonitorDialog.super.getProgressMonitor();
- @Override
+ @Override
public void beginTask(String name, int totalWork) {
- superMonitor.beginTask(name, totalWork);
- checkTicking();
- }
+ superMonitor.beginTask(name, totalWork);
+ checkTicking();
+ }
- /**
+ /**
* Check if we have ticked in the last 800ms.
*/
- private void checkTicking() {
- if (triggerTime < 0) {
+ private void checkTicking() {
+ if (triggerTime < 0) {
triggerTime = System.currentTimeMillis() + longOperationTime;
}
- if (!dialogOpened && System.currentTimeMillis() > triggerTime) {
- open();
- dialogOpened = true;
- }
- }
-
-
+ if (!dialogOpened && System.currentTimeMillis() > triggerTime) {
+ open();
+ dialogOpened = true;
+ }
+ }
- @Override
+ @Override
public void done() {
- superMonitor.done();
- checkTicking();
- }
+ superMonitor.done();
+ checkTicking();
+ }
- @Override
+ @Override
public void internalWorked(double work) {
- superMonitor.internalWorked(work);
- checkTicking();
- }
+ superMonitor.internalWorked(work);
+ checkTicking();
+ }
- @Override
+ @Override
public boolean isCanceled() {
- return superMonitor.isCanceled();
- }
+ return superMonitor.isCanceled();
+ }
- @Override
+ @Override
public void setCanceled(boolean value) {
- superMonitor.setCanceled(value);
+ superMonitor.setCanceled(value);
- }
+ }
- @Override
+ @Override
public void setTaskName(String name) {
- superMonitor.setTaskName(name);
- checkTicking();
+ superMonitor.setTaskName(name);
+ checkTicking();
- }
+ }
- @Override
+ @Override
public void subTask(String name) {
- superMonitor.subTask(name);
- checkTicking();
- }
+ superMonitor.subTask(name);
+ checkTicking();
+ }
- @Override
+ @Override
public void worked(int work) {
- superMonitor.worked(work);
- checkTicking();
+ superMonitor.worked(work);
+ checkTicking();
- }
- };
- }
+ }
+ };
+ }
- @Override
+ @Override
public IProgressMonitor getProgressMonitor() {
- if (wrapperedMonitor == null) {
+ if (wrapperedMonitor == null) {
createWrapperedMonitor();
}
- return wrapperedMonitor;
- }
-
- @Override
- public void run(final boolean fork, final boolean cancelable,
- final IRunnableWithProgress runnable) throws InvocationTargetException,
- InterruptedException {
- final InvocationTargetException[] invokes = new InvocationTargetException[1];
- final InterruptedException[] interrupt = new InterruptedException[1];
- Runnable dialogWaitRunnable = () -> {
+ return wrapperedMonitor;
+ }
+
+ @Override
+ public void run(final boolean fork, final boolean cancelable, final IRunnableWithProgress runnable)
+ throws InvocationTargetException, InterruptedException {
+ final InvocationTargetException[] invokes = new InvocationTargetException[1];
+ final InterruptedException[] interrupt = new InterruptedException[1];
+ Runnable dialogWaitRunnable = () -> {
try {
TimeTriggeredProgressMonitorDialog.super.run(fork, cancelable, runnable);
} catch (InvocationTargetException e1) {
invokes[0] = e1;
} catch (InterruptedException e2) {
- interrupt[0]= e2;
+ interrupt[0] = e2;
}
};
- final Display display = PlatformUI.getWorkbench().getDisplay();
- if (display == null) {
+ final Display display = PlatformUI.getWorkbench().getDisplay();
+ if (display == null) {
return;
}
- //show a busy cursor until the dialog opens
- BusyIndicator.showWhile(display, dialogWaitRunnable);
- if (invokes[0] != null) {
- throw invokes[0];
- }
- if (interrupt[0] != null) {
- throw interrupt[0];
- }
- }
+ // show a busy cursor until the dialog opens
+ BusyIndicator.showWhile(display, dialogWaitRunnable);
+ if (invokes[0] != null) {
+ throw invokes[0];
+ }
+ if (interrupt[0] != null) {
+ throw interrupt[0];
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/operations/WorkbenchOperationSupport.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/operations/WorkbenchOperationSupport.java
index a4330684e8b..07d0bdd4d01 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/operations/WorkbenchOperationSupport.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/operations/WorkbenchOperationSupport.java
@@ -26,9 +26,9 @@ import org.eclipse.ui.operations.IWorkbenchOperationSupport;
/**
* <p>
- * Provides undoable operation support for the workbench. This includes providing access to the default
- * operation history and installing a workbench-specific operation approver that enforces a linear
- * undo strategy.
+ * Provides undoable operation support for the workbench. This includes
+ * providing access to the default operation history and installing a
+ * workbench-specific operation approver that enforces a linear undo strategy.
* </p>
*
* @since 3.1
@@ -43,8 +43,10 @@ public class WorkbenchOperationSupport implements IWorkbenchOperationSupport {
DefaultOperationHistory.DEBUG_OPERATION_HISTORY_UNEXPECTED = Policy.DEBUG_OPERATIONS;
DefaultOperationHistory.DEBUG_OPERATION_HISTORY_OPENOPERATION = Policy.DEBUG_OPERATIONS;
DefaultOperationHistory.DEBUG_OPERATION_HISTORY_APPROVAL = Policy.DEBUG_OPERATIONS;
- DefaultOperationHistory.DEBUG_OPERATION_HISTORY_NOTIFICATION = Policy.DEBUG_OPERATIONS && Policy.DEBUG_OPERATIONS_VERBOSE;
- DefaultOperationHistory.DEBUG_OPERATION_HISTORY_DISPOSE = Policy.DEBUG_OPERATIONS && Policy.DEBUG_OPERATIONS_VERBOSE;
+ DefaultOperationHistory.DEBUG_OPERATION_HISTORY_NOTIFICATION = Policy.DEBUG_OPERATIONS
+ && Policy.DEBUG_OPERATIONS_VERBOSE;
+ DefaultOperationHistory.DEBUG_OPERATION_HISTORY_DISPOSE = Policy.DEBUG_OPERATIONS
+ && Policy.DEBUG_OPERATIONS_VERBOSE;
}
/**
@@ -62,9 +64,8 @@ public class WorkbenchOperationSupport implements IWorkbenchOperationSupport {
}
/**
- * Returns the undo context for workbench operations.
- * The workbench configures an undo context with the appropriate policies
- * for the workbench undo model.
+ * Returns the undo context for workbench operations. The workbench configures
+ * an undo context with the appropriate policies for the workbench undo model.
*
* @return the workbench operation context.
* @since 3.1
@@ -72,8 +73,7 @@ public class WorkbenchOperationSupport implements IWorkbenchOperationSupport {
@Override
public IUndoContext getUndoContext() {
if (undoContext == null) {
- undoContext = new ObjectUndoContext(PlatformUI.getWorkbench(),
- "Workbench Context"); //$NON-NLS-1$
+ undoContext = new ObjectUndoContext(PlatformUI.getWorkbench(), "Workbench Context"); //$NON-NLS-1$
}
return undoContext;
}
@@ -92,8 +92,8 @@ public class WorkbenchOperationSupport implements IWorkbenchOperationSupport {
*/
if (approver == null) {
/*
- * install an operation approver that prevents linear undo violations
- * in any context
+ * install an operation approver that prevents linear undo violations in any
+ * context
*/
approver = new AdvancedValidationUserApprover(getUndoContext());
history.addOperationApprover(approver);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/part/NullEditorInput.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/part/NullEditorInput.java
index 706f03e9556..348a6ddf4cc 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/part/NullEditorInput.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/part/NullEditorInput.java
@@ -33,29 +33,28 @@ public class NullEditorInput implements IEditorInput {
}
/**
- * Creates a <code>NullEditorInput</code> for the
- * given editor reference.
+ * Creates a <code>NullEditorInput</code> for the given editor reference.
*
* @param editorReference the editor reference
* @since 3.4
*/
public NullEditorInput(EditorReference editorReference) {
Assert.isLegal(editorReference != null);
- this.editorReference= editorReference;
+ this.editorReference = editorReference;
}
- @Override
+ @Override
public boolean exists() {
- return false;
- }
+ return false;
+ }
- @Override
+ @Override
public ImageDescriptor getImageDescriptor() {
- return ImageDescriptor.getMissingImageDescriptor();
- }
+ return ImageDescriptor.getMissingImageDescriptor();
+ }
- @Override
+ @Override
public String getName() {
String result = null;
if (editorReference != null) {
@@ -64,24 +63,24 @@ public class NullEditorInput implements IEditorInput {
if (result != null) {
return result;
}
- return ""; //$NON-NLS-1$
- }
+ return ""; //$NON-NLS-1$
+ }
- @Override
+ @Override
public IPersistableElement getPersistable() {
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public String getToolTipText() {
if (editorReference != null)
return editorReference.getTitleToolTip();
- return ""; //$NON-NLS-1$
- }
+ return ""; //$NON-NLS-1$
+ }
- @Override
+ @Override
public <T> T getAdapter(Class<T> adapter) {
- return null;
- }
+ return null;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/part/StatusPart.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/part/StatusPart.java
index 4766e076ef4..cbc41964068 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/part/StatusPart.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/part/StatusPart.java
@@ -44,146 +44,144 @@ import org.eclipse.ui.views.IViewDescriptor;
public class StatusPart {
private static final String LOG_VIEW_ID = "org.eclipse.pde.runtime.LogView"; //$NON-NLS-1$
- boolean showingDetails = false;
- private Button detailsButton;
- private Composite detailsArea;
- private Control details = null;
+ boolean showingDetails = false;
+ private Button detailsButton;
+ private Composite detailsArea;
+ private Control details = null;
private IStatus reason;
- public StatusPart(final Composite parent, IStatus reason_) {
- Color bgColor= parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND);
- Color fgColor= parent.getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND);
+ public StatusPart(final Composite parent, IStatus reason_) {
+ Color bgColor = parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND);
+ Color fgColor = parent.getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND);
parent.setBackground(bgColor);
parent.setForeground(fgColor);
- this.reason = reason_;
- GridLayout layout = new GridLayout();
+ this.reason = reason_;
+ GridLayout layout = new GridLayout();
layout.numColumns = 3;
- int spacing = 8;
- int margins = 8;
- layout.marginBottom = margins;
- layout.marginTop = margins;
- layout.marginLeft = margins;
- layout.marginRight = margins;
- layout.horizontalSpacing = spacing;
- layout.verticalSpacing = spacing;
- parent.setLayout(layout);
-
- Label imageLabel = new Label(parent, SWT.NONE);
- imageLabel.setBackground(bgColor);
- Image image = getImage();
- if (image != null) {
- image.setBackground(bgColor);
- imageLabel.setImage(image);
+ int spacing = 8;
+ int margins = 8;
+ layout.marginBottom = margins;
+ layout.marginTop = margins;
+ layout.marginLeft = margins;
+ layout.marginRight = margins;
+ layout.horizontalSpacing = spacing;
+ layout.verticalSpacing = spacing;
+ parent.setLayout(layout);
+
+ Label imageLabel = new Label(parent, SWT.NONE);
+ imageLabel.setBackground(bgColor);
+ Image image = getImage();
+ if (image != null) {
+ image.setBackground(bgColor);
+ imageLabel.setImage(image);
GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_BEGINNING);
imageLabel.setLayoutData(gridData);
- }
+ }
- Text text = new Text(parent, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP);
- text.setBackground(bgColor);
- text.setForeground(fgColor);
+ Text text = new Text(parent, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP);
+ text.setBackground(bgColor);
+ text.setForeground(fgColor);
text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- text.setText(reason.getMessage());
-
- Composite buttonParent = new Composite(parent, SWT.NONE);
- buttonParent.setBackground(parent.getBackground());
- GridLayout buttonsLayout = new GridLayout();
- buttonsLayout.numColumns = 2;
- buttonsLayout.marginHeight = 0;
- buttonsLayout.marginWidth = 0;
- buttonsLayout.horizontalSpacing = 0;
+ text.setText(reason.getMessage());
+
+ Composite buttonParent = new Composite(parent, SWT.NONE);
+ buttonParent.setBackground(parent.getBackground());
+ GridLayout buttonsLayout = new GridLayout();
+ buttonsLayout.numColumns = 2;
+ buttonsLayout.marginHeight = 0;
+ buttonsLayout.marginWidth = 0;
+ buttonsLayout.horizontalSpacing = 0;
buttonParent.setLayout(buttonsLayout);
+ detailsButton = new Button(buttonParent, SWT.PUSH);
+ detailsButton.addSelectionListener(widgetSelectedAdapter(e -> showDetails(!showingDetails)));
+
+ detailsButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.FILL, false, false));
+ detailsButton.setVisible(reason.getException() != null);
+
+ createShowLogButton(buttonParent);
+
+ updateDetailsText();
+
+ detailsArea = new Composite(parent, SWT.NONE);
+ detailsArea.setBackground(bgColor);
+ detailsArea.setForeground(fgColor);
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.horizontalSpan = 3;
+ data.verticalSpan = 1;
+ detailsArea.setLayoutData(data);
+ detailsArea.setLayout(new FillLayout());
+ parent.layout(true);
+ }
+
+ /**
+ * Return the image for the upper-left corner of this part
+ *
+ * @return the image
+ */
+ private Image getImage() {
+ Display d = Display.getCurrent();
+
+ switch (reason.getSeverity()) {
+ case IStatus.ERROR:
+ return d.getSystemImage(SWT.ICON_ERROR);
+ case IStatus.WARNING:
+ return d.getSystemImage(SWT.ICON_WARNING);
+ default:
+ return d.getSystemImage(SWT.ICON_INFORMATION);
+ }
+ }
+
+ private void showDetails(boolean shouldShow) {
+ if (shouldShow == showingDetails) {
+ return;
+ }
+ this.showingDetails = shouldShow;
+ updateDetailsText();
+ }
+
+ private void updateDetailsText() {
+ if (details != null) {
+ details.dispose();
+ details = null;
+ }
- detailsButton = new Button(buttonParent, SWT.PUSH);
- detailsButton.addSelectionListener(widgetSelectedAdapter(e -> showDetails(!showingDetails)));
-
- detailsButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.FILL, false, false));
- detailsButton.setVisible(reason.getException() != null);
-
- createShowLogButton(buttonParent);
-
- updateDetailsText();
-
- detailsArea = new Composite(parent, SWT.NONE);
- detailsArea.setBackground(bgColor);
- detailsArea.setForeground(fgColor);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.horizontalSpan = 3;
- data.verticalSpan = 1;
- detailsArea.setLayoutData(data);
- detailsArea.setLayout(new FillLayout());
- parent.layout(true);
- }
-
- /**
- * Return the image for the upper-left corner of this part
- *
- * @return the image
- */
- private Image getImage() {
- Display d = Display.getCurrent();
-
- switch(reason.getSeverity()) {
- case IStatus.ERROR:
- return d.getSystemImage(SWT.ICON_ERROR);
- case IStatus.WARNING:
- return d.getSystemImage(SWT.ICON_WARNING);
- default:
- return d.getSystemImage(SWT.ICON_INFORMATION);
- }
- }
-
- private void showDetails(boolean shouldShow) {
- if (shouldShow == showingDetails) {
- return;
- }
- this.showingDetails = shouldShow;
- updateDetailsText();
- }
-
- private void updateDetailsText() {
- if (details != null) {
- details.dispose();
- details = null;
- }
-
- if (showingDetails) {
- detailsButton.setText(IDialogConstants.HIDE_DETAILS_LABEL);
- Text detailsText = new Text(detailsArea, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL
- | SWT.MULTI | SWT.READ_ONLY | SWT.LEFT_TO_RIGHT);
- detailsText.setText(getDetails(reason));
+ if (showingDetails) {
+ detailsButton.setText(IDialogConstants.HIDE_DETAILS_LABEL);
+ Text detailsText = new Text(detailsArea,
+ SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.READ_ONLY | SWT.LEFT_TO_RIGHT);
+ detailsText.setText(getDetails(reason));
detailsText.setBackground(detailsText.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
- details = detailsText;
- detailsArea.layout(true);
- } else {
- detailsButton.setText(IDialogConstants.SHOW_DETAILS_LABEL);
- }
- }
-
-
- private String getDetails(IStatus status) {
- if (status.getException() != null) {
- return getStackTrace(status.getException());
- }
-
- return ""; //$NON-NLS-1$
- }
-
- private String getStackTrace(Throwable throwable) {
- StringWriter swriter = new StringWriter();
- PrintWriter pwriter = new PrintWriter(swriter);
- throwable.printStackTrace(pwriter);
- pwriter.flush();
- pwriter.close();
- return swriter.toString();
- }
-
- private void createShowLogButton(Composite parent){
+ details = detailsText;
+ detailsArea.layout(true);
+ } else {
+ detailsButton.setText(IDialogConstants.SHOW_DETAILS_LABEL);
+ }
+ }
+
+ private String getDetails(IStatus status) {
+ if (status.getException() != null) {
+ return getStackTrace(status.getException());
+ }
+
+ return ""; //$NON-NLS-1$
+ }
+
+ private String getStackTrace(Throwable throwable) {
+ StringWriter swriter = new StringWriter();
+ PrintWriter pwriter = new PrintWriter(swriter);
+ throwable.printStackTrace(pwriter);
+ pwriter.flush();
+ pwriter.close();
+ return swriter.toString();
+ }
+
+ private void createShowLogButton(Composite parent) {
IViewDescriptor descriptor = PlatformUI.getWorkbench().getViewRegistry().find(LOG_VIEW_ID);
if (descriptor == null) {
return;
@@ -200,5 +198,5 @@ public class StatusPart {
button.setImage(image);
button.setToolTipText(WorkbenchMessages.ErrorLogUtil_ShowErrorLogTooltip);
button.addDisposeListener(e -> image.dispose());
- }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/AbstractIntegerListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/AbstractIntegerListener.java
index 055319cdf65..e8c91a06908 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/AbstractIntegerListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/AbstractIntegerListener.java
@@ -18,37 +18,36 @@ package org.eclipse.ui.internal.preferences;
*/
public abstract class AbstractIntegerListener extends AbstractPropertyListener {
- private IDynamicPropertyMap map;
- private int defaultValue;
- private String propertyId;
+ private IDynamicPropertyMap map;
+ private int defaultValue;
+ private String propertyId;
- public AbstractIntegerListener() {
- }
+ public AbstractIntegerListener() {
+ }
- public void attach(IDynamicPropertyMap map, String propertyId, int defaultValue) {
- this.defaultValue = defaultValue;
- this.propertyId = propertyId;
- if (this.map != null) {
- this.map.removeListener(this);
- }
+ public void attach(IDynamicPropertyMap map, String propertyId, int defaultValue) {
+ this.defaultValue = defaultValue;
+ this.propertyId = propertyId;
+ if (this.map != null) {
+ this.map.removeListener(this);
+ }
- this.map = map;
+ this.map = map;
- if (this.map != null) {
- this.map.addListener(new String[]{propertyId}, this);
- }
- }
+ if (this.map != null) {
+ this.map.addListener(new String[] { propertyId }, this);
+ }
+ }
- @Override
+ @Override
protected void update() {
- handleValue(PropertyUtil.get(map, propertyId, defaultValue));
- }
-
- /**
- * @param b
- * @since 3.1
- */
- protected abstract void handleValue(int b);
-
+ handleValue(PropertyUtil.get(map, propertyId, defaultValue));
+ }
+
+ /**
+ * @param b
+ * @since 3.1
+ */
+ protected abstract void handleValue(int b);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/AbstractPropertyListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/AbstractPropertyListener.java
index e4e00733c4c..ee78989ac25 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/AbstractPropertyListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/AbstractPropertyListener.java
@@ -18,15 +18,15 @@ package org.eclipse.ui.internal.preferences;
*/
public abstract class AbstractPropertyListener implements IPropertyMapListener {
- @Override
+ @Override
public void propertyChanged(String[] propertyIds) {
- update();
- }
+ update();
+ }
- @Override
+ @Override
public void listenerAttached() {
- update();
- }
+ update();
+ }
- protected abstract void update();
+ protected abstract void update();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/Base64.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/Base64.java
index 7b1eb4fcc57..713870f2cad 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/Base64.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/Base64.java
@@ -14,23 +14,23 @@
package org.eclipse.ui.internal.preferences;
/**
- * Base64 is a helper class for converting byte arrays to and
- * from base 64 encoded Strings.
+ * Base64 is a helper class for converting byte arrays to and from base 64
+ * encoded Strings.
*
*/
class Base64 {
private static final byte equalSign = (byte) '=';
- static char digits[] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', //
+ static char digits[] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', //
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', //
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', //
- 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'};
+ 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' };
/**
- * This method decodes the byte array in base 64 encoding into a char array
- * Base 64 encoding has to be according to the specification given by the
- * RFC 1521 (5.2).
+ * This method decodes the byte array in base 64 encoding into a char array Base
+ * 64 encoding has to be according to the specification given by the RFC 1521
+ * (5.2).
*
* @param data the encoded byte array
* @return the decoded byte array
@@ -69,51 +69,51 @@ class Base64 {
// Now we do the extra bytes in case the original (non-encoded) data
// was not multiple of 3 bytes
switch (padBytes) {
- case 1 :
- // 1 pad byte means 3 (4-1) extra Base64 bytes of input, 18
- // bits, of which only 16 are meaningful
- // Or: 2 bytes of result data
- allBits = 0;
- // Loop 3 times gathering input bits
- for (int j = 0; j < 3; j++) {
- allBits = (allBits << 6) | decodeDigit(data[dataIndex++]);
- }
- // NOTE - The code below ends up being equivalent to allBits =
- // allBits>>>2
- // But we code it in a non-optimized way for clarity
- // The 4th, missing 6 bits are all 0
- allBits = allBits << 6;
- // The 3rd, missing 8 bits are all 0
- allBits = allBits >>> 8;
- // Loop 2 times generating output bits
- for (int j = resultIndex + 1; j >= resultIndex; j--) {
- result[j] = (byte) (allBits & 0xff); // Bottom 8
- // bits
- allBits = allBits >>> 8;
- }
- break;
- case 2 :
- // 2 pad bytes mean 2 (4-2) extra Base64 bytes of input, 12 bits
- // of data, of which only 8 are meaningful
- // Or: 1 byte of result data
- allBits = 0;
- // Loop 2 times gathering input bits
- for (int j = 0; j < 2; j++) {
- allBits = (allBits << 6) | decodeDigit(data[dataIndex++]);
- }
- // NOTE - The code below ends up being equivalent to allBits =
- // allBits>>>4
- // But we code it in a non-optimized way for clarity
- // The 3rd and 4th, missing 6 bits are all 0
- allBits = allBits << 6;
- allBits = allBits << 6;
- // The 3rd and 4th, missing 8 bits are all 0
- allBits = allBits >>> 8;
- allBits = allBits >>> 8;
- result[resultIndex] = (byte) (allBits & 0xff); // Bottom
- // 8
+ case 1:
+ // 1 pad byte means 3 (4-1) extra Base64 bytes of input, 18
+ // bits, of which only 16 are meaningful
+ // Or: 2 bytes of result data
+ allBits = 0;
+ // Loop 3 times gathering input bits
+ for (int j = 0; j < 3; j++) {
+ allBits = (allBits << 6) | decodeDigit(data[dataIndex++]);
+ }
+ // NOTE - The code below ends up being equivalent to allBits =
+ // allBits>>>2
+ // But we code it in a non-optimized way for clarity
+ // The 4th, missing 6 bits are all 0
+ allBits = allBits << 6;
+ // The 3rd, missing 8 bits are all 0
+ allBits = allBits >>> 8;
+ // Loop 2 times generating output bits
+ for (int j = resultIndex + 1; j >= resultIndex; j--) {
+ result[j] = (byte) (allBits & 0xff); // Bottom 8
// bits
- break;
+ allBits = allBits >>> 8;
+ }
+ break;
+ case 2:
+ // 2 pad bytes mean 2 (4-2) extra Base64 bytes of input, 12 bits
+ // of data, of which only 8 are meaningful
+ // Or: 1 byte of result data
+ allBits = 0;
+ // Loop 2 times gathering input bits
+ for (int j = 0; j < 2; j++) {
+ allBits = (allBits << 6) | decodeDigit(data[dataIndex++]);
+ }
+ // NOTE - The code below ends up being equivalent to allBits =
+ // allBits>>>4
+ // But we code it in a non-optimized way for clarity
+ // The 3rd and 4th, missing 6 bits are all 0
+ allBits = allBits << 6;
+ allBits = allBits << 6;
+ // The 3rd and 4th, missing 8 bits are all 0
+ allBits = allBits >>> 8;
+ allBits = allBits >>> 8;
+ result[resultIndex] = (byte) (allBits & 0xff); // Bottom
+ // 8
+ // bits
+ break;
}
return result;
}
@@ -136,18 +136,18 @@ class Base64 {
return charData - '0' + 52;
}
switch (charData) {
- case '+' :
- return 62;
- case '/' :
- return 63;
- default :
- throw new IllegalArgumentException("Invalid char to decode: " + data); //$NON-NLS-1$
+ case '+':
+ return 62;
+ case '/':
+ return 63;
+ default:
+ throw new IllegalArgumentException("Invalid char to decode: " + data); //$NON-NLS-1$
}
}
/**
- * This method encodes the byte array into a char array in base 64 according
- * to the specification given by the RFC 1521 (5.2).
+ * This method encodes the byte array into a char array in base 64 according to
+ * the specification given by the RFC 1521 (5.2).
*
* @param data the encoded char array
* @return the byte array that needs to be encoded
@@ -179,36 +179,36 @@ class Base64 {
// Now we do the extra bytes in case the original (non-encoded) data
// is not multiple of 4 bytes
switch (extraBytes) {
- case 1 :
- allBits = data[dataIndex++]; // actual byte
- allBits = allBits << 8; // 8 bits of zeroes
- allBits = allBits << 8; // 8 bits of zeroes
- // Loop 4 times generating output bits (4 * 6 = 24)
- for (int j = resultIndex + 3; j >= resultIndex; j--) {
- result[j] = (byte) digits[(allBits & 0x3f)]; // Bottom
- // 6
- // bits
- allBits = allBits >>> 6;
- }
- // 2 pad tags
- result[result.length - 1] = (byte) '=';
- result[result.length - 2] = (byte) '=';
- break;
- case 2 :
- allBits = data[dataIndex++]; // actual byte
- allBits = (allBits << 8) | (data[dataIndex++] & 0xff); // actual
- // byte
- allBits = allBits << 8; // 8 bits of zeroes
- // Loop 4 times generating output bits (4 * 6 = 24)
- for (int j = resultIndex + 3; j >= resultIndex; j--) {
- result[j] = (byte) digits[(allBits & 0x3f)]; // Bottom
- // 6
- // bits
- allBits = allBits >>> 6;
- }
- // 1 pad tag
- result[result.length - 1] = (byte) '=';
- break;
+ case 1:
+ allBits = data[dataIndex++]; // actual byte
+ allBits = allBits << 8; // 8 bits of zeroes
+ allBits = allBits << 8; // 8 bits of zeroes
+ // Loop 4 times generating output bits (4 * 6 = 24)
+ for (int j = resultIndex + 3; j >= resultIndex; j--) {
+ result[j] = (byte) digits[(allBits & 0x3f)]; // Bottom
+ // 6
+ // bits
+ allBits = allBits >>> 6;
+ }
+ // 2 pad tags
+ result[result.length - 1] = (byte) '=';
+ result[result.length - 2] = (byte) '=';
+ break;
+ case 2:
+ allBits = data[dataIndex++]; // actual byte
+ allBits = (allBits << 8) | (data[dataIndex++] & 0xff); // actual
+ // byte
+ allBits = allBits << 8; // 8 bits of zeroes
+ // Loop 4 times generating output bits (4 * 6 = 24)
+ for (int j = resultIndex + 3; j >= resultIndex; j--) {
+ result[j] = (byte) digits[(allBits & 0x3f)]; // Bottom
+ // 6
+ // bits
+ allBits = allBits >>> 6;
+ }
+ // 1 pad tag
+ result[result.length - 1] = (byte) '=';
+ break;
}
return result;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/IDynamicPropertyMap.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/IDynamicPropertyMap.java
index c5b77c67288..5804399bd26 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/IDynamicPropertyMap.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/IDynamicPropertyMap.java
@@ -17,33 +17,34 @@ package org.eclipse.ui.internal.preferences;
* @since 3.1
*/
public interface IDynamicPropertyMap extends IPropertyMap {
- /**
- * Attaches a property map listener to this map. The listener will be notified
- * whenever one of the properties in the map is changed, added, or removed.
- *
- * @param listener
- * @since 3.1
- */
- void addListener(IPropertyMapListener listener);
+ /**
+ * Attaches a property map listener to this map. The listener will be notified
+ * whenever one of the properties in the map is changed, added, or removed.
+ *
+ * @param listener
+ * @since 3.1
+ */
+ void addListener(IPropertyMapListener listener);
- /**
- * Attaches a listener that will receive notifications when any
- * of the given properties change. If an identical listener is already registered,
- * then this will add additional IDs to the set of properties being monitored
- * by the given listener.
- *
- * @param listener
- * @param propertyIds
- * @since 3.1
- */
- void addListener(String[] propertyIds, IPropertyMapListener listener);
+ /**
+ * Attaches a listener that will receive notifications when any of the given
+ * properties change. If an identical listener is already registered, then this
+ * will add additional IDs to the set of properties being monitored by the given
+ * listener.
+ *
+ * @param listener
+ * @param propertyIds
+ * @since 3.1
+ */
+ void addListener(String[] propertyIds, IPropertyMapListener listener);
- /**
- * Removes a property map listener from this map . The listener will no longer
- * be notified whenever one of the properties in the map is changed, added, or removed.
- *
- * @param listener
- * @since 3.1
- */
- void removeListener(IPropertyMapListener listener);
+ /**
+ * Removes a property map listener from this map . The listener will no longer
+ * be notified whenever one of the properties in the map is changed, added, or
+ * removed.
+ *
+ * @param listener
+ * @since 3.1
+ */
+ void removeListener(IPropertyMapListener listener);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/IPropertyMap.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/IPropertyMap.java
index 84fcd3b9ec8..ebdfdb5a1f0 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/IPropertyMap.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/IPropertyMap.java
@@ -16,69 +16,67 @@ package org.eclipse.ui.internal.preferences;
import java.util.Set;
/**
- * Eclipse provides many different classes and interfaces that map ids onto values and
- * send property change notifications (some examples are themes, preference stores,
- * xml nodes, property providers, and others). This interface is intended to provide
- * interoperability between these various classes.
+ * Eclipse provides many different classes and interfaces that map ids onto
+ * values and send property change notifications (some examples are themes,
+ * preference stores, xml nodes, property providers, and others). This interface
+ * is intended to provide interoperability between these various classes.
*
* @since 3.1
*/
public interface IPropertyMap {
- /**
- * Returns the set of keys that are recognized by this property map
- * (optional operation).
- *
- * @return the set of valid keys for this map
- * @throws UnsupportedOperationException if this type of property map
- * cannot compute the set of valid keys
- * @since 3.1
- */
- Set keySet();
+ /**
+ * Returns the set of keys that are recognized by this property map (optional
+ * operation).
+ *
+ * @return the set of valid keys for this map
+ * @throws UnsupportedOperationException if this type of property map cannot
+ * compute the set of valid keys
+ * @since 3.1
+ */
+ Set keySet();
- /**
- * Returns the value of the given property. Returns null if the given
- * property does not exist, cannot be converted into the expected type,
- * or if the value of the property is null.
- *
- * @param propertyId property ID to query
- * @param propertyType type of the expected return value
- * @return an object of the given propertyType or null if the property
- * does not exist or has the wrong type
- * @since 3.1
- */
- Object getValue(String propertyId, Class propertyType);
+ /**
+ * Returns the value of the given property. Returns null if the given property
+ * does not exist, cannot be converted into the expected type, or if the value
+ * of the property is null.
+ *
+ * @param propertyId property ID to query
+ * @param propertyType type of the expected return value
+ * @return an object of the given propertyType or null if the property does not
+ * exist or has the wrong type
+ * @since 3.1
+ */
+ Object getValue(String propertyId, Class propertyType);
- /**
- * If this map represents the union of multiple property maps, this
- * returns true iff the property existed in every map in the union.
- * Always returns true if this map was not computed from the union
- * of multiple maps.
- *
- * @param propertyId
- * @return true iff the given property existed in every child map
- * @since 3.1
- */
- boolean isCommonProperty(String propertyId);
+ /**
+ * If this map represents the union of multiple property maps, this returns true
+ * iff the property existed in every map in the union. Always returns true if
+ * this map was not computed from the union of multiple maps.
+ *
+ * @param propertyId
+ * @return true iff the given property existed in every child map
+ * @since 3.1
+ */
+ boolean isCommonProperty(String propertyId);
- /**
- * Returns true iff the given property exists.
- *
- * @param propertyId
- * @return true iff the given property exists in this map
- * @since 3.1
- */
- boolean propertyExists(String propertyId);
+ /**
+ * Returns true iff the given property exists.
+ *
+ * @param propertyId
+ * @return true iff the given property exists in this map
+ * @since 3.1
+ */
+ boolean propertyExists(String propertyId);
- /**
- * Sets the value of the given property to the given value (optional
- * operation).
- *
- * @param propertyId
- * @param newValue
- * @throws UnsupportedOperationException if this type of property map
- * is read-only
- * @since 3.1
- */
- void setValue(String propertyId, Object newValue);
+ /**
+ * Sets the value of the given property to the given value (optional operation).
+ *
+ * @param propertyId
+ * @param newValue
+ * @throws UnsupportedOperationException if this type of property map is
+ * read-only
+ * @since 3.1
+ */
+ void setValue(String propertyId, Object newValue);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/IPropertyMapListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/IPropertyMapListener.java
index d4a21b50f36..563cfe7c2c5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/IPropertyMapListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/IPropertyMapListener.java
@@ -17,6 +17,7 @@ package org.eclipse.ui.internal.preferences;
* @since 3.1
*/
public interface IPropertyMapListener {
- void propertyChanged(String[] propertyIds);
- void listenerAttached();
+ void propertyChanged(String[] propertyIds);
+
+ void listenerAttached();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PreferenceStoreAdapter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PreferenceStoreAdapter.java
index 99127566e94..af3c66caab0 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PreferenceStoreAdapter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PreferenceStoreAdapter.java
@@ -22,80 +22,80 @@ import org.eclipse.jface.util.IPropertyChangeListener;
*/
public final class PreferenceStoreAdapter extends PropertyMapAdapter {
- private IPreferenceStore store;
+ private IPreferenceStore store;
- private IPropertyChangeListener listener = event -> firePropertyChange(event.getProperty());
+ private IPropertyChangeListener listener = event -> firePropertyChange(event.getProperty());
- public PreferenceStoreAdapter(IPreferenceStore toConvert) {
- this.store = toConvert;
- }
+ public PreferenceStoreAdapter(IPreferenceStore toConvert) {
+ this.store = toConvert;
+ }
- @Override
+ @Override
protected void attachListener() {
- store.addPropertyChangeListener(listener);
- }
+ store.addPropertyChangeListener(listener);
+ }
- @Override
+ @Override
protected void detachListener() {
- store.removePropertyChangeListener(listener);
- }
+ store.removePropertyChangeListener(listener);
+ }
- @Override
+ @Override
public Set keySet() {
- throw new UnsupportedOperationException();
- }
+ throw new UnsupportedOperationException();
+ }
- @Override
+ @Override
public Object getValue(String propertyId, Class propertyType) {
- if (propertyType.isAssignableFrom(String.class)) {
- return store.getString(propertyId);
- }
+ if (propertyType.isAssignableFrom(String.class)) {
+ return store.getString(propertyId);
+ }
- if (propertyType == Boolean.class) {
- return store.getBoolean(propertyId) ? Boolean.TRUE : Boolean.FALSE;
- }
+ if (propertyType == Boolean.class) {
+ return store.getBoolean(propertyId) ? Boolean.TRUE : Boolean.FALSE;
+ }
- if (propertyType == Double.class) {
+ if (propertyType == Double.class) {
return Double.valueOf(store.getDouble(propertyId));
- }
+ }
- if (propertyType == Float.class) {
- return Float.valueOf(store.getFloat(propertyId));
- }
+ if (propertyType == Float.class) {
+ return Float.valueOf(store.getFloat(propertyId));
+ }
- if (propertyType == Integer.class) {
+ if (propertyType == Integer.class) {
return Integer.valueOf(store.getInt(propertyId));
- }
+ }
- if (propertyType == Long.class) {
- return Long.valueOf(store.getLong(propertyId));
- }
+ if (propertyType == Long.class) {
+ return Long.valueOf(store.getLong(propertyId));
+ }
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public boolean propertyExists(String propertyId) {
- return store.contains(propertyId);
- }
+ return store.contains(propertyId);
+ }
- @Override
+ @Override
public void setValue(String propertyId, Object newValue) {
- if (newValue instanceof String) {
- store.setValue(propertyId, (String)newValue);
- } else if (newValue instanceof Integer) {
- store.setValue(propertyId, ((Integer)newValue).intValue());
- } else if (newValue instanceof Boolean) {
- store.setValue(propertyId, ((Boolean)newValue).booleanValue());
- } else if (newValue instanceof Double) {
- store.setValue(propertyId, ((Double)newValue).doubleValue());
- } else if (newValue instanceof Float) {
- store.setValue(propertyId, ((Float)newValue).floatValue());
- } else if (newValue instanceof Integer) {
- store.setValue(propertyId, ((Integer)newValue).intValue());
- } else if (newValue instanceof Long) {
- store.setValue(propertyId, ((Long)newValue).longValue());
- }
- }
+ if (newValue instanceof String) {
+ store.setValue(propertyId, (String) newValue);
+ } else if (newValue instanceof Integer) {
+ store.setValue(propertyId, ((Integer) newValue).intValue());
+ } else if (newValue instanceof Boolean) {
+ store.setValue(propertyId, ((Boolean) newValue).booleanValue());
+ } else if (newValue instanceof Double) {
+ store.setValue(propertyId, ((Double) newValue).doubleValue());
+ } else if (newValue instanceof Float) {
+ store.setValue(propertyId, ((Float) newValue).floatValue());
+ } else if (newValue instanceof Integer) {
+ store.setValue(propertyId, ((Integer) newValue).intValue());
+ } else if (newValue instanceof Long) {
+ store.setValue(propertyId, ((Long) newValue).longValue());
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PreferenceTransferElement.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PreferenceTransferElement.java
index e6ef398ab68..84e3a9b0eb1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PreferenceTransferElement.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PreferenceTransferElement.java
@@ -33,8 +33,7 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
*
* @since 3.1
*/
-public class PreferenceTransferElement extends WorkbenchAdapter implements
- IPluginContribution {
+public class PreferenceTransferElement extends WorkbenchAdapter implements IPluginContribution {
private String id;
private ImageDescriptor imageDescriptor;
@@ -51,8 +50,7 @@ public class PreferenceTransferElement extends WorkbenchAdapter implements
*/
public PreferenceTransferElement(IConfigurationElement configurationElement) {
this.configurationElement = configurationElement;
- id = configurationElement
- .getAttribute(IWorkbenchRegistryConstants.ATT_ID);
+ id = configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
}
/**
@@ -76,8 +74,7 @@ public class PreferenceTransferElement extends WorkbenchAdapter implements
Set scopes = new HashSet(size);
Map mappingsMap = new HashMap(size);
for (int i = 0; i < size; i++) {
- String scope = PreferenceTransferRegistryReader
- .getScope(mappingConfigurations[i]);
+ String scope = PreferenceTransferRegistryReader.getScope(mappingConfigurations[i]);
scopes.add(scope);
Map mappings;
@@ -91,16 +88,14 @@ public class PreferenceTransferElement extends WorkbenchAdapter implements
}
}
- Map entries = PreferenceTransferRegistryReader
- .getEntry(mappingConfigurations[i]);
+ Map entries = PreferenceTransferRegistryReader.getEntry(mappingConfigurations[i]);
if (entries == null) {
mappingsMap.put(scope, null);
} else {
mappings.putAll(entries);
}
}
- filter = new PreferenceFilter((String[]) scopes
- .toArray(new String[scopes.size()]), mappingsMap);
+ filter = new PreferenceFilter((String[]) scopes.toArray(new String[scopes.size()]), mappingsMap);
}
return filter;
}
@@ -129,8 +124,7 @@ public class PreferenceTransferElement extends WorkbenchAdapter implements
* @return the name of the element
*/
public String getName() {
- return configurationElement
- .getAttribute(IWorkbenchRegistryConstants.ATT_NAME);
+ return configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_NAME);
}
@Override
@@ -140,8 +134,7 @@ public class PreferenceTransferElement extends WorkbenchAdapter implements
@Override
public String getPluginId() {
- return (configurationElement != null) ? configurationElement
- .getContributor().getName() : null;
+ return (configurationElement != null) ? configurationElement.getContributor().getName() : null;
}
static class PreferenceFilter implements IPreferenceFilter {
@@ -174,13 +167,11 @@ public class PreferenceTransferElement extends WorkbenchAdapter implements
@Override
public ImageDescriptor getImageDescriptor(Object object) {
if (imageDescriptor == null) {
- String iconName = configurationElement
- .getAttribute(IWorkbenchRegistryConstants.ATT_ICON);
+ String iconName = configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_ICON);
if (iconName == null) {
return null;
}
- imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(
- getPluginId(), iconName);
+ imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(getPluginId(), iconName);
}
return imageDescriptor;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PreferenceTransferManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PreferenceTransferManager.java
index b42b545a615..72793b1e7d7 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PreferenceTransferManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PreferenceTransferManager.java
@@ -23,13 +23,13 @@ import org.eclipse.ui.internal.registry.PreferenceTransferRegistryReader;
*/
public class PreferenceTransferManager {
- /**
- * Return an array of <code>IPreferenceTransfer</code> objects
- * @return an array of <code>IPreferenceTransfer</code> objects
- */
- public static PreferenceTransferElement[] getPreferenceTransfers() {
- return new PreferenceTransferRegistryReader(
- IWorkbenchRegistryConstants.PL_PREFERENCE_TRANSFER)
- .getPreferenceTransfers();
- }
+ /**
+ * Return an array of <code>IPreferenceTransfer</code> objects
+ *
+ * @return an array of <code>IPreferenceTransfer</code> objects
+ */
+ public static PreferenceTransferElement[] getPreferenceTransfers() {
+ return new PreferenceTransferRegistryReader(IWorkbenchRegistryConstants.PL_PREFERENCE_TRANSFER)
+ .getPreferenceTransfers();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PreferencesAdapter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PreferencesAdapter.java
index add9b720474..79cb8a2f4e3 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PreferencesAdapter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PreferencesAdapter.java
@@ -21,86 +21,86 @@ import org.eclipse.core.runtime.Preferences;
* @since 3.1
*/
public final class PreferencesAdapter extends PropertyMapAdapter {
- private Preferences store;
+ private Preferences store;
- private Preferences.IPropertyChangeListener listener = event -> firePropertyChange(event.getProperty());
+ private Preferences.IPropertyChangeListener listener = event -> firePropertyChange(event.getProperty());
- public PreferencesAdapter(Preferences toConvert) {
- this.store = toConvert;
- }
+ public PreferencesAdapter(Preferences toConvert) {
+ this.store = toConvert;
+ }
- @Override
+ @Override
protected void attachListener() {
- store.addPropertyChangeListener(listener);
- }
+ store.addPropertyChangeListener(listener);
+ }
- @Override
+ @Override
protected void detachListener() {
- store.removePropertyChangeListener(listener);
- }
+ store.removePropertyChangeListener(listener);
+ }
- @Override
+ @Override
public Set keySet() {
- Set result = new HashSet();
+ Set result = new HashSet();
for (String name : store.propertyNames()) {
result.add(name);
- }
+ }
- return result;
- }
+ return result;
+ }
- @Override
+ @Override
public Object getValue(String propertyId, Class propertyType) {
- if (propertyType.isAssignableFrom(String.class)) {
- return store.getString(propertyId);
- }
+ if (propertyType.isAssignableFrom(String.class)) {
+ return store.getString(propertyId);
+ }
- if (propertyType == Boolean.class) {
- return store.getBoolean(propertyId) ? Boolean.TRUE : Boolean.FALSE;
- }
+ if (propertyType == Boolean.class) {
+ return store.getBoolean(propertyId) ? Boolean.TRUE : Boolean.FALSE;
+ }
- if (propertyType == Double.class) {
+ if (propertyType == Double.class) {
return Double.valueOf(store.getDouble(propertyId));
- }
+ }
- if (propertyType == Float.class) {
+ if (propertyType == Float.class) {
return Float.valueOf(store.getFloat(propertyId));
- }
+ }
- if (propertyType == Integer.class) {
+ if (propertyType == Integer.class) {
return Integer.valueOf(store.getInt(propertyId));
- }
+ }
- if (propertyType == Long.class) {
+ if (propertyType == Long.class) {
return Long.valueOf(store.getLong(propertyId));
- }
+ }
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public boolean propertyExists(String propertyId) {
- return store.contains(propertyId);
- }
+ return store.contains(propertyId);
+ }
- @Override
+ @Override
public void setValue(String propertyId, Object newValue) {
- if (newValue instanceof String) {
- store.setValue(propertyId, (String)newValue);
- } else if (newValue instanceof Integer) {
- store.setValue(propertyId, ((Integer)newValue).intValue());
- } else if (newValue instanceof Boolean) {
- store.setValue(propertyId, ((Boolean)newValue).booleanValue());
- } else if (newValue instanceof Double) {
- store.setValue(propertyId, ((Double)newValue).doubleValue());
- } else if (newValue instanceof Float) {
- store.setValue(propertyId, ((Float)newValue).floatValue());
- } else if (newValue instanceof Integer) {
- store.setValue(propertyId, ((Integer)newValue).intValue());
- } else if (newValue instanceof Long) {
- store.setValue(propertyId, ((Long)newValue).longValue());
- }
- }
+ if (newValue instanceof String) {
+ store.setValue(propertyId, (String) newValue);
+ } else if (newValue instanceof Integer) {
+ store.setValue(propertyId, ((Integer) newValue).intValue());
+ } else if (newValue instanceof Boolean) {
+ store.setValue(propertyId, ((Boolean) newValue).booleanValue());
+ } else if (newValue instanceof Double) {
+ store.setValue(propertyId, ((Double) newValue).doubleValue());
+ } else if (newValue instanceof Float) {
+ store.setValue(propertyId, ((Float) newValue).floatValue());
+ } else if (newValue instanceof Integer) {
+ store.setValue(propertyId, ((Integer) newValue).intValue());
+ } else if (newValue instanceof Long) {
+ store.setValue(propertyId, ((Long) newValue).longValue());
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PreferencesSettingsTransfer.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PreferencesSettingsTransfer.java
index da1f14b8947..5bb9f26c885 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PreferencesSettingsTransfer.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PreferencesSettingsTransfer.java
@@ -19,7 +19,7 @@ import org.eclipse.ui.internal.WorkbenchMessages;
* @since 3.110
*
*/
-public class PreferencesSettingsTransfer extends WorkbenchSettingsTransfer{
+public class PreferencesSettingsTransfer extends WorkbenchSettingsTransfer {
@Override
public IStatus transferSettings(IPath newWorkspaceRoot) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PropertyListenerList.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PropertyListenerList.java
index 30f0e2d3590..0299b300f72 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PropertyListenerList.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PropertyListenerList.java
@@ -26,167 +26,167 @@ import java.util.Map;
* @since 3.1
*/
public final class PropertyListenerList {
- private Map listeners;
- private List globalListeners;
- private static String[] singlePropertyDelta;
- private static Object mutex = new Object();
-
- public PropertyListenerList() {
- }
-
- public void firePropertyChange(String prefId) {
- String[] delta;
-
- // Optimization: as long as we're not being called recursively,
- // we can reuse the same delta object to avoid repeated memory
- // allocation.
- synchronized(mutex) {
- if (singlePropertyDelta != null) {
- delta = singlePropertyDelta;
- singlePropertyDelta = null;
- } else {
- delta = new String[] {prefId};
- }
- }
-
- delta[0] = prefId;
-
- firePropertyChange(delta);
-
- // Optimization: allow this same delta object to be reused at a later
- // time
- if (singlePropertyDelta == null) {
- synchronized(mutex) {
- singlePropertyDelta = delta;
- }
- }
- }
-
- public void firePropertyChange(String[] propertyIds) {
- if (globalListeners != null) {
- for (Iterator iter = globalListeners.iterator(); iter.hasNext();) {
- IPropertyMapListener next = (IPropertyMapListener) iter.next();
-
- next.propertyChanged(propertyIds);
- }
- }
-
- if (listeners != null) {
-
- // To avoid temporary memory allocation, we try to simply move the
- // result pointer around if possible. We only allocate a HashSet
- // to compute which listeners we care about
- Collection result = Collections.EMPTY_SET;
- HashSet union = null;
-
- for (String property : propertyIds) {
- List existingListeners = (List)listeners.get(property);
-
- if (existingListeners != null) {
- if (result == Collections.EMPTY_SET) {
- result = existingListeners;
- } else {
- if (union == null) {
- union = new HashSet();
- union.addAll(result);
- result = union;
- }
-
- union.addAll(existingListeners);
- }
- }
- }
-
- for (Iterator iter = result.iterator(); iter.hasNext();) {
- IPropertyMapListener next = (IPropertyMapListener) iter.next();
-
- next.propertyChanged(propertyIds);
- }
- }
- }
-
- public void add(IPropertyMapListener newListener) {
- if (globalListeners == null) {
- globalListeners = new ArrayList();
- }
-
- globalListeners.add(newListener);
- newListener.listenerAttached();
- }
-
- /**
- * Adds a listener which will be notified when the given property changes
- *
- * @param propertyId
- * @param newListener
- * @since 3.1
- */
- private void addInternal(String propertyId, IPropertyMapListener newListener) {
- if (listeners == null) {
- listeners = new HashMap();
- }
-
- List listenerList = (List)listeners.get(propertyId);
-
- if (listenerList == null) {
- listenerList = new ArrayList(1);
- listeners.put(propertyId, listenerList);
- }
-
- if (!listenerList.contains(newListener)) {
- listenerList.add(newListener);
- }
- }
-
- public void add(String[] propertyIds, IPropertyMapListener newListener) {
- for (String id : propertyIds) {
- addInternal(id, newListener);
- }
- newListener.listenerAttached();
- }
-
- public void remove(String propertyId, IPropertyMapListener toRemove) {
- if (listeners == null) {
- return;
- }
- List listenerList = (List)listeners.get(propertyId);
-
- if (listenerList != null) {
- listenerList.remove(toRemove);
-
- if (listenerList.isEmpty()) {
- listeners.remove(propertyId);
-
- if (listeners.isEmpty()) {
- listeners = null;
- }
- }
- }
- }
-
- public void removeAll() {
- globalListeners = null;
- listeners = null;
- }
-
- public void remove(IPropertyMapListener toRemove) {
- if (globalListeners != null) {
- globalListeners.remove(toRemove);
- if (globalListeners.isEmpty()) {
- globalListeners = null;
- }
- }
-
- if (listeners != null) {
- for (Iterator iter = listeners.keySet().iterator(); iter.hasNext();) {
- String key = (String) iter.next();
-
- remove(key, toRemove);
- }
- }
- }
-
- public boolean isEmpty() {
- return globalListeners == null && listeners == null;
- }
+ private Map listeners;
+ private List globalListeners;
+ private static String[] singlePropertyDelta;
+ private static Object mutex = new Object();
+
+ public PropertyListenerList() {
+ }
+
+ public void firePropertyChange(String prefId) {
+ String[] delta;
+
+ // Optimization: as long as we're not being called recursively,
+ // we can reuse the same delta object to avoid repeated memory
+ // allocation.
+ synchronized (mutex) {
+ if (singlePropertyDelta != null) {
+ delta = singlePropertyDelta;
+ singlePropertyDelta = null;
+ } else {
+ delta = new String[] { prefId };
+ }
+ }
+
+ delta[0] = prefId;
+
+ firePropertyChange(delta);
+
+ // Optimization: allow this same delta object to be reused at a later
+ // time
+ if (singlePropertyDelta == null) {
+ synchronized (mutex) {
+ singlePropertyDelta = delta;
+ }
+ }
+ }
+
+ public void firePropertyChange(String[] propertyIds) {
+ if (globalListeners != null) {
+ for (Iterator iter = globalListeners.iterator(); iter.hasNext();) {
+ IPropertyMapListener next = (IPropertyMapListener) iter.next();
+
+ next.propertyChanged(propertyIds);
+ }
+ }
+
+ if (listeners != null) {
+
+ // To avoid temporary memory allocation, we try to simply move the
+ // result pointer around if possible. We only allocate a HashSet
+ // to compute which listeners we care about
+ Collection result = Collections.EMPTY_SET;
+ HashSet union = null;
+
+ for (String property : propertyIds) {
+ List existingListeners = (List) listeners.get(property);
+
+ if (existingListeners != null) {
+ if (result == Collections.EMPTY_SET) {
+ result = existingListeners;
+ } else {
+ if (union == null) {
+ union = new HashSet();
+ union.addAll(result);
+ result = union;
+ }
+
+ union.addAll(existingListeners);
+ }
+ }
+ }
+
+ for (Iterator iter = result.iterator(); iter.hasNext();) {
+ IPropertyMapListener next = (IPropertyMapListener) iter.next();
+
+ next.propertyChanged(propertyIds);
+ }
+ }
+ }
+
+ public void add(IPropertyMapListener newListener) {
+ if (globalListeners == null) {
+ globalListeners = new ArrayList();
+ }
+
+ globalListeners.add(newListener);
+ newListener.listenerAttached();
+ }
+
+ /**
+ * Adds a listener which will be notified when the given property changes
+ *
+ * @param propertyId
+ * @param newListener
+ * @since 3.1
+ */
+ private void addInternal(String propertyId, IPropertyMapListener newListener) {
+ if (listeners == null) {
+ listeners = new HashMap();
+ }
+
+ List listenerList = (List) listeners.get(propertyId);
+
+ if (listenerList == null) {
+ listenerList = new ArrayList(1);
+ listeners.put(propertyId, listenerList);
+ }
+
+ if (!listenerList.contains(newListener)) {
+ listenerList.add(newListener);
+ }
+ }
+
+ public void add(String[] propertyIds, IPropertyMapListener newListener) {
+ for (String id : propertyIds) {
+ addInternal(id, newListener);
+ }
+ newListener.listenerAttached();
+ }
+
+ public void remove(String propertyId, IPropertyMapListener toRemove) {
+ if (listeners == null) {
+ return;
+ }
+ List listenerList = (List) listeners.get(propertyId);
+
+ if (listenerList != null) {
+ listenerList.remove(toRemove);
+
+ if (listenerList.isEmpty()) {
+ listeners.remove(propertyId);
+
+ if (listeners.isEmpty()) {
+ listeners = null;
+ }
+ }
+ }
+ }
+
+ public void removeAll() {
+ globalListeners = null;
+ listeners = null;
+ }
+
+ public void remove(IPropertyMapListener toRemove) {
+ if (globalListeners != null) {
+ globalListeners.remove(toRemove);
+ if (globalListeners.isEmpty()) {
+ globalListeners = null;
+ }
+ }
+
+ if (listeners != null) {
+ for (Iterator iter = listeners.keySet().iterator(); iter.hasNext();) {
+ String key = (String) iter.next();
+
+ remove(key, toRemove);
+ }
+ }
+ }
+
+ public boolean isEmpty() {
+ return globalListeners == null && listeners == null;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PropertyMapAdapter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PropertyMapAdapter.java
index e036e4fa170..a5fe4f1f923 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PropertyMapAdapter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PropertyMapAdapter.java
@@ -20,99 +20,100 @@ import java.util.ArrayList;
*/
public abstract class PropertyMapAdapter implements IDynamicPropertyMap {
- private PropertyListenerList listeners;
- private int ignoreCount = 0;
- private ArrayList queuedEvents = new ArrayList();
+ private PropertyListenerList listeners;
+ private int ignoreCount = 0;
+ private ArrayList queuedEvents = new ArrayList();
- @Override
+ @Override
public final void addListener(IPropertyMapListener listener) {
- if (listeners == null) {
- listeners = new PropertyListenerList();
- attachListener();
- }
- listeners.add(listener);
- }
-
- @Override
+ if (listeners == null) {
+ listeners = new PropertyListenerList();
+ attachListener();
+ }
+ listeners.add(listener);
+ }
+
+ @Override
public final void removeListener(IPropertyMapListener listener) {
- if (listeners != null) {
- listeners.remove(listener);
- if (listeners.isEmpty()) {
- detachListener();
- listeners = null;
- }
- }
- }
-
- @Override
+ if (listeners != null) {
+ listeners.remove(listener);
+ if (listeners.isEmpty()) {
+ detachListener();
+ listeners = null;
+ }
+ }
+ }
+
+ @Override
public final boolean isCommonProperty(String propertyId) {
- return true;
- }
-
- /**
- * Detaches all listeners which have been registered with other objects
- *
- * @since 3.1
- */
- public void dispose() {
- if (listeners != null) {
- detachListener();
- listeners = null;
- }
- }
-
- protected final void firePropertyChange(String prefId) {
- if (ignoreCount > 0) {
- queuedEvents.add(prefId);
- return;
- }
-
- if (listeners != null) {
- listeners.firePropertyChange(prefId);
- }
- }
-
- @Override
+ return true;
+ }
+
+ /**
+ * Detaches all listeners which have been registered with other objects
+ *
+ * @since 3.1
+ */
+ public void dispose() {
+ if (listeners != null) {
+ detachListener();
+ listeners = null;
+ }
+ }
+
+ protected final void firePropertyChange(String prefId) {
+ if (ignoreCount > 0) {
+ queuedEvents.add(prefId);
+ return;
+ }
+
+ if (listeners != null) {
+ listeners.firePropertyChange(prefId);
+ }
+ }
+
+ @Override
public final void addListener(String[] eventsOfInterest, IPropertyMapListener listener) {
- if (listeners == null) {
- listeners = new PropertyListenerList();
- attachListener();
- }
- listeners.add(eventsOfInterest, listener);
- }
-
- protected final void firePropertyChange(String[] prefIds) {
- if (ignoreCount > 0) {
- for (String prefId : prefIds) {
- queuedEvents.add(prefId);
- }
- return;
- }
-
- if (listeners != null) {
- listeners.firePropertyChange(prefIds);
- }
- }
-
- public final void startTransaction() {
- ignoreCount++;
- }
-
- public final void endTransaction() {
- ignoreCount--;
- if (ignoreCount == 0 && !queuedEvents.isEmpty()) {
- if (listeners != null) {
- listeners.firePropertyChange((String[]) queuedEvents.toArray(new String[queuedEvents.size()]));
- }
- queuedEvents.clear();
- }
- }
-
- @Override
+ if (listeners == null) {
+ listeners = new PropertyListenerList();
+ attachListener();
+ }
+ listeners.add(eventsOfInterest, listener);
+ }
+
+ protected final void firePropertyChange(String[] prefIds) {
+ if (ignoreCount > 0) {
+ for (String prefId : prefIds) {
+ queuedEvents.add(prefId);
+ }
+ return;
+ }
+
+ if (listeners != null) {
+ listeners.firePropertyChange(prefIds);
+ }
+ }
+
+ public final void startTransaction() {
+ ignoreCount++;
+ }
+
+ public final void endTransaction() {
+ ignoreCount--;
+ if (ignoreCount == 0 && !queuedEvents.isEmpty()) {
+ if (listeners != null) {
+ listeners.firePropertyChange((String[]) queuedEvents.toArray(new String[queuedEvents.size()]));
+ }
+ queuedEvents.clear();
+ }
+ }
+
+ @Override
public boolean equals(Object toCompare) {
- return toCompare instanceof IPropertyMap && PropertyUtil.isEqual(this, (IPropertyMap)toCompare);
- }
+ return toCompare instanceof IPropertyMap && PropertyUtil.isEqual(this, (IPropertyMap) toCompare);
+ }
- protected abstract void attachListener();
- protected abstract void detachListener();
+ protected abstract void attachListener();
+
+ protected abstract void detachListener();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PropertyMapUnion.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PropertyMapUnion.java
index 52a72c7f934..157276057c2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PropertyMapUnion.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PropertyMapUnion.java
@@ -24,110 +24,111 @@ import org.eclipse.ui.internal.util.Util;
*/
public class PropertyMapUnion implements IPropertyMap {
- private Map values;
+ private Map values;
- private static final class PropertyInfo {
- Object value;
- boolean commonAttribute;
+ private static final class PropertyInfo {
+ Object value;
+ boolean commonAttribute;
- PropertyInfo(Object value, boolean commonAttribute) {
- this.value = value;
- this.commonAttribute = commonAttribute;
- }
- }
+ PropertyInfo(Object value, boolean commonAttribute) {
+ this.value = value;
+ this.commonAttribute = commonAttribute;
+ }
+ }
- @Override
+ @Override
public Set keySet() {
- return values.keySet();
- }
+ return values.keySet();
+ }
- @Override
+ @Override
public Object getValue(String propertyId, Class propertyType) {
- PropertyInfo info = (PropertyInfo)values.get(propertyId);
+ PropertyInfo info = (PropertyInfo) values.get(propertyId);
- if (info == null) {
- return null;
- }
+ if (info == null) {
+ return null;
+ }
- Object value = info.value;
+ Object value = info.value;
- if (propertyType.isInstance(value)) {
- return value;
- }
+ if (propertyType.isInstance(value)) {
+ return value;
+ }
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public boolean isCommonProperty(String propertyId) {
- PropertyInfo info = (PropertyInfo)values.get(propertyId);
+ PropertyInfo info = (PropertyInfo) values.get(propertyId);
- if (info == null) {
- return false;
- }
+ if (info == null) {
+ return false;
+ }
- return info.commonAttribute;
- }
+ return info.commonAttribute;
+ }
- @Override
+ @Override
public boolean propertyExists(String propertyId) {
- return values.get(propertyId) != null;
- }
+ return values.get(propertyId) != null;
+ }
- @Override
+ @Override
public void setValue(String propertyId, Object newValue) {
- PropertyInfo info = new PropertyInfo(newValue, true);
-
- values.put(propertyId, info);
- }
-
- public void addMap(IPropertyMap toAdd) {
- Set keySet = toAdd.keySet();
-
- // Update any existing attributes
- for (Iterator iter = keySet().iterator(); iter.hasNext();) {
- String key = (String) iter.next();
-
- PropertyInfo localInfo = (PropertyInfo)values.get(key);
- // Shouldn't be null, but just in case...
- if (localInfo != null) {
- // If the attribute exists in the new map
- if (toAdd.propertyExists(key)) {
- // Determine if the value is common
- Object value = toAdd.getValue(key, Object.class);
-
- if (!Util.equals(value, toAdd.getValue(key, Object.class))) {
- // Set the value to null if not common
- localInfo.value = null;
- }
-
- // The attribute must be common in both the receiver and the new map to be common
- // everywhere
- localInfo.commonAttribute = localInfo.commonAttribute && toAdd.isCommonProperty(key);
- } else {
- // If the attribute doesn't exist in the new map, it cannot be common
- localInfo.commonAttribute = false;
- }
- }
- }
-
- // Add any new attributes that exist in the target
- for (Iterator iter = keySet.iterator(); iter.hasNext();) {
- String element = (String) iter.next();
-
- PropertyInfo localInfo = (PropertyInfo)values.get(element);
- if (localInfo == null) {
- Object value = toAdd.getValue(element, Object.class);
-
- boolean isCommon = toAdd.isCommonProperty(element);
-
- localInfo = new PropertyInfo(value, isCommon);
- values.put(element, localInfo);
- }
- }
- }
-
- public void removeValue(String propertyId) {
- values.remove(propertyId);
- }
+ PropertyInfo info = new PropertyInfo(newValue, true);
+
+ values.put(propertyId, info);
+ }
+
+ public void addMap(IPropertyMap toAdd) {
+ Set keySet = toAdd.keySet();
+
+ // Update any existing attributes
+ for (Iterator iter = keySet().iterator(); iter.hasNext();) {
+ String key = (String) iter.next();
+
+ PropertyInfo localInfo = (PropertyInfo) values.get(key);
+ // Shouldn't be null, but just in case...
+ if (localInfo != null) {
+ // If the attribute exists in the new map
+ if (toAdd.propertyExists(key)) {
+ // Determine if the value is common
+ Object value = toAdd.getValue(key, Object.class);
+
+ if (!Util.equals(value, toAdd.getValue(key, Object.class))) {
+ // Set the value to null if not common
+ localInfo.value = null;
+ }
+
+ // The attribute must be common in both the receiver and the new map to be
+ // common
+ // everywhere
+ localInfo.commonAttribute = localInfo.commonAttribute && toAdd.isCommonProperty(key);
+ } else {
+ // If the attribute doesn't exist in the new map, it cannot be common
+ localInfo.commonAttribute = false;
+ }
+ }
+ }
+
+ // Add any new attributes that exist in the target
+ for (Iterator iter = keySet.iterator(); iter.hasNext();) {
+ String element = (String) iter.next();
+
+ PropertyInfo localInfo = (PropertyInfo) values.get(element);
+ if (localInfo == null) {
+ Object value = toAdd.getValue(element, Object.class);
+
+ boolean isCommon = toAdd.isCommonProperty(element);
+
+ localInfo = new PropertyInfo(value, isCommon);
+ values.put(element, localInfo);
+ }
+ }
+ }
+
+ public void removeValue(String propertyId) {
+ values.remove(propertyId);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PropertyUtil.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PropertyUtil.java
index 714a54c95d1..891bd072ddf 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PropertyUtil.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/PropertyUtil.java
@@ -20,84 +20,85 @@ import java.util.Set;
* @since 3.1
*/
public class PropertyUtil {
- private PropertyUtil() {
- }
-
- public static boolean isEqual(IPropertyMap map1, IPropertyMap map2) {
- Set map1Keys = map1.keySet();
- Set map2Keys = map2.keySet();
-
- if (!map1Keys.equals(map2Keys)) {
- return false;
- }
-
- for (Iterator iter = map1Keys.iterator(); iter.hasNext();) {
- String next = (String) iter.next();
-
- if (!map1.getValue(next, Object.class).equals(map2.getValue(next, Object.class))) {
- return false;
- }
- }
-
- return true;
- }
-
- /**
- * Copies all properties from the given source to the given destination
- *
- * @param destination
- * @param source
- * @since 3.1
- */
- public static void copy(IPropertyMap destination, IPropertyMap source) {
- Set keys = source.keySet();
-
- for (Iterator iter = keys.iterator(); iter.hasNext();) {
- String key = (String) iter.next();
-
- destination.setValue(key, source.getValue(key, Object.class));
- }
- }
-
- /**
- * Computes the union of a set property maps. The result will contain all properties from
- * all of the contributing maps. If the same property had a different value in two or
- * more maps, its value in the union will be null. If the same property
- *
- * Note that the result is a standalone
- * object and will not be updated to reflect subsequent changes in the source maps.
- *
- * @param sources
- * @return
- * @since 3.1
- */
- public static IPropertyMap union(IPropertyMap[] sources) {
- PropertyMapUnion result = new PropertyMapUnion();
-
- for (IPropertyMap map : sources) {
- result.addMap(map);
- }
-
- return result;
- }
-
- public static boolean get(IPropertyMap toRead, String propertyId, boolean defaultValue) {
- Boolean result = ((Boolean)toRead.getValue(propertyId, Boolean.class));
-
- if (result == null) {
- return defaultValue;
- }
-
- return result.booleanValue();
- }
-
- public static int get(IPropertyMap toRead, String propertyId, int defaultValue) {
- Integer result = ((Integer)toRead.getValue(propertyId, Integer.class));
-
- if (result == null) {
- return defaultValue;
- }
-
- return result.intValue();
- }
+ private PropertyUtil() {
+ }
+
+ public static boolean isEqual(IPropertyMap map1, IPropertyMap map2) {
+ Set map1Keys = map1.keySet();
+ Set map2Keys = map2.keySet();
+
+ if (!map1Keys.equals(map2Keys)) {
+ return false;
+ }
+
+ for (Iterator iter = map1Keys.iterator(); iter.hasNext();) {
+ String next = (String) iter.next();
+
+ if (!map1.getValue(next, Object.class).equals(map2.getValue(next, Object.class))) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * Copies all properties from the given source to the given destination
+ *
+ * @param destination
+ * @param source
+ * @since 3.1
+ */
+ public static void copy(IPropertyMap destination, IPropertyMap source) {
+ Set keys = source.keySet();
+
+ for (Iterator iter = keys.iterator(); iter.hasNext();) {
+ String key = (String) iter.next();
+
+ destination.setValue(key, source.getValue(key, Object.class));
+ }
+ }
+
+ /**
+ * Computes the union of a set property maps. The result will contain all
+ * properties from all of the contributing maps. If the same property had a
+ * different value in two or more maps, its value in the union will be null. If
+ * the same property
+ *
+ * Note that the result is a standalone object and will not be updated to
+ * reflect subsequent changes in the source maps.
+ *
+ * @param sources
+ * @return
+ * @since 3.1
+ */
+ public static IPropertyMap union(IPropertyMap[] sources) {
+ PropertyMapUnion result = new PropertyMapUnion();
+
+ for (IPropertyMap map : sources) {
+ result.addMap(map);
+ }
+
+ return result;
+ }
+
+ public static boolean get(IPropertyMap toRead, String propertyId, boolean defaultValue) {
+ Boolean result = ((Boolean) toRead.getValue(propertyId, Boolean.class));
+
+ if (result == null) {
+ return defaultValue;
+ }
+
+ return result.booleanValue();
+ }
+
+ public static int get(IPropertyMap toRead, String propertyId, int defaultValue) {
+ Integer result = ((Integer) toRead.getValue(propertyId, Integer.class));
+
+ if (result == null) {
+ return defaultValue;
+ }
+
+ return result.intValue();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/SettingsTransferRegistryReader.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/SettingsTransferRegistryReader.java
index c1dd4758903..9454d1f7144 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/SettingsTransferRegistryReader.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/SettingsTransferRegistryReader.java
@@ -53,11 +53,9 @@ public class SettingsTransferRegistryReader extends RegistryReader {
settingsTransfers = new ArrayList();
IExtensionRegistry registry = Platform.getExtensionRegistry();
- readRegistry(registry, WorkbenchPlugin.PI_WORKBENCH,
- IWorkbenchRegistryConstants.PL_PREFERENCE_TRANSFER);
+ readRegistry(registry, WorkbenchPlugin.PI_WORKBENCH, IWorkbenchRegistryConstants.PL_PREFERENCE_TRANSFER);
- IConfigurationElement[] transfers = new IConfigurationElement[settingsTransfers
- .size()];
+ IConfigurationElement[] transfers = new IConfigurationElement[settingsTransfers.size()];
settingsTransfers.toArray(transfers);
return transfers;
@@ -65,16 +63,14 @@ public class SettingsTransferRegistryReader extends RegistryReader {
@Override
protected boolean readElement(IConfigurationElement element) {
- if (element.getName().equals(
- IWorkbenchRegistryConstants.TAG_SETTINGS_TRANSFER)) {
+ if (element.getName().equals(IWorkbenchRegistryConstants.TAG_SETTINGS_TRANSFER)) {
settingsTransfers.add(element);
return true;
}
- //Ignore the preference transfers
- return element.getName().equals(
- IWorkbenchRegistryConstants.TAG_TRANSFER);
+ // Ignore the preference transfers
+ return element.getName().equals(IWorkbenchRegistryConstants.TAG_TRANSFER);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/ThemeAdapter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/ThemeAdapter.java
index 43f6b2e71b4..e31eed60db2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/ThemeAdapter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/ThemeAdapter.java
@@ -26,84 +26,84 @@ import org.eclipse.ui.themes.ITheme;
*/
public class ThemeAdapter extends PropertyMapAdapter {
- private ITheme targetTheme;
+ private ITheme targetTheme;
- private IPropertyChangeListener listener = event -> firePropertyChange(event.getProperty());
+ private IPropertyChangeListener listener = event -> firePropertyChange(event.getProperty());
- public ThemeAdapter(ITheme targetTheme) {
- this.targetTheme = targetTheme;
- }
+ public ThemeAdapter(ITheme targetTheme) {
+ this.targetTheme = targetTheme;
+ }
- @Override
+ @Override
protected void attachListener() {
- targetTheme.addPropertyChangeListener(listener);
- }
+ targetTheme.addPropertyChangeListener(listener);
+ }
- @Override
+ @Override
protected void detachListener() {
- targetTheme.removePropertyChangeListener(listener);
- }
+ targetTheme.removePropertyChangeListener(listener);
+ }
- @Override
+ @Override
public Set keySet() {
- return getKeySet(targetTheme);
- }
+ return getKeySet(targetTheme);
+ }
- @Override
+ @Override
public Object getValue(String propertyId, Class propertyType) {
- return getValue(targetTheme, propertyId, propertyType);
- }
+ return getValue(targetTheme, propertyId, propertyType);
+ }
- public static Set getKeySet(ITheme targetTheme) {
- Set result = new HashSet();
+ public static Set getKeySet(ITheme targetTheme) {
+ Set result = new HashSet();
- result.addAll(targetTheme.keySet());
- result.addAll(targetTheme.getColorRegistry().getKeySet());
- result.addAll(targetTheme.getFontRegistry().getKeySet());
+ result.addAll(targetTheme.keySet());
+ result.addAll(targetTheme.getColorRegistry().getKeySet());
+ result.addAll(targetTheme.getFontRegistry().getKeySet());
- return result;
- }
+ return result;
+ }
- public static Object getValue(ITheme targetTheme, String propertyId, Class propertyType) {
+ public static Object getValue(ITheme targetTheme, String propertyId, Class propertyType) {
- if (propertyType.isAssignableFrom(String.class)) {
- return targetTheme.getString(propertyId);
- }
+ if (propertyType.isAssignableFrom(String.class)) {
+ return targetTheme.getString(propertyId);
+ }
- if (propertyType.isAssignableFrom(Color.class)) {
- Color result = targetTheme.getColorRegistry().get(propertyId);
- if (result != null) {
- return result;
- }
- }
+ if (propertyType.isAssignableFrom(Color.class)) {
+ Color result = targetTheme.getColorRegistry().get(propertyId);
+ if (result != null) {
+ return result;
+ }
+ }
- if (propertyType.isAssignableFrom(Font.class)) {
- FontRegistry fonts = targetTheme.getFontRegistry();
+ if (propertyType.isAssignableFrom(Font.class)) {
+ FontRegistry fonts = targetTheme.getFontRegistry();
- if (fonts.hasValueFor(propertyId)) {
- return fonts.get(propertyId);
- }
- }
+ if (fonts.hasValueFor(propertyId)) {
+ return fonts.get(propertyId);
+ }
+ }
- if (propertyType == Integer.class) {
+ if (propertyType == Integer.class) {
return Integer.valueOf(targetTheme.getInt(propertyId));
- }
+ }
- if (propertyType == Boolean.class) {
- return targetTheme.getBoolean(propertyId) ? Boolean.TRUE : Boolean.FALSE;
- }
+ if (propertyType == Boolean.class) {
+ return targetTheme.getBoolean(propertyId) ? Boolean.TRUE : Boolean.FALSE;
+ }
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public boolean propertyExists(String propertyId) {
- return keySet().contains(propertyId);
- }
+ return keySet().contains(propertyId);
+ }
- @Override
+ @Override
public void setValue(String propertyId, Object newValue) {
- throw new UnsupportedOperationException();
- }
+ throw new UnsupportedOperationException();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/ThemeManagerAdapter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/ThemeManagerAdapter.java
index 53089139a23..7214a930fc2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/ThemeManagerAdapter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/ThemeManagerAdapter.java
@@ -23,44 +23,44 @@ import org.eclipse.ui.themes.IThemeManager;
*/
public class ThemeManagerAdapter extends PropertyMapAdapter {
- private IThemeManager manager;
+ private IThemeManager manager;
- private IPropertyChangeListener listener = event -> firePropertyChange(event.getProperty());
+ private IPropertyChangeListener listener = event -> firePropertyChange(event.getProperty());
- public ThemeManagerAdapter(IThemeManager manager) {
- this.manager = manager;
- }
+ public ThemeManagerAdapter(IThemeManager manager) {
+ this.manager = manager;
+ }
- @Override
+ @Override
protected void attachListener() {
- manager.addPropertyChangeListener(listener);
- }
+ manager.addPropertyChangeListener(listener);
+ }
- @Override
+ @Override
protected void detachListener() {
- manager.removePropertyChangeListener(listener);
- }
+ manager.removePropertyChangeListener(listener);
+ }
- @Override
+ @Override
public Set keySet() {
- Set result = ThemeAdapter.getKeySet(manager.getCurrentTheme());
+ Set result = ThemeAdapter.getKeySet(manager.getCurrentTheme());
- return result;
- }
+ return result;
+ }
- @Override
+ @Override
public Object getValue(String propertyId, Class propertyType) {
- return ThemeAdapter.getValue(manager.getCurrentTheme(), propertyId, propertyType);
- }
+ return ThemeAdapter.getValue(manager.getCurrentTheme(), propertyId, propertyType);
+ }
- @Override
+ @Override
public boolean propertyExists(String propertyId) {
- return keySet().contains(propertyId);
- }
+ return keySet().contains(propertyId);
+ }
- @Override
+ @Override
public void setValue(String propertyId, Object newValue) {
- throw new UnsupportedOperationException();
- }
+ throw new UnsupportedOperationException();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/WorkbenchPreferenceExpressionNode.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/WorkbenchPreferenceExpressionNode.java
index 66557bcb356..3cead776284 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/WorkbenchPreferenceExpressionNode.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/WorkbenchPreferenceExpressionNode.java
@@ -27,9 +27,7 @@ import org.eclipse.ui.activities.WorkbenchActivityHelper;
* @since 3.4
* @author Jan Diederich
*/
-public class WorkbenchPreferenceExpressionNode extends PreferenceNode
- implements IPluginContribution {
-
+public class WorkbenchPreferenceExpressionNode extends PreferenceNode implements IPluginContribution {
/**
* @param id The id.
@@ -39,48 +37,45 @@ public class WorkbenchPreferenceExpressionNode extends PreferenceNode
super(id);
}
- @Override
+ @Override
public IPreferenceNode findSubNode(String id) {
- return getNodeExpression(super.findSubNode(id));
- }
+ return getNodeExpression(super.findSubNode(id));
+ }
- @Override
+ @Override
public IPreferenceNode[] getSubNodes() {
- IPreferenceNode[] prefNodes = super.getSubNodes();
- int size = prefNodes.length;
- List list = new ArrayList(size);
- for (int i = 0; i < size; i++) {
- IPreferenceNode prefNode = getNodeExpression(prefNodes[i]);
- if (prefNode != null) {
- list.add(prefNode);
- }
- }
- return (IPreferenceNode[])list.toArray(new IPreferenceNode[list.size()]);
- }
+ IPreferenceNode[] prefNodes = super.getSubNodes();
+ int size = prefNodes.length;
+ List list = new ArrayList(size);
+ for (int i = 0; i < size; i++) {
+ IPreferenceNode prefNode = getNodeExpression(prefNodes[i]);
+ if (prefNode != null) {
+ list.add(prefNode);
+ }
+ }
+ return (IPreferenceNode[]) list.toArray(new IPreferenceNode[list.size()]);
+ }
- /**
- * Returns the given <code>prefNode</code>, but only if it's no
- * WorkbenchPreferenceExtensionNode which fails the Expression check.
- *
- * @param prefNode
- * The preference node which will be checked. Can be <code>null
- * </code>.
- * @return The given <code>prefNode</code>, or <code>null</code> if it
- * fails the Expressions check.
- */
- public static IPreferenceNode getNodeExpression(
- IPreferenceNode prefNode) {
- if (prefNode == null)
- return null;
- if (prefNode instanceof WorkbenchPreferenceExtensionNode) {
- WorkbenchPreferenceExpressionNode node =
- (WorkbenchPreferenceExtensionNode)prefNode;
- if (WorkbenchActivityHelper.restrictUseOf(node)) {
- return null;
- }
- }
- return prefNode;
- }
+ /**
+ * Returns the given <code>prefNode</code>, but only if it's no
+ * WorkbenchPreferenceExtensionNode which fails the Expression check.
+ *
+ * @param prefNode The preference node which will be checked. Can be <code>null
+ * </code>.
+ * @return The given <code>prefNode</code>, or <code>null</code> if it fails the
+ * Expressions check.
+ */
+ public static IPreferenceNode getNodeExpression(IPreferenceNode prefNode) {
+ if (prefNode == null)
+ return null;
+ if (prefNode instanceof WorkbenchPreferenceExtensionNode) {
+ WorkbenchPreferenceExpressionNode node = (WorkbenchPreferenceExtensionNode) prefNode;
+ if (WorkbenchActivityHelper.restrictUseOf(node)) {
+ return null;
+ }
+ }
+ return prefNode;
+ }
@Override
public String getLocalId() {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/WorkbenchPreferenceExtensionNode.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/WorkbenchPreferenceExtensionNode.java
index e597cf0b812..8696419fbb3 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/WorkbenchPreferenceExtensionNode.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/WorkbenchPreferenceExtensionNode.java
@@ -36,7 +36,7 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
* @since 3.1
*/
public abstract class WorkbenchPreferenceExtensionNode extends WorkbenchPreferenceExpressionNode
- implements IComparableContribution {
+ implements IComparableContribution {
private Collection<String> keywordReferences;
@@ -67,7 +67,7 @@ public abstract class WorkbenchPreferenceExtensionNode extends WorkbenchPreferen
/**
* Get the ids of the keywords the receiver is bound to.
*
- * @return Collection of <code>String</code>. Never <code>null</code>.
+ * @return Collection of <code>String</code>. Never <code>null</code>.
*/
public Collection<String> getKeywordReferences() {
if (keywordReferences == null) {
@@ -94,7 +94,7 @@ public abstract class WorkbenchPreferenceExtensionNode extends WorkbenchPreferen
/**
* Get the labels of all of the keywords of the receiver.
*
- * @return Collection of <code>String</code>. Never <code>null</code>.
+ * @return Collection of <code>String</code>. Never <code>null</code>.
*/
public Collection<String> getKeywordLabels() {
if (keywordLabelCache != null) {
@@ -111,7 +111,7 @@ public abstract class WorkbenchPreferenceExtensionNode extends WorkbenchPreferen
keywordLabelCache = new ArrayList<>(refs.size());
for (String reference : refs) {
String label = KeywordRegistry.getInstance().getKeywordLabel(reference);
- if(label != null) {
+ if (label != null) {
keywordLabelCache.add(label);
}
}
@@ -128,54 +128,53 @@ public abstract class WorkbenchPreferenceExtensionNode extends WorkbenchPreferen
@Override
public void disposeResources() {
- if (image != null) {
- image.dispose();
- image = null;
- }
- super.disposeResources();
+ if (image != null) {
+ image.dispose();
+ image = null;
+ }
+ super.disposeResources();
}
@Override
public Image getLabelImage() {
- if (image == null) {
- ImageDescriptor desc = getImageDescriptor();
- if (desc != null) {
+ if (image == null) {
+ ImageDescriptor desc = getImageDescriptor();
+ if (desc != null) {
image = imageDescriptor.createImage();
}
- }
- return image;
- }
-
+ }
+ return image;
+ }
@Override
public String getLabelText() {
return getConfigurationElement().getAttribute(IWorkbenchRegistryConstants.ATT_NAME);
}
- /**
- * Returns the image descriptor for this node.
- *
- * @return the image descriptor
- */
- @Override
+ /**
+ * Returns the image descriptor for this node.
+ *
+ * @return the image descriptor
+ */
+ @Override
public ImageDescriptor getImageDescriptor() {
- if (imageDescriptor != null) {
+ if (imageDescriptor != null) {
return imageDescriptor;
}
- String imageName = getConfigurationElement().getAttribute(IWorkbenchRegistryConstants.ATT_ICON);
+ String imageName = getConfigurationElement().getAttribute(IWorkbenchRegistryConstants.ATT_ICON);
if (imageName != null) {
String contributingPluginId = pluginId;
imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(contributingPluginId, imageName);
}
return imageDescriptor;
- }
+ }
- /**
- * Return the configuration element.
- *
- * @return the configuration element
- */
+ /**
+ * Return the configuration element.
+ *
+ * @return the configuration element
+ */
public IConfigurationElement getConfigurationElement() {
return configurationElement;
}
@@ -192,27 +191,23 @@ public abstract class WorkbenchPreferenceExtensionNode extends WorkbenchPreferen
@Override
public <T> T getAdapter(Class<T> adapter) {
- if (adapter == IConfigurationElement.class)
+ if (adapter == IConfigurationElement.class)
return adapter.cast(getConfigurationElement());
- return null;
- }
-
- @Override
- public String getLabel()
- {
- return getLabelText();
- }
-
- @Override
- public int getPriority()
- {
- return priority;
- }
-
- public void setPriority(int pri)
- {
- priority = pri;
- }
+ return null;
+ }
+
+ @Override
+ public String getLabel() {
+ return getLabelText();
+ }
+ @Override
+ public int getPriority() {
+ return priority;
+ }
+
+ public void setPriority(int pri) {
+ priority = pri;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/WorkbenchSettingsTransfer.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/WorkbenchSettingsTransfer.java
index d0951e9a7a7..30b8046a10d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/WorkbenchSettingsTransfer.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/WorkbenchSettingsTransfer.java
@@ -33,6 +33,7 @@ public abstract class WorkbenchSettingsTransfer extends SettingsTransfer {
/**
* Return a status message for missing workspace settings.
+ *
* @return IStatus
*/
protected IStatus noWorkingSettingsStatus() {
@@ -42,6 +43,7 @@ public abstract class WorkbenchSettingsTransfer extends SettingsTransfer {
/**
* Return the workbench settings location for the new root
+ *
* @param newWorkspaceRoot
* @return IPath or <code>null</code> if it can't be determined.
*/
@@ -52,8 +54,7 @@ public abstract class WorkbenchSettingsTransfer extends SettingsTransfer {
if (dataLocation == null)
return null;
- int segmentsToRemove = dataLocation
- .matchingFirstSegments(currentWorkspaceRoot);
+ int segmentsToRemove = dataLocation.matchingFirstSegments(currentWorkspaceRoot);
// Strip it down to the extension
dataLocation = dataLocation.removeFirstSegments(segmentsToRemove);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/WorkingCopyPreferences.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/WorkingCopyPreferences.java
index 6716f526953..b2bad2417e2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/WorkingCopyPreferences.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/WorkingCopyPreferences.java
@@ -36,10 +36,10 @@ import org.osgi.service.prefs.Preferences;
* Note: Preference change listeners registered on this node will only receive
* events from this node and not events based on the original backing node.
* </p>
+ *
* @since 3.1
*/
-public class WorkingCopyPreferences extends EventManager implements
- IEclipsePreferences {
+public class WorkingCopyPreferences extends EventManager implements IEclipsePreferences {
private static final String TRUE = "true"; //$NON-NLS-1$
@@ -50,7 +50,7 @@ public class WorkingCopyPreferences extends EventManager implements
/**
* @param original the underlying preference node
- * @param manager the working copy manager
+ * @param manager the working copy manager
*/
public WorkingCopyPreferences(IEclipsePreferences original, org.eclipse.ui.preferences.WorkingCopyManager manager) {
super();
@@ -60,8 +60,8 @@ public class WorkingCopyPreferences extends EventManager implements
}
/*
- * Convenience method for throwing an exception when methods
- * are called on a removed node.
+ * Convenience method for throwing an exception when methods are called on a
+ * removed node.
*/
private void checkRemoved() {
if (removed) {
@@ -110,7 +110,6 @@ public class WorkingCopyPreferences extends EventManager implements
removed = true;
}
-
@Override
public Preferences node(String path) {
checkRemoved();
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/WorkingSetPropertyPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/WorkingSetPropertyPage.java
index 23994b1fcd4..ff6c752040e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/WorkingSetPropertyPage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/WorkingSetPropertyPage.java
@@ -68,7 +68,7 @@ public class WorkingSetPropertyPage extends WizardPropertyPage {
*/
@Override
public void createControl(Composite parent) {
- Composite composite= new Composite(parent, SWT.NONE);
+ Composite composite = new Composite(parent, SWT.NONE);
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
composite.setLayout(new GridLayout(1, false));
@@ -96,7 +96,7 @@ public class WorkingSetPropertyPage extends WizardPropertyPage {
*/
@Override
protected void applyChanges() {
- //Wizard does all the work
+ // Wizard does all the work
}
/**
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/WorkingSetSettingsTransfer.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/WorkingSetSettingsTransfer.java
index 00e2196453b..09759d0a52d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/WorkingSetSettingsTransfer.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/WorkingSetSettingsTransfer.java
@@ -48,14 +48,12 @@ public class WorkingSetSettingsTransfer extends WorkbenchSettingsTransfer {
if (dataLocation == null)
return noWorkingSettingsStatus();
- dataLocation = dataLocation
- .append(WorkingSetManager.WORKING_SET_STATE_FILENAME);
+ dataLocation = dataLocation.append(WorkingSetManager.WORKING_SET_STATE_FILENAME);
File stateFile = new File(dataLocation.toOSString());
try {
- IWorkingSetManager manager = PlatformUI.getWorkbench()
- .getWorkingSetManager();
+ IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager();
if (manager instanceof AbstractWorkingSetManager)
((AbstractWorkingSetManager) manager).saveState(stateFile);
else
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/AbstractProgressViewer.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/AbstractProgressViewer.java
index 08111da2f3b..f04f2a83975 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/AbstractProgressViewer.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/AbstractProgressViewer.java
@@ -24,12 +24,14 @@ public abstract class AbstractProgressViewer extends StructuredViewer {
/**
* Add the elements to the receiver.
+ *
* @param elements
*/
public abstract void add(JobTreeElement... elements);
/**
* Remove the elements from the receiver.
+ *
* @param elements
*/
public abstract void remove(JobTreeElement... elements);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/AnimationItem.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/AnimationItem.java
index bb64b9c28a3..2c457ce7121 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/AnimationItem.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/AnimationItem.java
@@ -28,128 +28,126 @@ import org.eclipse.ui.IWorkbenchWindow;
public abstract class AnimationItem {
IWorkbenchWindow window;
- interface IAnimationContainer {
- /**
- * The animation has started.
- */
- void animationStart();
-
- /**
- * The animation has ended.
- */
- void animationDone();
- }
-
- //Create a containter that does nothing by default
- IAnimationContainer animationContainer = new IAnimationContainer() {
- @Override
+ interface IAnimationContainer {
+ /**
+ * The animation has started.
+ */
+ void animationStart();
+
+ /**
+ * The animation has ended.
+ */
+ void animationDone();
+ }
+
+ // Create a containter that does nothing by default
+ IAnimationContainer animationContainer = new IAnimationContainer() {
+ @Override
public void animationDone() {
- //Do nothing by default
- }
+ // Do nothing by default
+ }
- @Override
+ @Override
public void animationStart() {
- //Do nothing by default
- }
- };
-
- /**
- * Create a new instance of the receiver.
- *
- * @param workbenchWindow
- * the window being created
- */
+ // Do nothing by default
+ }
+ };
+
+ /**
+ * Create a new instance of the receiver.
+ *
+ * @param workbenchWindow the window being created
+ */
public AnimationItem(IWorkbenchWindow workbenchWindow) {
- this.window = workbenchWindow;
- }
+ this.window = workbenchWindow;
+ }
- /**
- * Create the canvas that will display the image.
- *
- * @param parent
- */
- public void createControl(Composite parent) {
+ /**
+ * Create the canvas that will display the image.
+ *
+ * @param parent
+ */
+ public void createControl(Composite parent) {
- Control animationItem = createAnimationItem(parent);
+ Control animationItem = createAnimationItem(parent);
- animationItem.addMouseListener(new MouseListener() {
- @Override
+ animationItem.addMouseListener(new MouseListener() {
+ @Override
public void mouseDoubleClick(MouseEvent arg0) {
- ProgressManagerUtil.openProgressView(AnimationItem.this.window);
- }
+ ProgressManagerUtil.openProgressView(AnimationItem.this.window);
+ }
- @Override
+ @Override
public void mouseDown(MouseEvent arg0) {
- //Do nothing
- }
+ // Do nothing
+ }
- @Override
+ @Override
public void mouseUp(MouseEvent arg0) {
- //Do nothing
- }
- });
- animationItem.addDisposeListener(e -> AnimationManager.getInstance().removeItem(AnimationItem.this));
- AnimationManager.getInstance().addItem(this);
- }
-
- /**
- * Create the animation item control.
- * @param parent the parent Composite
- * @return Control
- */
- protected abstract Control createAnimationItem(Composite parent);
-
- /**
- * Paint the image in the canvas.
- *
- * @param event
- * The PaintEvent that generated this call.
- * @param image
- * The image to display
- * @param imageData
- * The array of ImageData. Required to show an animation.
- */
- void paintImage(PaintEvent event, Image image, ImageData imageData) {
- event.gc.drawImage(image, 0, 0);
- }
-
- /**
- * Get the SWT control for the receiver.
- *
- * @return Control
- */
- public abstract Control getControl();
-
- /**
- * The animation has begun.
- */
- void animationStart() {
- animationContainer.animationStart();
- }
-
- /**
- * The animation has ended.
- */
- void animationDone() {
- animationContainer.animationDone();
- }
-
- /**
- * Get the preferred width of the receiver.
- *
- * @return int
- */
- public int getPreferredWidth() {
- return AnimationManager.getInstance().getPreferredWidth() + 5;
- }
-
- /**
- * Set the container that will be updated when this runs.
- * @param container The animationContainer to set.
- */
- void setAnimationContainer(IAnimationContainer container) {
- this.animationContainer = container;
- }
+ // Do nothing
+ }
+ });
+ animationItem.addDisposeListener(e -> AnimationManager.getInstance().removeItem(AnimationItem.this));
+ AnimationManager.getInstance().addItem(this);
+ }
+
+ /**
+ * Create the animation item control.
+ *
+ * @param parent the parent Composite
+ * @return Control
+ */
+ protected abstract Control createAnimationItem(Composite parent);
+
+ /**
+ * Paint the image in the canvas.
+ *
+ * @param event The PaintEvent that generated this call.
+ * @param image The image to display
+ * @param imageData The array of ImageData. Required to show an animation.
+ */
+ void paintImage(PaintEvent event, Image image, ImageData imageData) {
+ event.gc.drawImage(image, 0, 0);
+ }
+
+ /**
+ * Get the SWT control for the receiver.
+ *
+ * @return Control
+ */
+ public abstract Control getControl();
+
+ /**
+ * The animation has begun.
+ */
+ void animationStart() {
+ animationContainer.animationStart();
+ }
+
+ /**
+ * The animation has ended.
+ */
+ void animationDone() {
+ animationContainer.animationDone();
+ }
+
+ /**
+ * Get the preferred width of the receiver.
+ *
+ * @return int
+ */
+ public int getPreferredWidth() {
+ return AnimationManager.getInstance().getPreferredWidth() + 5;
+ }
+
+ /**
+ * Set the container that will be updated when this runs.
+ *
+ * @param container The animationContainer to set.
+ */
+ void setAnimationContainer(IAnimationContainer container) {
+ this.animationContainer = container;
+ }
/**
* @return Returns the window.
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/AnimationManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/AnimationManager.java
index 28d3d28d1b1..ee2546add40 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/AnimationManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/AnimationManager.java
@@ -29,198 +29,195 @@ import org.eclipse.ui.progress.WorkbenchJob;
* update.
*/
public class AnimationManager {
- private static AnimationManager singleton;
+ private static AnimationManager singleton;
- boolean animated = false;
+ boolean animated = false;
- private IJobProgressManagerListener listener;
+ private IJobProgressManagerListener listener;
- IAnimationProcessor animationProcessor;
+ IAnimationProcessor animationProcessor;
- WorkbenchJob animationUpdateJob;
+ WorkbenchJob animationUpdateJob;
- public static AnimationManager getInstance() {
- if (singleton == null) {
+ public static AnimationManager getInstance() {
+ if (singleton == null) {
singleton = new AnimationManager();
}
- return singleton;
- }
+ return singleton;
+ }
- /**
- * Get the background color to be used.
- *
- * @param control
- * The source of the display.
- * @return Color
- */
- static Color getItemBackgroundColor(Control control) {
- return control.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND);
- }
+ /**
+ * Get the background color to be used.
+ *
+ * @param control The source of the display.
+ * @return Color
+ */
+ static Color getItemBackgroundColor(Control control) {
+ return control.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND);
+ }
- AnimationManager() {
+ AnimationManager() {
- animationProcessor = new ProgressAnimationProcessor(this);
+ animationProcessor = new ProgressAnimationProcessor(this);
- animationUpdateJob = new WorkbenchJob(ProgressMessages.AnimationManager_AnimationStart) {
+ animationUpdateJob = new WorkbenchJob(ProgressMessages.AnimationManager_AnimationStart) {
- @Override
+ @Override
public IStatus runInUIThread(IProgressMonitor monitor) {
- if (animated) {
+ if (animated) {
animationProcessor.animationStarted();
} else {
animationProcessor.animationFinished();
}
- return Status.OK_STATUS;
- }
- };
- animationUpdateJob.setSystem(true);
-
- listener = getProgressListener();
- ProgressManager.getInstance().addListener(listener);
-
-
- }
-
- /**
- * Add an item to the list
- *
- * @param item
- */
- void addItem(final AnimationItem item) {
- animationProcessor.addItem(item);
- }
-
- /**
- * Remove an item from the list
- *
- * @param item
- */
- void removeItem(final AnimationItem item) {
- animationProcessor.removeItem(item);
- }
-
- /**
- * Return whether or not the current state is animated.
- *
- * @return boolean
- */
- boolean isAnimated() {
- return animated;
- }
-
- /**
+ return Status.OK_STATUS;
+ }
+ };
+ animationUpdateJob.setSystem(true);
+
+ listener = getProgressListener();
+ ProgressManager.getInstance().addListener(listener);
+
+ }
+
+ /**
+ * Add an item to the list
+ *
+ * @param item
+ */
+ void addItem(final AnimationItem item) {
+ animationProcessor.addItem(item);
+ }
+
+ /**
+ * Remove an item from the list
+ *
+ * @param item
+ */
+ void removeItem(final AnimationItem item) {
+ animationProcessor.removeItem(item);
+ }
+
+ /**
+ * Return whether or not the current state is animated.
+ *
+ * @return boolean
+ */
+ boolean isAnimated() {
+ return animated;
+ }
+
+ /**
* Set whether or not the receiver is animated.
*
* @param bool
*/
- void setAnimated(final boolean bool) {
- animated = bool;
- animationUpdateJob.schedule(100);
- }
-
- /**
- * Dispose the images in the receiver.
- */
- void dispose() {
- setAnimated(false);
- ProgressManager.getInstance().removeListener(listener);
- }
-
- private IJobProgressManagerListener getProgressListener() {
- return new IJobProgressManagerListener() {
+ void setAnimated(final boolean bool) {
+ animated = bool;
+ animationUpdateJob.schedule(100);
+ }
+
+ /**
+ * Dispose the images in the receiver.
+ */
+ void dispose() {
+ setAnimated(false);
+ ProgressManager.getInstance().removeListener(listener);
+ }
+
+ private IJobProgressManagerListener getProgressListener() {
+ return new IJobProgressManagerListener() {
Set<Job> jobs = new HashSet<>();
- @Override
+ @Override
public void addJob(JobInfo info) {
- incrementJobCount(info);
- }
+ incrementJobCount(info);
+ }
- @Override
+ @Override
public void refreshJobInfo(JobInfo info) {
- int state = info.getJob().getState();
- if (state == Job.RUNNING) {
+ int state = info.getJob().getState();
+ if (state == Job.RUNNING) {
addJob(info);
} else {
removeJob(info);
}
- }
+ }
- @Override
+ @Override
public void refreshAll() {
- ProgressManager manager = ProgressManager.getInstance();
- jobs.clear();
- setAnimated(false);
+ ProgressManager manager = ProgressManager.getInstance();
+ jobs.clear();
+ setAnimated(false);
for (JobInfo currentInfo : manager.getJobInfos(showsDebug())) {
- addJob(currentInfo);
- }
- }
+ addJob(currentInfo);
+ }
+ }
- @Override
+ @Override
public void removeJob(JobInfo info) {
- decrementJobCount(info.getJob());
- }
+ decrementJobCount(info.getJob());
+ }
- @Override
+ @Override
public boolean showsDebug() {
- return false;
- }
+ return false;
+ }
- private void incrementJobCount(JobInfo info) {
- //Don't count the animate job itself
- if (isNotTracked(info)) {
+ private void incrementJobCount(JobInfo info) {
+ // Don't count the animate job itself
+ if (isNotTracked(info)) {
return;
}
- if (jobs.isEmpty()) {
+ if (jobs.isEmpty()) {
setAnimated(true);
}
- jobs.add(info.getJob());
- }
-
- /*
- * Decrement the job count for the job
- */
- private void decrementJobCount(Job job) {
- jobs.remove(job);
- if (jobs.isEmpty()) {
+ jobs.add(info.getJob());
+ }
+
+ /*
+ * Decrement the job count for the job
+ */
+ private void decrementJobCount(Job job) {
+ jobs.remove(job);
+ if (jobs.isEmpty()) {
setAnimated(false);
}
- }
-
- /**
- * If this is one of our jobs or not running then don't bother.
- */
- private boolean isNotTracked(JobInfo info) {
- //We always track errors
- Job job = info.getJob();
- return job.getState() != Job.RUNNING
- || animationProcessor.isProcessorJob(job);
- }
-
- @Override
+ }
+
+ /**
+ * If this is one of our jobs or not running then don't bother.
+ */
+ private boolean isNotTracked(JobInfo info) {
+ // We always track errors
+ Job job = info.getJob();
+ return job.getState() != Job.RUNNING || animationProcessor.isProcessorJob(job);
+ }
+
+ @Override
public void addGroup(GroupInfo info) {
- //Don't care about groups
- }
+ // Don't care about groups
+ }
- @Override
+ @Override
public void removeGroup(GroupInfo group) {
- //Don't care about groups
- }
+ // Don't care about groups
+ }
- @Override
+ @Override
public void refreshGroup(GroupInfo info) {
- //Don't care about groups
- }
- };
- }
-
- /**
- * Get the preferred width for widgets displaying the animation.
- *
- * @return int. Return 0 if there is no image data.
- */
- int getPreferredWidth() {
- return animationProcessor.getPreferredWidth();
- }
+ // Don't care about groups
+ }
+ };
+ }
+
+ /**
+ * Get the preferred width for widgets displaying the animation.
+ *
+ * @return int. Return 0 if there is no image data.
+ */
+ int getPreferredWidth() {
+ return animationProcessor.getPreferredWidth();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/BlockedJobsDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/BlockedJobsDialog.java
index d4befd4b5d3..616dcfd95f2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/BlockedJobsDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/BlockedJobsDialog.java
@@ -38,8 +38,8 @@ import org.eclipse.ui.progress.WorkbenchJob;
public class BlockedJobsDialog extends IconAndMessageDialog {
/**
* The singleton dialog instance. A singleton avoids the possibility of
- * recursive dialogs being created. The singleton is created when a dialog
- * is requested, and cleared when the dialog is disposed.
+ * recursive dialogs being created. The singleton is created when a dialog is
+ * requested, and cleared when the dialog is disposed.
*/
protected static BlockedJobsDialog singleton;
@@ -63,8 +63,8 @@ public class BlockedJobsDialog extends IconAndMessageDialog {
private JobTreeElement blockedElement = new BlockedUIElement();
/**
- * The BlockedUIElement is the JobTreeElement that represents the blocked
- * job in the dialog.
+ * The BlockedUIElement is the JobTreeElement that represents the blocked job in
+ * the dialog.
*/
private class BlockedUIElement extends JobTreeElement {
@Override
@@ -115,25 +115,21 @@ public class BlockedJobsDialog extends IconAndMessageDialog {
* Creates a progress monitor dialog under the given shell. It also sets the
* dialog's message. The dialog is opened automatically after a reasonable
* delay. When no longer needed, the dialog must be closed by calling
- * <code>close(IProgressMonitor)</code>, where the supplied monitor is
- * the same monitor passed to this factory method.
+ * <code>close(IProgressMonitor)</code>, where the supplied monitor is the same
+ * monitor passed to this factory method.
*
- * @param parentShell
- * The parent shell, or <code>null</code> to create a top-level
- * shell. If the parentShell is not null we will open immediately
- * as parenting has been determined. If it is <code>null</code>
- * then the dialog will not open until there is no modal shell
- * blocking it.
- * @param blockedMonitor
- * The monitor that is currently blocked
- * @param reason
- * A status describing why the monitor is blocked
- * @param taskName
- * A name to give the blocking task in the dialog
+ * @param parentShell The parent shell, or <code>null</code> to create a
+ * top-level shell. If the parentShell is not null we will
+ * open immediately as parenting has been determined. If
+ * it is <code>null</code> then the dialog will not open
+ * until there is no modal shell blocking it.
+ * @param blockedMonitor The monitor that is currently blocked
+ * @param reason A status describing why the monitor is blocked
+ * @param taskName A name to give the blocking task in the dialog
* @return BlockedJobsDialog
*/
- public static BlockedJobsDialog createBlockedDialog(Shell parentShell,
- IProgressMonitor blockedMonitor, IStatus reason, String taskName) {
+ public static BlockedJobsDialog createBlockedDialog(Shell parentShell, IProgressMonitor blockedMonitor,
+ IStatus reason, String taskName) {
// Use an existing dialog if available.
if (singleton != null) {
return singleton;
@@ -147,13 +143,12 @@ public class BlockedJobsDialog extends IconAndMessageDialog {
}
/**
- * If there is no parent shell we have not been asked for a parent so we
- * want to avoid blocking. If there is a parent then it is OK to open.
+ * If there is no parent shell we have not been asked for a parent so we want to
+ * avoid blocking. If there is a parent then it is OK to open.
*/
if (parentShell == null) {
// Create the job that will open the dialog after a delay.
- WorkbenchJob dialogJob = new WorkbenchJob(
- WorkbenchMessages.EventLoopProgressMonitor_OpenDialogJobName) {
+ WorkbenchJob dialogJob = new WorkbenchJob(WorkbenchMessages.EventLoopProgressMonitor_OpenDialogJobName) {
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
if (singleton == null) {
@@ -169,8 +164,7 @@ public class BlockedJobsDialog extends IconAndMessageDialog {
// Wait for long operation time to prevent a proliferation of
// dialogs.
dialogJob.setSystem(true);
- dialogJob.schedule(PlatformUI.getWorkbench().getProgressService()
- .getLongOperationTime());
+ dialogJob.schedule(PlatformUI.getWorkbench().getProgressService().getLongOperationTime());
} else {
singleton.open();
}
@@ -181,8 +175,7 @@ public class BlockedJobsDialog extends IconAndMessageDialog {
/**
* The monitor is done. Clear the receiver.
*
- * @param monitor
- * The monitor that is now cleared.
+ * @param monitor The monitor that is now cleared.
*/
public static void clear(IProgressMonitor monitor) {
if (singleton != null)
@@ -193,21 +186,15 @@ public class BlockedJobsDialog extends IconAndMessageDialog {
* Creates a progress monitor dialog under the given shell. It also sets the
* dialog's\ message. <code>open</code> is non-blocking.
*
- * @param parentShell
- * The parent shell, or <code>null</code> to create a top-level
- * shell.
- * @param blocking
- * The monitor that is blocking the job
- * @param blockingStatus
- * A status describing why the monitor is blocked
+ * @param parentShell The parent shell, or <code>null</code> to create a
+ * top-level shell.
+ * @param blocking The monitor that is blocking the job
+ * @param blockingStatus A status describing why the monitor is blocked
*/
- private BlockedJobsDialog(Shell parentShell, IProgressMonitor blocking,
- IStatus blockingStatus) {
- super(parentShell == null ? ProgressManagerUtil.getDefaultParent()
- : parentShell);
+ private BlockedJobsDialog(Shell parentShell, IProgressMonitor blocking, IStatus blockingStatus) {
+ super(parentShell == null ? ProgressManagerUtil.getDefaultParent() : parentShell);
blockingMonitor = blocking;
- setShellStyle(SWT.BORDER | SWT.TITLE | SWT.APPLICATION_MODAL
- | SWT.RESIZE | SWT.MAX | getDefaultOrientation());
+ setShellStyle(SWT.BORDER | SWT.TITLE | SWT.APPLICATION_MODAL | SWT.RESIZE | SWT.MAX | getDefaultOrientation());
// no close button
setBlockOnOpen(false);
setMessage(blockingStatus.getMessage());
@@ -216,8 +203,7 @@ public class BlockedJobsDialog extends IconAndMessageDialog {
/**
* Creates the dialog area under the parent composite.
*
- * @param parent
- * The parent Composite.
+ * @param parent The parent Composite.
*
* @return parent The parent Composite.
*/
@@ -230,11 +216,10 @@ public class BlockedJobsDialog extends IconAndMessageDialog {
}
/**
- * Creates a dialog area in the parent composite and displays a progress
- * tree viewer of the running jobs.
+ * Creates a dialog area in the parent composite and displays a progress tree
+ * viewer of the running jobs.
*
- * @param parent
- * The parent Composite.
+ * @param parent The parent Composite.
*/
void showJobDetails(Composite parent) {
viewer = new DetailedProgressViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
@@ -249,8 +234,7 @@ public class BlockedJobsDialog extends IconAndMessageDialog {
viewer.setContentProvider(provider);
viewer.setInput(provider);
viewer.setLabelProvider(new ProgressLabelProvider());
- GridData data = new GridData(GridData.GRAB_HORIZONTAL
- | GridData.GRAB_VERTICAL | GridData.FILL_BOTH);
+ GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH);
data.horizontalSpan = 2;
int heightHint = convertHeightInCharsToPixels(10);
data.heightHint = heightHint;
@@ -304,8 +288,7 @@ public class BlockedJobsDialog extends IconAndMessageDialog {
/**
* This method sets the message in the message label.
*
- * @param messageString
- * the String for the message area
+ * @param messageString the String for the message area
*/
private void setMessage(String messageString) {
// must not set null text in a label
@@ -332,8 +315,8 @@ public class BlockedJobsDialog extends IconAndMessageDialog {
}
/**
- * Requests that the blocked jobs dialog be closed. The supplied monitor
- * must be the same one that was passed to the createBlockedDialog method.
+ * Requests that the blocked jobs dialog be closed. The supplied monitor must be
+ * the same one that was passed to the createBlockedDialog method.
*
* @param monitor
* @return IProgressMonitor
@@ -361,8 +344,7 @@ public class BlockedJobsDialog extends IconAndMessageDialog {
}
/**
- * @param taskName
- * The blockedTaskName to set.
+ * @param taskName The blockedTaskName to set.
*/
void setBlockedTaskName(String taskName) {
this.blockedTaskName = taskName;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/DetailedProgressViewer.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/DetailedProgressViewer.java
index e173c56a351..27d4ef5bdf9 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/DetailedProgressViewer.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/DetailedProgressViewer.java
@@ -50,7 +50,8 @@ import org.eclipse.ui.internal.WorkbenchPlugin;
*/
public class DetailedProgressViewer extends AbstractProgressViewer {
- //Maximum number of entries to display so that the view does not flood the UI with events
+ // Maximum number of entries to display so that the view does not flood the UI
+ // with events
private int maxDisplayed;
Composite control;
@@ -68,8 +69,7 @@ public class DetailedProgressViewer extends AbstractProgressViewer {
*/
public DetailedProgressViewer(Composite parent, int style) {
scrolled = new ScrolledComposite(parent, SWT.V_SCROLL | style);
- int height = JFaceResources.getDefaultFont().getFontData()[0]
- .getHeight();
+ int height = JFaceResources.getDefaultFont().getFontData()[0].getHeight();
scrolled.getVerticalBar().setIncrement(height * 2);
scrolled.setExpandHorizontal(true);
scrolled.setExpandVertical(true);
@@ -79,8 +79,7 @@ public class DetailedProgressViewer extends AbstractProgressViewer {
layout.marginHeight = 0;
layout.marginWidth = 0;
control.setLayout(layout);
- control.setBackground(parent.getDisplay().getSystemColor(
- SWT.COLOR_LIST_BACKGROUND));
+ control.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
control.addFocusListener(new FocusAdapter() {
@@ -111,26 +110,22 @@ public class DetailedProgressViewer extends AbstractProgressViewer {
}
});
- PlatformUI.getWorkbench().getHelpSystem().setHelp(control,
- IWorkbenchHelpContextIds.RESPONSIVE_UI);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(control, IWorkbenchHelpContextIds.RESPONSIVE_UI);
scrolled.setContent(control);
hookControl(control);
noEntryArea = new Composite(scrolled, SWT.NONE);
noEntryArea.setLayout(new GridLayout());
- noEntryArea.setBackground(noEntryArea.getDisplay()
- .getSystemColor(SWT.COLOR_LIST_BACKGROUND));
+ noEntryArea.setBackground(noEntryArea.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
Label noEntryLabel = new Label(noEntryArea, SWT.NONE);
noEntryLabel.setText(ProgressMessages.ProgressView_NoOperations);
- noEntryLabel.setBackground(noEntryArea.getDisplay().getSystemColor(
- SWT.COLOR_LIST_BACKGROUND));
+ noEntryLabel.setBackground(noEntryArea.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
GridData textData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
noEntryLabel.setLayoutData(textData);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(noEntryLabel,
- IWorkbenchHelpContextIds.RESPONSIVE_UI);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(noEntryLabel, IWorkbenchHelpContextIds.RESPONSIVE_UI);
IPreferenceStore prefs = WorkbenchPlugin.getDefault().getPreferenceStore();
updateMaxDisplayedValue(prefs);
@@ -144,7 +139,7 @@ public class DetailedProgressViewer extends AbstractProgressViewer {
return;
}
updateMaxDisplayedValue(WorkbenchPlugin.getDefault().getPreferenceStore());
- }
+ }
private void updateMaxDisplayedValue(IPreferenceStore prefs) {
int newValue = Math.max(1, prefs.getInt(IPreferenceConstants.MAX_PROGRESS_ENTRIES));
@@ -214,8 +209,7 @@ public class DetailedProgressViewer extends AbstractProgressViewer {
* @return ProgressInfoItem
*/
private ProgressInfoItem createNewItem(JobTreeElement info) {
- final ProgressInfoItem item = new ProgressInfoItem(control, SWT.NONE,
- info);
+ final ProgressInfoItem item = new ProgressInfoItem(control, SWT.NONE, info);
item.addControlListener(new ControlListener() {
@Override
@@ -315,8 +309,7 @@ public class DetailedProgressViewer extends AbstractProgressViewer {
@Override
protected Widget doFindItem(Object element) {
for (Control control : control.getChildren()) {
- if (control.isDisposed()
- || control.getData() == null) {
+ if (control.isDisposed() || control.getData() == null) {
continue;
}
if (control.getData().equals(element)) {
@@ -432,7 +425,7 @@ public class DetailedProgressViewer extends AbstractProgressViewer {
public void setFocus() {
Control[] children = control.getChildren();
if (children.length > 0) {
- ((ProgressInfoItem)children[0]).setButtonFocus();
+ ((ProgressInfoItem) children[0]).setButtonFocus();
} else {
noEntryArea.setFocus();
}
@@ -461,8 +454,7 @@ public class DetailedProgressViewer extends AbstractProgressViewer {
}
/**
- * Set the virtual items to be visible or not depending on the displayed
- * area.
+ * Set the virtual items to be visible or not depending on the displayed area.
*/
private void updateVisibleItems() {
updateVisibleProgressItems(control.getChildren());
@@ -502,8 +494,7 @@ public class DetailedProgressViewer extends AbstractProgressViewer {
}
/**
- * @param maxDisplayed
- * The maximal number of displayed items.
+ * @param maxDisplayed The maximal number of displayed items.
*/
public void setMaxDisplayed(int maxDisplayed) {
this.maxDisplayed = maxDisplayed;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/FinishedJobs.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/FinishedJobs.java
index 378294ec347..72a4b1c5c61 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/FinishedJobs.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/FinishedJobs.java
@@ -207,8 +207,7 @@ public final class FinishedJobs extends EventManager {
JobInfo ji = (JobInfo) jte;
Job job = ji.getJob();
if (job != null) {
- Object prop = job
- .getProperty(IProgressConstants.ACTION_PROPERTY);
+ Object prop = job.getProperty(IProgressConstants.ACTION_PROPERTY);
if (prop instanceof ActionFactory.IWorkbenchAction) {
((ActionFactory.IWorkbenchAction) prop).dispose();
}
@@ -231,8 +230,7 @@ public final class FinishedJobs extends EventManager {
for (JobTreeElement jobTreeElement : all) {
if (jobTreeElement != info && jobTreeElement.isJobInfo()) {
Job job = ((JobInfo) jobTreeElement).getJob();
- if (job != null && job != myJob
- && job.belongsTo(myJob)) {
+ if (job != null && job != myJob && job.belongsTo(myJob)) {
if (found == null) {
found = new ArrayList<>();
}
@@ -241,8 +239,7 @@ public final class FinishedJobs extends EventManager {
}
}
if (found != null) {
- return found
- .toArray(new JobTreeElement[found.size()]);
+ return found.toArray(new JobTreeElement[found.size()]);
}
}
}
@@ -288,8 +285,7 @@ public final class FinishedJobs extends EventManager {
if (job != null) {
IStatus status = job.getResult();
if (status != null && status.getSeverity() == IStatus.ERROR) {
- JobTreeElement topElement = info1
- .getParent();
+ JobTreeElement topElement = info1.getParent();
if (topElement == null) {
topElement = info1;
}
@@ -346,8 +342,7 @@ public final class FinishedJobs extends EventManager {
}
synchronized (keptjobinfos) {
- all = keptjobinfos
- .toArray(new JobTreeElement[keptjobinfos.size()]);
+ all = keptjobinfos.toArray(new JobTreeElement[keptjobinfos.size()]);
}
return all;
@@ -382,8 +377,7 @@ public final class FinishedJobs extends EventManager {
*/
public void clearAll() {
synchronized (keptjobinfos) {
- JobTreeElement[] all = keptjobinfos
- .toArray(new JobTreeElement[keptjobinfos.size()]);
+ JobTreeElement[] all = keptjobinfos.toArray(new JobTreeElement[keptjobinfos.size()]);
for (JobTreeElement jobTreeElement : all) {
disposeAction(jobTreeElement);
}
@@ -400,6 +394,7 @@ public final class FinishedJobs extends EventManager {
/**
* Return the set of kept jobs.
+ *
* @return Set
*/
Set<JobTreeElement> getKeptAsSet() {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/GroupInfo.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/GroupInfo.java
index a9d26db092b..db7239af29b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/GroupInfo.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/GroupInfo.java
@@ -95,8 +95,8 @@ class GroupInfo extends JobTreeElement implements IProgressMonitor {
}
/**
- * Updates the receiver in the progress manager. If all of the jobs are
- * finished and the receiver is not being kept then remove it.
+ * Updates the receiver in the progress manager. If all of the jobs are finished
+ * and the receiver is not being kept then remove it.
*/
private void updateInProgressManager() {
for (JobInfo info : infos) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/IAnimationProcessor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/IAnimationProcessor.java
index 1b4b1518a12..20832512f28 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/IAnimationProcessor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/IAnimationProcessor.java
@@ -16,55 +16,56 @@ package org.eclipse.ui.internal.progress;
import org.eclipse.core.runtime.jobs.Job;
/**
- * The IAnimationProcessor is the class that handles the animation of
- * the animation item.
+ * The IAnimationProcessor is the class that handles the animation of the
+ * animation item.
*/
interface IAnimationProcessor {
- /**
- * Add an item to the list of the items we are updating.
- * @param item
- */
- void addItem(AnimationItem item);
+ /**
+ * Add an item to the list of the items we are updating.
+ *
+ * @param item
+ */
+ void addItem(AnimationItem item);
- /**
- * Remove an item from the list of the items we are updating.
- * @param item
- */
- void removeItem(AnimationItem item);
+ /**
+ * Remove an item from the list of the items we are updating.
+ *
+ * @param item
+ */
+ void removeItem(AnimationItem item);
- /**
+ /**
* Return whether or not the receiver has any items.
*
* @return true if there are items
*/
- boolean hasItems();
+ boolean hasItems();
- /**
- * Animation has begun. Inform any listeners. This is called
- * from the UI Thread.
- */
- void animationStarted();
+ /**
+ * Animation has begun. Inform any listeners. This is called from the UI Thread.
+ */
+ void animationStarted();
- /**
- * Animation has finished. Inform any listeners. This is called
- * from the UI Thread.
- */
- void animationFinished();
+ /**
+ * Animation has finished. Inform any listeners. This is called from the UI
+ * Thread.
+ */
+ void animationFinished();
- /**
+ /**
* Get the preferred width of the types of items this processor manages.
*
* @return preferred width
*/
- int getPreferredWidth();
+ int getPreferredWidth();
- /**
+ /**
* Return whether or not this is a job used by the processor.
*
* @param job
* @return true if this job is used by the processor
*/
- boolean isProcessorJob(Job job);
+ boolean isProcessorJob(Job job);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/IJobBusyListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/IJobBusyListener.java
index bbee0d12e82..febaa71d627 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/IJobBusyListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/IJobBusyListener.java
@@ -17,21 +17,23 @@ package org.eclipse.ui.internal.progress;
import org.eclipse.core.runtime.jobs.Job;
/**
- * The IJobBusyListener is used to listen for running and
- * terminating of jobs of a particular family.
+ * The IJobBusyListener is used to listen for running and terminating of jobs of
+ * a particular family.
*/
interface IJobBusyListener {
- /**
- * Increment the busy count for job.
- * @param job
- */
- void incrementBusy(Job job);
+ /**
+ * Increment the busy count for job.
+ *
+ * @param job
+ */
+ void incrementBusy(Job job);
- /**
- * Decrement the busy count for job.
- * @param job
- */
- void decrementBusy(Job job);
+ /**
+ * Decrement the busy count for job.
+ *
+ * @param job
+ */
+ void decrementBusy(Job job);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/IJobProgressManagerListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/IJobProgressManagerListener.java
index 55c1970ea9a..700ef7657cd 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/IJobProgressManagerListener.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/IJobProgressManagerListener.java
@@ -14,56 +14,64 @@
package org.eclipse.ui.internal.progress;
/**
- * The IJobProgressManagerListener is a class that listeners to the JobProgressManager.
+ * The IJobProgressManagerListener is a class that listeners to the
+ * JobProgressManager.
*/
interface IJobProgressManagerListener {
- /**
- * Refresh the viewer as a result of an addition of info.
- * @param info
- */
- void addJob(final JobInfo info);
+ /**
+ * Refresh the viewer as a result of an addition of info.
+ *
+ * @param info
+ */
+ void addJob(final JobInfo info);
- /**
- * Refresh the viewer as a result of an addition of group.
- * @param info
- */
- void addGroup(final GroupInfo info);
+ /**
+ * Refresh the viewer as a result of an addition of group.
+ *
+ * @param info
+ */
+ void addGroup(final GroupInfo info);
- /**
- * Refresh the IJobProgressManagerListeners as a result of a change in info.
- * @param info
- */
- void refreshJobInfo(JobInfo info);
+ /**
+ * Refresh the IJobProgressManagerListeners as a result of a change in info.
+ *
+ * @param info
+ */
+ void refreshJobInfo(JobInfo info);
- /**
- * Refresh the IJobProgressManagerListeners as a result of a change in groups.
- * @param info
- */
- void refreshGroup(GroupInfo info);
+ /**
+ * Refresh the IJobProgressManagerListeners as a result of a change in groups.
+ *
+ * @param info
+ */
+ void refreshGroup(GroupInfo info);
- /**
- * Refresh the viewer for all jobs.
- * @param info
- */
- void refreshAll();
+ /**
+ * Refresh the viewer for all jobs.
+ *
+ * @param info
+ */
+ void refreshAll();
- /**
- * Refresh the viewer as a result of a removal of info.
- * @param info
- */
- void removeJob(final JobInfo info);
+ /**
+ * Refresh the viewer as a result of a removal of info.
+ *
+ * @param info
+ */
+ void removeJob(final JobInfo info);
- /**
+ /**
* Refresh the viewer as a result of a removal of group.
*
* @param group
*/
- void removeGroup(final GroupInfo group);
+ void removeGroup(final GroupInfo group);
- /**
- * Return whether or not this listener shows debug information.
- * @return boolean
- */
- boolean showsDebug();
+ /**
+ * Return whether or not this listener shows debug information.
+ *
+ * @return boolean
+ */
+ boolean showsDebug();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/IProgressUpdateCollector.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/IProgressUpdateCollector.java
index 88594c2fa11..598cf876df6 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/IProgressUpdateCollector.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/IProgressUpdateCollector.java
@@ -14,33 +14,36 @@
package org.eclipse.ui.internal.progress;
/**
- * The IProgressUpdateCollector is the interface that content providers
- * conform to in order that the ProgressViewUpdater can talk to various
- * types of content provider.
+ * The IProgressUpdateCollector is the interface that content providers conform
+ * to in order that the ProgressViewUpdater can talk to various types of content
+ * provider.
*/
public interface IProgressUpdateCollector {
- /**
- * Refresh the viewer.
- */
- void refresh();
+ /**
+ * Refresh the viewer.
+ */
+ void refresh();
- /**
- * Refresh the elements.
- * @param elements
- */
+ /**
+ * Refresh the elements.
+ *
+ * @param elements
+ */
void refresh(JobTreeElement... elements);
- /**
- * Add the elements.
- * @param elements Array of JobTreeElement
- */
+ /**
+ * Add the elements.
+ *
+ * @param elements Array of JobTreeElement
+ */
void add(JobTreeElement... elements);
- /**
- * Remove the elements.
- * @param elements Array of JobTreeElement
- */
+ /**
+ * Remove the elements.
+ *
+ * @param elements Array of JobTreeElement
+ */
void remove(JobTreeElement... elements);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/JobInfo.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/JobInfo.java
index 9e858307572..01533e5ff39 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/JobInfo.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/JobInfo.java
@@ -29,140 +29,138 @@ import org.eclipse.swt.graphics.Image;
* display job status in a tree.
*/
public class JobInfo extends JobTreeElement {
- private IStatus blockedStatus;
+ private IStatus blockedStatus;
private volatile boolean canceled;
private final Queue<JobTreeElement> children = new ConcurrentLinkedQueue<>();
private final Job job;
- private GroupInfo parent;
+ private GroupInfo parent;
- private TaskInfo taskInfo;
+ private TaskInfo taskInfo;
// Default to no progress.
- private int ticks = -1;
+ private int ticks = -1;
- /**
+ /**
* Creates a top level JobInfo.
*
* @param enclosingJob
*/
protected JobInfo(Job enclosingJob) {
- this.job = enclosingJob;
- }
+ this.job = enclosingJob;
+ }
- /**
+ /**
* Adds the subtask to the receiver.
*
* @param subTaskName
*/
- void addSubTask(String subTaskName) {
- children.add(new SubTaskInfo(this, subTaskName));
- }
+ void addSubTask(String subTaskName) {
+ children.add(new SubTaskInfo(this, subTaskName));
+ }
- /**
+ /**
* Adds the amount of work to the job info.
*
* @param workIncrement
*/
- void addWork(double workIncrement) {
- if (taskInfo == null) {
+ void addWork(double workIncrement) {
+ if (taskInfo == null) {
return;
}
- if (parent == null || ticks < 1) {
+ if (parent == null || ticks < 1) {
taskInfo.addWork(workIncrement);
} else {
taskInfo.addWork(workIncrement, parent, ticks);
}
- }
+ }
- /**
+ /**
* Begins the task called taskName with the supplied work.
*
* @param taskName
* @param work
*/
- void beginTask(String taskName, int work) {
- taskInfo = new TaskInfo(this, taskName, work);
- }
+ void beginTask(String taskName, int work) {
+ taskInfo = new TaskInfo(this, taskName, work);
+ }
- @Override
+ @Override
public void cancel() {
- this.canceled = true;
- this.job.cancel();
+ this.canceled = true;
+ this.job.cancel();
// Call the refresh so that this is updated immediately.
- ProgressManager.getInstance().refreshJobInfo(this);
- }
+ ProgressManager.getInstance().refreshJobInfo(this);
+ }
- /**
+ /**
* Clears the collection of subtasks an the task info.
*/
- void clearChildren() {
- children.clear();
- }
+ void clearChildren() {
+ children.clear();
+ }
- void clearTaskInfo() {
+ void clearTaskInfo() {
FinishedJobs.getInstance().remove(taskInfo);
- taskInfo = null;
- }
+ taskInfo = null;
+ }
- /**
+ /**
* Compares the job of the receiver to another job.
*
- * @param jobInfo
- * The info we are comparing to
+ * @param jobInfo The info we are comparing to
* @return Returns a negative integer, zero, or a positive integer as this
- * object is less than, equal to, or greater than the specified
- * object.
+ * object is less than, equal to, or greater than the specified object.
*/
- private int compareJobs(JobInfo jobInfo) {
- Job job2 = jobInfo.getJob();
+ private int compareJobs(JobInfo jobInfo) {
+ Job job2 = jobInfo.getJob();
// User jobs have top priority.
- if (job.isUser()) {
- if (!job2.isUser()) {
+ if (job.isUser()) {
+ if (!job2.isUser()) {
return -1;
}
- } else {
- if (job2.isUser()) {
+ } else {
+ if (job2.isUser()) {
return 1;
}
- }
+ }
// Show the blocked ones last.
- if (isBlocked()) {
- if (!jobInfo.isBlocked()) {
+ if (isBlocked()) {
+ if (!jobInfo.isBlocked()) {
return 1;
}
- } else {
- if (jobInfo.isBlocked()) {
+ } else {
+ if (jobInfo.isBlocked()) {
return -1;
}
- }
+ }
- int thisPriority = job.getPriority();
+ int thisPriority = job.getPriority();
int otherPriority = job2.getPriority();
// If equal priority, order by names.
if (thisPriority == otherPriority) {
- return job.getName().compareTo(job2.getName());
- }
+ return job.getName().compareTo(job2.getName());
+ }
// Order by priority.
- if (thisPriority > otherPriority) {
+ if (thisPriority > otherPriority) {
return -1;
}
- return 1;
- }
+ return 1;
+ }
- @Override
+ @Override
public int compareTo(JobTreeElement other) {
if (!(other instanceof JobInfo)) {
return super.compareTo(other);
}
JobInfo element = (JobInfo) other;
- boolean thisCanceled = isCanceled();
+ boolean thisCanceled = isCanceled();
boolean anotherCanceled = element.isCanceled();
if (thisCanceled && !anotherCanceled) {
// If the receiver is cancelled then it is lowest priority.
@@ -181,241 +179,239 @@ public class JobInfo extends JobTreeElement {
// Ordering by job states, Job.RUNNING should be ordered first.
return Integer.compare(anotherState, thisState);
- }
+ }
- /**
+ /**
* Disposes of the receiver.
*/
- void dispose() {
- if (parent != null) {
+ void dispose() {
+ if (parent != null) {
parent.removeJobInfo(this);
}
- }
+ }
- /**
+ /**
* Returns the blocked status or <code>null</code> if there isn't one.
*
* @return the blockedStatus.
*/
- public IStatus getBlockedStatus() {
- return blockedStatus;
- }
+ public IStatus getBlockedStatus() {
+ return blockedStatus;
+ }
- @Override
+ @Override
Object[] getChildren() {
- return children.toArray();
- }
+ return children.toArray();
+ }
- @Override
+ @Override
String getCondensedDisplayString() {
- TaskInfo info = getTaskInfo();
- if (info != null) {
+ TaskInfo info = getTaskInfo();
+ if (info != null) {
return info.getDisplayStringWithoutTask(true);
}
- return getJob().getName();
- }
+ return getJob().getName();
+ }
- @Override
+ @Override
public Image getDisplayImage() {
- int done = getPercentDone();
- if (done > 0) {
- return super.getDisplayImage();
- }
- if (isBlocked()) {
+ int done = getPercentDone();
+ if (done > 0) {
+ return super.getDisplayImage();
+ }
+ if (isBlocked()) {
return JFaceResources.getImage(ProgressManager.BLOCKED_JOB_KEY);
}
- int state = getJob().getState();
- if (state == Job.SLEEPING) {
+ int state = getJob().getState();
+ if (state == Job.SLEEPING) {
return JFaceResources.getImage(ProgressManager.SLEEPING_JOB_KEY);
}
- if (state == Job.WAITING) {
+ if (state == Job.WAITING) {
return JFaceResources.getImage(ProgressManager.WAITING_JOB_KEY);
}
// By default return the first progress image.
- return super.getDisplayImage();
+ return super.getDisplayImage();
+
+ }
- }
- @Override
+ @Override
String getDisplayString() {
- return getDisplayString(true);
- }
+ return getDisplayString(true);
+ }
- @Override
+ @Override
String getDisplayString(boolean showProgress) {
- String name = getDisplayStringWithStatus(showProgress);
- if (job.isSystem()) {
+ String name = getDisplayStringWithStatus(showProgress);
+ if (job.isSystem()) {
return NLS.bind(ProgressMessages.JobInfo_System, (new Object[] { name }));
}
- return name;
- }
+ return name;
+ }
- /**
- * Returns the display string based on the current status and the name of
- * the job.
+ /**
+ * Returns the display string based on the current status and the name of the
+ * job.
*
- * @param showProgress
- * a boolean to indicate if we should show progress or not.
+ * @param showProgress a boolean to indicate if we should show progress or not.
*
* @return String
*/
- private String getDisplayStringWithStatus(boolean showProgress) {
- if (isCanceled()) {
+ private String getDisplayStringWithStatus(boolean showProgress) {
+ if (isCanceled()) {
return NLS.bind(ProgressMessages.JobInfo_Cancelled, (new Object[] { getJob().getName() }));
}
- if (isBlocked()) {
- return NLS.bind(ProgressMessages.JobInfo_Blocked, (new Object[] { getJob().getName(),
- blockedStatus.getMessage() }));
+ if (isBlocked()) {
+ return NLS.bind(ProgressMessages.JobInfo_Blocked,
+ (new Object[] { getJob().getName(), blockedStatus.getMessage() }));
}
- if (getJob().getState() == Job.RUNNING) {
- TaskInfo info = getTaskInfo();
- if (info == null) {
+ if (getJob().getState() == Job.RUNNING) {
+ TaskInfo info = getTaskInfo();
+ if (info == null) {
return getJob().getName();
}
- return info.getDisplayString(showProgress);
- }
- if (getJob().getState() == Job.SLEEPING) {
+ return info.getDisplayString(showProgress);
+ }
+ if (getJob().getState() == Job.SLEEPING) {
return NLS.bind(ProgressMessages.JobInfo_Sleeping, (new Object[] { getJob().getName() }));
}
- return NLS.bind(ProgressMessages.JobInfo_Waiting, (new Object[] { getJob().getName() }));
- }
+ return NLS.bind(ProgressMessages.JobInfo_Waiting, (new Object[] { getJob().getName() }));
+ }
- /**
+ /**
* Returns the GroupInfo for the receiver if it' is active.
*
* @return GroupInfo or <code>null</code>.
*/
- GroupInfo getGroupInfo() {
- if (parent != null) {
+ GroupInfo getGroupInfo() {
+ if (parent != null) {
return parent;
}
- return null;
- }
+ return null;
+ }
- /**
+ /**
* Returns the job that the receiver is collecting data on.
*
* @return Job
*/
public Job getJob() {
- return job;
- }
+ return job;
+ }
@Override
public GroupInfo getParent() {
- return parent;
- }
+ return parent;
+ }
- /**
- * Returns the amount of progress we have had as a percentage. If there is
- * no progress or it is indeterminate return IProgressMonitor.UNKNOWN.
+ /**
+ * Returns the amount of progress we have had as a percentage. If there is no
+ * progress or it is indeterminate return IProgressMonitor.UNKNOWN.
*
* @return int
*/
- int getPercentDone() {
- TaskInfo info = getTaskInfo();
- if (info != null){
- if(info.totalWork == IProgressMonitor.UNKNOWN) {
+ int getPercentDone() {
+ TaskInfo info = getTaskInfo();
+ if (info != null) {
+ if (info.totalWork == IProgressMonitor.UNKNOWN) {
return IProgressMonitor.UNKNOWN;
}
- if(info.totalWork == 0) {
+ if (info.totalWork == 0) {
return 0;
}
- return (int) info.preWork * 100 / info.totalWork;
- }
- return IProgressMonitor.UNKNOWN;
- }
+ return (int) info.preWork * 100 / info.totalWork;
+ }
+ return IProgressMonitor.UNKNOWN;
+ }
- /**
+ /**
* Returns the taskInfo.
*/
- TaskInfo getTaskInfo() {
- return taskInfo;
- }
+ TaskInfo getTaskInfo() {
+ return taskInfo;
+ }
- @Override
+ @Override
boolean hasChildren() {
return !children.isEmpty();
- }
+ }
- /**
+ /**
* Returns whether or not there is a task.
*
* @return boolean
*/
- boolean hasTaskInfo() {
- return taskInfo != null;
- }
+ boolean hasTaskInfo() {
+ return taskInfo != null;
+ }
- @Override
+ @Override
boolean isActive() {
- return getJob().getState() != Job.NONE;
- }
+ return getJob().getState() != Job.NONE;
+ }
- /**
+ /**
* Returns whether or not the receiver is blocked.
*
* @return boolean <code>true</code> if this is a currently blocked job.
*/
- public boolean isBlocked() {
- return getBlockedStatus() != null;
- }
+ public boolean isBlocked() {
+ return getBlockedStatus() != null;
+ }
- /**
+ /**
* Returns whether or not the job was cancelled in the UI.
*
* @return boolean
*/
- public boolean isCanceled() {
- return canceled;
- }
+ public boolean isCanceled() {
+ return canceled;
+ }
- @Override
+ @Override
public boolean isCancellable() {
- return super.isCancellable();
- }
+ return super.isCancellable();
+ }
- @Override
+ @Override
boolean isJobInfo() {
- return true;
- }
+ return true;
+ }
- /**
+ /**
* Sets the description of the blocking status.
*
- * @param blockedStatus
- * The IStatus that describes the blockage or <code>null</code>
+ * @param blockedStatus The IStatus that describes the blockage or
+ * <code>null</code>
*/
- public void setBlockedStatus(IStatus blockedStatus) {
- this.blockedStatus = blockedStatus;
- }
+ public void setBlockedStatus(IStatus blockedStatus) {
+ this.blockedStatus = blockedStatus;
+ }
- /**
+ /**
* Sets the GroupInfo to be the group.
*
* @param group
*/
- void setGroupInfo(GroupInfo group) {
- parent = group;
- }
+ void setGroupInfo(GroupInfo group) {
+ parent = group;
+ }
- /**
+ /**
* Sets the name of the taskInfo.
*
* @param name
*/
- void setTaskName(String name) {
- taskInfo.setTaskName(name);
- }
+ void setTaskName(String name) {
+ taskInfo.setTaskName(name);
+ }
- /**
- * Sets the number of ticks this job represents. Default is indeterminate
- * (-1).
+ /**
+ * Sets the number of ticks this job represents. Default is indeterminate (-1).
*
- * @param ticks
- * The ticks to set.
+ * @param ticks The ticks to set.
*/
- public void setTicks(int ticks) {
- this.ticks = ticks;
- }
+ public void setTicks(int ticks) {
+ this.ticks = ticks;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/JobTreeElement.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/JobTreeElement.java
index cfd0237bfbf..d0cee9b6e4f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/JobTreeElement.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/JobTreeElement.java
@@ -53,8 +53,7 @@ public abstract class JobTreeElement implements Comparable<JobTreeElement> {
/**
* Returns the displayString for the receiver.
*
- * @param showProgress
- * Whether or not progress is being shown (if relevant).
+ * @param showProgress Whether or not progress is being shown (if relevant).
* @return String
*/
String getDisplayString(boolean showProgress) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/JobsViewPreferenceDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/JobsViewPreferenceDialog.java
index c6b68f0919d..6166a9059bd 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/JobsViewPreferenceDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/JobsViewPreferenceDialog.java
@@ -27,8 +27,8 @@ import org.eclipse.ui.internal.util.PrefUtil;
import org.eclipse.ui.preferences.ViewSettingsDialog;
/**
- * The JobsViewPreferenceDialog is the dialog that
- * allows the user to set the preferences.
+ * The JobsViewPreferenceDialog is the dialog that allows the user to set the
+ * preferences.
*/
public class JobsViewPreferenceDialog extends ViewSettingsDialog {
@@ -36,6 +36,7 @@ public class JobsViewPreferenceDialog extends ViewSettingsDialog {
/**
* Create a new instance of the receiver.
+ *
* @param parentShell
*/
public JobsViewPreferenceDialog(Shell parentShell) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressAnimationItem.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressAnimationItem.java
index 984a693309f..439edde6559 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressAnimationItem.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressAnimationItem.java
@@ -58,8 +58,7 @@ import org.eclipse.ui.statushandlers.StatusManager;
/**
* The ProgressAnimationItem is the animation items that uses the progress bar.
*/
-public class ProgressAnimationItem extends AnimationItem implements
- FinishedJobs.KeptJobsListener {
+public class ProgressAnimationItem extends AnimationItem implements FinishedJobs.KeptJobsListener {
ProgressBar bar;
@@ -88,10 +87,8 @@ public class ProgressAnimationItem extends AnimationItem implements
/**
* Create an instance of the receiver in the supplied region.
*
- * @param region
- * The ProgressRegion that contains the receiver.
- * @param flags
- * flags to use for creation of the progress bar
+ * @param region The ProgressRegion that contains the receiver.
+ * @param flags flags to use for creation of the progress bar
*/
ProgressAnimationItem(ProgressRegion region, int flags) {
super(region.workbenchWindow);
@@ -109,8 +106,7 @@ public class ProgressAnimationItem extends AnimationItem implements
void doAction() {
- JobTreeElement[] jobTreeElements = FinishedJobs.getInstance()
- .getKeptElements();
+ JobTreeElement[] jobTreeElements = FinishedJobs.getInstance().getKeptElements();
// search from end (youngest)
for (int i = jobTreeElements.length - 1; i >= 0; i--) {
if (jobTreeElements[i] instanceof JobInfo) {
@@ -120,14 +116,12 @@ public class ProgressAnimationItem extends AnimationItem implements
IStatus status = job.getResult();
if (status != null && status.getSeverity() == IStatus.ERROR) {
- StatusAdapter statusAdapter = StatusAdapterHelper
- .getInstance().getStatusAdapter(ji);
+ StatusAdapter statusAdapter = StatusAdapterHelper.getInstance().getStatusAdapter(ji);
if (statusAdapter == null)
statusAdapter = new StatusAdapter(status);
- StatusManager.getManager().handle(statusAdapter,
- StatusManager.SHOW);
+ StatusManager.getManager().handle(statusAdapter, StatusManager.SHOW);
removeTopElement(ji);
}
@@ -165,8 +159,7 @@ public class ProgressAnimationItem extends AnimationItem implements
if (prop instanceof ParameterizedCommand) {
ParameterizedCommand command = (ParameterizedCommand) prop;
IWorkbenchWindow window = getWindow();
- IHandlerService service = window
- .getService(IHandlerService.class);
+ IHandlerService service = window.getService(IHandlerService.class);
Exception exception = null;
try {
service.executeCommand(command, null);
@@ -182,10 +175,8 @@ public class ProgressAnimationItem extends AnimationItem implements
}
if (exception != null) {
- Status status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID,
- exception.getMessage(), exception);
- StatusManager.getManager().handle(status,
- StatusManager.LOG | StatusManager.SHOW);
+ Status status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, exception.getMessage(), exception);
+ StatusManager.getManager().handle(status, StatusManager.LOG | StatusManager.SHOW);
}
return true;
}
@@ -222,8 +213,7 @@ public class ProgressAnimationItem extends AnimationItem implements
return;
}
- JobTreeElement[] jobTreeElements = FinishedJobs.getInstance()
- .getKeptElements();
+ JobTreeElement[] jobTreeElements = FinishedJobs.getInstance().getKeptElements();
// search from end (youngest)
for (int i = jobTreeElements.length - 1; i >= 0; i--) {
if (jobTreeElements[i] instanceof JobInfo) {
@@ -233,9 +223,7 @@ public class ProgressAnimationItem extends AnimationItem implements
IStatus status = job.getResult();
if (status != null && status.getSeverity() == IStatus.ERROR) {
// green arrow with error overlay
- initButton(errorImage, NLS.bind(
- ProgressMessages.ProgressAnimationItem_error,
- job.getName()));
+ initButton(errorImage, NLS.bind(ProgressMessages.ProgressAnimationItem_error, job.getName()));
return;
}
IAction action = getAction(job);
@@ -243,16 +231,13 @@ public class ProgressAnimationItem extends AnimationItem implements
// green arrow with exclamation mark
String tt = action.getToolTipText();
if (tt == null || tt.trim().length() == 0) {
- tt = NLS.bind(
- ProgressMessages.ProgressAnimationItem_ok,
- job.getName());
+ tt = NLS.bind(ProgressMessages.ProgressAnimationItem_ok, job.getName());
}
initButton(okImage, tt);
return;
}
// just the green arrow
- initButton(noneImage,
- ProgressMessages.ProgressAnimationItem_tasks);
+ initButton(noneImage, ProgressMessages.ProgressAnimationItem_tasks);
return;
}
}
@@ -270,7 +255,7 @@ public class ProgressAnimationItem extends AnimationItem implements
private void initButton(Image im, final String tt) {
toolButton.setImage(im);
toolButton.setToolTipText(tt);
- toolbar.setVisible(true);
+ toolbar.setVisible(true);
toolbar.getParent().requestLayout(); // must layout
if (currentAccessibleListener != null)
@@ -289,18 +274,15 @@ public class ProgressAnimationItem extends AnimationItem implements
if (okImage == null) {
Display display = parent.getDisplay();
- noneImage = WorkbenchImages.getWorkbenchImageDescriptor(
- "progress/progress_none.png").createImage(display); //$NON-NLS-1$
- okImage = WorkbenchImages.getWorkbenchImageDescriptor(
- "progress/progress_ok.png").createImage(display); //$NON-NLS-1$
- errorImage = WorkbenchImages.getWorkbenchImageDescriptor(
- "progress/progress_error.png").createImage(display); //$NON-NLS-1$
+ noneImage = WorkbenchImages.getWorkbenchImageDescriptor("progress/progress_none.png").createImage(display); //$NON-NLS-1$
+ okImage = WorkbenchImages.getWorkbenchImageDescriptor("progress/progress_ok.png").createImage(display); //$NON-NLS-1$
+ errorImage = WorkbenchImages.getWorkbenchImageDescriptor("progress/progress_error.png") //$NON-NLS-1$
+ .createImage(display);
}
top = new Composite(parent, SWT.NULL);
top.addDisposeListener(e -> {
- FinishedJobs.getInstance().removeListener(
- ProgressAnimationItem.this);
+ FinishedJobs.getInstance().removeListener(ProgressAnimationItem.this);
noneImage.dispose();
okImage.dispose();
errorImage.dispose();
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressAnimationProcessor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressAnimationProcessor.java
index 642b1006817..7e7d2c67eb7 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressAnimationProcessor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressAnimationProcessor.java
@@ -26,99 +26,98 @@ import org.eclipse.ui.PlatformUI;
*/
class ProgressAnimationProcessor implements IAnimationProcessor {
- AnimationManager manager;
-
- /**
- * Create a new instance of the receiver and listen to the animation
- * manager.
- *
- * @param animationManager
- */
- ProgressAnimationProcessor(AnimationManager animationManager) {
- manager = animationManager;
- }
+ AnimationManager manager;
+
+ /**
+ * Create a new instance of the receiver and listen to the animation manager.
+ *
+ * @param animationManager
+ */
+ ProgressAnimationProcessor(AnimationManager animationManager) {
+ manager = animationManager;
+ }
List<AnimationItem> items = new ArrayList<>();
- public void startAnimationLoop(IProgressMonitor monitor) {
+ public void startAnimationLoop(IProgressMonitor monitor) {
- // Create an off-screen image to draw on, and a GC to draw with.
- // Both are disposed after the animation.
- if (items.isEmpty()) {
+ // Create an off-screen image to draw on, and a GC to draw with.
+ // Both are disposed after the animation.
+ if (items.isEmpty()) {
return;
}
- if (!PlatformUI.isWorkbenchRunning()) {
+ if (!PlatformUI.isWorkbenchRunning()) {
return;
}
- while (manager.isAnimated() && !monitor.isCanceled()) {
- //Do nothing while animation is happening
- }
+ while (manager.isAnimated() && !monitor.isCanceled()) {
+ // Do nothing while animation is happening
+ }
for (ProgressAnimationItem animationItem : getAnimationItems()) {
- animationItem.animationDone();
- }
+ animationItem.animationDone();
+ }
- }
+ }
- @Override
+ @Override
public void addItem(AnimationItem item) {
- Assert.isTrue(item instanceof ProgressAnimationItem);
- items.add(item);
- }
+ Assert.isTrue(item instanceof ProgressAnimationItem);
+ items.add(item);
+ }
- @Override
+ @Override
public void removeItem(AnimationItem item) {
- Assert.isTrue(item instanceof ProgressAnimationItem);
- items.remove(item);
- }
+ Assert.isTrue(item instanceof ProgressAnimationItem);
+ items.remove(item);
+ }
- @Override
+ @Override
public boolean hasItems() {
- return items.size() > 0;
- }
+ return items.size() > 0;
+ }
- public void itemsInactiveRedraw() {
- //Nothing to do here as SWT handles redraw
+ public void itemsInactiveRedraw() {
+ // Nothing to do here as SWT handles redraw
- }
+ }
- @Override
+ @Override
public void animationStarted() {
for (AnimationItem animationItem : getAnimationItems()) {
- animationItem.animationStart();
- }
+ animationItem.animationStart();
+ }
- }
+ }
- @Override
+ @Override
public int getPreferredWidth() {
- return 30;
- }
-
- /**
- * Get the animation items currently registered for the receiver.
- *
- * @return ProgressAnimationItem[]
- */
- private ProgressAnimationItem[] getAnimationItems() {
+ return 30;
+ }
+
+ /**
+ * Get the animation items currently registered for the receiver.
+ *
+ * @return ProgressAnimationItem[]
+ */
+ private ProgressAnimationItem[] getAnimationItems() {
ProgressAnimationItem[] animationItems = new ProgressAnimationItem[items.size()];
- items.toArray(animationItems);
- return animationItems;
- }
+ items.toArray(animationItems);
+ return animationItems;
+ }
- @Override
+ @Override
public void animationFinished() {
for (AnimationItem animationItem : getAnimationItems()) {
- animationItem.animationDone();
- }
+ animationItem.animationDone();
+ }
- }
+ }
- @Override
+ @Override
public boolean isProcessorJob(Job job) {
- // We have no jobs
- return false;
- }
+ // We have no jobs
+ return false;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressCanvasViewer.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressCanvasViewer.java
index f719cb61ed8..b8fedb59d09 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressCanvasViewer.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressCanvasViewer.java
@@ -33,181 +33,183 @@ import org.eclipse.swt.widgets.Widget;
import org.eclipse.ui.internal.TrimUtil;
/**
- * The ProgressCanvasViewer is the viewer used by progress windows. It displays text
- * on the canvas.
+ * The ProgressCanvasViewer is the viewer used by progress windows. It displays
+ * text on the canvas.
*/
public class ProgressCanvasViewer extends AbstractProgressViewer {
- Canvas canvas;
+ Canvas canvas;
- Object[] displayedItems = new Object[0];
+ Object[] displayedItems = new Object[0];
- /**
- * Font metrics to use for determining pixel sizes.
- */
- private FontMetrics fontMetrics;
+ /**
+ * Font metrics to use for determining pixel sizes.
+ */
+ private FontMetrics fontMetrics;
- private int numShowItems = 1;
+ private int numShowItems = 1;
- private int maxCharacterWidth;
+ private int maxCharacterWidth;
private int orientation = SWT.HORIZONTAL;
- /**
- * Create a new instance of the receiver with the supplied
- * parent and style bits.
- * @param parent The composite the Canvas is created in
- * @param style style bits for the canvas
- * @param itemsToShow the number of items this will show
- * @param numChars The number of characters for the width hint.
- * @param side the side to display text, this helps determine horizontal vs vertical
- */
- ProgressCanvasViewer(Composite parent, int style, int itemsToShow, int numChars, int orientation) {
- super();
- this.orientation = orientation;
- numShowItems = itemsToShow;
- maxCharacterWidth = numChars;
- canvas = new Canvas(parent, style);
- hookControl(canvas);
- // Compute and store a font metric
- GC gc = new GC(canvas);
- gc.setFont(JFaceResources.getDefaultFont());
- fontMetrics = gc.getFontMetrics();
- gc.dispose();
- initializeListeners();
- }
-
- /**
- * NE: Copied from ContentViewer. We don't want the OpenStrategy hooked
- * in StructuredViewer.hookControl otherwise the canvas will take focus
- * since it has a key listener. We don't want this included in the window's
- * tab traversal order. Defeating it here is more self-contained then
- * setting the tab list on the shell or other parent composite.
- */
- @Override
+ /**
+ * Create a new instance of the receiver with the supplied parent and style
+ * bits.
+ *
+ * @param parent The composite the Canvas is created in
+ * @param style style bits for the canvas
+ * @param itemsToShow the number of items this will show
+ * @param numChars The number of characters for the width hint.
+ * @param side the side to display text, this helps determine horizontal
+ * vs vertical
+ */
+ ProgressCanvasViewer(Composite parent, int style, int itemsToShow, int numChars, int orientation) {
+ super();
+ this.orientation = orientation;
+ numShowItems = itemsToShow;
+ maxCharacterWidth = numChars;
+ canvas = new Canvas(parent, style);
+ hookControl(canvas);
+ // Compute and store a font metric
+ GC gc = new GC(canvas);
+ gc.setFont(JFaceResources.getDefaultFont());
+ fontMetrics = gc.getFontMetrics();
+ gc.dispose();
+ initializeListeners();
+ }
+
+ /**
+ * NE: Copied from ContentViewer. We don't want the OpenStrategy hooked in
+ * StructuredViewer.hookControl otherwise the canvas will take focus since it
+ * has a key listener. We don't want this included in the window's tab traversal
+ * order. Defeating it here is more self-contained then setting the tab list on
+ * the shell or other parent composite.
+ */
+ @Override
protected void hookControl(Control control) {
- control.addDisposeListener(event -> handleDispose(event));
- }
+ control.addDisposeListener(event -> handleDispose(event));
+ }
- @Override
+ @Override
protected Widget doFindInputItem(Object element) {
- return null; // No widgets associated with items
- }
+ return null; // No widgets associated with items
+ }
- @Override
+ @Override
protected Widget doFindItem(Object element) {
- return null; // No widgets associated with items
- }
+ return null; // No widgets associated with items
+ }
- @Override
+ @Override
protected void doUpdateItem(Widget item, Object element, boolean fullMap) {
- canvas.redraw();
- }
+ canvas.redraw();
+ }
- @Override
+ @Override
protected List getSelectionFromWidget() {
- //No selection on a Canvas
+ // No selection on a Canvas
return Collections.EMPTY_LIST;
- }
+ }
- @Override
+ @Override
protected void internalRefresh(Object element) {
- displayedItems = getSortedChildren(getRoot());
- canvas.redraw();
- }
+ displayedItems = getSortedChildren(getRoot());
+ canvas.redraw();
+ }
- @Override
+ @Override
public void reveal(Object element) {
- //Nothing to do here as we do not scroll
- }
+ // Nothing to do here as we do not scroll
+ }
- @Override
+ @Override
protected void setSelectionToWidget(List l, boolean reveal) {
- //Do nothing as there is no selection
- }
+ // Do nothing as there is no selection
+ }
- @Override
+ @Override
public Control getControl() {
- return canvas;
- }
-
- private void initializeListeners() {
- canvas.addPaintListener(event -> {
-
- GC gc = event.gc;
- Transform transform = null;
- if (orientation == SWT.VERTICAL) {
- transform = new Transform(event.display);
- transform.translate(TrimUtil.TRIM_DEFAULT_HEIGHT, 0);
- transform.rotate(90);
- }
- ILabelProvider labelProvider = (ILabelProvider) getLabelProvider();
-
- int itemCount = Math.min(displayedItems.length, numShowItems);
-
- int yOffset = 0;
- int xOffset = 0;
- if (numShowItems == 1) {//If there is a single item try to center it
- Rectangle clientArea = canvas.getParent().getClientArea();
- if (orientation == SWT.HORIZONTAL) {
- int size1 = clientArea.height;
- yOffset = size1 - (fontMetrics.getHeight());
- yOffset = yOffset / 2;
- } else {
- int size2 = clientArea.width;
- xOffset = size2 - (fontMetrics.getHeight());
- xOffset = xOffset / 2;
- }
- }
-
- for (int i = 0; i < itemCount; i++) {
- String string = labelProvider.getText(displayedItems[i]);
- if(string == null) {
+ return canvas;
+ }
+
+ private void initializeListeners() {
+ canvas.addPaintListener(event -> {
+
+ GC gc = event.gc;
+ Transform transform = null;
+ if (orientation == SWT.VERTICAL) {
+ transform = new Transform(event.display);
+ transform.translate(TrimUtil.TRIM_DEFAULT_HEIGHT, 0);
+ transform.rotate(90);
+ }
+ ILabelProvider labelProvider = (ILabelProvider) getLabelProvider();
+
+ int itemCount = Math.min(displayedItems.length, numShowItems);
+
+ int yOffset = 0;
+ int xOffset = 0;
+ if (numShowItems == 1) {// If there is a single item try to center it
+ Rectangle clientArea = canvas.getParent().getClientArea();
+ if (orientation == SWT.HORIZONTAL) {
+ int size1 = clientArea.height;
+ yOffset = size1 - (fontMetrics.getHeight());
+ yOffset = yOffset / 2;
+ } else {
+ int size2 = clientArea.width;
+ xOffset = size2 - (fontMetrics.getHeight());
+ xOffset = xOffset / 2;
+ }
+ }
+
+ for (int i = 0; i < itemCount; i++) {
+ String string = labelProvider.getText(displayedItems[i]);
+ if (string == null) {
string = "";//$NON-NLS-1$
}
- if (orientation == SWT.HORIZONTAL) {
- gc.drawString(string, 2, yOffset + (i * fontMetrics.getHeight()), true);
- } else {
- gc.setTransform(transform);
- gc.drawString(string, xOffset + (i * fontMetrics.getHeight()), 2, true);
- }
- }
- if (transform != null)
- transform.dispose();
+ if (orientation == SWT.HORIZONTAL) {
+ gc.drawString(string, 2, yOffset + (i * fontMetrics.getHeight()), true);
+ } else {
+ gc.setTransform(transform);
+ gc.drawString(string, xOffset + (i * fontMetrics.getHeight()), 2, true);
+ }
+ }
+ if (transform != null)
+ transform.dispose();
});
- }
+ }
- @Override
+ @Override
public void setLabelProvider(IBaseLabelProvider labelProvider) {
- Assert.isTrue(labelProvider instanceof ILabelProvider);
- super.setLabelProvider(labelProvider);
- }
-
- /**
- * Get the size hints for the receiver. These are used for
- * layout data.
- * @return Point - the preferred x and y coordinates
- */
- public Point getSizeHints() {
-
- Display display = canvas.getDisplay();
-
- GC gc = new GC(canvas);
- FontMetrics fm = gc.getFontMetrics();
- int charWidth = fm.getAverageCharWidth();
- int charHeight = fm.getHeight();
- int maxWidth = display.getBounds().width / 2;
- int maxHeight = display.getBounds().height / 6;
- int fontWidth = charWidth * maxCharacterWidth;
- int fontHeight = charHeight * numShowItems;
- if (maxWidth < fontWidth) {
+ Assert.isTrue(labelProvider instanceof ILabelProvider);
+ super.setLabelProvider(labelProvider);
+ }
+
+ /**
+ * Get the size hints for the receiver. These are used for layout data.
+ *
+ * @return Point - the preferred x and y coordinates
+ */
+ public Point getSizeHints() {
+
+ Display display = canvas.getDisplay();
+
+ GC gc = new GC(canvas);
+ FontMetrics fm = gc.getFontMetrics();
+ int charWidth = fm.getAverageCharWidth();
+ int charHeight = fm.getHeight();
+ int maxWidth = display.getBounds().width / 2;
+ int maxHeight = display.getBounds().height / 6;
+ int fontWidth = charWidth * maxCharacterWidth;
+ int fontHeight = charHeight * numShowItems;
+ if (maxWidth < fontWidth) {
fontWidth = maxWidth;
}
- if (maxHeight < fontHeight) {
+ if (maxHeight < fontHeight) {
fontHeight = maxHeight;
}
- gc.dispose();
- return new Point(fontWidth, fontHeight);
- }
+ gc.dispose();
+ return new Point(fontWidth, fontHeight);
+ }
@Override
public void add(JobTreeElement... elements) {
@@ -221,5 +223,4 @@ public class ProgressCanvasViewer extends AbstractProgressViewer {
}
-
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressContentProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressContentProvider.java
index 9742f7b94a9..d64d532de84 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressContentProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressContentProvider.java
@@ -20,54 +20,53 @@ import org.eclipse.jface.viewers.Viewer;
* The ProgressContentProvider is the content provider used for classes that
* listen to the progress changes.
*/
-public abstract class ProgressContentProvider implements
- IProgressUpdateCollector, IStructuredContentProvider {
+public abstract class ProgressContentProvider implements IProgressUpdateCollector, IStructuredContentProvider {
/**
* Return whether or not we check the preferences or overide.
*/
- private boolean canShowDebug = false;
+ private boolean canShowDebug = false;
- /**
- * Create a new instance of the receiver with all of the
- * default values.
- */
- public ProgressContentProvider() {
+ /**
+ * Create a new instance of the receiver with all of the default values.
+ */
+ public ProgressContentProvider() {
super();
- }
+ }
- /**
- * Create a new instance of the receiver with a flag to
- * indicate if there will be debug info shown or not.
- * @param debug If true debug information will be shown
- * if the debug flag in the ProgressManager is true.
- */
- public ProgressContentProvider(boolean debug) {
- this();
- canShowDebug = debug;
- }
+ /**
+ * Create a new instance of the receiver with a flag to indicate if there will
+ * be debug info shown or not.
+ *
+ * @param debug If true debug information will be shown if the debug flag in the
+ * ProgressManager is true.
+ */
+ public ProgressContentProvider(boolean debug) {
+ this();
+ canShowDebug = debug;
+ }
- @Override
+ @Override
public Object[] getElements(Object inputElement) {
- return ProgressManager.getInstance().getRootElements(debug());
- }
+ return ProgressManager.getInstance().getRootElements(debug());
+ }
- @Override
+ @Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- //No change when input changes
- }
+ // No change when input changes
+ }
- /**
- * Return whether or not we are debugging. Check the
- * system settings unless we are overiding them.
- * @return boolean <code>true</code> if debug
- * (system) jobs are being shown.
- */
- public boolean debug(){
- if(!canShowDebug) {
+ /**
+ * Return whether or not we are debugging. Check the system settings unless we
+ * are overiding them.
+ *
+ * @return boolean <code>true</code> if debug (system) jobs are being shown.
+ */
+ public boolean debug() {
+ if (!canShowDebug) {
return false;
}
- return ProgressViewUpdater.getSingleton().debug;
- }
+ return ProgressViewUpdater.getSingleton().debug;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressInfoItem.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressInfoItem.java
index f049192216c..b6c41ffefc8 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressInfoItem.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressInfoItem.java
@@ -153,65 +153,41 @@ public class ProgressInfoItem extends Composite {
private boolean isThemed;
static {
- JFaceResources
- .getImageRegistry()
- .put(
- STOP_IMAGE_KEY,
- WorkbenchImages
- .getWorkbenchImageDescriptor("elcl16/progress_stop.png"));//$NON-NLS-1$
-
- JFaceResources
- .getImageRegistry()
- .put(
- DISABLED_STOP_IMAGE_KEY,
- WorkbenchImages
- .getWorkbenchImageDescriptor("dlcl16/progress_stop.png"));//$NON-NLS-1$
-
- JFaceResources
- .getImageRegistry()
- .put(
- DEFAULT_JOB_KEY,
- WorkbenchImages
- .getWorkbenchImageDescriptor("progress/progress_task.png")); //$NON-NLS-1$
-
- JFaceResources
- .getImageRegistry()
- .put(
- CLEAR_FINISHED_JOB_KEY,
- WorkbenchImages
- .getWorkbenchImageDescriptor("elcl16/progress_rem.png")); //$NON-NLS-1$
-
- JFaceResources
- .getImageRegistry()
- .put(
- DISABLED_CLEAR_FINISHED_JOB_KEY,
- WorkbenchImages
- .getWorkbenchImageDescriptor("dlcl16/progress_rem.png")); //$NON-NLS-1$
+ JFaceResources.getImageRegistry().put(STOP_IMAGE_KEY,
+ WorkbenchImages.getWorkbenchImageDescriptor("elcl16/progress_stop.png"));//$NON-NLS-1$
+
+ JFaceResources.getImageRegistry().put(DISABLED_STOP_IMAGE_KEY,
+ WorkbenchImages.getWorkbenchImageDescriptor("dlcl16/progress_stop.png"));//$NON-NLS-1$
+
+ JFaceResources.getImageRegistry().put(DEFAULT_JOB_KEY,
+ WorkbenchImages.getWorkbenchImageDescriptor("progress/progress_task.png")); //$NON-NLS-1$
+
+ JFaceResources.getImageRegistry().put(CLEAR_FINISHED_JOB_KEY,
+ WorkbenchImages.getWorkbenchImageDescriptor("elcl16/progress_rem.png")); //$NON-NLS-1$
+
+ JFaceResources.getImageRegistry().put(DISABLED_CLEAR_FINISHED_JOB_KEY,
+ WorkbenchImages.getWorkbenchImageDescriptor("dlcl16/progress_rem.png")); //$NON-NLS-1$
// Mac has different Gamma value
int shift = Util.isMac() ? -25 : -10;
- Color lightColor = PlatformUI.getWorkbench().getDisplay()
- .getSystemColor(SWT.COLOR_LIST_BACKGROUND);
+ Color lightColor = PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND);
// Determine a dark color by shifting the list color
- RGB darkRGB = new RGB(Math.max(0, lightColor.getRed() + shift), Math
- .max(0, lightColor.getGreen() + shift), Math.max(0, lightColor
- .getBlue()
- + shift));
+ RGB darkRGB = new RGB(Math.max(0, lightColor.getRed() + shift), Math.max(0, lightColor.getGreen() + shift),
+ Math.max(0, lightColor.getBlue() + shift));
JFaceResources.getColorRegistry().put(DARK_COLOR_KEY, darkRGB);
}
/**
- * Create a new instance of the receiver with the specified parent, style
- * and info object/
+ * Create a new instance of the receiver with the specified parent, style and
+ * info object/
*
* @param parent
* @param style
* @param progressInfo
*/
- public ProgressInfoItem(Composite parent, int style,
- JobTreeElement progressInfo) {
+ public ProgressInfoItem(Composite parent, int style, JobTreeElement progressInfo) {
super(parent, style);
info = progressInfo;
isThemed = getCustomThemeFlag();
@@ -234,14 +210,11 @@ public class ProgressInfoItem extends Composite {
FormData imageData = new FormData();
if (infoImage != null) {
// position it in the center
- imageData.top = new FormAttachment(50,
- -infoImage.getBounds().height / 2);
+ imageData.top = new FormAttachment(50, -infoImage.getBounds().height / 2);
} else {
- imageData.top = new FormAttachment(0,
- IDialogConstants.VERTICAL_SPACING);
+ imageData.top = new FormAttachment(0, IDialogConstants.VERTICAL_SPACING);
}
- imageData.left = new FormAttachment(0,
- IDialogConstants.HORIZONTAL_SPACING / 2);
+ imageData.left = new FormAttachment(0, IDialogConstants.HORIZONTAL_SPACING / 2);
jobImageLabel.setLayoutData(imageData);
progressLabel = new Label(this, SWT.NONE);
@@ -253,8 +226,7 @@ public class ProgressInfoItem extends Composite {
// set cursor to overwrite any busy cursor we might have
actionButton = new ToolItem(actionBar, SWT.NONE);
- actionButton
- .setToolTipText(ProgressMessages.NewProgressView_CancelJobToolTip);
+ actionButton.setToolTipText(ProgressMessages.NewProgressView_CancelJobToolTip);
actionButton.addSelectionListener(widgetSelectedAdapter(e -> {
actionButton.setEnabled(false);
cancelOrRemove();
@@ -275,12 +247,9 @@ public class ProgressInfoItem extends Composite {
updateToolBarValues();
FormData progressData = new FormData();
- progressData.top = new FormAttachment(0,
- IDialogConstants.VERTICAL_SPACING);
- progressData.left = new FormAttachment(jobImageLabel,
- IDialogConstants.HORIZONTAL_SPACING / 2);
- progressData.right = new FormAttachment(actionBar,
- IDialogConstants.HORIZONTAL_SPACING * -1);
+ progressData.top = new FormAttachment(0, IDialogConstants.VERTICAL_SPACING);
+ progressData.left = new FormAttachment(jobImageLabel, IDialogConstants.HORIZONTAL_SPACING / 2);
+ progressData.right = new FormAttachment(actionBar, IDialogConstants.HORIZONTAL_SPACING * -1);
progressLabel.setLayoutData(progressData);
mouseListener = new MouseAdapter() {
@@ -304,8 +273,7 @@ public class ProgressInfoItem extends Composite {
* Set the main text of the receiver. Truncate to fit the available space.
*/
private void setMainText() {
- progressLabel
- .setText(Dialog.shortenText(getMainTitle(), progressLabel));
+ progressLabel.setText(Dialog.shortenText(getMainTitle(), progressLabel));
}
/**
@@ -316,14 +284,12 @@ public class ProgressInfoItem extends Composite {
FormData buttonData = new FormData();
buttonData.top = new FormAttachment(progressLabel, 0, SWT.TOP);
- buttonData.right = new FormAttachment(100,
- IDialogConstants.HORIZONTAL_SPACING * -1);
+ buttonData.right = new FormAttachment(100, IDialogConstants.HORIZONTAL_SPACING * -1);
actionBar.setLayoutData(buttonData);
if (taskEntries.size() > 0) {
FormData linkData = new FormData();
- linkData.top = new FormAttachment(progressLabel,
- IDialogConstants.VERTICAL_SPACING);
+ linkData.top = new FormAttachment(progressLabel, IDialogConstants.VERTICAL_SPACING);
linkData.left = new FormAttachment(progressLabel, 0, SWT.LEFT);
linkData.right = new FormAttachment(actionBar, 0, SWT.LEFT);
taskEntries.get(0).setLayoutData(linkData);
@@ -359,8 +325,7 @@ public class ProgressInfoItem extends Composite {
JobInfo jobInfo = (JobInfo) info;
ImageDescriptor descriptor = null;
- Object property = jobInfo.getJob().getProperty(
- IProgressConstants.ICON_PROPERTY);
+ Object property = jobInfo.getJob().getProperty(IProgressConstants.ICON_PROPERTY);
if (property instanceof ImageDescriptor) {
descriptor = (ImageDescriptor) property;
@@ -388,8 +353,7 @@ public class ProgressInfoItem extends Composite {
*/
private ResourceManager getResourceManager() {
if (resourceManager == null)
- resourceManager = new LocalResourceManager(JFaceResources
- .getResources());
+ resourceManager = new LocalResourceManager(JFaceResources.getResources());
return resourceManager;
}
@@ -428,15 +392,13 @@ public class ProgressInfoItem extends Composite {
if (jobInfo.isCanceled()) {
if (job.getState() == Job.RUNNING)
- return NLS
- .bind(ProgressMessages.JobInfo_Cancel_Requested, name);
+ return NLS.bind(ProgressMessages.JobInfo_Cancel_Requested, name);
return NLS.bind(ProgressMessages.JobInfo_Cancelled, name);
}
IStatus blockedStatus = jobInfo.getBlockedStatus();
if (blockedStatus != null) {
- return NLS.bind(ProgressMessages.JobInfo_Blocked, name,
- blockedStatus.getMessage());
+ return NLS.bind(ProgressMessages.JobInfo_Blocked, name, blockedStatus.getMessage());
}
switch (job.getState()) {
@@ -456,8 +418,7 @@ public class ProgressInfoItem extends Composite {
/**
* Return the finished String for a job.
*
- * @param job
- * the completed Job
+ * @param job the completed Job
* @param withTime
* @return String
*/
@@ -467,8 +428,7 @@ public class ProgressInfoItem extends Composite {
time = getTimeString();
}
if (time != null) {
- return NLS.bind(ProgressMessages.JobInfo_FinishedAt, job.getName(),
- time);
+ return NLS.bind(ProgressMessages.JobInfo_FinishedAt, job.getName(), time);
}
return NLS.bind(ProgressMessages.JobInfo_Finished, job.getName());
}
@@ -476,8 +436,7 @@ public class ProgressInfoItem extends Composite {
/**
* Get the time string the finished job
*
- * @return String or <code>null</code> if this is not one of the finished
- * jobs.
+ * @return String or <code>null</code> if this is not one of the finished jobs.
*/
private String getTimeString() {
Date date = FinishedJobs.getInstance().getFinishDate(info);
@@ -509,8 +468,7 @@ public class ProgressInfoItem extends Composite {
// There may be no task so we don't want to create it
// until we know for sure
for (JobInfo jobInfo : infos) {
- if (jobInfo.hasTaskInfo()
- && jobInfo.getTaskInfo().totalWork == IProgressMonitor.UNKNOWN) {
+ if (jobInfo.hasTaskInfo() && jobInfo.getTaskInfo().totalWork == IProgressMonitor.UNKNOWN) {
createProgressBar(SWT.INDETERMINATE);
break;
}
@@ -523,8 +481,7 @@ public class ProgressInfoItem extends Composite {
}
// Protect against bad counters
- if (percentDone >= 0 && percentDone <= 100
- && percentDone != progressBar.getSelection()) {
+ if (percentDone >= 0 && percentDone <= 100 && percentDone != progressBar.getSelection()) {
progressBar.setSelection(percentDone);
}
}
@@ -549,17 +506,15 @@ public class ProgressInfoItem extends Composite {
String subTaskString = null;
Object[] jobChildren = jobInfo.getChildren();
if (jobChildren.length > 0) {
- subTaskString = ((JobTreeElement) jobChildren[0])
- .getDisplayString();
+ subTaskString = ((JobTreeElement) jobChildren[0]).getDisplayString();
}
if (subTaskString != null) {
if (taskString == null || taskString.length() == 0) {
taskString = subTaskString;
} else {
- taskString = NLS.bind(
- ProgressMessages.JobInfo_DoneNoProgressMessage,
- taskString, subTaskString);
+ taskString = NLS.bind(ProgressMessages.JobInfo_DoneNoProgressMessage, taskString,
+ subTaskString);
}
}
if (taskString != null) {
@@ -569,8 +524,7 @@ public class ProgressInfoItem extends Composite {
Job job = jobInfo.getJob();
IStatus result = job.getResult();
- if (result == null || result.getMessage().length() == 0
- && !info.isJobInfo()) {
+ if (result == null || result.getMessage().length() == 0 && !info.isJobInfo()) {
setLinkText(job, getJobNameAndStatus(jobInfo), i);
} else {
setLinkText(job, result.getMessage(), i);
@@ -672,22 +626,18 @@ public class ProgressInfoItem extends Composite {
}
/**
- * Set the images in the toolbar based on whether the receiver is finished
- * or not. Also update tooltips if required.
+ * Set the images in the toolbar based on whether the receiver is finished or
+ * not. Also update tooltips if required.
*
*/
private void updateToolBarValues() {
if (isCompleted()) {
- actionButton.setImage(JFaceResources
- .getImage(CLEAR_FINISHED_JOB_KEY));
- actionButton.setDisabledImage(JFaceResources
- .getImage(DISABLED_CLEAR_FINISHED_JOB_KEY));
- actionButton
- .setToolTipText(ProgressMessages.NewProgressView_ClearJobToolTip);
+ actionButton.setImage(JFaceResources.getImage(CLEAR_FINISHED_JOB_KEY));
+ actionButton.setDisabledImage(JFaceResources.getImage(DISABLED_CLEAR_FINISHED_JOB_KEY));
+ actionButton.setToolTipText(ProgressMessages.NewProgressView_ClearJobToolTip);
} else {
actionButton.setImage(JFaceResources.getImage(STOP_IMAGE_KEY));
- actionButton.setDisabledImage(JFaceResources
- .getImage(DISABLED_STOP_IMAGE_KEY));
+ actionButton.setDisabledImage(JFaceResources.getImage(DISABLED_STOP_IMAGE_KEY));
}
@@ -709,18 +659,15 @@ public class ProgressInfoItem extends Composite {
void createProgressBar(int style) {
FormData buttonData = new FormData();
buttonData.top = new FormAttachment(progressLabel, 0);
- buttonData.right = new FormAttachment(100,
- IDialogConstants.HORIZONTAL_SPACING * -1);
+ buttonData.right = new FormAttachment(100, IDialogConstants.HORIZONTAL_SPACING * -1);
actionBar.setLayoutData(buttonData);
progressBar = new ProgressBar(this, SWT.HORIZONTAL | style);
FormData barData = new FormData();
- barData.top = new FormAttachment(actionBar,
- IDialogConstants.VERTICAL_SPACING, SWT.TOP);
+ barData.top = new FormAttachment(actionBar, IDialogConstants.VERTICAL_SPACING, SWT.TOP);
barData.left = new FormAttachment(progressLabel, 0, SWT.LEFT);
- barData.right = new FormAttachment(actionBar,
- IDialogConstants.HORIZONTAL_SPACING * -1);
+ barData.right = new FormAttachment(actionBar, IDialogConstants.HORIZONTAL_SPACING * -1);
barData.height = MAX_PROGRESS_HEIGHT;
barData.width = 0;// default is too large
progressBar.setLayoutData(barData);
@@ -728,8 +675,7 @@ public class ProgressInfoItem extends Composite {
if (taskEntries.size() > 0) {
// Reattach the link label if there is one
FormData linkData = new FormData();
- linkData.top = new FormAttachment(progressBar,
- IDialogConstants.VERTICAL_SPACING);
+ linkData.top = new FormAttachment(progressBar, IDialogConstants.VERTICAL_SPACING);
linkData.left = new FormAttachment(progressBar, 0, SWT.LEFT);
linkData.right = new FormAttachment(progressBar, 0, SWT.RIGHT);
// Give an initial value so as to constrain the link shortening
@@ -754,16 +700,14 @@ public class ProgressInfoItem extends Composite {
if (top == null) {
top = progressLabel;
}
- linkData.top = new FormAttachment(top,
- IDialogConstants.VERTICAL_SPACING);
+ linkData.top = new FormAttachment(top, IDialogConstants.VERTICAL_SPACING);
linkData.left = new FormAttachment(top, 0, SWT.LEFT);
linkData.right = new FormAttachment(top, 0, SWT.RIGHT);
// Give an initial value so as to constrain the link shortening
linkData.width = 20;
} else {
Link previous = taskEntries.get(index - 1);
- linkData.top = new FormAttachment(previous,
- IDialogConstants.VERTICAL_SPACING);
+ linkData.top = new FormAttachment(previous, IDialogConstants.VERTICAL_SPACING);
linkData.left = new FormAttachment(previous, 0, SWT.LEFT);
linkData.right = new FormAttachment(previous, 0, SWT.RIGHT);
// Give an initial value so as to constrain the link shortening
@@ -789,22 +733,18 @@ public class ProgressInfoItem extends Composite {
}
// check for action property
- Object actionProperty = linkJob
- .getProperty(IProgressConstants.ACTION_PROPERTY);
- Object commandProperty = linkJob
- .getProperty(IProgressConstants2.COMMAND_PROPERTY);
+ Object actionProperty = linkJob.getProperty(IProgressConstants.ACTION_PROPERTY);
+ Object commandProperty = linkJob.getProperty(IProgressConstants2.COMMAND_PROPERTY);
if (actionProperty != null && commandProperty != null) {
// if both are specified, then use neither
updateTrigger(null, link);
} else {
- Object property = actionProperty != null ? actionProperty
- : commandProperty;
+ Object property = actionProperty != null ? actionProperty : commandProperty;
updateTrigger(property, link);
}
- if (link.getData(TRIGGER_KEY) == null
- && (taskString == null || taskString.equals(getMainTitle()))) {
+ if (link.getData(TRIGGER_KEY) == null && (taskString == null || taskString.equals(getMainTitle()))) {
// workaround for https://bugs.eclipse.org/383570
taskString = ""; //$NON-NLS-1$
}
@@ -822,32 +762,23 @@ public class ProgressInfoItem extends Composite {
action.run();
updateTrigger(action, link);
} else if (data instanceof ParameterizedCommand) {
- IWorkbench workbench = PlatformUI
- .getWorkbench();
- IHandlerService handlerService = workbench
- .getService(
- IHandlerService.class);
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ IHandlerService handlerService = workbench.getService(IHandlerService.class);
IStatus status = Status.OK_STATUS;
try {
- handlerService
- .executeCommand((ParameterizedCommand) data, null);
+ handlerService.executeCommand((ParameterizedCommand) data, null);
} catch (ExecutionException e) {
- status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, e
- .getMessage(), e);
+ status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, e.getMessage(), e);
} catch (NotDefinedException e) {
- status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, e
- .getMessage(), e);
+ status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, e.getMessage(), e);
} catch (NotEnabledException e) {
- status = new Status(IStatus.WARNING, PlatformUI.PLUGIN_ID, e
- .getMessage(), e);
+ status = new Status(IStatus.WARNING, PlatformUI.PLUGIN_ID, e.getMessage(), e);
} catch (NotHandledException e) {
- status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, e
- .getMessage(), e);
+ status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, e.getMessage(), e);
}
if (!status.isOK()) {
- StatusManager.getManager().handle(status,
- StatusManager.LOG | StatusManager.SHOW);
+ StatusManager.getManager().handle(status, StatusManager.LOG | StatusManager.SHOW);
}
}
@@ -864,11 +795,10 @@ public class ProgressInfoItem extends Composite {
}
/**
- * Update the trigger key if either action is available and enabled or
- * command is available
+ * Update the trigger key if either action is available and enabled or command
+ * is available
*
- * @param trigger
- * {@link Object} or <code>null</code>
+ * @param trigger {@link Object} or <code>null</code>
* @param link
*/
private void updateTrigger(Object trigger, Link link) {
@@ -893,8 +823,8 @@ public class ProgressInfoItem extends Composite {
* @param link
*/
private void updateText(String taskString, Link link) {
- if(taskString == null){
- taskString = ""; //$NON-NLS-1$
+ if (taskString == null) {
+ taskString = ""; //$NON-NLS-1$
}
if (!taskString.isEmpty()) {
taskString = Dialog.shortenText(taskString, link);
@@ -916,10 +846,8 @@ public class ProgressInfoItem extends Composite {
currentIndex = i;
if (selected) {
- setAllBackgrounds(getDisplay().getSystemColor(
- SWT.COLOR_LIST_SELECTION));
- setAllForegrounds(getDisplay().getSystemColor(
- SWT.COLOR_LIST_SELECTION_TEXT));
+ setAllBackgrounds(getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION));
+ setAllForegrounds(getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT));
return;
}
@@ -979,8 +907,7 @@ public class ProgressInfoItem extends Composite {
/**
* Set the selection colors.
*
- * @param select
- * boolean that indicates whether or not to show selection.
+ * @param select boolean that indicates whether or not to show selection.
*/
void selectWidgets(boolean select) {
if (select) {
@@ -1038,7 +965,7 @@ public class ProgressInfoItem extends Composite {
@Override
public void dispose() {
super.dispose();
- if(resourceManager != null)
+ if (resourceManager != null)
resourceManager.dispose();
}
@@ -1105,8 +1032,8 @@ public class ProgressInfoItem extends Composite {
}
}
/*
- * Check if workspace is using a theme. If it is, confirm it is not the
- * default theme.
+ * Check if workspace is using a theme. If it is, confirm it is not the default
+ * theme.
*/
private boolean getCustomThemeFlag() {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressLabelProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressLabelProvider.java
index 8cab74fc4fd..23593143efe 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressLabelProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressLabelProvider.java
@@ -17,19 +17,19 @@ import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
/**
- * The ProgressLabelProvider is a label provider used for viewers
- * that need anILabelprovider to show JobInfos.
+ * The ProgressLabelProvider is a label provider used for viewers that need
+ * anILabelprovider to show JobInfos.
*/
public class ProgressLabelProvider extends LabelProvider {
- @Override
+ @Override
public Image getImage(Object element) {
- return ((JobTreeElement) element).getDisplayImage();
- }
+ return ((JobTreeElement) element).getDisplayImage();
+ }
- @Override
+ @Override
public String getText(Object element) {
- return ((JobTreeElement) element).getDisplayString();
- }
+ return ((JobTreeElement) element).getDisplayString();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressManager.java
index bef5b372f80..e87cb030e8a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressManager.java
@@ -83,8 +83,8 @@ import org.eclipse.ui.statushandlers.StatusManager;
*/
public class ProgressManager extends ProgressProvider implements IProgressService {
/**
- * A property to determine if the job was run in the dialog. Kept for
- * backwards compatibility.
+ * A property to determine if the job was run in the dialog. Kept for backwards
+ * compatibility.
*
* @deprecated
* @see IProgressConstants#PROPERTY_IN_DIALOG
@@ -103,7 +103,7 @@ public class ProgressManager extends ProgressProvider implements IProgressServic
final private Map<Object, Collection<IJobBusyListener>> familyListeners = Collections
.synchronizedMap(new LinkedHashMap<>());
- // list of IJobProgressManagerListener
+ // list of IJobProgressManagerListener
private ListenerList<IJobProgressManagerListener> listeners = new ListenerList<>();
final IJobChangeListener changeListener;
@@ -387,8 +387,7 @@ public class ProgressManager extends ProgressProvider implements IProgressServic
setUpImage(iconsRoot, WAITING_JOB, WAITING_JOB_KEY);
setUpImage(iconsRoot, BLOCKED_JOB, BLOCKED_JOB_KEY);
- ImageDescriptor errorImage = ImageDescriptor
- .createFromURL(new URL(iconsRoot, ERROR_JOB));
+ ImageDescriptor errorImage = ImageDescriptor.createFromURL(new URL(iconsRoot, ERROR_JOB));
JFaceResources.getImageRegistry().put(ERROR_JOB_KEY, errorImage);
} catch (MalformedURLException e) {
@@ -429,18 +428,16 @@ public class ProgressManager extends ProgressProvider implements IProgressServic
removeJobInfo(info);
/*
- * Only report severe errors to the StatusManager if the error
- * is not part of a job group, or if the job is the last job in
- * a job group. For job groups, the JobManager accumulates the
- * status of jobs belonging to the group, suppresses the status
- * reporting of the individual jobs and reports a single
- * MultiStatus for the group, so mirror that behavior here.
+ * Only report severe errors to the StatusManager if the error is not part of a
+ * job group, or if the job is the last job in a job group. For job groups, the
+ * JobManager accumulates the status of jobs belonging to the group, suppresses
+ * the status reporting of the individual jobs and reports a single MultiStatus
+ * for the group, so mirror that behavior here.
*/
StatusAdapter statusAdapter = null;
if (event.getJobGroupResult() != null && event.getJobGroupResult().getSeverity() == IStatus.ERROR) {
statusAdapter = new StatusAdapter(event.getJobGroupResult());
- } else if (event.getResult() != null
- && event.getResult().getSeverity() == IStatus.ERROR
+ } else if (event.getResult() != null && event.getResult().getSeverity() == IStatus.ERROR
&& (event.getJob() == null || event.getJob().getJobGroup() == null)) {
statusAdapter = new StatusAdapter(event.getResult());
statusAdapter.addAdapter(Job.class, event.getJob());
@@ -512,7 +509,7 @@ public class ProgressManager extends ProgressProvider implements IProgressServic
protected void sleepJobInfo(JobInfo info) {
GroupInfo group = info.getGroupInfo();
if (group != null) {
- sleepGroup(group,info);
+ sleepGroup(group, info);
}
for (IJobProgressManagerListener listener : listeners) {
@@ -567,11 +564,9 @@ public class ProgressManager extends ProgressProvider implements IProgressServic
// only need a default monitor for operations the UI thread
// and only if there is a display
Display display;
- if (PlatformUI.isWorkbenchRunning()
- && !PlatformUI.getWorkbench().isStarting()) {
+ if (PlatformUI.isWorkbenchRunning() && !PlatformUI.getWorkbench().isStarting()) {
display = PlatformUI.getWorkbench().getDisplay();
- if (!display.isDisposed()
- && (display.getThread() == Thread.currentThread())) {
+ if (!display.isDisposed() && (display.getThread() == Thread.currentThread())) {
return new EventLoopProgressMonitor(new NullProgressMonitor());
}
}
@@ -599,8 +594,7 @@ public class ProgressManager extends ProgressProvider implements IProgressServic
}
/**
- * Removes the supplied IJobProgressManagerListener from the list of
- * listeners.
+ * Removes the supplied IJobProgressManagerListener from the list of listeners.
*
* @param listener
*/
@@ -609,8 +603,7 @@ public class ProgressManager extends ProgressProvider implements IProgressServic
}
/**
- * Refreshes the IJobProgressManagerListeners as a result of a change in
- * info.
+ * Refreshes the IJobProgressManagerListeners as a result of a change in info.
*
* @param info
*/
@@ -622,8 +615,7 @@ public class ProgressManager extends ProgressProvider implements IProgressServic
}
/**
- * Refreshes the IJobProgressManagerListeners as a result of a change in
- * info.
+ * Refreshes the IJobProgressManagerListeners as a result of a change in info.
*
* @param info
*/
@@ -637,8 +629,7 @@ public class ProgressManager extends ProgressProvider implements IProgressServic
/**
* Refreshes the content providers as a result of a deletion of info.
*
- * @param info
- * the info to remove
+ * @param info the info to remove
*/
public void removeJobInfo(JobInfo info) {
Job job = info.getJob();
@@ -653,8 +644,7 @@ public class ProgressManager extends ProgressProvider implements IProgressServic
/**
* Removes the group from the roots and inform the listeners.
*
- * @param group
- * GroupInfo
+ * @param group GroupInfo
*/
public void removeGroup(GroupInfo group) {
synchronized (pendingUpdatesMutex) {
@@ -684,8 +674,7 @@ public class ProgressManager extends ProgressProvider implements IProgressServic
private void rememberListenersForJob(JobInfo info, Map<JobInfo, Set<IJobProgressManagerListener>> listenersMap) {
Set<IJobProgressManagerListener> localListeners = listenersMap.computeIfAbsent(info,
k -> new LinkedHashSet<>());
- listeners.stream()
- .filter(listener -> !isCurrentDisplaying(info.getJob(), listener.showsDebug()))
+ listeners.stream().filter(listener -> !isCurrentDisplaying(info.getJob(), listener.showsDebug()))
.forEach(localListeners::add);
}
@@ -693,8 +682,7 @@ public class ProgressManager extends ProgressProvider implements IProgressServic
* Returns whether or not this job is currently displayable.
*
* @param job
- * @param debug
- * if the listener is in debug mode
+ * @param debug if the listener is in debug mode
* @return boolean <code>true</code> if the job is not displayed
*/
boolean isCurrentDisplaying(Job job, boolean debug) {
@@ -702,8 +690,7 @@ public class ProgressManager extends ProgressProvider implements IProgressServic
}
/**
- * Returns whether or not we even display this job with debug mode set to
- * debug.
+ * Returns whether or not we even display this job with debug mode set to debug.
*
* @param job
* @param debug
@@ -724,8 +711,7 @@ public class ProgressManager extends ProgressProvider implements IProgressServic
*/
public JobInfo[] getJobInfos(boolean debug) {
return managedJobs.stream().filter(job -> !isCurrentDisplaying(job, debug))
- .map(job -> progressFor(job).getJobInfo())
- .toArray(JobInfo[]::new);
+ .map(job -> progressFor(job).getJobInfo()).toArray(JobInfo[]::new);
}
/**
@@ -768,10 +754,8 @@ public class ProgressManager extends ProgressProvider implements IProgressServic
/**
* Returns the image descriptor with the given relative path.
*
- * @param fileSystemPath
- * The URL for the file system to the image.
- * @param loader
- * the loader used to get this data
+ * @param fileSystemPath The URL for the file system to the image.
+ * @param loader the loader used to get this data
* @return ImageData[]
*/
ImageData[] getImageData(URL fileSystemPath, ImageLoader loader) {
@@ -837,8 +821,7 @@ public class ProgressManager extends ProgressProvider implements IProgressServic
/**
* Schedules the job that will open the progress monitor dialog.
*
- * @param dialog
- * the dialog to open
+ * @param dialog the dialog to open
*/
private void scheduleProgressMonitorJob(final ProgressMonitorJobsDialog dialog) {
final WorkbenchJob updateJob = new WorkbenchJob(ProgressMessages.ProgressManager_openJobName) {
@@ -871,8 +854,7 @@ public class ProgressManager extends ProgressProvider implements IProgressServic
}
@Override
- public IProgressMonitor createMonitor(Job job, IProgressMonitor group,
- int ticks) {
+ public IProgressMonitor createMonitor(Job job, IProgressMonitor group, int ticks) {
JobMonitor monitor = progressFor(job);
if (group instanceof GroupInfo) {
GroupInfo groupInfo = (GroupInfo) group;
@@ -1021,11 +1003,10 @@ public class ProgressManager extends ProgressProvider implements IProgressServic
}
/**
- * Iterates through all of the windows and set them to be disabled or
- * enabled as appropriate.
+ * Iterates through all of the windows and set them to be disabled or enabled as
+ * appropriate.
*
- * @param active
- * the state the windows will be set to
+ * @param active the state the windows will be set to
*/
private void setUserInterfaceActive(boolean active) {
IWorkbench workbench = PlatformUI.getWorkbench();
@@ -1066,8 +1047,7 @@ public class ProgressManager extends ProgressProvider implements IProgressServic
* @return <code>true</code> if the dialog should not be shown
*/
private boolean shouldRunInBackground() {
- return WorkbenchPlugin.getDefault().getPreferenceStore().getBoolean(
- IPreferenceConstants.RUN_IN_BACKGROUND);
+ return WorkbenchPlugin.getDefault().getPreferenceStore().getBoolean(IPreferenceConstants.RUN_IN_BACKGROUND);
}
/**
@@ -1111,8 +1091,8 @@ public class ProgressManager extends ProgressProvider implements IProgressServic
}
/**
- * Returns a progress monitor that forwards to an event loop monitor.
- * Overrides #setBlocked() so that we always open the blocked dialog.
+ * Returns a progress monitor that forwards to an event loop monitor. Overrides
+ * #setBlocked() so that we always open the blocked dialog.
*
* @return the monitor on the event loop
*/
@@ -1125,8 +1105,8 @@ public class ProgressManager extends ProgressProvider implements IProgressServic
public void setBlocked(IStatus reason) {
// Set a shell to open with as we want to create this even
// if there is a modal shell.
- Dialog.getBlockedHandler().showBlocked(
- ProgressManagerUtil.getDefaultParent(), this, reason, getTaskName());
+ Dialog.getBlockedHandler().showBlocked(ProgressManagerUtil.getDefaultParent(), this, reason,
+ getTaskName());
}
};
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressManagerUtil.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressManagerUtil.java
index c608c42da4b..28d7947236d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressManagerUtil.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressManagerUtil.java
@@ -63,14 +63,14 @@ public class ProgressManagerUtil {
/*
* https://bugs.eclipse.org/371354
*
- * This ordering is inherently unstable, since it relies on
- * modifiable properties of the elements: E.g. the default
- * implementation in JobTreeElement compares getDisplayString(),
- * many of whose implementations use getPercentDone().
+ * This ordering is inherently unstable, since it relies on modifiable
+ * properties of the elements: E.g. the default implementation in JobTreeElement
+ * compares getDisplayString(), many of whose implementations use
+ * getPercentDone().
*
- * JavaSE 7+'s TimSort introduced a breaking change: It now throws a
- * new IllegalArgumentException for bad comparators. Workaround is
- * to retry a few times.
+ * JavaSE 7+'s TimSort introduced a breaking change: It now throws a new
+ * IllegalArgumentException for bad comparators. Workaround is to retry a few
+ * times.
*/
for (int retries = 3; retries > 0; retries--) {
try {
@@ -87,8 +87,8 @@ public class ProgressManagerUtil {
}
/**
- * A constant used by the progress support to determine if an operation is
- * too short to show progress.
+ * A constant used by the progress support to determine if an operation is too
+ * short to show progress.
*/
public static long SHORT_OPERATION_TIME = 250;
@@ -107,8 +107,7 @@ public class ProgressManagerUtil {
* @return IStatus
*/
static IStatus exceptionStatus(Throwable exception) {
- return StatusUtil.newStatus(IStatus.ERROR,
- exception.getMessage() == null ? "" : exception.getMessage(), //$NON-NLS-1$
+ return StatusUtil.newStatus(IStatus.ERROR, exception.getMessage() == null ? "" : exception.getMessage(), //$NON-NLS-1$
exception);
}
@@ -149,8 +148,7 @@ public class ProgressManagerUtil {
return;
}
try {
- IViewDescriptor reference = WorkbenchPlugin.getDefault()
- .getViewRegistry()
+ IViewDescriptor reference = WorkbenchPlugin.getDefault().getViewRegistry()
.find(IProgressConstants.PROGRESS_VIEW_ID);
if (reference == null) {
@@ -163,10 +161,10 @@ public class ProgressManagerUtil {
}
/**
- * Shorten the given text <code>t</code> so that its length doesn't exceed
- * the given width. The default implementation replaces characters in the
- * center of the original string with an ellipsis ("..."). Override if you
- * need a different strategy.
+ * Shorten the given text <code>t</code> so that its length doesn't exceed the
+ * given width. The default implementation replaces characters in the center of
+ * the original string with an ellipsis ("..."). Override if you need a
+ * different strategy.
*
* @param textValue
* @param control
@@ -210,8 +208,7 @@ public class ProgressManagerUtil {
if (maxExtent <= maxWidth) {
return textValue;
}
- currentLength = Math.max(0,
- Math.round(length * ((float) maxWidth / maxExtent)) - ellipsisString.length());
+ currentLength = Math.max(0, Math.round(length * ((float) maxWidth / maxExtent)) - ellipsisString.length());
upperBoundWidth = maxExtent;
upperBoundLength = length;
} else {
@@ -334,18 +331,15 @@ public class ProgressManagerUtil {
}
/**
- * Find the second index of a whitespace. Return the first index if there
- * isn't one or 0 if there is no space at all.
+ * Find the second index of a whitespace. Return the first index if there isn't
+ * one or 0 if there is no space at all.
*
* @param textValue
- * @param gc
- * The GC to test max length
- * @param maxWidth
- * The maximim extent
+ * @param gc The GC to test max length
+ * @param maxWidth The maximim extent
* @return int
*/
- private static int findSecondWhitespace(String textValue, GC gc,
- int maxWidth) {
+ private static int findSecondWhitespace(String textValue, GC gc, int maxWidth) {
int firstCharacter = 0;
char[] chars = textValue.toCharArray();
// Find the first whitespace
@@ -380,9 +374,8 @@ public class ProgressManagerUtil {
}
/**
- * If there are any modal shells open reschedule openJob to wait until they
- * are closed. Return true if it rescheduled, false if there is nothing
- * blocking it.
+ * If there are any modal shells open reschedule openJob to wait until they are
+ * closed. Return true if it rescheduled, false if there is nothing blocking it.
*
* @param openJob
* @return boolean. true if the job was rescheduled due to modal dialogs.
@@ -394,8 +387,7 @@ public class ProgressManagerUtil {
}
// try again in a few seconds
- openJob.schedule(PlatformUI.getWorkbench().getProgressService()
- .getLongOperationTime());
+ openJob.schedule(PlatformUI.getWorkbench().getProgressService().getLongOperationTime());
return true;
}
@@ -404,15 +396,12 @@ public class ProgressManagerUtil {
* <code>true</code>. If not then set it to open itself when it has had
* ProgressManager#longOperationTime worth of ticks.
*
- * @param dialog
- * ProgressMonitorJobsDialog that will be opening
- * @param excludedShell
- * The shell
- * @return boolean. <code>true</code> if it can open. Otherwise return
- * false and set the dialog to tick.
+ * @param dialog ProgressMonitorJobsDialog that will be opening
+ * @param excludedShell The shell
+ * @return boolean. <code>true</code> if it can open. Otherwise return false and
+ * set the dialog to tick.
*/
- public static boolean safeToOpen(ProgressMonitorJobsDialog dialog,
- Shell excludedShell) {
+ public static boolean safeToOpen(ProgressMonitorJobsDialog dialog, Shell excludedShell) {
Shell modal = getModalShellExcluding(excludedShell);
if (modal == null) {
return true;
@@ -423,11 +412,10 @@ public class ProgressManagerUtil {
}
/**
- * Return the modal shell that is currently open. If there isn't one then
- * return null. If there are stacked modal shells, return the top one.
+ * Return the modal shell that is currently open. If there isn't one then return
+ * null. If there are stacked modal shells, return the top one.
*
- * @param shell
- * A shell to exclude from the search. May be <code>null</code>.
+ * @param shell A shell to exclude from the search. May be <code>null</code>.
*
* @return Shell or <code>null</code>.
*/
@@ -436,8 +424,7 @@ public class ProgressManagerUtil {
// If shell is null or disposed, then look through all shells
if (shell == null || shell.isDisposed()) {
- return getModalChildExcluding(PlatformUI.getWorkbench()
- .getDisplay().getShells(), shell);
+ return getModalChildExcluding(PlatformUI.getWorkbench().getDisplay().getShells(), shell);
}
// Start with the shell to exclude and check it's shells
@@ -445,16 +432,15 @@ public class ProgressManagerUtil {
}
/**
- * Return the modal shell that is currently open. If there isn't one then
- * return null.
+ * Return the modal shell that is currently open. If there isn't one then return
+ * null.
*
- * @param toSearch shells to search for modal children
+ * @param toSearch shells to search for modal children
* @param toExclude shell to ignore
* @return the most specific modal child, or null if none
*/
private static Shell getModalChildExcluding(Shell[] toSearch, Shell toExclude) {
- int modal = SWT.APPLICATION_MODAL | SWT.SYSTEM_MODAL
- | SWT.PRIMARY_MODAL;
+ int modal = SWT.APPLICATION_MODAL | SWT.SYSTEM_MODAL | SWT.PRIMARY_MODAL;
// Make sure we don't pick a parent that has a modal child (this can
// lock the app)
@@ -462,7 +448,7 @@ public class ProgressManagerUtil {
for (int i = toSearch.length - 1; i >= 0; i--) {
Shell shell = toSearch[i];
- if(shell.equals(toExclude)) {
+ if (shell.equals(toExclude)) {
continue;
}
@@ -483,11 +469,11 @@ public class ProgressManagerUtil {
}
/**
- * Utility method to get the best parenting possible for a dialog. If there
- * is a modal shell return it so as to avoid two modal dialogs. If not then
- * return the shell of the active workbench window. If that shell is
- * <code>null</code> or not visible, then return the splash shell if still
- * visible. Otherwise return the shell of the active workbench window.
+ * Utility method to get the best parenting possible for a dialog. If there is a
+ * modal shell return it so as to avoid two modal dialogs. If not then return
+ * the shell of the active workbench window. If that shell is <code>null</code>
+ * or not visible, then return the splash shell if still visible. Otherwise
+ * return the shell of the active workbench window.
*
* @return the best parent shell or <code>null</code>
*/
@@ -543,15 +529,13 @@ public class ProgressManagerUtil {
}
/**
- * Animate the closing of a window given the start position down to the
- * progress region.
+ * Animate the closing of a window given the start position down to the progress
+ * region.
*
- * @param startPosition
- * Rectangle. The position to start drawing from.
+ * @param startPosition Rectangle. The position to start drawing from.
*/
public static void animateDown(Rectangle startPosition) {
- IWorkbenchWindow currentWindow = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow();
+ IWorkbenchWindow currentWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (currentWindow == null) {
return;
}
@@ -572,15 +556,13 @@ public class ProgressManagerUtil {
}
/**
- * Animate the opening of a window given the start position down to the
- * progress region.
+ * Animate the opening of a window given the start position down to the progress
+ * region.
*
- * @param endPosition
- * Rectangle. The position to end drawing at.
+ * @param endPosition Rectangle. The position to end drawing at.
*/
public static void animateUp(Rectangle endPosition) {
- IWorkbenchWindow currentWindow = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow();
+ IWorkbenchWindow currentWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (currentWindow == null) {
return;
}
@@ -600,9 +582,9 @@ public class ProgressManagerUtil {
}
/**
- * Get the shell provider to use in the progress support dialogs. This
- * provider will try to always parent off of an existing modal shell. If
- * there isn't one it will use the current workbench window.
+ * Get the shell provider to use in the progress support dialogs. This provider
+ * will try to always parent off of an existing modal shell. If there isn't one
+ * it will use the current workbench window.
*
* @return IShellProvider
*/
@@ -616,8 +598,7 @@ public class ProgressManagerUtil {
* @return URL
*/
public static URL getIconsRoot() {
- return BundleUtility.find(PlatformUI.PLUGIN_ID,
- ProgressManager.PROGRESS_FOLDER);
+ return BundleUtility.find(PlatformUI.PLUGIN_ID, ProgressManager.PROGRESS_FOLDER);
}
/**
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressMonitorFocusJobDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressMonitorFocusJobDialog.java
index 4bb89098a76..84c1148973c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressMonitorFocusJobDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressMonitorFocusJobDialog.java
@@ -56,14 +56,11 @@ public class ProgressMonitorFocusJobDialog extends ProgressMonitorJobsDialog {
/**
* Create a new instance of the receiver with progress reported on the job.
*
- * @param parentShell
- * The shell this is parented from.
+ * @param parentShell The shell this is parented from.
*/
public ProgressMonitorFocusJobDialog(Shell parentShell) {
- super(parentShell == null ? ProgressManagerUtil.getNonModalShell()
- : parentShell);
- setShellStyle(getDefaultOrientation() | SWT.BORDER | SWT.TITLE
- | SWT.RESIZE | SWT.MAX | SWT.MODELESS);
+ super(parentShell == null ? ProgressManagerUtil.getNonModalShell() : parentShell);
+ setShellStyle(getDefaultOrientation() | SWT.BORDER | SWT.TITLE | SWT.RESIZE | SWT.MAX | SWT.MODELESS);
setCancelable(true);
enableDetailsButton = true;
}
@@ -89,11 +86,8 @@ public class ProgressMonitorFocusJobDialog extends ProgressMonitorJobsDialog {
@Override
protected void createButtonsForButtonBar(Composite parent) {
- Button runInWorkspace = createButton(
- parent,
- IDialogConstants.CLOSE_ID,
- ProgressMessages.ProgressMonitorFocusJobDialog_RunInBackgroundButton,
- true);
+ Button runInWorkspace = createButton(parent, IDialogConstants.CLOSE_ID,
+ ProgressMessages.ProgressMonitorFocusJobDialog_RunInBackgroundButton, true);
runInWorkspace.addSelectionListener(widgetSelectedAdapter(e -> {
Rectangle shellPosition = getShell().getBounds();
job.setProperty(IProgressConstants.PROPERTY_IN_DIALOG, Boolean.FALSE);
@@ -102,8 +96,7 @@ public class ProgressMonitorFocusJobDialog extends ProgressMonitorJobsDialog {
}));
runInWorkspace.setCursor(arrowCursor);
- cancel = createButton(parent, IDialogConstants.CANCEL_ID,
- IDialogConstants.CANCEL_LABEL, false);
+ cancel = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
cancel.setCursor(arrowCursor);
createDetailsButton(parent);
@@ -167,9 +160,8 @@ public class ProgressMonitorFocusJobDialog extends ProgressMonitorJobsDialog {
* Opens this dialog for the duration that the given job is running.
*
* @param jobToWatch
- * @param originatingShell
- * The shell this request was created from. Do not block on this
- * shell.
+ * @param originatingShell The shell this request was created from. Do not block
+ * on this shell.
*/
public void show(Job jobToWatch, final Shell originatingShell) {
job = jobToWatch;
@@ -192,23 +184,21 @@ public class ProgressMonitorFocusJobDialog extends ProgressMonitorJobsDialog {
// start with a quick busy indicator. Lock the UI as we
// want to preserve modality
- BusyIndicator.showWhile(PlatformUI.getWorkbench().getDisplay(),
- () -> {
- try {
- synchronized (jobIsDone) {
- if (job.getState() != Job.NONE) {
- jobIsDone.wait(ProgressManagerUtil.SHORT_OPERATION_TIME);
- }
- }
- } catch (InterruptedException e) {
- // Do not log as this is a common operation from the
- // lock listener
+ BusyIndicator.showWhile(PlatformUI.getWorkbench().getDisplay(), () -> {
+ try {
+ synchronized (jobIsDone) {
+ if (job.getState() != Job.NONE) {
+ jobIsDone.wait(ProgressManagerUtil.SHORT_OPERATION_TIME);
}
- });
+ }
+ } catch (InterruptedException e) {
+ // Do not log as this is a common operation from the
+ // lock listener
+ }
+ });
job.removeJobChangeListener(jobListener);
- WorkbenchJob openJob = new WorkbenchJob(
- ProgressMessages.ProgressMonitorFocusJobDialog_UserDialogJob) {
+ WorkbenchJob openJob = new WorkbenchJob(ProgressMessages.ProgressMonitorFocusJobDialog_UserDialogJob) {
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
@@ -220,8 +210,7 @@ public class ProgressMonitorFocusJobDialog extends ProgressMonitorJobsDialog {
}
// now open the progress dialog if nothing else is
- if (!ProgressManagerUtil.safeToOpen(
- ProgressMonitorFocusJobDialog.this, originatingShell)) {
+ if (!ProgressManagerUtil.safeToOpen(ProgressMonitorFocusJobDialog.this, originatingShell)) {
return Status.CANCEL_STATUS;
}
@@ -246,8 +235,7 @@ public class ProgressMonitorFocusJobDialog extends ProgressMonitorJobsDialog {
}
/**
- * The job finished before we did anything so clean up the finished
- * reference.
+ * The job finished before we did anything so clean up the finished reference.
*/
private void cleanUpFinishedJob() {
ProgressManager.getInstance().checkForStaleness(job);
@@ -257,9 +245,8 @@ public class ProgressMonitorFocusJobDialog extends ProgressMonitorJobsDialog {
protected Control createDialogArea(Composite parent) {
Control area = super.createDialogArea(parent);
// Give the job info as the initial details
- getProgressMonitor().setTaskName(
- ProgressManager.getInstance().progressFor(this.job).getJobInfo()
- .getDisplayString());
+ getProgressMonitor()
+ .setTaskName(ProgressManager.getInstance().progressFor(this.job).getJobInfo().getDisplayString());
return area;
}
@@ -269,16 +256,15 @@ public class ProgressMonitorFocusJobDialog extends ProgressMonitorJobsDialog {
showDialog = WorkbenchPlugin.getDefault().getPreferenceStore()
.getBoolean(IPreferenceConstants.RUN_IN_BACKGROUND);
final Button showUserDialogButton = new Button(parent, SWT.CHECK);
- showUserDialogButton
- .setText(WorkbenchMessages.WorkbenchPreference_RunInBackgroundButton);
- showUserDialogButton
- .setToolTipText(WorkbenchMessages.WorkbenchPreference_RunInBackgroundToolTip);
+ showUserDialogButton.setText(WorkbenchMessages.WorkbenchPreference_RunInBackgroundButton);
+ showUserDialogButton.setToolTipText(WorkbenchMessages.WorkbenchPreference_RunInBackgroundToolTip);
GridData gd = new GridData();
gd.horizontalSpan = 2;
gd.horizontalAlignment = GridData.FILL;
showUserDialogButton.setLayoutData(gd);
- showUserDialogButton.addSelectionListener(widgetSelectedAdapter(e -> showDialog = showUserDialogButton.getSelection()));
+ showUserDialogButton
+ .addSelectionListener(widgetSelectedAdapter(e -> showDialog = showUserDialogButton.getSelection()));
super.createExtendedDialogArea(parent);
}
@@ -286,8 +272,8 @@ public class ProgressMonitorFocusJobDialog extends ProgressMonitorJobsDialog {
@Override
public boolean close() {
if (getReturnCode() != CANCEL)
- WorkbenchPlugin.getDefault().getPreferenceStore().setValue(
- IPreferenceConstants.RUN_IN_BACKGROUND, showDialog);
+ WorkbenchPlugin.getDefault().getPreferenceStore().setValue(IPreferenceConstants.RUN_IN_BACKGROUND,
+ showDialog);
return super.close();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressMonitorJobsDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressMonitorJobsDialog.java
index 280dddcd222..a8019638b33 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressMonitorJobsDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressMonitorJobsDialog.java
@@ -42,364 +42,353 @@ import org.eclipse.ui.internal.misc.Policy;
* progress service to allow locks to show the current jobs.
*/
public class ProgressMonitorJobsDialog extends ProgressMonitorDialog {
- private DetailedProgressViewer viewer;
+ private DetailedProgressViewer viewer;
- /**
- * The height of the viewer. Set when the details button is selected.
- */
- private int viewerHeight = -1;
+ /**
+ * The height of the viewer. Set when the details button is selected.
+ */
+ private int viewerHeight = -1;
- Composite viewerComposite;
+ Composite viewerComposite;
- private Button detailsButton;
+ private Button detailsButton;
- private long watchTime = -1;
+ private long watchTime = -1;
- protected boolean alreadyClosed = false;
+ protected boolean alreadyClosed = false;
- private IProgressMonitor wrapperedMonitor;
+ private IProgressMonitor wrapperedMonitor;
- //Cache initial enablement in case the enablement state is set
- //before the button is created
- protected boolean enableDetailsButton = false;
+ // Cache initial enablement in case the enablement state is set
+ // before the button is created
+ protected boolean enableDetailsButton = false;
- /**
- * Create a new instance of the receiver.
- *
- * @param parent
- */
- public ProgressMonitorJobsDialog(Shell parent) {
- super(parent);
- }
+ /**
+ * Create a new instance of the receiver.
+ *
+ * @param parent
+ */
+ public ProgressMonitorJobsDialog(Shell parent) {
+ super(parent);
+ }
- @Override
+ @Override
protected Control createDialogArea(Composite parent) {
- Composite top = (Composite) super.createDialogArea(parent);
- createExtendedDialogArea(parent);
- return top;
- }
+ Composite top = (Composite) super.createDialogArea(parent);
+ createExtendedDialogArea(parent);
+ return top;
+ }
/**
* Create the extensions to the dialog area.
+ *
* @param parent
*/
protected void createExtendedDialogArea(Composite parent) {
viewerComposite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- viewerComposite.setLayout(layout);
- GridData viewerData = new GridData(GridData.FILL_BOTH);
- viewerData.horizontalSpan = 2;
- viewerData.heightHint = 0;
- viewerComposite.setLayoutData(viewerData);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ viewerComposite.setLayout(layout);
+ GridData viewerData = new GridData(GridData.FILL_BOTH);
+ viewerData.horizontalSpan = 2;
+ viewerData.heightHint = 0;
+ viewerComposite.setLayoutData(viewerData);
}
- /**
- * The details button has been selected. Open or close the progress viewer
- * as appropriate.
- *
- */
- void handleDetailsButtonSelect() {
- Shell shell = getShell();
- Point shellSize = shell.getSize();
- Composite composite = (Composite) getDialogArea();
- if (viewer != null) {
- viewer.getControl().dispose();
- viewer = null;
- composite.layout();
- shell.setSize(shellSize.x, shellSize.y - viewerHeight);
- detailsButton.setText(ProgressMessages.ProgressMonitorJobsDialog_DetailsTitle);
- } else {
- //Abort if there are no jobs visible
- if (ProgressManager.getInstance().getRootElements(Policy.DEBUG_SHOW_ALL_JOBS).length == 0) {
- detailsButton.setEnabled(false);
- return;
- }
-
- viewer = new DetailedProgressViewer(viewerComposite, SWT.MULTI
- | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- viewer.setComparator(new ViewerComparator() {
+ /**
+ * The details button has been selected. Open or close the progress viewer as
+ * appropriate.
+ *
+ */
+ void handleDetailsButtonSelect() {
+ Shell shell = getShell();
+ Point shellSize = shell.getSize();
+ Composite composite = (Composite) getDialogArea();
+ if (viewer != null) {
+ viewer.getControl().dispose();
+ viewer = null;
+ composite.layout();
+ shell.setSize(shellSize.x, shellSize.y - viewerHeight);
+ detailsButton.setText(ProgressMessages.ProgressMonitorJobsDialog_DetailsTitle);
+ } else {
+ // Abort if there are no jobs visible
+ if (ProgressManager.getInstance().getRootElements(Policy.DEBUG_SHOW_ALL_JOBS).length == 0) {
+ detailsButton.setEnabled(false);
+ return;
+ }
+
+ viewer = new DetailedProgressViewer(viewerComposite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ viewer.setComparator(new ViewerComparator() {
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public int compare(Viewer testViewer, Object e1, Object e2) {
- return ((Comparable) e1).compareTo(e2);
- }
- });
+ return ((Comparable) e1).compareTo(e2);
+ }
+ });
- viewer.setContentProvider(new ProgressViewerContentProvider(viewer,true,false){
- @Override
+ viewer.setContentProvider(new ProgressViewerContentProvider(viewer, true, false) {
+ @Override
public Object[] getElements(Object inputElement) {
- return super.getElements(inputElement);
- }}
- );
-
- viewer.setLabelProvider(new ProgressLabelProvider());
- viewer.setInput(this);
- GridData viewerData = new GridData(GridData.FILL_BOTH);
- viewer.getControl().setLayoutData(viewerData);
- GridData viewerCompositeData = (GridData) viewerComposite.getLayoutData();
- viewerCompositeData.heightHint = convertHeightInCharsToPixels(10);
- viewerComposite.layout(true);
- viewer.getControl().setVisible(true);
- viewerHeight = viewerComposite.computeTrim(0, 0, 0, viewerCompositeData.heightHint).height;
- detailsButton.setText(ProgressMessages.ProgressMonitorJobsDialog_HideTitle);
- shell.setSize(shellSize.x, shellSize.y + viewerHeight);
- }
- }
-
- @Override
+ return super.getElements(inputElement);
+ }
+ });
+
+ viewer.setLabelProvider(new ProgressLabelProvider());
+ viewer.setInput(this);
+ GridData viewerData = new GridData(GridData.FILL_BOTH);
+ viewer.getControl().setLayoutData(viewerData);
+ GridData viewerCompositeData = (GridData) viewerComposite.getLayoutData();
+ viewerCompositeData.heightHint = convertHeightInCharsToPixels(10);
+ viewerComposite.layout(true);
+ viewer.getControl().setVisible(true);
+ viewerHeight = viewerComposite.computeTrim(0, 0, 0, viewerCompositeData.heightHint).height;
+ detailsButton.setText(ProgressMessages.ProgressMonitorJobsDialog_HideTitle);
+ shell.setSize(shellSize.x, shellSize.y + viewerHeight);
+ }
+ }
+
+ @Override
protected void createButtonsForButtonBar(Composite parent) {
- super.createButtonsForButtonBar(parent);
- createDetailsButton(parent);
- }
-
- /**
- * Create a spacer label to get the layout to not bunch the widgets.
- *
- * @param parent
- * The parent of the new button.
- */
- protected void createSpacer(Composite parent) {
- //Make a label to force the spacing
- Label spacer = new Label(parent, SWT.NONE);
- spacer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL
- | GridData.GRAB_HORIZONTAL));
- }
-
- /**
- * Create the details button for the receiver.
- *
- * @param parent
- * The parent of the new button.
- */
- protected void createDetailsButton(Composite parent) {
- detailsButton = createButton(parent, IDialogConstants.DETAILS_ID,
- ProgressMessages.ProgressMonitorJobsDialog_DetailsTitle,
- false);
- detailsButton.addSelectionListener(widgetSelectedAdapter(e -> handleDetailsButtonSelect()));
- detailsButton.setCursor(arrowCursor);
- detailsButton.setEnabled(enableDetailsButton);
- }
-
- @Override
+ super.createButtonsForButtonBar(parent);
+ createDetailsButton(parent);
+ }
+
+ /**
+ * Create a spacer label to get the layout to not bunch the widgets.
+ *
+ * @param parent The parent of the new button.
+ */
+ protected void createSpacer(Composite parent) {
+ // Make a label to force the spacing
+ Label spacer = new Label(parent, SWT.NONE);
+ spacer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
+ }
+
+ /**
+ * Create the details button for the receiver.
+ *
+ * @param parent The parent of the new button.
+ */
+ protected void createDetailsButton(Composite parent) {
+ detailsButton = createButton(parent, IDialogConstants.DETAILS_ID,
+ ProgressMessages.ProgressMonitorJobsDialog_DetailsTitle, false);
+ detailsButton.addSelectionListener(widgetSelectedAdapter(e -> handleDetailsButtonSelect()));
+ detailsButton.setCursor(arrowCursor);
+ detailsButton.setEnabled(enableDetailsButton);
+ }
+
+ @Override
protected Control createButtonBar(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- // create a layout with spacing and margins appropriate for the font
- // size.
- GridLayout layout = new GridLayout();
- layout.numColumns = 1; // this is incremented by createButton
- layout.makeColumnsEqualWidth = false;
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- composite.setLayout(layout);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- data.horizontalAlignment = GridData.END;
- data.grabExcessHorizontalSpace = true;
- composite.setLayoutData(data);
- composite.setFont(parent.getFont());
- // Add the buttons to the button bar.
- if (arrowCursor == null) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ // create a layout with spacing and margins appropriate for the font
+ // size.
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1; // this is incremented by createButton
+ layout.makeColumnsEqualWidth = false;
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+ layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
+ composite.setLayout(layout);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 2;
+ data.horizontalAlignment = GridData.END;
+ data.grabExcessHorizontalSpace = true;
+ composite.setLayoutData(data);
+ composite.setFont(parent.getFont());
+ // Add the buttons to the button bar.
+ if (arrowCursor == null) {
arrowCursor = new Cursor(parent.getDisplay(), SWT.CURSOR_ARROW);
}
- createButtonsForButtonBar(composite);
- return composite;
- }
+ createButtonsForButtonBar(composite);
+ return composite;
+ }
- @Override
+ @Override
protected void clearCursors() {
- if (detailsButton != null && !detailsButton.isDisposed()) {
- detailsButton.setCursor(null);
- }
- super.clearCursors();
- }
+ if (detailsButton != null && !detailsButton.isDisposed()) {
+ detailsButton.setCursor(null);
+ }
+ super.clearCursors();
+ }
- @Override
+ @Override
protected void updateForSetBlocked(IStatus reason) {
- if(alreadyClosed)
- return;
+ if (alreadyClosed)
+ return;
- super.updateForSetBlocked(reason);
- enableDetails(true);
- if (viewer == null) {
+ super.updateForSetBlocked(reason);
+ enableDetails(true);
+ if (viewer == null) {
handleDetailsButtonSelect();
}
- }
-
- @Override
- public void run(boolean fork, boolean cancelable,
- IRunnableWithProgress runnable) throws InvocationTargetException,
- InterruptedException {
- //if it is run in the UI Thread don't do anything.
- if (!fork) {
- enableDetails(false);
- }
- super.run(fork, cancelable, runnable);
- }
-
- /**
- * Set the enable state of the details button now or when it will be
- * created.
- *
- * @param enableState
- * a boolean to indicate the preferred' state
- */
- protected void enableDetails(boolean enableState) {
- if (detailsButton == null) {
+ }
+
+ @Override
+ public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable)
+ throws InvocationTargetException, InterruptedException {
+ // if it is run in the UI Thread don't do anything.
+ if (!fork) {
+ enableDetails(false);
+ }
+ super.run(fork, cancelable, runnable);
+ }
+
+ /**
+ * Set the enable state of the details button now or when it will be created.
+ *
+ * @param enableState a boolean to indicate the preferred' state
+ */
+ protected void enableDetails(boolean enableState) {
+ if (detailsButton == null) {
enableDetailsButton = enableState;
} else {
detailsButton.setEnabled(enableState);
}
- }
-
- /**
- * Start watching the ticks. When the long operation time has
- * passed open the dialog.
- */
- public void watchTicks() {
- watchTime = System.currentTimeMillis();
- }
-
- /**
- * Create a monitor for the receiver that wrappers the superclasses monitor.
- *
- */
- public void createWrapperedMonitor() {
- wrapperedMonitor = new IProgressMonitorWithBlocking() {
-
- IProgressMonitor superMonitor = ProgressMonitorJobsDialog.super
- .getProgressMonitor();
-
- @Override
+ }
+
+ /**
+ * Start watching the ticks. When the long operation time has passed open the
+ * dialog.
+ */
+ public void watchTicks() {
+ watchTime = System.currentTimeMillis();
+ }
+
+ /**
+ * Create a monitor for the receiver that wrappers the superclasses monitor.
+ *
+ */
+ public void createWrapperedMonitor() {
+ wrapperedMonitor = new IProgressMonitorWithBlocking() {
+
+ IProgressMonitor superMonitor = ProgressMonitorJobsDialog.super.getProgressMonitor();
+
+ @Override
public void beginTask(String name, int totalWork) {
- superMonitor.beginTask(name, totalWork);
- checkTicking();
- }
-
- /**
- * Check if we have ticked in the last 800ms.
- */
- private void checkTicking() {
- if (watchTime < 0) {
+ superMonitor.beginTask(name, totalWork);
+ checkTicking();
+ }
+
+ /**
+ * Check if we have ticked in the last 800ms.
+ */
+ private void checkTicking() {
+ if (watchTime < 0) {
return;
}
- if ((System.currentTimeMillis() - watchTime) > ProgressManager
- .getInstance().getLongOperationTime()) {
- watchTime = -1;
- openDialog();
- }
- }
-
- /**
- * Open the dialog in the ui Thread
- */
- private void openDialog() {
- if (!PlatformUI.isWorkbenchRunning()) {
+ if ((System.currentTimeMillis() - watchTime) > ProgressManager.getInstance().getLongOperationTime()) {
+ watchTime = -1;
+ openDialog();
+ }
+ }
+
+ /**
+ * Open the dialog in the ui Thread
+ */
+ private void openDialog() {
+ if (!PlatformUI.isWorkbenchRunning()) {
return;
}
- PlatformUI.getWorkbench().getDisplay().syncExec(() -> {
- //Reset the watch if it is not safe to open
- if (!ProgressManagerUtil.safeToOpen(ProgressMonitorJobsDialog.this,null)){
- watchTicks();
- return;
- }
+ PlatformUI.getWorkbench().getDisplay().syncExec(() -> {
+ // Reset the watch if it is not safe to open
+ if (!ProgressManagerUtil.safeToOpen(ProgressMonitorJobsDialog.this, null)) {
+ watchTicks();
+ return;
+ }
- if (!alreadyClosed) {
+ if (!alreadyClosed) {
open();
}
});
- }
+ }
- @Override
+ @Override
public void done() {
- superMonitor.done();
- checkTicking();
- }
+ superMonitor.done();
+ checkTicking();
+ }
- @Override
+ @Override
public void internalWorked(double work) {
- superMonitor.internalWorked(work);
- checkTicking();
- }
+ superMonitor.internalWorked(work);
+ checkTicking();
+ }
- @Override
+ @Override
public boolean isCanceled() {
- return superMonitor.isCanceled();
- }
+ return superMonitor.isCanceled();
+ }
- @Override
+ @Override
public void setCanceled(boolean value) {
- superMonitor.setCanceled(value);
+ superMonitor.setCanceled(value);
- }
+ }
- @Override
+ @Override
public void setTaskName(String name) {
- superMonitor.setTaskName(name);
- checkTicking();
+ superMonitor.setTaskName(name);
+ checkTicking();
- }
+ }
- @Override
+ @Override
public void subTask(String name) {
- superMonitor.subTask(name);
- checkTicking();
- }
+ superMonitor.subTask(name);
+ checkTicking();
+ }
- @Override
+ @Override
public void worked(int work) {
- superMonitor.worked(work);
- checkTicking();
+ superMonitor.worked(work);
+ checkTicking();
- }
+ }
- @Override
+ @Override
public void clearBlocked() {
- //We want to open on blocking too
- if (superMonitor instanceof IProgressMonitorWithBlocking) {
- ((IProgressMonitorWithBlocking) superMonitor)
- .clearBlocked();
+ // We want to open on blocking too
+ if (superMonitor instanceof IProgressMonitorWithBlocking) {
+ ((IProgressMonitorWithBlocking) superMonitor).clearBlocked();
}
- }
+ }
- @Override
+ @Override
public void setBlocked(IStatus reason) {
- openDialog();
- if (superMonitor instanceof IProgressMonitorWithBlocking) {
- ((IProgressMonitorWithBlocking) superMonitor)
- .setBlocked(reason);
+ openDialog();
+ if (superMonitor instanceof IProgressMonitorWithBlocking) {
+ ((IProgressMonitorWithBlocking) superMonitor).setBlocked(reason);
}
- }
+ }
- };
- }
+ };
+ }
- @Override
+ @Override
public IProgressMonitor getProgressMonitor() {
- if (wrapperedMonitor == null) {
+ if (wrapperedMonitor == null) {
createWrapperedMonitor();
}
- return wrapperedMonitor;
- }
+ return wrapperedMonitor;
+ }
- @Override
+ @Override
public boolean close() {
- alreadyClosed = true;//As this sometimes delayed cache if it was already closed
- boolean result = super.close();
- if (!result) {//If it fails reset the flag
- alreadyClosed = false;
- }
- return result;
- }
-
- @Override
+ alreadyClosed = true;// As this sometimes delayed cache if it was already closed
+ boolean result = super.close();
+ if (!result) {// If it fails reset the flag
+ alreadyClosed = false;
+ }
+ return result;
+ }
+
+ @Override
protected boolean isResizable() {
- return true;
- }
+ return true;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressRegion.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressRegion.java
index f6d83ee7927..edaa052d872 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressRegion.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressRegion.java
@@ -46,11 +46,11 @@ public class ProgressRegion {
@Inject
IWorkbenchWindow workbenchWindow;
- ProgressCanvasViewer viewer;
+ ProgressCanvasViewer viewer;
- ProgressAnimationItem animationItem;
+ ProgressAnimationItem animationItem;
- Composite region;
+ Composite region;
/**
* the side the receiver is placed on
@@ -72,26 +72,25 @@ public class ProgressRegion {
private boolean forceHorizontal;
- /**
- * Create the contents of the receiver in the parent. Use the window for the
- * animation item.
- *
- * @param parent
- * The parent widget of the composite.
- * @return Control
- */
+ /**
+ * Create the contents of the receiver in the parent. Use the window for the
+ * animation item.
+ *
+ * @param parent The parent widget of the composite.
+ * @return Control
+ */
@PostConstruct
public Control createContents(Composite parent) {
- // Test whether or not 'advanced' graphics are available
- // If not then we'll 'force' the ProgressBar to always be
- // HORIZONTAL...
- //TODO: This should likely be at some 'global' level state
- GC gc = new GC(parent);
- gc.setAdvanced(true);
- forceHorizontal = !gc.getAdvanced();
- gc.dispose();
-
- region = new Composite(parent, SWT.NONE) {
+ // Test whether or not 'advanced' graphics are available
+ // If not then we'll 'force' the ProgressBar to always be
+ // HORIZONTAL...
+ // TODO: This should likely be at some 'global' level state
+ GC gc = new GC(parent);
+ gc.setAdvanced(true);
+ forceHorizontal = !gc.getAdvanced();
+ gc.dispose();
+
+ region = new Composite(parent, SWT.NONE) {
@Override
public Point computeSize(int wHint, int hHint, boolean changed) {
Point size = super.computeSize(wHint, hHint, changed);
@@ -104,113 +103,111 @@ public class ProgressRegion {
}
};
- GridLayout gl = new GridLayout();
- gl.marginHeight = 0;
- gl.marginWidth = 0;
+ GridLayout gl = new GridLayout();
+ gl.marginHeight = 0;
+ gl.marginWidth = 0;
if (isHorizontal())
- gl.numColumns = 3;
- region.setLayout(gl);
+ gl.numColumns = 3;
+ region.setLayout(gl);
viewer = new ProgressCanvasViewer(region, SWT.NO_FOCUS, 1, 36, isHorizontal() ? SWT.HORIZONTAL : SWT.VERTICAL);
- viewer.setUseHashlookup(true);
- Control viewerControl = viewer.getControl();
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
- Point viewerSizeHints = viewer.getSizeHints();
+ viewer.setUseHashlookup(true);
+ Control viewerControl = viewer.getControl();
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ Point viewerSizeHints = viewer.getSizeHints();
if (isHorizontal()) {
- gd.widthHint = viewerSizeHints.x;
- gd.heightHint = viewerSizeHints.y;
- } else {
- gd.widthHint = viewerSizeHints.y;
- gd.heightHint = viewerSizeHints.x;
- }
- viewerControl.setLayoutData(gd);
-
- int widthPreference = AnimationManager.getInstance()
- .getPreferredWidth() + 25;
+ gd.widthHint = viewerSizeHints.x;
+ gd.heightHint = viewerSizeHints.y;
+ } else {
+ gd.widthHint = viewerSizeHints.y;
+ gd.heightHint = viewerSizeHints.x;
+ }
+ viewerControl.setLayoutData(gd);
+
+ int widthPreference = AnimationManager.getInstance().getPreferredWidth() + 25;
animationItem = new ProgressAnimationItem(this, isHorizontal() ? SWT.HORIZONTAL : SWT.VERTICAL);
- animationItem.createControl(region);
+ animationItem.createControl(region);
- animationItem.setAnimationContainer(new AnimationItem.IAnimationContainer() {
- @Override
+ animationItem.setAnimationContainer(new AnimationItem.IAnimationContainer() {
+ @Override
public void animationDone() {
- //Add an extra refresh to the viewer in case
- //of stale input if the controls are not disposed
- if (viewer.getControl().isDisposed()) {
+ // Add an extra refresh to the viewer in case
+ // of stale input if the controls are not disposed
+ if (viewer.getControl().isDisposed()) {
return;
}
- viewer.refresh();
- }
+ viewer.refresh();
+ }
- @Override
+ @Override
public void animationStart() {
- // Nothing by default here.
+ // Nothing by default here.
- }
- });
+ }
+ });
if (isHorizontal()) {
- gd = new GridData(GridData.FILL_VERTICAL);
- gd.widthHint = widthPreference;
- } else {
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.heightHint = widthPreference;
- }
+ gd = new GridData(GridData.FILL_VERTICAL);
+ gd.widthHint = widthPreference;
+ } else {
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.heightHint = widthPreference;
+ }
- animationItem.getControl().setLayoutData(gd);
+ animationItem.getControl().setLayoutData(gd);
- viewerControl.addMouseListener(new MouseAdapter() {
- @Override
+ viewerControl.addMouseListener(new MouseAdapter() {
+ @Override
public void mouseDoubleClick(MouseEvent e) {
- processDoubleClick();
- }
- });
-
- //Never show debug info
- IContentProvider provider = new ProgressViewerContentProvider(viewer,
- false,false);
- viewer.setContentProvider(provider);
- viewer.setInput(provider);
- viewer.setLabelProvider(new ProgressViewerLabelProvider(viewerControl));
- viewer.setComparator(ProgressManagerUtil.getProgressViewerComparator());
- viewer.addFilter(new ViewerFilter() {
- @Override
+ processDoubleClick();
+ }
+ });
+
+ // Never show debug info
+ IContentProvider provider = new ProgressViewerContentProvider(viewer, false, false);
+ viewer.setContentProvider(provider);
+ viewer.setInput(provider);
+ viewer.setLabelProvider(new ProgressViewerLabelProvider(viewerControl));
+ viewer.setComparator(ProgressManagerUtil.getProgressViewerComparator());
+ viewer.addFilter(new ViewerFilter() {
+ @Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
- if (element instanceof JobInfo) {
- JobInfo info= (JobInfo)element;
- if (info.isBlocked() || info.getJob().getState() == Job.WAITING) {
- return false;
- }
- }
- return true;
- }
+ if (element instanceof JobInfo) {
+ JobInfo info = (JobInfo) element;
+ if (info.isBlocked() || info.getJob().getState() == Job.WAITING) {
+ return false;
+ }
+ }
+ return true;
+ }
});
- return region;
- }
-
- /**
- * Return the animationItem for the receiver.
- *
- * @return AnimationItem
- */
- public AnimationItem getAnimationItem() {
- return animationItem;
- }
-
- /**
- * Return the control for the receiver.
- *
- * @return Control
- */
+ return region;
+ }
+
+ /**
+ * Return the animationItem for the receiver.
+ *
+ * @return AnimationItem
+ */
+ public AnimationItem getAnimationItem() {
+ return animationItem;
+ }
+
+ /**
+ * Return the control for the receiver.
+ *
+ * @return Control
+ */
public Control getControl() {
- return region;
- }
+ return region;
+ }
- /**
- * Process the double click event.
- */
- public void processDoubleClick() {
+ /**
+ * Process the double click event.
+ */
+ public void processDoubleClick() {
ProgressManagerUtil.openProgressView(workbenchWindow);
- }
+ }
/**
* Answer true if the side is a horizonal one
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressView.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressView.java
index 2bc80af65ee..2577f52aa7d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressView.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressView.java
@@ -108,8 +108,7 @@ public class ProgressView extends ViewPart {
viewer = new DetailedProgressViewer(parent, SWT.MULTI | SWT.H_SCROLL);
viewer.setComparator(ProgressManagerUtil.getProgressViewerComparator());
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
- IWorkbenchHelpContextIds.RESPONSIVE_UI);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IWorkbenchHelpContextIds.RESPONSIVE_UI);
initContentProvider();
createClearAllAction();
@@ -143,7 +142,7 @@ public class ProgressView extends ViewPart {
* Sets the content provider for the viewer.
*/
protected void initContentProvider() {
- provider = new ProgressViewerContentProvider(viewer, true ,true);
+ provider = new ProgressViewerContentProvider(viewer, true, true);
viewer.setContentProvider(provider);
viewer.setInput(ProgressManager.getInstance());
}
@@ -172,8 +171,7 @@ public class ProgressView extends ViewPart {
menuMgr.add(new ViewPreferencesAction() {
@Override
public void openViewPreferencesDialog() {
- new JobsViewPreferenceDialog(viewer.getControl().getShell())
- .open();
+ new JobsViewPreferenceDialog(viewer.getControl().getShell()).open();
}
});
@@ -206,16 +204,15 @@ public class ProgressView extends ViewPart {
}
/**
- * Get the currently selected job info. Only return it if it is the only
- * item selected and it is a JobInfo.
+ * Get the currently selected job info. Only return it if it is the only item
+ * selected and it is a JobInfo.
*
* @return JobInfo
*/
JobInfo getSelectedInfo() {
IStructuredSelection selection = getSelection();
if (selection != null && selection.size() == 1) {
- JobTreeElement element = (JobTreeElement) selection
- .getFirstElement();
+ JobTreeElement element = (JobTreeElement) selection.getFirstElement();
if (element.isJobInfo()) {
return (JobInfo) element;
}
@@ -240,22 +237,18 @@ public class ProgressView extends ViewPart {
* Create the clear all action for the receiver.
*/
private void createClearAllAction() {
- clearAllAction = new Action(
- ProgressMessages.ProgressView_ClearAllAction) {
+ clearAllAction = new Action(ProgressMessages.ProgressView_ClearAllAction) {
@Override
public void run() {
FinishedJobs.getInstance().clearAll();
}
};
- clearAllAction
- .setToolTipText(ProgressMessages.NewProgressView_RemoveAllJobsToolTip);
- ImageDescriptor id = WorkbenchImages
- .getWorkbenchImageDescriptor("/elcl16/progress_remall.png"); //$NON-NLS-1$
+ clearAllAction.setToolTipText(ProgressMessages.NewProgressView_RemoveAllJobsToolTip);
+ ImageDescriptor id = WorkbenchImages.getWorkbenchImageDescriptor("/elcl16/progress_remall.png"); //$NON-NLS-1$
if (id != null) {
clearAllAction.setImageDescriptor(id);
}
- id = WorkbenchImages
- .getWorkbenchImageDescriptor("/dlcl16/progress_remall.png"); //$NON-NLS-1$
+ id = WorkbenchImages.getWorkbenchImageDescriptor("/dlcl16/progress_remall.png"); //$NON-NLS-1$
if (id != null) {
clearAllAction.setDisabledImageDescriptor(id);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressViewUpdater.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressViewUpdater.java
index a309ee1bc0b..45b4d8c8346 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressViewUpdater.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressViewUpdater.java
@@ -29,21 +29,20 @@ import org.eclipse.ui.internal.util.PrefUtil;
*/
class ProgressViewUpdater implements IJobProgressManagerListener {
- private static ProgressViewUpdater singleton;
+ private static ProgressViewUpdater singleton;
private Set<IProgressUpdateCollector> collectors;
- UpdatesInfo currentInfo = new UpdatesInfo();
+ UpdatesInfo currentInfo = new UpdatesInfo();
- boolean debug;
+ boolean debug;
Throttler throttledUpdate = new Throttler(PlatformUI.getWorkbench().getDisplay(), Duration.ofMillis(100),
this::update);
- /**
- * The UpdatesInfo is a private class for keeping track of the updates
- * required.
- */
+ /**
+ * The UpdatesInfo is a private class for keeping track of the updates required.
+ */
static class UpdatesInfo {
Collection<JobTreeElement> additions = new LinkedHashSet<>();
@@ -54,46 +53,46 @@ class ProgressViewUpdater implements IJobProgressManagerListener {
volatile boolean updateAll;
- private UpdatesInfo() {
- //Create a new instance of the info
- }
+ private UpdatesInfo() {
+ // Create a new instance of the info
+ }
- /**
- * Add an add update
- *
- * @param addition
- */
+ /**
+ * Add an add update
+ *
+ * @param addition
+ */
synchronized void add(JobTreeElement addition) {
- additions.add(addition);
- }
-
- /**
- * Add a remove update
- *
- * @param removal
- */
+ additions.add(addition);
+ }
+
+ /**
+ * Add a remove update
+ *
+ * @param removal
+ */
synchronized void remove(JobTreeElement removal) {
- deletions.add(removal);
- }
-
- /**
- * Add a refresh update
- *
- * @param refresh
- */
+ deletions.add(removal);
+ }
+
+ /**
+ * Add a refresh update
+ *
+ * @param refresh
+ */
synchronized void refresh(JobTreeElement refresh) {
- refreshes.add(refresh);
- }
+ refreshes.add(refresh);
+ }
- /**
- * Reset the caches after completion of an update.
- */
+ /**
+ * Reset the caches after completion of an update.
+ */
synchronized void reset() {
- additions.clear();
- deletions.clear();
- refreshes.clear();
- updateAll = false;
- }
+ additions.clear();
+ deletions.clear();
+ refreshes.clear();
+ updateAll = false;
+ }
/**
* @return array containing updated, added and deleted items
@@ -101,41 +100,38 @@ class ProgressViewUpdater implements IJobProgressManagerListener {
synchronized JobTreeElement[][] processForUpdate() {
HashSet<JobTreeElement> staleAdditions = new HashSet<>();
- Iterator<JobTreeElement> additionsIterator = additions.iterator();
- while (additionsIterator.hasNext()) {
- JobTreeElement treeElement = additionsIterator
- .next();
- if (!treeElement.isActive()) {
- if (deletions.contains(treeElement)) {
+ Iterator<JobTreeElement> additionsIterator = additions.iterator();
+ while (additionsIterator.hasNext()) {
+ JobTreeElement treeElement = additionsIterator.next();
+ if (!treeElement.isActive()) {
+ if (deletions.contains(treeElement)) {
staleAdditions.add(treeElement);
}
- }
- }
+ }
+ }
- additions.removeAll(staleAdditions);
+ additions.removeAll(staleAdditions);
HashSet<JobTreeElement> obsoleteRefresh = new HashSet<>();
for (JobTreeElement treeElement : refreshes) {
- if (deletions.contains(treeElement)
- || additions.contains(treeElement)) {
+ if (deletions.contains(treeElement) || additions.contains(treeElement)) {
obsoleteRefresh.add(treeElement);
}
- //Also check for groups that are being added
- Object parent = treeElement.getParent();
- if(parent != null && (deletions.contains(parent)
- || additions.contains(parent))){
- obsoleteRefresh.add(treeElement);
- }
+ // Also check for groups that are being added
+ Object parent = treeElement.getParent();
+ if (parent != null && (deletions.contains(parent) || additions.contains(parent))) {
+ obsoleteRefresh.add(treeElement);
+ }
- if (!treeElement.isActive()) {
- //If it is done then delete it
- obsoleteRefresh.add(treeElement);
- deletions.add(treeElement);
- }
- }
+ if (!treeElement.isActive()) {
+ // If it is done then delete it
+ obsoleteRefresh.add(treeElement);
+ deletions.add(treeElement);
+ }
+ }
- refreshes.removeAll(obsoleteRefresh);
+ refreshes.removeAll(obsoleteRefresh);
JobTreeElement[] updateItems = refreshes.toArray(new JobTreeElement[0]);
JobTreeElement[] additionItems = additions.toArray(new JobTreeElement[0]);
@@ -143,70 +139,67 @@ class ProgressViewUpdater implements IJobProgressManagerListener {
return new JobTreeElement[][] { updateItems, additionItems, deletionItems };
}
- }
+ }
- /**
- * Return a new instance of the receiver.
- *
- * @return ProgressViewUpdater
- */
- static ProgressViewUpdater getSingleton() {
- if (singleton == null) {
+ /**
+ * Return a new instance of the receiver.
+ *
+ * @return ProgressViewUpdater
+ */
+ static ProgressViewUpdater getSingleton() {
+ if (singleton == null) {
singleton = new ProgressViewUpdater();
}
- return singleton;
- }
-
- /**
- * Return whether or not there is a singleton for updates to avoid creating
- * extra listeners.
- *
- * @return boolean <code>true</code> if there is already
- * a singleton
- */
- static boolean hasSingleton() {
- return singleton != null;
- }
-
- static void clearSingleton() {
- if (singleton != null) {
+ return singleton;
+ }
+
+ /**
+ * Return whether or not there is a singleton for updates to avoid creating
+ * extra listeners.
+ *
+ * @return boolean <code>true</code> if there is already a singleton
+ */
+ static boolean hasSingleton() {
+ return singleton != null;
+ }
+
+ static void clearSingleton() {
+ if (singleton != null) {
ProgressManager.getInstance().removeListener(singleton);
}
- singleton = null;
- }
+ singleton = null;
+ }
- /**
- * Create a new instance of the receiver.
- */
- private ProgressViewUpdater() {
+ /**
+ * Create a new instance of the receiver.
+ */
+ private ProgressViewUpdater() {
collectors = new LinkedHashSet<>();
- ProgressManager.getInstance().addListener(this);
- debug =
- PrefUtil.getAPIPreferenceStore().
- getBoolean(IWorkbenchPreferenceConstants.SHOW_SYSTEM_JOBS);
- }
-
- /**
- * Add the new collector to the list of collectors.
- *
- * @param newCollector
- */
- void addCollector(IProgressUpdateCollector newCollector) {
+ ProgressManager.getInstance().addListener(this);
+ debug = PrefUtil.getAPIPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.SHOW_SYSTEM_JOBS);
+ }
+
+ /**
+ * Add the new collector to the list of collectors.
+ *
+ * @param newCollector
+ */
+ void addCollector(IProgressUpdateCollector newCollector) {
collectors.add(newCollector);
- }
-
- /**
- * Remove the collector from the list of collectors.
- *
- * @param provider
- */
- void removeCollector(IProgressUpdateCollector provider) {
+ }
+
+ /**
+ * Remove the collector from the list of collectors.
+ *
+ * @param provider
+ */
+ void removeCollector(IProgressUpdateCollector provider) {
collectors.remove(provider);
- //Remove ourselves if there is nothing to update
+ // Remove ourselves if there is nothing to update
if (collectors.isEmpty()) {
clearSingleton();
}
- }
+ }
/** Running in UI thread by throttledUpdate */
private void update() {
@@ -244,36 +237,36 @@ class ProgressViewUpdater implements IJobProgressManagerListener {
}
}
- @Override
+ @Override
public void refreshJobInfo(JobInfo info) {
currentInfo.refresh(info);
- //Add in a 100ms delay so as to keep priority low
+ // Add in a 100ms delay so as to keep priority low
throttledUpdate.throttledExec();
- }
+ }
- @Override
+ @Override
public void refreshGroup(GroupInfo info) {
currentInfo.refresh(info);
- //Add in a 100ms delay so as to keep priority low
+ // Add in a 100ms delay so as to keep priority low
throttledUpdate.throttledExec();
- }
+ }
- @Override
+ @Override
public void addGroup(GroupInfo info) {
currentInfo.add(info);
throttledUpdate.throttledExec();
- }
+ }
- @Override
+ @Override
public void refreshAll() {
currentInfo.updateAll = true;
- //Add in a 100ms delay so as to keep priority low
+ // Add in a 100ms delay so as to keep priority low
throttledUpdate.throttledExec();
- }
+ }
- @Override
+ @Override
public void addJob(JobInfo info) {
GroupInfo group = info.getGroupInfo();
@@ -281,30 +274,30 @@ class ProgressViewUpdater implements IJobProgressManagerListener {
currentInfo.add(info);
} else {
currentInfo.refresh(group);
- }
+ }
throttledUpdate.throttledExec();
- }
+ }
- @Override
+ @Override
public void removeJob(JobInfo info) {
GroupInfo group = info.getGroupInfo();
if (group == null) {
currentInfo.remove(info);
} else {
currentInfo.refresh(group);
- }
+ }
throttledUpdate.throttledExec();
- }
+ }
- @Override
+ @Override
public void removeGroup(GroupInfo group) {
currentInfo.remove(group);
throttledUpdate.throttledExec();
- }
+ }
- @Override
+ @Override
public boolean showsDebug() {
- return debug;
- }
+ return debug;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressViewerContentProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressViewerContentProvider.java
index 883a98c9f48..106233fdb67 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressViewerContentProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressViewerContentProvider.java
@@ -39,17 +39,13 @@ public class ProgressViewerContentProvider extends ProgressContentProvider {
/**
* Create a new instance of the receiver.
*
- * @param structured
- * The Viewer we are providing content for
- * @param debug
- * If true debug information will be shown if the debug flag in
- * the ProgressManager is true.
- * @param showFinished
- * A boolean that indicates whether or not the finished jobs
- * should be shown.
+ * @param structured The Viewer we are providing content for
+ * @param debug If true debug information will be shown if the debug flag
+ * in the ProgressManager is true.
+ * @param showFinished A boolean that indicates whether or not the finished jobs
+ * should be shown.
*/
- public ProgressViewerContentProvider(AbstractProgressViewer structured,
- boolean debug, boolean showFinished) {
+ public ProgressViewerContentProvider(AbstractProgressViewer structured, boolean debug, boolean showFinished) {
super(debug);
progressViewer = structured;
this.showFinished = showFinished;
@@ -169,10 +165,8 @@ public class ProgressViewerContentProvider extends ProgressContentProvider {
* Get the root elements of the passed elements as we only show roots. Replace
* the element with its parent if subWithParent is true
*
- * @param elements
- * the array of elements.
- * @param subWithParent
- * sub with parent flag.
+ * @param elements the array of elements.
+ * @param subWithParent sub with parent flag.
* @return JobTreeElement[]
*/
private JobTreeElement[] getRoots(JobTreeElement[] elements, boolean subWithParent) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressViewerLabelProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressViewerLabelProvider.java
index 2ef9f2ba436..32e27062f1f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressViewerLabelProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressViewerLabelProvider.java
@@ -20,23 +20,21 @@ import org.eclipse.swt.widgets.Control;
* The ProgressViewerLabelProvider is the label provider for progress viewers.
*/
public class ProgressViewerLabelProvider extends LabelProvider {
- private Control control;
+ private Control control;
- @Override
+ @Override
public String getText(Object element) {
- JobTreeElement info = (JobTreeElement) element;
- return ProgressManagerUtil.shortenText(
- info.getCondensedDisplayString(), control);
- }
+ JobTreeElement info = (JobTreeElement) element;
+ return ProgressManagerUtil.shortenText(info.getCondensedDisplayString(), control);
+ }
- /**
- * Create a new instance of the receiver within the control.
- *
- * @param progressControl The control that the label is
- * being created for.
- */
- public ProgressViewerLabelProvider(Control progressControl) {
- super();
- control = progressControl;
- }
+ /**
+ * Create a new instance of the receiver within the control.
+ *
+ * @param progressControl The control that the label is being created for.
+ */
+ public ProgressViewerLabelProvider(Control progressControl) {
+ super();
+ control = progressControl;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/StatusAdapterHelper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/StatusAdapterHelper.java
index e6d09c708f7..55154937136 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/StatusAdapterHelper.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/StatusAdapterHelper.java
@@ -19,8 +19,9 @@ import org.eclipse.ui.progress.IProgressConstants;
import org.eclipse.ui.statushandlers.StatusAdapter;
/**
- * StatusAdapterHelper is a class for caching {@link StatusAdapter} instances to make sure
- * they are not created twice within the progress service.
+ * StatusAdapterHelper is a class for caching {@link StatusAdapter} instances to
+ * make sure they are not created twice within the progress service.
+ *
* @since 3.3
*/
public class StatusAdapterHelper {
@@ -33,6 +34,7 @@ public class StatusAdapterHelper {
/**
* Return the singleton.
+ *
* @return StatusAdapterHelper
*/
public static StatusAdapterHelper getInstance() {
@@ -44,6 +46,7 @@ public class StatusAdapterHelper {
/**
* Set the {@link StatusAdapter} for the {@link JobInfo}
+ *
* @param info
* @param statusAdapter
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/TaskBarProgressManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/TaskBarProgressManager.java
index ee7379c4746..fad21f77369 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/TaskBarProgressManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/TaskBarProgressManager.java
@@ -246,8 +246,8 @@ public class TaskBarProgressManager {
/**
* If the job isn't running or doesn't specify the
- * IProgressConstants#SHOW_IN_TASKBAR_ICON_PROPERTY property, don't
- * bother tracking it.
+ * IProgressConstants#SHOW_IN_TASKBAR_ICON_PROPERTY property, don't bother
+ * tracking it.
*/
private boolean isNotTracked(JobInfo info) {
Job job = info.getJob();
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/TaskInfo.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/TaskInfo.java
index 6ca3a8dcc63..10648a7f939 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/TaskInfo.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/TaskInfo.java
@@ -26,8 +26,8 @@ public class TaskInfo extends SubTaskInfo {
int totalWork;
/**
- * Creates a new instance of the receiver with the supplied total work and
- * task name.
+ * Creates a new instance of the receiver with the supplied total work and task
+ * name.
*
* @param parentJobInfo
* @param infoName
@@ -55,12 +55,9 @@ public class TaskInfo extends SubTaskInfo {
* Adds the amount of work to the receiver. Update a parent monitor by the
* increment scaled to the amount of ticks this represents.
*
- * @param workIncrement
- * int the amount of work in the receiver
- * @param parentMonitor
- * The IProgressMonitor that is also listening
- * @param parentTicks
- * the number of ticks this monitor represents
+ * @param workIncrement int the amount of work in the receiver
+ * @param parentMonitor The IProgressMonitor that is also listening
+ * @param parentTicks the number of ticks this monitor represents
*/
void addWork(double workIncrement, IProgressMonitor parentMonitor, int parentTicks) {
// Don't bother if we are indeterminate.
@@ -100,8 +97,7 @@ public class TaskInfo extends SubTaskInfo {
/**
* Returns the display String without the task name.
*
- * @param showProgress
- * Whether or not we are showing progress
+ * @param showProgress Whether or not we are showing progress
*
* @return String
*/
@@ -115,8 +111,8 @@ public class TaskInfo extends SubTaskInfo {
}
/**
- * Returns an integer representing the amount of work completed. If progress
- * is indeterminate return IProgressMonitor.UNKNOWN.
+ * Returns an integer representing the amount of work completed. If progress is
+ * indeterminate return IProgressMonitor.UNKNOWN.
*
* @return int IProgressMonitor.UNKNOWN or a value between 0 and 100.
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/WorkbenchSiteProgressService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/WorkbenchSiteProgressService.java
index 9cdd671ef48..a4774d4b406 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/WorkbenchSiteProgressService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/WorkbenchSiteProgressService.java
@@ -51,9 +51,8 @@ import org.eclipse.ui.progress.WorkbenchJob;
* The WorkbenchSiteProgressService is the concrete implementation of the
* WorkbenchSiteProgressService used by the workbench components.
*/
-public class WorkbenchSiteProgressService implements
- IWorkbenchSiteProgressService, IJobBusyListener {
- PartSite site;
+public class WorkbenchSiteProgressService implements IWorkbenchSiteProgressService, IJobBusyListener {
+ PartSite site;
/**
* Map from Job to Boolean (non-null). Interpretation of the value:
@@ -65,15 +64,15 @@ public class WorkbenchSiteProgressService implements
*/
private Map<Job, Boolean> busyJobs = new HashMap<>();
- private Object busyLock = new Object();
+ private Object busyLock = new Object();
- IPropertyChangeListener[] changeListeners = new IPropertyChangeListener[0];
+ IPropertyChangeListener[] changeListeners = new IPropertyChangeListener[0];
- private int waitCursorJobCount;
+ private int waitCursorJobCount;
- private Object waitCursorLock = new Object();
+ private Object waitCursorLock = new Object();
- private SiteUpdateJob updateJob;
+ private SiteUpdateJob updateJob;
/**
* Flag that keeps state from calls to {@link #incrementBusy()} and
@@ -81,109 +80,107 @@ public class WorkbenchSiteProgressService implements
*/
private int busyCount = 0;
- public class SiteUpdateJob extends WorkbenchJob {
- private boolean busy;
+ public class SiteUpdateJob extends WorkbenchJob {
+ private boolean busy;
- Object lock = new Object();
+ Object lock = new Object();
- /**
- * Set whether we are updating with the wait or busy cursor.
- *
- * @param cursorState
- */
- void setBusy(boolean cursorState) {
- synchronized (lock) {
- busy = cursorState;
- }
- }
+ /**
+ * Set whether we are updating with the wait or busy cursor.
+ *
+ * @param cursorState
+ */
+ void setBusy(boolean cursorState) {
+ synchronized (lock) {
+ busy = cursorState;
+ }
+ }
- private SiteUpdateJob() {
- super(ProgressMessages.WorkbenchSiteProgressService_CursorJob);
- }
+ private SiteUpdateJob() {
+ super(ProgressMessages.WorkbenchSiteProgressService_CursorJob);
+ }
- @Override
+ @Override
public IStatus runInUIThread(IProgressMonitor monitor) {
Control control = (Control) site.getModel().getWidget();
- if (control == null || control.isDisposed()) {
+ if (control == null || control.isDisposed()) {
return Status.CANCEL_STATUS;
}
- synchronized (lock) {
- //Update cursors if we are doing that
- Cursor cursor = null;
- if (waitCursorJobCount !=0) {
- // at least one job which is running has requested for wait cursor
+ synchronized (lock) {
+ // Update cursors if we are doing that
+ Cursor cursor = null;
+ if (waitCursorJobCount != 0) {
+ // at least one job which is running has requested for wait cursor
cursor = control.getDisplay().getSystemCursor(SWT.CURSOR_APPSTARTING);
}
- control.setCursor(cursor);
+ control.setCursor(cursor);
showBusy(busy);
- IWorkbenchPart part = site.getPart();
- if (part instanceof WorkbenchPart) {
+ IWorkbenchPart part = site.getPart();
+ if (part instanceof WorkbenchPart) {
((WorkbenchPart) part).showBusy(busy);
}
- }
- return Status.OK_STATUS;
- }
-
- }
-
- /**
- * Create a new instance of the receiver with a site of partSite
- *
- * @param partSite
- * PartSite.
- */
- public WorkbenchSiteProgressService(final PartSite partSite) {
- site = partSite;
- updateJob = new SiteUpdateJob();
- updateJob.setSystem(true);
- }
-
- /**
- * Dispose the resources allocated by the receiver.
- *
- */
- public void dispose() {
- if (updateJob != null) {
+ }
+ return Status.OK_STATUS;
+ }
+
+ }
+
+ /**
+ * Create a new instance of the receiver with a site of partSite
+ *
+ * @param partSite PartSite.
+ */
+ public WorkbenchSiteProgressService(final PartSite partSite) {
+ site = partSite;
+ updateJob = new SiteUpdateJob();
+ updateJob.setSystem(true);
+ }
+
+ /**
+ * Dispose the resources allocated by the receiver.
+ *
+ */
+ public void dispose() {
+ if (updateJob != null) {
updateJob.cancel();
}
- ProgressManager.getInstance().removeListener(this);
+ ProgressManager.getInstance().removeListener(this);
showBusy(false);
- }
+ }
- @Override
- public void busyCursorWhile(IRunnableWithProgress runnable)
- throws InvocationTargetException, InterruptedException {
- getWorkbenchProgressService().busyCursorWhile(runnable);
- }
+ @Override
+ public void busyCursorWhile(IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
+ getWorkbenchProgressService().busyCursorWhile(runnable);
+ }
- @Override
+ @Override
public void schedule(Job job, long delay, boolean useHalfBusyCursor) {
- job.addJobChangeListener(getJobChangeListener(useHalfBusyCursor));
- job.schedule(delay);
- }
+ job.addJobChangeListener(getJobChangeListener(useHalfBusyCursor));
+ job.schedule(delay);
+ }
- @Override
+ @Override
public void schedule(Job job, long delay) {
- schedule(job, delay, false);
- }
+ schedule(job, delay, false);
+ }
- @Override
+ @Override
public void schedule(Job job) {
- schedule(job, 0L, false);
- }
+ schedule(job, 0L, false);
+ }
- @Override
+ @Override
public void showBusyForFamily(Object family) {
- ProgressManager.getInstance().addListenerToFamily(family, this);
- }
-
- /**
- * Get the job change listener for this site.
- *
- * @param useHalfBusyCursor
- * @return IJobChangeListener
- */
+ ProgressManager.getInstance().addListenerToFamily(family, this);
+ }
+
+ /**
+ * Get the job change listener for this site.
+ *
+ * @param useHalfBusyCursor
+ * @return IJobChangeListener
+ */
public IJobChangeListener getJobChangeListener(final boolean useHalfBusyCursor) {
return new JobChangeAdapter() {
@@ -201,10 +198,10 @@ public class WorkbenchSiteProgressService implements
};
}
- @Override
+ @Override
public void decrementBusy(Job job) {
Object halfBusyCursorState;
- synchronized (busyLock) {
+ synchronized (busyLock) {
halfBusyCursorState = busyJobs.remove(job);
if (halfBusyCursorState == null) {
return;
@@ -214,27 +211,27 @@ public class WorkbenchSiteProgressService implements
synchronized (waitCursorLock) {
waitCursorJobCount--;
}
- }
- try {
- decrementBusy();
- } catch (Exception ex) {
- // protecting against assertion failures
- WorkbenchPlugin.log(ex);
- }
- }
-
- @Override
+ }
+ try {
+ decrementBusy();
+ } catch (Exception ex) {
+ // protecting against assertion failures
+ WorkbenchPlugin.log(ex);
+ }
+ }
+
+ @Override
public void incrementBusy(Job job) {
incrementBusy(job, false);
}
private void incrementBusy(Job job, boolean useHalfBusyCursor) {
Object halfBusyCursorState;
- synchronized (busyLock) {
+ synchronized (busyLock) {
halfBusyCursorState = busyJobs.get(job);
if (useHalfBusyCursor || halfBusyCursorState != Boolean.TRUE)
busyJobs.put(job, Boolean.valueOf(useHalfBusyCursor));
- }
+ }
if (useHalfBusyCursor && halfBusyCursorState != Boolean.TRUE) {
// want to set busy cursor and it has not been set before
synchronized (waitCursorLock) {
@@ -256,61 +253,59 @@ public class WorkbenchSiteProgressService implements
}
return;
}
- incrementBusy();
- }
+ incrementBusy();
+ }
- @Override
+ @Override
public void warnOfContentChange() {
MPart part = site.getModel();
if (!part.getTags().contains(CSSConstants.CSS_CONTENT_CHANGE_CLASS)) {
part.getTags().add(CSSConstants.CSS_CONTENT_CHANGE_CLASS);
}
- }
+ }
- @Override
+ @Override
public void showInDialog(Shell shell, Job job) {
- getWorkbenchProgressService().showInDialog(shell, job);
- }
-
- /**
- * Get the progress service for the workbnech,
- *
- * @return IProgressService
- */
- private IProgressService getWorkbenchProgressService() {
- return site.getWorkbenchWindow().getWorkbench().getProgressService();
- }
-
- @Override
- public void run(boolean fork, boolean cancelable,
- IRunnableWithProgress runnable) throws InvocationTargetException,
- InterruptedException {
- getWorkbenchProgressService().run(fork, cancelable, runnable);
- }
-
- @Override
- public void runInUI(IRunnableContext context,
- IRunnableWithProgress runnable, ISchedulingRule rule)
- throws InvocationTargetException, InterruptedException {
- getWorkbenchProgressService().runInUI(context, runnable, rule);
- }
-
- @Override
+ getWorkbenchProgressService().showInDialog(shell, job);
+ }
+
+ /**
+ * Get the progress service for the workbnech,
+ *
+ * @return IProgressService
+ */
+ private IProgressService getWorkbenchProgressService() {
+ return site.getWorkbenchWindow().getWorkbench().getProgressService();
+ }
+
+ @Override
+ public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable)
+ throws InvocationTargetException, InterruptedException {
+ getWorkbenchProgressService().run(fork, cancelable, runnable);
+ }
+
+ @Override
+ public void runInUI(IRunnableContext context, IRunnableWithProgress runnable, ISchedulingRule rule)
+ throws InvocationTargetException, InterruptedException {
+ getWorkbenchProgressService().runInUI(context, runnable, rule);
+ }
+
+ @Override
public int getLongOperationTime() {
- return getWorkbenchProgressService().getLongOperationTime();
- }
+ return getWorkbenchProgressService().getLongOperationTime();
+ }
- @Override
+ @Override
public void registerIconForFamily(ImageDescriptor icon, Object family) {
- getWorkbenchProgressService().registerIconForFamily(icon, family);
- }
+ getWorkbenchProgressService().registerIconForFamily(icon, family);
+ }
- @Override
+ @Override
public Image getIconFor(Job job) {
- return getWorkbenchProgressService().getIconFor(job);
- }
+ return getWorkbenchProgressService().getIconFor(job);
+ }
- @Override
+ @Override
public void incrementBusy() {
synchronized (busyLock) {
this.busyCount++;
@@ -324,14 +319,13 @@ public class WorkbenchSiteProgressService implements
} else {
updateJob.cancel();
}
- }
+ }
+
@Override
public void decrementBusy() {
synchronized (busyLock) {
- Assert
- .isTrue(
- busyCount > 0,
- "Ignoring unexpected call to IWorkbenchSiteProgressService.decrementBusy(). This might be due to an earlier call to this method."); //$NON-NLS-1$
+ Assert.isTrue(busyCount > 0,
+ "Ignoring unexpected call to IWorkbenchSiteProgressService.decrementBusy(). This might be due to an earlier call to this method."); //$NON-NLS-1$
this.busyCount--;
if (busyCount != 0) {
return;
@@ -346,8 +340,8 @@ public class WorkbenchSiteProgressService implements
}
/**
- * This method is made public only for the tests.
- * Clients should not be using this method
+ * This method is made public only for the tests. Clients should not be using
+ * this method
*
* @return the updateJob that updates the site
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/provisional/application/IActionBarConfigurer2.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/provisional/application/IActionBarConfigurer2.java
index 5ab0ff12f00..ba1e354689d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/provisional/application/IActionBarConfigurer2.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/provisional/application/IActionBarConfigurer2.java
@@ -19,8 +19,8 @@ import org.eclipse.jface.internal.provisional.action.IToolBarContributionItem;
import org.eclipse.ui.application.IActionBarConfigurer;
/**
- * Extends <code>IActionBarConfigurer</code> with API to allow the advisor to
- * be decoupled from the implementation types for tool bar managers and tool bar
+ * Extends <code>IActionBarConfigurer</code> with API to allow the advisor to be
+ * decoupled from the implementation types for tool bar managers and tool bar
* contribution items.
*
* @since 3.2
@@ -28,8 +28,8 @@ import org.eclipse.ui.application.IActionBarConfigurer;
public interface IActionBarConfigurer2 extends IActionBarConfigurer {
/**
- * Creates a tool bar manager for the workbench window's tool bar. The
- * action bar advisor should use this factory method rather than creating a
+ * Creates a tool bar manager for the workbench window's tool bar. The action
+ * bar advisor should use this factory method rather than creating a
* <code>ToolBarManager</code> directly.
*
* @return the tool bar manager
@@ -37,17 +37,14 @@ public interface IActionBarConfigurer2 extends IActionBarConfigurer {
IToolBarManager createToolBarManager();
/**
- * Creates a toolbar contribution item for the window's tool bar. The action
- * bar advisor should use this factory method rather than creating a
+ * Creates a toolbar contribution item for the window's tool bar. The action bar
+ * advisor should use this factory method rather than creating a
* <code>ToolBarContributionItem</code> directly.
*
- * @param toolBarManager
- * a tool bar manager for the workbench window's tool bar
- * @param id
- * the id of the contribution
+ * @param toolBarManager a tool bar manager for the workbench window's tool bar
+ * @param id the id of the contribution
* @return the tool bar contribution item
*/
- IToolBarContributionItem createToolBarContributionItem(
- IToolBarManager toolBarManager, String id);
+ IToolBarContributionItem createToolBarContributionItem(IToolBarManager toolBarManager, String id);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/ActionElement.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/ActionElement.java
index 2f519cce084..accb30aecaf 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/ActionElement.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/ActionElement.java
@@ -30,7 +30,7 @@ public class ActionElement extends QuickAccessElement {
private ActionContributionItem item;
- /* package */ActionElement(ActionContributionItem item, ActionProvider actionProvider) {
+ /* package */ ActionElement(ActionContributionItem item, ActionProvider actionProvider) {
super(actionProvider);
this.item = item;
}
@@ -53,10 +53,8 @@ public class ActionElement extends QuickAccessElement {
@Override
public String getLabel() {
IAction action = item.getAction();
- if (action.getToolTipText() != null
- && action.getToolTipText().length() != 0) {
- return LegacyActionTools.removeMnemonics(action.getText()
- + separator + action.getToolTipText());
+ if (action.getToolTipText() != null && action.getToolTipText().length() != 0) {
+ return LegacyActionTools.removeMnemonics(action.getText() + separator + action.getToolTipText());
}
return LegacyActionTools.removeMnemonics(action.getText());
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/ActionProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/ActionProvider.java
index d24419f0ccf..8dc67387c76 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/ActionProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/ActionProvider.java
@@ -54,8 +54,7 @@ public class ActionProvider extends QuickAccessProvider {
public QuickAccessElement[] getElements() {
if (idToElement == null) {
idToElement = new HashMap();
- IWorkbenchWindow window = PlatformUI
- .getWorkbench().getActiveWorkbenchWindow();
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window instanceof WorkbenchWindow) {
MenuManager menu = ((WorkbenchWindow) window).getMenuManager();
Set result = new HashSet();
@@ -68,8 +67,7 @@ public class ActionProvider extends QuickAccessProvider {
}
}
}
- return (ActionElement[]) idToElement.values().toArray(
- new ActionElement[idToElement.values().size()]);
+ return (ActionElement[]) idToElement.values().toArray(new ActionElement[idToElement.values().size()]);
}
private void collectContributions(MenuManager menu, Set result) {
@@ -79,8 +77,7 @@ public class ActionProvider extends QuickAccessProvider {
}
if (item instanceof MenuManager) {
collectContributions((MenuManager) item, result);
- } else if (item instanceof ActionContributionItem
- && item.isEnabled()) {
+ } else if (item instanceof ActionContributionItem && item.isEnabled()) {
result.add(item);
}
}
@@ -88,8 +85,7 @@ public class ActionProvider extends QuickAccessProvider {
@Override
public ImageDescriptor getImageDescriptor() {
- return WorkbenchImages
- .getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJ_NODE);
+ return WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJ_NODE);
}
@Override
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/CamelUtil.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/CamelUtil.java
index 3542a6066db..9dde8cf4cfd 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/CamelUtil.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/CamelUtil.java
@@ -27,13 +27,12 @@ public class CamelUtil {
/**
* Returns a lowercase string consisting of all initials of the words in the
- * given String. Words are separated by whitespace and other special
- * characters, or by uppercase letters in a word like CamelCase.
+ * given String. Words are separated by whitespace and other special characters,
+ * or by uppercase letters in a word like CamelCase.
*
- * @param s
- * the string
- * @return a lowercase string containing the first character of every wordin
- * the given string.
+ * @param s the string
+ * @return a lowercase string containing the first character of every wordin the
+ * given string.
*/
public static String getCamelCase(String s) {
StringBuilder result = new StringBuilder();
@@ -48,13 +47,12 @@ public class CamelUtil {
}
/**
- * Return an array with start/end indices for the characters used for camel
- * case matching, ignoring the first (start) many camel case characters.
- * For example, getCamelCaseIndices("some CamelCase", 1, 2) will return
- * {{5,5},{10,10}}.
+ * Return an array with start/end indices for the characters used for camel case
+ * matching, ignoring the first (start) many camel case characters. For example,
+ * getCamelCaseIndices("some CamelCase", 1, 2) will return {{5,5},{10,10}}.
*
- * @param s the source string
- * @param start how many characters of getCamelCase(s) should be ignored
+ * @param s the source string
+ * @param start how many characters of getCamelCase(s) should be ignored
* @param length for how many characters should indices be returned
* @return an array of length start
*/
@@ -76,15 +74,13 @@ public class CamelUtil {
/**
* Returns the next index to be used for camel case matching.
*
- * @param s the string
+ * @param s the string
* @param index the index
* @return the next index, or -1 if not found
*/
public static int getNextCamelIndex(String s, int index) {
char c;
- while (index < s.length()
- && !(isSeparatorForCamelCase(c = s.charAt(index)))
- && Character.isLowerCase(c)) {
+ while (index < s.length() && !(isSeparatorForCamelCase(c = s.charAt(index))) && Character.isLowerCase(c)) {
index++;
}
while (index < s.length() && isSeparatorForCamelCase(c = s.charAt(index))) {
@@ -97,8 +93,8 @@ public class CamelUtil {
}
/**
- * Returns true if the given character is to be considered a separator
- * for camel case matching purposes.
+ * Returns true if the given character is to be considered a separator for camel
+ * case matching purposes.
*
* @param c the character
* @return true if the character is a separator
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/CommandElement.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/CommandElement.java
index 1ab1e90b5b0..f30d37378a1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/CommandElement.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/CommandElement.java
@@ -44,8 +44,7 @@ public class CommandElement extends QuickAccessElement {
private String id;
- /* package */CommandElement(ParameterizedCommand command, String id,
- CommandProvider commandProvider) {
+ /* package */ CommandElement(ParameterizedCommand command, String id, CommandProvider commandProvider) {
super(commandProvider);
this.id = id;
this.command = command;
@@ -58,27 +57,22 @@ public class CommandElement extends QuickAccessElement {
CommandProvider provider = (CommandProvider) o;
if (provider.getHandlerService() != null && provider.getContextSnapshot() != null) {
try {
- provider.getHandlerService().executeCommandInContext(command, null,
- provider.getContextSnapshot());
+ provider.getHandlerService().executeCommandInContext(command, null, provider.getContextSnapshot());
} catch (Exception ex) {
- StatusUtil.handleStatus(ex, StatusManager.SHOW
- | StatusManager.LOG);
+ StatusUtil.handleStatus(ex, StatusManager.SHOW | StatusManager.LOG);
}
return;
}
}
// let's try the old fashioned way
- IWorkbenchWindow window = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow();
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window != null) {
- IHandlerService handlerService = window
- .getWorkbench().getService(IHandlerService.class);
+ IHandlerService handlerService = window.getWorkbench().getService(IHandlerService.class);
try {
handlerService.executeCommand(command, null);
} catch (Exception ex) {
- StatusUtil.handleStatus(ex, StatusManager.SHOW
- | StatusManager.LOG);
+ StatusUtil.handleStatus(ex, StatusManager.SHOW | StatusManager.LOG);
}
}
}
@@ -128,18 +122,16 @@ public class CommandElement extends QuickAccessElement {
}
/**
- * Returns a formatted string that can be used to invoke this element's
- * command. <code>null</code> may be returned if a binding cannot be found.
+ * Returns a formatted string that can be used to invoke this element's command.
+ * <code>null</code> may be returned if a binding cannot be found.
*
* @return the string keybinding for invoking this element's command, may be
* <code>null</code>
* @since 3.6
*/
public String getBinding() {
- BindingService service = (BindingService) PlatformUI.getWorkbench().getService(
- IBindingService.class);
- TriggerSequence[] triggerSeq = service.getBindingManager()
- .getActiveBindingsDisregardingContextFor(command);
+ BindingService service = (BindingService) PlatformUI.getWorkbench().getService(IBindingService.class);
+ TriggerSequence[] triggerSeq = service.getBindingManager().getActiveBindingsDisregardingContextFor(command);
if (triggerSeq != null && triggerSeq.length > 0) {
return triggerSeq[0].format();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/CommandProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/CommandProvider.java
index 4e5e3f6ab1f..40e5b465e09 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/CommandProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/CommandProvider.java
@@ -15,6 +15,7 @@
*******************************************************************************/
package org.eclipse.ui.internal.quickaccess;
+
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
@@ -115,8 +116,7 @@ public class CommandProvider extends QuickAccessProvider {
@Override
public ImageDescriptor getImageDescriptor() {
- return WorkbenchImages
- .getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJ_NODE);
+ return WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJ_NODE);
}
@Override
@@ -130,8 +130,7 @@ public class CommandProvider extends QuickAccessProvider {
IEclipseContext ctx = ((ExpressionContext) currentSnapshot).eclipseContext;
ehandlerService = ctx.get(EHandlerService.class);
} else {
- ehandlerService = PlatformUI.getWorkbench().getService(
- EHandlerService.class);
+ ehandlerService = PlatformUI.getWorkbench().getService(EHandlerService.class);
}
}
return ehandlerService;
@@ -143,8 +142,7 @@ public class CommandProvider extends QuickAccessProvider {
IEclipseContext ctx = ((ExpressionContext) currentSnapshot).eclipseContext;
commandService = ctx.get(ICommandService.class);
} else {
- commandService = PlatformUI.getWorkbench().getService(
- ICommandService.class);
+ commandService = PlatformUI.getWorkbench().getService(ICommandService.class);
}
}
return commandService;
@@ -156,8 +154,7 @@ public class CommandProvider extends QuickAccessProvider {
IEclipseContext ctx = ((ExpressionContext) currentSnapshot).eclipseContext;
handlerService = ctx.get(IHandlerService.class);
} else {
- handlerService = PlatformUI.getWorkbench().getService(
- IHandlerService.class);
+ handlerService = PlatformUI.getWorkbench().getService(IHandlerService.class);
}
}
return handlerService;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/EditorElement.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/EditorElement.java
index 5db89a3a57c..a8e047d3f90 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/EditorElement.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/EditorElement.java
@@ -34,7 +34,7 @@ public class EditorElement extends QuickAccessElement {
private IEditorReference editorReference;
- /* package */EditorElement(IEditorReference editorReference, EditorProvider editorProvider) {
+ /* package */ EditorElement(IEditorReference editorReference, EditorProvider editorProvider) {
super(editorProvider);
this.editorReference = editorReference;
}
@@ -43,8 +43,7 @@ public class EditorElement extends QuickAccessElement {
public void execute() {
IWorkbenchPart part = editorReference.getPart(true);
if (part != null) {
- IWorkbenchPage activePage = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getActivePage();
+ IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
if (activePage != null) {
activePage.activate(part);
}
@@ -80,8 +79,7 @@ public class EditorElement extends QuickAccessElement {
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result
- + ((editorReference == null) ? 0 : editorReference.hashCode());
+ result = prime * result + ((editorReference == null) ? 0 : editorReference.hashCode());
return result;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/EditorProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/EditorProvider.java
index 53d1d8aa51e..6e94782859c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/EditorProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/EditorProvider.java
@@ -43,19 +43,16 @@ public class EditorProvider extends QuickAccessProvider {
public QuickAccessElement[] getElements() {
if (idToElement == null) {
idToElement = new HashMap();
- IWorkbenchPage activePage = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getActivePage();
+ IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
if (activePage == null) {
return new QuickAccessElement[0];
}
for (IEditorReference editor : activePage.getEditorReferences()) {
- EditorElement editorElement = new EditorElement(editor,
- this);
+ EditorElement editorElement = new EditorElement(editor, this);
idToElement.put(editorElement.getId(), editorElement);
}
}
- return (QuickAccessElement[]) idToElement.values().toArray(
- new QuickAccessElement[idToElement.values().size()]);
+ return (QuickAccessElement[]) idToElement.values().toArray(new QuickAccessElement[idToElement.values().size()]);
}
@Override
@@ -65,8 +62,7 @@ public class EditorProvider extends QuickAccessProvider {
@Override
public ImageDescriptor getImageDescriptor() {
- return WorkbenchImages
- .getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJ_NODE);
+ return WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJ_NODE);
}
@Override
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/PerspectiveElement.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/PerspectiveElement.java
index e9bc761e7a7..501235ffc7d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/PerspectiveElement.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/PerspectiveElement.java
@@ -37,7 +37,7 @@ public class PerspectiveElement extends QuickAccessElement {
private final IPerspectiveDescriptor descriptor;
- /* package */PerspectiveElement(IPerspectiveDescriptor descriptor, PerspectiveProvider perspectiveProvider) {
+ /* package */ PerspectiveElement(IPerspectiveDescriptor descriptor, PerspectiveProvider perspectiveProvider) {
super(perspectiveProvider);
this.descriptor = descriptor;
}
@@ -45,21 +45,17 @@ public class PerspectiveElement extends QuickAccessElement {
@Override
public void execute() {
IWorkbench workbench = PlatformUI.getWorkbench();
- IWorkbenchWindow window = workbench
- .getActiveWorkbenchWindow();
+ IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
IWorkbenchPage activePage = window.getActivePage();
if (activePage != null) {
activePage.setPerspective(descriptor);
} else {
try {
- window.openPage(descriptor.getId(), ((Workbench) workbench)
- .getDefaultPageInput());
+ window.openPage(descriptor.getId(), ((Workbench) workbench).getDefaultPageInput());
} catch (WorkbenchException e) {
- IStatus errorStatus = WorkbenchPlugin.newError(NLS.bind(
- WorkbenchMessages.Workbench_showPerspectiveError,
- descriptor.getLabel()), e);
- StatusManager.getManager().handle(errorStatus,
- StatusManager.SHOW);
+ IStatus errorStatus = WorkbenchPlugin
+ .newError(NLS.bind(WorkbenchMessages.Workbench_showPerspectiveError, descriptor.getLabel()), e);
+ StatusManager.getManager().handle(errorStatus, StatusManager.SHOW);
}
}
}
@@ -83,8 +79,7 @@ public class PerspectiveElement extends QuickAccessElement {
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result
- + ((descriptor == null) ? 0 : descriptor.hashCode());
+ result = prime * result + ((descriptor == null) ? 0 : descriptor.hashCode());
return result;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/PerspectiveProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/PerspectiveProvider.java
index 52c8fa86e4a..a7646c3667f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/PerspectiveProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/PerspectiveProvider.java
@@ -49,26 +49,23 @@ public class PerspectiveProvider extends QuickAccessProvider {
@Override
public QuickAccessElement[] getElements() {
if (cachedElements == null) {
- IPerspectiveDescriptor[] perspectives = PlatformUI.getWorkbench()
- .getPerspectiveRegistry().getPerspectives();
+ IPerspectiveDescriptor[] perspectives = PlatformUI.getWorkbench().getPerspectiveRegistry()
+ .getPerspectives();
cachedElements = new QuickAccessElement[perspectives.length];
for (int i = 0; i < perspectives.length; i++) {
if (!WorkbenchActivityHelper.filterItem(perspectives[i])) {
- PerspectiveElement perspectiveElement = new PerspectiveElement(perspectives[i],
- this);
+ PerspectiveElement perspectiveElement = new PerspectiveElement(perspectives[i], this);
idToElement.put(perspectiveElement.getId(), perspectiveElement);
}
}
- cachedElements = idToElement.values().toArray(
- new QuickAccessElement[idToElement.size()]);
+ cachedElements = idToElement.values().toArray(new QuickAccessElement[idToElement.size()]);
}
return cachedElements;
}
@Override
public ImageDescriptor getImageDescriptor() {
- return WorkbenchImages
- .getImageDescriptor(ISharedImages.IMG_ETOOL_DEF_PERSPECTIVE);
+ return WorkbenchImages.getImageDescriptor(ISharedImages.IMG_ETOOL_DEF_PERSPECTIVE);
}
@Override
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/PreferenceElement.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/PreferenceElement.java
index 886d584cc16..8be038aff9c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/PreferenceElement.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/PreferenceElement.java
@@ -37,7 +37,8 @@ public class PreferenceElement extends QuickAccessElement {
private String matchLabelCache;
- /* package */PreferenceElement(IPreferenceNode preferenceNode, String prefix, PreferenceProvider preferenceProvider) {
+ /* package */ PreferenceElement(IPreferenceNode preferenceNode, String prefix,
+ PreferenceProvider preferenceProvider) {
super(preferenceProvider);
this.preferenceNode = preferenceNode;
this.prefix = prefix;
@@ -45,11 +46,10 @@ public class PreferenceElement extends QuickAccessElement {
@Override
public void execute() {
- IWorkbenchWindow window = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow();
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window != null) {
- WorkbenchPreferenceDialog dialog = WorkbenchPreferenceDialog
- .createDialogOn(window.getShell(), preferenceNode.getId());
+ WorkbenchPreferenceDialog dialog = WorkbenchPreferenceDialog.createDialogOn(window.getShell(),
+ preferenceNode.getId());
dialog.open();
}
}
@@ -72,8 +72,7 @@ public class PreferenceElement extends QuickAccessElement {
@Override
public String getLabel() {
if (prefix != null && prefix.length() > 0) {
- return preferenceNode.getLabelText() + separator
- + prefix;
+ return preferenceNode.getLabelText() + separator + prefix;
}
return preferenceNode.getLabelText();
}
@@ -98,8 +97,7 @@ public class PreferenceElement extends QuickAccessElement {
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result
- + ((preferenceNode == null) ? 0 : preferenceNode.hashCode());
+ result = prime * result + ((preferenceNode == null) ? 0 : preferenceNode.hashCode());
return result;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/PreferenceProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/PreferenceProvider.java
index 5fa62bfee71..2ac94e1491a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/PreferenceProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/PreferenceProvider.java
@@ -63,15 +63,13 @@ public class PreferenceProvider extends QuickAccessProvider {
return cachedElements;
}
- private void collectElements(String prefix, IPreferenceNode[] subNodes,
- List<PreferenceElement> result) {
+ private void collectElements(String prefix, IPreferenceNode[] subNodes, List<PreferenceElement> result) {
for (int i = 0; i < subNodes.length; i++) {
if (!WorkbenchActivityHelper.filterItem(subNodes[i])) {
- PreferenceElement preferenceElement = new PreferenceElement(subNodes[i], prefix,
- this);
+ PreferenceElement preferenceElement = new PreferenceElement(subNodes[i], prefix, this);
result.add(preferenceElement);
- String nestedPrefix = prefix.length() == 0 ? subNodes[i].getLabelText() : (prefix
- + "/" + subNodes[i].getLabelText()); //$NON-NLS-1$
+ String nestedPrefix = prefix.length() == 0 ? subNodes[i].getLabelText()
+ : (prefix + "/" + subNodes[i].getLabelText()); //$NON-NLS-1$
collectElements(nestedPrefix, subNodes[i].getSubNodes(), result);
}
}
@@ -79,8 +77,7 @@ public class PreferenceProvider extends QuickAccessProvider {
@Override
public ImageDescriptor getImageDescriptor() {
- return WorkbenchImages
- .getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJ_NODE);
+ return WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJ_NODE);
}
@Override
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/PropertiesElement.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/PropertiesElement.java
index 22519731f02..b45c602b8aa 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/PropertiesElement.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/PropertiesElement.java
@@ -31,7 +31,8 @@ public class PropertiesElement extends QuickAccessElement {
private Object selectedElement;
private IPreferenceNode preferenceNode;
- /* package */PropertiesElement(Object selectedElement, IPreferenceNode preferenceNode, PropertiesProvider propertiesProvider) {
+ /* package */ PropertiesElement(Object selectedElement, IPreferenceNode preferenceNode,
+ PropertiesProvider propertiesProvider) {
super(propertiesProvider);
this.selectedElement = selectedElement;
this.preferenceNode = preferenceNode;
@@ -39,11 +40,10 @@ public class PropertiesElement extends QuickAccessElement {
@Override
public void execute() {
- IWorkbenchWindow window = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow();
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window != null) {
- PropertyDialog dialog = PropertyDialog.createDialogOn(window
- .getShell(), preferenceNode.getId(), selectedElement);
+ PropertyDialog dialog = PropertyDialog.createDialogOn(window.getShell(), preferenceNode.getId(),
+ selectedElement);
dialog.open();
}
}
@@ -72,8 +72,7 @@ public class PropertiesElement extends QuickAccessElement {
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result
- + ((preferenceNode == null) ? 0 : preferenceNode.hashCode());
+ result = prime * result + ((preferenceNode == null) ? 0 : preferenceNode.hashCode());
return result;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/PropertiesProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/PropertiesProvider.java
index f88ed40f0b7..1f82d4d9db3 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/PropertiesProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/PropertiesProvider.java
@@ -53,23 +53,19 @@ public class PropertiesProvider extends QuickAccessProvider {
if (activePage != null) {
PropertyPageManager pageManager = new PropertyPageManager();
ISelection selection = activePage.getSelection();
- if (selection instanceof IStructuredSelection
- && !selection.isEmpty()) {
+ if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
Object element = ((IStructuredSelection) selection).getFirstElement();
PropertyPageContributorManager.getManager().contribute(pageManager, element);
List list = pageManager.getElements(PreferenceManager.PRE_ORDER);
IPreferenceNode[] properties = (IPreferenceNode[]) list.toArray(new IPreferenceNode[list.size()]);
for (IPreferenceNode property : properties) {
- PropertiesElement propertiesElement = new PropertiesElement(
- element, property, this);
- idToElement.put(propertiesElement.getId(),
- propertiesElement);
+ PropertiesElement propertiesElement = new PropertiesElement(element, property, this);
+ idToElement.put(propertiesElement.getId(), propertiesElement);
}
}
}
}
- return (QuickAccessElement[]) idToElement.values().toArray(
- new QuickAccessElement[idToElement.values().size()]);
+ return (QuickAccessElement[]) idToElement.values().toArray(new QuickAccessElement[idToElement.values().size()]);
}
@Override
@@ -79,8 +75,7 @@ public class PropertiesProvider extends QuickAccessProvider {
@Override
public ImageDescriptor getImageDescriptor() {
- return WorkbenchImages
- .getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJ_NODE);
+ return WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJ_NODE);
}
@Override
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/QuickAccessContents.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/QuickAccessContents.java
index 3027905fc3f..a3338a44115 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/QuickAccessContents.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/QuickAccessContents.java
@@ -77,7 +77,6 @@ import org.eclipse.ui.quickaccess.QuickAccessElement;
import org.eclipse.ui.quickaccess.QuickAccessProvider;
import org.eclipse.ui.themes.ColorUtil;
-
/**
* Provides the contents for the quick access shell created by
* {@link SearchField}. This was also used by {@link QuickAccessDialog} prior to
@@ -86,8 +85,8 @@ import org.eclipse.ui.themes.ColorUtil;
*/
public abstract class QuickAccessContents {
/**
- * When opened in a popup we were given the command used to open it. Now
- * that we have a shell, we are just using a hard coded command id.
+ * When opened in a popup we were given the command used to open it. Now that we
+ * have a shell, we are just using a hard coded command id.
*/
private static final String QUICK_ACCESS_COMMAND_ID = "org.eclipse.ui.window.quickAccess"; //$NON-NLS-1$
private static final int INITIAL_COUNT_PER_PROVIDER = 5;
@@ -103,14 +102,13 @@ public abstract class QuickAccessContents {
protected Table table;
protected Label infoLabel;
- private LocalResourceManager resourceManager = new LocalResourceManager(
- JFaceResources.getResources());
+ private LocalResourceManager resourceManager = new LocalResourceManager(JFaceResources.getResources());
protected String rememberedText;
/**
- * A color for dulled out items created by mixing the table foreground. Will
- * be disposed when the {@link #resourceManager} is disposed.
+ * A color for dulled out items created by mixing the table foreground. Will be
+ * disposed when the {@link #resourceManager} is disposed.
*/
private Color grayColor;
private TextLayout textLayout;
@@ -126,17 +124,16 @@ public abstract class QuickAccessContents {
* Returns the number of items the table can fit in its current layout
*/
private int computeNumberOfItems() {
- Rectangle rect = table.getClientArea ();
- int itemHeight = table.getItemHeight ();
- int headerHeight = table.getHeaderHeight ();
+ Rectangle rect = table.getClientArea();
+ int itemHeight = table.getItemHeight();
+ int headerHeight = table.getHeaderHeight();
return (rect.height - headerHeight + itemHeight - 1) / (itemHeight + table.getGridLineWidth());
}
/**
* Refreshes the contents of the quick access shell
*
- * @param filter
- * The filter text to apply to results
+ * @param filter The filter text to apply to results
*
*/
public void refresh(String filter) {
@@ -177,11 +174,10 @@ public abstract class QuickAccessContents {
QuickAccessHelpSearchElement searchHelpElement = null;
/**
- * Instantiate a new {@link QuickAccessEntry} to search the given text in
- * the eclipse help
+ * Instantiate a new {@link QuickAccessEntry} to search the given text in the
+ * eclipse help
*
- * @param text
- * String to search in the Eclipse Help
+ * @param text String to search in the Eclipse Help
*
* @return the {@link QuickAccessEntry} to perform the action
*/
@@ -273,23 +269,22 @@ public abstract class QuickAccessContents {
}
/**
- * Allows the quick access content owner to mark a quick access element as
- * being a perfect match, putting it at the start of the table.
+ * Allows the quick access content owner to mark a quick access element as being
+ * a perfect match, putting it at the start of the table.
*
- * @param filter
- * the filter text used to find a match
+ * @param filter the filter text used to find a match
* @return an element to be put at the top of the table or <code>null</code>
*/
protected abstract QuickAccessElement getPerfectMatch(String filter);
/**
- * Notifies the quick access content owner that the contents of the table
- * have been changed.
+ * Notifies the quick access content owner that the contents of the table have
+ * been changed.
*
- * @param filterTextEmpty
- * whether the filter text used to calculate matches was empty
- * @param showAllMatches
- * whether the results were constrained by the size of the dialog
+ * @param filterTextEmpty whether the filter text used to calculate matches was
+ * empty
+ * @param showAllMatches whether the results were constrained by the size of
+ * the dialog
*
*/
protected abstract void updateFeedback(boolean filterTextEmpty, boolean showAllMatches);
@@ -298,8 +293,7 @@ public abstract class QuickAccessContents {
* Sets whether to display all matches to the current filter or limit the
* results. Will refresh the table contents and update the info label.
*
- * @param showAll
- * whether to display all matches
+ * @param showAll whether to display all matches
*/
public void setShowAllMatches(boolean showAll) {
if (showAllMatches != showAll) {
@@ -328,25 +322,24 @@ public abstract class QuickAccessContents {
}
/**
- * Returns the trigger sequence that can be used to open the quick access
- * dialog as well as toggle the show all results feature. Can return
- * <code>null</code> if no trigger sequence is known.
+ * Returns the trigger sequence that can be used to open the quick access dialog
+ * as well as toggle the show all results feature. Can return <code>null</code>
+ * if no trigger sequence is known.
*
* @return the trigger sequence used to open the quick access or
* <code>null</code>
*/
public TriggerSequence getTriggerSequence() {
if (keySequence == null) {
- IBindingService bindingService =
- Adapters.adapt(PlatformUI.getWorkbench(), IBindingService.class);
+ IBindingService bindingService = Adapters.adapt(PlatformUI.getWorkbench(), IBindingService.class);
keySequence = bindingService.getBestActiveBindingFor(QUICK_ACCESS_COMMAND_ID);
}
return keySequence;
}
/**
- * Return whether the shell is currently set to display all matches or limit
- * the results.
+ * Return whether the shell is currently set to display all matches or limit the
+ * results.
*
* @return whether all matches will be displayed
*/
@@ -389,8 +382,7 @@ public abstract class QuickAccessContents {
item.setText(0, entry.provider.getName());
item.setText(1, entry.element.getLabel());
if (Util.isWpf()) {
- item.setImage(1, entry.getImage(entry.element,
- resourceManager));
+ item.setImage(1, entry.getImage(entry.element, resourceManager));
}
index++;
}
@@ -413,9 +405,9 @@ public abstract class QuickAccessContents {
int numberOfFilteredResults;
/**
- * Compute how many items are effectively filtered at a specific point in
- * time. So doing, the quick access content can perform operations that
- * depends on this number, i.e. hide the info label.
+ * Compute how many items are effectively filtered at a specific point in time.
+ * So doing, the quick access content can perform operations that depends on
+ * this number, i.e. hide the info label.
*
* @return number number of elements filtered
*/
@@ -424,25 +416,22 @@ public abstract class QuickAccessContents {
}
/**
- * Returns a list per provider containing matching {@link QuickAccessEntry}
- * that should be displayed in the table given a text filter and a perfect
- * match entry that should be given priority. The number of items returned
- * is affected by {@link #getShowAllMatches()} and the size of the table's
- * composite.
+ * Returns a list per provider containing matching {@link QuickAccessEntry} that
+ * should be displayed in the table given a text filter and a perfect match
+ * entry that should be given priority. The number of items returned is affected
+ * by {@link #getShowAllMatches()} and the size of the table's composite.
*
- * @param filter
- * the string text filter to apply, possibly empty
- * @param perfectMatch
- * a quick access element that should be given priority or
- * <code>null</code>
- * @param extraEntries
- * extra entries that will be added to the tabular visualization
- * after computing matching entries, i.e. Search in Help
+ * @param filter the string text filter to apply, possibly empty
+ * @param perfectMatch a quick access element that should be given priority or
+ * <code>null</code>
+ * @param extraEntries extra entries that will be added to the tabular
+ * visualization after computing matching entries, i.e.
+ * Search in Help
* @return the array of lists (one per provider) contains the quick access
* entries that should be added to the table, possibly empty
*/
- private List<QuickAccessEntry>[] computeMatchingEntries(String filter,
- QuickAccessElement perfectMatch, List<QuickAccessEntry> extraEntries) {
+ private List<QuickAccessEntry>[] computeMatchingEntries(String filter, QuickAccessElement perfectMatch,
+ List<QuickAccessEntry> extraEntries) {
// collect matches in an array of lists
@SuppressWarnings("unchecked")
List<QuickAccessEntry>[] entries = new List[providers.length];
@@ -471,8 +460,7 @@ public abstract class QuickAccessContents {
category = categoryMatcher.group(1);
filter = category + " " + categoryMatcher.group(2); //$NON-NLS-1$
}
- for (int i = 0; i < providers.length
- && (showAllMatches || countTotal < maxCount); i++) {
+ for (int i = 0; i < providers.length && (showAllMatches || countTotal < maxCount); i++) {
if (entries[i] == null) {
entries[i] = new ArrayList<>();
indexPerProvider[i] = 0;
@@ -509,8 +497,8 @@ public abstract class QuickAccessContents {
QuickAccessEntry entry = null;
if (filter.length() == 0) {
if (i == 0 || showAllMatches) {
- entry = new QuickAccessEntry(element, provider, new int[0][0],
- new int[0][0], QuickAccessEntry.MATCH_PERFECT);
+ entry = new QuickAccessEntry(element, provider, new int[0][0], new int[0][0],
+ QuickAccessEntry.MATCH_PERFECT);
} else {
entry = null;
}
@@ -566,8 +554,8 @@ public abstract class QuickAccessContents {
Pattern categoryPattern;
/**
- * Return a pattern like {@code "^(:?Views|Perspective):\\s?(.*)"}, with all
- * the provider names separated by semicolon.
+ * Return a pattern like {@code "^(:?Views|Perspective):\\s?(.*)"}, with all the
+ * provider names separated by semicolon.
*
* @return Returns the patternProvider.
*/
@@ -622,8 +610,7 @@ public abstract class QuickAccessContents {
}
protected IDialogSettings getDialogSettings() {
- final IDialogSettings workbenchDialogSettings = WorkbenchPlugin
- .getDefault().getDialogSettings();
+ final IDialogSettings workbenchDialogSettings = WorkbenchPlugin.getDefault().getDialogSettings();
IDialogSettings result = workbenchDialogSettings.getSection(getId());
if (result == null) {
result = workbenchDialogSettings.addNewSection(getId());
@@ -641,8 +628,7 @@ public abstract class QuickAccessContents {
QuickAccessElement selectedElement = null;
String text = filterText.getText().toLowerCase();
if (table.getSelectionCount() == 1) {
- QuickAccessEntry entry = (QuickAccessEntry) table
- .getSelection()[0].getData();
+ QuickAccessEntry entry = (QuickAccessEntry) table.getSelection()[0].getData();
selectedElement = entry == null ? null : entry.element;
}
if (selectedElement != null) {
@@ -652,9 +638,8 @@ public abstract class QuickAccessContents {
}
/**
- * Should be called by the owner of the parent composite when the shell is
- * being activated (made visible). This allows the show all keybinding to be
- * updated.
+ * Should be called by the owner of the parent composite when the shell is being
+ * activated (made visible). This allows the show all keybinding to be updated.
*/
public void preOpen() {
// Make sure we always start filtering
@@ -665,13 +650,15 @@ public abstract class QuickAccessContents {
}
/**
- * Informs the owner of the parent composite that the quick access dialog
- * should be closed
+ * Informs the owner of the parent composite that the quick access dialog should
+ * be closed
*/
protected abstract void doClose();
/**
- * Allows the dialog contents to interact correctly with the text box used to open it
+ * Allows the dialog contents to interact correctly with the text box used to
+ * open it
+ *
* @param filterText text box to hook up
*/
public void hookFilterText(Text filterText) {
@@ -762,8 +749,10 @@ public abstract class QuickAccessContents {
/**
* Creates the table providing the contents for the quick access dialog
*
- * @param composite parent composite with {@link GridLayout}
- * @param defaultOrientation the window orientation to use for the table {@link SWT#RIGHT_TO_LEFT} or {@link SWT#LEFT_TO_RIGHT}
+ * @param composite parent composite with {@link GridLayout}
+ * @param defaultOrientation the window orientation to use for the table
+ * {@link SWT#RIGHT_TO_LEFT} or
+ * {@link SWT#LEFT_TO_RIGHT}
* @return the created table
*/
public Table createTable(Composite composite, int defaultOrientation) {
@@ -775,8 +764,7 @@ public abstract class QuickAccessContents {
table = new Table(tableComposite, SWT.SINGLE | SWT.FULL_SELECTION);
textLayout = new TextLayout(table.getDisplay());
textLayout.setOrientation(defaultOrientation);
- Font boldFont = resourceManager.createFont(FontDescriptor.createFrom(
- table.getFont()).setStyle(SWT.BOLD));
+ Font boldFont = resourceManager.createFont(FontDescriptor.createFrom(table.getFont()).setStyle(SWT.BOLD));
textLayout.setFont(table.getFont());
textLayout.setText(QuickAccessMessages.QuickAccess_AvailableCategories);
int maxProviderWidth = (textLayout.getBounds().width);
@@ -797,7 +785,8 @@ public abstract class QuickAccessContents {
if (!resized) {
resized = true;
e.display.timerExec(100, () -> {
- if (table != null && !table.isDisposed() && filterText !=null && !filterText.isDisposed()) {
+ if (table != null && !table.isDisposed() && filterText != null
+ && !filterText.isDisposed()) {
refresh(filterText.getText().toLowerCase());
}
resized = false;
@@ -849,9 +838,7 @@ public abstract class QuickAccessContents {
if (table.equals(e.getSource())) {
TableItem tableItem = table.getItem(new Point(e.x, e.y));
if (lastItem == null ^ tableItem == null) {
- table.setCursor(tableItem == null ? null
- : table.getDisplay().getSystemCursor(
- SWT.CURSOR_HAND));
+ table.setCursor(tableItem == null ? null : table.getDisplay().getSystemCursor(SWT.CURSOR_HAND));
}
if (tableItem != null) {
if (!tableItem.equals(lastItem)) {
@@ -873,11 +860,10 @@ public abstract class QuickAccessContents {
});
final TextStyle boldStyle;
- if (PlatformUI.getPreferenceStore().getBoolean(
- IWorkbenchPreferenceConstants.USE_COLORED_LABELS)) {
+ if (PlatformUI.getPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.USE_COLORED_LABELS)) {
boldStyle = new TextStyle(boldFont, null, null);
- grayColor = resourceManager.createColor(ColorUtil.blend(table.getBackground().getRGB(),
- table.getForeground().getRGB()));
+ grayColor = resourceManager
+ .createColor(ColorUtil.blend(table.getBackground().getRGB(), table.getForeground().getRGB()));
} else {
boldStyle = null;
}
@@ -905,8 +891,8 @@ public abstract class QuickAccessContents {
}
/**
- * Creates a label which will display the key binding to expand
- * the search results.
+ * Creates a label which will display the key binding to expand the search
+ * results.
*
* @param parent parent composite with {@link GridLayout}
* @return the created label
@@ -935,7 +921,8 @@ public abstract class QuickAccessContents {
return null;
}
if (providerMap == null || providerMap.size() != providers.length) {
- providerMap = Arrays.stream(providers).collect(Collectors.toMap(QuickAccessProvider::getId, Function.identity()));
+ providerMap = Arrays.stream(providers)
+ .collect(Collectors.toMap(QuickAccessProvider::getId, Function.identity()));
}
return providerMap.get(providerId);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/QuickAccessDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/QuickAccessDialog.java
index e3e5e50a8cd..499dccaf173 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/QuickAccessDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/QuickAccessDialog.java
@@ -92,156 +92,147 @@ public class QuickAccessDialog extends PopupDialog {
WorkbenchWindow workbenchWindow = (WorkbenchWindow) window;
final MWindow model = workbenchWindow.getModel();
- BusyIndicator.showWhile(window.getShell() == null ? null : window.getShell().getDisplay(),
- () -> {
- final CommandProvider commandProvider = new CommandProvider();
- commandProvider.setSnapshot(new ExpressionContext(model.getContext()
- .getActiveLeaf()));
- List<QuickAccessProvider> providers = new ArrayList<>();
- providers.add(new PreviousPicksProvider(previousPicksList));
- providers.add(new EditorProvider());
- providers.add(new ViewProvider(model.getContext().get(MApplication.class), model));
- providers.add(new PerspectiveProvider());
- providers.add(commandProvider);
- providers.add(new ActionProvider());
- providers.add(new WizardProvider());
- providers.add(new PreferenceProvider());
- providers.add(new PropertiesProvider());
- providers.addAll(QuickAccessExtensionManager.getProviders());
- providerMap = new HashMap<>();
- for (QuickAccessProvider provider : providers) {
- providerMap.put(provider.getId(), provider);
- }
- QuickAccessDialog.this.contents = new QuickAccessContents(
- providers.toArray(new QuickAccessProvider[providers.size()])) {
- @Override
- protected void updateFeedback(boolean filterTextEmpty,
- boolean showAllMatches) {
- if (filterTextEmpty) {
- setInfoText(QuickAccessMessages.QuickAccess_StartTypingToFindMatches);
- } else {
- TriggerSequence[] sequences = getInvokingCommandKeySequences();
- if (showAllMatches || sequences == null
- || sequences.length == 0) {
- setInfoText(""); //$NON-NLS-1$
- } else {
- setInfoText(NLS
- .bind(QuickAccessMessages.QuickAccess_PressKeyToShowAllMatches,
- sequences[0].format()));
- }
- }
+ BusyIndicator.showWhile(window.getShell() == null ? null : window.getShell().getDisplay(), () -> {
+ final CommandProvider commandProvider = new CommandProvider();
+ commandProvider.setSnapshot(new ExpressionContext(model.getContext().getActiveLeaf()));
+ List<QuickAccessProvider> providers = new ArrayList<>();
+ providers.add(new PreviousPicksProvider(previousPicksList));
+ providers.add(new EditorProvider());
+ providers.add(new ViewProvider(model.getContext().get(MApplication.class), model));
+ providers.add(new PerspectiveProvider());
+ providers.add(commandProvider);
+ providers.add(new ActionProvider());
+ providers.add(new WizardProvider());
+ providers.add(new PreferenceProvider());
+ providers.add(new PropertiesProvider());
+ providers.addAll(QuickAccessExtensionManager.getProviders());
+ providerMap = new HashMap<>();
+ for (QuickAccessProvider provider : providers) {
+ providerMap.put(provider.getId(), provider);
+ }
+ QuickAccessDialog.this.contents = new QuickAccessContents(
+ providers.toArray(new QuickAccessProvider[providers.size()])) {
+ @Override
+ protected void updateFeedback(boolean filterTextEmpty, boolean showAllMatches) {
+ if (filterTextEmpty) {
+ setInfoText(QuickAccessMessages.QuickAccess_StartTypingToFindMatches);
+ } else {
+ TriggerSequence[] sequences = getInvokingCommandKeySequences();
+ if (showAllMatches || sequences == null || sequences.length == 0) {
+ setInfoText(""); //$NON-NLS-1$
+ } else {
+ setInfoText(NLS.bind(QuickAccessMessages.QuickAccess_PressKeyToShowAllMatches,
+ sequences[0].format()));
}
+ }
+ }
- @Override
- protected void doClose() {
- QuickAccessDialog.this.close();
- }
+ @Override
+ protected void doClose() {
+ QuickAccessDialog.this.close();
+ }
- /**
- * @param element
- */
- void addPreviousPick(String text, QuickAccessElement element) {
- // previousPicksList:
- // Remove element from previousPicksList so
- // there are no duplicates
- // If list is max size, remove last(oldest)
- // element
- // Remove entries for removed element from
- // elementMap and textMap
- // Add element to front of previousPicksList
- previousPicksList.remove(element);
- if (previousPicksList.size() == MAXIMUM_NUMBER_OF_ELEMENTS) {
- QuickAccessElement removedElement = previousPicksList.removeLast();
- ArrayList<String> removedList = textMap
- .remove(removedElement);
- for (int i = 0; i < removedList.size(); i++) {
- elementMap.remove(removedList.get(i));
- }
- }
- previousPicksList.addFirst(element);
-
- // textMap:
- // Get list of strings for element from textMap
- // Create new list for element if there isn't
- // one and put
- // element->textList in textMap
- // Remove rememberedText from list
- // If list is max size, remove first(oldest)
- // string
- // Remove text from elementMap
- // Add rememberedText to list of strings for
- // element in textMap
- ArrayList<String> textList = textMap.get(element);
- if (textList == null) {
- textList = new ArrayList<>();
- textMap.put(element, textList);
- }
+ /**
+ * @param element
+ */
+ void addPreviousPick(String text, QuickAccessElement element) {
+ // previousPicksList:
+ // Remove element from previousPicksList so
+ // there are no duplicates
+ // If list is max size, remove last(oldest)
+ // element
+ // Remove entries for removed element from
+ // elementMap and textMap
+ // Add element to front of previousPicksList
+ previousPicksList.remove(element);
+ if (previousPicksList.size() == MAXIMUM_NUMBER_OF_ELEMENTS) {
+ QuickAccessElement removedElement = previousPicksList.removeLast();
+ ArrayList<String> removedList = textMap.remove(removedElement);
+ for (int i = 0; i < removedList.size(); i++) {
+ elementMap.remove(removedList.get(i));
+ }
+ }
+ previousPicksList.addFirst(element);
+
+ // textMap:
+ // Get list of strings for element from textMap
+ // Create new list for element if there isn't
+ // one and put
+ // element->textList in textMap
+ // Remove rememberedText from list
+ // If list is max size, remove first(oldest)
+ // string
+ // Remove text from elementMap
+ // Add rememberedText to list of strings for
+ // element in textMap
+ ArrayList<String> textList = textMap.get(element);
+ if (textList == null) {
+ textList = new ArrayList<>();
+ textMap.put(element, textList);
+ }
- textList.remove(text);
- if (textList.size() == MAXIMUM_NUMBER_OF_TEXT_ENTRIES_PER_ELEMENT) {
- Object removedText = textList.remove(0);
- elementMap.remove(removedText);
- }
+ textList.remove(text);
+ if (textList.size() == MAXIMUM_NUMBER_OF_TEXT_ENTRIES_PER_ELEMENT) {
+ Object removedText = textList.remove(0);
+ elementMap.remove(removedText);
+ }
- if (text.length() > 0) {
- textList.add(text);
-
- // elementMap:
- // Put rememberedText->element in elementMap
- // If it replaced a different element update
- // textMap and
- // PreviousPicksList
- Object replacedElement = elementMap.put(text, element);
- if (replacedElement != null && !replacedElement.equals(element)) {
- textList = textMap.get(replacedElement);
- if (textList != null) {
- textList.remove(text);
- if (textList.isEmpty()) {
- textMap.remove(replacedElement);
- previousPicksList.remove(replacedElement);
- }
- }
+ if (text.length() > 0) {
+ textList.add(text);
+
+ // elementMap:
+ // Put rememberedText->element in elementMap
+ // If it replaced a different element update
+ // textMap and
+ // PreviousPicksList
+ Object replacedElement = elementMap.put(text, element);
+ if (replacedElement != null && !replacedElement.equals(element)) {
+ textList = textMap.get(replacedElement);
+ if (textList != null) {
+ textList.remove(text);
+ if (textList.isEmpty()) {
+ textMap.remove(replacedElement);
+ previousPicksList.remove(replacedElement);
}
}
}
+ }
+ }
- @Override
- protected QuickAccessElement getPerfectMatch(String filter) {
- QuickAccessElement perfectMatch = elementMap
- .get(filter);
- return perfectMatch;
- }
+ @Override
+ protected QuickAccessElement getPerfectMatch(String filter) {
+ QuickAccessElement perfectMatch = elementMap.get(filter);
+ return perfectMatch;
+ }
- @Override
- protected void handleElementSelected(String text, Object selectedElement) {
- if (selectedElement instanceof QuickAccessElement) {
- addPreviousPick(text, (QuickAccessElement) selectedElement);
- storeDialog(getDialogSettings());
-
- /*
- * Execute after the dialog has been fully
- * closed/disposed and the correct
- * EclipseContext is in place.
- */
- final QuickAccessElement element = (QuickAccessElement) selectedElement;
- window.getShell().getDisplay().asyncExec(() -> element.execute());
- }
- }
- };
- restoreDialog();
- QuickAccessDialog.this.invokingCommand = invokingCommand;
- if (QuickAccessDialog.this.invokingCommand != null
- && !QuickAccessDialog.this.invokingCommand.isDefined()) {
- QuickAccessDialog.this.invokingCommand = null;
- } else {
- // Pre-fetch key sequence - do not change because
- // scope will
- // change later.
- getInvokingCommandKeySequences();
+ @Override
+ protected void handleElementSelected(String text, Object selectedElement) {
+ if (selectedElement instanceof QuickAccessElement) {
+ addPreviousPick(text, (QuickAccessElement) selectedElement);
+ storeDialog(getDialogSettings());
+
+ /*
+ * Execute after the dialog has been fully closed/disposed and the correct
+ * EclipseContext is in place.
+ */
+ final QuickAccessElement element = (QuickAccessElement) selectedElement;
+ window.getShell().getDisplay().asyncExec(() -> element.execute());
}
- // create early
- create();
- });
+ }
+ };
+ restoreDialog();
+ QuickAccessDialog.this.invokingCommand = invokingCommand;
+ if (QuickAccessDialog.this.invokingCommand != null && !QuickAccessDialog.this.invokingCommand.isDefined()) {
+ QuickAccessDialog.this.invokingCommand = null;
+ } else {
+ // Pre-fetch key sequence - do not change because
+ // scope will
+ // change later.
+ getInvokingCommandKeySequences();
+ }
+ // create early
+ create();
+ });
QuickAccessDialog.this.contents.refresh(""); //$NON-NLS-1$
}
@@ -249,8 +240,7 @@ public class QuickAccessDialog extends PopupDialog {
protected Control createTitleControl(Composite parent) {
filterText = new Text(parent, SWT.NONE);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false)
- .applyTo(filterText);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(filterText);
contents.hookFilterText(filterText);
filterText.addKeyListener(getKeyAdapter());
@@ -262,8 +252,7 @@ public class QuickAccessDialog extends PopupDialog {
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
boolean isWin32 = Util.isWindows();
- GridLayoutFactory.fillDefaults().extendedMargins(isWin32 ? 0 : 3, 3, 2, 2)
- .applyTo(composite);
+ GridLayoutFactory.fillDefaults().extendedMargins(isWin32 ? 0 : 3, 3, 2, 2).applyTo(composite);
Table table = contents.createTable(composite, getDefaultOrientation());
table.addKeyListener(getKeyAdapter());
@@ -274,8 +263,7 @@ public class QuickAccessDialog extends PopupDialog {
final protected TriggerSequence[] getInvokingCommandKeySequences() {
if (invokingCommandKeySequences == null) {
if (invokingCommand != null) {
- IBindingService bindingService =
- Adapters.adapt(window.getWorkbench(), IBindingService.class);
+ IBindingService bindingService = Adapters.adapt(window.getWorkbench(), IBindingService.class);
invokingCommandKeySequences = bindingService.getActiveBindingsFor(invokingCommand.getId());
}
}
@@ -288,8 +276,8 @@ public class QuickAccessDialog extends PopupDialog {
@Override
public void keyPressed(KeyEvent e) {
int accelerator = SWTKeySupport.convertEventToUnmodifiedAccelerator(e);
- KeySequence keySequence = KeySequence.getInstance(SWTKeySupport
- .convertAcceleratorToKeyStroke(accelerator));
+ KeySequence keySequence = KeySequence
+ .getInstance(SWTKeySupport.convertAcceleratorToKeyStroke(accelerator));
TriggerSequence[] sequences = getInvokingCommandKeySequences();
if (sequences == null)
return;
@@ -344,8 +332,7 @@ public class QuickAccessDialog extends PopupDialog {
@Override
protected IDialogSettings getDialogSettings() {
- final IDialogSettings workbenchDialogSettings = WorkbenchPlugin.getDefault()
- .getDialogSettings();
+ final IDialogSettings workbenchDialogSettings = WorkbenchPlugin.getDefault().getDialogSettings();
IDialogSettings result = workbenchDialogSettings.getSection(getId());
if (result == null) {
result = workbenchDialogSettings.addNewSection(getId());
@@ -388,16 +375,13 @@ public class QuickAccessDialog extends PopupDialog {
elementMap = new HashMap<>();
textMap = new HashMap<>();
previousPicksList = new LinkedList<>();
- if (orderedElements != null && orderedProviders != null && textEntries != null
- && textArray != null) {
+ if (orderedElements != null && orderedProviders != null && textEntries != null && textArray != null) {
int arrayIndex = 0;
for (int i = 0; i < orderedElements.length; i++) {
- QuickAccessProvider quickAccessProvider = providerMap
- .get(orderedProviders[i]);
+ QuickAccessProvider quickAccessProvider = providerMap.get(orderedProviders[i]);
int numTexts = Integer.parseInt(textEntries[i]);
if (quickAccessProvider != null) {
- QuickAccessElement quickAccessElement = quickAccessProvider
- .getElementForId(orderedElements[i]);
+ QuickAccessElement quickAccessElement = quickAccessProvider.getElementForId(orderedElements[i]);
if (quickAccessElement != null) {
ArrayList<String> arrayList = new ArrayList<>();
for (int j = arrayIndex; j < arrayIndex + numTexts; j++) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/QuickAccessEntry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/QuickAccessEntry.java
index 278f30dd150..9f3d66c4c21 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/QuickAccessEntry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/QuickAccessEntry.java
@@ -51,15 +51,15 @@ public class QuickAccessEntry {
/**
* Provides a rough indicator of how good of a match this entry was to its
- * filter. Lower values indicate better match quality. A value of 0
- * indicates the filter string was an exact match to the label or that there
- * is no filter being applied.
+ * filter. Lower values indicate better match quality. A value of 0 indicates
+ * the filter string was an exact match to the label or that there is no filter
+ * being applied.
*/
private int matchQuality;
/**
- * Indicates the filter string was a perfect match to the label or there is
- * no filter applied
+ * Indicates the filter string was a perfect match to the label or there is no
+ * filter applied
*
* @see #getMatchQuality()
*/
@@ -67,17 +67,17 @@ public class QuickAccessEntry {
/**
* Indicates this entry is very relevant for the filter string. Recommended
- * value for when the filter was found at the start of the element's label
- * or a complete case sensitive camel case match.
+ * value for when the filter was found at the start of the element's label or a
+ * complete case sensitive camel case match.
*
* @see #getMatchQuality()
*/
public static final int MATCH_EXCELLENT = 5;
/**
- * Indicates this entry is relevant for the filter string. Recommended value
- * for when the complete filter was found somewhere inside the element's
- * label or provider.
+ * Indicates this entry is relevant for the filter string. Recommended value for
+ * when the complete filter was found somewhere inside the element's label or
+ * provider.
*
* @see #getMatchQuality()
*/
@@ -91,29 +91,25 @@ public class QuickAccessEntry {
public static final int MATCH_PARTIAL = 15;
/**
- * Creates a new quick access entry from the given element and provider. If
- * no filter was used to match this entry the element/provider match regions
- * may be empty and the match quality should be {@link #MATCH_PERFECT}
+ * Creates a new quick access entry from the given element and provider. If no
+ * filter was used to match this entry the element/provider match regions may be
+ * empty and the match quality should be {@link #MATCH_PERFECT}
*
- * @param element
- * the element this entry will represent
- * @param provider
- * the provider that owns this entry
- * @param elementMatchRegions
- * list of text regions the filter string matched in the element
- * label, possibly empty
- * @param providerMatchRegions
- * list of text regions the filter string matches in the provider
- * label, possible empty
- * @param matchQuality
- * a rough indication of how closely the filter matched, lower
- * values indicate a better match. It is recommended to use the
- * constants available on this class: {@link #MATCH_PERFECT},
- * {@link #MATCH_EXCELLENT}, {@link #MATCH_GOOD},
- * {@link #MATCH_PARTIAL}
+ * @param element the element this entry will represent
+ * @param provider the provider that owns this entry
+ * @param elementMatchRegions list of text regions the filter string matched in
+ * the element label, possibly empty
+ * @param providerMatchRegions list of text regions the filter string matches in
+ * the provider label, possible empty
+ * @param matchQuality a rough indication of how closely the filter
+ * matched, lower values indicate a better match. It
+ * is recommended to use the constants available on
+ * this class: {@link #MATCH_PERFECT},
+ * {@link #MATCH_EXCELLENT}, {@link #MATCH_GOOD},
+ * {@link #MATCH_PARTIAL}
*/
- public QuickAccessEntry(QuickAccessElement element, QuickAccessProvider provider,
- int[][] elementMatchRegions, int[][] providerMatchRegions, int matchQuality) {
+ public QuickAccessEntry(QuickAccessElement element, QuickAccessProvider provider, int[][] elementMatchRegions,
+ int[][] providerMatchRegions, int matchQuality) {
this.element = element;
this.provider = provider;
this.elementMatchRegions = elementMatchRegions;
@@ -122,17 +118,14 @@ public class QuickAccessEntry {
}
Image getImage(QuickAccessElement element, ResourceManager resourceManager) {
- Image image = findOrCreateImage(element.getImageDescriptor(),
- resourceManager);
+ Image image = findOrCreateImage(element.getImageDescriptor(), resourceManager);
if (image == null) {
- image = WorkbenchImages
- .getImage(IWorkbenchGraphicConstants.IMG_OBJ_ELEMENT);
+ image = WorkbenchImages.getImage(IWorkbenchGraphicConstants.IMG_OBJ_ELEMENT);
}
return image;
}
- private Image findOrCreateImage(ImageDescriptor imageDescriptor,
- ResourceManager resourceManager) {
+ private Image findOrCreateImage(ImageDescriptor imageDescriptor, ResourceManager resourceManager) {
if (imageDescriptor == null) {
return null;
}
@@ -147,8 +140,7 @@ public class QuickAccessEntry {
return image;
}
- public void measure(Event event, TextLayout textLayout,
- ResourceManager resourceManager, TextStyle boldStyle) {
+ public void measure(Event event, TextLayout textLayout, ResourceManager resourceManager, TextStyle boldStyle) {
Table table = ((TableItem) event.item).getParent();
textLayout.setFont(table.getFont());
event.width = 0;
@@ -194,8 +186,8 @@ public class QuickAccessEntry {
event.height = Math.max(event.height, rect.height + 2);
}
- public void paint(Event event, TextLayout textLayout,
- ResourceManager resourceManager, TextStyle boldStyle, Color grayColor) {
+ public void paint(Event event, TextLayout textLayout, ResourceManager resourceManager, TextStyle boldStyle,
+ Color grayColor) {
final Table table = ((TableItem) event.item).getParent();
textLayout.setFont(table.getFont());
switch (event.index) {
@@ -204,8 +196,7 @@ public class QuickAccessEntry {
textLayout.setText(provider.getName());
if (boldStyle != null) {
for (int[] matchRegion : providerMatchRegions) {
- textLayout.setStyle(boldStyle, matchRegion[0],
- matchRegion[1]);
+ textLayout.setStyle(boldStyle, matchRegion[0], matchRegion[1]);
}
}
if (grayColor != null && providerMatchRegions.length > 0 && !firstInCategory) {
@@ -213,8 +204,8 @@ public class QuickAccessEntry {
}
Rectangle availableBounds = ((TableItem) event.item).getTextBounds(event.index);
Rectangle requiredBounds = textLayout.getBounds();
- textLayout.draw(event.gc, availableBounds.x + 1, availableBounds.y
- + (availableBounds.height - requiredBounds.height) / 2);
+ textLayout.draw(event.gc, availableBounds.x + 1,
+ availableBounds.y + (availableBounds.height - requiredBounds.height) / 2);
}
break;
case 1:
@@ -224,12 +215,10 @@ public class QuickAccessEntry {
String binding = commandElement.getBinding();
if (binding != null) {
StyledString styledString = StyledCellLabelProvider.styleDecoratedString(label,
- StyledString.QUALIFIER_STYLER, new StyledString(commandElement
- .getCommand()));
+ StyledString.QUALIFIER_STYLER, new StyledString(commandElement.getCommand()));
StyleRange[] styleRanges = styledString.getStyleRanges();
for (StyleRange styleRange : styleRanges) {
- textLayout.setStyle(styleRange, styleRange.start,
- styleRange.start + styleRange.length);
+ textLayout.setStyle(styleRange, styleRange.start, styleRange.start + styleRange.length);
}
}
}
@@ -247,9 +236,8 @@ public class QuickAccessEntry {
// category separator
int startX = (maxImageSize - destWidth) / 2;
int startY = (availableBounds.height - 1 - destHeight) / 2;
- event.gc.drawImage(image, 0, 0, imageBounds.width, imageBounds.height,
- availableBounds.x + startX, availableBounds.y + startY,
- destWidth, destHeight);
+ event.gc.drawImage(image, 0, 0, imageBounds.width, imageBounds.height, availableBounds.x + startX,
+ availableBounds.y + startY, destWidth, destHeight);
textLayout.setText(label);
if (boldStyle != null) {
for (int[] matchRegion : elementMatchRegions) {
@@ -263,9 +251,9 @@ public class QuickAccessEntry {
if (lastInCategory) {
if (grayColor != null)
event.gc.setForeground(grayColor);
- Rectangle bounds = ((TableItem)event.item).getBounds(event.index);
- event.gc.drawLine(Math.max(0, bounds.x - 1), bounds.y + bounds.height - 1, bounds.x + bounds.width, bounds.y
- + bounds.height - 1);
+ Rectangle bounds = ((TableItem) event.item).getBounds(event.index);
+ event.gc.drawLine(Math.max(0, bounds.x - 1), bounds.y + bounds.height - 1, bounds.x + bounds.width,
+ bounds.y + bounds.height - 1);
}
}
@@ -280,8 +268,8 @@ public class QuickAccessEntry {
/**
* Provides a rough indicator of how good of a match this entry was to its
* filter. Lower values indicate better match quality. A value of
- * {@link #MATCH_PERFECT} indicates the filter string was an exact match to
- * the label or that there is no filter being applied.
+ * {@link #MATCH_PERFECT} indicates the filter string was an exact match to the
+ * label or that there is no filter being applied.
*
* @return Returns the match quality
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/QuickAccessExtensionManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/QuickAccessExtensionManager.java
index 2ab2ee404c7..62e0548217b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/QuickAccessExtensionManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/QuickAccessExtensionManager.java
@@ -35,17 +35,14 @@ public class QuickAccessExtensionManager {
public static Collection<QuickAccessProvider> getProviders() {
return Arrays.stream(Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_POINT_ID))
- .filter(element -> PROVIDER_TAG.equals(element.getName()))
- .map(element -> {
+ .filter(element -> PROVIDER_TAG.equals(element.getName())).map(element -> {
try {
return element.createExecutableExtension(IWorkbenchRegistryConstants.ATT_CLASS);
} catch (CoreException e) {
WorkbenchPlugin.log(e);
return null;
}
- })
- .filter(QuickAccessProvider.class::isInstance)
- .map(QuickAccessProvider.class::cast)
+ }).filter(QuickAccessProvider.class::isInstance).map(QuickAccessProvider.class::cast)
.collect(Collectors.toList());
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/QuickAccessHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/QuickAccessHandler.java
index d860c2cb579..550c1b3c6e1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/QuickAccessHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/QuickAccessHandler.java
@@ -66,10 +66,8 @@ public class QuickAccessHandler extends AbstractHandler {
/**
* Utility method to displays the original/legacy QuickAccess dialog.
*
- * @param window
- * the active workbench window
- * @param command
- * the command which invokes the open of the dialog
+ * @param window the active workbench window
+ * @param command the command which invokes the open of the dialog
*/
private static void displayQuickAccessDialog(IWorkbenchWindow window, Command command) {
PopupDialog popupDialog = new QuickAccessDialog(window, command);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/SearchField.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/SearchField.java
index 5581c024ea5..c35e6905ca3 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/SearchField.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/SearchField.java
@@ -18,6 +18,7 @@
* Patrik Suzzi <psuzzi@gmail.com> - Bug 488926, 491278, 491291, 491312, 491293, 436788, 513436
******************************************************************************/
package org.eclipse.ui.internal.quickaccess;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -102,7 +103,6 @@ import org.eclipse.ui.quickaccess.QuickAccessElement;
import org.eclipse.ui.quickaccess.QuickAccessProvider;
import org.eclipse.ui.swt.IFocusService;
-
public class SearchField {
private static final String QUICK_ACCESS_COMMAND_ID = "org.eclipse.ui.window.quickAccess"; //$NON-NLS-1$
@@ -136,7 +136,6 @@ public class SearchField {
private Control previousFocusControl;
boolean activated = false;
-
private String selectedString = ""; //$NON-NLS-1$
private AccessibleAdapter accessibleListener;
@@ -289,18 +288,16 @@ public class SearchField {
}
/*
- * By design, attempting to activate a part that is already
- * active does not change the focus. However in the case of
- * using Quick Access, focus is not in the active part, so
- * re-activating the active part results in focus being left
- * behind in the text field. If this happens then assign
- * focus to the active part explicitly.
+ * By design, attempting to activate a part that is already active does not
+ * change the focus. However in the case of using Quick Access, focus is not in
+ * the active part, so re-activating the active part results in focus being left
+ * behind in the text field. If this happens then assign focus to the active
+ * part explicitly.
*/
if (txtQuickAccess.isFocusControl()) {
MPart activePart = partService.getActivePart();
if (activePart != null) {
- IPresentationEngine pe = activePart.getContext().get(
- IPresentationEngine.class);
+ IPresentationEngine pe = activePart.getContext().get(IPresentationEngine.class);
pe.focusGui(activePart);
}
}
@@ -342,7 +339,6 @@ public class SearchField {
quickAccessContents.createInfoLabel(shell);
}
-
@Inject
@Optional
protected void keybindingPreferencesChanged(
@@ -371,7 +367,6 @@ public class SearchField {
shell.setVisible(nowVisible);
}
-
@Inject
private BindingTableManager manager;
@Inject
@@ -447,20 +442,19 @@ public class SearchField {
@Override
public EvaluationResult evaluate(IEvaluationContext context) {
- return EvaluationResult.valueOf(SearchField.class.getName().equals(
- context.getVariable(ISources.ACTIVE_FOCUS_CONTROL_ID_NAME)));
+ return EvaluationResult.valueOf(
+ SearchField.class.getName().equals(context.getVariable(ISources.ACTIVE_FOCUS_CONTROL_ID_NAME)));
}
};
IHandlerService whService = windowContext.get(IHandlerService.class);
- whService.activateHandler(IWorkbenchCommandConstants.EDIT_SELECT_ALL,
- new AbstractHandler() {
- @Override
- public Object execute(ExecutionEvent event) {
- txtQuickAccess.selectAll();
- return null;
- }
- }, focusExpr);
+ whService.activateHandler(IWorkbenchCommandConstants.EDIT_SELECT_ALL, new AbstractHandler() {
+ @Override
+ public Object execute(ExecutionEvent event) {
+ txtQuickAccess.selectAll();
+ return null;
+ }
+ }, focusExpr);
whService.activateHandler(IWorkbenchCommandConstants.EDIT_CUT, new AbstractHandler() {
@Override
public Object execute(ExecutionEvent event) {
@@ -488,8 +482,7 @@ public class SearchField {
* This method was copy/pasted from JFace.
*/
private Rectangle getConstrainedShellBounds(Display display, Rectangle preferredSize) {
- Rectangle result = new Rectangle(preferredSize.x, preferredSize.y, preferredSize.width,
- preferredSize.height);
+ Rectangle result = new Rectangle(preferredSize.x, preferredSize.y, preferredSize.width, preferredSize.height);
Point topLeft = new Point(preferredSize.x, preferredSize.y);
Monitor mon = Util.getClosestMonitor(display, topLeft);
@@ -522,12 +515,12 @@ public class SearchField {
// If size would extend past the right edge of the shell, try to move it
// to the left of the text
- if (compBounds.x + width > shellBounds.x + shellBounds.width){
+ if (compBounds.x + width > shellBounds.x + shellBounds.width) {
compBounds.x = Math.max(shellBounds.x, (compBounds.x + compBounds.width - width));
}
- shell.setBounds(getConstrainedShellBounds(display, new Rectangle(compBounds.x, compBounds.y
- + compBounds.height, width, height)));
+ shell.setBounds(getConstrainedShellBounds(display,
+ new Rectangle(compBounds.x, compBounds.y + compBounds.height, width, height)));
shell.layout();
}
@@ -548,10 +541,8 @@ public class SearchField {
/**
* Checks if the text or shell has focus. If not, closes the shell.
*
- * @param table
- * the shell's table
- * @param text
- * the search text field
+ * @param table the shell's table
+ * @param text the search text field
*/
protected void checkFocusLost(final Table table, final Text text) {
if (shell == null) {
@@ -564,18 +555,17 @@ public class SearchField {
text.setFocus();
return;
}
- if (!shell.isFocusControl() && !table.isFocusControl()
- && !text.isFocusControl()) {
+ if (!shell.isFocusControl() && !table.isFocusControl() && !text.isFocusControl()) {
quickAccessContents.doClose();
}
}
}
/**
- * Adds a listener to the
- * <code>org.eclipse.swt.accessibility.Accessible</code> object assigned to
- * the Quick Access search box. The listener sets a name of a selected
- * element in the search result list as a text to read for a screen reader.
+ * Adds a listener to the <code>org.eclipse.swt.accessibility.Accessible</code>
+ * object assigned to the Quick Access search box. The listener sets a name of a
+ * selected element in the search result list as a text to read for a screen
+ * reader.
*/
private void addAccessibleListener() {
if (accessibleListener == null) {
@@ -591,8 +581,8 @@ public class SearchField {
/**
* Removes a listener from the
- * <code>org.eclipse.swt.accessibility.Accessible</code> object assigned to
- * the Quick Access search box.
+ * <code>org.eclipse.swt.accessibility.Accessible</code> object assigned to the
+ * Quick Access search box.
*/
private void removeAccessibleListener() {
if (accessibleListener != null) {
@@ -603,16 +593,15 @@ public class SearchField {
}
/**
- * Notifies <code>org.eclipse.swt.accessibility.Accessible<code> object
- * that selected item has been changed.
+ * Notifies <code>org.eclipse.swt.accessibility.Accessible<code> object that
+ * selected item has been changed.
*/
private void notifyAccessibleTextChanged() {
if (table.getSelection().length == 0) {
return;
}
TableItem item = table.getSelection()[0];
- selectedString = NLS.bind(QuickAccessMessages.QuickAccess_SelectedString, item.getText(0),
- item.getText(1));
+ selectedString = NLS.bind(QuickAccessMessages.QuickAccess_SelectedString, item.getText(0), item.getText(1));
txtQuickAccess.getAccessible().sendEvent(ACC.EVENT_NAME_CHANGED, null);
}
@@ -676,8 +665,7 @@ public class SearchField {
}
private void restoreDialogEntries(IDialogSettings dialogSettings, boolean restoreUiElements,
- IProgressMonitor monitor)
- throws OperationCanceledException {
+ IProgressMonitor monitor) throws OperationCanceledException {
String[] orderedElements = dialogSettings.getArray(ORDERED_ELEMENTS);
String[] orderedProviders = dialogSettings.getArray(ORDERED_PROVIDERS);
String[] textEntries = dialogSettings.getArray(TEXT_ENTRIES);
@@ -756,8 +744,8 @@ public class SearchField {
}
/**
- * If the original list was not fully restored yet, it may contain null elements, so we
- * return here only already resolved, non null elements
+ * If the original list was not fully restored yet, it may contain null
+ * elements, so we return here only already resolved, non null elements
*/
private List<QuickAccessElement> getLoadedPreviousPicks() {
List<QuickAccessElement> previousPicks = previousPicksList.stream().filter(Objects::nonNull)
@@ -766,8 +754,7 @@ public class SearchField {
}
private IDialogSettings getDialogSettings() {
- final IDialogSettings workbenchDialogSettings = WorkbenchPlugin.getDefault()
- .getDialogSettings();
+ final IDialogSettings workbenchDialogSettings = WorkbenchPlugin.getDefault().getDialogSettings();
IDialogSettings result = workbenchDialogSettings.getSection(getId());
if (result == null) {
result = workbenchDialogSettings.addNewSection(getId());
@@ -841,8 +828,8 @@ public class SearchField {
}
/**
- * Returns the quick access shell for testing. Should not be referenced
- * outside of the tests.
+ * Returns the quick access shell for testing. Should not be referenced outside
+ * of the tests.
*
* @return the current quick access shell or <code>null</code>
*/
@@ -852,8 +839,8 @@ public class SearchField {
}
/**
- * Returns the quick access search text for testing. Should not be
- * referenced outside of the tests.
+ * Returns the quick access search text for testing. Should not be referenced
+ * outside of the tests.
*
* @return the search text in the workbench window or <code>null</code>
*/
@@ -862,12 +849,12 @@ public class SearchField {
}
/**
- * Returns the table in the shell for testing. Should not be referenced
- * outside of the tests.
+ * Returns the table in the shell for testing. Should not be referenced outside
+ * of the tests.
*
* @return the table created in the shell or <code>null</code>
*/
- public Table getQuickAccessTable(){
+ public Table getQuickAccessTable() {
createContentsAndTable();
return table;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/ViewElement.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/ViewElement.java
index bc159d4151e..4c14799cca2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/ViewElement.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/ViewElement.java
@@ -68,13 +68,12 @@ public class ViewElement extends QuickAccessElement {
public void execute() {
/*
* TODO: see bug 483699: the code below duplicates the code in
- * org.eclipse.ui.handlers.ShowViewHandler#openView() and should be
- * refactored to some user friendly API
+ * org.eclipse.ui.handlers.ShowViewHandler#openView() and should be refactored
+ * to some user friendly API
*/
String id = viewDescriptor.getElementId();
if (id != null) {
- if (CompatibilityPart.COMPATIBILITY_VIEW_URI
- .equals(viewDescriptor.getContributionURI())) {
+ if (CompatibilityPart.COMPATIBILITY_VIEW_URI.equals(viewDescriptor.getContributionURI())) {
IWorkbenchWindow workbenchWindow = window.getContext().get(IWorkbenchWindow.class);
IWorkbenchPage page = workbenchWindow.getActivePage();
if (page != null) {
@@ -122,8 +121,7 @@ public class ViewElement extends QuickAccessElement {
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result
- + ((viewDescriptor == null) ? 0 : viewDescriptor.hashCode());
+ result = prime * result + ((viewDescriptor == null) ? 0 : viewDescriptor.hashCode());
return result;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/ViewProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/ViewProvider.java
index 51346698f96..b44166d1ad8 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/ViewProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/ViewProvider.java
@@ -99,8 +99,7 @@ public class ViewProvider extends QuickAccessProvider {
@Override
public ImageDescriptor getImageDescriptor() {
- return WorkbenchImages
- .getImageDescriptor(IWorkbenchGraphicConstants.IMG_VIEW_DEFAULTVIEW_MISC);
+ return WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_VIEW_DEFAULTVIEW_MISC);
}
@Override
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/WizardElement.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/WizardElement.java
index 4984872fc2e..454055915c4 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/WizardElement.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/WizardElement.java
@@ -31,18 +31,16 @@ public class WizardElement extends QuickAccessElement {
private IWizardDescriptor wizardDescriptor;
- /* package */WizardElement(IWizardDescriptor wizardDescriptor, WizardProvider wizardProvider) {
+ /* package */ WizardElement(IWizardDescriptor wizardDescriptor, WizardProvider wizardProvider) {
super(wizardProvider);
this.wizardDescriptor = wizardDescriptor;
}
@Override
public void execute() {
- IWorkbenchWindow window = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow();
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window != null) {
- NewWizardShortcutAction wizardAction = new NewWizardShortcutAction(
- window, wizardDescriptor);
+ NewWizardShortcutAction wizardAction = new NewWizardShortcutAction(window, wizardDescriptor);
wizardAction.run();
}
}
@@ -59,17 +57,14 @@ public class WizardElement extends QuickAccessElement {
@Override
public String getLabel() {
- return wizardDescriptor.getLabel() + separator
- + wizardDescriptor.getDescription();
+ return wizardDescriptor.getLabel() + separator + wizardDescriptor.getDescription();
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime
- * result
- + ((wizardDescriptor == null) ? 0 : wizardDescriptor.hashCode());
+ result = prime * result + ((wizardDescriptor == null) ? 0 : wizardDescriptor.hashCode());
return result;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/WizardProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/WizardProvider.java
index 2244b0231b9..b11a089b1c1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/WizardProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/WizardProvider.java
@@ -48,20 +48,17 @@ public class WizardProvider extends QuickAccessProvider {
@Override
public QuickAccessElement[] getElements() {
if (cachedElements == null) {
- IWizardCategory rootCategory = WorkbenchPlugin.getDefault()
- .getNewWizardRegistry().getRootCategory();
+ IWizardCategory rootCategory = WorkbenchPlugin.getDefault().getNewWizardRegistry().getRootCategory();
List<IWizardDescriptor> result = new ArrayList<>();
collectWizards(rootCategory, result);
- IWizardDescriptor[] wizards = result
- .toArray(new IWizardDescriptor[result.size()]);
+ IWizardDescriptor[] wizards = result.toArray(new IWizardDescriptor[result.size()]);
for (int i = 0; i < wizards.length; i++) {
if (!WorkbenchActivityHelper.filterItem(wizards[i])) {
WizardElement wizardElement = new WizardElement(wizards[i], this);
idToElement.put(wizardElement.getId(), wizardElement);
}
}
- cachedElements = idToElement.values().toArray(
- new QuickAccessElement[idToElement.size()]);
+ cachedElements = idToElement.values().toArray(new QuickAccessElement[idToElement.size()]);
}
return cachedElements;
}
@@ -80,8 +77,7 @@ public class WizardProvider extends QuickAccessProvider {
@Override
public ImageDescriptor getImageDescriptor() {
- return WorkbenchImages
- .getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJ_NODE);
+ return WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJ_NODE);
}
@Override
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionSetDescriptor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionSetDescriptor.java
index 3260999091b..c946bf8a38b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionSetDescriptor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionSetDescriptor.java
@@ -28,203 +28,197 @@ import org.eclipse.ui.model.IWorkbenchAdapter;
/**
* ActionSetDescriptor
*/
-public class ActionSetDescriptor implements IActionSetDescriptor, IAdaptable,
- IWorkbenchAdapter, IPluginContribution {
- private static final Object[] NO_CHILDREN = new Object[0];
+public class ActionSetDescriptor implements IActionSetDescriptor, IAdaptable, IWorkbenchAdapter, IPluginContribution {
+ private static final Object[] NO_CHILDREN = new Object[0];
- private static final String INITIALLY_HIDDEN_PREF_ID_PREFIX = "actionSet.initiallyHidden."; //$NON-NLS-1$
+ private static final String INITIALLY_HIDDEN_PREF_ID_PREFIX = "actionSet.initiallyHidden."; //$NON-NLS-1$
- private String id;
+ private String id;
- private String pluginId;
+ private String pluginId;
- private String label;
+ private String label;
- private boolean visible;
+ private boolean visible;
- private String description;
+ private String description;
- private IConfigurationElement configElement;
+ private IConfigurationElement configElement;
- /**
- * Create a descriptor from a configuration element.
- *
- * @param configElement the configuration element
- * @throws CoreException thrown if there is an issue creating the descriptor
- */
- public ActionSetDescriptor(IConfigurationElement configElement)
- throws CoreException {
- super();
- this.configElement = configElement;
- id = configElement.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
- pluginId = configElement.getNamespace();
- label = configElement.getAttribute(IWorkbenchRegistryConstants.ATT_LABEL);
- description = configElement.getAttribute(IWorkbenchRegistryConstants.TAG_DESCRIPTION);
- String str = configElement.getAttribute(IWorkbenchRegistryConstants.ATT_VISIBLE);
- if (str != null && str.equals("true")) { //$NON-NLS-1$
+ /**
+ * Create a descriptor from a configuration element.
+ *
+ * @param configElement the configuration element
+ * @throws CoreException thrown if there is an issue creating the descriptor
+ */
+ public ActionSetDescriptor(IConfigurationElement configElement) throws CoreException {
+ super();
+ this.configElement = configElement;
+ id = configElement.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
+ pluginId = configElement.getNamespace();
+ label = configElement.getAttribute(IWorkbenchRegistryConstants.ATT_LABEL);
+ description = configElement.getAttribute(IWorkbenchRegistryConstants.TAG_DESCRIPTION);
+ String str = configElement.getAttribute(IWorkbenchRegistryConstants.ATT_VISIBLE);
+ if (str != null && str.equals("true")) { //$NON-NLS-1$
visible = true;
}
- // Sanity check.
- if (label == null) {
- throw new CoreException(new Status(IStatus.ERROR,
- WorkbenchPlugin.PI_WORKBENCH, 0,
- "Invalid extension (missing label): " + id,//$NON-NLS-1$
- null));
- }
- }
-
- /**
- * Returns the action set for this descriptor.
- *
- * @return the action set
- */
- @Override
+ // Sanity check.
+ if (label == null) {
+ throw new CoreException(new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 0,
+ "Invalid extension (missing label): " + id, //$NON-NLS-1$
+ null));
+ }
+ }
+
+ /**
+ * Returns the action set for this descriptor.
+ *
+ * @return the action set
+ */
+ @Override
public IActionSet createActionSet() throws CoreException {
- return new PluginActionSet(this);
- }
+ return new PluginActionSet(this);
+ }
- /**
- * Returns an object which is an instance of the given class
- * associated with this object. Returns <code>null</code> if
- * no such object can be found.
- */
+ /**
+ * Returns an object which is an instance of the given class associated with
+ * this object. Returns <code>null</code> if no such object can be found.
+ */
@Override
public <T> T getAdapter(Class<T> adapter) {
- if (adapter == IWorkbenchAdapter.class) {
+ if (adapter == IWorkbenchAdapter.class) {
return adapter.cast(this);
}
- return null;
- }
+ return null;
+ }
- /**
- * @see IWorkbenchAdapter#getChildren
- */
- @Override
+ /**
+ * @see IWorkbenchAdapter#getChildren
+ */
+ @Override
public Object[] getChildren(Object o) {
+ return NO_CHILDREN;
+ }
- return NO_CHILDREN;
- }
-
-
- @Override
+ @Override
public IConfigurationElement getConfigurationElement() {
- return configElement;
- }
-
- /**
- * Returns this action set's description.
- * This is the value of its <code>"description"</code> attribute.
- *
- * @return the description
- */
- @Override
+ return configElement;
+ }
+
+ /**
+ * Returns this action set's description. This is the value of its
+ * <code>"description"</code> attribute.
+ *
+ * @return the description
+ */
+ @Override
public String getDescription() {
- return description;
- }
-
- /**
- * Returns this action set's id.
- * This is the value of its <code>"id"</code> attribute.
- * <p>
- *
- * @return the action set id
- */
- @Override
+ return description;
+ }
+
+ /**
+ * Returns this action set's id. This is the value of its <code>"id"</code>
+ * attribute.
+ * <p>
+ *
+ * @return the action set id
+ */
+ @Override
public String getId() {
- return id;
- }
-
- /**
- * Returns this action set's label.
- * This is the value of its <code>"label"</code> attribute.
- *
- * @return the label
- */
- @Override
+ return id;
+ }
+
+ /**
+ * Returns this action set's label. This is the value of its
+ * <code>"label"</code> attribute.
+ *
+ * @return the label
+ */
+ @Override
public String getLabel() {
- return label;
- }
+ return label;
+ }
- /**
- * @see IWorkbenchAdapter#getLabel
- */
- @Override
+ /**
+ * @see IWorkbenchAdapter#getLabel
+ */
+ @Override
public String getLabel(Object o) {
- if (o == this) {
+ if (o == this) {
return getLabel();
}
- return "Unknown Label";//$NON-NLS-1$
- }
+ return "Unknown Label";//$NON-NLS-1$
+ }
- /**
- * Returns whether this action set is initially visible.
- */
- @Override
+ /**
+ * Returns whether this action set is initially visible.
+ */
+ @Override
public boolean isInitiallyVisible() {
- if (id == null) {
+ if (id == null) {
return visible;
}
- Preferences prefs = WorkbenchPlugin.getDefault().getPluginPreferences();
- String prefId = INITIALLY_HIDDEN_PREF_ID_PREFIX + getId();
- if (prefs.getBoolean(prefId)) {
+ Preferences prefs = WorkbenchPlugin.getDefault().getPluginPreferences();
+ String prefId = INITIALLY_HIDDEN_PREF_ID_PREFIX + getId();
+ if (prefs.getBoolean(prefId)) {
return false;
}
- return visible;
- }
-
- /**
- * Sets whether this action set is initially visible.
- * If the action set identifier is undefined, then this is ignored.
- *
- * @since 3.0
- */
- @Override
+ return visible;
+ }
+
+ /**
+ * Sets whether this action set is initially visible. If the action set
+ * identifier is undefined, then this is ignored.
+ *
+ * @since 3.0
+ */
+ @Override
public void setInitiallyVisible(boolean newValue) {
- if (id == null) {
+ if (id == null) {
return;
}
- Preferences prefs = WorkbenchPlugin.getDefault().getPluginPreferences();
- String prefId = INITIALLY_HIDDEN_PREF_ID_PREFIX + getId();
- prefs.setValue(prefId, !newValue);
- }
+ Preferences prefs = WorkbenchPlugin.getDefault().getPluginPreferences();
+ String prefId = INITIALLY_HIDDEN_PREF_ID_PREFIX + getId();
+ prefs.setValue(prefId, !newValue);
+ }
- @Override
+ @Override
public ImageDescriptor getImageDescriptor(Object object) {
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public Object getParent(Object o) {
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public String getLocalId() {
- return id;
- }
+ return id;
+ }
- @Override
+ @Override
public String getPluginId() {
- return pluginId;
- }
+ return pluginId;
+ }
- @Override
+ @Override
public boolean equals(Object arg0) {
- if (!(arg0 instanceof ActionSetDescriptor)) {
- return false;
- }
+ if (!(arg0 instanceof ActionSetDescriptor)) {
+ return false;
+ }
- ActionSetDescriptor descr = (ActionSetDescriptor) arg0;
+ ActionSetDescriptor descr = (ActionSetDescriptor) arg0;
- return id.equals(descr.id) && descr.pluginId.equals(pluginId);
- }
+ return id.equals(descr.id) && descr.pluginId.equals(pluginId);
+ }
- @Override
+ @Override
public int hashCode() {
- return id.hashCode() + pluginId.hashCode();
- }
+ return id.hashCode() + pluginId.hashCode();
+ }
@Override
public String toString() {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionSetRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionSetRegistry.java
index b061690c395..ab66ae56a22 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionSetRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionSetRegistry.java
@@ -36,83 +36,74 @@ import org.eclipse.ui.internal.WorkbenchPlugin;
*/
public class ActionSetRegistry implements IExtensionChangeHandler {
- /**
- * @since 3.1
- */
+ /**
+ * @since 3.1
+ */
private static class ActionSetPartAssociation {
- /**
- * @param partId
- * @param actionSetId
- */
- public ActionSetPartAssociation(String partId, String actionSetId) {
- this.partId = partId;
- this.actionSetId = actionSetId;
- }
-
+ /**
+ * @param partId
+ * @param actionSetId
+ */
+ public ActionSetPartAssociation(String partId, String actionSetId) {
+ this.partId = partId;
+ this.actionSetId = actionSetId;
+ }
- String partId;
- String actionSetId;
- }
+ String partId;
+ String actionSetId;
+ }
- private ArrayList children = new ArrayList();
+ private ArrayList children = new ArrayList();
- private Map mapPartToActionSetIds = new HashMap();
+ private Map mapPartToActionSetIds = new HashMap();
- private Map mapPartToActionSets = new HashMap();
+ private Map mapPartToActionSets = new HashMap();
private IContextService contextService;
- /**
- * Creates the action set registry.
- */
- public ActionSetRegistry() {
- contextService = PlatformUI
- .getWorkbench().getService(IContextService.class);
- PlatformUI.getWorkbench().getExtensionTracker().registerHandler(
- this,
- ExtensionTracker
- .createExtensionPointFilter(new IExtensionPoint[] {
- getActionSetExtensionPoint(),
- getActionSetPartAssociationExtensionPoint() }));
- readFromRegistry();
- }
-
- /**
- * Return the action set part association extension point.
- *
- * @return the action set part association extension point
- * @since 3.1
- */
- private IExtensionPoint getActionSetPartAssociationExtensionPoint() {
- return Platform
- .getExtensionRegistry().getExtensionPoint(
- PlatformUI.PLUGIN_ID,
- IWorkbenchRegistryConstants.PL_ACTION_SET_PART_ASSOCIATIONS);
- }
-
- /**
- * Return the action set extension point.
- *
- * @return the action set extension point
- * @since 3.1
- */
- private IExtensionPoint getActionSetExtensionPoint() {
- return Platform
- .getExtensionRegistry().getExtensionPoint(
- PlatformUI.PLUGIN_ID,
- IWorkbenchRegistryConstants.PL_ACTION_SETS);
- }
-
- /**
- * Adds an action set.
- * @param desc
- */
- private void addActionSet(ActionSetDescriptor desc) {
+ /**
+ * Creates the action set registry.
+ */
+ public ActionSetRegistry() {
+ contextService = PlatformUI.getWorkbench().getService(IContextService.class);
+ PlatformUI.getWorkbench().getExtensionTracker().registerHandler(this,
+ ExtensionTracker.createExtensionPointFilter(new IExtensionPoint[] { getActionSetExtensionPoint(),
+ getActionSetPartAssociationExtensionPoint() }));
+ readFromRegistry();
+ }
+
+ /**
+ * Return the action set part association extension point.
+ *
+ * @return the action set part association extension point
+ * @since 3.1
+ */
+ private IExtensionPoint getActionSetPartAssociationExtensionPoint() {
+ return Platform.getExtensionRegistry().getExtensionPoint(PlatformUI.PLUGIN_ID,
+ IWorkbenchRegistryConstants.PL_ACTION_SET_PART_ASSOCIATIONS);
+ }
+
+ /**
+ * Return the action set extension point.
+ *
+ * @return the action set extension point
+ * @since 3.1
+ */
+ private IExtensionPoint getActionSetExtensionPoint() {
+ return Platform.getExtensionRegistry().getExtensionPoint(PlatformUI.PLUGIN_ID,
+ IWorkbenchRegistryConstants.PL_ACTION_SETS);
+ }
+
+ /**
+ * Adds an action set.
+ *
+ * @param desc
+ */
+ private void addActionSet(ActionSetDescriptor desc) {
children.add(desc);
Context actionSetContext = contextService.getContext(desc.getId());
if (!actionSetContext.isDefined()) {
- actionSetContext.define(desc.getLabel(), desc.getDescription(),
- "org.eclipse.ui.contexts.actionSet"); //$NON-NLS-1$
+ actionSetContext.define(desc.getLabel(), desc.getDescription(), "org.eclipse.ui.contexts.actionSet"); //$NON-NLS-1$
}
}
@@ -130,228 +121,221 @@ public class ActionSetRegistry implements IExtensionChangeHandler {
}
/**
- * Adds an association between an action set an a part.
- */
- private Object addAssociation(String actionSetId, String partId) {
- // get the action set ids for this part
- ArrayList actionSets = (ArrayList) mapPartToActionSetIds.get(partId);
- if (actionSets == null) {
- actionSets = new ArrayList();
- mapPartToActionSetIds.put(partId, actionSets);
- }
- actionSets.add(actionSetId);
-
- ActionSetPartAssociation association = new ActionSetPartAssociation(partId, actionSetId);
- return association;
- }
-
- /**
- * Finds and returns the registered action set with the given id.
- *
- * @param id the action set id
- * @return the action set, or <code>null</code> if none
- * @see IActionSetDescriptor#getId
- */
- public IActionSetDescriptor findActionSet(String id) {
- Iterator i = children.iterator();
- while (i.hasNext()) {
- IActionSetDescriptor desc = (IActionSetDescriptor) i.next();
- if (desc.getId().equals(id)) {
+ * Adds an association between an action set an a part.
+ */
+ private Object addAssociation(String actionSetId, String partId) {
+ // get the action set ids for this part
+ ArrayList actionSets = (ArrayList) mapPartToActionSetIds.get(partId);
+ if (actionSets == null) {
+ actionSets = new ArrayList();
+ mapPartToActionSetIds.put(partId, actionSets);
+ }
+ actionSets.add(actionSetId);
+
+ ActionSetPartAssociation association = new ActionSetPartAssociation(partId, actionSetId);
+ return association;
+ }
+
+ /**
+ * Finds and returns the registered action set with the given id.
+ *
+ * @param id the action set id
+ * @return the action set, or <code>null</code> if none
+ * @see IActionSetDescriptor#getId
+ */
+ public IActionSetDescriptor findActionSet(String id) {
+ Iterator i = children.iterator();
+ while (i.hasNext()) {
+ IActionSetDescriptor desc = (IActionSetDescriptor) i.next();
+ if (desc.getId().equals(id)) {
return desc;
}
- }
- return null;
- }
-
- /**
- * Returns a list of the action sets known to the workbench.
- *
- * @return a list of action sets
- */
- public IActionSetDescriptor[] getActionSets() {
- return (IActionSetDescriptor []) children.toArray(new IActionSetDescriptor [children.size()]);
- }
-
- /**
- * Returns a list of the action sets associated with the given part id.
- *
- * @param partId the part id
- * @return a list of action sets
- */
- public IActionSetDescriptor[] getActionSetsFor(String partId) {
- // check the resolved map first
- ArrayList actionSets = (ArrayList) mapPartToActionSets.get(partId);
- if (actionSets != null) {
- return (IActionSetDescriptor[]) actionSets
- .toArray(new IActionSetDescriptor[actionSets.size()]);
- }
-
- // get the action set ids for this part
- ArrayList actionSetIds = (ArrayList) mapPartToActionSetIds.get(partId);
- if (actionSetIds == null) {
+ }
+ return null;
+ }
+
+ /**
+ * Returns a list of the action sets known to the workbench.
+ *
+ * @return a list of action sets
+ */
+ public IActionSetDescriptor[] getActionSets() {
+ return (IActionSetDescriptor[]) children.toArray(new IActionSetDescriptor[children.size()]);
+ }
+
+ /**
+ * Returns a list of the action sets associated with the given part id.
+ *
+ * @param partId the part id
+ * @return a list of action sets
+ */
+ public IActionSetDescriptor[] getActionSetsFor(String partId) {
+ // check the resolved map first
+ ArrayList actionSets = (ArrayList) mapPartToActionSets.get(partId);
+ if (actionSets != null) {
+ return (IActionSetDescriptor[]) actionSets.toArray(new IActionSetDescriptor[actionSets.size()]);
+ }
+
+ // get the action set ids for this part
+ ArrayList actionSetIds = (ArrayList) mapPartToActionSetIds.get(partId);
+ if (actionSetIds == null) {
return new IActionSetDescriptor[0];
}
- // resolve to action sets
- actionSets = new ArrayList(actionSetIds.size());
- for (Iterator i = actionSetIds.iterator(); i.hasNext();) {
- String actionSetId = (String) i.next();
- IActionSetDescriptor actionSet = findActionSet(actionSetId);
- if (actionSet != null) {
+ // resolve to action sets
+ actionSets = new ArrayList(actionSetIds.size());
+ for (Iterator i = actionSetIds.iterator(); i.hasNext();) {
+ String actionSetId = (String) i.next();
+ IActionSetDescriptor actionSet = findActionSet(actionSetId);
+ if (actionSet != null) {
actionSets.add(actionSet);
} else {
- WorkbenchPlugin.log("Unable to associate action set with part: " + //$NON-NLS-1$
- partId + ". Action set " + actionSetId + " not found."); //$NON-NLS-2$ //$NON-NLS-1$
- }
- }
+ WorkbenchPlugin.log("Unable to associate action set with part: " + //$NON-NLS-1$
+ partId + ". Action set " + actionSetId + " not found."); //$NON-NLS-2$ //$NON-NLS-1$
+ }
+ }
- mapPartToActionSets.put(partId, actionSets);
+ mapPartToActionSets.put(partId, actionSets);
- return (IActionSetDescriptor[]) actionSets
- .toArray(new IActionSetDescriptor[actionSets.size()]);
- }
+ return (IActionSetDescriptor[]) actionSets.toArray(new IActionSetDescriptor[actionSets.size()]);
+ }
- /**
- * Reads the registry.
- */
- private void readFromRegistry() {
+ /**
+ * Reads the registry.
+ */
+ private void readFromRegistry() {
for (IExtension extension : getActionSetExtensionPoint().getExtensions()) {
addActionSets(PlatformUI.getWorkbench().getExtensionTracker(), extension);
- }
+ }
for (IExtension extension : getActionSetPartAssociationExtensionPoint().getExtensions()) {
addActionSetPartAssociations(PlatformUI.getWorkbench().getExtensionTracker(), extension);
- }
- }
+ }
+ }
- @Override
+ @Override
public void addExtension(IExtensionTracker tracker, IExtension extension) {
- String extensionPointUniqueIdentifier = extension.getExtensionPointUniqueIdentifier();
- if (extensionPointUniqueIdentifier.equals(getActionSetExtensionPoint().getUniqueIdentifier())) {
- addActionSets(tracker, extension);
- }
- else if (extensionPointUniqueIdentifier.equals(getActionSetPartAssociationExtensionPoint().getUniqueIdentifier())){
- addActionSetPartAssociations(tracker, extension);
- }
- }
-
- /**
- * @param tracker
- * @param extension
- */
- private void addActionSetPartAssociations(IExtensionTracker tracker, IExtension extension) {
+ String extensionPointUniqueIdentifier = extension.getExtensionPointUniqueIdentifier();
+ if (extensionPointUniqueIdentifier.equals(getActionSetExtensionPoint().getUniqueIdentifier())) {
+ addActionSets(tracker, extension);
+ } else if (extensionPointUniqueIdentifier
+ .equals(getActionSetPartAssociationExtensionPoint().getUniqueIdentifier())) {
+ addActionSetPartAssociations(tracker, extension);
+ }
+ }
+
+ /**
+ * @param tracker
+ * @param extension
+ */
+ private void addActionSetPartAssociations(IExtensionTracker tracker, IExtension extension) {
for (IConfigurationElement element : extension.getConfigurationElements()) {
- if (element.getName().equals(IWorkbenchRegistryConstants.TAG_ACTION_SET_PART_ASSOCIATION)) {
- String actionSetId = element.getAttribute(IWorkbenchRegistryConstants.ATT_TARGET_ID);
+ if (element.getName().equals(IWorkbenchRegistryConstants.TAG_ACTION_SET_PART_ASSOCIATION)) {
+ String actionSetId = element.getAttribute(IWorkbenchRegistryConstants.ATT_TARGET_ID);
for (IConfigurationElement child : element.getChildren()) {
- if (child.getName().equals(IWorkbenchRegistryConstants.TAG_PART)) {
- String partId = child.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
- if (partId != null) {
- Object trackingObject = addAssociation(actionSetId, partId);
- if (trackingObject != null) {
- tracker.registerObject(extension,
- trackingObject,
- IExtensionTracker.REF_STRONG);
-
- }
-
- }
- } else {
- WorkbenchPlugin.log("Unable to process element: " + //$NON-NLS-1$
- child.getName() + " in action set part associations extension: " + //$NON-NLS-1$
- extension.getUniqueIdentifier());
- }
- }
- }
- }
-
- // TODO: optimize
- mapPartToActionSets.clear();
- }
-
- /**
- * @param tracker
- * @param extension
- */
- private void addActionSets(IExtensionTracker tracker, IExtension extension) {
+ if (child.getName().equals(IWorkbenchRegistryConstants.TAG_PART)) {
+ String partId = child.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
+ if (partId != null) {
+ Object trackingObject = addAssociation(actionSetId, partId);
+ if (trackingObject != null) {
+ tracker.registerObject(extension, trackingObject, IExtensionTracker.REF_STRONG);
+
+ }
+
+ }
+ } else {
+ WorkbenchPlugin.log("Unable to process element: " + //$NON-NLS-1$
+ child.getName() + " in action set part associations extension: " + //$NON-NLS-1$
+ extension.getUniqueIdentifier());
+ }
+ }
+ }
+ }
+
+ // TODO: optimize
+ mapPartToActionSets.clear();
+ }
+
+ /**
+ * @param tracker
+ * @param extension
+ */
+ private void addActionSets(IExtensionTracker tracker, IExtension extension) {
for (IConfigurationElement element : extension.getConfigurationElements()) {
- if (element.getName().equals(IWorkbenchRegistryConstants.TAG_ACTION_SET)) {
- try {
- ActionSetDescriptor desc = new ActionSetDescriptor(element);
- addActionSet(desc);
- tracker.registerObject(extension, desc, IExtensionTracker.REF_WEAK);
-
- } catch (CoreException e) {
- // log an error since its not safe to open a dialog here
- WorkbenchPlugin
- .log(
- "Unable to create action set descriptor.", e.getStatus());//$NON-NLS-1$
- }
- }
- }
-
- // TODO: optimize
- mapPartToActionSets.clear();
- }
-
- @Override
+ if (element.getName().equals(IWorkbenchRegistryConstants.TAG_ACTION_SET)) {
+ try {
+ ActionSetDescriptor desc = new ActionSetDescriptor(element);
+ addActionSet(desc);
+ tracker.registerObject(extension, desc, IExtensionTracker.REF_WEAK);
+
+ } catch (CoreException e) {
+ // log an error since its not safe to open a dialog here
+ WorkbenchPlugin.log("Unable to create action set descriptor.", e.getStatus());//$NON-NLS-1$
+ }
+ }
+ }
+
+ // TODO: optimize
+ mapPartToActionSets.clear();
+ }
+
+ @Override
public void removeExtension(IExtension extension, Object[] objects) {
- String extensionPointUniqueIdentifier = extension.getExtensionPointUniqueIdentifier();
- if (extensionPointUniqueIdentifier.equals(getActionSetExtensionPoint().getUniqueIdentifier())) {
- removeActionSets(objects);
- }
- else if (extensionPointUniqueIdentifier.equals(getActionSetPartAssociationExtensionPoint().getUniqueIdentifier())){
- removeActionSetPartAssociations(objects);
- }
- }
-
- /**
- * @param objects
- */
- private void removeActionSetPartAssociations(Object[] objects) {
- for (Object object : objects) {
- if (object instanceof ActionSetPartAssociation) {
- ActionSetPartAssociation association = (ActionSetPartAssociation) object;
- String actionSetId = association.actionSetId;
- ArrayList actionSets = (ArrayList) mapPartToActionSetIds.get(association.partId);
- if (actionSets == null) {
+ String extensionPointUniqueIdentifier = extension.getExtensionPointUniqueIdentifier();
+ if (extensionPointUniqueIdentifier.equals(getActionSetExtensionPoint().getUniqueIdentifier())) {
+ removeActionSets(objects);
+ } else if (extensionPointUniqueIdentifier
+ .equals(getActionSetPartAssociationExtensionPoint().getUniqueIdentifier())) {
+ removeActionSetPartAssociations(objects);
+ }
+ }
+
+ /**
+ * @param objects
+ */
+ private void removeActionSetPartAssociations(Object[] objects) {
+ for (Object object : objects) {
+ if (object instanceof ActionSetPartAssociation) {
+ ActionSetPartAssociation association = (ActionSetPartAssociation) object;
+ String actionSetId = association.actionSetId;
+ ArrayList actionSets = (ArrayList) mapPartToActionSetIds.get(association.partId);
+ if (actionSets == null) {
return;
}
- actionSets.remove(actionSetId);
- if (actionSets.isEmpty()) {
+ actionSets.remove(actionSetId);
+ if (actionSets.isEmpty()) {
mapPartToActionSetIds.remove(association.partId);
}
- }
- }
- // TODO: optimize
- mapPartToActionSets.clear();
-
- }
-
- /**
- * @param objects
- */
- private void removeActionSets(Object[] objects) {
- for (Object object : objects) {
- if (object instanceof IActionSetDescriptor) {
- IActionSetDescriptor desc = (IActionSetDescriptor) object;
- removeActionSet(desc);
-
- // now clean up the part associations
- // TODO: this is expensive. We should consider another map from
- // actionsets
- // to parts.
- for (Iterator j = mapPartToActionSetIds.values().iterator(); j
- .hasNext();) {
- ArrayList list = (ArrayList) j.next();
- list.remove(desc.getId());
- if (list.isEmpty()) {
+ }
+ }
+ // TODO: optimize
+ mapPartToActionSets.clear();
+
+ }
+
+ /**
+ * @param objects
+ */
+ private void removeActionSets(Object[] objects) {
+ for (Object object : objects) {
+ if (object instanceof IActionSetDescriptor) {
+ IActionSetDescriptor desc = (IActionSetDescriptor) object;
+ removeActionSet(desc);
+
+ // now clean up the part associations
+ // TODO: this is expensive. We should consider another map from
+ // actionsets
+ // to parts.
+ for (Iterator j = mapPartToActionSetIds.values().iterator(); j.hasNext();) {
+ ArrayList list = (ArrayList) j.next();
+ list.remove(desc.getId());
+ if (list.isEmpty()) {
j.remove();
}
- }
- }
- }
- // TODO: optimize
- mapPartToActionSets.clear();
- }
+ }
+ }
+ }
+ // TODO: optimize
+ mapPartToActionSets.clear();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/CategorizedPageRegistryReader.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/CategorizedPageRegistryReader.java
index b548cff83be..94021e77916 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/CategorizedPageRegistryReader.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/CategorizedPageRegistryReader.java
@@ -24,8 +24,8 @@ import org.eclipse.ui.internal.WorkbenchPlugin;
import org.eclipse.ui.internal.misc.StatusUtil;
/**
- * The CategorizedPageRegistryReader is the abstract super class
- * of registry readers for page that have categorization.
+ * The CategorizedPageRegistryReader is the abstract super class of registry
+ * readers for page that have categorization.
*/
public abstract class CategorizedPageRegistryReader extends RegistryReader {
@@ -36,8 +36,8 @@ public abstract class CategorizedPageRegistryReader extends RegistryReader {
List topLevelNodes;
/**
- * Internal class used to sort all the preference page nodes
- * based on the category.
+ * Internal class used to sort all the preference page nodes based on the
+ * category.
*/
abstract class CategoryNode {
/**
@@ -45,7 +45,7 @@ public abstract class CategorizedPageRegistryReader extends RegistryReader {
*/
private final CategorizedPageRegistryReader reader;
- //private WorkbenchPreferenceNode node;
+ // private WorkbenchPreferenceNode node;
private String flatCategory;
@@ -71,13 +71,14 @@ public abstract class CategorizedPageRegistryReader extends RegistryReader {
/**
* Get the label text for this node.
+ *
* @return String
*/
abstract String getLabelText();
/*
- * Initialize the flat category to include the parents'
- * category names and the current node's label
+ * Initialize the flat category to include the parents' category names and the
+ * current node's label
*/
private void initialize() {
String category = reader.getCategory(getNode());
@@ -109,6 +110,7 @@ public abstract class CategorizedPageRegistryReader extends RegistryReader {
/**
* Return the label text for the passed element.
+ *
* @param element
* @return String
*/
@@ -116,6 +118,7 @@ public abstract class CategorizedPageRegistryReader extends RegistryReader {
/**
* Get the node the receiver represents.
+ *
* @return Object
*/
abstract Object getNode();
@@ -133,18 +136,17 @@ public abstract class CategorizedPageRegistryReader extends RegistryReader {
*/
void processNodes() {
topLevelNodes = new ArrayList();
- //root nodes (which contain subnodes)
+ // root nodes (which contain subnodes)
- //Add root nodes to the contributions vector
+ // Add root nodes to the contributions vector
StringTokenizer tokenizer;
String currentToken;
-
CategoryNode[] nodes = createCategoryNodes(getNodes());
// flag to indicate that some work was done in the inner loop over the nodes
boolean workDone;
do {
- //reset the flag
+ // reset the flag
workDone = false;
List deferred = new ArrayList();
for (CategoryNode categoryNode : nodes) {
@@ -174,7 +176,7 @@ public abstract class CategorizedPageRegistryReader extends RegistryReader {
parent = child;
}
if (parent != null) {
- //we've done some work - the number of nodes to process has decreased
+ // we've done some work - the number of nodes to process has decreased
workDone = true;
add(parent, node);
} else {
@@ -183,15 +185,13 @@ public abstract class CategorizedPageRegistryReader extends RegistryReader {
}
}
// reset the nodes to all that have yet to find their proper parent
- nodes = (CategoryNode[]) deferred.toArray(new CategoryNode[deferred
- .size()]);
+ nodes = (CategoryNode[]) deferred.toArray(new CategoryNode[deferred.size()]);
} while (nodes.length > 0 && workDone); // loop while we still have nodes to work on and the list is shrinking
// log anything left over.
for (CategoryNode categoryNode : nodes) {
// Could not find the parent - log
- WorkbenchPlugin.log(StatusUtil.newStatus(IStatus.WARNING,
- invalidCategoryNodeMessage(categoryNode), null));
+ WorkbenchPlugin.log(StatusUtil.newStatus(IStatus.WARNING, invalidCategoryNodeMessage(categoryNode), null));
topLevelNodes.add(categoryNode.getNode());
}
}
@@ -199,8 +199,7 @@ public abstract class CategorizedPageRegistryReader extends RegistryReader {
/**
* Return a warning message for an invalid category path.
*
- * @param categoryNode
- * the unknown category node
+ * @param categoryNode the unknown category node
* @return an english string suitable for logging
*/
protected abstract String invalidCategoryNodeMessage(CategoryNode categoryNode);
@@ -216,6 +215,7 @@ public abstract class CategorizedPageRegistryReader extends RegistryReader {
/**
* Add the node to the parent.
+ *
* @param parent
* @param node
*/
@@ -223,18 +223,19 @@ public abstract class CategorizedPageRegistryReader extends RegistryReader {
/**
* Get the nodes for the receiver.
+ *
* @return Collection of Object
*/
abstract Collection getNodes();
/**
- * Sort the nodes based on full category + name. Category used for sorting
- * is created by substituting node IDs with labels of the referenced
- * nodes. workbench node is excluded from sorting because it always
- * appears first in the dialog.
+ * Sort the nodes based on full category + name. Category used for sorting is
+ * created by substituting node IDs with labels of the referenced nodes.
+ * workbench node is excluded from sorting because it always appears first in
+ * the dialog.
*/
CategoryNode[] createCategoryNodes(Collection nodesToCategorize) {
- //sort by categories
+ // sort by categories
List nodes = new ArrayList();
Iterator nodesIterator = nodesToCategorize.iterator();
@@ -246,8 +247,8 @@ public abstract class CategorizedPageRegistryReader extends RegistryReader {
}
/**
- * Create a node for categorization from the reader
- * and the supplied object.
+ * Create a node for categorization from the reader and the supplied object.
+ *
* @param reader
* @param object
* @return CategoryNode
@@ -256,15 +257,15 @@ public abstract class CategorizedPageRegistryReader extends RegistryReader {
/**
* Searches for the top-level node with the given id.
+ *
* @param id
- * @return Object of the type being categorized or
- * <code>null</code>
+ * @return Object of the type being categorized or <code>null</code>
*/
abstract Object findNode(String id);
/**
- * Find the node with the given parent with the id
- * of currentToken.
+ * Find the node with the given parent with the id of currentToken.
+ *
* @param parent
* @param currentToken
* @return
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/Category.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/Category.java
index 9fe68d362f3..b9785dbe9a6 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/Category.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/Category.java
@@ -26,233 +26,228 @@ import org.eclipse.ui.internal.WorkbenchMessages;
import org.eclipse.ui.model.IWorkbenchAdapter;
/**
- * Category provides for hierarchical grouping of elements
- * registered in the registry. One extension normally defines
- * a category, and other reference it via its ID.
+ * Category provides for hierarchical grouping of elements registered in the
+ * registry. One extension normally defines a category, and other reference it
+ * via its ID.
* <p>
- * A category may specify its parent category in order to
- * achieve hierarchy.
+ * A category may specify its parent category in order to achieve hierarchy.
* </p>
*/
public class Category implements IWorkbenchAdapter, IPluginContribution, IAdaptable {
- /**
- * Name of the miscellaneous category
- */
- public static final String MISC_NAME = WorkbenchMessages.ICategory_other;
+ /**
+ * Name of the miscellaneous category
+ */
+ public static final String MISC_NAME = WorkbenchMessages.ICategory_other;
- /**
- * Identifier of the miscellaneous category
- */
- public static final String MISC_ID = "org.eclipse.ui.internal.otherCategory"; //$NON-NLS-1$
+ /**
+ * Identifier of the miscellaneous category
+ */
+ public static final String MISC_ID = "org.eclipse.ui.internal.otherCategory"; //$NON-NLS-1$
- private String id;
+ private String id;
- private String name;
+ private String name;
- private String[] parentPath;
+ private String[] parentPath;
- private ArrayList elements;
+ private ArrayList elements;
- private IConfigurationElement configurationElement;
+ private IConfigurationElement configurationElement;
private String pluginId;
- /**
- * Creates an instance of <code>Category</code> as a
- * miscellaneous category.
- */
- public Category() {
- this.id = MISC_ID;
- this.name = MISC_NAME;
- this.pluginId = MISC_ID; // TODO: remove hack for bug 55172
- }
-
- /**
- * Creates an instance of <code>Category</code> with
- * an ID and label.
- *
- * @param id the unique identifier for the category
- * @param label the presentation label for this category
- */
- public Category(String id, String label) {
- this.id = id;
- this.name = label;
- }
-
- /**
- * Creates an instance of <code>Category</code> using the
- * information from the specified configuration element.
- *
- * @param configElement the <code>IConfigurationElement<code> containing
- * the ID, label, and optional parent category path.
- * @throws WorkbenchException if the ID or label is <code>null</code
- */
- public Category(IConfigurationElement configElement)
- throws WorkbenchException {
- id = configElement.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
-
- configurationElement = configElement;
- if (id == null || getLabel() == null) {
+ /**
+ * Creates an instance of <code>Category</code> as a miscellaneous category.
+ */
+ public Category() {
+ this.id = MISC_ID;
+ this.name = MISC_NAME;
+ this.pluginId = MISC_ID; // TODO: remove hack for bug 55172
+ }
+
+ /**
+ * Creates an instance of <code>Category</code> with an ID and label.
+ *
+ * @param id the unique identifier for the category
+ * @param label the presentation label for this category
+ */
+ public Category(String id, String label) {
+ this.id = id;
+ this.name = label;
+ }
+
+ /**
+ * Creates an instance of <code>Category</code> using the information from the
+ * specified configuration element.
+ *
+ * @param configElement the <code>IConfigurationElement<code> containing the ID,
+ * label, and optional parent category path.
+ * @throws WorkbenchException if the ID or label is <code>null</code
+ */
+ public Category(IConfigurationElement configElement) throws WorkbenchException {
+ id = configElement.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
+
+ configurationElement = configElement;
+ if (id == null || getLabel() == null) {
throw new WorkbenchException("Invalid category: " + id); //$NON-NLS-1$
}
- }
-
+ }
- /**
- * Add an element to this category.
- *
- * @param element the element to add
- */
- public void addElement(Object element) {
- if (elements == null) {
+ /**
+ * Add an element to this category.
+ *
+ * @param element the element to add
+ */
+ public void addElement(Object element) {
+ if (elements == null) {
elements = new ArrayList(5);
}
- elements.add(element);
- }
+ elements.add(element);
+ }
@Override
public <T> T getAdapter(Class<T> adapter) {
- if (adapter == IWorkbenchAdapter.class) {
+ if (adapter == IWorkbenchAdapter.class) {
return adapter.cast(this);
} else if (adapter == IConfigurationElement.class) {
return adapter.cast(configurationElement);
} else {
return null;
}
- }
+ }
- @Override
+ @Override
public Object[] getChildren(Object o) {
- return getElements().toArray();
- }
+ return getElements().toArray();
+ }
- @Override
+ @Override
public ImageDescriptor getImageDescriptor(Object object) {
- return WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER);
- }
+ return WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER);
+ }
- @Override
+ @Override
public String getLabel(Object o) {
- return getLabel();
- }
-
- /**
- * Return the id for this category.
- * @return the id
- */
- public String getId() {
- return id;
- }
-
- /**
- * Return the label for this category.
- *
- * @return the label
- */
- public String getLabel() {
- return configurationElement == null ? name : configurationElement
- .getAttribute(IWorkbenchRegistryConstants.ATT_NAME);
- }
-
- /**
- * Return the parent path for this category.
- *
- * @return the parent path
- */
- public String[] getParentPath() {
- if (parentPath != null) {
+ return getLabel();
+ }
+
+ /**
+ * Return the id for this category.
+ *
+ * @return the id
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Return the label for this category.
+ *
+ * @return the label
+ */
+ public String getLabel() {
+ return configurationElement == null ? name
+ : configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_NAME);
+ }
+
+ /**
+ * Return the parent path for this category.
+ *
+ * @return the parent path
+ */
+ public String[] getParentPath() {
+ if (parentPath != null) {
return parentPath;
}
- String unparsedPath = getRawParentPath();
- if (unparsedPath != null) {
- StringTokenizer stok = new StringTokenizer(unparsedPath, "/"); //$NON-NLS-1$
- parentPath = new String[stok.countTokens()];
- for (int i = 0; stok.hasMoreTokens(); i++) {
- parentPath[i] = stok.nextToken();
- }
- }
-
- return parentPath;
- }
-
- /**
- * Return the unparsed parent path. May be <code>null</code>.
- *
- * @return the unparsed parent path or <code>null</code>
- */
- public String getRawParentPath() {
- return configurationElement == null ? null
- : configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_PARENT_CATEGORY);
- }
-
- /**
- * Return the root path for this category.
- *
- * @return the root path
- */
- public String getRootPath() {
- String[] path = getParentPath();
- if (path != null && path.length > 0) {
+ String unparsedPath = getRawParentPath();
+ if (unparsedPath != null) {
+ StringTokenizer stok = new StringTokenizer(unparsedPath, "/"); //$NON-NLS-1$
+ parentPath = new String[stok.countTokens()];
+ for (int i = 0; stok.hasMoreTokens(); i++) {
+ parentPath[i] = stok.nextToken();
+ }
+ }
+
+ return parentPath;
+ }
+
+ /**
+ * Return the unparsed parent path. May be <code>null</code>.
+ *
+ * @return the unparsed parent path or <code>null</code>
+ */
+ public String getRawParentPath() {
+ return configurationElement == null ? null
+ : configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_PARENT_CATEGORY);
+ }
+
+ /**
+ * Return the root path for this category.
+ *
+ * @return the root path
+ */
+ public String getRootPath() {
+ String[] path = getParentPath();
+ if (path != null && path.length > 0) {
return path[0];
}
- return id;
- }
-
- /**
- * Return the elements contained in this category.
- *
- * @return the elements
- */
- public ArrayList getElements() {
- return elements;
- }
-
- /**
- * Return whether a given object exists in this category.
- *
- * @param o the object to search for
- * @return whether the object is in this category
- */
- public boolean hasElement(Object o) {
- if (elements == null) {
+ return id;
+ }
+
+ /**
+ * Return the elements contained in this category.
+ *
+ * @return the elements
+ */
+ public ArrayList getElements() {
+ return elements;
+ }
+
+ /**
+ * Return whether a given object exists in this category.
+ *
+ * @param o the object to search for
+ * @return whether the object is in this category
+ */
+ public boolean hasElement(Object o) {
+ if (elements == null) {
return false;
}
- if (elements.isEmpty()) {
+ if (elements.isEmpty()) {
return false;
}
- return elements.contains(o);
- }
-
- /**
- * Return whether this category has child elements.
- *
- * @return whether this category has child elements
- */
- public boolean hasElements() {
- if (elements != null) {
+ return elements.contains(o);
+ }
+
+ /**
+ * Return whether this category has child elements.
+ *
+ * @return whether this category has child elements
+ */
+ public boolean hasElements() {
+ if (elements != null) {
return !elements.isEmpty();
}
- return false;
- }
+ return false;
+ }
- @Override
+ @Override
public Object getParent(Object o) {
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public String getLocalId() {
- return id;
- }
+ return id;
+ }
- @Override
+ @Override
public String getPluginId() {
- return configurationElement == null ? pluginId : configurationElement
- .getContributor().getName();
- }
+ return configurationElement == null ? pluginId : configurationElement.getContributor().getName();
+ }
/**
* Clear all elements from this category.
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/EditorDescriptor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/EditorDescriptor.java
index 29113071d70..83c65fc77c9 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/EditorDescriptor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/EditorDescriptor.java
@@ -41,251 +41,248 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
/**
* @see IEditorDescriptor
*/
-public final class EditorDescriptor implements IEditorDescriptor, Serializable,
- IPluginContribution {
+public final class EditorDescriptor implements IEditorDescriptor, Serializable, IPluginContribution {
- /**
- * Generated serial version UID for this class.
- * @since 3.1
- */
- private static final long serialVersionUID = 3905241225668998961L;
+ /**
+ * Generated serial version UID for this class.
+ *
+ * @since 3.1
+ */
+ private static final long serialVersionUID = 3905241225668998961L;
- // @issue the following constants need not be public; see bug 47600
- /**
- * Open internal constant. Value <code>0x01</code>.
- */
- public static final int OPEN_INTERNAL = 0x01;
+ // @issue the following constants need not be public; see bug 47600
+ /**
+ * Open internal constant. Value <code>0x01</code>.
+ */
+ public static final int OPEN_INTERNAL = 0x01;
- /**
- * Open in place constant. Value <code>0x02</code>.
- */
- public static final int OPEN_INPLACE = 0x02;
+ /**
+ * Open in place constant. Value <code>0x02</code>.
+ */
+ public static final int OPEN_INPLACE = 0x02;
- /**
- * Open external constant. Value <code>0x04</code>.
- */
- public static final int OPEN_EXTERNAL = 0x04;
+ /**
+ * Open external constant. Value <code>0x04</code>.
+ */
+ public static final int OPEN_EXTERNAL = 0x04;
- private String editorName;
+ private String editorName;
- private String imageFilename;
+ private String imageFilename;
- private transient ImageDescriptor imageDesc;
- private transient Object imageDescLock = new Object();
+ private transient ImageDescriptor imageDesc;
+ private transient Object imageDescLock = new Object();
- private boolean testImage = true;
+ private boolean testImage = true;
- private String className;
+ private String className;
- private String launcherName;
+ private String launcherName;
- private String fileName;
+ private String fileName;
- private String id = Util.ZERO_LENGTH_STRING;
+ private String id = Util.ZERO_LENGTH_STRING;
- private boolean matchingStrategyChecked = false;
- private IEditorMatchingStrategy matchingStrategy;
+ private boolean matchingStrategyChecked = false;
+ private IEditorMatchingStrategy matchingStrategy;
- private Program program;
+ private Program program;
- //The id of the plugin which contributed this editor, null for external editors
- private String pluginIdentifier;
+ // The id of the plugin which contributed this editor, null for external editors
+ private String pluginIdentifier;
- private int openMode = 0;
+ private int openMode = 0;
- private transient IConfigurationElement configurationElement;
+ private transient IConfigurationElement configurationElement;
/**
- * Create a new instance of an editor descriptor. Limited
- * to internal framework calls.
- * @param element
- * @param id2
- */
- /* package */EditorDescriptor(String id2, IConfigurationElement element) {
- setID(id2);
- setConfigurationElement(element);
- }
-
-
+ * Create a new instance of an editor descriptor. Limited to internal framework
+ * calls.
+ *
+ * @param element
+ * @param id2
+ */
+ /* package */ EditorDescriptor(String id2, IConfigurationElement element) {
+ setID(id2);
+ setConfigurationElement(element);
+ }
/**
- * Create a new instance of an editor descriptor. Limited
- * to internal framework calls.
+ * Create a new instance of an editor descriptor. Limited to internal framework
+ * calls.
*/
- /* package */ EditorDescriptor() {
+ /* package */ EditorDescriptor() {
super();
}
+ /**
+ * Creates a descriptor for an external program.
+ *
+ * @param filename the external editor full path and filename
+ * @return the editor descriptor
+ */
+ public static EditorDescriptor createForProgram(String filename) {
+ if (filename == null) {
+ throw new IllegalArgumentException();
+ }
+ EditorDescriptor editor = new EditorDescriptor();
+
+ editor.setFileName(filename);
+ editor.setID(filename);
+ editor.setOpenMode(OPEN_EXTERNAL);
+
+ // Isolate the program name (no directory or extension)
+ int start = filename.lastIndexOf(File.separator);
+ String name;
+ if (start != -1) {
+ name = filename.substring(start + 1);
+ } else {
+ name = filename;
+ }
+ int end = name.lastIndexOf('.');
+ if (end != -1) {
+ name = name.substring(0, end);
+ }
+ editor.setName(name);
+
+ // get the program icon without storing it in the registry
+ ImageDescriptor imageDescriptor = new ProgramImageDescriptor(filename, 0);
+ editor.setImageDescriptor(imageDescriptor);
+ return editor;
+ }
/**
- * Creates a descriptor for an external program.
- *
- * @param filename the external editor full path and filename
- * @return the editor descriptor
- */
- public static EditorDescriptor createForProgram(String filename) {
- if (filename == null) {
- throw new IllegalArgumentException();
- }
- EditorDescriptor editor = new EditorDescriptor();
-
- editor.setFileName(filename);
- editor.setID(filename);
- editor.setOpenMode(OPEN_EXTERNAL);
-
- //Isolate the program name (no directory or extension)
- int start = filename.lastIndexOf(File.separator);
- String name;
- if (start != -1) {
- name = filename.substring(start + 1);
- } else {
- name = filename;
- }
- int end = name.lastIndexOf('.');
- if (end != -1) {
- name = name.substring(0, end);
- }
- editor.setName(name);
-
- // get the program icon without storing it in the registry
- ImageDescriptor imageDescriptor = new ProgramImageDescriptor(filename,
- 0);
- editor.setImageDescriptor(imageDescriptor);
-
- return editor;
- }
-
- /**
- * Return the program called programName. Return null if it is not found.
- * @return org.eclipse.swt.program.Program
- */
- private static Program findProgram(String programName) {
+ * Return the program called programName. Return null if it is not found.
+ *
+ * @return org.eclipse.swt.program.Program
+ */
+ private static Program findProgram(String programName) {
for (Program program : Program.getPrograms()) {
if (program.getName().equals(programName)) {
return program;
}
- }
-
- return null;
- }
-
- /**
- * Create the editor action bar contributor for editors of this type.
- *
- * @return the action bar contributor, or <code>null</code>
- */
- public IEditorActionBarContributor createActionBarContributor() {
- // Handle case for predefined editor descriptors, like the
- // one for IEditorRegistry.SYSTEM_INPLACE_EDITOR_ID, which
- // don't have a configuration element.
- if (configurationElement == null) {
- return null;
- }
-
- // Get the contributor class name.
- String className = configurationElement
- .getAttribute(IWorkbenchRegistryConstants.ATT_CONTRIBUTOR_CLASS);
- if (className == null) {
+ }
+
+ return null;
+ }
+
+ /**
+ * Create the editor action bar contributor for editors of this type.
+ *
+ * @return the action bar contributor, or <code>null</code>
+ */
+ public IEditorActionBarContributor createActionBarContributor() {
+ // Handle case for predefined editor descriptors, like the
+ // one for IEditorRegistry.SYSTEM_INPLACE_EDITOR_ID, which
+ // don't have a configuration element.
+ if (configurationElement == null) {
return null;
}
- // Create the contributor object.
- IEditorActionBarContributor contributor = null;
- try {
- contributor = (IEditorActionBarContributor) WorkbenchPlugin
- .createExtension(configurationElement,
- IWorkbenchRegistryConstants.ATT_CONTRIBUTOR_CLASS);
- } catch (CoreException e) {
- WorkbenchPlugin.log("Unable to create editor contributor: " + //$NON-NLS-1$
- id, e.getStatus());
- }
- return contributor;
- }
-
- /**
- * Return the editor class name.
- *
- * @return the class name
- */
- public String getClassName() {
- if (configurationElement == null) {
- return className;
- }
- return RegistryReader.getClassValue(configurationElement,
- IWorkbenchRegistryConstants.ATT_CLASS);
- }
-
- /**
- * Return the configuration element used to define this editor, or <code>null</code>.
- *
- * @return the element or null
- */
- public IConfigurationElement getConfigurationElement() {
- return configurationElement;
- }
-
- /**
- * Create an editor part based on this descriptor.
- *
- * @return the editor part
- * @throws CoreException thrown if there is an issue creating the editor
- */
- public IEditorPart createEditor() throws CoreException {
- Object extension = WorkbenchPlugin.createExtension(getConfigurationElement(), IWorkbenchRegistryConstants.ATT_CLASS);
- return ((InterceptContributions)Tweaklets.get(InterceptContributions.KEY)).tweakEditor(extension);
- }
-
- /**
- * Return the file name of the command to execute for this editor.
- *
- * @return the file name to execute
- */
- public String getFileName() {
- if (program == null) {
- if (configurationElement == null) {
- return fileName;
- }
- return configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_COMMAND);
- }
- return program.getName();
- }
-
- /**
- * Return the id for this editor.
- *
- * @return the id
- */
- @Override
+ // Get the contributor class name.
+ String className = configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_CONTRIBUTOR_CLASS);
+ if (className == null) {
+ return null;
+ }
+
+ // Create the contributor object.
+ IEditorActionBarContributor contributor = null;
+ try {
+ contributor = (IEditorActionBarContributor) WorkbenchPlugin.createExtension(configurationElement,
+ IWorkbenchRegistryConstants.ATT_CONTRIBUTOR_CLASS);
+ } catch (CoreException e) {
+ WorkbenchPlugin.log("Unable to create editor contributor: " + //$NON-NLS-1$
+ id, e.getStatus());
+ }
+ return contributor;
+ }
+
+ /**
+ * Return the editor class name.
+ *
+ * @return the class name
+ */
+ public String getClassName() {
+ if (configurationElement == null) {
+ return className;
+ }
+ return RegistryReader.getClassValue(configurationElement, IWorkbenchRegistryConstants.ATT_CLASS);
+ }
+
+ /**
+ * Return the configuration element used to define this editor, or
+ * <code>null</code>.
+ *
+ * @return the element or null
+ */
+ public IConfigurationElement getConfigurationElement() {
+ return configurationElement;
+ }
+
+ /**
+ * Create an editor part based on this descriptor.
+ *
+ * @return the editor part
+ * @throws CoreException thrown if there is an issue creating the editor
+ */
+ public IEditorPart createEditor() throws CoreException {
+ Object extension = WorkbenchPlugin.createExtension(getConfigurationElement(),
+ IWorkbenchRegistryConstants.ATT_CLASS);
+ return ((InterceptContributions) Tweaklets.get(InterceptContributions.KEY)).tweakEditor(extension);
+ }
+
+ /**
+ * Return the file name of the command to execute for this editor.
+ *
+ * @return the file name to execute
+ */
+ public String getFileName() {
+ if (program == null) {
+ if (configurationElement == null) {
+ return fileName;
+ }
+ return configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_COMMAND);
+ }
+ return program.getName();
+ }
+
+ /**
+ * Return the id for this editor.
+ *
+ * @return the id
+ */
+ @Override
public String getId() {
- if (program == null) {
- if (configurationElement == null) {
- return Util.safeString(id);
- }
- return Util.safeString(configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_ID));
-
- }
- return Util.safeString(program.getName());
- }
-
- /**
- * Return the image descriptor describing this editor.
- *
- * @return the image descriptor
- */
- @Override
+ if (program == null) {
+ if (configurationElement == null) {
+ return Util.safeString(id);
+ }
+ return Util.safeString(configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_ID));
+
+ }
+ return Util.safeString(program.getName());
+ }
+
+ /**
+ * Return the image descriptor describing this editor.
+ *
+ * @return the image descriptor
+ */
+ @Override
public ImageDescriptor getImageDescriptor() {
- ImageDescriptor tempDescriptor = null;
+ ImageDescriptor tempDescriptor = null;
- synchronized (imageDescLock) {
- if (!testImage)
- return imageDesc;
+ synchronized (imageDescLock) {
+ if (!testImage)
+ return imageDesc;
if (imageDesc == null) {
String imageFileName = getImageFilename();
String command = getFileName();
if (imageFileName != null && configurationElement != null)
- tempDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(configurationElement.getNamespaceIdentifier(), imageFileName);
+ tempDescriptor = AbstractUIPlugin
+ .imageDescriptorFromPlugin(configurationElement.getNamespaceIdentifier(), imageFileName);
else if (command != null)
tempDescriptor = WorkbenchImages.getImageDescriptorFromProgram(command, 0);
} else
@@ -294,19 +291,22 @@ public final class EditorDescriptor implements IEditorDescriptor, Serializable,
if (tempDescriptor == null) { // still null? return default image
imageDesc = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJ_FILE);
testImage = false;
- return imageDesc;
+ return imageDesc;
}
- }
+ }
- // Verifies that the image descriptor generates an image. If not, the descriptor is
- // replaced with the default image.
- // We must create the image without holding any locks, since there is a potential for deadlock
- // on Linux due to SWT's implementation of Image. See bugs 265028 and 256316 for details.
+ // Verifies that the image descriptor generates an image. If not, the descriptor
+ // is
+ // replaced with the default image.
+ // We must create the image without holding any locks, since there is a
+ // potential for deadlock
+ // on Linux due to SWT's implementation of Image. See bugs 265028 and 256316 for
+ // details.
Image img = tempDescriptor.createImage(false);
if (img == null) // @issue what should be the default image?
tempDescriptor = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJ_FILE);
else
- img.dispose();
+ img.dispose();
// <----- End of must-not-lock part
// reenter synchronized block
@@ -319,311 +319,305 @@ public final class EditorDescriptor implements IEditorDescriptor, Serializable,
testImage = false;
return imageDesc;
}
- }
-
- /**
- * The Image to use to repesent this editor
- */
- /* package */void setImageDescriptor(ImageDescriptor desc) {
- synchronized (imageDescLock) {
- imageDesc = desc;
- testImage = true;
- }
- }
-
- /**
- * The name of the image describing this editor.
- *
- * @return the image file name
- */
- public String getImageFilename() {
- if (configurationElement == null) {
+ }
+
+ /**
+ * The Image to use to repesent this editor
+ */
+ /* package */void setImageDescriptor(ImageDescriptor desc) {
+ synchronized (imageDescLock) {
+ imageDesc = desc;
+ testImage = true;
+ }
+ }
+
+ /**
+ * The name of the image describing this editor.
+ *
+ * @return the image file name
+ */
+ public String getImageFilename() {
+ if (configurationElement == null) {
return imageFilename;
}
- return configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_ICON);
- }
-
- /**
- * Return the user printable label for this editor.
- *
- * @return the label
- */
- @Override
+ return configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_ICON);
+ }
+
+ /**
+ * Return the user printable label for this editor.
+ *
+ * @return the label
+ */
+ @Override
public String getLabel() {
- if (program == null) {
- if (configurationElement == null) {
- return editorName;
- }
- return configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_NAME);
- }
- return program.getName();
- }
-
- /**
- * Returns the class name of the launcher.
- *
- * @return the launcher class name
- */
- public String getLauncher() {
- if (configurationElement == null) {
+ if (program == null) {
+ if (configurationElement == null) {
+ return editorName;
+ }
+ return configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_NAME);
+ }
+ return program.getName();
+ }
+
+ /**
+ * Returns the class name of the launcher.
+ *
+ * @return the launcher class name
+ */
+ public String getLauncher() {
+ if (configurationElement == null) {
return launcherName;
}
- return configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_LAUNCHER);
- }
-
- /**
- * Return the contributing plugin id.
- *
- * @return the contributing plugin id
- */
- public String getPluginID() {
- if (configurationElement != null) {
+ return configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_LAUNCHER);
+ }
+
+ /**
+ * Return the contributing plugin id.
+ *
+ * @return the contributing plugin id
+ */
+ public String getPluginID() {
+ if (configurationElement != null) {
return configurationElement.getContributor().getName();
}
- return pluginIdentifier;
- }
-
- /**
- * Get the program for the receiver if there is one.
- * @return Program
- */
- public Program getProgram() {
- return this.program;
- }
-
- @Override
+ return pluginIdentifier;
+ }
+
+ /**
+ * Get the program for the receiver if there is one.
+ *
+ * @return Program
+ */
+ public Program getProgram() {
+ return this.program;
+ }
+
+ @Override
public boolean isInternal() {
- return getOpenMode() == OPEN_INTERNAL;
- }
+ return getOpenMode() == OPEN_INTERNAL;
+ }
- @Override
+ @Override
public boolean isOpenInPlace() {
- return getOpenMode() == OPEN_INPLACE;
- }
+ return getOpenMode() == OPEN_INPLACE;
+ }
- @Override
+ @Override
public boolean isOpenExternal() {
- return getOpenMode() == OPEN_EXTERNAL;
- }
-
- /**
- * Load the object properties from a memento.
- *
- * @return <code>true</code> if the values are valid, <code>false</code> otherwise
- */
- protected boolean loadValues(IMemento memento) {
- editorName = memento.getString(IWorkbenchConstants.TAG_LABEL);
- imageFilename = memento.getString(IWorkbenchConstants.TAG_IMAGE);
- className = memento.getString(IWorkbenchConstants.TAG_CLASS);
- launcherName = memento.getString(IWorkbenchConstants.TAG_LAUNCHER);
- fileName = memento.getString(IWorkbenchConstants.TAG_FILE);
- id = Util.safeString(memento.getString(IWorkbenchConstants.TAG_ID));
- pluginIdentifier = memento.getString(IWorkbenchConstants.TAG_PLUGIN);
-
- Integer openModeInt = memento
- .getInteger(IWorkbenchConstants.TAG_OPEN_MODE);
- if (openModeInt != null) {
- openMode = openModeInt.intValue();
- } else {
- // legacy: handle the older attribute names, needed to allow reading of pre-3.0-RCP workspaces
- boolean internal = Boolean.parseBoolean(memento
- .getString(IWorkbenchConstants.TAG_INTERNAL));
- boolean openInPlace = Boolean.parseBoolean(memento
- .getString(IWorkbenchConstants.TAG_OPEN_IN_PLACE));
- if (internal) {
- openMode = OPEN_INTERNAL;
- } else {
- if (openInPlace) {
- openMode = OPEN_INPLACE;
- } else {
- openMode = OPEN_EXTERNAL;
- }
- }
- }
- if (openMode != OPEN_EXTERNAL && openMode != OPEN_INTERNAL
- && openMode != OPEN_INPLACE) {
- WorkbenchPlugin
- .log("Ignoring editor descriptor with invalid openMode: " + this); //$NON-NLS-1$
- return false;
- }
-
- String programName = memento
- .getString(IWorkbenchConstants.TAG_PROGRAM_NAME);
- if (programName != null) {
- this.program = findProgram(programName);
- }
- return true;
- }
-
- /**
- * Save the object values in a IMemento
- */
- protected void saveValues(IMemento memento) {
- memento.putString(IWorkbenchConstants.TAG_LABEL, getLabel());
- memento.putString(IWorkbenchConstants.TAG_IMAGE, getImageFilename());
- memento.putString(IWorkbenchConstants.TAG_CLASS, getClassName());
- memento.putString(IWorkbenchConstants.TAG_LAUNCHER, getLauncher());
- memento.putString(IWorkbenchConstants.TAG_FILE, getFileName());
- memento.putString(IWorkbenchConstants.TAG_ID, getId());
- memento.putString(IWorkbenchConstants.TAG_PLUGIN, getPluginId());
-
- memento.putInteger(IWorkbenchConstants.TAG_OPEN_MODE, getOpenMode());
- // legacy: handle the older attribute names, needed to allow reading of workspace by pre-3.0-RCP eclipses
- memento.putString(IWorkbenchConstants.TAG_INTERNAL, String
- .valueOf(isInternal()));
- memento.putString(IWorkbenchConstants.TAG_OPEN_IN_PLACE, String
- .valueOf(isOpenInPlace()));
-
- if (this.program != null) {
- memento.putString(IWorkbenchConstants.TAG_PROGRAM_NAME,
- this.program.getName());
+ return getOpenMode() == OPEN_EXTERNAL;
+ }
+
+ /**
+ * Load the object properties from a memento.
+ *
+ * @return <code>true</code> if the values are valid, <code>false</code>
+ * otherwise
+ */
+ protected boolean loadValues(IMemento memento) {
+ editorName = memento.getString(IWorkbenchConstants.TAG_LABEL);
+ imageFilename = memento.getString(IWorkbenchConstants.TAG_IMAGE);
+ className = memento.getString(IWorkbenchConstants.TAG_CLASS);
+ launcherName = memento.getString(IWorkbenchConstants.TAG_LAUNCHER);
+ fileName = memento.getString(IWorkbenchConstants.TAG_FILE);
+ id = Util.safeString(memento.getString(IWorkbenchConstants.TAG_ID));
+ pluginIdentifier = memento.getString(IWorkbenchConstants.TAG_PLUGIN);
+
+ Integer openModeInt = memento.getInteger(IWorkbenchConstants.TAG_OPEN_MODE);
+ if (openModeInt != null) {
+ openMode = openModeInt.intValue();
+ } else {
+ // legacy: handle the older attribute names, needed to allow reading of
+ // pre-3.0-RCP workspaces
+ boolean internal = Boolean.parseBoolean(memento.getString(IWorkbenchConstants.TAG_INTERNAL));
+ boolean openInPlace = Boolean.parseBoolean(memento.getString(IWorkbenchConstants.TAG_OPEN_IN_PLACE));
+ if (internal) {
+ openMode = OPEN_INTERNAL;
+ } else {
+ if (openInPlace) {
+ openMode = OPEN_INPLACE;
+ } else {
+ openMode = OPEN_EXTERNAL;
+ }
+ }
}
- }
+ if (openMode != OPEN_EXTERNAL && openMode != OPEN_INTERNAL && openMode != OPEN_INPLACE) {
+ WorkbenchPlugin.log("Ignoring editor descriptor with invalid openMode: " + this); //$NON-NLS-1$
+ return false;
+ }
+
+ String programName = memento.getString(IWorkbenchConstants.TAG_PROGRAM_NAME);
+ if (programName != null) {
+ this.program = findProgram(programName);
+ }
+ return true;
+ }
+
+ /**
+ * Save the object values in a IMemento
+ */
+ protected void saveValues(IMemento memento) {
+ memento.putString(IWorkbenchConstants.TAG_LABEL, getLabel());
+ memento.putString(IWorkbenchConstants.TAG_IMAGE, getImageFilename());
+ memento.putString(IWorkbenchConstants.TAG_CLASS, getClassName());
+ memento.putString(IWorkbenchConstants.TAG_LAUNCHER, getLauncher());
+ memento.putString(IWorkbenchConstants.TAG_FILE, getFileName());
+ memento.putString(IWorkbenchConstants.TAG_ID, getId());
+ memento.putString(IWorkbenchConstants.TAG_PLUGIN, getPluginId());
+
+ memento.putInteger(IWorkbenchConstants.TAG_OPEN_MODE, getOpenMode());
+ // legacy: handle the older attribute names, needed to allow reading of
+ // workspace by pre-3.0-RCP eclipses
+ memento.putString(IWorkbenchConstants.TAG_INTERNAL, String.valueOf(isInternal()));
+ memento.putString(IWorkbenchConstants.TAG_OPEN_IN_PLACE, String.valueOf(isOpenInPlace()));
+
+ if (this.program != null) {
+ memento.putString(IWorkbenchConstants.TAG_PROGRAM_NAME, this.program.getName());
+ }
+ }
- /**
- * Return the open mode of this editor.
- *
+ /**
+ * Return the open mode of this editor.
+ *
* @return the open mode of this editor
* @since 3.1
*/
private int getOpenMode() {
if (configurationElement == null) { // if we've been serialized, return our serialized value
return openMode;
+ } else if (getLauncher() != null) {
+ // open using a launcer
+ return EditorDescriptor.OPEN_EXTERNAL;
+ } else if (getFileName() != null) {
+ // open using an external editor
+ return EditorDescriptor.OPEN_EXTERNAL;
+ } else if (getPluginId() != null) {
+ // open using an internal editor
+ return EditorDescriptor.OPEN_INTERNAL;
+ } else {
+ return 0; // default for system editor
}
- else if (getLauncher() != null) {
- // open using a launcer
- return EditorDescriptor.OPEN_EXTERNAL;
- } else if (getFileName() != null) {
- // open using an external editor
- return EditorDescriptor.OPEN_EXTERNAL;
- } else if (getPluginId() != null) {
- // open using an internal editor
- return EditorDescriptor.OPEN_INTERNAL;
- }
- else {
- return 0; // default for system editor
- }
- }
-
- /**
- * Set the class name of an internal editor.
- */
- /* package */void setClassName(String newClassName) {
- className = newClassName;
- }
-
- /**
- * Set the configuration element which contributed this editor.
- */
- /* package */void setConfigurationElement(
- IConfigurationElement newConfigurationElement) {
- configurationElement = newConfigurationElement;
- }
-
- /**
- * Set the filename of an external editor.
- */
- /* package */void setFileName(String aFileName) {
- fileName = aFileName;
- }
-
- /**
- * Set the id of the editor.
- * For internal editors this is the id as provided in the extension point
- * For external editors it is path and filename of the editor
- */
- /* package */void setID(String anID) {
- Assert.isNotNull(anID);
- id = anID;
- }
-
- /**
- * The name of the image to use for this editor.
- */
- /* package */void setImageFilename(String aFileName) {
- imageFilename = aFileName;
- }
-
- /**
- * Sets the new launcher class name
- *
- * @param newLauncher the new launcher
- */
- /* package */void setLauncher(String newLauncher) {
- launcherName = newLauncher;
- }
-
- /**
- * The label to show for this editor.
- */
- /* package */void setName(String newName) {
- editorName = newName;
- }
-
- /**
- * Sets the open mode of this editor descriptor.
- *
- * @param mode the open mode
- *
- * @issue this method is public as a temporary fix for bug 47600
- */
- public void setOpenMode(int mode) {
- openMode = mode;
- }
-
- /**
- * The id of the plugin which contributed this editor, null for external editors.
- */
- /* package */void setPluginIdentifier(String anID) {
- pluginIdentifier = anID;
- }
-
- /**
- * Set the receivers program.
- * @param newProgram
- */
- /* package */void setProgram(Program newProgram) {
-
- this.program = newProgram;
- if (editorName == null) {
+ }
+
+ /**
+ * Set the class name of an internal editor.
+ */
+ /* package */void setClassName(String newClassName) {
+ className = newClassName;
+ }
+
+ /**
+ * Set the configuration element which contributed this editor.
+ */
+ /* package */void setConfigurationElement(IConfigurationElement newConfigurationElement) {
+ configurationElement = newConfigurationElement;
+ }
+
+ /**
+ * Set the filename of an external editor.
+ */
+ /* package */void setFileName(String aFileName) {
+ fileName = aFileName;
+ }
+
+ /**
+ * Set the id of the editor. For internal editors this is the id as provided in
+ * the extension point For external editors it is path and filename of the
+ * editor
+ */
+ /* package */void setID(String anID) {
+ Assert.isNotNull(anID);
+ id = anID;
+ }
+
+ /**
+ * The name of the image to use for this editor.
+ */
+ /* package */void setImageFilename(String aFileName) {
+ imageFilename = aFileName;
+ }
+
+ /**
+ * Sets the new launcher class name
+ *
+ * @param newLauncher the new launcher
+ */
+ /* package */void setLauncher(String newLauncher) {
+ launcherName = newLauncher;
+ }
+
+ /**
+ * The label to show for this editor.
+ */
+ /* package */void setName(String newName) {
+ editorName = newName;
+ }
+
+ /**
+ * Sets the open mode of this editor descriptor.
+ *
+ * @param mode the open mode
+ *
+ * @issue this method is public as a temporary fix for bug 47600
+ */
+ public void setOpenMode(int mode) {
+ openMode = mode;
+ }
+
+ /**
+ * The id of the plugin which contributed this editor, null for external
+ * editors.
+ */
+ /* package */void setPluginIdentifier(String anID) {
+ pluginIdentifier = anID;
+ }
+
+ /**
+ * Set the receivers program.
+ *
+ * @param newProgram
+ */
+ /* package */void setProgram(Program newProgram) {
+
+ this.program = newProgram;
+ if (editorName == null) {
setName(newProgram.getName());
}
- }
+ }
- /**
- * For debugging purposes only.
- */
- @Override
+ /**
+ * For debugging purposes only.
+ */
+ @Override
public String toString() {
- return "EditorDescriptor(id=" + getId() + ", label=" + getLabel() + ")"; //$NON-NLS-2$ //$NON-NLS-3$//$NON-NLS-1$
- }
+ return "EditorDescriptor(id=" + getId() + ", label=" + getLabel() + ")"; //$NON-NLS-2$ //$NON-NLS-3$//$NON-NLS-1$
+ }
- @Override
+ @Override
public String getLocalId() {
- return getId();
- }
+ return getId();
+ }
- @Override
+ @Override
public String getPluginId() {
- return getPluginID();
- }
+ return getPluginID();
+ }
- @Override
+ @Override
public IEditorMatchingStrategy getEditorMatchingStrategy() {
- if (matchingStrategy == null && !matchingStrategyChecked) {
- matchingStrategyChecked = true;
- if (program == null && configurationElement != null) {
- if (configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_MATCHING_STRATEGY) != null) {
- try {
- matchingStrategy = (IEditorMatchingStrategy) WorkbenchPlugin.createExtension(configurationElement, IWorkbenchRegistryConstants.ATT_MATCHING_STRATEGY);
- } catch (CoreException e) {
- WorkbenchPlugin.log("Error creating editor management policy for editor id " + getId(), e); //$NON-NLS-1$
- }
- }
- }
- }
- return matchingStrategy;
- }
-
+ if (matchingStrategy == null && !matchingStrategyChecked) {
+ matchingStrategyChecked = true;
+ if (program == null && configurationElement != null) {
+ if (configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_MATCHING_STRATEGY) != null) {
+ try {
+ matchingStrategy = (IEditorMatchingStrategy) WorkbenchPlugin.createExtension(
+ configurationElement, IWorkbenchRegistryConstants.ATT_MATCHING_STRATEGY);
+ } catch (CoreException e) {
+ WorkbenchPlugin.log("Error creating editor management policy for editor id " + getId(), e); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+ return matchingStrategy;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/EditorRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/EditorRegistry.java
index 9b5a0429ef8..d46a1ac70b8 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/EditorRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/EditorRegistry.java
@@ -80,21 +80,20 @@ import org.eclipse.ui.internal.misc.ExternalProgramImageDescriptor;
import org.eclipse.ui.internal.misc.ProgramImageDescriptor;
import org.eclipse.ui.internal.util.Util;
-
/**
* Provides access to the collection of defined editors for resource types.
*/
public class EditorRegistry extends EventManager implements IEditorRegistry, IExtensionChangeHandler {
- private static final IEditorDescriptor [] EMPTY = new IEditorDescriptor[0];
+ private static final IEditorDescriptor[] EMPTY = new IEditorDescriptor[0];
class RelatedRegistry {
/**
- * Return the objects related to the type.
- *
- * @param type
- * @return the objects related to the type
+ * Return the objects related to the type.
+ *
+ * @param type
+ * @return the objects related to the type
*/
public IEditorDescriptor[] getRelatedObjects(IContentType type) {
LinkedHashSet<IEditorDescriptor> editors = new LinkedHashSet<>();
@@ -107,13 +106,15 @@ public class EditorRegistry extends EventManager implements IEditorRegistry, IEx
if (editors.isEmpty()) {
return EMPTY;
}
- return (IEditorDescriptor[]) WorkbenchActivityHelper.restrictArray(editors.toArray(new IEditorDescriptor[editors.size()]));
+ return (IEditorDescriptor[]) WorkbenchActivityHelper
+ .restrictArray(editors.toArray(new IEditorDescriptor[editors.size()]));
}
/**
- * Return the objects related to the filename
- * @param fileName
- * @return the objects related to the filename
+ * Return the objects related to the filename
+ *
+ * @param fileName
+ * @return the objects related to the filename
*/
public IEditorDescriptor[] getRelatedObjects(String fileName) {
IFileEditorMapping mapping = getMappingFor(fileName);
@@ -130,34 +131,33 @@ public class EditorRegistry extends EventManager implements IEditorRegistry, IEx
private Map<IContentType, LinkedHashSet<IEditorDescriptor>> contentTypeToEditorMappingsFromUser = new HashMap<>();
/**
- * Cached images - these include images from registered editors (via
- * plugins) and others hence this table is not one to one with the mappings
- * table. It is in fact a superset of the keys one would find in
- * typeEditorMappings
+ * Cached images - these include images from registered editors (via plugins)
+ * and others hence this table is not one to one with the mappings table. It is
+ * in fact a superset of the keys one would find in typeEditorMappings
*/
private Map<Object, ImageDescriptor> extensionImages = new HashMap<>();
- /**
- * Vector of EditorDescriptor - all the editors loaded from plugin files.
- * The list is kept in order to be able to show in the editor selection
- * dialog of the resource associations page. This list is sorted based on the
- * human readable label of the editor descriptor.
- *
- * @see #comparer
- */
+ /**
+ * Vector of EditorDescriptor - all the editors loaded from plugin files. The
+ * list is kept in order to be able to show in the editor selection dialog of
+ * the resource associations page. This list is sorted based on the human
+ * readable label of the editor descriptor.
+ *
+ * @see #comparer
+ */
private List<IEditorDescriptor> sortedEditorsFromPlugins = new ArrayList<>();
- // Map of EditorDescriptor - map editor id to editor.
- private Map<String, IEditorDescriptor> mapIDtoEditor = initialIdToEditorMap(10);
+ // Map of EditorDescriptor - map editor id to editor.
+ private Map<String, IEditorDescriptor> mapIDtoEditor = initialIdToEditorMap(10);
- // Map of FileEditorMapping (extension to FileEditorMapping)
- private EditorMap typeEditorMappings;
+ // Map of FileEditorMapping (extension to FileEditorMapping)
+ private EditorMap typeEditorMappings;
- /*
- * Compares the labels from two IEditorDescriptor objects
- */
+ /*
+ * Compares the labels from two IEditorDescriptor objects
+ */
private static final Comparator<IEditorDescriptor> comparer = new Comparator<IEditorDescriptor>() {
- private Collator collator = Collator.getInstance();
+ private Collator collator = Collator.getInstance();
@Override
public int compare(IEditorDescriptor arg0, IEditorDescriptor arg1) {
@@ -173,17 +173,18 @@ public class EditorRegistry extends EventManager implements IEditorRegistry, IEx
public static final String EMPTY_EDITOR_ID = "org.eclipse.ui.internal.emptyEditorTab"; //$NON-NLS-1$
- /**
- * Return an instance of the receiver. Adds listeners into the extension
- * registry for dynamic UI purposes.
- * @param contentTypeManager
- */
- public EditorRegistry(IContentTypeManager contentTypeManager) {
- super();
- this.contentTypeManager = contentTypeManager;
- initializeFromStorage();
- IExtensionTracker tracker = PlatformUI.getWorkbench().getExtensionTracker();
- tracker.registerHandler(this, ExtensionTracker.createExtensionPointFilter(getExtensionPointFilter()));
+ /**
+ * Return an instance of the receiver. Adds listeners into the extension
+ * registry for dynamic UI purposes.
+ *
+ * @param contentTypeManager
+ */
+ public EditorRegistry(IContentTypeManager contentTypeManager) {
+ super();
+ this.contentTypeManager = contentTypeManager;
+ initializeFromStorage();
+ IExtensionTracker tracker = PlatformUI.getWorkbench().getExtensionTracker();
+ tracker.registerHandler(this, ExtensionTracker.createExtensionPointFilter(getExtensionPointFilter()));
relatedRegistry = new RelatedRegistry();
contentTypeManager.addContentTypeChangeListener(event -> {
if (contentTypeManager.getContentType(event.getContentType().getId()) == null) {
@@ -191,77 +192,71 @@ public class EditorRegistry extends EventManager implements IEditorRegistry, IEx
saveAssociations();
}
});
- }
-
- /**
- * Add an editor for the given extensions with the specified (possibly null)
- * extended type. The editor is being registered from a plugin
- *
- * @param editor
- * The description of the editor (as obtained from the plugin
- * file and built by the registry reader)
- * @param extensions
- * Collection of file extensions the editor applies to
- * @param filenames
- * Collection of filenames the editor applies to
- * @param contentTypeVector
- * @param bDefault
- * Indicates whether the editor should be made the default editor
- * and hence appear first inside a FileEditorMapping
- *
- * This method is not API and should not be called outside the workbench
- * code.
- */
+ }
+
+ /**
+ * Add an editor for the given extensions with the specified (possibly null)
+ * extended type. The editor is being registered from a plugin
+ *
+ * @param editor The description of the editor (as obtained from the
+ * plugin file and built by the registry reader)
+ * @param extensions Collection of file extensions the editor applies to
+ * @param filenames Collection of filenames the editor applies to
+ * @param contentTypeVector
+ * @param bDefault Indicates whether the editor should be made the
+ * default editor and hence appear first inside a
+ * FileEditorMapping
+ *
+ * This method is not API and should not be called
+ * outside the workbench code.
+ */
public void addEditorFromPlugin(EditorDescriptor editor, List<String> extensions, List<String> filenames,
List<String> contentTypeVector, boolean bDefault) {
- PlatformUI.getWorkbench().getExtensionTracker().registerObject(
- editor.getConfigurationElement().getDeclaringExtension(),
- editor, IExtensionTracker.REF_WEAK);
- // record it in our quick reference list
- sortedEditorsFromPlugins.add(editor);
+ PlatformUI.getWorkbench().getExtensionTracker().registerObject(
+ editor.getConfigurationElement().getDeclaringExtension(), editor, IExtensionTracker.REF_WEAK);
+ // record it in our quick reference list
+ sortedEditorsFromPlugins.add(editor);
- // add it to the table of mappings
+ // add it to the table of mappings
for (String fileExtension : extensions) {
- if (fileExtension != null && fileExtension.length() > 0) {
- FileEditorMapping mapping = getMappingFor("*." + fileExtension); //$NON-NLS-1$
- if (mapping == null) { // no mapping for that extension
- mapping = new FileEditorMapping(fileExtension);
- typeEditorMappings.putDefault(mappingKeyFor(mapping),
- mapping);
- }
- mapping.addEditor(editor);
- if (bDefault) {
+ if (fileExtension != null && fileExtension.length() > 0) {
+ FileEditorMapping mapping = getMappingFor("*." + fileExtension); //$NON-NLS-1$
+ if (mapping == null) { // no mapping for that extension
+ mapping = new FileEditorMapping(fileExtension);
+ typeEditorMappings.putDefault(mappingKeyFor(mapping), mapping);
+ }
+ mapping.addEditor(editor);
+ if (bDefault) {
mapping.setDefaultEditor(editor);
}
- }
- }
+ }
+ }
- // add it to the table of mappings
+ // add it to the table of mappings
for (String filename : filenames) {
- if (filename != null && filename.length() > 0) {
- FileEditorMapping mapping = getMappingFor(filename);
- if (mapping == null) { // no mapping for that extension
- String name;
- String extension;
- int index = filename.indexOf('.');
- if (index < 0) {
- name = filename;
- extension = ""; //$NON-NLS-1$
- } else {
- name = filename.substring(0, index);
- extension = filename.substring(index + 1);
- }
- mapping = new FileEditorMapping(name, extension);
- typeEditorMappings.putDefault(mappingKeyFor(mapping),
- mapping);
- }
- mapping.addEditor(editor);
- if (bDefault) {
+ if (filename != null && filename.length() > 0) {
+ FileEditorMapping mapping = getMappingFor(filename);
+ if (mapping == null) { // no mapping for that extension
+ String name;
+ String extension;
+ int index = filename.indexOf('.');
+ if (index < 0) {
+ name = filename;
+ extension = ""; //$NON-NLS-1$
+ } else {
+ name = filename.substring(0, index);
+ extension = filename.substring(index + 1);
+ }
+ mapping = new FileEditorMapping(name, extension);
+ typeEditorMappings.putDefault(mappingKeyFor(mapping), mapping);
+ }
+ mapping.addEditor(editor);
+ if (bDefault) {
mapping.setDefaultEditor(editor);
}
- }
- }
+ }
+ }
for (String contentTypeId : contentTypeVector) {
if (contentTypeId != null && contentTypeId.length() > 0) {
@@ -272,23 +267,21 @@ public class EditorRegistry extends EventManager implements IEditorRegistry, IEx
}
}
- // Update editor map.
- mapIDtoEditor.put(editor.getId(), editor);
- }
+ // Update editor map.
+ mapIDtoEditor.put(editor.getId(), editor);
+ }
public void addContentTypeBindingFromPlugin(IContentType contentType, IEditorDescriptor editor, boolean bDefault) {
IEditorDescriptor[] editorArray = contentTypeToEditorMappingsFromPlugins.get(contentType);
if (editorArray == null) {
- editorArray = new IEditorDescriptor[] {editor};
+ editorArray = new IEditorDescriptor[] { editor };
contentTypeToEditorMappingsFromPlugins.put(contentType, editorArray);
- }
- else {
- IEditorDescriptor [] newArray = new IEditorDescriptor[editorArray.length + 1];
+ } else {
+ IEditorDescriptor[] newArray = new IEditorDescriptor[editorArray.length + 1];
if (bDefault) { // default editors go to the front of the line
newArray[0] = editor;
System.arraycopy(editorArray, 0, newArray, 1, editorArray.length);
- }
- else {
+ } else {
newArray[editorArray.length] = editor;
System.arraycopy(editorArray, 0, newArray, 0, editorArray.length);
}
@@ -296,63 +289,63 @@ public class EditorRegistry extends EventManager implements IEditorRegistry, IEx
}
}
- /**
- * Add external editors to the editor mapping.
- */
- private void addExternalEditorsToEditorMap() {
- // Add registered editors (may include external editors).
- for (FileEditorMapping map : typeEditorMappings.allMappings()) {
- IEditorDescriptor[] descArray = map.getEditors();
- for (IEditorDescriptor desc : descArray) {
+ /**
+ * Add external editors to the editor mapping.
+ */
+ private void addExternalEditorsToEditorMap() {
+ // Add registered editors (may include external editors).
+ for (FileEditorMapping map : typeEditorMappings.allMappings()) {
+ IEditorDescriptor[] descArray = map.getEditors();
+ for (IEditorDescriptor desc : descArray) {
mapIDtoEditor.put(desc.getId(), desc);
- }
- }
- // Add external editors from OS
- for (IEditorDescriptor desc : getSortedEditorsFromOS()) {
- mapIDtoEditor.put(desc.getId(), desc);
+ }
+ }
+ // Add external editors from OS
+ for (IEditorDescriptor desc : getSortedEditorsFromOS()) {
+ mapIDtoEditor.put(desc.getId(), desc);
+ }
}
- }
- @Override
+ @Override
public void addPropertyListener(IPropertyListener l) {
- addListenerObject(l);
- }
+ addListenerObject(l);
+ }
- @Override
+ @Override
public IEditorDescriptor findEditor(String id) {
IEditorDescriptor desc = mapIDtoEditor.get(id);
- if (WorkbenchActivityHelper.restrictUseOf(desc)) {
- return null;
- }
+ if (WorkbenchActivityHelper.restrictUseOf(desc)) {
+ return null;
+ }
return desc;
- }
-
- /**
- * Fires a property changed event to all registered listeners.
- *
- * @param type the type of event
- * @see IEditorRegistry#PROP_CONTENTS
- */
- private void firePropertyChange(final int type) {
+ }
+
+ /**
+ * Fires a property changed event to all registered listeners.
+ *
+ * @param type the type of event
+ * @see IEditorRegistry#PROP_CONTENTS
+ */
+ private void firePropertyChange(final int type) {
for (Object listener : getListeners()) {
final IPropertyListener propertyListener = (IPropertyListener) listener;
- SafeRunner.run(new SafeRunnable() {
- @Override
+ SafeRunner.run(new SafeRunnable() {
+ @Override
public void run() {
propertyListener.propertyChanged(EditorRegistry.this, type);
- }
- });
- }
- }
+ }
+ });
+ }
+ }
- @Override
+ @Override
public IEditorDescriptor getDefaultEditor() {
- // the default editor will always be the system external editor
- // this should never return null
- return findEditor(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID);
- }
+ // the default editor will always be the system external editor
+ // this should never return null
+ return findEditor(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID);
+ }
- @Override
+ @Override
public IEditorDescriptor getDefaultEditor(String filename) {
IEditorDescriptor defaultEditor = getDefaultEditor(filename, guessAtContentType(filename));
if (defaultEditor != null) {
@@ -367,7 +360,7 @@ public class EditorRegistry extends EventManager implements IEditorRegistry, IEx
}
}
return null;
- }
+ }
/**
* Return the (approximated) content type for a file with the given name.
@@ -380,126 +373,127 @@ public class EditorRegistry extends EventManager implements IEditorRegistry, IEx
return contentTypeManager.findContentTypeFor(filename);
}
- /**
- * Returns the default file image descriptor.
- *
- * @return the image descriptor
- */
- private ImageDescriptor getDefaultImage() {
- // @issue what should be the default image?
- return WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJ_FILE);
- }
+ /**
+ * Returns the default file image descriptor.
+ *
+ * @return the image descriptor
+ */
+ private ImageDescriptor getDefaultImage() {
+ // @issue what should be the default image?
+ return WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJ_FILE);
+ }
- @Override
+ @Override
public IEditorDescriptor[] getEditors(String filename) {
return getEditors(filename, guessAtContentType(filename));
}
- @Override
+ @Override
public IFileEditorMapping[] getFileEditorMappings() {
- FileEditorMapping[] array = typeEditorMappings.allMappings();
- final Collator collator = Collator.getInstance();
+ FileEditorMapping[] array = typeEditorMappings.allMappings();
+ final Collator collator = Collator.getInstance();
Arrays.sort(array, (o1, o2) -> {
String s1 = o1.getLabel();
String s2 = o2.getLabel();
- return collator.compare(s1, s2);
+ return collator.compare(s1, s2);
});
- return array;
- }
+ return array;
+ }
- @Override
+ @Override
public ImageDescriptor getImageDescriptor(String filename) {
return getImageDescriptor(filename, guessAtContentType(filename));
}
/**
- * Find the file editor mapping for the file extension. Returns
- * <code>null</code> if not found.
- *
- * @param ext
- * the file extension
- * @return the mapping, or <code>null</code>
- */
- private FileEditorMapping getMappingFor(String ext) {
- if (ext == null) {
+ * Find the file editor mapping for the file extension. Returns
+ * <code>null</code> if not found.
+ *
+ * @param ext the file extension
+ * @return the mapping, or <code>null</code>
+ */
+ private FileEditorMapping getMappingFor(String ext) {
+ if (ext == null) {
return null;
}
- String key = mappingKeyFor(ext);
- return typeEditorMappings.get(key);
- }
-
- /**
- * Find the file editor mappings for the given filename.
- * <p>
- * Return an array of two FileEditorMapping items, where the first mapping
- * is for the entire filename, and the second mapping is for the filename's
- * extension only. These items can be null if no mapping exist on the
- * filename and/or filename's extension.</p>
- *
- * @param filename the filename
- * @return the mappings
- */
- private FileEditorMapping[] getMappingForFilename(String filename) {
- FileEditorMapping[] mapping = new FileEditorMapping[2];
-
- // Lookup on entire filename
- mapping[0] = getMappingFor(filename);
-
- // Lookup on filename's extension
- int index = filename.lastIndexOf('.');
- if (index > -1) {
- String extension = filename.substring(index);
- mapping[1] = getMappingFor("*" + extension); //$NON-NLS-1$
- }
-
- return mapping;
- }
-
- /**
- * Return the editor descriptors pulled from the OS.
- * <p>
- * WARNING! The image described by each editor descriptor is *not* known by
- * the workbench's graphic registry. Therefore clients must take care to
- * ensure that if they access any of the images held by these editors that
- * they also dispose them
- * </p>
- * @return the editor descriptors
- */
- public IEditorDescriptor[] getSortedEditorsFromOS() {
+ String key = mappingKeyFor(ext);
+ return typeEditorMappings.get(key);
+ }
+
+ /**
+ * Find the file editor mappings for the given filename.
+ * <p>
+ * Return an array of two FileEditorMapping items, where the first mapping is
+ * for the entire filename, and the second mapping is for the filename's
+ * extension only. These items can be null if no mapping exist on the filename
+ * and/or filename's extension.
+ * </p>
+ *
+ * @param filename the filename
+ * @return the mappings
+ */
+ private FileEditorMapping[] getMappingForFilename(String filename) {
+ FileEditorMapping[] mapping = new FileEditorMapping[2];
+
+ // Lookup on entire filename
+ mapping[0] = getMappingFor(filename);
+
+ // Lookup on filename's extension
+ int index = filename.lastIndexOf('.');
+ if (index > -1) {
+ String extension = filename.substring(index);
+ mapping[1] = getMappingFor("*" + extension); //$NON-NLS-1$
+ }
+
+ return mapping;
+ }
+
+ /**
+ * Return the editor descriptors pulled from the OS.
+ * <p>
+ * WARNING! The image described by each editor descriptor is *not* known by the
+ * workbench's graphic registry. Therefore clients must take care to ensure that
+ * if they access any of the images held by these editors that they also dispose
+ * them
+ * </p>
+ *
+ * @return the editor descriptors
+ */
+ public IEditorDescriptor[] getSortedEditorsFromOS() {
List<IEditorDescriptor> externalEditors = new ArrayList<>();
for (Program program : Program.getPrograms()) {
- //1FPLRL2: ITPUI:WINNT - NOTEPAD editor cannot be launched
- //Some entries start with %SystemRoot%
- //For such cases just use the file name as they are generally
- //in directories which are on the path
- /*
- * if (fileName.charAt(0) == '%') { fileName = name + ".exe"; }
- */
-
- EditorDescriptor editor = new EditorDescriptor();
- editor.setOpenMode(EditorDescriptor.OPEN_EXTERNAL);
- editor.setProgram(program);
-
- // determine the program icon this editor would need (do not let it
- // be cached in the workbench registry)
+ // 1FPLRL2: ITPUI:WINNT - NOTEPAD editor cannot be launched
+ // Some entries start with %SystemRoot%
+ // For such cases just use the file name as they are generally
+ // in directories which are on the path
+ /*
+ * if (fileName.charAt(0) == '%') { fileName = name + ".exe"; }
+ */
+
+ EditorDescriptor editor = new EditorDescriptor();
+ editor.setOpenMode(EditorDescriptor.OPEN_EXTERNAL);
+ editor.setProgram(program);
+
+ // determine the program icon this editor would need (do not let it
+ // be cached in the workbench registry)
ImageDescriptor desc = new ExternalProgramImageDescriptor(program);
- editor.setImageDescriptor(desc);
- externalEditors.add(editor);
- }
+ editor.setImageDescriptor(desc);
+ externalEditors.add(editor);
+ }
- Object[] tempArray = sortEditors(externalEditors);
+ Object[] tempArray = sortEditors(externalEditors);
IEditorDescriptor[] array = new IEditorDescriptor[externalEditors.size()];
- for (int i = 0; i < tempArray.length; i++) {
- array[i] = (IEditorDescriptor) tempArray[i];
- }
- return array;
- }
-
- /**
- * Return the editors loaded from plugins.
- *
- * @return the sorted array of editors declared in plugins
- */
+ for (int i = 0; i < tempArray.length; i++) {
+ array[i] = (IEditorDescriptor) tempArray[i];
+ }
+ return array;
+ }
+
+ /**
+ * Return the editors loaded from plugins.
+ *
+ * @return the sorted array of editors declared in plugins
+ */
public IEditorDescriptor[] getSortedEditorsFromPlugins() {
// see #comparer
Collection<IEditorDescriptor> descs = WorkbenchActivityHelper.restrictCollection(sortedEditorsFromPlugins,
@@ -507,172 +501,159 @@ public class EditorRegistry extends EventManager implements IEditorRegistry, IEx
return descs.toArray(new IEditorDescriptor[descs.size()]);
}
- /**
- * Answer an intial id to editor map. This will create a new map and
- * populate it with the default system editors.
+ /**
+ * Answer an intial id to editor map. This will create a new map and populate it
+ * with the default system editors.
*
- * @param initialSize
- * the initial size of the map
+ * @param initialSize the initial size of the map
* @return the new map
*/
private Map<String, IEditorDescriptor> initialIdToEditorMap(int initialSize) {
- Map<String, IEditorDescriptor> map = new HashMap<>(initialSize);
- addSystemEditors(map);
- return map;
- }
-
- /**
- * Add the system editors to the provided map. This will always add an
- * editor with an id of {@link #SYSTEM_EXTERNAL_EDITOR_ID} and may also add
- * an editor with id of {@link #SYSTEM_INPLACE_EDITOR_ID} if the system
- * configuration supports it.
- *
- * @param map the map to augment
- */
- private void addSystemEditors(Map<String, IEditorDescriptor> map) {
- // there will always be a system external editor descriptor
- EditorDescriptor editor = new EditorDescriptor();
- editor.setID(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID);
- editor.setName(WorkbenchMessages.SystemEditorDescription_name);
- editor.setOpenMode(EditorDescriptor.OPEN_EXTERNAL);
- // @issue we need a real icon for this editor?
- map.put(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID, editor);
-
- // there may be a system in-place editor if supported by platform
- if (ComponentSupport.inPlaceEditorSupported()) {
- editor = new EditorDescriptor();
- editor.setID(IEditorRegistry.SYSTEM_INPLACE_EDITOR_ID);
- editor.setName(WorkbenchMessages.SystemInPlaceDescription_name);
- editor.setOpenMode(EditorDescriptor.OPEN_INPLACE);
- // @issue we need a real icon for this editor?
- map.put(IEditorRegistry.SYSTEM_INPLACE_EDITOR_ID, editor);
- }
+ Map<String, IEditorDescriptor> map = new HashMap<>(initialSize);
+ addSystemEditors(map);
+ return map;
+ }
+
+ /**
+ * Add the system editors to the provided map. This will always add an editor
+ * with an id of {@link #SYSTEM_EXTERNAL_EDITOR_ID} and may also add an editor
+ * with id of {@link #SYSTEM_INPLACE_EDITOR_ID} if the system configuration
+ * supports it.
+ *
+ * @param map the map to augment
+ */
+ private void addSystemEditors(Map<String, IEditorDescriptor> map) {
+ // there will always be a system external editor descriptor
+ EditorDescriptor editor = new EditorDescriptor();
+ editor.setID(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID);
+ editor.setName(WorkbenchMessages.SystemEditorDescription_name);
+ editor.setOpenMode(EditorDescriptor.OPEN_EXTERNAL);
+ // @issue we need a real icon for this editor?
+ map.put(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID, editor);
+
+ // there may be a system in-place editor if supported by platform
+ if (ComponentSupport.inPlaceEditorSupported()) {
+ editor = new EditorDescriptor();
+ editor.setID(IEditorRegistry.SYSTEM_INPLACE_EDITOR_ID);
+ editor.setName(WorkbenchMessages.SystemInPlaceDescription_name);
+ editor.setOpenMode(EditorDescriptor.OPEN_INPLACE);
+ // @issue we need a real icon for this editor?
+ map.put(IEditorRegistry.SYSTEM_INPLACE_EDITOR_ID, editor);
+ }
EditorDescriptor emptyEditorDescriptor = new EditorDescriptor();
emptyEditorDescriptor.setID(EMPTY_EDITOR_ID);
emptyEditorDescriptor.setName("(Empty)"); //$NON-NLS-1$
emptyEditorDescriptor
- .setImageDescriptor(WorkbenchImages
- .getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJ_ELEMENT));
+ .setImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJ_ELEMENT));
map.put(EMPTY_EDITOR_ID, emptyEditorDescriptor);
- }
-
- /**
- * Initialize the registry state from plugin declarations and preference
- * overrides.
- */
- private void initializeFromStorage() {
- typeEditorMappings = new EditorMap();
- extensionImages = new HashMap<>();
-
- //Get editors from the registry
- EditorRegistryReader registryReader = new EditorRegistryReader();
- registryReader.addEditors(this);
- sortInternalEditors();
- rebuildInternalEditorMap();
-
- IPreferenceStore store = PlatformUI.getPreferenceStore();
- String defaultEditors = store
- .getString(IPreferenceConstants.DEFAULT_EDITORS);
- String chachedDefaultEditors = store
- .getString(IPreferenceConstants.DEFAULT_EDITORS_CACHE);
-
- //If defaults has changed load it afterwards so it overrides the users
- // associations.
- if (defaultEditors == null
- || defaultEditors.equals(chachedDefaultEditors)) {
- setProductDefaults(defaultEditors);
- loadAssociations(); //get saved earlier state
- } else {
- loadAssociations(); //get saved earlier state
- setProductDefaults(defaultEditors);
- store.putValue(IPreferenceConstants.DEFAULT_EDITORS_CACHE,
- defaultEditors);
- }
- addExternalEditorsToEditorMap();
- }
-
- /**
- * Set the default editors according to the preference store which can be
- * overwritten in the file properties.ini. In the form:
- * <p>
- * <code>ext1:id1;ext2:id2;...</code>
- * </p>
- *
- * @param defaultEditors the default editors to set
- */
- private void setProductDefaults(String defaultEditors) {
- if (defaultEditors == null || defaultEditors.length() == 0) {
+ }
+
+ /**
+ * Initialize the registry state from plugin declarations and preference
+ * overrides.
+ */
+ private void initializeFromStorage() {
+ typeEditorMappings = new EditorMap();
+ extensionImages = new HashMap<>();
+
+ // Get editors from the registry
+ EditorRegistryReader registryReader = new EditorRegistryReader();
+ registryReader.addEditors(this);
+ sortInternalEditors();
+ rebuildInternalEditorMap();
+
+ IPreferenceStore store = PlatformUI.getPreferenceStore();
+ String defaultEditors = store.getString(IPreferenceConstants.DEFAULT_EDITORS);
+ String chachedDefaultEditors = store.getString(IPreferenceConstants.DEFAULT_EDITORS_CACHE);
+
+ // If defaults has changed load it afterwards so it overrides the users
+ // associations.
+ if (defaultEditors == null || defaultEditors.equals(chachedDefaultEditors)) {
+ setProductDefaults(defaultEditors);
+ loadAssociations(); // get saved earlier state
+ } else {
+ loadAssociations(); // get saved earlier state
+ setProductDefaults(defaultEditors);
+ store.putValue(IPreferenceConstants.DEFAULT_EDITORS_CACHE, defaultEditors);
+ }
+ addExternalEditorsToEditorMap();
+ }
+
+ /**
+ * Set the default editors according to the preference store which can be
+ * overwritten in the file properties.ini. In the form:
+ * <p>
+ * <code>ext1:id1;ext2:id2;...</code>
+ * </p>
+ *
+ * @param defaultEditors the default editors to set
+ */
+ private void setProductDefaults(String defaultEditors) {
+ if (defaultEditors == null || defaultEditors.length() == 0) {
return;
}
- StringTokenizer extEditors = new StringTokenizer(defaultEditors,
+ StringTokenizer extEditors = new StringTokenizer(defaultEditors,
Character.valueOf(IPreferenceConstants.SEPARATOR).toString());
- while (extEditors.hasMoreTokens()) {
- String extEditor = extEditors.nextToken().trim();
- int index = extEditor.indexOf(':');
- if (extEditor.length() < 3 || index <= 0
- || index >= (extEditor.length() - 1)) {
- //Extension and id must have at least one char.
- WorkbenchPlugin
- .log("Error setting default editor. Could not parse '" + extEditor + "'. Default editors should be specified as '*.ext1:editorId1;*.ext2:editorId2'"); //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
- String ext = extEditor.substring(0, index).trim();
- String editorId = extEditor.substring(index + 1).trim();
- FileEditorMapping mapping = getMappingFor(ext);
- if (mapping == null) {
- WorkbenchPlugin
- .log("Error setting default editor. Could not find mapping for '" + ext + "'."); //$NON-NLS-1$ //$NON-NLS-2$
- continue;
- }
+ while (extEditors.hasMoreTokens()) {
+ String extEditor = extEditors.nextToken().trim();
+ int index = extEditor.indexOf(':');
+ if (extEditor.length() < 3 || index <= 0 || index >= (extEditor.length() - 1)) {
+ // Extension and id must have at least one char.
+ WorkbenchPlugin.log("Error setting default editor. Could not parse '" + extEditor //$NON-NLS-1$
+ + "'. Default editors should be specified as '*.ext1:editorId1;*.ext2:editorId2'"); //$NON-NLS-1$
+ return;
+ }
+ String ext = extEditor.substring(0, index).trim();
+ String editorId = extEditor.substring(index + 1).trim();
+ FileEditorMapping mapping = getMappingFor(ext);
+ if (mapping == null) {
+ WorkbenchPlugin.log("Error setting default editor. Could not find mapping for '" + ext + "'."); //$NON-NLS-1$ //$NON-NLS-2$
+ continue;
+ }
IEditorDescriptor editor = findEditor(editorId);
- if (editor == null) {
- WorkbenchPlugin
- .log("Error setting default editor. Could not find editor: '" + editorId + "'."); //$NON-NLS-1$ //$NON-NLS-2$
- continue;
- }
- mapping.setDefaultEditor(editor);
- }
- }
+ if (editor == null) {
+ WorkbenchPlugin.log("Error setting default editor. Could not find editor: '" + editorId + "'."); //$NON-NLS-1$ //$NON-NLS-2$
+ continue;
+ }
+ mapping.setDefaultEditor(editor);
+ }
+ }
/**
* Read the editors defined in the preferences store.
*
- * @param editorTable
- * Editor table to store the editor definitions.
+ * @param editorTable Editor table to store the editor definitions.
* @return true if the table is built succesfully.
*/
private boolean readEditors(Map<String, IEditorDescriptor> editorTable) {
- //Get the workbench plugin's working directory
- IPath workbenchStatePath = WorkbenchPlugin.getDefault().getDataLocation();
- if(workbenchStatePath == null) {
+ // Get the workbench plugin's working directory
+ IPath workbenchStatePath = WorkbenchPlugin.getDefault().getDataLocation();
+ if (workbenchStatePath == null) {
return false;
}
- IPreferenceStore store = WorkbenchPlugin.getDefault()
- .getPreferenceStore();
- Reader reader = null;
- FileInputStream stream = null;
- try {
- // Get the editors defined in the preferences store
- String xmlString = store.getString(IPreferenceConstants.EDITORS);
- if (xmlString == null || xmlString.length() == 0) {
- stream = new FileInputStream(workbenchStatePath
- .append(IWorkbenchConstants.EDITOR_FILE_NAME)
- .toOSString());
- reader = new BufferedReader(new InputStreamReader(stream,
- StandardCharsets.UTF_8));
- } else {
- reader = new StringReader(xmlString);
- }
- XMLMemento memento = XMLMemento.createReadRoot(reader);
- // Get the editors and validate each one
+ IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
+ Reader reader = null;
+ FileInputStream stream = null;
+ try {
+ // Get the editors defined in the preferences store
+ String xmlString = store.getString(IPreferenceConstants.EDITORS);
+ if (xmlString == null || xmlString.length() == 0) {
+ stream = new FileInputStream(
+ workbenchStatePath.append(IWorkbenchConstants.EDITOR_FILE_NAME).toOSString());
+ reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8));
+ } else {
+ reader = new StringReader(xmlString);
+ }
+ XMLMemento memento = XMLMemento.createReadRoot(reader);
+ // Get the editors and validate each one
for (IMemento childMemento : memento.getChildren(IWorkbenchConstants.TAG_DESCRIPTOR)) {
EditorDescriptor editor = new EditorDescriptor();
boolean valid = editor.loadValues(childMemento);
- if (!valid) {
- continue;
- }
+ if (!valid) {
+ continue;
+ }
if (isSystem(editor.getId())) {
// bug 502514: check if there is internal editor
// descriptor (they are always recreated via
@@ -681,13 +662,13 @@ public class EditorRegistry extends EventManager implements IEditorRegistry, IEx
continue;
}
if (editor.getPluginID() != null) {
- //If the editor is from a plugin we use its ID to look it
- // up in the mapping of editors we
- //have obtained from plugins. This allows us to verify that
- // the editor is still valid
- //and allows us to get the editor description from the
- // mapping table which has
- //a valid config element field.
+ // If the editor is from a plugin we use its ID to look it
+ // up in the mapping of editors we
+ // have obtained from plugins. This allows us to verify that
+ // the editor is still valid
+ // and allows us to get the editor description from the
+ // mapping table which has
+ // a valid config element field.
lookupEditorFromTable(editorTable, editor);
continue;
}
@@ -707,15 +688,14 @@ public class EditorRegistry extends EventManager implements IEditorRegistry, IEx
}
editor.setImageDescriptor(descriptor);
editorTable.put(editor.getId(), editor);
- }
- } catch (IOException e) {
- //Ignore this as the workbench may not yet have saved any state
- return false;
- } catch (WorkbenchException e) {
- ErrorDialog.openError((Shell) null, WorkbenchMessages.EditorRegistry_errorTitle,
- WorkbenchMessages.EditorRegistry_errorMessage,
- e.getStatus());
- return false;
+ }
+ } catch (IOException e) {
+ // Ignore this as the workbench may not yet have saved any state
+ return false;
+ } catch (WorkbenchException e) {
+ ErrorDialog.openError((Shell) null, WorkbenchMessages.EditorRegistry_errorTitle,
+ WorkbenchMessages.EditorRegistry_errorMessage, e.getStatus());
+ return false;
} finally {
try {
if (reader != null) {
@@ -725,14 +705,13 @@ public class EditorRegistry extends EventManager implements IEditorRegistry, IEx
} catch (IOException ex) {
WorkbenchPlugin.log("Error reading editors: Could not close steam", ex); //$NON-NLS-1$
}
- }
+ }
- return true;
- }
+ return true;
+ }
- /**
- * @param id
- * descriptor id
+ /**
+ * @param id descriptor id
* @return true if the id is one of the system internal id's:
* {@link IEditorRegistry#SYSTEM_EXTERNAL_EDITOR_ID} or
* {@link IEditorRegistry#SYSTEM_INPLACE_EDITOR_ID}
@@ -749,23 +728,23 @@ public class EditorRegistry extends EventManager implements IEditorRegistry, IEx
}
}
- /**
- * Read the file types and associate them to their defined editor(s).
- *
- * @param editorTable
- * The editor table containing the defined editors.
- * @param reader
- * Reader containing the preferences content for the resources.
- *
- * @throws WorkbenchException
- */
+ /**
+ * Read the file types and associate them to their defined editor(s).
+ *
+ * @param editorTable The editor table containing the defined editors.
+ * @param reader Reader containing the preferences content for the
+ * resources.
+ *
+ * @throws WorkbenchException
+ */
public void readResources(Map<String, IEditorDescriptor> editorTable, Reader reader) throws WorkbenchException {
- XMLMemento memento = XMLMemento.createReadRoot(reader);
- String versionString = memento.getString(IWorkbenchConstants.TAG_VERSION);
- boolean versionIs31 = "3.1".equals(versionString); //$NON-NLS-1$
+ XMLMemento memento = XMLMemento.createReadRoot(reader);
+ String versionString = memento.getString(IWorkbenchConstants.TAG_VERSION);
+ boolean versionIs31 = "3.1".equals(versionString); //$NON-NLS-1$
for (IMemento childMemento : memento.getChildren(IWorkbenchConstants.TAG_INFO)) {
- List<IEditorDescriptor> editors = getEditorDescriptors(childMemento.getChildren(IWorkbenchConstants.TAG_EDITOR), editorTable);
+ List<IEditorDescriptor> editors = getEditorDescriptors(
+ childMemento.getChildren(IWorkbenchConstants.TAG_EDITOR), editorTable);
editors.forEach(editor -> {
if (!mapIDtoEditor.containsKey(editor.getId())) {
mapIDtoEditor.put(editor.getId(), editor);
@@ -792,11 +771,13 @@ public class EditorRegistry extends EventManager implements IEditorRegistry, IEx
mapping = new FileEditorMapping(name, extension);
}
- List<IEditorDescriptor> deletedEditors = getEditorDescriptors(childMemento.getChildren(IWorkbenchConstants.TAG_DELETED_EDITOR), editorTable);
+ List<IEditorDescriptor> deletedEditors = getEditorDescriptors(
+ childMemento.getChildren(IWorkbenchConstants.TAG_DELETED_EDITOR), editorTable);
List<IEditorDescriptor> defaultEditors = null;
if (versionIs31) { // parse the new format
- defaultEditors = getEditorDescriptors(childMemento.getChildren(IWorkbenchConstants.TAG_DEFAULT_EDITOR), editorTable);
+ defaultEditors = getEditorDescriptors(
+ childMemento.getChildren(IWorkbenchConstants.TAG_DEFAULT_EDITOR), editorTable);
} else { // guess at pre 3.1 format defaults
defaultEditors = new ArrayList<>(
(editors.isEmpty() ? 0 : 1) + mapping.getDeclaredDefaultEditors().length);
@@ -821,9 +802,9 @@ public class EditorRegistry extends EventManager implements IEditorRegistry, IEx
typeEditorMappings.put(mappingKeyFor(mapping), mapping);
}
}
- }
+ }
- /**
+ /**
* @param children
* @param editorTable
* @return
@@ -844,150 +825,140 @@ public class EditorRegistry extends EventManager implements IEditorRegistry, IEx
}
/**
- * Determine if the editors list contains the editor descriptor.
- *
- * @param editors
- * The list of editors
- * @param editorDescriptor
- * The editor descriptor
- * @return <code>true</code> if the editors list contains the editor descriptor
- */
- private boolean contains(List<IEditorDescriptor> editors, IEditorDescriptor editorDescriptor) {
- for (IEditorDescriptor currentEditorDescriptor : editors) {
- if (currentEditorDescriptor.getId().equals(editorDescriptor.getId())) {
+ * Determine if the editors list contains the editor descriptor.
+ *
+ * @param editors The list of editors
+ * @param editorDescriptor The editor descriptor
+ * @return <code>true</code> if the editors list contains the editor descriptor
+ */
+ private boolean contains(List<IEditorDescriptor> editors, IEditorDescriptor editorDescriptor) {
+ for (IEditorDescriptor currentEditorDescriptor : editors) {
+ if (currentEditorDescriptor.getId().equals(editorDescriptor.getId())) {
return true;
}
- }
- return false;
- }
-
- /**
- * Creates the reader for the resources preferences defined in the
- * preference store.
- *
- * @param editorTable
- * The editor table containing the defined editors.
- * @return true if the resources are read succesfully.
- */
+ }
+ return false;
+ }
+
+ /**
+ * Creates the reader for the resources preferences defined in the preference
+ * store.
+ *
+ * @param editorTable The editor table containing the defined editors.
+ * @return true if the resources are read succesfully.
+ */
private boolean readResources(Map<String, IEditorDescriptor> editorTable) {
- //Get the workbench plugin's working directory
- IPath workbenchStatePath = WorkbenchPlugin.getDefault().getDataLocation();
- // XXX: nobody cares about this return value
- if(workbenchStatePath == null) {
+ // Get the workbench plugin's working directory
+ IPath workbenchStatePath = WorkbenchPlugin.getDefault().getDataLocation();
+ // XXX: nobody cares about this return value
+ if (workbenchStatePath == null) {
return false;
}
- IPreferenceStore store = WorkbenchPlugin.getDefault()
- .getPreferenceStore();
- Reader reader = null;
- FileInputStream stream = null;
- try {
- // Get the resource types
- String xmlString = store.getString(IPreferenceConstants.RESOURCES);
- if (xmlString == null || xmlString.length() == 0) {
- stream = new FileInputStream(workbenchStatePath
- .append(IWorkbenchConstants.RESOURCE_TYPE_FILE_NAME)
- .toOSString());
- reader = new BufferedReader(new InputStreamReader(stream,
- StandardCharsets.UTF_8));
- } else {
- reader = new StringReader(xmlString);
- }
- // Read the defined resources into the table
- readResources(editorTable, reader);
- } catch (IOException e) {
- MessageDialog.openError((Shell) null, WorkbenchMessages.EditorRegistry_errorTitle,
- WorkbenchMessages.EditorRegistry_errorMessage);
- return false;
- } catch (WorkbenchException e) {
- ErrorDialog.openError((Shell) null, WorkbenchMessages.EditorRegistry_errorTitle,
- WorkbenchMessages.EditorRegistry_errorMessage,
- e.getStatus());
- return false;
- } finally {
- try {
- if (reader != null) {
+ IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
+ Reader reader = null;
+ FileInputStream stream = null;
+ try {
+ // Get the resource types
+ String xmlString = store.getString(IPreferenceConstants.RESOURCES);
+ if (xmlString == null || xmlString.length() == 0) {
+ stream = new FileInputStream(
+ workbenchStatePath.append(IWorkbenchConstants.RESOURCE_TYPE_FILE_NAME).toOSString());
+ reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8));
+ } else {
+ reader = new StringReader(xmlString);
+ }
+ // Read the defined resources into the table
+ readResources(editorTable, reader);
+ } catch (IOException e) {
+ MessageDialog.openError((Shell) null, WorkbenchMessages.EditorRegistry_errorTitle,
+ WorkbenchMessages.EditorRegistry_errorMessage);
+ return false;
+ } catch (WorkbenchException e) {
+ ErrorDialog.openError((Shell) null, WorkbenchMessages.EditorRegistry_errorTitle,
+ WorkbenchMessages.EditorRegistry_errorMessage, e.getStatus());
+ return false;
+ } finally {
+ try {
+ if (reader != null) {
reader.close();
} else if (stream != null) {
- stream.close();
+ stream.close();
}
- } catch (IOException ex) {
+ } catch (IOException ex) {
WorkbenchPlugin.log("Error reading resources: Could not close steam", ex); //$NON-NLS-1$
- }
- }
- return true;
+ }
+ }
+ return true;
- }
+ }
- /**
- * Load the serialized resource associations Return true if the operation
- * was successful, false otherwise
- */
- private boolean loadAssociations() {
+ /**
+ * Load the serialized resource associations Return true if the operation was
+ * successful, false otherwise
+ */
+ private boolean loadAssociations() {
Map<String, IEditorDescriptor> editorTable = new HashMap<>();
- if (!readEditors(editorTable)) {
- return false;
- }
- return readResources(editorTable);
- }
-
- /**
- * Return a friendly version of the given key suitable for use in the editor
- * map.
- */
- private String mappingKeyFor(String type) {
+ if (!readEditors(editorTable)) {
+ return false;
+ }
+ return readResources(editorTable);
+ }
+
+ /**
+ * Return a friendly version of the given key suitable for use in the editor
+ * map.
+ */
+ private String mappingKeyFor(String type) {
// keep everything lower case for case-sensitive platforms
- return type.toLowerCase();
- }
-
- /**
- * Return a key that combines the file's name and extension of the given
- * mapping
- *
- * @param mapping the mapping to generate a key for
- */
- private String mappingKeyFor(FileEditorMapping mapping) {
- return mappingKeyFor(mapping.getName()
- + (mapping.getExtension().length() == 0 ? "" : "." + mapping.getExtension())); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Rebuild the editor map
- */
- private void rebuildEditorMap() {
- rebuildInternalEditorMap();
- addExternalEditorsToEditorMap();
- }
-
- /**
- * Rebuild the internal editor mapping.
- */
- private void rebuildInternalEditorMap() {
- // Allocate a new map.
- mapIDtoEditor = initialIdToEditorMap(mapIDtoEditor.size());
-
- // Add plugin editors.
- for (IEditorDescriptor desc : sortedEditorsFromPlugins) {
- mapIDtoEditor.put(desc.getId(), desc);
- }
- }
-
- @Override
+ return type.toLowerCase();
+ }
+
+ /**
+ * Return a key that combines the file's name and extension of the given mapping
+ *
+ * @param mapping the mapping to generate a key for
+ */
+ private String mappingKeyFor(FileEditorMapping mapping) {
+ return mappingKeyFor(
+ mapping.getName() + (mapping.getExtension().length() == 0 ? "" : "." + mapping.getExtension())); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * Rebuild the editor map
+ */
+ private void rebuildEditorMap() {
+ rebuildInternalEditorMap();
+ addExternalEditorsToEditorMap();
+ }
+
+ /**
+ * Rebuild the internal editor mapping.
+ */
+ private void rebuildInternalEditorMap() {
+ // Allocate a new map.
+ mapIDtoEditor = initialIdToEditorMap(mapIDtoEditor.size());
+
+ // Add plugin editors.
+ for (IEditorDescriptor desc : sortedEditorsFromPlugins) {
+ mapIDtoEditor.put(desc.getId(), desc);
+ }
+ }
+
+ @Override
public void removePropertyListener(IPropertyListener l) {
- removeListenerObject(l);
- }
-
- /**
- * Save the registry to the filesystem by serializing the current resource
- * associations.
- */
- public void saveAssociations() {
- //Save the resource type descriptions
+ removeListenerObject(l);
+ }
+
+ /**
+ * Save the registry to the filesystem by serializing the current resource
+ * associations.
+ */
+ public void saveAssociations() {
+ // Save the resource type descriptions
LinkedHashSet<IEditorDescriptor> editors = new LinkedHashSet<>();
- IPreferenceStore store = WorkbenchPlugin.getDefault()
- .getPreferenceStore();
+ IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
- XMLMemento memento = XMLMemento
- .createWriteRoot(IWorkbenchConstants.TAG_EDITORS);
+ XMLMemento memento = XMLMemento.createWriteRoot(IWorkbenchConstants.TAG_EDITORS);
memento.putString(IWorkbenchConstants.TAG_VERSION, "3.1"); //$NON-NLS-1$
for (FileEditorMapping fileEditorMapping : typeEditorMappings.userMappings()) {
IMemento editorMemento = memento.createChild(IWorkbenchConstants.TAG_INFO);
@@ -1023,7 +994,7 @@ public class EditorRegistry extends EventManager implements IEditorRegistry, IEx
}
for (Entry<IContentType, LinkedHashSet<IEditorDescriptor>> mapping : contentTypeToEditorMappingsFromUser
.entrySet()) {
- IMemento editorMemento = memento.createChild(IWorkbenchConstants.TAG_INFO);
+ IMemento editorMemento = memento.createChild(IWorkbenchConstants.TAG_INFO);
editorMemento.putString(IWorkbenchConstants.TAG_CONTENT_TYPE, mapping.getKey().getId());
for (IEditorDescriptor editor : mapping.getValue()) {
if (editor == null) {
@@ -1032,19 +1003,19 @@ public class EditorRegistry extends EventManager implements IEditorRegistry, IEx
editors.add(editor);
IMemento idMemento = editorMemento.createChild(IWorkbenchConstants.TAG_EDITOR);
idMemento.putString(IWorkbenchConstants.TAG_ID, editor.getId());
- }
- }
+ }
+ }
try (Writer writer = new StringWriter()) {
- memento.save(writer);
- writer.close();
- store.setValue(IPreferenceConstants.RESOURCES, writer.toString());
- } catch (IOException e) {
- MessageDialog.openError((Shell) null, "Saving Problems", //$NON-NLS-1$
- "Unable to save resource associations."); //$NON-NLS-1$
- return;
- }
-
- memento = XMLMemento.createWriteRoot(IWorkbenchConstants.TAG_EDITORS);
+ memento.save(writer);
+ writer.close();
+ store.setValue(IPreferenceConstants.RESOURCES, writer.toString());
+ } catch (IOException e) {
+ MessageDialog.openError((Shell) null, "Saving Problems", //$NON-NLS-1$
+ "Unable to save resource associations."); //$NON-NLS-1$
+ return;
+ }
+
+ memento = XMLMemento.createWriteRoot(IWorkbenchConstants.TAG_EDITORS);
for (IEditorDescriptor editor : editors) {
if (isSystem(editor.getId())) {
// bug 502514: don't persist internal editor descriptors,
@@ -1052,41 +1023,38 @@ public class EditorRegistry extends EventManager implements IEditorRegistry, IEx
// IEditorDescriptor>)
continue;
}
- IMemento editorMemento = memento
- .createChild(IWorkbenchConstants.TAG_DESCRIPTOR);
+ IMemento editorMemento = memento.createChild(IWorkbenchConstants.TAG_DESCRIPTOR);
((EditorDescriptor) editor).saveValues(editorMemento);
- }
+ }
try (Writer writer = new StringWriter()) {
- memento.save(writer);
- writer.close();
- store.setValue(IPreferenceConstants.EDITORS, writer.toString());
- } catch (IOException e) {
- MessageDialog.openError((Shell) null,
- "Error", "Unable to save resource associations."); //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
- }
-
- /**
- * Set the collection of FileEditorMappings. The given collection is
- * converted into the internal hash table for faster lookup Each mapping
- * goes from an extension to the collection of editors that work on it. This
- * operation will rebuild the internal editor mappings.
- *
- * @param newResourceTypes
- * te new file editor mappings.
- */
- public void setFileEditorMappings(FileEditorMapping[] newResourceTypes) {
- typeEditorMappings = new EditorMap();
- for (FileEditorMapping mapping : newResourceTypes) {
- typeEditorMappings.put(mappingKeyFor(mapping), mapping);
- }
- extensionImages = new HashMap<>();
- rebuildEditorMap();
- firePropertyChange(PROP_CONTENTS);
- }
-
- @Override
+ memento.save(writer);
+ writer.close();
+ store.setValue(IPreferenceConstants.EDITORS, writer.toString());
+ } catch (IOException e) {
+ MessageDialog.openError((Shell) null, "Error", "Unable to save resource associations."); //$NON-NLS-1$ //$NON-NLS-2$
+ return;
+ }
+ }
+
+ /**
+ * Set the collection of FileEditorMappings. The given collection is converted
+ * into the internal hash table for faster lookup Each mapping goes from an
+ * extension to the collection of editors that work on it. This operation will
+ * rebuild the internal editor mappings.
+ *
+ * @param newResourceTypes te new file editor mappings.
+ */
+ public void setFileEditorMappings(FileEditorMapping[] newResourceTypes) {
+ typeEditorMappings = new EditorMap();
+ for (FileEditorMapping mapping : newResourceTypes) {
+ typeEditorMappings.put(mappingKeyFor(mapping), mapping);
+ }
+ extensionImages = new HashMap<>();
+ rebuildEditorMap();
+ firePropertyChange(PROP_CONTENTS);
+ }
+
+ @Override
public void setDefaultEditor(String fileName, String editorId) {
IEditorDescriptor desc = findEditor(editorId);
setDefaultEditor(fileName, desc);
@@ -1100,192 +1068,189 @@ public class EditorRegistry extends EventManager implements IEditorRegistry, IEx
if (mapping[1] != null) {
mapping[1].setDefaultEditor(desc);
}
- }
+ }
- /**
- * Alphabetically sort the internal editors.
- *
- * @see #comparer
- */
+ /**
+ * Alphabetically sort the internal editors.
+ *
+ * @see #comparer
+ */
private IEditorDescriptor[] sortEditors(List<IEditorDescriptor> unsortedList) {
IEditorDescriptor[] array = new IEditorDescriptor[unsortedList.size()];
- unsortedList.toArray(array);
-
- Collections.sort(Arrays.asList(array), comparer);
- return array;
- }
-
- /**
- * Alphabetically sort the internal editors.
- *
- * @see #comparer
- */
- private void sortInternalEditors() {
+ unsortedList.toArray(array);
+
+ Collections.sort(Arrays.asList(array), comparer);
+ return array;
+ }
+
+ /**
+ * Alphabetically sort the internal editors.
+ *
+ * @see #comparer
+ */
+ private void sortInternalEditors() {
IEditorDescriptor[] array = sortEditors(sortedEditorsFromPlugins);
sortedEditorsFromPlugins = new ArrayList<>();
- for (IEditorDescriptor element : array) {
- sortedEditorsFromPlugins.add(element);
- }
- }
-
- /**
- * Map of FileEditorMapping (extension to FileEditorMapping) Uses two
- * java.util.HashMap: one keeps the default which are set by the plugins and
- * the other keeps the changes made by the user through the preference page.
- */
- private static class EditorMap {
+ for (IEditorDescriptor element : array) {
+ sortedEditorsFromPlugins.add(element);
+ }
+ }
+
+ /**
+ * Map of FileEditorMapping (extension to FileEditorMapping) Uses two
+ * java.util.HashMap: one keeps the default which are set by the plugins and the
+ * other keeps the changes made by the user through the preference page.
+ */
+ private static class EditorMap {
HashMap<String, FileEditorMapping> defaultMap = new HashMap<>();
HashMap<String, FileEditorMapping> map = new HashMap<>();
- /**
- * Put a default mapping into the editor map.
- *
- * @param key the key to set
- * @param value the value to associate
- */
- public void putDefault(String key, FileEditorMapping value) {
- defaultMap.put(key, value);
- }
-
- /**
- * Put a mapping into the user editor map.
- *
- * @param key the key to set
- * @param value the value to associate
- */
- public void put(String key, FileEditorMapping value) {
- Object result = defaultMap.get(key);
- if (value.equals(result)) {
+ /**
+ * Put a default mapping into the editor map.
+ *
+ * @param key the key to set
+ * @param value the value to associate
+ */
+ public void putDefault(String key, FileEditorMapping value) {
+ defaultMap.put(key, value);
+ }
+
+ /**
+ * Put a mapping into the user editor map.
+ *
+ * @param key the key to set
+ * @param value the value to associate
+ */
+ public void put(String key, FileEditorMapping value) {
+ Object result = defaultMap.get(key);
+ if (value.equals(result)) {
map.remove(key);
} else {
map.put(key, value);
}
- }
-
- /**
- * Return the mapping associated to the key. First searches user
- * map, and then falls back to the default map if there is no match. May
- * return <code>null</code>
- *
- * @param key
- * the key to search for
- * @return the mapping associated to the key or <code>null</code>
- */
- public FileEditorMapping get(String key) {
- Object result = map.get(key);
- if (result == null) {
+ }
+
+ /**
+ * Return the mapping associated to the key. First searches user map, and then
+ * falls back to the default map if there is no match. May return
+ * <code>null</code>
+ *
+ * @param key the key to search for
+ * @return the mapping associated to the key or <code>null</code>
+ */
+ public FileEditorMapping get(String key) {
+ Object result = map.get(key);
+ if (result == null) {
result = defaultMap.get(key);
}
- return (FileEditorMapping) result;
- }
-
- /**
- * Return all mappings. This will return default mappings overlayed with
- * user mappings.
- *
- * @return the mappings
- */
- public FileEditorMapping[] allMappings() {
+ return (FileEditorMapping) result;
+ }
+
+ /**
+ * Return all mappings. This will return default mappings overlayed with user
+ * mappings.
+ *
+ * @return the mappings
+ */
+ public FileEditorMapping[] allMappings() {
@SuppressWarnings("unchecked")
HashMap<String, FileEditorMapping> merge = (HashMap<String, FileEditorMapping>) defaultMap.clone();
- merge.putAll(map);
- Collection<FileEditorMapping> values = merge.values();
- FileEditorMapping result[] = new FileEditorMapping[values.size()];
- return values.toArray(result);
- }
-
- /**
- * Return all user mappings.
- *
- * @return the mappings
- */
- public FileEditorMapping[] userMappings() {
- Collection<FileEditorMapping> values = map.values();
- FileEditorMapping result[] = new FileEditorMapping[values.size()];
- return values.toArray(result);
- }
- }
-
- @Override
+ merge.putAll(map);
+ Collection<FileEditorMapping> values = merge.values();
+ FileEditorMapping result[] = new FileEditorMapping[values.size()];
+ return values.toArray(result);
+ }
+
+ /**
+ * Return all user mappings.
+ *
+ * @return the mappings
+ */
+ public FileEditorMapping[] userMappings() {
+ Collection<FileEditorMapping> values = map.values();
+ FileEditorMapping result[] = new FileEditorMapping[values.size()];
+ return values.toArray(result);
+ }
+ }
+
+ @Override
public boolean isSystemInPlaceEditorAvailable(String filename) {
- return ComponentSupport.inPlaceEditorAvailable(filename);
- }
+ return ComponentSupport.inPlaceEditorAvailable(filename);
+ }
- @Override
+ @Override
public boolean isSystemExternalEditorAvailable(String filename) {
- int nDot = filename.lastIndexOf('.');
- if (nDot >= 0) {
- String strName = filename.substring(nDot);
- return Program.findProgram(strName) != null;
- }
- return false;
- }
-
- @Override
- public ImageDescriptor getSystemExternalEditorImageDescriptor(
- String filename) {
- Program externalProgram = null;
- int extensionIndex = filename.lastIndexOf('.');
- if (extensionIndex >= 0) {
- externalProgram = Program.findProgram(filename
- .substring(extensionIndex));
- }
- if (externalProgram == null) {
- return null;
- }
-
- return new ExternalProgramImageDescriptor(externalProgram);
- }
-
- /**
- * Removes the entry with the value of the editor descriptor from the given
- * map. If the descriptor is the last descriptor in a given
- * FileEditorMapping then the mapping is removed from the map.
- *
- * @param map
- * the map to search
- * @param desc
- * the descriptor value to remove
- */
- private void removeEditorFromMapping(HashMap<String, FileEditorMapping> map, IEditorDescriptor desc) {
- Iterator<FileEditorMapping> iter = map.values().iterator();
+ int nDot = filename.lastIndexOf('.');
+ if (nDot >= 0) {
+ String strName = filename.substring(nDot);
+ return Program.findProgram(strName) != null;
+ }
+ return false;
+ }
+
+ @Override
+ public ImageDescriptor getSystemExternalEditorImageDescriptor(String filename) {
+ Program externalProgram = null;
+ int extensionIndex = filename.lastIndexOf('.');
+ if (extensionIndex >= 0) {
+ externalProgram = Program.findProgram(filename.substring(extensionIndex));
+ }
+ if (externalProgram == null) {
+ return null;
+ }
+
+ return new ExternalProgramImageDescriptor(externalProgram);
+ }
+
+ /**
+ * Removes the entry with the value of the editor descriptor from the given map.
+ * If the descriptor is the last descriptor in a given FileEditorMapping then
+ * the mapping is removed from the map.
+ *
+ * @param map the map to search
+ * @param desc the descriptor value to remove
+ */
+ private void removeEditorFromMapping(HashMap<String, FileEditorMapping> map, IEditorDescriptor desc) {
+ Iterator<FileEditorMapping> iter = map.values().iterator();
while (iter.hasNext()) {
- FileEditorMapping mapping = iter.next();
+ FileEditorMapping mapping = iter.next();
for (IEditorDescriptor editor : mapping.getUnfilteredEditors()) {
if (editor == desc) {
mapping.removeEditor(editor);
- break;
- }
+ break;
+ }
}
IEditorDescriptor[] editors = mapping.getUnfilteredEditors();
if (editors.length == 0) {
iter.remove();
- }
- }
- }
+ }
+ }
+ }
- @Override
+ @Override
public void removeExtension(IExtension source, Object[] objects) {
- for (Object object : objects) {
+ for (Object object : objects) {
if (object instanceof IEditorDescriptor) {
IEditorDescriptor desc = (IEditorDescriptor) object;
- sortedEditorsFromPlugins.remove(desc);
- mapIDtoEditor.values().remove(desc);
- removeEditorFromMapping(typeEditorMappings.defaultMap, desc);
- removeEditorFromMapping(typeEditorMappings.map, desc);
+ sortedEditorsFromPlugins.remove(desc);
+ mapIDtoEditor.values().remove(desc);
+ removeEditorFromMapping(typeEditorMappings.defaultMap, desc);
+ removeEditorFromMapping(typeEditorMappings.map, desc);
removeEditorFromContentTypeMappings(contentTypeToEditorMappingsFromPlugins, desc);
- }
+ }
- }
- }
+ }
+ }
- /**
- * Removes all occurrences of the given editor descriptor from the map of content types.
- * If the descriptor was the only editor, the whole content type is removed from the map.
- */
- private void removeEditorFromContentTypeMappings(Map<IContentType, IEditorDescriptor[]> map, IEditorDescriptor desc) {
+ /**
+ * Removes all occurrences of the given editor descriptor from the map of
+ * content types. If the descriptor was the only editor, the whole content type
+ * is removed from the map.
+ */
+ private void removeEditorFromContentTypeMappings(Map<IContentType, IEditorDescriptor[]> map,
+ IEditorDescriptor desc) {
for (Iterator<Entry<IContentType, IEditorDescriptor[]>> iter = map.entrySet().iterator(); iter.hasNext();) {
Entry<IContentType, IEditorDescriptor[]> entry = iter.next();
IEditorDescriptor[] descriptors = entry.getValue();
@@ -1301,10 +1266,10 @@ public class EditorRegistry extends EventManager implements IEditorRegistry, IEx
}
/**
- * Checks the given IEditorDescriptor for an occurrence of the given descriptor and
- * returns an array not containing this descriptor.
- * If the result would then be an empty array, <code>null</code> is returned.
- * If the descriptor is not contained at all in the given array, it is returned as is.
+ * Checks the given IEditorDescriptor for an occurrence of the given descriptor
+ * and returns an array not containing this descriptor. If the result would then
+ * be an empty array, <code>null</code> is returned. If the descriptor is not
+ * contained at all in the given array, it is returned as is.
*/
private IEditorDescriptor[] removeDescriptor(IEditorDescriptor[] descriptors, IEditorDescriptor desc) {
for (int i = 0; i < descriptors.length; i++) {
@@ -1332,36 +1297,36 @@ public class EditorRegistry extends EventManager implements IEditorRegistry, IEx
@Override
public void addExtension(IExtensionTracker tracker, IExtension extension) {
- EditorRegistryReader eReader = new EditorRegistryReader();
- IConfigurationElement[] elements = extension.getConfigurationElements();
- for (IConfigurationElement element : elements) {
- String id = element.getAttribute(IWorkbenchConstants.TAG_ID);
- if (id != null && findEditor(id) != null) {
+ EditorRegistryReader eReader = new EditorRegistryReader();
+ IConfigurationElement[] elements = extension.getConfigurationElements();
+ for (IConfigurationElement element : elements) {
+ String id = element.getAttribute(IWorkbenchConstants.TAG_ID);
+ if (id != null && findEditor(id) != null) {
continue;
}
- eReader.readElement(this, element);
- }
+ eReader.readElement(this, element);
+ }
}
private IExtensionPoint getExtensionPointFilter() {
- return Platform.getExtensionRegistry().getExtensionPoint(PlatformUI.PLUGIN_ID, IWorkbenchRegistryConstants.PL_EDITOR);
+ return Platform.getExtensionRegistry().getExtensionPoint(PlatformUI.PLUGIN_ID,
+ IWorkbenchRegistryConstants.PL_EDITOR);
}
@Override
public IEditorDescriptor getDefaultEditor(String fileName, IContentType contentType) {
- return getEditorForContentType(fileName, contentType);
+ return getEditorForContentType(fileName, contentType);
}
/**
* Return the editor for a file with a given content type.
*
- * @param filename the file name
+ * @param filename the file name
* @param contentType the content type
* @return the editor for a file with a given content type
* @since 3.1
*/
- private IEditorDescriptor getEditorForContentType(String filename,
- IContentType contentType) {
+ private IEditorDescriptor getEditorForContentType(String filename, IContentType contentType) {
IEditorDescriptor desc = null;
Object[] contentTypeResults = findRelatedObjects(contentType, filename, relatedRegistry);
if (contentTypeResults != null && contentTypeResults.length > 0) {
@@ -1377,7 +1342,7 @@ public class EditorRegistry extends EventManager implements IEditorRegistry, IEx
@Override
public ImageDescriptor getImageDescriptor(String filename, IContentType contentType) {
- if (filename == null) {
+ if (filename == null) {
return getDefaultImage();
}
@@ -1393,45 +1358,45 @@ public class EditorRegistry extends EventManager implements IEditorRegistry, IEx
return anImage;
}
}
- // Lookup in the cache first...
- String key = mappingKeyFor(filename);
- ImageDescriptor anImage = extensionImages.get(key);
- if (anImage != null) {
+ // Lookup in the cache first...
+ String key = mappingKeyFor(filename);
+ ImageDescriptor anImage = extensionImages.get(key);
+ if (anImage != null) {
return anImage;
}
- // See if we have a mapping for the filename or extension
- FileEditorMapping[] mapping = getMappingForFilename(filename);
- for (int i = 0; i < 2; i++) {
- if (mapping[i] != null) {
- // Lookup in the cache first...
- String mappingKey = mappingKeyFor(mapping[i]);
- ImageDescriptor mappingImage = extensionImages.get(key);
- if (mappingImage != null) {
+ // See if we have a mapping for the filename or extension
+ FileEditorMapping[] mapping = getMappingForFilename(filename);
+ for (int i = 0; i < 2; i++) {
+ if (mapping[i] != null) {
+ // Lookup in the cache first...
+ String mappingKey = mappingKeyFor(mapping[i]);
+ ImageDescriptor mappingImage = extensionImages.get(key);
+ if (mappingImage != null) {
+ return mappingImage;
+ }
+ // Create it and cache it
+ IEditorDescriptor editor = mapping[i].getDefaultEditor();
+ if (editor != null) {
+ mappingImage = editor.getImageDescriptor();
+ extensionImages.put(mappingKey, mappingImage);
return mappingImage;
}
- // Create it and cache it
- IEditorDescriptor editor = mapping[i].getDefaultEditor();
- if (editor != null) {
- mappingImage = editor.getImageDescriptor();
- extensionImages.put(mappingKey, mappingImage);
- return mappingImage;
- }
- }
- }
-
- // Nothing - time to look externally for the icon
- anImage = getSystemExternalEditorImageDescriptor(filename);
- if (anImage == null) {
+ }
+ }
+
+ // Nothing - time to look externally for the icon
+ anImage = getSystemExternalEditorImageDescriptor(filename);
+ if (anImage == null) {
anImage = getDefaultImage();
}
- // for dynamic UI - comment out the next line
- //extensionImages.put(key, anImage);
- return anImage;
+ // for dynamic UI - comment out the next line
+ // extensionImages.put(key, anImage);
+ return anImage;
}
- /**
+ /**
* Find objects related to the content type.
*
* This method is temporary and exists only to back us off of the
@@ -1442,8 +1407,7 @@ public class EditorRegistry extends EventManager implements IEditorRegistry, IEx
* @param registry
* @return the related objects
*/
- private IEditorDescriptor [] findRelatedObjects(IContentType type, String fileName,
- RelatedRegistry registry) {
+ private IEditorDescriptor[] findRelatedObjects(IContentType type, String fileName, RelatedRegistry registry) {
List<IEditorDescriptor> allRelated = new ArrayList<>();
List<IEditorDescriptor> nonDefaultFileEditors = new ArrayList<>();
@@ -1526,7 +1490,7 @@ public class EditorRegistry extends EventManager implements IEditorRegistry, IEx
}
}
- return allRelated.toArray(new IEditorDescriptor [allRelated.size()]);
+ return allRelated.toArray(new IEditorDescriptor[allRelated.size()]);
}
/**
@@ -1535,13 +1499,13 @@ public class EditorRegistry extends EventManager implements IEditorRegistry, IEx
* @param type the content type to check
* @return the editors
* @since 3.1
- *
- * TODO: this should be rolled in with the above findRelatedObjects code
+ *
+ * TODO: this should be rolled in with the above findRelatedObjects code
*/
- public IEditorDescriptor [] getEditorsForContentType(IContentType type) {
+ public IEditorDescriptor[] getEditorsForContentType(IContentType type) {
List<IEditorDescriptor> allRelated = new ArrayList<>();
if (type == null) {
- return new IEditorDescriptor [0];
+ return new IEditorDescriptor[0];
}
IEditorDescriptor[] related = relatedRegistry.getRelatedObjects(type);
@@ -1580,12 +1544,11 @@ public class EditorRegistry extends EventManager implements IEditorRegistry, IEx
* @return the file types
* @since 3.1
*/
- public IFileEditorMapping [] getUnifiedMappings() {
- IFileEditorMapping[] standardMappings = PlatformUI.getWorkbench()
- .getEditorRegistry().getFileEditorMappings();
+ public IFileEditorMapping[] getUnifiedMappings() {
+ IFileEditorMapping[] standardMappings = PlatformUI.getWorkbench().getEditorRegistry().getFileEditorMappings();
- List<IFileEditorMapping> allMappings = new ArrayList<>(Arrays.asList(standardMappings));
- // mock-up content type extensions into IFileEditorMappings
+ List<IFileEditorMapping> allMappings = new ArrayList<>(Arrays.asList(standardMappings));
+ // mock-up content type extensions into IFileEditorMappings
for (IContentType type : contentTypeManager.getAllContentTypes()) {
for (String extension : type.getFileSpecs(IContentType.FILE_EXTENSION_SPEC)) {
boolean found = false;
@@ -1620,7 +1583,7 @@ public class EditorRegistry extends EventManager implements IEditorRegistry, IEx
}
}
- return allMappings.toArray(new IFileEditorMapping [allMappings.size()]);
+ return allMappings.toArray(new IFileEditorMapping[allMappings.size()]);
}
/**
@@ -1662,7 +1625,6 @@ public class EditorRegistry extends EventManager implements IEditorRegistry, IEx
}
-
class MockMapping implements IFileEditorMapping {
private IContentType contentType;
@@ -1677,11 +1639,9 @@ class MockMapping implements IFileEditorMapping {
@Override
public IEditorDescriptor getDefaultEditor() {
- IEditorDescriptor[] candidates = ((EditorRegistry) PlatformUI
- .getWorkbench().getEditorRegistry())
+ IEditorDescriptor[] candidates = ((EditorRegistry) PlatformUI.getWorkbench().getEditorRegistry())
.getEditorsForContentType(contentType);
- if (candidates.length == 0
- || WorkbenchActivityHelper.restrictUseOf(candidates[0])) {
+ if (candidates.length == 0 || WorkbenchActivityHelper.restrictUseOf(candidates[0])) {
return null;
}
return candidates[0];
@@ -1689,11 +1649,9 @@ class MockMapping implements IFileEditorMapping {
@Override
public IEditorDescriptor[] getEditors() {
- IEditorDescriptor[] editorsForContentType = ((EditorRegistry) PlatformUI
- .getWorkbench().getEditorRegistry())
+ IEditorDescriptor[] editorsForContentType = ((EditorRegistry) PlatformUI.getWorkbench().getEditorRegistry())
.getEditorsForContentType(contentType);
- return (IEditorDescriptor[]) WorkbenchActivityHelper
- .restrictArray(editorsForContentType);
+ return (IEditorDescriptor[]) WorkbenchActivityHelper.restrictArray(editorsForContentType);
}
@Override
@@ -1710,8 +1668,7 @@ class MockMapping implements IFileEditorMapping {
public ImageDescriptor getImageDescriptor() {
IEditorDescriptor editor = getDefaultEditor();
if (editor == null) {
- return WorkbenchImages
- .getImageDescriptor(ISharedImages.IMG_OBJ_FILE);
+ return WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJ_FILE);
}
return editor.getImageDescriptor();
@@ -1725,7 +1682,7 @@ class MockMapping implements IFileEditorMapping {
@Override
public String getName() {
return filename;
- }
+ }
@Override
public boolean equals(Object obj) {
@@ -1749,8 +1706,6 @@ class MockMapping implements IFileEditorMapping {
if (!Util.equals(this.getEditors(), mapping.getEditors())) {
return false;
}
- return Util.equals(this.getDeletedEditors(), mapping
- .getDeletedEditors());
+ return Util.equals(this.getDeletedEditors(), mapping.getDeletedEditors());
}
}
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/EditorRegistryReader.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/EditorRegistryReader.java
index 261db8add2b..579e682004f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/EditorRegistryReader.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/EditorRegistryReader.java
@@ -24,34 +24,32 @@ import org.eclipse.ui.IEditorDescriptor;
import org.eclipse.ui.PlatformUI;
/**
- * This class is used to read resource editor registry descriptors from
- * the platform registry.
+ * This class is used to read resource editor registry descriptors from the
+ * platform registry.
*/
public class EditorRegistryReader extends RegistryReader {
- private EditorRegistry editorRegistry;
-
- /**
- * Get the editors that are defined in the registry
- * and add them to the ResourceEditorRegistry
- *
- * Warning:
- * The registry must be passed in because this method is called during the
- * process of setting up the registry and at this time it has not been
- * safely setup with the plugin.
- */
- protected void addEditors(EditorRegistry registry) {
- IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
- this.editorRegistry = registry;
- readRegistry(extensionRegistry, PlatformUI.PLUGIN_ID,
- IWorkbenchRegistryConstants.PL_EDITOR);
- }
-
- /**
- * Implementation of the abstract method that
- * processes one configuration element.
- */
- @Override
+ private EditorRegistry editorRegistry;
+
+ /**
+ * Get the editors that are defined in the registry and add them to the
+ * ResourceEditorRegistry
+ *
+ * Warning: The registry must be passed in because this method is called during
+ * the process of setting up the registry and at this time it has not been
+ * safely setup with the plugin.
+ */
+ protected void addEditors(EditorRegistry registry) {
+ IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
+ this.editorRegistry = registry;
+ readRegistry(extensionRegistry, PlatformUI.PLUGIN_ID, IWorkbenchRegistryConstants.PL_EDITOR);
+ }
+
+ /**
+ * Implementation of the abstract method that processes one configuration
+ * element.
+ */
+ @Override
protected boolean readElement(IConfigurationElement element) {
if (element.getName().equals(IWorkbenchRegistryConstants.TAG_EDITOR)) {
return readEditorElement(element);
@@ -60,7 +58,7 @@ public class EditorRegistryReader extends RegistryReader {
return readEditorContentTypeBinding(element);
}
return false;
- }
+ }
/**
* @param element
@@ -97,43 +95,41 @@ public class EditorRegistryReader extends RegistryReader {
private boolean readEditorElement(IConfigurationElement element) {
String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
- if (id == null) {
- logMissingAttribute(element, IWorkbenchRegistryConstants.ATT_ID);
- return true;
- }
+ if (id == null) {
+ logMissingAttribute(element, IWorkbenchRegistryConstants.ATT_ID);
+ return true;
+ }
- EditorDescriptor editor = new EditorDescriptor(id, element);
+ EditorDescriptor editor = new EditorDescriptor(id, element);
- List extensionsVector = new ArrayList();
- List filenamesVector = new ArrayList();
+ List extensionsVector = new ArrayList();
+ List filenamesVector = new ArrayList();
List contentTypeVector = new ArrayList();
- boolean defaultEditor = false;
-
- // Get editor name (required field).
- if (element.getAttribute(IWorkbenchRegistryConstants.ATT_NAME) == null) {
- logMissingAttribute(element, IWorkbenchRegistryConstants.ATT_NAME);
- return true;
- }
-
- // Get target extensions (optional field)
- String extensionsString = element.getAttribute(IWorkbenchRegistryConstants.ATT_EXTENSIONS);
- if (extensionsString != null) {
- StringTokenizer tokenizer = new StringTokenizer(extensionsString,
- ",");//$NON-NLS-1$
- while (tokenizer.hasMoreTokens()) {
- extensionsVector.add(tokenizer.nextToken().trim());
- }
- }
- String filenamesString = element.getAttribute(IWorkbenchRegistryConstants.ATT_FILENAMES);
- if (filenamesString != null) {
- StringTokenizer tokenizer = new StringTokenizer(filenamesString,
- ",");//$NON-NLS-1$
- while (tokenizer.hasMoreTokens()) {
- filenamesVector.add(tokenizer.nextToken().trim());
- }
- }
-
- IConfigurationElement [] bindings = element.getChildren(IWorkbenchRegistryConstants.TAG_CONTENT_TYPE_BINDING);
+ boolean defaultEditor = false;
+
+ // Get editor name (required field).
+ if (element.getAttribute(IWorkbenchRegistryConstants.ATT_NAME) == null) {
+ logMissingAttribute(element, IWorkbenchRegistryConstants.ATT_NAME);
+ return true;
+ }
+
+ // Get target extensions (optional field)
+ String extensionsString = element.getAttribute(IWorkbenchRegistryConstants.ATT_EXTENSIONS);
+ if (extensionsString != null) {
+ StringTokenizer tokenizer = new StringTokenizer(extensionsString, ",");//$NON-NLS-1$
+ while (tokenizer.hasMoreTokens()) {
+ extensionsVector.add(tokenizer.nextToken().trim());
+ }
+ }
+ String filenamesString = element.getAttribute(IWorkbenchRegistryConstants.ATT_FILENAMES);
+ if (filenamesString != null) {
+ StringTokenizer tokenizer = new StringTokenizer(filenamesString, ",");//$NON-NLS-1$
+ while (tokenizer.hasMoreTokens()) {
+ filenamesVector.add(tokenizer.nextToken().trim());
+ }
+ }
+
+ IConfigurationElement[] bindings = element.getChildren(IWorkbenchRegistryConstants.TAG_CONTENT_TYPE_BINDING);
for (IConfigurationElement binding : bindings) {
String contentTypeId = binding.getAttribute(IWorkbenchRegistryConstants.ATT_CONTENT_TYPE_ID);
if (contentTypeId == null) {
@@ -142,26 +138,23 @@ public class EditorRegistryReader extends RegistryReader {
contentTypeVector.add(contentTypeId);
}
- // Is this the default editor?
- String def = element.getAttribute(IWorkbenchRegistryConstants.ATT_DEFAULT);
- if (def != null) {
+ // Is this the default editor?
+ String def = element.getAttribute(IWorkbenchRegistryConstants.ATT_DEFAULT);
+ if (def != null) {
defaultEditor = Boolean.parseBoolean(def);
}
- // Add the editor to the manager.
- editorRegistry.addEditorFromPlugin(editor, extensionsVector,
- filenamesVector, contentTypeVector, defaultEditor);
- return true;
+ // Add the editor to the manager.
+ editorRegistry.addEditorFromPlugin(editor, extensionsVector, filenamesVector, contentTypeVector, defaultEditor);
+ return true;
}
-
- /**
- * @param editorRegistry
- * @param element
- */
- public void readElement(EditorRegistry editorRegistry,
- IConfigurationElement element) {
- this.editorRegistry = editorRegistry;
- readElement(element);
- }
+ /**
+ * @param editorRegistry
+ * @param element
+ */
+ public void readElement(EditorRegistry editorRegistry, IConfigurationElement element) {
+ this.editorRegistry = editorRegistry;
+ readElement(element);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/FileEditorMapping.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/FileEditorMapping.java
index f852921b11e..56fb365b9fb 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/FileEditorMapping.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/FileEditorMapping.java
@@ -32,134 +32,131 @@ import org.eclipse.ui.internal.WorkbenchImages;
* Implementation of IFileEditorMapping.
*
*/
-public class FileEditorMapping extends Object implements IFileEditorMapping,
- Cloneable {
+public class FileEditorMapping extends Object implements IFileEditorMapping, Cloneable {
private static final String STAR = "*"; //$NON-NLS-1$
- private static final String DOT = "."; //$NON-NLS-1$
+ private static final String DOT = "."; //$NON-NLS-1$
- private String name = STAR;
+ private String name = STAR;
- private String extension;
+ private String extension;
- // Collection of EditorDescriptor, where the first one
- // if considered the default one.
+ // Collection of EditorDescriptor, where the first one
+ // if considered the default one.
private List<IEditorDescriptor> editors = new ArrayList<>(1);
private List<IEditorDescriptor> deletedEditors = new ArrayList<>(1);
private List<IEditorDescriptor> declaredDefaultEditors = new ArrayList<>(1);
- /**
- * Create an instance of this class.
- *
- * @param extension java.lang.String
- */
- public FileEditorMapping(String extension) {
- this(STAR, extension);
- }
-
- /**
- * Create an instance of this class.
- *
- * @param name java.lang.String
- * @param extension java.lang.String
- */
- public FileEditorMapping(String name, String extension) {
- super();
- if (name == null || name.length() < 1) {
- setName(STAR);
- } else {
+ /**
+ * Create an instance of this class.
+ *
+ * @param extension java.lang.String
+ */
+ public FileEditorMapping(String extension) {
+ this(STAR, extension);
+ }
+
+ /**
+ * Create an instance of this class.
+ *
+ * @param name java.lang.String
+ * @param extension java.lang.String
+ */
+ public FileEditorMapping(String name, String extension) {
+ super();
+ if (name == null || name.length() < 1) {
+ setName(STAR);
+ } else {
setName(name);
}
- if (extension == null) {
+ if (extension == null) {
setExtension("");//$NON-NLS-1$
} else {
setExtension(extension);
}
- }
+ }
- /**
- * Add the given editor to the list of editors registered.
- *
- * @param editor the editor to add
- */
+ /**
+ * Add the given editor to the list of editors registered.
+ *
+ * @param editor the editor to add
+ */
public void addEditor(EditorDescriptor editor) {
Assert.isNotNull(editor);
- editors.add(editor);
- deletedEditors.remove(editor);
- }
+ editors.add(editor);
+ deletedEditors.remove(editor);
+ }
- /**
- * Clone the receiver.
- */
+ /**
+ * Clone the receiver.
+ */
@SuppressWarnings("unchecked")
@Override
public Object clone() {
- try {
- FileEditorMapping clone = (FileEditorMapping) super.clone();
+ try {
+ FileEditorMapping clone = (FileEditorMapping) super.clone();
clone.editors = (List<IEditorDescriptor>) ((ArrayList<IEditorDescriptor>) editors).clone();
clone.deletedEditors = (List<IEditorDescriptor>) ((ArrayList<IEditorDescriptor>) deletedEditors).clone();
clone.declaredDefaultEditors = (List<IEditorDescriptor>) ((ArrayList<IEditorDescriptor>) declaredDefaultEditors)
.clone();
- return clone;
- } catch (CloneNotSupportedException e) {
- return null;
- }
- }
+ return clone;
+ } catch (CloneNotSupportedException e) {
+ return null;
+ }
+ }
- @Override
+ @Override
public boolean equals(Object obj) {
- if (this == obj) {
+ if (this == obj) {
return true;
}
- if (!(obj instanceof FileEditorMapping)) {
+ if (!(obj instanceof FileEditorMapping)) {
return false;
}
- FileEditorMapping mapping = (FileEditorMapping) obj;
- if (!this.name.equals(mapping.name)) {
+ FileEditorMapping mapping = (FileEditorMapping) obj;
+ if (!this.name.equals(mapping.name)) {
return false;
}
- if (!this.extension.equals(mapping.extension)) {
+ if (!this.extension.equals(mapping.extension)) {
return false;
}
- if (!compareList(this.editors, mapping.editors)) {
+ if (!compareList(this.editors, mapping.editors)) {
return false;
}
if (!compareList(this.declaredDefaultEditors, mapping.declaredDefaultEditors)) {
return false;
}
- return compareList(this.deletedEditors, mapping.deletedEditors);
- }
+ return compareList(this.deletedEditors, mapping.deletedEditors);
+ }
- /**
- * Compare the editor ids from both lists and return true if they
- * are equals.
- */
+ /**
+ * Compare the editor ids from both lists and return true if they are equals.
+ */
private boolean compareList(List<IEditorDescriptor> l1, List<IEditorDescriptor> l2) {
- if (l1.size() != l2.size()) {
+ if (l1.size() != l2.size()) {
return false;
}
Iterator<IEditorDescriptor> i1 = l1.iterator();
Iterator<IEditorDescriptor> i2 = l2.iterator();
- while (i1.hasNext() && i2.hasNext()) {
- Object o1 = i1.next();
- Object o2 = i2.next();
- if (!(o1 == null ? o2 == null : o1.equals(o2))) {
+ while (i1.hasNext() && i2.hasNext()) {
+ Object o1 = i1.next();
+ Object o2 = i2.next();
+ if (!(o1 == null ? o2 == null : o1.equals(o2))) {
return false;
}
- }
- return true;
- }
+ }
+ return true;
+ }
- @Override
+ @Override
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result
- + ((declaredDefaultEditors == null) ? 0 : declaredDefaultEditors.hashCode());
+ result = prime * result + ((declaredDefaultEditors == null) ? 0 : declaredDefaultEditors.hashCode());
result = prime * result + ((deletedEditors == null) ? 0 : deletedEditors.hashCode());
result = prime * result + ((editors == null) ? 0 : editors.hashCode());
result = prime * result + ((extension == null) ? 0 : extension.hashCode());
@@ -167,156 +164,151 @@ public class FileEditorMapping extends Object implements IFileEditorMapping,
return result;
}
- @Override
+ @Override
public IEditorDescriptor getDefaultEditor() {
- if (editors.isEmpty() || WorkbenchActivityHelper.restrictUseOf(editors.get(0))) {
+ if (editors.isEmpty() || WorkbenchActivityHelper.restrictUseOf(editors.get(0))) {
return null;
}
- return editors.get(0);
- }
+ return editors.get(0);
+ }
- /**
- * Returns all editor descriptors of this mapping, not filtered by activities.
- */
- IEditorDescriptor[] getUnfilteredEditors() {
- return editors.toArray(new IEditorDescriptor[editors.size()]);
- }
+ /**
+ * Returns all editor descriptors of this mapping, not filtered by activities.
+ */
+ IEditorDescriptor[] getUnfilteredEditors() {
+ return editors.toArray(new IEditorDescriptor[editors.size()]);
+ }
- @Override
+ @Override
public IEditorDescriptor[] getEditors() {
Collection<IEditorDescriptor> descs = WorkbenchActivityHelper.restrictCollection(editors, new ArrayList<>());
return descs.toArray(new IEditorDescriptor[descs.size()]);
- }
+ }
- @Override
+ @Override
public IEditorDescriptor[] getDeletedEditors() {
- IEditorDescriptor[] array = new IEditorDescriptor[deletedEditors.size()];
- deletedEditors.toArray(array);
- return array;
- }
+ IEditorDescriptor[] array = new IEditorDescriptor[deletedEditors.size()];
+ deletedEditors.toArray(array);
+ return array;
+ }
- @Override
+ @Override
public String getExtension() {
- return extension;
- }
+ return extension;
+ }
- @Override
+ @Override
public ImageDescriptor getImageDescriptor() {
- IEditorDescriptor editor = getDefaultEditor();
- if (editor == null) {
- return WorkbenchImages
- .getImageDescriptor(ISharedImages.IMG_OBJ_FILE);
- }
- return editor.getImageDescriptor();
- }
-
- @Override
+ IEditorDescriptor editor = getDefaultEditor();
+ if (editor == null) {
+ return WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJ_FILE);
+ }
+ return editor.getImageDescriptor();
+ }
+
+ @Override
public String getLabel() {
- return TextProcessor.process(name + (extension.length() == 0 ? "" : DOT + extension), STAR + DOT); //$NON-NLS-1$
- }
+ return TextProcessor.process(name + (extension.length() == 0 ? "" : DOT + extension), STAR + DOT); //$NON-NLS-1$
+ }
- @Override
+ @Override
public String getName() {
- return name;
- }
-
- /**
- * Remove the given editor from the set of editors registered.
- *
- * @param editor the editor to remove
- */
+ return name;
+ }
+
+ /**
+ * Remove the given editor from the set of editors registered.
+ *
+ * @param editor the editor to remove
+ */
public void removeEditor(IEditorDescriptor editor) {
Assert.isNotNull(editor);
- editors.remove(editor);
- deletedEditors.add(editor);
- declaredDefaultEditors.remove(editor);
- }
-
- /**
- * Set the default editor registered for file type
- * described by this mapping.
- *
- * @param editor the editor to be set as default
- */
+ editors.remove(editor);
+ deletedEditors.add(editor);
+ declaredDefaultEditors.remove(editor);
+ }
+
+ /**
+ * Set the default editor registered for file type described by this mapping.
+ *
+ * @param editor the editor to be set as default
+ */
public void setDefaultEditor(IEditorDescriptor editor) {
Assert.isNotNull(editor);
- editors.remove(editor);
- editors.add(0, editor);
- declaredDefaultEditors.remove(editor);
- declaredDefaultEditors.add(0, editor);
- }
-
- /**
- * Set the collection of all editors (EditorDescriptor)
- * registered for the file type described by this mapping.
- * Typically an editor is registered either through a plugin or explicitly by
- * the user modifying the associations in the preference pages.
- * This modifies the internal list to share the passed list.
- * (hence the clear indication of list in the method name)
- *
- * @param newEditors the new list of associated editors
- */
+ editors.remove(editor);
+ editors.add(0, editor);
+ declaredDefaultEditors.remove(editor);
+ declaredDefaultEditors.add(0, editor);
+ }
+
+ /**
+ * Set the collection of all editors (EditorDescriptor) registered for the file
+ * type described by this mapping. Typically an editor is registered either
+ * through a plugin or explicitly by the user modifying the associations in the
+ * preference pages. This modifies the internal list to share the passed list.
+ * (hence the clear indication of list in the method name)
+ *
+ * @param newEditors the new list of associated editors
+ */
public void setEditorsList(List<IEditorDescriptor> newEditors) {
- editors = newEditors;
- declaredDefaultEditors.retainAll(newEditors);
- }
-
- /**
- * Set the collection of all editors (EditorDescriptor)
- * formally registered for the file type described by this mapping
- * which have been deleted by the user.
- * This modifies the internal list to share the passed list.
- * (hence the clear indication of list in the method name)
- *
- * @param newDeletedEditors the new list of associated (but deleted) editors
- */
+ editors = newEditors;
+ declaredDefaultEditors.retainAll(newEditors);
+ }
+
+ /**
+ * Set the collection of all editors (EditorDescriptor) formally registered for
+ * the file type described by this mapping which have been deleted by the user.
+ * This modifies the internal list to share the passed list. (hence the clear
+ * indication of list in the method name)
+ *
+ * @param newDeletedEditors the new list of associated (but deleted) editors
+ */
public void setDeletedEditorsList(List<IEditorDescriptor> newDeletedEditors) {
- deletedEditors = newDeletedEditors;
- }
-
- /**
- * Set the file's extension.
- *
- * @param extension the file extension for this mapping
- */
- public void setExtension(String extension) {
- this.extension = extension;
- }
-
- /**
- * Set the file's name.
- *
- * @param name the file name for this mapping
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
+ deletedEditors = newDeletedEditors;
+ }
+
+ /**
+ * Set the file's extension.
+ *
+ * @param extension the file extension for this mapping
+ */
+ public void setExtension(String extension) {
+ this.extension = extension;
+ }
+
+ /**
+ * Set the file's name.
+ *
+ * @param name the file name for this mapping
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
* Get the editors that have been declared as default. This may be via plugin
* declarations or the preference page.
*
* @return the editors the default editors
* @since 3.1
*/
- public IEditorDescriptor [] getDeclaredDefaultEditors() {
+ public IEditorDescriptor[] getDeclaredDefaultEditors() {
Collection<IEditorDescriptor> descs = WorkbenchActivityHelper.restrictCollection(declaredDefaultEditors,
new ArrayList<>());
return descs.toArray(new IEditorDescriptor[descs.size()]);
}
/**
- * Return whether the editor is declared default.
- * If this is EditorDescriptor fails the ExpressionsCheck it will always
- * return <code>false</code>, even if it's the original default editor.
+ * Return whether the editor is declared default. If this is EditorDescriptor
+ * fails the ExpressionsCheck it will always return <code>false</code>, even if
+ * it's the original default editor.
*
* @param editor the editor to test
* @return whether the editor is declared default
* @since 3.1
*/
- public boolean isDeclaredDefaultEditor (IEditorDescriptor editor) {
- return declaredDefaultEditors.contains(editor)
- && !WorkbenchActivityHelper.restrictUseOf(editor);
+ public boolean isDeclaredDefaultEditor(IEditorDescriptor editor) {
+ return declaredDefaultEditors.contains(editor) && !WorkbenchActivityHelper.restrictUseOf(editor);
}
/**
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/IActionSet.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/IActionSet.java
index d6537f7f083..c4613e83f47 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/IActionSet.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/IActionSet.java
@@ -17,43 +17,42 @@ import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IWorkbenchWindow;
/**
- * An action set is responsible for the creation of actions.
- * The end user may add these actions to a workbench page menu and tool bar
- * if they are deemed useful to the particular task at hand.
+ * An action set is responsible for the creation of actions. The end user may
+ * add these actions to a workbench page menu and tool bar if they are deemed
+ * useful to the particular task at hand.
* <p>
- * [Issue: This interface is not exposed in API, but time may
- * demonstrate that it should be. For the short term leave it be.
- * In the long term its use should be re-evaluated. ]
+ * [Issue: This interface is not exposed in API, but time may demonstrate that
+ * it should be. For the short term leave it be. In the long term its use should
+ * be re-evaluated. ]
* </p>
* <p>
- * In the current workbench implementation the desktop provides the
- * only implementation of this class in PluginActionSet. So, it may
- * be useful to phase this interface out at some point. PluginActionSet
- * provides a lazy load strategy, where the actions are declared in
- * XML and represented at runtime by a PluginAction.
+ * In the current workbench implementation the desktop provides the only
+ * implementation of this class in PluginActionSet. So, it may be useful to
+ * phase this interface out at some point. PluginActionSet provides a lazy load
+ * strategy, where the actions are declared in XML and represented at runtime by
+ * a PluginAction.
* </p>
*/
public interface IActionSet {
- /**
- * Disposes of this action set.
- * <p>
- * Implementation should remove any references to the window and action bars
- * created in the <code>init</code>.
- * </p>
- * <p>
- * [Issue: Should this say: "...should remove anything they contributed
- * in <code>init</code>? Or is most of the withdrawal done automatically?
- * ]
- * </p>
- */
- void dispose();
+ /**
+ * Disposes of this action set.
+ * <p>
+ * Implementation should remove any references to the window and action bars
+ * created in the <code>init</code>.
+ * </p>
+ * <p>
+ * [Issue: Should this say: "...should remove anything they contributed in
+ * <code>init</code>? Or is most of the withdrawal done automatically? ]
+ * </p>
+ */
+ void dispose();
- /**
- * Initializes this action set, which is expected to add it actions as required
- * to the given workbench window and action bars.
- *
- * @param window the workbench window
- * @param bars the action bars
- */
- void init(IWorkbenchWindow window, IActionBars bars);
+ /**
+ * Initializes this action set, which is expected to add it actions as required
+ * to the given workbench window and action bars.
+ *
+ * @param window the workbench window
+ * @param bars the action bars
+ */
+ void init(IWorkbenchWindow window, IActionBars bars);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/IActionSetDescriptor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/IActionSetDescriptor.java
index bdede7f0285..789eb811bd2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/IActionSetDescriptor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/IActionSetDescriptor.java
@@ -17,76 +17,77 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
/**
- * A named set of actions which is defined as an extension to the workbench
- * via the standard workbench actions extension point
+ * A named set of actions which is defined as an extension to the workbench via
+ * the standard workbench actions extension point
* (<code>"org.eclipse.ui.workbenchActions"</code>).
* <p>
- * [Issue: This interface is not exposed in API, but time may
- * demonstrate that it should be. For the short term leave it be.
- * In the long term its use should be re-evaluated. ]
+ * [Issue: This interface is not exposed in API, but time may demonstrate that
+ * it should be. For the short term leave it be. In the long term its use should
+ * be re-evaluated. ]
* </p>
* <p>
* This interface is not intended to be implemented by clients.
* </p>
+ *
* @see ActionSetRegistry
*/
public interface IActionSetDescriptor {
- /**
- * Creates a new action set from this descriptor.
- * <p>
- * [Issue: Consider throwing WorkbenchException rather than CoreException.]
- * </p>
- *
- * @return the new action set
- * @exception CoreException if the action set cannot be created
- */
- IActionSet createActionSet() throws CoreException;
+ /**
+ * Creates a new action set from this descriptor.
+ * <p>
+ * [Issue: Consider throwing WorkbenchException rather than CoreException.]
+ * </p>
+ *
+ * @return the new action set
+ * @exception CoreException if the action set cannot be created
+ */
+ IActionSet createActionSet() throws CoreException;
- /**
- * Returns the description of this action set.
- * This is the value of its <code>"description"</code> attribute.
- *
- * @return the description
- */
- String getDescription();
+ /**
+ * Returns the description of this action set. This is the value of its
+ * <code>"description"</code> attribute.
+ *
+ * @return the description
+ */
+ String getDescription();
- /**
- * Returns the id of this action set.
- * This is the value of its <code>"id"</code> attribute.
- *
- * @return the action set id
- */
- String getId();
+ /**
+ * Returns the id of this action set. This is the value of its <code>"id"</code>
+ * attribute.
+ *
+ * @return the action set id
+ */
+ String getId();
- /**
- * Returns the label of this action set.
- * This is the value of its <code>"label"</code> attribute.
- *
- * @return the label
- */
- String getLabel();
+ /**
+ * Returns the label of this action set. This is the value of its
+ * <code>"label"</code> attribute.
+ *
+ * @return the label
+ */
+ String getLabel();
- /**
- * Returns whether this action set is initially visible.
- *
- * @return whether this action set is initially visible
- */
- boolean isInitiallyVisible();
+ /**
+ * Returns whether this action set is initially visible.
+ *
+ * @return whether this action set is initially visible
+ */
+ boolean isInitiallyVisible();
- /**
- * Sets whether this action set is initially visible.
- *
- * @param visible whether the action set should be visible initially.
- * @since 3.0
- */
- void setInitiallyVisible(boolean visible);
+ /**
+ * Sets whether this action set is initially visible.
+ *
+ * @param visible whether the action set should be visible initially.
+ * @since 3.0
+ */
+ void setInitiallyVisible(boolean visible);
- /**
- * Returns the conconfigurationfig element.
- *
- * @return the configuration element
- * @since 3.1
- */
- IConfigurationElement getConfigurationElement();
+ /**
+ * Returns the conconfigurationfig element.
+ *
+ * @return the configuration element
+ * @since 3.1
+ */
+ IConfigurationElement getConfigurationElement();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/IWorkbenchRegistryConstants.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/IWorkbenchRegistryConstants.java
index ca62daa9205..dee3443108f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/IWorkbenchRegistryConstants.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/IWorkbenchRegistryConstants.java
@@ -54,7 +54,8 @@ public interface IWorkbenchRegistryConstants {
String ATT_ALLOW_MULTIPLE = "allowMultiple"; //$NON-NLS-1$
/**
- * Attribute that specifies whether a view gets restored upon workbench restart. Value <code>restorable</code>.
+ * Attribute that specifies whether a view gets restored upon workbench restart.
+ * Value <code>restorable</code>.
*/
String ATT_RESTORABLE = "restorable"; //$NON-NLS-1$
@@ -65,8 +66,7 @@ public interface IWorkbenchRegistryConstants {
String ATT_CAN_FINISH_EARLY = "canFinishEarly"; //$NON-NLS-1$
/**
- * The name of the category attribute, which appears on a command
- * definition.
+ * The name of the category attribute, which appears on a command definition.
*/
String ATT_CATEGORY = "category"; //$NON-NLS-1$
@@ -76,8 +76,8 @@ public interface IWorkbenchRegistryConstants {
String ATT_CATEGORY_ID = "categoryId"; //$NON-NLS-1$
/**
- * The name of the attribute storing checkEnabled for the visibleWhen
- * element. Value <code>checkEnabled</code>.
+ * The name of the attribute storing checkEnabled for the visibleWhen element.
+ * Value <code>checkEnabled</code>.
*/
String ATT_CHECK_ENABLED = "checkEnabled"; //$NON-NLS-1$
@@ -107,19 +107,18 @@ public interface IWorkbenchRegistryConstants {
String ATT_COMMAND_ID = "commandId"; //$NON-NLS-1$
/**
- * The name of the configuration attribute storing the scheme id for a
- * binding.
+ * The name of the configuration attribute storing the scheme id for a binding.
*/
String ATT_CONFIGURATION = "configuration"; //$NON-NLS-1$
/**
- * Intro content detector class attribute (optional). Value <code>contentDetector</code>.
+ * Intro content detector class attribute (optional). Value
+ * <code>contentDetector</code>.
*/
String ATT_CONTENT_DETECTOR = "contentDetector"; //$NON-NLS-1$
/**
- * Editor content type id binding attribute. Value
- * <code>contentTypeId</code>.
+ * Editor content type id binding attribute. Value <code>contentTypeId</code>.
*/
String ATT_CONTENT_TYPE_ID = "contentTypeId"; //$NON-NLS-1$
@@ -134,8 +133,8 @@ public interface IWorkbenchRegistryConstants {
String ATT_CONTRIBUTOR_CLASS = "contributorClass"; //$NON-NLS-1$
/**
- * The name of the attribute storing the AbstractParameterValueConverter for
- * a commandParameterType.
+ * The name of the attribute storing the AbstractParameterValueConverter for a
+ * commandParameterType.
*/
String ATT_CONVERTER = "converter"; //$NON-NLS-1$
@@ -166,8 +165,7 @@ public interface IWorkbenchRegistryConstants {
String ATT_DELETED = "deleted";//$NON-NLS-1$
/**
- * The name of the description attribute, which appears on named handle
- * objects.
+ * The name of the description attribute, which appears on named handle objects.
*/
String ATT_DESCRIPTION = "description"; //$NON-NLS-1$
@@ -248,8 +246,8 @@ public interface IWorkbenchRegistryConstants {
String ATT_ID = "id"; //$NON-NLS-1$
/**
- * The name of the image style attribute, which is used on location elements
- * in the menus extension point.
+ * The name of the image style attribute, which is used on location elements in
+ * the menus extension point.
*/
String ATT_IMAGE_STYLE = "imageStyle"; //$NON-NLS-1$
@@ -266,14 +264,13 @@ public interface IWorkbenchRegistryConstants {
/**
* The name of the attribute storing the identifier for the active key
* configuration identifier. This provides legacy support for the
- * <code>activeKeyConfiguration</code> element in the commands extension
- * point.
+ * <code>activeKeyConfiguration</code> element in the commands extension point.
*/
String ATT_KEY_CONFIGURATION_ID = "keyConfigurationId"; //$NON-NLS-1$
/**
- * The name of the attribute storing the trigger sequence for a binding.
- * This is called a 'keySequence' for legacy reasons.
+ * The name of the attribute storing the trigger sequence for a binding. This is
+ * called a 'keySequence' for legacy reasons.
*/
String ATT_KEY_SEQUENCE = "keySequence"; //$NON-NLS-1$
@@ -323,8 +320,8 @@ public interface IWorkbenchRegistryConstants {
String ATT_MNEMONIC = "mnemonic"; //$NON-NLS-1$
/**
- * The name of the minimized attribute, which appears
- * when adding a view in a perspectiveExtension.
+ * The name of the minimized attribute, which appears when adding a view in a
+ * perspectiveExtension.
*/
String ATT_MINIMIZED = "minimized"; //$NON-NLS-1$
@@ -359,8 +356,7 @@ public interface IWorkbenchRegistryConstants {
String ATT_OBJECTCLASS = "objectClass";//$NON-NLS-1$
/**
- * The name of the optional attribute, which appears on parameter
- * definitions.
+ * The name of the optional attribute, which appears on parameter definitions.
*/
String ATT_OPTIONAL = "optional"; //$NON-NLS-1$
@@ -386,8 +382,8 @@ public interface IWorkbenchRegistryConstants {
String ATT_PARENT_ID = "parentId"; //$NON-NLS-1$
/**
- * The name of the deprecated parent scope attribute, which appears on
- * contexts definitions.
+ * The name of the deprecated parent scope attribute, which appears on contexts
+ * definitions.
*/
String ATT_PARENT_SCOPE = "parentScope"; //$NON-NLS-1$
@@ -423,8 +419,8 @@ public interface IWorkbenchRegistryConstants {
String ATT_PROJECT = "project";//$NON-NLS-1$ /**
/**
- * The name of the pulldown attribute, which indicates whether the class is
- * a pulldown delegate.
+ * The name of the pulldown attribute, which indicates whether the class is a
+ * pulldown delegate.
*/
String ATT_PULLDOWN = "pulldown"; //$NON-NLS-1$
@@ -454,14 +450,13 @@ public interface IWorkbenchRegistryConstants {
String ATT_RETARGET = "retarget";//$NON-NLS-1$
/**
- * The name of the returnTypeId attribute, which appears on command
- * elements.
+ * The name of the returnTypeId attribute, which appears on command elements.
*/
String ATT_RETURN_TYPE_ID = "returnTypeId"; //$NON-NLS-1$
/**
- * The name of the attribute storing the identifier for the active scheme.
- * This is called a 'keyConfigurationId' for legacy reasons.
+ * The name of the attribute storing the identifier for the active scheme. This
+ * is called a 'keyConfigurationId' for legacy reasons.
*/
String ATT_SCHEME_ID = "schemeId"; //$NON-NLS-1$
@@ -471,8 +466,7 @@ public interface IWorkbenchRegistryConstants {
String ATT_SCOPE = "scope"; //$NON-NLS-1$
/**
- * The name of the separatorsVisible attribute, which appears on group
- * elements.
+ * The name of the separatorsVisible attribute, which appears on group elements.
*/
String ATT_SEPARATORS_VISIBLE = "separatorsVisible"; //$NON-NLS-1$
@@ -492,7 +486,7 @@ public interface IWorkbenchRegistryConstants {
String ATT_SINGLETON = "singleton";//$NON-NLS-1$
/**
- * Splash id attribute. Value <code>splashId</code>.
+ * Splash id attribute. Value <code>splashId</code>.
*
* @since 3.3
*/
@@ -509,8 +503,8 @@ public interface IWorkbenchRegistryConstants {
String ATT_STATE = "state";//$NON-NLS-1$
/**
- * The name of the string attribute (key sequence) for a binding in the
- * commands extension point.
+ * The name of the string attribute (key sequence) for a binding in the commands
+ * extension point.
*/
String ATT_STRING = "string"; //$NON-NLS-1$
@@ -541,8 +535,7 @@ public interface IWorkbenchRegistryConstants {
String ATT_TYPE = "type"; //$NON-NLS-1$
/**
- * The name of the typeId attribute, which appears on commandParameter
- * elements.
+ * The name of the typeId attribute, which appears on commandParameter elements.
*/
String ATT_TYPE_ID = "typeId"; //$NON-NLS-1$
@@ -564,14 +557,14 @@ public interface IWorkbenchRegistryConstants {
/**
* The prefix that all auto-generated identifiers start with. This makes the
- * identifier recognizable as auto-generated, and further helps ensure that
- * it does not conflict with existing identifiers.
+ * identifier recognizable as auto-generated, and further helps ensure that it
+ * does not conflict with existing identifiers.
*/
String AUTOGENERATED_PREFIX = "AUTOGEN:::"; //$NON-NLS-1$
/**
- * The legacy extension point (2.1.x and earlier) for specifying a key
- * binding scheme.
+ * The legacy extension point (2.1.x and earlier) for specifying a key binding
+ * scheme.
*
* @since 3.1.1
*/
@@ -600,8 +593,8 @@ public interface IWorkbenchRegistryConstants {
String PL_ACTIVITYSUPPORT = "activitySupport"; //$NON-NLS-1$
/**
- * The extension point (3.1 and later) for specifying bindings, such as
- * keyboard shortcuts.
+ * The extension point (3.1 and later) for specifying bindings, such as keyboard
+ * shortcuts.
*
* @since 3.1.1
*/
@@ -620,8 +613,8 @@ public interface IWorkbenchRegistryConstants {
/**
* The extension point (2.1.x and later) for specifying a command. A lot of
- * other things have appeared first in this extension point and then been
- * moved to their own extension point.
+ * other things have appeared first in this extension point and then been moved
+ * to their own extension point.
*
* @since 3.1.1
*/
@@ -723,89 +716,73 @@ public interface IWorkbenchRegistryConstants {
/**
* The name of the deprecated accelerator configurations extension point.
*/
- String EXTENSION_ACCELERATOR_CONFIGURATIONS = PlatformUI.PLUGIN_ID
- + '.' + PL_ACCELERATOR_CONFIGURATIONS;
+ String EXTENSION_ACCELERATOR_CONFIGURATIONS = PlatformUI.PLUGIN_ID + '.' + PL_ACCELERATOR_CONFIGURATIONS;
/**
* The name of the accelerator scopes extension point.
*/
- String EXTENSION_ACCELERATOR_SCOPES = PlatformUI.PLUGIN_ID
- + '.' + PL_ACCELERATOR_SCOPES;
+ String EXTENSION_ACCELERATOR_SCOPES = PlatformUI.PLUGIN_ID + '.' + PL_ACCELERATOR_SCOPES;
/**
* The name of the action definitions extension point.
*/
- String EXTENSION_ACTION_DEFINITIONS = PlatformUI.PLUGIN_ID
- + '.' + PL_ACTION_DEFINITIONS;
+ String EXTENSION_ACTION_DEFINITIONS = PlatformUI.PLUGIN_ID + '.' + PL_ACTION_DEFINITIONS;
/**
* The name of the <code>org.eclipse.ui.actionSets</code> extension point.
*/
- String EXTENSION_ACTION_SETS = PlatformUI.PLUGIN_ID
- + '.' + IWorkbenchRegistryConstants.PL_ACTION_SETS;
+ String EXTENSION_ACTION_SETS = PlatformUI.PLUGIN_ID + '.' + IWorkbenchRegistryConstants.PL_ACTION_SETS;
/**
* The name of the bindings extension point.
*/
- String EXTENSION_BINDINGS = PlatformUI.PLUGIN_ID + '.'
- + PL_BINDINGS;
+ String EXTENSION_BINDINGS = PlatformUI.PLUGIN_ID + '.' + PL_BINDINGS;
/**
* The name of the commands extension point.
*/
- String EXTENSION_COMMAND_IMAGES = PlatformUI.PLUGIN_ID
- + '.' + PL_COMMAND_IMAGES;
+ String EXTENSION_COMMAND_IMAGES = PlatformUI.PLUGIN_ID + '.' + PL_COMMAND_IMAGES;
/**
* The name of the commands extension point, and the name of the key for the
* commands preferences.
*/
- String EXTENSION_COMMANDS = PlatformUI.PLUGIN_ID + '.'
- + PL_COMMANDS;
+ String EXTENSION_COMMANDS = PlatformUI.PLUGIN_ID + '.' + PL_COMMANDS;
/**
* The name of the contexts extension point.
*/
- String EXTENSION_CONTEXTS = PlatformUI.PLUGIN_ID + '.'
- + PL_CONTEXTS;
+ String EXTENSION_CONTEXTS = PlatformUI.PLUGIN_ID + '.' + PL_CONTEXTS;
/**
- * The name of the <code>org.eclipse.ui.editorActions</code> extension
- * point.
+ * The name of the <code>org.eclipse.ui.editorActions</code> extension point.
*/
- String EXTENSION_EDITOR_ACTIONS = PlatformUI.PLUGIN_ID
- + '.' + PL_EDITOR_ACTIONS;
+ String EXTENSION_EDITOR_ACTIONS = PlatformUI.PLUGIN_ID + '.' + PL_EDITOR_ACTIONS;
/**
* The name of the commands extension point.
*/
- String EXTENSION_HANDLERS = PlatformUI.PLUGIN_ID + '.'
- + PL_HANDLERS;
+ String EXTENSION_HANDLERS = PlatformUI.PLUGIN_ID + '.' + PL_HANDLERS;
/**
* The name of the <code>org.eclipse.ui.menus</code> extension point.
*/
- String EXTENSION_MENUS = PlatformUI.PLUGIN_ID + '.'
- + PL_MENUS;
+ String EXTENSION_MENUS = PlatformUI.PLUGIN_ID + '.' + PL_MENUS;
/**
* The name of the <code>org.eclipse.ui.menus2</code> extension point.
*/
- String COMMON_MENU_ADDITIONS = PlatformUI.PLUGIN_ID + '.'
- + PL_MENUS + '2';
+ String COMMON_MENU_ADDITIONS = PlatformUI.PLUGIN_ID + '.' + PL_MENUS + '2';
/**
* The name of the <code>org.eclipse.ui.popupMenus</code> extension point.
*/
- String EXTENSION_POPUP_MENUS = PlatformUI.PLUGIN_ID
- + '.' + PL_POPUP_MENU;
+ String EXTENSION_POPUP_MENUS = PlatformUI.PLUGIN_ID + '.' + PL_POPUP_MENU;
/**
- * The name of the <code>org.eclipse.ui.viewActions</code> extension
- * point.
+ * The name of the <code>org.eclipse.ui.viewActions</code> extension point.
*/
- String EXTENSION_VIEW_ACTIONS = PlatformUI.PLUGIN_ID
- + '.' + PL_VIEW_ACTIONS;
+ String EXTENSION_VIEW_ACTIONS = PlatformUI.PLUGIN_ID + '.' + PL_VIEW_ACTIONS;
/**
* The constant for the position attribute corresponding to
@@ -847,9 +824,9 @@ public interface IWorkbenchRegistryConstants {
String STYLE_TOGGLE = "toggle"; //$NON-NLS-1$
/**
- * The name of the deprecated accelerator configuration element. This
- * element was used in 2.1.x and earlier to define groups of what are now
- * called schemes.
+ * The name of the deprecated accelerator configuration element. This element
+ * was used in 2.1.x and earlier to define groups of what are now called
+ * schemes.
*/
String TAG_ACCELERATOR_CONFIGURATION = "acceleratorConfiguration"; //$NON-NLS-1$
@@ -888,8 +865,7 @@ public interface IWorkbenchRegistryConstants {
String TAG_SEQUENCE_MODIFIER = "sequenceModifier"; //$NON-NLS-1$
/**
- * The name of the active when element, which appears on a handler
- * definition.
+ * The name of the active when element, which appears on a handler definition.
*/
String TAG_ACTIVE_WHEN = "activeWhen"; //$NON-NLS-1$
@@ -925,8 +901,7 @@ public interface IWorkbenchRegistryConstants {
String TAG_CATEGORYDEFINITION = "themeElementCategory"; //$NON-NLS-1$
/**
- * Category presentation tag. Value <code>categoryPresentationBinding</code>
- * .
+ * Category presentation tag. Value <code>categoryPresentationBinding</code> .
*
* @deprecated used by the removal presentation API
*/
@@ -1018,8 +993,7 @@ public interface IWorkbenchRegistryConstants {
String TAG_EDITOR_CONTRIBUTION = "editorContribution"; //$NON-NLS-1$
/**
- * The name of the enabled when element, which appears on a handler
- * definition.
+ * The name of the enabled when element, which appears on a handler definition.
*/
String TAG_ENABLED_WHEN = "enabledWhen"; //$NON-NLS-1$
@@ -1105,8 +1079,8 @@ public interface IWorkbenchRegistryConstants {
/**
* The name of the deprecated key configuration element in the commands
- * extension point. This element has been replaced with the scheme element
- * in the bindings extension point.
+ * extension point. This element has been replaced with the scheme element in
+ * the bindings extension point.
*/
String TAG_KEY_CONFIGURATION = "keyConfiguration"; //$NON-NLS-1$
@@ -1116,8 +1090,7 @@ public interface IWorkbenchRegistryConstants {
String TAG_LOCATION = "location"; //$NON-NLS-1$
/**
- * The name of the element defining the insertion point for menu
- * additions.
+ * The name of the element defining the insertion point for menu additions.
*
* @since 3.3
*/
@@ -1208,7 +1181,6 @@ public interface IWorkbenchRegistryConstants {
*/
String TAG_SEPARATOR = "separator"; //$NON-NLS-1$
-
/**
* Tag for the settings transfer entry.
*/
@@ -1227,14 +1199,15 @@ public interface IWorkbenchRegistryConstants {
/**
* The name of the element describing splash handlers. Value
* <code>splashHandler</code>.
+ *
* @since 3.3
*/
String TAG_SPLASH_HANDLER = "splashHandler"; //$NON-NLS-1$
-
/**
* The name of the element describing splash handler product bindings. Value
* <code>splashHandlerProductBinding</code>.
+ *
* @since 3.3
*/
String TAG_SPLASH_HANDLER_PRODUCT_BINDING = "splashHandlerProductBinding"; //$NON-NLS-1$
@@ -1275,8 +1248,8 @@ public interface IWorkbenchRegistryConstants {
String TAG_VIEW = "view";//$NON-NLS-1$
/**
- * E4 view tag, used in the <code>org.eclipse.ui.view</code> extension point
- * to point to a POJO class. Value <code>e4view</code>.
+ * E4 view tag, used in the <code>org.eclipse.ui.view</code> extension point to
+ * point to a POJO class. Value <code>e4view</code>.
*/
String TAG_E4VIEW = "e4view";//$NON-NLS-1$
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ImportExportPespectiveHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ImportExportPespectiveHandler.java
index 24b95ef054c..6d63bc33142 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ImportExportPespectiveHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ImportExportPespectiveHandler.java
@@ -73,7 +73,8 @@ public class ImportExportPespectiveHandler {
@Inject
private Logger logger;
- @Inject @Preference(nodePath="org.eclipse.ui.workbench")
+ @Inject
+ @Preference(nodePath = "org.eclipse.ui.workbench")
private IEclipsePreferences preferences;
@Inject
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/KeywordRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/KeywordRegistry.java
index 11538dc7447..e4a994973b7 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/KeywordRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/KeywordRegistry.java
@@ -62,7 +62,7 @@ public final class KeywordRegistry implements IExtensionChangeHandler {
*/
private KeywordRegistry() {
IExtensionTracker tracker = PlatformUI.getWorkbench().getExtensionTracker();
- tracker.registerHandler(this, ExtensionTracker.createExtensionPointFilter(getExtensionPointFilter()));
+ tracker.registerHandler(this, ExtensionTracker.createExtensionPointFilter(getExtensionPointFilter()));
for (IExtension extension : getExtensionPointFilter().getExtensions()) {
addExtension(PlatformUI.getWorkbench().getExtensionTracker(), extension);
}
@@ -75,15 +75,15 @@ public final class KeywordRegistry implements IExtensionChangeHandler {
String name = element.getAttribute(ATT_LABEL);
String id = element.getAttribute(ATT_ID);
internalKeywordMap.put(id, name);
- PlatformUI.getWorkbench().getExtensionTracker().registerObject(
- extension, id, IExtensionTracker.REF_WEAK);
+ PlatformUI.getWorkbench().getExtensionTracker().registerObject(extension, id,
+ IExtensionTracker.REF_WEAK);
}
}
}
private IExtensionPoint getExtensionPointFilter() {
- return Platform.getExtensionRegistry().getExtensionPoint(
- PlatformUI.PLUGIN_ID, IWorkbenchRegistryConstants.PL_KEYWORDS);
+ return Platform.getExtensionRegistry().getExtensionPoint(PlatformUI.PLUGIN_ID,
+ IWorkbenchRegistryConstants.PL_KEYWORDS);
}
/**
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveDescriptor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveDescriptor.java
index 7bf469a696c..5dc40976c4c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveDescriptor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveDescriptor.java
@@ -33,15 +33,14 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
* <ol>
* <li>It <code>isPredefined()</code>, in which case it was defined from an
* extension point.</li>
- * <li>It <code>isPredefined()</code> and <code>hasCustomFile</code>, in
- * which case the user has customized a predefined perspective.</li>
+ * <li>It <code>isPredefined()</code> and <code>hasCustomFile</code>, in which
+ * case the user has customized a predefined perspective.</li>
* <li>It <code>hasCustomFile</code>, in which case the user created a new
* perspective.</li>
* </ol>
*
*/
-public class PerspectiveDescriptor implements IPerspectiveDescriptor,
- IPluginContribution {
+public class PerspectiveDescriptor implements IPerspectiveDescriptor, IPluginContribution {
private String id;
private String label;
@@ -74,8 +73,7 @@ public class PerspectiveDescriptor implements IPerspectiveDescriptor,
public IPerspectiveFactory createFactory() {
try {
- return (IPerspectiveFactory) configElement
- .createExecutableExtension(IWorkbenchRegistryConstants.ATT_CLASS);
+ return (IPerspectiveFactory) configElement.createExecutableExtension(IWorkbenchRegistryConstants.ATT_CLASS);
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -110,8 +108,7 @@ public class PerspectiveDescriptor implements IPerspectiveDescriptor,
if (configElement != null) {
String icon = configElement.getAttribute(IWorkbenchRegistryConstants.ATT_ICON);
if (icon != null) {
- image = AbstractUIPlugin.imageDescriptorFromPlugin(
- configElement.getNamespaceIdentifier(), icon);
+ image = AbstractUIPlugin.imageDescriptorFromPlugin(configElement.getNamespaceIdentifier(), icon);
}
}
@@ -124,11 +121,9 @@ public class PerspectiveDescriptor implements IPerspectiveDescriptor,
/**
* Set the {@link ImageDescriptor} that should be used to provide the
- * perspective icon. Needed for contributing perspectives via model
- * fragments.
+ * perspective icon. Needed for contributing perspectives via model fragments.
*
- * @param image
- * The {@link ImageDescriptor} to use
+ * @param image The {@link ImageDescriptor} to use
*/
public void setImageDescriptor(ImageDescriptor image) {
this.image = image;
@@ -136,8 +131,7 @@ public class PerspectiveDescriptor implements IPerspectiveDescriptor,
@Override
public String getLabel() {
- return configElement == null ? label : configElement
- .getAttribute(IWorkbenchRegistryConstants.ATT_NAME);
+ return configElement == null ? label : configElement.getAttribute(IWorkbenchRegistryConstants.ATT_NAME);
}
@Override
@@ -164,8 +158,7 @@ public class PerspectiveDescriptor implements IPerspectiveDescriptor,
}
/**
- * Returns <code>true</code> if this perspective is predefined by an
- * extension.
+ * Returns <code>true</code> if this perspective is predefined by an extension.
*
* @return boolean whether this perspective is predefined by an extension
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveParameterValues.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveParameterValues.java
index 787d477f34c..49e9168cef6 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveParameterValues.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveParameterValues.java
@@ -32,8 +32,8 @@ public final class PerspectiveParameterValues implements IParameterValues {
public Map getParameterValues() {
final Map values = new HashMap();
- final IPerspectiveDescriptor[] perspectives = PlatformUI.getWorkbench()
- .getPerspectiveRegistry().getPerspectives();
+ final IPerspectiveDescriptor[] perspectives = PlatformUI.getWorkbench().getPerspectiveRegistry()
+ .getPerspectives();
for (final IPerspectiveDescriptor perspective : perspectives) {
values.put(perspective.getLabel(), perspective.getId());
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveRegistry.java
index aed71dbcbed..2258ffc3504 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveRegistry.java
@@ -91,7 +91,8 @@ public class PerspectiveRegistry implements IPerspectiveRegistry, IExtensionChan
MPerspective perspective = (MPerspective) snippet;
String id = perspective.getElementId();
- // See if the clone is customizing an a predefined perspective without changing its name
+ // See if the clone is customizing an a predefined perspective without changing
+ // its name
PerspectiveDescriptor existingDescriptor = descriptors.get(id);
if (existingDescriptor == null) {
@@ -144,8 +145,8 @@ public class PerspectiveRegistry implements IPerspectiveRegistry, IExtensionChan
}
@Override
- public IPerspectiveDescriptor clonePerspective(String id, String label,
- IPerspectiveDescriptor desc) throws IllegalArgumentException {
+ public IPerspectiveDescriptor clonePerspective(String id, String label, IPerspectiveDescriptor desc)
+ throws IllegalArgumentException {
// FIXME: compat clonePerspective. Not called in 3.8
E4Util.unsupported("clonePerspective"); //$NON-NLS-1$
return null;
@@ -179,14 +180,12 @@ public class PerspectiveRegistry implements IPerspectiveRegistry, IExtensionChan
}
}
-
@Override
public IPerspectiveDescriptor findPerspectiveWithId(String perspectiveId) {
return findPerspectiveWithId(perspectiveId, true);
}
- public IPerspectiveDescriptor findPerspectiveWithId(String perspectiveId,
- boolean considerRestrictRules) {
+ public IPerspectiveDescriptor findPerspectiveWithId(String perspectiveId, boolean considerRestrictRules) {
IPerspectiveDescriptor candidate = descriptors.get(perspectiveId);
if (considerRestrictRules && WorkbenchActivityHelper.restrictUseOf(candidate)) {
return null;
@@ -209,8 +208,8 @@ public class PerspectiveRegistry implements IPerspectiveRegistry, IExtensionChan
@Override
public String getDefaultPerspective() {
- String defaultId = PrefUtil.getAPIPreferenceStore().getString(
- IWorkbenchPreferenceConstants.DEFAULT_PERSPECTIVE_ID);
+ String defaultId = PrefUtil.getAPIPreferenceStore()
+ .getString(IWorkbenchPreferenceConstants.DEFAULT_PERSPECTIVE_ID);
// empty string may be returned but we want to return null if nothing
// found
if (defaultId.length() == 0 || findPerspectiveWithId(defaultId) == null) {
@@ -223,8 +222,7 @@ public class PerspectiveRegistry implements IPerspectiveRegistry, IExtensionChan
@Override
public IPerspectiveDescriptor[] getPerspectives() {
- Collection<?> descs = WorkbenchActivityHelper.restrictCollection(descriptors.values(),
- new ArrayList<>());
+ Collection<?> descs = WorkbenchActivityHelper.restrictCollection(descriptors.values(), new ArrayList<>());
return descs.toArray(new IPerspectiveDescriptor[descs.size()]);
}
@@ -235,18 +233,16 @@ public class PerspectiveRegistry implements IPerspectiveRegistry, IExtensionChan
public void setDefaultPerspective(String id) {
IPerspectiveDescriptor desc = findPerspectiveWithId(id);
if (desc != null) {
- PrefUtil.getAPIPreferenceStore().setValue(
- IWorkbenchPreferenceConstants.DEFAULT_PERSPECTIVE_ID, id);
+ PrefUtil.getAPIPreferenceStore().setValue(IWorkbenchPreferenceConstants.DEFAULT_PERSPECTIVE_ID, id);
}
}
/**
* Return <code>true</code> if a label is valid. This checks only the given
- * label in isolation. It does not check whether the given label is used by
- * any existing perspectives.
+ * label in isolation. It does not check whether the given label is used by any
+ * existing perspectives.
*
- * @param label
- * the label to test
+ * @param label the label to test
* @return whether the label is valid
*/
public boolean validateLabel(String label) {
@@ -257,7 +253,6 @@ public class PerspectiveRegistry implements IPerspectiveRegistry, IExtensionChan
return true;
}
-
@Override
public void revertPerspective(IPerspectiveDescriptor perspToRevert) {
PerspectiveDescriptor perspective = (PerspectiveDescriptor) perspToRevert;
@@ -294,19 +289,15 @@ public class PerspectiveRegistry implements IPerspectiveRegistry, IExtensionChan
/**
* Create a new perspective.
*
- * @param label
- * the name of the new descriptor
- * @param originalDescriptor
- * the descriptor on which to base the new descriptor
+ * @param label the name of the new descriptor
+ * @param originalDescriptor the descriptor on which to base the new descriptor
* @return a new perspective descriptor or <code>null</code> if the creation
* failed.
*/
- public PerspectiveDescriptor createPerspective(String label,
- PerspectiveDescriptor originalDescriptor) {
+ public PerspectiveDescriptor createPerspective(String label, PerspectiveDescriptor originalDescriptor) {
String newID = createNewId(label, originalDescriptor);
- PerspectiveDescriptor newDescriptor = new PerspectiveDescriptor(newID, label,
- originalDescriptor);
+ PerspectiveDescriptor newDescriptor = new PerspectiveDescriptor(newID, label, originalDescriptor);
descriptors.put(newDescriptor.getId(), newDescriptor);
return newDescriptor;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PreferencePageParameterValues.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PreferencePageParameterValues.java
index 80f301fe6d4..ccdcfd09774 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PreferencePageParameterValues.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PreferencePageParameterValues.java
@@ -45,13 +45,11 @@ import org.eclipse.ui.internal.WorkbenchMessages;
public final class PreferencePageParameterValues implements IParameterValues {
public PreferencePageParameterValues() {
- Platform.getExtensionRegistry().addRegistryChangeListener(
- event -> {
- if (event.getExtensionDeltas(PlatformUI.PLUGIN_ID,
- IWorkbenchRegistryConstants.PL_PREFERENCES).length > 0) {
- preferenceMap = null;
- }
- });
+ Platform.getExtensionRegistry().addRegistryChangeListener(event -> {
+ if (event.getExtensionDeltas(PlatformUI.PLUGIN_ID, IWorkbenchRegistryConstants.PL_PREFERENCES).length > 0) {
+ preferenceMap = null;
+ }
+ });
}
private Map preferenceMap;
@@ -60,26 +58,22 @@ public final class PreferencePageParameterValues implements IParameterValues {
* Iterate through the preference page and build the map of preference page
* names to ids.
*
- * @param values
- * The Map being populated with parameter values.
- * @param preferenceNodes
- * An array of <code>IPreferenceNode</code> to process.
- * @param namePrefix
- * A string incorporating the names of each parent
- * <code>IPreferenceNode</code> up to the root of the
- * preference page tree. This will be <code>null</code> for the
- * root level preference page nodes.
+ * @param values The Map being populated with parameter values.
+ * @param preferenceNodes An array of <code>IPreferenceNode</code> to process.
+ * @param namePrefix A string incorporating the names of each parent
+ * <code>IPreferenceNode</code> up to the root of the
+ * preference page tree. This will be <code>null</code>
+ * for the root level preference page nodes.
*/
- private void collectParameterValues(final Map values,
- final IPreferenceNode[] preferenceNodes, final String namePrefix) {
+ private void collectParameterValues(final Map values, final IPreferenceNode[] preferenceNodes,
+ final String namePrefix) {
for (final IPreferenceNode preferenceNode : preferenceNodes) {
final String name;
if (namePrefix == null) {
name = preferenceNode.getLabelText();
} else {
- name = namePrefix
- + WorkbenchMessages.PreferencePageParameterValues_pageLabelSeparator
+ name = namePrefix + WorkbenchMessages.PreferencePageParameterValues_pageLabelSeparator
+ preferenceNode.getLabelText();
}
final String value = preferenceNode.getId();
@@ -94,10 +88,8 @@ public final class PreferencePageParameterValues implements IParameterValues {
if (preferenceMap == null) {
preferenceMap = new TreeMap();
- final PreferenceManager preferenceManager = PlatformUI
- .getWorkbench().getPreferenceManager();
- collectParameterValues(preferenceMap, preferenceManager
- .getRootSubNodes(), null);
+ final PreferenceManager preferenceManager = PlatformUI.getWorkbench().getPreferenceManager();
+ collectParameterValues(preferenceMap, preferenceManager.getRootSubNodes(), null);
}
return preferenceMap;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PreferencePageRegistryReader.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PreferencePageRegistryReader.java
index 24d409e45ac..5fda0331b22 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PreferencePageRegistryReader.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PreferencePageRegistryReader.java
@@ -27,8 +27,8 @@ import org.eclipse.ui.internal.Workbench;
import org.eclipse.ui.internal.dialogs.WorkbenchPreferenceNode;
/**
- * Instances access the registry that is provided at creation time in order
- * to determine the contributed preference pages
+ * Instances access the registry that is provided at creation time in order to
+ * determine the contributed preference pages
*/
public class PreferencePageRegistryReader extends CategorizedPageRegistryReader {
@@ -38,18 +38,17 @@ public class PreferencePageRegistryReader extends CategorizedPageRegistryReader
private IWorkbench workbench;
-
class PreferencesCategoryNode extends CategoryNode {
WorkbenchPreferenceNode node;
/**
* Create a new instance of the receiver.
+ *
* @param reader
* @param nodeToCategorize
*/
- public PreferencesCategoryNode(CategorizedPageRegistryReader reader,
- WorkbenchPreferenceNode nodeToCategorize) {
+ public PreferencesCategoryNode(CategorizedPageRegistryReader reader, WorkbenchPreferenceNode nodeToCategorize) {
super(reader);
this.node = nodeToCategorize;
}
@@ -120,7 +119,8 @@ public class PreferencePageRegistryReader extends CategorizedPageRegistryReader
@Override
protected String invalidCategoryNodeMessage(CategoryNode categoryNode) {
WorkbenchPreferenceNode wpn = (WorkbenchPreferenceNode) categoryNode.getNode();
- return "Invalid preference category path: " + wpn.getCategory() + " (bundle: " + wpn.getPluginId() + ", page: " + wpn.getLocalId() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ return "Invalid preference category path: " + wpn.getCategory() + " (bundle: " + wpn.getPluginId() + ", page: " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ + wpn.getLocalId() + ")"; //$NON-NLS-1$
}
@Override
@@ -129,13 +129,12 @@ public class PreferencePageRegistryReader extends CategorizedPageRegistryReader
}
/**
- * Load the preference page contirbutions from the registry and
- * organize preference node contributions by category into hierarchies
- * If there is no page for a given node in the hierarchy then a blank
- * page will be created.
- * If no category has been specified or category information
- * is incorrect, page will appear at the root level. workbench
- * log entry will be created for incorrect category information.
+ * Load the preference page contirbutions from the registry and organize
+ * preference node contributions by category into hierarchies If there is no
+ * page for a given node in the hierarchy then a blank page will be created. If
+ * no category has been specified or category information is incorrect, page
+ * will appear at the root level. workbench log entry will be created for
+ * incorrect category information.
*
* @param registry the extension registry
*/
@@ -159,8 +158,7 @@ public class PreferencePageRegistryReader extends CategorizedPageRegistryReader
WorkbenchPreferenceNode node = createNode(element);
if (node != null) {
if (workbench instanceof Workbench) {
- if (node.getId().equals(
- ((Workbench) workbench).getMainPreferencePageId()))
+ if (node.getId().equals(((Workbench) workbench).getMainPreferencePageId()))
node.setPriority(-1);
}
nodes.add(node);
@@ -170,6 +168,7 @@ public class PreferencePageRegistryReader extends CategorizedPageRegistryReader
/**
* Create a workbench preference node.
+ *
* @param element
* @return WorkbenchPreferenceNode
*/
@@ -199,7 +198,8 @@ public class PreferencePageRegistryReader extends CategorizedPageRegistryReader
/**
* Return the top level IPreferenceNodes, minus the one which fail the
* Expression check.
- * @return Collection of IPreferenceNode.
+ *
+ * @return Collection of IPreferenceNode.
*/
public Collection getTopLevelNodes() {
return WorkbenchActivityHelper.restrictCollection(topLevelNodes, new ArrayList());
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PreferenceTransferRegistryReader.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PreferenceTransferRegistryReader.java
index 506ca624f67..a78cfec5c59 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PreferenceTransferRegistryReader.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PreferenceTransferRegistryReader.java
@@ -42,8 +42,7 @@ public class PreferenceTransferRegistryReader extends RegistryReader {
/**
* Create an instance of this class.
*
- * @param pluginPointId
- * java.lang.String
+ * @param pluginPointId java.lang.String
*/
public PreferenceTransferRegistryReader(String pluginPointId) {
pluginPoint = pluginPointId;
@@ -53,13 +52,11 @@ public class PreferenceTransferRegistryReader extends RegistryReader {
* Returns a new PreferenceTransferElement configured according to the
* parameters contained in the passed element.
*
- * @param element
- * the configuration element
- * @return the preference transfer element or <code>null</code> if there was
- * not enough information in the element
+ * @param element the configuration element
+ * @return the preference transfer element or <code>null</code> if there was not
+ * enough information in the element
*/
- protected PreferenceTransferElement createPreferenceTransferElement(
- IConfigurationElement element) {
+ protected PreferenceTransferElement createPreferenceTransferElement(IConfigurationElement element) {
// PreferenceTransfers must have a class attribute
if (element.getAttribute(IWorkbenchRegistryConstants.ATT_NAME) == null) {
logMissingAttribute(element, IWorkbenchRegistryConstants.ATT_NAME);
@@ -82,8 +79,7 @@ public class PreferenceTransferRegistryReader extends RegistryReader {
*/
public PreferenceTransferElement[] getPreferenceTransfers() {
readPreferenceTransfers();
- PreferenceTransferElement[] transfers = new PreferenceTransferElement[preferenceTransfers
- .size()];
+ PreferenceTransferElement[] transfers = new PreferenceTransferElement[preferenceTransfers.size()];
Collections.sort(preferenceTransfers, (o1, o2) -> {
String name1 = ((PreferenceTransferElement) o1).getName();
String name2 = ((PreferenceTransferElement) o2).getName();
@@ -106,8 +102,7 @@ public class PreferenceTransferRegistryReader extends RegistryReader {
// Allow settings transfers as well.
- return element.getName().equals(
- IWorkbenchRegistryConstants.TAG_SETTINGS_TRANSFER);
+ return element.getName().equals(IWorkbenchRegistryConstants.TAG_SETTINGS_TRANSFER);
}
/**
@@ -125,13 +120,10 @@ public class PreferenceTransferRegistryReader extends RegistryReader {
* @param configElement
* @return the child configuration elements
*/
- public static IConfigurationElement[] getMappings(
- IConfigurationElement configElement) {
- IConfigurationElement[] children = configElement
- .getChildren(IWorkbenchRegistryConstants.TAG_MAPPING);
+ public static IConfigurationElement[] getMappings(IConfigurationElement configElement) {
+ IConfigurationElement[] children = configElement.getChildren(IWorkbenchRegistryConstants.TAG_MAPPING);
if (children.length < 1) {
- logMissingElement(configElement,
- IWorkbenchRegistryConstants.TAG_MAPPING);
+ logMissingElement(configElement, IWorkbenchRegistryConstants.TAG_MAPPING);
return new IConfigurationElement[0];
}
return children;
@@ -146,10 +138,9 @@ public class PreferenceTransferRegistryReader extends RegistryReader {
}
/**
- * @param element
- * the configuration element
- * @return a map that maps nodes to keys for this element or
- * <code>null</code> for all nodes
+ * @param element the configuration element
+ * @return a map that maps nodes to keys for this element or <code>null</code>
+ * for all nodes
*/
public static Map getEntry(IConfigurationElement element) {
IConfigurationElement[] entries = element.getChildren(IWorkbenchRegistryConstants.TAG_ENTRY);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PropertyPagesRegistryReader.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PropertyPagesRegistryReader.java
index fe14ad07e7d..26554963213 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PropertyPagesRegistryReader.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PropertyPagesRegistryReader.java
@@ -46,13 +46,16 @@ public class PropertyPagesRegistryReader extends CategorizedPageRegistryReader {
/**
* Value "<code>selectionFilter</code>". Is an enum allowing propertyPages to
- * support multiple selection when enum value is <code>ATT_SELECTION_FILTER_MULTI</code>
+ * support multiple selection when enum value is
+ * <code>ATT_SELECTION_FILTER_MULTI</code>
+ *
* @since 3.7
*/
public static final String ATT_SELECTION_FILTER = "selectionFilter";//$NON-NLS-1$
/**
* Selection filter attribute value indicating support for multiple selection.
+ *
* @since 3.7
*/
public static final String ATT_SELECTION_FILTER_MULTI = "multi";//$NON-NLS-1$
@@ -79,7 +82,7 @@ public class PropertyPagesRegistryReader extends CategorizedPageRegistryReader {
*/
public static final String ATT_ADAPTABLE = "adaptable";//$NON-NLS-1$
- private static final String CHILD_ENABLED_WHEN = "enabledWhen"; //$NON-NLS-1$;
+ private static final String CHILD_ENABLED_WHEN = "enabledWhen"; //$NON-NLS-1$ ;
private Collection pages = new ArrayList();
@@ -95,8 +98,7 @@ public class PropertyPagesRegistryReader extends CategorizedPageRegistryReader {
* @param reader
* @param propertyPage
*/
- PropertyCategoryNode(CategorizedPageRegistryReader reader,
- RegistryPageContributor propertyPage) {
+ PropertyCategoryNode(CategorizedPageRegistryReader reader, RegistryPageContributor propertyPage) {
super(reader);
page = propertyPage;
}
@@ -120,8 +122,7 @@ public class PropertyPagesRegistryReader extends CategorizedPageRegistryReader {
/**
* The constructor.
*
- * @param manager
- * the manager
+ * @param manager the manager
*/
public PropertyPagesRegistryReader(PropertyPageContributorManager manager) {
this.manager = manager;
@@ -131,19 +132,16 @@ public class PropertyPagesRegistryReader extends CategorizedPageRegistryReader {
* Reads static property page specification.
*/
private void processPageElement(IConfigurationElement element) {
- String pageId = element
- .getAttribute(IWorkbenchRegistryConstants.ATT_ID);
+ String pageId = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
if (pageId == null) {
logMissingAttribute(element, IWorkbenchRegistryConstants.ATT_ID);
return;
}
- RegistryPageContributor contributor = new RegistryPageContributor(
- pageId, element);
+ RegistryPageContributor contributor = new RegistryPageContributor(pageId, element);
- String pageClassName = getClassValue(element,
- IWorkbenchRegistryConstants.ATT_CLASS);
+ String pageClassName = getClassValue(element, IWorkbenchRegistryConstants.ATT_CLASS);
if (pageClassName == null) {
logMissingAttribute(element, IWorkbenchRegistryConstants.ATT_CLASS);
return;
@@ -164,8 +162,7 @@ public class PropertyPagesRegistryReader extends CategorizedPageRegistryReader {
* @param contributor
* @param objectClassNames
*/
- private void registerContributors(RegistryPageContributor contributor,
- List objectClassNames) {
+ private void registerContributors(RegistryPageContributor contributor, List objectClassNames) {
pages.add(contributor);
for (Iterator iter = objectClassNames.iterator(); iter.hasNext();) {
@@ -174,7 +171,6 @@ public class PropertyPagesRegistryReader extends CategorizedPageRegistryReader {
}
-
/**
* Reads the next contribution element.
*
@@ -205,27 +201,22 @@ public class PropertyPagesRegistryReader extends CategorizedPageRegistryReader {
/**
* Reads all occurances of propertyPages extension in the registry.
*
- * @param registry
- * the registry
+ * @param registry the registry
*/
public void registerPropertyPages(IExtensionRegistry registry) {
- readRegistry(registry, PlatformUI.PLUGIN_ID,
- IWorkbenchRegistryConstants.PL_PROPERTY_PAGES);
+ readRegistry(registry, PlatformUI.PLUGIN_ID, IWorkbenchRegistryConstants.PL_PROPERTY_PAGES);
processNodes();
}
@Override
void add(Object parent, Object node) {
- ((RegistryPageContributor) parent)
- .addSubPage((RegistryPageContributor) node);
+ ((RegistryPageContributor) parent).addSubPage((RegistryPageContributor) node);
}
@Override
- CategoryNode createCategoryNode(CategorizedPageRegistryReader reader,
- Object object) {
- return new PropertyCategoryNode(reader,
- (RegistryPageContributor) object);
+ CategoryNode createCategoryNode(CategorizedPageRegistryReader reader, Object object) {
+ return new PropertyCategoryNode(reader, (RegistryPageContributor) object);
}
@Override
@@ -237,8 +228,7 @@ public class PropertyPagesRegistryReader extends CategorizedPageRegistryReader {
Object findNode(String id) {
Iterator iterator = pages.iterator();
while (iterator.hasNext()) {
- RegistryPageContributor next = (RegistryPageContributor) iterator
- .next();
+ RegistryPageContributor next = (RegistryPageContributor) iterator.next();
if (next.getPageId().equals(id))
return next;
}
@@ -253,7 +243,8 @@ public class PropertyPagesRegistryReader extends CategorizedPageRegistryReader {
@Override
protected String invalidCategoryNodeMessage(CategoryNode categoryNode) {
RegistryPageContributor rpc = (RegistryPageContributor) categoryNode.getNode();
- return "Invalid property category path: " + rpc.getCategory() + " (bundle: " + rpc.getPluginId() + ", propertyPage: " + rpc.getLocalId() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ return "Invalid property category path: " + rpc.getCategory() + " (bundle: " + rpc.getPluginId() //$NON-NLS-1$ //$NON-NLS-2$
+ + ", propertyPage: " + rpc.getLocalId() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
}
@Override
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/RegistryReader.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/RegistryReader.java
index 38b2ece01ee..4cb983b2643 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/RegistryReader.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/RegistryReader.java
@@ -22,186 +22,172 @@ import org.eclipse.e4.ui.internal.workbench.ExtensionsSort;
import org.eclipse.ui.internal.WorkbenchPlugin;
/**
- * Template implementation of a registry reader that creates objects
- * representing registry contents. Typically, an extension
- * contains one element, but this reader handles multiple
- * elements per extension.
+ * Template implementation of a registry reader that creates objects
+ * representing registry contents. Typically, an extension contains one element,
+ * but this reader handles multiple elements per extension.
*
- * To start reading the extensions from the registry for an
- * extension point, call the method <code>readRegistry</code>.
+ * To start reading the extensions from the registry for an extension point,
+ * call the method <code>readRegistry</code>.
*
- * To read children of an IConfigurationElement, call the
- * method <code>readElementChildren</code> from your implementation
- * of the method <code>readElement</code>, as it will not be
- * done by default.
+ * To read children of an IConfigurationElement, call the method
+ * <code>readElementChildren</code> from your implementation of the method
+ * <code>readElement</code>, as it will not be done by default.
*/
public abstract class RegistryReader {
- // for dynamic UI - remove this cache to avoid inconsistency
- //protected static Hashtable extensionPoints = new Hashtable();
- /**
- * The constructor.
- */
- protected RegistryReader() {
- }
-
- /**
- * Logs the error in the workbench log using the provided
- * text and the information in the configuration element.
- */
- protected static void logError(IConfigurationElement element, String text) {
- IExtension extension = element.getDeclaringExtension();
- StringBuilder buf = new StringBuilder();
- buf
- .append("Plugin " + extension.getContributor().getName() + ", extension " //$NON-NLS-1$//$NON-NLS-2$
- + extension.getExtensionPointUniqueIdentifier());
- // look for an ID if available - this should help debugging
- String id = element.getAttribute("id"); //$NON-NLS-1$
- if (id != null) {
- buf.append(", id "); //$NON-NLS-1$
- buf.append(id);
- }
- buf.append(": " + text);//$NON-NLS-1$
- WorkbenchPlugin.log(buf.toString());
- }
-
- /**
- * Logs a very common registry error when a required attribute is missing.
- */
- protected static void logMissingAttribute(IConfigurationElement element,
- String attributeName) {
- logError(element,
- "Required attribute '" + attributeName + "' not defined");//$NON-NLS-2$//$NON-NLS-1$
- }
-
- /**
- * Logs a very common registry error when a required child is missing.
- */
- protected static void logMissingElement(IConfigurationElement element,
- String elementName) {
- logError(element,
- "Required sub element '" + elementName + "' not defined");//$NON-NLS-2$//$NON-NLS-1$
- }
-
- /**
- * Logs a registry error when the configuration element is unknown.
- */
- protected static void logUnknownElement(IConfigurationElement element) {
- logError(element, "Unknown extension tag found: " + element.getName());//$NON-NLS-1$
- }
-
- /**
- * Apply a reproducable order to the list of extensions
- * provided, such that the order will not change as
- * extensions are added or removed.
- * @param extensions the extensions to order
- * @return ordered extensions
- */
- public static IExtension[] orderExtensions(IExtension[] extensions) {
+ // for dynamic UI - remove this cache to avoid inconsistency
+ // protected static Hashtable extensionPoints = new Hashtable();
+ /**
+ * The constructor.
+ */
+ protected RegistryReader() {
+ }
+
+ /**
+ * Logs the error in the workbench log using the provided text and the
+ * information in the configuration element.
+ */
+ protected static void logError(IConfigurationElement element, String text) {
+ IExtension extension = element.getDeclaringExtension();
+ StringBuilder buf = new StringBuilder();
+ buf.append("Plugin " + extension.getContributor().getName() + ", extension " //$NON-NLS-1$//$NON-NLS-2$
+ + extension.getExtensionPointUniqueIdentifier());
+ // look for an ID if available - this should help debugging
+ String id = element.getAttribute("id"); //$NON-NLS-1$
+ if (id != null) {
+ buf.append(", id "); //$NON-NLS-1$
+ buf.append(id);
+ }
+ buf.append(": " + text);//$NON-NLS-1$
+ WorkbenchPlugin.log(buf.toString());
+ }
+
+ /**
+ * Logs a very common registry error when a required attribute is missing.
+ */
+ protected static void logMissingAttribute(IConfigurationElement element, String attributeName) {
+ logError(element, "Required attribute '" + attributeName + "' not defined");//$NON-NLS-2$//$NON-NLS-1$
+ }
+
+ /**
+ * Logs a very common registry error when a required child is missing.
+ */
+ protected static void logMissingElement(IConfigurationElement element, String elementName) {
+ logError(element, "Required sub element '" + elementName + "' not defined");//$NON-NLS-2$//$NON-NLS-1$
+ }
+
+ /**
+ * Logs a registry error when the configuration element is unknown.
+ */
+ protected static void logUnknownElement(IConfigurationElement element) {
+ logError(element, "Unknown extension tag found: " + element.getName());//$NON-NLS-1$
+ }
+
+ /**
+ * Apply a reproducable order to the list of extensions provided, such that the
+ * order will not change as extensions are added or removed.
+ *
+ * @param extensions the extensions to order
+ * @return ordered extensions
+ */
+ public static IExtension[] orderExtensions(IExtension[] extensions) {
return new ExtensionsSort().sort(extensions);
- }
-
- /**
- * Implement this method to read element's attributes.
- * If children should also be read, then implementor
- * is responsible for calling <code>readElementChildren</code>.
- * Implementor is also responsible for logging missing
- * attributes.
- *
- * @return true if element was recognized, false if not.
- */
- protected abstract boolean readElement(IConfigurationElement element);
-
- /**
- * Read the element's children. This is called by
- * the subclass' readElement method when it wants
- * to read the children of the element.
- */
- protected void readElementChildren(IConfigurationElement element) {
- readElements(element.getChildren());
- }
-
- /**
- * Read each element one at a time by calling the
- * subclass implementation of <code>readElement</code>.
- *
- * Logs an error if the element was not recognized.
- */
- protected void readElements(IConfigurationElement[] elements) {
- for (int i = 0; i < elements.length; i++) {
- if (!readElement(elements[i])) {
+ }
+
+ /**
+ * Implement this method to read element's attributes. If children should also
+ * be read, then implementor is responsible for calling
+ * <code>readElementChildren</code>. Implementor is also responsible for logging
+ * missing attributes.
+ *
+ * @return true if element was recognized, false if not.
+ */
+ protected abstract boolean readElement(IConfigurationElement element);
+
+ /**
+ * Read the element's children. This is called by the subclass' readElement
+ * method when it wants to read the children of the element.
+ */
+ protected void readElementChildren(IConfigurationElement element) {
+ readElements(element.getChildren());
+ }
+
+ /**
+ * Read each element one at a time by calling the subclass implementation of
+ * <code>readElement</code>.
+ *
+ * Logs an error if the element was not recognized.
+ */
+ protected void readElements(IConfigurationElement[] elements) {
+ for (int i = 0; i < elements.length; i++) {
+ if (!readElement(elements[i])) {
logUnknownElement(elements[i]);
}
- }
- }
-
- /**
- * Read one extension by looping through its
- * configuration elements.
- */
- protected void readExtension(IExtension extension) {
- readElements(extension.getConfigurationElements());
- }
-
- /**
- * Start the registry reading process using the
- * supplied plugin ID and extension point.
- *
- * @param registry the registry to read from
- * @param pluginId the plugin id of the extenion point
- * @param extensionPoint the extension point id
- */
- public void readRegistry(IExtensionRegistry registry, String pluginId,
- String extensionPoint) {
- IExtensionPoint point = registry.getExtensionPoint(pluginId,
- extensionPoint);
- if (point == null) {
+ }
+ }
+
+ /**
+ * Read one extension by looping through its configuration elements.
+ */
+ protected void readExtension(IExtension extension) {
+ readElements(extension.getConfigurationElements());
+ }
+
+ /**
+ * Start the registry reading process using the supplied plugin ID and extension
+ * point.
+ *
+ * @param registry the registry to read from
+ * @param pluginId the plugin id of the extenion point
+ * @param extensionPoint the extension point id
+ */
+ public void readRegistry(IExtensionRegistry registry, String pluginId, String extensionPoint) {
+ IExtensionPoint point = registry.getExtensionPoint(pluginId, extensionPoint);
+ if (point == null) {
return;
}
- IExtension[] extensions = point.getExtensions();
- extensions = orderExtensions(extensions);
- for (IExtension extension : extensions) {
+ IExtension[] extensions = point.getExtensions();
+ extensions = orderExtensions(extensions);
+ for (IExtension extension : extensions) {
readExtension(extension);
}
- }
-
- /**
- * Utility for extracting the description child of an element.
- *
- * @param configElement the element
- * @return the description
- * @since 3.1
- */
- public static String getDescription(IConfigurationElement configElement) {
+ }
+
+ /**
+ * Utility for extracting the description child of an element.
+ *
+ * @param configElement the element
+ * @return the description
+ * @since 3.1
+ */
+ public static String getDescription(IConfigurationElement configElement) {
IConfigurationElement[] children = configElement.getChildren(IWorkbenchRegistryConstants.TAG_DESCRIPTION);
- if (children.length >= 1) {
- return children[0].getValue();
- }
- return "";//$NON-NLS-1$
- }
+ if (children.length >= 1) {
+ return children[0].getValue();
+ }
+ return "";//$NON-NLS-1$
+ }
- /**
+ /**
* Utility for extracting the value of a class attribute or a nested class
* element that follows the pattern set forth by
* {@link org.eclipse.core.runtime.IExecutableExtension}.
*
- * @param configElement
- * the element
- * @param classAttributeName
- * the name of the class attribute to check
+ * @param configElement the element
+ * @param classAttributeName the name of the class attribute to check
* @return the value of the attribute or nested class element
* @since 3.1
*/
- public static String getClassValue(IConfigurationElement configElement, String classAttributeName) {
- String className = configElement.getAttribute(classAttributeName);
- if (className != null) {
+ public static String getClassValue(IConfigurationElement configElement, String classAttributeName) {
+ String className = configElement.getAttribute(classAttributeName);
+ if (className != null) {
return className;
}
- IConfigurationElement [] candidateChildren = configElement.getChildren(classAttributeName);
+ IConfigurationElement[] candidateChildren = configElement.getChildren(classAttributeName);
if (candidateChildren.length == 0) {
return null;
}
return candidateChildren[0].getAttribute(IWorkbenchRegistryConstants.ATT_CLASS);
- }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ShowViewHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ShowViewHandler.java
index 3b1fec979af..90b0e10869a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ShowViewHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ShowViewHandler.java
@@ -33,27 +33,24 @@ import org.eclipse.ui.statushandlers.StatusManager;
public final class ShowViewHandler extends AbstractHandler {
/**
- * The identifier of the view this handler should open. This value should
- * never be <code>null</code>.
+ * The identifier of the view this handler should open. This value should never
+ * be <code>null</code>.
*/
private final String viewId;
/**
* Constructs a new instance of <code>ShowViewHandler</code>.
*
- * @param viewId
- * The identifier of the view this handler should open; must not
- * be <code>null</code>.
+ * @param viewId The identifier of the view this handler should open; must not
+ * be <code>null</code>.
*/
public ShowViewHandler(final String viewId) {
this.viewId = viewId;
}
@Override
- public Object execute(final ExecutionEvent event)
- throws ExecutionException {
- final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil
- .getActiveWorkbenchWindowChecked(event);
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+ final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindowChecked(event);
final IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
if (activePage == null) {
@@ -63,8 +60,7 @@ public final class ShowViewHandler extends AbstractHandler {
try {
activePage.showView(viewId);
} catch (PartInitException e) {
- IStatus status = StatusUtil
- .newStatus(e.getStatus(), e.getMessage());
+ IStatus status = StatusUtil.newStatus(e.getStatus(), e.getMessage());
StatusManager.getManager().handle(status, StatusManager.SHOW);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/StickyViewDescriptor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/StickyViewDescriptor.java
index 91810216452..a5afb18037e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/StickyViewDescriptor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/StickyViewDescriptor.java
@@ -25,10 +25,9 @@ import org.eclipse.ui.views.IStickyViewDescriptor;
/**
* @since 3.0
*/
-public class StickyViewDescriptor implements IStickyViewDescriptor,
- IPluginContribution {
+public class StickyViewDescriptor implements IStickyViewDescriptor, IPluginContribution {
- private IConfigurationElement configurationElement;
+ private IConfigurationElement configurationElement;
private String id;
@@ -52,81 +51,78 @@ public class StickyViewDescriptor implements IStickyViewDescriptor,
*/
public static final String STICKY_FOLDER_BOTTOM = "stickyFolderBottom"; //$NON-NLS-1$
- /**
- * @param element
- * @throws CoreException
- */
- public StickyViewDescriptor(IConfigurationElement element)
- throws CoreException {
- this.configurationElement = element;
- id = configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
- if (id == null) {
- throw new CoreException(new Status(IStatus.ERROR, element
- .getContributor().getName(), 0,
- "Invalid extension (missing id) ", null));//$NON-NLS-1$
+ /**
+ * @param element
+ * @throws CoreException
+ */
+ public StickyViewDescriptor(IConfigurationElement element) throws CoreException {
+ this.configurationElement = element;
+ id = configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
+ if (id == null) {
+ throw new CoreException(new Status(IStatus.ERROR, element.getContributor().getName(), 0,
+ "Invalid extension (missing id) ", null));//$NON-NLS-1$
}
- }
+ }
/**
- * Return the configuration element.
- *
+ * Return the configuration element.
+ *
* @return the configuration element
*/
public IConfigurationElement getConfigurationElement() {
return configurationElement;
}
- @Override
+ @Override
public int getLocation() {
- int direction = IPageLayout.RIGHT;
+ int direction = IPageLayout.RIGHT;
- String location = configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_LOCATION);
- if (location != null) {
- if (location.equalsIgnoreCase("left")) { //$NON-NLS-1$
+ String location = configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_LOCATION);
+ if (location != null) {
+ if (location.equalsIgnoreCase("left")) { //$NON-NLS-1$
direction = IPageLayout.LEFT;
} else if (location.equalsIgnoreCase("top")) { //$NON-NLS-1$
direction = IPageLayout.TOP;
} else if (location.equalsIgnoreCase("bottom")) { //$NON-NLS-1$
direction = IPageLayout.BOTTOM;
- //no else for right - it is the default value;
+ // no else for right - it is the default value;
}
- }
- return direction;
- }
+ }
+ return direction;
+ }
- @Override
+ @Override
public String getId() {
- return id;
- }
+ return id;
+ }
- @Override
+ @Override
public String getLocalId() {
- return id;
- }
+ return id;
+ }
- @Override
+ @Override
public String getPluginId() {
- return configurationElement.getContributor().getName();
- }
-
+ return configurationElement.getContributor().getName();
+ }
- @Override
+ @Override
public boolean isCloseable() {
- boolean closeable = true;
- String closeableString = configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_CLOSEABLE);
- if (closeableString != null) {
- closeable = !closeableString.equals("false"); //$NON-NLS-1$
- }
- return closeable;
- }
-
- @Override
+ boolean closeable = true;
+ String closeableString = configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_CLOSEABLE);
+ if (closeableString != null) {
+ closeable = !closeableString.equals("false"); //$NON-NLS-1$
+ }
+ return closeable;
+ }
+
+ @Override
public boolean isMoveable() {
- boolean moveable = true;
- String moveableString = configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_MOVEABLE);
- if (moveableString != null) {
- moveable = !moveableString.equals("false"); //$NON-NLS-1$
- }
- return moveable;
- }
+ boolean moveable = true;
+ String moveableString = configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_MOVEABLE);
+ if (moveableString != null) {
+ moveable = !moveableString.equals("false"); //$NON-NLS-1$
+ }
+ return moveable;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/UIExtensionTracker.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/UIExtensionTracker.java
index 85a4d9efd36..d6ef20d621a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/UIExtensionTracker.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/UIExtensionTracker.java
@@ -23,18 +23,18 @@ import org.eclipse.ui.internal.WorkbenchPlugin;
* @since 3.1
*/
public class UIExtensionTracker extends ExtensionTracker {
- private Display display;
+ private Display display;
- // SOMETHING HAS NOT BEEN DONE IN THE REGISTTRY CHANGED CODE
- // if (!PlatformUI.isWorkbenchRunning())
- // return;
- // int numDeltas = 0;
- // Display display = PlatformUI.getWorkbench().getDisplay();
- // if (display == null || display.isDisposed())
- // return;
- // It seems that the tracker should be closed.
+ // SOMETHING HAS NOT BEEN DONE IN THE REGISTTRY CHANGED CODE
+ // if (!PlatformUI.isWorkbenchRunning())
+ // return;
+ // int numDeltas = 0;
+ // Display display = PlatformUI.getWorkbench().getDisplay();
+ // if (display == null || display.isDisposed())
+ // return;
+ // It seems that the tracker should be closed.
- /**
+ /**
* @param display
*/
public UIExtensionTracker(Display display) {
@@ -42,20 +42,21 @@ public class UIExtensionTracker extends ExtensionTracker {
}
@Override
- protected void applyRemove(final IExtensionChangeHandler handler, final IExtension removedExtension, final Object[] objects) {
+ protected void applyRemove(final IExtensionChangeHandler handler, final IExtension removedExtension,
+ final Object[] objects) {
if (display.isDisposed())
return;
display.asyncExec(() -> {
- try {
- handler.removeExtension(removedExtension, objects);
- } catch (Exception e) {
- WorkbenchPlugin.log(getClass(), "doRemove", e); //$NON-NLS-1$
- }
- });
- }
+ try {
+ handler.removeExtension(removedExtension, objects);
+ } catch (Exception e) {
+ WorkbenchPlugin.log(getClass(), "doRemove", e); //$NON-NLS-1$
+ }
+ });
+ }
- @Override
+ @Override
protected void applyAdd(final IExtensionChangeHandler handler, final IExtension addedExtension) {
if (display.isDisposed())
return;
@@ -65,7 +66,7 @@ public class UIExtensionTracker extends ExtensionTracker {
handler.addExtension(UIExtensionTracker.this, addedExtension);
} catch (Exception e) {
WorkbenchPlugin.log(getClass(), "doAdd", e); //$NON-NLS-1$
- }
- });
- }
+ }
+ });
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewCategory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewCategory.java
index 0682e966d4a..adfa5868a42 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewCategory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewCategory.java
@@ -43,8 +43,7 @@ public class ViewCategory implements IViewCategory {
@Override
public IViewDescriptor[] getViews() {
- Collection<?> allowedViews = WorkbenchActivityHelper.restrictCollection(descriptors,
- new ArrayList<>());
+ Collection<?> allowedViews = WorkbenchActivityHelper.restrictCollection(descriptors, new ArrayList<>());
return allowedViews.toArray(new IViewDescriptor[allowedViews.size()]);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewDescriptor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewDescriptor.java
index 713ce5fb59d..dfd18a04585 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewDescriptor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewDescriptor.java
@@ -41,8 +41,7 @@ public class ViewDescriptor implements IViewDescriptor, IPluginContribution {
private String[] categoryPath;
private ImageDescriptor imageDescriptor;
- public ViewDescriptor(MApplication application, MPartDescriptor descriptor,
- IConfigurationElement element) {
+ public ViewDescriptor(MApplication application, MPartDescriptor descriptor, IConfigurationElement element) {
this.application = application;
this.descriptor = descriptor;
this.element = element;
@@ -84,8 +83,7 @@ public class ViewDescriptor implements IViewDescriptor, IPluginContribution {
if (iconURI == null) {
// If the icon attribute was omitted, use the default one
IWorkbench workbench = application.getContext().get(IWorkbench.class);
- imageDescriptor = workbench.getSharedImages().getImageDescriptor(
- ISharedImages.IMG_DEF_VIEW);
+ imageDescriptor = workbench.getSharedImages().getImageDescriptor(ISharedImages.IMG_DEF_VIEW);
} else {
ISWTResourceUtilities utility = (ISWTResourceUtilities) application.getContext()
.get(IResourceUtilities.class);
@@ -97,8 +95,7 @@ public class ViewDescriptor implements IViewDescriptor, IPluginContribution {
@Override
public String getLabel() {
- return LocalizationHelper.getLocalized(descriptor.getLabel(), descriptor,
- application.getContext());
+ return LocalizationHelper.getLocalized(descriptor.getLabel(), descriptor, application.getContext());
}
@Override
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewParameterValues.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewParameterValues.java
index 47750fcd3eb..f112ef61350 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewParameterValues.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewParameterValues.java
@@ -32,8 +32,7 @@ public final class ViewParameterValues implements IParameterValues {
public Map getParameterValues() {
final Map values = new HashMap();
- final IViewDescriptor[] views = PlatformUI.getWorkbench()
- .getViewRegistry().getViews();
+ final IViewDescriptor[] views = PlatformUI.getWorkbench().getViewRegistry().getViews();
for (final IViewDescriptor view : views) {
values.put(view.getLabel(), view.getId());
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewRegistry.java
index 1c361115513..6150392986b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewRegistry.java
@@ -52,16 +52,14 @@ public class ViewRegistry implements IViewRegistry {
public static final String VIEW_TAG = "View"; //$NON-NLS-1$
/**
- * This constant is used as key for persisting the original class for a
- * legacy {@link ViewPart} in the persisted state of a
- * {@link MPartDescriptor}.
+ * This constant is used as key for persisting the original class for a legacy
+ * {@link ViewPart} in the persisted state of a {@link MPartDescriptor}.
*/
public static final String ORIGINAL_COMPATIBILITY_VIEW_CLASS = "originalCompatibilityViewClass"; //$NON-NLS-1$
/**
- * This constant is used as key for persisting the original bundle for a
- * legacy {@link ViewPart} in the persisted state of a
- * {@link MPartDescriptor}.
+ * This constant is used as key for persisting the original bundle for a legacy
+ * {@link ViewPart} in the persisted state of a {@link MPartDescriptor}.
*/
public static final String ORIGINAL_COMPATIBILITY_VIEW_BUNDLE = "originalCompatibilityViewBundle"; //$NON-NLS-1$
@@ -95,8 +93,7 @@ public class ViewRegistry implements IViewRegistry {
// find the category first
for (IConfigurationElement element : extension.getConfigurationElements()) {
if (element.getName().equals(IWorkbenchRegistryConstants.TAG_CATEGORY)) {
- ViewCategory category = new ViewCategory(
- element.getAttribute(IWorkbenchRegistryConstants.ATT_ID),
+ ViewCategory category = new ViewCategory(element.getAttribute(IWorkbenchRegistryConstants.ATT_ID),
element.getAttribute(IWorkbenchRegistryConstants.ATT_NAME));
categories.put(category.getId(), category);
} else if (element.getName().equals(IWorkbenchRegistryConstants.TAG_STICKYVIEW)) {
@@ -110,8 +107,7 @@ public class ViewRegistry implements IViewRegistry {
}
}
if (!categories.containsKey(miscCategory.getId())) {
- categories.put(miscCategory.getId(), new ViewCategory(miscCategory.getId(),
- miscCategory.getLabel()));
+ categories.put(miscCategory.getId(), new ViewCategory(miscCategory.getId(), miscCategory.getLabel()));
}
for (IExtension extension : point.getExtensions()) {
@@ -149,8 +145,8 @@ public class ViewRegistry implements IViewRegistry {
tags.add(VIEW_TAG);
descriptor.setCloseable(true);
- descriptor.setAllowMultiple(Boolean.parseBoolean(element
- .getAttribute(IWorkbenchRegistryConstants.ATT_ALLOW_MULTIPLE)));
+ descriptor.setAllowMultiple(
+ Boolean.parseBoolean(element.getAttribute(IWorkbenchRegistryConstants.ATT_ALLOW_MULTIPLE)));
// make view description available as tooltip
String viewDescription = RegistryReader.getDescription(element);
@@ -183,8 +179,8 @@ public class ViewRegistry implements IViewRegistry {
String iconURI = MenuHelper.getIconURI(element, IWorkbenchRegistryConstants.ATT_ICON);
if (iconURI == null) {
- descriptor.setIconURI(MenuHelper.getImageUrl(workbench.getSharedImages()
- .getImageDescriptor(ISharedImages.IMG_DEF_VIEW)));
+ descriptor.setIconURI(
+ MenuHelper.getImageUrl(workbench.getSharedImages().getImageDescriptor(ISharedImages.IMG_DEF_VIEW)));
} else {
descriptor.setIconURI(iconURI);
}
@@ -226,24 +222,22 @@ public class ViewRegistry implements IViewRegistry {
@Override
public IViewDescriptor[] getViews() {
- Collection<?> allowedViews = WorkbenchActivityHelper.restrictCollection(
- descriptors.values(), new ArrayList<>());
+ Collection<?> allowedViews = WorkbenchActivityHelper.restrictCollection(descriptors.values(),
+ new ArrayList<>());
return allowedViews.toArray(new IViewDescriptor[allowedViews.size()]);
}
@Override
public IStickyViewDescriptor[] getStickyViews() {
- Collection<?> allowedViews = WorkbenchActivityHelper.restrictCollection(stickyDescriptors,
- new ArrayList<>());
+ Collection<?> allowedViews = WorkbenchActivityHelper.restrictCollection(stickyDescriptors, new ArrayList<>());
return allowedViews.toArray(new IStickyViewDescriptor[allowedViews.size()]);
}
/**
- * Returns the {@link ViewCategory} for the given id or <code>null</code> if
- * one cannot be found or the id is <code>null</code>
+ * Returns the {@link ViewCategory} for the given id or <code>null</code> if one
+ * cannot be found or the id is <code>null</code>
*
- * @param id
- * the {@link ViewCategory} id
+ * @param id the {@link ViewCategory} id
* @return the {@link ViewCategory} with the given id or <code>null</code>
*/
public ViewCategory findCategory(String id) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WizardParameterValues.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WizardParameterValues.java
index f69d7747ed0..3e8ff0042cc 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WizardParameterValues.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WizardParameterValues.java
@@ -24,8 +24,8 @@ import org.eclipse.ui.wizards.IWizardRegistry;
/**
* Provides the parameter values for a show wizard command.
* <p>
- * This class is only intended to be extended by the three inner classes (<code>Export</code>,
- * <code>Import</code> and <code>New</code>) defined here.
+ * This class is only intended to be extended by the three inner classes
+ * (<code>Export</code>, <code>Import</code> and <code>New</code>) defined here.
* </p>
*
* @since 3.2
@@ -66,7 +66,6 @@ public abstract class WizardParameterValues implements IParameterValues {
for (final IWizardDescriptor wizardDescriptor : wizardCategory.getWizards()) {
-
// Note: using description instead of label for the name
// to reduce possibilities of key collision in the map
// final String name = wizardDescriptor.getDescription();
@@ -75,7 +74,7 @@ public abstract class WizardParameterValues implements IParameterValues {
String name = wizardDescriptor.getLabel();
final String id = wizardDescriptor.getId();
final String value = (String) values.get(name);
- if (value!=null && !value.equals(id)) {
+ if (value != null && !value.equals(id)) {
name = name + " (" + id + ")"; //$NON-NLS-1$//$NON-NLS-2$
}
values.put(name, id);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WizardsRegistryReader.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WizardsRegistryReader.java
index b616b3522d1..fbebd22f2d5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WizardsRegistryReader.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WizardsRegistryReader.java
@@ -35,520 +35,507 @@ import org.eclipse.ui.internal.dialogs.WizardCollectionElement;
import org.eclipse.ui.internal.dialogs.WorkbenchWizardElement;
/**
- * Instances access the registry that is provided at creation time
- * in order to determine the contained Wizards
+ * Instances access the registry that is provided at creation time in order to
+ * determine the contained Wizards
*/
public class WizardsRegistryReader extends RegistryReader {
private String pluginPoint;
- private WizardCollectionElement wizardElements = null;
+ private WizardCollectionElement wizardElements = null;
- private ArrayList deferWizards = null;
+ private ArrayList deferWizards = null;
- private ArrayList deferCategories = null;
+ private ArrayList deferCategories = null;
- private Set deferPrimary;
+ private Set deferPrimary;
- // constants
- /**
- * Examples wizard category id
- */
- public static final String FULL_EXAMPLES_WIZARD_CATEGORY = "org.eclipse.ui.Examples";//$NON-NLS-1$
- /**
- * Other wizard category id
- */
- final public static String UNCATEGORIZED_WIZARD_CATEGORY = "org.eclipse.ui.Other";//$NON-NLS-1$
- /**
- * General wizard category id
- */
- final public static String GENERAL_WIZARD_CATEGORY = "org.eclipse.ui.Basic"; //$NON-NLS-1$
+ // constants
+ /**
+ * Examples wizard category id
+ */
+ public static final String FULL_EXAMPLES_WIZARD_CATEGORY = "org.eclipse.ui.Examples";//$NON-NLS-1$
+ /**
+ * Other wizard category id
+ */
+ final public static String UNCATEGORIZED_WIZARD_CATEGORY = "org.eclipse.ui.Other";//$NON-NLS-1$
+ /**
+ * General wizard category id
+ */
+ final public static String GENERAL_WIZARD_CATEGORY = "org.eclipse.ui.Basic"; //$NON-NLS-1$
- final private static String UNCATEGORIZED_WIZARD_CATEGORY_LABEL = WorkbenchMessages.NewWizardsRegistryReader_otherCategory;
+ final private static String UNCATEGORIZED_WIZARD_CATEGORY_LABEL = WorkbenchMessages.NewWizardsRegistryReader_otherCategory;
- private static final String CATEGORY_SEPARATOR = "/";//$NON-NLS-1$
+ private static final String CATEGORY_SEPARATOR = "/";//$NON-NLS-1$
- private WorkbenchWizardElement[] primaryWizards = new WorkbenchWizardElement[0];
+ private WorkbenchWizardElement[] primaryWizards = new WorkbenchWizardElement[0];
private static class CategoryNode {
- private Category category;
-
- private String path;
-
- CategoryNode(Category cat) {
- category = cat;
- path = ""; //$NON-NLS-1$
- String[] categoryPath = category.getParentPath();
- if (categoryPath != null) {
- for (String parentPath : categoryPath) {
- path += parentPath + '/';
- }
- }
- path += cat.getId();
- }
-
- String getPath() {
- return path;
- }
-
- Category getCategory() {
- return category;
- }
- }
-
- private static final Comparator comparer = new Comparator() {
- private Collator collator = Collator.getInstance();
-
- @Override
+ private Category category;
+
+ private String path;
+
+ CategoryNode(Category cat) {
+ category = cat;
+ path = ""; //$NON-NLS-1$
+ String[] categoryPath = category.getParentPath();
+ if (categoryPath != null) {
+ for (String parentPath : categoryPath) {
+ path += parentPath + '/';
+ }
+ }
+ path += cat.getId();
+ }
+
+ String getPath() {
+ return path;
+ }
+
+ Category getCategory() {
+ return category;
+ }
+ }
+
+ private static final Comparator comparer = new Comparator() {
+ private Collator collator = Collator.getInstance();
+
+ @Override
public int compare(Object arg0, Object arg1) {
- String s1 = ((CategoryNode) arg0).getPath();
- String s2 = ((CategoryNode) arg1).getPath();
- return collator.compare(s1, s2);
- }
- };
+ String s1 = ((CategoryNode) arg0).getPath();
+ String s2 = ((CategoryNode) arg1).getPath();
+ return collator.compare(s1, s2);
+ }
+ };
private boolean readAll = true;
private String plugin;
- /**
- *Create an instance of this class.
- *
- * @param pluginId the plugin id
- * @param pluginPointId java.lang.String
- */
- public WizardsRegistryReader(String pluginId, String pluginPointId) {
- pluginPoint = pluginPointId;
- plugin = pluginId;
- }
+ /**
+ * Create an instance of this class.
+ *
+ * @param pluginId the plugin id
+ * @param pluginPointId java.lang.String
+ */
+ public WizardsRegistryReader(String pluginId, String pluginPointId) {
+ pluginPoint = pluginPointId;
+ plugin = pluginId;
+ }
/*
* <p> This implementation uses a defering strategy. For more info see
* <code>readWizards</code>. </p>
*/
- protected void addNewElementToResult(WorkbenchWizardElement element,
- IConfigurationElement config) {
- // TODO: can we remove the config parameter?
- deferWizard(element);
- }
-
- /**
- *
- * @param parent
- * @param element
- * @since 3.1
- */
- private WizardCollectionElement createCollectionElement(WizardCollectionElement parent, IConfigurationElement element) {
- WizardCollectionElement newElement = new WizardCollectionElement(
- element, parent);
-
- parent.add(newElement);
- return newElement;
+ protected void addNewElementToResult(WorkbenchWizardElement element, IConfigurationElement config) {
+ // TODO: can we remove the config parameter?
+ deferWizard(element);
}
- /**
- * Create and answer a new WizardCollectionElement, configured as a
- * child of <code>parent</code>
- *
- * @return org.eclipse.ui.internal.model.WizardCollectionElement
- * @param parent org.eclipse.ui.internal.model.WizardCollectionElement
- * @param id the id of the new collection
- * @param pluginId the originating plugin id of the collection, if any. <code>null</code> otherwise.
- * @param label java.lang.String
- */
- protected WizardCollectionElement createCollectionElement(
- WizardCollectionElement parent, String id, String pluginId,
- String label) {
- WizardCollectionElement newElement = new WizardCollectionElement(id,
- pluginId, label, parent);
-
- parent.add(newElement);
- return newElement;
- }
-
- /**
- * Creates empty element collection. Overrider to fill
- * initial elements, if needed.
- */
- protected void createEmptyWizardCollection() {
- wizardElements = new WizardCollectionElement("root", null, "root", null);//$NON-NLS-2$//$NON-NLS-1$
- }
-
- /**
- * Set the initial wizard set for supplemental reading via dynamic plugin loading.
- *
- * @param wizards the wizards
- * @since 3.1
- */
- public void setInitialCollection(WizardCollectionElement wizards) {
- wizardElements = wizards;
- readAll = false;
- }
-
- /**
- * Stores a category element for deferred addition.
- */
- private void deferCategory(IConfigurationElement config) {
- // Create category.
- Category category = null;
- try {
- category = new Category(config);
- } catch (CoreException e) {
- WorkbenchPlugin.log("Cannot create category: ", e.getStatus());//$NON-NLS-1$
- return;
- }
-
- // Defer for later processing.
- if (deferCategories == null) {
- deferCategories = new ArrayList(20);
+
+ /**
+ *
+ * @param parent
+ * @param element
+ * @since 3.1
+ */
+ private WizardCollectionElement createCollectionElement(WizardCollectionElement parent,
+ IConfigurationElement element) {
+ WizardCollectionElement newElement = new WizardCollectionElement(element, parent);
+
+ parent.add(newElement);
+ return newElement;
+ }
+
+ /**
+ * Create and answer a new WizardCollectionElement, configured as a child of
+ * <code>parent</code>
+ *
+ * @return org.eclipse.ui.internal.model.WizardCollectionElement
+ * @param parent org.eclipse.ui.internal.model.WizardCollectionElement
+ * @param id the id of the new collection
+ * @param pluginId the originating plugin id of the collection, if any.
+ * <code>null</code> otherwise.
+ * @param label java.lang.String
+ */
+ protected WizardCollectionElement createCollectionElement(WizardCollectionElement parent, String id,
+ String pluginId, String label) {
+ WizardCollectionElement newElement = new WizardCollectionElement(id, pluginId, label, parent);
+
+ parent.add(newElement);
+ return newElement;
+ }
+
+ /**
+ * Creates empty element collection. Overrider to fill initial elements, if
+ * needed.
+ */
+ protected void createEmptyWizardCollection() {
+ wizardElements = new WizardCollectionElement("root", null, "root", null);//$NON-NLS-2$//$NON-NLS-1$
+ }
+
+ /**
+ * Set the initial wizard set for supplemental reading via dynamic plugin
+ * loading.
+ *
+ * @param wizards the wizards
+ * @since 3.1
+ */
+ public void setInitialCollection(WizardCollectionElement wizards) {
+ wizardElements = wizards;
+ readAll = false;
+ }
+
+ /**
+ * Stores a category element for deferred addition.
+ */
+ private void deferCategory(IConfigurationElement config) {
+ // Create category.
+ Category category = null;
+ try {
+ category = new Category(config);
+ } catch (CoreException e) {
+ WorkbenchPlugin.log("Cannot create category: ", e.getStatus());//$NON-NLS-1$
+ return;
}
- deferCategories.add(category);
- }
+ // Defer for later processing.
+ if (deferCategories == null) {
+ deferCategories = new ArrayList(20);
+ }
+ deferCategories.add(category);
+ }
- /**
- * Stores a wizard element for deferred addition.
- */
- private void deferWizard(WorkbenchWizardElement element) {
- if (deferWizards == null) {
+ /**
+ * Stores a wizard element for deferred addition.
+ */
+ private void deferWizard(WorkbenchWizardElement element) {
+ if (deferWizards == null) {
deferWizards = new ArrayList(50);
}
- deferWizards.add(element);
- }
-
- /**
- * Finishes the addition of categories. The categories are sorted and
- * added in a root to depth traversal.
- */
- private void finishCategories() {
- // If no categories just return.
- if (deferCategories == null) {
+ deferWizards.add(element);
+ }
+
+ /**
+ * Finishes the addition of categories. The categories are sorted and added in a
+ * root to depth traversal.
+ */
+ private void finishCategories() {
+ // If no categories just return.
+ if (deferCategories == null) {
return;
}
- // Sort categories by flattened name.
- CategoryNode[] flatArray = new CategoryNode[deferCategories.size()];
- for (int i = 0; i < deferCategories.size(); i++) {
- flatArray[i] = new CategoryNode((Category) deferCategories.get(i));
- }
- Collections.sort(Arrays.asList(flatArray), comparer);
-
- // Add each category.
- for (CategoryNode categoryNode : flatArray) {
- Category cat = categoryNode.getCategory();
- finishCategory(cat);
- }
-
- // Cleanup.
- deferCategories = null;
- }
-
- /**
- * Save new category definition.
- */
- private void finishCategory(Category category) {
- String[] categoryPath = category.getParentPath();
- WizardCollectionElement parent = wizardElements; // ie.- root
-
- // Traverse down into parent category.
- if (categoryPath != null) {
- for (String parentPath : categoryPath) {
- WizardCollectionElement tempElement = getChildWithID(parent,
- parentPath);
- if (tempElement == null) {
- // The parent category is invalid. By returning here the
- // category will be dropped and any wizard within the category
- // will be added to the "Other" category.
- return;
- }
- parent = tempElement;
- }
- }
-
- // If another category already exists with the same id ignore this one.
- Object test = getChildWithID(parent, category.getId());
- if (test != null) {
+ // Sort categories by flattened name.
+ CategoryNode[] flatArray = new CategoryNode[deferCategories.size()];
+ for (int i = 0; i < deferCategories.size(); i++) {
+ flatArray[i] = new CategoryNode((Category) deferCategories.get(i));
+ }
+ Collections.sort(Arrays.asList(flatArray), comparer);
+
+ // Add each category.
+ for (CategoryNode categoryNode : flatArray) {
+ Category cat = categoryNode.getCategory();
+ finishCategory(cat);
+ }
+
+ // Cleanup.
+ deferCategories = null;
+ }
+
+ /**
+ * Save new category definition.
+ */
+ private void finishCategory(Category category) {
+ String[] categoryPath = category.getParentPath();
+ WizardCollectionElement parent = wizardElements; // ie.- root
+
+ // Traverse down into parent category.
+ if (categoryPath != null) {
+ for (String parentPath : categoryPath) {
+ WizardCollectionElement tempElement = getChildWithID(parent, parentPath);
+ if (tempElement == null) {
+ // The parent category is invalid. By returning here the
+ // category will be dropped and any wizard within the category
+ // will be added to the "Other" category.
+ return;
+ }
+ parent = tempElement;
+ }
+ }
+
+ // If another category already exists with the same id ignore this one.
+ Object test = getChildWithID(parent, category.getId());
+ if (test != null) {
return;
}
- if (parent != null) {
+ if (parent != null) {
createCollectionElement(parent, Adapters.adapt(category, IConfigurationElement.class));
}
- }
+ }
+
+ /**
+ * Finishes the recognition of primary wizards.
+ */
+ private void finishPrimary() {
+ if (deferPrimary != null) {
+ ArrayList primary = new ArrayList();
+ for (Iterator i = deferPrimary.iterator(); i.hasNext();) {
+ String id = (String) i.next();
+ WorkbenchWizardElement element = wizardElements == null ? null : wizardElements.findWizard(id, true);
+ if (element != null) {
+ primary.add(element);
+ }
+ }
+ primaryWizards = (WorkbenchWizardElement[]) primary.toArray(new WorkbenchWizardElement[primary.size()]);
+
+ deferPrimary = null;
+ }
+ }
/**
- * Finishes the recognition of primary wizards.
- */
- private void finishPrimary() {
- if (deferPrimary != null) {
- ArrayList primary = new ArrayList();
- for (Iterator i = deferPrimary.iterator(); i.hasNext();) {
- String id = (String) i.next();
- WorkbenchWizardElement element = wizardElements == null ? null : wizardElements.findWizard(id, true);
- if (element != null) {
- primary.add(element);
- }
- }
-
- primaryWizards = (WorkbenchWizardElement[]) primary
- .toArray(new WorkbenchWizardElement[primary.size()]);
-
- deferPrimary = null;
- }
- }
-
-
- /**
- * Insert the passed wizard element into the wizard collection appropriately
- * based upon its defining extension's CATEGORY tag value
- *
- * @param element WorkbenchWizardElement
- * @param config configuration element
- */
- private void finishWizard(WorkbenchWizardElement element,
- IConfigurationElement config) {
- StringTokenizer familyTokenizer = new StringTokenizer(
- getCategoryStringFor(config), CATEGORY_SEPARATOR);
-
- // use the period-separated sections of the current Wizard's category
- // to traverse through the NamedSolution "tree" that was previously created
- WizardCollectionElement currentCollectionElement = wizardElements; // ie.- root
- boolean moveToOther = false;
-
- while (familyTokenizer.hasMoreElements()) {
- WizardCollectionElement tempCollectionElement = getChildWithID(
- currentCollectionElement, familyTokenizer.nextToken());
-
- if (tempCollectionElement == null) { // can't find the path; bump it to uncategorized
- moveToOther = true;
- break;
- }
- currentCollectionElement = tempCollectionElement;
- }
-
- if (moveToOther) {
+ * Insert the passed wizard element into the wizard collection appropriately
+ * based upon its defining extension's CATEGORY tag value
+ *
+ * @param element WorkbenchWizardElement
+ * @param config configuration element
+ */
+ private void finishWizard(WorkbenchWizardElement element, IConfigurationElement config) {
+ StringTokenizer familyTokenizer = new StringTokenizer(getCategoryStringFor(config), CATEGORY_SEPARATOR);
+
+ // use the period-separated sections of the current Wizard's category
+ // to traverse through the NamedSolution "tree" that was previously created
+ WizardCollectionElement currentCollectionElement = wizardElements; // ie.- root
+ boolean moveToOther = false;
+
+ while (familyTokenizer.hasMoreElements()) {
+ WizardCollectionElement tempCollectionElement = getChildWithID(currentCollectionElement,
+ familyTokenizer.nextToken());
+
+ if (tempCollectionElement == null) { // can't find the path; bump it to uncategorized
+ moveToOther = true;
+ break;
+ }
+ currentCollectionElement = tempCollectionElement;
+ }
+
+ if (moveToOther) {
moveElementToUncategorizedCategory(wizardElements, element);
} else {
- currentCollectionElement.add(element);
- element.setParent(currentCollectionElement);
- }
- }
-
- /**
- * Finishes the addition of wizards. The wizards are processed and categorized.
- */
- private void finishWizards() {
- if (deferWizards != null) {
- Iterator iter = deferWizards.iterator();
- while (iter.hasNext()) {
- WorkbenchWizardElement wizard = (WorkbenchWizardElement) iter
- .next();
- IConfigurationElement config = wizard.getConfigurationElement();
- finishWizard(wizard, config);
- }
- deferWizards = null;
- }
- }
-
- /**
- * Return the appropriate category (tree location) for this Wizard.
- * If a category is not specified then return a default one.
- */
- protected String getCategoryStringFor(IConfigurationElement config) {
- String result = config.getAttribute(IWorkbenchRegistryConstants.TAG_CATEGORY);
- if (result == null) {
+ currentCollectionElement.add(element);
+ element.setParent(currentCollectionElement);
+ }
+ }
+
+ /**
+ * Finishes the addition of wizards. The wizards are processed and categorized.
+ */
+ private void finishWizards() {
+ if (deferWizards != null) {
+ Iterator iter = deferWizards.iterator();
+ while (iter.hasNext()) {
+ WorkbenchWizardElement wizard = (WorkbenchWizardElement) iter.next();
+ IConfigurationElement config = wizard.getConfigurationElement();
+ finishWizard(wizard, config);
+ }
+ deferWizards = null;
+ }
+ }
+
+ /**
+ * Return the appropriate category (tree location) for this Wizard. If a
+ * category is not specified then return a default one.
+ */
+ protected String getCategoryStringFor(IConfigurationElement config) {
+ String result = config.getAttribute(IWorkbenchRegistryConstants.TAG_CATEGORY);
+ if (result == null) {
result = UNCATEGORIZED_WIZARD_CATEGORY;
}
- return result;
- }
-
- /**
- * Go through the children of the passed parent and answer the child
- * with the passed name. If no such child is found then return null.
- *
- * @return org.eclipse.ui.internal.model.WizardCollectionElement
- * @param parent org.eclipse.ui.internal.model.WizardCollectionElement
- * @param id java.lang.String
- */
- protected WizardCollectionElement getChildWithID(
- WizardCollectionElement parent, String id) {
+ return result;
+ }
+
+ /**
+ * Go through the children of the passed parent and answer the child with the
+ * passed name. If no such child is found then return null.
+ *
+ * @return org.eclipse.ui.internal.model.WizardCollectionElement
+ * @param parent org.eclipse.ui.internal.model.WizardCollectionElement
+ * @param id java.lang.String
+ */
+ protected WizardCollectionElement getChildWithID(WizardCollectionElement parent, String id) {
for (Object child : parent.getChildren(null)) {
WizardCollectionElement currentChild = (WizardCollectionElement) child;
- if (currentChild.getId().equals(id)) {
+ if (currentChild.getId().equals(id)) {
return currentChild;
}
- }
- return null;
- }
-
- /**
- * Moves given element to "Other" category, previously creating one if missing.
- */
- protected void moveElementToUncategorizedCategory(
- WizardCollectionElement root, WorkbenchWizardElement element) {
- WizardCollectionElement otherCategory = getChildWithID(root,
- UNCATEGORIZED_WIZARD_CATEGORY);
-
- if (otherCategory == null) {
- otherCategory = createCollectionElement(root,
- UNCATEGORIZED_WIZARD_CATEGORY, null,
- UNCATEGORIZED_WIZARD_CATEGORY_LABEL);
}
+ return null;
+ }
+
+ /**
+ * Moves given element to "Other" category, previously creating one if missing.
+ */
+ protected void moveElementToUncategorizedCategory(WizardCollectionElement root, WorkbenchWizardElement element) {
+ WizardCollectionElement otherCategory = getChildWithID(root, UNCATEGORIZED_WIZARD_CATEGORY);
+
+ if (otherCategory == null) {
+ otherCategory = createCollectionElement(root, UNCATEGORIZED_WIZARD_CATEGORY, null,
+ UNCATEGORIZED_WIZARD_CATEGORY_LABEL);
+ }
+
+ otherCategory.add(element);
+ element.setParent(otherCategory);
+ }
- otherCategory.add(element);
- element.setParent(otherCategory);
- }
-
- /**
- * Removes the empty categories from a wizard collection.
- */
- private void pruneEmptyCategories(WizardCollectionElement parent) {
- Object[] children = parent.getChildren(null);
- for (Object element : children) {
- WizardCollectionElement child = (WizardCollectionElement) element;
- pruneEmptyCategories(child);
- boolean shouldPrune = child.getId().equals(FULL_EXAMPLES_WIZARD_CATEGORY);
- if (child.isEmpty() && shouldPrune) {
+ /**
+ * Removes the empty categories from a wizard collection.
+ */
+ private void pruneEmptyCategories(WizardCollectionElement parent) {
+ Object[] children = parent.getChildren(null);
+ for (Object element : children) {
+ WizardCollectionElement child = (WizardCollectionElement) element;
+ pruneEmptyCategories(child);
+ boolean shouldPrune = child.getId().equals(FULL_EXAMPLES_WIZARD_CATEGORY);
+ if (child.isEmpty() && shouldPrune) {
parent.remove(child);
}
- }
- }
+ }
+ }
- /**
- * Implement this method to read element attributes.
- */
- @Override
+ /**
+ * Implement this method to read element attributes.
+ */
+ @Override
public boolean readElement(IConfigurationElement element) {
- if (element.getName().equals(IWorkbenchRegistryConstants.TAG_CATEGORY)) {
- deferCategory(element);
- return true;
- } else if (element.getName().equals(IWorkbenchRegistryConstants.TAG_PRIMARYWIZARD)) {
- if (deferPrimary == null) {
+ if (element.getName().equals(IWorkbenchRegistryConstants.TAG_CATEGORY)) {
+ deferCategory(element);
+ return true;
+ } else if (element.getName().equals(IWorkbenchRegistryConstants.TAG_PRIMARYWIZARD)) {
+ if (deferPrimary == null) {
deferPrimary = new HashSet();
}
- deferPrimary.add(element.getAttribute(IWorkbenchRegistryConstants.ATT_ID));
+ deferPrimary.add(element.getAttribute(IWorkbenchRegistryConstants.ATT_ID));
- return true;
- } else {
- if (!element.getName().equals(IWorkbenchRegistryConstants.TAG_WIZARD)) {
+ return true;
+ } else {
+ if (!element.getName().equals(IWorkbenchRegistryConstants.TAG_WIZARD)) {
return false;
}
- WorkbenchWizardElement wizard = createWizardElement(element);
- if (wizard != null) {
+ WorkbenchWizardElement wizard = createWizardElement(element);
+ if (wizard != null) {
addNewElementToResult(wizard, element);
}
- return true;
- }
- }
-
- /**
- * Reads the wizards in a registry.
- * <p>
- * This implementation uses a defering strategy. All of the elements
- * (categories, wizards) are read. The categories are created as the read occurs.
- * The wizards are just stored for later addition after the read completes.
- * This ensures that wizard categorization is performed after all categories
- * have been read.
- * </p>
- */
- protected void readWizards() {
- if (readAll) {
- if (!areWizardsRead()) {
- createEmptyWizardCollection();
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- readRegistry(registry, plugin, pluginPoint);
- }
- }
- finishCategories();
- finishWizards();
- finishPrimary();
- if (wizardElements != null) {
- pruneEmptyCategories(wizardElements);
- }
- }
-
- /**
- * Returns the list of wizards that are considered 'primary'.
- *
- * The return value for this method is cached since computing its value
- * requires non-trivial work.
- *
- * @return the primary wizards
- */
- public WorkbenchWizardElement [] getPrimaryWizards() {
- if (!areWizardsRead()) {
- readWizards();
- }
- return (WorkbenchWizardElement[]) WorkbenchActivityHelper.restrictArray(primaryWizards);
- }
-
-
- /**
- * Returns whether the wizards have been read already
- */
- protected boolean areWizardsRead() {
- return wizardElements != null && readAll;
- }
-
- /**
- * Returns a list of wizards, project and not.
- *
- * The return value for this method is cached since computing its value
- * requires non-trivial work.
- *
- * @return the wizard collection
- */
- public WizardCollectionElement getWizardElements() {
- if (!areWizardsRead()) {
- readWizards();
- }
- return wizardElements;
- }
-
- protected Object[] getWizardCollectionElements() {
- if (!areWizardsRead()) {
- readWizards();
- }
- return wizardElements.getChildren();
- }
-
- /**
- * Returns a new WorkbenchWizardElement configured according to the parameters
- * contained in the passed Registry.
- *
- * May answer null if there was not enough information in the Extension to create
- * an adequate wizard
- */
- protected WorkbenchWizardElement createWizardElement(
- IConfigurationElement element) {
- // WizardElements must have a name attribute
- if (element.getAttribute(IWorkbenchRegistryConstants.ATT_NAME) == null) {
- logMissingAttribute(element, IWorkbenchRegistryConstants.ATT_NAME);
- return null;
- }
-
- if (getClassValue(element, IWorkbenchRegistryConstants.ATT_CLASS) == null) {
- logMissingAttribute(element, IWorkbenchRegistryConstants.ATT_CLASS);
- return null;
- }
- return new WorkbenchWizardElement(element);
- }
-
- /**
- * Returns the first wizard with a given id.
- *
- * @param id wizard id to search for
- * @return WorkbenchWizardElement matching the given id, if found; null otherwise
- */
- public WorkbenchWizardElement findWizard(String id) {
+ return true;
+ }
+ }
+
+ /**
+ * Reads the wizards in a registry.
+ * <p>
+ * This implementation uses a defering strategy. All of the elements
+ * (categories, wizards) are read. The categories are created as the read
+ * occurs. The wizards are just stored for later addition after the read
+ * completes. This ensures that wizard categorization is performed after all
+ * categories have been read.
+ * </p>
+ */
+ protected void readWizards() {
+ if (readAll) {
+ if (!areWizardsRead()) {
+ createEmptyWizardCollection();
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ readRegistry(registry, plugin, pluginPoint);
+ }
+ }
+ finishCategories();
+ finishWizards();
+ finishPrimary();
+ if (wizardElements != null) {
+ pruneEmptyCategories(wizardElements);
+ }
+ }
+
+ /**
+ * Returns the list of wizards that are considered 'primary'.
+ *
+ * The return value for this method is cached since computing its value requires
+ * non-trivial work.
+ *
+ * @return the primary wizards
+ */
+ public WorkbenchWizardElement[] getPrimaryWizards() {
+ if (!areWizardsRead()) {
+ readWizards();
+ }
+ return (WorkbenchWizardElement[]) WorkbenchActivityHelper.restrictArray(primaryWizards);
+ }
+
+ /**
+ * Returns whether the wizards have been read already
+ */
+ protected boolean areWizardsRead() {
+ return wizardElements != null && readAll;
+ }
+
+ /**
+ * Returns a list of wizards, project and not.
+ *
+ * The return value for this method is cached since computing its value requires
+ * non-trivial work.
+ *
+ * @return the wizard collection
+ */
+ public WizardCollectionElement getWizardElements() {
+ if (!areWizardsRead()) {
+ readWizards();
+ }
+ return wizardElements;
+ }
+
+ protected Object[] getWizardCollectionElements() {
+ if (!areWizardsRead()) {
+ readWizards();
+ }
+ return wizardElements.getChildren();
+ }
+
+ /**
+ * Returns a new WorkbenchWizardElement configured according to the parameters
+ * contained in the passed Registry.
+ *
+ * May answer null if there was not enough information in the Extension to
+ * create an adequate wizard
+ */
+ protected WorkbenchWizardElement createWizardElement(IConfigurationElement element) {
+ // WizardElements must have a name attribute
+ if (element.getAttribute(IWorkbenchRegistryConstants.ATT_NAME) == null) {
+ logMissingAttribute(element, IWorkbenchRegistryConstants.ATT_NAME);
+ return null;
+ }
+
+ if (getClassValue(element, IWorkbenchRegistryConstants.ATT_CLASS) == null) {
+ logMissingAttribute(element, IWorkbenchRegistryConstants.ATT_CLASS);
+ return null;
+ }
+ return new WorkbenchWizardElement(element);
+ }
+
+ /**
+ * Returns the first wizard with a given id.
+ *
+ * @param id wizard id to search for
+ * @return WorkbenchWizardElement matching the given id, if found; null
+ * otherwise
+ */
+ public WorkbenchWizardElement findWizard(String id) {
for (Object wizard : getWizardCollectionElements()) {
- WizardCollectionElement collection = (WizardCollectionElement) wizard;
- WorkbenchWizardElement element = collection.findWizard(id, true);
- if (element != null && !WorkbenchActivityHelper.restrictUseOf(element)) {
+ WizardCollectionElement collection = (WizardCollectionElement) wizard;
+ WorkbenchWizardElement element = collection.findWizard(id, true);
+ if (element != null && !WorkbenchActivityHelper.restrictUseOf(element)) {
return element;
}
- }
- return null;
- }
+ }
+ return null;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WorkingSetDescriptor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WorkingSetDescriptor.java
index 10e298aaf80..c9083be7664 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WorkingSetDescriptor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WorkingSetDescriptor.java
@@ -30,114 +30,107 @@ import org.eclipse.ui.internal.WorkbenchPlugin;
import org.eclipse.ui.plugin.AbstractUIPlugin;
/**
- * A working set descriptor stores the plugin registry data for
- * a working set page extension.
+ * A working set descriptor stores the plugin registry data for a working set
+ * page extension.
*
* @since 2.0
*/
public class WorkingSetDescriptor implements IPluginContribution {
- private String id;
+ private String id;
- private String name;
+ private String name;
- private String icon;
+ private String icon;
- private String pageClassName;
+ private String pageClassName;
- private String updaterClassName;
+ private String updaterClassName;
- private IConfigurationElement configElement;
+ private IConfigurationElement configElement;
- private String[] classTypes;
+ private String[] classTypes;
private String[] adapterTypes;
- private static final String ATT_ID = "id"; //$NON-NLS-1$
+ private static final String ATT_ID = "id"; //$NON-NLS-1$
- private static final String ATT_NAME = "name"; //$NON-NLS-1$
+ private static final String ATT_NAME = "name"; //$NON-NLS-1$
- private static final String ATT_ICON = "icon"; //$NON-NLS-1$
+ private static final String ATT_ICON = "icon"; //$NON-NLS-1$
- private static final String ATT_PAGE_CLASS = "pageClass"; //$NON-NLS-1$
+ private static final String ATT_PAGE_CLASS = "pageClass"; //$NON-NLS-1$
- private static final String ATT_UPDATER_CLASS = "updaterClass"; //$NON-NLS-1$
+ private static final String ATT_UPDATER_CLASS = "updaterClass"; //$NON-NLS-1$
- private static final String ATT_ELEMENT_ADAPTER_CLASS = "elementAdapterClass"; //$NON-NLS-1$
+ private static final String ATT_ELEMENT_ADAPTER_CLASS = "elementAdapterClass"; //$NON-NLS-1$
- private static final String TAG_APPLICABLE_TYPE = "applicableType"; //$NON-NLS-1$
+ private static final String TAG_APPLICABLE_TYPE = "applicableType"; //$NON-NLS-1$
- /**
- * Creates a descriptor from a configuration element.
- *
- * @param configElement configuration element to create a descriptor from
- */
- public WorkingSetDescriptor(IConfigurationElement configElement)
- throws CoreException {
- super();
- this.configElement = configElement;
- id = configElement.getAttribute(ATT_ID);
- name = configElement.getAttribute(ATT_NAME);
- icon = configElement.getAttribute(ATT_ICON);
- pageClassName = configElement.getAttribute(ATT_PAGE_CLASS);
- updaterClassName = configElement.getAttribute(ATT_UPDATER_CLASS);
-
- if (name == null) {
- throw new CoreException(new Status(IStatus.ERROR,
- WorkbenchPlugin.PI_WORKBENCH, 0,
- "Invalid extension (missing class name): " + id, //$NON-NLS-1$
- null));
- }
+ /**
+ * Creates a descriptor from a configuration element.
+ *
+ * @param configElement configuration element to create a descriptor from
+ */
+ public WorkingSetDescriptor(IConfigurationElement configElement) throws CoreException {
+ super();
+ this.configElement = configElement;
+ id = configElement.getAttribute(ATT_ID);
+ name = configElement.getAttribute(ATT_NAME);
+ icon = configElement.getAttribute(ATT_ICON);
+ pageClassName = configElement.getAttribute(ATT_PAGE_CLASS);
+ updaterClassName = configElement.getAttribute(ATT_UPDATER_CLASS);
+
+ if (name == null) {
+ throw new CoreException(new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 0,
+ "Invalid extension (missing class name): " + id, //$NON-NLS-1$
+ null));
+ }
- IConfigurationElement[] containsChildren = configElement
- .getChildren(TAG_APPLICABLE_TYPE);
+ IConfigurationElement[] containsChildren = configElement.getChildren(TAG_APPLICABLE_TYPE);
if (containsChildren.length > 0) {
List byClassList = new ArrayList(containsChildren.length);
List byAdapterList = new ArrayList(containsChildren.length);
for (IConfigurationElement child : containsChildren) {
- String className = child
- .getAttribute(IWorkbenchRegistryConstants.ATT_CLASS);
+ String className = child.getAttribute(IWorkbenchRegistryConstants.ATT_CLASS);
if (className != null)
byClassList.add(className);
- if ("true".equals(child.getAttribute(IWorkbenchRegistryConstants.ATT_ADAPTABLE))) //$NON-NLS-1$
+ if ("true".equals(child.getAttribute(IWorkbenchRegistryConstants.ATT_ADAPTABLE))) //$NON-NLS-1$
byAdapterList.add(className);
}
if (!byClassList.isEmpty()) {
- classTypes = (String[]) byClassList.toArray(new String[byClassList
- .size()]);
+ classTypes = (String[]) byClassList.toArray(new String[byClassList.size()]);
Arrays.sort(classTypes);
}
if (!byAdapterList.isEmpty()) {
- adapterTypes = (String[]) byAdapterList.toArray(new String[byAdapterList
- .size()]);
+ adapterTypes = (String[]) byAdapterList.toArray(new String[byAdapterList.size()]);
Arrays.sort(adapterTypes);
}
}
- }
-
- /**
- * Returns the name space that declares this working set.
- *
- * @return the name space declaring this working set
- */
- public String getDeclaringNamespace() {
+ }
+
+ /**
+ * Returns the name space that declares this working set.
+ *
+ * @return the name space declaring this working set
+ */
+ public String getDeclaringNamespace() {
return configElement.getContributor().getName();
- }
+ }
- /**
- * Return the namespace that contains the class referenced by the
- * updaterClass. May be the bundle that declared this extension or another
- * bundle that contains the referenced class.
+ /**
+ * Return the namespace that contains the class referenced by the updaterClass.
+ * May be the bundle that declared this extension or another bundle that
+ * contains the referenced class.
*
* @return the namespace
* @since 3.3
*/
public String getUpdaterNamespace() {
- return WorkbenchPlugin.getBundleForExecutableExtension(configElement,
- ATT_UPDATER_CLASS).getSymbolicName();
+ return WorkbenchPlugin.getBundleForExecutableExtension(configElement, ATT_UPDATER_CLASS).getSymbolicName();
}
- /**
+ /**
* Return the namespace that contains the class referenced by the
* elementAdapterClass. May be the bundle that declared this extension or
* another bundle that contains the referenced class.
@@ -146,86 +139,82 @@ public class WorkingSetDescriptor implements IPluginContribution {
* @since 3.3
*/
public String getElementAdapterNamespace() {
- return WorkbenchPlugin.getBundleForExecutableExtension(configElement,
- ATT_UPDATER_CLASS).getSymbolicName();
+ return WorkbenchPlugin.getBundleForExecutableExtension(configElement, ATT_UPDATER_CLASS).getSymbolicName();
}
- /**
+ /**
* Creates a working set page from this extension descriptor.
*
* @return a working set page created from this extension descriptor.
*/
- public IWorkingSetPage createWorkingSetPage() {
- Object page = null;
-
- if (pageClassName != null) {
- try {
- page = WorkbenchPlugin.createExtension(configElement,
- ATT_PAGE_CLASS);
- } catch (CoreException exception) {
- WorkbenchPlugin.log("Unable to create working set page: " + //$NON-NLS-1$
- pageClassName, exception.getStatus());
- }
- }
- return (IWorkingSetPage) page;
- }
-
- /**
- * Returns the page's icon
- *
- * @return the page's icon
- */
- public ImageDescriptor getIcon() {
- if (icon == null) {
+ public IWorkingSetPage createWorkingSetPage() {
+ Object page = null;
+
+ if (pageClassName != null) {
+ try {
+ page = WorkbenchPlugin.createExtension(configElement, ATT_PAGE_CLASS);
+ } catch (CoreException exception) {
+ WorkbenchPlugin.log("Unable to create working set page: " + //$NON-NLS-1$
+ pageClassName, exception.getStatus());
+ }
+ }
+ return (IWorkingSetPage) page;
+ }
+
+ /**
+ * Returns the page's icon
+ *
+ * @return the page's icon
+ */
+ public ImageDescriptor getIcon() {
+ if (icon == null) {
return null;
}
- IExtension extension = configElement.getDeclaringExtension();
+ IExtension extension = configElement.getDeclaringExtension();
String extendingPluginId = extension.getContributor().getName();
- return AbstractUIPlugin.imageDescriptorFromPlugin(extendingPluginId,
- icon);
- }
-
- /**
- * Returns the working set page id.
- *
- * @return the working set page id.
- */
- public String getId() {
- return id;
- }
-
- /**
- * Returns the working set page class name
- *
- * @return the working set page class name or <code>null</code> if
- * no page class name has been provided by the extension
- */
- public String getPageClassName() {
- return pageClassName;
- }
-
- /**
- * Returns the name of the working set element type the
- * page works with.
- *
- * @return the working set element type name
- */
- public String getName() {
- return name;
- }
-
- /**
- * Returns the working set updater class name
- *
- * @return the working set updater class name or <code>null</code> if
- * no updater class name has been provided by the extension
- */
- public String getUpdaterClassName() {
- return updaterClassName;
- }
-
- /**
+ return AbstractUIPlugin.imageDescriptorFromPlugin(extendingPluginId, icon);
+ }
+
+ /**
+ * Returns the working set page id.
+ *
+ * @return the working set page id.
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Returns the working set page class name
+ *
+ * @return the working set page class name or <code>null</code> if no page class
+ * name has been provided by the extension
+ */
+ public String getPageClassName() {
+ return pageClassName;
+ }
+
+ /**
+ * Returns the name of the working set element type the page works with.
+ *
+ * @return the working set element type name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Returns the working set updater class name
+ *
+ * @return the working set updater class name or <code>null</code> if no updater
+ * class name has been provided by the extension
+ */
+ public String getUpdaterClassName() {
+ return updaterClassName;
+ }
+
+ /**
* Creates a working set element adapter.
*
* @return the element adapter or <code>null</code> if no adapter has been
@@ -236,8 +225,8 @@ public class WorkingSetDescriptor implements IPluginContribution {
return null;
IWorkingSetElementAdapter result = null;
try {
- result = (IWorkingSetElementAdapter) WorkbenchPlugin
- .createExtension(configElement, ATT_ELEMENT_ADAPTER_CLASS);
+ result = (IWorkingSetElementAdapter) WorkbenchPlugin.createExtension(configElement,
+ ATT_ELEMENT_ADAPTER_CLASS);
} catch (CoreException exception) {
WorkbenchPlugin.log("Unable to create working set element adapter: " + //$NON-NLS-1$
result, exception.getStatus());
@@ -245,45 +234,45 @@ public class WorkingSetDescriptor implements IPluginContribution {
return result;
}
- /**
+ /**
* Creates a working set updater.
*
- * @return the working set updater or <code>null</code> if no updater has
- * been declared
+ * @return the working set updater or <code>null</code> if no updater has been
+ * declared
*/
- public IWorkingSetUpdater createWorkingSetUpdater() {
- if (updaterClassName == null) {
+ public IWorkingSetUpdater createWorkingSetUpdater() {
+ if (updaterClassName == null) {
return null;
}
- IWorkingSetUpdater result = null;
- try {
- result = (IWorkingSetUpdater)WorkbenchPlugin.createExtension(configElement, ATT_UPDATER_CLASS);
- } catch (CoreException exception) {
- WorkbenchPlugin.log("Unable to create working set updater: " + //$NON-NLS-1$
- updaterClassName, exception.getStatus());
- }
- return result;
- }
-
- public boolean isUpdaterClassLoaded() {
- return WorkbenchPlugin.isBundleLoadedForExecutableExtension(configElement, ATT_UPDATER_CLASS);
- }
-
- public boolean isElementAdapterClassLoaded() {
- return WorkbenchPlugin.isBundleLoadedForExecutableExtension(configElement, ATT_ELEMENT_ADAPTER_CLASS);
- }
-
- /**
- * Returns whether working sets based on this descriptor are editable.
- *
- * @return <code>true</code> if working sets based on this descriptor are editable; otherwise
- * <code>false</code>
- *
- * @since 3.1
- */
- public boolean isEditable() {
- return getPageClassName() != null;
- }
+ IWorkingSetUpdater result = null;
+ try {
+ result = (IWorkingSetUpdater) WorkbenchPlugin.createExtension(configElement, ATT_UPDATER_CLASS);
+ } catch (CoreException exception) {
+ WorkbenchPlugin.log("Unable to create working set updater: " + //$NON-NLS-1$
+ updaterClassName, exception.getStatus());
+ }
+ return result;
+ }
+
+ public boolean isUpdaterClassLoaded() {
+ return WorkbenchPlugin.isBundleLoadedForExecutableExtension(configElement, ATT_UPDATER_CLASS);
+ }
+
+ public boolean isElementAdapterClassLoaded() {
+ return WorkbenchPlugin.isBundleLoadedForExecutableExtension(configElement, ATT_ELEMENT_ADAPTER_CLASS);
+ }
+
+ /**
+ * Returns whether working sets based on this descriptor are editable.
+ *
+ * @return <code>true</code> if working sets based on this descriptor are
+ * editable; otherwise <code>false</code>
+ *
+ * @since 3.1
+ */
+ public boolean isEditable() {
+ return getPageClassName() != null;
+ }
@Override
public String getLocalId() {
@@ -312,8 +301,7 @@ public class WorkingSetDescriptor implements IPluginContribution {
* @since 3.4
*/
public String getDescription() {
- String description = configElement
- .getAttribute(IWorkbenchRegistryConstants.ATT_DESCRIPTION);
+ String description = configElement.getAttribute(IWorkbenchRegistryConstants.ATT_DESCRIPTION);
if (description == null)
description = ""; //$NON-NLS-1$
return description;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WorkingSetRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WorkingSetRegistry.java
index fee5bee2c21..0973dfd34d5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WorkingSetRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WorkingSetRegistry.java
@@ -34,20 +34,18 @@ import org.eclipse.ui.dialogs.IWorkingSetPage;
* Stores working set descriptors for working set extensions.
*/
public class WorkingSetRegistry implements IExtensionChangeHandler {
- // used in Workbench plugin.xml for default workingSet extension
- // @issue this is an IDE specific working set page!
- private static final String DEFAULT_PAGE_ID = "org.eclipse.ui.resourceWorkingSetPage"; //$NON-NLS-1$
+ // used in Workbench plugin.xml for default workingSet extension
+ // @issue this is an IDE specific working set page!
+ private static final String DEFAULT_PAGE_ID = "org.eclipse.ui.resourceWorkingSetPage"; //$NON-NLS-1$
private HashMap<String, WorkingSetDescriptor> workingSetDescriptors = new HashMap<>();
- /**
+ /**
*
*/
public WorkingSetRegistry() {
- IExtensionTracker tracker = PlatformUI.getWorkbench()
- .getExtensionTracker();
- tracker.registerHandler(this, ExtensionTracker
- .createExtensionPointFilter(getExtensionPointFilter()));
+ IExtensionTracker tracker = PlatformUI.getWorkbench().getExtensionTracker();
+ tracker.registerHandler(this, ExtensionTracker.createExtensionPointFilter(getExtensionPointFilter()));
}
@@ -57,98 +55,92 @@ public class WorkingSetRegistry implements IExtensionChangeHandler {
* @since 3.3
*/
private IExtensionPoint getExtensionPointFilter() {
- return Platform.getExtensionRegistry().getExtensionPoint(
- PlatformUI.PLUGIN_ID,
+ return Platform.getExtensionRegistry().getExtensionPoint(PlatformUI.PLUGIN_ID,
IWorkbenchRegistryConstants.PL_WORKINGSETS);
}
- /**
- * Adds a working set descriptor.
- *
- * @param descriptor working set descriptor to add. Must not
- * exist in the registry yet.
- */
- public void addWorkingSetDescriptor(WorkingSetDescriptor descriptor) {
- Assert.isTrue(!workingSetDescriptors.containsValue(descriptor),
- "working set descriptor already registered"); //$NON-NLS-1$
- IExtensionTracker tracker = PlatformUI.getWorkbench()
- .getExtensionTracker();
- tracker.registerObject(descriptor.getConfigurationElement()
- .getDeclaringExtension(), descriptor,
+ /**
+ * Adds a working set descriptor.
+ *
+ * @param descriptor working set descriptor to add. Must not exist in the
+ * registry yet.
+ */
+ public void addWorkingSetDescriptor(WorkingSetDescriptor descriptor) {
+ Assert.isTrue(!workingSetDescriptors.containsValue(descriptor), "working set descriptor already registered"); //$NON-NLS-1$
+ IExtensionTracker tracker = PlatformUI.getWorkbench().getExtensionTracker();
+ tracker.registerObject(descriptor.getConfigurationElement().getDeclaringExtension(), descriptor,
IExtensionTracker.REF_WEAK);
workingSetDescriptors.put(descriptor.getId(), descriptor);
}
- /**
+ /**
* Returns the default, resource based, working set page
*
* @return the default working set page.
*/
- public IWorkingSetPage getDefaultWorkingSetPage() {
- // @issue this will return the IDE resource working set page... not good for generic workbench
+ public IWorkingSetPage getDefaultWorkingSetPage() {
+ // @issue this will return the IDE resource working set page... not good for
+ // generic workbench
WorkingSetDescriptor descriptor = workingSetDescriptors.get(DEFAULT_PAGE_ID);
- if (descriptor != null) {
- return descriptor.createWorkingSetPage();
- }
- return null;
- }
-
- /**
- * Returns the working set descriptor with the given id.
- *
- * @param pageId working set page id
- * @return the working set descriptor with the given id.
- */
- public WorkingSetDescriptor getWorkingSetDescriptor(String pageId) {
+ if (descriptor != null) {
+ return descriptor.createWorkingSetPage();
+ }
+ return null;
+ }
+
+ /**
+ * Returns the working set descriptor with the given id.
+ *
+ * @param pageId working set page id
+ * @return the working set descriptor with the given id.
+ */
+ public WorkingSetDescriptor getWorkingSetDescriptor(String pageId) {
return workingSetDescriptors.get(pageId);
- }
-
- /**
- * Returns an array of all working set descriptors.
- *
- * @return an array of all working set descriptors.
- */
- public WorkingSetDescriptor[] getWorkingSetDescriptors() {
- return workingSetDescriptors.values().toArray(
- new WorkingSetDescriptor[workingSetDescriptors.size()]);
- }
-
- /**
- * Returns an array of all working set descriptors having
- * a page class attribute
- *
- * @return an array of all working set descriptors having a
- * page class attribute
- */
- public WorkingSetDescriptor[] getNewPageWorkingSetDescriptors() {
- Collection descriptors= workingSetDescriptors.values();
- List result= new ArrayList(descriptors.size());
- for (Iterator iter= descriptors.iterator(); iter.hasNext();) {
- WorkingSetDescriptor descriptor= (WorkingSetDescriptor)iter.next();
+ }
+
+ /**
+ * Returns an array of all working set descriptors.
+ *
+ * @return an array of all working set descriptors.
+ */
+ public WorkingSetDescriptor[] getWorkingSetDescriptors() {
+ return workingSetDescriptors.values().toArray(new WorkingSetDescriptor[workingSetDescriptors.size()]);
+ }
+
+ /**
+ * Returns an array of all working set descriptors having a page class attribute
+ *
+ * @return an array of all working set descriptors having a page class attribute
+ */
+ public WorkingSetDescriptor[] getNewPageWorkingSetDescriptors() {
+ Collection descriptors = workingSetDescriptors.values();
+ List result = new ArrayList(descriptors.size());
+ for (Iterator iter = descriptors.iterator(); iter.hasNext();) {
+ WorkingSetDescriptor descriptor = (WorkingSetDescriptor) iter.next();
if (descriptor.getPageClassName() != null) {
result.add(descriptor);
}
}
- return (WorkingSetDescriptor[])result.toArray(new WorkingSetDescriptor[result.size()]);
- }
-
- /**
- * Returns <code>true</code> if there is a working set descriptor with
- * a page class attribute. Otherwise <code>false</code> is returned.
- *
- * @return whether a descriptor with a page class attribute exists
- */
- public boolean hasNewPageWorkingSetDescriptor() {
- Collection descriptors= workingSetDescriptors.values();
- for (Iterator iter= descriptors.iterator(); iter.hasNext();) {
- WorkingSetDescriptor descriptor= (WorkingSetDescriptor)iter.next();
+ return (WorkingSetDescriptor[]) result.toArray(new WorkingSetDescriptor[result.size()]);
+ }
+
+ /**
+ * Returns <code>true</code> if there is a working set descriptor with a page
+ * class attribute. Otherwise <code>false</code> is returned.
+ *
+ * @return whether a descriptor with a page class attribute exists
+ */
+ public boolean hasNewPageWorkingSetDescriptor() {
+ Collection descriptors = workingSetDescriptors.values();
+ for (Iterator iter = descriptors.iterator(); iter.hasNext();) {
+ WorkingSetDescriptor descriptor = (WorkingSetDescriptor) iter.next();
if (descriptor.getPageClassName() != null) {
return true;
}
}
- return false;
- }
+ return false;
+ }
public List<WorkingSetDescriptor> getUpdaterDescriptorsForNamespace(String namespace) {
if (namespace == null) { // fix for Bug 84225
@@ -163,45 +155,42 @@ public class WorkingSetRegistry implements IExtensionChangeHandler {
return result;
}
- public WorkingSetDescriptor[] getElementAdapterDescriptorsForNamespace(
- String namespace) {
- if (namespace == null) // fix for Bug 84225
- return new WorkingSetDescriptor[0];
+ public WorkingSetDescriptor[] getElementAdapterDescriptorsForNamespace(String namespace) {
+ if (namespace == null) // fix for Bug 84225
+ return new WorkingSetDescriptor[0];
Collection descriptors = workingSetDescriptors.values();
List result = new ArrayList();
for (Iterator iter = descriptors.iterator(); iter.hasNext();) {
- WorkingSetDescriptor descriptor = (WorkingSetDescriptor) iter
- .next();
+ WorkingSetDescriptor descriptor = (WorkingSetDescriptor) iter.next();
if (namespace.equals(descriptor.getDeclaringNamespace())) {
result.add(descriptor);
}
}
- return (WorkingSetDescriptor[]) result
- .toArray(new WorkingSetDescriptor[result.size()]);
+ return (WorkingSetDescriptor[]) result.toArray(new WorkingSetDescriptor[result.size()]);
}
- /**
- * Returns the working set page with the given id.
- *
- * @param pageId working set page id
- * @return the working set page with the given id.
- */
- public IWorkingSetPage getWorkingSetPage(String pageId) {
+ /**
+ * Returns the working set page with the given id.
+ *
+ * @param pageId working set page id
+ * @return the working set page with the given id.
+ */
+ public IWorkingSetPage getWorkingSetPage(String pageId) {
WorkingSetDescriptor descriptor = workingSetDescriptors.get(pageId);
- if (descriptor == null) {
- return null;
- }
- return descriptor.createWorkingSetPage();
- }
+ if (descriptor == null) {
+ return null;
+ }
+ return descriptor.createWorkingSetPage();
+ }
- /**
- * Loads the working set registry.
- */
- public void load() {
- WorkingSetRegistryReader reader = new WorkingSetRegistryReader();
- reader.readWorkingSets(Platform.getExtensionRegistry(), this);
- }
+ /**
+ * Loads the working set registry.
+ */
+ public void load() {
+ WorkingSetRegistryReader reader = new WorkingSetRegistryReader();
+ reader.readWorkingSets(Platform.getExtensionRegistry(), this);
+ }
@Override
public void addExtension(IExtensionTracker tracker, IExtension extension) {
@@ -214,10 +203,10 @@ public class WorkingSetRegistry implements IExtensionChangeHandler {
@Override
public void removeExtension(IExtension extension, Object[] objects) {
for (Object object : objects) {
- if (object instanceof WorkingSetDescriptor) {
- WorkingSetDescriptor desc = (WorkingSetDescriptor) object;
- workingSetDescriptors.remove(desc.getId());
- }
- }
+ if (object instanceof WorkingSetDescriptor) {
+ WorkingSetDescriptor desc = (WorkingSetDescriptor) object;
+ workingSetDescriptors.remove(desc.getId());
+ }
+ }
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WorkingSetRegistryReader.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WorkingSetRegistryReader.java
index f9a23dfbc34..7f53f3cc91f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WorkingSetRegistryReader.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WorkingSetRegistryReader.java
@@ -24,58 +24,54 @@ import org.eclipse.ui.internal.WorkbenchPlugin;
*/
public class WorkingSetRegistryReader extends RegistryReader {
+ private WorkingSetRegistry registry;
- private WorkingSetRegistry registry;
+ /**
+ * Create a new instance of this reader.
+ */
+ public WorkingSetRegistryReader() {
+ super();
+ }
- /**
- * Create a new instance of this reader.
- */
- public WorkingSetRegistryReader() {
- super();
- }
+ /**
+ * Create a new instance of this reader.
+ *
+ * @param registry the registry to populate
+ */
+ public WorkingSetRegistryReader(WorkingSetRegistry registry) {
+ super();
+ this.registry = registry;
+ }
- /**
- * Create a new instance of this reader.
- *
- * @param registry the registry to populate
- */
- public WorkingSetRegistryReader(WorkingSetRegistry registry) {
- super();
- this.registry = registry;
- }
-
- /**
- * Overrides method in RegistryReader.
- *
- * @see RegistryReader#readElement(IConfigurationElement)
- */
- @Override
+ /**
+ * Overrides method in RegistryReader.
+ *
+ * @see RegistryReader#readElement(IConfigurationElement)
+ */
+ @Override
public boolean readElement(IConfigurationElement element) {
- if (element.getName().equals(IWorkbenchRegistryConstants.TAG_WORKING_SET)) {
- try {
- WorkingSetDescriptor desc = new WorkingSetDescriptor(element);
- registry.addWorkingSetDescriptor(desc);
- } catch (CoreException e) {
- // log an error since its not safe to open a dialog here
- WorkbenchPlugin
- .log(
- "Unable to create working set descriptor.", e.getStatus());//$NON-NLS-1$
- }
- return true;
- }
+ if (element.getName().equals(IWorkbenchRegistryConstants.TAG_WORKING_SET)) {
+ try {
+ WorkingSetDescriptor desc = new WorkingSetDescriptor(element);
+ registry.addWorkingSetDescriptor(desc);
+ } catch (CoreException e) {
+ // log an error since its not safe to open a dialog here
+ WorkbenchPlugin.log("Unable to create working set descriptor.", e.getStatus());//$NON-NLS-1$
+ }
+ return true;
+ }
- return false;
- }
+ return false;
+ }
- /**
- * Reads the working set extensions within a registry.
- *
- * @param in the plugin registry to read from
- * @param out the working set registry to store read entries in.
- */
- public void readWorkingSets(IExtensionRegistry in, WorkingSetRegistry out) {
- registry = out;
- readRegistry(in, PlatformUI.PLUGIN_ID,
- IWorkbenchRegistryConstants.PL_WORKINGSETS);
- }
+ /**
+ * Reads the working set extensions within a registry.
+ *
+ * @param in the plugin registry to read from
+ * @param out the working set registry to store read entries in.
+ */
+ public void readWorkingSets(IExtensionRegistry in, WorkingSetRegistry out) {
+ registry = out;
+ readRegistry(in, PlatformUI.PLUGIN_ID, IWorkbenchRegistryConstants.PL_WORKINGSETS);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/ActionSetSourceProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/ActionSetSourceProvider.java
index fc71382e341..94dd056de65 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/ActionSetSourceProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/ActionSetSourceProvider.java
@@ -35,8 +35,7 @@ import org.eclipse.ui.internal.util.Util;
*
* @since 3.2
*/
-public final class ActionSetSourceProvider extends AbstractSourceProvider
- implements IActionSetsListener {
+public final class ActionSetSourceProvider extends AbstractSourceProvider implements IActionSetsListener {
/**
* The names of the sources supported by this source provider.
@@ -44,8 +43,8 @@ public final class ActionSetSourceProvider extends AbstractSourceProvider
private static final String[] PROVIDED_SOURCE_NAMES = new String[] { ISources.ACTIVE_ACTION_SETS_NAME };
/**
- * The action sets last seen as active by this source provider. This value
- * may be <code>null</code>.
+ * The action sets last seen as active by this source provider. This value may
+ * be <code>null</code>.
*/
private IActionSetDescriptor[] activeActionSets;
@@ -73,8 +72,7 @@ public final class ActionSetSourceProvider extends AbstractSourceProvider
}
activeActionSets = newActionSets;
- fireSourceChanged(ISources.ACTIVE_ACTION_SETS,
- ISources.ACTIVE_ACTION_SETS_NAME, activeActionSets);
+ fireSourceChanged(ISources.ACTIVE_ACTION_SETS, ISources.ACTIVE_ACTION_SETS_NAME, activeActionSets);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/EvaluationReference.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/EvaluationReference.java
index 116103e94e6..3bdfaea433b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/EvaluationReference.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/EvaluationReference.java
@@ -42,8 +42,8 @@ public class EvaluationReference extends RunAndTrack implements IEvaluationRefer
boolean postingChanges = true;
boolean hasRun = false;
- public EvaluationReference(IEclipseContext context, Expression expression,
- IPropertyChangeListener listener, String property) {
+ public EvaluationReference(IEclipseContext context, Expression expression, IPropertyChangeListener listener,
+ String property) {
this.context = context;
this.expression = expression;
this.listener = listener;
@@ -102,16 +102,13 @@ public class EvaluationReference extends RunAndTrack implements IEvaluationRefer
return;
}
if (!hasRun) {
- getListener().propertyChange(
- new PropertyChangeEvent(this, getProperty(), null, Boolean.valueOf(cache)));
+ getListener().propertyChange(new PropertyChangeEvent(this, getProperty(), null, Boolean.valueOf(cache)));
} else if (!participating) {
- getListener().propertyChange(
- new PropertyChangeEvent(this, getProperty(), Boolean.valueOf(value), null));
+ getListener().propertyChange(new PropertyChangeEvent(this, getProperty(), Boolean.valueOf(value), null));
}
if (value != cache) {
getListener().propertyChange(
- new PropertyChangeEvent(this, getProperty(), Boolean.valueOf(value), Boolean
- .valueOf(cache)));
+ new PropertyChangeEvent(this, getProperty(), Boolean.valueOf(value), Boolean.valueOf(cache)));
}
hasRun = true;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/EvaluationResultCache.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/EvaluationResultCache.java
index e7f6842db64..05f37411ffa 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/EvaluationResultCache.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/EvaluationResultCache.java
@@ -38,8 +38,8 @@ public abstract class EvaluationResultCache implements IEvaluationResultCache {
private EvaluationResult evaluationResult = null;
/**
- * The expression to evaluate. This value may be <code>null</code>, in
- * which case the evaluation result is always <code>true</code>.
+ * The expression to evaluate. This value may be <code>null</code>, in which
+ * case the evaluation result is always <code>true</code>.
*/
private final Expression expression;
@@ -51,16 +51,14 @@ public abstract class EvaluationResultCache implements IEvaluationResultCache {
/**
* Constructs a new instance of <code>EvaluationResultCache</code>.
*
- * @param expression
- * The expression that must evaluate to <code>true</code>
- * before this handler is active. This value may be
- * <code>null</code> if it is always active.
+ * @param expression The expression that must evaluate to <code>true</code>
+ * before this handler is active. This value may be
+ * <code>null</code> if it is always active.
* @see ISources
*/
protected EvaluationResultCache(final Expression expression) {
this.expression = expression;
- this.sourcePriority = SourcePriorityNameMapping
- .computeSourcePriority(expression);
+ this.sourcePriority = SourcePriorityNameMapping.computeSourcePriority(expression);
}
@Override
@@ -79,17 +77,16 @@ public abstract class EvaluationResultCache implements IEvaluationResultCache {
evaluationResult = expression.evaluate(context);
} catch (final CoreException e) {
/*
- * Swallow the exception. It simply means the variable is not
- * valid it some (most frequently, that the value is null). This
- * kind of information is not really useful to us, so we can
- * just treat it as null.
+ * Swallow the exception. It simply means the variable is not valid it some
+ * (most frequently, that the value is null). This kind of information is not
+ * really useful to us, so we can just treat it as null.
*/
evaluationResult = EvaluationResult.FALSE;
return false;
}
}
- // return true if the result is FALSE or NOT_LOADED
+ // return true if the result is FALSE or NOT_LOADED
return evaluationResult != EvaluationResult.FALSE;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/EvaluationResultCacheComparator.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/EvaluationResultCacheComparator.java
index 14f8cd751e8..4df61a573a8 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/EvaluationResultCacheComparator.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/EvaluationResultCacheComparator.java
@@ -45,16 +45,14 @@ public final class EvaluationResultCacheComparator implements Comparator {
int comparison;
/*
- * Note: all of the comparisons are flipped intentionally. This allows
- * those items with greater values to appear earlier when using an
- * iterator.
+ * Note: all of the comparisons are flipped intentionally. This allows those
+ * items with greater values to appear earlier when using an iterator.
*/
// if objects went to the trouble to implement Comparable
// we should use it ... this algorithm can accept a natural ordering
// that's not compatible with equals.
if (object1 instanceof Comparable && object2 instanceof Comparable) {
- comparison = Util.compare((Comparable) object2,
- (Comparable) object1);
+ comparison = Util.compare((Comparable) object2, (Comparable) object1);
if (comparison != 0) {
return comparison;
}
@@ -63,4 +61,3 @@ public final class EvaluationResultCacheComparator implements Comparator {
return Util.compareIdentity(cache2, cache1);
}
}
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/EvaluationService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/EvaluationService.java
index 456f536a83d..9bf79154d38 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/EvaluationService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/EvaluationService.java
@@ -97,16 +97,14 @@ public final class EvaluationService implements IEvaluationService {
@Override
public Object compute(IEclipseContext context, String contextKey) {
Object defaultVariable = context.getLocal(DEFAULT_VAR);
- if (defaultVariable != null
- && defaultVariable != IEvaluationContext.UNDEFINED_VARIABLE) {
+ if (defaultVariable != null && defaultVariable != IEvaluationContext.UNDEFINED_VARIABLE) {
return defaultVariable;
}
defaultVariable = context.getActive(IServiceConstants.ACTIVE_SELECTION);
if (defaultVariable instanceof IStructuredSelection) {
final IStructuredSelection selection = (IStructuredSelection) defaultVariable;
return selection.toList();
- } else if ((defaultVariable instanceof ISelection)
- && (!((ISelection) defaultVariable).isEmpty())) {
+ } else if ((defaultVariable instanceof ISelection) && (!((ISelection) defaultVariable).isEmpty())) {
return Collections.singleton(defaultVariable);
}
return null;
@@ -130,9 +128,8 @@ public final class EvaluationService implements IEvaluationService {
};
variableFilter.addAll(Arrays.asList(new String[] { ISources.ACTIVE_WORKBENCH_WINDOW_NAME,
ISources.ACTIVE_WORKBENCH_WINDOW_SHELL_NAME, ISources.ACTIVE_EDITOR_ID_NAME,
- ISources.ACTIVE_EDITOR_INPUT_NAME, ISources.SHOW_IN_INPUT,
- ISources.SHOW_IN_SELECTION, ISources.ACTIVE_PART_NAME,
- ISources.ACTIVE_PART_ID_NAME, ISources.ACTIVE_SITE_NAME,
+ ISources.ACTIVE_EDITOR_INPUT_NAME, ISources.SHOW_IN_INPUT, ISources.SHOW_IN_SELECTION,
+ ISources.ACTIVE_PART_NAME, ISources.ACTIVE_PART_ID_NAME, ISources.ACTIVE_SITE_NAME,
ISources.ACTIVE_CONTEXT_NAME, ISources.ACTIVE_CURRENT_SELECTION_NAME }));
context.runAndTrack(ratUpdater);
}
@@ -152,6 +149,7 @@ public final class EvaluationService implements IEvaluationService {
legacyContext.addVariable(name, value);
}
}
+
@Override
public void addSourceProvider(ISourceProvider provider) {
sourceProviders.add(provider);
@@ -164,12 +162,10 @@ public final class EvaluationService implements IEvaluationService {
final Object variableValue = entry.getValue();
/*
- * Bug 84056. If we update the active workbench window, then we risk
- * falling back to that shell when the active shell has registered
- * as "none".
+ * Bug 84056. If we update the active workbench window, then we risk falling
+ * back to that shell when the active shell has registered as "none".
*/
- if ((variableName != null)
- && (!ISources.ACTIVE_WORKBENCH_WINDOW_SHELL_NAME.equals(variableName))) {
+ if ((variableName != null) && (!ISources.ACTIVE_WORKBENCH_WINDOW_SHELL_NAME.equals(variableName))) {
changeVariable(variableName, variableValue);
}
}
@@ -211,10 +207,9 @@ public final class EvaluationService implements IEvaluationService {
}
@Override
- public IEvaluationReference addEvaluationListener(Expression expression,
- IPropertyChangeListener listener, String property) {
- EvaluationReference ref = new EvaluationReference(ratContext, expression, listener,
- property);
+ public IEvaluationReference addEvaluationListener(Expression expression, IPropertyChangeListener listener,
+ String property) {
+ EvaluationReference ref = new EvaluationReference(ratContext, expression, listener, property);
addEvaluationReference(ref);
return ref;
}
@@ -233,8 +228,7 @@ public final class EvaluationService implements IEvaluationService {
}
}
- if (info.hasDefaultVariableAccess()
- && ratVariables.add(IServiceConstants.ACTIVE_SELECTION)) {
+ if (info.hasDefaultVariableAccess() && ratVariables.add(IServiceConstants.ACTIVE_SELECTION)) {
changed = true;
}
}
@@ -324,8 +318,7 @@ public final class EvaluationService implements IEvaluationService {
notifying--;
}
- private void fireServiceChange(final String property, final Object oldValue,
- final Object newValue) {
+ private void fireServiceChange(final String property, final Object oldValue, final Object newValue) {
for (final IPropertyChangeListener listener : serviceListeners) {
SafeRunner.run(new ISafeRunnable() {
@Override
@@ -335,8 +328,8 @@ public final class EvaluationService implements IEvaluationService {
@Override
public void run() throws Exception {
- listener.propertyChange(new PropertyChangeEvent(EvaluationService.this,
- property, oldValue, newValue));
+ listener.propertyChange(
+ new PropertyChangeEvent(EvaluationService.this, property, oldValue, newValue));
}
});
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/EvaluationServiceFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/EvaluationServiceFactory.java
index bb36e883385..01924f6e78e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/EvaluationServiceFactory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/EvaluationServiceFactory.java
@@ -25,8 +25,7 @@ import org.eclipse.ui.services.IServiceLocator;
public class EvaluationServiceFactory extends AbstractServiceFactory {
@Override
- public Object create(Class serviceInterface, IServiceLocator parentLocator,
- IServiceLocator locator) {
+ public Object create(Class serviceInterface, IServiceLocator parentLocator, IServiceLocator locator) {
if (!IEvaluationService.class.equals(serviceInterface)) {
return null;
}
@@ -34,7 +33,7 @@ public class EvaluationServiceFactory extends AbstractServiceFactory {
if (parent == null) {
return null;
}
- return new SlaveEvaluationService((IEvaluationService)parent);
+ return new SlaveEvaluationService((IEvaluationService) parent);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/ExpressionAuthority.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/ExpressionAuthority.java
index e3088757ab1..396b4cc741b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/ExpressionAuthority.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/ExpressionAuthority.java
@@ -50,23 +50,22 @@ public abstract class ExpressionAuthority implements ISourceProviderListener {
/**
* The evaluation context instance to use when evaluating expression. This
- * context is shared, and so all calls into <code>sourceChanged</code>
- * must happen on the event thread.
+ * context is shared, and so all calls into <code>sourceChanged</code> must
+ * happen on the event thread.
*/
private final IEvaluationContext context;
/**
- * The current state of this authority. This is a child of the
- * {@link #context} that has been given the selection as the default
- * variable. This value is cleared to <code>null</code> whenever the
- * selection changes.
+ * The current state of this authority. This is a child of the {@link #context}
+ * that has been given the selection as the default variable. This value is
+ * cleared to <code>null</code> whenever the selection changes.
*/
private IEvaluationContext currentState = null;
/**
- * The collection of source providers used by this authority. This
- * collection is consulted whenever a contribution is made. This collection
- * only contains instances of <code>ISourceProvider</code>.
+ * The collection of source providers used by this authority. This collection is
+ * consulted whenever a contribution is made. This collection only contains
+ * instances of <code>ISourceProvider</code>.
*/
private final Collection providers = new ArrayList();
@@ -82,11 +81,10 @@ public abstract class ExpressionAuthority implements ISourceProviderListener {
}
/**
- * Adds a source provider to a list of providers to check when updating.
- * This also attaches this authority as a listener to the provider.
+ * Adds a source provider to a list of providers to check when updating. This
+ * also attaches this authority as a listener to the provider.
*
- * @param provider
- * The provider to add; must not be <code>null</code>.
+ * @param provider The provider to add; must not be <code>null</code>.
*/
public final void addSourceProvider(final ISourceProvider provider) {
provider.addSourceProviderListener(this);
@@ -101,13 +99,10 @@ public abstract class ExpressionAuthority implements ISourceProviderListener {
final Object variableValue = entry.getValue();
/*
- * Bug 84056. If we update the active workbench window, then we risk
- * falling back to that shell when the active shell has registered
- * as "none".
+ * Bug 84056. If we update the active workbench window, then we risk falling
+ * back to that shell when the active shell has registered as "none".
*/
- if ((variableName != null)
- && (!ISources.ACTIVE_WORKBENCH_WINDOW_SHELL_NAME
- .equals(variableName))) {
+ if ((variableName != null) && (!ISources.ACTIVE_WORKBENCH_WINDOW_SHELL_NAME.equals(variableName))) {
changeVariable(variableName, variableValue);
}
}
@@ -115,14 +110,13 @@ public abstract class ExpressionAuthority implements ISourceProviderListener {
}
/**
- * Removes all of the source provider listeners. Subclasses may extend, but
- * must not override.
+ * Removes all of the source provider listeners. Subclasses may extend, but must
+ * not override.
*/
public void dispose() {
final Iterator providerItr = providers.iterator();
while (providerItr.hasNext()) {
- final ISourceProvider provider = (ISourceProvider) providerItr
- .next();
+ final ISourceProvider provider = (ISourceProvider) providerItr.next();
provider.removeSourceProviderListener(this);
}
@@ -133,18 +127,15 @@ public abstract class ExpressionAuthority implements ISourceProviderListener {
* Returns whether at least one of the <code>IEvaluationResultCache</code>
* instances in <code>collection</code> evaluates to <code>true</code>.
*
- * @param collection
- * The evaluation result caches to check; must not be
- * <code>null</code>, but may be empty.
- * @return <code>true</code> if there is at least one expression that
- * evaluates to <code>true</code>; <code>false</code>
- * otherwise.
+ * @param collection The evaluation result caches to check; must not be
+ * <code>null</code>, but may be empty.
+ * @return <code>true</code> if there is at least one expression that evaluates
+ * to <code>true</code>; <code>false</code> otherwise.
*/
protected final boolean evaluate(final Collection collection) {
final Iterator iterator = collection.iterator();
while (iterator.hasNext()) {
- final IEvaluationResultCache cache = (IEvaluationResultCache) iterator
- .next();
+ final IEvaluationResultCache cache = (IEvaluationResultCache) iterator.next();
if (evaluate(cache)) {
return true;
}
@@ -157,11 +148,10 @@ public abstract class ExpressionAuthority implements ISourceProviderListener {
* Returns whether the <code>IEvaluationResultCache</code> evaluates to
* <code>true</code>.
*
- * @param expression
- * The evaluation result cache to check; must not be
- * <code>null</code>.
- * @return <code>true</code> if the expression evaluates to
- * <code>true</code>; <code>false</code> otherwise.
+ * @param expression The evaluation result cache to check; must not be
+ * <code>null</code>.
+ * @return <code>true</code> if the expression evaluates to <code>true</code>;
+ * <code>false</code> otherwise.
*/
protected final boolean evaluate(final IEvaluationResultCache expression) {
final IEvaluationContext contextWithDefaultVariable = getCurrentState();
@@ -170,28 +160,23 @@ public abstract class ExpressionAuthority implements ISourceProviderListener {
/**
* Creates a new evaluation context based on the current evaluation context
- * (i.e., the current state), and places the current selection as the
- * default variable.
+ * (i.e., the current state), and places the current selection as the default
+ * variable.
*
- * @return An evaluation context that can be used for evaluating
- * expressions; never <code>null</code>.
+ * @return An evaluation context that can be used for evaluating expressions;
+ * never <code>null</code>.
*/
public final IEvaluationContext getCurrentState() {
if (currentState == null) {
- final Object defaultVariable = context
- .getVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME);
+ final Object defaultVariable = context.getVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME);
final IEvaluationContext contextWithDefaultVariable;
if (defaultVariable instanceof IStructuredSelection) {
final IStructuredSelection selection = (IStructuredSelection) defaultVariable;
- contextWithDefaultVariable = new EvaluationContext(context,
- selection.toList());
- } else if ((defaultVariable instanceof ISelection)
- && (!((ISelection) defaultVariable).isEmpty())) {
- contextWithDefaultVariable = new EvaluationContext(context,
- Collections.singleton(defaultVariable));
+ contextWithDefaultVariable = new EvaluationContext(context, selection.toList());
+ } else if ((defaultVariable instanceof ISelection) && (!((ISelection) defaultVariable).isEmpty())) {
+ contextWithDefaultVariable = new EvaluationContext(context, Collections.singleton(defaultVariable));
} else {
- contextWithDefaultVariable = new EvaluationContext(context,
- Collections.EMPTY_LIST);
+ contextWithDefaultVariable = new EvaluationContext(context, Collections.EMPTY_LIST);
}
currentState = contextWithDefaultVariable;
}
@@ -202,8 +187,7 @@ public abstract class ExpressionAuthority implements ISourceProviderListener {
/**
* Returns the variable of the given name.
*
- * @param name
- * The name of the variable to get; must not be <code>null</code>.
+ * @param name The name of the variable to get; must not be <code>null</code>.
* @return The variable of the given name; <code>null</code> if none.
*/
protected final Object getVariable(final String name) {
@@ -211,11 +195,10 @@ public abstract class ExpressionAuthority implements ISourceProviderListener {
}
/**
- * Removes this source provider from the list, and detaches this authority
- * as a listener.
+ * Removes this source provider from the list, and detaches this authority as a
+ * listener.
*
- * @param provider
- * The provider to remove; must not be <code>null</code>.
+ * @param provider The provider to remove; must not be <code>null</code>.
*/
public final void removeSourceProvider(final ISourceProvider provider) {
provider.removeSourceProviderListener(this);
@@ -234,12 +217,10 @@ public abstract class ExpressionAuthority implements ISourceProviderListener {
* Changes the variable of the given name. If the <code>value</code> is
* <code>null</code>, then the variable is removed.
*
- * @param name
- * The name of the variable to change; must not be
- * <code>null</code>.
- * @param value
- * The new value; the variable should be removed if this is
- * <code>null</code>.
+ * @param name The name of the variable to change; must not be
+ * <code>null</code>.
+ * @param value The new value; the variable should be removed if this is
+ * <code>null</code>.
*/
protected final void changeVariable(final String name, final Object value) {
if (value == null) {
@@ -251,24 +232,23 @@ public abstract class ExpressionAuthority implements ISourceProviderListener {
/**
* Carries out the actual source change notification. It assumed that by the
- * time this method is called, <code>getEvaluationContext()</code> is
- * up-to-date with the current state of the application.
+ * time this method is called, <code>getEvaluationContext()</code> is up-to-date
+ * with the current state of the application.
*
- * @param sourcePriority
- * A bit mask of all the source priorities that have changed.
+ * @param sourcePriority A bit mask of all the source priorities that have
+ * changed.
*/
protected abstract void sourceChanged(final int sourcePriority);
/**
- * Similar to sourceChanged(int) this notifies the subclass about the
- * change, but using the array of source names that changed instead of the
- * priority ... int based.
+ * Similar to sourceChanged(int) this notifies the subclass about the change,
+ * but using the array of source names that changed instead of the priority ...
+ * int based.
* <p>
* Clients may override this method.
* </p>
*
- * @param sourceNames
- * The array of names that changed.
+ * @param sourceNames The array of names that changed.
* @since 3.3
*/
protected void sourceChanged(final String[] sourceNames) {
@@ -276,11 +256,9 @@ public abstract class ExpressionAuthority implements ISourceProviderListener {
}
@Override
- public final void sourceChanged(final int sourcePriority,
- final Map sourceValuesByName) {
+ public final void sourceChanged(final int sourcePriority, final Map sourceValuesByName) {
// If the selection has changed, invalidate the current state.
- if (sourceValuesByName
- .containsKey(ISources.ACTIVE_CURRENT_SELECTION_NAME)) {
+ if (sourceValuesByName.containsKey(ISources.ACTIVE_CURRENT_SELECTION_NAME)) {
currentState = null;
}
@@ -291,13 +269,11 @@ public abstract class ExpressionAuthority implements ISourceProviderListener {
final Object sourceValue = entry.getValue();
updateEvaluationContext(sourceName, sourceValue);
}
- sourceChanged(sourcePriority, (String[]) sourceValuesByName.keySet()
- .toArray(new String[0]));
+ sourceChanged(sourcePriority, (String[]) sourceValuesByName.keySet().toArray(new String[0]));
}
@Override
- public final void sourceChanged(final int sourcePriority,
- final String sourceName, final Object sourceValue) {
+ public final void sourceChanged(final int sourcePriority, final String sourceName, final Object sourceValue) {
// If the selection has changed, invalidate the current state.
if (ISources.ACTIVE_CURRENT_SELECTION_NAME.equals(sourceName)) {
currentState = null;
@@ -317,14 +293,13 @@ public abstract class ExpressionAuthority implements ISourceProviderListener {
}
/**
- * Updates the evaluation context with the current state from all of the
- * source providers.
+ * Updates the evaluation context with the current state from all of the source
+ * providers.
*/
protected final void updateCurrentState() {
final Iterator providerItr = providers.iterator();
while (providerItr.hasNext()) {
- final ISourceProvider provider = (ISourceProvider) providerItr
- .next();
+ final ISourceProvider provider = (ISourceProvider) providerItr.next();
final Map currentState = provider.getCurrentState();
final Iterator variableItr = currentState.entrySet().iterator();
while (variableItr.hasNext()) {
@@ -332,13 +307,10 @@ public abstract class ExpressionAuthority implements ISourceProviderListener {
final String variableName = (String) entry.getKey();
final Object variableValue = entry.getValue();
/*
- * Bug 84056. If we update the active workbench window, then we
- * risk falling back to that shell when the active shell has
- * registered as "none".
+ * Bug 84056. If we update the active workbench window, then we risk falling
+ * back to that shell when the active shell has registered as "none".
*/
- if ((variableName != null)
- && (!ISources.ACTIVE_WORKBENCH_WINDOW_SHELL_NAME
- .equals(variableName))) {
+ if ((variableName != null) && (!ISources.ACTIVE_WORKBENCH_WINDOW_SHELL_NAME.equals(variableName))) {
changeVariable(variableName, variableValue);
}
}
@@ -348,12 +320,10 @@ public abstract class ExpressionAuthority implements ISourceProviderListener {
/**
* Updates this authority's evaluation context.
*
- * @param name
- * The name of the variable to update; must not be
- * <code>null</code>.
- * @param value
- * The new value of the variable. If this value is
- * <code>null</code>, then the variable is removed.
+ * @param name The name of the variable to update; must not be
+ * <code>null</code>.
+ * @param value The new value of the variable. If this value is
+ * <code>null</code>, then the variable is removed.
*/
protected void updateEvaluationContext(final String name, final Object value) {
if (name != null) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/IEvaluationResultCache.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/IEvaluationResultCache.java
index 039dcb30116..121e617dd1d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/IEvaluationResultCache.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/IEvaluationResultCache.java
@@ -34,19 +34,17 @@ import org.eclipse.ui.ISources;
public interface IEvaluationResultCache {
/**
- * Clears the cached computation of the <code>evaluate</code> method, if
- * any. This method is only intended for internal use. It provides a
- * mechanism by which <code>ISourceProvider</code> events can invalidate
- * state on a <code>IEvaluationResultCache</code> instance.
+ * Clears the cached computation of the <code>evaluate</code> method, if any.
+ * This method is only intended for internal use. It provides a mechanism by
+ * which <code>ISourceProvider</code> events can invalidate state on a
+ * <code>IEvaluationResultCache</code> instance.
*/
void clearResult();
/**
- * Returns the expression controlling the activation or visibility of this
- * item.
+ * Returns the expression controlling the activation or visibility of this item.
*
- * @return The expression associated with this item; may be
- * <code>null</code>.
+ * @return The expression associated with this item; may be <code>null</code>.
*/
Expression getExpression();
@@ -59,13 +57,12 @@ public interface IEvaluationResultCache {
int getSourcePriority();
/**
- * Evaluates the expression -- given the current state of the workbench.
- * This method should cache its computation. The cache will be cleared by a
- * call to <code>clearResult</code>.
+ * Evaluates the expression -- given the current state of the workbench. This
+ * method should cache its computation. The cache will be cleared by a call to
+ * <code>clearResult</code>.
*
- * @param context
- * The context in which this state should be evaluated; must not
- * be <code>null</code>.
+ * @param context The context in which this state should be evaluated; must not
+ * be <code>null</code>.
* @return <code>true</code> if the expression currently evaluates to
* <code>true</code>; <code>false</code> otherwise.
*/
@@ -75,8 +72,7 @@ public interface IEvaluationResultCache {
* Forces the cached result to be a particular value. This will <b>not</b>
* notify any users of the cache that it has changed.
*
- * @param result
- * The cached result to use.
+ * @param result The cached result to use.
* @since 3.3
*/
void setResult(boolean result);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/INestable.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/INestable.java
index 3bd136df9b7..3bac1442457 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/INestable.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/INestable.java
@@ -47,16 +47,15 @@ package org.eclipse.ui.internal.services;
public interface INestable {
/**
- * Notifies this service that the component within which it exists has
- * become active. The service should modify its state as appropriate.
+ * Notifies this service that the component within which it exists has become
+ * active. The service should modify its state as appropriate.
*
*/
void activate();
/**
- * Notifies this service that the component within which it exists has
- * become inactive. The service should modify its state as appropriate.
+ * Notifies this service that the component within which it exists has become
+ * inactive. The service should modify its state as appropriate.
*/
void deactivate();
}
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/IServiceLocatorCreator.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/IServiceLocatorCreator.java
index 01b3e01c860..cc90ba7cf3d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/IServiceLocatorCreator.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/IServiceLocatorCreator.java
@@ -29,7 +29,7 @@ import org.eclipse.ui.services.IServiceLocator;
* <strong>PROVISIONAL</strong>. This class or interface has been added as part
* of a work in progress. There is a guarantee neither that this API will work
* nor that it will remain the same. Please do not use this API without
- * consulting with the Platform/UI team. This might disappear in 3.4 M5.
+ * consulting with the Platform/UI team. This might disappear in 3.4 M5.
* </p>
*
*
@@ -37,35 +37,30 @@ import org.eclipse.ui.services.IServiceLocator;
*/
public interface IServiceLocatorCreator {
/**
- * Creates a service locator that can be used for hosting a new service
- * context. It will have the appropriate child services created as needed,
- * and can be used with the Dependency Injection framework to reuse
- * components (by simply providing your own implementation for certain
- * services).
+ * Creates a service locator that can be used for hosting a new service context.
+ * It will have the appropriate child services created as needed, and can be
+ * used with the Dependency Injection framework to reuse components (by simply
+ * providing your own implementation for certain services).
*
- * @param parent
- * the parent locator
- * @param factory
- * a factory that can lazily provide services if requested. This
- * may be <code>null</code>
- * @param owner
- * an object whose {@link IDisposable#dispose()} method will be
- * called on the UI thread if the created service locator needs
- * to be disposed (typically, because a plug-in contributing
- * services to the service locator via an
- * {@link AbstractServiceFactory} is no longer available). The
- * owner can be any object that implements {@link IDisposable}.
- * The recommended implementation of the owner's dispose method
- * is to do whatever is necessary to stop using the created
- * service locator, and then to call
- * {@link IDisposable#dispose()} on the service locator.
- * @return the created service locator. The returned service locator will be
- * an instance of {@link IDisposable}.
+ * @param parent the parent locator
+ * @param factory a factory that can lazily provide services if requested. This
+ * may be <code>null</code>
+ * @param owner an object whose {@link IDisposable#dispose()} method will be
+ * called on the UI thread if the created service locator needs
+ * to be disposed (typically, because a plug-in contributing
+ * services to the service locator via an
+ * {@link AbstractServiceFactory} is no longer available). The
+ * owner can be any object that implements {@link IDisposable}.
+ * The recommended implementation of the owner's dispose method
+ * is to do whatever is necessary to stop using the created
+ * service locator, and then to call
+ * {@link IDisposable#dispose()} on the service locator.
+ * @return the created service locator. The returned service locator will be an
+ * instance of {@link IDisposable}.
*/
- IServiceLocator createServiceLocator(IServiceLocator parent,
- AbstractServiceFactory factory, IDisposable owner);
+ IServiceLocator createServiceLocator(IServiceLocator parent, AbstractServiceFactory factory, IDisposable owner);
- IServiceLocator createServiceLocator(IServiceLocator parent,
- AbstractServiceFactory factory, IDisposable owner, IEclipseContext context);
+ IServiceLocator createServiceLocator(IServiceLocator parent, AbstractServiceFactory factory, IDisposable owner,
+ IEclipseContext context);
} \ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/IWorkbenchLocationService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/IWorkbenchLocationService.java
index 546911fd982..7eebd33e669 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/IWorkbenchLocationService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/IWorkbenchLocationService.java
@@ -50,27 +50,27 @@ public interface IWorkbenchLocationService {
IWorkbench getWorkbench();
/**
- * @return the workbench window in this service locator hierarchy. May
- * return <code>null</code>.
+ * @return the workbench window in this service locator hierarchy. May return
+ * <code>null</code>.
*/
IWorkbenchWindow getWorkbenchWindow();
/**
* @return the part site in this service locator hierarchy. May return
- * <code>null</code>.
+ * <code>null</code>.
*/
IWorkbenchPartSite getPartSite();
/**
- * @return the inner editor site for a multi-page editor in this service
- * locator hierarchy. May return <code>null</code>.
+ * @return the inner editor site for a multi-page editor in this service locator
+ * hierarchy. May return <code>null</code>.
* @see MultiPageEditorSite
*/
IEditorSite getMultiPageEditorSite();
/**
* @return the inner page site for a page based view in this service locator
- * hierarchy. May return <code>null</code>.
+ * hierarchy. May return <code>null</code>.
* @see PageBookView
*/
IPageSite getPageSite();
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/MenuSourceProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/MenuSourceProvider.java
index 67d966cb301..d031c99846a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/MenuSourceProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/MenuSourceProvider.java
@@ -42,25 +42,22 @@ public final class MenuSourceProvider extends AbstractSourceProvider {
/**
* The names of the sources supported by this source provider.
*/
- private static final String[] PROVIDED_SOURCE_NAMES = new String[] {
- ISources.ACTIVE_MENU_NAME, ISources.ACTIVE_MENU_SELECTION_NAME,
- ISources.ACTIVE_MENU_EDITOR_INPUT_NAME };
+ private static final String[] PROVIDED_SOURCE_NAMES = new String[] { ISources.ACTIVE_MENU_NAME,
+ ISources.ACTIVE_MENU_SELECTION_NAME, ISources.ACTIVE_MENU_EDITOR_INPUT_NAME };
/**
- * The menu ids that are currently showing, as known by this source
- * provider. This value may be <code>null</code>.
+ * The menu ids that are currently showing, as known by this source provider.
+ * This value may be <code>null</code>.
*/
private Set menuIds = new HashSet();
/**
* Adds all of the given menu identifiers as being shown.
*
- * @param menuIds
- * The ids of the menu that is now showing; must not be
- * <code>null</code>.
+ * @param menuIds The ids of the menu that is now showing; must not be
+ * <code>null</code>.
*/
- public void addShowingMenus(final Set menuIds,
- final ISelection localSelection, final ISelection localEditorInput) {
+ public void addShowingMenus(final Set menuIds, final ISelection localSelection, final ISelection localEditorInput) {
this.menuIds.addAll(menuIds);
if (DEBUG) {
logDebuggingInfo("Menu ids changed to " + this.menuIds); //$NON-NLS-1$
@@ -70,14 +67,12 @@ public final class MenuSourceProvider extends AbstractSourceProvider {
if (selection != localSelection) {
selection = localSelection;
m.put(ISources.ACTIVE_MENU_SELECTION_NAME,
- selection == null ? IEvaluationContext.UNDEFINED_VARIABLE
- : selection);
+ selection == null ? IEvaluationContext.UNDEFINED_VARIABLE : selection);
}
if (input != localEditorInput) {
input = localEditorInput;
m.put(ISources.ACTIVE_MENU_EDITOR_INPUT_NAME,
- input == null ? IEvaluationContext.UNDEFINED_VARIABLE
- : input);
+ input == null ? IEvaluationContext.UNDEFINED_VARIABLE : input);
}
fireSourceChanged(ISources.ACTIVE_MENU, m);
@@ -95,8 +90,7 @@ public final class MenuSourceProvider extends AbstractSourceProvider {
final Map state = new HashMap();
state.put(ISources.ACTIVE_MENU_NAME, menuIds);
state.put(ISources.ACTIVE_MENU_SELECTION_NAME,
- selection == null ? IEvaluationContext.UNDEFINED_VARIABLE
- : selection);
+ selection == null ? IEvaluationContext.UNDEFINED_VARIABLE : selection);
state.put(ISources.ACTIVE_MENU_EDITOR_INPUT_NAME,
input == null ? IEvaluationContext.UNDEFINED_VARIABLE : input);
return state;
@@ -110,12 +104,11 @@ public final class MenuSourceProvider extends AbstractSourceProvider {
/**
* Removes all of the given menu identifiers as being shown.
*
- * @param menuIds
- * The ids of the menu that is no longer shown; must not be
- * <code>null</code>.
+ * @param menuIds The ids of the menu that is no longer shown; must not be
+ * <code>null</code>.
*/
- public void removeShowingMenus(final Set menuIds,
- final ISelection localSelection, final ISelection localEditorInput) {
+ public void removeShowingMenus(final Set menuIds, final ISelection localSelection,
+ final ISelection localEditorInput) {
this.menuIds.removeAll(menuIds);
if (DEBUG) {
logDebuggingInfo("Menu ids changed to " + this.menuIds); //$NON-NLS-1$
@@ -125,14 +118,12 @@ public final class MenuSourceProvider extends AbstractSourceProvider {
if (selection != localSelection) {
selection = localSelection;
m.put(ISources.ACTIVE_MENU_SELECTION_NAME,
- selection == null ? IEvaluationContext.UNDEFINED_VARIABLE
- : selection);
+ selection == null ? IEvaluationContext.UNDEFINED_VARIABLE : selection);
}
if (input != localEditorInput) {
input = localEditorInput;
m.put(ISources.ACTIVE_MENU_EDITOR_INPUT_NAME,
- input == null ? IEvaluationContext.UNDEFINED_VARIABLE
- : input);
+ input == null ? IEvaluationContext.UNDEFINED_VARIABLE : input);
}
fireSourceChanged(ISources.ACTIVE_MENU, m);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/PreferencePersistence.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/PreferencePersistence.java
index 0a32d8435bc..84cf7f44d4a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/PreferencePersistence.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/PreferencePersistence.java
@@ -50,23 +50,18 @@ import org.eclipse.ui.internal.util.Util;
public abstract class PreferencePersistence extends RegistryPersistence {
/**
- * Inserts the given element into the indexed two-dimensional array in the
- * array at the index. The array is grown as necessary.
+ * Inserts the given element into the indexed two-dimensional array in the array
+ * at the index. The array is grown as necessary.
*
- * @param elementToAdd
- * The element to add to the indexed array; may be
- * <code>null</code>
- * @param indexedArray
- * The two-dimensional array that is indexed by element type;
- * must not be <code>null</code>.
- * @param index
- * The index at which the element should be added; must be a
- * valid index.
- * @param currentCount
- * The current number of items in the array at the index.
+ * @param elementToAdd The element to add to the indexed array; may be
+ * <code>null</code>
+ * @param indexedArray The two-dimensional array that is indexed by element
+ * type; must not be <code>null</code>.
+ * @param index The index at which the element should be added; must be a
+ * valid index.
+ * @param currentCount The current number of items in the array at the index.
*/
- protected static final void addElementToIndexedArray(
- final IMemento elementToAdd, final IMemento[][] indexedArray,
+ protected static final void addElementToIndexedArray(final IMemento elementToAdd, final IMemento[][] indexedArray,
final int index, final int currentCount) {
final IMemento[] elements;
if (currentCount == 0) {
@@ -88,14 +83,11 @@ public abstract class PreferencePersistence extends RegistryPersistence {
/**
* Adds a warning to be logged at some later point in time.
*
- * @param warningsToLog
- * The collection of warnings to be logged; must not be
- * <code>null</code>.
- * @param message
- * The mesaage to log; must not be <code>null</code>.
+ * @param warningsToLog The collection of warnings to be logged; must not be
+ * <code>null</code>.
+ * @param message The mesaage to log; must not be <code>null</code>.
*/
- protected static final void addWarning(final List warningsToLog,
- final String message) {
+ protected static final void addWarning(final List warningsToLog, final String message) {
addWarning(warningsToLog, message, null, null, null);
}
@@ -103,17 +95,13 @@ public abstract class PreferencePersistence extends RegistryPersistence {
* Adds a warning to be logged at some later point in time. This logs the
* identifier of the item.
*
- * @param warningsToLog
- * The collection of warnings to be logged; must not be
- * <code>null</code>.
- * @param message
- * The mesaage to log; must not be <code>null</code>.
- * @param id
- * The identifier of the item for which a warning is being
- * logged; may be <code>null</code>.
+ * @param warningsToLog The collection of warnings to be logged; must not be
+ * <code>null</code>.
+ * @param message The mesaage to log; must not be <code>null</code>.
+ * @param id The identifier of the item for which a warning is being
+ * logged; may be <code>null</code>.
*/
- protected static final void addWarning(final List warningsToLog,
- final String message, final String id) {
+ protected static final void addWarning(final List warningsToLog, final String message, final String id) {
addWarning(warningsToLog, message, id, null, null);
}
@@ -121,23 +109,17 @@ public abstract class PreferencePersistence extends RegistryPersistence {
* Adds a warning to be logged at some later point in time. This logs the
* identifier of the item, as well as an extra attribute.
*
- * @param warningsToLog
- * The collection of warnings to be logged; must not be
- * <code>null</code>.
- * @param message
- * The mesaage to log; must not be <code>null</code>.
- * @param id
- * The identifier of the item for which a warning is being
- * logged; may be <code>null</code>.
- * @param extraAttributeName
- * The name of extra attribute to be logged; may be
- * <code>null</code>.
- * @param extraAttributeValue
- * The value of the extra attribute to be logged; may be
- * <code>null</code>.
+ * @param warningsToLog The collection of warnings to be logged; must not
+ * be <code>null</code>.
+ * @param message The mesaage to log; must not be <code>null</code>.
+ * @param id The identifier of the item for which a warning is
+ * being logged; may be <code>null</code>.
+ * @param extraAttributeName The name of extra attribute to be logged; may be
+ * <code>null</code>.
+ * @param extraAttributeValue The value of the extra attribute to be logged; may
+ * be <code>null</code>.
*/
- protected static final void addWarning(final List warningsToLog,
- final String message, final String id,
+ protected static final void addWarning(final List warningsToLog, final String message, final String id,
final String extraAttributeName, final String extraAttributeValue) {
String statusMessage = message;
if (id != null) {
@@ -153,25 +135,21 @@ public abstract class PreferencePersistence extends RegistryPersistence {
+ extraAttributeValue + '\'';
}
- final IStatus status = new Status(IStatus.WARNING,
- WorkbenchPlugin.PI_WORKBENCH, 0, statusMessage, null);
+ final IStatus status = new Status(IStatus.WARNING, WorkbenchPlugin.PI_WORKBENCH, 0, statusMessage, null);
warningsToLog.add(status);
}
/**
* Reads a boolean attribute from a memnto.
*
- * @param memento
- * The memento from which to read the attribute; must not be
- * <code>null</code>.
- * @param attribute
- * The attribute to read; must not be <code>null</code>.
- * @param defaultValue
- * The default boolean value.
+ * @param memento The memento from which to read the attribute; must not be
+ * <code>null</code>.
+ * @param attribute The attribute to read; must not be <code>null</code>.
+ * @param defaultValue The default boolean value.
* @return The attribute's value; may be <code>null</code> if none.
*/
- protected static final boolean readBoolean(final IMemento memento,
- final String attribute, final boolean defaultValue) {
+ protected static final boolean readBoolean(final IMemento memento, final String attribute,
+ final boolean defaultValue) {
final String value = memento.getString(attribute);
if (value == null) {
return defaultValue;
@@ -185,18 +163,15 @@ public abstract class PreferencePersistence extends RegistryPersistence {
}
/**
- * Reads an optional attribute from a memento. This converts zero-length
- * strings into <code>null</code>.
+ * Reads an optional attribute from a memento. This converts zero-length strings
+ * into <code>null</code>.
*
- * @param memento
- * The memento from which to read the attribute; must not be
- * <code>null</code>.
- * @param attribute
- * The attribute to read; must not be <code>null</code>.
+ * @param memento The memento from which to read the attribute; must not be
+ * <code>null</code>.
+ * @param attribute The attribute to read; must not be <code>null</code>.
* @return The attribute's value; may be <code>null</code> if none.
*/
- protected static final String readOptional(final IMemento memento,
- final String attribute) {
+ protected static final String readOptional(final IMemento memento, final String attribute) {
String value = memento.getString(attribute);
if ((value != null) && (value.length() == 0)) {
value = null;
@@ -206,69 +181,56 @@ public abstract class PreferencePersistence extends RegistryPersistence {
}
/**
- * Reads the parameterized command from a parent memento. This is used to
- * read the parameter sub-elements from a key element, as well as the
- * command id. Each parameter is guaranteed to be valid. If invalid
- * parameters are found, then a warning status will be appended to the
- * <code>warningsToLog</code> list. The command id is required, or a
- * warning will be logged.
+ * Reads the parameterized command from a parent memento. This is used to read
+ * the parameter sub-elements from a key element, as well as the command id.
+ * Each parameter is guaranteed to be valid. If invalid parameters are found,
+ * then a warning status will be appended to the <code>warningsToLog</code>
+ * list. The command id is required, or a warning will be logged.
*
- * @param memento
- * The memento from which the parameters should be read; must not
- * be <code>null</code>.
- * @param commandService
- * The service providing commands for the workbench; must not be
- * <code>null</code>.
- * @param warningsToLog
- * The list of warnings found during parsing. Warnings found will
- * parsing the parameters will be appended to this list. This
- * value must not be <code>null</code>.
- * @param message
- * The message to print if the command identifier is not present;
- * must not be <code>null</code>.
+ * @param memento The memento from which the parameters should be read;
+ * must not be <code>null</code>.
+ * @param commandService The service providing commands for the workbench; must
+ * not be <code>null</code>.
+ * @param warningsToLog The list of warnings found during parsing. Warnings
+ * found will parsing the parameters will be appended to
+ * this list. This value must not be <code>null</code>.
+ * @param message The message to print if the command identifier is not
+ * present; must not be <code>null</code>.
* @return The array of parameters found for this configuration element;
* <code>null</code> if none can be found.
*/
- protected static final ParameterizedCommand readParameterizedCommand(
- final IMemento memento, final ICommandService commandService,
- final List warningsToLog, final String message, final String id) {
- final String commandId = readRequired(memento, ATT_COMMAND_ID,
- warningsToLog, message, id);
+ protected static final ParameterizedCommand readParameterizedCommand(final IMemento memento,
+ final ICommandService commandService, final List warningsToLog, final String message, final String id) {
+ final String commandId = readRequired(memento, ATT_COMMAND_ID, warningsToLog, message, id);
if (commandId == null) {
return null;
}
final Command command = commandService.getCommand(commandId);
- final ParameterizedCommand parameterizedCommand = readParameters(
- memento, warningsToLog, command);
+ final ParameterizedCommand parameterizedCommand = readParameters(memento, warningsToLog, command);
return parameterizedCommand;
}
/**
* Reads the parameters from a parent memento. This is used to read the
- * parameter sub-elements from a key element. Each parameter is guaranteed
- * to be valid. If invalid parameters are found, then a warning status will
- * be appended to the <code>warningsToLog</code> list.
+ * parameter sub-elements from a key element. Each parameter is guaranteed to be
+ * valid. If invalid parameters are found, then a warning status will be
+ * appended to the <code>warningsToLog</code> list.
*
- * @param memento
- * The memento from which the parameters should be read; must not
- * be <code>null</code>.
- * @param warningsToLog
- * The list of warnings found during parsing. Warnings found will
- * parsing the parameters will be appended to this list. This
- * value must not be <code>null</code>.
- * @param command
- * The command around which the parameterization should be
- * created; must not be <code>null</code>.
- * @return The array of parameters found for this memento; <code>null</code>
- * if none can be found.
+ * @param memento The memento from which the parameters should be read;
+ * must not be <code>null</code>.
+ * @param warningsToLog The list of warnings found during parsing. Warnings
+ * found will parsing the parameters will be appended to
+ * this list. This value must not be <code>null</code>.
+ * @param command The command around which the parameterization should be
+ * created; must not be <code>null</code>.
+ * @return The array of parameters found for this memento; <code>null</code> if
+ * none can be found.
*/
- protected static final ParameterizedCommand readParameters(
- final IMemento memento, final List warningsToLog,
+ protected static final ParameterizedCommand readParameters(final IMemento memento, final List warningsToLog,
final Command command) {
- final IMemento[] parameterMementos = memento
- .getChildren(TAG_PARAMETER);
+ final IMemento[] parameterMementos = memento.getChildren(TAG_PARAMETER);
if ((parameterMementos == null) || (parameterMementos.length == 0)) {
return new ParameterizedCommand(command, null);
}
@@ -301,8 +263,7 @@ public abstract class PreferencePersistence extends RegistryPersistence {
}
if (parameter == null) {
// The name should never be null. This is invalid.
- addWarning(warningsToLog,
- "Could not find a matching parameter", id); //$NON-NLS-1$
+ addWarning(warningsToLog, "Could not find a matching parameter", id); //$NON-NLS-1$
continue;
}
@@ -322,50 +283,40 @@ public abstract class PreferencePersistence extends RegistryPersistence {
}
return new ParameterizedCommand(command,
- (Parameterization[]) parameters
- .toArray(new Parameterization[parameters.size()]));
+ (Parameterization[]) parameters.toArray(new Parameterization[parameters.size()]));
}
/**
* Reads a required attribute from the memento.
*
- * @param memento
- * The memento from which to read; must not be <code>null</code>.
- * @param attribute
- * The attribute to read; must not be <code>null</code>.
- * @param warningsToLog
- * The list of warnings; must not be <code>null</code>.
- * @param message
- * The warning message to use if the attribute is missing; must
- * not be <code>null</code>.
+ * @param memento The memento from which to read; must not be
+ * <code>null</code>.
+ * @param attribute The attribute to read; must not be <code>null</code>.
+ * @param warningsToLog The list of warnings; must not be <code>null</code>.
+ * @param message The warning message to use if the attribute is missing;
+ * must not be <code>null</code>.
* @return The required attribute; may be <code>null</code> if missing.
*/
- protected static final String readRequired(final IMemento memento,
- final String attribute, final List warningsToLog,
+ protected static final String readRequired(final IMemento memento, final String attribute, final List warningsToLog,
final String message) {
return readRequired(memento, attribute, warningsToLog, message, null);
}
/**
- * Reads a required attribute from the memento. This logs the identifier of
- * the item if this required element cannot be found.
+ * Reads a required attribute from the memento. This logs the identifier of the
+ * item if this required element cannot be found.
*
- * @param memento
- * The memento from which to read; must not be <code>null</code>.
- * @param attribute
- * The attribute to read; must not be <code>null</code>.
- * @param warningsToLog
- * The list of warnings; must not be <code>null</code>.
- * @param message
- * The warning message to use if the attribute is missing; must
- * not be <code>null</code>.
- * @param id
- * The identifier of the element for which this is a required
- * attribute; may be <code>null</code>.
+ * @param memento The memento from which to read; must not be
+ * <code>null</code>.
+ * @param attribute The attribute to read; must not be <code>null</code>.
+ * @param warningsToLog The list of warnings; must not be <code>null</code>.
+ * @param message The warning message to use if the attribute is missing;
+ * must not be <code>null</code>.
+ * @param id The identifier of the element for which this is a
+ * required attribute; may be <code>null</code>.
* @return The required attribute; may be <code>null</code> if missing.
*/
- protected static final String readRequired(final IMemento memento,
- final String attribute, final List warningsToLog,
+ protected static final String readRequired(final IMemento memento, final String attribute, final List warningsToLog,
final String message, final String id) {
final String value = memento.getString(attribute);
if ((value == null) || (value.length() == 0)) {
@@ -377,8 +328,7 @@ public abstract class PreferencePersistence extends RegistryPersistence {
}
/**
- * Whether the preference and registry change listeners have been attached
- * yet.
+ * Whether the preference and registry change listeners have been attached yet.
*/
protected boolean preferenceListenerAttached = false;
@@ -394,33 +344,30 @@ public abstract class PreferencePersistence extends RegistryPersistence {
public final void dispose() {
super.dispose();
- final IPreferenceStore store = WorkbenchPlugin.getDefault()
- .getPreferenceStore();
+ final IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
store.removePropertyChangeListener(preferenceChangeListener);
}
/**
* Checks whether the preference change could affect this persistence class.
*
- * @param event
- * The event indicating the preference change; must not be
- * <code>null</code>.
- * @return <code>true</code> if the persistence instance is affected by
- * this change; <code>false</code> otherwise.
+ * @param event The event indicating the preference change; must not be
+ * <code>null</code>.
+ * @return <code>true</code> if the persistence instance is affected by this
+ * change; <code>false</code> otherwise.
*/
protected abstract boolean isChangeImportant(final PropertyChangeEvent event);
/**
- * Reads the various elements from the registry. Subclasses should extend,
- * but must not override.
+ * Reads the various elements from the registry. Subclasses should extend, but
+ * must not override.
*/
@Override
protected void read() {
super.read();
if (!preferenceListenerAttached) {
- final IPreferenceStore store = WorkbenchPlugin.getDefault()
- .getPreferenceStore();
+ final IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
store.addPropertyChangeListener(preferenceChangeListener);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/RegistryPersistence.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/RegistryPersistence.java
index 0cdff347596..2b6acd30cb2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/RegistryPersistence.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/RegistryPersistence.java
@@ -57,8 +57,7 @@ import org.eclipse.ui.services.IDisposable;
*
* @since 3.2
*/
-public abstract class RegistryPersistence implements IDisposable,
- IWorkbenchRegistryConstants {
+public abstract class RegistryPersistence implements IDisposable, IWorkbenchRegistryConstants {
/**
* The expression to return when there is an error. Never <code>null</code>.
@@ -71,25 +70,19 @@ public abstract class RegistryPersistence implements IDisposable,
};
/**
- * Inserts the given element into the indexed two-dimensional array in the
- * array at the index. The array is grown as necessary.
+ * Inserts the given element into the indexed two-dimensional array in the array
+ * at the index. The array is grown as necessary.
*
- * @param elementToAdd
- * The element to add to the indexed array; may be
- * <code>null</code>
- * @param indexedArray
- * The two-dimensional array that is indexed by element type;
- * must not be <code>null</code>.
- * @param index
- * The index at which the element should be added; must be a
- * valid index.
- * @param currentCount
- * The current number of items in the array at the index.
+ * @param elementToAdd The element to add to the indexed array; may be
+ * <code>null</code>
+ * @param indexedArray The two-dimensional array that is indexed by element
+ * type; must not be <code>null</code>.
+ * @param index The index at which the element should be added; must be a
+ * valid index.
+ * @param currentCount The current number of items in the array at the index.
*/
- protected static final void addElementToIndexedArray(
- final IConfigurationElement elementToAdd,
- final IConfigurationElement[][] indexedArray, final int index,
- final int currentCount) {
+ protected static final void addElementToIndexedArray(final IConfigurationElement elementToAdd,
+ final IConfigurationElement[][] indexedArray, final int index, final int currentCount) {
final IConfigurationElement[] elements;
if (currentCount == 0) {
elements = new IConfigurationElement[1];
@@ -110,17 +103,14 @@ public abstract class RegistryPersistence implements IDisposable,
/**
* Adds a warning to be logged at some later point in time.
*
- * @param warningsToLog
- * The collection of warnings to be logged; must not be
- * <code>null</code>.
- * @param message
- * The mesaage to log; must not be <code>null</code>.
- * @param element
- * The element from which the warning originates; may be
- * <code>null</code>.
+ * @param warningsToLog The collection of warnings to be logged; must not be
+ * <code>null</code>.
+ * @param message The mesaage to log; must not be <code>null</code>.
+ * @param element The element from which the warning originates; may be
+ * <code>null</code>.
*/
- protected static final void addWarning(final List warningsToLog,
- final String message, final IConfigurationElement element) {
+ protected static final void addWarning(final List warningsToLog, final String message,
+ final IConfigurationElement element) {
addWarning(warningsToLog, message, element, null, null, null);
}
@@ -128,21 +118,16 @@ public abstract class RegistryPersistence implements IDisposable,
* Adds a warning to be logged at some later point in time. This logs the
* identifier of the item.
*
- * @param warningsToLog
- * The collection of warnings to be logged; must not be
- * <code>null</code>.
- * @param message
- * The mesaage to log; must not be <code>null</code>.
- * @param element
- * The element from which the warning originates; may be
- * <code>null</code>.
- * @param id
- * The identifier of the item for which a warning is being
- * logged; may be <code>null</code>.
+ * @param warningsToLog The collection of warnings to be logged; must not be
+ * <code>null</code>.
+ * @param message The mesaage to log; must not be <code>null</code>.
+ * @param element The element from which the warning originates; may be
+ * <code>null</code>.
+ * @param id The identifier of the item for which a warning is being
+ * logged; may be <code>null</code>.
*/
- protected static final void addWarning(final List warningsToLog,
- final String message, final IConfigurationElement element,
- final String id) {
+ protected static final void addWarning(final List warningsToLog, final String message,
+ final IConfigurationElement element, final String id) {
addWarning(warningsToLog, message, element, id, null, null);
}
@@ -150,32 +135,24 @@ public abstract class RegistryPersistence implements IDisposable,
* Adds a warning to be logged at some later point in time. This logs the
* identifier of the item, as well as an extra attribute.
*
- * @param warningsToLog
- * The collection of warnings to be logged; must not be
- * <code>null</code>.
- * @param message
- * The mesaage to log; must not be <code>null</code>.
- * @param element
- * The element from which the warning originates; may be
- * <code>null</code>.
- * @param id
- * The identifier of the item for which a warning is being
- * logged; may be <code>null</code>.
- * @param extraAttributeName
- * The name of extra attribute to be logged; may be
- * <code>null</code>.
- * @param extraAttributeValue
- * The value of the extra attribute to be logged; may be
- * <code>null</code>.
+ * @param warningsToLog The collection of warnings to be logged; must not
+ * be <code>null</code>.
+ * @param message The mesaage to log; must not be <code>null</code>.
+ * @param element The element from which the warning originates; may
+ * be <code>null</code>.
+ * @param id The identifier of the item for which a warning is
+ * being logged; may be <code>null</code>.
+ * @param extraAttributeName The name of extra attribute to be logged; may be
+ * <code>null</code>.
+ * @param extraAttributeValue The value of the extra attribute to be logged; may
+ * be <code>null</code>.
*/
- protected static final void addWarning(final List warningsToLog,
- final String message, final IConfigurationElement element,
- final String id, final String extraAttributeName,
+ protected static final void addWarning(final List warningsToLog, final String message,
+ final IConfigurationElement element, final String id, final String extraAttributeName,
final String extraAttributeValue) {
String statusMessage = message;
if (element != null) {
- statusMessage = statusMessage
- + ": plug-in='" + element.getContributor().getName() + '\''; //$NON-NLS-1$
+ statusMessage = statusMessage + ": plug-in='" + element.getContributor().getName() + '\''; //$NON-NLS-1$
}
if (id != null) {
if (element != null) {
@@ -195,31 +172,27 @@ public abstract class RegistryPersistence implements IDisposable,
+ extraAttributeValue + '\'';
}
- final IStatus status = new Status(IStatus.WARNING,
- WorkbenchPlugin.PI_WORKBENCH, 0, statusMessage, null);
+ final IStatus status = new Status(IStatus.WARNING, WorkbenchPlugin.PI_WORKBENCH, 0, statusMessage, null);
warningsToLog.add(status);
}
/**
- * Checks that the class attribute or element exists for this element. This
- * is used for executable extensions that are being read in.
+ * Checks that the class attribute or element exists for this element. This is
+ * used for executable extensions that are being read in.
*
- * @param configurationElement
- * The configuration element which should contain a class
- * attribute or a class child element; must not be
- * <code>null</code>.
- * @param warningsToLog
- * The list of warnings to be logged; never <code>null</code>.
- * @param message
- * The message to log if something goes wrong; may be
- * <code>null</code>.
- * @param id
- * The identifier of the handle object; may be <code>null</code>.
+ * @param configurationElement The configuration element which should contain a
+ * class attribute or a class child element; must
+ * not be <code>null</code>.
+ * @param warningsToLog The list of warnings to be logged; never
+ * <code>null</code>.
+ * @param message The message to log if something goes wrong; may
+ * be <code>null</code>.
+ * @param id The identifier of the handle object; may be
+ * <code>null</code>.
* @return <code>true</code> if the class attribute or element exists;
* <code>false</code> otherwise.
*/
- protected static final boolean checkClass(
- final IConfigurationElement configurationElement,
+ protected static final boolean checkClass(final IConfigurationElement configurationElement,
final List warningsToLog, final String message, final String id) {
// Check to see if we have a handler class.
if ((configurationElement.getAttribute(ATT_CLASS) == null)
@@ -232,17 +205,15 @@ public abstract class RegistryPersistence implements IDisposable,
}
/**
- * Checks to see whether the configuration element represents a pulldown
- * action. This involves reading the <code>style</code> and
- * <code>pulldown</code> attributes.
+ * Checks to see whether the configuration element represents a pulldown action.
+ * This involves reading the <code>style</code> and <code>pulldown</code>
+ * attributes.
*
- * @param element
- * The element to check; must not be <code>null</code>.
+ * @param element The element to check; must not be <code>null</code>.
* @return <code>true</code> if the element is a pulldown action;
* <code>false</code> otherwise.
*/
- protected static final boolean isPulldown(
- final IConfigurationElement element) {
+ protected static final boolean isPulldown(final IConfigurationElement element) {
final String style = readOptional(element, ATT_STYLE);
final boolean pulldown = readBoolean(element, ATT_PULLDOWN, false);
return (pulldown || STYLE_PULLDOWN.equals(style));
@@ -251,20 +222,15 @@ public abstract class RegistryPersistence implements IDisposable,
/**
* Logs any warnings in <code>warningsToLog</code>.
*
- * @param warningsToLog
- * The warnings to log; may be <code>null</code>.
- * @param message
- * The message to include in the log entry; must not be
- * <code>null</code>.
+ * @param warningsToLog The warnings to log; may be <code>null</code>.
+ * @param message The message to include in the log entry; must not be
+ * <code>null</code>.
*/
- protected static final void logWarnings(final List warningsToLog,
- final String message) {
+ protected static final void logWarnings(final List warningsToLog, final String message) {
// If there were any warnings, then log them now.
if ((warningsToLog != null) && (!warningsToLog.isEmpty())) {
- final IStatus status = new MultiStatus(
- WorkbenchPlugin.PI_WORKBENCH, 0, (IStatus[]) warningsToLog
- .toArray(new IStatus[warningsToLog.size()]),
- message, null);
+ final IStatus status = new MultiStatus(WorkbenchPlugin.PI_WORKBENCH, 0,
+ (IStatus[]) warningsToLog.toArray(new IStatus[warningsToLog.size()]), message, null);
WorkbenchPlugin.log(status);
}
}
@@ -272,18 +238,15 @@ public abstract class RegistryPersistence implements IDisposable,
/**
* Reads a boolean attribute from an element.
*
- * @param configurationElement
- * The configuration element from which to read the attribute;
- * must not be <code>null</code>.
- * @param attribute
- * The attribute to read; must not be <code>null</code>.
- * @param defaultValue
- * The default boolean value.
+ * @param configurationElement The configuration element from which to read the
+ * attribute; must not be <code>null</code>.
+ * @param attribute The attribute to read; must not be
+ * <code>null</code>.
+ * @param defaultValue The default boolean value.
* @return The attribute's value; may be <code>null</code> if none.
*/
- protected static final boolean readBoolean(
- final IConfigurationElement configurationElement,
- final String attribute, final boolean defaultValue) {
+ protected static final boolean readBoolean(final IConfigurationElement configurationElement, final String attribute,
+ final boolean defaultValue) {
final String value = configurationElement.getAttribute(attribute);
if (value == null) {
return defaultValue;
@@ -300,15 +263,13 @@ public abstract class RegistryPersistence implements IDisposable,
* Reads an optional attribute from an element. This converts zero-length
* strings into <code>null</code>.
*
- * @param configurationElement
- * The configuration element from which to read the attribute;
- * must not be <code>null</code>.
- * @param attribute
- * The attribute to read; must not be <code>null</code>.
+ * @param configurationElement The configuration element from which to read the
+ * attribute; must not be <code>null</code>.
+ * @param attribute The attribute to read; must not be
+ * <code>null</code>.
* @return The attribute's value; may be <code>null</code> if none.
*/
- protected static final String readOptional(
- final IConfigurationElement configurationElement,
+ protected static final String readOptional(final IConfigurationElement configurationElement,
final String attribute) {
String value = configurationElement.getAttribute(attribute);
if ((value != null) && (value.length() == 0)) {
@@ -319,42 +280,37 @@ public abstract class RegistryPersistence implements IDisposable,
}
/**
- * Reads the parameterized command from a parent configuration element. This
- * is used to read the parameter sub-elements from a key element, as well as
- * the command id. Each parameter is guaranteed to be valid. If invalid
- * parameters are found, then a warning status will be appended to the
- * <code>warningsToLog</code> list. The command id is required, or a
- * warning will be logged.
+ * Reads the parameterized command from a parent configuration element. This is
+ * used to read the parameter sub-elements from a key element, as well as the
+ * command id. Each parameter is guaranteed to be valid. If invalid parameters
+ * are found, then a warning status will be appended to the
+ * <code>warningsToLog</code> list. The command id is required, or a warning
+ * will be logged.
*
- * @param configurationElement
- * The configuration element from which the parameters should be
- * read; must not be <code>null</code>.
- * @param commandService
- * The service providing commands for the workbench; must not be
- * <code>null</code>.
- * @param warningsToLog
- * The list of warnings found during parsing. Warnings found will
- * parsing the parameters will be appended to this list. This
- * value must not be <code>null</code>.
- * @param message
- * The message to print if the command identifier is not present;
- * must not be <code>null</code>.
+ * @param configurationElement The configuration element from which the
+ * parameters should be read; must not be
+ * <code>null</code>.
+ * @param commandService The service providing commands for the workbench;
+ * must not be <code>null</code>.
+ * @param warningsToLog The list of warnings found during parsing.
+ * Warnings found will parsing the parameters will
+ * be appended to this list. This value must not be
+ * <code>null</code>.
+ * @param message The message to print if the command identifier is
+ * not present; must not be <code>null</code>.
* @return The array of parameters found for this configuration element;
* <code>null</code> if none can be found.
*/
protected static final ParameterizedCommand readParameterizedCommand(
- final IConfigurationElement configurationElement,
- final ICommandService commandService, final List warningsToLog,
- final String message, final String id) {
- final String commandId = readRequired(configurationElement,
- ATT_COMMAND_ID, warningsToLog, message, id);
+ final IConfigurationElement configurationElement, final ICommandService commandService,
+ final List warningsToLog, final String message, final String id) {
+ final String commandId = readRequired(configurationElement, ATT_COMMAND_ID, warningsToLog, message, id);
if (commandId == null) {
return null;
}
final Command command = commandService.getCommand(commandId);
- final ParameterizedCommand parameterizedCommand = readParameters(
- configurationElement, warningsToLog, command);
+ final ParameterizedCommand parameterizedCommand = readParameters(configurationElement, warningsToLog, command);
return parameterizedCommand;
}
@@ -365,24 +321,21 @@ public abstract class RegistryPersistence implements IDisposable,
* guaranteed to be valid. If invalid parameters are found, then a warning
* status will be appended to the <code>warningsToLog</code> list.
*
- * @param configurationElement
- * The configuration element from which the parameters should be
- * read; must not be <code>null</code>.
- * @param warningsToLog
- * The list of warnings found during parsing. Warnings found will
- * parsing the parameters will be appended to this list. This
- * value must not be <code>null</code>.
- * @param command
- * The command around which the parameterization should be
- * created; must not be <code>null</code>.
+ * @param configurationElement The configuration element from which the
+ * parameters should be read; must not be
+ * <code>null</code>.
+ * @param warningsToLog The list of warnings found during parsing.
+ * Warnings found will parsing the parameters will
+ * be appended to this list. This value must not be
+ * <code>null</code>.
+ * @param command The command around which the parameterization
+ * should be created; must not be <code>null</code>.
* @return The array of parameters found for this configuration element;
* <code>null</code> if none can be found.
*/
- protected static final ParameterizedCommand readParameters(
- final IConfigurationElement configurationElement,
+ protected static final ParameterizedCommand readParameters(final IConfigurationElement configurationElement,
final List warningsToLog, final Command command) {
- final IConfigurationElement[] parameterElements = configurationElement
- .getChildren(TAG_PARAMETER);
+ final IConfigurationElement[] parameterElements = configurationElement.getChildren(TAG_PARAMETER);
if ((parameterElements == null) || (parameterElements.length == 0)) {
return new ParameterizedCommand(command, null);
}
@@ -416,8 +369,7 @@ public abstract class RegistryPersistence implements IDisposable,
}
if (parameter == null) {
// The name should never be null. This is invalid.
- addWarning(warningsToLog,
- "Could not find a matching parameter", //$NON-NLS-1$
+ addWarning(warningsToLog, "Could not find a matching parameter", //$NON-NLS-1$
configurationElement, id);
continue;
}
@@ -439,56 +391,45 @@ public abstract class RegistryPersistence implements IDisposable,
}
return new ParameterizedCommand(command,
- (Parameterization[]) parameters
- .toArray(new Parameterization[parameters.size()]));
+ (Parameterization[]) parameters.toArray(new Parameterization[parameters.size()]));
}
/**
* Reads a required attribute from the configuration element.
*
- * @param configurationElement
- * The configuration element from which to read; must not be
- * <code>null</code>.
- * @param attribute
- * The attribute to read; must not be <code>null</code>.
- * @param warningsToLog
- * The list of warnings; must not be <code>null</code>.
- * @param message
- * The warning message to use if the attribute is missing; must
- * not be <code>null</code>.
+ * @param configurationElement The configuration element from which to read;
+ * must not be <code>null</code>.
+ * @param attribute The attribute to read; must not be
+ * <code>null</code>.
+ * @param warningsToLog The list of warnings; must not be
+ * <code>null</code>.
+ * @param message The warning message to use if the attribute is
+ * missing; must not be <code>null</code>.
* @return The required attribute; may be <code>null</code> if missing.
*/
- protected static final String readRequired(
- final IConfigurationElement configurationElement,
- final String attribute, final List warningsToLog,
- final String message) {
- return readRequired(configurationElement, attribute, warningsToLog,
- message, null);
+ protected static final String readRequired(final IConfigurationElement configurationElement, final String attribute,
+ final List warningsToLog, final String message) {
+ return readRequired(configurationElement, attribute, warningsToLog, message, null);
}
/**
* Reads a required attribute from the configuration element. This logs the
* identifier of the item if this required element cannot be found.
*
- * @param configurationElement
- * The configuration element from which to read; must not be
- * <code>null</code>.
- * @param attribute
- * The attribute to read; must not be <code>null</code>.
- * @param warningsToLog
- * The list of warnings; must not be <code>null</code>.
- * @param message
- * The warning message to use if the attribute is missing; must
- * not be <code>null</code>.
- * @param id
- * The identifier of the element for which this is a required
- * attribute; may be <code>null</code>.
+ * @param configurationElement The configuration element from which to read;
+ * must not be <code>null</code>.
+ * @param attribute The attribute to read; must not be
+ * <code>null</code>.
+ * @param warningsToLog The list of warnings; must not be
+ * <code>null</code>.
+ * @param message The warning message to use if the attribute is
+ * missing; must not be <code>null</code>.
+ * @param id The identifier of the element for which this is a
+ * required attribute; may be <code>null</code>.
* @return The required attribute; may be <code>null</code> if missing.
*/
- protected static final String readRequired(
- final IConfigurationElement configurationElement,
- final String attribute, final List warningsToLog,
- final String message, final String id) {
+ protected static final String readRequired(final IConfigurationElement configurationElement, final String attribute,
+ final List warningsToLog, final String message, final String id) {
final String value = configurationElement.getAttribute(attribute);
if ((value == null) || (value.length() == 0)) {
addWarning(warningsToLog, message, configurationElement, id);
@@ -499,74 +440,60 @@ public abstract class RegistryPersistence implements IDisposable,
}
/**
- * Reads a <code>when</code> child element from the given configuration
- * element. Warnings will be appended to <code>warningsToLog</code>.
+ * Reads a <code>when</code> child element from the given configuration element.
+ * Warnings will be appended to <code>warningsToLog</code>.
*
- * @param parentElement
- * The configuration element which might have a <code>when</code>
- * element as a child; never <code>null</code>.
- * @param whenElementName
- * The name of the when element to find; never <code>null</code>.
- * @param id
- * The identifier of the menu element whose <code>when</code>
- * expression is being read; never <code>null</code>.
- * @param warningsToLog
- * The list of warnings while parsing the extension point; never
- * <code>null</code>.
+ * @param parentElement The configuration element which might have a
+ * <code>when</code> element as a child; never
+ * <code>null</code>.
+ * @param whenElementName The name of the when element to find; never
+ * <code>null</code>.
+ * @param id The identifier of the menu element whose
+ * <code>when</code> expression is being read; never
+ * <code>null</code>.
+ * @param warningsToLog The list of warnings while parsing the extension
+ * point; never <code>null</code>.
* @return The <code>when</code> expression for the
* <code>configurationElement</code>, if any; otherwise,
* <code>null</code>.
*/
- protected static final Expression readWhenElement(
- final IConfigurationElement parentElement,
- final String whenElementName, final String id,
- final List warningsToLog) {
+ protected static final Expression readWhenElement(final IConfigurationElement parentElement,
+ final String whenElementName, final String id, final List warningsToLog) {
// Check to see if we have an when expression.
- final IConfigurationElement[] whenElements = parentElement
- .getChildren(whenElementName);
+ final IConfigurationElement[] whenElements = parentElement.getChildren(whenElementName);
Expression whenExpression = null;
if (whenElements.length > 0) {
// Check if we have too many when elements.
if (whenElements.length > 1) {
// There should only be one when element
- addWarning(warningsToLog,
- "There should only be one when element", parentElement, //$NON-NLS-1$
+ addWarning(warningsToLog, "There should only be one when element", parentElement, //$NON-NLS-1$
id, "whenElementName", //$NON-NLS-1$
whenElementName);
return ERROR_EXPRESSION;
}
final IConfigurationElement whenElement = whenElements[0];
- final IConfigurationElement[] expressionElements = whenElement
- .getChildren();
+ final IConfigurationElement[] expressionElements = whenElement.getChildren();
if (expressionElements.length > 0) {
// Check if we have too many expression elements
if (expressionElements.length > 1) {
// There should only be one expression element
- addWarning(
- warningsToLog,
- "There should only be one expression element", parentElement, //$NON-NLS-1$
+ addWarning(warningsToLog, "There should only be one expression element", parentElement, //$NON-NLS-1$
id, "whenElementName", //$NON-NLS-1$
whenElementName);
return ERROR_EXPRESSION;
}
// Convert the activeWhen element into an expression.
- final ElementHandler elementHandler = ElementHandler
- .getDefault();
- final ExpressionConverter converter = ExpressionConverter
- .getDefault();
+ final ElementHandler elementHandler = ElementHandler.getDefault();
+ final ExpressionConverter converter = ExpressionConverter.getDefault();
final IConfigurationElement expressionElement = expressionElements[0];
try {
- whenExpression = elementHandler.create(converter,
- expressionElement);
+ whenExpression = elementHandler.create(converter, expressionElement);
} catch (final CoreException e) {
// There when expression could not be created.
- addWarning(
- warningsToLog,
- "Problem creating when element", //$NON-NLS-1$
- parentElement, id,
- "whenElementName", whenElementName); //$NON-NLS-1$
+ addWarning(warningsToLog, "Problem creating when element", //$NON-NLS-1$
+ parentElement, id, "whenElementName", whenElementName); //$NON-NLS-1$
return ERROR_EXPRESSION;
}
}
@@ -581,14 +508,13 @@ public abstract class RegistryPersistence implements IDisposable,
private final IRegistryChangeListener registryChangeListener;
/**
- * Whether the preference and registry change listeners have been attached
- * yet.
+ * Whether the preference and registry change listeners have been attached yet.
*/
protected boolean registryListenerAttached = false;
/**
- * Constructs a new instance of {@link RegistryPersistence}. A registry
- * change listener is created.
+ * Constructs a new instance of {@link RegistryPersistence}. A registry change
+ * listener is created.
*/
protected RegistryPersistence() {
registryChangeListener = event -> {
@@ -611,18 +537,16 @@ public abstract class RegistryPersistence implements IDisposable,
/**
* Checks whether the registry change could affect this persistence class.
*
- * @param event
- * The event indicating the registry change; must not be
- * <code>null</code>.
- * @return <code>true</code> if the persistence instance is affected by
- * this change; <code>false</code> otherwise.
+ * @param event The event indicating the registry change; must not be
+ * <code>null</code>.
+ * @return <code>true</code> if the persistence instance is affected by this
+ * change; <code>false</code> otherwise.
*/
- protected abstract boolean isChangeImportant(
- final IRegistryChangeEvent event);
+ protected abstract boolean isChangeImportant(final IRegistryChangeEvent event);
/**
- * Reads the various elements from the registry. Subclasses should extend,
- * but must not override.
+ * Reads the various elements from the registry. Subclasses should extend, but
+ * must not override.
*/
protected void read() {
if (!registryListenerAttached) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/ServiceLocator.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/ServiceLocator.java
index 3908b3dc3e8..084232153c5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/ServiceLocator.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/ServiceLocator.java
@@ -35,8 +35,7 @@ import org.eclipse.ui.services.IServiceLocator;
* @since 3.2
*
*/
-public final class ServiceLocator implements IDisposable, INestable,
- IServiceLocator {
+public final class ServiceLocator implements IDisposable, INestable, IServiceLocator {
boolean activated = false;
private static class ParentLocator implements IServiceLocator {
@@ -92,15 +91,12 @@ public final class ServiceLocator implements IDisposable, INestable,
/**
* Constructs a service locator with the given parent.
*
- * @param parent
- * The parent for this service locator; this value may be
- * <code>null</code>.
- * @param factory
- * a local factory that can provide services at this level
+ * @param parent The parent for this service locator; this value may be
+ * <code>null</code>.
+ * @param factory a local factory that can provide services at this level
* @param owner
*/
- public ServiceLocator(final IServiceLocator parent,
- AbstractServiceFactory factory, IDisposable owner) {
+ public ServiceLocator(final IServiceLocator parent, AbstractServiceFactory factory, IDisposable owner) {
this.parent = parent;
this.factory = factory;
this.owner = owner;
@@ -188,9 +184,8 @@ public final class ServiceLocator implements IDisposable, INestable,
@Override
public void handleException(Throwable ex) {
- WorkbenchPlugin
- .log(StatusUtil.newStatus(IStatus.ERROR,
- "Error while disposing: " + iDisposable.getClass().getName(), ex)); //$NON-NLS-1$
+ WorkbenchPlugin.log(StatusUtil.newStatus(IStatus.ERROR,
+ "Error while disposing: " + iDisposable.getClass().getName(), ex)); //$NON-NLS-1$
}
});
}
@@ -232,8 +227,7 @@ public final class ServiceLocator implements IDisposable, INestable,
service = factory.create(key, factoryParent, this);
}
if (service == null) {
- service = WorkbenchServiceRegistry.getRegistry().getService(key, factoryParent,
- this);
+ service = WorkbenchServiceRegistry.getRegistry().getService(key, factoryParent, this);
}
if (service == null) {
service = factoryParent.getService(key);
@@ -255,15 +249,13 @@ public final class ServiceLocator implements IDisposable, INestable,
/**
* Registers a service with this locator. If there is an existing service
- * matching the same <code>api</code> and it implements {@link IDisposable},
- * it will be disposed.
+ * matching the same <code>api</code> and it implements {@link IDisposable}, it
+ * will be disposed.
*
- * @param api
- * This is the interface that the service implements. Must not be
- * <code>null</code>.
- * @param service
- * The service to register. This must be some implementation of
- * <code>api</code>. This value must not be <code>null</code>.
+ * @param api This is the interface that the service implements. Must not be
+ * <code>null</code>.
+ * @param service The service to register. This must be some implementation of
+ * <code>api</code>. This value must not be <code>null</code>.
*/
public void registerService(final Class api, final Object service) {
registerService(api, service, true);
@@ -275,8 +267,7 @@ public final class ServiceLocator implements IDisposable, INestable,
}
if (!api.isInstance(service)) {
- throw new IllegalArgumentException(
- "The service does not implement the given interface"); //$NON-NLS-1$
+ throw new IllegalArgumentException("The service does not implement the given interface"); //$NON-NLS-1$
}
if (isDisposed()) {
IllegalStateException ex = new IllegalStateException("An attempt was made to register service " + service //$NON-NLS-1$
@@ -308,9 +299,9 @@ public final class ServiceLocator implements IDisposable, INestable,
}
/**
- * Some services that were contributed to this locator are no longer
- * available (because the plug-in containing the AbstractServiceFactory is
- * no longer available). Notify the owner of the locator about this.
+ * Some services that were contributed to this locator are no longer available
+ * (because the plug-in containing the AbstractServiceFactory is no longer
+ * available). Notify the owner of the locator about this.
*/
public void unregisterServices(String[] serviceNames) {
if (owner != null) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/ServiceLocatorCreator.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/ServiceLocatorCreator.java
index 618faf8a38b..0d4b8bfd405 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/ServiceLocatorCreator.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/ServiceLocatorCreator.java
@@ -28,10 +28,10 @@ import org.eclipse.ui.services.IServiceLocator;
public class ServiceLocatorCreator implements IServiceLocatorCreator {
@Override
- public IServiceLocator createServiceLocator(IServiceLocator parent,
- AbstractServiceFactory factory, IDisposable owner) {
+ public IServiceLocator createServiceLocator(IServiceLocator parent, AbstractServiceFactory factory,
+ IDisposable owner) {
ServiceLocator serviceLocator = new ServiceLocator(parent, factory, owner);
- //System.err.println("parentLocator: " + parent); //$NON-NLS-1$
+ // System.err.println("parentLocator: " + parent); //$NON-NLS-1$
if (parent != null) {
IEclipseContext ctx = parent.getService(IEclipseContext.class);
if (ctx != null) {
@@ -42,8 +42,8 @@ public class ServiceLocatorCreator implements IServiceLocatorCreator {
}
@Override
- public IServiceLocator createServiceLocator(IServiceLocator parent,
- AbstractServiceFactory factory, IDisposable owner, IEclipseContext context) {
+ public IServiceLocator createServiceLocator(IServiceLocator parent, AbstractServiceFactory factory,
+ IDisposable owner, IEclipseContext context) {
ServiceLocator serviceLocator = new ServiceLocator(parent, factory, owner);
serviceLocator.setContext(context);
return serviceLocator;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/SlaveEvaluationService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/SlaveEvaluationService.java
index d6b8534f6ae..55c9e24a73c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/SlaveEvaluationService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/SlaveEvaluationService.java
@@ -49,10 +49,9 @@ public class SlaveEvaluationService implements IEvaluationService {
* org.eclipse.jface.util.IPropertyChangeListener, java.lang.String)
*/
@Override
- public IEvaluationReference addEvaluationListener(Expression expression,
- IPropertyChangeListener listener, String property) {
- IEvaluationReference ref = parentService.addEvaluationListener(
- expression, listener, property);
+ public IEvaluationReference addEvaluationListener(Expression expression, IPropertyChangeListener listener,
+ String property) {
+ IEvaluationReference ref = parentService.addEvaluationListener(expression, listener, property);
if (!evaluationReferences.contains(ref)) {
evaluationReferences.add(ref);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/SourcePriorityNameMapping.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/SourcePriorityNameMapping.java
index 523c43bbe2b..14d85dfa11e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/SourcePriorityNameMapping.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/SourcePriorityNameMapping.java
@@ -28,12 +28,12 @@ import org.eclipse.ui.ISources;
* <p>
* In the future, it will possible to define a new variable (i.e., piece of
* application state) that you want to use inside of the
- * <code>org.eclipse.ui.contexts</code>, <code>org.eclipse.ui.handlers</code>
- * or <code>org.eclipse.ui.menus</code> extension points. As it stands right
- * now, it is not possible to run code soon enough for the
+ * <code>org.eclipse.ui.contexts</code>, <code>org.eclipse.ui.handlers</code> or
+ * <code>org.eclipse.ui.menus</code> extension points. As it stands right now,
+ * it is not possible to run code soon enough for the
* <code>IHandlerService</code>, <code>IMenuService</code> or
- * <code>IContextService</code> to become aware of the new variables. This
- * will likely be fixed with a new extension point.
+ * <code>IContextService</code> to become aware of the new variables. This will
+ * likely be fixed with a new extension point.
* </p>
* <p>
* TODO Move to "org.eclipse.ui" and resolve the above issue.
@@ -82,35 +82,29 @@ public final class SourcePriorityNameMapping implements ISources {
addMapping(ACTIVE_SHELL_NAME, ACTIVE_SHELL);
addMapping(ACTIVE_SITE_NAME, ACTIVE_SITE);
addMapping(ACTIVE_WORKBENCH_WINDOW_NAME, ACTIVE_WORKBENCH_WINDOW);
- addMapping(ACTIVE_WORKBENCH_WINDOW_SHELL_NAME,
- ACTIVE_WORKBENCH_WINDOW_SHELL);
- addMapping(ACTIVE_WORKBENCH_WINDOW_IS_COOLBAR_VISIBLE_NAME,
- ACTIVE_WORKBENCH_WINDOW_SUBORDINATE);
- addMapping(ACTIVE_WORKBENCH_WINDOW_ACTIVE_PERSPECTIVE_NAME,
- ACTIVE_WORKBENCH_WINDOW_SUBORDINATE);
- addMapping(ACTIVE_WORKBENCH_WINDOW_IS_PERSPECTIVEBAR_VISIBLE_NAME,
- ACTIVE_WORKBENCH_WINDOW_SUBORDINATE);
+ addMapping(ACTIVE_WORKBENCH_WINDOW_SHELL_NAME, ACTIVE_WORKBENCH_WINDOW_SHELL);
+ addMapping(ACTIVE_WORKBENCH_WINDOW_IS_COOLBAR_VISIBLE_NAME, ACTIVE_WORKBENCH_WINDOW_SUBORDINATE);
+ addMapping(ACTIVE_WORKBENCH_WINDOW_ACTIVE_PERSPECTIVE_NAME, ACTIVE_WORKBENCH_WINDOW_SUBORDINATE);
+ addMapping(ACTIVE_WORKBENCH_WINDOW_IS_PERSPECTIVEBAR_VISIBLE_NAME, ACTIVE_WORKBENCH_WINDOW_SUBORDINATE);
addMapping(LEGACY_LEGACY_NAME, LEGACY_LEGACY);
addMapping("workbench", WORKBENCH); //$NON-NLS-1$
}
/**
- * Adds a mapping between a source name and a source priority. This method
- * also cleans up any existing mappings using the same name or priority.
- * There is a one-to-one relationship between name and priority.
+ * Adds a mapping between a source name and a source priority. This method also
+ * cleans up any existing mappings using the same name or priority. There is a
+ * one-to-one relationship between name and priority.
*
- * @param sourceName
- * The name of the variable as it would appear in an XML
- * expression; must not be <code>null</code>.
- * @param sourcePriority
- * The priority of the source with respect to other sources. A
- * higher value means that expressions including this priority
- * will win ties more often. It is recommended that this value is
- * simply a single bit shifted to a particular place.
+ * @param sourceName The name of the variable as it would appear in an XML
+ * expression; must not be <code>null</code>.
+ * @param sourcePriority The priority of the source with respect to other
+ * sources. A higher value means that expressions
+ * including this priority will win ties more often. It is
+ * recommended that this value is simply a single bit
+ * shifted to a particular place.
* @see ISources
*/
- public static void addMapping(final String sourceName,
- final int sourcePriority) {
+ public static void addMapping(final String sourceName, final int sourcePriority) {
if (sourceName == null) {
throw new NullPointerException("The source name cannot be null."); //$NON-NLS-1$
}
@@ -123,16 +117,14 @@ public final class SourcePriorityNameMapping implements ISources {
}
/**
- * Computes the source priority for the given expression. The source
- * priority is a bit mask of all of the variables references by the
- * expression. The default variable is considered to be
- * {@link ISources#ACTIVE_CURRENT_SELECTION}. The source priority is used
- * to minimize recomputations of the expression, and it can also be used for
- * conflict resolution.
+ * Computes the source priority for the given expression. The source priority is
+ * a bit mask of all of the variables references by the expression. The default
+ * variable is considered to be {@link ISources#ACTIVE_CURRENT_SELECTION}. The
+ * source priority is used to minimize recomputations of the expression, and it
+ * can also be used for conflict resolution.
*
- * @param expression
- * The expression for which the source priority should be
- * computed; may be <code>null</code>.
+ * @param expression The expression for which the source priority should be
+ * computed; may be <code>null</code>.
* @return The bit mask of all the sources required for this expression;
* <code>0</code> if none.
*/
@@ -162,9 +154,8 @@ public final class SourcePriorityNameMapping implements ISources {
/**
* Gets the priority for the source with the given name.
*
- * @param sourceName
- * The name of the variable as it would appear in an XML
- * expression; should not be <code>null</code>.
+ * @param sourceName The name of the variable as it would appear in an XML
+ * expression; should not be <code>null</code>.
* @return The source priority that matches, if any;
* <code>NO_SOURCE_PRIORITY</code> if none is found.
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/SourceProviderService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/SourceProviderService.java
index f05185f0bfa..bba2bd20b3e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/SourceProviderService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/SourceProviderService.java
@@ -36,19 +36,18 @@ import org.eclipse.ui.services.ISourceProviderService;
*
* @since 3.2
*/
-public final class SourceProviderService implements ISourceProviderService,
- IDisposable {
+public final class SourceProviderService implements ISourceProviderService, IDisposable {
/**
* The source providers registered with this service. This value is never
- * <code>null</code>. This is a map of the source name ({@link String})
- * to the source provider ({@link ISourceProvider}).
+ * <code>null</code>. This is a map of the source name ({@link String}) to the
+ * source provider ({@link ISourceProvider}).
*/
private final Map sourceProvidersByName = new HashMap();
/**
- * All of the source providers registered with this service. This value is
- * never <code>null</code>.
+ * All of the source providers registered with this service. This value is never
+ * <code>null</code>.
*/
private final Set sourceProviders = new HashSet();
@@ -62,8 +61,7 @@ public final class SourceProviderService implements ISourceProviderService,
public void dispose() {
final Iterator sourceProviderItr = sourceProviders.iterator();
while (sourceProviderItr.hasNext()) {
- final ISourceProvider sourceProvider = (ISourceProvider) sourceProviderItr
- .next();
+ final ISourceProvider sourceProvider = (ISourceProvider) sourceProviderItr.next();
sourceProvider.dispose();
}
sourceProviders.clear();
@@ -77,8 +75,7 @@ public final class SourceProviderService implements ISourceProviderService,
@Override
public ISourceProvider[] getSourceProviders() {
- return (ISourceProvider[]) sourceProviders
- .toArray(new ISourceProvider[sourceProviders.size()]);
+ return (ISourceProvider[]) sourceProviders.toArray(new ISourceProvider[sourceProviders.size()]);
}
public void registerProvider(final ISourceProvider sourceProvider) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/WorkbenchLocationService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/WorkbenchLocationService.java
index 364faa0b8c7..572279ed4d1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/WorkbenchLocationService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/WorkbenchLocationService.java
@@ -25,8 +25,7 @@ import org.eclipse.ui.services.IDisposable;
* @since 3.4
*
*/
-public class WorkbenchLocationService implements IWorkbenchLocationService,
- IDisposable {
+public class WorkbenchLocationService implements IWorkbenchLocationService, IDisposable {
private IEditorSite mpepSite;
private IPageSite pageSite;
@@ -36,9 +35,8 @@ public class WorkbenchLocationService implements IWorkbenchLocationService,
private IWorkbenchWindow window;
private int level;
- public WorkbenchLocationService(String serviceScope, IWorkbench workbench,
- IWorkbenchWindow window, IWorkbenchPartSite partSite,
- IEditorSite mpepSite, IPageSite pageSite, int level) {
+ public WorkbenchLocationService(String serviceScope, IWorkbench workbench, IWorkbenchWindow window,
+ IWorkbenchPartSite partSite, IEditorSite mpepSite, IPageSite pageSite, int level) {
this.mpepSite = mpepSite;
this.pageSite = pageSite;
this.partSite = partSite;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/WorkbenchServiceRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/WorkbenchServiceRegistry.java
index da4df4f3cb6..a4f00390625 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/WorkbenchServiceRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/WorkbenchServiceRegistry.java
@@ -65,10 +65,8 @@ public class WorkbenchServiceRegistry implements IExtensionChangeHandler {
}
private WorkbenchServiceRegistry() {
- PlatformUI.getWorkbench().getExtensionTracker().registerHandler(
- this,
- ExtensionTracker
- .createExtensionPointFilter(getExtensionPoint()));
+ PlatformUI.getWorkbench().getExtensionTracker().registerHandler(this,
+ ExtensionTracker.createExtensionPointFilter(getExtensionPoint()));
}
/**
@@ -92,13 +90,13 @@ public class WorkbenchServiceRegistry implements IExtensionChangeHandler {
AbstractServiceFactory factory;
WeakHashMap serviceLocators = new WeakHashMap();
String[] serviceNames;
+
ServiceFactoryHandle(AbstractServiceFactory factory) {
this.factory = factory;
}
}
- public Object getService(Class key, IServiceLocator parentLocator,
- ServiceLocator locator) {
+ public Object getService(Class key, IServiceLocator parentLocator, ServiceLocator locator) {
ServiceFactoryHandle handle = (ServiceFactoryHandle) factories.get(key.getName());
if (handle == null) {
handle = loadFromRegistry(key);
@@ -115,8 +113,7 @@ public class WorkbenchServiceRegistry implements IExtensionChangeHandler {
private ServiceFactoryHandle loadFromRegistry(Class key) {
ServiceFactoryHandle result = null;
- IConfigurationElement[] serviceFactories = getExtensionPoint()
- .getConfigurationElements();
+ IConfigurationElement[] serviceFactories = getExtensionPoint().getConfigurationElements();
try {
final String requestedName = key.getName();
boolean done = false;
@@ -134,11 +131,10 @@ public class WorkbenchServiceRegistry implements IExtensionChangeHandler {
final AbstractServiceFactory f = (AbstractServiceFactory) serviceFactories[i]
.createExecutableExtension(IWorkbenchRegistryConstants.ATTR_FACTORY_CLASS);
ServiceFactoryHandle handle = new ServiceFactoryHandle(f);
- PlatformUI.getWorkbench().getExtensionTracker().registerObject(
- serviceFactories[i].getDeclaringExtension(),
- handle, IExtensionTracker.REF_WEAK);
+ PlatformUI.getWorkbench().getExtensionTracker().registerObject(
+ serviceFactories[i].getDeclaringExtension(), handle, IExtensionTracker.REF_WEAK);
- List serviceNames = new ArrayList();
+ List serviceNames = new ArrayList();
for (IConfigurationElement configElement : serviceNameElements) {
String serviceName = configElement.getAttribute(IWorkbenchRegistryConstants.ATTR_SERVICE_CLASS);
if (factories.containsKey(serviceName)) {
@@ -149,8 +145,7 @@ public class WorkbenchServiceRegistry implements IExtensionChangeHandler {
serviceNames.add(serviceName);
}
}
- handle.serviceNames = (String[]) serviceNames.toArray(new String[serviceNames
- .size()]);
+ handle.serviceNames = (String[]) serviceNames.toArray(new String[serviceNames.size()]);
result = handle;
}
}
@@ -170,16 +165,14 @@ public class WorkbenchServiceRegistry implements IExtensionChangeHandler {
ArrayList providers = new ArrayList();
IExtensionPoint ep = getExtensionPoint();
for (IConfigurationElement configElement : ep.getConfigurationElements()) {
- if (configElement.getName().equals(
- IWorkbenchRegistryConstants.TAG_SOURCE_PROVIDER)) {
+ if (configElement.getName().equals(IWorkbenchRegistryConstants.TAG_SOURCE_PROVIDER)) {
try {
Object sourceProvider = configElement
.createExecutableExtension(IWorkbenchRegistryConstants.ATTR_PROVIDER);
if (!(sourceProvider instanceof AbstractSourceProvider)) {
String attributeName = configElement.getAttribute(IWorkbenchRegistryConstants.ATTR_PROVIDER);
final String message = "Source Provider '" + //$NON-NLS-1$
- attributeName
- + "' should extend AbstractSourceProvider"; //$NON-NLS-1$
+ attributeName + "' should extend AbstractSourceProvider"; //$NON-NLS-1$
final IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, message);
WorkbenchPlugin.log(status);
continue;
@@ -191,17 +184,12 @@ public class WorkbenchServiceRegistry implements IExtensionChangeHandler {
}
}
}
- return (AbstractSourceProvider[]) providers
- .toArray(new AbstractSourceProvider[providers.size()]);
+ return (AbstractSourceProvider[]) providers.toArray(new AbstractSourceProvider[providers.size()]);
}
- private static final String[] supportedLevels = { ISources.ACTIVE_CONTEXT_NAME,
- ISources.ACTIVE_SHELL_NAME,
- ISources.ACTIVE_WORKBENCH_WINDOW_NAME,
- ISources.ACTIVE_EDITOR_ID_NAME,
- ISources.ACTIVE_PART_ID_NAME,
- ISources.ACTIVE_SITE_NAME
- };
+ private static final String[] supportedLevels = { ISources.ACTIVE_CONTEXT_NAME, ISources.ACTIVE_SHELL_NAME,
+ ISources.ACTIVE_WORKBENCH_WINDOW_NAME, ISources.ACTIVE_EDITOR_ID_NAME, ISources.ACTIVE_PART_ID_NAME,
+ ISources.ACTIVE_SITE_NAME };
private void processVariables(IConfigurationElement[] children) {
for (IConfigurationElement configElement : children) {
@@ -231,7 +219,8 @@ public class WorkbenchServiceRegistry implements IExtensionChangeHandler {
@Override
public void addExtension(IExtensionTracker tracker, IExtension extension) {
- // we don't need to react to adds because we are not caching the extensions we find -
+ // we don't need to react to adds because we are not caching the extensions we
+ // find -
// next time a service is requested, we will look at all extensions again in
// loadFromRegistry
}
@@ -242,7 +231,8 @@ public class WorkbenchServiceRegistry implements IExtensionChangeHandler {
if (object instanceof ServiceFactoryHandle) {
ServiceFactoryHandle handle = (ServiceFactoryHandle) object;
Set locatorSet = handle.serviceLocators.keySet();
- ServiceLocator[] locators = (ServiceLocator[]) locatorSet.toArray(new ServiceLocator[locatorSet.size()]);
+ ServiceLocator[] locators = (ServiceLocator[]) locatorSet
+ .toArray(new ServiceLocator[locatorSet.size()]);
Arrays.sort(locators, (loc1, loc2) -> {
int l1 = loc1.getService(IWorkbenchLocationService.class).getServiceLevel();
int l2 = loc2.getService(IWorkbenchLocationService.class).getServiceLevel();
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/WorkbenchSourceProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/WorkbenchSourceProvider.java
index bf103fcfad5..4672f13a595 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/WorkbenchSourceProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/WorkbenchSourceProvider.java
@@ -53,27 +53,20 @@ import org.eclipse.ui.services.IServiceLocator;
* @since 3.5
* @author Prakash G.R.
*/
-public class WorkbenchSourceProvider extends AbstractSourceProvider implements
- INullSelectionListener {
+public class WorkbenchSourceProvider extends AbstractSourceProvider implements INullSelectionListener {
- private static final String STATUS_LINE_VIS = ISources.ACTIVE_WORKBENCH_WINDOW_NAME
- + ".isStatusLineVisible"; //$NON-NLS-1$
+ private static final String STATUS_LINE_VIS = ISources.ACTIVE_WORKBENCH_WINDOW_NAME + ".isStatusLineVisible"; //$NON-NLS-1$
/**
* The names of the sources supported by this source provider.
*/
- private static final String[] PROVIDED_SOURCE_NAMES = new String[] {
- ISources.ACTIVE_CURRENT_SELECTION_NAME,
- ISources.ACTIVE_EDITOR_ID_NAME, ISources.ACTIVE_EDITOR_NAME,
- ISources.ACTIVE_PART_ID_NAME, ISources.ACTIVE_PART_NAME,
- ISources.ACTIVE_SITE_NAME, ISources.SHOW_IN_SELECTION,
- ISources.SHOW_IN_INPUT, ISources.ACTIVE_SHELL_NAME,
- ISources.ACTIVE_WORKBENCH_WINDOW_NAME,
- ISources.ACTIVE_WORKBENCH_WINDOW_SHELL_NAME,
- ISources.ACTIVE_WORKBENCH_WINDOW_IS_COOLBAR_VISIBLE_NAME,
+ private static final String[] PROVIDED_SOURCE_NAMES = new String[] { ISources.ACTIVE_CURRENT_SELECTION_NAME,
+ ISources.ACTIVE_EDITOR_ID_NAME, ISources.ACTIVE_EDITOR_NAME, ISources.ACTIVE_PART_ID_NAME,
+ ISources.ACTIVE_PART_NAME, ISources.ACTIVE_SITE_NAME, ISources.SHOW_IN_SELECTION, ISources.SHOW_IN_INPUT,
+ ISources.ACTIVE_SHELL_NAME, ISources.ACTIVE_WORKBENCH_WINDOW_NAME,
+ ISources.ACTIVE_WORKBENCH_WINDOW_SHELL_NAME, ISources.ACTIVE_WORKBENCH_WINDOW_IS_COOLBAR_VISIBLE_NAME,
ISources.ACTIVE_WORKBENCH_WINDOW_IS_PERSPECTIVEBAR_VISIBLE_NAME,
- ISources.ACTIVE_WORKBENCH_WINDOW_ACTIVE_PERSPECTIVE_NAME,
- STATUS_LINE_VIS };
+ ISources.ACTIVE_WORKBENCH_WINDOW_ACTIVE_PERSPECTIVE_NAME, STATUS_LINE_VIS };
private IWorkbench workbench;
private IWorkbenchWindow lastWindow;
@@ -83,8 +76,7 @@ public class WorkbenchSourceProvider extends AbstractSourceProvider implements
public void initialize(IServiceLocator locator) {
// this.locator = locator;
super.initialize(locator);
- IWorkbenchLocationService wls = locator
- .getService(IWorkbenchLocationService.class);
+ IWorkbenchLocationService wls = locator.getService(IWorkbenchLocationService.class);
workbench = wls.getWorkbench();
workbench.addWindowListener(windowListener);
lastWindow = workbench.getActiveWorkbenchWindow();
@@ -128,27 +120,21 @@ public class WorkbenchSourceProvider extends AbstractSourceProvider implements
private int updateSelection(final Map currentState) {
int sources = 0;
- currentState.put(ISources.ACTIVE_CURRENT_SELECTION_NAME,
- IEvaluationContext.UNDEFINED_VARIABLE);
+ currentState.put(ISources.ACTIVE_CURRENT_SELECTION_NAME, IEvaluationContext.UNDEFINED_VARIABLE);
Object object = currentState.get(ISources.ACTIVE_PART_NAME);
if (object instanceof IWorkbenchPart) {
IWorkbenchPart part = (IWorkbenchPart) object;
- if (part.getSite() != null
- && part.getSite().getSelectionProvider() != null) {
+ if (part.getSite() != null && part.getSite().getSelectionProvider() != null) {
sources = ISources.ACTIVE_CURRENT_SELECTION;
- ISelection currentSelection = part.getSite()
- .getSelectionProvider()
- .getSelection();
- currentState.put(ISources.ACTIVE_CURRENT_SELECTION_NAME,
- currentSelection);
+ ISelection currentSelection = part.getSite().getSelectionProvider().getSelection();
+ currentState.put(ISources.ACTIVE_CURRENT_SELECTION_NAME, currentSelection);
}
}
return sources;
}
@Override
- public final void selectionChanged(final IWorkbenchPart part,
- final ISelection newSelection) {
+ public final void selectionChanged(final IWorkbenchPart part, final ISelection newSelection) {
if (Util.equals(selection, newSelection))
return; // we have already handled the change
@@ -159,8 +145,7 @@ public class WorkbenchSourceProvider extends AbstractSourceProvider implements
logDebuggingInfo("Selection changed to " + selection); //$NON-NLS-1$
}
- fireSourceChanged(ISources.ACTIVE_CURRENT_SELECTION,
- ISources.ACTIVE_CURRENT_SELECTION_NAME, selection);
+ fireSourceChanged(ISources.ACTIVE_CURRENT_SELECTION, ISources.ACTIVE_CURRENT_SELECTION_NAME, selection);
}
private final void updateWindows(IWorkbenchWindow newWindow) {
@@ -183,14 +168,14 @@ public class WorkbenchSourceProvider extends AbstractSourceProvider implements
// Active Part SourceProvider
/**
- * The last active editor part seen as active by this provider. This value
- * may be <code>null</code> if there is no currently active editor.
+ * The last active editor part seen as active by this provider. This value may
+ * be <code>null</code> if there is no currently active editor.
*/
private IEditorPart lastActiveEditor = null;
/**
- * The last active editor id seen as active by this provider. This value may
- * be <code>null</code> if there is no currently active editor.
+ * The last active editor id seen as active by this provider. This value may be
+ * <code>null</code> if there is no currently active editor.
*/
private String lastActiveEditorId = null;
@@ -201,8 +186,8 @@ public class WorkbenchSourceProvider extends AbstractSourceProvider implements
private IWorkbenchPart lastActivePart = null;
/**
- * The last active part id seen as active by this provider. This value may
- * be <code>null</code> if there is no currently active part.
+ * The last active part id seen as active by this provider. This value may be
+ * <code>null</code> if there is no currently active part.
*/
private String lastActivePartId = null;
@@ -299,8 +284,7 @@ public class WorkbenchSourceProvider extends AbstractSourceProvider implements
int sources = 0;
// Figure out what was changed.
- final Object newActivePart = currentState
- .get(ISources.ACTIVE_PART_NAME);
+ final Object newActivePart = currentState.get(ISources.ACTIVE_PART_NAME);
if (!Util.equals(newActivePart, lastActivePart)) {
sources |= ISources.ACTIVE_PART;
if (newActivePart != IEvaluationContext.UNDEFINED_VARIABLE) {
@@ -309,8 +293,7 @@ public class WorkbenchSourceProvider extends AbstractSourceProvider implements
lastActivePart = null;
}
}
- final Object newActivePartId = currentState
- .get(ISources.ACTIVE_PART_ID_NAME);
+ final Object newActivePartId = currentState.get(ISources.ACTIVE_PART_ID_NAME);
if (!Util.equals(newActivePartId, lastActivePartId)) {
sources |= ISources.ACTIVE_PART_ID;
if (newActivePartId != IEvaluationContext.UNDEFINED_VARIABLE) {
@@ -319,8 +302,7 @@ public class WorkbenchSourceProvider extends AbstractSourceProvider implements
lastActivePartId = null;
}
}
- final Object newActivePartSite = currentState
- .get(ISources.ACTIVE_SITE_NAME);
+ final Object newActivePartSite = currentState.get(ISources.ACTIVE_SITE_NAME);
if (!Util.equals(newActivePartSite, lastActivePartSite)) {
sources |= ISources.ACTIVE_SITE;
if (newActivePartSite != IEvaluationContext.UNDEFINED_VARIABLE) {
@@ -335,8 +317,7 @@ public class WorkbenchSourceProvider extends AbstractSourceProvider implements
lastShowInInput = newShowInInput;
}
if (updateShowInSelection) {
- final Object newShowInSelection = currentState
- .get(ISources.SHOW_IN_SELECTION);
+ final Object newShowInSelection = currentState.get(ISources.SHOW_IN_SELECTION);
if (!Util.equals(newShowInSelection, lastShowInSelection)) {
sources |= ISources.ACTIVE_SITE;
if (newShowInSelection != IEvaluationContext.UNDEFINED_VARIABLE) {
@@ -349,8 +330,7 @@ public class WorkbenchSourceProvider extends AbstractSourceProvider implements
Object newActiveEditor = currentState.get(ISources.ACTIVE_EDITOR_NAME);
if (!Util.equals(newActiveEditor, lastActiveEditor)) {
sources |= ISources.ACTIVE_EDITOR;
- newActiveEditor = (newActiveEditor == IEvaluationContext.UNDEFINED_VARIABLE ? null
- : newActiveEditor);
+ newActiveEditor = (newActiveEditor == IEvaluationContext.UNDEFINED_VARIABLE ? null : newActiveEditor);
hookListener(lastActiveEditor, (IEditorPart) newActiveEditor);
lastActiveEditor = (IEditorPart) newActiveEditor;
}
@@ -363,8 +343,7 @@ public class WorkbenchSourceProvider extends AbstractSourceProvider implements
lastEditorInput = null;
}
}
- final Object newActiveEditorId = currentState
- .get(ISources.ACTIVE_EDITOR_ID_NAME);
+ final Object newActiveEditorId = currentState.get(ISources.ACTIVE_EDITOR_ID_NAME);
if (!Util.equals(newActiveEditorId, lastActiveEditorId)) {
sources |= ISources.ACTIVE_EDITOR_ID;
if (newActiveEditorId != IEvaluationContext.UNDEFINED_VARIABLE) {
@@ -425,8 +404,7 @@ public class WorkbenchSourceProvider extends AbstractSourceProvider implements
private IWorkbenchWindow getActiveWindow() {
final Shell newActiveShell = workbench.getDisplay().getActiveShell();
- final IContextService contextService = workbench
- .getService(IContextService.class);
+ final IContextService contextService = workbench.getService(IContextService.class);
if (contextService != null) {
final int shellType = contextService.getShellType(newActiveShell);
if (shellType != IContextService.TYPE_DIALOG) {
@@ -441,40 +419,27 @@ public class WorkbenchSourceProvider extends AbstractSourceProvider implements
}
private void updateActivePart(Map currentState, boolean updateShowInSelection) {
- currentState.put(ISources.ACTIVE_SITE_NAME,
- IEvaluationContext.UNDEFINED_VARIABLE);
- currentState.put(ISources.ACTIVE_PART_NAME,
- IEvaluationContext.UNDEFINED_VARIABLE);
- currentState.put(ISources.ACTIVE_PART_ID_NAME,
- IEvaluationContext.UNDEFINED_VARIABLE);
- currentState.put(ISources.ACTIVE_EDITOR_NAME,
- IEvaluationContext.UNDEFINED_VARIABLE);
- currentState.put(ISources.ACTIVE_EDITOR_ID_NAME,
- IEvaluationContext.UNDEFINED_VARIABLE);
- currentState.put(ISources.SHOW_IN_INPUT,
- IEvaluationContext.UNDEFINED_VARIABLE);
- currentState.put(ISources.SHOW_IN_SELECTION,
- IEvaluationContext.UNDEFINED_VARIABLE);
+ currentState.put(ISources.ACTIVE_SITE_NAME, IEvaluationContext.UNDEFINED_VARIABLE);
+ currentState.put(ISources.ACTIVE_PART_NAME, IEvaluationContext.UNDEFINED_VARIABLE);
+ currentState.put(ISources.ACTIVE_PART_ID_NAME, IEvaluationContext.UNDEFINED_VARIABLE);
+ currentState.put(ISources.ACTIVE_EDITOR_NAME, IEvaluationContext.UNDEFINED_VARIABLE);
+ currentState.put(ISources.ACTIVE_EDITOR_ID_NAME, IEvaluationContext.UNDEFINED_VARIABLE);
+ currentState.put(ISources.SHOW_IN_INPUT, IEvaluationContext.UNDEFINED_VARIABLE);
+ currentState.put(ISources.SHOW_IN_SELECTION, IEvaluationContext.UNDEFINED_VARIABLE);
final IWorkbenchWindow activeWorkbenchWindow = getActiveWindow();
if (activeWorkbenchWindow != null) {
- final IWorkbenchPage activeWorkbenchPage = activeWorkbenchWindow
- .getActivePage();
+ final IWorkbenchPage activeWorkbenchPage = activeWorkbenchWindow.getActivePage();
if (activeWorkbenchPage != null) {
// Check the active workbench part.
- final IWorkbenchPart newActivePart = activeWorkbenchPage
- .getActivePart();
+ final IWorkbenchPart newActivePart = activeWorkbenchPage.getActivePart();
currentState.put(ISources.ACTIVE_PART_NAME, newActivePart);
if (newActivePart != null) {
- final IWorkbenchPartSite activeWorkbenchPartSite = newActivePart
- .getSite();
- currentState.put(ISources.ACTIVE_SITE_NAME,
- activeWorkbenchPartSite);
+ final IWorkbenchPartSite activeWorkbenchPartSite = newActivePart.getSite();
+ currentState.put(ISources.ACTIVE_SITE_NAME, activeWorkbenchPartSite);
if (activeWorkbenchPartSite != null) {
- final String newActivePartId = activeWorkbenchPartSite
- .getId();
- currentState.put(ISources.ACTIVE_PART_ID_NAME,
- newActivePartId);
+ final String newActivePartId = activeWorkbenchPartSite.getId();
+ currentState.put(ISources.ACTIVE_PART_ID_NAME, newActivePartId);
}
ShowInContext context = getContext(newActivePart);
if (context != null) {
@@ -485,27 +450,21 @@ public class WorkbenchSourceProvider extends AbstractSourceProvider implements
if (updateShowInSelection) {
ISelection selection = context.getSelection();
if (selection != null) {
- currentState.put(ISources.SHOW_IN_SELECTION,
- selection);
+ currentState.put(ISources.SHOW_IN_SELECTION, selection);
}
}
}
}
// Check the active editor part.
- final IEditorPart newActiveEditor = activeWorkbenchPage
- .getActiveEditor();
+ final IEditorPart newActiveEditor = activeWorkbenchPage.getActiveEditor();
currentState.put(ISources.ACTIVE_EDITOR_NAME, newActiveEditor);
if (newActiveEditor != null) {
- currentState.put(ISources.ACTIVE_EDITOR_INPUT_NAME,
- newActiveEditor.getEditorInput());
- final IEditorSite activeEditorSite = newActiveEditor
- .getEditorSite();
+ currentState.put(ISources.ACTIVE_EDITOR_INPUT_NAME, newActiveEditor.getEditorInput());
+ final IEditorSite activeEditorSite = newActiveEditor.getEditorSite();
if (activeEditorSite != null) {
- final String newActiveEditorId = activeEditorSite
- .getId();
- currentState.put(ISources.ACTIVE_EDITOR_ID_NAME,
- newActiveEditorId);
+ final String newActiveEditorId = activeEditorSite.getId();
+ currentState.put(ISources.ACTIVE_EDITOR_ID_NAME, newActiveEditorId);
}
}
}
@@ -522,24 +481,22 @@ public class WorkbenchSourceProvider extends AbstractSourceProvider implements
/**
* The last shell seen as active by this provider. This value may be
- * <code>null</code> if the last call to
- * <code>Display.getActiveShell()</code> returned <code>null</code>.
+ * <code>null</code> if the last call to <code>Display.getActiveShell()</code>
+ * returned <code>null</code>.
*/
private Shell lastActiveShell = null;
/**
- * The last workbench window shell seen as active by this provider. This
- * value may be <code>null</code> if the last call to
- * <code>workbench.getActiveWorkbenchWindow()</code> returned
- * <code>null</code>.
+ * The last workbench window shell seen as active by this provider. This value
+ * may be <code>null</code> if the last call to
+ * <code>workbench.getActiveWorkbenchWindow()</code> returned <code>null</code>.
*/
private Shell lastActiveWorkbenchWindowShell = null;
/**
- * The last workbench window seen as active by this provider. This value may
- * be null if the last call to
- * <code>workbench.getActiveWorkbenchWindow()</code> returned
- * <code>null</code>.
+ * The last workbench window seen as active by this provider. This value may be
+ * null if the last call to <code>workbench.getActiveWorkbenchWindow()</code>
+ * returned <code>null</code>.
*
* @since 3.3
*/
@@ -554,8 +511,8 @@ public class WorkbenchSourceProvider extends AbstractSourceProvider implements
private Boolean lastCoolbarVisibility = Boolean.FALSE;
/**
- * The result of the last visibility check on the perspective bar of the
- * last active workbench window.
+ * The result of the last visibility check on the perspective bar of the last
+ * active workbench window.
*
* @since 3.3
*/
@@ -582,40 +539,31 @@ public class WorkbenchSourceProvider extends AbstractSourceProvider implements
* @since 3.3
*/
private final IPropertyChangeListener propertyListener = event -> {
- if (WorkbenchWindow.PROP_COOLBAR_VISIBLE
- .equals(event.getProperty())) {
+ if (WorkbenchWindow.PROP_COOLBAR_VISIBLE.equals(event.getProperty())) {
Object newValue1 = event.getNewValue();
if (newValue1 == null || !(newValue1 instanceof Boolean))
return;
if (!lastCoolbarVisibility.equals(newValue1)) {
- fireSourceChanged(
- ISources.ACTIVE_WORKBENCH_WINDOW_SUBORDINATE,
- ISources.ACTIVE_WORKBENCH_WINDOW_IS_COOLBAR_VISIBLE_NAME,
- newValue1);
+ fireSourceChanged(ISources.ACTIVE_WORKBENCH_WINDOW_SUBORDINATE,
+ ISources.ACTIVE_WORKBENCH_WINDOW_IS_COOLBAR_VISIBLE_NAME, newValue1);
lastCoolbarVisibility = (Boolean) newValue1;
}
- } else if (WorkbenchWindow.PROP_PERSPECTIVEBAR_VISIBLE.equals(event
- .getProperty())) {
+ } else if (WorkbenchWindow.PROP_PERSPECTIVEBAR_VISIBLE.equals(event.getProperty())) {
Object newValue2 = event.getNewValue();
if (newValue2 == null || !(newValue2 instanceof Boolean))
return;
if (!lastPerspectiveBarVisibility.equals(newValue2)) {
- fireSourceChanged(
- ISources.ACTIVE_WORKBENCH_WINDOW_SUBORDINATE,
- ISources.ACTIVE_WORKBENCH_WINDOW_IS_PERSPECTIVEBAR_VISIBLE_NAME,
- newValue2);
+ fireSourceChanged(ISources.ACTIVE_WORKBENCH_WINDOW_SUBORDINATE,
+ ISources.ACTIVE_WORKBENCH_WINDOW_IS_PERSPECTIVEBAR_VISIBLE_NAME, newValue2);
lastPerspectiveBarVisibility = (Boolean) newValue2;
}
- } else if (WorkbenchWindow.PROP_STATUS_LINE_VISIBLE.equals(event
- .getProperty())) {
+ } else if (WorkbenchWindow.PROP_STATUS_LINE_VISIBLE.equals(event.getProperty())) {
Object newValue3 = event.getNewValue();
if (newValue3 == null || !(newValue3 instanceof Boolean))
return;
if (!lastStatusLineVisibility.equals(newValue3)) {
- fireSourceChanged(
- ISources.ACTIVE_WORKBENCH_WINDOW_SUBORDINATE,
- ISources.ACTIVE_WORKBENCH_WINDOW_NAME
- + ".isStatusLineVisible", newValue3); //$NON-NLS-1$
+ fireSourceChanged(ISources.ACTIVE_WORKBENCH_WINDOW_SUBORDINATE,
+ ISources.ACTIVE_WORKBENCH_WINDOW_NAME + ".isStatusLineVisible", newValue3); //$NON-NLS-1$
lastStatusLineVisibility = (Boolean) newValue3;
}
}
@@ -623,8 +571,7 @@ public class WorkbenchSourceProvider extends AbstractSourceProvider implements
IPerspectiveListener perspectiveListener = new IPerspectiveListener() {
@Override
- public void perspectiveActivated(IWorkbenchPage page,
- IPerspectiveDescriptor perspective) {
+ public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
String id = perspective == null ? null : perspective.getId();
if (Util.equals(lastPerspectiveId, id)) {
return;
@@ -633,16 +580,13 @@ public class WorkbenchSourceProvider extends AbstractSourceProvider implements
HashMap currentState = new HashMap();
int sources = updateSelection(currentState);
sources |= ISources.ACTIVE_WORKBENCH_WINDOW_SUBORDINATE;
- currentState.put(
- ISources.ACTIVE_WORKBENCH_WINDOW_ACTIVE_PERSPECTIVE_NAME,
- id);
+ currentState.put(ISources.ACTIVE_WORKBENCH_WINDOW_ACTIVE_PERSPECTIVE_NAME, id);
fireSourceChanged(sources, currentState);
lastPerspectiveId = id;
}
@Override
- public void perspectiveChanged(IWorkbenchPage page,
- IPerspectiveDescriptor perspective, String changeId) {
+ public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId) {
}
};
@@ -652,7 +596,6 @@ public class WorkbenchSourceProvider extends AbstractSourceProvider implements
}
};
-
/**
* The listener to shell activations on the display.
*/
@@ -669,8 +612,7 @@ public class WorkbenchSourceProvider extends AbstractSourceProvider implements
}
final Map currentState = getCurrentState();
- final Shell newActiveShell = (Shell) currentState
- .get(ISources.ACTIVE_SHELL_NAME);
+ final Shell newActiveShell = (Shell) currentState.get(ISources.ACTIVE_SHELL_NAME);
final WorkbenchWindow newActiveWorkbenchWindow = (WorkbenchWindow) currentState
.get(ISources.ACTIVE_WORKBENCH_WINDOW_NAME);
final Shell newActiveWorkbenchWindowShell = (Shell) currentState
@@ -679,22 +621,17 @@ public class WorkbenchSourceProvider extends AbstractSourceProvider implements
// dont update the coolbar/perspective bar visibility unless we're
// processing a workbench window change
final Boolean newCoolbarVisibility = newActiveWorkbenchWindow == null ? lastCoolbarVisibility
- : (newActiveWorkbenchWindow.getCoolBarVisible() ? Boolean.TRUE
- : Boolean.FALSE);
+ : (newActiveWorkbenchWindow.getCoolBarVisible() ? Boolean.TRUE : Boolean.FALSE);
final Boolean newPerspectiveBarVisibility = newActiveWorkbenchWindow == null ? lastPerspectiveBarVisibility
- : (newActiveWorkbenchWindow.getPerspectiveBarVisible() ? Boolean.TRUE
- : Boolean.FALSE);
+ : (newActiveWorkbenchWindow.getPerspectiveBarVisible() ? Boolean.TRUE : Boolean.FALSE);
final Boolean newStatusLineVis = newActiveWorkbenchWindow == null ? lastStatusLineVisibility
- : (newActiveWorkbenchWindow.getStatusLineVisible() ? Boolean.TRUE
- : Boolean.FALSE);
+ : (newActiveWorkbenchWindow.getStatusLineVisible() ? Boolean.TRUE : Boolean.FALSE);
String perspectiveId = lastPerspectiveId;
if (newActiveWorkbenchWindow != null) {
- IWorkbenchPage activePage = newActiveWorkbenchWindow
- .getActivePage();
+ IWorkbenchPage activePage = newActiveWorkbenchWindow.getActivePage();
if (activePage != null) {
- IPerspectiveDescriptor perspective = activePage
- .getPerspective();
+ IPerspectiveDescriptor perspective = activePage.getPerspective();
if (perspective != null) {
perspectiveId = perspective.getId();
}
@@ -708,26 +645,17 @@ public class WorkbenchSourceProvider extends AbstractSourceProvider implements
final boolean statusLineChanged = newStatusLineVis != lastStatusLineVisibility;
final boolean perspectiveBarChanged = newPerspectiveBarVisibility != lastPerspectiveBarVisibility;
- final boolean perspectiveIdChanged = !Util.equals(
- lastPerspectiveId, perspectiveId);
+ final boolean perspectiveIdChanged = !Util.equals(lastPerspectiveId, perspectiveId);
// Fire an event for those sources that have changed.
if (shellChanged && windowChanged) {
final Map sourceValuesByName1 = new HashMap(5);
- sourceValuesByName1.put(ISources.ACTIVE_SHELL_NAME,
- newActiveShell);
- sourceValuesByName1.put(ISources.ACTIVE_WORKBENCH_WINDOW_NAME,
- newActiveWorkbenchWindow);
- sourceValuesByName1.put(
- ISources.ACTIVE_WORKBENCH_WINDOW_SHELL_NAME,
- newActiveWorkbenchWindowShell);
- int sourceFlags1 = ISources.ACTIVE_SHELL
- | ISources.ACTIVE_WORKBENCH_WINDOW;
+ sourceValuesByName1.put(ISources.ACTIVE_SHELL_NAME, newActiveShell);
+ sourceValuesByName1.put(ISources.ACTIVE_WORKBENCH_WINDOW_NAME, newActiveWorkbenchWindow);
+ sourceValuesByName1.put(ISources.ACTIVE_WORKBENCH_WINDOW_SHELL_NAME, newActiveWorkbenchWindowShell);
+ int sourceFlags1 = ISources.ACTIVE_SHELL | ISources.ACTIVE_WORKBENCH_WINDOW;
if (coolbarChanged) {
- sourceValuesByName1
- .put(
- ISources.ACTIVE_WORKBENCH_WINDOW_IS_COOLBAR_VISIBLE_NAME,
- newCoolbarVisibility);
+ sourceValuesByName1.put(ISources.ACTIVE_WORKBENCH_WINDOW_IS_COOLBAR_VISIBLE_NAME, newCoolbarVisibility);
sourceFlags1 |= ISources.ACTIVE_WORKBENCH_WINDOW_SUBORDINATE;
}
if (statusLineChanged) {
@@ -735,17 +663,12 @@ public class WorkbenchSourceProvider extends AbstractSourceProvider implements
sourceFlags1 |= ISources.ACTIVE_WORKBENCH_WINDOW_SUBORDINATE;
}
if (perspectiveBarChanged) {
- sourceValuesByName1
- .put(
- ISources.ACTIVE_WORKBENCH_WINDOW_IS_PERSPECTIVEBAR_VISIBLE_NAME,
- newPerspectiveBarVisibility);
+ sourceValuesByName1.put(ISources.ACTIVE_WORKBENCH_WINDOW_IS_PERSPECTIVEBAR_VISIBLE_NAME,
+ newPerspectiveBarVisibility);
sourceFlags1 |= ISources.ACTIVE_WORKBENCH_WINDOW_SUBORDINATE;
}
if (perspectiveIdChanged) {
- sourceValuesByName1
- .put(
- ISources.ACTIVE_WORKBENCH_WINDOW_ACTIVE_PERSPECTIVE_NAME,
- perspectiveId);
+ sourceValuesByName1.put(ISources.ACTIVE_WORKBENCH_WINDOW_ACTIVE_PERSPECTIVE_NAME, perspectiveId);
sourceFlags1 |= ISources.ACTIVE_WORKBENCH_WINDOW_SUBORDINATE;
}
@@ -765,32 +688,23 @@ public class WorkbenchSourceProvider extends AbstractSourceProvider implements
}
fireSourceChanged(sourceFlags1, sourceValuesByName1);
- hookListener(lastActiveWorkbenchWindow,
- newActiveWorkbenchWindow);
+ hookListener(lastActiveWorkbenchWindow, newActiveWorkbenchWindow);
} else if (shellChanged) {
if (DEBUG) {
logDebuggingInfo("Active shell changed to " //$NON-NLS-1$
+ newActiveShell);
}
- fireSourceChanged(ISources.ACTIVE_SHELL,
- ISources.ACTIVE_SHELL_NAME, newActiveShell);
+ fireSourceChanged(ISources.ACTIVE_SHELL, ISources.ACTIVE_SHELL_NAME, newActiveShell);
} else if (windowChanged) {
final Map sourceValuesByName2 = new HashMap(4);
- sourceValuesByName2.put(ISources.ACTIVE_WORKBENCH_WINDOW_NAME,
- newActiveWorkbenchWindow);
- sourceValuesByName2.put(
- ISources.ACTIVE_WORKBENCH_WINDOW_SHELL_NAME,
- newActiveWorkbenchWindowShell);
+ sourceValuesByName2.put(ISources.ACTIVE_WORKBENCH_WINDOW_NAME, newActiveWorkbenchWindow);
+ sourceValuesByName2.put(ISources.ACTIVE_WORKBENCH_WINDOW_SHELL_NAME, newActiveWorkbenchWindowShell);
- int sourceFlags2 = ISources.ACTIVE_SHELL
- | ISources.ACTIVE_WORKBENCH_WINDOW;
+ int sourceFlags2 = ISources.ACTIVE_SHELL | ISources.ACTIVE_WORKBENCH_WINDOW;
if (coolbarChanged) {
- sourceValuesByName2
- .put(
- ISources.ACTIVE_WORKBENCH_WINDOW_IS_COOLBAR_VISIBLE_NAME,
- newCoolbarVisibility);
+ sourceValuesByName2.put(ISources.ACTIVE_WORKBENCH_WINDOW_IS_COOLBAR_VISIBLE_NAME, newCoolbarVisibility);
sourceFlags2 |= ISources.ACTIVE_WORKBENCH_WINDOW_SUBORDINATE;
}
if (statusLineChanged) {
@@ -798,17 +712,12 @@ public class WorkbenchSourceProvider extends AbstractSourceProvider implements
sourceFlags2 |= ISources.ACTIVE_WORKBENCH_WINDOW_SUBORDINATE;
}
if (perspectiveBarChanged) {
- sourceValuesByName2
- .put(
- ISources.ACTIVE_WORKBENCH_WINDOW_IS_PERSPECTIVEBAR_VISIBLE_NAME,
- newPerspectiveBarVisibility);
+ sourceValuesByName2.put(ISources.ACTIVE_WORKBENCH_WINDOW_IS_PERSPECTIVEBAR_VISIBLE_NAME,
+ newPerspectiveBarVisibility);
sourceFlags2 |= ISources.ACTIVE_WORKBENCH_WINDOW_SUBORDINATE;
}
if (perspectiveIdChanged) {
- sourceValuesByName2
- .put(
- ISources.ACTIVE_WORKBENCH_WINDOW_ACTIVE_PERSPECTIVE_NAME,
- perspectiveId);
+ sourceValuesByName2.put(ISources.ACTIVE_WORKBENCH_WINDOW_ACTIVE_PERSPECTIVE_NAME, perspectiveId);
sourceFlags2 |= ISources.ACTIVE_WORKBENCH_WINDOW_SUBORDINATE;
}
@@ -826,8 +735,7 @@ public class WorkbenchSourceProvider extends AbstractSourceProvider implements
}
fireSourceChanged(sourceFlags2, sourceValuesByName2);
- hookListener(lastActiveWorkbenchWindow,
- newActiveWorkbenchWindow);
+ hookListener(lastActiveWorkbenchWindow, newActiveWorkbenchWindow);
}
if (shellChanged || windowChanged) {
@@ -844,7 +752,6 @@ public class WorkbenchSourceProvider extends AbstractSourceProvider implements
lastPerspectiveId = perspectiveId;
};
-
protected void checkOtherSources(Shell s) {
handleCheck(s);
}
@@ -852,37 +759,29 @@ public class WorkbenchSourceProvider extends AbstractSourceProvider implements
protected void handleInputChanged(IEditorPart editor) {
IEditorInput newInput = editor.getEditorInput();
if (!Util.equals(newInput, lastEditorInput)) {
- fireSourceChanged(ISources.ACTIVE_EDITOR,
- ISources.ACTIVE_EDITOR_INPUT_NAME,
- newInput == null ? IEvaluationContext.UNDEFINED_VARIABLE
- : newInput);
+ fireSourceChanged(ISources.ACTIVE_EDITOR, ISources.ACTIVE_EDITOR_INPUT_NAME,
+ newInput == null ? IEvaluationContext.UNDEFINED_VARIABLE : newInput);
lastEditorInput = newInput;
}
}
- private void hookListener(WorkbenchWindow lastActiveWorkbenchWindow,
- WorkbenchWindow newActiveWorkbenchWindow) {
+ private void hookListener(WorkbenchWindow lastActiveWorkbenchWindow, WorkbenchWindow newActiveWorkbenchWindow) {
if (lastActiveWorkbenchWindow != null) {
- lastActiveWorkbenchWindow
- .removePropertyChangeListener(propertyListener);
- lastActiveWorkbenchWindow
- .removePerspectiveListener(perspectiveListener);
+ lastActiveWorkbenchWindow.removePropertyChangeListener(propertyListener);
+ lastActiveWorkbenchWindow.removePerspectiveListener(perspectiveListener);
}
if (newActiveWorkbenchWindow != null) {
- newActiveWorkbenchWindow
- .addPropertyChangeListener(propertyListener);
- newActiveWorkbenchWindow
- .addPerspectiveListener(perspectiveListener);
+ newActiveWorkbenchWindow.addPropertyChangeListener(propertyListener);
+ newActiveWorkbenchWindow.addPerspectiveListener(perspectiveListener);
}
}
- private void hookListener(IEditorPart lastActiveEditor,
- IEditorPart newActiveEditor) {
- if (lastActiveEditor!=null) {
+ private void hookListener(IEditorPart lastActiveEditor, IEditorPart newActiveEditor) {
+ if (lastActiveEditor != null) {
lastActiveEditor.removePropertyListener(editorListener);
}
- if (newActiveEditor!=null) {
+ if (newActiveEditor != null) {
newActiveEditor.addPropertyListener(editorListener);
}
}
@@ -893,11 +792,9 @@ public class WorkbenchSourceProvider extends AbstractSourceProvider implements
currentState.put(ISources.ACTIVE_SHELL_NAME, newActiveShell);
/*
- * We will fallback to the workbench window, but only if a dialog is not
- * open.
+ * We will fallback to the workbench window, but only if a dialog is not open.
*/
- final IContextService contextService = workbench
- .getService(IContextService.class);
+ final IContextService contextService = workbench.getService(IContextService.class);
if (contextService == null) {
return;
}
@@ -906,55 +803,40 @@ public class WorkbenchSourceProvider extends AbstractSourceProvider implements
if (shellType == IContextService.TYPE_DIALOG)
return;
- final WorkbenchWindow newActiveWorkbenchWindow = (WorkbenchWindow) workbench
- .getActiveWorkbenchWindow();
+ final WorkbenchWindow newActiveWorkbenchWindow = (WorkbenchWindow) workbench.getActiveWorkbenchWindow();
final Shell newActiveWorkbenchWindowShell;
if (newActiveWorkbenchWindow == null) {
newActiveWorkbenchWindowShell = null;
} else {
newActiveWorkbenchWindowShell = newActiveWorkbenchWindow.getShell();
}
- currentState.put(ISources.ACTIVE_WORKBENCH_WINDOW_NAME,
- newActiveWorkbenchWindow);
- currentState.put(ISources.ACTIVE_WORKBENCH_WINDOW_SHELL_NAME,
- newActiveWorkbenchWindowShell);
+ currentState.put(ISources.ACTIVE_WORKBENCH_WINDOW_NAME, newActiveWorkbenchWindow);
+ currentState.put(ISources.ACTIVE_WORKBENCH_WINDOW_SHELL_NAME, newActiveWorkbenchWindowShell);
final Boolean newCoolbarVisibility = newActiveWorkbenchWindow == null ? lastCoolbarVisibility
- : (newActiveWorkbenchWindow.getCoolBarVisible() ? Boolean.TRUE
- : Boolean.FALSE);
+ : (newActiveWorkbenchWindow.getCoolBarVisible() ? Boolean.TRUE : Boolean.FALSE);
final Boolean newPerspectiveBarVisibility = newActiveWorkbenchWindow == null ? lastPerspectiveBarVisibility
- : (newActiveWorkbenchWindow.getPerspectiveBarVisible() ? Boolean.TRUE
- : Boolean.FALSE);
+ : (newActiveWorkbenchWindow.getPerspectiveBarVisible() ? Boolean.TRUE : Boolean.FALSE);
final Boolean newStatusLineVis = newActiveWorkbenchWindow == null ? lastStatusLineVisibility
- : (newActiveWorkbenchWindow.getStatusLineVisible() ? Boolean.TRUE
- : Boolean.FALSE);
+ : (newActiveWorkbenchWindow.getStatusLineVisible() ? Boolean.TRUE : Boolean.FALSE);
String perspectiveId = lastPerspectiveId;
if (newActiveWorkbenchWindow != null) {
- IWorkbenchPage activePage = newActiveWorkbenchWindow
- .getActivePage();
+ IWorkbenchPage activePage = newActiveWorkbenchWindow.getActivePage();
if (activePage != null) {
- IPerspectiveDescriptor perspective = activePage
- .getPerspective();
+ IPerspectiveDescriptor perspective = activePage.getPerspective();
if (perspective != null) {
perspectiveId = perspective.getId();
}
}
}
- currentState.put(
- ISources.ACTIVE_WORKBENCH_WINDOW_IS_COOLBAR_VISIBLE_NAME,
- newCoolbarVisibility);
+ currentState.put(ISources.ACTIVE_WORKBENCH_WINDOW_IS_COOLBAR_VISIBLE_NAME, newCoolbarVisibility);
- currentState
- .put(
- ISources.ACTIVE_WORKBENCH_WINDOW_IS_PERSPECTIVEBAR_VISIBLE_NAME,
- newPerspectiveBarVisibility);
+ currentState.put(ISources.ACTIVE_WORKBENCH_WINDOW_IS_PERSPECTIVEBAR_VISIBLE_NAME, newPerspectiveBarVisibility);
currentState.put(STATUS_LINE_VIS, newStatusLineVis);
- currentState.put(
- ISources.ACTIVE_WORKBENCH_WINDOW_ACTIVE_PERSPECTIVE_NAME,
- perspectiveId);
+ currentState.put(ISources.ACTIVE_WORKBENCH_WINDOW_ACTIVE_PERSPECTIVE_NAME, perspectiveId);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/splash/EclipseSplashHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/splash/EclipseSplashHandler.java
index 84b4eb9c923..a924c1c3f89 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/splash/EclipseSplashHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/splash/EclipseSplashHandler.java
@@ -43,8 +43,7 @@ public class EclipseSplashHandler extends BasicSplashHandler {
* products might rely on them.
* </p>
*
- * @param splash
- * the shell that contains the splash screen
+ * @param splash the shell that contains the splash screen
*/
@Override
public void init(Shell splash) {
@@ -54,38 +53,29 @@ public class EclipseSplashHandler extends BasicSplashHandler {
String foregroundColorString = null;
IProduct product = Platform.getProduct();
if (product != null) {
- progressRectString = product
- .getProperty(IProductConstants.STARTUP_PROGRESS_RECT);
- messageRectString = product
- .getProperty(IProductConstants.STARTUP_MESSAGE_RECT);
- foregroundColorString = product
- .getProperty(IProductConstants.STARTUP_FOREGROUND_COLOR);
+ progressRectString = product.getProperty(IProductConstants.STARTUP_PROGRESS_RECT);
+ messageRectString = product.getProperty(IProductConstants.STARTUP_MESSAGE_RECT);
+ foregroundColorString = product.getProperty(IProductConstants.STARTUP_FOREGROUND_COLOR);
}
- Rectangle progressRect = StringConverter.asRectangle(
- progressRectString, new Rectangle(10, 10, 300, 15));
+ Rectangle progressRect = StringConverter.asRectangle(progressRectString, new Rectangle(10, 10, 300, 15));
setProgressRect(progressRect);
- Rectangle messageRect = StringConverter.asRectangle(messageRectString,
- new Rectangle(10, 35, 300, 15));
+ Rectangle messageRect = StringConverter.asRectangle(messageRectString, new Rectangle(10, 35, 300, 15));
setMessageRect(messageRect);
int foregroundColorInteger;
try {
- foregroundColorInteger = Integer
- .parseInt(foregroundColorString, 16);
+ foregroundColorInteger = Integer.parseInt(foregroundColorString, 16);
} catch (Exception ex) {
foregroundColorInteger = 0xD2D7FF; // off white
}
- setForeground(new RGB((foregroundColorInteger & 0xFF0000) >> 16,
- (foregroundColorInteger & 0xFF00) >> 8,
+ setForeground(new RGB((foregroundColorInteger & 0xFF0000) >> 16, (foregroundColorInteger & 0xFF00) >> 8,
foregroundColorInteger & 0xFF));
// the following code will be removed for release time
- if (PrefUtil.getInternalPreferenceStore().getBoolean(
- "SHOW_BUILDID_ON_STARTUP")) { //$NON-NLS-1$
- final String buildId = System.getProperty(
- "eclipse.buildId", "Unknown Build"); //$NON-NLS-1$ //$NON-NLS-2$
- // find the specified location. Not currently API
+ if (PrefUtil.getInternalPreferenceStore().getBoolean("SHOW_BUILDID_ON_STARTUP")) { //$NON-NLS-1$
+ final String buildId = System.getProperty("eclipse.buildId", "Unknown Build"); //$NON-NLS-1$ //$NON-NLS-2$
+ // find the specified location. Not currently API
// hardcoded to be sensible with our current splash Graphic
String buildIdLocString = product.getProperty("buildIdLocation"); //$NON-NLS-1$
@@ -105,8 +95,7 @@ public class EclipseSplashHandler extends BasicSplashHandler {
idLabel.setBounds(buildIdRectangle);
idLabel.setText(buildId);
idLabel.setData(CSSSWTConstants.CSS_ID_KEY, CSS_ID_SPLASH_BUILD_ID);
- }
- else {
+ } else {
getContent(); // ensure creation of the progress
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/splash/SplashHandlerFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/splash/SplashHandlerFactory.java
index 0bc3cd72a66..39ac7709ad6 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/splash/SplashHandlerFactory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/splash/SplashHandlerFactory.java
@@ -36,20 +36,18 @@ import org.eclipse.ui.splash.AbstractSplashHandler;
public final class SplashHandlerFactory {
/**
- * Find the splash handler for the given product or <code>null</code> if
- * it cannot be found.
+ * Find the splash handler for the given product or <code>null</code> if it
+ * cannot be found.
*
- * @param product
- * the product
+ * @param product the product
* @return the splash or <code>null</code>
*/
public static AbstractSplashHandler findSplashHandlerFor(IProduct product) {
if (product == null)
return null;
- IExtensionPoint point = Platform.getExtensionRegistry()
- .getExtensionPoint(PlatformUI.PLUGIN_ID,
- IWorkbenchRegistryConstants.PL_SPLASH_HANDLERS);
+ IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(PlatformUI.PLUGIN_ID,
+ IWorkbenchRegistryConstants.PL_SPLASH_HANDLERS);
if (point == null)
return null;
@@ -72,24 +70,18 @@ public final class SplashHandlerFactory {
/**
* Process a given element.
*
- * @param configurationElement
- * the element to process
- * @param idToSplash
- * the map of current splash elements
- * @param targetId
- * the target id if known
- * @param product
- * the product to search for
+ * @param configurationElement the element to process
+ * @param idToSplash the map of current splash elements
+ * @param targetId the target id if known
+ * @param product the product to search for
* @return a splash matching the target id from this element or
* <code>null</code>
*/
- private static AbstractSplashHandler processElement(
- IConfigurationElement configurationElement, Map idToSplash,
+ private static AbstractSplashHandler processElement(IConfigurationElement configurationElement, Map idToSplash,
String[] targetId, IProduct product) {
String type = configurationElement.getName();
if (IWorkbenchRegistryConstants.TAG_SPLASH_HANDLER.equals(type)) {
- String id = configurationElement
- .getAttribute(IWorkbenchRegistryConstants.ATT_ID);
+ String id = configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
if (id == null)
return null;
@@ -100,17 +92,13 @@ public final class SplashHandlerFactory {
// store for later examination
idToSplash.put(id, configurationElement);
- } else if (IWorkbenchRegistryConstants.TAG_SPLASH_HANDLER_PRODUCT_BINDING
- .equals(type)) {
- String productId = configurationElement
- .getAttribute(IWorkbenchRegistryConstants.ATT_PRODUCTID);
+ } else if (IWorkbenchRegistryConstants.TAG_SPLASH_HANDLER_PRODUCT_BINDING.equals(type)) {
+ String productId = configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_PRODUCTID);
if (product.getId().equals(productId) && targetId[0] == null) { // we
// found the target ID
- targetId[0] = configurationElement
- .getAttribute(IWorkbenchRegistryConstants.ATT_SPLASH_ID);
+ targetId[0] = configurationElement.getAttribute(IWorkbenchRegistryConstants.ATT_SPLASH_ID);
// check all currently located splashes
- IConfigurationElement splashElement = (IConfigurationElement) idToSplash
- .get(targetId[0]);
+ IConfigurationElement splashElement = (IConfigurationElement) idToSplash.get(targetId[0]);
if (splashElement != null)
return create(splashElement);
}
@@ -122,26 +110,22 @@ public final class SplashHandlerFactory {
/**
* Create the splash implementation.
*
- * @param splashElement
- * the element to create from
+ * @param splashElement the element to create from
* @return the element or <code>null</code> if it couldn't be created
*/
- private static AbstractSplashHandler create(
- final IConfigurationElement splashElement) {
+ private static AbstractSplashHandler create(final IConfigurationElement splashElement) {
final AbstractSplashHandler[] handler = new AbstractSplashHandler[1];
SafeRunner.run(new SafeRunnable() {
@Override
public void run() throws Exception {
- handler[0] = (AbstractSplashHandler) WorkbenchPlugin
- .createExtension(splashElement,
- IWorkbenchRegistryConstants.ATT_CLASS);
+ handler[0] = (AbstractSplashHandler) WorkbenchPlugin.createExtension(splashElement,
+ IWorkbenchRegistryConstants.ATT_CLASS);
}
@Override
public void handleException(Throwable e) {
- WorkbenchPlugin
- .log("Problem creating splash implementation", e); //$NON-NLS-1$
+ WorkbenchPlugin.log("Problem creating splash implementation", e); //$NON-NLS-1$
}
});
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/DefaultDetailsArea.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/DefaultDetailsArea.java
index 6cd1a62d44d..83552344108 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/DefaultDetailsArea.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/DefaultDetailsArea.java
@@ -89,15 +89,12 @@ public class DefaultDetailsArea extends AbstractStatusAreaProvider {
*/
public DefaultDetailsArea(Map dialogState) {
this.dialogState = dialogState;
- handleOkStatuses = ((Boolean) dialogState
- .get(IStatusDialogConstants.HANDLE_OK_STATUSES)).booleanValue();
- mask = ((Integer) dialogState.get(IStatusDialogConstants.MASK))
- .intValue();
+ handleOkStatuses = ((Boolean) dialogState.get(IStatusDialogConstants.HANDLE_OK_STATUSES)).booleanValue();
+ mask = ((Integer) dialogState.get(IStatusDialogConstants.MASK)).intValue();
}
@Override
- public Control createSupportArea(Composite parent,
- StatusAdapter statusAdapter) {
+ public Control createSupportArea(Composite parent, StatusAdapter statusAdapter) {
Composite area = createArea(parent);
setStatusAdapter(statusAdapter);
return area;
@@ -107,8 +104,7 @@ public class DefaultDetailsArea extends AbstractStatusAreaProvider {
parent = new Composite(parent, SWT.NONE);
parent.setLayout(new GridLayout());
parent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- text = new StyledText(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI
- | SWT.BORDER | SWT.READ_ONLY | SWT.WRAP);
+ text = new StyledText(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.READ_ONLY | SWT.WRAP);
text.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
GridData gd = new GridData(GridData.FILL_BOTH);
gd.grabExcessHorizontalSpace = true;
@@ -118,11 +114,9 @@ public class DefaultDetailsArea extends AbstractStatusAreaProvider {
text.setLayoutData(gd);
// There is no support for triggering commands in the dialogs. I am
// trying to emulate the workbench behavior as exactly as possible.
- IBindingService binding = PlatformUI.getWorkbench()
- .getService(IBindingService.class);
+ IBindingService binding = PlatformUI.getWorkbench().getService(IBindingService.class);
// find bindings for copy action
- final TriggerSequence ts[] = binding
- .getActiveBindingsFor(ActionFactory.COPY.getCommandId());
+ final TriggerSequence ts[] = binding.getActiveBindingsFor(ActionFactory.COPY.getCommandId());
text.addKeyListener(new KeyListener() {
ArrayList keyList = new ArrayList();
@@ -132,8 +126,7 @@ public class DefaultDetailsArea extends AbstractStatusAreaProvider {
// get the character. reverse the ctrl modifier if necessary
char character = e.character;
boolean ctrlDown = (e.stateMask & SWT.CTRL) != 0;
- if (ctrlDown && e.character != e.keyCode && e.character < 0x20
- && (e.keyCode & SWT.KEYCODE_BIT) == 0) {
+ if (ctrlDown && e.character != e.keyCode && e.character < 0x20 && (e.keyCode & SWT.KEYCODE_BIT) == 0) {
character += 0x40;
}
// do not process modifier keys
@@ -142,8 +135,7 @@ public class DefaultDetailsArea extends AbstractStatusAreaProvider {
}
// if there is a character, use it. if no character available,
// try with key code
- KeyStroke ks = KeyStroke.getInstance(e.stateMask,
- character != 0 ? character : e.keyCode);
+ KeyStroke ks = KeyStroke.getInstance(e.stateMask, character != 0 ? character : e.keyCode);
keyList.add(ks);
KeySequence sequence = KeySequence.getInstance(keyList);
boolean partialMatch = false;
@@ -202,20 +194,16 @@ public class DefaultDetailsArea extends AbstractStatusAreaProvider {
private void setStatusAdapter(StatusAdapter adapter) {
populateList(text, adapter.getStatus(), 0, new int[] { 0 });
if (!isMulti()) {
- Long timestamp = (Long) adapter
- .getProperty(IStatusAdapterConstants.TIMESTAMP_PROPERTY);
+ Long timestamp = (Long) adapter.getProperty(IStatusAdapterConstants.TIMESTAMP_PROPERTY);
if (timestamp != null) {
- String date = DateFormat.getDateTimeInstance(DateFormat.LONG,
- DateFormat.LONG)
+ String date = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG)
.format(new Date(timestamp.longValue()));
- text.append(NLS.bind(ProgressMessages.JobInfo_Error,
- (new Object[] { "", date }))); //$NON-NLS-1$
+ text.append(NLS.bind(ProgressMessages.JobInfo_Error, (new Object[] { "", date }))); //$NON-NLS-1$
}
}
int delimiterLength = getLineSeparator().length();
- text.replaceTextRange(text.getText().length() - delimiterLength,
- delimiterLength, ""); //$NON-NLS-1$
+ text.replaceTextRange(text.getText().length() - delimiterLength, delimiterLength, ""); //$NON-NLS-1$
adjustHeight(text);
}
@@ -287,8 +275,7 @@ public class DefaultDetailsArea extends AbstractStatusAreaProvider {
}
}
- private void populateList(StyledText text, IStatus status, int nesting,
- int[] lineNumber) {
+ private void populateList(StyledText text, IStatus status, int nesting, int[] lineNumber) {
if (!status.matches(mask) && !(handleOkStatuses && status.isOK())) {
return;
}
@@ -317,8 +304,7 @@ public class DefaultDetailsArea extends AbstractStatusAreaProvider {
return System.getProperty("line.separator"); //$NON-NLS-1$
}
- private void appendNewLine(StyledText text, String line, int indentLevel,
- int lineNumber) {
+ private void appendNewLine(StyledText text, String line, int indentLevel, int lineNumber) {
text.append(line + getLineSeparator());
int pixelIndent = indentLevel * NESTING_INDENT;
if (lineNumber != 0) {
@@ -347,7 +333,6 @@ public class DefaultDetailsArea extends AbstractStatusAreaProvider {
* @return true if the dialog has one more than one status.
*/
private boolean isMulti() {
- return ((Collection) dialogState
- .get(IStatusDialogConstants.STATUS_ADAPTERS)).size() != 1;
+ return ((Collection) dialogState.get(IStatusDialogConstants.STATUS_ADAPTERS)).size() != 1;
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/DetailsAreaManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/DetailsAreaManager.java
index c277c54ae44..920bb3047e5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/DetailsAreaManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/DetailsAreaManager.java
@@ -22,7 +22,6 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.statushandlers.AbstractStatusAreaProvider;
import org.eclipse.ui.statushandlers.StatusAdapter;
-
/**
* This class is responsible for managing details area.
*/
@@ -51,14 +50,11 @@ public class DetailsAreaManager {
* This method is responsible for creating details area on the specified
* Composite and displaying specified StatusAdapter
*
- * @param parent
- * A composite on which should be the details area created.
- * @param statusAdapter
- * StatusAdapter for which should be the details area
- * created.
+ * @param parent A composite on which should be the details area created.
+ * @param statusAdapter StatusAdapter for which should be the details area
+ * created.
*/
- public void createDetailsArea(Composite parent,
- StatusAdapter statusAdapter) {
+ public void createDetailsArea(Composite parent, StatusAdapter statusAdapter) {
Composite container = new Composite(parent, SWT.NONE);
container.setLayout(GridLayoutFactory.fillDefaults().create());
container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/IStatusDialogConstants.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/IStatusDialogConstants.java
index 6a78a89120c..6d803b424ba 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/IStatusDialogConstants.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/IStatusDialogConstants.java
@@ -40,19 +40,19 @@ public interface IStatusDialogConstants {
Object SHELL = Shell.class;
/**
- * This property indicates if the support area should be opened when the
- * dialog appears. The value must be of {@link Boolean} type.
- * {@link Boolean#TRUE} means that the support area will be opened, while
- * {@link Boolean#FALSE} means that it will be in the closed state.
+ * This property indicates if the support area should be opened when the dialog
+ * appears. The value must be of {@link Boolean} type. {@link Boolean#TRUE}
+ * means that the support area will be opened, while {@link Boolean#FALSE} means
+ * that it will be in the closed state.
*/
Object SHOW_SUPPORT = new Object();
/**
- * This property indicates if the dialog should display a link to the Error
- * Log if the Error Log view is available. The value must be of
- * {@link Boolean} type. {@link Boolean#TRUE} means that the link will be
- * present if the Error Log is available, {@link Boolean#FALSE} means that
- * it will never be displayed.
+ * This property indicates if the dialog should display a link to the Error Log
+ * if the Error Log view is available. The value must be of {@link Boolean}
+ * type. {@link Boolean#TRUE} means that the link will be present if the Error
+ * Log is available, {@link Boolean#FALSE} means that it will never be
+ * displayed.
*/
Object ERRORLOG_LINK = new Object();
@@ -60,21 +60,20 @@ public interface IStatusDialogConstants {
* This property indicates if the dialog should threat {@link Status}es with
* severity {@link IStatus#OK} as all other statuses. The value must be of
* {@link Boolean} type. A {@link Boolean#TRUE} means that those
- * {@link Status}es will be handled as all others, while
- * {@link Boolean#FALSE} means that they will be silently ignored.
+ * {@link Status}es will be handled as all others, while {@link Boolean#FALSE}
+ * means that they will be silently ignored.
*/
Object HANDLE_OK_STATUSES = new Object();
/**
* This property indicates how the dialog should be named. The default value
- * comes from jface resources. It may be {@link String} or <code>null</code>
- * .
+ * comes from jface resources. It may be {@link String} or <code>null</code> .
*/
Object TITLE = new Object();
/**
- * This property indicates which status severities should be handled. The
- * value must be of {@link Integer} type.
+ * This property indicates which status severities should be handled. The value
+ * must be of {@link Integer} type.
*/
Object MASK = new Object();
@@ -92,14 +91,13 @@ public interface IStatusDialogConstants {
/**
* This flag controls if the support area is opened automatically when the
- * dialog is opened. It must be of {@link Boolean} type or <code>null</code>
- * .
+ * dialog is opened. It must be of {@link Boolean} type or <code>null</code> .
*/
Object ENABLE_DEFAULT_SUPPORT_AREA = new Object();
/**
- * This flag controls if there should be a control allowing for support
- * opening. It must be of {@link Boolean} type or <code>null</code>.
+ * This flag controls if there should be a control allowing for support opening.
+ * It must be of {@link Boolean} type or <code>null</code>.
*/
Object HIDE_SUPPORT_BUTTON = new Object();
@@ -118,8 +116,7 @@ public interface IStatusDialogConstants {
Object CUSTOM_DETAILS_PROVIDER = new Object();
/**
- * Currently selected status adapter. It must be of {@link StatusAdapter}
- * type.
+ * Currently selected status adapter. It must be of {@link StatusAdapter} type.
*/
Object CURRENT_STATUS_ADAPTER = new Object();
@@ -131,8 +128,8 @@ public interface IStatusDialogConstants {
Object STATUS_ADAPTERS = new Object();
/**
- * Stores "modal" flags describing {@link StatusAdapter}. It is a
- * {@link Map} of {@link StatusAdapter}s and {@link Boolean}s.
+ * Stores "modal" flags describing {@link StatusAdapter}. It is a {@link Map} of
+ * {@link StatusAdapter}s and {@link Boolean}s.
*/
Object STATUS_MODALS = new Object();
@@ -144,37 +141,37 @@ public interface IStatusDialogConstants {
/**
* This property stores internal {@link LabelProviderWrapper} which is
- * responsible for providing all the text and images. This property should
- * be never changed.
+ * responsible for providing all the text and images. This property should be
+ * never changed.
*/
Object LABEL_PROVIDER = new Object();
/**
* This property stores custom label provider. LABEL_PROVIDER uses
- * CUSTOM_LABEL_PROVIDER or default label provider to deliver images and
- * text to the dialog. Since the custom label provider is not able to
- * deliver all necessary images, this field should not be used. It is kept
- * only for backward compatibility.
+ * CUSTOM_LABEL_PROVIDER or default label provider to deliver images and text to
+ * the dialog. Since the custom label provider is not able to deliver all
+ * necessary images, this field should not be used. It is kept only for backward
+ * compatibility.
*/
Object CUSTOM_LABEL_PROVIDER = new Object();
/**
* If it is necessary to modify each message, this property may be used. It
- * should be of {@link ILabelDecorator} type. This decorator will be invoked
- * for each text that will be later passed to the dialog.
+ * should be of {@link ILabelDecorator} type. This decorator will be invoked for
+ * each text that will be later passed to the dialog.
*/
Object DECORATOR = new Object();
/**
- * This flag indicates if the dialog is during modality switch state. It
- * must be of {@link Boolean} type.
+ * This flag indicates if the dialog is during modality switch state. It must be
+ * of {@link Boolean} type.
*/
Object MODALITY_SWITCH = new Object();
/**
- * This flag controls animations. It is for testing purposes only. If it set
- * to false, animations will not be created. Animation means shell
- * closing/opening animation.
+ * This flag controls animations. It is for testing purposes only. If it set to
+ * false, animations will not be created. Animation means shell closing/opening
+ * animation.
*/
Object ANIMATION = new Object();
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/InternalDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/InternalDialog.java
index ff90d8f4654..c2b820b861a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/InternalDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/InternalDialog.java
@@ -62,11 +62,10 @@ import org.eclipse.ui.statushandlers.StatusAdapter;
import org.eclipse.ui.statushandlers.StatusManager;
import org.eclipse.ui.views.IViewDescriptor;
-
/**
- * Parent window actually does not use its Shell to build dialog on. The
- * window passes the shell to the InternalDialog, and it can do switching
- * modality and recreate the window silently.
+ * Parent window actually does not use its Shell to build dialog on. The window
+ * passes the shell to the InternalDialog, and it can do switching modality and
+ * recreate the window silently.
*
* @since 3.4
*/
@@ -80,8 +79,8 @@ public class InternalDialog extends TrayDialog {
static final String LOG_VIEW_ID = "org.eclipse.pde.runtime.LogView"; //$NON-NLS-1$
/**
- * Preference used to indicate whether the user should be prompted to
- * confirm the execution of the job's goto action
+ * Preference used to indicate whether the user should be prompted to confirm
+ * the execution of the job's goto action
*/
static final String PREF_SKIP_GOTO_ACTION_PROMPT = "pref_skip_goto_action_prompt"; //$NON-NLS-1$
@@ -90,30 +89,29 @@ public class InternalDialog extends TrayDialog {
*/
private Composite dialogArea;
/**
- * This composite is initially scrolled to the 0 x 0 size. When more
- * than one status arrives, listArea is resized and a list is created on
- * it to present statuses to the user.
+ * This composite is initially scrolled to the 0 x 0 size. When more than one
+ * status arrives, listArea is resized and a list is created on it to present
+ * statuses to the user.
*/
private Composite listArea;
/**
- * On this composite are presented additional elements for displaying
- * single status. Currently it is the second label that displays the
- * second most important message to the user.
+ * On this composite are presented additional elements for displaying single
+ * status. Currently it is the second label that displays the second most
+ * important message to the user.
*/
private Composite singleStatusDisplayArea;
/**
- * This label is used to display the second most important message to
- * the user. It is placed on singleStatusDisplayArea.
+ * This label is used to display the second most important message to the user.
+ * It is placed on singleStatusDisplayArea.
*/
private Label singleStatusLabel;
/**
- * A list from which the user selects statuses. The list is placed on
- * listArea.
+ * A list from which the user selects statuses. The list is placed on listArea.
*/
private TableViewer statusListViewer;
/**
- * Composite on the left bottom corner. Allows for opening support tray
- * & Error Log.
+ * Composite on the left bottom corner. Allows for opening support tray & Error
+ * Log.
*/
private Composite linkComposite;
/**
@@ -121,8 +119,7 @@ public class InternalDialog extends TrayDialog {
*/
private Link launchTrayLink;
/**
- * This fields contains indicator if link to ErrorLog view should be
- * present.
+ * This fields contains indicator if link to ErrorLog view should be present.
*/
private Link showErrorLogLink;
/**
@@ -155,8 +152,7 @@ public class InternalDialog extends TrayDialog {
super(ProgressManagerUtil.getDefaultParent());
this.dialogState = dialogState;
supportTray = new SupportTray(dialogState, event -> {
- dialogState.put(IStatusDialogConstants.TRAY_OPENED,
- Boolean.FALSE);
+ dialogState.put(IStatusDialogConstants.TRAY_OPENED, Boolean.FALSE);
// close the tray
closeTray();
// set focus back to shell
@@ -184,8 +180,7 @@ public class InternalDialog extends TrayDialog {
}
if (id == IDialogConstants.DETAILS_ID) {
// was the details button pressed?
- dialogState.put(IStatusDialogConstants.DETAILS_OPENED, Boolean.valueOf(
- toggleDetailsArea()));
+ dialogState.put(IStatusDialogConstants.DETAILS_OPENED, Boolean.valueOf(toggleDetailsArea()));
} else {
super.buttonPressed(id);
}
@@ -226,13 +221,11 @@ public class InternalDialog extends TrayDialog {
/**
* Creates title area.
*
- * @param parent
- * A composite on which the title area should be created.
+ * @param parent A composite on which the title area should be created.
*/
private void createTitleArea(Composite parent) {
titleArea = new Composite(parent, SWT.NONE);
- titleArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true,
- false));
+ titleArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
GridLayout layout = new GridLayout();
layout.numColumns = 2;
@@ -243,8 +236,7 @@ public class InternalDialog extends TrayDialog {
titleArea.setLayout(layout);
titleImageLabel = new Label(titleArea, SWT.NONE);
- titleImageLabel.setImage(getLabelProviderWrapper()
- .getImage(getCurrentStatusAdapter()));
+ titleImageLabel.setImage(getLabelProviderWrapper().getImage(getCurrentStatusAdapter()));
GridData layoutData = new GridData();
layoutData.verticalSpan = 2;
layoutData.verticalAlignment = SWT.TOP;
@@ -255,20 +247,17 @@ public class InternalDialog extends TrayDialog {
mainMessageLabel = new Label(titleArea, SWT.WRAP);
mainMessageLabel.setLayoutData(messageData);
// main message set up early, to address bug 222391
- mainMessageLabel.setText(getLabelProviderWrapper()
- .getMainMessage(getCurrentStatusAdapter()));
+ mainMessageLabel.setText(getLabelProviderWrapper().getMainMessage(getCurrentStatusAdapter()));
if (!isMulti()) {
singleStatusDisplayArea = createSingleStatusDisplayArea(titleArea);
}
}
/**
- * Create an area which allows the user to view the status if only one
- * is created or to select one of reported statuses when there are many.
+ * Create an area which allows the user to view the status if only one is
+ * created or to select one of reported statuses when there are many.
*
- * @param parent
- * the parent composite on which all components should be
- * placed.
+ * @param parent the parent composite on which all components should be placed.
*/
private void createListArea(Composite parent) {
listArea = new Composite(parent, SWT.NONE);
@@ -301,8 +290,7 @@ public class InternalDialog extends TrayDialog {
}
/**
- * @param supportTray
- * The supportTray to set.
+ * @param supportTray The supportTray to set.
*/
public void setSupportTray(SupportTray supportTray) {
this.supportTray = supportTray;
@@ -333,19 +321,17 @@ public class InternalDialog extends TrayDialog {
if (getTray() != null) {
super.closeTray();
}
- //preserve state during modality switch
+ // preserve state during modality switch
if (!getBooleanValue(IStatusDialogConstants.MODALITY_SWITCH)) {
dialogState.put(IStatusDialogConstants.TRAY_OPENED, Boolean.FALSE);
}
if (launchTrayLink != null && !launchTrayLink.isDisposed()) {
- launchTrayLink.setEnabled(providesSupport()
- && !getBooleanValue(IStatusDialogConstants.TRAY_OPENED));
+ launchTrayLink.setEnabled(providesSupport() && !getBooleanValue(IStatusDialogConstants.TRAY_OPENED));
}
}
/**
- * Method which should be invoked when new errors become available for
- * display.
+ * Method which should be invoked when new errors become available for display.
*/
void refresh() {
if (dialogArea == null || dialogArea.isDisposed()) {
@@ -356,8 +342,7 @@ public class InternalDialog extends TrayDialog {
updateEnablements();
// adjust width if necessary
Point currentSize = getShell().getSize();
- Point desiredSize = getShell()
- .computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ Point desiredSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
if (currentSize.x < desiredSize.x) {
getShell().setSize(desiredSize.x, currentSize.y);
} else {
@@ -374,34 +359,30 @@ public class InternalDialog extends TrayDialog {
}
/**
- * Show the details portion of the dialog if it is not already visible.
- * This method will only work when it is invoked after the control of
- * the dialog has been set. In other words, after the
- * <code>createContents</code> method has been invoked and has returned
- * the control for the content area of the dialog. Invoking the method
- * before the content area has been set or after the dialog has been
- * disposed will have no effect.
+ * Show the details portion of the dialog if it is not already visible. This
+ * method will only work when it is invoked after the control of the dialog has
+ * been set. In other words, after the <code>createContents</code> method has
+ * been invoked and has returned the control for the content area of the dialog.
+ * Invoking the method before the content area has been set or after the dialog
+ * has been disposed will have no effect.
*/
private void showDetailsArea() {
if (dialogArea != null && !dialogArea.isDisposed()) {
if (detailsManager.isOpen()) {
detailsManager.close();
- detailsManager.createDetailsArea(dialogArea,
- getCurrentStatusAdapter());
- dialogState.put(IStatusDialogConstants.DETAILS_OPENED,
- Boolean.TRUE);
+ detailsManager.createDetailsArea(dialogArea, getCurrentStatusAdapter());
+ dialogState.put(IStatusDialogConstants.DETAILS_OPENED, Boolean.TRUE);
} else {
toggleDetailsArea();
- dialogState.put(IStatusDialogConstants.DETAILS_OPENED,
- Boolean.TRUE);
+ dialogState.put(IStatusDialogConstants.DETAILS_OPENED, Boolean.TRUE);
}
dialogArea.layout();
}
}
/**
- * Toggles the unfolding of the details area. This is triggered by the
- * user pressing the details button.
+ * Toggles the unfolding of the details area. This is triggered by the user
+ * pressing the details button.
*
*/
private boolean toggleDetailsArea() {
@@ -409,14 +390,11 @@ public class InternalDialog extends TrayDialog {
Point windowSize = getShell().getSize();
if (detailsManager.isOpen()) {
detailsManager.close();
- getButton(IDialogConstants.DETAILS_ID).setText(
- IDialogConstants.SHOW_DETAILS_LABEL);
+ getButton(IDialogConstants.DETAILS_ID).setText(IDialogConstants.SHOW_DETAILS_LABEL);
opened = false;
} else {
- detailsManager.createDetailsArea(dialogArea,
- getCurrentStatusAdapter());
- getButton(IDialogConstants.DETAILS_ID).setText(
- IDialogConstants.HIDE_DETAILS_LABEL);
+ detailsManager.createDetailsArea(dialogArea, getCurrentStatusAdapter());
+ getButton(IDialogConstants.DETAILS_ID).setText(IDialogConstants.HIDE_DETAILS_LABEL);
opened = true;
}
@@ -442,8 +420,7 @@ public class InternalDialog extends TrayDialog {
// decrease the dialog height if details were closed and empty space
// appeared
if ((opened && diffY > 0) || (!opened && diffY < 0)) {
- getShell().setSize(
- new Point(windowSize.x, windowSize.y + (diffY)));
+ getShell().setSize(new Point(windowSize.x, windowSize.y + (diffY)));
}
dialogArea.layout();
return opened;
@@ -474,20 +451,17 @@ public class InternalDialog extends TrayDialog {
private void handleSelectionChange() {
StatusAdapter newSelection = getSingleSelection();
if (newSelection != null) {
- dialogState.put(IStatusDialogConstants.CURRENT_STATUS_ADAPTER,
- newSelection);
+ dialogState.put(IStatusDialogConstants.CURRENT_STATUS_ADAPTER, newSelection);
showDetailsArea();
refresh();
}
}
/**
- * This method creates display area for {@link StatusAdapter}s when more
- * is available.
+ * This method creates display area for {@link StatusAdapter}s when more is
+ * available.
*
- * @param parent
- * A parent composite on which all components should be
- * placed.
+ * @param parent A parent composite on which all components should be placed.
*/
private void fillListArea(Composite parent) {
// it is necessary to make list parent composite taller
@@ -499,8 +473,7 @@ public class InternalDialog extends TrayDialog {
listAreaGD.heightHint = SWT.DEFAULT;
// create list viewer
- statusListViewer = new TableViewer(parent, SWT.SINGLE
- | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ statusListViewer = new TableViewer(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
statusListViewer.setComparator(getLabelProviderWrapper());
Control control = statusListViewer.getControl();
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
@@ -510,8 +483,7 @@ public class InternalDialog extends TrayDialog {
initLabelProvider();
statusListViewer.addPostSelectionChangedListener(event -> {
handleSelectionChange();
- if ((getTray() == null) && getBooleanValue(IStatusDialogConstants.TRAY_OPENED)
- && providesSupport()) {
+ if ((getTray() == null) && getBooleanValue(IStatusDialogConstants.TRAY_OPENED) && providesSupport()) {
silentTrayOpen();
return;
}
@@ -536,9 +508,10 @@ public class InternalDialog extends TrayDialog {
if (getTray() == null)
super.openTray(supportTray);
}
+
/**
- * This methods switches StatusAdapters presentation depending if there
- * is one status or more.
+ * This methods switches StatusAdapters presentation depending if there is one
+ * status or more.
*/
private void updateListArea() {
// take care about list area if there is more than one status
@@ -546,29 +519,25 @@ public class InternalDialog extends TrayDialog {
if (singleStatusDisplayArea != null) {
singleStatusDisplayArea.dispose();
}
- if (statusListViewer == null
- || statusListViewer.getControl().isDisposed()) {
+ if (statusListViewer == null || statusListViewer.getControl().isDisposed()) {
fillListArea(listArea);
listArea.layout();
listArea.getParent().layout();
- getShell().setSize(
- getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT));
+ getShell().setSize(getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT));
}
refreshStatusListArea();
}
}
/**
- * Updated title area. Adjust title, title message and title image
- * according to selected {@link StatusAdapter}.
+ * Updated title area. Adjust title, title message and title image according to
+ * selected {@link StatusAdapter}.
*/
private void updateTitleArea() {
- Image image = getLabelProviderWrapper().getImage(
- getCurrentStatusAdapter());
+ Image image = getLabelProviderWrapper().getImage(getCurrentStatusAdapter());
titleImageLabel.setImage(image);
if (getCurrentStatusAdapter() != null) {
- mainMessageLabel.setText(getLabelProviderWrapper()
- .getMainMessage(getCurrentStatusAdapter()));
+ mainMessageLabel.setText(getLabelProviderWrapper().getMainMessage(getCurrentStatusAdapter()));
}
if (singleStatusDisplayArea != null) {
if (isMulti()) {
@@ -581,8 +550,7 @@ public class InternalDialog extends TrayDialog {
}
/**
- * This method creates button bar that is available on the bottom of the
- * dialog.
+ * This method creates button bar that is available on the bottom of the dialog.
*/
@Override
protected Control createButtonBar(Composite parent) {
@@ -591,8 +559,7 @@ public class InternalDialog extends TrayDialog {
layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
composite.setLayout(layout);
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true,
- false));
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
linkComposite = createLinkComposite(composite);
@@ -613,30 +580,25 @@ public class InternalDialog extends TrayDialog {
if (gotoAction != null) {
text = gotoAction.getText();
}
- Button button = createButton(parent, GOTO_ACTION_ID,
- text == null ? "" : text, //$NON-NLS-1$
+ Button button = createButton(parent, GOTO_ACTION_ID, text == null ? "" : text, //$NON-NLS-1$
false);
if (text == null)
hideButton(button, true);
- createButton(parent, IDialogConstants.OK_ID,
- IDialogConstants.OK_LABEL, true);
+ createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
- createButton(parent, IDialogConstants.DETAILS_ID,
- IDialogConstants.SHOW_DETAILS_LABEL, false);
+ createButton(parent, IDialogConstants.DETAILS_ID, IDialogConstants.SHOW_DETAILS_LABEL, false);
}
/**
- * This method creates additional display area for {@link StatusAdapter}
- * when only one is available.
+ * This method creates additional display area for {@link StatusAdapter} when
+ * only one is available.
*
* It creates one label on a composite currently for secondary message.
*
- * @param parent
- * A parent composite on which all components should be
- * placed.
- * @return composite the composite on which are all components for
- * displaying status when only one is available.
+ * @param parent A parent composite on which all components should be placed.
+ * @return composite the composite on which are all components for displaying
+ * status when only one is available.
*/
private Composite createSingleStatusDisplayArea(Composite parent) {
// secondary message is displayed on separate composite with no
@@ -650,13 +612,11 @@ public class InternalDialog extends TrayDialog {
// label that wraps
singleStatusLabel = new Label(singleStatusParent, SWT.WRAP);
- GridData labelLayoutData = new GridData(SWT.FILL, SWT.FILL, true,
- true);
+ GridData labelLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
labelLayoutData.widthHint = convertWidthInCharsToPixels(50);
singleStatusLabel.setLayoutData(labelLayoutData);
// main message set up early, to address bug 222391
- singleStatusLabel.setText(getLabelProviderWrapper()
- .getColumnText(getCurrentStatusAdapter(), 0));
+ singleStatusLabel.setText(getLabelProviderWrapper().getColumnText(getCurrentStatusAdapter(), 0));
singleStatusLabel.addMouseListener(new MouseListener() {
@Override
@@ -723,14 +683,12 @@ public class InternalDialog extends TrayDialog {
Button gotoButton = getButton(GOTO_ACTION_ID);
if (gotoButton != null) {
IAction gotoAction = getGotoAction();
- boolean hasValidGotoAction = (gotoAction != null)
- && (gotoAction.getText() != null);
+ boolean hasValidGotoAction = (gotoAction != null) && (gotoAction.getText() != null);
if (hasValidGotoAction) {
hideButton(gotoButton, false);
gotoButton.setText(gotoAction.getText());
- ((GridData) gotoButton.getLayoutData()).widthHint = gotoButton
- .computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
+ ((GridData) gotoButton.getLayoutData()).widthHint = gotoButton.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
gotoButton.getParent().layout();
} else
hideButton(gotoButton, true);
@@ -740,8 +698,7 @@ public class InternalDialog extends TrayDialog {
if (launchTrayLink == null || launchTrayLink.isDisposed()) {
launchTrayLink = createGetSupportLink();
}
- launchTrayLink
- .setEnabled(!getBooleanValue(IStatusDialogConstants.TRAY_OPENED));
+ launchTrayLink.setEnabled(!getBooleanValue(IStatusDialogConstants.TRAY_OPENED));
} else {
if (launchTrayLink != null && !launchTrayLink.isDisposed()) {
launchTrayLink.dispose();
@@ -768,13 +725,11 @@ public class InternalDialog extends TrayDialog {
}
/* check handling hint and display link if it is expected */
boolean shouldDisplay = false;
- Iterator it = ((Collection) dialogState
- .get(IStatusDialogConstants.STATUS_ADAPTERS)).iterator();
+ Iterator it = ((Collection) dialogState.get(IStatusDialogConstants.STATUS_ADAPTERS)).iterator();
while (it.hasNext()) {
StatusAdapter adapter = (StatusAdapter) it.next();
Integer hint = (Integer) adapter.getProperty(WorkbenchStatusDialogManagerImpl.HINT);
- if (hint != null
- && ((hint.intValue() & StatusManager.LOG) != 0)) {
+ if (hint != null && ((hint.intValue() & StatusManager.LOG) != 0)) {
shouldDisplay |= true;
break;
}
@@ -790,8 +745,7 @@ public class InternalDialog extends TrayDialog {
* Opens the dialog tray (support area at the right side of the dialog)
*/
@Override
- public void openTray(DialogTray tray) throws IllegalStateException,
- UnsupportedOperationException {
+ public void openTray(DialogTray tray) throws IllegalStateException, UnsupportedOperationException {
if (launchTrayLink != null && !launchTrayLink.isDisposed()) {
launchTrayLink.setEnabled(false);
}
@@ -802,12 +756,11 @@ public class InternalDialog extends TrayDialog {
}
/**
- * Refreshes the single status area. Is called only when there is one
- * and only one error.
+ * Refreshes the single status area. Is called only when there is one and only
+ * one error.
*/
private void refreshSingleStatusArea() {
- String description = getLabelProviderWrapper()
- .getColumnText(getCurrentStatusAdapter(), 0);
+ String description = getLabelProviderWrapper().getColumnText(getCurrentStatusAdapter(), 0);
if (description.equals(singleStatusLabel.getText()))
singleStatusLabel.setText(" "); //$NON-NLS-1$
singleStatusLabel.setText(description);
@@ -819,16 +772,12 @@ public class InternalDialog extends TrayDialog {
* Refresh the contents of the viewer.
*/
private void refreshStatusListArea() {
- if (statusListViewer != null
- && !statusListViewer.getControl().isDisposed()) {
+ if (statusListViewer != null && !statusListViewer.getControl().isDisposed()) {
statusListViewer.refresh();
if (statusListViewer.getTable().getItemCount() > 1) {
- getShell()
- .setText(
- WorkbenchMessages.WorkbenchStatusDialog_MultipleProblemsHaveOccured);
+ getShell().setText(WorkbenchMessages.WorkbenchStatusDialog_MultipleProblemsHaveOccured);
} else {
- getShell().setText(
- getString(IStatusDialogConstants.TITLE));
+ getShell().setText(getString(IStatusDialogConstants.TITLE));
}
}
}
@@ -845,13 +794,11 @@ public class InternalDialog extends TrayDialog {
@Override
public Object[] getElements(Object inputElement) {
- return ((Collection) dialogState
- .get(IStatusDialogConstants.STATUS_ADAPTERS)).toArray();
+ return ((Collection) dialogState.get(IStatusDialogConstants.STATUS_ADAPTERS)).toArray();
}
@Override
- public void inputChanged(Viewer viewer, Object oldInput,
- Object newInput) {
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
if (newInput != null) {
refreshStatusListArea();
}
@@ -859,23 +806,19 @@ public class InternalDialog extends TrayDialog {
};
statusListViewer.setContentProvider(provider);
statusListViewer.setInput(this);
- statusListViewer.setSelection(new StructuredSelection(
- getCurrentStatusAdapter()));
+ statusListViewer.setSelection(new StructuredSelection(getCurrentStatusAdapter()));
}
/**
* Creates a new control that provides access to support providers.
* <p>
- * The <code>WorkbenchStatusDialog</code> implementation of this method
- * creates the control, registers it for selection events including
- * selection, Note that the parent's layout is assumed to be a
- * <code>GridLayout</code> and the number of columns in this layout is
- * incremented. Subclasses may override.
+ * The <code>WorkbenchStatusDialog</code> implementation of this method creates
+ * the control, registers it for selection events including selection, Note that
+ * the parent's layout is assumed to be a <code>GridLayout</code> and the number
+ * of columns in this layout is incremented. Subclasses may override.
* </p>
*
- * @param parent
- * A parent composite on which all components should be
- * placed.
+ * @param parent A parent composite on which all components should be placed.
* @return the report control
*/
private Composite createLinkComposite(Composite parent) {
@@ -902,15 +845,14 @@ public class InternalDialog extends TrayDialog {
((GridLayout) parent.getLayout()).numColumns++;
- GridData layoutData = new GridData(SWT.BEGINNING, SWT.CENTER, true,
- false);
+ GridData layoutData = new GridData(SWT.BEGINNING, SWT.CENTER, true, false);
linkArea.setLayoutData(layoutData);
return linkArea;
}
/**
- * Creates a button with a report image. This is only used if there is
- * an image available.
+ * Creates a button with a report image. This is only used if there is an image
+ * available.
*/
private Link createGetSupportLink() {
// no support
@@ -919,10 +861,8 @@ public class InternalDialog extends TrayDialog {
}
Link link = new Link(linkComposite, SWT.NONE);
- link
- .setText(WorkbenchMessages.WorkbenchStatusDialog_SupportHyperlink);
- link
- .setToolTipText(WorkbenchMessages.WorkbenchStatusDialog_SupportTooltip);
+ link.setText(WorkbenchMessages.WorkbenchStatusDialog_SupportHyperlink);
+ link.setToolTipText(WorkbenchMessages.WorkbenchStatusDialog_SupportTooltip);
link.addSelectionListener(widgetSelectedAdapter(e -> openTray()));
Dialog.applyDialogFont(link);
return link;
@@ -938,8 +878,7 @@ public class InternalDialog extends TrayDialog {
}
}));
link.setText(WorkbenchMessages.ErrorLogUtil_ShowErrorLogHyperlink);
- link
- .setToolTipText(WorkbenchMessages.ErrorLogUtil_ShowErrorLogTooltip);
+ link.setToolTipText(WorkbenchMessages.ErrorLogUtil_ShowErrorLogTooltip);
Dialog.applyDialogFont(link);
return link;
}
@@ -954,8 +893,8 @@ public class InternalDialog extends TrayDialog {
/**
* Returns {@link IAction} associated with selected StatusAdapter.
*
- * @return {@link IAction} that is set as {@link StatusAdapter} property
- * with Job.class key.
+ * @return {@link IAction} that is set as {@link StatusAdapter} property with
+ * Job.class key.
*/
private IAction getGotoAction() {
Object property = null;
@@ -972,8 +911,8 @@ public class InternalDialog extends TrayDialog {
}
/**
- * Get the single selection. Return null if the selection is not just
- * one element.
+ * Get the single selection. Return null if the selection is not just one
+ * element.
*
* @return StatusAdapter or <code>null</code>.
*/
@@ -986,21 +925,17 @@ public class InternalDialog extends TrayDialog {
}
/*
- * Prompt to inform the user that the dialog will close and the errors
- * cleared.
+ * Prompt to inform the user that the dialog will close and the errors cleared.
*/
private boolean isPromptToClose() {
- IPreferenceStore store = WorkbenchPlugin.getDefault()
- .getPreferenceStore();
+ IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
if (!store.contains(PREF_SKIP_GOTO_ACTION_PROMPT)
- || !store.getString(PREF_SKIP_GOTO_ACTION_PROMPT).equals(
- MessageDialogWithToggle.ALWAYS)) {
- MessageDialogWithToggle dialog = MessageDialogWithToggle.open(
- MessageDialog.CONFIRM, getShell(),
+ || !store.getString(PREF_SKIP_GOTO_ACTION_PROMPT).equals(MessageDialogWithToggle.ALWAYS)) {
+ MessageDialogWithToggle dialog = MessageDialogWithToggle.open(MessageDialog.CONFIRM, getShell(),
ProgressMessages.JobErrorDialog_CloseDialogTitle,
ProgressMessages.JobErrorDialog_CloseDialogMessage,
- ProgressMessages.JobErrorDialog_DoNotShowAgainMessage,
- false, store, PREF_SKIP_GOTO_ACTION_PROMPT, SWT.SHEET);
+ ProgressMessages.JobErrorDialog_DoNotShowAgainMessage, false, store, PREF_SKIP_GOTO_ACTION_PROMPT,
+ SWT.SHEET);
return dialog.getReturnCode() == Window.OK;
}
return true;
@@ -1019,8 +954,7 @@ public class InternalDialog extends TrayDialog {
}
private StatusAdapter getCurrentStatusAdapter() {
- return (StatusAdapter) dialogState
- .get(IStatusDialogConstants.CURRENT_STATUS_ADAPTER);
+ return (StatusAdapter) dialogState.get(IStatusDialogConstants.CURRENT_STATUS_ADAPTER);
}
private boolean getBooleanValue(Object key) {
@@ -1036,12 +970,10 @@ public class InternalDialog extends TrayDialog {
}
private LabelProviderWrapper getLabelProviderWrapper() {
- return (LabelProviderWrapper) dialogState
- .get(IStatusDialogConstants.LABEL_PROVIDER);
+ return (LabelProviderWrapper) dialogState.get(IStatusDialogConstants.LABEL_PROVIDER);
}
private boolean isMulti() {
- return ((Collection) dialogState
- .get(IStatusDialogConstants.STATUS_ADAPTERS)).size() > 1;
+ return ((Collection) dialogState.get(IStatusDialogConstants.STATUS_ADAPTERS)).size() > 1;
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/LabelProviderWrapper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/LabelProviderWrapper.java
index 38395ec9447..ece92d3a3ea 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/LabelProviderWrapper.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/LabelProviderWrapper.java
@@ -41,21 +41,18 @@ import org.eclipse.ui.progress.IProgressConstants;
import org.eclipse.ui.statushandlers.IStatusAdapterConstants;
import org.eclipse.ui.statushandlers.StatusAdapter;
-
/**
* This is an utility class which is responsible for text and icon decorators in
* the StatusDialog.
*
* @since 3.6
*/
-public class LabelProviderWrapper extends ViewerComparator implements
- ITableLabelProvider {
+public class LabelProviderWrapper extends ViewerComparator implements ITableLabelProvider {
/**
* The default status label provider.
*/
private class DefaultLabelProvider implements ITableLabelProvider {
- ResourceManager manager = new LocalResourceManager(JFaceResources
- .getResources());
+ ResourceManager manager = new LocalResourceManager(JFaceResources.getResources());
@Override
public void addListener(ILabelProviderListener listener) {
@@ -103,15 +100,12 @@ public class LabelProviderWrapper extends ViewerComparator implements
text = getPrimaryMessage(statusAdapter);
}
}
- Long timestamp = (Long) statusAdapter
- .getProperty(IStatusAdapterConstants.TIMESTAMP_PROPERTY);
+ Long timestamp = (Long) statusAdapter.getProperty(IStatusAdapterConstants.TIMESTAMP_PROPERTY);
if (timestamp != null && isMulti()) {
- String date = DateFormat.getDateTimeInstance(DateFormat.LONG,
- DateFormat.LONG)
+ String date = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG)
.format(new Date(timestamp.longValue()));
- return NLS.bind(ProgressMessages.JobInfo_Error, (new Object[] {
- text, date }));
+ return NLS.bind(ProgressMessages.JobInfo_Error, (new Object[] { text, date }));
}
return text;
}
@@ -121,15 +115,13 @@ public class LabelProviderWrapper extends ViewerComparator implements
*/
private Image getIcon(Job job) {
if (job != null) {
- Object property = job
- .getProperty(IProgressConstants.ICON_PROPERTY);
+ Object property = job.getProperty(IProgressConstants.ICON_PROPERTY);
// Create an image from the job's icon property or family
if (property instanceof ImageDescriptor) {
return manager.createImage((ImageDescriptor) property);
} else if (property instanceof URL) {
- return manager.createImage(ImageDescriptor
- .createFromURL((URL) property));
+ return manager.createImage(ImageDescriptor.createFromURL((URL) property));
} else {
// Let the progress manager handle the resource management
return ProgressManager.getInstance().getIconFor(job);
@@ -152,8 +144,8 @@ public class LabelProviderWrapper extends ViewerComparator implements
private ITableLabelProvider labelProvider;
/**
- * This field stores the decorator which can override various texts produced
- * by this class.
+ * This field stores the decorator which can override various texts produced by
+ * this class.
*/
private ILabelDecorator messageDecorator;
@@ -189,8 +181,7 @@ public class LabelProviderWrapper extends ViewerComparator implements
*/
@Override
public void dispose() {
- boolean modalitySwitch = ((Boolean) dialogState.get(IStatusDialogConstants.MODALITY_SWITCH))
- .booleanValue();
+ boolean modalitySwitch = ((Boolean) dialogState.get(IStatusDialogConstants.MODALITY_SWITCH)).booleanValue();
if (!modalitySwitch) {
getLabelProvider().dispose();
}
@@ -207,13 +198,11 @@ public class LabelProviderWrapper extends ViewerComparator implements
}
/**
- * Gets {@link Image} associated with current {@link StatusAdapter}
- * severity.
+ * Gets {@link Image} associated with current {@link StatusAdapter} severity.
*
* @param statusAdapter
*
- * @return {@link Image} associated with current {@link StatusAdapter}
- * severity.
+ * @return {@link Image} associated with current {@link StatusAdapter} severity.
*/
public Image getImage(StatusAdapter statusAdapter) {
if (statusAdapter != null) {
@@ -237,8 +226,7 @@ public class LabelProviderWrapper extends ViewerComparator implements
/**
* Get an <code>Image</code> from the provide SWT image constant.
*
- * @param imageID
- * the SWT image constant
+ * @param imageID the SWT image constant
* @return image the image
*/
public Image getSWTImage(final int imageID) {
@@ -262,8 +250,8 @@ public class LabelProviderWrapper extends ViewerComparator implements
*
* If nothing can be found, some general information should be displayed.
*
- * @param statusAdapter
- * A status adapter which is used as the base for computation.
+ * @param statusAdapter A status adapter which is used as the base for
+ * computation.
* @return main message of the dialog.
*
* @see #getPrimaryMessage(StatusAdapter)
@@ -274,10 +262,7 @@ public class LabelProviderWrapper extends ViewerComparator implements
Job job = Adapters.adapt(statusAdapter, Job.class);
// job
if (job != null) {
- return NLS
- .bind(
- WorkbenchMessages.WorkbenchStatusDialog_ProblemOccurredInJob,
- job.getName());
+ return NLS.bind(WorkbenchMessages.WorkbenchStatusDialog_ProblemOccurredInJob, job.getName());
}
// we are not handling job
return getPrimaryMessage(statusAdapter);
@@ -299,8 +284,8 @@ public class LabelProviderWrapper extends ViewerComparator implements
}
/**
- * Retrieves primary message from passed statusAdapter. Primary message
- * should be (from the most important):
+ * Retrieves primary message from passed statusAdapter. Primary message should
+ * be (from the most important):
* <ul>
* <li>statusAdapter title</li>
* <li>IStatus message</li>
@@ -310,8 +295,7 @@ public class LabelProviderWrapper extends ViewerComparator implements
* <li>general message informing about error (no details at all)</li>
* </ul>
*
- * @param statusAdapter
- * an status adapter to retrieve primary message from
+ * @param statusAdapter an status adapter to retrieve primary message from
* @return String containing primary message
*
* @see #getMainMessage(StatusAdapter)
@@ -319,8 +303,7 @@ public class LabelProviderWrapper extends ViewerComparator implements
*/
public String getPrimaryMessage(StatusAdapter statusAdapter) {
// if there was nonempty title set, display the title
- Object property = statusAdapter
- .getProperty(IStatusAdapterConstants.TITLE_PROPERTY);
+ Object property = statusAdapter.getProperty(IStatusAdapterConstants.TITLE_PROPERTY);
if (property instanceof String) {
String header = (String) property;
if (header.trim().length() > 0) {
@@ -329,8 +312,7 @@ public class LabelProviderWrapper extends ViewerComparator implements
}
// if there was message set in the status
IStatus status = statusAdapter.getStatus();
- if (status.getMessage() != null
- && status.getMessage().trim().length() > 0) {
+ if (status.getMessage() != null && status.getMessage().trim().length() > 0) {
return decorate(status.getMessage(), statusAdapter);
}
@@ -351,9 +333,9 @@ public class LabelProviderWrapper extends ViewerComparator implements
}
/**
- * Retrieves secondary message from the passed statusAdapter. Secondary
- * message is one level lower than primary. Secondary message should be
- * (from the most important):
+ * Retrieves secondary message from the passed statusAdapter. Secondary message
+ * is one level lower than primary. Secondary message should be (from the most
+ * important):
* <ul>
* <li>IStatus message</li>
* <li>pointing to child statuses if IStatus has them.</li>
@@ -363,8 +345,7 @@ public class LabelProviderWrapper extends ViewerComparator implements
* Secondary message should not be the same as primary one. If no secondary
* message can be extracted, details should be pointed.
*
- * @param statusAdapter
- * an status adapter to retrieve secondary message from
+ * @param statusAdapter an status adapter to retrieve secondary message from
* @return String containing secondary message
*
* @see #getMainMessage(StatusAdapter)
@@ -377,16 +358,13 @@ public class LabelProviderWrapper extends ViewerComparator implements
// if there was message set in the status
IStatus status = statusAdapter.getStatus();
String message = status.getMessage();
- String decoratedMessage = message == null ? null : decorate(message,
- statusAdapter);
- if (message != null && message.trim().length() > 0
- && !primary.equals(decoratedMessage)) {
+ String decoratedMessage = message == null ? null : decorate(message, statusAdapter);
+ if (message != null && message.trim().length() > 0 && !primary.equals(decoratedMessage)) {
/* we have not displayed it yet */
return decoratedMessage;
}
// if status has children
- if (status.getChildren().length > 0
- && !primary.equals(decoratedMessage)) {
+ if (status.getChildren().length > 0 && !primary.equals(decoratedMessage)) {
return WorkbenchMessages.WorkbenchStatusDialog_StatusWithChildren;
}
@@ -394,10 +372,8 @@ public class LabelProviderWrapper extends ViewerComparator implements
Throwable t = status.getException();
if (t != null) {
if (t.getMessage() != null) {
- String decoratedThrowable = decorate(t.getMessage(),
- statusAdapter);
- if (t.getMessage().trim().length() > 0
- && !primary.equals(decoratedThrowable)) {
+ String decoratedThrowable = decorate(t.getMessage(), statusAdapter);
+ if (t.getMessage().trim().length() > 0 && !primary.equals(decoratedThrowable)) {
return decoratedThrowable;
}
}
@@ -410,8 +386,7 @@ public class LabelProviderWrapper extends ViewerComparator implements
}
private String decorate(String string, StatusAdapter adapter) {
- messageDecorator = (ILabelDecorator) dialogState
- .get(IStatusDialogConstants.DECORATOR);
+ messageDecorator = (ILabelDecorator) dialogState.get(IStatusDialogConstants.DECORATOR);
if (messageDecorator != null) {
string = messageDecorator.decorateText(string, adapter);
}
@@ -419,12 +394,9 @@ public class LabelProviderWrapper extends ViewerComparator implements
}
private int compare(StatusAdapter s1, StatusAdapter s2) {
- Long timestamp1 = ((Long) s1
- .getProperty(IStatusAdapterConstants.TIMESTAMP_PROPERTY));
- Long timestamp2 = ((Long) s2
- .getProperty(IStatusAdapterConstants.TIMESTAMP_PROPERTY));
- if (timestamp1 == null || timestamp2 == null
- || (timestamp1.equals(timestamp2))) {
+ Long timestamp1 = ((Long) s1.getProperty(IStatusAdapterConstants.TIMESTAMP_PROPERTY));
+ Long timestamp2 = ((Long) s2.getProperty(IStatusAdapterConstants.TIMESTAMP_PROPERTY));
+ if (timestamp1 == null || timestamp2 == null || (timestamp1.equals(timestamp2))) {
String text1 = getColumnText(s1, 0);
String text2 = getColumnText(s2, 0);
return text1.compareTo(text2);
@@ -456,16 +428,14 @@ public class LabelProviderWrapper extends ViewerComparator implements
}
private boolean isMulti() {
- return ((Collection) dialogState
- .get(IStatusDialogConstants.STATUS_ADAPTERS)).size() > 1;
+ return ((Collection) dialogState.get(IStatusDialogConstants.STATUS_ADAPTERS)).size() > 1;
}
/**
* @return Returns the labelProvider.
*/
public ITableLabelProvider getLabelProvider() {
- ITableLabelProvider temp = (ITableLabelProvider) dialogState
- .get(IStatusDialogConstants.CUSTOM_LABEL_PROVIDER);
+ ITableLabelProvider temp = (ITableLabelProvider) dialogState.get(IStatusDialogConstants.CUSTOM_LABEL_PROVIDER);
if (temp != null) {
labelProvider = temp;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StackTraceSupportArea.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StackTraceSupportArea.java
index 8d62632c6d1..2b68e6d80e5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StackTraceSupportArea.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StackTraceSupportArea.java
@@ -40,10 +40,10 @@ import org.eclipse.ui.statushandlers.WorkbenchStatusDialogManager;
/**
* This class is responsible for displaying stack trace retrieved from IStatus.
- * It has similar functionality as details area in {@link WorkbenchStatusDialogManager}.
- * This class will be visible only if it is enabled in
- * {@link WorkbenchStatusDialogManager} and no support provider is passed by
- * {@link Policy}
+ * It has similar functionality as details area in
+ * {@link WorkbenchStatusDialogManager}. This class will be visible only if it
+ * is enabled in {@link WorkbenchStatusDialogManager} and no support provider is
+ * passed by {@link Policy}
*
* @see Policy#setErrorSupportProvider
* @see Policy#getErrorSupportProvider()
@@ -59,8 +59,7 @@ public class StackTraceSupportArea extends AbstractStatusAreaProvider {
private List list;
@Override
- public Control createSupportArea(final Composite parent,
- StatusAdapter statusAdapter) {
+ public Control createSupportArea(final Composite parent, StatusAdapter statusAdapter) {
Label label = new Label(parent, SWT.NONE);
label.setText(WorkbenchMessages.StackTraceSupportArea_Title);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StatusHandlerDescriptor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StatusHandlerDescriptor.java
index 51aac0e1f73..40498f9397e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StatusHandlerDescriptor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StatusHandlerDescriptor.java
@@ -55,19 +55,15 @@ public class StatusHandlerDescriptor implements IPluginContribution {
* Gets an instance of the status handler defined in the descriptor.
*
* @return the status handler
- * @throws CoreException
- * thrown if there is a problem creating the handler
+ * @throws CoreException thrown if there is a problem creating the handler
*/
- public synchronized AbstractStatusHandler getStatusHandler()
- throws CoreException {
+ public synchronized AbstractStatusHandler getStatusHandler() throws CoreException {
if (cachedInstance == null) {
AbstractStatusHandler statusHandler = (AbstractStatusHandler) configElement
.createExecutableExtension(IWorkbenchRegistryConstants.ATT_CLASS);
- statusHandler.setId(configElement
- .getAttribute(IWorkbenchRegistryConstants.ATT_ID));
+ statusHandler.setId(configElement.getAttribute(IWorkbenchRegistryConstants.ATT_ID));
- IConfigurationElement parameters[] = configElement
- .getChildren(IWorkbenchRegistryConstants.TAG_PARAMETER);
+ IConfigurationElement parameters[] = configElement.getChildren(IWorkbenchRegistryConstants.TAG_PARAMETER);
Map params = new HashMap();
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StatusHandlerDescriptorsMap.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StatusHandlerDescriptorsMap.java
index 7f538bed516..a11ac55579e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StatusHandlerDescriptorsMap.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StatusHandlerDescriptorsMap.java
@@ -40,19 +40,16 @@ class StatusHandlerDescriptorsMap {
/**
* Adds a new handler descriptor to the prefix tree
*
- * @param handlerDescriptor
- * the handler descriptor to add
+ * @param handlerDescriptor the handler descriptor to add
*/
public void addHandlerDescriptor(StatusHandlerDescriptor handlerDescriptor) {
add(this.map, handlerDescriptor.getPrefix(), handlerDescriptor);
}
/*
- * Recursively searches the tree for the best place for the handler
- * descriptor
+ * Recursively searches the tree for the best place for the handler descriptor
*/
- private void add(Map map, String prefix,
- StatusHandlerDescriptor handlerDescriptor) {
+ private void add(Map map, String prefix, StatusHandlerDescriptor handlerDescriptor) {
if (prefix == null) {
if (map.get(ASTERISK) == null) {
map.put(ASTERISK, new ArrayList());
@@ -88,8 +85,8 @@ class StatusHandlerDescriptorsMap {
}
/**
- * Returns status handler descriptors whose prefixes are the most specific
- * for given pluginId.
+ * Returns status handler descriptors whose prefixes are the most specific for
+ * given pluginId.
*
* @param pluginId
* @return handler descriptors list
@@ -99,8 +96,8 @@ class StatusHandlerDescriptorsMap {
}
/*
- * Recursively searches the prefix tree for the most specific handler
- * descriptor for the given pluginId.
+ * Recursively searches the prefix tree for the most specific handler descriptor
+ * for the given pluginId.
*/
private List get(String pluginId, Map map) {
if (pluginId == null) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StatusHandlerProductBindingDescriptor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StatusHandlerProductBindingDescriptor.java
index dfad92ef9d8..35acabbdcff 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StatusHandlerProductBindingDescriptor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StatusHandlerProductBindingDescriptor.java
@@ -23,8 +23,7 @@ import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants;
*
* @since 3.3
*/
-class StatusHandlerProductBindingDescriptor implements
- IPluginContribution {
+class StatusHandlerProductBindingDescriptor implements IPluginContribution {
/**
* Handler id attribute. Value <code>handlerId</code>.
@@ -42,8 +41,7 @@ class StatusHandlerProductBindingDescriptor implements
/**
* @param configElement
*/
- public StatusHandlerProductBindingDescriptor(
- IConfigurationElement configElement) {
+ public StatusHandlerProductBindingDescriptor(IConfigurationElement configElement) {
super();
id = configElement.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
pluginId = configElement.getContributor().getName();
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StatusHandlerRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StatusHandlerRegistry.java
index 600646c0011..3f0c7a4074e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StatusHandlerRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StatusHandlerRegistry.java
@@ -57,11 +57,9 @@ public class StatusHandlerRegistry implements IExtensionChangeHandler {
* Creates an instance of the class.
*/
private StatusHandlerRegistry() {
- IExtensionTracker tracker = PlatformUI.getWorkbench()
- .getExtensionTracker();
- IExtensionPoint handlersPoint = Platform.getExtensionRegistry()
- .getExtensionPoint(WorkbenchPlugin.PI_WORKBENCH,
- STATUSHANDLERS_POINT_NAME);
+ IExtensionTracker tracker = PlatformUI.getWorkbench().getExtensionTracker();
+ IExtensionPoint handlersPoint = Platform.getExtensionRegistry().getExtensionPoint(WorkbenchPlugin.PI_WORKBENCH,
+ STATUSHANDLERS_POINT_NAME);
IExtension[] extensions = handlersPoint.getExtensions();
statusHandlerDescriptorsMap = new StatusHandlerDescriptorsMap();
@@ -71,16 +69,14 @@ public class StatusHandlerRegistry implements IExtensionChangeHandler {
addExtension(tracker, extension);
}
- tracker.registerHandler(this, ExtensionTracker
- .createExtensionPointFilter(handlersPoint));
+ tracker.registerHandler(this, ExtensionTracker.createExtensionPointFilter(handlersPoint));
// registers on products ext. point to, needed
// for changing the default handler if product is changed
- IExtensionPoint productsPoint = Platform.getExtensionRegistry()
- .getExtensionPoint(Platform.PI_RUNTIME, Platform.PT_PRODUCT);
+ IExtensionPoint productsPoint = Platform.getExtensionRegistry().getExtensionPoint(Platform.PI_RUNTIME,
+ Platform.PT_PRODUCT);
- tracker.registerHandler(this, ExtensionTracker
- .createExtensionPointFilter(productsPoint));
+ tracker.registerHandler(this, ExtensionTracker.createExtensionPointFilter(productsPoint));
}
/**
@@ -103,8 +99,7 @@ public class StatusHandlerRegistry implements IExtensionChangeHandler {
StatusHandlerDescriptor descriptor = new StatusHandlerDescriptor(configElement);
tracker.registerObject(extension, descriptor, IExtensionTracker.REF_STRONG);
statusHandlerDescriptors.add(descriptor);
- } else if (configElement.getName().equals(
- TAG_STATUSHANDLER_PRODUCTBINDING)) {
+ } else if (configElement.getName().equals(TAG_STATUSHANDLER_PRODUCTBINDING)) {
StatusHandlerProductBindingDescriptor descriptor = new StatusHandlerProductBindingDescriptor(
configElement);
tracker.registerObject(extension, descriptor, IExtensionTracker.REF_STRONG);
@@ -127,8 +122,8 @@ public class StatusHandlerRegistry implements IExtensionChangeHandler {
}
/**
- * Returns the default product handler descriptor, or null if the product is
- * not defined or there is no product binding
+ * Returns the default product handler descriptor, or null if the product is not
+ * defined or there is no product binding
*
* @return the default handler
*/
@@ -137,8 +132,8 @@ public class StatusHandlerRegistry implements IExtensionChangeHandler {
}
/**
- * Returns a list of handler descriptors which should be used for statuses
- * with given plugin id.
+ * Returns a list of handler descriptors which should be used for statuses with
+ * given plugin id.
*
* @param pluginId
* @return list of handler descriptors
@@ -150,8 +145,7 @@ public class StatusHandlerRegistry implements IExtensionChangeHandler {
/**
* Returns status handler descriptor for given id.
*
- * @param statusHandlerId
- * the id to get for
+ * @param statusHandlerId the id to get for
* @return the status handler descriptor
*/
public StatusHandlerDescriptor getHandlerDescriptor(String statusHandlerId) {
@@ -163,8 +157,7 @@ public class StatusHandlerRegistry implements IExtensionChangeHandler {
}
}
- if (defaultHandlerDescriptor != null
- && defaultHandlerDescriptor.getId().equals(statusHandlerId)) {
+ if (defaultHandlerDescriptor != null && defaultHandlerDescriptor.getId().equals(statusHandlerId)) {
return defaultHandlerDescriptor;
}
@@ -179,17 +172,17 @@ public class StatusHandlerRegistry implements IExtensionChangeHandler {
}
/**
- * It is possible since Eclipse 3.5 to configure custom status handling
- * using the -statushandler parameter.
+ * It is possible since Eclipse 3.5 to configure custom status handling using
+ * the -statushandler parameter.
*
* @return the id of the statushandler
* @since 3.5
*/
- private String resolveUserStatusHandlerId(){
+ private String resolveUserStatusHandlerId() {
String[] parameters = Platform.getCommandLineArgs();
- for(int i = 0; i < parameters.length - 1; i++){
- if(STATUSHANDLER_ARG.equals(parameters[i])){
+ for (int i = 0; i < parameters.length - 1; i++) {
+ if (STATUSHANDLER_ARG.equals(parameters[i])) {
return parameters[i + 1];
}
}
@@ -197,15 +190,14 @@ public class StatusHandlerRegistry implements IExtensionChangeHandler {
}
/**
- * Sets the default product handler descriptor if product exists and binding
- * is defined and creates handler descriptors tree due to the prefix policy.
+ * Sets the default product handler descriptor if product exists and binding is
+ * defined and creates handler descriptors tree due to the prefix policy.
*/
private void buildHandlersStructure() {
statusHandlerDescriptorsMap.clear();
defaultHandlerDescriptor = null;
- String productId = Platform.getProduct() != null ? Platform
- .getProduct().getId() : null;
+ String productId = Platform.getProduct() != null ? Platform.getProduct().getId() : null;
List allHandlers = new ArrayList();
@@ -214,10 +206,8 @@ public class StatusHandlerRegistry implements IExtensionChangeHandler {
if (defaultHandlerId == null) {
// we look for product related statushandler if it was not passed as
// an argument to Eclipse
- for (Iterator it = productBindingDescriptors.iterator(); it
- .hasNext();) {
- StatusHandlerProductBindingDescriptor descriptor = ((StatusHandlerProductBindingDescriptor) it
- .next());
+ for (Iterator it = productBindingDescriptors.iterator(); it.hasNext();) {
+ StatusHandlerProductBindingDescriptor descriptor = ((StatusHandlerProductBindingDescriptor) it.next());
if (descriptor.getProductId().equals(productId)) {
defaultHandlerId = descriptor.getHandlerId();
@@ -226,8 +216,7 @@ public class StatusHandlerRegistry implements IExtensionChangeHandler {
}
for (Iterator it = statusHandlerDescriptors.iterator(); it.hasNext();) {
- StatusHandlerDescriptor descriptor = ((StatusHandlerDescriptor) it
- .next());
+ StatusHandlerDescriptor descriptor = ((StatusHandlerDescriptor) it.next());
allHandlers.add(descriptor);
}
@@ -240,8 +229,7 @@ public class StatusHandlerRegistry implements IExtensionChangeHandler {
if (handlerDescriptor.getId().equals(defaultHandlerId)) {
defaultHandlerDescriptor = handlerDescriptor;
} else {
- statusHandlerDescriptorsMap
- .addHandlerDescriptor(handlerDescriptor);
+ statusHandlerDescriptorsMap.addHandlerDescriptor(handlerDescriptor);
}
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/SupportTray.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/SupportTray.java
index 341df917c98..24e0decee30 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/SupportTray.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/SupportTray.java
@@ -46,17 +46,14 @@ import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.ui.statushandlers.AbstractStatusAreaProvider;
import org.eclipse.ui.statushandlers.StatusAdapter;
-
/**
- * This class is responsible for displaying the support area on the right
- * side of the status dialog.
+ * This class is responsible for displaying the support area on the right side
+ * of the status dialog.
*/
-public class SupportTray extends DialogTray implements
- ISelectionChangedListener {
+public class SupportTray extends DialogTray implements ISelectionChangedListener {
private Map dialogState;
-
/**
* @param dialogState
* @param listener
@@ -90,8 +87,7 @@ public class SupportTray extends DialogTray implements
// nothing to display. Should never happen, cause button is disabled
// when nothing to display.
- if (providesSupport(getCurrentStatusAdapter()) == null
- && getBooleanValue(IStatusDialogConstants.TRAY_OPENED)) {
+ if (providesSupport(getCurrentStatusAdapter()) == null && getBooleanValue(IStatusDialogConstants.TRAY_OPENED)) {
}
@@ -110,8 +106,7 @@ public class SupportTray extends DialogTray implements
GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
gd.grabExcessHorizontalSpace = true;
toolBarManager.getControl().setLayoutData(gd);
- Label separator = new Label(container, SWT.SEPARATOR
- | SWT.HORIZONTAL);
+ Label separator = new Label(container, SWT.SEPARATOR | SWT.HORIZONTAL);
gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gd.heightHint = 1;
separator.setLayoutData(gd);
@@ -127,8 +122,7 @@ public class SupportTray extends DialogTray implements
layout.marginWidth = layout.marginHeight = 0;
layout.verticalSpacing = 0;
supportArea.setLayout(layout);
- GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL
- | GridData.VERTICAL_ALIGN_FILL);
+ GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
gd.horizontalSpan = 1;
gd.grabExcessHorizontalSpace = true;
gd.grabExcessVerticalSpace = true;
@@ -138,12 +132,10 @@ public class SupportTray extends DialogTray implements
createSupportArea(supportArea, lastSelectedStatus);
Point shellSize = supportArea.getShell().getSize();
- Point desiredSize = supportArea.getShell().computeSize(SWT.DEFAULT,
- SWT.DEFAULT);
+ Point desiredSize = supportArea.getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
- if(desiredSize.y > shellSize.y){
- supportArea.getShell().setSize(shellSize.x,
- Math.min(desiredSize.y, 500));
+ if (desiredSize.y > shellSize.y) {
+ supportArea.getShell().setSize(shellSize.x, Math.min(desiredSize.y, 500));
}
return container;
@@ -154,22 +146,19 @@ public class SupportTray extends DialogTray implements
*/
private void createImages() {
Display display = Display.getCurrent();
- int[] shape = new int[] { 3, 3, 5, 3, 7, 5, 8, 5, 10, 3, 12, 3, 12,
- 5, 10, 7, 10, 8, 12, 10, 12, 12, 10, 12, 8, 10, 7, 10, 5,
- 12, 3, 12, 3, 10, 5, 8, 5, 7, 3, 5 };
+ int[] shape = new int[] { 3, 3, 5, 3, 7, 5, 8, 5, 10, 3, 12, 3, 12, 5, 10, 7, 10, 8, 12, 10, 12, 12, 10, 12, 8,
+ 10, 7, 10, 5, 12, 3, 12, 3, 10, 5, 8, 5, 7, 3, 5 };
/*
* Use magenta as transparency color since it is used infrequently.
*/
Color border = display.getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW);
- Color background = display
- .getSystemColor(SWT.COLOR_LIST_BACKGROUND);
+ Color background = display.getSystemColor(SWT.COLOR_LIST_BACKGROUND);
Color backgroundHot = new Color(display, new RGB(252, 160, 160));
Color transparent = display.getSystemColor(SWT.COLOR_MAGENTA);
- PaletteData palette = new PaletteData(new RGB[] {
- transparent.getRGB(), border.getRGB(), background.getRGB(),
- backgroundHot.getRGB() });
+ PaletteData palette = new PaletteData(
+ new RGB[] { transparent.getRGB(), border.getRGB(), background.getRGB(), backgroundHot.getRGB() });
ImageData data = new ImageData(16, 16, 8, palette);
data.transparentPixel = 0;
@@ -212,21 +201,20 @@ public class SupportTray extends DialogTray implements
}
private void destroyImages() {
- if (normal != null) normal.dispose();
- if (hover != null) hover.dispose();
+ if (normal != null)
+ normal.dispose();
+ if (hover != null)
+ hover.dispose();
}
/**
* Create the area for extra error support information.
*
- * @param parent
- * A composite on which should be the support area created.
- * @param statusAdapter
- * StatusAdapter for which should be the support area
- * created.
+ * @param parent A composite on which should be the support area created.
+ * @param statusAdapter StatusAdapter for which should be the support area
+ * created.
*/
- private void createSupportArea(Composite parent,
- StatusAdapter statusAdapter) {
+ private void createSupportArea(Composite parent, StatusAdapter statusAdapter) {
ErrorSupportProvider provider = getSupportProvider();
@@ -250,32 +238,27 @@ public class SupportTray extends DialogTray implements
}
if (provider instanceof AbstractStatusAreaProvider) {
- ((AbstractStatusAreaProvider) provider).createSupportArea(
- supportAreaContent, statusAdapter);
+ ((AbstractStatusAreaProvider) provider).createSupportArea(supportAreaContent, statusAdapter);
} else {
- provider.createSupportArea(supportAreaContent, statusAdapter
- .getStatus());
+ provider.createSupportArea(supportAreaContent, statusAdapter.getStatus());
}
}
public ErrorSupportProvider getSupportProvider() {
ErrorSupportProvider provider = Policy.getErrorSupportProvider();
- Object userSupportProvider = dialogState
- .get(IStatusDialogConstants.CUSTOM_SUPPORT_PROVIDER);
+ Object userSupportProvider = dialogState.get(IStatusDialogConstants.CUSTOM_SUPPORT_PROVIDER);
if (userSupportProvider instanceof AbstractStatusAreaProvider) {
provider = (ErrorSupportProvider) userSupportProvider;
}
-
if (getBooleanValue(IStatusDialogConstants.ENABLE_DEFAULT_SUPPORT_AREA) && provider == null) {
provider = new StackTraceSupportArea();
}
return provider;
}
- private StatusAdapter getStatusAdapterFromEvent(
- SelectionChangedEvent event) {
+ private StatusAdapter getStatusAdapterFromEvent(SelectionChangedEvent event) {
ISelection selection = event.getSelection();
@@ -292,8 +275,7 @@ public class SupportTray extends DialogTray implements
/**
* Checks if the support dialog has any support areas.
*
- * @param adapter
- * - a parameter for which we area checking the status adapter
+ * @param adapter - a parameter for which we area checking the status adapter
* @return true if support dialog has any support areas to display, false
* otherwise
*/
@@ -336,7 +318,6 @@ public class SupportTray extends DialogTray implements
}
private StatusAdapter getCurrentStatusAdapter() {
- return (StatusAdapter) dialogState
- .get(IStatusDialogConstants.CURRENT_STATUS_ADAPTER);
+ return (StatusAdapter) dialogState.get(IStatusDialogConstants.CURRENT_STATUS_ADAPTER);
}
} \ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/WorkbenchStatusDialogManagerImpl.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/WorkbenchStatusDialogManagerImpl.java
index 7e864e84a94..1ba4d6f1842 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/WorkbenchStatusDialogManagerImpl.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/WorkbenchStatusDialogManagerImpl.java
@@ -63,8 +63,7 @@ import org.eclipse.ui.statushandlers.StatusManager.INotificationTypes;
*/
public class WorkbenchStatusDialogManagerImpl implements KeptJobsListener {
- static final QualifiedName HINT = new QualifiedName(
- IStatusAdapterConstants.PROPERTY_PREFIX, "hint"); //$NON-NLS-1$
+ static final QualifiedName HINT = new QualifiedName(IStatusAdapterConstants.PROPERTY_PREFIX, "hint"); //$NON-NLS-1$
private final class StatusDialogDisposeListener implements DisposeListener {
@@ -89,8 +88,7 @@ public class WorkbenchStatusDialogManagerImpl implements KeptJobsListener {
/**
* Returns whether the given StatusAdapter object should be displayed.
*
- * @param statusAdapter
- * a status object
+ * @param statusAdapter a status object
* @return <code>true</code> if the given status should be displayed, and
* <code>false</code> otherwise
* @see org.eclipse.core.runtime.IStatus#matches(int)
@@ -98,10 +96,9 @@ public class WorkbenchStatusDialogManagerImpl implements KeptJobsListener {
public boolean shouldAccept(StatusAdapter statusAdapter) {
IStatus status = statusAdapter.getStatus();
IStatus[] children = status.getChildren();
- int mask = ((Integer) dialogState.get(IStatusDialogConstants.MASK))
- .intValue();
- boolean handleOKStatuses = ((Boolean) dialogState
- .get(IStatusDialogConstants.HANDLE_OK_STATUSES)).booleanValue();
+ int mask = ((Integer) dialogState.get(IStatusDialogConstants.MASK)).intValue();
+ boolean handleOKStatuses = ((Boolean) dialogState.get(IStatusDialogConstants.HANDLE_OK_STATUSES))
+ .booleanValue();
if (children == null || children.length == 0) {
return status.matches(mask) || (handleOKStatuses && status.isOK());
}
@@ -119,17 +116,15 @@ public class WorkbenchStatusDialogManagerImpl implements KeptJobsListener {
/**
* Creates workbench status dialog.
*
- * @param displayMask
- * the mask used to filter the handled <code>StatusAdapter</code>
- * objects, the mask is a logical sum of status severities
- * @param dialogTitle
- * the title of the dialog. If null, than default will be used.
+ * @param displayMask the mask used to filter the handled
+ * <code>StatusAdapter</code> objects, the mask is a logical
+ * sum of status severities
+ * @param dialogTitle the title of the dialog. If null, than default will be
+ * used.
*/
public WorkbenchStatusDialogManagerImpl(int displayMask, String dialogTitle) {
- Assert
- .isNotNull(Display.getCurrent(),
- "WorkbenchStatusDialogManager must be instantiated in UI thread"); //$NON-NLS-1$
+ Assert.isNotNull(Display.getCurrent(), "WorkbenchStatusDialogManager must be instantiated in UI thread"); //$NON-NLS-1$
dialogState = initDialogState(dialogState, displayMask, dialogTitle);
FinishedJobs.getInstance().addListener(this);
@@ -138,35 +133,26 @@ public class WorkbenchStatusDialogManagerImpl implements KeptJobsListener {
/**
* This method creates the initial state of the dialog.
*
- * @param dialogState
- * - the map to fill in.
- * @param displayMask
- * - the mask suggesting which statuses should be displayed
- * @param dialogTitle
- * - the dialog title.
+ * @param dialogState - the map to fill in.
+ * @param displayMask - the mask suggesting which statuses should be displayed
+ * @param dialogTitle - the dialog title.
* @return populated dialogState
*/
public Map initDialogState(Map dialogState, int displayMask, String dialogTitle) {
dialogState.put(IStatusDialogConstants.MASK, Integer.valueOf(displayMask));
dialogState.put(IStatusDialogConstants.TITLE,
- dialogTitle == null ? JFaceResources
- .getString("Problem_Occurred") : //$NON-NLS-1$
+ dialogTitle == null ? JFaceResources.getString("Problem_Occurred") : //$NON-NLS-1$
dialogTitle);
- dialogState.put(IStatusDialogConstants.HANDLE_OK_STATUSES,
- Boolean.FALSE);
+ dialogState.put(IStatusDialogConstants.HANDLE_OK_STATUSES, Boolean.FALSE);
dialogState.put(IStatusDialogConstants.SHOW_SUPPORT, Boolean.FALSE);
- dialogState.put(IStatusDialogConstants.ENABLE_DEFAULT_SUPPORT_AREA,
- Boolean.FALSE);
+ dialogState.put(IStatusDialogConstants.ENABLE_DEFAULT_SUPPORT_AREA, Boolean.FALSE);
dialogState.put(IStatusDialogConstants.DETAILS_OPENED, Boolean.FALSE);
dialogState.put(IStatusDialogConstants.TRAY_OPENED, Boolean.FALSE);
- dialogState.put(IStatusDialogConstants.HIDE_SUPPORT_BUTTON,
- Boolean.FALSE);
- dialogState.put(IStatusDialogConstants.STATUS_ADAPTERS, Collections
- .synchronizedSet(new LinkedHashSet()));
+ dialogState.put(IStatusDialogConstants.HIDE_SUPPORT_BUTTON, Boolean.FALSE);
+ dialogState.put(IStatusDialogConstants.STATUS_ADAPTERS, Collections.synchronizedSet(new LinkedHashSet()));
dialogState.put(IStatusDialogConstants.STATUS_MODALS, new HashMap());
- dialogState.put(IStatusDialogConstants.LABEL_PROVIDER, new LabelProviderWrapper(
- dialogState));
+ dialogState.put(IStatusDialogConstants.LABEL_PROVIDER, new LabelProviderWrapper(dialogState));
dialogState.put(IStatusDialogConstants.MODALITY_SWITCH, Boolean.FALSE);
dialogState.put(IStatusDialogConstants.ANIMATION, Boolean.TRUE);
return dialogState;
@@ -174,31 +160,28 @@ public class WorkbenchStatusDialogManagerImpl implements KeptJobsListener {
/**
* <p>
- * Adds a new {@link StatusAdapter} to the status adapters list in the
- * dialog.
+ * Adds a new {@link StatusAdapter} to the status adapters list in the dialog.
* </p>
* <p>
* If the dialog is already visible, the status adapter will be shown
- * immediately. Otherwise, the dialog with the added status adapter will
- * show up, if all conditions below are false.
+ * immediately. Otherwise, the dialog with the added status adapter will show
+ * up, if all conditions below are false.
* <ul>
* <li>the status adapter has
- * {@link IProgressConstants#NO_IMMEDIATE_ERROR_PROMPT_PROPERTY} set to true</li>
+ * {@link IProgressConstants#NO_IMMEDIATE_ERROR_PROMPT_PROPERTY} set to
+ * true</li>
* </ul>
* </p>
* <p>
- * All not shown status adapters will be displayed as soon as the dialog
- * shows up.
+ * All not shown status adapters will be displayed as soon as the dialog shows
+ * up.
* </p>
*
- * @param modal
- * <code>true</code> if the dialog should be modal,
- * <code>false</code> otherwise
- * @param statusAdapter
- * the status adapter
+ * @param modal <code>true</code> if the dialog should be modal,
+ * <code>false</code> otherwise
+ * @param statusAdapter the status adapter
*/
- public void addStatusAdapter(final StatusAdapter statusAdapter,
- final boolean modal) {
+ public void addStatusAdapter(final StatusAdapter statusAdapter, final boolean modal) {
if (ErrorDialog.AUTOMATED_MODE == true) {
return;
}
@@ -220,8 +203,7 @@ public class WorkbenchStatusDialogManagerImpl implements KeptJobsListener {
}
private boolean isDialogClosed() {
- return dialog == null || dialog.getShell() == null
- || dialog.getShell().isDisposed();
+ return dialog == null || dialog.getShell() == null || dialog.getShell().isDisposed();
}
private void cleanUp() {
@@ -234,8 +216,7 @@ public class WorkbenchStatusDialogManagerImpl implements KeptJobsListener {
dialogState.remove(IStatusDialogConstants.CURRENT_STATUS_ADAPTER);
}
- private void doAddStatusAdapter(final StatusAdapter statusAdapter,
- final boolean modal) {
+ private void doAddStatusAdapter(final StatusAdapter statusAdapter, final boolean modal) {
if (!PlatformUI.isWorkbenchRunning()) {
// we are shutting down, so just log
@@ -258,23 +239,19 @@ public class WorkbenchStatusDialogManagerImpl implements KeptJobsListener {
if (shouldPrompt(statusAdapter)) {
// notify all interested parties that status adapters will be
// handled
- StatusManager.getManager().fireNotification(
- INotificationTypes.HANDLED,
- getErrors()
- .toArray(new StatusAdapter[] {}));
+ StatusManager.getManager().fireNotification(INotificationTypes.HANDLED,
+ getErrors().toArray(new StatusAdapter[] {}));
if (dialog == null) {
setSelectedStatusAdapter(statusAdapter);
dialog = new InternalDialog(dialogState, shouldBeModal());
dialog.create();
dialog.getShell().addDisposeListener(disposeListener);
- boolean showSupport = ((Boolean) dialogState
- .get(IStatusDialogConstants.SHOW_SUPPORT))
+ boolean showSupport = ((Boolean) dialogState.get(IStatusDialogConstants.SHOW_SUPPORT))
.booleanValue();
if (showSupport) {
dialog.openTray();
- dialog.getShell().setLocation(
- dialog.getInitialLocation(dialog.getShell().getSize()));
+ dialog.getShell().setLocation(dialog.getInitialLocation(dialog.getShell().getSize()));
}
dialog.open();
}
@@ -283,14 +260,10 @@ public class WorkbenchStatusDialogManagerImpl implements KeptJobsListener {
}
} else {
- StatusManager.getManager().fireNotification(
- INotificationTypes.HANDLED,
+ StatusManager.getManager().fireNotification(INotificationTypes.HANDLED,
new StatusAdapter[] { statusAdapter });
- if (statusAdapter
- .getProperty(IProgressConstants.NO_IMMEDIATE_ERROR_PROMPT_PROPERTY) != null) {
- statusAdapter.setProperty(
- IProgressConstants.NO_IMMEDIATE_ERROR_PROMPT_PROPERTY,
- Boolean.FALSE);
+ if (statusAdapter.getProperty(IProgressConstants.NO_IMMEDIATE_ERROR_PROMPT_PROPERTY) != null) {
+ statusAdapter.setProperty(IProgressConstants.NO_IMMEDIATE_ERROR_PROMPT_PROPERTY, Boolean.FALSE);
}
openStatusDialog(modal, statusAdapter);
}
@@ -308,13 +281,10 @@ public class WorkbenchStatusDialogManagerImpl implements KeptJobsListener {
/**
* Opens status dialog with particular statusAdapter selected.
*
- * @param modal
- * decides if window is modal or not.
- * @param statusAdapter
- * status adapter to be selected.
+ * @param modal decides if window is modal or not.
+ * @param statusAdapter status adapter to be selected.
*/
- private void openStatusDialog(final boolean modal,
- final StatusAdapter statusAdapter) {
+ private void openStatusDialog(final boolean modal, final StatusAdapter statusAdapter) {
getErrors().add(statusAdapter);
getModals().put(statusAdapter, Boolean.valueOf(modal));
boolean shouldBeModal = shouldBeModal();
@@ -333,34 +303,30 @@ public class WorkbenchStatusDialogManagerImpl implements KeptJobsListener {
/**
* Sets current status adapter.
*
- * @param statusAdapter
- * The statusAdapter to set.
+ * @param statusAdapter The statusAdapter to set.
*/
public void setSelectedStatusAdapter(StatusAdapter statusAdapter) {
- dialogState.put(IStatusDialogConstants.CURRENT_STATUS_ADAPTER,
- statusAdapter);
+ dialogState.put(IStatusDialogConstants.CURRENT_STATUS_ADAPTER, statusAdapter);
}
/**
- * Sets new label provider for the status list. This label provider is used
- * also to display the second message on the dialog if only one status is
- * available.
+ * Sets new label provider for the status list. This label provider is used also
+ * to display the second message on the dialog if only one status is available.
*
* <p>
- * This method is no longer recommended to use as it is impossible to
- * achieve consistent behavior after changing only one label provider.
+ * This method is no longer recommended to use as it is impossible to achieve
+ * consistent behavior after changing only one label provider.
* </p>
*
* @deprecated As of 3.5 {@link #setMessageDecorator} is recommended.
*
- * @param labelProvider
- * a label provider to be used when displaying status adapters.
+ * @param labelProvider a label provider to be used when displaying status
+ * adapters.
*/
@Deprecated
public void setStatusListLabelProvider(ITableLabelProvider labelProvider) {
Assert.isLegal(labelProvider != null, "Label Provider cannot be null"); //$NON-NLS-1$
- dialogState.put(IStatusDialogConstants.CUSTOM_LABEL_PROVIDER,
- labelProvider);
+ dialogState.put(IStatusDialogConstants.CUSTOM_LABEL_PROVIDER, labelProvider);
}
/**
@@ -371,8 +337,7 @@ public class WorkbenchStatusDialogManagerImpl implements KeptJobsListener {
* @return true if any StatusHandler should be displayed in modal window
*/
public boolean shouldBeModal() {
- Map<?, ?> modals = (Map<?, ?>) dialogState
- .get(IStatusDialogConstants.STATUS_MODALS);
+ Map<?, ?> modals = (Map<?, ?>) dialogState.get(IStatusDialogConstants.STATUS_MODALS);
for (Object value : modals.values()) {
if (value instanceof Boolean) {
Boolean b = (Boolean) value;
@@ -385,16 +350,13 @@ public class WorkbenchStatusDialogManagerImpl implements KeptJobsListener {
}
/**
- * Checks if the user should be prompted immediately about
- * {@link StatusAdapter}
+ * Checks if the user should be prompted immediately about {@link StatusAdapter}
*
- * @param statusAdapter
- * to be checked.
+ * @param statusAdapter to be checked.
* @return true if the statusAdapter should be prompted, false otherwise.
*/
public boolean shouldPrompt(final StatusAdapter statusAdapter) {
- Object noPromptProperty = statusAdapter
- .getProperty(IProgressConstants.NO_IMMEDIATE_ERROR_PROMPT_PROPERTY);
+ Object noPromptProperty = statusAdapter.getProperty(IProgressConstants.NO_IMMEDIATE_ERROR_PROMPT_PROPERTY);
boolean prompt = true;
if (noPromptProperty instanceof Boolean) {
@@ -417,46 +379,41 @@ public class WorkbenchStatusDialogManagerImpl implements KeptJobsListener {
/**
* <p>
- * This methods sets up the decorator, which is used to modify displayed
- * strings extracted from StatusAdapter. The decorator should be used to
- * remove technical codes from the dialog, f.e. following message
- * "<i>ERR2008 Invalid password</i>" can be translated into
- * "<i>Invalid password</i>".
+ * This methods sets up the decorator, which is used to modify displayed strings
+ * extracted from StatusAdapter. The decorator should be used to remove
+ * technical codes from the dialog, f.e. following message "<i>ERR2008 Invalid
+ * password</i>" can be translated into "<i>Invalid password</i>".
* </p>
* <p>
- * The decorator will be applied only to messages extracted from
- * StatusAdapter (predefined messages like
- * "This status has children statuses. See 'Details' for more information."
- * are not affected.
+ * The decorator will be applied only to messages extracted from StatusAdapter
+ * (predefined messages like "This status has children statuses. See 'Details'
+ * for more information." are not affected.
* </p>
* <p>
* This method should not be used together with
* {@link #setStatusListLabelProvider(ITableLabelProvider)}.
* </p>
*
- * @param decorator
- * - the decorator to be set. Only
- * {@link ILabelDecorator#decorateText(String, Object)} method
- * will be used. This method should return <code>null</code> if
- * and only if the first argument is null. StatusAdapter is
- * passed as second parameter. Other methods should have default
- * behavior as they may be used in future versions of the dialog.
+ * @param decorator - the decorator to be set. Only
+ * {@link ILabelDecorator#decorateText(String, Object)} method
+ * will be used. This method should return <code>null</code> if
+ * and only if the first argument is null. StatusAdapter is
+ * passed as second parameter. Other methods should have
+ * default behavior as they may be used in future versions of
+ * the dialog.
* @since 3.5
*/
- public void setMessageDecorator(ILabelDecorator decorator){
+ public void setMessageDecorator(ILabelDecorator decorator) {
dialogState.put(IStatusDialogConstants.DECORATOR, decorator);
}
-
/**
* This method sets various properties on the manager.
*
- * @param key
- * a key of the property to be set.
- * @param value
- * a value of the property to be set. The value must be of type
- * specified by the property key. <code>null</code> should never
- * be passed unless the property key javadoc allows for that.
+ * @param key a key of the property to be set.
+ * @param value a value of the property to be set. The value must be of type
+ * specified by the property key. <code>null</code> should never be
+ * passed unless the property key javadoc allows for that.
* @since 3.5
*/
public void setProperty(Object key, Object value) {
@@ -466,14 +423,13 @@ public class WorkbenchStatusDialogManagerImpl implements KeptJobsListener {
/**
* This method gets various dialog properties.
*
- * @param key
- * a key of the property to be get.
- * @return a value of the property. The value will be of type specified by
- * the property key. <code>null</code> can be returned.
+ * @param key a key of the property to be get.
+ * @return a value of the property. The value will be of type specified by the
+ * property key. <code>null</code> can be returned.
* @since 3.5
*/
- public Object getProperty(Object key){
- if(key == IStatusDialogConstants.SHELL){
+ public Object getProperty(Object key) {
+ if (key == IStatusDialogConstants.SHELL) {
return getShell();
}
if (key == IStatusDialogConstants.MANAGER_IMPL) {
@@ -484,14 +440,14 @@ public class WorkbenchStatusDialogManagerImpl implements KeptJobsListener {
/**
* This method makes the dialog to be similar to the JFace ErrorDialog. The
- * dialog handles {@link StatusAdapter}s wrapping {@link IStatus} with
- * severity {@link IStatus#OK}, does not display the link to the error log,
- * does not display the link to the support area but always opens it.
+ * dialog handles {@link StatusAdapter}s wrapping {@link IStatus} with severity
+ * {@link IStatus#OK}, does not display the link to the error log, does not
+ * display the link to the support area but always opens it.
*
* @see ErrorDialog
* @since 3.6
*/
- public void enableErrorDialogCompatibility(){
+ public void enableErrorDialogCompatibility() {
setProperty(IStatusDialogConstants.ERRORLOG_LINK, Boolean.FALSE);
setProperty(IStatusDialogConstants.HANDLE_OK_STATUSES, Boolean.TRUE);
setProperty(IStatusDialogConstants.SHOW_SUPPORT, Boolean.TRUE);
@@ -510,8 +466,7 @@ public class WorkbenchStatusDialogManagerImpl implements KeptJobsListener {
/**
* This method is public for testing purposes only.
*
- * @param dialog
- * The dialog to set.
+ * @param dialog The dialog to set.
*/
public void setDialog(InternalDialog dialog) {
this.dialog = dialog;
@@ -542,8 +497,7 @@ public class WorkbenchStatusDialogManagerImpl implements KeptJobsListener {
* @return Collection of StatusAdapter modal flag.
*/
private Map getModals() {
- return (Map) dialogState
- .get(IStatusDialogConstants.STATUS_MODALS);
+ return (Map) dialogState.get(IStatusDialogConstants.STATUS_MODALS);
}
@Override
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/testing/ContributionInfoMessages.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/testing/ContributionInfoMessages.java
index 60e851f0a26..9cac65d372e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/testing/ContributionInfoMessages.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/testing/ContributionInfoMessages.java
@@ -22,7 +22,6 @@ import org.eclipse.osgi.util.NLS;
public class ContributionInfoMessages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.ui.internal.testing.messages";//$NON-NLS-1$
-
public static String ContributionInfo_Editor;
public static String ContributionInfo_View;
public static String ContributionInfo_ActionSet;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/testing/WorkbenchPartTestable.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/testing/WorkbenchPartTestable.java
index ce789377963..a486aa456fe 100755
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/testing/WorkbenchPartTestable.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/testing/WorkbenchPartTestable.java
@@ -34,7 +34,7 @@ public class WorkbenchPartTestable implements IWorkbenchPartTestable {
*/
public WorkbenchPartTestable(PartSite partSite) {
Composite paneComposite = (Composite) partSite.getModel().getWidget();
- Control [] paneChildren = paneComposite.getChildren();
+ Control[] paneChildren = paneComposite.getChildren();
this.composite = ((Composite) paneChildren[0]);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/testing/WorkbenchTestable.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/testing/WorkbenchTestable.java
index 4f45d94996a..b36d604fff6 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/testing/WorkbenchTestable.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/testing/WorkbenchTestable.java
@@ -31,59 +31,64 @@ import org.eclipse.ui.testing.TestableObject;
*/
public class WorkbenchTestable extends TestableObject {
- private Display display;
+ private Display display;
- private IWorkbench workbench;
+ private IWorkbench workbench;
- private boolean oldAutomatedMode;
+ private boolean oldAutomatedMode;
- private boolean oldIgnoreErrors;
+ private boolean oldIgnoreErrors;
- /**
- * Constructs a new workbench testable object.
- */
- public WorkbenchTestable() {
- // do nothing
- }
+ /**
+ * Constructs a new workbench testable object.
+ */
+ public WorkbenchTestable() {
+ // do nothing
+ }
- /**
- * Initializes the workbench testable with the display and workbench,
- * and notifies all listeners that the tests can be run.
- *
- * @param display the display
- * @param workbench the workbench
- */
- public void init(Display display, IWorkbench workbench) {
- Assert.isNotNull(display);
- Assert.isNotNull(workbench);
- this.display = display;
- this.workbench = workbench;
- if (getTestHarness() != null) {
- // don't use a job, since tests often wait for all jobs to complete before proceeding
- Runnable runnable = () -> {
+ /**
+ * Initializes the workbench testable with the display and workbench, and
+ * notifies all listeners that the tests can be run.
+ *
+ * @param display the display
+ * @param workbench the workbench
+ */
+ public void init(Display display, IWorkbench workbench) {
+ Assert.isNotNull(display);
+ Assert.isNotNull(workbench);
+ this.display = display;
+ this.workbench = workbench;
+ if (getTestHarness() != null) {
+ // don't use a job, since tests often wait for all jobs to complete before
+ // proceeding
+ Runnable runnable = () -> {
// disable workbench auto-save during tests
- if ("true".equalsIgnoreCase(System.getProperty(PlatformUI.PLUGIN_ID + ".testsDisableWorkbenchAutoSave"))) { //$NON-NLS-1$ //$NON-NLS-2$
+ if ("true".equalsIgnoreCase( //$NON-NLS-1$
+ System.getProperty(PlatformUI.PLUGIN_ID + ".testsDisableWorkbenchAutoSave"))) { //$NON-NLS-1$
if (WorkbenchTestable.this.workbench instanceof Workbench) {
((Workbench) WorkbenchTestable.this.workbench).setEnableAutoSave(false);
}
Job.getJobManager().cancel(Workbench.WORKBENCH_AUTO_SAVE_JOB);
}
- // Some tests (notably the startup performance tests) do not want to wait for early startup.
- // Allow this to be disabled by specifying the system property: org.eclipse.ui.testsWaitForEarlyStartup=false
- // For details, see bug 94129 [Workbench] Performance test regression caused by workbench harness change
- if (!"false".equalsIgnoreCase(System.getProperty(PlatformUI.PLUGIN_ID + ".testsWaitForEarlyStartup"))) { //$NON-NLS-1$ //$NON-NLS-2$
+ // Some tests (notably the startup performance tests) do not want to wait for
+ // early startup.
+ // Allow this to be disabled by specifying the system property:
+ // org.eclipse.ui.testsWaitForEarlyStartup=false
+ // For details, see bug 94129 [Workbench] Performance test regression caused by
+ // workbench harness change
+ if (!"false".equalsIgnoreCase(System.getProperty(PlatformUI.PLUGIN_ID + ".testsWaitForEarlyStartup"))) { //$NON-NLS-1$ //$NON-NLS-2$
waitForEarlyStartup();
}
- getTestHarness().runTests();
+ getTestHarness().runTests();
};
- new Thread(runnable, "WorkbenchTestable").start(); //$NON-NLS-1$
- }
- }
+ new Thread(runnable, "WorkbenchTestable").start(); //$NON-NLS-1$
+ }
+ }
- /**
- * Waits for the early startup job to complete.
- */
- private void waitForEarlyStartup() {
+ /**
+ * Waits for the early startup job to complete.
+ */
+ private void waitForEarlyStartup() {
try {
Job.getJobManager().join(Workbench.EARLY_STARTUP_FAMILY, null);
} catch (OperationCanceledException e) {
@@ -91,44 +96,42 @@ public class WorkbenchTestable extends TestableObject {
} catch (InterruptedException e) {
// ignore
}
- }
+ }
- /**
- * The <code>WorkbenchTestable</code> implementation of this
- * <code>TestableObject</code> method ensures that the workbench
- * has been set.
- */
- @Override
+ /**
+ * The <code>WorkbenchTestable</code> implementation of this
+ * <code>TestableObject</code> method ensures that the workbench has been set.
+ */
+ @Override
public void testingStarting() {
- Assert.isNotNull(workbench);
- oldAutomatedMode = ErrorDialog.AUTOMATED_MODE;
- ErrorDialog.AUTOMATED_MODE = true;
- oldIgnoreErrors = SafeRunnable.getIgnoreErrors();
- SafeRunnable.setIgnoreErrors(true);
- }
+ Assert.isNotNull(workbench);
+ oldAutomatedMode = ErrorDialog.AUTOMATED_MODE;
+ ErrorDialog.AUTOMATED_MODE = true;
+ oldIgnoreErrors = SafeRunnable.getIgnoreErrors();
+ SafeRunnable.setIgnoreErrors(true);
+ }
- /**
- * The <code>WorkbenchTestable</code> implementation of this
- * <code>TestableObject</code> method flushes the event queue,
- * runs the test in a <code>syncExec</code>, then flushes the
- * event queue again.
- */
- @Override
+ /**
+ * The <code>WorkbenchTestable</code> implementation of this
+ * <code>TestableObject</code> method flushes the event queue, runs the test in
+ * a <code>syncExec</code>, then flushes the event queue again.
+ */
+ @Override
public void runTest(Runnable testRunnable) {
- Assert.isNotNull(workbench);
- display.syncExec(testRunnable);
- }
+ Assert.isNotNull(workbench);
+ display.syncExec(testRunnable);
+ }
- /**
- * The <code>WorkbenchTestable</code> implementation of this
- * <code>TestableObject</code> method flushes the event queue,
- * then closes the workbench.
- */
- @Override
+ /**
+ * The <code>WorkbenchTestable</code> implementation of this
+ * <code>TestableObject</code> method flushes the event queue, then closes the
+ * workbench.
+ */
+ @Override
public void testingFinished() {
- // force events to be processed, and ensure the close is done in the UI thread
- display.syncExec(() -> Assert.isTrue(workbench.close()));
- ErrorDialog.AUTOMATED_MODE = oldAutomatedMode;
- SafeRunnable.setIgnoreErrors(oldIgnoreErrors);
- }
+ // force events to be processed, and ensure the close is done in the UI thread
+ display.syncExec(() -> Assert.isTrue(workbench.close()));
+ ErrorDialog.AUTOMATED_MODE = oldAutomatedMode;
+ SafeRunnable.setIgnoreErrors(oldIgnoreErrors);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/CascadingColorRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/CascadingColorRegistry.java
index 2d6d42e9a0a..77aef05522f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/CascadingColorRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/CascadingColorRegistry.java
@@ -27,76 +27,75 @@ import org.eclipse.ui.PlatformUI;
*/
public class CascadingColorRegistry extends ColorRegistry {
- private ColorRegistry parent;
+ private ColorRegistry parent;
- private IPropertyChangeListener listener = event -> {
+ private IPropertyChangeListener listener = event -> {
// check to see if we have an override for the given key. If so,
// then a change in our parent registry shouldn't cause a change in
// us. Without this check we will propagate a new value
// (event.getNewValue()) to our listeners despite the fact that this
// value is NOT our current value.
if (!hasOverrideFor(event.getProperty()))
- fireMappingChanged(event.getProperty(), event.getOldValue(),
- event.getNewValue());
+ fireMappingChanged(event.getProperty(), event.getOldValue(), event.getNewValue());
};
- /**
- * Create a new instance of this class.
- *
- * @param parent the parent registry
- */
- public CascadingColorRegistry(ColorRegistry parent) {
- super(Display.getCurrent(), false);
- this.parent = parent;
- parent.addListener(listener);
- }
+ /**
+ * Create a new instance of this class.
+ *
+ * @param parent the parent registry
+ */
+ public CascadingColorRegistry(ColorRegistry parent) {
+ super(Display.getCurrent(), false);
+ this.parent = parent;
+ parent.addListener(listener);
+ }
- @Override
+ @Override
public Color get(String symbolicName) {
- if (super.hasValueFor(symbolicName)) {
+ if (super.hasValueFor(symbolicName)) {
return super.get(symbolicName);
}
- return parent.get(symbolicName);
- }
+ return parent.get(symbolicName);
+ }
- @Override
+ @Override
public Set getKeySet() {
- Set keyUnion = new HashSet(super.getKeySet());
- keyUnion.addAll(parent.getKeySet());
- return keyUnion;
- }
+ Set keyUnion = new HashSet(super.getKeySet());
+ keyUnion.addAll(parent.getKeySet());
+ return keyUnion;
+ }
- @Override
+ @Override
public RGB getRGB(String symbolicName) {
- if (super.hasValueFor(symbolicName)) {
+ if (super.hasValueFor(symbolicName)) {
return super.getRGB(symbolicName);
}
- return parent.getRGB(symbolicName);
- }
+ return parent.getRGB(symbolicName);
+ }
- @Override
+ @Override
public boolean hasValueFor(String colorKey) {
- return super.hasValueFor(colorKey) || parent.hasValueFor(colorKey);
- }
+ return super.hasValueFor(colorKey) || parent.hasValueFor(colorKey);
+ }
- /**
- * Returns whether this cascading registry has an override for the provided
- * color key.
- *
- * @param colorKey the provided color key
- * @return hether this cascading registry has an override
- */
- public boolean hasOverrideFor(String colorKey) {
- return super.hasValueFor(colorKey);
- }
+ /**
+ * Returns whether this cascading registry has an override for the provided
+ * color key.
+ *
+ * @param colorKey the provided color key
+ * @return hether this cascading registry has an override
+ */
+ public boolean hasOverrideFor(String colorKey) {
+ return super.hasValueFor(colorKey);
+ }
- /**
- * Disposes of all allocated resources.
- */
- public void dispose() {
- parent.removeListener(listener);
- PlatformUI.getWorkbench().getDisplay().asyncExec(displayRunnable);
- }
+ /**
+ * Disposes of all allocated resources.
+ */
+ public void dispose() {
+ parent.removeListener(listener);
+ PlatformUI.getWorkbench().getDisplay().asyncExec(displayRunnable);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/CascadingFontRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/CascadingFontRegistry.java
index a675a18f88e..c6874d5fc75 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/CascadingFontRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/CascadingFontRegistry.java
@@ -28,75 +28,74 @@ import org.eclipse.ui.PlatformUI;
*/
public class CascadingFontRegistry extends FontRegistry {
- private FontRegistry parent;
+ private FontRegistry parent;
- private IPropertyChangeListener listener = event -> {
+ private IPropertyChangeListener listener = event -> {
// check to see if we have an override for the given key. If so,
// then a change in our parent registry shouldn't cause a change in
// us. Without this check we will propagate a new value
// (event.getNewValue()) to our listeners despite the fact that this
// value is NOT our current value.
if (!hasOverrideFor(event.getProperty()))
- fireMappingChanged(event.getProperty(), event.getOldValue(), event
- .getNewValue());
+ fireMappingChanged(event.getProperty(), event.getOldValue(), event.getNewValue());
};
- /**
- * Create a new instance of this class.
- *
- * @param parent the parent registry
- */
- public CascadingFontRegistry(FontRegistry parent) {
- super(Display.getCurrent(), false);
- this.parent = parent;
- parent.addListener(listener);
- }
+ /**
+ * Create a new instance of this class.
+ *
+ * @param parent the parent registry
+ */
+ public CascadingFontRegistry(FontRegistry parent) {
+ super(Display.getCurrent(), false);
+ this.parent = parent;
+ parent.addListener(listener);
+ }
- @Override
+ @Override
public Font get(String symbolicName) {
- if (super.hasValueFor(symbolicName)) {
+ if (super.hasValueFor(symbolicName)) {
return super.get(symbolicName);
}
- return parent.get(symbolicName);
- }
+ return parent.get(symbolicName);
+ }
- @Override
+ @Override
public Set getKeySet() {
- Set keyUnion = new HashSet(super.getKeySet());
- keyUnion.addAll(parent.getKeySet());
- return keyUnion;
- }
+ Set keyUnion = new HashSet(super.getKeySet());
+ keyUnion.addAll(parent.getKeySet());
+ return keyUnion;
+ }
- @Override
+ @Override
public FontData[] getFontData(String symbolicName) {
- if (super.hasValueFor(symbolicName)) {
+ if (super.hasValueFor(symbolicName)) {
return super.getFontData(symbolicName);
}
- return parent.getFontData(symbolicName);
- }
+ return parent.getFontData(symbolicName);
+ }
- @Override
+ @Override
public boolean hasValueFor(String colorKey) {
- return super.hasValueFor(colorKey) || parent.hasValueFor(colorKey);
- }
+ return super.hasValueFor(colorKey) || parent.hasValueFor(colorKey);
+ }
- /**
- * Returns whether this cascading registry has an override for the provided
- * color key.
- *
- * @param fontKey the provided color key
- * @return hether this cascading registry has an override
- */
- public boolean hasOverrideFor(String fontKey) {
- return super.hasValueFor(fontKey);
- }
+ /**
+ * Returns whether this cascading registry has an override for the provided
+ * color key.
+ *
+ * @param fontKey the provided color key
+ * @return hether this cascading registry has an override
+ */
+ public boolean hasOverrideFor(String fontKey) {
+ return super.hasValueFor(fontKey);
+ }
- /**
- * Disposes of all allocated resources.
- */
- public void dispose() {
- parent.removeListener(listener);
- PlatformUI.getWorkbench().getDisplay().asyncExec(displayRunnable);
- }
+ /**
+ * Disposes of all allocated resources.
+ */
+ public void dispose() {
+ parent.removeListener(listener);
+ PlatformUI.getWorkbench().getDisplay().asyncExec(displayRunnable);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/CascadingMap.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/CascadingMap.java
index 768820e2c29..c5b649d57ef 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/CascadingMap.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/CascadingMap.java
@@ -23,38 +23,38 @@ import java.util.Set;
*/
public class CascadingMap {
- private Map base, override;
+ private Map base, override;
- /**
- * @param base the base (default) map
- * @param override the override map
- */
- public CascadingMap(Map base, Map override) {
- this.base = base;
- this.override = override;
- }
+ /**
+ * @param base the base (default) map
+ * @param override the override map
+ */
+ public CascadingMap(Map base, Map override) {
+ this.base = base;
+ this.override = override;
+ }
- /**
- * Return the union of the parent and child key sets.
- *
- * @return the union. This set is read only.
- */
- public Set keySet() {
- Set keySet = new HashSet(base.keySet());
- keySet.addAll(override.keySet());
- return Collections.unmodifiableSet(keySet);
- }
+ /**
+ * Return the union of the parent and child key sets.
+ *
+ * @return the union. This set is read only.
+ */
+ public Set keySet() {
+ Set keySet = new HashSet(base.keySet());
+ keySet.addAll(override.keySet());
+ return Collections.unmodifiableSet(keySet);
+ }
- /**
- * Get the value. Preference will be given to entries in the override map.
- *
- * @param key the key
- * @return the value
- */
- public Object get(Object key) {
- if (override.containsKey(key)) {
+ /**
+ * Get the value. Preference will be given to entries in the override map.
+ *
+ * @param key the key
+ * @return the value
+ */
+ public Object get(Object key) {
+ if (override.containsKey(key)) {
return override.get(key);
}
- return base.get(key);
- }
+ return base.get(key);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/CascadingTheme.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/CascadingTheme.java
index 6576b5dcea6..1d5651abc93 100755
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/CascadingTheme.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/CascadingTheme.java
@@ -26,92 +26,91 @@ import org.eclipse.ui.themes.ITheme;
*/
public class CascadingTheme extends EventManager implements ITheme {
- private CascadingFontRegistry fontRegistry;
+ private CascadingFontRegistry fontRegistry;
- private CascadingColorRegistry colorRegistry;
+ private CascadingColorRegistry colorRegistry;
- private ITheme currentTheme;
+ private ITheme currentTheme;
- private IPropertyChangeListener listener = event -> fire(event);
+ private IPropertyChangeListener listener = event -> fire(event);
- /**
- * @param colorRegistry
- * @param fontRegistry
- */
- public CascadingTheme(ITheme currentTheme,
- CascadingColorRegistry colorRegistry,
- CascadingFontRegistry fontRegistry) {
- this.currentTheme = currentTheme;
- this.colorRegistry = colorRegistry;
- this.fontRegistry = fontRegistry;
+ /**
+ * @param colorRegistry
+ * @param fontRegistry
+ */
+ public CascadingTheme(ITheme currentTheme, CascadingColorRegistry colorRegistry,
+ CascadingFontRegistry fontRegistry) {
+ this.currentTheme = currentTheme;
+ this.colorRegistry = colorRegistry;
+ this.fontRegistry = fontRegistry;
- fontRegistry.addListener(listener);
- colorRegistry.addListener(listener);
- }
+ fontRegistry.addListener(listener);
+ colorRegistry.addListener(listener);
+ }
- /**
- * @param event
- */
- protected void fire(PropertyChangeEvent event) {
+ /**
+ * @param event
+ */
+ protected void fire(PropertyChangeEvent event) {
for (Object listener : getListeners()) {
((IPropertyChangeListener) listener).propertyChange(event);
- }
- }
+ }
+ }
- @Override
+ @Override
public void addPropertyChangeListener(IPropertyChangeListener listener) {
- addListenerObject(listener);
- }
+ addListenerObject(listener);
+ }
- @Override
+ @Override
public void removePropertyChangeListener(IPropertyChangeListener listener) {
- removeListenerObject(listener);
- }
+ removeListenerObject(listener);
+ }
- @Override
+ @Override
public String getId() {
- return currentTheme.getId();
- }
+ return currentTheme.getId();
+ }
- @Override
+ @Override
public String getLabel() {
- return currentTheme.getLabel();
- }
+ return currentTheme.getLabel();
+ }
- @Override
+ @Override
public ColorRegistry getColorRegistry() {
- return colorRegistry;
- }
+ return colorRegistry;
+ }
- @Override
+ @Override
public FontRegistry getFontRegistry() {
- return fontRegistry;
- }
+ return fontRegistry;
+ }
- @Override
+ @Override
public void dispose() {
- colorRegistry.removeListener(listener);
- fontRegistry.removeListener(listener);
- }
+ colorRegistry.removeListener(listener);
+ fontRegistry.removeListener(listener);
+ }
- @Override
+ @Override
public String getString(String key) {
- return currentTheme.getString(key);
- }
+ return currentTheme.getString(key);
+ }
- @Override
+ @Override
public int getInt(String key) {
- return currentTheme.getInt(key);
- }
+ return currentTheme.getInt(key);
+ }
- @Override
+ @Override
public boolean getBoolean(String key) {
- return currentTheme.getBoolean(key);
- }
+ return currentTheme.getBoolean(key);
+ }
- @Override
+ @Override
public Set keySet() {
- return currentTheme.keySet();
- }
+ return currentTheme.keySet();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ColorDefinition.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ColorDefinition.java
index 6e54fc8805e..3a5fcb2b7a8 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ColorDefinition.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ColorDefinition.java
@@ -26,90 +26,87 @@ import org.eclipse.ui.themes.ColorUtil;
* A <code>ColorDefiniton </code> is the representation of the extensions
* defined by the <code>org.eclipse.ui.colorDefinitions</code> extension point.
*
- * @since 3.0
+ * @since 3.0
*/
public class ColorDefinition extends ThemeElementDefinition implements IPluginContribution,
- IHierarchalThemeElementDefinition, ICategorizedThemeElementDefinition, IEditable,
- IColorDefinitionOverridable {
+ IHierarchalThemeElementDefinition, ICategorizedThemeElementDefinition, IEditable, IColorDefinitionOverridable {
/**
* Default color value - black - for colors that cannot be parsed.
*/
- private static final RGB DEFAULT_COLOR_VALUE = new RGB(0,0,0);
+ private static final RGB DEFAULT_COLOR_VALUE = new RGB(0, 0, 0);
private String defaultsTo;
- private String pluginId;
-
- private String rawValue;
-
- boolean isEditable;
-
- private RGB parsedValue;
-
- /**
- * Create a new instance of the receiver.
- *
- * @param label the label for this definition
- * @param id the identifier for this definition
- * @param defaultsTo the id of a definition that this definition will
- * default to.
- * @param value the default value of this definition, either in the form
- * rrr,ggg,bbb or the name of an SWT color constant.
- * @param description the description for this definition.
- * @param pluginId the identifier of the plugin that contributed this
- * definition.
- */
- public ColorDefinition(String label, String id, String defaultsTo,
- String value, String categoryId, boolean isEditable,
- String description, String pluginId) {
+ private String pluginId;
+
+ private String rawValue;
+
+ boolean isEditable;
+
+ private RGB parsedValue;
+
+ /**
+ * Create a new instance of the receiver.
+ *
+ * @param label the label for this definition
+ * @param id the identifier for this definition
+ * @param defaultsTo the id of a definition that this definition will default
+ * to.
+ * @param value the default value of this definition, either in the form
+ * rrr,ggg,bbb or the name of an SWT color constant.
+ * @param description the description for this definition.
+ * @param pluginId the identifier of the plugin that contributed this
+ * definition.
+ */
+ public ColorDefinition(String label, String id, String defaultsTo, String value, String categoryId,
+ boolean isEditable, String description, String pluginId) {
super(id, label, description, categoryId);
- this.defaultsTo = defaultsTo;
- this.rawValue = value;
- this.isEditable = isEditable;
- this.pluginId = pluginId;
- }
-
- /**
- * Create a new instance of the receiver.
- *
- * @param original the original definition. This will be used to populate
- * all fields except defaultsTo and value. defaultsTo will always be
- * <code>null</code>.
- * @param value the RGB value
- */
- public ColorDefinition(ColorDefinition original, RGB value) {
- super(original.getId(), original.getName(), original.getDescription(), original
- .getCategoryId());
- this.isEditable = original.isEditable();
- this.pluginId = original.getPluginId();
- this.parsedValue = value;
- }
-
- /**
- * @return the defaultsTo value, or <code>null</code> if none was supplied.
- */
- @Override
+ this.defaultsTo = defaultsTo;
+ this.rawValue = value;
+ this.isEditable = isEditable;
+ this.pluginId = pluginId;
+ }
+
+ /**
+ * Create a new instance of the receiver.
+ *
+ * @param original the original definition. This will be used to populate all
+ * fields except defaultsTo and value. defaultsTo will always be
+ * <code>null</code>.
+ * @param value the RGB value
+ */
+ public ColorDefinition(ColorDefinition original, RGB value) {
+ super(original.getId(), original.getName(), original.getDescription(), original.getCategoryId());
+ this.isEditable = original.isEditable();
+ this.pluginId = original.getPluginId();
+ this.parsedValue = value;
+ }
+
+ /**
+ * @return the defaultsTo value, or <code>null</code> if none was supplied.
+ */
+ @Override
public String getDefaultsTo() {
- return defaultsTo;
- }
+ return defaultsTo;
+ }
- @Override
+ @Override
public String getLocalId() {
- return getId();
- }
+ return getId();
+ }
- @Override
+ @Override
public String getPluginId() {
- return pluginId;
- }
-
- /**
- * @return the value. Any SWT constants supplied to the constructor will be
- * evaluated and converted into their RGB value.
- */
- @Override
+ return pluginId;
+ }
+
+ /**
+ * @return the value. Any SWT constants supplied to the constructor will be
+ * evaluated and converted into their RGB value.
+ */
+ @Override
public RGB getValue() {
- if (parsedValue == null) {
+ if (parsedValue == null) {
try {
parsedValue = ColorUtil.getColorValue(rawValue);
} catch (DataFormatException e) {
@@ -119,8 +116,8 @@ public class ColorDefinition extends ThemeElementDefinition implements IPluginCo
StatusManager.getManager().handle(status, StatusManager.LOG);
}
}
- return parsedValue;
- }
+ return parsedValue;
+ }
@Override
public void resetToDefaultValue() {
@@ -128,28 +125,28 @@ public class ColorDefinition extends ThemeElementDefinition implements IPluginCo
super.resetToDefaultValue();
}
- @Override
+ @Override
public String toString() {
- return getId();
- }
+ return getId();
+ }
- @Override
+ @Override
public boolean isEditable() {
- return isEditable;
- }
+ return isEditable;
+ }
- @Override
+ @Override
public boolean equals(Object obj) {
- if (obj instanceof ColorDefinition) {
- return getId().equals(((ColorDefinition)obj).getId());
- }
- return false;
- }
+ if (obj instanceof ColorDefinition) {
+ return getId().equals(((ColorDefinition) obj).getId());
+ }
+ return false;
+ }
- @Override
+ @Override
public int hashCode() {
return getId().hashCode();
- }
+ }
@Override
public void setValue(RGB data) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ColorsAndFontsPreferencePage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ColorsAndFontsPreferencePage.java
index 5c7a2000af7..a243b64eaa4 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ColorsAndFontsPreferencePage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ColorsAndFontsPreferencePage.java
@@ -93,14 +93,12 @@ import org.eclipse.ui.themes.IThemePreview;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventHandler;
-
/**
* Preference page for management of system colors, gradients and fonts.
*
* @since 3.0
*/
-public final class ColorsAndFontsPreferencePage extends PreferencePage
- implements IWorkbenchPreferencePage {
+public final class ColorsAndFontsPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
private static final String EMPTY = ""; //$NON-NLS-1$
@@ -117,8 +115,8 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
private static final String EXPANDED_ELEMENTS_TOKEN = "\t"; //$NON-NLS-1$
/**
- * Marks category tokens in EXPANDED_ELEMENTS_PREF and SELECTED_ELEMENT_PREF.
- */
+ * Marks category tokens in EXPANDED_ELEMENTS_PREF and SELECTED_ELEMENT_PREF.
+ */
private static final char MARKER_CATEGORY = 'T';
/**
@@ -133,22 +131,21 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
private static final int DEFINITION_NOT_AVAIL_COLOR = SWT.COLOR_WIDGET_LIGHT_SHADOW;
- private class ThemeContentProvider implements ITreeContentProvider {
+ private class ThemeContentProvider implements ITreeContentProvider {
- private IThemeRegistry registry;
+ private IThemeRegistry registry;
- @Override
+ @Override
public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof ThemeElementCategory) {
- String categoryId = ((ThemeElementCategory) parentElement)
- .getId();
- Object[] defintions = (Object[]) categoryMap.get(categoryId);
- if (defintions == null) {
- defintions = getCategoryChildren(categoryId);
- categoryMap.put(categoryId, defintions);
- }
- return defintions;
- }
+ if (parentElement instanceof ThemeElementCategory) {
+ String categoryId = ((ThemeElementCategory) parentElement).getId();
+ Object[] defintions = (Object[]) categoryMap.get(categoryId);
+ if (defintions == null) {
+ defintions = getCategoryChildren(categoryId);
+ categoryMap.put(categoryId, defintions);
+ }
+ return defintions;
+ }
ArrayList list = new ArrayList();
IHierarchalThemeElementDefinition def = (IHierarchalThemeElementDefinition) parentElement;
@@ -161,93 +158,87 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
}
for (IHierarchalThemeElementDefinition elementDefinition : defs) {
- if (id.equals(elementDefinition.getDefaultsTo())
- && ColorsAndFontsPreferencePage.equals(
- ((ICategorizedThemeElementDefinition) def).getCategoryId(),
- ((ICategorizedThemeElementDefinition) elementDefinition).getCategoryId())) {
+ if (id.equals(elementDefinition.getDefaultsTo()) && ColorsAndFontsPreferencePage.equals(
+ ((ICategorizedThemeElementDefinition) def).getCategoryId(),
+ ((ICategorizedThemeElementDefinition) elementDefinition).getCategoryId())) {
list.add(elementDefinition);
}
}
return list.toArray();
- }
+ }
- private Object[] getCategoryChildren(String categoryId) {
- ArrayList list = new ArrayList();
+ private Object[] getCategoryChildren(String categoryId) {
+ ArrayList list = new ArrayList();
- if (categoryId != null) {
+ if (categoryId != null) {
for (ThemeElementCategory category : registry.getCategories()) {
if (categoryId.equals(category.getParentId())) {
Set bindings = themeRegistry.getPresentationsBindingsFor(category);
if (bindings == null) {
list.add(category);
}
- }
- }
- }
- {
- ColorDefinition[] colorDefinitions = themeRegistry
- .getColorsFor(currentTheme.getId());
- for (int i = 0; i < colorDefinitions.length; i++) {
- if (!colorDefinitions[i].isEditable()) {
+ }
+ }
+ }
+ {
+ ColorDefinition[] colorDefinitions = themeRegistry.getColorsFor(currentTheme.getId());
+ for (int i = 0; i < colorDefinitions.length; i++) {
+ if (!colorDefinitions[i].isEditable()) {
continue;
}
- String catId = colorDefinitions[i].getCategoryId();
- if ((catId == null && categoryId == null)
- || (catId != null && categoryId != null && categoryId
- .equals(catId))) {
- if (colorDefinitions[i].getDefaultsTo() != null
- && parentIsInSameCategory(colorDefinitions[i])) {
+ String catId = colorDefinitions[i].getCategoryId();
+ if ((catId == null && categoryId == null)
+ || (catId != null && categoryId != null && categoryId.equals(catId))) {
+ if (colorDefinitions[i].getDefaultsTo() != null
+ && parentIsInSameCategory(colorDefinitions[i])) {
continue;
}
- list.add(colorDefinitions[i]);
- }
- }
- }
- {
- FontDefinition[] fontDefinitions = themeRegistry
- .getFontsFor(currentTheme.getId());
- for (int i = 0; i < fontDefinitions.length; i++) {
- if (!fontDefinitions[i].isEditable()) {
+ list.add(colorDefinitions[i]);
+ }
+ }
+ }
+ {
+ FontDefinition[] fontDefinitions = themeRegistry.getFontsFor(currentTheme.getId());
+ for (int i = 0; i < fontDefinitions.length; i++) {
+ if (!fontDefinitions[i].isEditable()) {
continue;
}
- String catId = fontDefinitions[i].getCategoryId();
- if ((catId == null && categoryId == null)
- || (catId != null && categoryId != null && categoryId
- .equals(catId))) {
- if (fontDefinitions[i].getDefaultsTo() != null
- && parentIsInSameCategory(fontDefinitions[i])) {
+ String catId = fontDefinitions[i].getCategoryId();
+ if ((catId == null && categoryId == null)
+ || (catId != null && categoryId != null && categoryId.equals(catId))) {
+ if (fontDefinitions[i].getDefaultsTo() != null && parentIsInSameCategory(fontDefinitions[i])) {
continue;
}
- list.add(fontDefinitions[i]);
- }
- }
- }
- return list.toArray(new Object[list.size()]);
- }
-
- private boolean parentIsInSameCategory(ColorDefinition definition) {
- String defaultsTo = definition.getDefaultsTo();
+ list.add(fontDefinitions[i]);
+ }
+ }
+ }
+ return list.toArray(new Object[list.size()]);
+ }
+
+ private boolean parentIsInSameCategory(ColorDefinition definition) {
+ String defaultsTo = definition.getDefaultsTo();
for (ColorDefinition colorDef : registry.getColors()) {
- if (colorDef.getId().equals(defaultsTo) && ColorsAndFontsPreferencePage.equals(colorDef
- .getCategoryId(), definition.getCategoryId())) {
+ if (colorDef.getId().equals(defaultsTo)
+ && ColorsAndFontsPreferencePage.equals(colorDef.getCategoryId(), definition.getCategoryId())) {
return true;
}
- }
- return false;
- }
+ }
+ return false;
+ }
- private boolean parentIsInSameCategory(FontDefinition definition) {
- String defaultsTo = definition.getDefaultsTo();
+ private boolean parentIsInSameCategory(FontDefinition definition) {
+ String defaultsTo = definition.getDefaultsTo();
for (FontDefinition fontDef : registry.getFonts()) {
- if (fontDef.getId().equals(defaultsTo) && ColorsAndFontsPreferencePage.equals(fontDef
- .getCategoryId(), definition.getCategoryId())) {
+ if (fontDef.getId().equals(defaultsTo)
+ && ColorsAndFontsPreferencePage.equals(fontDef.getCategoryId(), definition.getCategoryId())) {
return true;
}
- }
- return false;
- }
+ }
+ return false;
+ }
- @Override
+ @Override
public Object getParent(Object element) {
if (element instanceof ThemeElementCategory)
return registry;
@@ -275,11 +266,11 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
}
return null;
- }
+ }
- @Override
+ @Override
public boolean hasChildren(Object element) {
- if (element instanceof ThemeElementCategory) {
+ if (element instanceof ThemeElementCategory) {
return true;
}
@@ -293,24 +284,23 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
}
for (IHierarchalThemeElementDefinition elementDefinition : defs) {
- if (id.equals(elementDefinition.getDefaultsTo())
- && ColorsAndFontsPreferencePage.equals(
- ((ICategorizedThemeElementDefinition) def).getCategoryId(),
- ((ICategorizedThemeElementDefinition) elementDefinition).getCategoryId())) {
+ if (id.equals(elementDefinition.getDefaultsTo()) && ColorsAndFontsPreferencePage.equals(
+ ((ICategorizedThemeElementDefinition) def).getCategoryId(),
+ ((ICategorizedThemeElementDefinition) elementDefinition).getCategoryId())) {
return true;
}
}
- return false;
- }
+ return false;
+ }
- @Override
+ @Override
public Object[] getElements(Object inputElement) {
- ArrayList list = new ArrayList();
- Object[] uncatChildren = getCategoryChildren(null);
- list.addAll(Arrays.asList(uncatChildren));
+ ArrayList list = new ArrayList();
+ Object[] uncatChildren = getCategoryChildren(null);
+ list.addAll(Arrays.asList(uncatChildren));
for (ThemeElementCategory category : ((IThemeRegistry) inputElement).getCategories()) {
- if (category.getParentId() == null) {
+ if (category.getParentId() == null) {
Set bindings = themeRegistry.getPresentationsBindingsFor(category);
if (bindings == null) {
Object[] children = getChildren(category);
@@ -318,40 +308,37 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
list.add(category);
}
}
- }
- }
- return list.toArray(new Object[list.size()]);
- }
+ }
+ }
+ return list.toArray(new Object[list.size()]);
+ }
- @Override
+ @Override
public void dispose() {
- categoryMap.clear();
- }
+ categoryMap.clear();
+ }
- @Override
+ @Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- categoryMap.clear();
- registry = (IThemeRegistry) newInput;
- }
+ categoryMap.clear();
+ registry = (IThemeRegistry) newInput;
+ }
- }
+ }
- private class PresentationLabelProvider extends LabelProvider implements
- IFontProvider,
- IColorProvider {
+ private class PresentationLabelProvider extends LabelProvider implements IFontProvider, IColorProvider {
- private HashMap fonts = new HashMap();
+ private HashMap fonts = new HashMap();
- private HashMap images = new HashMap();
+ private HashMap images = new HashMap();
- private int imageSize = -1;
+ private int imageSize = -1;
- private int usableImageSize = -1;
+ private int usableImageSize = -1;
- private IPropertyChangeListener listener = event -> {
+ private IPropertyChangeListener listener = event -> {
if (event.getNewValue() != null) {
- fireLabelProviderChanged(new LabelProviderChangedEvent(
- PresentationLabelProvider.this));
+ fireLabelProviderChanged(new LabelProviderChangedEvent(PresentationLabelProvider.this));
} else {
// Some theme definition element has been modified and we
// need to refresh the viewer
@@ -359,138 +346,129 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
}
};
- private Image emptyImage;
+ private Image emptyImage;
- public PresentationLabelProvider() {
- hookListeners();
- }
+ public PresentationLabelProvider() {
+ hookListeners();
+ }
- /**
- * Hook the listeners onto the various registries.
- */
- public void hookListeners() {
- colorRegistry.addListener(listener);
- fontRegistry.addListener(listener);
- }
+ /**
+ * Hook the listeners onto the various registries.
+ */
+ public void hookListeners() {
+ colorRegistry.addListener(listener);
+ fontRegistry.addListener(listener);
+ }
- @Override
+ @Override
public void dispose() {
- super.dispose();
- colorRegistry.removeListener(listener);
- fontRegistry.removeListener(listener);
- for (Iterator i = images.values().iterator(); i.hasNext();) {
- ((Image) i.next()).dispose();
- }
- images.clear();
-
- if (emptyImage != null) {
- emptyImage.dispose();
- emptyImage = null;
- }
-
- //clear the fonts.
- clearFontCache();
- }
-
- /**
- * Clears and disposes all fonts.
- */
- public void clearFontCache() {
- for (Iterator i = fonts.values().iterator(); i.hasNext();) {
- ((Font) i.next()).dispose();
- }
- fonts.clear();
- }
-
- /**
- * Clears and disposes all fonts and fires a label update.
- */
- public void clearFontCacheAndUpdate() {
- clearFontCache();
- fireLabelProviderChanged(new LabelProviderChangedEvent(
- PresentationLabelProvider.this));
- }
-
- @Override
+ super.dispose();
+ colorRegistry.removeListener(listener);
+ fontRegistry.removeListener(listener);
+ for (Iterator i = images.values().iterator(); i.hasNext();) {
+ ((Image) i.next()).dispose();
+ }
+ images.clear();
+
+ if (emptyImage != null) {
+ emptyImage.dispose();
+ emptyImage = null;
+ }
+
+ // clear the fonts.
+ clearFontCache();
+ }
+
+ /**
+ * Clears and disposes all fonts.
+ */
+ public void clearFontCache() {
+ for (Iterator i = fonts.values().iterator(); i.hasNext();) {
+ ((Font) i.next()).dispose();
+ }
+ fonts.clear();
+ }
+
+ /**
+ * Clears and disposes all fonts and fires a label update.
+ */
+ public void clearFontCacheAndUpdate() {
+ clearFontCache();
+ fireLabelProviderChanged(new LabelProviderChangedEvent(PresentationLabelProvider.this));
+ }
+
+ @Override
public Font getFont(Object element) {
- Display display = tree.getDisplay();
- if (element instanceof FontDefinition) {
- int parentHeight = tree.getViewer().getControl().getFont()
- .getFontData()[0].getHeight();
- Font baseFont = fontRegistry.get(((FontDefinition) element)
- .getId());
- Font font = (Font) fonts.get(baseFont);
- if (font == null) {
- FontData[] data = baseFont.getFontData();
- for (FontData fontData : data) {
- fontData.setHeight(parentHeight);
- }
- font = new Font(display, data);
-
- fonts.put(baseFont, font);
- }
- return font;
+ Display display = tree.getDisplay();
+ if (element instanceof FontDefinition) {
+ int parentHeight = tree.getViewer().getControl().getFont().getFontData()[0].getHeight();
+ Font baseFont = fontRegistry.get(((FontDefinition) element).getId());
+ Font font = (Font) fonts.get(baseFont);
+ if (font == null) {
+ FontData[] data = baseFont.getFontData();
+ for (FontData fontData : data) {
+ fontData.setHeight(parentHeight);
+ }
+ font = new Font(display, data);
+
+ fonts.put(baseFont, font);
+ }
+ return font;
}
- return JFaceResources.getDialogFont();
- }
+ return JFaceResources.getDialogFont();
+ }
- @Override
+ @Override
public Image getImage(Object element) {
- if (element instanceof ColorDefinition) {
+ if (element instanceof ColorDefinition) {
Display display = tree.getDisplay();
- Color c = colorRegistry
- .get(((ColorDefinition) element).getId());
+ Color c = colorRegistry.get(((ColorDefinition) element).getId());
Color foregroundColor = display.getSystemColor(SWT.COLOR_BLACK);
if (!isAvailableInCurrentTheme((ColorDefinition) element)) {
c = display.getSystemColor(SWT.COLOR_WHITE);
foregroundColor = display.getSystemColor(DEFINITION_NOT_AVAIL_COLOR);
}
- Image image = (Image) images.get(c);
+ Image image = (Image) images.get(c);
if (image == null) {
- ensureImageSize();
- image = new Image(display, imageSize, imageSize);
+ ensureImageSize();
+ image = new Image(display, imageSize, imageSize);
- GC gc = new GC(image);
- gc.setBackground(tree.getViewer().getControl()
- .getBackground());
- gc.setForeground(tree.getViewer().getControl()
- .getBackground());
- gc.drawRectangle(0, 0, imageSize - 1, imageSize - 1);
+ GC gc = new GC(image);
+ gc.setBackground(tree.getViewer().getControl().getBackground());
+ gc.setForeground(tree.getViewer().getControl().getBackground());
+ gc.drawRectangle(0, 0, imageSize - 1, imageSize - 1);
gc.setForeground(foregroundColor);
- gc.setBackground(c);
-
- int offset = (imageSize - usableImageSize) / 2;
- gc.drawRectangle(offset, offset, usableImageSize - offset,
- usableImageSize - offset);
- gc.fillRectangle(offset + 1, offset + 1, usableImageSize
- - offset - 1, usableImageSize - offset - 1);
- gc.dispose();
-
- images.put(c, image);
- }
- return image;
-
- } else if (element instanceof FontDefinition) {
- return workbench.getSharedImages().getImage(
- IWorkbenchGraphicConstants.IMG_OBJ_FONT);
- } else {
- return workbench.getSharedImages().getImage(
- IWorkbenchGraphicConstants.IMG_OBJ_THEME_CATEGORY);
- }
- }
-
- private void ensureImageSize() {
- if (imageSize == -1) {
- imageSize = tree.getViewer().getTree().getItemHeight();
- usableImageSize = Math.max(1, imageSize - 4);
- }
- }
-
- @Override
+ gc.setBackground(c);
+
+ int offset = (imageSize - usableImageSize) / 2;
+ gc.drawRectangle(offset, offset, usableImageSize - offset, usableImageSize - offset);
+ gc.fillRectangle(offset + 1, offset + 1, usableImageSize - offset - 1,
+ usableImageSize - offset - 1);
+ gc.dispose();
+
+ images.put(c, image);
+ }
+ return image;
+
+ } else if (element instanceof FontDefinition) {
+ return workbench.getSharedImages().getImage(IWorkbenchGraphicConstants.IMG_OBJ_FONT);
+ } else {
+ return workbench.getSharedImages().getImage(IWorkbenchGraphicConstants.IMG_OBJ_THEME_CATEGORY);
+ }
+ }
+
+ private void ensureImageSize() {
+ if (imageSize == -1) {
+ imageSize = tree.getViewer().getTree().getItemHeight();
+ usableImageSize = Math.max(1, imageSize - 4);
+ }
+ }
+
+ @Override
public String getText(Object element) {
- if (element instanceof IHierarchalThemeElementDefinition) {
- IHierarchalThemeElementDefinition themeElement = (IHierarchalThemeElementDefinition) element;
+ if (element instanceof IHierarchalThemeElementDefinition) {
+ IHierarchalThemeElementDefinition themeElement = (IHierarchalThemeElementDefinition) element;
if (themeElement.getDefaultsTo() != null) {
String myCategory = ((ICategorizedThemeElementDefinition) themeElement).getCategoryId();
ICategorizedThemeElementDefinition def;
@@ -508,24 +486,23 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
themeElement.getName(), def.getName());
}
}
- }
- return ((IThemeElementDefinition) element).getName();
- }
-
- /**
- * Return whether the element is set to default.
- *
- * @param def the definition
- * @return whether the element is set to default
- * @since 3.2
- */
+ }
+ return ((IThemeElementDefinition) element).getName();
+ }
+
+ /**
+ * Return whether the element is set to default.
+ *
+ * @param def the definition
+ * @return whether the element is set to default
+ * @since 3.2
+ */
private boolean isDefault(IThemeElementDefinition def) {
if (def instanceof FontDefinition) {
FontDefinition fontDef = (FontDefinition) def;
String defaultFontID = fontDef.getDefaultsTo();
- return defaultFontID != null
- && Arrays.equals(fontRegistry.getFontData(def.getId()),
- fontRegistry.getFontData(defaultFontID));
+ return defaultFontID != null && Arrays.equals(fontRegistry.getFontData(def.getId()),
+ fontRegistry.getFontData(defaultFontID));
}
if (def instanceof ColorDefinition) {
ColorDefinition colorDef = (ColorDefinition) def;
@@ -533,23 +510,22 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
if (defaultColorID == null)
return false;
RGB defaultRGB = colorRegistry.getRGB(defaultColorID);
- return defaultRGB != null
- && defaultRGB.equals(colorRegistry.getRGB(colorDef.getId()));
+ return defaultRGB != null && defaultRGB.equals(colorRegistry.getRGB(colorDef.getId()));
}
return false;
}
/**
- * Returns the DEFINITION_NOT_AVAIL_COLOR color when definition is not
- * present in the current theme or null when it is available
+ * Returns the DEFINITION_NOT_AVAIL_COLOR color when definition is not present
+ * in the current theme or null when it is available
*
- * @param def
- * the definition
+ * @param def the definition
* @return the DEFINITION_NOT_AVAIL_COLOR color or null
*/
@Override
public Color getForeground(Object element) {
- if (element instanceof ThemeElementDefinition && !isAvailableInCurrentTheme((ThemeElementDefinition) element)) {
+ if (element instanceof ThemeElementDefinition
+ && !isAvailableInCurrentTheme((ThemeElementDefinition) element)) {
return tree.getDisplay().getSystemColor(DEFINITION_NOT_AVAIL_COLOR);
}
return null;
@@ -559,50 +535,49 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
public Color getBackground(Object element) {
return null;
}
- }
+ }
- /**
- * The translation bundle in which to look up internationalized text.
- */
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
- .getBundle(ColorsAndFontsPreferencePage.class.getName());
+ /**
+ * The translation bundle in which to look up internationalized text.
+ */
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+ .getBundle(ColorsAndFontsPreferencePage.class.getName());
- /**
- * Map to precalculate category color lists.
- */
- private Map categoryMap = new HashMap(7);
+ /**
+ * Map to precalculate category color lists.
+ */
+ private Map categoryMap = new HashMap(7);
- private Font appliedDialogFont;
+ private Font appliedDialogFont;
- /**
- * Map of definition ColorDefinition->RGB capturing the explicit changes
- * made by the user. These changes need to be stored into the preference
- * store.
+ /**
+ * Map of definition ColorDefinition->RGB capturing the explicit changes made by
+ * the user. These changes need to be stored into the preference store.
*/
private Map<ColorDefinition, RGB> colorPreferencesToSet = new HashMap<>(7);
- private CascadingColorRegistry colorRegistry;
+ private CascadingColorRegistry colorRegistry;
- /**
+ /**
* Map of definition id->RGB capturing the temporary changes caused by a
* 'defaultsTo' color change.
*/
- private Map colorValuesToSet = new HashMap(7);
+ private Map colorValuesToSet = new HashMap(7);
- /**
- * The default color preview composite.
- */
- private Composite defaultColorPreview;
+ /**
+ * The default color preview composite.
+ */
+ private Composite defaultColorPreview;
- /**
- * The default font preview composite.
- */
- private Composite defaultFontPreview;
+ /**
+ * The default font preview composite.
+ */
+ private Composite defaultFontPreview;
- /**
- * The composite to use when no preview is available.
- */
- private Composite defaultNoPreview;
+ /**
+ * The composite to use when no preview is available.
+ */
+ private Composite defaultNoPreview;
/**
* Currently selected font for preview; might be null.
@@ -626,9 +601,9 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
private String fontSampleText;
- private List dialogFontWidgets = new ArrayList();
+ private List dialogFontWidgets = new ArrayList();
- private Button fontChangeButton;
+ private Button fontChangeButton;
/**
* The button to edit the default of the selected element.
@@ -652,63 +627,61 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
private Button expandAllButton;
/**
- * Map of definition FontDefinition->FontData[] capturing the changes
- * explicitly made by the user. These changes need to be stored into the
- * preference store.
+ * Map of definition FontDefinition->FontData[] capturing the changes explicitly
+ * made by the user. These changes need to be stored into the preference store.
*/
- private Map<FontDefinition, FontData[]> fontPreferencesToSet = new HashMap<>(
- 7);
+ private Map<FontDefinition, FontData[]> fontPreferencesToSet = new HashMap<>(7);
- private CascadingFontRegistry fontRegistry;
+ private CascadingFontRegistry fontRegistry;
- private Button fontResetButton;
+ private Button fontResetButton;
- private Button fontSystemButton;
+ private Button fontSystemButton;
/**
- * Map of definition id->FontData[] capturing the temporary changes caused
- * by a 'defaultsTo' font change.
+ * Map of definition id->FontData[] capturing the temporary changes caused by a
+ * 'defaultsTo' font change.
*
- * @deprecated in this page, we should only care about preferences,
- * preference to fontValues synchronization in registry is
- * handled in the ThemeAPI and listeners
+ * @deprecated in this page, we should only care about preferences, preference
+ * to fontValues synchronization in registry is handled in the
+ * ThemeAPI and listeners
*/
@Deprecated
- private Map fontValuesToSet = new HashMap(7);
+ private Map fontValuesToSet = new HashMap(7);
- /**
- * The composite that is parent to all previews.
- */
- private Composite previewComposite;
+ /**
+ * The composite that is parent to all previews.
+ */
+ private Composite previewComposite;
- /**
- * A mapping from PresentationCategory->Composite for the created previews.
- */
- private Map previewMap = new HashMap(7);
+ /**
+ * A mapping from PresentationCategory->Composite for the created previews.
+ */
+ private Map previewMap = new HashMap(7);
- /**
- * Set containing all IPresentationPreviews created.
- */
- private Set previewSet = new HashSet(7);
+ /**
+ * Set containing all IPresentationPreviews created.
+ */
+ private Set previewSet = new HashSet(7);
- /**
- * The layout for the previewComposite.
- */
- private StackLayout stackLayout;
+ /**
+ * The layout for the previewComposite.
+ */
+ private StackLayout stackLayout;
- private final IThemeRegistry themeRegistry;
+ private final IThemeRegistry themeRegistry;
- private ITheme currentTheme;
+ private ITheme currentTheme;
- private PresentationLabelProvider labelProvider;
+ private PresentationLabelProvider labelProvider;
private CascadingThemeExt cascadingTheme;
- private IPropertyChangeListener themeChangeListener;
+ private IPropertyChangeListener themeChangeListener;
- private Workbench workbench;
+ private Workbench workbench;
- private FilteredTree tree;
+ private FilteredTree tree;
private Text descriptionText;
@@ -730,8 +703,7 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
}
private boolean isAnyThemeChanged() {
- return currentTheme != workbench.getThemeManager().getCurrentTheme()
- || currentCSSTheme != getActiveTheme();
+ return currentTheme != workbench.getThemeManager().getCurrentTheme() || currentCSSTheme != getActiveTheme();
}
};
@@ -739,13 +711,13 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
private IThemeEngine themeEngine;
- /**
- * Create a new instance of the receiver.
- */
- public ColorsAndFontsPreferencePage() {
- themeRegistry = WorkbenchPlugin.getDefault().getThemeRegistry();
- //no-op
- }
+ /**
+ * Create a new instance of the receiver.
+ */
+ public ColorsAndFontsPreferencePage() {
+ themeRegistry = WorkbenchPlugin.getDefault().getThemeRegistry();
+ // no-op
+ }
/**
* {@inheritDoc}
@@ -759,8 +731,7 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
* </li>
* </p>
*
- * @param data
- * the data to be applied
+ * @param data the data to be applied
*/
@Override
public void applyData(Object data) {
@@ -794,8 +765,7 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
/**
* Selects and reveals the given element.
*
- * @param selection
- * the object to select and reveal
+ * @param selection the object to select and reveal
* @since 3.7
*/
private void selectAndReveal(Object selection) {
@@ -805,21 +775,21 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
viewer.getTree().setFocus();
}
- private static boolean equals(String string, String string2) {
- if ((string == null && string2 == null))
+ private static boolean equals(String string, String string2) {
+ if ((string == null && string2 == null))
return true;
- if (string == null || string2 == null)
+ if (string == null || string2 == null)
return false;
- if (string.equals(string2))
+ if (string.equals(string2))
return true;
- return false;
- }
+ return false;
+ }
/**
* Get the active theme.
*
- * @return the active theme if there is one; <code>null</code> if there
- * isn't or {@link #themeEngine} is <code>null</code>.
+ * @return the active theme if there is one; <code>null</code> if there isn't or
+ * {@link #themeEngine} is <code>null</code>.
*/
private org.eclipse.e4.ui.css.swt.theme.ITheme getActiveTheme() {
if (themeEngine != null) {
@@ -828,19 +798,20 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
return null;
}
- /**
- * Create a button for the preference page.
- * @param parent
- * @param label
- */
- private Button createButton(Composite parent, String label) {
- Button button = new Button(parent, SWT.PUSH | SWT.CENTER);
- button.setText(label);
- myApplyDialogFont(button);
- setButtonLayoutData(button);
- button.setEnabled(false);
- return button;
- }
+ /**
+ * Create a button for the preference page.
+ *
+ * @param parent
+ * @param label
+ */
+ private Button createButton(Composite parent, String label) {
+ Button button = new Button(parent, SWT.PUSH | SWT.CENTER);
+ button.setText(label);
+ myApplyDialogFont(button);
+ setButtonLayoutData(button);
+ button.setEnabled(false);
+ return button;
+ }
private Label createSeparator(Composite parent) {
Label separator = new Label(parent, SWT.NONE);
@@ -854,12 +825,12 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
return separator;
}
- @Override
+ @Override
protected Control createContents(Composite parent) {
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IWorkbenchHelpContextIds.FONTS_PREFERENCE_PAGE);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IWorkbenchHelpContextIds.FONTS_PREFERENCE_PAGE);
- parent.addDisposeListener(e -> {
- if (appliedDialogFont != null)
+ parent.addDisposeListener(e -> {
+ if (appliedDialogFont != null)
appliedDialogFont.dispose();
});
@@ -867,65 +838,65 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
GridData sashData = new GridData(SWT.FILL, SWT.FILL, true, true);
advancedComposite.setLayoutData(sashData);
- Composite mainColumn = new Composite(advancedComposite, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- mainColumn.setFont(parent.getFont());
- mainColumn.setLayout(layout);
-
- GridData data = new GridData(GridData.BEGINNING);
- data.horizontalSpan = 2;
- Label label = new Label(mainColumn, SWT.LEFT);
- label.setText(RESOURCE_BUNDLE.getString("colorsAndFonts")); //$NON-NLS-1$
- myApplyDialogFont(label);
- label.setLayoutData(data);
-
- createTree(mainColumn);
-
- // --- buttons
- Composite controlColumn = new Composite(mainColumn, SWT.NONE);
- data = new GridData(GridData.FILL_VERTICAL);
- controlColumn.setLayoutData(data);
- layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- controlColumn.setLayout(layout);
-
- // we need placeholder to offset the filter control of the table
- Label placeholder = new Label(controlColumn, SWT.NONE);
- GridData placeholderData = new GridData(SWT.TOP);
- placeholderData.heightHint = convertVerticalDLUsToPixels(12);
- placeholder.setLayoutData(placeholderData);
+ Composite mainColumn = new Composite(advancedComposite, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ mainColumn.setFont(parent.getFont());
+ mainColumn.setLayout(layout);
+
+ GridData data = new GridData(GridData.BEGINNING);
+ data.horizontalSpan = 2;
+ Label label = new Label(mainColumn, SWT.LEFT);
+ label.setText(RESOURCE_BUNDLE.getString("colorsAndFonts")); //$NON-NLS-1$
+ myApplyDialogFont(label);
+ label.setLayoutData(data);
+
+ createTree(mainColumn);
+
+ // --- buttons
+ Composite controlColumn = new Composite(mainColumn, SWT.NONE);
+ data = new GridData(GridData.FILL_VERTICAL);
+ controlColumn.setLayoutData(data);
+ layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ controlColumn.setLayout(layout);
+
+ // we need placeholder to offset the filter control of the table
+ Label placeholder = new Label(controlColumn, SWT.NONE);
+ GridData placeholderData = new GridData(SWT.TOP);
+ placeholderData.heightHint = convertVerticalDLUsToPixels(12);
+ placeholder.setLayoutData(placeholderData);
fontChangeButton = createButton(controlColumn, RESOURCE_BUNDLE.getString("openChange")); //$NON-NLS-1$
- fontSystemButton = createButton(controlColumn, WorkbenchMessages.FontsPreference_useSystemFont);
- fontResetButton = createButton(controlColumn, RESOURCE_BUNDLE.getString("reset")); //$NON-NLS-1$
+ fontSystemButton = createButton(controlColumn, WorkbenchMessages.FontsPreference_useSystemFont);
+ fontResetButton = createButton(controlColumn, RESOURCE_BUNDLE.getString("reset")); //$NON-NLS-1$
createSeparator(controlColumn);
editDefaultButton = createButton(controlColumn, RESOURCE_BUNDLE.getString("editDefault")); //$NON-NLS-1$
goToDefaultButton = createButton(controlColumn, RESOURCE_BUNDLE.getString("goToDefault")); //$NON-NLS-1$
createSeparator(controlColumn);
expandAllButton = createButton(controlColumn, RESOURCE_BUNDLE.getString("expandAll")); //$NON-NLS-1$
expandAllButton.setEnabled(true);
- // --- end of buttons
+ // --- end of buttons
createDescriptionControl(mainColumn);
Composite previewColumn = new Composite(advancedComposite, SWT.NONE);
- GridLayout previewLayout = new GridLayout();
+ GridLayout previewLayout = new GridLayout();
previewLayout.marginTop = 7;
previewLayout.marginWidth = 0;
previewLayout.marginHeight = 0;
- previewColumn.setFont(parent.getFont());
- previewColumn.setLayout(previewLayout);
+ previewColumn.setFont(parent.getFont());
+ previewColumn.setLayout(previewLayout);
- // --- create preview control
+ // --- create preview control
Composite composite = new Composite(previewColumn, SWT.NONE);
- GridData data2 = new GridData(GridData.FILL_BOTH);
- composite.setLayoutData(data2);
- GridLayout layout2 = new GridLayout(1, true);
+ GridData data2 = new GridData(GridData.FILL_BOTH);
+ composite.setLayoutData(data2);
+ GridLayout layout2 = new GridLayout(1, true);
layout2.marginHeight = 0;
layout2.marginWidth = 0;
composite.setLayout(layout2);
@@ -934,33 +905,31 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
label2.setText(RESOURCE_BUNDLE.getString("preview")); //$NON-NLS-1$
myApplyDialogFont(label2);
- previewComposite = new Composite(composite, SWT.NONE);
- previewComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
- stackLayout = new StackLayout();
- stackLayout.marginHeight = 0;
- stackLayout.marginWidth = 0;
- previewComposite.setLayout(stackLayout);
- // -- end of preview control
-
+ previewComposite = new Composite(composite, SWT.NONE);
+ previewComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ stackLayout = new StackLayout();
+ stackLayout.marginHeight = 0;
+ stackLayout.marginWidth = 0;
+ previewComposite.setLayout(stackLayout);
+ // -- end of preview control
defaultFontPreview = createFontPreviewControl();
defaultColorPreview = createColorPreviewControl();
defaultNoPreview = createNoPreviewControl();
- hookListeners();
+ hookListeners();
- updateTreeSelection(tree.getViewer().getSelection());
+ updateTreeSelection(tree.getViewer().getSelection());
advancedComposite.setWeights(new int[] { 75, 25 });
- return advancedComposite;
- }
+ return advancedComposite;
+ }
/**
- * Create the <code>ListViewer</code> that will contain all color
- * definitions as defined in the extension point.
+ * Create the <code>ListViewer</code> that will contain all color definitions as
+ * defined in the extension point.
*
- * @param parent
- * the parent <code>Composite</code>.
+ * @param parent the parent <code>Composite</code>.
*/
private void createTree(Composite parent) {
labelProvider = new PresentationLabelProvider();
@@ -1005,8 +974,7 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
};
filter.setIncludeLeadingWildcard(true);
- tree = new FilteredTree(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER,
- filter, true);
+ tree = new FilteredTree(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER, filter, true);
tree.setQuickSelectionMode(true);
GridData data = new GridData(GridData.FILL_BOTH | GridData.VERTICAL_ALIGN_FILL);
data.widthHint = Math.max(285, convertWidthInCharsToPixels(30));
@@ -1032,16 +1000,14 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
IStructuredSelection s = (IStructuredSelection) event.getSelection();
Object element = s.getFirstElement();
if (tree.getViewer().isExpandable(element))
- tree.getViewer().setExpandedState(element,
- !tree.getViewer().getExpandedState(element));
+ tree.getViewer().setExpandedState(element, !tree.getViewer().getExpandedState(element));
if (element instanceof ThemeElementDefinition) {
ThemeElementDefinition definition = (ThemeElementDefinition) element;
if (element instanceof FontDefinition) {
editFont(tree.getDisplay());
- } else if (element instanceof ColorDefinition
- && isAvailableInCurrentTheme(definition)) {
+ } else if (element instanceof ColorDefinition && isAvailableInCurrentTheme(definition)) {
editColor(tree.getDisplay());
}
updateControls();
@@ -1052,183 +1018,181 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
restoreTreeSelection();
}
- @Override
+ @Override
public void dispose() {
eventBroker.unsubscribe(themeRegistryRestyledHandler);
- workbench.getThemeManager().removePropertyChangeListener(themeChangeListener);
- clearPreviews();
- colorRegistry.dispose();
- fontRegistry.dispose();
+ workbench.getThemeManager().removePropertyChangeListener(themeChangeListener);
+ clearPreviews();
+ colorRegistry.dispose();
+ fontRegistry.dispose();
super.dispose();
- }
+ }
- /**
- * Clear all previews.
- */
- private void clearPreviews() {
- if (cascadingTheme != null)
+ /**
+ * Clear all previews.
+ */
+ private void clearPreviews() {
+ if (cascadingTheme != null)
cascadingTheme.dispose();
- for (Iterator i = previewSet.iterator(); i.hasNext();) {
- IThemePreview preview = (IThemePreview) i.next();
- try {
- preview.dispose();
- } catch (RuntimeException e) {
- WorkbenchPlugin.log(RESOURCE_BUNDLE.getString("errorDisposePreviewLog"), //$NON-NLS-1$
- StatusUtil.newStatus(IStatus.ERROR, e.getMessage(), e));
- }
- }
- previewSet.clear();
- }
-
- /**
- * Get the ancestor of the given color, if any.
- *
- * @param definition the descendant <code>ColorDefinition</code>.
- * @return the ancestor <code>ColorDefinition</code>, or <code>null</code>
- * if none.
- */
- private ColorDefinition getColorAncestor(ColorDefinition definition) {
- String defaultsTo = definition.getDefaultsTo();
- if (defaultsTo == null)
+ for (Iterator i = previewSet.iterator(); i.hasNext();) {
+ IThemePreview preview = (IThemePreview) i.next();
+ try {
+ preview.dispose();
+ } catch (RuntimeException e) {
+ WorkbenchPlugin.log(RESOURCE_BUNDLE.getString("errorDisposePreviewLog"), //$NON-NLS-1$
+ StatusUtil.newStatus(IStatus.ERROR, e.getMessage(), e));
+ }
+ }
+ previewSet.clear();
+ }
+
+ /**
+ * Get the ancestor of the given color, if any.
+ *
+ * @param definition the descendant <code>ColorDefinition</code>.
+ * @return the ancestor <code>ColorDefinition</code>, or <code>null</code> if
+ * none.
+ */
+ private ColorDefinition getColorAncestor(ColorDefinition definition) {
+ String defaultsTo = definition.getDefaultsTo();
+ if (defaultsTo == null)
return null;
- return themeRegistry.findColor(defaultsTo);
- }
-
- /**
- * Get the RGB value of the given colors ancestor, if any.
- *
- * @param definition the descendant <code>ColorDefinition</code>.
- * @return the ancestor <code>RGB</code>, or <code>null</code> if none.
- */
- private RGB getColorAncestorValue(ColorDefinition definition) {
- ColorDefinition ancestor = getColorAncestor(definition);
- if (ancestor == null)
+ return themeRegistry.findColor(defaultsTo);
+ }
+
+ /**
+ * Get the RGB value of the given colors ancestor, if any.
+ *
+ * @param definition the descendant <code>ColorDefinition</code>.
+ * @return the ancestor <code>RGB</code>, or <code>null</code> if none.
+ */
+ private RGB getColorAncestorValue(ColorDefinition definition) {
+ ColorDefinition ancestor = getColorAncestor(definition);
+ if (ancestor == null)
return null;
- return getColorValue(ancestor);
- }
-
- /**
- * Get the RGB value for the specified definition. Cascades through
- * preferenceToSet, valuesToSet and finally the registry.
- *
- * @param definition the <code>ColorDefinition</code>.
- * @return the <code>RGB</code> value.
- */
- private RGB getColorValue(ColorDefinition definition) {
- String id = definition.getId();
+ return getColorValue(ancestor);
+ }
+
+ /**
+ * Get the RGB value for the specified definition. Cascades through
+ * preferenceToSet, valuesToSet and finally the registry.
+ *
+ * @param definition the <code>ColorDefinition</code>.
+ * @return the <code>RGB</code> value.
+ */
+ private RGB getColorValue(ColorDefinition definition) {
+ String id = definition.getId();
RGB updatedRGB = colorPreferencesToSet.get(definition);
- if (updatedRGB == null) {
- updatedRGB = (RGB) colorValuesToSet.get(id);
- if (updatedRGB == null)
+ if (updatedRGB == null) {
+ updatedRGB = (RGB) colorValuesToSet.get(id);
+ if (updatedRGB == null)
updatedRGB = currentTheme.getColorRegistry().getRGB(id);
- }
- return updatedRGB;
- }
-
- /**
- * Get colors that descend from the provided color.
- *
- * @param definition the ancestor <code>ColorDefinition</code>.
- * @return the ColorDefinitions that have the provided definition as their
- * defaultsTo attribute.
- */
- private ColorDefinition[] getDescendantColors(ColorDefinition definition) {
- List list = new ArrayList(5);
- String id = definition.getId();
-
- ColorDefinition[] colors = themeRegistry.getColors();
- ColorDefinition[] sorted = new ColorDefinition[colors.length];
- System.arraycopy(colors, 0, sorted, 0, sorted.length);
-
- Arrays.sort(sorted, new IThemeRegistry.HierarchyComparator(colors));
-
- for (ColorDefinition colorDefinition : sorted) {
- if (id.equals(colorDefinition.getDefaultsTo()))
+ }
+ return updatedRGB;
+ }
+
+ /**
+ * Get colors that descend from the provided color.
+ *
+ * @param definition the ancestor <code>ColorDefinition</code>.
+ * @return the ColorDefinitions that have the provided definition as their
+ * defaultsTo attribute.
+ */
+ private ColorDefinition[] getDescendantColors(ColorDefinition definition) {
+ List list = new ArrayList(5);
+ String id = definition.getId();
+
+ ColorDefinition[] colors = themeRegistry.getColors();
+ ColorDefinition[] sorted = new ColorDefinition[colors.length];
+ System.arraycopy(colors, 0, sorted, 0, sorted.length);
+
+ Arrays.sort(sorted, new IThemeRegistry.HierarchyComparator(colors));
+
+ for (ColorDefinition colorDefinition : sorted) {
+ if (id.equals(colorDefinition.getDefaultsTo()))
list.add(colorDefinition);
- }
- return (ColorDefinition[]) list.toArray(new ColorDefinition[list.size()]);
- }
+ }
+ return (ColorDefinition[]) list.toArray(new ColorDefinition[list.size()]);
+ }
- private FontDefinition[] getDescendantFonts(FontDefinition definition) {
- List list = new ArrayList(5);
- String id = definition.getId();
+ private FontDefinition[] getDescendantFonts(FontDefinition definition) {
+ List list = new ArrayList(5);
+ String id = definition.getId();
- FontDefinition[] fonts = themeRegistry.getFonts();
- FontDefinition[] sorted = new FontDefinition[fonts.length];
- System.arraycopy(fonts, 0, sorted, 0, sorted.length);
+ FontDefinition[] fonts = themeRegistry.getFonts();
+ FontDefinition[] sorted = new FontDefinition[fonts.length];
+ System.arraycopy(fonts, 0, sorted, 0, sorted.length);
- Arrays.sort(sorted, new IThemeRegistry.HierarchyComparator(fonts));
+ Arrays.sort(sorted, new IThemeRegistry.HierarchyComparator(fonts));
- for (FontDefinition fontDefinition : sorted) {
- if (id.equals(fontDefinition.getDefaultsTo()))
+ for (FontDefinition fontDefinition : sorted) {
+ if (id.equals(fontDefinition.getDefaultsTo()))
list.add(fontDefinition);
- }
- return (FontDefinition[]) list.toArray(new FontDefinition[list.size()]);
- }
+ }
+ return (FontDefinition[]) list.toArray(new FontDefinition[list.size()]);
+ }
- private FontDefinition getFontAncestor(FontDefinition definition) {
- String defaultsTo = definition.getDefaultsTo();
- if (defaultsTo == null)
+ private FontDefinition getFontAncestor(FontDefinition definition) {
+ String defaultsTo = definition.getDefaultsTo();
+ if (defaultsTo == null)
return null;
- return themeRegistry.findFont(defaultsTo);
- }
+ return themeRegistry.findFont(defaultsTo);
+ }
- private FontData[] getFontAncestorValue(FontDefinition definition) {
- FontDefinition ancestor = getFontAncestor(definition);
- if (ancestor == null) {
- return PreferenceConverter.getDefaultFontDataArray(
-getPreferenceStore(),
- createPreferenceKey(definition));
+ private FontData[] getFontAncestorValue(FontDefinition definition) {
+ FontDefinition ancestor = getFontAncestor(definition);
+ if (ancestor == null) {
+ return PreferenceConverter.getDefaultFontDataArray(getPreferenceStore(), createPreferenceKey(definition));
}
- return getFontValue(ancestor);
- }
+ return getFontValue(ancestor);
+ }
- protected FontData[] getFontValue(FontDefinition definition) {
- String id = definition.getId();
+ protected FontData[] getFontValue(FontDefinition definition) {
+ String id = definition.getId();
FontData[] updatedFD = fontPreferencesToSet.get(definition);
- if (updatedFD == null) {
- updatedFD = (FontData[]) fontValuesToSet.get(id);
- if (updatedFD == null)
+ if (updatedFD == null) {
+ updatedFD = (FontData[]) fontValuesToSet.get(id);
+ if (updatedFD == null)
updatedFD = currentTheme.getFontRegistry().getFontData(id);
- }
- return updatedFD;
- }
+ }
+ return updatedFD;
+ }
- protected ColorDefinition getSelectedColorDefinition() {
+ protected ColorDefinition getSelectedColorDefinition() {
Object o = tree.getViewer().getStructuredSelection().getFirstElement();
if (o instanceof ColorDefinition) {
return themeRegistry.findColor(((ColorDefinition) o).getId());
}
- return null;
- }
+ return null;
+ }
- protected FontDefinition getSelectedFontDefinition() {
+ protected FontDefinition getSelectedFontDefinition() {
Object o = tree.getViewer().getStructuredSelection().getFirstElement();
if (o instanceof FontDefinition) {
return themeRegistry.findFont(((FontDefinition) o).getId());
}
- return null;
- }
+ return null;
+ }
- protected boolean isFontSelected() {
+ protected boolean isFontSelected() {
Object o = tree.getViewer().getStructuredSelection().getFirstElement();
- return (o instanceof FontDefinition);
- }
+ return (o instanceof FontDefinition);
+ }
- protected boolean isColorSelected() {
+ protected boolean isColorSelected() {
Object o = tree.getViewer().getStructuredSelection().getFirstElement();
- return (o instanceof ColorDefinition);
- }
-
- /**
- * Hook all control listeners.
- */
- private void hookListeners() {
- TreeViewer viewer = tree.getViewer();
+ return (o instanceof ColorDefinition);
+ }
+
+ /**
+ * Hook all control listeners.
+ */
+ private void hookListeners() {
+ TreeViewer viewer = tree.getViewer();
viewer.addSelectionChangedListener(event -> updateTreeSelection(event.getSelection()));
- fontChangeButton.addSelectionListener(widgetSelectedAdapter(event -> {
+ fontChangeButton.addSelectionListener(widgetSelectedAdapter(event -> {
Display display = event.display;
if (isFontSelected())
editFont(display);
@@ -1237,7 +1201,7 @@ getPreferenceStore(),
updateControls();
}));
- fontResetButton.addSelectionListener(widgetSelectedAdapter(e -> {
+ fontResetButton.addSelectionListener(widgetSelectedAdapter(e -> {
if (isFontSelected())
resetFont(getSelectedFontDefinition(), false);
else if (isColorSelected())
@@ -1245,13 +1209,13 @@ getPreferenceStore(),
updateControls();
}));
- fontSystemButton.addSelectionListener(widgetSelectedAdapter(event -> {
- FontDefinition definition = getSelectedFontDefinition();
- if (definition == null)
- return;
- FontData[] defaultFontData = JFaceResources.getDefaultFont().getFontData();
+ fontSystemButton.addSelectionListener(widgetSelectedAdapter(event -> {
+ FontDefinition definition = getSelectedFontDefinition();
+ if (definition == null)
+ return;
+ FontData[] defaultFontData = JFaceResources.getDefaultFont().getFontData();
setFontPreferenceValue(definition, defaultFontData, false);
- updateControls();
+ updateControls();
}));
editDefaultButton.addSelectionListener(widgetSelectedAdapter(event -> {
@@ -1265,8 +1229,7 @@ getPreferenceStore(),
ColorDefinition colorDefinition = getSelectedColorDefinition();
if (colorDefinition != null) {
String defaultColorId = colorDefinition.getDefaultsTo();
- ColorDefinition defaultColorDefinition = themeRegistry
- .findColor(defaultColorId);
+ ColorDefinition defaultColorDefinition = themeRegistry.findColor(defaultColorId);
editColor(defaultColorDefinition, display);
}
}
@@ -1283,8 +1246,7 @@ getPreferenceStore(),
ColorDefinition colorDefinition = getSelectedColorDefinition();
if (colorDefinition != null) {
String defaultColorId = colorDefinition.getDefaultsTo();
- ColorDefinition defaultColorDefinition = themeRegistry
- .findColor(defaultColorId);
+ ColorDefinition defaultColorDefinition = themeRegistry.findColor(defaultColorId);
selectAndReveal(defaultColorDefinition);
}
}
@@ -1293,85 +1255,83 @@ getPreferenceStore(),
expandAllButton.addSelectionListener(widgetSelectedAdapter(event -> tree.getViewer().expandAll()));
- }
+ }
- @Override
+ @Override
public void init(IWorkbench aWorkbench) {
- this.workbench = (Workbench) aWorkbench;
+ this.workbench = (Workbench) aWorkbench;
themeEngine = workbench.getService(IThemeEngine.class);
- setPreferenceStore(PrefUtil.getInternalPreferenceStore());
-
- final IThemeManager themeManager = aWorkbench.getThemeManager();
- themeChangeListener = event -> {
- if (event.getProperty().equals(
- IThemeManager.CHANGE_CURRENT_THEME)) {
- updateThemeInfo(themeManager);
- refreshCategory();
+ setPreferenceStore(PrefUtil.getInternalPreferenceStore());
+
+ final IThemeManager themeManager = aWorkbench.getThemeManager();
+ themeChangeListener = event -> {
+ if (event.getProperty().equals(IThemeManager.CHANGE_CURRENT_THEME)) {
+ updateThemeInfo(themeManager);
+ refreshCategory();
refreshAllLabels();
- }
+ }
};
- themeManager.addPropertyChangeListener(themeChangeListener);
+ themeManager.addPropertyChangeListener(themeChangeListener);
- updateThemeInfo(themeManager);
+ updateThemeInfo(themeManager);
eventBroker = workbench.getService(IEventBroker.class);
- eventBroker.subscribe(WorkbenchThemeManager.Events.THEME_REGISTRY_RESTYLED,
- themeRegistryRestyledHandler);
- }
+ eventBroker.subscribe(WorkbenchThemeManager.Events.THEME_REGISTRY_RESTYLED, themeRegistryRestyledHandler);
+ }
- private void updateThemeInfo(IThemeManager manager) {
- clearPreviews();
- categoryMap.clear();
+ private void updateThemeInfo(IThemeManager manager) {
+ clearPreviews();
+ categoryMap.clear();
- if (labelProvider != null)
+ if (labelProvider != null)
labelProvider.dispose(); // nuke the old cache
- if (colorRegistry != null)
+ if (colorRegistry != null)
colorRegistry.dispose();
- if (fontRegistry != null)
+ if (fontRegistry != null)
fontRegistry.dispose();
- currentTheme = manager.getCurrentTheme();
+ currentTheme = manager.getCurrentTheme();
currentCSSTheme = getActiveTheme();
- colorRegistry = new CascadingColorRegistry(currentTheme.getColorRegistry());
- fontRegistry = new CascadingFontRegistry(currentTheme.getFontRegistry());
+ colorRegistry = new CascadingColorRegistry(currentTheme.getColorRegistry());
+ fontRegistry = new CascadingFontRegistry(currentTheme.getFontRegistry());
if (cascadingTheme != null) {
cascadingTheme.dispose();
cascadingTheme = new CascadingThemeExt(currentTheme, colorRegistry, fontRegistry);
}
- fontPreferencesToSet.clear();
- fontValuesToSet.clear();
+ fontPreferencesToSet.clear();
+ fontValuesToSet.clear();
- colorPreferencesToSet.clear();
- colorValuesToSet.clear();
+ colorPreferencesToSet.clear();
+ colorValuesToSet.clear();
- if (labelProvider != null)
+ if (labelProvider != null)
labelProvider.hookListeners(); // rehook the listeners
- }
-
- /**
- * Answers whether the definition is currently set to the default value.
- *
- * @param definition the <code>ColorDefinition</code> to check.
- * @return Return whether the definition is currently mapped to the default
- * value, either in the preference store or in the local change record
- * of this preference page.
- */
- private boolean isDefault(ColorDefinition definition) {
- String id = definition.getId();
+ }
+
+ /**
+ * Answers whether the definition is currently set to the default value.
+ *
+ * @param definition the <code>ColorDefinition</code> to check.
+ * @return Return whether the definition is currently mapped to the default
+ * value, either in the preference store or in the local change record
+ * of this preference page.
+ */
+ private boolean isDefault(ColorDefinition definition) {
+ String id = definition.getId();
if (colorPreferencesToSet.containsKey(definition)) {
- if (definition.getValue() != null) { // value-based color
+ if (definition.getValue() != null) { // value-based color
if (colorPreferencesToSet.get(definition).equals(definition.getValue()))
return true;
- } else {
+ } else {
if (colorPreferencesToSet.get(definition).equals(getColorAncestorValue(definition)))
return true;
- }
+ }
} else if (colorValuesToSet.containsKey(id)) {
if (definition.getValue() != null) { // value-based color
if (colorValuesToSet.get(id).equals(definition.getValue()))
@@ -1380,33 +1340,32 @@ getPreferenceStore(),
if (colorValuesToSet.get(id).equals(getColorAncestorValue(definition)))
return true;
}
- } else {
- if (definition.getValue() != null) { // value-based color
+ } else {
+ if (definition.getValue() != null) { // value-based color
if (getPreferenceStore().isDefault(createPreferenceKey(definition)))
return true;
- } else {
- // a descendant is default if it's the same value as its ancestor
+ } else {
+ // a descendant is default if it's the same value as its ancestor
RGB rgb = getColorValue(definition);
if (rgb != null && rgb.equals(getColorAncestorValue(definition)))
return true;
- }
- }
- return false;
- }
+ }
+ }
+ return false;
+ }
- private boolean isDefault(FontDefinition definition) {
- String id = definition.getId();
+ private boolean isDefault(FontDefinition definition) {
+ String id = definition.getId();
if (fontPreferencesToSet.containsKey(definition)) {
- if (definition.getValue() != null) { // value-based font
- if (Arrays.equals(fontPreferencesToSet.get(definition),
- definition.getValue()))
+ if (definition.getValue() != null) { // value-based font
+ if (Arrays.equals(fontPreferencesToSet.get(definition), definition.getValue()))
return true;
- } else {
- FontData[] ancestor = getFontAncestorValue(definition);
+ } else {
+ FontData[] ancestor = getFontAncestorValue(definition);
if (Arrays.equals(fontPreferencesToSet.get(definition), ancestor))
return true;
- }
+ }
} else if (fontValuesToSet.containsKey(id)) {
if (definition.getValue() != null) { // value-based font
if (Arrays.equals((FontData[]) fontValuesToSet.get(id), definition.getValue()))
@@ -1417,52 +1376,52 @@ getPreferenceStore(),
return true;
}
- } else {
- if (definition.getValue() != null) { // value-based font
+ } else {
+ if (definition.getValue() != null) { // value-based font
if (getPreferenceStore().isDefault(createPreferenceKey(definition)))
return true;
- } else {
- FontData[] ancestor = getFontAncestorValue(definition);
- if (ancestor == null)
+ } else {
+ FontData[] ancestor = getFontAncestorValue(definition);
+ if (ancestor == null)
return true;
- // a descendant is default if it's the same value as its ancestor
- if (Arrays.equals(getFontValue(definition), ancestor))
+ // a descendant is default if it's the same value as its ancestor
+ if (Arrays.equals(getFontValue(definition), ancestor))
return true;
- }
- }
- return false;
- }
-
- /**
- * Apply the dialog font to the control and store
- * it for later so that it can be used for a later
- * update.
- * @param control
- */
- private void myApplyDialogFont(Control control) {
- control.setFont(JFaceResources.getDialogFont());
- dialogFontWidgets.add(control);
- }
-
- /**
- * @see org.eclipse.jface.preference.PreferencePage#performApply()
- */
- @Override
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Apply the dialog font to the control and store it for later so that it can be
+ * used for a later update.
+ *
+ * @param control
+ */
+ private void myApplyDialogFont(Control control) {
+ control.setFont(JFaceResources.getDialogFont());
+ dialogFontWidgets.add(control);
+ }
+
+ /**
+ * @see org.eclipse.jface.preference.PreferencePage#performApply()
+ */
+ @Override
protected void performApply() {
- super.performApply();
+ super.performApply();
- //Apply the default font to the dialog.
- Font oldFont = appliedDialogFont;
- FontDefinition fontDefinition = themeRegistry.findFont(JFaceResources.DIALOG_FONT);
- if (fontDefinition == null)
+ // Apply the default font to the dialog.
+ Font oldFont = appliedDialogFont;
+ FontDefinition fontDefinition = themeRegistry.findFont(JFaceResources.DIALOG_FONT);
+ if (fontDefinition == null)
return;
- FontData[] newData = getFontValue(fontDefinition);
+ FontData[] newData = getFontValue(fontDefinition);
- appliedDialogFont = new Font(getControl().getDisplay(), newData);
+ appliedDialogFont = new Font(getControl().getDisplay(), newData);
- updateForDialogFontChange(appliedDialogFont);
- getApplyButton().setFont(appliedDialogFont);
- getDefaultsButton().setFont(appliedDialogFont);
+ updateForDialogFontChange(appliedDialogFont);
+ getApplyButton().setFont(appliedDialogFont);
+ getDefaultsButton().setFont(appliedDialogFont);
if (oldFont != null) {
oldFont.dispose();
@@ -1471,183 +1430,182 @@ getPreferenceStore(),
if (performColorOk() && performFontOk()) {
publishThemeRegistryModifiedEvent();
}
- }
+ }
- private void performColorDefaults() {
- ColorDefinition[] definitions = themeRegistry.getColors();
+ private void performColorDefaults() {
+ ColorDefinition[] definitions = themeRegistry.getColors();
- // apply defaults in depth-order.
- ColorDefinition[] definitionsCopy = new ColorDefinition[definitions.length];
- System.arraycopy(definitions, 0, definitionsCopy, 0,definitions.length);
+ // apply defaults in depth-order.
+ ColorDefinition[] definitionsCopy = new ColorDefinition[definitions.length];
+ System.arraycopy(definitions, 0, definitionsCopy, 0, definitions.length);
- Arrays.sort(definitionsCopy, new IThemeRegistry.HierarchyComparator(definitions));
+ Arrays.sort(definitionsCopy, new IThemeRegistry.HierarchyComparator(definitions));
- for (ColorDefinition colorDefinition : definitionsCopy) {
+ for (ColorDefinition colorDefinition : definitionsCopy) {
resetColor(colorDefinition, true);
}
- }
+ }
- private boolean performColorOk() {
+ private boolean performColorOk() {
for (Map.Entry<ColorDefinition, RGB> entry : colorPreferencesToSet.entrySet()) {
String key = createPreferenceKey(entry.getKey());
String rgbString = StringConverter.asString(entry.getValue());
- String storeString = getPreferenceStore().getString(key);
+ String storeString = getPreferenceStore().getString(key);
- if (!rgbString.equals(storeString))
- getPreferenceStore().setValue(key, rgbString);
- }
+ if (!rgbString.equals(storeString))
+ getPreferenceStore().setValue(key, rgbString);
+ }
- colorValuesToSet.clear();
- colorPreferencesToSet.clear();
- return true;
- }
+ colorValuesToSet.clear();
+ colorPreferencesToSet.clear();
+ return true;
+ }
private String createPreferenceKey(ThemeElementDefinition definition) {
if (definition.isOverridden() || definition.isAddedByCss()) {
- return ThemeElementHelper.createPreferenceKey(currentCSSTheme, currentTheme,
- definition.getId());
+ return ThemeElementHelper.createPreferenceKey(currentCSSTheme, currentTheme, definition.getId());
}
return ThemeElementHelper.createPreferenceKey(currentTheme, definition.getId());
}
- @Override
+ @Override
public void performDefaults() {
- performColorDefaults();
- performFontDefaults();
+ performColorDefaults();
+ performFontDefaults();
updateControls();
tree.getViewer().refresh();
- }
+ }
- private void performFontDefaults() {
- FontDefinition[] definitions = themeRegistry.getFonts();
+ private void performFontDefaults() {
+ FontDefinition[] definitions = themeRegistry.getFonts();
- // apply defaults in depth-order.
- FontDefinition[] definitionsCopy = new FontDefinition[definitions.length];
- System.arraycopy(definitions, 0, definitionsCopy, 0, definitions.length);
+ // apply defaults in depth-order.
+ FontDefinition[] definitionsCopy = new FontDefinition[definitions.length];
+ System.arraycopy(definitions, 0, definitionsCopy, 0, definitions.length);
- Arrays.sort(definitionsCopy, new IThemeRegistry.HierarchyComparator(definitions));
+ Arrays.sort(definitionsCopy, new IThemeRegistry.HierarchyComparator(definitions));
- for (FontDefinition fontDefinition : definitionsCopy) {
+ for (FontDefinition fontDefinition : definitionsCopy) {
resetFont(fontDefinition, true);
}
- }
+ }
- private boolean performFontOk() {
+ private boolean performFontOk() {
for (Map.Entry<FontDefinition, FontData[]> entry : fontPreferencesToSet.entrySet()) {
String key = createPreferenceKey(entry.getKey());
String fdString = PreferenceConverter.getStoredRepresentation(entry.getValue());
- String storeString = getPreferenceStore().getString(key);
+ String storeString = getPreferenceStore().getString(key);
- if (!fdString.equals(storeString))
- getPreferenceStore().setValue(key, fdString);
- }
+ if (!fdString.equals(storeString))
+ getPreferenceStore().setValue(key, fdString);
+ }
- fontValuesToSet.clear();
- fontPreferencesToSet.clear();
- return true;
- }
+ fontValuesToSet.clear();
+ fontPreferencesToSet.clear();
+ return true;
+ }
- @Override
+ @Override
public boolean performOk() {
- saveTreeExpansion();
- saveTreeSelection();
- boolean result = performColorOk() && performFontOk();
+ saveTreeExpansion();
+ saveTreeSelection();
+ boolean result = performColorOk() && performFontOk();
if (result) {
PrefUtil.savePrefs();
publishThemeRegistryModifiedEvent();
}
- return result;
- }
-
- /**
- * Refreshes the category.
- */
- private void refreshCategory() {
- updateControls();
- }
-
- /**
- * Resets the supplied definition to its default value.
- *
- * @param definition the <code>ColorDefinition</code> to reset.
- * @return whether any change was made.
- */
+ return result;
+ }
+
+ /**
+ * Refreshes the category.
+ */
+ private void refreshCategory() {
+ updateControls();
+ }
+
+ /**
+ * Resets the supplied definition to its default value.
+ *
+ * @param definition the <code>ColorDefinition</code> to reset.
+ * @return whether any change was made.
+ */
private boolean resetColor(ColorDefinition definition, boolean force) {
if (force || !isDefault(definition)) {
- RGB newRGB;
- if (definition.getValue() != null)
- newRGB = definition.getValue();
- else
- newRGB = getColorAncestorValue(definition);
+ RGB newRGB;
+ if (definition.getValue() != null)
+ newRGB = definition.getValue();
+ else
+ newRGB = getColorAncestorValue(definition);
- if (newRGB != null) {
+ if (newRGB != null) {
setColorPreferenceValue(definition, newRGB, true);
- setRegistryValue(definition, newRGB);
+ setRegistryValue(definition, newRGB);
refreshElement(definition);
- return true;
- }
- }
- return false;
- }
+ return true;
+ }
+ }
+ return false;
+ }
protected boolean resetFont(FontDefinition definition, boolean force) {
if (force || !isDefault(definition)) {
- FontData[] newFD;
+ FontData[] newFD;
if (definition.isOverridden()) {
newFD = definition.getValue();
} else if (!force && definition.getDefaultsTo() != null) {
- newFD = getFontAncestorValue(definition);
+ newFD = getFontAncestorValue(definition);
} else {
newFD = PreferenceConverter.getDefaultFontDataArray(getPreferenceStore(),
createPreferenceKey(definition));
}
- if (newFD != null) {
+ if (newFD != null) {
setFontPreferenceValue(definition, newFD, true);
refreshElement(definition);
- return true;
- }
- }
- return false;
- }
-
- /**
- * Set the value (in preferences) for the given color.
- *
- * @param definition the <code>ColorDefinition</code> to set.
- * @param newRGB the new <code>RGB</code> value for the definitions
- * identifier.
- */
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Set the value (in preferences) for the given color.
+ *
+ * @param definition the <code>ColorDefinition</code> to set.
+ * @param newRGB the new <code>RGB</code> value for the definitions
+ * identifier.
+ */
protected void setColorPreferenceValue(ColorDefinition definition, RGB newRGB, boolean reset) {
- setDescendantRegistryValues(definition, newRGB);
+ setDescendantRegistryValues(definition, newRGB);
colorPreferencesToSet.put(definition, newRGB);
updateDefinitionState(definition, reset);
- }
-
- /**
- * Set the value (in registry) for the given colors children.
- *
- * @param definition the <code>ColorDefinition</code> whose children should
- * be set.
- * @param newRGB the new <code>RGB</code> value for the definitions
- * identifier.
- */
- private void setDescendantRegistryValues(ColorDefinition definition, RGB newRGB) {
+ }
+
+ /**
+ * Set the value (in registry) for the given colors children.
+ *
+ * @param definition the <code>ColorDefinition</code> whose children should be
+ * set.
+ * @param newRGB the new <code>RGB</code> value for the definitions
+ * identifier.
+ */
+ private void setDescendantRegistryValues(ColorDefinition definition, RGB newRGB) {
for (ColorDefinition colorDefinition : getDescendantColors(definition)) {
if (isDefault(colorDefinition)) {
setDescendantRegistryValues(colorDefinition, newRGB);
setRegistryValue(colorDefinition, newRGB);
colorValuesToSet.put(colorDefinition.getId(), newRGB);
- }
- }
- }
+ }
+ }
+ }
private void setDescendantRegistryValues(FontDefinition definition, FontData[] datas, boolean reset) {
for (FontDefinition fontDefinition : getDescendantFonts(definition)) {
if (isDefault(fontDefinition)) {
setFontPreferenceValue(fontDefinition, datas, reset);
- }
- }
- }
+ }
+ }
+ }
protected void setFontPreferenceValue(FontDefinition definition, FontData[] datas, boolean reset) {
// descendant values must be computed and set before updating current,
@@ -1656,115 +1614,120 @@ getPreferenceStore(),
fontPreferencesToSet.put(definition, datas);
setRegistryValue(definition, datas);
updateDefinitionState(definition, reset);
- }
-
- /**
- * Updates the working registry.
- * @param definition
- * @param newRGB
- */
- protected void setRegistryValue(ColorDefinition definition, RGB newRGB) {
- colorRegistry.put(definition.getId(), newRGB);
- }
-
- protected void setRegistryValue(FontDefinition definition, FontData[] datas) {
- fontRegistry.put(definition.getId(), datas);
- }
-
- /**
- * Returns the preview for the category.
- * @param category the category
- * @return the preview for the category, or its ancestors preview if it does not have one.
- */
- private IThemePreview getThemePreview(ThemeElementCategory category) throws CoreException {
- IThemePreview preview = category.createPreview();
- if (preview != null)
+ }
+
+ /**
+ * Updates the working registry.
+ *
+ * @param definition
+ * @param newRGB
+ */
+ protected void setRegistryValue(ColorDefinition definition, RGB newRGB) {
+ colorRegistry.put(definition.getId(), newRGB);
+ }
+
+ protected void setRegistryValue(FontDefinition definition, FontData[] datas) {
+ fontRegistry.put(definition.getId(), datas);
+ }
+
+ /**
+ * Returns the preview for the category.
+ *
+ * @param category the category
+ * @return the preview for the category, or its ancestors preview if it does not
+ * have one.
+ */
+ private IThemePreview getThemePreview(ThemeElementCategory category) throws CoreException {
+ IThemePreview preview = category.createPreview();
+ if (preview != null)
return preview;
- if (category.getParentId() != null) {
- int idx = Arrays.binarySearch(themeRegistry.getCategories(),
- category.getParentId(), IThemeRegistry.ID_COMPARATOR);
- if (idx >= 0)
+ if (category.getParentId() != null) {
+ int idx = Arrays.binarySearch(themeRegistry.getCategories(), category.getParentId(),
+ IThemeRegistry.ID_COMPARATOR);
+ if (idx >= 0)
return getThemePreview(themeRegistry.getCategories()[idx]);
- }
- return null;
- }
+ }
+ return null;
+ }
private CascadingThemeExt getCascadingTheme() {
if (cascadingTheme == null) {
cascadingTheme = new CascadingThemeExt(currentTheme, colorRegistry, fontRegistry);
}
- return cascadingTheme;
- }
-
- /**
- * Update for a change in the dialog font.
- * @param newFont
- */
- private void updateForDialogFontChange(Font newFont) {
- Iterator iterator = dialogFontWidgets.iterator();
- while (iterator.hasNext()) {
- ((Control) iterator.next()).setFont(newFont);
- }
-
- //recalculate the fonts for the tree
- labelProvider.clearFontCacheAndUpdate();
- }
-
- private void updateTreeSelection(ISelection selection) {
- ThemeElementCategory category = null;
- Object element = ((IStructuredSelection) selection).getFirstElement();
- if (element instanceof ThemeElementCategory) {
- category = (ThemeElementCategory) element;
- } else if (element instanceof ColorDefinition) {
- String categoryID = ((ColorDefinition) element).getCategoryId();
- category = WorkbenchPlugin.getDefault().getThemeRegistry().findCategory(categoryID);
- } else if (element instanceof FontDefinition) {
- String categoryID = ((FontDefinition) element).getCategoryId();
- category = WorkbenchPlugin.getDefault().getThemeRegistry().findCategory(categoryID);
- }
+ return cascadingTheme;
+ }
+
+ /**
+ * Update for a change in the dialog font.
+ *
+ * @param newFont
+ */
+ private void updateForDialogFontChange(Font newFont) {
+ Iterator iterator = dialogFontWidgets.iterator();
+ while (iterator.hasNext()) {
+ ((Control) iterator.next()).setFont(newFont);
+ }
+
+ // recalculate the fonts for the tree
+ labelProvider.clearFontCacheAndUpdate();
+ }
+
+ private void updateTreeSelection(ISelection selection) {
+ ThemeElementCategory category = null;
+ Object element = ((IStructuredSelection) selection).getFirstElement();
+ if (element instanceof ThemeElementCategory) {
+ category = (ThemeElementCategory) element;
+ } else if (element instanceof ColorDefinition) {
+ String categoryID = ((ColorDefinition) element).getCategoryId();
+ category = WorkbenchPlugin.getDefault().getThemeRegistry().findCategory(categoryID);
+ } else if (element instanceof FontDefinition) {
+ String categoryID = ((FontDefinition) element).getCategoryId();
+ category = WorkbenchPlugin.getDefault().getThemeRegistry().findCategory(categoryID);
+ }
Composite previewControl = null;
if (category != null) { // check if there is a preview for it
- previewControl = (Composite) previewMap.get(category);
- if (previewControl == null) {
- try {
- IThemePreview preview = getThemePreview(category);
- if (preview != null) {
- previewControl = new Composite(previewComposite, SWT.NONE);
- previewControl.setLayout(new FillLayout());
- ITheme theme = getCascadingTheme();
- preview.createControl(previewControl, theme);
- previewSet.add(preview);
- previewMap.put(category, previewControl);
- }
- } catch (CoreException e) {
- previewControl = new Composite(previewComposite, SWT.NONE);
- previewControl.setLayout(new FillLayout());
- myApplyDialogFont(previewControl);
- Text error = new Text(previewControl, SWT.WRAP | SWT.READ_ONLY);
- error.setText(RESOURCE_BUNDLE.getString("errorCreatingPreview")); //$NON-NLS-1$
- WorkbenchPlugin.log(RESOURCE_BUNDLE.getString("errorCreatePreviewLog"), //$NON-NLS-1$
- StatusUtil.newStatus(IStatus.ERROR, e.getMessage(), e));
- }
- }
- }
-
- if (previewControl == null) { // there is no preview for this theme, use default preview
- if (element instanceof ColorDefinition)
- previewControl = defaultColorPreview;
- else if (element instanceof FontDefinition)
- previewControl = defaultFontPreview;
- else
- previewControl = defaultNoPreview;
- }
-
- stackLayout.topControl = previewControl;
- previewComposite.layout();
- updateControls();
- }
-
- /**
+ previewControl = (Composite) previewMap.get(category);
+ if (previewControl == null) {
+ try {
+ IThemePreview preview = getThemePreview(category);
+ if (preview != null) {
+ previewControl = new Composite(previewComposite, SWT.NONE);
+ previewControl.setLayout(new FillLayout());
+ ITheme theme = getCascadingTheme();
+ preview.createControl(previewControl, theme);
+ previewSet.add(preview);
+ previewMap.put(category, previewControl);
+ }
+ } catch (CoreException e) {
+ previewControl = new Composite(previewComposite, SWT.NONE);
+ previewControl.setLayout(new FillLayout());
+ myApplyDialogFont(previewControl);
+ Text error = new Text(previewControl, SWT.WRAP | SWT.READ_ONLY);
+ error.setText(RESOURCE_BUNDLE.getString("errorCreatingPreview")); //$NON-NLS-1$
+ WorkbenchPlugin.log(RESOURCE_BUNDLE.getString("errorCreatePreviewLog"), //$NON-NLS-1$
+ StatusUtil.newStatus(IStatus.ERROR, e.getMessage(), e));
+ }
+ }
+ }
+
+ if (previewControl == null) { // there is no preview for this theme, use default preview
+ if (element instanceof ColorDefinition)
+ previewControl = defaultColorPreview;
+ else if (element instanceof FontDefinition)
+ previewControl = defaultFontPreview;
+ else
+ previewControl = defaultNoPreview;
+ }
+
+ stackLayout.topControl = previewControl;
+ previewComposite.layout();
+ updateControls();
+ }
+
+ /**
* Restore the selection state of the tree.
+ *
* @since 3.1
*/
private void restoreTreeSelection() {
@@ -1779,6 +1742,7 @@ getPreferenceStore(),
/**
* Save the selection state of the tree.
+ *
* @since 3.1
*/
private void saveTreeSelection() {
@@ -1793,6 +1757,7 @@ getPreferenceStore(),
/**
* Restore the expansion state of the tree.
+ *
* @since 3.1
*/
private void restoreTreeExpansion() {
@@ -1814,9 +1779,9 @@ getPreferenceStore(),
/**
* Find the theme element from the given string. It will check the first
- * character against the known constants and then call the appropriate
- * method on the theme registry. If the element does not exist or the string
- * is invalid <code>null</code> is returned.
+ * character against the known constants and then call the appropriate method on
+ * the theme registry. If the element does not exist or the string is invalid
+ * <code>null</code> is returned.
*
* @param string the string to parse
* @return the element, or <code>null</code>
@@ -1844,6 +1809,7 @@ getPreferenceStore(),
/**
* Saves the expansion state of the tree.
+ *
* @since 3.1
*/
private void saveTreeExpansion() {
@@ -1885,8 +1851,7 @@ getPreferenceStore(),
/**
* Edit the currently selected font.
*
- * @param display
- * the display to open the dialog on
+ * @param display the display to open the dialog on
* @since 3.2
*/
private void editFont(Display display) {
@@ -1896,10 +1861,8 @@ getPreferenceStore(),
/**
* Edit the given font.
*
- * @param definition
- * the font definition
- * @param display
- * the display to open the dialog on
+ * @param definition the font definition
+ * @param display the display to open the dialog on
* @since 3.7
*/
private void editFont(FontDefinition definition, Display display) {
@@ -1926,7 +1889,7 @@ getPreferenceStore(),
ColorDialog colorDialog = new ColorDialog(display.getActiveShell());
colorDialog.setRGB(currentColor);
- RGB selectedColor = colorDialog.open();
+ RGB selectedColor = colorDialog.open();
if ((selectedColor != null) && (!selectedColor.equals(currentColor))) {
setColorPreferenceValue(definition, selectedColor, false);
setRegistryValue(definition, selectedColor);
@@ -1934,7 +1897,6 @@ getPreferenceStore(),
}
}
-
protected void updateControls() {
FontDefinition fontDefinition = getSelectedFontDefinition();
if (fontDefinition != null) {
@@ -1945,25 +1907,25 @@ getPreferenceStore(),
fontResetButton.setEnabled(!isSetToDefault);
editDefaultButton.setEnabled(hasEditableDefault && isSetToDefault);
goToDefaultButton.setEnabled(hasEditableDefault);
- setCurrentFont(fontDefinition);
- return;
- }
- ColorDefinition colorDefinition = getSelectedColorDefinition();
- if (colorDefinition != null) {
+ setCurrentFont(fontDefinition);
+ return;
+ }
+ ColorDefinition colorDefinition = getSelectedColorDefinition();
+ if (colorDefinition != null) {
boolean isSetToDefault = isDefault(getSelectedColorDefinition());
boolean hasEditableDefault = defaultIsEditable(colorDefinition);
fontChangeButton.setEnabled(true);
- fontSystemButton.setEnabled(false);
+ fontSystemButton.setEnabled(false);
fontResetButton.setEnabled(!isSetToDefault);
editDefaultButton.setEnabled(hasEditableDefault && isSetToDefault);
goToDefaultButton.setEnabled(hasEditableDefault);
- setCurrentColor(colorDefinition);
- return;
- }
- // not a font or a color?
- fontChangeButton.setEnabled(false);
- fontSystemButton.setEnabled(false);
- fontResetButton.setEnabled(false);
+ setCurrentColor(colorDefinition);
+ return;
+ }
+ // not a font or a color?
+ fontChangeButton.setEnabled(false);
+ fontSystemButton.setEnabled(false);
+ fontResetButton.setEnabled(false);
editDefaultButton.setEnabled(false);
goToDefaultButton.setEnabled(false);
descriptionText.setText(""); //$NON-NLS-1$
@@ -1992,9 +1954,9 @@ getPreferenceStore(),
return (defaultDefinition != null && defaultDefinition.isEditable());
}
- /**
- * @return Return the default "No preview available." preview.
- */
+ /**
+ * @return Return the default "No preview available." preview.
+ */
private Composite createNoPreviewControl() {
Composite noPreviewControl = new Composite(previewComposite, SWT.NONE);
noPreviewControl.setLayout(new FillLayout());
@@ -2079,9 +2041,9 @@ getPreferenceStore(),
private Composite createColorPreviewControl() {
colorSampler = new Canvas(previewComposite, SWT.NONE);
- GridLayout gridLayout = new GridLayout();
- gridLayout.marginWidth = 0;
- gridLayout.marginHeight = 0;
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.marginWidth = 0;
+ gridLayout.marginHeight = 0;
colorSampler.setLayout(gridLayout);
colorSampler.setLayoutData(new GridData(GridData.FILL_BOTH));
@@ -2181,7 +2143,7 @@ getPreferenceStore(),
label.setText(RESOURCE_BUNDLE.getString("description")); //$NON-NLS-1$
myApplyDialogFont(label);
- descriptionText = new Text(composite, SWT.READ_ONLY | SWT.BORDER | SWT.WRAP);
+ descriptionText = new Text(composite, SWT.READ_ONLY | SWT.BORDER | SWT.WRAP);
data = new GridData(GridData.FILL_BOTH);
data.heightHint = convertHeightInCharsToPixels(3);
data.widthHint = convertWidthInCharsToPixels(30);
@@ -2232,8 +2194,8 @@ getPreferenceStore(),
tree.getViewer().refresh(definition);
updateTreeSelection(tree.getViewer().getSelection());
- Object newValue = definition instanceof ColorDefinition ?
- ((ColorDefinition) definition).getValue(): ((FontDefinition) definition).getValue();
+ Object newValue = definition instanceof ColorDefinition ? ((ColorDefinition) definition).getValue()
+ : ((FontDefinition) definition).getValue();
getCascadingTheme().fire(new PropertyChangeEvent(this, definition.getId(), null, newValue));
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/FontDefinition.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/FontDefinition.java
index 05ea694f66e..79f485b5927 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/FontDefinition.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/FontDefinition.java
@@ -20,84 +20,87 @@ import org.eclipse.swt.graphics.FontData;
import org.eclipse.ui.PlatformUI;
/**
- * The FontDefiniton is the representation of the fontDefinition
- * from the plugin.xml of a type.
+ * The FontDefiniton is the representation of the fontDefinition from the
+ * plugin.xml of a type.
*/
-public class FontDefinition extends ThemeElementDefinition implements
- IHierarchalThemeElementDefinition, ICategorizedThemeElementDefinition, IEditable,
- IFontDefinitionOverridable {
+public class FontDefinition extends ThemeElementDefinition implements IHierarchalThemeElementDefinition,
+ ICategorizedThemeElementDefinition, IEditable, IFontDefinitionOverridable {
private String defaultsTo;
- private String value;
+ private String value;
private String defaultValue;
- private boolean isEditable;
-
- private FontData[] parsedValue;
-
- /**
- * Create a new instance of the receiver.
- *
- * @param fontName The name display
- * ed in the preference page.
- * @param uniqueId The id used to refer to this definition.
- * @param defaultsId The id of the font this defaults to.
- * @param fontDescription The description of the font in the preference page.
- */
- public FontDefinition(String fontName, String uniqueId, String defaultsId,
- String value, String categoryId, boolean isEditable,
- String fontDescription) {
+ private boolean isEditable;
+
+ private FontData[] parsedValue;
+
+ /**
+ * Create a new instance of the receiver.
+ *
+ * @param fontName The name display ed in the preference page.
+ * @param uniqueId The id used to refer to this definition.
+ * @param defaultsId The id of the font this defaults to.
+ * @param fontDescription The description of the font in the preference page.
+ */
+ public FontDefinition(String fontName, String uniqueId, String defaultsId, String value, String categoryId,
+ boolean isEditable, String fontDescription) {
super(uniqueId, fontName, fontDescription, categoryId);
- this.defaultsTo = defaultsId;
- this.value = value;
- this.isEditable = isEditable;
- }
-
- /**
- * Create a new instance of the receiver.
- *
- * @param originalFont the original definition. This will be used to populate
- * all fields except defaultsTo and value. defaultsTo will always be
- * <code>null</code>.
- * @param datas the FontData[] value
- */
- public FontDefinition(FontDefinition originalFont, FontData[] datas) {
+ this.defaultsTo = defaultsId;
+ this.value = value;
+ this.isEditable = isEditable;
+ }
+
+ /**
+ * Create a new instance of the receiver.
+ *
+ * @param originalFont the original definition. This will be used to populate
+ * all fields except defaultsTo and value. defaultsTo will
+ * always be <code>null</code>.
+ * @param datas the FontData[] value
+ */
+ public FontDefinition(FontDefinition originalFont, FontData[] datas) {
super(originalFont.getId(), originalFont.getName(), originalFont.getDescription(),
originalFont.getCategoryId());
- this.isEditable = originalFont.isEditable();
- this.parsedValue = datas;
- }
-
- /**
- * Returns the defaultsTo. This is the id of the text font
- * that this font defualts to.
- * @return String or <pre>null</pre>.
- */
- @Override
+ this.isEditable = originalFont.isEditable();
+ this.parsedValue = datas;
+ }
+
+ /**
+ * Returns the defaultsTo. This is the id of the text font that this font
+ * defualts to.
+ *
+ * @return String or
+ *
+ * <pre>
+ * null
+ * </pre>
+ *
+ * .
+ */
+ @Override
public String getDefaultsTo() {
- return defaultsTo;
- }
-
- /**
- * Returns the value.
- *
- * @return FontData []
- */
- @Override
+ return defaultsTo;
+ }
+
+ /**
+ * Returns the value.
+ *
+ * @return FontData []
+ */
+ @Override
public FontData[] getValue() {
- if (value == null) {
+ if (value == null) {
return null;
}
- if (parsedValue == null) {
- parsedValue = JFaceResources.getFontRegistry().filterData(
- StringConverter.asFontDataArray(value),
- PlatformUI.getWorkbench().getDisplay());
- }
+ if (parsedValue == null) {
+ parsedValue = JFaceResources.getFontRegistry().filterData(StringConverter.asFontDataArray(value),
+ PlatformUI.getWorkbench().getDisplay());
+ }
- return parsedValue;
- }
+ return parsedValue;
+ }
@Override
public void resetToDefaultValue() {
@@ -106,20 +109,20 @@ public class FontDefinition extends ThemeElementDefinition implements
super.resetToDefaultValue();
}
- @Override
+ @Override
public boolean isEditable() {
- return isEditable;
- }
+ return isEditable;
+ }
- @Override
+ @Override
public boolean equals(Object obj) {
- if (obj instanceof FontDefinition) {
- return getId().equals(((FontDefinition)obj).getId());
- }
- return false;
- }
+ if (obj instanceof FontDefinition) {
+ return getId().equals(((FontDefinition) obj).getId());
+ }
+ return false;
+ }
- @Override
+ @Override
public int hashCode() {
return getId().hashCode();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ICategorizedThemeElementDefinition.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ICategorizedThemeElementDefinition.java
index 9a2b0f643bf..76e71663fdb 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ICategorizedThemeElementDefinition.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ICategorizedThemeElementDefinition.java
@@ -18,13 +18,13 @@ package org.eclipse.ui.internal.themes;
*
* @since 3.0
*/
-public interface ICategorizedThemeElementDefinition extends
- IThemeElementDefinition {
+public interface ICategorizedThemeElementDefinition extends IThemeElementDefinition {
- /**
- * Returns the category of this element.
- *
- * @return the category of this element, or <code>null</code> if it does not belong to one.
- */
- String getCategoryId();
+ /**
+ * Returns the category of this element.
+ *
+ * @return the category of this element, or <code>null</code> if it does not
+ * belong to one.
+ */
+ String getCategoryId();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/IEditable.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/IEditable.java
index f360ff9f185..ec84f4cce98 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/IEditable.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/IEditable.java
@@ -22,11 +22,11 @@ package org.eclipse.ui.internal.themes;
*/
public interface IEditable {
- /**
- * Returns whether this object is editable.
- *
- * @return whether this object is editable.
- */
- boolean isEditable();
+ /**
+ * Returns whether this object is editable.
+ *
+ * @return whether this object is editable.
+ */
+ boolean isEditable();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/IHierarchalThemeElementDefinition.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/IHierarchalThemeElementDefinition.java
index 88e66092129..38fb10c3d31 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/IHierarchalThemeElementDefinition.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/IHierarchalThemeElementDefinition.java
@@ -18,14 +18,13 @@ package org.eclipse.ui.internal.themes;
*
* @since 3.0
*/
-public interface IHierarchalThemeElementDefinition extends
- IThemeElementDefinition {
+public interface IHierarchalThemeElementDefinition extends IThemeElementDefinition {
- /**
- * Return the id of the element this element defaults to.
- *
- * @return the id of the element this element defaults to, or
- * <code>null</code> if it does not default to another element.
- */
- String getDefaultsTo();
+ /**
+ * Return the id of the element this element defaults to.
+ *
+ * @return the id of the element this element defaults to, or <code>null</code>
+ * if it does not default to another element.
+ */
+ String getDefaultsTo();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/IThemeDescriptor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/IThemeDescriptor.java
index 060712b0a9f..bdc10d7b556 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/IThemeDescriptor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/IThemeDescriptor.java
@@ -21,24 +21,26 @@ import java.util.Map;
* @since 3.0
*/
public interface IThemeDescriptor extends IThemeElementDefinition {
- String TAB_BORDER_STYLE = "TAB_BORDER_STYLE"; //$NON-NLS-1$
+ String TAB_BORDER_STYLE = "TAB_BORDER_STYLE"; //$NON-NLS-1$
- /**
- * Returns the color overrides for this theme.
- * @return ColorDefinition []
- */
- ColorDefinition[] getColors();
+ /**
+ * Returns the color overrides for this theme.
+ *
+ * @return ColorDefinition []
+ */
+ ColorDefinition[] getColors();
- /**
- * Returns the font overrides for this theme.
- * @return GradientDefinition []
- */
- FontDefinition[] getFonts();
+ /**
+ * Returns the font overrides for this theme.
+ *
+ * @return GradientDefinition []
+ */
+ FontDefinition[] getFonts();
- /**
- * Returns the data map for this theme.
- *
- * @return the data map. This will be read only.
- */
- Map getData();
+ /**
+ * Returns the data map for this theme.
+ *
+ * @return the data map. This will be read only.
+ */
+ Map getData();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/IThemeElementDefinition.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/IThemeElementDefinition.java
index a9ac9394e0c..d931fc73dc2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/IThemeElementDefinition.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/IThemeElementDefinition.java
@@ -14,32 +14,31 @@
package org.eclipse.ui.internal.themes;
/**
- * A basic element (color, font) of a theme must implement this
- * interface.
+ * A basic element (color, font) of a theme must implement this interface.
*
* @since 3.0
*/
public interface IThemeElementDefinition {
- /**
- * Returns the name for this element.
- *
- * @return the name for this element
- */
- String getName();
+ /**
+ * Returns the name for this element.
+ *
+ * @return the name for this element
+ */
+ String getName();
- /**
- * Returns the id for this element.
- *
- * @return the id for this element. This will never be <code>null</code>.
- */
- String getId();
+ /**
+ * Returns the id for this element.
+ *
+ * @return the id for this element. This will never be <code>null</code>.
+ */
+ String getId();
- /**
- * Returns the description for this element.
- *
- * @return the description for this element. This may be <code>null</code>.
- */
- String getDescription();
+ /**
+ * Returns the description for this element.
+ *
+ * @return the description for this element. This may be <code>null</code>.
+ */
+ String getDescription();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/IThemeRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/IThemeRegistry.java
index f1ef52641ec..f0fe5593ca6 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/IThemeRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/IThemeRegistry.java
@@ -25,189 +25,184 @@ import java.util.Set;
*/
public interface IThemeRegistry {
- /**
- * A comparator that will sort IHierarchalThemeElementDefinition elements
- * by defaultsTo depth.
- *
- * @since 3.0
- */
- public static class HierarchyComparator implements Comparator {
-
- private IHierarchalThemeElementDefinition[] definitions;
-
- /**
- * Create a new comparator.
- *
- * @param definitions the elements to be sorted by depth, in ID order.
- */
- public HierarchyComparator(
- IHierarchalThemeElementDefinition[] definitions) {
- this.definitions = definitions;
- }
-
- @Override
+ /**
+ * A comparator that will sort IHierarchalThemeElementDefinition elements by
+ * defaultsTo depth.
+ *
+ * @since 3.0
+ */
+ public static class HierarchyComparator implements Comparator {
+
+ private IHierarchalThemeElementDefinition[] definitions;
+
+ /**
+ * Create a new comparator.
+ *
+ * @param definitions the elements to be sorted by depth, in ID order.
+ */
+ public HierarchyComparator(IHierarchalThemeElementDefinition[] definitions) {
+ this.definitions = definitions;
+ }
+
+ @Override
public int compare(Object arg0, Object arg1) {
- String def0 = arg0 == null ? null
- : ((IHierarchalThemeElementDefinition) arg0)
- .getDefaultsTo();
- String def1 = arg1 == null ? null
- : ((IHierarchalThemeElementDefinition) arg1)
- .getDefaultsTo();
-
- if (def0 == null && def1 == null) {
+ String def0 = arg0 == null ? null : ((IHierarchalThemeElementDefinition) arg0).getDefaultsTo();
+ String def1 = arg1 == null ? null : ((IHierarchalThemeElementDefinition) arg1).getDefaultsTo();
+
+ if (def0 == null && def1 == null) {
return 0;
}
- if (def0 == null) {
+ if (def0 == null) {
return -1;
}
- if (def1 == null) {
+ if (def1 == null) {
return 1;
}
- return compare(getDefaultsTo(def0), getDefaultsTo(def1));
- }
-
- /**
- * @param id the identifier to search for.
- * @return the <code>IHierarchalThemeElementDefinition</code> that
- * matches the id.
- */
- private IHierarchalThemeElementDefinition getDefaultsTo(String id) {
- int idx = Arrays.binarySearch(definitions, id, ID_COMPARATOR);
- if (idx >= 0) {
+ return compare(getDefaultsTo(def0), getDefaultsTo(def1));
+ }
+
+ /**
+ * @param id the identifier to search for.
+ * @return the <code>IHierarchalThemeElementDefinition</code> that matches the
+ * id.
+ */
+ private IHierarchalThemeElementDefinition getDefaultsTo(String id) {
+ int idx = Arrays.binarySearch(definitions, id, ID_COMPARATOR);
+ if (idx >= 0) {
return definitions[idx];
}
- return null;
- }
- }
-
- /**
- * A comparator that will sort <code>IThemeElementDefinition</code> elements
- * by id depth. You may use this on both <code>String</code> and
- * <code>IThemeElementDefinition</code> objects in order to perform
- * searching.
- *
- * @since 3.0
- */
- Comparator ID_COMPARATOR = new Comparator() {
+ return null;
+ }
+ }
+
+ /**
+ * A comparator that will sort <code>IThemeElementDefinition</code> elements by
+ * id depth. You may use this on both <code>String</code> and
+ * <code>IThemeElementDefinition</code> objects in order to perform searching.
+ *
+ * @since 3.0
+ */
+ Comparator ID_COMPARATOR = new Comparator() {
@Override
public int compare(Object arg0, Object arg1) {
- String str0 = getCompareString(arg0);
- String str1 = getCompareString(arg1);
- return str0.compareTo(str1);
- }
-
- /**
- * @param object
- * @return <code>String</code> representation of the object.
- */
- private String getCompareString(Object object) {
- if (object instanceof String) {
+ String str0 = getCompareString(arg0);
+ String str1 = getCompareString(arg1);
+ return str0.compareTo(str1);
+ }
+
+ /**
+ * @param object
+ * @return <code>String</code> representation of the object.
+ */
+ private String getCompareString(Object object) {
+ if (object instanceof String) {
return (String) object;
} else if (object instanceof IThemeElementDefinition) {
return ((IThemeElementDefinition) object).getId();
}
- return ""; //$NON-NLS-1$
- }
- };
-
- /**
- * Returns the category matching the provided id.
- *
- * @param id the id to search for
- * @return the element matching the provided id, or <code>null</code> if
- * not found
- */
- ThemeElementCategory findCategory(String id);
-
- /**
- * Returns the color matching the provided id.
- *
- * @param id the id to search for
- * @return the element matching the provided id, or <code>null</code> if
- * not found
- */
- ColorDefinition findColor(String id);
-
- /**
- * Returns the font matching the provided id.
- *
- * @param id the id to search for
- * @return the element matching the provided id, or <code>null</code> if
- * not found
- */
- FontDefinition findFont(String id);
-
- /**
- * Returns the theme matching the provided id.
- *
- * @param id the id to search for
- * @return the element matching the provided id, or <code>null</code> if
- * not found
- */
- IThemeDescriptor findTheme(String id);
-
- /**
- * Returns a list of categories defined in the registry.
- *
- * @return the categories in this registry
- */
- ThemeElementCategory[] getCategories();
-
- /**
- * Returns a list of colors defined in the registry.
- *
- * @return the colors in this registry
- */
- ColorDefinition[] getColors();
-
- /**
- * Returns a list of colors defined for the given theme. This is the
- * set of base colours overlayed with any theme specific overrides.
- *
- * @param themeId the theme id
- * @return the colors in this theme
- */
- ColorDefinition[] getColorsFor(String themeId);
-
- /**
- * Returns a list of fonts defined for the given theme. This is the
- * set of base fonts overlayed with any theme specific overrides.
- *
- * @param themeId the theme id
- * @return the fonts in this theme
- */
- FontDefinition[] getFontsFor(String themeId);
-
- /**
- * Returns a list of fonts defined in the registry.
- *
- * @return the fonts in this registry
- */
- FontDefinition[] getFonts();
-
- /**
- * Returns a list of themes defined in the registry.
- *
- * @return the themes in this registry
- */
- IThemeDescriptor[] getThemes();
-
- /**
- * Return the data map.
- *
- * @return the data map
- */
- Map getData();
-
- /**
- * Return the set of category presentation bindings.
- *
- * @param category the category to test
- * @return the set of bindings or <code>null</code> if this category has no bindings
- */
- Set getPresentationsBindingsFor(ThemeElementCategory category);
+ return ""; //$NON-NLS-1$
+ }
+ };
+
+ /**
+ * Returns the category matching the provided id.
+ *
+ * @param id the id to search for
+ * @return the element matching the provided id, or <code>null</code> if not
+ * found
+ */
+ ThemeElementCategory findCategory(String id);
+
+ /**
+ * Returns the color matching the provided id.
+ *
+ * @param id the id to search for
+ * @return the element matching the provided id, or <code>null</code> if not
+ * found
+ */
+ ColorDefinition findColor(String id);
+
+ /**
+ * Returns the font matching the provided id.
+ *
+ * @param id the id to search for
+ * @return the element matching the provided id, or <code>null</code> if not
+ * found
+ */
+ FontDefinition findFont(String id);
+
+ /**
+ * Returns the theme matching the provided id.
+ *
+ * @param id the id to search for
+ * @return the element matching the provided id, or <code>null</code> if not
+ * found
+ */
+ IThemeDescriptor findTheme(String id);
+
+ /**
+ * Returns a list of categories defined in the registry.
+ *
+ * @return the categories in this registry
+ */
+ ThemeElementCategory[] getCategories();
+
+ /**
+ * Returns a list of colors defined in the registry.
+ *
+ * @return the colors in this registry
+ */
+ ColorDefinition[] getColors();
+
+ /**
+ * Returns a list of colors defined for the given theme. This is the set of base
+ * colours overlayed with any theme specific overrides.
+ *
+ * @param themeId the theme id
+ * @return the colors in this theme
+ */
+ ColorDefinition[] getColorsFor(String themeId);
+
+ /**
+ * Returns a list of fonts defined for the given theme. This is the set of base
+ * fonts overlayed with any theme specific overrides.
+ *
+ * @param themeId the theme id
+ * @return the fonts in this theme
+ */
+ FontDefinition[] getFontsFor(String themeId);
+
+ /**
+ * Returns a list of fonts defined in the registry.
+ *
+ * @return the fonts in this registry
+ */
+ FontDefinition[] getFonts();
+
+ /**
+ * Returns a list of themes defined in the registry.
+ *
+ * @return the themes in this registry
+ */
+ IThemeDescriptor[] getThemes();
+
+ /**
+ * Return the data map.
+ *
+ * @return the data map
+ */
+ Map getData();
+
+ /**
+ * Return the set of category presentation bindings.
+ *
+ * @param category the category to test
+ * @return the set of bindings or <code>null</code> if this category has no
+ * bindings
+ */
+ Set getPresentationsBindingsFor(ThemeElementCategory category);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/LightColorFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/LightColorFactory.java
index 58b38430bbf..14f6381d86b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/LightColorFactory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/LightColorFactory.java
@@ -24,14 +24,13 @@ import org.eclipse.ui.themes.ColorUtil;
import org.eclipse.ui.themes.IColorFactory;
/**
- * LightColorFactory returns tab begin and end colours based on taking
- * a system color as input, analyzing it, and lightening it appropriately.
+ * LightColorFactory returns tab begin and end colours based on taking a system
+ * color as input, analyzing it, and lightening it appropriately.
*
* @since 3.3
*
*/
-public class LightColorFactory implements IColorFactory,
- IExecutableExtension {
+public class LightColorFactory implements IColorFactory, IExecutableExtension {
protected static final RGB white = ColorUtil.getColorValue("COLOR_WHITE"); //$NON-NLS-1$
protected static final RGB black = ColorUtil.getColorValue("COLOR_BLACK"); //$NON-NLS-1$
@@ -41,6 +40,7 @@ public class LightColorFactory implements IColorFactory,
/**
* Return the highlight start (top of tab) color as an RGB
+ *
* @return the highlight start RGB
*/
@@ -49,20 +49,20 @@ public class LightColorFactory implements IColorFactory,
}
/**
- * This executable extension requires parameters to be explicitly declared
- * via the second method described in the <code>IExecutableExtension</code>
- * documentation. The following parameters are parsed:
- * <code>base</code>, describes the base color to produce all other colours from.
- * This value may either be an RGB triple or an SWT constant.
- * <code>definitionId</code>, describes the id of color we are looking for, one of
+ * This executable extension requires parameters to be explicitly declared via
+ * the second method described in the <code>IExecutableExtension</code>
+ * documentation. The following parameters are parsed: <code>base</code>,
+ * describes the base color to produce all other colours from. This value may
+ * either be an RGB triple or an SWT constant. <code>definitionId</code>,
+ * describes the id of color we are looking for, one of
* "org.eclipse.ui.workbench.ACTIVE_TAB_BG_START"
* "org.eclipse.ui.workbench.ACTIVE_TAB_BG_END"
+ *
* @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement,
* java.lang.String, java.lang.Object)
*/
@Override
- public void setInitializationData(IConfigurationElement config,
- String propertyName, Object data) {
+ public void setInitializationData(IConfigurationElement config, String propertyName, Object data) {
if (data instanceof Hashtable) {
Hashtable table = (Hashtable) data;
@@ -72,36 +72,39 @@ public class LightColorFactory implements IColorFactory,
}
/*
- * Return the number of RGB values in test that are
- * equal to or between lower and upper.
+ * Return the number of RGB values in test that are equal to or between lower
+ * and upper.
*/
protected int valuesInRange(RGB test, int lower, int upper) {
int hits = 0;
- if(test.red >= lower && test.red <= upper) hits++;
- if(test.blue >= lower && test.blue <= upper) hits++;
- if(test.green >= lower && test.green <= upper) hits++;
+ if (test.red >= lower && test.red <= upper)
+ hits++;
+ if (test.blue >= lower && test.blue <= upper)
+ hits++;
+ if (test.green >= lower && test.green <= upper)
+ hits++;
return hits;
}
/*
- * Return the RGB value for the bottom tab color
- * based on a blend of white and sample color
+ * Return the RGB value for the bottom tab color based on a blend of white and
+ * sample color
*/
private RGB getLightenedColor(RGB sample) {
- //Group 1
- if(valuesInRange(sample, 180, 255) >= 2)
+ // Group 1
+ if (valuesInRange(sample, 180, 255) >= 2)
return sample;
- //Group 2
- if(valuesInRange(sample, 100, 179) >= 2)
+ // Group 2
+ if (valuesInRange(sample, 100, 179) >= 2)
return ColorUtil.blend(white, sample, 40);
- //Group 3
- if(valuesInRange(sample, 0, 99) >= 2)
+ // Group 3
+ if (valuesInRange(sample, 0, 99) >= 2)
return ColorUtil.blend(white, sample, 60);
- //Group 4
+ // Group 4
return ColorUtil.blend(white, sample, 30);
}
@@ -110,7 +113,7 @@ public class LightColorFactory implements IColorFactory,
*/
private RGB getActiveFocusStartColor() {
if (Display.getCurrent().getDepth() < 15)
- return getActiveFocusEndColor();
+ return getActiveFocusEndColor();
RGB startColor = ColorUtil.blend(white, getActiveFocusEndColor(), 75);
return startColor;
@@ -123,8 +126,7 @@ public class LightColorFactory implements IColorFactory,
if (Display.getCurrent().getDepth() < 15)
return ColorUtil.getColorValue(baseColorName);
- return getLightenedColor(
- ColorUtil.getColorValue(baseColorName));
+ return getLightenedColor(ColorUtil.getColorValue(baseColorName));
}
/*
@@ -132,10 +134,11 @@ public class LightColorFactory implements IColorFactory,
*/
private RGB getActiveFocusTextColor() {
if (Display.getCurrent().getDepth() < 15)
- return ColorUtil.getColorValue(baseColorName); //typically TITLE_FOREGROUND
+ return ColorUtil.getColorValue(baseColorName); // typically TITLE_FOREGROUND
return ColorUtil.getColorValue("COLOR_BLACK"); //$NON-NLS-1$
}
+
/*
* Return the RGB value for the top tab color.
*/
@@ -149,7 +152,7 @@ public class LightColorFactory implements IColorFactory,
@Override
public RGB createColor() {
- //should have base, otherwise error in the xml
+ // should have base, otherwise error in the xml
if (baseColorName == null || definitionId == null)
return white;
@@ -162,7 +165,7 @@ public class LightColorFactory implements IColorFactory,
if (definitionId.equals("org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_BG_START")) //$NON-NLS-1$
return getActiveNofocusStartColor();
- //should be one of start or end, otherwise error in the xml
+ // should be one of start or end, otherwise error in the xml
return white;
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/RGBBrightnessColorFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/RGBBrightnessColorFactory.java
index ce58590cffd..d34fc1ba240 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/RGBBrightnessColorFactory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/RGBBrightnessColorFactory.java
@@ -44,13 +44,13 @@ public class RGBBrightnessColorFactory implements IColorFactory, IExecutableExte
}
/**
- * This executable extension requires parameters to be explicitly declared
- * via the second method described in the <code>IExecutableExtension</code>
+ * This executable extension requires parameters to be explicitly declared via
+ * the second method described in the <code>IExecutableExtension</code>
* documentation. This class expects that there will be two parameters,
* <code>color</code> that describe the color to be blended (this values may
- * either be RGB triples or SWT constants) and <code>scaleFactor</code>
- * which is the brightness scale factor with 1.0 having the same brightness
- * as the original color.
+ * either be RGB triples or SWT constants) and <code>scaleFactor</code> which is
+ * the brightness scale factor with 1.0 having the same brightness as the
+ * original color.
*
* @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement,
* java.lang.String, java.lang.Object)
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/RGBContrastFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/RGBContrastFactory.java
index a37e2aa31b8..960601b7abc 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/RGBContrastFactory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/RGBContrastFactory.java
@@ -22,12 +22,11 @@ import org.eclipse.ui.themes.ColorUtil;
import org.eclipse.ui.themes.IColorFactory;
/**
- * A <code>IColorFactory</code> that may be used to select a colour with
- * a higher contrast. The colors to blend are specified as per method
- * number two in {@link org.eclipse.core.runtime.IExecutableExtension}.
+ * A <code>IColorFactory</code> that may be used to select a colour with a
+ * higher contrast. The colors to blend are specified as per method number two
+ * in {@link org.eclipse.core.runtime.IExecutableExtension}.
* <p>
- * Example usage:
- * <br/>
+ * Example usage: <br/>
* <code>
* &lt;colorDefinition
* label="Red/Blue Contrast"
@@ -52,118 +51,117 @@ import org.eclipse.ui.themes.IColorFactory;
* @since 3.0
*/
public class RGBContrastFactory implements IColorFactory, IExecutableExtension {
- private String fg, bg1, bg2;
+ private String fg, bg1, bg2;
- /**
- * Returns the intensity of an RGB component using the
- * sRGB gamma function.
- *
- * @param val Value to convert.
- * @return Light intensity of the component.
- */
- double voltage_to_intensity_srgb(double val) {
- /* Handle invalid values before doing a gamma transform. */
- if (val < 0.0) {
+ /**
+ * Returns the intensity of an RGB component using the sRGB gamma function.
+ *
+ * @param val Value to convert.
+ * @return Light intensity of the component.
+ */
+ double voltage_to_intensity_srgb(double val) {
+ /* Handle invalid values before doing a gamma transform. */
+ if (val < 0.0) {
return 0.0;
}
- if (val > 1.0) {
+ if (val > 1.0) {
return 1.0;
}
- if (val <= 0.04045) {
- return val / 12.92;
- }
- return Math.pow((val + 0.055) / 1.055, 2.4);
- }
+ if (val <= 0.04045) {
+ return val / 12.92;
+ }
+ return Math.pow((val + 0.055) / 1.055, 2.4);
+ }
- /**
- * Returns a measure of the lightness in the perceptual colourspace
- * IPT.
- *
- * @param color The colour in sRGB
- * @return Lightness in IPT space.
- */
- double lightness(RGB color) {
- double r = voltage_to_intensity_srgb(color.red / 255.0);
- double g = voltage_to_intensity_srgb(color.green / 255.0);
- double b = voltage_to_intensity_srgb(color.blue / 255.0);
- double l = (0.3139 * r) + (0.6395 * g) + (0.0466 * b);
- double m = (0.1516 * r) + (0.7482 * g) + (0.1000 * b);
- double s = (0.0177 * r) + (0.1095 * g) + (0.8729 * b);
- double lp, mp, sp;
+ /**
+ * Returns a measure of the lightness in the perceptual colourspace IPT.
+ *
+ * @param color The colour in sRGB
+ * @return Lightness in IPT space.
+ */
+ double lightness(RGB color) {
+ double r = voltage_to_intensity_srgb(color.red / 255.0);
+ double g = voltage_to_intensity_srgb(color.green / 255.0);
+ double b = voltage_to_intensity_srgb(color.blue / 255.0);
+ double l = (0.3139 * r) + (0.6395 * g) + (0.0466 * b);
+ double m = (0.1516 * r) + (0.7482 * g) + (0.1000 * b);
+ double s = (0.0177 * r) + (0.1095 * g) + (0.8729 * b);
+ double lp, mp, sp;
- if (l < 0.0) {
+ if (l < 0.0) {
lp = -Math.pow(-l, 0.43);
} else {
lp = Math.pow(l, 0.43);
}
- if (m < 0.0) {
+ if (m < 0.0) {
mp = -Math.pow(-m, 0.43);
} else {
mp = Math.pow(m, 0.43);
}
- if (s < 0.0) {
+ if (s < 0.0) {
sp = -Math.pow(-s, 0.43);
} else {
sp = Math.pow(s, 0.43);
}
- return (0.4000 * lp) + (0.4000 * mp) + (0.2000 * sp);
- }
+ return (0.4000 * lp) + (0.4000 * mp) + (0.2000 * sp);
+ }
- @Override
+ @Override
public RGB createColor() {
- /**
- * Determine which pair has a higher contrast by selecting
- * the colour with the furthest distance in lightness.
- */
- RGB cfg, cbg1, cbg2;
+ /**
+ * Determine which pair has a higher contrast by selecting the colour with the
+ * furthest distance in lightness.
+ */
+ RGB cfg, cbg1, cbg2;
- if (fg != null) {
- cfg = ColorUtil.getColorValue(fg);
- } else {
- cfg = new RGB(255, 255, 255);
- }
- if (bg1 != null) {
- cbg1 = ColorUtil.getColorValue(bg1);
- } else {
- cbg1 = new RGB(0, 0, 0);
- }
- if (bg2 != null) {
- cbg2 = ColorUtil.getColorValue(bg2);
- } else {
- cbg2 = new RGB(0, 0, 0);
- }
+ if (fg != null) {
+ cfg = ColorUtil.getColorValue(fg);
+ } else {
+ cfg = new RGB(255, 255, 255);
+ }
+ if (bg1 != null) {
+ cbg1 = ColorUtil.getColorValue(bg1);
+ } else {
+ cbg1 = new RGB(0, 0, 0);
+ }
+ if (bg2 != null) {
+ cbg2 = ColorUtil.getColorValue(bg2);
+ } else {
+ cbg2 = new RGB(0, 0, 0);
+ }
- double lfg = lightness(cfg);
- double lbg1 = lightness(cbg1);
- double lbg2 = lightness(cbg2);
+ double lfg = lightness(cfg);
+ double lbg1 = lightness(cbg1);
+ double lbg2 = lightness(cbg2);
- if (Math.abs(lbg1 - lfg) > Math.abs(lbg2 - lfg)) {
- return cbg1;
- }
+ if (Math.abs(lbg1 - lfg) > Math.abs(lbg2 - lfg)) {
+ return cbg1;
+ }
return cbg2;
- }
+ }
- /**
- * This executable extension requires parameters to be explicitly declared
- * via the second method described in the <code>IExecutableExtension</code>
- * documentation. This class expects that there will be three parameters,
- * <code>foreground</code>, <code>background1</code> and
- * <code>background2</code>, that describe the two colors to be blended.
- * These values may either be RGB triples or SWT constants.
- *
- * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
- */
- @Override
- public void setInitializationData(IConfigurationElement config,
- String propertyName, Object data) throws CoreException {
- if (data instanceof Hashtable) {
- Hashtable table = (Hashtable) data;
- fg = (String) table.get("foreground"); //$NON-NLS-1$
- bg1 = (String) table.get("background1"); //$NON-NLS-1$
- bg2 = (String) table.get("background2"); //$NON-NLS-1$
- }
+ /**
+ * This executable extension requires parameters to be explicitly declared via
+ * the second method described in the <code>IExecutableExtension</code>
+ * documentation. This class expects that there will be three parameters,
+ * <code>foreground</code>, <code>background1</code> and
+ * <code>background2</code>, that describe the two colors to be blended. These
+ * values may either be RGB triples or SWT constants.
+ *
+ * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement,
+ * java.lang.String, java.lang.Object)
+ */
+ @Override
+ public void setInitializationData(IConfigurationElement config, String propertyName, Object data)
+ throws CoreException {
+ if (data instanceof Hashtable) {
+ Hashtable table = (Hashtable) data;
+ fg = (String) table.get("foreground"); //$NON-NLS-1$
+ bg1 = (String) table.get("background1"); //$NON-NLS-1$
+ bg2 = (String) table.get("background2"); //$NON-NLS-1$
+ }
- }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/RGBInfoColorFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/RGBInfoColorFactory.java
index 38a725c49c0..9935491adf9 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/RGBInfoColorFactory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/RGBInfoColorFactory.java
@@ -28,11 +28,11 @@ public class RGBInfoColorFactory implements IColorFactory, IExecutableExtension
return rgb;
}
/**
- * Starting with ~Gnome 3.06, COLOR_INFO_BACKGROUND and
- * COLOR_INFO_FOREGROUND are inverted, often producing hoverboxes with
- * black background with white text on an otherwise white background and
- * black text. However, on Windows/Cocoa COLOR_INFO_* looks ok. Solution
- * is to generate a different color based on platform.
+ * Starting with ~Gnome 3.06, COLOR_INFO_BACKGROUND and COLOR_INFO_FOREGROUND
+ * are inverted, often producing hoverboxes with black background with white
+ * text on an otherwise white background and black text. However, on
+ * Windows/Cocoa COLOR_INFO_* looks ok. Solution is to generate a different
+ * color based on platform.
*/
if (Util.isGtk()) {
switch (color) {
@@ -49,7 +49,7 @@ public class RGBInfoColorFactory implements IColorFactory, IExecutableExtension
rgb = ColorUtil.getColorValue("COLOR_INFO_FOREGROUND"); //$NON-NLS-1$
break;
case "background": //$NON-NLS-1$
- rgb = ColorUtil.getColorValue("COLOR_INFO_BACKGROUND"); //$NON-NLS-1$
+ rgb = ColorUtil.getColorValue("COLOR_INFO_BACKGROUND"); //$NON-NLS-1$
break;
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/RGBVisibleContrastColorFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/RGBVisibleContrastColorFactory.java
index 6b73a710b3e..f8c08f220fe 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/RGBVisibleContrastColorFactory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/RGBVisibleContrastColorFactory.java
@@ -88,12 +88,12 @@ public class RGBVisibleContrastColorFactory implements IColorFactory, IExecutabl
}
/**
- * This executable extension requires parameters to be explicitly declared
- * via the second method described in the <code>IExecutableExtension</code>
+ * This executable extension requires parameters to be explicitly declared via
+ * the second method described in the <code>IExecutableExtension</code>
* documentation. This class expects that there will be three parameters,
* <code>foreground</code>, <code>background</code> and
- * <code>alternativeBackground</code>. These values may either be RGB
- * triples or SWT constants.
+ * <code>alternativeBackground</code>. These values may either be RGB triples or
+ * SWT constants.
*/
@Override
public void setInitializationData(IConfigurationElement config, String propertyName, Object data)
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/Theme.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/Theme.java
index e7dcc2aab51..dd5795f72d6 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/Theme.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/Theme.java
@@ -40,87 +40,77 @@ import org.eclipse.ui.themes.IThemeManager;
*/
public class Theme extends EventManager implements ITheme {
- /**
- * The translation bundle in which to look up internationalized text.
- */
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
- .getBundle(Theme.class.getName());
-
- private CascadingColorRegistry themeColorRegistry;
-
- private CascadingFontRegistry themeFontRegistry;
-
- private IThemeDescriptor descriptor;
-
- private IPropertyChangeListener themeListener;
-
- private CascadingMap dataMap;
-
- private ThemeRegistry themeRegistry;
-
- private IPropertyChangeListener propertyListener;
-
- /**
- * @param descriptor
- */
- public Theme(IThemeDescriptor descriptor) {
- themeRegistry = ((ThemeRegistry) WorkbenchPlugin.getDefault()
- .getThemeRegistry());
- this.descriptor = descriptor;
- IWorkbench workbench = PlatformUI.getWorkbench();
- if (descriptor != null) {
- ITheme defaultTheme = workbench.getThemeManager().getTheme(
- IThemeManager.DEFAULT_THEME);
-
- ColorDefinition[] colorDefinitions = this.descriptor.getColors();
- themeColorRegistry = new CascadingColorRegistry(defaultTheme
- .getColorRegistry());
- if (colorDefinitions.length > 0) {
- ThemeElementHelper.populateRegistry(this, colorDefinitions,
- PrefUtil.getInternalPreferenceStore());
- }
-
- FontDefinition[] fontDefinitions = this.descriptor.getFonts();
- themeFontRegistry = new CascadingFontRegistry(defaultTheme
- .getFontRegistry());
- if (fontDefinitions.length > 0) {
- ThemeElementHelper.populateRegistry(this, fontDefinitions,
- PrefUtil.getInternalPreferenceStore());
- }
-
- dataMap = new CascadingMap(((ThemeRegistry) WorkbenchPlugin
- .getDefault().getThemeRegistry()).getData(), descriptor
- .getData());
- }
-
- getColorRegistry().addListener(getCascadeListener());
- getFontRegistry().addListener(getCascadeListener());
- PrefUtil.getInternalPreferenceStore().addPropertyChangeListener(
- getPropertyListener());
- }
-
- /**
- * Listener that is responsible for responding to preference changes.
- *
- * @return the property change listener
- */
- private IPropertyChangeListener getPropertyListener() {
- if (propertyListener == null) {
- propertyListener = new IPropertyChangeListener() {
-
- @Override
+ /**
+ * The translation bundle in which to look up internationalized text.
+ */
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(Theme.class.getName());
+
+ private CascadingColorRegistry themeColorRegistry;
+
+ private CascadingFontRegistry themeFontRegistry;
+
+ private IThemeDescriptor descriptor;
+
+ private IPropertyChangeListener themeListener;
+
+ private CascadingMap dataMap;
+
+ private ThemeRegistry themeRegistry;
+
+ private IPropertyChangeListener propertyListener;
+
+ /**
+ * @param descriptor
+ */
+ public Theme(IThemeDescriptor descriptor) {
+ themeRegistry = ((ThemeRegistry) WorkbenchPlugin.getDefault().getThemeRegistry());
+ this.descriptor = descriptor;
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ if (descriptor != null) {
+ ITheme defaultTheme = workbench.getThemeManager().getTheme(IThemeManager.DEFAULT_THEME);
+
+ ColorDefinition[] colorDefinitions = this.descriptor.getColors();
+ themeColorRegistry = new CascadingColorRegistry(defaultTheme.getColorRegistry());
+ if (colorDefinitions.length > 0) {
+ ThemeElementHelper.populateRegistry(this, colorDefinitions, PrefUtil.getInternalPreferenceStore());
+ }
+
+ FontDefinition[] fontDefinitions = this.descriptor.getFonts();
+ themeFontRegistry = new CascadingFontRegistry(defaultTheme.getFontRegistry());
+ if (fontDefinitions.length > 0) {
+ ThemeElementHelper.populateRegistry(this, fontDefinitions, PrefUtil.getInternalPreferenceStore());
+ }
+
+ dataMap = new CascadingMap(((ThemeRegistry) WorkbenchPlugin.getDefault().getThemeRegistry()).getData(),
+ descriptor.getData());
+ }
+
+ getColorRegistry().addListener(getCascadeListener());
+ getFontRegistry().addListener(getCascadeListener());
+ PrefUtil.getInternalPreferenceStore().addPropertyChangeListener(getPropertyListener());
+ }
+
+ /**
+ * Listener that is responsible for responding to preference changes.
+ *
+ * @return the property change listener
+ */
+ private IPropertyChangeListener getPropertyListener() {
+ if (propertyListener == null) {
+ propertyListener = new IPropertyChangeListener() {
+
+ @Override
public void propertyChange(PropertyChangeEvent event) {
- String[] split = ThemeElementHelper.splitPropertyName(
- Theme.this, event.getProperty());
- String key = split[1];
- String theme = split[0];
- if (key.equals(IWorkbenchPreferenceConstants.CURRENT_THEME_ID)) {
+ String[] split = ThemeElementHelper.splitPropertyName(Theme.this, event.getProperty());
+ String key = split[1];
+ String theme = split[0];
+ if (key.equals(IWorkbenchPreferenceConstants.CURRENT_THEME_ID)) {
return;
}
- try {
- String thisTheme = getId();
+ try {
+ String thisTheme = getId();
- if (Util.equals(thisTheme, theme)) {
+ if (Util.equals(thisTheme, theme)) {
if (getFontRegistry().hasValueFor(key)) {
FontData[] data = event.getNewValue() instanceof String
? PreferenceConverter.basicGetFontData((String) event.getNewValue())
@@ -129,8 +119,7 @@ public class Theme extends EventManager implements ITheme {
getFontRegistry().put(key, data);
processDefaultsTo(key, data);
return;
- }
- else if (getColorRegistry().hasValueFor(key)) {
+ } else if (getColorRegistry().hasValueFor(key)) {
RGB rgb = event.getNewValue() instanceof String
? StringConverter.asRGB((String) event.getNewValue())
: (RGB) event.getNewValue();
@@ -140,166 +129,162 @@ public class Theme extends EventManager implements ITheme {
return;
}
}
- } catch (DataFormatException e) {
- //no-op
- }
- }
-
- /**
- * Process all fonts that default to the given ID.
- *
- * @param key the font ID
- * @param fd the new FontData for defaulted fonts
- */
- private void processDefaultsTo(String key, FontData[] fd) {
+ } catch (DataFormatException e) {
+ // no-op
+ }
+ }
+
+ /**
+ * Process all fonts that default to the given ID.
+ *
+ * @param key the font ID
+ * @param fd the new FontData for defaulted fonts
+ */
+ private void processDefaultsTo(String key, FontData[] fd) {
FontDefinition[] defs = WorkbenchPlugin.getDefault().getThemeRegistry().getFontsFor(getId());
- for (FontDefinition fontDefinition : defs) {
- String defaultsTo = fontDefinition.getDefaultsTo();
- if (defaultsTo != null && defaultsTo.equals(key)) {
+ for (FontDefinition fontDefinition : defs) {
+ String defaultsTo = fontDefinition.getDefaultsTo();
+ if (defaultsTo != null && defaultsTo.equals(key)) {
IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
- if (store.isDefault(ThemeElementHelper
- .createPreferenceKey(Theme.this, fontDefinition.getId()))) {
- getFontRegistry().put(fontDefinition.getId(), fd);
- processDefaultsTo(fontDefinition.getId(), fd);
- }
- }
- }
- }
-
- /**
- * Process all colors that default to the given ID.
- *
- * @param key the color ID
- * @param rgb the new RGB value for defaulted colors
- */
- private void processDefaultsTo(String key, RGB rgb) {
+ if (store.isDefault(
+ ThemeElementHelper.createPreferenceKey(Theme.this, fontDefinition.getId()))) {
+ getFontRegistry().put(fontDefinition.getId(), fd);
+ processDefaultsTo(fontDefinition.getId(), fd);
+ }
+ }
+ }
+ }
+
+ /**
+ * Process all colors that default to the given ID.
+ *
+ * @param key the color ID
+ * @param rgb the new RGB value for defaulted colors
+ */
+ private void processDefaultsTo(String key, RGB rgb) {
ColorDefinition[] defs = WorkbenchPlugin.getDefault().getThemeRegistry().getColorsFor(getId());
- for (ColorDefinition colorDefinition : defs) {
- String defaultsTo = colorDefinition.getDefaultsTo();
- if (defaultsTo != null && defaultsTo.equals(key)) {
+ for (ColorDefinition colorDefinition : defs) {
+ String defaultsTo = colorDefinition.getDefaultsTo();
+ if (defaultsTo != null && defaultsTo.equals(key)) {
IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
if (store.isDefault(
ThemeElementHelper.createPreferenceKey(Theme.this, colorDefinition.getId()))) {
- getColorRegistry().put(colorDefinition.getId(), rgb);
- processDefaultsTo(colorDefinition.getId(), rgb);
- }
- }
- }
- }
- };
- }
- return propertyListener;
- }
-
- /**
- * Listener that is responsible for rebroadcasting events fired from the base font/color registry
- */
- private IPropertyChangeListener getCascadeListener() {
- if (themeListener == null) {
- themeListener = event -> firePropertyChange(event);
- }
- return themeListener;
- }
-
- @Override
+ getColorRegistry().put(colorDefinition.getId(), rgb);
+ processDefaultsTo(colorDefinition.getId(), rgb);
+ }
+ }
+ }
+ }
+ };
+ }
+ return propertyListener;
+ }
+
+ /**
+ * Listener that is responsible for rebroadcasting events fired from the base
+ * font/color registry
+ */
+ private IPropertyChangeListener getCascadeListener() {
+ if (themeListener == null) {
+ themeListener = event -> firePropertyChange(event);
+ }
+ return themeListener;
+ }
+
+ @Override
public ColorRegistry getColorRegistry() {
if (themeColorRegistry != null) {
return themeColorRegistry;
}
- return WorkbenchThemeManager.getInstance()
- .getDefaultThemeColorRegistry();
+ return WorkbenchThemeManager.getInstance().getDefaultThemeColorRegistry();
}
- @Override
+ @Override
public FontRegistry getFontRegistry() {
if (themeFontRegistry != null) {
return themeFontRegistry;
}
- return WorkbenchThemeManager.getInstance()
- .getDefaultThemeFontRegistry();
+ return WorkbenchThemeManager.getInstance().getDefaultThemeFontRegistry();
}
- @Override
+ @Override
public void dispose() {
- if (themeColorRegistry != null) {
- themeColorRegistry.removeListener(themeListener);
- themeColorRegistry.dispose();
- }
- if (themeFontRegistry != null) {
- themeFontRegistry.removeListener(themeListener);
- themeFontRegistry.dispose();
- }
- PrefUtil.getInternalPreferenceStore()
- .removePropertyChangeListener(getPropertyListener());
- }
-
- @Override
+ if (themeColorRegistry != null) {
+ themeColorRegistry.removeListener(themeListener);
+ themeColorRegistry.dispose();
+ }
+ if (themeFontRegistry != null) {
+ themeFontRegistry.removeListener(themeListener);
+ themeFontRegistry.dispose();
+ }
+ PrefUtil.getInternalPreferenceStore().removePropertyChangeListener(getPropertyListener());
+ }
+
+ @Override
public String getId() {
- return descriptor == null ? IThemeManager.DEFAULT_THEME : descriptor
- .getId();
- }
+ return descriptor == null ? IThemeManager.DEFAULT_THEME : descriptor.getId();
+ }
- @Override
+ @Override
public void addPropertyChangeListener(IPropertyChangeListener listener) {
- addListenerObject(listener);
- }
+ addListenerObject(listener);
+ }
- @Override
+ @Override
public void removePropertyChangeListener(IPropertyChangeListener listener) {
- removeListenerObject(listener);
- }
+ removeListenerObject(listener);
+ }
- private void firePropertyChange(PropertyChangeEvent event) {
+ private void firePropertyChange(PropertyChangeEvent event) {
for (Object listener : getListeners()) {
((IPropertyChangeListener) listener).propertyChange(event);
}
- }
+ }
- @Override
+ @Override
public String getLabel() {
- return descriptor == null ? RESOURCE_BUNDLE
- .getString("DefaultTheme.label") : descriptor.getName(); //$NON-NLS-1$
- }
+ return descriptor == null ? RESOURCE_BUNDLE.getString("DefaultTheme.label") : descriptor.getName(); //$NON-NLS-1$
+ }
- @Override
+ @Override
public String getString(String key) {
- if (dataMap != null) {
+ if (dataMap != null) {
return (String) dataMap.get(key);
}
- return (String) themeRegistry.getData().get(key);
- }
+ return (String) themeRegistry.getData().get(key);
+ }
- @Override
+ @Override
public Set keySet() {
- if (dataMap != null) {
+ if (dataMap != null) {
return dataMap.keySet();
}
- return themeRegistry.getData().keySet();
- }
+ return themeRegistry.getData().keySet();
+ }
- @Override
+ @Override
public int getInt(String key) {
- String string = getString(key);
- if (string == null) {
+ String string = getString(key);
+ if (string == null) {
+ return 0;
+ }
+ try {
+ return Integer.parseInt(string);
+ } catch (NumberFormatException e) {
return 0;
}
- try {
- return Integer.parseInt(string);
- } catch (NumberFormatException e) {
- return 0;
- }
- }
-
- @Override
+ }
+
+ @Override
public boolean getBoolean(String key) {
- String string = getString(key);
- if (string == null) {
+ String string = getString(key);
+ if (string == null) {
return false;
}
- return Boolean.parseBoolean(getString(key));
- }
+ return Boolean.parseBoolean(getString(key));
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeDescriptor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeDescriptor.java
index 2f7e98d19c9..bf63b66beed 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeDescriptor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeDescriptor.java
@@ -29,124 +29,123 @@ import org.eclipse.core.runtime.IConfigurationElement;
*/
public class ThemeDescriptor implements IThemeDescriptor {
- /* Theme */
- public static final String ATT_ID = "id";//$NON-NLS-1$
+ /* Theme */
+ public static final String ATT_ID = "id";//$NON-NLS-1$
- private static final String ATT_NAME = "name";//$NON-NLS-1$
+ private static final String ATT_NAME = "name";//$NON-NLS-1$
- private Collection colors = new HashSet();
+ private Collection colors = new HashSet();
- private String description;
+ private String description;
- private Collection fonts = new HashSet();
+ private Collection fonts = new HashSet();
- private String id;
+ private String id;
- private String name;
+ private String name;
- private Map dataMap = new HashMap();
+ private Map dataMap = new HashMap();
- /**
- * Create a new ThemeDescriptor
- * @param id
- */
- public ThemeDescriptor(String id) {
- this.id = id;
- }
+ /**
+ * Create a new ThemeDescriptor
+ *
+ * @param id
+ */
+ public ThemeDescriptor(String id) {
+ this.id = id;
+ }
- /**
- * Add a color override to this descriptor.
- *
- * @param definition the definition to add
- */
- void add(ColorDefinition definition) {
- if (colors.contains(definition)) {
- colors.remove(definition);
+ /**
+ * Add a color override to this descriptor.
+ *
+ * @param definition the definition to add
+ */
+ void add(ColorDefinition definition) {
+ if (colors.contains(definition)) {
+ colors.remove(definition);
}
- colors.add(definition);
- }
-
- /**
- * Add a font override to this descriptor.
- *
- * @param definition the definition to add
- */
- void add(FontDefinition definition) {
- if (fonts.contains(definition)) {
+ colors.add(definition);
+ }
+
+ /**
+ * Add a font override to this descriptor.
+ *
+ * @param definition the definition to add
+ */
+ void add(FontDefinition definition) {
+ if (fonts.contains(definition)) {
return;
}
- fonts.add(definition);
- }
-
- /**
- * Add a data object to this descriptor.
- *
- * @param key the key
- * @param data the data
- */
- void setData(String key, Object data) {
- if (dataMap.containsKey(key)) {
+ fonts.add(definition);
+ }
+
+ /**
+ * Add a data object to this descriptor.
+ *
+ * @param key the key
+ * @param data the data
+ */
+ void setData(String key, Object data) {
+ if (dataMap.containsKey(key)) {
return;
}
- dataMap.put(key, data);
- }
+ dataMap.put(key, data);
+ }
- @Override
+ @Override
public ColorDefinition[] getColors() {
- ColorDefinition[] defs = (ColorDefinition[]) colors
- .toArray(new ColorDefinition[colors.size()]);
- Arrays.sort(defs, IThemeRegistry.ID_COMPARATOR);
- return defs;
- }
+ ColorDefinition[] defs = (ColorDefinition[]) colors.toArray(new ColorDefinition[colors.size()]);
+ Arrays.sort(defs, IThemeRegistry.ID_COMPARATOR);
+ return defs;
+ }
- @Override
+ @Override
public String getDescription() {
- return description;
- }
+ return description;
+ }
- @Override
+ @Override
public FontDefinition[] getFonts() {
- FontDefinition[] defs = (FontDefinition[]) fonts
- .toArray(new FontDefinition[fonts.size()]);
- Arrays.sort(defs, IThemeRegistry.ID_COMPARATOR);
- return defs;
- }
+ FontDefinition[] defs = (FontDefinition[]) fonts.toArray(new FontDefinition[fonts.size()]);
+ Arrays.sort(defs, IThemeRegistry.ID_COMPARATOR);
+ return defs;
+ }
- @Override
+ @Override
public String getId() {
- return id;
- }
+ return id;
+ }
- @Override
+ @Override
public String getName() {
- if (name == null)
- return getId();
- return name;
- }
-
- /*
- * load the name if it is not already set.
- */
- void extractName(IConfigurationElement configElement) {
- if (name == null) {
+ if (name == null)
+ return getId();
+ return name;
+ }
+
+ /*
+ * load the name if it is not already set.
+ */
+ void extractName(IConfigurationElement configElement) {
+ if (name == null) {
name = configElement.getAttribute(ATT_NAME);
}
- }
-
- /**
- * Set the description.
- *
- * @param description the description
- */
- void setDescription(String description) {
- if (this.description == null) {
+ }
+
+ /**
+ * Set the description.
+ *
+ * @param description the description
+ */
+ void setDescription(String description) {
+ if (this.description == null) {
this.description = description;
}
- }
+ }
- @Override
+ @Override
public Map getData() {
- return Collections.unmodifiableMap(dataMap);
- }
+ return Collections.unmodifiableMap(dataMap);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeElementCategory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeElementCategory.java
index d95248e1df8..1aa49222146 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeElementCategory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeElementCategory.java
@@ -23,107 +23,105 @@ import org.eclipse.ui.themes.IThemePreview;
/**
* @since 3.0
*/
-public class ThemeElementCategory implements IPluginContribution,
- IThemeElementDefinition {
-
- private String description;
-
- private IConfigurationElement element;
-
- private String id;
-
- private String parentId;
-
- private String label;
-
- private String pluginId;
-
- /**
- *
- * @param label
- * @param id
- * @param parentId
- * @param description
- * @param pluginId
- * @param element
- */
- public ThemeElementCategory(String label, String id, String parentId,
- String description, String pluginId, IConfigurationElement element) {
-
- this.label = label;
- this.id = id;
- this.parentId = parentId;
- this.description = description;
- this.pluginId = pluginId;
- this.element = element;
- }
-
- /**
- * @return Returns the <code>IColorExample</code> for this category. If one
- * is not available, <code>null</code> is returned.
- * @throws CoreException thrown if there is a problem instantiating the preview
- */
- public IThemePreview createPreview() throws CoreException {
- String classString = element.getAttribute(IWorkbenchRegistryConstants.ATT_CLASS);
- if (classString == null || "".equals(classString)) { //$NON-NLS-1$
+public class ThemeElementCategory implements IPluginContribution, IThemeElementDefinition {
+
+ private String description;
+
+ private IConfigurationElement element;
+
+ private String id;
+
+ private String parentId;
+
+ private String label;
+
+ private String pluginId;
+
+ /**
+ *
+ * @param label
+ * @param id
+ * @param parentId
+ * @param description
+ * @param pluginId
+ * @param element
+ */
+ public ThemeElementCategory(String label, String id, String parentId, String description, String pluginId,
+ IConfigurationElement element) {
+
+ this.label = label;
+ this.id = id;
+ this.parentId = parentId;
+ this.description = description;
+ this.pluginId = pluginId;
+ this.element = element;
+ }
+
+ /**
+ * @return Returns the <code>IColorExample</code> for this category. If one is
+ * not available, <code>null</code> is returned.
+ * @throws CoreException thrown if there is a problem instantiating the preview
+ */
+ public IThemePreview createPreview() throws CoreException {
+ String classString = element.getAttribute(IWorkbenchRegistryConstants.ATT_CLASS);
+ if (classString == null || "".equals(classString)) { //$NON-NLS-1$
return null;
}
- return (IThemePreview) WorkbenchPlugin.createExtension(element,
- IWorkbenchRegistryConstants.ATT_CLASS);
- }
-
- /**
- * @return Returns the description.
- */
- @Override
+ return (IThemePreview) WorkbenchPlugin.createExtension(element, IWorkbenchRegistryConstants.ATT_CLASS);
+ }
+
+ /**
+ * @return Returns the description.
+ */
+ @Override
public String getDescription() {
- return description;
- }
+ return description;
+ }
- /**
- * @return Returns the element.
- */
- public IConfigurationElement getElement() {
- return element;
- }
+ /**
+ * @return Returns the element.
+ */
+ public IConfigurationElement getElement() {
+ return element;
+ }
- @Override
+ @Override
public String getId() {
- return id;
- }
+ return id;
+ }
- @Override
+ @Override
public String getName() {
- return label;
- }
+ return label;
+ }
- @Override
+ @Override
public String getLocalId() {
- return id;
- }
+ return id;
+ }
- @Override
+ @Override
public String getPluginId() {
- return pluginId;
- }
+ return pluginId;
+ }
- /**
- * @return Returns the parentId. May be <code>null</code>.
- */
- public String getParentId() {
- return parentId;
- }
+ /**
+ * @return Returns the parentId. May be <code>null</code>.
+ */
+ public String getParentId() {
+ return parentId;
+ }
- @Override
+ @Override
public boolean equals(Object obj) {
- if (obj instanceof ThemeElementCategory) {
- return getId().equals(((ThemeElementCategory)obj).getId());
- }
- return false;
- }
+ if (obj instanceof ThemeElementCategory) {
+ return getId().equals(((ThemeElementCategory) obj).getId());
+ }
+ return false;
+ }
- @Override
+ @Override
public int hashCode() {
- return id.hashCode();
- }
+ return id.hashCode();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeElementDefinition.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeElementDefinition.java
index 54e45004921..4067293137e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeElementDefinition.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeElementDefinition.java
@@ -23,8 +23,7 @@ import java.util.ResourceBundle;
*
*/
public class ThemeElementDefinition {
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(Theme.class
- .getName());
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(Theme.class.getName());
public interface State {
int UNKNOWN = 0;
@@ -84,8 +83,8 @@ public class ThemeElementDefinition {
* @return String or
*
* <pre>
- * null
- * </pre>
+ * null
+ * </pre>
*
* .
*/
@@ -150,6 +149,7 @@ public class ThemeElementDefinition {
public void removeState(int state) {
this.state &= ~state;
}
+
public boolean isOverridden() {
return (state & State.OVERRIDDEN) != 0;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeElementHelper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeElementHelper.java
index 733f9ab1188..9e78d17b05b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeElementHelper.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeElementHelper.java
@@ -34,8 +34,8 @@ import org.eclipse.ui.themes.IThemeManager;
* @since 3.0
*/
public final class ThemeElementHelper {
- public static void populateDefinition(org.eclipse.e4.ui.css.swt.theme.ITheme cssTheme,
- ITheme theme, FontRegistry registry, FontDefinition definition, IPreferenceStore store) {
+ public static void populateDefinition(org.eclipse.e4.ui.css.swt.theme.ITheme cssTheme, ITheme theme,
+ FontRegistry registry, FontDefinition definition, IPreferenceStore store) {
String key = createPreferenceKey(cssTheme, theme, definition.getId());
String value = store.getString(key);
if (!IPreferenceStore.STRING_DEFAULT_DEFAULT.equals(value)) {
@@ -45,93 +45,86 @@ public final class ThemeElementHelper {
}
}
- public static void populateRegistry(ITheme theme,
- FontDefinition[] definitions, IPreferenceStore store) {
- // sort the definitions by dependant ordering so that we process
- // ancestors before children.
- FontDefinition[] copyOfDefinitions = null;
-
- // the colors to set a default value for, but not a registry value
- FontDefinition[] defaults = null;
- if (!theme.getId().equals(IThemeManager.DEFAULT_THEME)) {
- definitions = addDefaulted(definitions);
- //compute the defaults only if we're setting preferences at this time
- if (store != null) {
+ public static void populateRegistry(ITheme theme, FontDefinition[] definitions, IPreferenceStore store) {
+ // sort the definitions by dependant ordering so that we process
+ // ancestors before children.
+ FontDefinition[] copyOfDefinitions = null;
+
+ // the colors to set a default value for, but not a registry value
+ FontDefinition[] defaults = null;
+ if (!theme.getId().equals(IThemeManager.DEFAULT_THEME)) {
+ definitions = addDefaulted(definitions);
+ // compute the defaults only if we're setting preferences at this time
+ if (store != null) {
defaults = getDefaults(definitions);
}
- }
-
- copyOfDefinitions = new FontDefinition[definitions.length];
- System.arraycopy(definitions, 0, copyOfDefinitions, 0,
- definitions.length);
- Arrays.sort(copyOfDefinitions, new IThemeRegistry.HierarchyComparator(
- definitions));
-
- for (FontDefinition definition : copyOfDefinitions) {
- installFont(definition, theme, store, true);
- }
-
- if (defaults != null) {
- for (FontDefinition fontDef : defaults) {
- installFont(fontDef, theme, store, false);
- }
- }
- }
-
- /**
- * @param definitions
- * @return
- */
- private static FontDefinition[] addDefaulted(FontDefinition[] definitions) {
- IThemeRegistry registry = WorkbenchPlugin.getDefault()
- .getThemeRegistry();
- FontDefinition[] allDefs = registry.getFonts();
-
- SortedSet set = addDefaulted(definitions, allDefs);
- return (FontDefinition[]) set.toArray(new FontDefinition[set.size()]);
- }
-
- /**
- * Installs the given font in the preference store and optionally the font
- * registry.
- *
- * @param definition
- * the font definition
- * @param registry
- * the font registry
- * @param store
- * the preference store from which to set and obtain font data
- * @param setInRegistry
- * whether the color should be put into the registry as well as
- * having its default preference set
- */
- private static void installFont(FontDefinition definition, ITheme theme,
- IPreferenceStore store, boolean setInRegistry) {
- FontRegistry registry = theme.getFontRegistry();
+ }
+
+ copyOfDefinitions = new FontDefinition[definitions.length];
+ System.arraycopy(definitions, 0, copyOfDefinitions, 0, definitions.length);
+ Arrays.sort(copyOfDefinitions, new IThemeRegistry.HierarchyComparator(definitions));
+
+ for (FontDefinition definition : copyOfDefinitions) {
+ installFont(definition, theme, store, true);
+ }
+
+ if (defaults != null) {
+ for (FontDefinition fontDef : defaults) {
+ installFont(fontDef, theme, store, false);
+ }
+ }
+ }
+
+ /**
+ * @param definitions
+ * @return
+ */
+ private static FontDefinition[] addDefaulted(FontDefinition[] definitions) {
+ IThemeRegistry registry = WorkbenchPlugin.getDefault().getThemeRegistry();
+ FontDefinition[] allDefs = registry.getFonts();
+
+ SortedSet set = addDefaulted(definitions, allDefs);
+ return (FontDefinition[]) set.toArray(new FontDefinition[set.size()]);
+ }
+
+ /**
+ * Installs the given font in the preference store and optionally the font
+ * registry.
+ *
+ * @param definition the font definition
+ * @param registry the font registry
+ * @param store the preference store from which to set and obtain font
+ * data
+ * @param setInRegistry whether the color should be put into the registry as
+ * well as having its default preference set
+ */
+ private static void installFont(FontDefinition definition, ITheme theme, IPreferenceStore store,
+ boolean setInRegistry) {
+ FontRegistry registry = theme.getFontRegistry();
Display display = PlatformUI.getWorkbench().getDisplay();
- String id = definition.getId();
- String key = createPreferenceKey(theme, id);
- FontData[] prefFont = store != null ? PreferenceConverter
- .getFontDataArray(store, key) : null;
- FontData[] defaultFont = null;
- if (definition.getValue() != null) {
+ String id = definition.getId();
+ String key = createPreferenceKey(theme, id);
+ FontData[] prefFont = store != null ? PreferenceConverter.getFontDataArray(store, key) : null;
+ FontData[] defaultFont = null;
+ if (definition.getValue() != null) {
defaultFont = definition.getValue();
} else if (definition.getDefaultsTo() != null) {
String defaultsToKey = createPreferenceKey(theme, definition.getDefaultsTo());
FontData[] defaultFontData = PreferenceConverter.getDefaultFontDataArray(store, defaultsToKey);
defaultFont = registry.filterData(defaultFontData, display);
} else {
- // values pushed in from jface property files. Very ugly.
+ // values pushed in from jface property files. Very ugly.
- //If in high contrast, ignore the defaults in jface and use the default (system) font.
- //This is a hack to address bug #205474. See bug #228207 for a future fix.
+ // If in high contrast, ignore the defaults in jface and use the default
+ // (system) font.
+ // This is a hack to address bug #205474. See bug #228207 for a future fix.
FontData[] fontData = JFaceResources.getFontRegistry()
.getFontData(display.getHighContrast() ? JFaceResources.DEFAULT_FONT : id);
defaultFont = registry.bestDataArray(fontData, display);
- }
+ }
- if (setInRegistry) {
+ if (setInRegistry) {
if (prefFont == null || prefFont == PreferenceConverter.getFontDataArrayDefaultDefault()) {
if (definition.getValue() != null) {
prefFont = definition.getValue();
@@ -141,23 +134,23 @@ public final class ThemeElementHelper {
} else {
prefFont = defaultFont;
}
- }
+ }
if (!definition.isEditable()) {
prefFont = defaultFont;
}
- if (prefFont != null) {
- registry.put(id, prefFont);
- }
- }
+ if (prefFont != null) {
+ registry.put(id, prefFont);
+ }
+ }
- if (defaultFont != null && store != null) {
- PreferenceConverter.setDefault(store, key, defaultFont);
- }
- }
+ if (defaultFont != null && store != null) {
+ PreferenceConverter.setDefault(store, key, defaultFont);
+ }
+ }
- public static void populateDefinition(org.eclipse.e4.ui.css.swt.theme.ITheme cssTheme,
- ITheme theme, ColorRegistry registry, ColorDefinition definition, IPreferenceStore store) {
+ public static void populateDefinition(org.eclipse.e4.ui.css.swt.theme.ITheme cssTheme, ITheme theme,
+ ColorRegistry registry, ColorDefinition definition, IPreferenceStore store) {
String key = createPreferenceKey(cssTheme, theme, definition.getId());
String value = store.getString(key);
if (!IPreferenceStore.STRING_DEFAULT_DEFAULT.equals(value)) {
@@ -167,140 +160,129 @@ public final class ThemeElementHelper {
}
}
- public static void populateRegistry(ITheme theme,
- ColorDefinition[] definitions, IPreferenceStore store) {
- // sort the definitions by dependant ordering so that we process
- // ancestors before children.
+ public static void populateRegistry(ITheme theme, ColorDefinition[] definitions, IPreferenceStore store) {
+ // sort the definitions by dependant ordering so that we process
+ // ancestors before children.
- ColorDefinition[] copyOfDefinitions = null;
+ ColorDefinition[] copyOfDefinitions = null;
- // the colors to set a default value for, but not a registry value
- ColorDefinition[] defaults = null;
- if (!theme.getId().equals(IThemeManager.DEFAULT_THEME)) {
- definitions = addDefaulted(definitions);
- //compute defaults only if we're setting preferences
- if (store != null) {
+ // the colors to set a default value for, but not a registry value
+ ColorDefinition[] defaults = null;
+ if (!theme.getId().equals(IThemeManager.DEFAULT_THEME)) {
+ definitions = addDefaulted(definitions);
+ // compute defaults only if we're setting preferences
+ if (store != null) {
defaults = getDefaults(definitions);
}
- }
+ }
- copyOfDefinitions = new ColorDefinition[definitions.length];
- System.arraycopy(definitions, 0, copyOfDefinitions, 0,
- definitions.length);
- Arrays.sort(copyOfDefinitions, new IThemeRegistry.HierarchyComparator(
- definitions));
+ copyOfDefinitions = new ColorDefinition[definitions.length];
+ System.arraycopy(definitions, 0, copyOfDefinitions, 0, definitions.length);
+ Arrays.sort(copyOfDefinitions, new IThemeRegistry.HierarchyComparator(definitions));
- for (ColorDefinition definition : copyOfDefinitions) {
- installColor(definition, theme, store, true);
- }
+ for (ColorDefinition definition : copyOfDefinitions) {
+ installColor(definition, theme, store, true);
+ }
- if (defaults != null) {
+ if (defaults != null) {
for (ColorDefinition colorDef : defaults) {
installColor(colorDef, theme, store, false);
- }
- }
- }
-
- /**
- * Return the definitions that should have their default preference value
- * set but nothing else.
- *
- * @param definitions the definitions that will be fully handled
- * @return the remaining definitions that should be defaulted
- */
- private static ColorDefinition[] getDefaults(ColorDefinition[] definitions) {
- IThemeRegistry registry = WorkbenchPlugin.getDefault()
- .getThemeRegistry();
- ColorDefinition[] allDefs = registry.getColors();
-
- SortedSet set = new TreeSet(IThemeRegistry.ID_COMPARATOR);
- set.addAll(Arrays.asList(allDefs));
- set.removeAll(Arrays.asList(definitions));
- return (ColorDefinition[]) set.toArray(new ColorDefinition[set.size()]);
- }
-
- /**
- * Return the definitions that should have their default preference value
- * set but nothing else.
- *
- * @param definitions the definitions that will be fully handled
- * @return the remaining definitions that should be defaulted
- */
- private static FontDefinition[] getDefaults(FontDefinition[] definitions) {
- IThemeRegistry registry = WorkbenchPlugin.getDefault()
- .getThemeRegistry();
- FontDefinition[] allDefs = registry.getFonts();
-
- SortedSet set = new TreeSet(IThemeRegistry.ID_COMPARATOR);
- set.addAll(Arrays.asList(allDefs));
- set.removeAll(Arrays.asList(definitions));
- return (FontDefinition[]) set.toArray(new FontDefinition[set.size()]);
- }
-
- /**
- * @param definitions
- * @return
- */
- private static ColorDefinition[] addDefaulted(ColorDefinition[] definitions) {
- IThemeRegistry registry = WorkbenchPlugin.getDefault()
- .getThemeRegistry();
- ColorDefinition[] allDefs = registry.getColors();
-
- SortedSet set = addDefaulted(definitions, allDefs);
- return (ColorDefinition[]) set.toArray(new ColorDefinition[set.size()]);
- }
-
- /**
- * @param definitions
- * @param allDefs
- * @return
- */
- private static SortedSet addDefaulted(
- IHierarchalThemeElementDefinition[] definitions,
- IHierarchalThemeElementDefinition[] allDefs) {
- SortedSet set = new TreeSet(IThemeRegistry.ID_COMPARATOR);
- set.addAll(Arrays.asList(definitions));
-
- IHierarchalThemeElementDefinition copy [] = new IHierarchalThemeElementDefinition[allDefs.length];
+ }
+ }
+ }
+
+ /**
+ * Return the definitions that should have their default preference value set
+ * but nothing else.
+ *
+ * @param definitions the definitions that will be fully handled
+ * @return the remaining definitions that should be defaulted
+ */
+ private static ColorDefinition[] getDefaults(ColorDefinition[] definitions) {
+ IThemeRegistry registry = WorkbenchPlugin.getDefault().getThemeRegistry();
+ ColorDefinition[] allDefs = registry.getColors();
+
+ SortedSet set = new TreeSet(IThemeRegistry.ID_COMPARATOR);
+ set.addAll(Arrays.asList(allDefs));
+ set.removeAll(Arrays.asList(definitions));
+ return (ColorDefinition[]) set.toArray(new ColorDefinition[set.size()]);
+ }
+
+ /**
+ * Return the definitions that should have their default preference value set
+ * but nothing else.
+ *
+ * @param definitions the definitions that will be fully handled
+ * @return the remaining definitions that should be defaulted
+ */
+ private static FontDefinition[] getDefaults(FontDefinition[] definitions) {
+ IThemeRegistry registry = WorkbenchPlugin.getDefault().getThemeRegistry();
+ FontDefinition[] allDefs = registry.getFonts();
+
+ SortedSet set = new TreeSet(IThemeRegistry.ID_COMPARATOR);
+ set.addAll(Arrays.asList(allDefs));
+ set.removeAll(Arrays.asList(definitions));
+ return (FontDefinition[]) set.toArray(new FontDefinition[set.size()]);
+ }
+
+ /**
+ * @param definitions
+ * @return
+ */
+ private static ColorDefinition[] addDefaulted(ColorDefinition[] definitions) {
+ IThemeRegistry registry = WorkbenchPlugin.getDefault().getThemeRegistry();
+ ColorDefinition[] allDefs = registry.getColors();
+
+ SortedSet set = addDefaulted(definitions, allDefs);
+ return (ColorDefinition[]) set.toArray(new ColorDefinition[set.size()]);
+ }
+
+ /**
+ * @param definitions
+ * @param allDefs
+ * @return
+ */
+ private static SortedSet addDefaulted(IHierarchalThemeElementDefinition[] definitions,
+ IHierarchalThemeElementDefinition[] allDefs) {
+ SortedSet set = new TreeSet(IThemeRegistry.ID_COMPARATOR);
+ set.addAll(Arrays.asList(definitions));
+
+ IHierarchalThemeElementDefinition copy[] = new IHierarchalThemeElementDefinition[allDefs.length];
System.arraycopy(allDefs, 0, copy, 0, allDefs.length);
- Arrays.sort(allDefs, new IThemeRegistry.HierarchyComparator(copy));
- for (IHierarchalThemeElementDefinition def : allDefs) {
- if (def.getDefaultsTo() != null) {
- if (set.contains(def.getDefaultsTo())) {
+ Arrays.sort(allDefs, new IThemeRegistry.HierarchyComparator(copy));
+ for (IHierarchalThemeElementDefinition def : allDefs) {
+ if (def.getDefaultsTo() != null) {
+ if (set.contains(def.getDefaultsTo())) {
set.add(def);
}
- }
- }
- return set;
- }
-
- /**
- * Installs the given color in the preference store and optionally the color
- * registry.
- *
- * @param definition
- * the color definition
- * @param theme
- * the theme defining the color
- * @param store
- * the preference store from which to set and obtain color data
- * @param setInRegistry
- * whether the color should be put into the registry
- */
-
- private static void installColor(ColorDefinition definition, ITheme theme,
- IPreferenceStore store, boolean setInRegistry) {
-
- //TODO: store shouldn't be null, should assert instead of checking null all over
-
- ColorRegistry registry = theme.getColorRegistry();
-
- String id = definition.getId();
- String key = createPreferenceKey(theme, id);
- RGB prefColor = store != null
- ? PreferenceConverter.getColor(store, key)
- : null;
+ }
+ }
+ return set;
+ }
+
+ /**
+ * Installs the given color in the preference store and optionally the color
+ * registry.
+ *
+ * @param definition the color definition
+ * @param theme the theme defining the color
+ * @param store the preference store from which to set and obtain color
+ * data
+ * @param setInRegistry whether the color should be put into the registry
+ */
+
+ private static void installColor(ColorDefinition definition, ITheme theme, IPreferenceStore store,
+ boolean setInRegistry) {
+
+ // TODO: store shouldn't be null, should assert instead of checking null all
+ // over
+
+ ColorRegistry registry = theme.getColorRegistry();
+
+ String id = definition.getId();
+ String key = createPreferenceKey(theme, id);
+ RGB prefColor = store != null ? PreferenceConverter.getColor(store, key) : null;
RGB defaultColor;
if (definition.getValue() != null) {
defaultColor = definition.getValue();
@@ -311,7 +293,7 @@ public final class ThemeElementHelper {
defaultColor = null;
}
- if (defaultColor == null) {
+ if (defaultColor == null) {
// default is null, likely because we have a bad definition - the
// defaultsTo color doesn't exist. We still need a sensible default,
// however.
@@ -330,62 +312,59 @@ public final class ThemeElementHelper {
prefColor = defaultColor;
}
- if (setInRegistry) {
- registry.put(id, prefColor);
- }
-
- if (store != null) {
- PreferenceConverter.setDefault(store, key, defaultColor);
- }
- }
-
- /**
- * @param theme
- * @param id
- * @return
- */
- public static String createPreferenceKey(ITheme theme, String id) {
- String themeId = theme.getId();
- if (themeId.equals(IThemeManager.DEFAULT_THEME)) {
+ if (setInRegistry) {
+ registry.put(id, prefColor);
+ }
+
+ if (store != null) {
+ PreferenceConverter.setDefault(store, key, defaultColor);
+ }
+ }
+
+ /**
+ * @param theme
+ * @param id
+ * @return
+ */
+ public static String createPreferenceKey(ITheme theme, String id) {
+ String themeId = theme.getId();
+ if (themeId.equals(IThemeManager.DEFAULT_THEME)) {
return id;
}
- return themeId + '.' + id;
- }
+ return themeId + '.' + id;
+ }
- public static String createPreferenceKey(org.eclipse.e4.ui.css.swt.theme.ITheme cssTheme,
- ITheme theme, String id) {
+ public static String createPreferenceKey(org.eclipse.e4.ui.css.swt.theme.ITheme cssTheme, ITheme theme, String id) {
String cssThemePrefix = cssTheme != null ? cssTheme.getId() + '.' : ""; //$NON-NLS-1$
return cssThemePrefix + createPreferenceKey(theme, id);
}
- /**
- * @param theme
- * @param property
- * @return
- */
- public static String[] splitPropertyName(Theme theme, String property) {
- IThemeDescriptor[] descriptors = WorkbenchPlugin.getDefault()
- .getThemeRegistry().getThemes();
+ /**
+ * @param theme
+ * @param property
+ * @return
+ */
+ public static String[] splitPropertyName(Theme theme, String property) {
+ IThemeDescriptor[] descriptors = WorkbenchPlugin.getDefault().getThemeRegistry().getThemes();
for (IThemeDescriptor themeDescriptor : descriptors) {
String id = themeDescriptor.getId();
if (property.startsWith(id + '.')) { // the property starts with
// a known theme ID -
// extract and return it and
// the remaining property
- return new String[] { property.substring(0, id.length()),
- property.substring(id.length() + 1) };
+ return new String[] { property.substring(0, id.length()), property.substring(id.length() + 1) };
}
}
// default is simply return the default theme ID and the raw property
return new String[] { IThemeManager.DEFAULT_THEME, property };
- }
+ }
- /**
+ /**
* Not intended to be instantiated.
*/
- private ThemeElementHelper() {
- // no-op
- }
+ private ThemeElementHelper() {
+ // no-op
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeRegistry.java
index 3313ba158a3..9ee4b5d951f 100755
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeRegistry.java
@@ -31,257 +31,253 @@ import org.eclipse.ui.themes.IThemeManager;
*/
public class ThemeRegistry implements IThemeRegistry {
- private List themes;
-
- private List colors;
-
- private List fonts;
-
- private List categories;
-
- private Map dataMap;
-
- /**
- * Map from String (categoryId) -> Set (presentationIds)
- */
- private Map categoryBindingMap;
-
- /**
- * Create a new ThemeRegistry.
- */
- public ThemeRegistry() {
- themes = new ArrayList();
- colors = new ArrayList();
- fonts = new ArrayList();
- categories = new ArrayList();
- dataMap = new HashMap();
- categoryBindingMap = new HashMap();
- }
-
- /**
- * Add a descriptor to the registry.
- */
- void add(IThemeDescriptor desc) {
- if (findTheme(desc.getId()) != null) {
+ private List themes;
+
+ private List colors;
+
+ private List fonts;
+
+ private List categories;
+
+ private Map dataMap;
+
+ /**
+ * Map from String (categoryId) -> Set (presentationIds)
+ */
+ private Map categoryBindingMap;
+
+ /**
+ * Create a new ThemeRegistry.
+ */
+ public ThemeRegistry() {
+ themes = new ArrayList();
+ colors = new ArrayList();
+ fonts = new ArrayList();
+ categories = new ArrayList();
+ dataMap = new HashMap();
+ categoryBindingMap = new HashMap();
+ }
+
+ /**
+ * Add a descriptor to the registry.
+ */
+ void add(IThemeDescriptor desc) {
+ if (findTheme(desc.getId()) != null) {
return;
}
- themes.add(desc);
- }
+ themes.add(desc);
+ }
- /**
- * Add a descriptor to the registry.
- */
- void add(ColorDefinition desc) {
- addOrReplaceDescriptor(colors, desc);
- }
+ /**
+ * Add a descriptor to the registry.
+ */
+ void add(ColorDefinition desc) {
+ addOrReplaceDescriptor(colors, desc);
+ }
- @Override
+ @Override
public ThemeElementCategory findCategory(String id) {
- return (ThemeElementCategory) findDescriptor(getCategories(), id);
- }
+ return (ThemeElementCategory) findDescriptor(getCategories(), id);
+ }
- @Override
+ @Override
public ColorDefinition findColor(String id) {
- return (ColorDefinition) findDescriptor(getColors(), id);
- }
+ return (ColorDefinition) findDescriptor(getColors(), id);
+ }
- @Override
+ @Override
public IThemeDescriptor findTheme(String id) {
- return (IThemeDescriptor) findDescriptor(getThemes(), id);
- }
-
- /**
- * @param descriptors
- * @param id
- * @return
- */
- private IThemeElementDefinition findDescriptor(
- IThemeElementDefinition[] descriptors, String id) {
- int idx = Arrays.binarySearch(descriptors, id, ID_COMPARATOR);
- if (idx < 0) {
+ return (IThemeDescriptor) findDescriptor(getThemes(), id);
+ }
+
+ /**
+ * @param descriptors
+ * @param id
+ * @return
+ */
+ private IThemeElementDefinition findDescriptor(IThemeElementDefinition[] descriptors, String id) {
+ int idx = Arrays.binarySearch(descriptors, id, ID_COMPARATOR);
+ if (idx < 0) {
return null;
}
- return descriptors[idx];
- }
-
- /*
- * Add newElement to descriptors.
- * If one with the same id already exists, replace it.
- * Return the existing element in the case of replacing, null in the case of adding.
- */
- private IThemeElementDefinition addOrReplaceDescriptor(
- List descriptors, IThemeElementDefinition newElement) {
- String id = newElement.getId();
- for (int i = 0; i < descriptors.size(); i++) {
- IThemeElementDefinition existingElement = (IThemeElementDefinition) descriptors.get(i);
- if(existingElement.getId().equals(id)) {
- descriptors.remove(i);
- descriptors.add(newElement);
- return existingElement;
- }
+ return descriptors[idx];
+ }
+
+ /*
+ * Add newElement to descriptors. If one with the same id already exists,
+ * replace it. Return the existing element in the case of replacing, null in the
+ * case of adding.
+ */
+ private IThemeElementDefinition addOrReplaceDescriptor(List descriptors, IThemeElementDefinition newElement) {
+ String id = newElement.getId();
+ for (int i = 0; i < descriptors.size(); i++) {
+ IThemeElementDefinition existingElement = (IThemeElementDefinition) descriptors.get(i);
+ if (existingElement.getId().equals(id)) {
+ descriptors.remove(i);
+ descriptors.add(newElement);
+ return existingElement;
+ }
}
- descriptors.add(newElement);
- return null;
- }
+ descriptors.add(newElement);
+ return null;
+ }
- @Override
+ @Override
public IThemeDescriptor[] getThemes() {
- int nSize = themes.size();
- IThemeDescriptor[] retArray = new IThemeDescriptor[nSize];
- themes.toArray(retArray);
- Arrays.sort(retArray, ID_COMPARATOR);
- return retArray;
- }
-
- @Override
+ int nSize = themes.size();
+ IThemeDescriptor[] retArray = new IThemeDescriptor[nSize];
+ themes.toArray(retArray);
+ Arrays.sort(retArray, ID_COMPARATOR);
+ return retArray;
+ }
+
+ @Override
public ColorDefinition[] getColors() {
- int nSize = colors.size();
- ColorDefinition[] retArray = new ColorDefinition[nSize];
- colors.toArray(retArray);
- Arrays.sort(retArray, ID_COMPARATOR);
- return retArray;
- }
-
- @Override
+ int nSize = colors.size();
+ ColorDefinition[] retArray = new ColorDefinition[nSize];
+ colors.toArray(retArray);
+ Arrays.sort(retArray, ID_COMPARATOR);
+ return retArray;
+ }
+
+ @Override
public ColorDefinition[] getColorsFor(String themeId) {
- ColorDefinition[] defs = getColors();
- if (themeId.equals(IThemeManager.DEFAULT_THEME)) {
+ ColorDefinition[] defs = getColors();
+ if (themeId.equals(IThemeManager.DEFAULT_THEME)) {
return defs;
}
- IThemeDescriptor desc = findTheme(themeId);
- ColorDefinition[] overrides = desc.getColors();
- return (ColorDefinition[]) overlay(defs, overrides);
- }
+ IThemeDescriptor desc = findTheme(themeId);
+ ColorDefinition[] overrides = desc.getColors();
+ return (ColorDefinition[]) overlay(defs, overrides);
+ }
- @Override
+ @Override
public FontDefinition[] getFontsFor(String themeId) {
- FontDefinition[] defs = getFonts();
- if (themeId.equals(IThemeManager.DEFAULT_THEME)) {
+ FontDefinition[] defs = getFonts();
+ if (themeId.equals(IThemeManager.DEFAULT_THEME)) {
return defs;
}
- IThemeDescriptor desc = findTheme(themeId);
- FontDefinition[] overrides = desc.getFonts();
- return (FontDefinition[]) overlay(defs, overrides);
- }
-
- /**
- * Overlay the overrides onto the base definitions.
- *
- * @param defs the base definitions
- * @param overrides the overrides
- * @return the overlayed elements
- */
- private IThemeElementDefinition[] overlay(IThemeElementDefinition[] defs,
- IThemeElementDefinition[] overrides) {
- for (IThemeElementDefinition override : overrides) {
+ IThemeDescriptor desc = findTheme(themeId);
+ FontDefinition[] overrides = desc.getFonts();
+ return (FontDefinition[]) overlay(defs, overrides);
+ }
+
+ /**
+ * Overlay the overrides onto the base definitions.
+ *
+ * @param defs the base definitions
+ * @param overrides the overrides
+ * @return the overlayed elements
+ */
+ private IThemeElementDefinition[] overlay(IThemeElementDefinition[] defs, IThemeElementDefinition[] overrides) {
+ for (IThemeElementDefinition override : overrides) {
int idx = Arrays.binarySearch(defs, override, IThemeRegistry.ID_COMPARATOR);
- if (idx >= 0) {
- defs[idx] = overlay(defs[idx], override);
- }
- }
- return defs;
- }
-
- /**
- * Overlay the override onto the base definition.
- *
- * @param defs the base definition
- * @param overrides the override
- * @return the overlayed element
- */
- private IThemeElementDefinition overlay(IThemeElementDefinition original,
- IThemeElementDefinition overlay) {
- if (original instanceof ColorDefinition) {
- ColorDefinition originalColor = (ColorDefinition) original;
- ColorDefinition overlayColor = (ColorDefinition) overlay;
- return new ColorDefinition(originalColor, overlayColor.getValue());
- } else if (original instanceof FontDefinition) {
- FontDefinition originalFont = (FontDefinition) original;
- FontDefinition overlayFont = (FontDefinition) overlay;
- return new FontDefinition(originalFont, overlayFont.getValue());
- }
- return null;
- }
-
- /**
- * @param definition
- */
- void add(FontDefinition definition) {
- if (findFont(definition.getId()) != null) {
+ if (idx >= 0) {
+ defs[idx] = overlay(defs[idx], override);
+ }
+ }
+ return defs;
+ }
+
+ /**
+ * Overlay the override onto the base definition.
+ *
+ * @param defs the base definition
+ * @param overrides the override
+ * @return the overlayed element
+ */
+ private IThemeElementDefinition overlay(IThemeElementDefinition original, IThemeElementDefinition overlay) {
+ if (original instanceof ColorDefinition) {
+ ColorDefinition originalColor = (ColorDefinition) original;
+ ColorDefinition overlayColor = (ColorDefinition) overlay;
+ return new ColorDefinition(originalColor, overlayColor.getValue());
+ } else if (original instanceof FontDefinition) {
+ FontDefinition originalFont = (FontDefinition) original;
+ FontDefinition overlayFont = (FontDefinition) overlay;
+ return new FontDefinition(originalFont, overlayFont.getValue());
+ }
+ return null;
+ }
+
+ /**
+ * @param definition
+ */
+ void add(FontDefinition definition) {
+ if (findFont(definition.getId()) != null) {
return;
}
- fonts.add(definition);
- }
+ fonts.add(definition);
+ }
- @Override
+ @Override
public FontDefinition[] getFonts() {
- int nSize = fonts.size();
- FontDefinition[] retArray = new FontDefinition[nSize];
- fonts.toArray(retArray);
- Arrays.sort(retArray, ID_COMPARATOR);
- return retArray;
- }
-
- @Override
+ int nSize = fonts.size();
+ FontDefinition[] retArray = new FontDefinition[nSize];
+ fonts.toArray(retArray);
+ Arrays.sort(retArray, ID_COMPARATOR);
+ return retArray;
+ }
+
+ @Override
public FontDefinition findFont(String id) {
- return (FontDefinition) findDescriptor(getFonts(), id);
- }
-
- /**
- * @param definition
- */
- void add(ThemeElementCategory definition) {
- if (findCategory(definition.getId()) != null) {
+ return (FontDefinition) findDescriptor(getFonts(), id);
+ }
+
+ /**
+ * @param definition
+ */
+ void add(ThemeElementCategory definition) {
+ if (findCategory(definition.getId()) != null) {
return;
}
- categories.add(definition);
- }
+ categories.add(definition);
+ }
- @Override
+ @Override
public ThemeElementCategory[] getCategories() {
- int nSize = categories.size();
- ThemeElementCategory[] retArray = new ThemeElementCategory[nSize];
- categories.toArray(retArray);
- Arrays.sort(retArray, ID_COMPARATOR);
- return retArray;
- }
-
- /**
- * @param name
- * @param value
- */
- void setData(String name, String value) {
- if (dataMap.containsKey(name)) {
+ int nSize = categories.size();
+ ThemeElementCategory[] retArray = new ThemeElementCategory[nSize];
+ categories.toArray(retArray);
+ Arrays.sort(retArray, ID_COMPARATOR);
+ return retArray;
+ }
+
+ /**
+ * @param name
+ * @param value
+ */
+ void setData(String name, String value) {
+ if (dataMap.containsKey(name)) {
return;
}
- dataMap.put(name, value);
- }
+ dataMap.put(name, value);
+ }
- @Override
+ @Override
public Map getData() {
- return Collections.unmodifiableMap(dataMap);
- }
-
- /**
- * Add the data from another map to this data
- *
- * @param otherData the other data to add
- */
- public void addData(Map<?, ?> otherData) {
+ return Collections.unmodifiableMap(dataMap);
+ }
+
+ /**
+ * Add the data from another map to this data
+ *
+ * @param otherData the other data to add
+ */
+ public void addData(Map<?, ?> otherData) {
for (Entry<?, ?> entry : otherData.entrySet()) {
Object key = entry.getKey();
- if (dataMap.containsKey(key)) {
+ if (dataMap.containsKey(key)) {
continue;
}
dataMap.put(key, entry.getValue());
- }
- }
+ }
+ }
- @Override
+ @Override
public Set getPresentationsBindingsFor(ThemeElementCategory category) {
- return (Set) categoryBindingMap.get(category.getId());
- }
+ return (Set) categoryBindingMap.get(category.getId());
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeRegistryReader.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeRegistryReader.java
index 54730cb3798..5a1f8c27213 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeRegistryReader.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemeRegistryReader.java
@@ -35,426 +35,405 @@ import org.eclipse.ui.themes.IColorFactory;
*/
public class ThemeRegistryReader extends RegistryReader {
- /**
- * The translation bundle in which to look up internationalized text.
- */
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
- .getBundle(ThemeRegistryReader.class.getName());
-
- private Collection categoryDefinitions = new HashSet();
-
- private Collection colorDefinitions = new HashSet();
-
- private Collection fontDefinitions = new HashSet();
-
- private ThemeDescriptor themeDescriptor = null;
-
- private ThemeRegistry themeRegistry;
-
- private Map dataMap = new HashMap();
-
- /**
- * ThemeRegistryReader constructor comment.
- */
- public ThemeRegistryReader() {
- super();
- }
-
- /**
- * Returns the category definitions.
- *
- * @return the category definitions
- */
- public Collection getCategoryDefinitions() {
- return categoryDefinitions;
- }
-
- /**
- * Returns the color definitions.
- *
- * @return the color definitions
- */
- public Collection getColorDefinitions() {
- return colorDefinitions;
- }
-
- /**
- * Returns the data map.
- *
- * @return the data map
- */
- public Map getData() {
- return dataMap;
- }
-
- /**
- * Returns the font definitions.
- *
- * @return the font definitions
- */
- public Collection getFontDefinitions() {
- return fontDefinitions;
- }
-
- /**
- * Read a category.
- *
- * @param element the element to read
- * @return the new category
- */
- private ThemeElementCategory readCategory(IConfigurationElement element) {
- String name = element.getAttribute(IWorkbenchRegistryConstants.ATT_LABEL);
-
- String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
- String parentId = element.getAttribute(IWorkbenchRegistryConstants.ATT_PARENT_ID);
-
- String description = null;
-
- IConfigurationElement[] descriptions = element
- .getChildren(IWorkbenchRegistryConstants.TAG_DESCRIPTION);
-
- if (descriptions.length > 0) {
+ /**
+ * The translation bundle in which to look up internationalized text.
+ */
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(ThemeRegistryReader.class.getName());
+
+ private Collection categoryDefinitions = new HashSet();
+
+ private Collection colorDefinitions = new HashSet();
+
+ private Collection fontDefinitions = new HashSet();
+
+ private ThemeDescriptor themeDescriptor = null;
+
+ private ThemeRegistry themeRegistry;
+
+ private Map dataMap = new HashMap();
+
+ /**
+ * ThemeRegistryReader constructor comment.
+ */
+ public ThemeRegistryReader() {
+ super();
+ }
+
+ /**
+ * Returns the category definitions.
+ *
+ * @return the category definitions
+ */
+ public Collection getCategoryDefinitions() {
+ return categoryDefinitions;
+ }
+
+ /**
+ * Returns the color definitions.
+ *
+ * @return the color definitions
+ */
+ public Collection getColorDefinitions() {
+ return colorDefinitions;
+ }
+
+ /**
+ * Returns the data map.
+ *
+ * @return the data map
+ */
+ public Map getData() {
+ return dataMap;
+ }
+
+ /**
+ * Returns the font definitions.
+ *
+ * @return the font definitions
+ */
+ public Collection getFontDefinitions() {
+ return fontDefinitions;
+ }
+
+ /**
+ * Read a category.
+ *
+ * @param element the element to read
+ * @return the new category
+ */
+ private ThemeElementCategory readCategory(IConfigurationElement element) {
+ String name = element.getAttribute(IWorkbenchRegistryConstants.ATT_LABEL);
+
+ String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
+ String parentId = element.getAttribute(IWorkbenchRegistryConstants.ATT_PARENT_ID);
+
+ String description = null;
+
+ IConfigurationElement[] descriptions = element.getChildren(IWorkbenchRegistryConstants.TAG_DESCRIPTION);
+
+ if (descriptions.length > 0) {
description = descriptions[0].getValue();
}
- return new ThemeElementCategory(name, id, parentId, description,
- element.getContributor().getName(), element);
- }
+ return new ThemeElementCategory(name, id, parentId, description, element.getContributor().getName(), element);
+ }
- /**
- * Read a color.
- *
- * @param element the element to read
- * @return the new color
- */
- private ColorDefinition readColor(IConfigurationElement element) {
- String name = element.getAttribute(IWorkbenchRegistryConstants.ATT_LABEL);
+ /**
+ * Read a color.
+ *
+ * @param element the element to read
+ * @return the new color
+ */
+ private ColorDefinition readColor(IConfigurationElement element) {
+ String name = element.getAttribute(IWorkbenchRegistryConstants.ATT_LABEL);
- String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
+ String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
- String defaultMapping = element.getAttribute(IWorkbenchRegistryConstants.ATT_DEFAULTS_TO);
+ String defaultMapping = element.getAttribute(IWorkbenchRegistryConstants.ATT_DEFAULTS_TO);
- String value = getPlatformSpecificColorValue(element
- .getChildren(IWorkbenchRegistryConstants.TAG_COLORVALUE));
+ String value = getPlatformSpecificColorValue(element.getChildren(IWorkbenchRegistryConstants.TAG_COLORVALUE));
- if (value == null) {
- value = getColorValue(element);
- }
+ if (value == null) {
+ value = getColorValue(element);
+ }
- if ((value == null && defaultMapping == null)
- || (value != null && defaultMapping != null)) {
- logError(element, RESOURCE_BUNDLE.getString("Colors.badDefault")); //$NON-NLS-1$
- return null;
- }
+ if ((value == null && defaultMapping == null) || (value != null && defaultMapping != null)) {
+ logError(element, RESOURCE_BUNDLE.getString("Colors.badDefault")); //$NON-NLS-1$
+ return null;
+ }
- String categoryId = element.getAttribute(IWorkbenchRegistryConstants.ATT_CATEGORY_ID);
+ String categoryId = element.getAttribute(IWorkbenchRegistryConstants.ATT_CATEGORY_ID);
- String description = null;
- boolean isEditable = true;
- String isEditableString = element.getAttribute(IWorkbenchRegistryConstants.ATT_IS_EDITABLE);
- if (isEditableString != null) {
- isEditable = Boolean.parseBoolean(isEditableString);
- }
+ String description = null;
+ boolean isEditable = true;
+ String isEditableString = element.getAttribute(IWorkbenchRegistryConstants.ATT_IS_EDITABLE);
+ if (isEditableString != null) {
+ isEditable = Boolean.parseBoolean(isEditableString);
+ }
- IConfigurationElement[] descriptions = element
- .getChildren(IWorkbenchRegistryConstants.TAG_DESCRIPTION);
+ IConfigurationElement[] descriptions = element.getChildren(IWorkbenchRegistryConstants.TAG_DESCRIPTION);
- if (descriptions.length > 0) {
+ if (descriptions.length > 0) {
description = descriptions[0].getValue();
}
- return new ColorDefinition(name, id, defaultMapping, value, categoryId,
- isEditable, description, element.getDeclaringExtension()
- .getContributor().getName());
- }
-
- /**
- * Gets the color value, either via the value attribute or from a color
- * factory.
- *
- * @param element the element to check
- * @return the color string
- */
- private String getColorValue(IConfigurationElement element) {
- if (element == null) {
+ return new ColorDefinition(name, id, defaultMapping, value, categoryId, isEditable, description,
+ element.getDeclaringExtension().getContributor().getName());
+ }
+
+ /**
+ * Gets the color value, either via the value attribute or from a color factory.
+ *
+ * @param element the element to check
+ * @return the color string
+ */
+ private String getColorValue(IConfigurationElement element) {
+ if (element == null) {
return null;
}
- String value = element.getAttribute(IWorkbenchRegistryConstants.ATT_VALUE);
- if (value == null) {
- value = checkColorFactory(element);
- }
- return value;
- }
-
- /**
- * Check for platform specific color values. This will return the
- * "best match" for the current platform.
- *
- * @param elements the elements to check
- * @return the platform specific color, if any
- */
- private String getPlatformSpecificColorValue(
- IConfigurationElement[] elements) {
- return getColorValue(getBestPlatformMatch(elements));
- }
-
- /**
- * Get the element that has os/ws attributes that best match the current
- * platform.
- *
- * @param elements the elements to check
- * @return the best match, if any
- */
- private IConfigurationElement getBestPlatformMatch(
- IConfigurationElement[] elements) {
- IConfigurationElement match = null;
-
- String osname = Platform.getOS();
- String wsname = Platform.getWS();
-
- for (IConfigurationElement element : elements) {
- String elementOs = element.getAttribute(IWorkbenchRegistryConstants.ATT_OS);
- String elementWs = element.getAttribute(IWorkbenchRegistryConstants.ATT_WS);
-
- if (osname.equalsIgnoreCase(elementOs)) {
- if (wsname.equalsIgnoreCase(elementWs)) {
- // best possible match. Return
- return element;
- }
- match = element;
- } else if (wsname.equalsIgnoreCase(elementWs)) {
- match = element;
- }
- }
-
- return match;
- }
-
- @Override
+ String value = element.getAttribute(IWorkbenchRegistryConstants.ATT_VALUE);
+ if (value == null) {
+ value = checkColorFactory(element);
+ }
+ return value;
+ }
+
+ /**
+ * Check for platform specific color values. This will return the "best match"
+ * for the current platform.
+ *
+ * @param elements the elements to check
+ * @return the platform specific color, if any
+ */
+ private String getPlatformSpecificColorValue(IConfigurationElement[] elements) {
+ return getColorValue(getBestPlatformMatch(elements));
+ }
+
+ /**
+ * Get the element that has os/ws attributes that best match the current
+ * platform.
+ *
+ * @param elements the elements to check
+ * @return the best match, if any
+ */
+ private IConfigurationElement getBestPlatformMatch(IConfigurationElement[] elements) {
+ IConfigurationElement match = null;
+
+ String osname = Platform.getOS();
+ String wsname = Platform.getWS();
+
+ for (IConfigurationElement element : elements) {
+ String elementOs = element.getAttribute(IWorkbenchRegistryConstants.ATT_OS);
+ String elementWs = element.getAttribute(IWorkbenchRegistryConstants.ATT_WS);
+
+ if (osname.equalsIgnoreCase(elementOs)) {
+ if (wsname.equalsIgnoreCase(elementWs)) {
+ // best possible match. Return
+ return element;
+ }
+ match = element;
+ } else if (wsname.equalsIgnoreCase(elementWs)) {
+ match = element;
+ }
+ }
+
+ return match;
+ }
+
+ @Override
public boolean readElement(IConfigurationElement element) {
- String elementName = element.getName();
- if (themeDescriptor == null && elementName.equals(IWorkbenchRegistryConstants.TAG_COLORDEFINITION)) {
- ColorDefinition definition = readColor(element);
- if (definition != null) {
- if (!colorDefinitions.contains(definition)) {
- colorDefinitions.add(definition);
- themeRegistry.add(definition);
- }
- }
- return true;
- } else if (themeDescriptor != null
- && elementName.equals(IWorkbenchRegistryConstants.TAG_COLOROVERRIDE)) {
- ColorDefinition definition = readColor(element);
- if (definition != null) {
- themeDescriptor.add(definition);
- }
- return true;
- } else if (themeDescriptor == null
- && elementName.equals(IWorkbenchRegistryConstants.TAG_FONTDEFINITION)) {
- FontDefinition definition = readFont(element);
- if (definition != null) {
- if (!fontDefinitions.contains(definition)) {
- fontDefinitions.add(definition);
- themeRegistry.add(definition);
- }
- }
- return true;
- } else if (themeDescriptor != null
- && elementName.equals(IWorkbenchRegistryConstants.TAG_FONTOVERRIDE)) {
- FontDefinition definition = readFont(element);
- if (definition != null) {
- themeDescriptor.add(definition);
- }
- return true;
- } else if (themeDescriptor == null
- && elementName.equals(IWorkbenchRegistryConstants.TAG_CATEGORYDEFINITION)) {
- ThemeElementCategory definition = readCategory(element);
- if (definition != null) {
- if (!categoryDefinitions.contains(definition)) {
- categoryDefinitions.add(definition);
- themeRegistry.add(definition);
- }
- }
- return true;
- } else if (element.getName().equals(IWorkbenchRegistryConstants.TAG_THEME)) {
- if (themeDescriptor != null) {
- logError(element, RESOURCE_BUNDLE
- .getString("Themes.badNesting")); //$NON-NLS-1$
+ String elementName = element.getName();
+ if (themeDescriptor == null && elementName.equals(IWorkbenchRegistryConstants.TAG_COLORDEFINITION)) {
+ ColorDefinition definition = readColor(element);
+ if (definition != null) {
+ if (!colorDefinitions.contains(definition)) {
+ colorDefinitions.add(definition);
+ themeRegistry.add(definition);
+ }
+ }
+ return true;
+ } else if (themeDescriptor != null && elementName.equals(IWorkbenchRegistryConstants.TAG_COLOROVERRIDE)) {
+ ColorDefinition definition = readColor(element);
+ if (definition != null) {
+ themeDescriptor.add(definition);
+ }
+ return true;
+ } else if (themeDescriptor == null && elementName.equals(IWorkbenchRegistryConstants.TAG_FONTDEFINITION)) {
+ FontDefinition definition = readFont(element);
+ if (definition != null) {
+ if (!fontDefinitions.contains(definition)) {
+ fontDefinitions.add(definition);
+ themeRegistry.add(definition);
+ }
+ }
+ return true;
+ } else if (themeDescriptor != null && elementName.equals(IWorkbenchRegistryConstants.TAG_FONTOVERRIDE)) {
+ FontDefinition definition = readFont(element);
+ if (definition != null) {
+ themeDescriptor.add(definition);
+ }
+ return true;
+ } else if (themeDescriptor == null && elementName.equals(IWorkbenchRegistryConstants.TAG_CATEGORYDEFINITION)) {
+ ThemeElementCategory definition = readCategory(element);
+ if (definition != null) {
+ if (!categoryDefinitions.contains(definition)) {
+ categoryDefinitions.add(definition);
+ themeRegistry.add(definition);
+ }
+ }
+ return true;
+ } else if (element.getName().equals(IWorkbenchRegistryConstants.TAG_THEME)) {
+ if (themeDescriptor != null) {
+ logError(element, RESOURCE_BUNDLE.getString("Themes.badNesting")); //$NON-NLS-1$
} else {
- themeDescriptor = readTheme(element);
- if (themeDescriptor != null) {
- readElementChildren(element);
- themeDescriptor = null;
- }
- return true;
- }
- } else if (themeDescriptor != null
- && elementName.equals(IWorkbenchRegistryConstants.TAG_DESCRIPTION)) {
- themeDescriptor.setDescription(element.getValue());
- return true;
- } else if (elementName.equals(IWorkbenchRegistryConstants.TAG_DATA)) {
- String name = element.getAttribute(IWorkbenchRegistryConstants.ATT_NAME);
- String value = element.getAttribute(IWorkbenchRegistryConstants.ATT_VALUE);
- if (name == null || value == null) {
- logError(element, RESOURCE_BUNDLE.getString("Data.badData")); //$NON-NLS-1$
- } else {
- if (themeDescriptor != null) {
- themeDescriptor.setData(name, value);
- } else {
- themeRegistry.setData(name, value);
- if (!dataMap.containsKey(name)) {
+ themeDescriptor = readTheme(element);
+ if (themeDescriptor != null) {
+ readElementChildren(element);
+ themeDescriptor = null;
+ }
+ return true;
+ }
+ } else if (themeDescriptor != null && elementName.equals(IWorkbenchRegistryConstants.TAG_DESCRIPTION)) {
+ themeDescriptor.setDescription(element.getValue());
+ return true;
+ } else if (elementName.equals(IWorkbenchRegistryConstants.TAG_DATA)) {
+ String name = element.getAttribute(IWorkbenchRegistryConstants.ATT_NAME);
+ String value = element.getAttribute(IWorkbenchRegistryConstants.ATT_VALUE);
+ if (name == null || value == null) {
+ logError(element, RESOURCE_BUNDLE.getString("Data.badData")); //$NON-NLS-1$
+ } else {
+ if (themeDescriptor != null) {
+ themeDescriptor.setData(name, value);
+ } else {
+ themeRegistry.setData(name, value);
+ if (!dataMap.containsKey(name)) {
dataMap.put(name, value);
}
- }
- }
- return true;
+ }
+ }
+ return true;
}
- return false;
- }
+ return false;
+ }
- /**
- * Read a font.
- *
- * @param element the element to read
- * @return the new font
- */
- private FontDefinition readFont(IConfigurationElement element) {
- String name = element.getAttribute(IWorkbenchRegistryConstants.ATT_LABEL);
+ /**
+ * Read a font.
+ *
+ * @param element the element to read
+ * @return the new font
+ */
+ private FontDefinition readFont(IConfigurationElement element) {
+ String name = element.getAttribute(IWorkbenchRegistryConstants.ATT_LABEL);
- String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
+ String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID);
- String defaultMapping = element.getAttribute(IWorkbenchRegistryConstants.ATT_DEFAULTS_TO);
+ String defaultMapping = element.getAttribute(IWorkbenchRegistryConstants.ATT_DEFAULTS_TO);
- String value = getPlatformSpecificFontValue(element
- .getChildren(IWorkbenchRegistryConstants.TAG_FONTVALUE));
- if (value == null) {
- value = element.getAttribute(IWorkbenchRegistryConstants.ATT_VALUE);
- }
+ String value = getPlatformSpecificFontValue(element.getChildren(IWorkbenchRegistryConstants.TAG_FONTVALUE));
+ if (value == null) {
+ value = element.getAttribute(IWorkbenchRegistryConstants.ATT_VALUE);
+ }
- if (value != null && defaultMapping != null) {
- logError(element, RESOURCE_BUNDLE.getString("Fonts.badDefault")); //$NON-NLS-1$
- return null;
- }
+ if (value != null && defaultMapping != null) {
+ logError(element, RESOURCE_BUNDLE.getString("Fonts.badDefault")); //$NON-NLS-1$
+ return null;
+ }
- String categoryId = element.getAttribute(IWorkbenchRegistryConstants.ATT_CATEGORY_ID);
+ String categoryId = element.getAttribute(IWorkbenchRegistryConstants.ATT_CATEGORY_ID);
- boolean isEditable = true;
- String isEditableString = element.getAttribute(IWorkbenchRegistryConstants.ATT_IS_EDITABLE);
- if (isEditableString != null) {
- isEditable = Boolean.parseBoolean(isEditableString);
- }
+ boolean isEditable = true;
+ String isEditableString = element.getAttribute(IWorkbenchRegistryConstants.ATT_IS_EDITABLE);
+ if (isEditableString != null) {
+ isEditable = Boolean.parseBoolean(isEditableString);
+ }
- String description = null;
+ String description = null;
- IConfigurationElement[] descriptions = element
- .getChildren(IWorkbenchRegistryConstants.TAG_DESCRIPTION);
+ IConfigurationElement[] descriptions = element.getChildren(IWorkbenchRegistryConstants.TAG_DESCRIPTION);
- if (descriptions.length > 0) {
+ if (descriptions.length > 0) {
description = descriptions[0].getValue();
}
- return new FontDefinition(name, id, defaultMapping, value, categoryId,
- isEditable, description);
- }
-
- /**
- * Check for platform specific font values. This will return the
- * "best match" for the current platform.
- *
- * @param elements the elements to check
- * @return the platform specific font, if any
- */
- private String getPlatformSpecificFontValue(IConfigurationElement[] elements) {
- return getFontValue(getBestPlatformMatch(elements));
- }
-
- /**
- * Gets the font valu from the value attribute.
- *
- * @param element the element to check
- * @return the font string
- */
- private String getFontValue(IConfigurationElement element) {
- if (element == null) {
+ return new FontDefinition(name, id, defaultMapping, value, categoryId, isEditable, description);
+ }
+
+ /**
+ * Check for platform specific font values. This will return the "best match"
+ * for the current platform.
+ *
+ * @param elements the elements to check
+ * @return the platform specific font, if any
+ */
+ private String getPlatformSpecificFontValue(IConfigurationElement[] elements) {
+ return getFontValue(getBestPlatformMatch(elements));
+ }
+
+ /**
+ * Gets the font valu from the value attribute.
+ *
+ * @param element the element to check
+ * @return the font string
+ */
+ private String getFontValue(IConfigurationElement element) {
+ if (element == null) {
return null;
}
- return element.getAttribute(IWorkbenchRegistryConstants.ATT_VALUE);
- }
-
- /**
- * Attempt to load the color value from the colorFactory attribute.
- *
- * @param element the element to load from
- * @return the value, or null if it could not be obtained
- */
- private String checkColorFactory(IConfigurationElement element) {
- String value = null;
- if (element.getAttribute(IWorkbenchRegistryConstants.ATT_COLORFACTORY) != null
- || element.getChildren(IWorkbenchRegistryConstants.ATT_COLORFACTORY).length > 0) {
- try {
- IColorFactory factory = (IColorFactory) element
- .createExecutableExtension(IWorkbenchRegistryConstants.ATT_COLORFACTORY);
- value = StringConverter.asString(factory.createColor());
- } catch (Exception e) {
- WorkbenchPlugin.log(RESOURCE_BUNDLE
- .getString("Colors.badFactory"), //$NON-NLS-1$
- WorkbenchPlugin.getStatus(e));
- }
- }
- return value;
- }
-
- /**
- * Read a theme.
- *
- * @param element the element to read
- * @return the new theme
- */
- protected ThemeDescriptor readTheme(IConfigurationElement element) {
- ThemeDescriptor desc = null;
-
- String id = element.getAttribute(ThemeDescriptor.ATT_ID);
- if (id == null) {
+ return element.getAttribute(IWorkbenchRegistryConstants.ATT_VALUE);
+ }
+
+ /**
+ * Attempt to load the color value from the colorFactory attribute.
+ *
+ * @param element the element to load from
+ * @return the value, or null if it could not be obtained
+ */
+ private String checkColorFactory(IConfigurationElement element) {
+ String value = null;
+ if (element.getAttribute(IWorkbenchRegistryConstants.ATT_COLORFACTORY) != null
+ || element.getChildren(IWorkbenchRegistryConstants.ATT_COLORFACTORY).length > 0) {
+ try {
+ IColorFactory factory = (IColorFactory) element
+ .createExecutableExtension(IWorkbenchRegistryConstants.ATT_COLORFACTORY);
+ value = StringConverter.asString(factory.createColor());
+ } catch (Exception e) {
+ WorkbenchPlugin.log(RESOURCE_BUNDLE.getString("Colors.badFactory"), //$NON-NLS-1$
+ WorkbenchPlugin.getStatus(e));
+ }
+ }
+ return value;
+ }
+
+ /**
+ * Read a theme.
+ *
+ * @param element the element to read
+ * @return the new theme
+ */
+ protected ThemeDescriptor readTheme(IConfigurationElement element) {
+ ThemeDescriptor desc = null;
+
+ String id = element.getAttribute(ThemeDescriptor.ATT_ID);
+ if (id == null) {
return null;
}
- //see if the theme has already been created in another extension
- desc = (ThemeDescriptor) themeRegistry.findTheme(id);
- //if not, create it
- if (desc == null) {
- desc = new ThemeDescriptor(id);
- themeRegistry.add(desc);
- }
- //set the name as applicable
- desc.extractName(element);
-
- return desc;
- }
-
- /**
- * Read the theme extensions within a registry.
- *
- * @param in the registry to read
- * @param out the registry to write to
- */
- public void readThemes(IExtensionRegistry in, ThemeRegistry out) {
- // this does not seem to really ever be throwing an the exception
- setRegistry(out);
- readRegistry(in, PlatformUI.PLUGIN_ID, IWorkbenchRegistryConstants.PL_THEMES);
-
- // support for old font definitions
- readRegistry(in, PlatformUI.PLUGIN_ID,
- IWorkbenchRegistryConstants.PL_FONT_DEFINITIONS);
- }
-
- /**
- * Set the output registry.
- *
- * @param out the output registry
- */
- public void setRegistry(ThemeRegistry out) {
- themeRegistry = out;
- }
+ // see if the theme has already been created in another extension
+ desc = (ThemeDescriptor) themeRegistry.findTheme(id);
+ // if not, create it
+ if (desc == null) {
+ desc = new ThemeDescriptor(id);
+ themeRegistry.add(desc);
+ }
+ // set the name as applicable
+ desc.extractName(element);
+
+ return desc;
+ }
+
+ /**
+ * Read the theme extensions within a registry.
+ *
+ * @param in the registry to read
+ * @param out the registry to write to
+ */
+ public void readThemes(IExtensionRegistry in, ThemeRegistry out) {
+ // this does not seem to really ever be throwing an the exception
+ setRegistry(out);
+ readRegistry(in, PlatformUI.PLUGIN_ID, IWorkbenchRegistryConstants.PL_THEMES);
+
+ // support for old font definitions
+ readRegistry(in, PlatformUI.PLUGIN_ID, IWorkbenchRegistryConstants.PL_FONT_DEFINITIONS);
+ }
+
+ /**
+ * Set the output registry.
+ *
+ * @param out the output registry
+ */
+ public void setRegistry(ThemeRegistry out) {
+ themeRegistry = out;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemesExtension.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemesExtension.java
index 27d9b096a7e..f7dab0d5bed 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemesExtension.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ThemesExtension.java
@@ -28,22 +28,20 @@ import org.eclipse.ui.internal.WorkbenchPlugin;
public class ThemesExtension implements IThemesExtension {
public static final String DEFAULT_CATEGORY_ID = "org.eclipse.ui.themes.CssTheme"; //$NON-NLS-1$
-
private List<IThemeElementDefinitionOverridable<?>> definitions = new ArrayList<>();
@Override
public void addFontDefinition(String symbolicName) {
- FontDefinition definition = new FontDefinition(formatDefaultName(FontDefinition.class,
- symbolicName), symbolicName, null, null, DEFAULT_CATEGORY_ID, true, null);
+ FontDefinition definition = new FontDefinition(formatDefaultName(FontDefinition.class, symbolicName),
+ symbolicName, null, null, DEFAULT_CATEGORY_ID, true, null);
definition.appendState(ThemeElementDefinition.State.ADDED_BY_CSS);
definitions.add(definition);
}
@Override
public void addColorDefinition(String symbolicName) {
- ColorDefinition definition = new ColorDefinition(formatDefaultName(ColorDefinition.class,
- symbolicName), symbolicName, null, null, DEFAULT_CATEGORY_ID, true, null,
- getPluginId());
+ ColorDefinition definition = new ColorDefinition(formatDefaultName(ColorDefinition.class, symbolicName),
+ symbolicName, null, null, DEFAULT_CATEGORY_ID, true, null, getPluginId());
definition.appendState(ThemeElementDefinition.State.ADDED_BY_CSS);
definitions.add(definition);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/WorkbenchPreview.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/WorkbenchPreview.java
index e9dd331d752..40cc057dbfe 100755
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/WorkbenchPreview.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/WorkbenchPreview.java
@@ -39,127 +39,119 @@ import org.eclipse.ui.themes.IThemePreview;
*/
public class WorkbenchPreview implements IThemePreview {
- // don't reset this dynamically, so just keep the information static.
+ // don't reset this dynamically, so just keep the information static.
// see bug:
- // 75422 [Presentations] Switching presentation to R21 switches immediately, but only partially
- private static int tabPos = PlatformUI.getPreferenceStore().getInt(IWorkbenchPreferenceConstants.VIEW_TAB_POSITION);
+ // 75422 [Presentations] Switching presentation to R21 switches immediately, but
+ // only partially
+ private static int tabPos = PlatformUI.getPreferenceStore().getInt(IWorkbenchPreferenceConstants.VIEW_TAB_POSITION);
- private boolean disposed = false;
+ private boolean disposed = false;
- private CTabFolder folder;
+ private CTabFolder folder;
- private ITheme theme;
+ private ITheme theme;
- private ToolBar toolBar;
+ private ToolBar toolBar;
- private CLabel viewMessage;
+ private CLabel viewMessage;
- private ViewForm viewForm;
+ private ViewForm viewForm;
- private IPropertyChangeListener fontAndColorListener = event -> {
- if (!disposed) {
- setColorsAndFonts();
- //viewMessage.setSize(viewMessage.computeSize(SWT.DEFAULT, SWT.DEFAULT, true));
- viewForm.layout(true);
- }
+ private IPropertyChangeListener fontAndColorListener = event -> {
+ if (!disposed) {
+ setColorsAndFonts();
+ // viewMessage.setSize(viewMessage.computeSize(SWT.DEFAULT, SWT.DEFAULT, true));
+ viewForm.layout(true);
+ }
};
- @Override
+ @Override
public void createControl(Composite parent, ITheme currentTheme) {
- this.theme = currentTheme;
- folder = new CTabFolder(parent, SWT.BORDER);
- folder.setUnselectedCloseVisible(false);
- folder.setEnabled(false);
- folder.setMaximizeVisible(true);
- folder.setMinimizeVisible(true);
-
- viewForm = new ViewForm(folder, SWT.NONE);
- viewForm.marginHeight = 0;
- viewForm.marginWidth = 0;
- viewForm.verticalSpacing = 0;
- viewForm.setBorderVisible(false);
- toolBar = new ToolBar(viewForm, SWT.FLAT | SWT.WRAP);
- ToolItem toolItem = new ToolItem(toolBar, SWT.PUSH);
-
- Image hoverImage = WorkbenchImages
- .getImage(IWorkbenchGraphicConstants.IMG_LCL_VIEW_MENU);
- toolItem.setImage(hoverImage);
-
- viewForm.setTopRight(toolBar);
-
- viewMessage = new CLabel(viewForm, SWT.NONE);
- viewMessage.setText("Etu?"); //$NON-NLS-1$
- viewForm.setTopLeft(viewMessage);
-
- CTabItem item = new CTabItem(folder, SWT.CLOSE);
- item.setText("Lorem"); //$NON-NLS-1$
- Label text = new Label(viewForm, SWT.NONE);
- viewForm.setContent(text);
- text.setText("Lorem ipsum dolor sit amet"); //$NON-NLS-1$
- item = new CTabItem(folder, SWT.CLOSE);
- item.setText("Ipsum"); //$NON-NLS-1$
- item.setControl(viewForm);
- item.setImage(WorkbenchImages.getImage(ISharedImages.IMG_TOOL_COPY));
-
- folder.setSelection(item);
-
- item = new CTabItem(folder, SWT.CLOSE);
- item.setText("Dolor"); //$NON-NLS-1$
- item = new CTabItem(folder, SWT.CLOSE);
- item.setText("Sit"); //$NON-NLS-1$
-
- currentTheme.addPropertyChangeListener(fontAndColorListener);
- setColorsAndFonts();
- setTabPosition();
- setTabStyle();
- }
-
- /**
- * Set the tab style from preferences.
- */
- protected void setTabStyle() {
- boolean traditionalTab = PlatformUI.getPreferenceStore()
- .getBoolean(IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS);
- folder.setSimple(traditionalTab);
- }
-
- /**
- * Set the tab location from preferences.
- */
- protected void setTabPosition() {
- tabPos = PlatformUI.getPreferenceStore().getInt(IWorkbenchPreferenceConstants.VIEW_TAB_POSITION);
- folder.setTabPosition(tabPos);
- }
-
- /**
- * Set the folder colors and fonts
- */
- private void setColorsAndFonts() {
- folder.setSelectionForeground(theme.getColorRegistry().get(
- IWorkbenchThemeConstants.ACTIVE_TAB_TEXT_COLOR));
- folder.setForeground(theme.getColorRegistry().get(
- IWorkbenchThemeConstants.INACTIVE_TAB_TEXT_COLOR));
-
- Color[] colors = new Color[2];
- colors[0] = theme.getColorRegistry().get(
- IWorkbenchThemeConstants.INACTIVE_TAB_BG_START);
- colors[1] = theme.getColorRegistry().get(
- IWorkbenchThemeConstants.INACTIVE_TAB_BG_END);
- colors[0] = theme.getColorRegistry().get(
- IWorkbenchThemeConstants.ACTIVE_TAB_BG_START);
- colors[1] = theme.getColorRegistry().get(
- IWorkbenchThemeConstants.ACTIVE_TAB_BG_END);
- folder.setSelectionBackground(colors, new int[] { theme
- .getInt(IWorkbenchThemeConstants.ACTIVE_TAB_PERCENT) }, theme
- .getBoolean(IWorkbenchThemeConstants.ACTIVE_TAB_VERTICAL));
-
- folder.setFont(theme.getFontRegistry().get(
- IWorkbenchThemeConstants.TAB_TEXT_FONT));
- }
-
- @Override
+ this.theme = currentTheme;
+ folder = new CTabFolder(parent, SWT.BORDER);
+ folder.setUnselectedCloseVisible(false);
+ folder.setEnabled(false);
+ folder.setMaximizeVisible(true);
+ folder.setMinimizeVisible(true);
+
+ viewForm = new ViewForm(folder, SWT.NONE);
+ viewForm.marginHeight = 0;
+ viewForm.marginWidth = 0;
+ viewForm.verticalSpacing = 0;
+ viewForm.setBorderVisible(false);
+ toolBar = new ToolBar(viewForm, SWT.FLAT | SWT.WRAP);
+ ToolItem toolItem = new ToolItem(toolBar, SWT.PUSH);
+
+ Image hoverImage = WorkbenchImages.getImage(IWorkbenchGraphicConstants.IMG_LCL_VIEW_MENU);
+ toolItem.setImage(hoverImage);
+
+ viewForm.setTopRight(toolBar);
+
+ viewMessage = new CLabel(viewForm, SWT.NONE);
+ viewMessage.setText("Etu?"); //$NON-NLS-1$
+ viewForm.setTopLeft(viewMessage);
+
+ CTabItem item = new CTabItem(folder, SWT.CLOSE);
+ item.setText("Lorem"); //$NON-NLS-1$
+ Label text = new Label(viewForm, SWT.NONE);
+ viewForm.setContent(text);
+ text.setText("Lorem ipsum dolor sit amet"); //$NON-NLS-1$
+ item = new CTabItem(folder, SWT.CLOSE);
+ item.setText("Ipsum"); //$NON-NLS-1$
+ item.setControl(viewForm);
+ item.setImage(WorkbenchImages.getImage(ISharedImages.IMG_TOOL_COPY));
+
+ folder.setSelection(item);
+
+ item = new CTabItem(folder, SWT.CLOSE);
+ item.setText("Dolor"); //$NON-NLS-1$
+ item = new CTabItem(folder, SWT.CLOSE);
+ item.setText("Sit"); //$NON-NLS-1$
+
+ currentTheme.addPropertyChangeListener(fontAndColorListener);
+ setColorsAndFonts();
+ setTabPosition();
+ setTabStyle();
+ }
+
+ /**
+ * Set the tab style from preferences.
+ */
+ protected void setTabStyle() {
+ boolean traditionalTab = PlatformUI.getPreferenceStore()
+ .getBoolean(IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS);
+ folder.setSimple(traditionalTab);
+ }
+
+ /**
+ * Set the tab location from preferences.
+ */
+ protected void setTabPosition() {
+ tabPos = PlatformUI.getPreferenceStore().getInt(IWorkbenchPreferenceConstants.VIEW_TAB_POSITION);
+ folder.setTabPosition(tabPos);
+ }
+
+ /**
+ * Set the folder colors and fonts
+ */
+ private void setColorsAndFonts() {
+ folder.setSelectionForeground(theme.getColorRegistry().get(IWorkbenchThemeConstants.ACTIVE_TAB_TEXT_COLOR));
+ folder.setForeground(theme.getColorRegistry().get(IWorkbenchThemeConstants.INACTIVE_TAB_TEXT_COLOR));
+
+ Color[] colors = new Color[2];
+ colors[0] = theme.getColorRegistry().get(IWorkbenchThemeConstants.INACTIVE_TAB_BG_START);
+ colors[1] = theme.getColorRegistry().get(IWorkbenchThemeConstants.INACTIVE_TAB_BG_END);
+ colors[0] = theme.getColorRegistry().get(IWorkbenchThemeConstants.ACTIVE_TAB_BG_START);
+ colors[1] = theme.getColorRegistry().get(IWorkbenchThemeConstants.ACTIVE_TAB_BG_END);
+ folder.setSelectionBackground(colors, new int[] { theme.getInt(IWorkbenchThemeConstants.ACTIVE_TAB_PERCENT) },
+ theme.getBoolean(IWorkbenchThemeConstants.ACTIVE_TAB_VERTICAL));
+
+ folder.setFont(theme.getFontRegistry().get(IWorkbenchThemeConstants.TAB_TEXT_FONT));
+ }
+
+ @Override
public void dispose() {
- disposed = true;
- theme.removePropertyChangeListener(fontAndColorListener);
- }
+ disposed = true;
+ theme.removePropertyChangeListener(fontAndColorListener);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/WorkbenchThemeManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/WorkbenchThemeManager.java
index e24047a79cc..4adad92fd0d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/WorkbenchThemeManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/WorkbenchThemeManager.java
@@ -52,8 +52,7 @@ import org.osgi.service.event.EventHandler;
*
* @since 3.0
*/
-public class WorkbenchThemeManager extends EventManager implements
- IThemeManager {
+public class WorkbenchThemeManager extends EventManager implements IThemeManager {
public static RGB EMPTY_COLOR_VALUE = new RGB(0, 1, 2);
private static final String SYSTEM_DEFAULT_THEME = "org.eclipse.ui.ide.systemDefault";//$NON-NLS-1$
@@ -84,17 +83,14 @@ public class WorkbenchThemeManager extends EventManager implements
return instance;
}
-
private ITheme currentTheme;
private IPropertyChangeListener currentThemeListener = event -> {
firePropertyChange(event);
if (event.getSource() instanceof FontRegistry) {
- JFaceResources.getFontRegistry().put(event.getProperty(),
- (FontData[]) event.getNewValue());
+ JFaceResources.getFontRegistry().put(event.getProperty(), (FontData[]) event.getNewValue());
} else if (event.getSource() instanceof ColorRegistry) {
- JFaceResources.getColorRegistry().put(event.getProperty(),
- (RGB) event.getNewValue());
+ JFaceResources.getColorRegistry().put(event.getProperty(), (RGB) event.getNewValue());
}
};
@@ -116,23 +112,20 @@ public class WorkbenchThemeManager extends EventManager implements
}
/*
- * Initialize the WorkbenchThemeManager.
- * Determine the default theme according to the following rules:
- * 1) If we're in HC mode then default to system default
- * 2) Otherwise, if preference already set (e.g. via plugin_customization.ini), then observe that value
- * 3) Otherwise, use our default
- * Call dispose when we close.
+ * Initialize the WorkbenchThemeManager. Determine the default theme according
+ * to the following rules: 1) If we're in HC mode then default to system default
+ * 2) Otherwise, if preference already set (e.g. via plugin_customization.ini),
+ * then observe that value 3) Otherwise, use our default Call dispose when we
+ * close.
*/
private synchronized void init() {
if (initialized) {
return;
}
initialized = true;
- defaultThemeColorRegistry = new ColorRegistry(PlatformUI.getWorkbench()
- .getDisplay());
+ defaultThemeColorRegistry = new ColorRegistry(PlatformUI.getWorkbench().getDisplay());
- defaultThemeFontRegistry = new FontRegistry(PlatformUI.getWorkbench()
- .getDisplay());
+ defaultThemeFontRegistry = new FontRegistry(PlatformUI.getWorkbench().getDisplay());
// copy the font values from preferences.
FontRegistry jfaceFonts = JFaceResources.getFontRegistry();
@@ -141,10 +134,11 @@ public class WorkbenchThemeManager extends EventManager implements
defaultThemeFontRegistry.put(key, jfaceFonts.getFontData(key));
}
- //Theme might be set via plugin_configuration.ini
- String themeId = PrefUtil.getAPIPreferenceStore().getDefaultString(IWorkbenchPreferenceConstants.CURRENT_THEME_ID);
+ // Theme might be set via plugin_configuration.ini
+ String themeId = PrefUtil.getAPIPreferenceStore()
+ .getDefaultString(IWorkbenchPreferenceConstants.CURRENT_THEME_ID);
- //If not set, use default
+ // If not set, use default
if (themeId.length() == 0)
themeId = IThemeManager.DEFAULT_THEME;
@@ -157,8 +151,7 @@ public class WorkbenchThemeManager extends EventManager implements
if (highContrast)
themeId = SYSTEM_DEFAULT_THEME;
- PrefUtil.getAPIPreferenceStore().setDefault(
- IWorkbenchPreferenceConstants.CURRENT_THEME_ID, themeId);
+ PrefUtil.getAPIPreferenceStore().setDefault(IWorkbenchPreferenceConstants.CURRENT_THEME_ID, themeId);
context = Workbench.getInstance().getService(IEclipseContext.class);
eventBroker = Workbench.getInstance().getService(IEventBroker.class);
@@ -171,31 +164,33 @@ public class WorkbenchThemeManager extends EventManager implements
}
/*
- * Update existing theme contents, descriptors, and registries.
- * Reread the themes and recompute the registries.
+ * Update existing theme contents, descriptors, and registries. Reread the
+ * themes and recompute the registries.
*/
private void updateThemes() {
- //reread the themes since their descriptors have changed in value
- ThemeRegistryReader reader = new ThemeRegistryReader();
- reader.readThemes(Platform.getExtensionRegistry(),(ThemeRegistry) getThemeRegistry());
+ // reread the themes since their descriptors have changed in value
+ ThemeRegistryReader reader = new ThemeRegistryReader();
+ reader.readThemes(Platform.getExtensionRegistry(), (ThemeRegistry) getThemeRegistry());
- //DEFAULT_THEME is not in getThemes() list so must be handled special
- ThemeElementHelper.populateRegistry(getTheme(IThemeManager.DEFAULT_THEME), getThemeRegistry().getColors(), PrefUtil.getInternalPreferenceStore());
+ // DEFAULT_THEME is not in getThemes() list so must be handled special
+ ThemeElementHelper.populateRegistry(getTheme(IThemeManager.DEFAULT_THEME), getThemeRegistry().getColors(),
+ PrefUtil.getInternalPreferenceStore());
- IThemeDescriptor[] themeDescriptors = getThemeRegistry().getThemes();
+ IThemeDescriptor[] themeDescriptors = getThemeRegistry().getThemes();
- for (IThemeDescriptor themeDescriptor : themeDescriptors) {
- ITheme theme = (ITheme) themes.get(themeDescriptor);
- //If theme is in our themes table then its already been populated
- if (theme != null) {
- ColorDefinition[] colorDefinitions = themeDescriptor.getColors();
+ for (IThemeDescriptor themeDescriptor : themeDescriptors) {
+ ITheme theme = (ITheme) themes.get(themeDescriptor);
+ // If theme is in our themes table then its already been populated
+ if (theme != null) {
+ ColorDefinition[] colorDefinitions = themeDescriptor.getColors();
- if (colorDefinitions.length > 0) {
- ThemeElementHelper.populateRegistry(theme, colorDefinitions,PrefUtil.getInternalPreferenceStore());
- }
- }
+ if (colorDefinitions.length > 0) {
+ ThemeElementHelper.populateRegistry(theme, colorDefinitions, PrefUtil.getInternalPreferenceStore());
+ }
+ }
}
}
+
@Override
public void addPropertyChangeListener(IPropertyChangeListener listener) {
addListenerObject(listener);
@@ -235,11 +230,9 @@ public class WorkbenchThemeManager extends EventManager implements
}
}
- protected void firePropertyChange(String changeId, ITheme oldTheme,
- ITheme newTheme) {
+ protected void firePropertyChange(String changeId, ITheme oldTheme, ITheme newTheme) {
- PropertyChangeEvent event = new PropertyChangeEvent(this, changeId,
- oldTheme, newTheme);
+ PropertyChangeEvent event = new PropertyChangeEvent(this, changeId, oldTheme, newTheme);
firePropertyChange(event);
}
@@ -247,8 +240,7 @@ public class WorkbenchThemeManager extends EventManager implements
public ITheme getCurrentTheme() {
init();
if (currentTheme == null) {
- String themeId = PrefUtil.getAPIPreferenceStore().getString(
- IWorkbenchPreferenceConstants.CURRENT_THEME_ID);
+ String themeId = PrefUtil.getAPIPreferenceStore().getString(IWorkbenchPreferenceConstants.CURRENT_THEME_ID);
if (themeId == null) // missing preference
setCurrentTheme(IThemeManager.DEFAULT_THEME);
@@ -257,13 +249,8 @@ public class WorkbenchThemeManager extends EventManager implements
if (currentTheme == null) { // still null - the preference
// didn't resolve to a proper theme
setCurrentTheme(IThemeManager.DEFAULT_THEME);
- StatusManager
- .getManager()
- .handle(
- StatusUtil
- .newStatus(
- PlatformUI.PLUGIN_ID,
- "Could not restore current theme: " + themeId, null)); //$NON-NLS-1$
+ StatusManager.getManager().handle(StatusUtil.newStatus(PlatformUI.PLUGIN_ID,
+ "Could not restore current theme: " + themeId, null)); //$NON-NLS-1$
}
}
}
@@ -333,18 +320,16 @@ public class WorkbenchThemeManager extends EventManager implements
init();
ITheme oldTheme = currentTheme;
if (WorkbenchThemeManager.getInstance().doSetCurrentTheme(id)) {
- firePropertyChange(CHANGE_CURRENT_THEME, oldTheme,
- getCurrentTheme());
+ firePropertyChange(CHANGE_CURRENT_THEME, oldTheme, getCurrentTheme());
if (oldTheme != null) {
oldTheme.removePropertyChangeListener(currentThemeListener);
}
currentTheme.addPropertyChangeListener(currentThemeListener);
// update the preference if required.
- if (!PrefUtil.getAPIPreferenceStore().getString(
- IWorkbenchPreferenceConstants.CURRENT_THEME_ID).equals(id)) {
- PrefUtil.getAPIPreferenceStore().setValue(
- IWorkbenchPreferenceConstants.CURRENT_THEME_ID, id);
+ if (!PrefUtil.getAPIPreferenceStore().getString(IWorkbenchPreferenceConstants.CURRENT_THEME_ID)
+ .equals(id)) {
+ PrefUtil.getAPIPreferenceStore().setValue(IWorkbenchPreferenceConstants.CURRENT_THEME_ID, id);
PrefUtil.saveAPIPrefs();
}
@@ -368,8 +353,7 @@ public class WorkbenchThemeManager extends EventManager implements
{
if (oldTheme != null && eventBroker != null) {
eventBroker.send(UIEvents.UILifeCycle.THEME_CHANGED, null);
- eventBroker.send(UIEvents.UILifeCycle.THEME_DEFINITION_CHANGED,
- context.get(MApplication.class));
+ eventBroker.send(UIEvents.UILifeCycle.THEME_DEFINITION_CHANGED, context.get(MApplication.class));
}
}
}
@@ -384,8 +368,7 @@ public class WorkbenchThemeManager extends EventManager implements
ColorRegistry colorRegistry = getColorRegistry();
resetThemeRegistries(themeRegistry, fontRegistry, colorRegistry);
- overrideAlreadyExistingDefinitions(event, engine, themeRegistry, fontRegistry,
- colorRegistry);
+ overrideAlreadyExistingDefinitions(event, engine, themeRegistry, fontRegistry, colorRegistry);
addNewDefinitions(event, engine, themeRegistry, fontRegistry, colorRegistry);
sendThemeRegistryRestyledEvent();
@@ -444,15 +427,13 @@ public class WorkbenchThemeManager extends EventManager implements
for (ColorDefinition def : themeRegistry.getColors()) {
if (def.isOverridden()) {
def.resetToDefaultValue();
- colorRegistry.put(def.getId(), def.getValue() != null ? def.getValue()
- : EMPTY_COLOR_VALUE);
+ colorRegistry.put(def.getId(), def.getValue() != null ? def.getValue() : EMPTY_COLOR_VALUE);
}
}
}
- protected void overrideAlreadyExistingDefinitions(org.osgi.service.event.Event event,
- IStylingEngine engine, ThemeRegistry themeRegistry, FontRegistry fontRegistry,
- ColorRegistry colorRegistry) {
+ protected void overrideAlreadyExistingDefinitions(org.osgi.service.event.Event event, IStylingEngine engine,
+ ThemeRegistry themeRegistry, FontRegistry fontRegistry, ColorRegistry colorRegistry) {
IPreferenceStore store = PrefUtil.getInternalPreferenceStore();
org.eclipse.e4.ui.css.swt.theme.ITheme cssTheme = getTheme(event);
ITheme theme = getColorsAndFontsTheme();
@@ -485,17 +466,14 @@ public class WorkbenchThemeManager extends EventManager implements
ThemesExtension themesExtension = createThemesExtension();
engine.style(themesExtension);
- for (IThemeElementDefinitionOverridable<?> definition : themesExtension
- .getDefinitions()) {
+ for (IThemeElementDefinitionOverridable<?> definition : themesExtension.getDefinitions()) {
engine.style(definition);
if (definition.isOverridden() && definition instanceof FontDefinition) {
addFontDefinition((FontDefinition) definition, themeRegistry, fontRegistry);
- populateDefinition(cssTheme, theme, fontRegistry, (FontDefinition) definition,
- store);
+ populateDefinition(cssTheme, theme, fontRegistry, (FontDefinition) definition, store);
} else if (definition.isOverridden() && definition instanceof ColorDefinition) {
addColorDefinition((ColorDefinition) definition, themeRegistry, colorRegistry);
- populateDefinition(cssTheme, theme, colorRegistry,
- (ColorDefinition) definition, store);
+ populateDefinition(cssTheme, theme, colorRegistry, (ColorDefinition) definition, store);
}
}
}
@@ -520,15 +498,13 @@ public class WorkbenchThemeManager extends EventManager implements
return new ThemesExtension();
}
- protected void populateDefinition(org.eclipse.e4.ui.css.swt.theme.ITheme cssTheme,
- ITheme theme, ColorRegistry registry, ColorDefinition definition,
- IPreferenceStore store) {
+ protected void populateDefinition(org.eclipse.e4.ui.css.swt.theme.ITheme cssTheme, ITheme theme,
+ ColorRegistry registry, ColorDefinition definition, IPreferenceStore store) {
ThemeElementHelper.populateDefinition(cssTheme, theme, registry, definition, store);
}
- protected void populateDefinition(org.eclipse.e4.ui.css.swt.theme.ITheme cssTheme,
- ITheme theme, FontRegistry registry, FontDefinition definition,
- IPreferenceStore store) {
+ protected void populateDefinition(org.eclipse.e4.ui.css.swt.theme.ITheme cssTheme, ITheme theme,
+ FontRegistry registry, FontDefinition definition, IPreferenceStore store) {
ThemeElementHelper.populateDefinition(cssTheme, theme, registry, definition, store);
}
}
@@ -536,8 +512,8 @@ public class WorkbenchThemeManager extends EventManager implements
public static class ThemeRegistryModifiedHandler implements EventHandler {
@Override
public void handleEvent(org.osgi.service.event.Event event) {
- populateThemeRegistries(getThemeRegistry(), getFontRegistry(), getColorRegistry(),
- getTheme(), getColorsAndFontsTheme());
+ populateThemeRegistries(getThemeRegistry(), getFontRegistry(), getColorRegistry(), getTheme(),
+ getColorsAndFontsTheme());
sendThemeDefinitionChangedEvent();
}
@@ -568,13 +544,11 @@ public class WorkbenchThemeManager extends EventManager implements
protected void sendThemeDefinitionChangedEvent() {
MApplication application = getContext().get(MApplication.class);
- getInstance().eventBroker.send(UIEvents.UILifeCycle.THEME_DEFINITION_CHANGED,
- application);
+ getInstance().eventBroker.send(UIEvents.UILifeCycle.THEME_DEFINITION_CHANGED, application);
}
- protected void populateThemeRegistries(ThemeRegistry themeRegistry,
- FontRegistry fontRegistry, ColorRegistry colorRegistry,
- org.eclipse.e4.ui.css.swt.theme.ITheme cssTheme, ITheme theme) {
+ protected void populateThemeRegistries(ThemeRegistry themeRegistry, FontRegistry fontRegistry,
+ ColorRegistry colorRegistry, org.eclipse.e4.ui.css.swt.theme.ITheme cssTheme, ITheme theme) {
IPreferenceStore store = PrefUtil.getInternalPreferenceStore();
for (FontDefinition definition : themeRegistry.getFonts()) {
if (definition.isOverridden() || definition.isAddedByCss()) {
@@ -588,15 +562,13 @@ public class WorkbenchThemeManager extends EventManager implements
}
}
- protected void populateDefinition(org.eclipse.e4.ui.css.swt.theme.ITheme cssTheme,
- ITheme theme, ColorRegistry registry, ColorDefinition definition,
- IPreferenceStore store) {
+ protected void populateDefinition(org.eclipse.e4.ui.css.swt.theme.ITheme cssTheme, ITheme theme,
+ ColorRegistry registry, ColorDefinition definition, IPreferenceStore store) {
ThemeElementHelper.populateDefinition(cssTheme, theme, registry, definition, store);
}
- protected void populateDefinition(org.eclipse.e4.ui.css.swt.theme.ITheme cssTheme,
- ITheme theme, FontRegistry registry, FontDefinition definition,
- IPreferenceStore store) {
+ protected void populateDefinition(org.eclipse.e4.ui.css.swt.theme.ITheme cssTheme, ITheme theme,
+ FontRegistry registry, FontDefinition definition, IPreferenceStore store) {
ThemeElementHelper.populateDefinition(cssTheme, theme, registry, definition, store);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/Animations.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/Animations.java
index 74b677896f7..811df011994 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/Animations.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/Animations.java
@@ -19,10 +19,9 @@ import org.eclipse.ui.internal.RectangleAnimationFeedbackBase;
import org.eclipse.ui.internal.tweaklets.Tweaklets.TweakKey;
/**
- * Animation tweaklet base class. Create (and register) a tweaklet
- * extension derived from this class to provide alternate animation
- * behavior. Currently only affects animations produced by the new
- * min / max behavior.
+ * Animation tweaklet base class. Create (and register) a tweaklet extension
+ * derived from this class to provide alternate animation behavior. Currently
+ * only affects animations produced by the new min / max behavior.
*
* @since 3.3
*
@@ -35,7 +34,8 @@ public abstract class Animations {
}
/** Default c'tor */
- public Animations() {}
+ public Animations() {
+ }
/**
* Create and return the animation feedback you want to use.
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/ImageAnimationTweak.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/ImageAnimationTweak.java
index 431fc10b4ab..e40aa8573ad 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/ImageAnimationTweak.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/ImageAnimationTweak.java
@@ -26,7 +26,8 @@ import org.eclipse.ui.internal.RectangleAnimationImageFeedback;
*/
public class ImageAnimationTweak extends Animations {
/** Default c'tor */
- public ImageAnimationTweak() {}
+ public ImageAnimationTweak() {
+ }
@Override
public RectangleAnimationFeedbackBase createFeedback(Shell shell) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/InterceptContributions.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/InterceptContributions.java
index ed01cb16eb2..20986745d1e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/InterceptContributions.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/InterceptContributions.java
@@ -23,21 +23,20 @@ import org.eclipse.ui.internal.tweaklets.Tweaklets.TweakKey;
*
*/
public abstract class InterceptContributions {
- public static TweakKey KEY = new Tweaklets.TweakKey(
- InterceptContributions.class);
+ public static TweakKey KEY = new Tweaklets.TweakKey(InterceptContributions.class);
static {
- Tweaklets.setDefault(InterceptContributions.KEY,
- new InterceptContributions() {
- @Override
- public IViewPart tweakView(Object viewContribution) {
- return (IViewPart) viewContribution;
- }
- @Override
- public IEditorPart tweakEditor(Object editorContribution) {
- return (IEditorPart) editorContribution;
- }
- });
+ Tweaklets.setDefault(InterceptContributions.KEY, new InterceptContributions() {
+ @Override
+ public IViewPart tweakView(Object viewContribution) {
+ return (IViewPart) viewContribution;
+ }
+
+ @Override
+ public IEditorPart tweakEditor(Object editorContribution) {
+ return (IEditorPart) editorContribution;
+ }
+ });
}
/** Default constructor */
@@ -47,8 +46,7 @@ public abstract class InterceptContributions {
/**
* Tweak the given view contribution.
*
- * @param viewContribution
- * The contributed instance
+ * @param viewContribution The contributed instance
* @return The view part to use
*/
public abstract IViewPart tweakView(Object viewContribution);
@@ -56,8 +54,7 @@ public abstract class InterceptContributions {
/**
* Tweak the given editor contribution.
*
- * @param editorContribution
- * The contributed instance
+ * @param editorContribution The contributed instance
* @return The editor part to use
*/
public abstract IEditorPart tweakEditor(Object editorContribution);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/LegacyAnimations.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/LegacyAnimations.java
index 7419c528399..fba250a74e8 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/LegacyAnimations.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/LegacyAnimations.java
@@ -26,7 +26,8 @@ import org.eclipse.ui.internal.RectangleAnimationFeedbackBase;
*/
public class LegacyAnimations extends Animations {
/** Default c'tor */
- public LegacyAnimations() {}
+ public LegacyAnimations() {
+ }
@Override
public RectangleAnimationFeedbackBase createFeedback(Shell shell) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/TabBehaviour.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/TabBehaviour.java
index 1c10c7a8bf5..11aefa9011f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/TabBehaviour.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/TabBehaviour.java
@@ -56,11 +56,8 @@ public abstract class TabBehaviour {
*/
public abstract IEditorReference findReusableEditor(WorkbenchPage page);
- public abstract IEditorReference reuseInternalEditor(WorkbenchPage page,
- Object manager,
- Object editorPresentation,
- EditorDescriptor desc, IEditorInput input,
- IEditorReference reusableEditorRef);
+ public abstract IEditorReference reuseInternalEditor(WorkbenchPage page, Object manager, Object editorPresentation,
+ EditorDescriptor desc, IEditorInput input, IEditorReference reusableEditorRef);
/**
* Does nothing by default. Can be overridden by subclasses.
@@ -68,8 +65,7 @@ public abstract class TabBehaviour {
* @param editorReuseGroup
* @param showMultipleEditorTabs
*/
- public void setPreferenceVisibility(Composite editorReuseGroup,
- Button showMultipleEditorTabs) {
+ public void setPreferenceVisibility(Composite editorReuseGroup, Button showMultipleEditorTabs) {
}
/**
@@ -98,8 +94,7 @@ public abstract class TabBehaviour {
* @return
*/
public int getEditorReuseThreshold() {
- IPreferenceStore store = WorkbenchPlugin.getDefault()
- .getPreferenceStore();
+ IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
return store.getInt(IPreferenceConstants.REUSE_EDITORS);
}
@@ -124,12 +119,12 @@ public abstract class TabBehaviour {
}
public Font createInvisibleEditorsFont(Display display, Font originalFont) {
- FontData fontData[] = originalFont.getFontData();
- // Adding the bold attribute
- for (FontData element : fontData) {
+ FontData fontData[] = originalFont.getFontData();
+ // Adding the bold attribute
+ for (FontData element : fontData) {
element.setStyle(element.getStyle() | SWT.BOLD);
}
- return new Font(display, fontData);
+ return new Font(display, fontData);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/TabBehaviourMRU.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/TabBehaviourMRU.java
index 1d3197e71c1..bcde4f29090 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/TabBehaviourMRU.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/TabBehaviourMRU.java
@@ -105,11 +105,8 @@ public class TabBehaviourMRU extends TabBehaviour {
}
@Override
- public IEditorReference reuseInternalEditor(WorkbenchPage page,
- Object manager,
- Object editorPresentation,
- EditorDescriptor desc, IEditorInput input,
- IEditorReference reusableEditorRef) {
+ public IEditorReference reuseInternalEditor(WorkbenchPage page, Object manager, Object editorPresentation,
+ EditorDescriptor desc, IEditorInput input, IEditorReference reusableEditorRef) {
E4Util.unsupported("reuseInternalEditor: we reuse nothing"); //$NON-NLS-1$
return reusableEditorRef;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/Tweaklets.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/Tweaklets.java
index 2a854eff3e5..235bbd01955 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/Tweaklets.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/tweaklets/Tweaklets.java
@@ -44,8 +44,7 @@ public class Tweaklets {
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result
- + ((tweakClass == null) ? 0 : tweakClass.hashCode());
+ result = prime * result + ((tweakClass == null) ? 0 : tweakClass.hashCode());
return result;
}
@@ -100,12 +99,10 @@ public class Tweaklets {
* @return
*/
private static Object createTweaklet(TweakKey definition) {
- IConfigurationElement[] elements = Platform
- .getExtensionRegistry()
+ IConfigurationElement[] elements = Platform.getExtensionRegistry()
.getConfigurationElementsFor("org.eclipse.ui.internalTweaklets"); //$NON-NLS-1$
for (IConfigurationElement element : elements) {
- if (definition.tweakClass.getName().equals(
- element.getAttribute("definition"))) { //$NON-NLS-1$
+ if (definition.tweakClass.getName().equals(element.getAttribute("definition"))) { //$NON-NLS-1$
try {
Object tweaklet = element.createExecutableExtension("implementation"); //$NON-NLS-1$
tweaklets.put(definition, tweaklet);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/BundleUtility.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/BundleUtility.java
index 6430d6de0c7..735018309e2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/BundleUtility.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/BundleUtility.java
@@ -35,51 +35,51 @@ public class BundleUtility {
return bundle.getState() == Bundle.ACTIVE;
}
- public static boolean isActivated(Bundle bundle) {
+ public static boolean isActivated(Bundle bundle) {
if (bundle != null && (bundle.getState() & Bundle.STARTING) != 0)
- return WorkbenchPlugin.getDefault().isStarting(bundle);
- return bundle != null && (bundle.getState() & (Bundle.ACTIVE | Bundle.STOPPING)) != 0;
- }
+ return WorkbenchPlugin.getDefault().isStarting(bundle);
+ return bundle != null && (bundle.getState() & (Bundle.ACTIVE | Bundle.STOPPING)) != 0;
+ }
- public static boolean isReady(Bundle bundle) {
- return bundle != null && isReady(bundle.getState());
- }
+ public static boolean isReady(Bundle bundle) {
+ return bundle != null && isReady(bundle.getState());
+ }
- public static boolean isReady(int bundleState) {
- return (bundleState & (Bundle.RESOLVED | Bundle.STARTING | Bundle.ACTIVE | Bundle.STOPPING)) != 0;
+ public static boolean isReady(int bundleState) {
+ return (bundleState & (Bundle.RESOLVED | Bundle.STARTING | Bundle.ACTIVE | Bundle.STOPPING)) != 0;
}
- public static boolean isActive(String bundleId) {
+ public static boolean isActive(String bundleId) {
return isActive(Platform.getBundle(bundleId));
}
- public static boolean isActivated(String bundleId) {
- return isActivated(Platform.getBundle(bundleId));
- }
+ public static boolean isActivated(String bundleId) {
+ return isActivated(Platform.getBundle(bundleId));
+ }
- public static boolean isReady(String bundleId) {
- return isReady(Platform.getBundle(bundleId));
- }
+ public static boolean isReady(String bundleId) {
+ return isReady(Platform.getBundle(bundleId));
+ }
- public static URL find(Bundle bundle, String path) {
- if (bundle == null) {
+ public static URL find(Bundle bundle, String path) {
+ if (bundle == null) {
return null;
}
return FileLocator.find(bundle, new Path(path));
- }
+ }
- public static URL find(String bundleId, String path) {
- return find(Platform.getBundle(bundleId), path);
- }
+ public static URL find(String bundleId, String path) {
+ return find(Platform.getBundle(bundleId), path);
+ }
- public static void log(String bundleId, Throwable exception) {
- Bundle bundle = Platform.getBundle(bundleId);
- if (bundle == null) {
+ public static void log(String bundleId, Throwable exception) {
+ Bundle bundle = Platform.getBundle(bundleId);
+ if (bundle == null) {
return;
}
- IStatus status = new Status(IStatus.ERROR, bundleId, IStatus.ERROR,
- exception.getMessage() == null ? "" : exception.getMessage(), //$NON-NLS-1$
- exception);
- Platform.getLog(bundle).log(status);
- }
+ IStatus status = new Status(IStatus.ERROR, bundleId, IStatus.ERROR,
+ exception.getMessage() == null ? "" : exception.getMessage(), //$NON-NLS-1$
+ exception);
+ Platform.getLog(bundle).log(status);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/ConfigurationElementMemento.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/ConfigurationElementMemento.java
index b00227b385a..a1d883f7132 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/ConfigurationElementMemento.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/ConfigurationElementMemento.java
@@ -19,38 +19,36 @@ import org.eclipse.ui.IMemento;
public final class ConfigurationElementMemento implements IMemento {
- private IConfigurationElement configurationElement;
+ private IConfigurationElement configurationElement;
- public ConfigurationElementMemento(
- IConfigurationElement configurationElement) {
- if (configurationElement == null) {
+ public ConfigurationElementMemento(IConfigurationElement configurationElement) {
+ if (configurationElement == null) {
throw new NullPointerException();
}
- this.configurationElement = configurationElement;
- }
+ this.configurationElement = configurationElement;
+ }
- @Override
+ @Override
public IMemento createChild(String type) {
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public IMemento createChild(String type, String id) {
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public IMemento getChild(String type) {
- IConfigurationElement[] configurationElements = configurationElement
- .getChildren(type);
+ IConfigurationElement[] configurationElements = configurationElement.getChildren(type);
- if (configurationElements != null && configurationElements.length >= 1) {
+ if (configurationElements != null && configurationElements.length >= 1) {
return new ConfigurationElementMemento(configurationElements[0]);
}
- return null;
- }
+ return null;
+ }
@Override
public IMemento[] getChildren() {
@@ -59,120 +57,118 @@ public final class ConfigurationElementMemento implements IMemento {
return getMementoArray(configurationElements);
}
- @Override
+ @Override
public IMemento[] getChildren(String type) {
- IConfigurationElement[] configurationElements = configurationElement
- .getChildren(type);
+ IConfigurationElement[] configurationElements = configurationElement.getChildren(type);
- return getMementoArray(configurationElements);
- }
+ return getMementoArray(configurationElements);
+ }
private IMemento[] getMementoArray(IConfigurationElement[] configurationElements) {
if (configurationElements != null && configurationElements.length > 0) {
- IMemento mementos[] = new ConfigurationElementMemento[configurationElements.length];
+ IMemento mementos[] = new ConfigurationElementMemento[configurationElements.length];
- for (int i = 0; i < configurationElements.length; i++) {
- mementos[i] = new ConfigurationElementMemento(
- configurationElements[i]);
+ for (int i = 0; i < configurationElements.length; i++) {
+ mementos[i] = new ConfigurationElementMemento(configurationElements[i]);
}
- return mementos;
- }
+ return mementos;
+ }
- return new IMemento[0];
+ return new IMemento[0];
}
- @Override
+ @Override
public Float getFloat(String key) {
- String string = configurationElement.getAttribute(key);
+ String string = configurationElement.getAttribute(key);
- if (string != null) {
+ if (string != null) {
try {
return Float.valueOf(string);
- } catch (NumberFormatException eNumberFormat) {
- }
+ } catch (NumberFormatException eNumberFormat) {
+ }
}
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public String getType() {
- return configurationElement.getName();
- }
+ return configurationElement.getName();
+ }
- @Override
+ @Override
public String getID() {
- return configurationElement.getAttribute(TAG_ID);
- }
+ return configurationElement.getAttribute(TAG_ID);
+ }
- @Override
+ @Override
public Integer getInteger(String key) {
- String string = configurationElement.getAttribute(key);
+ String string = configurationElement.getAttribute(key);
- if (string != null) {
+ if (string != null) {
try {
return Integer.valueOf(string);
- } catch (NumberFormatException eNumberFormat) {
- }
+ } catch (NumberFormatException eNumberFormat) {
+ }
}
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public String getString(String key) {
- return configurationElement.getAttribute(key);
- }
+ return configurationElement.getAttribute(key);
+ }
- @Override
+ @Override
public Boolean getBoolean(String key) {
- String string = configurationElement.getAttribute(key);
- if (string==null) {
- return null;
- }
- return Boolean.valueOf(string);
- }
-
- @Override
+ String string = configurationElement.getAttribute(key);
+ if (string == null) {
+ return null;
+ }
+ return Boolean.valueOf(string);
+ }
+
+ @Override
public String getTextData() {
- return configurationElement.getValue();
- }
+ return configurationElement.getValue();
+ }
- @Override
+ @Override
public String[] getAttributeKeys() {
- return configurationElement.getAttributeNames();
- }
+ return configurationElement.getAttributeNames();
+ }
- @Override
+ @Override
public void putFloat(String key, float value) {
- }
+ }
- @Override
+ @Override
public void putInteger(String key, int value) {
- }
+ }
- @Override
+ @Override
public void putMemento(IMemento memento) {
- }
+ }
- @Override
+ @Override
public void putString(String key, String value) {
- }
+ }
- @Override
+ @Override
public void putBoolean(String key, boolean value) {
- }
+ }
- @Override
+ @Override
public void putTextData(String data) {
- }
+ }
- public String getContributorName() {
- return configurationElement.getContributor().getName();
- }
+ public String getContributorName() {
+ return configurationElement.getContributor().getName();
+ }
- public String getExtensionID() {
- return configurationElement.getDeclaringExtension().getUniqueIdentifier();
- }
+ public String getExtensionID() {
+ return configurationElement.getDeclaringExtension().getUniqueIdentifier();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/ImageSupport.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/ImageSupport.java
index 15118dab2d0..637d2e37fcb 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/ImageSupport.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/ImageSupport.java
@@ -20,11 +20,11 @@ import org.eclipse.ui.PlatformUI;
public final class ImageSupport {
- public static ImageDescriptor getImageDescriptor(String path) {
- URL url = BundleUtility.find(PlatformUI.PLUGIN_ID, path);
- return ImageDescriptor.createFromURL(url);
- }
+ public static ImageDescriptor getImageDescriptor(String path) {
+ URL url = BundleUtility.find(PlatformUI.PLUGIN_ID, path);
+ return ImageDescriptor.createFromURL(url);
+ }
- private ImageSupport() {
- }
+ private ImageSupport() {
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/PrefUtil.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/PrefUtil.java
index 0f3ed52c251..c764fdec874 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/PrefUtil.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/PrefUtil.java
@@ -19,96 +19,96 @@ import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.internal.WorkbenchPlugin;
import org.osgi.service.prefs.BackingStoreException;
-
/**
* Internal utility class to help with getting/setting preferences.
* <p>
- * API preferences are defined in {@link org.eclipse.ui.IWorkbenchPreferenceConstants}
- * and are obtained from the <code>org.eclipse.ui</code> plug-in's preference store.
+ * API preferences are defined in
+ * {@link org.eclipse.ui.IWorkbenchPreferenceConstants} and are obtained from
+ * the <code>org.eclipse.ui</code> plug-in's preference store.
* </p>
* <p>
- * Internal preferences are defined in {@link org.eclipse.ui.internal.IPreferenceConstants}
- * and are obtained from the <code>org.eclipse.ui.workbench</code> plug-in's preference store.
+ * Internal preferences are defined in
+ * {@link org.eclipse.ui.internal.IPreferenceConstants} and are obtained from
+ * the <code>org.eclipse.ui.workbench</code> plug-in's preference store.
* </p>
*
* @since 3.0
*/
public class PrefUtil {
- private PrefUtil() {
- // prevents instantiation
- }
+ private PrefUtil() {
+ // prevents instantiation
+ }
- /**
- * Callback interface to obtain and save the UI preference store.
- */
- public interface ICallback {
- IPreferenceStore getPreferenceStore();
+ /**
+ * Callback interface to obtain and save the UI preference store.
+ */
+ public interface ICallback {
+ IPreferenceStore getPreferenceStore();
- void savePreferences();
- }
+ void savePreferences();
+ }
- private static ICallback uiCallback;
+ private static ICallback uiCallback;
- private static IPreferenceStore uiPreferenceStore;
+ private static IPreferenceStore uiPreferenceStore;
- /**
+ /**
* Sets the callback used to obtain and save the UI preference store.
*
- * @param callback
- * the callback
+ * @param callback the callback
*/
- public static final void setUICallback(ICallback callback) {
- Assert.isTrue(uiCallback == null);
- uiCallback = callback;
- }
+ public static final void setUICallback(ICallback callback) {
+ Assert.isTrue(uiCallback == null);
+ uiCallback = callback;
+ }
- /**
- * Returns the API preference store.
- *
- * @return the API preference store
- */
- public static IPreferenceStore getAPIPreferenceStore() {
- if (uiPreferenceStore == null) {
- Assert.isNotNull(uiCallback);
- uiPreferenceStore = uiCallback.getPreferenceStore();
- }
- return uiPreferenceStore;
- }
+ /**
+ * Returns the API preference store.
+ *
+ * @return the API preference store
+ */
+ public static IPreferenceStore getAPIPreferenceStore() {
+ if (uiPreferenceStore == null) {
+ Assert.isNotNull(uiCallback);
+ uiPreferenceStore = uiCallback.getPreferenceStore();
+ }
+ return uiPreferenceStore;
+ }
- /**
- * Returns the internal preference store.
- *
- * @return the internal preference store
- */
- public static IPreferenceStore getInternalPreferenceStore() {
- return WorkbenchPlugin.getDefault().getPreferenceStore();
- }
+ /**
+ * Returns the internal preference store.
+ *
+ * @return the internal preference store
+ */
+ public static IPreferenceStore getInternalPreferenceStore() {
+ return WorkbenchPlugin.getDefault().getPreferenceStore();
+ }
- /**
- * Saves both the API and internal preference stores.
- */
- public static void savePrefs() {
- saveAPIPrefs();
- saveInternalPrefs();
- }
+ /**
+ * Saves both the API and internal preference stores.
+ */
+ public static void savePrefs() {
+ saveAPIPrefs();
+ saveInternalPrefs();
+ }
- /**
- * Saves the API preference store, if needed.
- */
- public static void saveAPIPrefs() {
- Assert.isNotNull(uiCallback);
- uiCallback.savePreferences();
- }
+ /**
+ * Saves the API preference store, if needed.
+ */
+ public static void saveAPIPrefs() {
+ Assert.isNotNull(uiCallback);
+ uiCallback.savePreferences();
+ }
- /**
- * Saves the internal preference store, if needed.
- */
- public static void saveInternalPrefs() {
+ /**
+ * Saves the internal preference store, if needed.
+ */
+ public static void saveInternalPrefs() {
try {
InstanceScope.INSTANCE.getNode(WorkbenchPlugin.PI_WORKBENCH).flush();
} catch (BackingStoreException e) {
WorkbenchPlugin.log(e);
}
- }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/Util.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/Util.java
index 33167058595..1ddacb712e4 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/Util.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/Util.java
@@ -44,56 +44,54 @@ import org.eclipse.ui.internal.WorkbenchPlugin;
public final class Util {
- public static final SortedMap EMPTY_SORTED_MAP = Collections
- .unmodifiableSortedMap(new TreeMap());
-
- public static final SortedSet EMPTY_SORTED_SET = Collections
- .unmodifiableSortedSet(new TreeSet());
-
- public static final String ZERO_LENGTH_STRING = ""; //$NON-NLS-1$
-
- public static final String[] EMPTY_STRING_ARRAY = new String[0];
-
- /**
- * Ensures that a string is not null. Converts null strings into empty
- * strings, and leaves any other string unmodified. Use this to help
- * wrap calls to methods that return null instead of the empty string.
- * Can also help protect against implementation errors in methods that
- * are not supposed to return null.
- *
- * @param input input string (may be null)
- * @return input if not null, or the empty string if input is null
- */
- public static String safeString(String input) {
- if (input != null) {
- return input;
- }
-
- return ZERO_LENGTH_STRING;
- }
-
- public static void assertInstance(Object object, Class c) {
- assertInstance(object, c, false);
- }
-
- public static void assertInstance(Object object, Class c, boolean allowNull) {
- if (object == null && allowNull) {
+ public static final SortedMap EMPTY_SORTED_MAP = Collections.unmodifiableSortedMap(new TreeMap());
+
+ public static final SortedSet EMPTY_SORTED_SET = Collections.unmodifiableSortedSet(new TreeSet());
+
+ public static final String ZERO_LENGTH_STRING = ""; //$NON-NLS-1$
+
+ public static final String[] EMPTY_STRING_ARRAY = new String[0];
+
+ /**
+ * Ensures that a string is not null. Converts null strings into empty strings,
+ * and leaves any other string unmodified. Use this to help wrap calls to
+ * methods that return null instead of the empty string. Can also help protect
+ * against implementation errors in methods that are not supposed to return
+ * null.
+ *
+ * @param input input string (may be null)
+ * @return input if not null, or the empty string if input is null
+ */
+ public static String safeString(String input) {
+ if (input != null) {
+ return input;
+ }
+
+ return ZERO_LENGTH_STRING;
+ }
+
+ public static void assertInstance(Object object, Class c) {
+ assertInstance(object, c, false);
+ }
+
+ public static void assertInstance(Object object, Class c, boolean allowNull) {
+ if (object == null && allowNull) {
return;
}
- if (object == null || c == null) {
+ if (object == null || c == null) {
throw new NullPointerException();
} else if (!c.isInstance(object)) {
throw new IllegalArgumentException();
}
- }
+ }
- public static int compare(boolean left, boolean right) {
- return left == false ? (right == true ? -1 : 0) : 1;
- }
+ public static int compare(boolean left, boolean right) {
+ return left == false ? (right == true ? -1 : 0) : 1;
+ }
- public static int compare(Comparable left, Comparable right) {
- if (left == null && right == null) {
+ public static int compare(Comparable left, Comparable right) {
+ if (left == null && right == null) {
return 0;
} else if (left == null) {
return -1;
@@ -102,20 +100,20 @@ public final class Util {
} else {
return left.compareTo(right);
}
- }
+ }
- public static int compare(Comparable[] left, Comparable[] right) {
- if (left == null && right == null) {
+ public static int compare(Comparable[] left, Comparable[] right) {
+ if (left == null && right == null) {
return 0;
} else if (left == null) {
return -1;
} else if (right == null) {
return 1;
} else {
- int l = left.length;
- int r = right.length;
+ int l = left.length;
+ int r = right.length;
- if (l != r) {
+ if (l != r) {
return l - r;
}
for (int i = 0; i < l; i++) {
@@ -127,25 +125,25 @@ public final class Util {
}
return 0;
- }
- }
+ }
+ }
- public static int compare(int left, int right) {
- return left - right;
- }
+ public static int compare(int left, int right) {
+ return left - right;
+ }
- public static int compare(List left, List right) {
- if (left == null && right == null) {
+ public static int compare(List left, List right) {
+ if (left == null && right == null) {
return 0;
} else if (left == null) {
return -1;
} else if (right == null) {
return 1;
} else {
- int l = left.size();
- int r = right.size();
+ int l = left.size();
+ int r = right.size();
- if (l != r) {
+ if (l != r) {
return l - r;
}
for (int i = 0; i < l; i++) {
@@ -157,11 +155,11 @@ public final class Util {
}
return 0;
- }
- }
+ }
+ }
- public static int compare(Object left, Object right) {
- if (left == null && right == null) {
+ public static int compare(Object left, Object right) {
+ if (left == null && right == null) {
return 0;
} else if (left == null) {
return -1;
@@ -170,91 +168,83 @@ public final class Util {
} else if (left == right) {
return 0;
} else {
- return compare(System.identityHashCode(left), System
- .identityHashCode(right));
- }
- }
-
- /**
- * An optimized comparison that uses identity hash codes to perform the
- * comparison between non- <code>null</code> objects.
- *
- * @param left
- * The left-hand side of the comparison; may be <code>null</code>.
- * @param right
- * The right-hand side of the comparison; may be
- * <code>null</code>.
- * @return <code>0</code> if they are the same, <code>-1</code> if left
- * is <code>null</code>;<code>1</code> if right is
- * <code>null</code>. Otherwise, the left identity hash code
- * minus the right identity hash code.
- */
- public static int compareIdentity(Object left, Object right) {
- if (left == null && right == null) {
+ return compare(System.identityHashCode(left), System.identityHashCode(right));
+ }
+ }
+
+ /**
+ * An optimized comparison that uses identity hash codes to perform the
+ * comparison between non- <code>null</code> objects.
+ *
+ * @param left The left-hand side of the comparison; may be <code>null</code>.
+ * @param right The right-hand side of the comparison; may be <code>null</code>.
+ * @return <code>0</code> if they are the same, <code>-1</code> if left is
+ * <code>null</code>;<code>1</code> if right is <code>null</code>.
+ * Otherwise, the left identity hash code minus the right identity hash
+ * code.
+ */
+ public static int compareIdentity(Object left, Object right) {
+ if (left == null && right == null) {
return 0;
} else if (left == null) {
return -1;
} else if (right == null) {
return 1;
} else {
- return System.identityHashCode(left)
- - System.identityHashCode(right);
+ return System.identityHashCode(left) - System.identityHashCode(right);
}
- }
+ }
- public static void diff(Map<?, ?> left, Map<?, ?> right, Set leftOnly, Set different,
- Set rightOnly) {
- if (left == null || right == null || leftOnly == null
- || different == null || rightOnly == null) {
+ public static void diff(Map<?, ?> left, Map<?, ?> right, Set leftOnly, Set different, Set rightOnly) {
+ if (left == null || right == null || leftOnly == null || different == null || rightOnly == null) {
throw new NullPointerException();
}
for (Entry<?, ?> leftEntry : left.entrySet()) {
Object key = leftEntry.getKey();
- if (!right.containsKey(key)) {
+ if (!right.containsKey(key)) {
leftOnly.add(key);
} else if (!Util.equals(leftEntry.getValue(), right.get(key))) {
different.add(key);
}
- }
+ }
for (Object rightKey : right.keySet()) {
if (!left.containsKey(rightKey)) {
rightOnly.add(rightKey);
}
- }
- }
+ }
+ }
- public static void diff(Set left, Set right, Set leftOnly, Set rightOnly) {
- if (left == null || right == null || leftOnly == null
- || rightOnly == null) {
+ public static void diff(Set left, Set right, Set leftOnly, Set rightOnly) {
+ if (left == null || right == null || leftOnly == null || rightOnly == null) {
throw new NullPointerException();
}
- Iterator iterator = left.iterator();
+ Iterator iterator = left.iterator();
- while (iterator.hasNext()) {
- Object object = iterator.next();
+ while (iterator.hasNext()) {
+ Object object = iterator.next();
- if (!right.contains(object)) {
+ if (!right.contains(object)) {
leftOnly.add(object);
}
- }
+ }
- iterator = right.iterator();
+ iterator = right.iterator();
- while (iterator.hasNext()) {
- Object object = iterator.next();
+ while (iterator.hasNext()) {
+ Object object = iterator.next();
- if (!left.contains(object)) {
+ if (!left.contains(object)) {
rightOnly.add(object);
}
- }
- }
+ }
+ }
- public static boolean endsWith(List left, List right, boolean equals) {
- if (left == null || right == null) {
+ public static boolean endsWith(List left, List right, boolean equals) {
+ if (left == null || right == null) {
return false;
}
int l = left.size();
@@ -271,10 +261,10 @@ public final class Util {
}
return true;
- }
+ }
- public static boolean endsWith(Object[] left, Object[] right, boolean equals) {
- if (left == null || right == null) {
+ public static boolean endsWith(Object[] left, Object[] right, boolean equals) {
+ if (left == null || right == null) {
return false;
}
int l = left.length;
@@ -291,38 +281,32 @@ public final class Util {
}
return true;
- }
+ }
- public static boolean equals(boolean left, boolean right) {
- return left == right;
- }
+ public static boolean equals(boolean left, boolean right) {
+ return left == right;
+ }
- public static boolean equals(int left, int right) {
- return left == right;
- }
+ public static boolean equals(int left, int right) {
+ return left == right;
+ }
- public static boolean equals(Object left, Object right) {
- return left == null ? right == null : ((right != null) && left
- .equals(right));
- }
+ public static boolean equals(Object left, Object right) {
+ return left == null ? right == null : ((right != null) && left.equals(right));
+ }
/**
- * Tests whether two arrays of objects are equal to each other. The arrays
- * must not be <code>null</code>, but their elements may be
- * <code>null</code>.
+ * Tests whether two arrays of objects are equal to each other. The arrays must
+ * not be <code>null</code>, but their elements may be <code>null</code>.
*
- * @param leftArray
- * The left array to compare; may be <code>null</code>, and
- * may be empty and may contain <code>null</code> elements.
- * @param rightArray
- * The right array to compare; may be <code>null</code>, and
- * may be empty and may contain <code>null</code> elements.
- * @return <code>true</code> if the arrays are equal length and the
- * elements at the same position are equal; <code>false</code>
- * otherwise.
+ * @param leftArray The left array to compare; may be <code>null</code>, and
+ * may be empty and may contain <code>null</code> elements.
+ * @param rightArray The right array to compare; may be <code>null</code>, and
+ * may be empty and may contain <code>null</code> elements.
+ * @return <code>true</code> if the arrays are equal length and the elements at
+ * the same position are equal; <code>false</code> otherwise.
*/
- public static boolean equals(final Object[] leftArray,
- final Object[] rightArray) {
+ public static boolean equals(final Object[] leftArray, final Object[] rightArray) {
if (leftArray == rightArray) {
return true;
}
@@ -340,8 +324,7 @@ public final class Util {
for (int i = 0; i < leftArray.length; i++) {
final Object left = leftArray[i];
final Object right = rightArray[i];
- final boolean equal = (left == null) ? (right == null) : (left
- .equals(right));
+ final boolean equal = (left == null) ? (right == null) : (left.equals(right));
if (!equal) {
return false;
}
@@ -350,246 +333,240 @@ public final class Util {
return true;
}
- public static int hashCode(boolean b) {
- return b ? Boolean.TRUE.hashCode() : Boolean.FALSE.hashCode();
- }
+ public static int hashCode(boolean b) {
+ return b ? Boolean.TRUE.hashCode() : Boolean.FALSE.hashCode();
+ }
- public static int hashCode(int i) {
- return i;
- }
+ public static int hashCode(int i) {
+ return i;
+ }
- public static int hashCode(Object object) {
- return object != null ? object.hashCode() : 0;
- }
+ public static int hashCode(Object object) {
+ return object != null ? object.hashCode() : 0;
+ }
- public static Collection safeCopy(Collection collection, Class c) {
- return safeCopy(collection, c, false);
- }
+ public static Collection safeCopy(Collection collection, Class c) {
+ return safeCopy(collection, c, false);
+ }
- public static Collection safeCopy(Collection collection, Class c,
- boolean allowNullElements) {
- if (collection == null || c == null) {
+ public static Collection safeCopy(Collection collection, Class c, boolean allowNullElements) {
+ if (collection == null || c == null) {
throw new NullPointerException();
}
- collection = Collections.unmodifiableCollection(new ArrayList(
- collection));
- Iterator iterator = collection.iterator();
+ collection = Collections.unmodifiableCollection(new ArrayList(collection));
+ Iterator iterator = collection.iterator();
- while (iterator.hasNext()) {
+ while (iterator.hasNext()) {
assertInstance(iterator.next(), c, allowNullElements);
}
- return collection;
- }
+ return collection;
+ }
- public static List safeCopy(List list, Class c) {
- return safeCopy(list, c, false);
- }
+ public static List safeCopy(List list, Class c) {
+ return safeCopy(list, c, false);
+ }
- public static List safeCopy(List list, Class c, boolean allowNullElements) {
- if (list == null || c == null) {
+ public static List safeCopy(List list, Class c, boolean allowNullElements) {
+ if (list == null || c == null) {
throw new NullPointerException();
}
- list = Collections.unmodifiableList(new ArrayList(list));
- Iterator iterator = list.iterator();
+ list = Collections.unmodifiableList(new ArrayList(list));
+ Iterator iterator = list.iterator();
- while (iterator.hasNext()) {
+ while (iterator.hasNext()) {
assertInstance(iterator.next(), c, allowNullElements);
}
- return list;
- }
+ return list;
+ }
- public static Map safeCopy(Map map, Class keyClass, Class valueClass) {
- return safeCopy(map, keyClass, valueClass, false, false);
- }
+ public static Map safeCopy(Map map, Class keyClass, Class valueClass) {
+ return safeCopy(map, keyClass, valueClass, false, false);
+ }
- public static Map safeCopy(Map map, Class keyClass, Class valueClass,
- boolean allowNullKeys, boolean allowNullValues) {
- if (map == null || keyClass == null || valueClass == null) {
+ public static Map safeCopy(Map map, Class keyClass, Class valueClass, boolean allowNullKeys,
+ boolean allowNullValues) {
+ if (map == null || keyClass == null || valueClass == null) {
throw new NullPointerException();
}
- map = Collections.unmodifiableMap(new HashMap(map));
- Iterator iterator = map.entrySet().iterator();
+ map = Collections.unmodifiableMap(new HashMap(map));
+ Iterator iterator = map.entrySet().iterator();
- while (iterator.hasNext()) {
- Map.Entry entry = (Map.Entry) iterator.next();
- assertInstance(entry.getKey(), keyClass, allowNullKeys);
- assertInstance(entry.getValue(), valueClass, allowNullValues);
- }
+ while (iterator.hasNext()) {
+ Map.Entry entry = (Map.Entry) iterator.next();
+ assertInstance(entry.getKey(), keyClass, allowNullKeys);
+ assertInstance(entry.getValue(), valueClass, allowNullValues);
+ }
- return map;
- }
+ return map;
+ }
- public static Set safeCopy(Set set, Class c) {
- return safeCopy(set, c, false);
- }
+ public static Set safeCopy(Set set, Class c) {
+ return safeCopy(set, c, false);
+ }
- public static Set safeCopy(Set set, Class c, boolean allowNullElements) {
- if (set == null || c == null) {
+ public static Set safeCopy(Set set, Class c, boolean allowNullElements) {
+ if (set == null || c == null) {
throw new NullPointerException();
}
- set = Collections.unmodifiableSet(new HashSet(set));
- Iterator iterator = set.iterator();
+ set = Collections.unmodifiableSet(new HashSet(set));
+ Iterator iterator = set.iterator();
- while (iterator.hasNext()) {
+ while (iterator.hasNext()) {
assertInstance(iterator.next(), c, allowNullElements);
}
- return set;
- }
+ return set;
+ }
- public static SortedMap safeCopy(SortedMap sortedMap, Class keyClass,
- Class valueClass) {
- return safeCopy(sortedMap, keyClass, valueClass, false, false);
- }
+ public static SortedMap safeCopy(SortedMap sortedMap, Class keyClass, Class valueClass) {
+ return safeCopy(sortedMap, keyClass, valueClass, false, false);
+ }
- public static SortedMap safeCopy(SortedMap sortedMap, Class keyClass,
- Class valueClass, boolean allowNullKeys, boolean allowNullValues) {
- if (sortedMap == null || keyClass == null || valueClass == null) {
+ public static SortedMap safeCopy(SortedMap sortedMap, Class keyClass, Class valueClass, boolean allowNullKeys,
+ boolean allowNullValues) {
+ if (sortedMap == null || keyClass == null || valueClass == null) {
throw new NullPointerException();
}
- sortedMap = Collections.unmodifiableSortedMap(new TreeMap(sortedMap));
- Iterator iterator = sortedMap.entrySet().iterator();
+ sortedMap = Collections.unmodifiableSortedMap(new TreeMap(sortedMap));
+ Iterator iterator = sortedMap.entrySet().iterator();
- while (iterator.hasNext()) {
- Map.Entry entry = (Map.Entry) iterator.next();
- assertInstance(entry.getKey(), keyClass, allowNullKeys);
- assertInstance(entry.getValue(), valueClass, allowNullValues);
- }
+ while (iterator.hasNext()) {
+ Map.Entry entry = (Map.Entry) iterator.next();
+ assertInstance(entry.getKey(), keyClass, allowNullKeys);
+ assertInstance(entry.getValue(), valueClass, allowNullValues);
+ }
- return sortedMap;
- }
+ return sortedMap;
+ }
- public static SortedSet safeCopy(SortedSet sortedSet, Class c) {
- return safeCopy(sortedSet, c, false);
- }
+ public static SortedSet safeCopy(SortedSet sortedSet, Class c) {
+ return safeCopy(sortedSet, c, false);
+ }
- public static SortedSet safeCopy(SortedSet sortedSet, Class c,
- boolean allowNullElements) {
- if (sortedSet == null || c == null) {
+ public static SortedSet safeCopy(SortedSet sortedSet, Class c, boolean allowNullElements) {
+ if (sortedSet == null || c == null) {
throw new NullPointerException();
}
- sortedSet = Collections.unmodifiableSortedSet(new TreeSet(sortedSet));
- Iterator iterator = sortedSet.iterator();
+ sortedSet = Collections.unmodifiableSortedSet(new TreeSet(sortedSet));
+ Iterator iterator = sortedSet.iterator();
- while (iterator.hasNext()) {
+ while (iterator.hasNext()) {
assertInstance(iterator.next(), c, allowNullElements);
}
- return sortedSet;
- }
+ return sortedSet;
+ }
- public static boolean startsWith(List left, List right, boolean equals) {
- if (left == null || right == null) {
+ public static boolean startsWith(List left, List right, boolean equals) {
+ if (left == null || right == null) {
return false;
} else {
- int l = left.size();
- int r = right.size();
+ int l = left.size();
+ int r = right.size();
- if (r > l || !equals && r == l) {
+ if (r > l || !equals && r == l) {
return false;
}
- for (int i = 0; i < r; i++) {
+ for (int i = 0; i < r; i++) {
if (!equals(left.get(i), right.get(i))) {
return false;
}
}
- return true;
- }
- }
+ return true;
+ }
+ }
- public static boolean startsWith(Object[] left, Object[] right,
- boolean equals) {
- if (left == null || right == null) {
+ public static boolean startsWith(Object[] left, Object[] right, boolean equals) {
+ if (left == null || right == null) {
return false;
} else {
- int l = left.length;
- int r = right.length;
+ int l = left.length;
+ int r = right.length;
- if (r > l || !equals && r == l) {
+ if (r > l || !equals && r == l) {
return false;
}
- for (int i = 0; i < r; i++) {
+ for (int i = 0; i < r; i++) {
if (!equals(left[i], right[i])) {
return false;
}
}
- return true;
- }
- }
+ return true;
+ }
+ }
- public static String translateString(ResourceBundle resourceBundle,
- String key) {
- return Util.translateString(resourceBundle, key, key, true, true);
- }
+ public static String translateString(ResourceBundle resourceBundle, String key) {
+ return Util.translateString(resourceBundle, key, key, true, true);
+ }
- public static String translateString(ResourceBundle resourceBundle,
- String key, String string, boolean signal, boolean trim) {
- if (resourceBundle != null && key != null) {
+ public static String translateString(ResourceBundle resourceBundle, String key, String string, boolean signal,
+ boolean trim) {
+ if (resourceBundle != null && key != null) {
try {
- final String translatedString = resourceBundle.getString(key);
+ final String translatedString = resourceBundle.getString(key);
- if (translatedString != null) {
+ if (translatedString != null) {
return trim ? translatedString.trim() : translatedString;
}
- } catch (MissingResourceException eMissingResource) {
- if (signal) {
+ } catch (MissingResourceException eMissingResource) {
+ if (signal) {
WorkbenchPlugin.log(eMissingResource);
}
- }
+ }
}
- return trim ? string.trim() : string;
- }
+ return trim ? string.trim() : string;
+ }
- public static void arrayCopyWithRemoval(Object [] src, Object [] dst, int idxToRemove) {
- if (src == null || dst == null || src.length - 1 != dst.length || idxToRemove < 0 || idxToRemove >= src.length) {
+ public static void arrayCopyWithRemoval(Object[] src, Object[] dst, int idxToRemove) {
+ if (src == null || dst == null || src.length - 1 != dst.length || idxToRemove < 0
+ || idxToRemove >= src.length) {
throw new IllegalArgumentException();
}
- if (idxToRemove == 0) {
- System.arraycopy(src, 1, dst, 0, src.length - 1);
- }
- else if (idxToRemove == src.length - 1) {
- System.arraycopy(src, 0, dst, 0, src.length - 1);
- }
- else {
- System.arraycopy(src, 0, dst, 0, idxToRemove);
- System.arraycopy(src, idxToRemove + 1, dst, idxToRemove, src.length - idxToRemove - 1);
- }
- }
-
- /**
- * Appends array2 to the end of array1 and returns the result
- *
- * @param array1
- * @param array2
- * @return
- * @since 3.1
- */
- public static Object[] appendArray(Object[] array1, Object[] array2) {
- Object[] result = new Object[array1.length + array2.length];
- System.arraycopy(array1, 0, result, 0, array1.length);
- System.arraycopy(array2, 0, result, array1.length, array2.length);
- return result;
- }
-
- private Util() {
- }
+ if (idxToRemove == 0) {
+ System.arraycopy(src, 1, dst, 0, src.length - 1);
+ } else if (idxToRemove == src.length - 1) {
+ System.arraycopy(src, 0, dst, 0, src.length - 1);
+ } else {
+ System.arraycopy(src, 0, dst, 0, idxToRemove);
+ System.arraycopy(src, idxToRemove + 1, dst, idxToRemove, src.length - idxToRemove - 1);
+ }
+ }
+
+ /**
+ * Appends array2 to the end of array1 and returns the result
+ *
+ * @param array1
+ * @param array2
+ * @return
+ * @since 3.1
+ */
+ public static Object[] appendArray(Object[] array1, Object[] array2) {
+ Object[] result = new Object[array1.length + array2.length];
+ System.arraycopy(array1, 0, result, 0, array1.length);
+ System.arraycopy(array2, 0, result, array1.length, array2.length);
+ return result;
+ }
+
+ private Util() {
+ }
/**
* Returns an interned representation of the given string
+ *
* @param string The string to intern
* @return The interned string
*/
@@ -598,33 +575,33 @@ public final class Util {
}
/**
- * Two {@link String}s presented in a list form.
- * This method can be used to form a longer list by providing a list for
- * <code>item1</code> and an item to append to the list for
- * <code>item2</code>.
+ * Two {@link String}s presented in a list form. This method can be used to form
+ * a longer list by providing a list for <code>item1</code> and an item to
+ * append to the list for <code>item2</code>.
*
- * @param item1 a string
- * @param item2 a string
- * @return a string which presents <code>item1</code> and
- * <code>item2</code> in a list form.
+ * @param item1 a string
+ * @param item2 a string
+ * @return a string which presents <code>item1</code> and <code>item2</code> in
+ * a list form.
*/
public static String createList(String item1, String item2) {
return NLS.bind(WorkbenchMessages.Util_List, item1, item2);
}
/**
- * Creates a {@link String} representing the elements in <code>items</code>
- * as a list. This method uses the {@link Object#toString()} method on the
- * objects to create them as a String.
- * @param items the List to make into a String
- * @return a string which presents <code>items</code> in String form.
+ * Creates a {@link String} representing the elements in <code>items</code> as a
+ * list. This method uses the {@link Object#toString()} method on the objects to
+ * create them as a String.
+ *
+ * @param items the List to make into a String
+ * @return a string which presents <code>items</code> in String form.
*/
public static String createList(List items) {
String list = null;
for (Iterator i = items.iterator(); i.hasNext();) {
Object object = i.next();
final String string = object == null ? WorkbenchMessages.Util_listNull : object.toString();
- if(list == null) {
+ if (list == null) {
list = string;
} else {
list = createList(list, string);
@@ -634,16 +611,17 @@ public final class Util {
}
/**
- * Creates a {@link String} representing the elements in <code>items</code>
- * as a list. This method uses the {@link Object#toString()} method on the
- * objects to create them as a String.
- * @param items the array to make into a String
- * @return a string which presents <code>items</code> in String form.
+ * Creates a {@link String} representing the elements in <code>items</code> as a
+ * list. This method uses the {@link Object#toString()} method on the objects to
+ * create them as a String.
+ *
+ * @param items the array to make into a String
+ * @return a string which presents <code>items</code> in String form.
*/
public static String createList(Object[] items) {
String list = null;
for (Object item : items) {
- if(list == null) {
+ if (list == null) {
list = item.toString();
} else {
list = createList(list, item.toString());
@@ -653,13 +631,12 @@ public final class Util {
}
/**
- * Return the window for the given shell or the currently active window if
- * one could not be determined.
+ * Return the window for the given shell or the currently active window if one
+ * could not be determined.
*
- * @param shellToCheck
- * the shell to search on
- * @return the window for the given shell or the currently active window if
- * one could not be determined
+ * @param shellToCheck the shell to search on
+ * @return the window for the given shell or the currently active window if one
+ * could not be determined
* @since 3.2
*/
public static IWorkbenchWindow getWorkbenchWindowForShell(Shell shellToCheck) {
@@ -673,8 +650,7 @@ public final class Util {
}
if (workbenchWindow == null) {
- workbenchWindow = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow();
+ workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
}
return workbenchWindow;
@@ -692,9 +668,9 @@ public final class Util {
public static Shell getShellToParentOn() {
IWorkbench workbench = PlatformUI.getWorkbench();
IWorkbenchWindow activeWindow = workbench.getActiveWorkbenchWindow();
- IWorkbenchWindow windowToParentOn = activeWindow == null ? (workbench
- .getWorkbenchWindowCount() > 0 ? workbench
- .getWorkbenchWindows()[0] : null) : activeWindow;
+ IWorkbenchWindow windowToParentOn = activeWindow == null
+ ? (workbench.getWorkbenchWindowCount() > 0 ? workbench.getWorkbenchWindows()[0] : null)
+ : activeWindow;
return windowToParentOn == null ? null : windowToParentOn.getShell();
}
@@ -702,10 +678,8 @@ public final class Util {
* A String#split(*) replacement that splits on the provided char. No Regex
* involved.
*
- * @param src
- * The string to be split
- * @param delim
- * The character to split on
+ * @param src The string to be split
+ * @param delim The character to split on
* @return An array containing the split. Might be empty, but will not be
* <code>null</code>.
*/
@@ -736,7 +710,7 @@ public final class Util {
String[] resultArray = (String[]) result.toArray(new String[result.size()]);
boolean allEmpty = true;
for (int i = 0; i < resultArray.length && allEmpty; i++) {
- if (resultArray[i].length()>0) {
+ if (resultArray[i].length() > 0) {
allEmpty = false;
}
}
@@ -749,8 +723,8 @@ public final class Util {
/**
* Foundation replacement for String.replaceAll(*).
*
- * @param src the starting string.
- * @param find the string to find.
+ * @param src the starting string.
+ * @param find the string to find.
* @param replacement the string to replace.
* @return The new string.
* @since 3.3
@@ -760,23 +734,22 @@ public final class Util {
}
/**
- * Attempt to load the executable extension from the element/attName. If
- * the load fails or the resulting object is not castable to the
- * provided classSpec (if any) an error is logged and a null is returned.
+ * Attempt to load the executable extension from the element/attName. If the
+ * load fails or the resulting object is not castable to the provided classSpec
+ * (if any) an error is logged and a null is returned.
*
- * @param element The {@link IConfigurationElement} containing the
- * executable extension's specification
- * @param attName The attribute name of the executable extension
- * @param classSpec An optional <code>Class</code> defining the type
- * that the loaded Object must be castable to. This is optional to support
- * code where the client has a choice of mutually non-castable types to
- * choose from.
+ * @param element The {@link IConfigurationElement} containing the executable
+ * extension's specification
+ * @param attName The attribute name of the executable extension
+ * @param classSpec An optional <code>Class</code> defining the type that the
+ * loaded Object must be castable to. This is optional to
+ * support code where the client has a choice of mutually
+ * non-castable types to choose from.
*
- * @return The loaded object which is guaranteed to be
- * castable to the given classSpec or null if a failure occurred
+ * @return The loaded object which is guaranteed to be castable to the given
+ * classSpec or null if a failure occurred
*/
- public static Object safeLoadExecutableExtension(IConfigurationElement element,
- String attName, Class classSpec) {
+ public static Object safeLoadExecutableExtension(IConfigurationElement element, String attName, Class classSpec) {
Object loadedEE = null;
// Load the handler.
@@ -787,9 +760,8 @@ public final class Util {
// Gather formatting info
final String classDef = element.getAttribute(attName);
- final String message = "Class load Failure: '" + classDef + "'"; //$NON-NLS-1$//$NON-NLS-2$
- IStatus status = new Status(IStatus.ERROR,
- WorkbenchPlugin.PI_WORKBENCH, 0, message, e);
+ final String message = "Class load Failure: '" + classDef + "'"; //$NON-NLS-1$//$NON-NLS-2$
+ IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 0, message, e);
WorkbenchPlugin.log(message, status);
}
@@ -797,11 +769,10 @@ public final class Util {
if (classSpec != null && loadedEE != null && !classSpec.isInstance(loadedEE)) {
// ooops, the loaded class is not castable to the given type
final String message = "Loaded class is of incorrect type: expected(" + //$NON-NLS-1$
- classSpec.getName() + ") got (" + loadedEE.getClass().getName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ classSpec.getName() + ") got (" + loadedEE.getClass().getName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
IllegalArgumentException e = new IllegalArgumentException(message);
- final IStatus status = new Status(IStatus.ERROR,
- WorkbenchPlugin.PI_WORKBENCH, 0, message, e);
+ final IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 0, message, e);
WorkbenchPlugin.log(message, status);
// This 'failed'
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/AbstractExtensionWizardRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/AbstractExtensionWizardRegistry.java
index 978bbd25699..f6e5728c6e6 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/AbstractExtensionWizardRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/AbstractExtensionWizardRegistry.java
@@ -32,8 +32,8 @@ import org.eclipse.ui.wizards.IWizardDescriptor;
*
* @since 3.1
*/
-public abstract class AbstractExtensionWizardRegistry extends
- AbstractWizardRegistry implements IExtensionChangeHandler{
+public abstract class AbstractExtensionWizardRegistry extends AbstractWizardRegistry
+ implements IExtensionChangeHandler {
/**
* Create a new instance of this class.
@@ -44,11 +44,9 @@ public abstract class AbstractExtensionWizardRegistry extends
@Override
public void addExtension(IExtensionTracker tracker, IExtension extension) {
- WizardsRegistryReader reader = new WizardsRegistryReader(getPlugin(),
- getExtensionPoint());
+ WizardsRegistryReader reader = new WizardsRegistryReader(getPlugin(), getExtensionPoint());
reader.setInitialCollection(getWizardElements());
- IConfigurationElement[] configurationElements = extension
- .getConfigurationElements();
+ IConfigurationElement[] configurationElements = extension.getConfigurationElements();
for (IConfigurationElement configurationElement : configurationElements) {
reader.readElement(configurationElement);
}
@@ -68,27 +66,24 @@ public abstract class AbstractExtensionWizardRegistry extends
IWizardDescriptor[] localPrimaryWizards = getPrimaryWizards();
WorkbenchWizardElement[] newPrimary = new WorkbenchWizardElement[additionalPrimary.length
+ localPrimaryWizards.length];
- System.arraycopy(localPrimaryWizards, 0, newPrimary, 0,
- localPrimaryWizards.length);
- System.arraycopy(additionalPrimary, 0, newPrimary,
- localPrimaryWizards.length, additionalPrimary.length);
+ System.arraycopy(localPrimaryWizards, 0, newPrimary, 0, localPrimaryWizards.length);
+ System.arraycopy(additionalPrimary, 0, newPrimary, localPrimaryWizards.length, additionalPrimary.length);
setPrimaryWizards(newPrimary);
}
@Override
public void dispose() {
super.dispose();
- PlatformUI.getWorkbench().getExtensionTracker()
- .unregisterHandler(this);
+ PlatformUI.getWorkbench().getExtensionTracker().unregisterHandler(this);
}
@Override
protected void doInitialize() {
- PlatformUI.getWorkbench().getExtensionTracker().registerHandler(this, ExtensionTracker.createExtensionPointFilter(getExtensionPointFilter()));
+ PlatformUI.getWorkbench().getExtensionTracker().registerHandler(this,
+ ExtensionTracker.createExtensionPointFilter(getExtensionPointFilter()));
- WizardsRegistryReader reader = new WizardsRegistryReader(getPlugin(),
- getExtensionPoint());
+ WizardsRegistryReader reader = new WizardsRegistryReader(getPlugin(), getExtensionPoint());
setWizardElements(reader.getWizardElements());
setPrimaryWizards(reader.getPrimaryWizards());
registerWizards(getWizardElements());
@@ -103,8 +98,7 @@ public abstract class AbstractExtensionWizardRegistry extends
protected abstract String getExtensionPoint();
private IExtensionPoint getExtensionPointFilter() {
- return Platform.getExtensionRegistry().getExtensionPoint(getPlugin(),
- getExtensionPoint());
+ return Platform.getExtensionRegistry().getExtensionPoint(getPlugin(), getExtensionPoint());
}
/**
@@ -117,21 +111,17 @@ public abstract class AbstractExtensionWizardRegistry extends
/**
* Register the object with the workbench tracker.
*
- * @param extension
- * the originating extension
- * @param object
- * the object to track
+ * @param extension the originating extension
+ * @param object the object to track
*/
private void register(IExtension extension, Object object) {
- PlatformUI.getWorkbench().getExtensionTracker().registerObject(
- extension, object, IExtensionTracker.REF_WEAK);
+ PlatformUI.getWorkbench().getExtensionTracker().registerObject(extension, object, IExtensionTracker.REF_WEAK);
}
/**
* Register all wizards in the given collection with the extension tracker.
*
- * @param collection
- * the collection to register
+ * @param collection the collection to register
*/
private void registerWizards(WizardCollectionElement collection) {
registerWizards(collection.getWorkbenchWizardElements());
@@ -139,8 +129,7 @@ public abstract class AbstractExtensionWizardRegistry extends
for (WizardCollectionElement wizardCollectionElement : collection.getCollectionElements()) {
IConfigurationElement configurationElement = wizardCollectionElement.getConfigurationElement();
if (configurationElement != null) {
- register(configurationElement.getDeclaringExtension(),
- wizardCollectionElement);
+ register(configurationElement.getDeclaringExtension(), wizardCollectionElement);
}
registerWizards(wizardCollectionElement);
}
@@ -149,20 +138,17 @@ public abstract class AbstractExtensionWizardRegistry extends
/**
* Register all wizards in the given array.
*
- * @param wizards
- * the wizards to register
+ * @param wizards the wizards to register
*/
private void registerWizards(WorkbenchWizardElement[] wizards) {
for (WorkbenchWizardElement wizard : wizards) {
- register(wizard.getConfigurationElement()
- .getDeclaringExtension(), wizard);
+ register(wizard.getConfigurationElement().getDeclaringExtension(), wizard);
}
}
@Override
public void removeExtension(IExtension extension, Object[] objects) {
- if (!extension.getExtensionPointUniqueIdentifier().equals(
- getExtensionPointFilter().getUniqueIdentifier())) {
+ if (!extension.getExtensionPointUniqueIdentifier().equals(getExtensionPointFilter().getUniqueIdentifier())) {
return;
}
for (Object object : objects) {
@@ -180,9 +166,7 @@ public abstract class AbstractExtensionWizardRegistry extends
for (int j = 0; j < primaryWizards.length; j++) {
if (primaryWizards[j] == wizard) {
WorkbenchWizardElement[] newPrimary = new WorkbenchWizardElement[primaryWizards.length - 1];
- Util
- .arrayCopyWithRemoval(primaryWizards,
- newPrimary, j);
+ Util.arrayCopyWithRemoval(primaryWizards, newPrimary, j);
primaryWizards = newPrimary;
break;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/AbstractWizardRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/AbstractWizardRegistry.java
index 83689d0f553..3d366bd2d61 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/AbstractWizardRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/AbstractWizardRegistry.java
@@ -112,8 +112,7 @@ public abstract class AbstractWizardRegistry implements IWizardRegistry {
/**
* Set the primary wizards.
*
- * @param primaryWizards
- * the primary wizards
+ * @param primaryWizards the primary wizards
*/
protected void setPrimaryWizards(WorkbenchWizardElement[] primaryWizards) {
this.primaryWizards = primaryWizards;
@@ -122,8 +121,7 @@ public abstract class AbstractWizardRegistry implements IWizardRegistry {
/**
* Set the wizard elements.
*
- * @param wizardElements
- * the wizard elements
+ * @param wizardElements the wizard elements
*/
protected void setWizardElements(WizardCollectionElement wizardElements) {
this.wizardElements = wizardElements;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/ImportWizardRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/ImportWizardRegistry.java
index f421e2366d0..a52d7ff899b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/ImportWizardRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/ImportWizardRegistry.java
@@ -38,7 +38,6 @@ public class ImportWizardRegistry extends AbstractExtensionWizardRegistry {
return singleton;
}
-
/**
*
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/PreferencesContentProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/PreferencesContentProvider.java
index 00f10ed2065..ebab43bdf1e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/PreferencesContentProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/PreferencesContentProvider.java
@@ -57,5 +57,4 @@ public class PreferencesContentProvider implements ITreeContentProvider {
}
-
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/PreferencesExportWizard.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/PreferencesExportWizard.java
index af782d35107..8e3d47d5389 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/PreferencesExportWizard.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/PreferencesExportWizard.java
@@ -24,24 +24,26 @@ import org.eclipse.ui.internal.WorkbenchImages;
import org.eclipse.ui.internal.WorkbenchPlugin;
/**
- * Standard workbench wizard for exporting preferences from the workspace
- * to the local file system.
+ * Standard workbench wizard for exporting preferences from the workspace to the
+ * local file system.
* <p>
- * This class may be instantiated and used without further configuration;
- * this class is not intended to be subclassed.
+ * This class may be instantiated and used without further configuration; this
+ * class is not intended to be subclassed.
* </p>
* <p>
* Example:
+ *
* <pre>
* IWizard wizard = new PreferencesExportWizard();
* wizard.init(workbench, selection);
* WizardDialog dialog = new WizardDialog(shell, wizard);
* dialog.open();
* </pre>
+ *
* During the call to <code>open</code>, the wizard dialog is presented to the
- * user. When the user hits Finish, the user-selected workspace preferences
- * are exported to the user-specified location in the local file system,
- * the dialog closes, and the call to <code>open</code> returns.
+ * user. When the user hits Finish, the user-selected workspace preferences are
+ * exported to the user-specified location in the local file system, the dialog
+ * closes, and the call to <code>open</code> returns.
* </p>
*
* @since 3.1
@@ -55,46 +57,46 @@ public class PreferencesExportWizard extends Wizard implements IExportWizard {
public static final String EVENT_EXPORT_END = EVENT_TOPIC_BASE + "end"; //$NON-NLS-1$
- private WizardPreferencesExportPage1 mainPage;
+ private WizardPreferencesExportPage1 mainPage;
private IEventBroker eventBroker;
- /**
- * Creates a wizard for exporting workspace preferences to the local file system.
- */
- public PreferencesExportWizard() {
- IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
- IDialogSettings section = workbenchSettings
- .getSection("PreferencesExportWizard");//$NON-NLS-1$
- if (section == null) {
+ /**
+ * Creates a wizard for exporting workspace preferences to the local file
+ * system.
+ */
+ public PreferencesExportWizard() {
+ IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
+ IDialogSettings section = workbenchSettings.getSection("PreferencesExportWizard");//$NON-NLS-1$
+ if (section == null) {
section = workbenchSettings.addNewSection("PreferencesExportWizard");//$NON-NLS-1$
}
- setDialogSettings(section);
- }
+ setDialogSettings(section);
+ }
- @Override
+ @Override
public void addPages() {
- super.addPages();
- mainPage = new WizardPreferencesExportPage1();
- addPage(mainPage);
- }
+ super.addPages();
+ mainPage = new WizardPreferencesExportPage1();
+ addPage(mainPage);
+ }
- @Override
+ @Override
public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
eventBroker = workbench.getService(IEventBroker.class);
- setWindowTitle(PreferencesMessages.PreferencesExportWizard_export);
- setDefaultPageImageDescriptor(WorkbenchImages
- .getImageDescriptor(IWorkbenchGraphicConstants.IMG_WIZBAN_EXPORT_PREF_WIZ));
- setNeedsProgressMonitor(true);
- }
+ setWindowTitle(PreferencesMessages.PreferencesExportWizard_export);
+ setDefaultPageImageDescriptor(
+ WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_WIZBAN_EXPORT_PREF_WIZ));
+ setNeedsProgressMonitor(true);
+ }
- @Override
+ @Override
public boolean performFinish() {
sendEvent(EVENT_EXPORT_BEGIN);
boolean success = mainPage.finish();
sendEvent(EVENT_EXPORT_END);
return success;
- }
+ }
private void sendEvent(String topic) {
if (eventBroker != null) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/PreferencesImportWizard.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/PreferencesImportWizard.java
index 760db056aaf..c7870b8f4a5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/PreferencesImportWizard.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/PreferencesImportWizard.java
@@ -29,26 +29,26 @@ import org.eclipse.ui.internal.IWorkbenchGraphicConstants;
import org.eclipse.ui.internal.WorkbenchImages;
import org.eclipse.ui.internal.WorkbenchPlugin;
-
/**
* Standard workbench wizard for importing resources from the local file system
* into the workspace.
* <p>
- * This class may be instantiated and used without further configuration;
- * this class is not intended to be subclassed.
+ * This class may be instantiated and used without further configuration; this
+ * class is not intended to be subclassed.
* </p>
* <p>
* Example:
+ *
* <pre>
* IWizard wizard = new PreferencesImportWizard();
* wizard.init(workbench, selection);
* WizardDialog dialog = new WizardDialog(shell, wizard);
* dialog.open();
* </pre>
+ *
* During the call to <code>open</code>, the wizard dialog is presented to the
- * user. When the user hits Finish, the user-selected files are imported
- * into the workspace, the dialog closes, and the call to <code>open</code>
- * returns.
+ * user. When the user hits Finish, the user-selected files are imported into
+ * the workspace, the dialog closes, and the call to <code>open</code> returns.
* </p>
*
* @since 3.1
@@ -58,54 +58,52 @@ public class PreferencesImportWizard extends Wizard implements IImportWizard {
public static final String EVENT_IMPORT_END = "org/eclipse/ui/internal/wizards/preferences/import/end"; //$NON-NLS-1$
- private WizardPreferencesImportPage1 mainPage;
+ private WizardPreferencesImportPage1 mainPage;
private IEventBroker eventBroker;
- /**
- * Creates a wizard for importing resources into the workspace from
- * the file system.
- */
- public PreferencesImportWizard() {
- IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
- IDialogSettings section = workbenchSettings
- .getSection("PreferencesImportWizard");//$NON-NLS-1$
- if (section == null) {
+ /**
+ * Creates a wizard for importing resources into the workspace from the file
+ * system.
+ */
+ public PreferencesImportWizard() {
+ IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
+ IDialogSettings section = workbenchSettings.getSection("PreferencesImportWizard");//$NON-NLS-1$
+ if (section == null) {
section = workbenchSettings.addNewSection("PreferencesImportWizard");//$NON-NLS-1$
}
- setDialogSettings(section);
- }
+ setDialogSettings(section);
+ }
- @Override
+ @Override
public void addPages() {
- super.addPages();
- mainPage = new WizardPreferencesImportPage1();
- addPage(mainPage);
- }
+ super.addPages();
+ mainPage = new WizardPreferencesImportPage1();
+ addPage(mainPage);
+ }
- @Override
+ @Override
public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
eventBroker = workbench.getService(IEventBroker.class);
- setWindowTitle(PreferencesMessages.PreferencesImportWizard_import);
- setDefaultPageImageDescriptor(WorkbenchImages
- .getImageDescriptor(IWorkbenchGraphicConstants.IMG_WIZBAN_IMPORT_PREF_WIZ));
- setNeedsProgressMonitor(true);
- }
+ setWindowTitle(PreferencesMessages.PreferencesImportWizard_import);
+ setDefaultPageImageDescriptor(
+ WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_WIZBAN_IMPORT_PREF_WIZ));
+ setNeedsProgressMonitor(true);
+ }
- @Override
+ @Override
public boolean performFinish() {
- boolean success = mainPage.finish();
- sendEvent(EVENT_IMPORT_END);
- showRestartDialog();
- return success;
- }
+ boolean success = mainPage.finish();
+ sendEvent(EVENT_IMPORT_END);
+ showRestartDialog();
+ return success;
+ }
private void showRestartDialog() {
if (0 == MessageDialog.open(MessageDialog.CONFIRM, mainPage.getShell(),
PreferencesMessages.WizardPreferencesImportRestartDialog_title,
PreferencesMessages.WizardPreferencesImportRestartDialog_message, SWT.NONE,
- PreferencesMessages.WizardPreferencesImportRestartDialog_restart,
- IDialogConstants.CANCEL_LABEL)) {
+ PreferencesMessages.WizardPreferencesImportRestartDialog_restart, IDialogConstants.CANCEL_LABEL)) {
Display.getDefault().asyncExec(() -> {
PlatformUI.getWorkbench().restart();
});
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/PreferencesMessages.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/PreferencesMessages.java
index 2a9e1b6a18a..40e5041be2d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/PreferencesMessages.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/PreferencesMessages.java
@@ -16,10 +16,9 @@ package org.eclipse.ui.internal.wizards.preferences;
import org.eclipse.osgi.util.NLS;
-
/**
* NLS messages class for preferences messages.
-
+ *
* @since 3.1
*
*/
@@ -62,7 +61,6 @@ public class PreferencesMessages extends NLS {
public static String SelectionDialog_selectLabel;
public static String SelectionDialog_deselectLabel;
-
public static String WizardDataTransfer_existsQuestion;
public static String WizardDataTransfer_overwriteNameAndPathQuestion;
public static String Question;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/WizardPreferencesExportPage1.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/WizardPreferencesExportPage1.java
index 59bf2490047..4a57e330a9d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/WizardPreferencesExportPage1.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/WizardPreferencesExportPage1.java
@@ -34,7 +34,7 @@ import org.eclipse.ui.internal.preferences.PreferenceTransferElement;
*
* @since 3.1
*/
-public class WizardPreferencesExportPage1 extends WizardPreferencesPage {
+public class WizardPreferencesExportPage1 extends WizardPreferencesPage {
// constants
private static final String PREFERENCESEXPORTPAGE1 = "preferencesExportPage1"; // //$NON-NLS-1$
@@ -56,8 +56,8 @@ public class WizardPreferencesExportPage1 extends WizardPreferencesPage {
}
protected String getOutputSuffix() {
- return ".epf"; //$NON-NLS-1$
- }
+ return ".epf"; //$NON-NLS-1$
+ }
/**
* Answer the contents of self's destination specification widget
@@ -67,29 +67,27 @@ public class WizardPreferencesExportPage1 extends WizardPreferencesPage {
@Override
protected String getDestinationValue() {
String idealSuffix = getOutputSuffix();
- String destinationText = super.getDestinationValue();
-
- // only append a suffix if the destination doesn't already have a . in
- // its last path segment.
- // Also prevent the user from selecting a directory. Allowing this will
- // create a ".epf" file in the directory
- if (destinationText.length() != 0
- && !destinationText.endsWith(File.separator)) {
- int dotIndex = destinationText.lastIndexOf('.');
- if (dotIndex != -1) {
+ String destinationText = super.getDestinationValue();
+
+ // only append a suffix if the destination doesn't already have a . in
+ // its last path segment.
+ // Also prevent the user from selecting a directory. Allowing this will
+ // create a ".epf" file in the directory
+ if (destinationText.length() != 0 && !destinationText.endsWith(File.separator)) {
+ int dotIndex = destinationText.lastIndexOf('.');
+ if (dotIndex != -1) {
// the last path separator index
- int pathSepIndex = destinationText.lastIndexOf(File.separator);
- if (pathSepIndex != -1 && dotIndex < pathSepIndex) {
- destinationText += idealSuffix;
- }
- } else {
- destinationText += idealSuffix;
- }
- }
-
- return destinationText;
- }
+ int pathSepIndex = destinationText.lastIndexOf(File.separator);
+ if (pathSepIndex != -1 && dotIndex < pathSepIndex) {
+ destinationText += idealSuffix;
+ }
+ } else {
+ destinationText += idealSuffix;
+ }
+ }
+ return destinationText;
+ }
@Override
protected String getAllButtonText() {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/WizardPreferencesImportPage1.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/WizardPreferencesImportPage1.java
index bd673304f09..dcec42a35d4 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/WizardPreferencesImportPage1.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/WizardPreferencesImportPage1.java
@@ -37,188 +37,182 @@ import org.eclipse.ui.internal.preferences.PreferenceTransferElement;
*/
public class WizardPreferencesImportPage1 extends WizardPreferencesPage {
- /**
- * Create a new instance of the receiver with name pageName.
- * @param pageName
- */
- protected WizardPreferencesImportPage1(String pageName) {
- super(pageName);
- setTitle(PreferencesMessages.WizardPreferencesImportPage1_importTitle);
- setDescription(PreferencesMessages.WizardPreferencesImportPage1_importDescription);
- }
-
- /**
- * Create an instance of this class
- */
- public WizardPreferencesImportPage1() {
- this("preferencesImportPage1");//$NON-NLS-1$
- }
-
- @Override
+ /**
+ * Create a new instance of the receiver with name pageName.
+ *
+ * @param pageName
+ */
+ protected WizardPreferencesImportPage1(String pageName) {
+ super(pageName);
+ setTitle(PreferencesMessages.WizardPreferencesImportPage1_importTitle);
+ setDescription(PreferencesMessages.WizardPreferencesImportPage1_importDescription);
+ }
+
+ /**
+ * Create an instance of this class
+ */
+ public WizardPreferencesImportPage1() {
+ this("preferencesImportPage1");//$NON-NLS-1$
+ }
+
+ @Override
protected String getAllButtonText() {
- return PreferencesMessages.WizardPreferencesImportPage1_all;
- }
+ return PreferencesMessages.WizardPreferencesImportPage1_all;
+ }
- @Override
+ @Override
protected String getChooseButtonText() {
- return PreferencesMessages.WizardPreferencesImportPage1_choose;
- }
-
+ return PreferencesMessages.WizardPreferencesImportPage1_choose;
+ }
- @Override
+ @Override
protected PreferenceTransferElement[] getTransfers() {
- if (validFromFile()) {
- FileInputStream fis;
-
- try {
- fis = new FileInputStream(getDestinationValue());
- } catch (FileNotFoundException e) {
- WorkbenchPlugin.log(e.getMessage(), e);
- return new PreferenceTransferElement[0];
- }
- IPreferencesService service = Platform.getPreferencesService();
- try {
- IExportedPreferences prefs;
- prefs = service.readPreferences(fis);
- PreferenceTransferElement[] transfers = super.getTransfers();
- IPreferenceFilter[] filters = new IPreferenceFilter[transfers.length];
- for (int i = 0; i < transfers.length; i++) {
- PreferenceTransferElement transfer = transfers[i];
- filters[i] = transfer.getFilter();
- }
- IPreferenceFilter[] matches = service.matches(prefs, filters);
- PreferenceTransferElement[] returnTransfers = new PreferenceTransferElement[matches.length];
- int index = 0;
- for (IPreferenceFilter filter : matches) {
- for (PreferenceTransferElement element : transfers) {
- if (element.getFilter().equals(filter)) {
+ if (validFromFile()) {
+ FileInputStream fis;
+
+ try {
+ fis = new FileInputStream(getDestinationValue());
+ } catch (FileNotFoundException e) {
+ WorkbenchPlugin.log(e.getMessage(), e);
+ return new PreferenceTransferElement[0];
+ }
+ IPreferencesService service = Platform.getPreferencesService();
+ try {
+ IExportedPreferences prefs;
+ prefs = service.readPreferences(fis);
+ PreferenceTransferElement[] transfers = super.getTransfers();
+ IPreferenceFilter[] filters = new IPreferenceFilter[transfers.length];
+ for (int i = 0; i < transfers.length; i++) {
+ PreferenceTransferElement transfer = transfers[i];
+ filters[i] = transfer.getFilter();
+ }
+ IPreferenceFilter[] matches = service.matches(prefs, filters);
+ PreferenceTransferElement[] returnTransfers = new PreferenceTransferElement[matches.length];
+ int index = 0;
+ for (IPreferenceFilter filter : matches) {
+ for (PreferenceTransferElement element : transfers) {
+ if (element.getFilter().equals(filter)) {
returnTransfers[index++] = element;
}
- }
- }
-
- PreferenceTransferElement[] destTransfers = new PreferenceTransferElement[index];
- System.arraycopy(returnTransfers, 0, destTransfers, 0, index);
- return destTransfers;
- } catch (CoreException e) {
- //Do not log core exceptions, they indicate the chosen file is not valid
- //WorkbenchPlugin.log(e.getMessage(), e);
- } finally {
- try {
- fis.close();
- } catch (IOException e) {
- WorkbenchPlugin.log(e.getMessage(), e);
- }
- }
- }
-
- return new PreferenceTransferElement[0];
- }
-
- /**
- * Return whether or not the file is valid.
- * @return <code>true</code> of the file is an existing
- * file and not a directory
- */
- private boolean validFromFile() {
- File fromFile = new File(getDestinationValue());
- return fromFile.exists() && !fromFile.isDirectory();
- }
-
- @Override
+ }
+ }
+
+ PreferenceTransferElement[] destTransfers = new PreferenceTransferElement[index];
+ System.arraycopy(returnTransfers, 0, destTransfers, 0, index);
+ return destTransfers;
+ } catch (CoreException e) {
+ // Do not log core exceptions, they indicate the chosen file is not valid
+ // WorkbenchPlugin.log(e.getMessage(), e);
+ } finally {
+ try {
+ fis.close();
+ } catch (IOException e) {
+ WorkbenchPlugin.log(e.getMessage(), e);
+ }
+ }
+ }
+
+ return new PreferenceTransferElement[0];
+ }
+
+ /**
+ * Return whether or not the file is valid.
+ *
+ * @return <code>true</code> of the file is an existing file and not a directory
+ */
+ private boolean validFromFile() {
+ File fromFile = new File(getDestinationValue());
+ return fromFile.exists() && !fromFile.isDirectory();
+ }
+
+ @Override
protected void setPreferenceTransfers() {
- super.setPreferenceTransfers();
+ super.setPreferenceTransfers();
- if (validFromFile()
- && (transfersTree.getViewer().getTree().getItemCount() == 0)) {
- descText
- .setText(PreferencesMessages.WizardPreferences_noSpecificPreferenceDescription);
+ if (validFromFile() && (transfersTree.getViewer().getTree().getItemCount() == 0)) {
+ descText.setText(PreferencesMessages.WizardPreferences_noSpecificPreferenceDescription);
} else {
descText.setText(""); //$NON-NLS-1$
}
}
- @Override
+ @Override
protected void createTransferArea(Composite composite) {
- createDestinationGroup(composite);
- createTransfersList(composite);
- }
-
- /**
- * Answer the string to display in self as the destination type
- *
- * @return java.lang.String
- */
- @Override
+ createDestinationGroup(composite);
+ createTransfersList(composite);
+ }
+
+ /**
+ * Answer the string to display in self as the destination type
+ *
+ * @return java.lang.String
+ */
+ @Override
protected String getDestinationLabel() {
- return PreferencesMessages.WizardPreferencesImportPage1_file;
- }
-
- /**
- * @param filters
- * @return <code>true</code> if the transfer was succesful, and
- * <code>false</code> otherwise
- */
- @Override
+ return PreferencesMessages.WizardPreferencesImportPage1_file;
+ }
+
+ /**
+ * @param filters
+ * @return <code>true</code> if the transfer was succesful, and
+ * <code>false</code> otherwise
+ */
+ @Override
protected boolean transfer(IPreferenceFilter[] filters) {
- File importFile = new File(getDestinationValue());
- FileInputStream fis = null;
- try {
- if (filters.length > 0) {
- try {
- fis = new FileInputStream(importFile);
- } catch (FileNotFoundException e) {
- WorkbenchPlugin.log(e.getMessage(), e);
+ File importFile = new File(getDestinationValue());
+ FileInputStream fis = null;
+ try {
+ if (filters.length > 0) {
+ try {
+ fis = new FileInputStream(importFile);
+ } catch (FileNotFoundException e) {
+ WorkbenchPlugin.log(e.getMessage(), e);
MessageDialog.open(MessageDialog.ERROR, getControl().getShell(), "", //$NON-NLS-1$
- e.getLocalizedMessage(),
- SWT.SHEET);
- return false;
- }
- IPreferencesService service = Platform.getPreferencesService();
- try {
- IExportedPreferences prefs = service.readPreferences(fis);
-
- service.applyPreferences(prefs, filters);
- } catch (CoreException e) {
- WorkbenchPlugin.log(e.getMessage(), e);
- MessageDialog.open(MessageDialog.ERROR, getControl()
- .getShell(), "", e.getLocalizedMessage(), //$NON-NLS-1$
+ e.getLocalizedMessage(), SWT.SHEET);
+ return false;
+ }
+ IPreferencesService service = Platform.getPreferencesService();
+ try {
+ IExportedPreferences prefs = service.readPreferences(fis);
+
+ service.applyPreferences(prefs, filters);
+ } catch (CoreException e) {
+ WorkbenchPlugin.log(e.getMessage(), e);
+ MessageDialog.open(MessageDialog.ERROR, getControl().getShell(), "", e.getLocalizedMessage(), //$NON-NLS-1$
SWT.SHEET);
- return false;
- }
- }
- } finally {
- if (fis != null) {
+ return false;
+ }
+ }
+ } finally {
+ if (fis != null) {
try {
- fis.close();
- } catch (IOException e) {
- WorkbenchPlugin.log(e.getMessage(), e);
- MessageDialog.open(MessageDialog.ERROR, getControl()
- .getShell(), "", e.getLocalizedMessage(), //$NON-NLS-1$
+ fis.close();
+ } catch (IOException e) {
+ WorkbenchPlugin.log(e.getMessage(), e);
+ MessageDialog.open(MessageDialog.ERROR, getControl().getShell(), "", e.getLocalizedMessage(), //$NON-NLS-1$
SWT.SHEET);
- }
+ }
}
- }
- return true;
- }
-
- /**
- * Handle events and enablements for widgets in this page
- *
- * @param e
- * Event
- */
- @Override
+ }
+ return true;
+ }
+
+ /**
+ * Handle events and enablements for widgets in this page
+ *
+ * @param e Event
+ */
+ @Override
public void handleEvent(Event e) {
- if (e.widget == destinationNameField) {
+ if (e.widget == destinationNameField) {
setPreferenceTransfers();
}
- super.handleEvent(e);
- }
+ super.handleEvent(e);
+ }
- @Override
- protected String getFileDialogTitle(){
+ @Override
+ protected String getFileDialogTitle() {
return PreferencesMessages.WizardPreferencesImportPage1_title;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/WizardPreferencesPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/WizardPreferencesPage.java
index 95fc4c452d9..6c1b8e099c4 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/WizardPreferencesPage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/wizards/preferences/WizardPreferencesPage.java
@@ -65,8 +65,7 @@ import org.eclipse.ui.model.WorkbenchLabelProvider;
*
* @since 3.1
*/
-public abstract class WizardPreferencesPage extends WizardPage implements
- Listener, IOverwriteQuery {
+public abstract class WizardPreferencesPage extends WizardPage implements Listener, IOverwriteQuery {
// widgets
protected Combo destinationNameField;
@@ -108,7 +107,6 @@ public abstract class WizardPreferencesPage extends WizardPage implements
protected static final int COMBO_HISTORY_LENGTH = 5;
-
/**
* @param pageName
*/
@@ -119,27 +117,23 @@ public abstract class WizardPreferencesPage extends WizardPage implements
/**
* Creates a new button with the given id.
* <p>
- * The <code>Dialog</code> implementation of this framework method creates
- * a standard push button, registers for selection events including button
- * presses and registers default buttons with its shell. The button id is
- * stored as the buttons client data. Note that the parent's layout is
- * assumed to be a GridLayout and the number of columns in this layout is
- * incremented. Subclasses may override.
+ * The <code>Dialog</code> implementation of this framework method creates a
+ * standard push button, registers for selection events including button presses
+ * and registers default buttons with its shell. The button id is stored as the
+ * buttons client data. Note that the parent's layout is assumed to be a
+ * GridLayout and the number of columns in this layout is incremented.
+ * Subclasses may override.
* </p>
*
- * @param parent
- * the parent composite
- * @param id
- * the id of the button (see <code>IDialogConstants.*_ID</code>
- * constants for standard dialog button ids)
- * @param label
- * the label from the button
- * @param defaultButton
- * <code>true</code> if the button is to be the default button,
- * and <code>false</code> otherwise
- */
- protected Button createButton(Composite parent, int id, String label,
- boolean defaultButton) {
+ * @param parent the parent composite
+ * @param id the id of the button (see
+ * <code>IDialogConstants.*_ID</code> constants for
+ * standard dialog button ids)
+ * @param label the label from the button
+ * @param defaultButton <code>true</code> if the button is to be the default
+ * button, and <code>false</code> otherwise
+ */
+ protected Button createButton(Composite parent, int id, String label, boolean defaultButton) {
// increment the number of columns in the button bar
((GridLayout) parent.getLayout()).numColumns++;
@@ -164,8 +158,7 @@ public abstract class WizardPreferencesPage extends WizardPage implements
/**
* Add the passed value to self's destination widget's history
*
- * @param value
- * java.lang.String
+ * @param value java.lang.String
*/
protected void addDestinationItem(String value) {
destinationNameField.add(value);
@@ -176,9 +169,7 @@ public abstract class WizardPreferencesPage extends WizardPage implements
initializeDialogUnits(parent);
Composite composite = new Composite(parent, SWT.NULL);
composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL
- | GridData.HORIZONTAL_ALIGN_FILL));
-
+ composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
createTransferArea(composite);
setPreferenceTransfers();
@@ -205,8 +196,9 @@ public abstract class WizardPreferencesPage extends WizardPage implements
/**
* Validate the destination group.
- * @return <code>true</code> if the group is valid. If
- * not set the error message and return <code>false</code>.
+ *
+ * @return <code>true</code> if the group is valid. If not set the error message
+ * and return <code>false</code>.
*/
protected boolean validateDestinationGroup() {
if (!validDestination()) {
@@ -219,6 +211,7 @@ public abstract class WizardPreferencesPage extends WizardPage implements
/**
* Return the message that indicates an invalid destination.
+ *
* @return String
*/
abstract protected String getInvalidDestinationMessage();
@@ -281,8 +274,7 @@ public abstract class WizardPreferencesPage extends WizardPage implements
description.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
description.setText(PreferencesMessages.WizardPreferences_description);
- descText = new Text(group, SWT.V_SCROLL | SWT.READ_ONLY
- | SWT.BORDER | SWT.WRAP);
+ descText = new Text(group, SWT.V_SCROLL | SWT.READ_ONLY | SWT.BORDER | SWT.WRAP);
GridData descriptionData = new GridData(GridData.FILL_BOTH);
descriptionData.heightHint = convertHeightInCharsToPixels(3);
descText.setLayoutData(descriptionData);
@@ -321,8 +313,7 @@ public abstract class WizardPreferencesPage extends WizardPage implements
private FilteredTree createFilteredTree(Group group) {
int style = SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER;
- FilteredTree transfersTree = new FilteredTree(group, style,
- new PatternFilter(), true) {
+ FilteredTree transfersTree = new FilteredTree(group, style, new PatternFilter(), true) {
@Override
protected TreeViewer doCreateTreeViewer(Composite parent, int style) {
return new CheckboxTreeViewer(parent, style);
@@ -338,8 +329,7 @@ public abstract class WizardPreferencesPage extends WizardPage implements
/**
* Add the selection and deselection buttons to the composite.
*
- * @param composite
- * org.eclipse.swt.widgets.Composite
+ * @param composite org.eclipse.swt.widgets.Composite
*/
private void addSelectionButtons(Composite composite) {
Font parentFont = composite.getFont();
@@ -387,8 +377,7 @@ public abstract class WizardPreferencesPage extends WizardPage implements
/**
* Create the export destination specification widgets
*
- * @param parent
- * org.eclipse.swt.widgets.Composite
+ * @param parent org.eclipse.swt.widgets.Composite
*/
protected void createDestinationGroup(Composite parent) {
// destination specification group
@@ -396,26 +385,22 @@ public abstract class WizardPreferencesPage extends WizardPage implements
GridLayout layout = new GridLayout();
layout.numColumns = 3;
destinationSelectionGroup.setLayout(layout);
- destinationSelectionGroup.setLayoutData(new GridData(
- GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
+ destinationSelectionGroup
+ .setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
Label dest = new Label(destinationSelectionGroup, SWT.NONE);
dest.setText(getDestinationLabel());
// destination name entry field
- destinationNameField = new Combo(destinationSelectionGroup, SWT.SINGLE
- | SWT.BORDER);
+ destinationNameField = new Combo(destinationSelectionGroup, SWT.SINGLE | SWT.BORDER);
destinationNameField.addListener(SWT.Modify, this);
destinationNameField.addListener(SWT.Selection, this);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL
- | GridData.GRAB_HORIZONTAL);
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
destinationNameField.setLayoutData(data);
// destination browse button
- destinationBrowseButton = new Button(destinationSelectionGroup,
- SWT.PUSH);
- destinationBrowseButton
- .setText(PreferencesMessages.PreferencesExport_browse);
+ destinationBrowseButton = new Button(destinationSelectionGroup, SWT.PUSH);
+ destinationBrowseButton.setText(PreferencesMessages.PreferencesExport_browse);
setButtonLayoutData(destinationBrowseButton);
destinationBrowseButton.addListener(SWT.Selection, this);
@@ -425,8 +410,7 @@ public abstract class WizardPreferencesPage extends WizardPage implements
/**
* Create the export options specification widgets.
*
- * @param parent
- * org.eclipse.swt.widgets.Composite
+ * @param parent org.eclipse.swt.widgets.Composite
*/
protected void createOptionsGroup(Composite parent) {
// options group
@@ -435,14 +419,11 @@ public abstract class WizardPreferencesPage extends WizardPage implements
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
optionsGroup.setLayout(layout);
- optionsGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
- | GridData.GRAB_HORIZONTAL));
+ optionsGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
// overwrite... checkbox
- overwriteExistingFilesCheckbox = new Button(optionsGroup, SWT.CHECK
- | SWT.LEFT);
- overwriteExistingFilesCheckbox
- .setText(PreferencesMessages.ExportFile_overwriteExisting);
+ overwriteExistingFilesCheckbox = new Button(optionsGroup, SWT.CHECK | SWT.LEFT);
+ overwriteExistingFilesCheckbox.setText(PreferencesMessages.ExportFile_overwriteExisting);
}
@@ -451,8 +432,7 @@ public abstract class WizardPreferencesPage extends WizardPage implements
* system. Answers a boolean indicating success.
*
* @return boolean
- * @param directory
- * java.io.File
+ * @param directory java.io.File
*/
protected boolean ensureDirectoryExists(File directory) {
if (!directory.exists()) {
@@ -461,13 +441,9 @@ public abstract class WizardPreferencesPage extends WizardPage implements
}
if (!directory.mkdirs()) {
- MessageDialog
- .open(
- MessageDialog.ERROR,
- getContainer().getShell(),
- PreferencesMessages.PreferencesExport_error,
- PreferencesMessages.PreferencesExport_directoryCreationError,
- SWT.SHEET);
+ MessageDialog.open(MessageDialog.ERROR, getContainer().getShell(),
+ PreferencesMessages.PreferencesExport_error,
+ PreferencesMessages.PreferencesExport_directoryCreationError, SWT.SHEET);
return false;
}
}
@@ -475,17 +451,15 @@ public abstract class WizardPreferencesPage extends WizardPage implements
}
/**
- * Displays a Yes/No question to the user with the specified message and
- * returns the user's response.
+ * Displays a Yes/No question to the user with the specified message and returns
+ * the user's response.
*
- * @param message
- * the question to ask
+ * @param message the question to ask
* @return <code>true</code> for Yes, and <code>false</code> for No
*/
protected boolean queryYesNoQuestion(String message) {
- MessageDialog dialog = new MessageDialog(getContainer().getShell(),
- PreferencesMessages.Question, (Image) null, message,
- MessageDialog.NONE, 0, IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL) {
+ MessageDialog dialog = new MessageDialog(getContainer().getShell(), PreferencesMessages.Question, (Image) null,
+ message, MessageDialog.NONE, 0, IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL) {
@Override
protected int getShellStyle() {
return super.getShellStyle() | SWT.SHEET;
@@ -497,19 +471,17 @@ public abstract class WizardPreferencesPage extends WizardPage implements
}
/**
- * If the target for export does not exist then attempt to create it. Answer
- * a boolean indicating whether the target exists (ie.- if it either
- * pre-existed or this method was able to create it)
+ * If the target for export does not exist then attempt to create it. Answer a
+ * boolean indicating whether the target exists (ie.- if it either pre-existed
+ * or this method was able to create it)
*
* @return boolean
*/
protected boolean ensureTargetIsValid(File file) {
if (file.exists()) {
if (!getOverwriteExisting()) {
- String msg = NLS
- .bind(
- PreferencesMessages.WizardPreferencesExportPage1_overwrite,
- file.getAbsolutePath());
+ String msg = NLS.bind(PreferencesMessages.WizardPreferencesExportPage1_overwrite,
+ file.getAbsolutePath());
if (!queryYesNoQuestion(msg)) {
return false;
}
@@ -528,8 +500,7 @@ public abstract class WizardPreferencesPage extends WizardPage implements
IDialogSettings settings = getDialogSettings();
if (settings != null) {
- String[] directoryNames = settings
- .getArray(STORE_DESTINATION_NAMES_ID);
+ String[] directoryNames = settings.getArray(STORE_DESTINATION_NAMES_ID);
if (directoryNames == null) {
directoryNames = new String[0];
}
@@ -542,8 +513,7 @@ public abstract class WizardPreferencesPage extends WizardPage implements
}
// options
if (overwriteExistingFilesCheckbox != null) {
- settings.put(STORE_OVERWRITE_EXISTING_FILES_ID,
- overwriteExistingFilesCheckbox.getSelection());
+ settings.put(STORE_OVERWRITE_EXISTING_FILES_ID, overwriteExistingFilesCheckbox.getSelection());
}
if (shouldSaveTransferAll()) {
@@ -565,9 +535,9 @@ public abstract class WizardPreferencesPage extends WizardPage implements
}
/**
- * The Finish button was pressed. Try to do the required work now and answer
- * a boolean indicating success. If false is returned then the wizard will
- * not close.
+ * The Finish button was pressed. Try to do the required work now and answer a
+ * boolean indicating success. If false is returned then the wizard will not
+ * close.
*
* @return boolean
*/
@@ -587,8 +557,7 @@ public abstract class WizardPreferencesPage extends WizardPage implements
@Override
public String[] getScopes() {
- return new String[] { InstanceScope.SCOPE,
- ConfigurationScope.SCOPE };
+ return new String[] { InstanceScope.SCOPE, ConfigurationScope.SCOPE };
}
@Override
@@ -639,8 +608,7 @@ public abstract class WizardPreferencesPage extends WizardPage implements
protected PreferenceTransferElement[] getPreferenceTransferElements() {
Object[] checkedElements = viewer.getCheckedElements();
PreferenceTransferElement[] transferElements = new PreferenceTransferElement[checkedElements.length];
- System.arraycopy(checkedElements, 0, transferElements, 0,
- checkedElements.length);
+ System.arraycopy(checkedElements, 0, transferElements, 0, checkedElements.length);
return transferElements;
}
@@ -665,22 +633,21 @@ public abstract class WizardPreferencesPage extends WizardPage implements
}
/**
- * Returns whether this page is complete. This determination is made based
- * upon the current contents of this page's controls. Subclasses wishing to
- * include their controls in this determination should override the hook
- * methods <code>validateSourceGroup</code> and/or
- * <code>validateOptionsGroup</code>.
+ * Returns whether this page is complete. This determination is made based upon
+ * the current contents of this page's controls. Subclasses wishing to include
+ * their controls in this determination should override the hook methods
+ * <code>validateSourceGroup</code> and/or <code>validateOptionsGroup</code>.
*
- * @return <code>true</code> if this page is complete, and
- * <code>false</code> if incomplete
+ * @return <code>true</code> if this page is complete, and <code>false</code> if
+ * incomplete
* @see #validateSourceGroup
* @see #validateOptionsGroup
*/
protected boolean determinePageCompletion() {
- // validate groups in order of priority so error message is the most important one
- boolean complete = validateSourceGroup() && validateDestinationGroup()
- && validateOptionsGroup();
+ // validate groups in order of priority so error message is the most important
+ // one
+ boolean complete = validateSourceGroup() && validateDestinationGroup() && validateOptionsGroup();
// Avoid draw flicker by not clearing the error
// message unless all is valid.
@@ -694,17 +661,17 @@ public abstract class WizardPreferencesPage extends WizardPage implements
}
/**
- * Returns whether this page's options group's controls currently all
- * contain valid values.
+ * Returns whether this page's options group's controls currently all contain
+ * valid values.
* <p>
- * The <code>WizardPreferencesPage</code> implementation of this method
- * returns <code>true</code> if the button to transfer all preferences is
- * selected OR at least one of the individual items are checked. Subclasses
- * may reimplement this method.
+ * The <code>WizardPreferencesPage</code> implementation of this method returns
+ * <code>true</code> if the button to transfer all preferences is selected OR at
+ * least one of the individual items are checked. Subclasses may reimplement
+ * this method.
* </p>
*
- * @return <code>true</code> indicating validity of all controls in the
- * options group
+ * @return <code>true</code> indicating validity of all controls in the options
+ * group
*/
protected boolean validateOptionsGroup() {
boolean isValid = true;
@@ -722,13 +689,12 @@ public abstract class WizardPreferencesPage extends WizardPage implements
* Returns whether this page's source specification controls currently all
* contain valid values.
* <p>
- * The <code>WizardDataTransferPage</code> implementation of this method
- * returns <code>true</code>. Subclasses may reimplement this hook
- * method.
+ * The <code>WizardDataTransferPage</code> implementation of this method returns
+ * <code>true</code>. Subclasses may reimplement this hook method.
* </p>
*
- * @return <code>true</code> indicating validity of all controls in the
- * source specification group
+ * @return <code>true</code> indicating validity of all controls in the source
+ * specification group
*/
protected boolean validateSourceGroup() {
return true;
@@ -758,15 +724,14 @@ public abstract class WizardPreferencesPage extends WizardPage implements
}
/**
- * Open an appropriate destination browser so that the user can specify a
- * source to import from
+ * Open an appropriate destination browser so that the user can specify a source
+ * to import from
*/
protected void handleDestinationBrowseButtonPressed() {
- FileDialog dialog = new FileDialog(getContainer().getShell(),
- getFileDialogStyle());
+ FileDialog dialog = new FileDialog(getContainer().getShell(), getFileDialogStyle());
dialog.setText(getFileDialogTitle());
dialog.setFilterPath(getDestinationValue());
- dialog.setFilterExtensions(new String[] { "*.epf" ,"*.*"}); //$NON-NLS-1$ //$NON-NLS-2$
+ dialog.setFilterExtensions(new String[] { "*.epf", "*.*" }); //$NON-NLS-1$ //$NON-NLS-2$
String selectedFileName = dialog.open();
if (selectedFileName != null) {
@@ -781,8 +746,7 @@ public abstract class WizardPreferencesPage extends WizardPage implements
/**
* Handle all events and enablements for widgets in this page
*
- * @param e
- * Event
+ * @param e Event
*/
@Override
public void handleEvent(Event e) {
@@ -807,39 +771,39 @@ public abstract class WizardPreferencesPage extends WizardPage implements
}
/**
- * Adds an entry to a history, while taking care of duplicate history items
- * and excessively long histories. The assumption is made that all histories
- * should be of length <code>WizardDataTransferPage.COMBO_HISTORY_LENGTH</code>.
- *
- * @param history the current history
- * @param newEntry the entry to add to the history
- */
- protected String[] addToHistory(String[] history, String newEntry) {
- java.util.ArrayList l = new java.util.ArrayList(Arrays.asList(history));
- addToHistory(l, newEntry);
- String[] r = new String[l.size()];
- l.toArray(r);
- return r;
- }
-
- /**
- * Adds an entry to a history, while taking care of duplicate history items
- * and excessively long histories. The assumption is made that all histories
- * should be of length <code>WizardDataTransferPage.COMBO_HISTORY_LENGTH</code>.
- *
- * @param history the current history
- * @param newEntry the entry to add to the history
- */
- protected void addToHistory(List history, String newEntry) {
- history.remove(newEntry);
- history.add(0, newEntry);
-
- // since only one new item was added, we can be over the limit
- // by at most one item
- if (history.size() > COMBO_HISTORY_LENGTH) {
+ * Adds an entry to a history, while taking care of duplicate history items and
+ * excessively long histories. The assumption is made that all histories should
+ * be of length <code>WizardDataTransferPage.COMBO_HISTORY_LENGTH</code>.
+ *
+ * @param history the current history
+ * @param newEntry the entry to add to the history
+ */
+ protected String[] addToHistory(String[] history, String newEntry) {
+ java.util.ArrayList l = new java.util.ArrayList(Arrays.asList(history));
+ addToHistory(l, newEntry);
+ String[] r = new String[l.size()];
+ l.toArray(r);
+ return r;
+ }
+
+ /**
+ * Adds an entry to a history, while taking care of duplicate history items and
+ * excessively long histories. The assumption is made that all histories should
+ * be of length <code>WizardDataTransferPage.COMBO_HISTORY_LENGTH</code>.
+ *
+ * @param history the current history
+ * @param newEntry the entry to add to the history
+ */
+ protected void addToHistory(List history, String newEntry) {
+ history.remove(newEntry);
+ history.add(0, newEntry);
+
+ // since only one new item was added, we can be over the limit
+ // by at most one item
+ if (history.size() > COMBO_HISTORY_LENGTH) {
history.remove(COMBO_HISTORY_LENGTH);
}
- }
+ }
/**
* Hook method for restoring widget values to the values that they held last
@@ -854,12 +818,10 @@ public abstract class WizardPreferencesPage extends WizardPage implements
if (settings.get(TRANSFER_ALL_PREFERENCES_ID) == null)
transferAll = true;
else
- transferAll = settings
- .getBoolean(TRANSFER_ALL_PREFERENCES_ID);
+ transferAll = settings.getBoolean(TRANSFER_ALL_PREFERENCES_ID);
transferAllButton.setSelection(transferAll);
if (!transferAll) {
- String[] preferenceIds = settings
- .getArray(TRANSFER_PREFERENCES_NAMES_ID);
+ String[] preferenceIds = settings.getArray(TRANSFER_PREFERENCES_NAMES_ID);
if (preferenceIds != null) {
PreferenceTransferElement[] transfers = getTransfers();
for (PreferenceTransferElement transfer : transfers) {
@@ -878,8 +840,7 @@ public abstract class WizardPreferencesPage extends WizardPage implements
updateEnablement();
if (settings != null) {
- String[] directoryNames = settings
- .getArray(STORE_DESTINATION_NAMES_ID);
+ String[] directoryNames = settings.getArray(STORE_DESTINATION_NAMES_ID);
if (directoryNames != null) {
// destination
setDestinationValue(directoryNames[0]);
@@ -893,8 +854,7 @@ public abstract class WizardPreferencesPage extends WizardPage implements
}
// options
if (overwriteExistingFilesCheckbox != null) {
- overwriteExistingFilesCheckbox.setSelection(settings
- .getBoolean(STORE_OVERWRITE_EXISTING_FILES_ID));
+ overwriteExistingFilesCheckbox.setSelection(settings.getBoolean(STORE_OVERWRITE_EXISTING_FILES_ID));
}
}
}
@@ -914,8 +874,7 @@ public abstract class WizardPreferencesPage extends WizardPage implements
* Set the contents of self's destination specification widget to the passed
* value
*
- * @param value
- * java.lang.String
+ * @param value java.lang.String
*/
protected void setDestinationValue(String value) {
destinationNameField.setText(value);
@@ -949,15 +908,10 @@ public abstract class WizardPreferencesPage extends WizardPage implements
// Break the message up if there is a file name and a directory
// and there are at least 2 segments.
if (path.getFileExtension() == null || path.segmentCount() < 2) {
- messageString = NLS.bind(
- PreferencesMessages.WizardDataTransfer_existsQuestion,
- pathString);
+ messageString = NLS.bind(PreferencesMessages.WizardDataTransfer_existsQuestion, pathString);
} else {
- messageString = NLS
- .bind(
- PreferencesMessages.WizardDataTransfer_overwriteNameAndPathQuestion,
- path.lastSegment(), path.removeLastSegments(1)
- .toOSString());
+ messageString = NLS.bind(PreferencesMessages.WizardDataTransfer_overwriteNameAndPathQuestion,
+ path.lastSegment(), path.removeLastSegments(1).toOSString());
}
final MessageDialog dialog = new MessageDialog(getContainer().getShell(), PreferencesMessages.Question, null,
@@ -972,8 +926,7 @@ public abstract class WizardPreferencesPage extends WizardPage implements
// run in syncExec because callback is from an operation,
// which is probably not running in the UI thread.
getControl().getDisplay().syncExec(() -> dialog.open());
- return dialog.getReturnCode() < 0 ? CANCEL : response[dialog
- .getReturnCode()];
+ return dialog.getReturnCode() < 0 ? CANCEL : response[dialog.getReturnCode()];
}
private void updateEnablement() {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/intro/IIntroManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/intro/IIntroManager.java
index 116d1be0cbf..75b691b591b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/intro/IIntroManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/intro/IIntroManager.java
@@ -16,11 +16,11 @@ package org.eclipse.ui.intro;
import org.eclipse.ui.IWorkbenchWindow;
/**
- * Manages the intro part that introduces the product to new users.
- * The intro part is typically shown the first time a product is started up.
+ * Manages the intro part that introduces the product to new users. The intro
+ * part is typically shown the first time a product is started up.
* <p>
- * The initial behavior of the intro part is controlled by the application
- * from via the {@link org.eclipse.ui.application.WorkbenchWindowAdvisor#openIntro()}
+ * The initial behavior of the intro part is controlled by the application from
+ * via the {@link org.eclipse.ui.application.WorkbenchWindowAdvisor#openIntro()}
* method.
* </p>
* <p>
@@ -37,84 +37,83 @@ import org.eclipse.ui.IWorkbenchWindow;
*/
public interface IIntroManager {
- /**
- * Closes the given intro part.
- *
- * @param part the intro part
- * @return <code>true</code> if the intro part was closed, and
- * <code>false</code> otherwise. <code>false</code> is returned
- * if part is <code>null</code> or it is not the intro part returned
- * by {@link #getIntro()}.
- */
- boolean closeIntro(IIntroPart part);
+ /**
+ * Closes the given intro part.
+ *
+ * @param part the intro part
+ * @return <code>true</code> if the intro part was closed, and
+ * <code>false</code> otherwise. <code>false</code> is returned if part
+ * is <code>null</code> or it is not the intro part returned by
+ * {@link #getIntro()}.
+ */
+ boolean closeIntro(IIntroPart part);
- /**
- * Returns the intro part. Returns <code>null</code> if there is no intro
- * part, if it has been previously closed via {@link #closeIntro(IIntroPart)}
- * or if there is an intro part but {@link #showIntro(IWorkbenchWindow, boolean)}
- * has not yet been called to create it.
- *
- * @return the intro part, or <code>null</code> if none is available
- */
- IIntroPart getIntro();
+ /**
+ * Returns the intro part. Returns <code>null</code> if there is no intro part,
+ * if it has been previously closed via {@link #closeIntro(IIntroPart)} or if
+ * there is an intro part but {@link #showIntro(IWorkbenchWindow, boolean)} has
+ * not yet been called to create it.
+ *
+ * @return the intro part, or <code>null</code> if none is available
+ */
+ IIntroPart getIntro();
- /**
- * Return whether an intro is available. Note that this checks whether
- * there is an applicable intro part that could be instantiated and shown
- * to the user.
- * Use {@link #getIntro()} to discover whether an intro part has already
- * been created.
- *
- * @return <code>true</code> if there is an intro that could be shown, and
- * <code>false</code> if there is no intro
- */
- boolean hasIntro();
+ /**
+ * Return whether an intro is available. Note that this checks whether there is
+ * an applicable intro part that could be instantiated and shown to the user.
+ * Use {@link #getIntro()} to discover whether an intro part has already been
+ * created.
+ *
+ * @return <code>true</code> if there is an intro that could be shown, and
+ * <code>false</code> if there is no intro
+ */
+ boolean hasIntro();
- /**
- * Return the standby state of the given intro part.
- *
- * @param part the intro part
- * @return <code>true</code> if the part in its partially
- * visible standy mode, and <code>false</code> if in its fully visible state.
- * <code>false</code> is returned if part is <code>null</code> or it is not
- * the intro part returned by {@link #getIntro()}.
- */
- boolean isIntroStandby(IIntroPart part);
+ /**
+ * Return the standby state of the given intro part.
+ *
+ * @param part the intro part
+ * @return <code>true</code> if the part in its partially visible standy mode,
+ * and <code>false</code> if in its fully visible state.
+ * <code>false</code> is returned if part is <code>null</code> or it is
+ * not the intro part returned by {@link #getIntro()}.
+ */
+ boolean isIntroStandby(IIntroPart part);
- /**
- * Sets the standby state of the given intro part. Intro part usually should
- * render themselves differently in the full and standby modes. In standby
- * mode, the part should be partially visible to the user but otherwise
- * allow them to work. In full mode, the part should be fully visible and
- * be the center of the user's attention.
- * <p>
- * This method does nothing if the part is <code>null</code> or is not
- * the intro part returned by {@link #getIntro()}.
- * </p>
- *
- * @param part the intro part, or <code>null</code>
- * @param standby <code>true</code> to put the part in its partially
- * visible standy mode, and <code>false</code> to make it fully visible.
- */
- void setIntroStandby(IIntroPart part, boolean standby);
+ /**
+ * Sets the standby state of the given intro part. Intro part usually should
+ * render themselves differently in the full and standby modes. In standby mode,
+ * the part should be partially visible to the user but otherwise allow them to
+ * work. In full mode, the part should be fully visible and be the center of the
+ * user's attention.
+ * <p>
+ * This method does nothing if the part is <code>null</code> or is not the intro
+ * part returned by {@link #getIntro()}.
+ * </p>
+ *
+ * @param part the intro part, or <code>null</code>
+ * @param standby <code>true</code> to put the part in its partially visible
+ * standy mode, and <code>false</code> to make it fully visible.
+ */
+ void setIntroStandby(IIntroPart part, boolean standby);
- /**
- * Shows the intro part in the given workbench window. If the intro part has
- * not been created yet, one will be created. If the intro part is currently
- * being shown in some workbench window, that other window is made active.
- *
- * @param preferredWindow the preferred workbench window, or
- * <code>null</code> to indicate the currently active workbench window
- * @param standby <code>true</code> to put the intro part in its partially
- * visible standy mode, and <code>false</code> to make it fully visible
- * @return the newly-created or existing intro part, or <code>null</code>
- * if no intro part is available or if <code>preferredWindow</code> is
- * <code>null</code> and there is no currently active workbench window
- */
- IIntroPart showIntro(IWorkbenchWindow preferredWindow,
- boolean standby);
+ /**
+ * Shows the intro part in the given workbench window. If the intro part has not
+ * been created yet, one will be created. If the intro part is currently being
+ * shown in some workbench window, that other window is made active.
+ *
+ * @param preferredWindow the preferred workbench window, or <code>null</code>
+ * to indicate the currently active workbench window
+ * @param standby <code>true</code> to put the intro part in its
+ * partially visible standy mode, and <code>false</code>
+ * to make it fully visible
+ * @return the newly-created or existing intro part, or <code>null</code> if no
+ * intro part is available or if <code>preferredWindow</code> is
+ * <code>null</code> and there is no currently active workbench window
+ */
+ IIntroPart showIntro(IWorkbenchWindow preferredWindow, boolean standby);
- /**
+ /**
* Returns <code>true</code> if there is an intro content detector and it
* reports that new intro content is available.
*
@@ -122,5 +121,5 @@ public interface IIntroManager {
*
* @since 3.3
*/
- boolean isNewContentAvailable();
+ boolean isNewContentAvailable();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/intro/IIntroPart.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/intro/IIntroPart.java
index 5653e4dbd78..eefc02d0fa2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/intro/IIntroPart.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/intro/IIntroPart.java
@@ -28,10 +28,10 @@ import org.eclipse.ui.PartInitException;
* first time a product is started up.
* <p>
* The intro part implementation is contributed to the workbench via the
- * <code>org.eclipse.ui.intro</code> extension point. There can be several
- * intro part implementations, and associations between intro part
- * implementations and products. The workbench will only make use of the intro
- * part implementation for the current product (as given by
+ * <code>org.eclipse.ui.intro</code> extension point. There can be several intro
+ * part implementations, and associations between intro part implementations and
+ * products. The workbench will only make use of the intro part implementation
+ * for the current product (as given by
* {@link org.eclipse.core.runtime.Platform#getProduct()}. There is at most one
* intro part instance in the entire workbench, and it resides in exactly one
* workbench window at a time.
@@ -42,77 +42,74 @@ import org.eclipse.ui.PartInitException;
* {@link org.eclipse.ui.part.IntroPart}.
* </p>
*
- * @see org.eclipse.ui.intro.IIntroManager#showIntro(org.eclipse.ui.IWorkbenchWindow, boolean)
+ * @see org.eclipse.ui.intro.IIntroManager#showIntro(org.eclipse.ui.IWorkbenchWindow,
+ * boolean)
* @since 3.0
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IIntroPart extends IAdaptable {
- /**
- * The property id for <code>getTitleImage</code> and
- * <code>getTitle</code>.
+ /**
+ * The property id for <code>getTitleImage</code> and <code>getTitle</code>.
*
* @since 3.2 this property now covers changes to <code>getTitle</code> in
* addition to <code>getTitleImage</code>
*/
int PROP_TITLE = IWorkbenchPart.PROP_TITLE;
- /**
+ /**
* Returns the site for this intro part.
*
* @return the intro site
*/
- IIntroSite getIntroSite();
+ IIntroSite getIntroSite();
- /**
- * Initializes this intro 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 the intro's lifecycle. Clients
- * must not call this method.
- * </p>
- *
- * @param site the intro site
- * @param memento the intro part state or <code>null</code> if there is no previous
- * saved state
- * @exception PartInitException if this part was not initialized
- * successfully
- */
- void init(IIntroSite site, IMemento memento)
- throws PartInitException;
+ /**
+ * Initializes this intro 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 the intro's lifecycle. Clients must not
+ * call this method.
+ * </p>
+ *
+ * @param site the intro site
+ * @param memento the intro part state or <code>null</code> if there is no
+ * previous saved state
+ * @exception PartInitException if this part was not initialized successfully
+ */
+ void init(IIntroSite site, IMemento memento) throws PartInitException;
- /**
- * Sets the standby state of this intro part. An intro part should render
- * itself differently in the full and standby modes. In standby mode, the
- * part should be partially visible to the user but otherwise allow them
- * to work. In full mode, the part should be fully visible and be the center
- * of the user's attention.
- * <p>
- * This method is automatically called by the workbench at appropriate
- * times. Clients must not call this method directly (call
- * {@link IIntroManager#setIntroStandby(IIntroPart, boolean)} instead.
- * </p>
- *
- * @param standby <code>true</code> to put this part in its partially
- * visible standy mode, and <code>false</code> to make it fully visible
- */
- void standbyStateChanged(boolean standby);
+ /**
+ * Sets the standby state of this intro part. An intro part should render itself
+ * differently in the full and standby modes. In standby mode, the part should
+ * be partially visible to the user but otherwise allow them to work. In full
+ * mode, the part should be fully visible and be the center of the user's
+ * attention.
+ * <p>
+ * This method is automatically called by the workbench at appropriate times.
+ * Clients must not call this method directly (call
+ * {@link IIntroManager#setIntroStandby(IIntroPart, boolean)} instead.
+ * </p>
+ *
+ * @param standby <code>true</code> to put this part in its partially visible
+ * standy mode, and <code>false</code> to make it fully visible
+ */
+ void standbyStateChanged(boolean standby);
- /**
- * 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
- */
- 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
+ */
+ void saveState(IMemento memento);
- /**
+ /**
* Adds a listener for changes to properties of this intro part. Has no effect
* if an identical listener is already registered.
* <p>
@@ -124,9 +121,9 @@ public interface IIntroPart extends IAdaptable {
*
* @param listener a property listener
*/
- void addPropertyListener(IPropertyListener listener);
+ void addPropertyListener(IPropertyListener listener);
- /**
+ /**
* Creates the SWT controls for this intro part.
* <p>
* Clients should not call this method (the workbench calls this method when it
@@ -146,72 +143,68 @@ public interface IIntroPart extends IAdaptable {
*
* @param parent the parent control
*/
- void createPartControl(Composite parent);
+ void createPartControl(Composite parent);
- /**
- * Disposes of this intro part.
- * <p>
- * This is the last method called on the <code>IIntroPart</code>. At this
- * point the part controls (if they were ever created) have been disposed as part
- * of an SWT composite. There is no guarantee that createPartControl() has been
- * called, so the part controls may never have been created.
- * </p>
- * <p>
- * Within this method a part may release any resources, fonts, images, etc.&nbsp;
- * held by this part. It is also very important to deregister all listeners
- * from the workbench.
- * </p>
- * <p>
- * Clients should not call this method (the workbench calls this method at
- * appropriate times).
- * </p>
- */
- void dispose();
+ /**
+ * Disposes of this intro part.
+ * <p>
+ * This is the last method called on the <code>IIntroPart</code>. At this point
+ * the part controls (if they were ever created) have been disposed as part of
+ * an SWT composite. There is no guarantee that createPartControl() has been
+ * called, so the part controls may never have been created.
+ * </p>
+ * <p>
+ * Within this method a part may release any resources, fonts, images,
+ * etc.&nbsp; held by this part. It is also very important to deregister all
+ * listeners from the workbench.
+ * </p>
+ * <p>
+ * Clients should not call this method (the workbench calls this method at
+ * appropriate times).
+ * </p>
+ */
+ void dispose();
- /**
- * Returns the title image of this intro part. If this value changes
- * the part must fire a property listener event with
- * {@link IIntroPart#PROP_TITLE}.
- * <p>
- * The title image is usually used to populate the title bar of this part's
- * visual container. Since this image is managed by the part itself, callers
- * must <b>not</b> dispose the returned image.
- * </p>
- *
- * @return the title image
- */
- Image getTitleImage();
+ /**
+ * Returns the title image of this intro part. If this value changes the part
+ * must fire a property listener event with {@link IIntroPart#PROP_TITLE}.
+ * <p>
+ * The title image is usually used to populate the title bar of this part's
+ * visual container. Since this image is managed by the part itself, callers
+ * must <b>not</b> dispose the returned image.
+ * </p>
+ *
+ * @return the title image
+ */
+ Image getTitleImage();
- /**
- * Returns the title of this intro part. If this value changes
- * the part must fire a property listener event with
- * {@link IIntroPart#PROP_TITLE}.
- * <p>
- * The title is used to populate the title bar of this part's visual
- * container.
- * </p>
- *
- * @return the intro part title (not <code>null</code>)
- * @since 3.2
- */
- String getTitle();
+ /**
+ * Returns the title of this intro part. If this value changes the part must
+ * fire a property listener event with {@link IIntroPart#PROP_TITLE}.
+ * <p>
+ * The title is used to populate the title bar of this part's visual container.
+ * </p>
+ *
+ * @return the intro part title (not <code>null</code>)
+ * @since 3.2
+ */
+ String getTitle();
- /**
- * Removes the given property listener from this intro part. Has no effect
- * if an identical listener is not registered.
+ /**
+ * Removes the given property listener from this intro part. Has no effect if an
+ * identical listener is not registered.
*
- * @param listener
- * a property listener
+ * @param listener a property listener
*/
- void removePropertyListener(IPropertyListener listener);
+ void removePropertyListener(IPropertyListener listener);
- /**
- * Asks this part to take focus within the workbench.
- * <p>
- * Clients should not call this method (the workbench calls this method at
- * appropriate times). To have the workbench activate a part, use
- * {@link IIntroManager#showIntro(IWorkbenchWindow, boolean)}.
- * </p>
- */
- void setFocus();
+ /**
+ * Asks this part to take focus within the workbench.
+ * <p>
+ * Clients should not call this method (the workbench calls this method at
+ * appropriate times). To have the workbench activate a part, use
+ * {@link IIntroManager#showIntro(IWorkbenchWindow, boolean)}.
+ * </p>
+ */
+ void setFocus();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/intro/IIntroSite.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/intro/IIntroSite.java
index 64f79f50d7e..9b228a186ae 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/intro/IIntroSite.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/intro/IIntroSite.java
@@ -29,44 +29,45 @@ import org.eclipse.ui.IWorkbenchSite;
*/
public interface IIntroSite extends IWorkbenchSite {
- /**
- * Returns the part registry extension id for this intro site's part.
- * <p>
- * The name comes from the <code>id</code> attribute in the configuration
- * element.
- * </p>
- *
- * @return the registry extension id
- */
- String getId();
+ /**
+ * Returns the part registry extension id for this intro site's part.
+ * <p>
+ * The name comes from the <code>id</code> attribute in the configuration
+ * element.
+ * </p>
+ *
+ * @return the registry extension id
+ */
+ String getId();
- /**
- * Returns the unique identifier of the plug-in that defines this intro
- * site's part.
- *
- * @return the unique identifier of the declaring plug-in
- * @see org.eclipse.core.runtime.IPluginDescriptor#getUniqueIdentifier()
- */
- String getPluginId();
+ /**
+ * Returns the unique identifier of the plug-in that defines this intro site's
+ * part.
+ *
+ * @return the unique identifier of the declaring plug-in
+ * @see org.eclipse.core.runtime.IPluginDescriptor#getUniqueIdentifier()
+ */
+ String getPluginId();
- /**
- * Returns the key binding service in use.
- * <p>
- * The part will access this service to register
- * all of its actions, to set the active scope.
- * </p>
- *
- * @return the key binding service in use
- * @deprecated Use IServiceLocator#getService(*) to retrieve
- * IContextService and IHandlerService instead.
- */
- @Deprecated IKeyBindingService getKeyBindingService();
+ /**
+ * Returns the key binding service in use.
+ * <p>
+ * The part will access this service to register all of its actions, to set the
+ * active scope.
+ * </p>
+ *
+ * @return the key binding service in use
+ * @deprecated Use IServiceLocator#getService(*) to retrieve IContextService and
+ * IHandlerService instead.
+ */
+ @Deprecated
+ IKeyBindingService getKeyBindingService();
- /**
- * Returns the action bars for this part site.
- * The intro part has exclusive use of its site's action bars.
- *
- * @return the action bars
- */
- IActionBars getActionBars();
+ /**
+ * Returns the action bars for this part site. The intro part has exclusive use
+ * of its site's action bars.
+ *
+ * @return the action bars
+ */
+ IActionBars getActionBars();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/CharacterKey.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/CharacterKey.java
index 80bcaad6af1..9adc0bbed65 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/CharacterKey.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/CharacterKey.java
@@ -26,8 +26,8 @@ import org.eclipse.jface.bindings.keys.KeyLookupFactory;
* represent unicode characters.
* </p>
* <p>
- * <code>CharacterKey</code> objects are immutable. Clients are not permitted
- * to extend this class.
+ * <code>CharacterKey</code> objects are immutable. Clients are not permitted to
+ * extend this class.
* </p>
*
* @deprecated Please use org.eclipse.jface.bindings.keys.KeyStroke and
@@ -38,82 +38,80 @@ import org.eclipse.jface.bindings.keys.KeyLookupFactory;
public final class CharacterKey extends NaturalKey {
/**
- * An internal map used to lookup instances of <code>CharacterKey</code>
- * given the formal string representation of a character key.
+ * An internal map used to lookup instances of <code>CharacterKey</code> given
+ * the formal string representation of a character key.
*/
static SortedMap characterKeysByName = new TreeMap();
/**
- * The single static instance of <code>CharacterKey</code> which
- * represents the backspace key (U+0008).
+ * The single static instance of <code>CharacterKey</code> which represents the
+ * backspace key (U+0008).
*/
public static final CharacterKey BS;
/**
- * The single static instance of <code>CharacterKey</code> which
- * represents the carriage return (U+000D) key
+ * The single static instance of <code>CharacterKey</code> which represents the
+ * carriage return (U+000D) key
*/
public static final CharacterKey CR;
/**
- * The single static instance of <code>CharacterKey</code> which
- * represents the delete (U+007F) key.
+ * The single static instance of <code>CharacterKey</code> which represents the
+ * delete (U+007F) key.
*/
public static final CharacterKey DEL;
/**
- * The single static instance of <code>CharacterKey</code> which
- * represents the escape (U+001B) key.
+ * The single static instance of <code>CharacterKey</code> which represents the
+ * escape (U+001B) key.
*/
public static final CharacterKey ESC;
/**
- * The single static instance of <code>CharacterKey</code> which
- * represents the form feed (U+000C) key.
+ * The single static instance of <code>CharacterKey</code> which represents the
+ * form feed (U+000C) key.
*/
public static final CharacterKey FF;
/**
- * The single static instance of <code>CharacterKey</code> which
- * represents the line feed (U+000A) key.
+ * The single static instance of <code>CharacterKey</code> which represents the
+ * line feed (U+000A) key.
*/
public static final CharacterKey LF;
/**
- * The single static instance of <code>CharacterKey</code> which
- * represents the null (U+0000) key.
+ * The single static instance of <code>CharacterKey</code> which represents the
+ * null (U+0000) key.
*/
public static final CharacterKey NUL;
/**
- * The single static instance of <code>CharacterKey</code> which
- * represents the space (U+0020) key.
+ * The single static instance of <code>CharacterKey</code> which represents the
+ * space (U+0020) key.
*/
public static final CharacterKey SPACE;
/**
- * The single static instance of <code>CharacterKey</code> which
- * represents the tab (U+0009) key.
+ * The single static instance of <code>CharacterKey</code> which represents the
+ * tab (U+0009) key.
*/
public static final CharacterKey TAB;
/**
- * The single static instance of <code>CharacterKey</code> which
- * represents the vertical tab (U+000B) key.
+ * The single static instance of <code>CharacterKey</code> which represents the
+ * vertical tab (U+000B) key.
*/
public static final CharacterKey VT;
/**
- * Creates an instance of <code>CharacterKey</code> given a unicode
- * character. This method determines the correct name for the key based on
- * character. Typically, this name is a string of one-character in length
- * equal to the character that this instance represents.
+ * Creates an instance of <code>CharacterKey</code> given a unicode character.
+ * This method determines the correct name for the key based on character.
+ * Typically, this name is a string of one-character in length equal to the
+ * character that this instance represents.
*
- * @param character
- * the character that the resultant <code>CharacterKey</code>
- * instance is to represent.
- * @return an instance of <code>CharacterKey</code> representing the
- * character.
+ * @param character the character that the resultant <code>CharacterKey</code>
+ * instance is to represent.
+ * @return an instance of <code>CharacterKey</code> representing the character.
*/
public static CharacterKey getInstance(final char character) {
return new CharacterKey(character);
@@ -150,11 +148,10 @@ public final class CharacterKey extends NaturalKey {
}
/**
- * Constructs an instance of <code>CharacterKey</code> given a unicode
- * character and a name.
+ * Constructs an instance of <code>CharacterKey</code> given a unicode character
+ * and a name.
*
- * @param key
- * The key to be wrapped.
+ * @param key The key to be wrapped.
*/
private CharacterKey(final int key) {
super(key);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/IBindingService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/IBindingService.java
index eca0691d776..935d0b83e91 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/IBindingService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/IBindingService.java
@@ -52,23 +52,22 @@ public interface IBindingService extends IDisposable {
/**
* The default default value for the active scheme id. This value can be
* overridden using the "plugin_customization.ini" file. The
- * <code>BindingPersistence</code> code needs to know this value so it can
- * try to decide if someone overrode the default.
+ * <code>BindingPersistence</code> code needs to know this value so it can try
+ * to decide if someone overrode the default.
*/
String DEFAULT_DEFAULT_ACTIVE_SCHEME_ID = "org.eclipse.ui.defaultAcceleratorConfiguration"; //$NON-NLS-1$
/**
* <p>
- * Adds a listener to this binding service. The listener will be notified
- * when the set of defined schemes or bindings changes. This can be used to
- * track the global appearance and disappearance of bindings.
+ * Adds a listener to this binding service. The listener will be notified when
+ * the set of defined schemes or bindings changes. This can be used to track the
+ * global appearance and disappearance of bindings.
* </p>
* <p>
* This method completes in amortized constant time (<code>O(1)</code>).
* </p>
*
- * @param listener
- * The listener to attach; must not be <code>null</code>.
+ * @param listener The listener to attach; must not be <code>null</code>.
*
* @since 3.5
*/
@@ -82,8 +81,7 @@ public interface IBindingService extends IDisposable {
* This method completes in amortized <code>O(1)</code>.
* </p>
*
- * @param listener
- * The listener to be removed; must not be <code>null</code>.
+ * @param listener The listener to be removed; must not be <code>null</code>.
*
* @since 3.5
*/
@@ -92,22 +90,20 @@ public interface IBindingService extends IDisposable {
/**
* Gets the active bindings for a given parameterized command.
*
- * @param parameterizedCommand
- * The fully-parameterized command for which the active bindings
- * should be found; must not be <code>null</code>.
+ * @param parameterizedCommand The fully-parameterized command for which the
+ * active bindings should be found; must not be
+ * <code>null</code>.
* @return The array of all active bindings for the given command. This
* collection may be empty, but it is never <code>null</code>.
*/
- TriggerSequence[] getActiveBindingsFor(
- ParameterizedCommand parameterizedCommand);
+ TriggerSequence[] getActiveBindingsFor(ParameterizedCommand parameterizedCommand);
/**
- * Gets the active bindings for a given command identifier. It is assumed
- * that the command has no parameters.
+ * Gets the active bindings for a given command identifier. It is assumed that
+ * the command has no parameters.
*
- * @param commandId
- * The id of the command for which the active bindings should be
- * found; must not be <code>null</code>.
+ * @param commandId The id of the command for which the active bindings should
+ * be found; must not be <code>null</code>.
* @return The array of all active bindings for the given command. This
* collection may be empty, but it is never <code>null</code>.
*/
@@ -122,61 +118,52 @@ public interface IBindingService extends IDisposable {
Scheme getActiveScheme();
/**
- * Gets the best active binding for a command. The best binding is the one
- * that would be most appropriate to show in a menu. Bindings which belong
- * to a child scheme are given preference over those in a parent scheme.
- * Bindings which belong to a particular locale or platform are given
- * preference over those that do not. The rest of the calculation is based
- * most on various concepts of "length", as well as giving some modifier
- * keys preference (e.g., <code>Alt</code> is less likely to appear than
- * <code>Ctrl</code>).
+ * Gets the best active binding for a command. The best binding is the one that
+ * would be most appropriate to show in a menu. Bindings which belong to a child
+ * scheme are given preference over those in a parent scheme. Bindings which
+ * belong to a particular locale or platform are given preference over those
+ * that do not. The rest of the calculation is based most on various concepts of
+ * "length", as well as giving some modifier keys preference (e.g.,
+ * <code>Alt</code> is less likely to appear than <code>Ctrl</code>).
*
- * @param command
- * The command for which the best active binding should be
- * retrieved; must not be <code>null</code>.
- * @return The trigger sequence for the best binding; may be
- * <code>null</code> if no bindings are active for the given
- * command.
+ * @param command The command for which the best active binding should be
+ * retrieved; must not be <code>null</code>.
+ * @return The trigger sequence for the best binding; may be <code>null</code>
+ * if no bindings are active for the given command.
* @since 3.4
*/
TriggerSequence getBestActiveBindingFor(ParameterizedCommand command);
/**
- * Gets the best active binding for a command. The best binding is the one
- * that would be most appropriate to show in a menu. Bindings which belong
- * to a child scheme are given preference over those in a parent scheme.
- * Bindings which belong to a particular locale or platform are given
- * preference over those that do not. The rest of the calculaton is based
- * most on various concepts of "length", as well as giving some modifier
- * keys preference (e.g., <code>Alt</code> is less likely to appear than
- * <code>Ctrl</code>).
+ * Gets the best active binding for a command. The best binding is the one that
+ * would be most appropriate to show in a menu. Bindings which belong to a child
+ * scheme are given preference over those in a parent scheme. Bindings which
+ * belong to a particular locale or platform are given preference over those
+ * that do not. The rest of the calculaton is based most on various concepts of
+ * "length", as well as giving some modifier keys preference (e.g.,
+ * <code>Alt</code> is less likely to appear than <code>Ctrl</code>).
*
- * @param commandId
- * The identifier of the command for which the best active
- * binding should be retrieved; must not be <code>null</code>.
- * @return The trigger sequence for the best binding; may be
- * <code>null</code> if no bindings are active for the given
- * command.
+ * @param commandId The identifier of the command for which the best active
+ * binding should be retrieved; must not be <code>null</code>.
+ * @return The trigger sequence for the best binding; may be <code>null</code>
+ * if no bindings are active for the given command.
* @since 3.2
* @see #getBestActiveBindingFor(ParameterizedCommand)
*/
TriggerSequence getBestActiveBindingFor(String commandId);
/**
- * Gets the formatted string representing the best active binding for a
- * command. The best binding is the one that would be most appropriate to
- * show in a menu. Bindings which belong to a child scheme are given
- * preference over those in a parent scheme. The rest of the calculaton is
- * based most on various concepts of "length", as well as giving some
- * modifier keys preference (e.g., <code>Alt</code> is less likely to
- * appear than <code>Ctrl</code>).
+ * Gets the formatted string representing the best active binding for a command.
+ * The best binding is the one that would be most appropriate to show in a menu.
+ * Bindings which belong to a child scheme are given preference over those in a
+ * parent scheme. The rest of the calculaton is based most on various concepts
+ * of "length", as well as giving some modifier keys preference (e.g.,
+ * <code>Alt</code> is less likely to appear than <code>Ctrl</code>).
*
- * @param commandId
- * The identifier of the command for which the best active
- * binding should be retrieved; must not be <code>null</code>.
- * @return The formatted string for the best binding; may be
- * <code>null</code> if no bindings are active for the given
- * command.
+ * @param commandId The identifier of the command for which the best active
+ * binding should be retrieved; must not be <code>null</code>.
+ * @return The formatted string for the best binding; may be <code>null</code>
+ * if no bindings are active for the given command.
* @since 3.2
* @see #getBestActiveBindingFor(ParameterizedCommand)
*/
@@ -190,35 +177,33 @@ public interface IBindingService extends IDisposable {
Binding[] getBindings();
/**
- * Returns the current state of the key binding buffer. This will contain
- * all of the keys currently awaiting processing. If the system is currently
- * executing a command (as a result of a key press), then this will contain
- * the trigger sequence used to execute the command. If the key binding
- * architecture has seen part of multi-key binding, then this will contain
- * the part that it has seen. Otherwise, this will return nothing.
+ * Returns the current state of the key binding buffer. This will contain all of
+ * the keys currently awaiting processing. If the system is currently executing
+ * a command (as a result of a key press), then this will contain the trigger
+ * sequence used to execute the command. If the key binding architecture has
+ * seen part of multi-key binding, then this will contain the part that it has
+ * seen. Otherwise, this will return nothing.
*
- * @return The trigger sequence indicating the current state of the key
- * binding buffer; never <code>null</code>, but may be empty if
- * there is nothing in the buffer.
+ * @return The trigger sequence indicating the current state of the key binding
+ * buffer; never <code>null</code>, but may be empty if there is nothing
+ * in the buffer.
* @since 3.2
*/
TriggerSequence getBuffer();
/**
- * Returns the default scheme identifier for the currently running
- * application.
+ * Returns the default scheme identifier for the currently running application.
*
* @return The default scheme identifier (<code>String</code>); never
- * <code>null</code>, but may be empty or point to an undefined
- * scheme.
+ * <code>null</code>, but may be empty or point to an undefined scheme.
*/
String getDefaultSchemeId();
/**
* Returns the array of defined schemes in the workbench.
*
- * @return The array of schemes (<code>Scheme</code>) that are defined;
- * it may be <code>null</code>, and it may be empty.
+ * @return The array of schemes (<code>Scheme</code>) that are defined; it may
+ * be <code>null</code>, and it may be empty.
*/
Scheme[] getDefinedSchemes();
@@ -230,22 +215,21 @@ public interface IBindingService extends IDisposable {
String getLocale();
/**
- * Returns all of the possible bindings that start with the given trigger
- * (but are not equal to the given trigger).
+ * Returns all of the possible bindings that start with the given trigger (but
+ * are not equal to the given trigger).
*
- * @param trigger
- * The prefix to look for; must not be <code>null</code>.
- * @return A map of triggers (<code>TriggerSequence</code>) to bindings (<code>Binding</code>).
- * This map may be empty, but it is never <code>null</code>.
+ * @param trigger The prefix to look for; must not be <code>null</code>.
+ * @return A map of triggers (<code>TriggerSequence</code>) to bindings
+ * (<code>Binding</code>). This map may be empty, but it is never
+ * <code>null</code>.
*/
Map getPartialMatches(TriggerSequence trigger);
/**
- * Returns the command identifier for the active binding matching this
- * trigger, if any.
+ * Returns the command identifier for the active binding matching this trigger,
+ * if any.
*
- * @param trigger
- * The trigger to match; may be <code>null</code>.
+ * @param trigger The trigger to match; may be <code>null</code>.
* @return The binding that matches, if any; <code>null</code> otherwise.
*/
Binding getPerfectMatch(TriggerSequence trigger);
@@ -261,8 +245,7 @@ public interface IBindingService extends IDisposable {
* Retrieves the scheme with the given identifier. If no such scheme exists,
* then an undefined scheme with the given id is created.
*
- * @param schemeId
- * The identifier to find; must not be <code>null</code>.
+ * @param schemeId The identifier to find; must not be <code>null</code>.
* @return A scheme with the given identifier, either defined or undefined.
*/
Scheme getScheme(String schemeId);
@@ -270,84 +253,77 @@ public interface IBindingService extends IDisposable {
/**
* Tests whether the global key binding architecture is currently active.
*
- * @return <code>true</code> if the key bindings are active;
- * <code>false</code> otherwise.
+ * @return <code>true</code> if the key bindings are active; <code>false</code>
+ * otherwise.
*/
boolean isKeyFilterEnabled();
/**
- * Returns whether the given trigger sequence is a partial match for the
- * given sequence.
+ * Returns whether the given trigger sequence is a partial match for the given
+ * sequence.
*
- * @param trigger
- * The sequence which should be the prefix for some binding;
- * should not be <code>null</code>.
- * @return <code>true</code> if the trigger can be found in the active
- * bindings; <code>false</code> otherwise.
+ * @param trigger The sequence which should be the prefix for some binding;
+ * should not be <code>null</code>.
+ * @return <code>true</code> if the trigger can be found in the active bindings;
+ * <code>false</code> otherwise.
*/
boolean isPartialMatch(TriggerSequence trigger);
/**
- * Returns whether the given trigger sequence is a perfect match for the
- * given sequence.
+ * Returns whether the given trigger sequence is a perfect match for the given
+ * sequence.
*
- * @param trigger
- * The sequence which should match exactly; should not be
- * <code>null</code>.
- * @return <code>true</code> if the trigger can be found in the active
- * bindings; <code>false</code> otherwise.
+ * @param trigger The sequence which should match exactly; should not be
+ * <code>null</code>.
+ * @return <code>true</code> if the trigger can be found in the active bindings;
+ * <code>false</code> otherwise.
*/
boolean isPerfectMatch(TriggerSequence trigger);
/**
- * Opens the key assistant dialog positioned near the key binding entry in
- * the status bar.
+ * Opens the key assistant dialog positioned near the key binding entry in the
+ * status bar.
*/
void openKeyAssistDialog();
/**
* <p>
* Reads the binding information from the registry and the preferences. This
- * will overwrite any of the existing information in the binding service.
- * This method is intended to be called during start-up. When this method
- * completes, this binding service will reflect the current state of the
- * registry and preference store.
+ * will overwrite any of the existing information in the binding service. This
+ * method is intended to be called during start-up. When this method completes,
+ * this binding service will reflect the current state of the registry and
+ * preference store.
* </p>
*
- * @param commandService
- * Ignored.
+ * @param commandService Ignored.
*/
void readRegistryAndPreferences(ICommandService commandService);
/**
* <p>
- * Writes the given active scheme and bindings to the preference store. Only
- * the bindings that are of the <code>Binding.USER</code> type will be
- * written; the others will be ignored. This should only be used by
- * applications trying to persist user preferences. If you are trying to
- * change the active scheme as an RCP application, then you should be using
- * the <code>plugin_customization.ini</code> file. If you are trying to
- * switch between groups of bindings dynamically, you should be using
- * contexts.
+ * Writes the given active scheme and bindings to the preference store. Only the
+ * bindings that are of the <code>Binding.USER</code> type will be written; the
+ * others will be ignored. This should only be used by applications trying to
+ * persist user preferences. If you are trying to change the active scheme as an
+ * RCP application, then you should be using the
+ * <code>plugin_customization.ini</code> file. If you are trying to switch
+ * between groups of bindings dynamically, you should be using contexts.
* </p>
* <p>
* This method also updates the active scheme and bindings in the system to
* match those written to the preference store.
* </p>
*
- * @param activeScheme
- * The scheme which should be persisted; may be <code>null</code>.
- * @param bindings
- * The bindings which should be persisted; may be
- * <code>null</code>.
- * @throws IOException
- * If something goes wrong while writing to the preference
- * store.
+ * @param activeScheme The scheme which should be persisted; may be
+ * <code>null</code>.
+ * @param bindings The bindings which should be persisted; may be
+ * <code>null</code>.
+ * @throws IOException If something goes wrong while writing to the preference
+ * store.
* @see org.eclipse.ui.IWorkbenchPreferenceConstants
* @see org.eclipse.ui.contexts.IContextService
*/
- void savePreferences(Scheme activeScheme, Binding[] bindings)
- throws IOException;
+ void savePreferences(Scheme activeScheme, Binding[] bindings) throws IOException;
/**
* <p>
@@ -355,19 +331,17 @@ public interface IBindingService extends IDisposable {
* should be enabled by default.
* </p>
* <p>
- * When enabled, keyboard shortcuts are active, and that key events can
- * trigger commands. This also means that widgets may not see all key events
- * (as they might be trapped as a keyboard shortcut).
+ * When enabled, keyboard shortcuts are active, and that key events can trigger
+ * commands. This also means that widgets may not see all key events (as they
+ * might be trapped as a keyboard shortcut).
* </p>
* <p>
- * When disabled, no key events will trapped as keyboard shortcuts, and that
- * no commands can be triggered by keyboard events. (Exception: it is
- * possible that someone listening for key events on a widget could trigger
- * a command.)
+ * When disabled, no key events will trapped as keyboard shortcuts, and that no
+ * commands can be triggered by keyboard events. (Exception: it is possible that
+ * someone listening for key events on a widget could trigger a command.)
* </p>
*
- * @param enabled
- * Whether the key filter should be enabled.
+ * @param enabled Whether the key filter should be enabled.
*/
void setKeyFilterEnabled(boolean enabled);
@@ -377,8 +351,8 @@ public interface IBindingService extends IDisposable {
*
* @param sequence The sequence for which conflict info is required
*
- * @return Collection of Bindings. If no conflicts,
- * then returns a <code>null</code>
+ * @return Collection of Bindings. If no conflicts, then returns a
+ * <code>null</code>
* @since 3.5
*/
Collection getConflictsFor(TriggerSequence sequence);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/IKeyFormatter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/IKeyFormatter.java
index 5d11cbcc9c2..09f4bd2ccb1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/IKeyFormatter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/IKeyFormatter.java
@@ -26,37 +26,36 @@ package org.eclipse.ui.keys;
@Deprecated
public interface IKeyFormatter {
- /**
- * Formats an individual key into a human readable format. This uses an
- * internationalization resource bundle to look up the key. This does not
- * do any platform-specific formatting (e.g., Carbon's command character).
- *
- * @param key
- * The key to format; must not be <code>null</code>.
- * @return The key formatted as a string; should not be <code>null</code>.
- */
- String format(Key key);
+ /**
+ * Formats an individual key into a human readable format. This uses an
+ * internationalization resource bundle to look up the key. This does not do any
+ * platform-specific formatting (e.g., Carbon's command character).
+ *
+ * @param key The key to format; must not be <code>null</code>.
+ * @return The key formatted as a string; should not be <code>null</code>.
+ */
+ String format(Key key);
- /**
- * Format the given key sequence into a string. The manner of the
- * conversion is dependent on the formatter. It is required that unequal
- * key seqeunces return unequal strings.
- *
- * @param keySequence
- * The key sequence to convert; must not be <code>null</code>.
- * @return A string representation of the key sequence; must not be <code>null</code>.
- */
- String format(KeySequence keySequence);
+ /**
+ * Format the given key sequence into a string. The manner of the conversion is
+ * dependent on the formatter. It is required that unequal key seqeunces return
+ * unequal strings.
+ *
+ * @param keySequence The key sequence to convert; must not be
+ * <code>null</code>.
+ * @return A string representation of the key sequence; must not be
+ * <code>null</code>.
+ */
+ String format(KeySequence keySequence);
- /**
- * Format the given key strokes into a string. The manner of the conversion
- * is dependent on the formatter. It is required that unequal key strokes
- * return unequal strings.
- *
- * @param keyStroke
- * The key stroke to convert; must not be <Code>null</code>.
- * @return A string representation of the key stroke; must not be <code>
- * null</code>
- */
- String format(KeyStroke keyStroke);
+ /**
+ * Format the given key strokes into a string. The manner of the conversion is
+ * dependent on the formatter. It is required that unequal key strokes return
+ * unequal strings.
+ *
+ * @param keyStroke The key stroke to convert; must not be <Code>null</code>.
+ * @return A string representation of the key stroke; must not be <code>
+ * null</code>
+ */
+ String format(KeyStroke keyStroke);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/Key.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/Key.java
index 4536cb3d3e5..f1610d063b3 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/Key.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/Key.java
@@ -20,17 +20,17 @@ import org.eclipse.ui.internal.util.Util;
/**
* <p>
- * <code>Key</code> is the abstract base class for all objects representing
- * keys on the keyboard.
+ * <code>Key</code> is the abstract base class for all objects representing keys
+ * on the keyboard.
* </p>
* <p>
- * All <code>Key</code> objects have a formal string representation, called
- * the 'name' of the key, available via the <code>toString()</code> method.
+ * All <code>Key</code> objects have a formal string representation, called the
+ * 'name' of the key, available via the <code>toString()</code> method.
* </p>
* <p>
- * All <code>Key</code> objects, via the <code>format()</code> method,
- * provide a version of their formal string representation translated by
- * platform and locale, suitable for display to a user.
+ * All <code>Key</code> objects, via the <code>format()</code> method, provide a
+ * version of their formal string representation translated by platform and
+ * locale, suitable for display to a user.
* </p>
* <p>
* <code>Key</code> objects are immutable. Clients are not permitted to extend
@@ -55,8 +55,7 @@ public abstract class Key implements Comparable {
* Constructs an instance of <code>Key</code> given its formal string
* representation.
*
- * @param key
- * the integer representation of this key, as defined by
+ * @param key the integer representation of this key, as defined by
* <code>KeyLookupFactory.getDefault()</code>.
*/
Key(final int key) {
@@ -88,8 +87,8 @@ public abstract class Key implements Comparable {
/**
* Returns the formal string representation for this key.
*
- * @return The formal string representation for this key. Guaranteed not to
- * be <code>null</code>.
+ * @return The formal string representation for this key. Guaranteed not to be
+ * <code>null</code>.
*/
@Override
public final String toString() {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/KeyFormatterFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/KeyFormatterFactory.java
index c9f3f4b7949..1fd9e3818fe 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/KeyFormatterFactory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/KeyFormatterFactory.java
@@ -29,65 +29,65 @@ import org.eclipse.ui.internal.keys.FormalKeyFormatter;
*/
@Deprecated
public final class KeyFormatterFactory {
- private static final IKeyFormatter COMPACT_KEY_FORMATTER = new CompactKeyFormatter();
+ private static final IKeyFormatter COMPACT_KEY_FORMATTER = new CompactKeyFormatter();
- private static final IKeyFormatter FORMAL_KEY_FORMATTER = new FormalKeyFormatter();
+ private static final IKeyFormatter FORMAL_KEY_FORMATTER = new FormalKeyFormatter();
- private static final IKeyFormatter EMACS_KEY_FORMATTER = new EmacsKeyFormatter();
+ private static final IKeyFormatter EMACS_KEY_FORMATTER = new EmacsKeyFormatter();
- private static IKeyFormatter defaultKeyFormatter = FORMAL_KEY_FORMATTER;
+ private static IKeyFormatter defaultKeyFormatter = FORMAL_KEY_FORMATTER;
- /**
- * Provides an instance of <code>CompactKeyFormatter</code>.
- *
- * @return The compact formatter; never <code>null</code>.
- */
- public static IKeyFormatter getCompactKeyFormatter() {
- return COMPACT_KEY_FORMATTER;
- }
+ /**
+ * Provides an instance of <code>CompactKeyFormatter</code>.
+ *
+ * @return The compact formatter; never <code>null</code>.
+ */
+ public static IKeyFormatter getCompactKeyFormatter() {
+ return COMPACT_KEY_FORMATTER;
+ }
- /**
- * An accessor for the current default key formatter.
- *
- * @return The default formatter; never <code>null</code>.
- */
- public static IKeyFormatter getDefault() {
- return defaultKeyFormatter;
- }
+ /**
+ * An accessor for the current default key formatter.
+ *
+ * @return The default formatter; never <code>null</code>.
+ */
+ public static IKeyFormatter getDefault() {
+ return defaultKeyFormatter;
+ }
- /**
- * Provides an instance of <code>EmacsKeyFormatter</code>.
- *
- * @return The Xemacs formatter; never <code>null</code>.
- */
- public static IKeyFormatter getEmacsKeyFormatter() {
- return EMACS_KEY_FORMATTER;
- }
+ /**
+ * Provides an instance of <code>EmacsKeyFormatter</code>.
+ *
+ * @return The Xemacs formatter; never <code>null</code>.
+ */
+ public static IKeyFormatter getEmacsKeyFormatter() {
+ return EMACS_KEY_FORMATTER;
+ }
- /**
- * Provides an instance of <code>FormalKeyFormatter</code>.
- *
- * @return The formal formatter; never <code>null</code>.
- */
- public static IKeyFormatter getFormalKeyFormatter() {
- return FORMAL_KEY_FORMATTER;
- }
+ /**
+ * Provides an instance of <code>FormalKeyFormatter</code>.
+ *
+ * @return The formal formatter; never <code>null</code>.
+ */
+ public static IKeyFormatter getFormalKeyFormatter() {
+ return FORMAL_KEY_FORMATTER;
+ }
- /**
- * Sets the default key formatter.
- *
- * @param defaultKeyFormatter
- * the default key formatter. Must not be <code>null</code>.
- */
- public static void setDefault(IKeyFormatter defaultKeyFormatter) {
- if (defaultKeyFormatter == null) {
+ /**
+ * Sets the default key formatter.
+ *
+ * @param defaultKeyFormatter the default key formatter. Must not be
+ * <code>null</code>.
+ */
+ public static void setDefault(IKeyFormatter defaultKeyFormatter) {
+ if (defaultKeyFormatter == null) {
throw new NullPointerException();
}
- KeyFormatterFactory.defaultKeyFormatter = defaultKeyFormatter;
- }
+ KeyFormatterFactory.defaultKeyFormatter = defaultKeyFormatter;
+ }
- private KeyFormatterFactory() {
- // Not to be constructred.
- }
+ private KeyFormatterFactory() {
+ // Not to be constructred.
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/KeySequence.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/KeySequence.java
index 0e563c832b3..d125cfc3b8d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/KeySequence.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/KeySequence.java
@@ -24,10 +24,10 @@ import org.eclipse.ui.internal.util.Util;
/**
* <p>
* A <code>KeySequence</code> is defined as a list of zero or more
- * <code>KeyStrokes</code>, with the stipulation that all
- * <code>KeyStroke</code> objects must be complete, save for the last one,
- * whose completeness is optional. A <code>KeySequence</code> is said to be
- * complete if all of its <code>KeyStroke</code> objects are complete.
+ * <code>KeyStrokes</code>, with the stipulation that all <code>KeyStroke</code>
+ * objects must be complete, save for the last one, whose completeness is
+ * optional. A <code>KeySequence</code> is said to be complete if all of its
+ * <code>KeyStroke</code> objects are complete.
* </p>
* <p>
* All <code>KeySequence</code> objects have a formal string representation
@@ -36,13 +36,13 @@ import org.eclipse.ui.internal.util.Util;
* which can parse this formal string representation.
* </p>
* <p>
- * All <code>KeySequence</code> objects, via the <code>format()</code>
- * method, provide a version of their formal string representation translated by
+ * All <code>KeySequence</code> objects, via the <code>format()</code> method,
+ * provide a version of their formal string representation translated by
* platform and locale, suitable for display to a user.
* </p>
* <p>
- * <code>KeySequence</code> objects are immutable. Clients are not permitted
- * to extend this class.
+ * <code>KeySequence</code> objects are immutable. Clients are not permitted to
+ * extend this class.
* </p>
*
* @deprecated Please use org.eclipse.jface.bindings.keys.KeySequence
@@ -51,328 +51,297 @@ import org.eclipse.ui.internal.util.Util;
@Deprecated
public final class KeySequence implements Comparable {
- /**
- * The delimiter between multiple key strokes in a single key sequence --
- * expressed in the formal key stroke grammar. This is not to be displayed
- * to the user. It is only intended as an internal representation.
- */
- public static final String KEY_STROKE_DELIMITER = "\u0020"; //$NON-NLS-1$
-
- /**
- * An empty key sequence instance for use by everyone.
- */
- private static final KeySequence EMPTY_KEY_SEQUENCE = new KeySequence(
- Collections.EMPTY_LIST);
-
- /**
- * An internal constant used only in this object's hash code algorithm.
- */
- private static final int HASH_FACTOR = 89;
-
- /**
- * An internal constant used only in this object's hash code algorithm.
- */
- private static final int HASH_INITIAL = KeySequence.class.getName()
- .hashCode();
-
- /**
- * The set of delimiters for <code>KeyStroke</code> objects allowed
- * during parsing of the formal string representation.
- */
- public static final String KEY_STROKE_DELIMITERS = KEY_STROKE_DELIMITER
- + "\b\r\u007F\u001B\f\n\0\t\u000B"; //$NON-NLS-1$
-
- /**
- * Gets an instance of <code>KeySequence</code>.
- *
- * @return a key sequence. This key sequence will have no key strokes.
- * Guaranteed not to be <code>null</code>.
- */
- public static KeySequence getInstance() {
- return EMPTY_KEY_SEQUENCE;
- }
-
- /**
- * Gets an instance of <code>KeySequence</code> given a key sequence and
- * a key stroke.
- *
- * @param keySequence
- * a key sequence. Must not be <code>null</code>.
- * @param keyStroke
- * a key stroke. Must not be <code>null</code>.
- * @return a key sequence that is equal to the given key sequence with the
- * given key stroke appended to the end. Guaranteed not to be
- * <code>null</code>.
- */
- public static KeySequence getInstance(KeySequence keySequence,
- KeyStroke keyStroke) {
- if (keySequence == null || keyStroke == null) {
+ /**
+ * The delimiter between multiple key strokes in a single key sequence --
+ * expressed in the formal key stroke grammar. This is not to be displayed to
+ * the user. It is only intended as an internal representation.
+ */
+ public static final String KEY_STROKE_DELIMITER = "\u0020"; //$NON-NLS-1$
+
+ /**
+ * An empty key sequence instance for use by everyone.
+ */
+ private static final KeySequence EMPTY_KEY_SEQUENCE = new KeySequence(Collections.EMPTY_LIST);
+
+ /**
+ * An internal constant used only in this object's hash code algorithm.
+ */
+ private static final int HASH_FACTOR = 89;
+
+ /**
+ * An internal constant used only in this object's hash code algorithm.
+ */
+ private static final int HASH_INITIAL = KeySequence.class.getName().hashCode();
+
+ /**
+ * The set of delimiters for <code>KeyStroke</code> objects allowed during
+ * parsing of the formal string representation.
+ */
+ public static final String KEY_STROKE_DELIMITERS = KEY_STROKE_DELIMITER + "\b\r\u007F\u001B\f\n\0\t\u000B"; //$NON-NLS-1$
+
+ /**
+ * Gets an instance of <code>KeySequence</code>.
+ *
+ * @return a key sequence. This key sequence will have no key strokes.
+ * Guaranteed not to be <code>null</code>.
+ */
+ public static KeySequence getInstance() {
+ return EMPTY_KEY_SEQUENCE;
+ }
+
+ /**
+ * Gets an instance of <code>KeySequence</code> given a key sequence and a key
+ * stroke.
+ *
+ * @param keySequence a key sequence. Must not be <code>null</code>.
+ * @param keyStroke a key stroke. Must not be <code>null</code>.
+ * @return a key sequence that is equal to the given key sequence with the given
+ * key stroke appended to the end. Guaranteed not to be
+ * <code>null</code>.
+ */
+ public static KeySequence getInstance(KeySequence keySequence, KeyStroke keyStroke) {
+ if (keySequence == null || keyStroke == null) {
throw new NullPointerException();
}
- List keyStrokes = new ArrayList(keySequence.getKeyStrokes());
- keyStrokes.add(keyStroke);
- return new KeySequence(keyStrokes);
- }
-
- /**
- * Gets an instance of <code>KeySequence</code> given a single key
- * stroke.
- *
- * @param keyStroke
- * a single key stroke. Must not be <code>null</code>.
- * @return a key sequence. Guaranteed not to be <code>null</code>.
- */
- public static KeySequence getInstance(KeyStroke keyStroke) {
- return new KeySequence(Collections.singletonList(keyStroke));
- }
-
- /**
- * Gets an instance of <code>KeySequence</code> given an array of key
- * strokes.
- *
- * @param keyStrokes
- * the array of key strokes. This array may be empty, but it
- * must not be <code>null</code>. This array must not contain
- * <code>null</code> elements.
- * @return a key sequence. Guaranteed not to be <code>null</code>.
- */
- public static KeySequence getInstance(KeyStroke[] keyStrokes) {
- return new KeySequence(Arrays.asList(keyStrokes));
- }
-
- /**
- * Gets an instance of <code>KeySequence</code> given a list of key
- * strokes.
- *
- * @param keyStrokes
- * the list of key strokes. This list may be empty, but it must
- * not be <code>null</code>. If this list is not empty, it
- * must only contain instances of <code>KeyStroke</code>.
- * @return a key sequence. Guaranteed not to be <code>null</code>.
- */
- public static KeySequence getInstance(List keyStrokes) {
- return new KeySequence(keyStrokes);
- }
+ List keyStrokes = new ArrayList(keySequence.getKeyStrokes());
+ keyStrokes.add(keyStroke);
+ return new KeySequence(keyStrokes);
+ }
/**
- * Gets an instance of <code>KeySequence</code> given a new-style key
- * sequence.
+ * Gets an instance of <code>KeySequence</code> given a single key stroke.
*
- * @param newKeySequence
- * The new-style key sequence to convert into a legacy key
- * sequence; must not be <code>null</code>.
+ * @param keyStroke a single key stroke. Must not be <code>null</code>.
+ * @return a key sequence. Guaranteed not to be <code>null</code>.
+ */
+ public static KeySequence getInstance(KeyStroke keyStroke) {
+ return new KeySequence(Collections.singletonList(keyStroke));
+ }
+
+ /**
+ * Gets an instance of <code>KeySequence</code> given an array of key strokes.
+ *
+ * @param keyStrokes the array of key strokes. This array may be empty, but it
+ * must not be <code>null</code>. This array must not contain
+ * <code>null</code> elements.
+ * @return a key sequence. Guaranteed not to be <code>null</code>.
+ */
+ public static KeySequence getInstance(KeyStroke[] keyStrokes) {
+ return new KeySequence(Arrays.asList(keyStrokes));
+ }
+
+ /**
+ * Gets an instance of <code>KeySequence</code> given a list of key strokes.
+ *
+ * @param keyStrokes the list of key strokes. This list may be empty, but it
+ * must not be <code>null</code>. If this list is not empty,
+ * it must only contain instances of <code>KeyStroke</code>.
+ * @return a key sequence. Guaranteed not to be <code>null</code>.
+ */
+ public static KeySequence getInstance(List keyStrokes) {
+ return new KeySequence(keyStrokes);
+ }
+
+ /**
+ * Gets an instance of <code>KeySequence</code> given a new-style key sequence.
+ *
+ * @param newKeySequence The new-style key sequence to convert into a legacy key
+ * sequence; must not be <code>null</code>.
* @return a key sequence; never <code>null</code>.
*/
- public static KeySequence getInstance(
- final org.eclipse.jface.bindings.keys.KeySequence newKeySequence) {
- final org.eclipse.jface.bindings.keys.KeyStroke[] newKeyStrokes = newKeySequence
- .getKeyStrokes();
+ public static KeySequence getInstance(final org.eclipse.jface.bindings.keys.KeySequence newKeySequence) {
+ final org.eclipse.jface.bindings.keys.KeyStroke[] newKeyStrokes = newKeySequence.getKeyStrokes();
final int newKeyStrokesCount = newKeyStrokes.length;
final List legacyKeyStrokes = new ArrayList(newKeyStrokesCount);
for (int i = 0; i < newKeyStrokesCount; i++) {
final org.eclipse.jface.bindings.keys.KeyStroke newKeyStroke = newKeyStrokes[i];
legacyKeyStrokes.add(SWTKeySupport
- .convertAcceleratorToKeyStroke(newKeyStroke
- .getModifierKeys()
- | newKeyStroke.getNaturalKey()));
+ .convertAcceleratorToKeyStroke(newKeyStroke.getModifierKeys() | newKeyStroke.getNaturalKey()));
}
return new KeySequence(legacyKeyStrokes);
}
- /**
- * Gets an instance of <code>KeySequence</code> by parsing a given a
- * formal string representation.
- *
- * @param string
- * the formal string representation to parse.
- * @return a key sequence. Guaranteed not to be <code>null</code>.
- * @throws ParseException
- * if the given formal string representation could not be
- * parsed to a valid key sequence.
- */
- public static KeySequence getInstance(String string) throws ParseException {
- if (string == null) {
+ /**
+ * Gets an instance of <code>KeySequence</code> by parsing a given a formal
+ * string representation.
+ *
+ * @param string the formal string representation to parse.
+ * @return a key sequence. Guaranteed not to be <code>null</code>.
+ * @throws ParseException if the given formal string representation could not be
+ * parsed to a valid key sequence.
+ */
+ public static KeySequence getInstance(String string) throws ParseException {
+ if (string == null) {
throw new NullPointerException();
}
- List keyStrokes = new ArrayList();
- StringTokenizer stringTokenizer = new StringTokenizer(string,
- KEY_STROKE_DELIMITERS);
+ List keyStrokes = new ArrayList();
+ StringTokenizer stringTokenizer = new StringTokenizer(string, KEY_STROKE_DELIMITERS);
- while (stringTokenizer.hasMoreTokens()) {
+ while (stringTokenizer.hasMoreTokens()) {
keyStrokes.add(KeyStroke.getInstance(stringTokenizer.nextToken()));
}
- try {
- return new KeySequence(keyStrokes);
- } catch (Throwable t) {
- throw new ParseException(
- "Could not construct key sequence with these key strokes: " //$NON-NLS-1$
- + keyStrokes);
- }
- }
-
- /**
- * The cached hash code for this object. Because <code>KeySequence</code>
- * objects are immutable, their hash codes need only to be computed once.
- * After the first call to <code>hashCode()</code>, the computed value
- * is cached here for all subsequent calls.
- */
- private transient int hashCode;
-
- /**
- * A flag to determine if the <code>hashCode</code> field has already
- * been computed.
- */
- private transient boolean hashCodeComputed;
-
- /**
- * The list of key strokes for this key sequence.
- */
- private List keyStrokes;
-
- /**
- * Constructs an instance of <code>KeySequence</code> given a list of key
- * strokes.
- *
- * @param keyStrokes
- * the list of key strokes. This list may be empty, but it must
- * not be <code>null</code>. If this list is not empty, it
- * must only contain instances of <code>KeyStroke</code>.
- */
- private KeySequence(List keyStrokes) {
- this.keyStrokes = Util.safeCopy(keyStrokes, KeyStroke.class);
-
- for (int i = 0; i < this.keyStrokes.size() - 1; i++) {
- KeyStroke keyStroke = (KeyStroke) this.keyStrokes.get(i);
-
- if (!keyStroke.isComplete()) {
+ try {
+ return new KeySequence(keyStrokes);
+ } catch (Throwable t) {
+ throw new ParseException("Could not construct key sequence with these key strokes: " //$NON-NLS-1$
+ + keyStrokes);
+ }
+ }
+
+ /**
+ * The cached hash code for this object. Because <code>KeySequence</code>
+ * objects are immutable, their hash codes need only to be computed once. After
+ * the first call to <code>hashCode()</code>, the computed value is cached here
+ * for all subsequent calls.
+ */
+ private transient int hashCode;
+
+ /**
+ * A flag to determine if the <code>hashCode</code> field has already been
+ * computed.
+ */
+ private transient boolean hashCodeComputed;
+
+ /**
+ * The list of key strokes for this key sequence.
+ */
+ private List keyStrokes;
+
+ /**
+ * Constructs an instance of <code>KeySequence</code> given a list of key
+ * strokes.
+ *
+ * @param keyStrokes the list of key strokes. This list may be empty, but it
+ * must not be <code>null</code>. If this list is not empty,
+ * it must only contain instances of <code>KeyStroke</code>.
+ */
+ private KeySequence(List keyStrokes) {
+ this.keyStrokes = Util.safeCopy(keyStrokes, KeyStroke.class);
+
+ for (int i = 0; i < this.keyStrokes.size() - 1; i++) {
+ KeyStroke keyStroke = (KeyStroke) this.keyStrokes.get(i);
+
+ if (!keyStroke.isComplete()) {
throw new IllegalArgumentException();
}
- }
- }
+ }
+ }
- @Override
+ @Override
public int compareTo(Object object) {
- KeySequence castedObject = (KeySequence) object;
- int compareTo = Util.compare(keyStrokes, castedObject.keyStrokes);
- return compareTo;
- }
-
- /**
- * Returns whether or not this key sequence ends with the given key
- * sequence.
- *
- * @param keySequence
- * a key sequence. Must not be <code>null</code>.
- * @param equals
- * whether or not an identical key sequence should be considered
- * as a possible match.
- * @return <code>true</code>, iff the given key sequence ends with this
- * key sequence.
- */
- public boolean endsWith(KeySequence keySequence, boolean equals) {
- if (keySequence == null) {
+ KeySequence castedObject = (KeySequence) object;
+ int compareTo = Util.compare(keyStrokes, castedObject.keyStrokes);
+ return compareTo;
+ }
+
+ /**
+ * Returns whether or not this key sequence ends with the given key sequence.
+ *
+ * @param keySequence a key sequence. Must not be <code>null</code>.
+ * @param equals whether or not an identical key sequence should be
+ * considered as a possible match.
+ * @return <code>true</code>, iff the given key sequence ends with this key
+ * sequence.
+ */
+ public boolean endsWith(KeySequence keySequence, boolean equals) {
+ if (keySequence == null) {
throw new NullPointerException();
}
- return Util.endsWith(keyStrokes, keySequence.keyStrokes, equals);
- }
+ return Util.endsWith(keyStrokes, keySequence.keyStrokes, equals);
+ }
- @Override
+ @Override
public boolean equals(Object object) {
- if (!(object instanceof KeySequence)) {
+ if (!(object instanceof KeySequence)) {
return false;
}
- return keyStrokes.equals(((KeySequence) object).keyStrokes);
- }
-
- /**
- * Formats this key sequence into the current default look.
- *
- * @return A string representation for this key sequence using the default
- * look; never <code>null</code>.
- */
- public String format() {
- return KeyFormatterFactory.getDefault().format(this);
- }
-
- /**
- * Returns the list of key strokes for this key sequence.
- *
- * @return the list of key strokes keys. This list may be empty, but is
- * guaranteed not to be <code>null</code>. If this list is not
- * empty, it is guaranteed to only contain instances of <code>KeyStroke</code>.
- */
- public List getKeyStrokes() {
- return keyStrokes;
- }
-
- @Override
+ return keyStrokes.equals(((KeySequence) object).keyStrokes);
+ }
+
+ /**
+ * Formats this key sequence into the current default look.
+ *
+ * @return A string representation for this key sequence using the default look;
+ * never <code>null</code>.
+ */
+ public String format() {
+ return KeyFormatterFactory.getDefault().format(this);
+ }
+
+ /**
+ * Returns the list of key strokes for this key sequence.
+ *
+ * @return the list of key strokes keys. This list may be empty, but is
+ * guaranteed not to be <code>null</code>. If this list is not empty, it
+ * is guaranteed to only contain instances of <code>KeyStroke</code>.
+ */
+ public List getKeyStrokes() {
+ return keyStrokes;
+ }
+
+ @Override
public int hashCode() {
- if (!hashCodeComputed) {
- hashCode = HASH_INITIAL;
- hashCode = hashCode * HASH_FACTOR + keyStrokes.hashCode();
- hashCodeComputed = true;
- }
-
- return hashCode;
- }
-
- /**
- * Returns whether or not this key sequence is complete. Key sequences are
- * complete iff all of their key strokes are complete.
- *
- * @return <code>true</code>, iff the key sequence is complete.
- */
- public boolean isComplete() {
- return keyStrokes.isEmpty()
- || ((KeyStroke) keyStrokes.get(keyStrokes.size() - 1))
- .isComplete();
- }
-
- /**
- * Returns whether or not this key sequence is empty. Key sequences are
- * complete iff they have no key strokes.
- *
- * @return <code>true</code>, iff the key sequence is empty.
- */
- public boolean isEmpty() {
- return keyStrokes.isEmpty();
- }
-
- /**
- * Returns whether or not this key sequence starts with the given key
- * sequence.
- *
- * @param keySequence
- * a key sequence. Must not be <code>null</code>.
- * @param equals
- * whether or not an identical key sequence should be considered
- * as a possible match.
- * @return <code>true</code>, iff the given key sequence starts with
- * this key sequence.
- */
- public boolean startsWith(KeySequence keySequence, boolean equals) {
- if (keySequence == null) {
+ if (!hashCodeComputed) {
+ hashCode = HASH_INITIAL;
+ hashCode = hashCode * HASH_FACTOR + keyStrokes.hashCode();
+ hashCodeComputed = true;
+ }
+
+ return hashCode;
+ }
+
+ /**
+ * Returns whether or not this key sequence is complete. Key sequences are
+ * complete iff all of their key strokes are complete.
+ *
+ * @return <code>true</code>, iff the key sequence is complete.
+ */
+ public boolean isComplete() {
+ return keyStrokes.isEmpty() || ((KeyStroke) keyStrokes.get(keyStrokes.size() - 1)).isComplete();
+ }
+
+ /**
+ * Returns whether or not this key sequence is empty. Key sequences are complete
+ * iff they have no key strokes.
+ *
+ * @return <code>true</code>, iff the key sequence is empty.
+ */
+ public boolean isEmpty() {
+ return keyStrokes.isEmpty();
+ }
+
+ /**
+ * Returns whether or not this key sequence starts with the given key sequence.
+ *
+ * @param keySequence a key sequence. Must not be <code>null</code>.
+ * @param equals whether or not an identical key sequence should be
+ * considered as a possible match.
+ * @return <code>true</code>, iff the given key sequence starts with this key
+ * sequence.
+ */
+ public boolean startsWith(KeySequence keySequence, boolean equals) {
+ if (keySequence == null) {
throw new NullPointerException();
}
- return Util.startsWith(keyStrokes, keySequence.keyStrokes, equals);
- }
+ return Util.startsWith(keyStrokes, keySequence.keyStrokes, equals);
+ }
- /**
- * Returns the formal string representation for this key sequence.
- *
- * @return The formal string representation for this key sequence.
- * Guaranteed not to be <code>null</code>.
- */
- @Override
+ /**
+ * Returns the formal string representation for this key sequence.
+ *
+ * @return The formal string representation for this key sequence. Guaranteed
+ * not to be <code>null</code>.
+ */
+ @Override
public String toString() {
- return KeyFormatterFactory.getFormalKeyFormatter().format(this);
- }
+ return KeyFormatterFactory.getFormalKeyFormatter().format(this);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/KeyStroke.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/KeyStroke.java
index c16a10b32a4..482a77e1123 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/KeyStroke.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/KeyStroke.java
@@ -26,11 +26,11 @@ import org.eclipse.ui.internal.util.Util;
/**
* <p>
* A <code>KeyStroke</code> is defined as an optional set of modifier keys
- * followed optionally by a natural key. A <code>KeyStroke</code> is said to
- * be complete if it contains a natural key. A natural key is any Unicode
- * character (e.g., "backspace", etc.), any character belonging to a natural
- * language (e.g., "A", "1", "[", etc.), or any special control character
- * specific to computers (e.g., "F10", "PageUp", etc.).
+ * followed optionally by a natural key. A <code>KeyStroke</code> is said to be
+ * complete if it contains a natural key. A natural key is any Unicode character
+ * (e.g., "backspace", etc.), any character belonging to a natural language
+ * (e.g., "A", "1", "[", etc.), or any special control character specific to
+ * computers (e.g., "F10", "PageUp", etc.).
* </p>
* <p>
* All <code>KeyStroke</code> objects have a formal string representation
@@ -56,304 +56,282 @@ import org.eclipse.ui.internal.util.Util;
@Deprecated
public final class KeyStroke implements Comparable {
- /**
- * The delimiter between multiple keys in a single key strokes -- expressed
- * in the formal key stroke grammar. This is not to be displayed to the
- * user. It is only intended as an internal representation.
- */
- public static final String KEY_DELIMITER = "\u002B"; //$NON-NLS-1$
-
- /**
- * An internal constant used only in this object's hash code algorithm.
- */
- private static final int HASH_FACTOR = 89;
-
- /**
- * An internal constant used only in this object's hash code algorithm.
- */
- private static final int HASH_INITIAL = KeyStroke.class.getName()
- .hashCode();
-
- /**
- * The set of delimiters for <code>Key</code> objects allowed during
- * parsing of the formal string representation.
- */
- public static final String KEY_DELIMITERS = KEY_DELIMITER;
-
- /**
- * Gets an instance of <code>KeyStroke</code> given a single modifier key
- * and a natural key.
- *
- * @param modifierKey
- * a modifier key. Must not be <code>null</code>.
- * @param naturalKey
- * the natural key. May be <code>null</code>.
- * @return a key stroke. Guaranteed not to be <code>null</code>.
- */
- public static KeyStroke getInstance(ModifierKey modifierKey,
- NaturalKey naturalKey) {
- if (modifierKey == null) {
+ /**
+ * The delimiter between multiple keys in a single key strokes -- expressed in
+ * the formal key stroke grammar. This is not to be displayed to the user. It is
+ * only intended as an internal representation.
+ */
+ public static final String KEY_DELIMITER = "\u002B"; //$NON-NLS-1$
+
+ /**
+ * An internal constant used only in this object's hash code algorithm.
+ */
+ private static final int HASH_FACTOR = 89;
+
+ /**
+ * An internal constant used only in this object's hash code algorithm.
+ */
+ private static final int HASH_INITIAL = KeyStroke.class.getName().hashCode();
+
+ /**
+ * The set of delimiters for <code>Key</code> objects allowed during parsing of
+ * the formal string representation.
+ */
+ public static final String KEY_DELIMITERS = KEY_DELIMITER;
+
+ /**
+ * Gets an instance of <code>KeyStroke</code> given a single modifier key and a
+ * natural key.
+ *
+ * @param modifierKey a modifier key. Must not be <code>null</code>.
+ * @param naturalKey the natural key. May be <code>null</code>.
+ * @return a key stroke. Guaranteed not to be <code>null</code>.
+ */
+ public static KeyStroke getInstance(ModifierKey modifierKey, NaturalKey naturalKey) {
+ if (modifierKey == null) {
throw new NullPointerException();
}
- return new KeyStroke(
- new TreeSet(Collections.singletonList(modifierKey)), naturalKey);
- }
-
- /**
- * Gets an instance of <code>KeyStroke</code> given an array of modifier
- * keys and a natural key.
- *
- * @param modifierKeys
- * the array of modifier keys. This array may be empty, but it
- * must not be <code>null</code>. If this array is not empty,
- * it must not contain <code>null</code> elements.
- * @param naturalKey
- * the natural key. May be <code>null</code>.
- * @return a key stroke. Guaranteed not to be <code>null</code>.
- */
- public static KeyStroke getInstance(ModifierKey[] modifierKeys,
- NaturalKey naturalKey) {
- Util.assertInstance(modifierKeys, ModifierKey.class);
- return new KeyStroke(new TreeSet(Arrays.asList(modifierKeys)),
- naturalKey);
- }
-
- /**
- * Gets an instance of <code>KeyStroke</code> given a natural key.
- *
- * @param naturalKey
- * the natural key. May be <code>null</code>.
- * @return a key stroke. This key stroke will have no modifier keys.
- * Guaranteed not to be <code>null</code>.
- */
- public static KeyStroke getInstance(NaturalKey naturalKey) {
- return new KeyStroke(Util.EMPTY_SORTED_SET, naturalKey);
- }
-
- /**
- * Gets an instance of <code>KeyStroke</code> given a set of modifier
- * keys and a natural key.
- *
- * @param modifierKeys
- * the set of modifier keys. This set may be empty, but it must
- * not be <code>null</code>. If this set is not empty, it
- * must only contain instances of <code>ModifierKey</code>.
- * @param naturalKey
- * the natural key. May be <code>null</code>.
- * @return a key stroke. Guaranteed not to be <code>null</code>.
- */
- public static KeyStroke getInstance(SortedSet modifierKeys,
- NaturalKey naturalKey) {
- return new KeyStroke(modifierKeys, naturalKey);
- }
-
- /**
- * Gets an instance of <code>KeyStroke</code> by parsing a given a formal
- * string representation.
- *
- * @param string
- * the formal string representation to parse.
- * @return a key stroke. Guaranteed not to be <code>null</code>.
- * @throws ParseException
- * if the given formal string representation could not be
- * parsed to a valid key stroke.
- */
- public static KeyStroke getInstance(String string) throws ParseException {
- if (string == null) {
+ return new KeyStroke(new TreeSet(Collections.singletonList(modifierKey)), naturalKey);
+ }
+
+ /**
+ * Gets an instance of <code>KeyStroke</code> given an array of modifier keys
+ * and a natural key.
+ *
+ * @param modifierKeys the array of modifier keys. This array may be empty, but
+ * it must not be <code>null</code>. If this array is not
+ * empty, it must not contain <code>null</code> elements.
+ * @param naturalKey the natural key. May be <code>null</code>.
+ * @return a key stroke. Guaranteed not to be <code>null</code>.
+ */
+ public static KeyStroke getInstance(ModifierKey[] modifierKeys, NaturalKey naturalKey) {
+ Util.assertInstance(modifierKeys, ModifierKey.class);
+ return new KeyStroke(new TreeSet(Arrays.asList(modifierKeys)), naturalKey);
+ }
+
+ /**
+ * Gets an instance of <code>KeyStroke</code> given a natural key.
+ *
+ * @param naturalKey the natural key. May be <code>null</code>.
+ * @return a key stroke. This key stroke will have no modifier keys. Guaranteed
+ * not to be <code>null</code>.
+ */
+ public static KeyStroke getInstance(NaturalKey naturalKey) {
+ return new KeyStroke(Util.EMPTY_SORTED_SET, naturalKey);
+ }
+
+ /**
+ * Gets an instance of <code>KeyStroke</code> given a set of modifier keys and a
+ * natural key.
+ *
+ * @param modifierKeys the set of modifier keys. This set may be empty, but it
+ * must not be <code>null</code>. If this set is not empty,
+ * it must only contain instances of
+ * <code>ModifierKey</code>.
+ * @param naturalKey the natural key. May be <code>null</code>.
+ * @return a key stroke. Guaranteed not to be <code>null</code>.
+ */
+ public static KeyStroke getInstance(SortedSet modifierKeys, NaturalKey naturalKey) {
+ return new KeyStroke(modifierKeys, naturalKey);
+ }
+
+ /**
+ * Gets an instance of <code>KeyStroke</code> by parsing a given a formal string
+ * representation.
+ *
+ * @param string the formal string representation to parse.
+ * @return a key stroke. Guaranteed not to be <code>null</code>.
+ * @throws ParseException if the given formal string representation could not be
+ * parsed to a valid key stroke.
+ */
+ public static KeyStroke getInstance(String string) throws ParseException {
+ if (string == null) {
throw new NullPointerException();
}
- SortedSet modifierKeys = new TreeSet();
- NaturalKey naturalKey = null;
- StringTokenizer stringTokenizer = new StringTokenizer(string,
- KEY_DELIMITERS, true);
- int i = 0;
+ SortedSet modifierKeys = new TreeSet();
+ NaturalKey naturalKey = null;
+ StringTokenizer stringTokenizer = new StringTokenizer(string, KEY_DELIMITERS, true);
+ int i = 0;
- while (stringTokenizer.hasMoreTokens()) {
- String token = stringTokenizer.nextToken();
+ while (stringTokenizer.hasMoreTokens()) {
+ String token = stringTokenizer.nextToken();
- if (i % 2 == 0) {
- if (stringTokenizer.hasMoreTokens()) {
+ if (i % 2 == 0) {
+ if (stringTokenizer.hasMoreTokens()) {
token = token.toUpperCase(Locale.ENGLISH);
- ModifierKey modifierKey = (ModifierKey) ModifierKey.modifierKeysByName
- .get(token);
+ ModifierKey modifierKey = (ModifierKey) ModifierKey.modifierKeysByName.get(token);
- if (modifierKey == null || !modifierKeys.add(modifierKey)) {
+ if (modifierKey == null || !modifierKeys.add(modifierKey)) {
throw new ParseException(
- "Cannot create key stroke with duplicate or non-existent modifier key: " //$NON-NLS-1$
- + token);
+ "Cannot create key stroke with duplicate or non-existent modifier key: " //$NON-NLS-1$
+ + token);
}
- } else if (token.length() == 1) {
- naturalKey = CharacterKey.getInstance(token.charAt(0));
- break;
- } else {
+ } else if (token.length() == 1) {
+ naturalKey = CharacterKey.getInstance(token.charAt(0));
+ break;
+ } else {
token = token.toUpperCase(Locale.ENGLISH);
- naturalKey = (NaturalKey) CharacterKey.characterKeysByName
- .get(token);
+ naturalKey = (NaturalKey) CharacterKey.characterKeysByName.get(token);
- if (naturalKey == null) {
- naturalKey = (NaturalKey) SpecialKey.specialKeysByName
- .get(token);
+ if (naturalKey == null) {
+ naturalKey = (NaturalKey) SpecialKey.specialKeysByName.get(token);
}
- if (naturalKey == null) {
- throw new ParseException(
- "Cannot create key stroke with invalid natural key: " //$NON-NLS-1$
- + token);
+ if (naturalKey == null) {
+ throw new ParseException("Cannot create key stroke with invalid natural key: " //$NON-NLS-1$
+ + token);
}
- }
- }
-
- i++;
- }
-
- try {
- return new KeyStroke(modifierKeys, naturalKey);
- } catch (Throwable t) {
- throw new ParseException("Cannot create key stroke with " //$NON-NLS-1$
- + modifierKeys + " and " + naturalKey); //$NON-NLS-1$
- }
- }
-
- /**
- * The cached hash code for this object. Because <code>KeyStroke</code>
- * objects are immutable, their hash codes need only to be computed once.
- * After the first call to <code>hashCode()</code>, the computed value
- * is cached here for all subsequent calls.
- */
- private transient int hashCode;
-
- /**
- * A flag to determine if the <code>hashCode</code> field has already
- * been computed.
- */
- private transient boolean hashCodeComputed;
-
- /**
- * The set of modifier keys for this key stroke.
- */
- private SortedSet modifierKeys;
-
- /**
- * The set of modifier keys for this key stroke in the form of an array.
- * Used internally by <code>int compareTo(Object)</code>.
- */
- private transient ModifierKey[] modifierKeysAsArray;
-
- /**
- * The natural key for this key stroke.
- */
- private NaturalKey naturalKey;
-
- /**
- * Constructs an instance of <code>KeyStroke</code> given a set of
- * modifier keys and a natural key.
- *
- * @param modifierKeys
- * the set of modifier keys. This set may be empty, but it must
- * not be <code>null</code>. If this set is not empty, it
- * must only contain instances of <code>ModifierKey</code>.
- * @param naturalKey
- * the natural key. May be <code>null</code>.
- */
- private KeyStroke(SortedSet modifierKeys, NaturalKey naturalKey) {
- this.modifierKeys = Util.safeCopy(modifierKeys, ModifierKey.class);
- this.naturalKey = naturalKey;
- this.modifierKeysAsArray = (ModifierKey[]) this.modifierKeys
- .toArray(new ModifierKey[this.modifierKeys.size()]);
- }
-
- /**
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- */
- @Override
+ }
+ }
+
+ i++;
+ }
+
+ try {
+ return new KeyStroke(modifierKeys, naturalKey);
+ } catch (Throwable t) {
+ throw new ParseException("Cannot create key stroke with " //$NON-NLS-1$
+ + modifierKeys + " and " + naturalKey); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * The cached hash code for this object. Because <code>KeyStroke</code> objects
+ * are immutable, their hash codes need only to be computed once. After the
+ * first call to <code>hashCode()</code>, the computed value is cached here for
+ * all subsequent calls.
+ */
+ private transient int hashCode;
+
+ /**
+ * A flag to determine if the <code>hashCode</code> field has already been
+ * computed.
+ */
+ private transient boolean hashCodeComputed;
+
+ /**
+ * The set of modifier keys for this key stroke.
+ */
+ private SortedSet modifierKeys;
+
+ /**
+ * The set of modifier keys for this key stroke in the form of an array. Used
+ * internally by <code>int compareTo(Object)</code>.
+ */
+ private transient ModifierKey[] modifierKeysAsArray;
+
+ /**
+ * The natural key for this key stroke.
+ */
+ private NaturalKey naturalKey;
+
+ /**
+ * Constructs an instance of <code>KeyStroke</code> given a set of modifier keys
+ * and a natural key.
+ *
+ * @param modifierKeys the set of modifier keys. This set may be empty, but it
+ * must not be <code>null</code>. If this set is not empty,
+ * it must only contain instances of
+ * <code>ModifierKey</code>.
+ * @param naturalKey the natural key. May be <code>null</code>.
+ */
+ private KeyStroke(SortedSet modifierKeys, NaturalKey naturalKey) {
+ this.modifierKeys = Util.safeCopy(modifierKeys, ModifierKey.class);
+ this.naturalKey = naturalKey;
+ this.modifierKeysAsArray = (ModifierKey[]) this.modifierKeys.toArray(new ModifierKey[this.modifierKeys.size()]);
+ }
+
+ /**
+ * @see java.lang.Comparable#compareTo(java.lang.Object)
+ */
+ @Override
public int compareTo(Object object) {
- KeyStroke castedObject = (KeyStroke) object;
- int compareTo = Util.compare(modifierKeysAsArray,
- castedObject.modifierKeysAsArray);
+ KeyStroke castedObject = (KeyStroke) object;
+ int compareTo = Util.compare(modifierKeysAsArray, castedObject.modifierKeysAsArray);
- if (compareTo == 0) {
+ if (compareTo == 0) {
compareTo = Util.compare(naturalKey, castedObject.naturalKey);
}
- return compareTo;
- }
+ return compareTo;
+ }
- @Override
+ @Override
public boolean equals(Object object) {
- if (!(object instanceof KeyStroke)) {
+ if (!(object instanceof KeyStroke)) {
return false;
}
- KeyStroke castedObject = (KeyStroke) object;
+ KeyStroke castedObject = (KeyStroke) object;
- if (!modifierKeys.equals(castedObject.modifierKeys)) {
+ if (!modifierKeys.equals(castedObject.modifierKeys)) {
return false;
}
- return Util.equals(naturalKey, castedObject.naturalKey);
- }
-
- /**
- * Formats this key stroke into the current default look.
- *
- * @return A string representation for this key stroke using the default
- * look; never <code>null</code>.
- */
- public String format() {
- return KeyFormatterFactory.getDefault().format(this);
- }
-
- /**
- * Returns the set of modifier keys for this key stroke.
- *
- * @return the set of modifier keys. This set may be empty, but is
- * guaranteed not to be <code>null</code>. If this set is not
- * empty, it is guaranteed to only contain instances of <code>ModifierKey</code>.
- */
- public Set getModifierKeys() {
- return Collections.unmodifiableSet(modifierKeys);
- }
-
- /**
- * Returns the natural key for this key stroke.
- *
- * @return the natural key. May be <code>null</code>.
- */
- public NaturalKey getNaturalKey() {
- return naturalKey;
- }
-
- @Override
+ return Util.equals(naturalKey, castedObject.naturalKey);
+ }
+
+ /**
+ * Formats this key stroke into the current default look.
+ *
+ * @return A string representation for this key stroke using the default look;
+ * never <code>null</code>.
+ */
+ public String format() {
+ return KeyFormatterFactory.getDefault().format(this);
+ }
+
+ /**
+ * Returns the set of modifier keys for this key stroke.
+ *
+ * @return the set of modifier keys. This set may be empty, but is guaranteed
+ * not to be <code>null</code>. If this set is not empty, it is
+ * guaranteed to only contain instances of <code>ModifierKey</code>.
+ */
+ public Set getModifierKeys() {
+ return Collections.unmodifiableSet(modifierKeys);
+ }
+
+ /**
+ * Returns the natural key for this key stroke.
+ *
+ * @return the natural key. May be <code>null</code>.
+ */
+ public NaturalKey getNaturalKey() {
+ return naturalKey;
+ }
+
+ @Override
public int hashCode() {
- if (!hashCodeComputed) {
- hashCode = HASH_INITIAL;
- hashCode = hashCode * HASH_FACTOR + modifierKeys.hashCode();
- hashCode = hashCode * HASH_FACTOR + Util.hashCode(naturalKey);
- hashCodeComputed = true;
- }
-
- return hashCode;
- }
-
- /**
- * Returns whether or not this key stroke is complete. Key strokes are
- * complete iff they have a natural key which is not <code>null</code>.
- *
- * @return <code>true</code>, iff the key stroke is complete.
- */
- public boolean isComplete() {
- return naturalKey != null;
- }
-
- /**
- * Returns the formal string representation for this key stroke.
- *
- * @return The formal string representation for this key stroke. Guaranteed
- * not to be <code>null</code>.
- */
- @Override
+ if (!hashCodeComputed) {
+ hashCode = HASH_INITIAL;
+ hashCode = hashCode * HASH_FACTOR + modifierKeys.hashCode();
+ hashCode = hashCode * HASH_FACTOR + Util.hashCode(naturalKey);
+ hashCodeComputed = true;
+ }
+
+ return hashCode;
+ }
+
+ /**
+ * Returns whether or not this key stroke is complete. Key strokes are complete
+ * iff they have a natural key which is not <code>null</code>.
+ *
+ * @return <code>true</code>, iff the key stroke is complete.
+ */
+ public boolean isComplete() {
+ return naturalKey != null;
+ }
+
+ /**
+ * Returns the formal string representation for this key stroke.
+ *
+ * @return The formal string representation for this key stroke. Guaranteed not
+ * to be <code>null</code>.
+ */
+ @Override
public String toString() {
- return KeyFormatterFactory.getFormalKeyFormatter().format(this);
- }
+ return KeyFormatterFactory.getFormalKeyFormatter().format(this);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/ModifierKey.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/ModifierKey.java
index 41be4390e35..f0bd6870855 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/ModifierKey.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/ModifierKey.java
@@ -23,14 +23,13 @@ import org.eclipse.jface.util.Util;
/**
* <p>
- * Instances of <code>ModifierKey</code> represent the four keys on the
- * keyboard recognized by convention as 'modifier keys', those keys typically
- * pressed in combination with themselves and/or a
- * {@link org.eclipse.ui.keys.NaturalKey}.
+ * Instances of <code>ModifierKey</code> represent the four keys on the keyboard
+ * recognized by convention as 'modifier keys', those keys typically pressed in
+ * combination with themselves and/or a {@link org.eclipse.ui.keys.NaturalKey}.
* </p>
* <p>
- * <code>ModifierKey</code> objects are immutable. Clients are not permitted
- * to extend this class.
+ * <code>ModifierKey</code> objects are immutable. Clients are not permitted to
+ * extend this class.
* </p>
*
* @deprecated Please use org.eclipse.jface.bindings.keys.KeyStroke and
@@ -42,26 +41,26 @@ import org.eclipse.jface.util.Util;
public final class ModifierKey extends Key {
/**
- * An internal map used to lookup instances of <code>ModifierKey</code>
- * given the formal string representation of a modifier key.
+ * An internal map used to lookup instances of <code>ModifierKey</code> given
+ * the formal string representation of a modifier key.
*/
static SortedMap modifierKeysByName = new TreeMap();
/**
- * The single static instance of <code>ModifierKey</code> which represents
- * the 'Alt' key.
+ * The single static instance of <code>ModifierKey</code> which represents the
+ * 'Alt' key.
*/
public static final ModifierKey ALT;
/**
- * The single static instance of <code>ModifierKey</code> which represents
- * the 'Command' key.
+ * The single static instance of <code>ModifierKey</code> which represents the
+ * 'Command' key.
*/
public static final ModifierKey COMMAND;
/**
- * The single static instance of <code>ModifierKey</code> which represents
- * the 'Ctrl' key.
+ * The single static instance of <code>ModifierKey</code> which represents the
+ * 'Ctrl' key.
*/
public static final ModifierKey CTRL;
@@ -86,8 +85,8 @@ public final class ModifierKey extends Key {
private static final String M4_NAME = "M4"; //$NON-NLS-1$
/**
- * The single static instance of <code>ModifierKey</code> which represents
- * the 'Shift' key.
+ * The single static instance of <code>ModifierKey</code> which represents the
+ * 'Shift' key.
*/
public static final ModifierKey SHIFT;
@@ -99,27 +98,19 @@ public final class ModifierKey extends Key {
SHIFT = new ModifierKey(lookup.getShift());
modifierKeysByName.put(ModifierKey.ALT.toString(), ModifierKey.ALT);
- modifierKeysByName.put(ModifierKey.COMMAND.toString(),
- ModifierKey.COMMAND);
+ modifierKeysByName.put(ModifierKey.COMMAND.toString(), ModifierKey.COMMAND);
modifierKeysByName.put(ModifierKey.CTRL.toString(), ModifierKey.CTRL);
modifierKeysByName.put(ModifierKey.SHIFT.toString(), ModifierKey.SHIFT);
- modifierKeysByName
- .put(
- M1_NAME,
- Util.isMac() ? ModifierKey.COMMAND : ModifierKey.CTRL);
+ modifierKeysByName.put(M1_NAME, Util.isMac() ? ModifierKey.COMMAND : ModifierKey.CTRL);
modifierKeysByName.put(M2_NAME, ModifierKey.SHIFT);
modifierKeysByName.put(M3_NAME, ModifierKey.ALT);
- modifierKeysByName
- .put(
- M4_NAME,
- Util.isMac() ? ModifierKey.CTRL : ModifierKey.COMMAND);
+ modifierKeysByName.put(M4_NAME, Util.isMac() ? ModifierKey.CTRL : ModifierKey.COMMAND);
}
/**
* Constructs an instance of <code>ModifierKey</code> given a name.
*
- * @param key
- * The key which this key wraps.
+ * @param key The key which this key wraps.
*/
private ModifierKey(final int key) {
super(key);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/NaturalKey.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/NaturalKey.java
index cbc2bb84cf4..d1dea6fc0c1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/NaturalKey.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/NaturalKey.java
@@ -38,8 +38,7 @@ public abstract class NaturalKey extends Key {
/**
* Constructs an instance of <code>NaturalKey</code> given a name.
*
- * @param key
- * The key to be wrapped.
+ * @param key The key to be wrapped.
*/
NaturalKey(final int key) {
super(key);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/ParseException.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/ParseException.java
index c4bbd96478c..cc6faa670f5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/ParseException.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/ParseException.java
@@ -20,8 +20,8 @@ package org.eclipse.ui.keys;
* of either <code>KeyStroke</code> or <code>KeySequence</code> objects.
* </p>
* <p>
- * <code>ParseException</code> objects are immutable. Clients are not
- * permitted to extend this class.
+ * <code>ParseException</code> objects are immutable. Clients are not permitted
+ * to extend this class.
* </p>
*
* @deprecated Please use org.eclipse.jface.bindings.keys.ParseException
@@ -30,20 +30,19 @@ package org.eclipse.ui.keys;
@Deprecated
public final class ParseException extends Exception {
- /**
- * Generated serial version UID for this class.
- * @since 3.1
- */
- private static final long serialVersionUID = 3257009864814376241L;
+ /**
+ * Generated serial version UID for this class.
+ *
+ * @since 3.1
+ */
+ private static final long serialVersionUID = 3257009864814376241L;
- /**
- * Constructs a <code>ParseException</code> with the specified detail
- * message.
- *
- * @param s
- * the detail message.
- */
- public ParseException(final String s) {
- super(s);
- }
+ /**
+ * Constructs a <code>ParseException</code> with the specified detail message.
+ *
+ * @param s the detail message.
+ */
+ public ParseException(final String s) {
+ super(s);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/SWTKeySupport.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/SWTKeySupport.java
index a438df01aa9..c2f1ea5d243 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/SWTKeySupport.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/SWTKeySupport.java
@@ -31,310 +31,297 @@ import org.eclipse.ui.internal.keys.NativeKeyFormatter;
@Deprecated
public final class SWTKeySupport {
- /**
- * Given an SWT accelerator value, provide the corresponding key stroke.
- *
- * @param accelerator
- * The accelerator to convert; should be a valid SWT accelerator
- * value.
- * @return The equivalent key stroke; never <code>null</code>.
- */
- public static KeyStroke convertAcceleratorToKeyStroke(int accelerator) {
- final SortedSet modifierKeys = new TreeSet();
+ /**
+ * Given an SWT accelerator value, provide the corresponding key stroke.
+ *
+ * @param accelerator The accelerator to convert; should be a valid SWT
+ * accelerator value.
+ * @return The equivalent key stroke; never <code>null</code>.
+ */
+ public static KeyStroke convertAcceleratorToKeyStroke(int accelerator) {
+ final SortedSet modifierKeys = new TreeSet();
NaturalKey naturalKey;
- if ((accelerator & SWT.ALT) != 0) {
+ if ((accelerator & SWT.ALT) != 0) {
modifierKeys.add(ModifierKey.ALT);
}
- if ((accelerator & SWT.COMMAND) != 0) {
+ if ((accelerator & SWT.COMMAND) != 0) {
modifierKeys.add(ModifierKey.COMMAND);
}
- if ((accelerator & SWT.CTRL) != 0) {
+ if ((accelerator & SWT.CTRL) != 0) {
modifierKeys.add(ModifierKey.CTRL);
}
- if ((accelerator & SWT.SHIFT) != 0) {
+ if ((accelerator & SWT.SHIFT) != 0) {
modifierKeys.add(ModifierKey.SHIFT);
}
- if (((accelerator & SWT.KEY_MASK) == 0) && (accelerator != 0)) {
- // There were only accelerators
- naturalKey = null;
- } else {
- // There were other keys.
- accelerator &= SWT.KEY_MASK;
-
- switch (accelerator) {
- case SWT.ARROW_DOWN:
- naturalKey = SpecialKey.ARROW_DOWN;
- break;
- case SWT.ARROW_LEFT:
- naturalKey = SpecialKey.ARROW_LEFT;
- break;
- case SWT.ARROW_RIGHT:
- naturalKey = SpecialKey.ARROW_RIGHT;
- break;
- case SWT.ARROW_UP:
- naturalKey = SpecialKey.ARROW_UP;
- break;
- case SWT.BREAK:
- naturalKey = SpecialKey.BREAK;
- break;
- case SWT.CAPS_LOCK:
- naturalKey = SpecialKey.CAPS_LOCK;
- break;
- case SWT.END:
- naturalKey = SpecialKey.END;
- break;
- case SWT.F1:
- naturalKey = SpecialKey.F1;
- break;
- case SWT.F10:
- naturalKey = SpecialKey.F10;
- break;
- case SWT.F11:
- naturalKey = SpecialKey.F11;
- break;
- case SWT.F12:
- naturalKey = SpecialKey.F12;
- break;
- case SWT.F2:
- naturalKey = SpecialKey.F2;
- break;
- case SWT.F3:
- naturalKey = SpecialKey.F3;
- break;
- case SWT.F4:
- naturalKey = SpecialKey.F4;
- break;
- case SWT.F5:
- naturalKey = SpecialKey.F5;
- break;
- case SWT.F6:
- naturalKey = SpecialKey.F6;
- break;
- case SWT.F7:
- naturalKey = SpecialKey.F7;
- break;
- case SWT.F8:
- naturalKey = SpecialKey.F8;
- break;
- case SWT.F9:
- naturalKey = SpecialKey.F9;
- break;
- case SWT.HOME:
- naturalKey = SpecialKey.HOME;
- break;
- case SWT.INSERT:
- naturalKey = SpecialKey.INSERT;
- break;
- case SWT.KEYPAD_0:
- naturalKey = SpecialKey.NUMPAD_0;
- break;
- case SWT.KEYPAD_1:
- naturalKey = SpecialKey.NUMPAD_1;
- break;
- case SWT.KEYPAD_2:
- naturalKey = SpecialKey.NUMPAD_2;
- break;
- case SWT.KEYPAD_3:
- naturalKey = SpecialKey.NUMPAD_3;
- break;
- case SWT.KEYPAD_4:
- naturalKey = SpecialKey.NUMPAD_4;
- break;
- case SWT.KEYPAD_5:
- naturalKey = SpecialKey.NUMPAD_5;
- break;
- case SWT.KEYPAD_6:
- naturalKey = SpecialKey.NUMPAD_6;
- break;
- case SWT.KEYPAD_7:
- naturalKey = SpecialKey.NUMPAD_7;
- break;
- case SWT.KEYPAD_8:
- naturalKey = SpecialKey.NUMPAD_8;
- break;
- case SWT.KEYPAD_9:
- naturalKey = SpecialKey.NUMPAD_9;
- break;
- case SWT.KEYPAD_ADD:
- naturalKey = SpecialKey.NUMPAD_ADD;
- break;
- case SWT.KEYPAD_CR:
- naturalKey = SpecialKey.NUMPAD_ENTER;
- break;
- case SWT.KEYPAD_DECIMAL:
- naturalKey = SpecialKey.NUMPAD_DECIMAL;
- break;
- case SWT.KEYPAD_DIVIDE:
- naturalKey = SpecialKey.NUMPAD_DIVIDE;
- break;
- case SWT.KEYPAD_EQUAL:
- naturalKey = SpecialKey.NUMPAD_EQUAL;
- break;
- case SWT.KEYPAD_MULTIPLY:
- naturalKey = SpecialKey.NUMPAD_MULTIPLY;
- break;
- case SWT.KEYPAD_SUBTRACT:
- naturalKey = SpecialKey.NUMPAD_SUBTRACT;
- break;
- case SWT.NUM_LOCK:
- naturalKey = SpecialKey.NUM_LOCK;
- break;
- case SWT.PAGE_DOWN:
- naturalKey = SpecialKey.PAGE_DOWN;
- break;
- case SWT.PAGE_UP:
- naturalKey = SpecialKey.PAGE_UP;
- break;
- case SWT.PAUSE:
- naturalKey = SpecialKey.PAUSE;
- break;
- case SWT.PRINT_SCREEN:
- naturalKey = SpecialKey.PRINT_SCREEN;
- break;
- case SWT.SCROLL_LOCK:
- naturalKey = SpecialKey.SCROLL_LOCK;
- break;
- default:
- naturalKey = CharacterKey
- .getInstance((char) (accelerator & 0xFFFF));
- }
- }
-
- return KeyStroke.getInstance(modifierKeys, naturalKey);
- }
-
- /**
- * <p>
- * Converts the given event into an SWT accelerator value -- considering the
- * modified character with the shift modifier. This is the third accelerator
- * value that should be checked.
- * </p>
- * <p>
- * For example, on a standard US keyboard, "Ctrl+Shift+5" would be viewed as
- * "Ctrl+Shift+%".
- * </p>
- *
- * @param event
- * The event to be converted; must not be <code>null</code>.
- * @return The combination of the state mask and the unmodified character.
- */
- public static int convertEventToModifiedAccelerator(Event event) {
- int modifiers = event.stateMask & SWT.MODIFIER_MASK;
- char character = topKey(event);
- return modifiers + toUpperCase(character);
- }
-
- /**
- * <p>
- * Converts the given event into an SWT accelerator value -- considering the
- * unmodified character with all modifier keys. This is the first
- * accelerator value that should be checked. However, all alphabetic
- * characters are considered as their uppercase equivalents.
- * </p>
- * <p>
- * For example, on a standard US keyboard, "Ctrl+Shift+5" would be viewed as
- * "Ctrl+Shift+5".
- * </p>
- *
- * @param event
- * The event to be converted; must not be <code>null</code>.
- * @return The combination of the state mask and the unmodified character.
- */
- public static int convertEventToUnmodifiedAccelerator(Event event) {
- return convertEventToUnmodifiedAccelerator(event.stateMask,
- event.keyCode);
- }
-
- /**
- * <p>
- * Converts the given state mask and key code into an SWT accelerator value --
- * considering the unmodified character with all modifier keys. All
- * alphabetic characters are considered as their uppercase equivalents.
- * </p>
- * <p>
- * For example, on a standard US keyboard, "Ctrl+Shift+5" would be viewed as
- * "Ctrl+Shift+5".
- * </p>
- *
- * @param stateMask
- * The integer mask of modifiers keys depressed when this was
- * pressed.
- * @param keyCode
- * The key that was pressed, before being modified.
- * @return The combination of the state mask and the unmodified character.
- */
- private static int convertEventToUnmodifiedAccelerator(int stateMask,
- int keyCode) {
- int modifiers = stateMask & SWT.MODIFIER_MASK;
- int character = keyCode;
- return modifiers + toUpperCase(character);
- }
-
- /**
- * <p>
- * Converts the given event into an SWT accelerator value -- considering the
- * unmodified character with all modifier keys. This is the first
- * accelerator value that should be checked. However, all alphabetic
- * characters are considered as their uppercase equivalents.
- * </p>
- * <p>
- * For example, on a standard US keyboard, "Ctrl+Shift+5" would be viewed as
- * "Ctrl+%".
- * </p>
- *
- * @param event
- * The event to be converted; must not be <code>null</code>.
- * @return The combination of the state mask and the unmodified character.
- */
- public static int convertEventToUnmodifiedAccelerator(KeyEvent event) {
- return convertEventToUnmodifiedAccelerator(event.stateMask,
- event.keyCode);
- }
-
- /**
- * Converts the given event into an SWT accelerator value -- considering
- * the modified character without the shift modifier. This is the second
- * accelerator value that should be checked. Key strokes with alphabetic
- * natural keys are run through <code>convertEventToUnmodifiedAccelerator</code>
- *
- * @param event
- * The event to be converted; must not be <code>null</code>.
- * @return The combination of the state mask without shift, and the
- * modified character.
- */
- public static int convertEventToUnshiftedModifiedAccelerator(Event event) {
- // Disregard alphabetic key strokes.
- if (Character.isLetter((char) event.keyCode)) {
- return convertEventToUnmodifiedAccelerator(event);
- }
-
- int modifiers = event.stateMask & (SWT.MODIFIER_MASK ^ SWT.SHIFT);
- char character = topKey(event);
- return modifiers + toUpperCase(character);
- }
-
- /**
- * Given a key stroke, this method provides the equivalent SWT accelerator
- * value. The functional inverse of <code>convertAcceleratorToKeyStroke</code>.
- *
- * @param keyStroke
- * The key stroke to convert; must not be <code>null</code>.
- * @return The SWT accelerator value
- */
- public static int convertKeyStrokeToAccelerator(
- final KeyStroke keyStroke) {
- int accelerator = 0;
- final Iterator iterator = keyStroke.getModifierKeys().iterator();
-
- while (iterator.hasNext()) {
- final ModifierKey modifierKey = (ModifierKey) iterator.next();
-
- if (modifierKey == ModifierKey.ALT) {
+ if (((accelerator & SWT.KEY_MASK) == 0) && (accelerator != 0)) {
+ // There were only accelerators
+ naturalKey = null;
+ } else {
+ // There were other keys.
+ accelerator &= SWT.KEY_MASK;
+
+ switch (accelerator) {
+ case SWT.ARROW_DOWN:
+ naturalKey = SpecialKey.ARROW_DOWN;
+ break;
+ case SWT.ARROW_LEFT:
+ naturalKey = SpecialKey.ARROW_LEFT;
+ break;
+ case SWT.ARROW_RIGHT:
+ naturalKey = SpecialKey.ARROW_RIGHT;
+ break;
+ case SWT.ARROW_UP:
+ naturalKey = SpecialKey.ARROW_UP;
+ break;
+ case SWT.BREAK:
+ naturalKey = SpecialKey.BREAK;
+ break;
+ case SWT.CAPS_LOCK:
+ naturalKey = SpecialKey.CAPS_LOCK;
+ break;
+ case SWT.END:
+ naturalKey = SpecialKey.END;
+ break;
+ case SWT.F1:
+ naturalKey = SpecialKey.F1;
+ break;
+ case SWT.F10:
+ naturalKey = SpecialKey.F10;
+ break;
+ case SWT.F11:
+ naturalKey = SpecialKey.F11;
+ break;
+ case SWT.F12:
+ naturalKey = SpecialKey.F12;
+ break;
+ case SWT.F2:
+ naturalKey = SpecialKey.F2;
+ break;
+ case SWT.F3:
+ naturalKey = SpecialKey.F3;
+ break;
+ case SWT.F4:
+ naturalKey = SpecialKey.F4;
+ break;
+ case SWT.F5:
+ naturalKey = SpecialKey.F5;
+ break;
+ case SWT.F6:
+ naturalKey = SpecialKey.F6;
+ break;
+ case SWT.F7:
+ naturalKey = SpecialKey.F7;
+ break;
+ case SWT.F8:
+ naturalKey = SpecialKey.F8;
+ break;
+ case SWT.F9:
+ naturalKey = SpecialKey.F9;
+ break;
+ case SWT.HOME:
+ naturalKey = SpecialKey.HOME;
+ break;
+ case SWT.INSERT:
+ naturalKey = SpecialKey.INSERT;
+ break;
+ case SWT.KEYPAD_0:
+ naturalKey = SpecialKey.NUMPAD_0;
+ break;
+ case SWT.KEYPAD_1:
+ naturalKey = SpecialKey.NUMPAD_1;
+ break;
+ case SWT.KEYPAD_2:
+ naturalKey = SpecialKey.NUMPAD_2;
+ break;
+ case SWT.KEYPAD_3:
+ naturalKey = SpecialKey.NUMPAD_3;
+ break;
+ case SWT.KEYPAD_4:
+ naturalKey = SpecialKey.NUMPAD_4;
+ break;
+ case SWT.KEYPAD_5:
+ naturalKey = SpecialKey.NUMPAD_5;
+ break;
+ case SWT.KEYPAD_6:
+ naturalKey = SpecialKey.NUMPAD_6;
+ break;
+ case SWT.KEYPAD_7:
+ naturalKey = SpecialKey.NUMPAD_7;
+ break;
+ case SWT.KEYPAD_8:
+ naturalKey = SpecialKey.NUMPAD_8;
+ break;
+ case SWT.KEYPAD_9:
+ naturalKey = SpecialKey.NUMPAD_9;
+ break;
+ case SWT.KEYPAD_ADD:
+ naturalKey = SpecialKey.NUMPAD_ADD;
+ break;
+ case SWT.KEYPAD_CR:
+ naturalKey = SpecialKey.NUMPAD_ENTER;
+ break;
+ case SWT.KEYPAD_DECIMAL:
+ naturalKey = SpecialKey.NUMPAD_DECIMAL;
+ break;
+ case SWT.KEYPAD_DIVIDE:
+ naturalKey = SpecialKey.NUMPAD_DIVIDE;
+ break;
+ case SWT.KEYPAD_EQUAL:
+ naturalKey = SpecialKey.NUMPAD_EQUAL;
+ break;
+ case SWT.KEYPAD_MULTIPLY:
+ naturalKey = SpecialKey.NUMPAD_MULTIPLY;
+ break;
+ case SWT.KEYPAD_SUBTRACT:
+ naturalKey = SpecialKey.NUMPAD_SUBTRACT;
+ break;
+ case SWT.NUM_LOCK:
+ naturalKey = SpecialKey.NUM_LOCK;
+ break;
+ case SWT.PAGE_DOWN:
+ naturalKey = SpecialKey.PAGE_DOWN;
+ break;
+ case SWT.PAGE_UP:
+ naturalKey = SpecialKey.PAGE_UP;
+ break;
+ case SWT.PAUSE:
+ naturalKey = SpecialKey.PAUSE;
+ break;
+ case SWT.PRINT_SCREEN:
+ naturalKey = SpecialKey.PRINT_SCREEN;
+ break;
+ case SWT.SCROLL_LOCK:
+ naturalKey = SpecialKey.SCROLL_LOCK;
+ break;
+ default:
+ naturalKey = CharacterKey.getInstance((char) (accelerator & 0xFFFF));
+ }
+ }
+
+ return KeyStroke.getInstance(modifierKeys, naturalKey);
+ }
+
+ /**
+ * <p>
+ * Converts the given event into an SWT accelerator value -- considering the
+ * modified character with the shift modifier. This is the third accelerator
+ * value that should be checked.
+ * </p>
+ * <p>
+ * For example, on a standard US keyboard, "Ctrl+Shift+5" would be viewed as
+ * "Ctrl+Shift+%".
+ * </p>
+ *
+ * @param event The event to be converted; must not be <code>null</code>.
+ * @return The combination of the state mask and the unmodified character.
+ */
+ public static int convertEventToModifiedAccelerator(Event event) {
+ int modifiers = event.stateMask & SWT.MODIFIER_MASK;
+ char character = topKey(event);
+ return modifiers + toUpperCase(character);
+ }
+
+ /**
+ * <p>
+ * Converts the given event into an SWT accelerator value -- considering the
+ * unmodified character with all modifier keys. This is the first accelerator
+ * value that should be checked. However, all alphabetic characters are
+ * considered as their uppercase equivalents.
+ * </p>
+ * <p>
+ * For example, on a standard US keyboard, "Ctrl+Shift+5" would be viewed as
+ * "Ctrl+Shift+5".
+ * </p>
+ *
+ * @param event The event to be converted; must not be <code>null</code>.
+ * @return The combination of the state mask and the unmodified character.
+ */
+ public static int convertEventToUnmodifiedAccelerator(Event event) {
+ return convertEventToUnmodifiedAccelerator(event.stateMask, event.keyCode);
+ }
+
+ /**
+ * <p>
+ * Converts the given state mask and key code into an SWT accelerator value --
+ * considering the unmodified character with all modifier keys. All alphabetic
+ * characters are considered as their uppercase equivalents.
+ * </p>
+ * <p>
+ * For example, on a standard US keyboard, "Ctrl+Shift+5" would be viewed as
+ * "Ctrl+Shift+5".
+ * </p>
+ *
+ * @param stateMask The integer mask of modifiers keys depressed when this was
+ * pressed.
+ * @param keyCode The key that was pressed, before being modified.
+ * @return The combination of the state mask and the unmodified character.
+ */
+ private static int convertEventToUnmodifiedAccelerator(int stateMask, int keyCode) {
+ int modifiers = stateMask & SWT.MODIFIER_MASK;
+ int character = keyCode;
+ return modifiers + toUpperCase(character);
+ }
+
+ /**
+ * <p>
+ * Converts the given event into an SWT accelerator value -- considering the
+ * unmodified character with all modifier keys. This is the first accelerator
+ * value that should be checked. However, all alphabetic characters are
+ * considered as their uppercase equivalents.
+ * </p>
+ * <p>
+ * For example, on a standard US keyboard, "Ctrl+Shift+5" would be viewed as
+ * "Ctrl+%".
+ * </p>
+ *
+ * @param event The event to be converted; must not be <code>null</code>.
+ * @return The combination of the state mask and the unmodified character.
+ */
+ public static int convertEventToUnmodifiedAccelerator(KeyEvent event) {
+ return convertEventToUnmodifiedAccelerator(event.stateMask, event.keyCode);
+ }
+
+ /**
+ * Converts the given event into an SWT accelerator value -- considering the
+ * modified character without the shift modifier. This is the second accelerator
+ * value that should be checked. Key strokes with alphabetic natural keys are
+ * run through <code>convertEventToUnmodifiedAccelerator</code>
+ *
+ * @param event The event to be converted; must not be <code>null</code>.
+ * @return The combination of the state mask without shift, and the modified
+ * character.
+ */
+ public static int convertEventToUnshiftedModifiedAccelerator(Event event) {
+ // Disregard alphabetic key strokes.
+ if (Character.isLetter((char) event.keyCode)) {
+ return convertEventToUnmodifiedAccelerator(event);
+ }
+
+ int modifiers = event.stateMask & (SWT.MODIFIER_MASK ^ SWT.SHIFT);
+ char character = topKey(event);
+ return modifiers + toUpperCase(character);
+ }
+
+ /**
+ * Given a key stroke, this method provides the equivalent SWT accelerator
+ * value. The functional inverse of <code>convertAcceleratorToKeyStroke</code>.
+ *
+ * @param keyStroke The key stroke to convert; must not be <code>null</code>.
+ * @return The SWT accelerator value
+ */
+ public static int convertKeyStrokeToAccelerator(final KeyStroke keyStroke) {
+ int accelerator = 0;
+ final Iterator iterator = keyStroke.getModifierKeys().iterator();
+
+ while (iterator.hasNext()) {
+ final ModifierKey modifierKey = (ModifierKey) iterator.next();
+
+ if (modifierKey == ModifierKey.ALT) {
accelerator |= SWT.ALT;
} else if (modifierKey == ModifierKey.COMMAND) {
accelerator |= SWT.COMMAND;
@@ -343,16 +330,16 @@ public final class SWTKeySupport {
} else if (modifierKey == ModifierKey.SHIFT) {
accelerator |= SWT.SHIFT;
}
- }
+ }
- final NaturalKey naturalKey = keyStroke.getNaturalKey();
+ final NaturalKey naturalKey = keyStroke.getNaturalKey();
- if (naturalKey instanceof CharacterKey) {
+ if (naturalKey instanceof CharacterKey) {
accelerator |= ((CharacterKey) naturalKey).getCharacter();
} else if (naturalKey instanceof SpecialKey) {
- final SpecialKey specialKey = (SpecialKey) naturalKey;
+ final SpecialKey specialKey = (SpecialKey) naturalKey;
- if (specialKey == SpecialKey.ARROW_DOWN) {
+ if (specialKey == SpecialKey.ARROW_DOWN) {
accelerator |= SWT.ARROW_DOWN;
} else if (specialKey == SpecialKey.ARROW_LEFT) {
accelerator |= SWT.ARROW_LEFT;
@@ -395,71 +382,65 @@ public final class SWTKeySupport {
} else if (specialKey == SpecialKey.PAGE_UP) {
accelerator |= SWT.PAGE_UP;
}
- }
-
- return accelerator;
- }
-
- private static final IKeyFormatter NATIVE_FORMATTER = new NativeKeyFormatter();
-
- /**
- * Provides an instance of <code>IKeyFormatter</code> appropriate for the
- * current instance.
- *
- * @return an instance of <code>IKeyFormatter</code> appropriate for the
- * current instance; never <code>null</code>.
- */
- public static IKeyFormatter getKeyFormatterForPlatform() {
- return NATIVE_FORMATTER;
- }
-
- /**
- * Makes sure that a fully-modified character is converted to the normal
- * form. This means that "Ctrl+" key strokes must reverse the modification
- * caused by control-escaping. Also, all lower case letters are converted
- * to uppercase.
- *
- * @param event
- * The event from which the fully-modified character should be
- * pulled.
- * @return The modified character, uppercase and without control-escaping.
- */
- private static char topKey(Event event) {
- char character = event.character;
- boolean ctrlDown = (event.stateMask & SWT.CTRL) != 0;
-
- if (ctrlDown && event.character != event.keyCode
- && event.character < 0x20) {
+ }
+
+ return accelerator;
+ }
+
+ private static final IKeyFormatter NATIVE_FORMATTER = new NativeKeyFormatter();
+
+ /**
+ * Provides an instance of <code>IKeyFormatter</code> appropriate for the
+ * current instance.
+ *
+ * @return an instance of <code>IKeyFormatter</code> appropriate for the current
+ * instance; never <code>null</code>.
+ */
+ public static IKeyFormatter getKeyFormatterForPlatform() {
+ return NATIVE_FORMATTER;
+ }
+
+ /**
+ * Makes sure that a fully-modified character is converted to the normal form.
+ * This means that "Ctrl+" key strokes must reverse the modification caused by
+ * control-escaping. Also, all lower case letters are converted to uppercase.
+ *
+ * @param event The event from which the fully-modified character should be
+ * pulled.
+ * @return The modified character, uppercase and without control-escaping.
+ */
+ private static char topKey(Event event) {
+ char character = event.character;
+ boolean ctrlDown = (event.stateMask & SWT.CTRL) != 0;
+
+ if (ctrlDown && event.character != event.keyCode && event.character < 0x20) {
character += 0x40;
}
- return character;
- }
-
- /**
- * Makes the given character uppercase if it is a letter.
- *
- * @param keyCode
- * The character to convert.
- * @return The uppercase equivalent, if any; otherwise, the character
- * itself.
- */
- private static int toUpperCase(int keyCode) {
- // Will this key code be truncated?
- if (keyCode > 0xFFFF) {
- return keyCode;
- }
-
- // Downcast in safety. Only make characters uppercase.
- char character = (char) keyCode;
- return Character.isLetter(character) ? Character.toUpperCase(character)
- : keyCode;
- }
-
- /**
- * This class should never be instantiated.
- */
- private SWTKeySupport() {
- // This class should never be instantiated.
- }
+ return character;
+ }
+
+ /**
+ * Makes the given character uppercase if it is a letter.
+ *
+ * @param keyCode The character to convert.
+ * @return The uppercase equivalent, if any; otherwise, the character itself.
+ */
+ private static int toUpperCase(int keyCode) {
+ // Will this key code be truncated?
+ if (keyCode > 0xFFFF) {
+ return keyCode;
+ }
+
+ // Downcast in safety. Only make characters uppercase.
+ char character = (char) keyCode;
+ return Character.isLetter(character) ? Character.toUpperCase(character) : keyCode;
+ }
+
+ /**
+ * This class should never be instantiated.
+ */
+ private SWTKeySupport() {
+ // This class should never be instantiated.
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/SpecialKey.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/SpecialKey.java
index 787ca88dedc..dbff02fa97c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/SpecialKey.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/keys/SpecialKey.java
@@ -42,306 +42,301 @@ import org.eclipse.jface.bindings.keys.KeyLookupFactory;
public final class SpecialKey extends NaturalKey {
/**
- * An internal map used to lookup instances of <code>SpecialKey</code>
- * given the formal string representation of a special key.
+ * An internal map used to lookup instances of <code>SpecialKey</code> given the
+ * formal string representation of a special key.
*/
static SortedMap specialKeysByName = new TreeMap();
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'Arrow Down' key.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'Arrow Down' key.
*/
public static final SpecialKey ARROW_DOWN;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'Arrow Left' key.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'Arrow Left' key.
*/
public static final SpecialKey ARROW_LEFT;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'Arrow Right' key.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'Arrow Right' key.
*/
public static final SpecialKey ARROW_RIGHT;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'Arrow Up' key.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'Arrow Up' key.
*/
public static final SpecialKey ARROW_UP;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'Break' key.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'Break' key.
*/
public static final SpecialKey BREAK;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'Caps Lock' key.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'Caps Lock' key.
*/
public static final SpecialKey CAPS_LOCK;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'End' key.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'End' key.
*/
public static final SpecialKey END;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'F1' key.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'F1' key.
*/
public static final SpecialKey F1;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'F10' key.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'F10' key.
*/
public static final SpecialKey F10;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'F11' key.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'F11' key.
*/
public static final SpecialKey F11;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'F12' key.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'F12' key.
*/
public static final SpecialKey F12;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'F13' key.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'F13' key.
*/
public static final SpecialKey F13;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'F14' key.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'F14' key.
*/
public static final SpecialKey F14;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'F15' key.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'F15' key.
*/
public static final SpecialKey F15;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'F2' key.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'F2' key.
*/
public static final SpecialKey F2;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'F3' key.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'F3' key.
*/
public static final SpecialKey F3;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'F4' key.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'F4' key.
*/
public static final SpecialKey F4;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'F5' key.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'F5' key.
*/
public static final SpecialKey F5;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'F6' key.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'F6' key.
*/
public static final SpecialKey F6;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'F7' key.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'F7' key.
*/
public static final SpecialKey F7;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'F8' key.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'F8' key.
*/
public static final SpecialKey F8;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'F9' key.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'F9' key.
*/
public static final SpecialKey F9;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'Home' key.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'Home' key.
*/
public static final SpecialKey HOME;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'Insert' key.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'Insert' key.
*/
public static final SpecialKey INSERT;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'NumLock' key.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'NumLock' key.
*/
public static final SpecialKey NUM_LOCK;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the '0' key on the numpad.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * '0' key on the numpad.
*/
public static final SpecialKey NUMPAD_0;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the '1' key on the numpad.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * '1' key on the numpad.
*/
public static final SpecialKey NUMPAD_1;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the '2' key on the numpad.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * '2' key on the numpad.
*/
public static final SpecialKey NUMPAD_2;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the '3' key on the numpad.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * '3' key on the numpad.
*/
public static final SpecialKey NUMPAD_3;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the '4' key on the numpad.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * '4' key on the numpad.
*/
public static final SpecialKey NUMPAD_4;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the '5' key on the numpad.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * '5' key on the numpad.
*/
public static final SpecialKey NUMPAD_5;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the '6' key on the numpad.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * '6' key on the numpad.
*/
public static final SpecialKey NUMPAD_6;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the '7' key on the numpad.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * '7' key on the numpad.
*/
public static final SpecialKey NUMPAD_7;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the '8' key on the numpad.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * '8' key on the numpad.
*/
public static final SpecialKey NUMPAD_8;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the '9' key on the numpad.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * '9' key on the numpad.
*/
public static final SpecialKey NUMPAD_9;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'Add' key on the numpad.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'Add' key on the numpad.
*/
public static final SpecialKey NUMPAD_ADD;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'Decimal' key on the numpad.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'Decimal' key on the numpad.
*/
public static final SpecialKey NUMPAD_DECIMAL;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'Divide' key on the numpad.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'Divide' key on the numpad.
*/
public static final SpecialKey NUMPAD_DIVIDE;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'Enter' key on the numpad.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'Enter' key on the numpad.
*/
public static final SpecialKey NUMPAD_ENTER;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the '=' key on the numpad.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * '=' key on the numpad.
*/
public static final SpecialKey NUMPAD_EQUAL;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'Multiply' key on the numpad.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'Multiply' key on the numpad.
*/
public static final SpecialKey NUMPAD_MULTIPLY;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'Subtract' key on the numpad.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'Subtract' key on the numpad.
*/
public static final SpecialKey NUMPAD_SUBTRACT;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'Page Down' key.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'Page Down' key.
*/
public static final SpecialKey PAGE_DOWN;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'Page Up' key.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'Page Up' key.
*/
public static final SpecialKey PAGE_UP;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'Pause' key.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'Pause' key.
*/
public static final SpecialKey PAUSE;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'Print Screen' key.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'Print Screen' key.
*/
public static final SpecialKey PRINT_SCREEN;
/**
- * The single static instance of <code>SpecialKey</code> which represents
- * the 'Scroll Lock' key.
+ * The single static instance of <code>SpecialKey</code> which represents the
+ * 'Scroll Lock' key.
*/
public static final SpecialKey SCROLL_LOCK;
static {
final IKeyLookup lookup = KeyLookupFactory.getDefault();
- ARROW_DOWN = new SpecialKey(lookup
- .formalKeyLookup(IKeyLookup.ARROW_DOWN_NAME));
- ARROW_LEFT = new SpecialKey(lookup
- .formalKeyLookup(IKeyLookup.ARROW_LEFT_NAME));
- ARROW_RIGHT = new SpecialKey(lookup
- .formalKeyLookup(IKeyLookup.ARROW_RIGHT_NAME));
- ARROW_UP = new SpecialKey(lookup
- .formalKeyLookup(IKeyLookup.ARROW_UP_NAME));
+ ARROW_DOWN = new SpecialKey(lookup.formalKeyLookup(IKeyLookup.ARROW_DOWN_NAME));
+ ARROW_LEFT = new SpecialKey(lookup.formalKeyLookup(IKeyLookup.ARROW_LEFT_NAME));
+ ARROW_RIGHT = new SpecialKey(lookup.formalKeyLookup(IKeyLookup.ARROW_RIGHT_NAME));
+ ARROW_UP = new SpecialKey(lookup.formalKeyLookup(IKeyLookup.ARROW_UP_NAME));
BREAK = new SpecialKey(lookup.formalKeyLookup(IKeyLookup.BREAK_NAME));
- CAPS_LOCK = new SpecialKey(lookup
- .formalKeyLookup(IKeyLookup.CAPS_LOCK_NAME));
+ CAPS_LOCK = new SpecialKey(lookup.formalKeyLookup(IKeyLookup.CAPS_LOCK_NAME));
END = new SpecialKey(lookup.formalKeyLookup(IKeyLookup.END_NAME));
F1 = new SpecialKey(lookup.formalKeyLookup(IKeyLookup.F1_NAME));
F2 = new SpecialKey(lookup.formalKeyLookup(IKeyLookup.F2_NAME));
@@ -360,63 +355,36 @@ public final class SpecialKey extends NaturalKey {
F15 = new SpecialKey(lookup.formalKeyLookup(IKeyLookup.F15_NAME));
HOME = new SpecialKey(lookup.formalKeyLookup(IKeyLookup.HOME_NAME));
INSERT = new SpecialKey(lookup.formalKeyLookup(IKeyLookup.INSERT_NAME));
- NUM_LOCK = new SpecialKey(lookup
- .formalKeyLookup(IKeyLookup.NUM_LOCK_NAME));
- NUMPAD_0 = new SpecialKey(lookup
- .formalKeyLookup(IKeyLookup.NUMPAD_0_NAME));
- NUMPAD_1 = new SpecialKey(lookup
- .formalKeyLookup(IKeyLookup.NUMPAD_1_NAME));
- NUMPAD_2 = new SpecialKey(lookup
- .formalKeyLookup(IKeyLookup.NUMPAD_2_NAME));
- NUMPAD_3 = new SpecialKey(lookup
- .formalKeyLookup(IKeyLookup.NUMPAD_3_NAME));
- NUMPAD_4 = new SpecialKey(lookup
- .formalKeyLookup(IKeyLookup.NUMPAD_4_NAME));
- NUMPAD_5 = new SpecialKey(lookup
- .formalKeyLookup(IKeyLookup.NUMPAD_5_NAME));
- NUMPAD_6 = new SpecialKey(lookup
- .formalKeyLookup(IKeyLookup.NUMPAD_6_NAME));
- NUMPAD_7 = new SpecialKey(lookup
- .formalKeyLookup(IKeyLookup.NUMPAD_7_NAME));
- NUMPAD_8 = new SpecialKey(lookup
- .formalKeyLookup(IKeyLookup.NUMPAD_8_NAME));
- NUMPAD_9 = new SpecialKey(lookup
- .formalKeyLookup(IKeyLookup.NUMPAD_9_NAME));
- NUMPAD_ADD = new SpecialKey(lookup
- .formalKeyLookup(IKeyLookup.NUMPAD_ADD_NAME));
- NUMPAD_DECIMAL = new SpecialKey(lookup
- .formalKeyLookup(IKeyLookup.NUMPAD_DECIMAL_NAME));
- NUMPAD_DIVIDE = new SpecialKey(lookup
- .formalKeyLookup(IKeyLookup.NUMPAD_DIVIDE_NAME));
- NUMPAD_ENTER = new SpecialKey(lookup
- .formalKeyLookup(IKeyLookup.NUMPAD_ENTER_NAME));
- NUMPAD_EQUAL = new SpecialKey(lookup
- .formalKeyLookup(IKeyLookup.NUMPAD_EQUAL_NAME));
- NUMPAD_MULTIPLY = new SpecialKey(lookup
- .formalKeyLookup(IKeyLookup.NUMPAD_MULTIPLY_NAME));
- NUMPAD_SUBTRACT = new SpecialKey(lookup
- .formalKeyLookup(IKeyLookup.NUMPAD_SUBTRACT_NAME));
- PAGE_DOWN = new SpecialKey(lookup
- .formalKeyLookup(IKeyLookup.PAGE_DOWN_NAME));
- PAGE_UP = new SpecialKey(lookup
- .formalKeyLookup(IKeyLookup.PAGE_UP_NAME));
+ NUM_LOCK = new SpecialKey(lookup.formalKeyLookup(IKeyLookup.NUM_LOCK_NAME));
+ NUMPAD_0 = new SpecialKey(lookup.formalKeyLookup(IKeyLookup.NUMPAD_0_NAME));
+ NUMPAD_1 = new SpecialKey(lookup.formalKeyLookup(IKeyLookup.NUMPAD_1_NAME));
+ NUMPAD_2 = new SpecialKey(lookup.formalKeyLookup(IKeyLookup.NUMPAD_2_NAME));
+ NUMPAD_3 = new SpecialKey(lookup.formalKeyLookup(IKeyLookup.NUMPAD_3_NAME));
+ NUMPAD_4 = new SpecialKey(lookup.formalKeyLookup(IKeyLookup.NUMPAD_4_NAME));
+ NUMPAD_5 = new SpecialKey(lookup.formalKeyLookup(IKeyLookup.NUMPAD_5_NAME));
+ NUMPAD_6 = new SpecialKey(lookup.formalKeyLookup(IKeyLookup.NUMPAD_6_NAME));
+ NUMPAD_7 = new SpecialKey(lookup.formalKeyLookup(IKeyLookup.NUMPAD_7_NAME));
+ NUMPAD_8 = new SpecialKey(lookup.formalKeyLookup(IKeyLookup.NUMPAD_8_NAME));
+ NUMPAD_9 = new SpecialKey(lookup.formalKeyLookup(IKeyLookup.NUMPAD_9_NAME));
+ NUMPAD_ADD = new SpecialKey(lookup.formalKeyLookup(IKeyLookup.NUMPAD_ADD_NAME));
+ NUMPAD_DECIMAL = new SpecialKey(lookup.formalKeyLookup(IKeyLookup.NUMPAD_DECIMAL_NAME));
+ NUMPAD_DIVIDE = new SpecialKey(lookup.formalKeyLookup(IKeyLookup.NUMPAD_DIVIDE_NAME));
+ NUMPAD_ENTER = new SpecialKey(lookup.formalKeyLookup(IKeyLookup.NUMPAD_ENTER_NAME));
+ NUMPAD_EQUAL = new SpecialKey(lookup.formalKeyLookup(IKeyLookup.NUMPAD_EQUAL_NAME));
+ NUMPAD_MULTIPLY = new SpecialKey(lookup.formalKeyLookup(IKeyLookup.NUMPAD_MULTIPLY_NAME));
+ NUMPAD_SUBTRACT = new SpecialKey(lookup.formalKeyLookup(IKeyLookup.NUMPAD_SUBTRACT_NAME));
+ PAGE_DOWN = new SpecialKey(lookup.formalKeyLookup(IKeyLookup.PAGE_DOWN_NAME));
+ PAGE_UP = new SpecialKey(lookup.formalKeyLookup(IKeyLookup.PAGE_UP_NAME));
PAUSE = new SpecialKey(lookup.formalKeyLookup(IKeyLookup.PAUSE_NAME));
- PRINT_SCREEN = new SpecialKey(lookup
- .formalKeyLookup(IKeyLookup.PRINT_SCREEN_NAME));
- SCROLL_LOCK = new SpecialKey(lookup
- .formalKeyLookup(IKeyLookup.SCROLL_LOCK_NAME));
-
- specialKeysByName.put(SpecialKey.ARROW_DOWN.toString(),
- SpecialKey.ARROW_DOWN);
- specialKeysByName.put(SpecialKey.ARROW_LEFT.toString(),
- SpecialKey.ARROW_LEFT);
- specialKeysByName.put(SpecialKey.ARROW_RIGHT.toString(),
- SpecialKey.ARROW_RIGHT);
- specialKeysByName.put(SpecialKey.ARROW_UP.toString(),
- SpecialKey.ARROW_UP);
+ PRINT_SCREEN = new SpecialKey(lookup.formalKeyLookup(IKeyLookup.PRINT_SCREEN_NAME));
+ SCROLL_LOCK = new SpecialKey(lookup.formalKeyLookup(IKeyLookup.SCROLL_LOCK_NAME));
+
+ specialKeysByName.put(SpecialKey.ARROW_DOWN.toString(), SpecialKey.ARROW_DOWN);
+ specialKeysByName.put(SpecialKey.ARROW_LEFT.toString(), SpecialKey.ARROW_LEFT);
+ specialKeysByName.put(SpecialKey.ARROW_RIGHT.toString(), SpecialKey.ARROW_RIGHT);
+ specialKeysByName.put(SpecialKey.ARROW_UP.toString(), SpecialKey.ARROW_UP);
specialKeysByName.put(SpecialKey.BREAK.toString(), SpecialKey.BREAK);
- specialKeysByName.put(SpecialKey.CAPS_LOCK.toString(),
- SpecialKey.CAPS_LOCK);
+ specialKeysByName.put(SpecialKey.CAPS_LOCK.toString(), SpecialKey.CAPS_LOCK);
specialKeysByName.put(SpecialKey.END.toString(), SpecialKey.END);
specialKeysByName.put(SpecialKey.F1.toString(), SpecialKey.F1);
specialKeysByName.put(SpecialKey.F10.toString(), SpecialKey.F10);
@@ -433,60 +401,37 @@ public final class SpecialKey extends NaturalKey {
specialKeysByName.put(SpecialKey.F7.toString(), SpecialKey.F7);
specialKeysByName.put(SpecialKey.F8.toString(), SpecialKey.F8);
specialKeysByName.put(SpecialKey.F9.toString(), SpecialKey.F9);
- specialKeysByName.put(SpecialKey.NUM_LOCK.toString(),
- SpecialKey.NUM_LOCK);
- specialKeysByName.put(SpecialKey.NUMPAD_0.toString(),
- SpecialKey.NUMPAD_0);
- specialKeysByName.put(SpecialKey.NUMPAD_1.toString(),
- SpecialKey.NUMPAD_1);
- specialKeysByName.put(SpecialKey.NUMPAD_2.toString(),
- SpecialKey.NUMPAD_2);
- specialKeysByName.put(SpecialKey.NUMPAD_3.toString(),
- SpecialKey.NUMPAD_3);
- specialKeysByName.put(SpecialKey.NUMPAD_4.toString(),
- SpecialKey.NUMPAD_4);
- specialKeysByName.put(SpecialKey.NUMPAD_5.toString(),
- SpecialKey.NUMPAD_5);
- specialKeysByName.put(SpecialKey.NUMPAD_6.toString(),
- SpecialKey.NUMPAD_6);
- specialKeysByName.put(SpecialKey.NUMPAD_7.toString(),
- SpecialKey.NUMPAD_7);
- specialKeysByName.put(SpecialKey.NUMPAD_8.toString(),
- SpecialKey.NUMPAD_8);
- specialKeysByName.put(SpecialKey.NUMPAD_9.toString(),
- SpecialKey.NUMPAD_9);
- specialKeysByName.put(SpecialKey.NUMPAD_ADD.toString(),
- SpecialKey.NUMPAD_ADD);
- specialKeysByName.put(SpecialKey.NUMPAD_DECIMAL.toString(),
- SpecialKey.NUMPAD_DECIMAL);
- specialKeysByName.put(SpecialKey.NUMPAD_DIVIDE.toString(),
- SpecialKey.NUMPAD_DIVIDE);
- specialKeysByName.put(SpecialKey.NUMPAD_ENTER.toString(),
- SpecialKey.NUMPAD_ENTER);
- specialKeysByName.put(SpecialKey.NUMPAD_EQUAL.toString(),
- SpecialKey.NUMPAD_EQUAL);
- specialKeysByName.put(SpecialKey.NUMPAD_MULTIPLY.toString(),
- SpecialKey.NUMPAD_MULTIPLY);
- specialKeysByName.put(SpecialKey.NUMPAD_SUBTRACT.toString(),
- SpecialKey.NUMPAD_SUBTRACT);
+ specialKeysByName.put(SpecialKey.NUM_LOCK.toString(), SpecialKey.NUM_LOCK);
+ specialKeysByName.put(SpecialKey.NUMPAD_0.toString(), SpecialKey.NUMPAD_0);
+ specialKeysByName.put(SpecialKey.NUMPAD_1.toString(), SpecialKey.NUMPAD_1);
+ specialKeysByName.put(SpecialKey.NUMPAD_2.toString(), SpecialKey.NUMPAD_2);
+ specialKeysByName.put(SpecialKey.NUMPAD_3.toString(), SpecialKey.NUMPAD_3);
+ specialKeysByName.put(SpecialKey.NUMPAD_4.toString(), SpecialKey.NUMPAD_4);
+ specialKeysByName.put(SpecialKey.NUMPAD_5.toString(), SpecialKey.NUMPAD_5);
+ specialKeysByName.put(SpecialKey.NUMPAD_6.toString(), SpecialKey.NUMPAD_6);
+ specialKeysByName.put(SpecialKey.NUMPAD_7.toString(), SpecialKey.NUMPAD_7);
+ specialKeysByName.put(SpecialKey.NUMPAD_8.toString(), SpecialKey.NUMPAD_8);
+ specialKeysByName.put(SpecialKey.NUMPAD_9.toString(), SpecialKey.NUMPAD_9);
+ specialKeysByName.put(SpecialKey.NUMPAD_ADD.toString(), SpecialKey.NUMPAD_ADD);
+ specialKeysByName.put(SpecialKey.NUMPAD_DECIMAL.toString(), SpecialKey.NUMPAD_DECIMAL);
+ specialKeysByName.put(SpecialKey.NUMPAD_DIVIDE.toString(), SpecialKey.NUMPAD_DIVIDE);
+ specialKeysByName.put(SpecialKey.NUMPAD_ENTER.toString(), SpecialKey.NUMPAD_ENTER);
+ specialKeysByName.put(SpecialKey.NUMPAD_EQUAL.toString(), SpecialKey.NUMPAD_EQUAL);
+ specialKeysByName.put(SpecialKey.NUMPAD_MULTIPLY.toString(), SpecialKey.NUMPAD_MULTIPLY);
+ specialKeysByName.put(SpecialKey.NUMPAD_SUBTRACT.toString(), SpecialKey.NUMPAD_SUBTRACT);
specialKeysByName.put(SpecialKey.HOME.toString(), SpecialKey.HOME);
specialKeysByName.put(SpecialKey.INSERT.toString(), SpecialKey.INSERT);
- specialKeysByName.put(SpecialKey.PAGE_DOWN.toString(),
- SpecialKey.PAGE_DOWN);
- specialKeysByName
- .put(SpecialKey.PAGE_UP.toString(), SpecialKey.PAGE_UP);
+ specialKeysByName.put(SpecialKey.PAGE_DOWN.toString(), SpecialKey.PAGE_DOWN);
+ specialKeysByName.put(SpecialKey.PAGE_UP.toString(), SpecialKey.PAGE_UP);
specialKeysByName.put(SpecialKey.PAUSE.toString(), SpecialKey.PAUSE);
- specialKeysByName.put(SpecialKey.PRINT_SCREEN.toString(),
- SpecialKey.PRINT_SCREEN);
- specialKeysByName.put(SpecialKey.SCROLL_LOCK.toString(),
- SpecialKey.SCROLL_LOCK);
+ specialKeysByName.put(SpecialKey.PRINT_SCREEN.toString(), SpecialKey.PRINT_SCREEN);
+ specialKeysByName.put(SpecialKey.SCROLL_LOCK.toString(), SpecialKey.SCROLL_LOCK);
}
/**
* Constructs an instance of <code>SpecialKey</code> given a name.
*
- * @param key
- * The key to be wrapped.
+ * @param key The key to be wrapped.
*/
private SpecialKey(final int key) {
super(key);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/AbstractContributionFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/AbstractContributionFactory.java
index a2101038c84..f0555ec0db1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/AbstractContributionFactory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/AbstractContributionFactory.java
@@ -19,25 +19,21 @@ import org.eclipse.ui.services.IServiceLocator;
/**
* ContributionFactories are used by the IMenuService to populate
- * ContributionManagers. In {@link #createContributionItems(IServiceLocator, IContributionRoot)}
- * you fill in the additions List with {@link IContributionItem} to be inserted at this
+ * ContributionManagers. In
+ * {@link #createContributionItems(IServiceLocator, IContributionRoot)} you fill
+ * in the additions List with {@link IContributionItem} to be inserted at this
* factory's location. For example:
*
* <pre>
* AbstractContributionFactory contributions = new AbstractContributionFactory(
* &quot;menu:org.eclipse.ui.tests.api.MenuTestHarness?after=additions&quot;) {
* public void createContributionItems(IMenuService menuService, List additions) {
- * CommandContributionItem item = new CommandContributionItem(
- * &quot;org.eclipse.ui.tests.menus.helloWorld&quot;,
- * &quot;org.eclipse.ui.tests.commands.enabledHelloWorld&quot;, null, null,
- * &quot;Say Hello&quot;, null);
+ * CommandContributionItem item = new CommandContributionItem(&quot;org.eclipse.ui.tests.menus.helloWorld&quot;,
+ * &quot;org.eclipse.ui.tests.commands.enabledHelloWorld&quot;, null, null, &quot;Say Hello&quot;, null);
* additions.add(item);
- * item = new CommandContributionItem(
- * &quot;org.eclipse.ui.tests.menus.refresh&quot;,
- * &quot;org.eclipse.ui.tests.commands.refreshView&quot;, null, null,
- * &quot;Refresh&quot;, null);
- * menuService.registerVisibleWhen(item, new MyActiveContextExpression(
- * &quot;org.eclipse.ui.tests.myview.context&quot;));
+ * item = new CommandContributionItem(&quot;org.eclipse.ui.tests.menus.refresh&quot;,
+ * &quot;org.eclipse.ui.tests.commands.refreshView&quot;, null, null, &quot;Refresh&quot;, null);
+ * menuService.registerVisibleWhen(item, new MyActiveContextExpression(&quot;org.eclipse.ui.tests.myview.context&quot;));
* additions.add(item);
* }
*
@@ -45,8 +41,7 @@ import org.eclipse.ui.services.IServiceLocator;
* // we have nothing to do
* }
* };
- * IMenuService service = (IMenuService) PlatformUI.getWorkbench().getService(
- * IMenuService.class);
+ * IMenuService service = (IMenuService) PlatformUI.getWorkbench().getService(IMenuService.class);
* service.addContributionFactory(contributions);
* </pre>
*
@@ -69,14 +64,13 @@ public abstract class AbstractContributionFactory {
private String namespace;
/**
- * The contribution factories must be instantiated with their location,
- * which which specifies the contributions insertion location.
+ * The contribution factories must be instantiated with their location, which
+ * which specifies the contributions insertion location.
*
- * @param location
- * the addition location in Menu API URI format. It must not be
- * <code>null</code>.
- * @param namespace
- * the namespace for this contribution. May be <code>null</code>.
+ * @param location the addition location in Menu API URI format. It must not be
+ * <code>null</code>.
+ * @param namespace the namespace for this contribution. May be
+ * <code>null</code>.
* @see #getNamespace()
*/
public AbstractContributionFactory(String location, String namespace) {
@@ -95,29 +89,26 @@ public abstract class AbstractContributionFactory {
/**
* This factory should create the IContributionItems that it wants to
- * contribute, and add them to the additions list. The menu service will
- * call this method at the appropriate time. It should always return new
- * instances of its contributions in the additions list.
+ * contribute, and add them to the additions list. The menu service will call
+ * this method at the appropriate time. It should always return new instances of
+ * its contributions in the additions list.
* <p>
- * This method is not meant to be called by clients. It will be called by
- * the menu service at the appropriate time.
+ * This method is not meant to be called by clients. It will be called by the
+ * menu service at the appropriate time.
* </p>
*
- * @param serviceLocator
- * a service locator that may be used in the construction of
- * items created by this factory
- * @param additions
- * A {@link IContributionRoot} supplied by the framework. It will
- * never be <code>null</code>.
+ * @param serviceLocator a service locator that may be used in the construction
+ * of items created by this factory
+ * @param additions A {@link IContributionRoot} supplied by the framework.
+ * It will never be <code>null</code>.
* @see org.eclipse.ui.menus.CommandContributionItem
* @see org.eclipse.jface.action.MenuManager
*/
- public abstract void createContributionItems(IServiceLocator serviceLocator,
- IContributionRoot additions);
+ public abstract void createContributionItems(IServiceLocator serviceLocator, IContributionRoot additions);
/**
- * Return the namespace for this cache. This corresponds to the plug-in that
- * is contributing this factory.
+ * Return the namespace for this cache. This corresponds to the plug-in that is
+ * contributing this factory.
*
* @return the namespace the namespace of this factory
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/AbstractWorkbenchTrimWidget.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/AbstractWorkbenchTrimWidget.java
index 135bd43b1e2..7a970ebf85a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/AbstractWorkbenchTrimWidget.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/AbstractWorkbenchTrimWidget.java
@@ -19,10 +19,9 @@ import org.eclipse.swt.graphics.Point;
import org.eclipse.ui.IWorkbenchWindow;
/**
- * Extension for trim widgets contributed to the workbench.
- * The extension point handler will call the <code>init</code>
- * method to inform the contributed widgets as to which
- * workbench window they're currently being hosted in.
+ * Extension for trim widgets contributed to the workbench. The extension point
+ * handler will call the <code>init</code> method to inform the contributed
+ * widgets as to which workbench window they're currently being hosted in.
*
* @since 3.2
*
@@ -38,12 +37,10 @@ public abstract class AbstractWorkbenchTrimWidget extends AbstractTrimWidget imp
super();
}
-
/**
- * Define the IWorkbenchWindow that this trim is being hosted in.
- * Note that subclasses may extend but should not override. The
- * base implementation caches the value for access through the
- * <code>getWorkbenchWindow</code> method.
+ * Define the IWorkbenchWindow that this trim is being hosted in. Note that
+ * subclasses may extend but should not override. The base implementation caches
+ * the value for access through the <code>getWorkbenchWindow</code> method.
*
* @see org.eclipse.ui.menus.IWorkbenchWidget#init(org.eclipse.ui.IWorkbenchWindow)
*/
@@ -53,8 +50,7 @@ public abstract class AbstractWorkbenchTrimWidget extends AbstractTrimWidget imp
}
/**
- * Convenience method to get the IWorkbenchWindow that is
- * hosting this widget.
+ * Convenience method to get the IWorkbenchWindow that is hosting this widget.
*
* @return The IWorkbenchWindow hosting this widget.
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/CommandContributionItem.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/CommandContributionItem.java
index 14027f4dfd4..4d360172e01 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/CommandContributionItem.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/CommandContributionItem.java
@@ -69,9 +69,8 @@ import org.eclipse.ui.services.IServiceLocator;
import org.eclipse.ui.statushandlers.StatusManager;
/**
- * A contribution item which delegates to a command. It can be used in {@link
- * AbstractContributionFactory#createContributionItems(IServiceLocator,
- * IContributionRoot)}.
+ * A contribution item which delegates to a command. It can be used in
+ * {@link AbstractContributionFactory#createContributionItems(IServiceLocator, IContributionRoot)}.
* <p>
* It currently supports placement in menus and toolbars.
* </p>
@@ -104,9 +103,9 @@ public class CommandContributionItem extends ContributionItem {
public static final int STYLE_PULLDOWN = SWT.DROP_DOWN;
/**
- * Mode bit: Show text on tool items or buttons, even if an image is
- * present. If this mode bit is not set, text is only shown on tool items if
- * there is no image present.
+ * Mode bit: Show text on tool items or buttons, even if an image is present. If
+ * this mode bit is not set, text is only shown on tool items if there is no
+ * image present.
*
* @since 3.4
*/
@@ -180,12 +179,11 @@ public class CommandContributionItem extends ContributionItem {
/**
* Create a CommandContributionItem to place in a ContributionManager.
*
- * @param contributionParameters
- * parameters necessary to render this contribution item.
+ * @param contributionParameters parameters necessary to render this
+ * contribution item.
* @since 3.4
*/
- public CommandContributionItem(
- CommandContributionItemParameter contributionParameters) {
+ public CommandContributionItem(CommandContributionItemParameter contributionParameters) {
super(contributionParameters.id);
contributedLabel = contributionParameters.label;
@@ -195,7 +193,6 @@ public class CommandContributionItem extends ContributionItem {
contributedHoverIcon = contributionParameters.hoverIcon;
this.serviceLocator = contributionParameters.serviceLocator;
-
this.icon = contributionParameters.icon;
this.disabledIcon = contributionParameters.disabledIcon;
this.hoverIcon = contributionParameters.hoverIcon;
@@ -207,38 +204,32 @@ public class CommandContributionItem extends ContributionItem {
this.visibleEnabled = contributionParameters.visibleEnabled;
this.mode = contributionParameters.mode;
- menuService = contributionParameters.serviceLocator
- .getService(IMenuService.class);
- commandService = contributionParameters.serviceLocator
- .getService(ICommandService.class);
- handlerService = contributionParameters.serviceLocator
- .getService(IHandlerService.class);
- bindingService = contributionParameters.serviceLocator
- .getService(IBindingService.class);
- IWorkbenchLocationService workbenchLocationService = contributionParameters.serviceLocator.getService(IWorkbenchLocationService.class);
+ menuService = contributionParameters.serviceLocator.getService(IMenuService.class);
+ commandService = contributionParameters.serviceLocator.getService(ICommandService.class);
+ handlerService = contributionParameters.serviceLocator.getService(IHandlerService.class);
+ bindingService = contributionParameters.serviceLocator.getService(IBindingService.class);
+ IWorkbenchLocationService workbenchLocationService = contributionParameters.serviceLocator
+ .getService(IWorkbenchLocationService.class);
display = workbenchLocationService.getWorkbench().getDisplay();
- createCommand(contributionParameters.commandId,
- contributionParameters.parameters);
+ createCommand(contributionParameters.commandId, contributionParameters.parameters);
if (command != null) {
- setImages(contributionParameters.serviceLocator,
- contributionParameters.iconStyle);
-
- if (contributionParameters.helpContextId == null) {
- try {
- this.helpContextId = commandService
- .getHelpContextId(contributionParameters.commandId);
- } catch (NotDefinedException e) {
- // it's OK to not have a helpContextId
- }
- }
- IWorkbenchLocationService wls = contributionParameters.serviceLocator
- .getService(IWorkbenchLocationService.class);
- final IWorkbench workbench = wls.getWorkbench();
- if (workbench != null && helpContextId != null) {
- this.workbenchHelpSystem = workbench.getHelpSystem();
+ setImages(contributionParameters.serviceLocator, contributionParameters.iconStyle);
+
+ if (contributionParameters.helpContextId == null) {
+ try {
+ this.helpContextId = commandService.getHelpContextId(contributionParameters.commandId);
+ } catch (NotDefinedException e) {
+ // it's OK to not have a helpContextId
}
+ }
+ IWorkbenchLocationService wls = contributionParameters.serviceLocator
+ .getService(IWorkbenchLocationService.class);
+ final IWorkbench workbench = wls.getWorkbench();
+ if (workbench != null && helpContextId != null) {
+ this.workbenchHelpSystem = workbench.getHelpSystem();
+ }
}
}
@@ -246,57 +237,45 @@ public class CommandContributionItem extends ContributionItem {
/**
* Create a CommandContributionItem to place in a ContributionManager.
*
- * @param serviceLocator
- * a service locator that is most appropriate for this contribution.
- * Typically the local {@link IWorkbenchWindow} or {@link
- * IWorkbenchPartSite} will be sufficient.
- * @param id
- * The id for this item. May be <code>null</code>. Items without an id
- * cannot be referenced later.
- * @param commandId
- * A command id for a defined command. Must not be <code>null</code>.
- * @param parameters
- * A map of strings to strings which represent parameter names to
- * values. The parameter names must match those in the command
- * definition.
- * @param icon
- * An icon for this item. May be <code>null</code>.
- * @param disabledIcon
- * A disabled icon for this item. May be <code>null</code>.
- * @param hoverIcon
- * A hover icon for this item. May be <code>null</code>.
- * @param label
- * A label for this item. May be <code>null</code>.
- * @param mnemonic
- * A mnemonic for this item to be applied to the label. May be
- * <code>null</code>.
- * @param tooltip
- * A tooltip for this item. May be <code>null</code>. Tooltips are
- * currently only valid for toolbar contributions.
- * @param style
- * The style of this menu contribution. See the STYLE_* contants.
+ * @param serviceLocator a service locator that is most appropriate for this
+ * contribution. Typically the local
+ * {@link IWorkbenchWindow} or {@link IWorkbenchPartSite}
+ * will be sufficient.
+ * @param id The id for this item. May be <code>null</code>. Items
+ * without an id cannot be referenced later.
+ * @param commandId A command id for a defined command. Must not be
+ * <code>null</code>.
+ * @param parameters A map of strings to strings which represent parameter
+ * names to values. The parameter names must match those
+ * in the command definition.
+ * @param icon An icon for this item. May be <code>null</code>.
+ * @param disabledIcon A disabled icon for this item. May be
+ * <code>null</code>.
+ * @param hoverIcon A hover icon for this item. May be <code>null</code>.
+ * @param label A label for this item. May be <code>null</code>.
+ * @param mnemonic A mnemonic for this item to be applied to the label.
+ * May be <code>null</code>.
+ * @param tooltip A tooltip for this item. May be <code>null</code>.
+ * Tooltips are currently only valid for toolbar
+ * contributions.
+ * @param style The style of this menu contribution. See the STYLE_*
+ * contants.
* @deprecated create the {@link CommandContributionItemParameter}
*/
@Deprecated
- public CommandContributionItem(IServiceLocator serviceLocator, String id,
- String commandId, Map parameters, ImageDescriptor icon,
- ImageDescriptor disabledIcon, ImageDescriptor hoverIcon,
- String label, String mnemonic, String tooltip, int style) {
- this(new CommandContributionItemParameter(serviceLocator, id,
- commandId, parameters, icon, disabledIcon, hoverIcon, label,
- mnemonic, tooltip, style, null, false));
+ public CommandContributionItem(IServiceLocator serviceLocator, String id, String commandId, Map parameters,
+ ImageDescriptor icon, ImageDescriptor disabledIcon, ImageDescriptor hoverIcon, String label,
+ String mnemonic, String tooltip, int style) {
+ this(new CommandContributionItemParameter(serviceLocator, id, commandId, parameters, icon, disabledIcon,
+ hoverIcon, label, mnemonic, tooltip, style, null, false));
}
private void setImages(IServiceLocator locator, String iconStyle) {
if (icon == null) {
- ICommandImageService service = locator
- .getService(ICommandImageService.class);
- icon = service.getImageDescriptor(command.getId(),
- ICommandImageService.TYPE_DEFAULT, iconStyle);
- disabledIcon = service.getImageDescriptor(command.getId(),
- ICommandImageService.TYPE_DISABLED, iconStyle);
- hoverIcon = service.getImageDescriptor(command.getId(),
- ICommandImageService.TYPE_HOVER, iconStyle);
+ ICommandImageService service = locator.getService(ICommandImageService.class);
+ icon = service.getImageDescriptor(command.getId(), ICommandImageService.TYPE_DEFAULT, iconStyle);
+ disabledIcon = service.getImageDescriptor(command.getId(), ICommandImageService.TYPE_DISABLED, iconStyle);
+ hoverIcon = service.getImageDescriptor(command.getId(), ICommandImageService.TYPE_HOVER, iconStyle);
if (contributedIcon == null)
contributedIcon = icon;
@@ -310,8 +289,7 @@ public class CommandContributionItem extends ContributionItem {
private ICommandListener getCommandListener() {
if (commandListener == null) {
commandListener = commandEvent -> {
- if (commandEvent.isHandledChanged()
- || commandEvent.isEnabledChanged()
+ if (commandEvent.isHandledChanged() || commandEvent.isEnabledChanged()
|| commandEvent.isDefinedChanged()) {
updateCommandProperties(commandEvent);
}
@@ -325,8 +303,7 @@ public class CommandContributionItem extends ContributionItem {
dropDownMenuOverride = null;
}
Runnable update = () -> {
- if (commandEvent.isEnabledChanged()
- || commandEvent.isHandledChanged()) {
+ if (commandEvent.isEnabledChanged() || commandEvent.isHandledChanged()) {
if (visibleEnabled) {
IContributionManager parent = getParent();
if (parent != null) {
@@ -375,9 +352,8 @@ public class CommandContributionItem extends ContributionItem {
/**
* Returns the ParameterizedCommand for this contribution.
* <p>
- * <strong>NOTE:</strong> The returned object should be treated as
- * 'read-only', do <b>not</b> execute this instance or attempt to modify its
- * state.
+ * <strong>NOTE:</strong> The returned object should be treated as 'read-only',
+ * do <b>not</b> execute this instance or attempt to modify its state.
* </p>
*
* @return The parameterized command for this contribution.
@@ -390,22 +366,16 @@ public class CommandContributionItem extends ContributionItem {
void createCommand(String commandId, Map parameters) {
if (commandId == null) {
- StatusManager.getManager().handle(
- StatusUtil.newStatus(IStatus.ERROR,
- "Unable to create menu item \"" + getId() //$NON-NLS-1$
- + "\", no command id", null)); //$NON-NLS-1$
+ StatusManager.getManager()
+ .handle(StatusUtil.newStatus(IStatus.ERROR, "Unable to create menu item \"" + getId() //$NON-NLS-1$
+ + "\", no command id", null)); //$NON-NLS-1$
return;
}
Command cmd = commandService.getCommand(commandId);
if (!cmd.isDefined()) {
- StatusManager
- .getManager()
- .handle(
- StatusUtil
- .newStatus(
- IStatus.ERROR,
- "Unable to create menu item \"" + getId() //$NON-NLS-1$
- + "\", command \"" + commandId + "\" not defined", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ StatusManager.getManager()
+ .handle(StatusUtil.newStatus(IStatus.ERROR, "Unable to create menu item \"" + getId() //$NON-NLS-1$
+ + "\", command \"" + commandId + "\" not defined", null)); //$NON-NLS-1$ //$NON-NLS-2$
return;
}
command = ParameterizedCommand.generateCommand(cmd, parameters);
@@ -529,10 +499,8 @@ public class CommandContributionItem extends ContributionItem {
try {
text = command.getCommand().getName();
} catch (NotDefinedException e) {
- StatusManager.getManager().handle(
- StatusUtil.newStatus(IStatus.ERROR,
- "Update item failed " //$NON-NLS-1$
- + getId(), e));
+ StatusManager.getManager().handle(StatusUtil.newStatus(IStatus.ERROR, "Update item failed " //$NON-NLS-1$
+ + getId(), e));
}
}
}
@@ -540,8 +508,7 @@ public class CommandContributionItem extends ContributionItem {
String keyBindingText = null;
if (command != null) {
- TriggerSequence binding = bindingService
- .getBestActiveBindingFor(command);
+ TriggerSequence binding = bindingService.getBestActiveBindingFor(command);
if (binding != null) {
keyBindingText = binding.format();
}
@@ -581,16 +548,13 @@ public class CommandContributionItem extends ContributionItem {
tooltip = text;
}
} catch (NotDefinedException e) {
- StatusManager.getManager().handle(
- StatusUtil.newStatus(IStatus.ERROR,
- "Update item failed " //$NON-NLS-1$
- + getId(), e));
+ StatusManager.getManager().handle(StatusUtil.newStatus(IStatus.ERROR, "Update item failed " //$NON-NLS-1$
+ + getId(), e));
}
}
}
- if ((icon == null || (mode & MODE_FORCE_TEXT) == MODE_FORCE_TEXT)
- && text != null) {
+ if ((icon == null || (mode & MODE_FORCE_TEXT) == MODE_FORCE_TEXT) && text != null) {
item.setText(text);
}
@@ -618,10 +582,8 @@ public class CommandContributionItem extends ContributionItem {
try {
text = command.getCommand().getName();
} catch (NotDefinedException e) {
- StatusManager.getManager().handle(
- StatusUtil.newStatus(IStatus.ERROR,
- "Update item failed " //$NON-NLS-1$
- + getId(), e));
+ StatusManager.getManager().handle(StatusUtil.newStatus(IStatus.ERROR, "Update item failed " //$NON-NLS-1$
+ + getId(), e));
}
}
}
@@ -653,14 +615,11 @@ public class CommandContributionItem extends ContributionItem {
else
tooltipText = ""; //$NON-NLS-1$
- TriggerSequence activeBinding = bindingService
- .getBestActiveBindingFor(command);
+ TriggerSequence activeBinding = bindingService.getBestActiveBindingFor(command);
if (activeBinding != null && !activeBinding.isEmpty()) {
String acceleratorText = activeBinding.format();
- if (acceleratorText != null
- && acceleratorText.length() != 0) {
- tooltipText = NLS.bind(CommandMessages.Tooltip_Accelerator,
- tooltipText, acceleratorText);
+ if (acceleratorText != null && acceleratorText.length() != 0) {
+ tooltipText = NLS.bind(CommandMessages.Tooltip_Accelerator, tooltipText, acceleratorText);
}
}
@@ -738,8 +697,8 @@ public class CommandContributionItem extends ContributionItem {
try {
elementRef = commandService.registerElementForCommand(command, callback);
} catch (NotDefinedException e) {
- StatusManager.getManager().handle(
- StatusUtil.newStatus(IStatus.ERROR, "Unable to register menu item \"" + getId() //$NON-NLS-1$
+ StatusManager.getManager()
+ .handle(StatusUtil.newStatus(IStatus.ERROR, "Unable to register menu item \"" + getId() //$NON-NLS-1$
+ "\", command \"" + command.getId() + "\" not defined", //$NON-NLS-1$ //$NON-NLS-2$
null));
}
@@ -823,34 +782,25 @@ public class CommandContributionItem extends ContributionItem {
try {
handlerService.executeCommand(command, event);
} catch (ExecutionException e) {
- StatusManager.getManager().handle(
- StatusUtil.newStatus(IStatus.ERROR,
- "Failed to execute item " //$NON-NLS-1$
- + getId(), e));
+ StatusManager.getManager().handle(StatusUtil.newStatus(IStatus.ERROR, "Failed to execute item " //$NON-NLS-1$
+ + getId(), e));
} catch (NotDefinedException e) {
- StatusManager.getManager().handle(
- StatusUtil.newStatus(IStatus.ERROR,
- "Failed to execute item " //$NON-NLS-1$
- + getId(), e));
+ StatusManager.getManager().handle(StatusUtil.newStatus(IStatus.ERROR, "Failed to execute item " //$NON-NLS-1$
+ + getId(), e));
} catch (NotEnabledException e) {
- StatusManager.getManager().handle(
- StatusUtil.newStatus(IStatus.ERROR,
- "Failed to execute item " //$NON-NLS-1$
- + getId(), e));
+ StatusManager.getManager().handle(StatusUtil.newStatus(IStatus.ERROR, "Failed to execute item " //$NON-NLS-1$
+ + getId(), e));
} catch (NotHandledException e) {
- StatusManager.getManager().handle(
- StatusUtil.newStatus(IStatus.ERROR,
- "Failed to execute item " //$NON-NLS-1$
- + getId(), e));
+ StatusManager.getManager().handle(StatusUtil.newStatus(IStatus.ERROR, "Failed to execute item " //$NON-NLS-1$
+ + getId(), e));
}
}
/**
- * Determines if the selection was on the dropdown affordance and, if so,
- * opens the drop down menu (populated using the same id as this item...
+ * Determines if the selection was on the dropdown affordance and, if so, opens
+ * the drop down menu (populated using the same id as this item...
*
- * @param event
- * The <code>SWT.Selection</code> event to be tested
+ * @param event The <code>SWT.Selection</code> event to be tested
*
* @return <code>true</code> iff a drop down menu was opened
*/
@@ -874,9 +824,9 @@ public class CommandContributionItem extends ContributionItem {
if (dropDownMenuOverride != null) {
id = dropDownMenuOverride;
}
- menuService.populateContributionManager(
- menuManager, "menu:" + id); //$NON-NLS-1$
+ menuService.populateContributionManager(menuManager, "menu:" + id); //$NON-NLS-1$
}
+
@Override
public void menuAboutToHide(IMenuManager manager) {
IMenuService menuService = CommandContributionItem.this.menuService;
@@ -890,8 +840,7 @@ public class CommandContributionItem extends ContributionItem {
});
// position the menu below the drop down item
- Point point = ti.getParent().toDisplay(
- new Point(event.x, event.y));
+ Point point = ti.getParent().toDisplay(new Point(event.x, event.y));
menu.setLocation(point.x, point.y); // waiting for SWT
// 0.42
menu.setVisible(true);
@@ -911,28 +860,23 @@ public class CommandContributionItem extends ContributionItem {
private void updateIcons() {
if (widget instanceof MenuItem) {
MenuItem item = (MenuItem) widget;
- LocalResourceManager m = new LocalResourceManager(JFaceResources
- .getResources());
+ LocalResourceManager m = new LocalResourceManager(JFaceResources.getResources());
try {
item.setImage(icon == null ? null : m.createImage(icon));
} catch (DeviceResourceException e) {
icon = ImageDescriptor.getMissingImageDescriptor();
item.setImage(m.createImage(icon));
// as we replaced the failed icon, log the message once.
- StatusManager.getManager().handle(
- new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH,
- "Failed to load image", e)); //$NON-NLS-1$
+ StatusManager.getManager()
+ .handle(new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, "Failed to load image", e)); //$NON-NLS-1$
}
disposeOldImages();
localResourceManager = m;
} else if (widget instanceof ToolItem) {
ToolItem item = (ToolItem) widget;
- LocalResourceManager m = new LocalResourceManager(JFaceResources
- .getResources());
- item.setDisabledImage(disabledIcon == null ? null : m
- .createImage(disabledIcon));
- item.setHotImage(hoverIcon == null ? null : m
- .createImage(hoverIcon));
+ LocalResourceManager m = new LocalResourceManager(JFaceResources.getResources());
+ item.setDisabledImage(disabledIcon == null ? null : m.createImage(disabledIcon));
+ item.setHotImage(hoverIcon == null ? null : m.createImage(hoverIcon));
item.setImage(icon == null ? null : m.createImage(icon));
disposeOldImages();
localResourceManager = m;
@@ -994,8 +938,7 @@ public class CommandContributionItem extends ContributionItem {
}
private IBindingManagerListener bindingManagerListener = event -> {
- if (event.isActiveBindingsChanged()
- && event.isActiveBindingsChangedFor(getCommand())) {
+ if (event.isActiveBindingsChanged() && event.isActiveBindingsChangedFor(getCommand())) {
update();
}
@@ -1012,8 +955,8 @@ public class CommandContributionItem extends ContributionItem {
* @since 3.100
*/
public CommandContributionItemParameter getData() {
- CommandContributionItemParameter data = new CommandContributionItemParameter(
- serviceLocator, getId(), null, style);
+ CommandContributionItemParameter data = new CommandContributionItemParameter(serviceLocator, getId(), null,
+ style);
data.icon = contributedIcon;
data.disabledIcon = contributedDisabledIcon;
data.hoverIcon = contributedHoverIcon;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/CommandContributionItemParameter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/CommandContributionItemParameter.java
index a9ddea58ac6..9b861221a64 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/CommandContributionItemParameter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/CommandContributionItemParameter.java
@@ -30,16 +30,15 @@ import org.eclipse.ui.services.IServiceLocator;
*/
public class CommandContributionItemParameter {
/**
- * a service locator that is most appropriate for this contribution.
- * Typically the local {@link IWorkbenchWindow} or
- * {@link IWorkbenchPartSite} will be sufficient. Must not be
- * <code>null</code>.
+ * a service locator that is most appropriate for this contribution. Typically
+ * the local {@link IWorkbenchWindow} or {@link IWorkbenchPartSite} will be
+ * sufficient. Must not be <code>null</code>.
*/
public IServiceLocator serviceLocator;
/**
- * The id for this item. May be <code>null</code>. Items without an id
- * cannot be referenced later.
+ * The id for this item. May be <code>null</code>. Items without an id cannot be
+ * referenced later.
*/
public String id;
@@ -49,8 +48,8 @@ public class CommandContributionItemParameter {
public String commandId;
/**
- * A map of strings to strings which represent parameter names to values.
- * The parameter names must match those in the command definition. May be
+ * A map of strings to strings which represent parameter names to values. The
+ * parameter names must match those in the command definition. May be
* <code>null</code>
*/
public Map parameters;
@@ -82,14 +81,14 @@ public class CommandContributionItemParameter {
public String mnemonic;
/**
- * A tooltip for this item. May be <code>null</code>. Tooltips are
- * currently only valid for toolbar contributions.
+ * A tooltip for this item. May be <code>null</code>. Tooltips are currently
+ * only valid for toolbar contributions.
*/
public String tooltip;
/**
- * The style of this menu contribution. See the CommandContributionItem
- * STYLE_* contants.
+ * The style of this menu contribution. See the CommandContributionItem STYLE_*
+ * contants.
*/
public int style;
@@ -120,22 +119,18 @@ public class CommandContributionItemParameter {
/**
* Create the parameter object. Nullable attributes can be set directly.
*
- * @param serviceLocator
- * a service locator that is most appropriate for this
- * contribution. Typically the local {@link IWorkbenchWindow} or
- * {@link IWorkbenchPartSite} will be sufficient. Must not be
- * <code>null</code>.
- * @param id
- * The id for this item. May be <code>null</code>. Items
- * without an id cannot be referenced later.
- * @param commandId
- * A command id for a defined command. Must not be
- * <code>null</code>.
- * @param style
- * The style of this menu contribution. See the STYLE_* contants.
- */
- public CommandContributionItemParameter(IServiceLocator serviceLocator,
- String id, String commandId, int style) {
+ * @param serviceLocator a service locator that is most appropriate for this
+ * contribution. Typically the local
+ * {@link IWorkbenchWindow} or {@link IWorkbenchPartSite}
+ * will be sufficient. Must not be <code>null</code>.
+ * @param id The id for this item. May be <code>null</code>. Items
+ * without an id cannot be referenced later.
+ * @param commandId A command id for a defined command. Must not be
+ * <code>null</code>.
+ * @param style The style of this menu contribution. See the STYLE_*
+ * contants.
+ */
+ public CommandContributionItemParameter(IServiceLocator serviceLocator, String id, String commandId, int style) {
this.serviceLocator = serviceLocator;
this.id = id;
this.commandId = commandId;
@@ -148,49 +143,37 @@ public class CommandContributionItemParameter {
* <b>Note:</b> This constructor should not be called outside the framework.
* </p>
*
- * @param serviceLocator
- * a service locator that is most appropriate for this
- * contribution. Typically the local {@link IWorkbenchWindow} or
- * {@link IWorkbenchPartSite} will be sufficient. Must not be
- * <code>null</code>.
- * @param id
- * The id for this item. May be <code>null</code>. Items
- * without an id cannot be referenced later.
- * @param commandId
- * A command id for a defined command. Must not be
- * <code>null</code>.
- * @param parameters
- * A map of strings to strings which represent parameter names to
- * values. The parameter names must match those in the command
- * definition. May be <code>null</code>
- * @param icon
- * An icon for this item. May be <code>null</code>.
- * @param disabledIcon
- * A disabled icon for this item. May be <code>null</code>.
- * @param hoverIcon
- * A hover icon for this item. May be <code>null</code>.
- * @param label
- * A label for this item. May be <code>null</code>.
- * @param mnemonic
- * A mnemonic for this item to be applied to the label. May be
- * <code>null</code>.
- * @param tooltip
- * A tooltip for this item. May be <code>null</code>. Tooltips
- * are currently only valid for toolbar contributions.
- * @param style
- * The style of this menu contribution. See the STYLE_* contants.
- * @param helpContextId
- * the help context id to be applied to this contribution. May be
- * <code>null</code>
- * @param visibleEnabled
- * Visibility tracking for the menu contribution.
+ * @param serviceLocator a service locator that is most appropriate for this
+ * contribution. Typically the local
+ * {@link IWorkbenchWindow} or {@link IWorkbenchPartSite}
+ * will be sufficient. Must not be <code>null</code>.
+ * @param id The id for this item. May be <code>null</code>. Items
+ * without an id cannot be referenced later.
+ * @param commandId A command id for a defined command. Must not be
+ * <code>null</code>.
+ * @param parameters A map of strings to strings which represent parameter
+ * names to values. The parameter names must match those
+ * in the command definition. May be <code>null</code>
+ * @param icon An icon for this item. May be <code>null</code>.
+ * @param disabledIcon A disabled icon for this item. May be
+ * <code>null</code>.
+ * @param hoverIcon A hover icon for this item. May be <code>null</code>.
+ * @param label A label for this item. May be <code>null</code>.
+ * @param mnemonic A mnemonic for this item to be applied to the label.
+ * May be <code>null</code>.
+ * @param tooltip A tooltip for this item. May be <code>null</code>.
+ * Tooltips are currently only valid for toolbar
+ * contributions.
+ * @param style The style of this menu contribution. See the STYLE_*
+ * contants.
+ * @param helpContextId the help context id to be applied to this contribution.
+ * May be <code>null</code>
+ * @param visibleEnabled Visibility tracking for the menu contribution.
* @noreference This constructor is not intended to be referenced by clients.
*/
- public CommandContributionItemParameter(IServiceLocator serviceLocator,
- String id, String commandId, Map parameters, ImageDescriptor icon,
- ImageDescriptor disabledIcon, ImageDescriptor hoverIcon,
- String label, String mnemonic, String tooltip, int style,
- String helpContextId, boolean visibleEnabled) {
+ public CommandContributionItemParameter(IServiceLocator serviceLocator, String id, String commandId, Map parameters,
+ ImageDescriptor icon, ImageDescriptor disabledIcon, ImageDescriptor hoverIcon, String label,
+ String mnemonic, String tooltip, int style, String helpContextId, boolean visibleEnabled) {
this.serviceLocator = serviceLocator;
this.id = id;
this.commandId = commandId;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/ExtensionContributionFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/ExtensionContributionFactory.java
index e9109997cf5..4ab7a578c07 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/ExtensionContributionFactory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/ExtensionContributionFactory.java
@@ -38,8 +38,7 @@ import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants;
*
* @since 3.5
*/
-public abstract class ExtensionContributionFactory extends
- AbstractContributionFactory implements IExecutableExtension {
+public abstract class ExtensionContributionFactory extends AbstractContributionFactory implements IExecutableExtension {
private String namespace;
private String locationURI;
@@ -63,17 +62,15 @@ public abstract class ExtensionContributionFactory extends
/**
* Clients who wish to implement their own {@link IExecutableExtension}
- * behaviour <strong>must</strong> invoke this method prior to any
- * customization they perform.
+ * behaviour <strong>must</strong> invoke this method prior to any customization
+ * they perform.
*
- * @throws CoreException
- * so that a subclass may throw this
+ * @throws CoreException so that a subclass may throw this
*/
@Override
- public void setInitializationData(IConfigurationElement config,
- String propertyName, Object data) throws CoreException {
- locationURI = config
- .getAttribute(IWorkbenchRegistryConstants.TAG_LOCATION_URI);
+ public void setInitializationData(IConfigurationElement config, String propertyName, Object data)
+ throws CoreException {
+ locationURI = config.getAttribute(IWorkbenchRegistryConstants.TAG_LOCATION_URI);
namespace = config.getNamespaceIdentifier();
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/IContributionRoot.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/IContributionRoot.java
index 021f945e2c9..c75037f6472 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/IContributionRoot.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/IContributionRoot.java
@@ -34,26 +34,20 @@ public interface IContributionRoot {
* called for all top-level elements created in
* {@link AbstractContributionFactory#createContributionItems(org.eclipse.ui.services.IServiceLocator, IContributionRoot)}
*
- * @param item
- * the item to add
- * @param visibleWhen
- * the visibility expression. May be <code>null</code>.
+ * @param item the item to add
+ * @param visibleWhen the visibility expression. May be <code>null</code>.
*/
- void addContributionItem(IContributionItem item,
- Expression visibleWhen);
+ void addContributionItem(IContributionItem item, Expression visibleWhen);
/**
- * Registers visibilty for arbitrary {@link IContributionItem} instances
- * that are <b>NOT</b> direct children of this container. Ie: children of a
- * {@link IContributionManager} that has been previously registered with a
- * call to {{@link #addContributionItem(IContributionItem, Expression)}.
+ * Registers visibilty for arbitrary {@link IContributionItem} instances that
+ * are <b>NOT</b> direct children of this container. Ie: children of a
+ * {@link IContributionManager} that has been previously registered with a call
+ * to {{@link #addContributionItem(IContributionItem, Expression)}.
*
- * @param item
- * the item for which to register a visibility clause
- * @param visibleWhen
- * the visibility expression. May be <code>null</code> in which
- * case this method is a no-op.
+ * @param item the item for which to register a visibility clause
+ * @param visibleWhen the visibility expression. May be <code>null</code> in
+ * which case this method is a no-op.
*/
- void registerVisibilityForChild(IContributionItem item,
- Expression visibleWhen);
+ void registerVisibilityForChild(IContributionItem item, Expression visibleWhen);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/IMenuService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/IMenuService.java
index f96a7bfcac5..97dbc10c177 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/IMenuService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/IMenuService.java
@@ -43,27 +43,25 @@ public interface IMenuService extends IServiceWithSources {
/**
* Contribute and initialize the contribution factory. This should only be
- * called once per factory. After the call, the factory should be treated as
- * an unmodifiable object.
+ * called once per factory. After the call, the factory should be treated as an
+ * unmodifiable object.
* <p>
- * <b>Note:</b> factories should be removed when no longer necessary. If
- * not, they will be removed when the IServiceLocator used to acquire this
- * service is disposed.
+ * <b>Note:</b> factories should be removed when no longer necessary. If not,
+ * they will be removed when the IServiceLocator used to acquire this service is
+ * disposed.
* </p>
*
- * @param factory
- * the contribution factory. Must not be <code>null</code>
+ * @param factory the contribution factory. Must not be <code>null</code>
* @see #removeContributionFactory(AbstractContributionFactory)
*/
void addContributionFactory(AbstractContributionFactory factory);
/**
- * Remove the contributed factory from the menu service. If the factory is
- * not contained by this service, this call does nothing.
+ * Remove the contributed factory from the menu service. If the factory is not
+ * contained by this service, this call does nothing.
*
- * @param factory
- * the contribution factory to remove. Must not be
- * <code>null</code>.
+ * @param factory the contribution factory to remove. Must not be
+ * <code>null</code>.
*/
void removeContributionFactory(AbstractContributionFactory factory);
@@ -73,20 +71,17 @@ public interface IMenuService extends IServiceWithSources {
* <code>AbstractContributionFactory</code>s that are stored against the
* provided location.
*
- * @param mgr
- * The ContributionManager to populate
- * @param location
- * The starting location to begin populating this contribution
- * manager. The format is the Menu API URI format.
+ * @param mgr The ContributionManager to populate
+ * @param location The starting location to begin populating this contribution
+ * manager. The format is the Menu API URI format.
* @see #releaseContributions(ContributionManager)
*/
- void populateContributionManager(ContributionManager mgr,
- String location);
+ void populateContributionManager(ContributionManager mgr, String location);
/**
* Before calling dispose() on a ContributionManager populated by the menu
- * service, you must inform the menu service to release its contributions.
- * This takes care of unregistering any IContributionItems that have their
+ * service, you must inform the menu service to release its contributions. This
+ * takes care of unregistering any IContributionItems that have their
* visibleWhen clause managed by this menu service.
* <p>
* This will not update the ContributionManager (and any widgets). It will
@@ -94,8 +89,7 @@ public interface IMenuService extends IServiceWithSources {
* ContributionManager.
* </p>
*
- * @param mgr
- * The manager that was populated by a call to
+ * @param mgr The manager that was populated by a call to
* {@link #populateContributionManager(ContributionManager, String)}
*/
void releaseContributions(ContributionManager mgr);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/IWorkbenchContribution.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/IWorkbenchContribution.java
index 99c1a5fcf14..c200390f3fd 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/IWorkbenchContribution.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/IWorkbenchContribution.java
@@ -24,14 +24,12 @@ import org.eclipse.ui.services.IServiceLocator;
*/
public interface IWorkbenchContribution {
/**
- * The service locator for this contribution. It will potentially exist
- * longer than the lifecycle of this specific contribution, so
- * ContributionItems should remove themselves from any listeners or services
- * in their dispose() calls.
+ * The service locator for this contribution. It will potentially exist longer
+ * than the lifecycle of this specific contribution, so ContributionItems should
+ * remove themselves from any listeners or services in their dispose() calls.
*
- * @param serviceLocator
- * the locator which services can be retrieved. Will not be
- * <code>null</code>
+ * @param serviceLocator the locator which services can be retrieved. Will not
+ * be <code>null</code>
*/
void initialize(IServiceLocator serviceLocator);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/IWorkbenchWidget.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/IWorkbenchWidget.java
index 16985715bfd..57d28658e6d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/IWorkbenchWidget.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/IWorkbenchWidget.java
@@ -17,11 +17,9 @@ package org.eclipse.ui.menus;
import org.eclipse.jface.menus.IWidget;
import org.eclipse.ui.IWorkbenchWindow;
-
/**
- * Interface used for IWidget's contributed to the
- * Workbench. Allows the contributed widget to be
- * informed as to which WorkbenchWindow it's being
+ * Interface used for IWidget's contributed to the Workbench. Allows the
+ * contributed widget to be informed as to which WorkbenchWindow it's being
* hosted in.
*
* @see org.eclipse.jface.menus.IWidget
@@ -29,15 +27,15 @@ import org.eclipse.ui.IWorkbenchWindow;
* @since 3.2
*/
public interface IWorkbenchWidget extends IWidget {
- /**
- * Initializes this widget contribution by supplying the
- * <code>IWorkbenchWindow</code> that it's being hosted in.
- * <p>
- * This method is called after the no argument constructor and
- * before other methods are called.
- * </p>
- *
- * @param workbenchWindow the current workbench
- */
- void init(IWorkbenchWindow workbenchWindow);
+ /**
+ * Initializes this widget contribution by supplying the
+ * <code>IWorkbenchWindow</code> that it's being hosted in.
+ * <p>
+ * This method is called after the no argument constructor and before other
+ * methods are called.
+ * </p>
+ *
+ * @param workbenchWindow the current workbench
+ */
+ void init(IWorkbenchWindow workbenchWindow);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/MenuUtil.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/MenuUtil.java
index 13b0d75147d..06889b1823f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/MenuUtil.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/MenuUtil.java
@@ -23,8 +23,8 @@ package org.eclipse.ui.menus;
*/
public class MenuUtil {
/**
- * Workbench Menu. On supported platforms, this menu is shown when no
- * workbench windows are active
+ * Workbench Menu. On supported platforms, this menu is shown when no workbench
+ * windows are active
*
* @since 3.7
*/
@@ -66,8 +66,8 @@ public class MenuUtil {
* Valid query attribute. Usage <b>menu:menu.id?endof=contribution.id</b>.
* <p>
* This menu contribution will be placed at the end of the group defined by
- * <b>contribution.id</b> (usually right in front of the next group marker
- * or separator). Further contribution processing can still place other
+ * <b>contribution.id</b> (usually right in front of the next group marker or
+ * separator). Further contribution processing can still place other
* contributions after this one.
* </p>
*
@@ -76,16 +76,15 @@ public class MenuUtil {
public static final String QUERY_ENDOF = "endof"; //$NON-NLS-1$
/**
- * Contributions of targets to this location will be included with the show
- * in menu.
+ * Contributions of targets to this location will be included with the show in
+ * menu.
*
* @since 3.4
*/
public static final String SHOW_IN_MENU_ID = "popup:org.eclipse.ui.menus.showInMenu"; //$NON-NLS-1$
/**
- * @param id
- * The menu's id
+ * @param id The menu's id
* @return The locator URI for a menu with the given id
*/
public static String menuUri(String id) {
@@ -93,12 +92,9 @@ public class MenuUtil {
}
/**
- * @param id
- * The id of the menu
- * @param location
- * The relative location specifier
- * @param refId
- * The id of the menu element to be relative to
+ * @param id The id of the menu
+ * @param location The relative location specifier
+ * @param refId The id of the menu element to be relative to
* @return A location URI formatted with the given parameters
*/
public static String menuAddition(String id, String location, String refId) {
@@ -106,11 +102,10 @@ public class MenuUtil {
}
/**
- * Convenience method to create a standard menu addition The resulting
- * string has the format: "menu:[id]?after=additions"
+ * Convenience method to create a standard menu addition The resulting string
+ * has the format: "menu:[id]?after=additions"
*
- * @param id
- * The id of the root element to contribute to
+ * @param id The id of the root element to contribute to
* @return The formatted string
*/
public static String menuAddition(String id) {
@@ -118,8 +113,7 @@ public class MenuUtil {
}
/**
- * @param id
- * The toolbar's id
+ * @param id The toolbar's id
* @return The lcoation URI for a toolbar with the given id
*/
public static String toolbarUri(String id) {
@@ -127,25 +121,20 @@ public class MenuUtil {
}
/**
- * @param id
- * The id of the toolbar
- * @param location
- * The relative location specifier
- * @param refId
- * The id of the toolbar element to be relative to
+ * @param id The id of the toolbar
+ * @param location The relative location specifier
+ * @param refId The id of the toolbar element to be relative to
* @return A location URI formatted with the given parameters
*/
- public static String toolbarAddition(String id, String location,
- String refId) {
+ public static String toolbarAddition(String id, String location, String refId) {
return toolbarUri(id) + '?' + location + '=' + refId;
}
/**
- * Convenience method to create a standard toolbar addition The resulting
- * string has the format: "toolbar:[id]?after=additions"
+ * Convenience method to create a standard toolbar addition The resulting string
+ * has the format: "toolbar:[id]?after=additions"
*
- * @param id
- * The id of the root element to contribute to
+ * @param id The id of the root element to contribute to
* @return The formatted string
*/
public static String toolbarAddition(String id) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/UIElement.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/UIElement.java
index 7d0b6ae8705..371bafe78e4 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/UIElement.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/UIElement.java
@@ -38,11 +38,9 @@ public abstract class UIElement {
* Construct a new instance of this class keyed off of the provided service
* locator.
*
- * @param serviceLocator
- * the locator. May not be <code>null</code>.
+ * @param serviceLocator the locator. May not be <code>null</code>.
*/
- protected UIElement(IServiceLocator serviceLocator)
- throws IllegalArgumentException {
+ protected UIElement(IServiceLocator serviceLocator) throws IllegalArgumentException {
if (serviceLocator == null)
throw new IllegalArgumentException();
this.serviceLocator = serviceLocator;
@@ -51,41 +49,36 @@ public abstract class UIElement {
/**
* Update the label on this UI element.
*
- * @param text
- * The new label to display.
+ * @param text The new label to display.
*/
public abstract void setText(String text);
/**
- * Update the tooltip on this UI element. Tooltips are currently only valid
- * for toolbar contributions.
+ * Update the tooltip on this UI element. Tooltips are currently only valid for
+ * toolbar contributions.
*
- * @param text
- * The new tooltip to display.
+ * @param text The new tooltip to display.
*/
public abstract void setTooltip(String text);
/**
* Update the icon on this UI element.
*
- * @param desc
- * The descriptor for the new icon to display.
+ * @param desc The descriptor for the new icon to display.
*/
public abstract void setIcon(ImageDescriptor desc);
/**
* Update the disabled icon on this UI element.
*
- * @param desc
- * The descriptor for the new icon to display.
+ * @param desc The descriptor for the new icon to display.
*/
public abstract void setDisabledIcon(ImageDescriptor desc);
/**
* Update the hover icon on this UI element.
*
- * @param desc
- * The descriptor for the new icon to display.
+ * @param desc The descriptor for the new icon to display.
*/
public abstract void setHoverIcon(ImageDescriptor desc);
@@ -93,22 +86,20 @@ public abstract class UIElement {
* Update the checked state on this UI element. For example, if this was a
* toggle or radio button.
*
- * @param checked
- * true to set toggle on
+ * @param checked true to set toggle on
*/
public abstract void setChecked(boolean checked);
/**
- * Get the service locator scope in which this UI element resides. May not
- * be <code>null</code>.
+ * Get the service locator scope in which this UI element resides. May not be
+ * <code>null</code>.
*
* <p>
- * The locator may be used to obtain services that are scoped in the same
- * way as the {@link UIElement}. Such services include but are not limited
- * to {@link IWorkbench}, {@link IWorkbenchWindow}, and
- * {@link IWorkbenchPartSite}. While this method may not return
- * <code>null</code> requests for any of these particular services may
- * return <code>null</code>.
+ * The locator may be used to obtain services that are scoped in the same way as
+ * the {@link UIElement}. Such services include but are not limited to
+ * {@link IWorkbench}, {@link IWorkbenchWindow}, and {@link IWorkbenchPartSite}.
+ * While this method may not return <code>null</code> requests for any of these
+ * particular services may return <code>null</code>.
* </p>
*
* @return the service locator for this element
@@ -120,15 +111,13 @@ public abstract class UIElement {
/**
* Set the menu contribution id to use. This is only applicable to menu
- * contributions that support a drop-down style menu. The default
- * implementation does nothing.
+ * contributions that support a drop-down style menu. The default implementation
+ * does nothing.
* <p>
* Example: element.setDropdownId("org.eclipse.ui.navigate.back.my.menu");
* </p>
*
- * @param id
- * used to populate the dropdown menu. Must not be
- * <code>null</code>.
+ * @param id used to populate the dropdown menu. Must not be <code>null</code>.
*/
public void setDropDownId(String id) {
// This does nothing.
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/WorkbenchWindowControlContribution.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/WorkbenchWindowControlContribution.java
index 84f6a44851a..d9f3513ca72 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/WorkbenchWindowControlContribution.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/WorkbenchWindowControlContribution.java
@@ -42,19 +42,18 @@ import org.eclipse.ui.internal.menus.InternalControlContribution;
public abstract class WorkbenchWindowControlContribution extends InternalControlContribution {
/**
- * Default contstructor that allows the use of this class as
- * the basis for XML contributions and will be used by the
- * workbench implementation. This is public only by necessity
- * and should not be used outside of the workbench implemenation
- * code.
+ * Default contstructor that allows the use of this class as the basis for XML
+ * contributions and will be used by the workbench implementation. This is
+ * public only by necessity and should not be used outside of the workbench
+ * implemenation code.
*/
public WorkbenchWindowControlContribution() {
this("unknown ID"); //$NON-NLS-1$
}
/**
- * Constructor for use by clients programmatically creating
- * control contributions in the workbench.
+ * Constructor for use by clients programmatically creating control
+ * contributions in the workbench.
*
* @param id The id of this contribution
*/
@@ -63,8 +62,7 @@ public abstract class WorkbenchWindowControlContribution extends InternalControl
}
/**
- * @return Returns the workbench window currently hosting
- * the control.
+ * @return Returns the workbench window currently hosting the control.
*/
@Override
public final IWorkbenchWindow getWorkbenchWindow() {
@@ -72,9 +70,9 @@ public abstract class WorkbenchWindowControlContribution extends InternalControl
}
/**
- * @return Returns the side of the workbench window that the
- * control is currently being display on. This allows derivatives
- * to tailor their created control based on the orientation...
+ * @return Returns the side of the workbench window that the control is
+ * currently being display on. This allows derivatives to tailor their
+ * created control based on the orientation...
*/
@Override
public final int getCurSide() {
@@ -90,17 +88,16 @@ public abstract class WorkbenchWindowControlContribution extends InternalControl
}
/**
- * Important: This method is *NOT* to be used/extended by clients. This is
- * for the internal use inside Workbench
+ * Important: This method is *NOT* to be used/extended by clients. This is for
+ * the internal use inside Workbench
*
- * @param parent
- * the parent composite
+ * @param parent the parent composite
* @return newly created Control
* @since 3.6
*
* @noreference This method is not intended to be referenced by clients.
- * @nooverride This method is not intended to be re-implemented or extended
- * by clients.
+ * @nooverride This method is not intended to be re-implemented or extended by
+ * clients.
*/
public Control delegateCreateControl(Composite parent) {
return createControl(parent);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/AdaptableList.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/AdaptableList.java
index a6624a58b0e..cc6f4dd3382 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/AdaptableList.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/AdaptableList.java
@@ -21,9 +21,9 @@ import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IAdaptable;
/**
- * A modifiable list of <code>IAdaptable</code> objects.
- * The list is adaptable to <code>IWorkbenchAdapter</code>, and can be used to
- * display an arbitrary set of adaptable objects in a viewer.
+ * A modifiable list of <code>IAdaptable</code> objects. The list is adaptable
+ * to <code>IWorkbenchAdapter</code>, and can be used to display an arbitrary
+ * set of adaptable objects in a viewer.
* <p>
* This class is not intended to be subclassed.
* </p>
@@ -34,119 +34,118 @@ import org.eclipse.core.runtime.IAdaptable;
*/
public class AdaptableList extends WorkbenchAdapter implements IAdaptable {
- protected List children = null;
+ protected List children = null;
- /**
- * Creates a new adaptable list. All of the elements in the list must
- * implement <code>IAdaptable</code>.
- */
- public AdaptableList() {
- children = new ArrayList();
- }
+ /**
+ * Creates a new adaptable list. All of the elements in the list must implement
+ * <code>IAdaptable</code>.
+ */
+ public AdaptableList() {
+ children = new ArrayList();
+ }
- /**
- * Creates a new adaptable list with the given initial capacity.
- * All of the elements in the list must implement <code>IAdaptable</code>.
- *
- * @param initialCapacity the initial capacity of the list
- */
- public AdaptableList(int initialCapacity) {
- children = new ArrayList(initialCapacity);
- }
+ /**
+ * Creates a new adaptable list with the given initial capacity. All of the
+ * elements in the list must implement <code>IAdaptable</code>.
+ *
+ * @param initialCapacity the initial capacity of the list
+ */
+ public AdaptableList(int initialCapacity) {
+ children = new ArrayList(initialCapacity);
+ }
- /**
- * Creates a new adaptable list containing the given children.
- *
- * @param newChildren the list of children
- */
- public AdaptableList(IAdaptable[] newChildren) {
- this(newChildren.length);
- for (IAdaptable adaptable : newChildren) {
- children.add(adaptable);
- }
- }
+ /**
+ * Creates a new adaptable list containing the given children.
+ *
+ * @param newChildren the list of children
+ */
+ public AdaptableList(IAdaptable[] newChildren) {
+ this(newChildren.length);
+ for (IAdaptable adaptable : newChildren) {
+ children.add(adaptable);
+ }
+ }
- /**
- * Creates a new adaptable list containing the elements of the specified
- * collection, in the order they are returned by the collection's iterator.
- * All of the elements in the list must implement <code>IAdaptable</code>.
- *
- * @param c the initial elements of this list (element type:
- * <code>IAdaptable</code>)
- */
- public AdaptableList(Collection c) {
- this(c.size());
- children.addAll(c);
- }
+ /**
+ * Creates a new adaptable list containing the elements of the specified
+ * collection, in the order they are returned by the collection's iterator. All
+ * of the elements in the list must implement <code>IAdaptable</code>.
+ *
+ * @param c the initial elements of this list (element type:
+ * <code>IAdaptable</code>)
+ */
+ public AdaptableList(Collection c) {
+ this(c.size());
+ children.addAll(c);
+ }
- /**
- * Adds the given adaptable object to this list.
- *
- * @param adaptable the new element
- * @return this list
- */
- public AdaptableList add(IAdaptable adaptable) {
- Assert.isNotNull(adaptable);
- children.add(adaptable);
- return this;
- }
+ /**
+ * Adds the given adaptable object to this list.
+ *
+ * @param adaptable the new element
+ * @return this list
+ */
+ public AdaptableList add(IAdaptable adaptable) {
+ Assert.isNotNull(adaptable);
+ children.add(adaptable);
+ return this;
+ }
- /**
- * Removes the given adaptable object from this list.
- *
- * @param adaptable the element to remove
- */
- public void remove(IAdaptable adaptable) {
- Assert.isNotNull(adaptable);
- children.remove(adaptable);
- }
+ /**
+ * Removes the given adaptable object from this list.
+ *
+ * @param adaptable the element to remove
+ */
+ public void remove(IAdaptable adaptable) {
+ Assert.isNotNull(adaptable);
+ children.remove(adaptable);
+ }
- /**
- * Returns the number of children in this list.
- *
- * @return the length of this list
- */
- public int size() {
- return children.size();
- }
+ /**
+ * Returns the number of children in this list.
+ *
+ * @return the length of this list
+ */
+ public int size() {
+ return children.size();
+ }
@Override
public <T> T getAdapter(Class<T> adapter) {
- if (adapter == IWorkbenchAdapter.class) {
+ if (adapter == IWorkbenchAdapter.class) {
return adapter.cast(this);
- }
- return null;
- }
+ }
+ return null;
+ }
- @Override
+ @Override
public Object[] getChildren(Object o) {
- // @issue suspicious - does not reference parameter
- return children.toArray();
- }
+ // @issue suspicious - does not reference parameter
+ return children.toArray();
+ }
- /**
- * Returns the elements in this list.
- *
- * @return the elements in this list
- */
- public Object[] getChildren() {
- return children.toArray();
- }
+ /**
+ * Returns the elements in this list.
+ *
+ * @return the elements in this list
+ */
+ public Object[] getChildren() {
+ return children.toArray();
+ }
- /**
- * Return the elements in this list in an array of the given type.
- *
- * @param type the type of the array to create
- * @return the elements in the list
- * @since 3.1
- */
- public Object[] getTypedChildren(Class type) {
- return children.toArray((Object[]) Array.newInstance(type, children
- .size()));
+ /**
+ * Return the elements in this list in an array of the given type.
+ *
+ * @param type the type of the array to create
+ * @return the elements in the list
+ * @since 3.1
+ */
+ public Object[] getTypedChildren(Class type) {
+ return children.toArray((Object[]) Array.newInstance(type, children.size()));
}
- @Override
+ @Override
public String toString() {
- return children.toString();
- }
+ return children.toString();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/BaseWorkbenchContentProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/BaseWorkbenchContentProvider.java
index 647b5c09066..f0716323def 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/BaseWorkbenchContentProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/BaseWorkbenchContentProvider.java
@@ -29,62 +29,61 @@ import org.eclipse.jface.viewers.Viewer;
*/
public class BaseWorkbenchContentProvider implements ITreeContentProvider {
- /**
- * Creates a new workbench content provider.
- *
- */
- public BaseWorkbenchContentProvider() {
- super();
- }
+ /**
+ * Creates a new workbench content provider.
+ *
+ */
+ public BaseWorkbenchContentProvider() {
+ super();
+ }
- @Override
+ @Override
public void dispose() {
- // do nothing
- }
+ // do nothing
+ }
- /**
- * Returns the implementation of IWorkbenchAdapter for the given
- * object. Returns null if the adapter is not defined or the
- * object is not adaptable.
- *
- * @param element the element
- * @return the corresponding workbench adapter object
- */
- protected IWorkbenchAdapter getAdapter(Object element) {
- return Adapters.adapt(element, IWorkbenchAdapter.class);
- }
+ /**
+ * Returns the implementation of IWorkbenchAdapter for the given object. Returns
+ * null if the adapter is not defined or the object is not adaptable.
+ *
+ * @param element the element
+ * @return the corresponding workbench adapter object
+ */
+ protected IWorkbenchAdapter getAdapter(Object element) {
+ return Adapters.adapt(element, IWorkbenchAdapter.class);
+ }
- @Override
+ @Override
public Object[] getChildren(Object element) {
- IWorkbenchAdapter adapter = getAdapter(element);
- if (adapter != null) {
- return adapter.getChildren(element);
- }
- return new Object[0];
- }
+ IWorkbenchAdapter adapter = getAdapter(element);
+ if (adapter != null) {
+ return adapter.getChildren(element);
+ }
+ return new Object[0];
+ }
- @Override
+ @Override
public Object[] getElements(Object element) {
- return getChildren(element);
- }
+ return getChildren(element);
+ }
- @Override
+ @Override
public Object getParent(Object element) {
- IWorkbenchAdapter adapter = getAdapter(element);
- if (adapter != null) {
- return adapter.getParent(element);
- }
- return null;
- }
+ IWorkbenchAdapter adapter = getAdapter(element);
+ if (adapter != null) {
+ return adapter.getParent(element);
+ }
+ return null;
+ }
- @Override
+ @Override
public boolean hasChildren(Object element) {
- return getChildren(element).length > 0;
- }
+ return getChildren(element).length > 0;
+ }
- @Override
+ @Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // do nothing
- }
+ // do nothing
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/ContributionComparator.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/ContributionComparator.java
index f6e782a7dd2..7a293b624fc 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/ContributionComparator.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/ContributionComparator.java
@@ -28,15 +28,16 @@ import org.eclipse.jface.viewers.ViewerComparator;
* {@link ViewerComparator} (for {@link StructuredViewer}s) or as a traditional
* {@link Comparator}.
*
- * This class orders contributions by first grouping by priority ({@link IComparableContribution#getPriority()})
- * and then by utilizing the JFace policy comparator to order by label ({@link IComparableContribution#getLabel()}).
+ * This class orders contributions by first grouping by priority
+ * ({@link IComparableContribution#getPriority()}) and then by utilizing the
+ * JFace policy comparator to order by label
+ * ({@link IComparableContribution#getLabel()}).
*
* @see IComparableContribution
*
* @since 3.4
*/
-public class ContributionComparator extends ViewerComparator implements
- Comparator {
+public class ContributionComparator extends ViewerComparator implements Comparator {
/**
* This implementation of {@link Comparator#compare(Object, Object)} does a
@@ -70,39 +71,36 @@ public class ContributionComparator extends ViewerComparator implements
/**
* Tries to extract a useful string for comparison from the provided object.
- * This method is a workaround for bug 226547. Looking forward we need a
- * more sensible answer to this problem.
+ * This method is a workaround for bug 226547. Looking forward we need a more
+ * sensible answer to this problem.
*
- * @param o
- * the object to test
- * @return the comparison string
- * TODO : remove this method and replace it with a sensible solution
+ * @param o the object to test
+ * @return the comparison string TODO : remove this method and replace it with a
+ * sensible solution
*/
private String getComparisonString(Object o) {
if (o instanceof IPreferenceNode) {
- return ((IPreferenceNode)o).getLabelText();
+ return ((IPreferenceNode) o).getLabelText();
}
return o.toString();
}
/**
- * Returns a negative, zero, or positive number depending on whether the
- * first element is less than, equal to, or greater than the second element.
+ * Returns a negative, zero, or positive number depending on whether the first
+ * element is less than, equal to, or greater than the second element.
* <p>
- * The default implementation of this method is based on comparing the
- * elements' categories as computed by the <code>category</code> framework
- * method. Elements within the same category are further subjected to a case
- * insensitive compare of their label strings. Subclasses may override.
+ * The default implementation of this method is based on comparing the elements'
+ * categories as computed by the <code>category</code> framework method.
+ * Elements within the same category are further subjected to a case insensitive
+ * compare of their label strings. Subclasses may override.
* </p>
*
- * @param c1
- * the first element
- * @param c2
- * the second element
+ * @param c1 the first element
+ * @param c2 the second element
* @return a negative number if the first element is less than the second
- * element; the value <code>0</code> if the first element is equal
- * to the second element; and a positive number if the first element
- * is greater than the second element
+ * element; the value <code>0</code> if the first element is equal to
+ * the second element; and a positive number if the first element is
+ * greater than the second element
*/
public int compare(IComparableContribution c1, IComparableContribution c2) {
int cat1 = category(c1);
@@ -132,18 +130,16 @@ public class ContributionComparator extends ViewerComparator implements
}
/**
- * Returns the category of the given element. The category is a number used
- * to allocate elements to bins; the bins are arranged in ascending numeric
- * order. The elements within a bin are arranged via a second level sort
- * criterion.
+ * Returns the category of the given element. The category is a number used to
+ * allocate elements to bins; the bins are arranged in ascending numeric order.
+ * The elements within a bin are arranged via a second level sort criterion.
* <p>
* The default implementation of this framework method returns the result of
- * {@link IComparableContribution#getPriority()}. Subclasses may
- * re-implement this method to provide non-trivial categorization.
+ * {@link IComparableContribution#getPriority()}. Subclasses may re-implement
+ * this method to provide non-trivial categorization.
* </p>
*
- * @param c
- * the element
+ * @param c the element
* @return the category
*/
public int category(IComparableContribution c) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/IComparableContribution.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/IComparableContribution.java
index 50508c7f60d..a52918a0786 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/IComparableContribution.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/IComparableContribution.java
@@ -51,11 +51,12 @@ public interface IComparableContribution extends IAdaptable {
* Possible adaptations include:
* <dl>
* <dt>{@link org.eclipse.core.runtime.IConfigurationElement}</dt>
- * <dd>useful for contributions that eventually work back to registry
- * elements. The majority of {@link IComparableContribution} instances
- * provided by the platform will provide this adapter.</dd>
+ * <dd>useful for contributions that eventually work back to registry elements.
+ * The majority of {@link IComparableContribution} instances provided by the
+ * platform will provide this adapter.</dd>
* </dl>
*/
- @Override <T> T getAdapter(Class<T> adapter);
+ @Override
+ <T> T getAdapter(Class<T> adapter);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/IContributionService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/IContributionService.java
index e9916997990..7923b1c1daf 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/IContributionService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/IContributionService.java
@@ -37,8 +37,8 @@ public interface IContributionService {
/**
* Return a comparator for ordering contributions within the user interface.
*
- * @param contributionType
- * the type of contribution, must not be <code>null</code>.
+ * @param contributionType the type of contribution, must not be
+ * <code>null</code>.
* @return the comparator
* @see #TYPE_PREFERENCE
* @see #TYPE_PROPERTY
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/IWorkbenchAdapter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/IWorkbenchAdapter.java
index fd8c21c6c62..0ee867451f0 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/IWorkbenchAdapter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/IWorkbenchAdapter.java
@@ -16,55 +16,54 @@ package org.eclipse.ui.model;
import org.eclipse.jface.resource.ImageDescriptor;
/**
- * This adapter interface provides visual presentation and hierarchical structure
- * for workbench elements, allowing them to be displayed in the UI
+ * This adapter interface provides visual presentation and hierarchical
+ * structure for workbench elements, allowing them to be displayed in the UI
* without having to know the concrete type of the element.
* <p>
* There is an associate label provider and content provider for showing
* elements with a registered workbench adapter in JFace structured viewers.
* </p>
+ *
* @see WorkbenchLabelProvider
* @see BaseWorkbenchContentProvider
*/
public interface IWorkbenchAdapter {
- /**
- * Returns the children of this object. When this object
- * is displayed in a tree, the returned objects will be this
- * element's children. Returns an empty array if this
- * object has no children.
- *
- * @param o The object to get the children for.
- * @return Object[]
- */
- Object[] getChildren(Object o);
+ /**
+ * Returns the children of this object. When this object is displayed in a tree,
+ * the returned objects will be this element's children. Returns an empty array
+ * if this object has no children.
+ *
+ * @param o The object to get the children for.
+ * @return Object[]
+ */
+ Object[] getChildren(Object o);
- /**
- * Returns an image descriptor to be used for displaying an object in the workbench.
- * Returns <code>null</code> if there is no appropriate image.
- *
- * @param object The object to get an image descriptor for.
- * @return ImageDescriptor
- */
- ImageDescriptor getImageDescriptor(Object object);
+ /**
+ * Returns an image descriptor to be used for displaying an object in the
+ * workbench. Returns <code>null</code> if there is no appropriate image.
+ *
+ * @param object The object to get an image descriptor for.
+ * @return ImageDescriptor
+ */
+ ImageDescriptor getImageDescriptor(Object object);
- /**
- * Returns the label text for this element. This is typically
- * used to assign a label to this object when displayed
- * in the UI. Returns an empty string if there is no appropriate
- * label text for this object.
- *
- * @param o The object to get a label for.
- * @return String
- */
- String getLabel(Object o);
+ /**
+ * Returns the label text for this element. This is typically used to assign a
+ * label to this object when displayed in the UI. Returns an empty string if
+ * there is no appropriate label text for this object.
+ *
+ * @param o The object to get a label for.
+ * @return String
+ */
+ String getLabel(Object o);
- /**
- * Returns the logical parent of the given object in its tree.
- * Returns <code>null</code> if there is no parent, or if this object doesn't
- * belong to a tree.
- *
- * @param o The object to get the parent for.
- * @return Object
- */
- Object getParent(Object o);
+ /**
+ * Returns the logical parent of the given object in its tree. Returns
+ * <code>null</code> if there is no parent, or if this object doesn't belong to
+ * a tree.
+ *
+ * @param o The object to get the parent for.
+ * @return Object
+ */
+ Object getParent(Object o);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/IWorkbenchAdapter2.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/IWorkbenchAdapter2.java
index 2f1310a1600..434f5e251ab 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/IWorkbenchAdapter2.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/IWorkbenchAdapter2.java
@@ -23,6 +23,7 @@ import org.eclipse.swt.graphics.RGB;
* There is an associate label provider and content provider for showing
* elements with a registered workbench adapter in JFace structured viewers.
* </p>
+ *
* @see IWorkbenchAdapter
* @see WorkbenchLabelProvider
* @see BaseWorkbenchContentProvider
@@ -30,31 +31,31 @@ import org.eclipse.swt.graphics.RGB;
*/
public interface IWorkbenchAdapter2 {
- /**
- * Provides a foreground color for the given element.
- *
- * @param element the element
- * @return the foreground color for the element, or <code>null</code>
- * to use the default foreground color
- */
- RGB getForeground(Object element);
+ /**
+ * Provides a foreground color for the given element.
+ *
+ * @param element the element
+ * @return the foreground color for the element, or <code>null</code> to use the
+ * default foreground color
+ */
+ RGB getForeground(Object element);
- /**
- * Provides a background color for the given element.
- *
- * @param element the element
- * @return the background color for the element, or <code>null</code>
- * to use the default background color
- */
- RGB getBackground(Object element);
+ /**
+ * Provides a background color for the given element.
+ *
+ * @param element the element
+ * @return the background color for the element, or <code>null</code> to use the
+ * default background color
+ */
+ RGB getBackground(Object element);
- /**
- * Provides a font the given element.
- *
- * @param element the element
- * @return the font for the element, or <code>null</code>
- * to use the default font
- */
- FontData getFont(Object element);
+ /**
+ * Provides a font the given element.
+ *
+ * @param element the element
+ * @return the font for the element, or <code>null</code> to use the default
+ * font
+ */
+ FontData getFont(Object element);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/IWorkbenchAdapter3.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/IWorkbenchAdapter3.java
index 18590927412..12342a09e8c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/IWorkbenchAdapter3.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/IWorkbenchAdapter3.java
@@ -32,8 +32,7 @@ public interface IWorkbenchAdapter3 {
/**
* Returns the styled text label for the given element.
*
- * @param element
- * the element to evaluate the styled string for.
+ * @param element the element to evaluate the styled string for.
*
* @return the styled string.
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/PerspectiveLabelProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/PerspectiveLabelProvider.java
index 3d798d33176..9850e45fe60 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/PerspectiveLabelProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/PerspectiveLabelProvider.java
@@ -37,96 +37,93 @@ import org.eclipse.ui.internal.WorkbenchMessages;
*
* @since 3.0
*/
-public final class PerspectiveLabelProvider extends LabelProvider implements
- ITableLabelProvider {
+public final class PerspectiveLabelProvider extends LabelProvider implements ITableLabelProvider {
- /**
- * List of all Image objects this label provider is responsible for.
- */
- private HashMap imageCache = new HashMap(5);
+ /**
+ * List of all Image objects this label provider is responsible for.
+ */
+ private HashMap imageCache = new HashMap(5);
- /**
- * Indicates whether the default perspective is visually marked.
- */
- private boolean markDefault;
+ /**
+ * Indicates whether the default perspective is visually marked.
+ */
+ private boolean markDefault;
- /**
- * Creates a new label provider for perspectives.
- * The default perspective is visually marked.
- */
- public PerspectiveLabelProvider() {
- this(true);
- }
+ /**
+ * Creates a new label provider for perspectives. The default perspective is
+ * visually marked.
+ */
+ public PerspectiveLabelProvider() {
+ this(true);
+ }
- /**
- * Creates a new label provider for perspectives.
- *
- * @param markDefault <code>true</code> if the default perspective is to be
- * visually marked, and <code>false</code> if the default perspective is
- * not treated as anything special
- */
- public PerspectiveLabelProvider(boolean markDefault) {
- super();
- this.markDefault = markDefault;
- }
+ /**
+ * Creates a new label provider for perspectives.
+ *
+ * @param markDefault <code>true</code> if the default perspective is to be
+ * visually marked, and <code>false</code> if the default
+ * perspective is not treated as anything special
+ */
+ public PerspectiveLabelProvider(boolean markDefault) {
+ super();
+ this.markDefault = markDefault;
+ }
- @Override
+ @Override
public Image getImage(Object element) {
- if (element instanceof IPerspectiveDescriptor) {
- IPerspectiveDescriptor desc = (IPerspectiveDescriptor) element;
- ImageDescriptor imageDescriptor = desc.getImageDescriptor();
- if (imageDescriptor == null) {
- imageDescriptor = WorkbenchImages
- .getImageDescriptor(ISharedImages.IMG_ETOOL_DEF_PERSPECTIVE);
- }
- Image image = (Image) imageCache.get(imageDescriptor);
- if (image == null) {
- image = imageDescriptor.createImage();
- imageCache.put(imageDescriptor, image);
- }
- return image;
- }
- return null;
- }
+ if (element instanceof IPerspectiveDescriptor) {
+ IPerspectiveDescriptor desc = (IPerspectiveDescriptor) element;
+ ImageDescriptor imageDescriptor = desc.getImageDescriptor();
+ if (imageDescriptor == null) {
+ imageDescriptor = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_ETOOL_DEF_PERSPECTIVE);
+ }
+ Image image = (Image) imageCache.get(imageDescriptor);
+ if (image == null) {
+ image = imageDescriptor.createImage();
+ imageCache.put(imageDescriptor, image);
+ }
+ return image;
+ }
+ return null;
+ }
- @Override
+ @Override
public void dispose() {
- for (Iterator i = imageCache.values().iterator(); i.hasNext();) {
- ((Image) i.next()).dispose();
- }
- imageCache.clear();
- }
+ for (Iterator i = imageCache.values().iterator(); i.hasNext();) {
+ ((Image) i.next()).dispose();
+ }
+ imageCache.clear();
+ }
- @Override
+ @Override
public String getText(Object element) {
- if (element instanceof IPerspectiveDescriptor) {
- IPerspectiveDescriptor desc = (IPerspectiveDescriptor) element;
- String label = desc.getLabel();
- if (markDefault) {
- String def = PlatformUI.getWorkbench().getPerspectiveRegistry()
- .getDefaultPerspective();
- if (desc.getId().equals(def)) {
- label = NLS.bind(WorkbenchMessages.PerspectivesPreference_defaultLabel, label );
- }
- }
- return label;
- }
- return WorkbenchMessages.PerspectiveLabelProvider_unknown;
- }
+ if (element instanceof IPerspectiveDescriptor) {
+ IPerspectiveDescriptor desc = (IPerspectiveDescriptor) element;
+ String label = desc.getLabel();
+ if (markDefault) {
+ String def = PlatformUI.getWorkbench().getPerspectiveRegistry().getDefaultPerspective();
+ if (desc.getId().equals(def)) {
+ label = NLS.bind(WorkbenchMessages.PerspectivesPreference_defaultLabel, label);
+ }
+ }
+ return label;
+ }
+ return WorkbenchMessages.PerspectiveLabelProvider_unknown;
+ }
- /**
- * @see ITableLabelProvider#getColumnImage
- */
- @Override
+ /**
+ * @see ITableLabelProvider#getColumnImage
+ */
+ @Override
public Image getColumnImage(Object element, int columnIndex) {
- return getImage(element);
- }
+ return getImage(element);
+ }
- /**
- * @see ITableLabelProvider#getColumnText
- */
- @Override
+ /**
+ * @see ITableLabelProvider#getColumnText
+ */
+ @Override
public String getColumnText(Object element, int columnIndex) {
- return getText(element);
- }
+ return getText(element);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/WorkbenchAdapter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/WorkbenchAdapter.java
index cdefa49b2a2..19f31ba9407 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/WorkbenchAdapter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/WorkbenchAdapter.java
@@ -25,89 +25,87 @@ import org.eclipse.swt.graphics.RGB;
*
* @since 3.0
*/
-public abstract class WorkbenchAdapter implements IWorkbenchAdapter,
- IWorkbenchAdapter2, IWorkbenchAdapter3 {
- /**
- * The empty list of children.
- */
- protected static final Object[] NO_CHILDREN = new Object[0];
+public abstract class WorkbenchAdapter implements IWorkbenchAdapter, IWorkbenchAdapter2, IWorkbenchAdapter3 {
+ /**
+ * The empty list of children.
+ */
+ protected static final Object[] NO_CHILDREN = new Object[0];
- /**
- * The default implementation of this <code>IWorkbenchAdapter</code> method
- * returns the empty list. Subclasses may override.
- */
- @Override
+ /**
+ * The default implementation of this <code>IWorkbenchAdapter</code> method
+ * returns the empty list. Subclasses may override.
+ */
+ @Override
public Object[] getChildren(Object object) {
- return NO_CHILDREN;
- }
+ return NO_CHILDREN;
+ }
- /**
- * The default implementation of this <code>IWorkbenchAdapter</code> method
- * returns <code>null</code>. Subclasses may override.
- */
- @Override
+ /**
+ * The default implementation of this <code>IWorkbenchAdapter</code> method
+ * returns <code>null</code>. Subclasses may override.
+ */
+ @Override
public ImageDescriptor getImageDescriptor(Object object) {
- return null;
- }
+ return null;
+ }
- /**
- * The default implementation of this <code>IWorkbenchAdapter</code> method
- * returns the empty string if the object is <code>null</code>, and
- * the object's <code>toString</code> otherwise. Subclasses may override.
- */
- @Override
+ /**
+ * The default implementation of this <code>IWorkbenchAdapter</code> method
+ * returns the empty string if the object is <code>null</code>, and the object's
+ * <code>toString</code> otherwise. Subclasses may override.
+ */
+ @Override
public String getLabel(Object object) {
- return object == null ? "" : object.toString(); //$NON-NLS-1$
- }
+ return object == null ? "" : object.toString(); //$NON-NLS-1$
+ }
- /**
- * The default implementation of this <code>IWorkbenchAdapter</code> method
- * returns <code>null</code>. Subclasses may override.
- */
- @Override
+ /**
+ * The default implementation of this <code>IWorkbenchAdapter</code> method
+ * returns <code>null</code>. Subclasses may override.
+ */
+ @Override
public Object getParent(Object object) {
- return null;
- }
+ return null;
+ }
- /**
- * The default implementation of this <code>IWorkbenchAdapter2</code> method
- * returns <code>null</code>. Subclasses may override.
- */
- @Override
+ /**
+ * The default implementation of this <code>IWorkbenchAdapter2</code> method
+ * returns <code>null</code>. Subclasses may override.
+ */
+ @Override
public RGB getBackground(Object element) {
- return null;
- }
+ return null;
+ }
- /**
- * The default implementation of this <code>IWorkbenchAdapter2</code> method
- * returns <code>null</code>. Subclasses may override.
- */
- @Override
+ /**
+ * The default implementation of this <code>IWorkbenchAdapter2</code> method
+ * returns <code>null</code>. Subclasses may override.
+ */
+ @Override
public RGB getForeground(Object element) {
- return null;
- }
+ return null;
+ }
- /**
- * The default implementation of this <code>IWorkbenchAdapter2</code> method
- * returns <code>null</code>. Subclasses may override.
- */
- @Override
+ /**
+ * The default implementation of this <code>IWorkbenchAdapter2</code> method
+ * returns <code>null</code>. Subclasses may override.
+ */
+ @Override
public FontData getFont(Object element) {
- return null;
- }
+ return null;
+ }
/**
* The default implementation of this <code>IWorkbenchAdapter3</code> method
* returns the {@link StyledString} which wraps the label of the element.
* Subclasses may override.
*
- * @return Return the {@link StyledString} which wraps the label of the
- * element.
+ * @return Return the {@link StyledString} which wraps the label of the element.
*
* @since 3.7
*/
@Override
public StyledString getStyledText(Object object) {
return new StyledString(getLabel(object));
- }
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/WorkbenchLabelProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/WorkbenchLabelProvider.java
index c8b377875c9..9470c33ebd6 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/WorkbenchLabelProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/WorkbenchLabelProvider.java
@@ -42,117 +42,112 @@ import org.eclipse.ui.PlatformUI;
/**
* Provides basic labels for adaptable objects that have the
- * <code>IWorkbenchAdapter</code> adapter associated with them. All dispensed
- * images are cached until the label provider is explicitly disposed.
- * This class provides a facility for subclasses to define annotations
- * on the labels and icons of adaptable objects.
+ * <code>IWorkbenchAdapter</code> adapter associated with them. All dispensed
+ * images are cached until the label provider is explicitly disposed. This class
+ * provides a facility for subclasses to define annotations on the labels and
+ * icons of adaptable objects.
*/
-public class WorkbenchLabelProvider extends LabelProvider implements
- IColorProvider, IFontProvider, IStyledLabelProvider {
+public class WorkbenchLabelProvider extends LabelProvider
+ implements IColorProvider, IFontProvider, IStyledLabelProvider {
- /**
+ /**
* Returns a workbench label provider that is hooked up to the decorator
* mechanism.
*
* @return a new <code>DecoratingLabelProvider</code> which wraps a new
* <code>WorkbenchLabelProvider</code>
*/
- public static ILabelProvider getDecoratingWorkbenchLabelProvider() {
- return new DecoratingLabelProvider(new WorkbenchLabelProvider(),
- PlatformUI.getWorkbench().getDecoratorManager()
- .getLabelDecorator());
- }
+ public static ILabelProvider getDecoratingWorkbenchLabelProvider() {
+ return new DecoratingLabelProvider(new WorkbenchLabelProvider(),
+ PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator());
+ }
- /**
- * Listener that tracks changes to the editor registry and does a full update
- * when it changes, since many workbench adapters derive their icon from the file
- * associations in the registry.
- */
- private IPropertyListener editorRegistryListener = (source, propId) -> {
+ /**
+ * Listener that tracks changes to the editor registry and does a full update
+ * when it changes, since many workbench adapters derive their icon from the
+ * file associations in the registry.
+ */
+ private IPropertyListener editorRegistryListener = (source, propId) -> {
if (propId == IEditorRegistry.PROP_CONTENTS) {
fireLabelProviderChanged(new LabelProviderChangedEvent(WorkbenchLabelProvider.this));
}
};
private ResourceManager resourceManager;
- /**
- * Creates a new workbench label provider.
- */
- public WorkbenchLabelProvider() {
- PlatformUI.getWorkbench().getEditorRegistry().addPropertyListener(editorRegistryListener);
- }
+ /**
+ * Creates a new workbench label provider.
+ */
+ public WorkbenchLabelProvider() {
+ PlatformUI.getWorkbench().getEditorRegistry().addPropertyListener(editorRegistryListener);
+ }
- /**
- * Returns an image descriptor that is based on the given descriptor,
- * but decorated with additional information relating to the state
- * of the provided object.
- *
- * Subclasses may reimplement this method to decorate an object's
- * image.
- *
- * @param input The base image to decorate.
- * @param element The element used to look up decorations.
- * @return the resuling ImageDescriptor.
- * @see org.eclipse.jface.resource.CompositeImageDescriptor
- */
- protected ImageDescriptor decorateImage(ImageDescriptor input,
- Object element) {
- return input;
- }
+ /**
+ * Returns an image descriptor that is based on the given descriptor, but
+ * decorated with additional information relating to the state of the provided
+ * object.
+ *
+ * Subclasses may reimplement this method to decorate an object's image.
+ *
+ * @param input The base image to decorate.
+ * @param element The element used to look up decorations.
+ * @return the resuling ImageDescriptor.
+ * @see org.eclipse.jface.resource.CompositeImageDescriptor
+ */
+ protected ImageDescriptor decorateImage(ImageDescriptor input, Object element) {
+ return input;
+ }
- /**
- * Returns a label that is based on the given label,
- * but decorated with additional information relating to the state
- * of the provided object.
- *
- * Subclasses may implement this method to decorate an object's
- * label.
- * @param input The base text to decorate.
- * @param element The element used to look up decorations.
- * @return the resulting text
- */
- protected String decorateText(String input, Object element) {
- return input;
- }
+ /**
+ * Returns a label that is based on the given label, but decorated with
+ * additional information relating to the state of the provided object.
+ *
+ * Subclasses may implement this method to decorate an object's label.
+ *
+ * @param input The base text to decorate.
+ * @param element The element used to look up decorations.
+ * @return the resulting text
+ */
+ protected String decorateText(String input, Object element) {
+ return input;
+ }
- @Override
+ @Override
public void dispose() {
- PlatformUI.getWorkbench().getEditorRegistry().removePropertyListener(editorRegistryListener);
+ PlatformUI.getWorkbench().getEditorRegistry().removePropertyListener(editorRegistryListener);
if (resourceManager != null)
resourceManager.dispose();
- resourceManager = null;
- super.dispose();
- }
+ resourceManager = null;
+ super.dispose();
+ }
- /**
- * Returns the implementation of IWorkbenchAdapter for the given
- * object.
- * @param o the object to look up.
- * @return IWorkbenchAdapter or<code>null</code> if the adapter is not defined or the
- * object is not adaptable.
- */
- protected final IWorkbenchAdapter getAdapter(Object o) {
- return Adapters.adapt(o, IWorkbenchAdapter.class);
- }
+ /**
+ * Returns the implementation of IWorkbenchAdapter for the given object.
+ *
+ * @param o the object to look up.
+ * @return IWorkbenchAdapter or<code>null</code> if the adapter is not defined
+ * or the object is not adaptable.
+ */
+ protected final IWorkbenchAdapter getAdapter(Object o) {
+ return Adapters.adapt(o, IWorkbenchAdapter.class);
+ }
- /**
- * Returns the implementation of IWorkbenchAdapter2 for the given
- * object.
- * @param o the object to look up.
- * @return IWorkbenchAdapter2 or<code>null</code> if the adapter is not defined or the
- * object is not adaptable.
- */
- protected final IWorkbenchAdapter2 getAdapter2(Object o) {
- return Adapters.adapt(o, IWorkbenchAdapter2.class);
- }
+ /**
+ * Returns the implementation of IWorkbenchAdapter2 for the given object.
+ *
+ * @param o the object to look up.
+ * @return IWorkbenchAdapter2 or<code>null</code> if the adapter is not defined
+ * or the object is not adaptable.
+ */
+ protected final IWorkbenchAdapter2 getAdapter2(Object o) {
+ return Adapters.adapt(o, IWorkbenchAdapter2.class);
+ }
/**
* Returns the implementation of IWorkbenchAdapter3 for the given object.
*
- * @param o
- * the object to look up.
- * @return IWorkbenchAdapter3 or<code>null</code> if the adapter is not
- * defined or the object is not adaptable.
+ * @param o the object to look up.
+ * @return IWorkbenchAdapter3 or<code>null</code> if the adapter is not defined
+ * or the object is not adaptable.
* @since 3.7
*/
protected final IWorkbenchAdapter3 getAdapter3(Object o) {
@@ -166,45 +161,43 @@ public class WorkbenchLabelProvider extends LabelProvider implements
*/
private ResourceManager getResourceManager() {
if (resourceManager == null) {
- resourceManager = new LocalResourceManager(JFaceResources
- .getResources());
+ resourceManager = new LocalResourceManager(JFaceResources.getResources());
}
return resourceManager;
}
- @Override
+ @Override
public final Image getImage(Object element) {
- //obtain the base image by querying the element
- IWorkbenchAdapter adapter = getAdapter(element);
- if (adapter == null) {
- return null;
- }
- ImageDescriptor descriptor = adapter.getImageDescriptor(element);
- if (descriptor == null) {
- return null;
- }
+ // obtain the base image by querying the element
+ IWorkbenchAdapter adapter = getAdapter(element);
+ if (adapter == null) {
+ return null;
+ }
+ ImageDescriptor descriptor = adapter.getImageDescriptor(element);
+ if (descriptor == null) {
+ return null;
+ }
- //add any annotations to the image descriptor
- descriptor = decorateImage(descriptor, element);
+ // add any annotations to the image descriptor
+ descriptor = decorateImage(descriptor, element);
return (Image) getResourceManager().get(descriptor);
- }
+ }
/**
* The default implementation of this returns the styled text label for the
* given element.
*
- * @param element
- * the element to evaluate the styled string for
+ * @param element the element to evaluate the styled string for
*
* @return the styled string.
*
* @since 3.7
*/
- @Override
+ @Override
public StyledString getStyledText(Object element) {
- IWorkbenchAdapter3 adapter = getAdapter3(element);
+ IWorkbenchAdapter3 adapter = getAdapter3(element);
if (adapter == null) {
// If adapter class doesn't implement IWorkbenchAdapter3 than use
// StyledString with text of element. Since the output of getText is
@@ -218,15 +211,14 @@ public class WorkbenchLabelProvider extends LabelProvider implements
String decorated = decorateText(styledString.getString(), element);
Styler styler = getDecorationStyle(element);
return StyledCellLabelProvider.styleDecoratedString(decorated, styler, styledString);
- }
+ }
/**
* Sets the {@link Styler} to be used for string decorations. By default the
* {@link StyledString#DECORATIONS_STYLER decoration style}. Clients can
* override.
*
- * @param element
- * the element that has been decorated
+ * @param element the element that has been decorated
*
* @return return the decoration style
*
@@ -236,57 +228,54 @@ public class WorkbenchLabelProvider extends LabelProvider implements
return StyledString.DECORATIONS_STYLER;
}
- @Override
+ @Override
public final String getText(Object element) {
- //query the element for its label
- IWorkbenchAdapter adapter = getAdapter(element);
- if (adapter == null) {
- return ""; //$NON-NLS-1$
- }
- String label = adapter.getLabel(element);
+ // query the element for its label
+ IWorkbenchAdapter adapter = getAdapter(element);
+ if (adapter == null) {
+ return ""; //$NON-NLS-1$
+ }
+ String label = adapter.getLabel(element);
- //return the decorated label
- return decorateText(label, element);
- }
+ // return the decorated label
+ return decorateText(label, element);
+ }
- @Override
+ @Override
public Color getForeground(Object element) {
- return getColor(element, true);
- }
+ return getColor(element, true);
+ }
- @Override
+ @Override
public Color getBackground(Object element) {
- return getColor(element, false);
- }
+ return getColor(element, false);
+ }
- @Override
+ @Override
public Font getFont(Object element) {
- IWorkbenchAdapter2 adapter = getAdapter2(element);
- if (adapter == null) {
- return null;
- }
+ IWorkbenchAdapter2 adapter = getAdapter2(element);
+ if (adapter == null) {
+ return null;
+ }
- FontData descriptor = adapter.getFont(element);
- if (descriptor == null) {
- return null;
- }
+ FontData descriptor = adapter.getFont(element);
+ if (descriptor == null) {
+ return null;
+ }
- return (Font) getResourceManager().get(
- FontDescriptor.createFrom(descriptor));
- }
+ return (Font) getResourceManager().get(FontDescriptor.createFrom(descriptor));
+ }
- private Color getColor(Object element, boolean forground) {
- IWorkbenchAdapter2 adapter = getAdapter2(element);
- if (adapter == null) {
- return null;
- }
- RGB descriptor = forground ? adapter.getForeground(element) : adapter
- .getBackground(element);
- if (descriptor == null) {
- return null;
- }
+ private Color getColor(Object element, boolean forground) {
+ IWorkbenchAdapter2 adapter = getAdapter2(element);
+ if (adapter == null) {
+ return null;
+ }
+ RGB descriptor = forground ? adapter.getForeground(element) : adapter.getBackground(element);
+ if (descriptor == null) {
+ return null;
+ }
- return (Color) getResourceManager().get(
- ColorDescriptor.createFrom(descriptor));
- }
+ return (Color) getResourceManager().get(ColorDescriptor.createFrom(descriptor));
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/WorkbenchPartLabelProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/WorkbenchPartLabelProvider.java
index a457fc33de3..d2ff875ec36 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/WorkbenchPartLabelProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/WorkbenchPartLabelProvider.java
@@ -28,96 +28,94 @@ import org.eclipse.ui.Saveable;
import org.eclipse.ui.internal.WorkbenchPlugin;
/**
- * A table label provider implementation for showing workbench views and
- * editors (objects of type <code>IWorkbenchPart</code>) in tree- and
- * table-structured viewers.
+ * A table label provider implementation for showing workbench views and editors
+ * (objects of type <code>IWorkbenchPart</code>) in tree- and table-structured
+ * viewers.
* <p>
* Clients may instantiate this class. It is not intended to be subclassed.
* </p>
*
* @since 3.0
*/
-public final class WorkbenchPartLabelProvider extends LabelProvider implements
- ITableLabelProvider {
+public final class WorkbenchPartLabelProvider extends LabelProvider implements ITableLabelProvider {
private ResourceManager resourceManager = new LocalResourceManager(JFaceResources.getResources());
private HashMap images = new HashMap();
- /**
- * Creates a new label provider for workbench parts.
- */
- public WorkbenchPartLabelProvider() {
- super();
- }
+ /**
+ * Creates a new label provider for workbench parts.
+ */
+ public WorkbenchPartLabelProvider() {
+ super();
+ }
- @Override
+ @Override
public Image getImage(Object element) {
- if (element instanceof IWorkbenchPart) {
- return ((IWorkbenchPart) element).getTitleImage();
- }
- if (element instanceof Saveable) {
- Saveable model = (Saveable) element;
- ImageDescriptor imageDesc = model.getImageDescriptor();
- // convert from ImageDescriptor to Image
- if (imageDesc == null) {
+ if (element instanceof IWorkbenchPart) {
+ return ((IWorkbenchPart) element).getTitleImage();
+ }
+ if (element instanceof Saveable) {
+ Saveable model = (Saveable) element;
+ ImageDescriptor imageDesc = model.getImageDescriptor();
+ // convert from ImageDescriptor to Image
+ if (imageDesc == null) {
return null;
}
- Image image = (Image) images.get(imageDesc);
- if (image == null) {
- try {
- image = resourceManager.createImage(imageDesc);
- images.put(imageDesc, image);
- }
- catch (DeviceResourceException e) {
- WorkbenchPlugin.log(getClass(), "getImage", e); //$NON-NLS-1$
- }
- }
- return image;
- }
- return null;
- }
+ Image image = (Image) images.get(imageDesc);
+ if (image == null) {
+ try {
+ image = resourceManager.createImage(imageDesc);
+ images.put(imageDesc, image);
+ } catch (DeviceResourceException e) {
+ WorkbenchPlugin.log(getClass(), "getImage", e); //$NON-NLS-1$
+ }
+ }
+ return image;
+ }
+ return null;
+ }
- @Override
+ @Override
public String getText(Object element) {
- if (element instanceof IWorkbenchPart) {
- IWorkbenchPart part = (IWorkbenchPart) element;
- String path = part.getTitleToolTip();
- if (path == null || path.trim().length() == 0) {
- return part.getTitle();
- }
- return part.getTitle() + " [" + path + "]"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- if (element instanceof Saveable) {
- Saveable model = (Saveable) element;
- String path = model.getToolTipText();
- if (path == null || path.trim().length() == 0) {
- return model.getName();
- }
- return model.getName() + " [" + path + "]"; //$NON-NLS-1$ //$NON-NLS-2$
+ if (element instanceof IWorkbenchPart) {
+ IWorkbenchPart part = (IWorkbenchPart) element;
+ String path = part.getTitleToolTip();
+ if (path == null || path.trim().length() == 0) {
+ return part.getTitle();
+ }
+ return part.getTitle() + " [" + path + "]"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ if (element instanceof Saveable) {
+ Saveable model = (Saveable) element;
+ String path = model.getToolTipText();
+ if (path == null || path.trim().length() == 0) {
+ return model.getName();
+ }
+ return model.getName() + " [" + path + "]"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- return null;
- }
+ }
+ return null;
+ }
- /**
- * @see ITableLabelProvider#getColumnImage
- */
- @Override
+ /**
+ * @see ITableLabelProvider#getColumnImage
+ */
+ @Override
public Image getColumnImage(Object element, int columnIndex) {
- return getImage(element);
- }
+ return getImage(element);
+ }
- /**
- * @see ITableLabelProvider#getColumnText
- */
- @Override
+ /**
+ * @see ITableLabelProvider#getColumnText
+ */
+ @Override
public String getColumnText(Object element, int columnIndex) {
- return getText(element);
- }
+ return getText(element);
+ }
- @Override
+ @Override
public void dispose() {
- resourceManager.dispose();
- super.dispose();
- }
+ resourceManager.dispose();
+ super.dispose();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/WorkbenchViewerComparator.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/WorkbenchViewerComparator.java
index a9417ad0da4..e59af54d0a9 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/WorkbenchViewerComparator.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/WorkbenchViewerComparator.java
@@ -29,24 +29,24 @@ import org.eclipse.jface.viewers.ViewerComparator;
*/
public class WorkbenchViewerComparator extends ViewerComparator {
- /**
- * Creates a workbench viewer sorter using the default collator.
- */
- public WorkbenchViewerComparator() {
- super();
- }
+ /**
+ * Creates a workbench viewer sorter using the default collator.
+ */
+ public WorkbenchViewerComparator() {
+ super();
+ }
- /**
- * Creates a workbench viewer sorter using the given collator.
- *
- * @param comparator the comparator to use to sort strings
- */
- public WorkbenchViewerComparator(Comparator comparator) {
- super(comparator);
- }
+ /**
+ * Creates a workbench viewer sorter using the given collator.
+ *
+ * @param comparator the comparator to use to sort strings
+ */
+ public WorkbenchViewerComparator(Comparator comparator) {
+ super(comparator);
+ }
- @Override
+ @Override
public boolean isSorterProperty(Object element, String propertyId) {
- return propertyId.equals(IBasicPropertyConstants.P_TEXT);
- }
+ return propertyId.equals(IBasicPropertyConstants.P_TEXT);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/WorkbenchViewerSorter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/WorkbenchViewerSorter.java
index 984d9e3bdb2..fab3ad6d689 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/WorkbenchViewerSorter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/WorkbenchViewerSorter.java
@@ -19,9 +19,9 @@ import org.eclipse.jface.viewers.IBasicPropertyConstants;
import org.eclipse.jface.viewers.ViewerSorter;
/**
- * A viewer sorter that sorts elements with registered workbench adapters by their text property.
- * Note that capitalization differences are not considered by this
- * sorter, so a &gt; B &gt; c
+ * A viewer sorter that sorts elements with registered workbench adapters by
+ * their text property. Note that capitalization differences are not considered
+ * by this sorter, so a &gt; B &gt; c
*
* @see IWorkbenchAdapter
* @deprecated as of 3.3, use {@link WorkbenchViewerComparator} instead
@@ -29,24 +29,24 @@ import org.eclipse.jface.viewers.ViewerSorter;
@Deprecated
public class WorkbenchViewerSorter extends ViewerSorter {
- /**
- * Creates a workbench viewer sorter using the default collator.
- */
- public WorkbenchViewerSorter() {
- super();
- }
+ /**
+ * Creates a workbench viewer sorter using the default collator.
+ */
+ public WorkbenchViewerSorter() {
+ super();
+ }
- /**
- * Creates a workbench viewer sorter using the given collator.
- *
- * @param collator the collator to use to sort strings
- */
- public WorkbenchViewerSorter(Collator collator) {
- super(collator);
- }
+ /**
+ * Creates a workbench viewer sorter using the given collator.
+ *
+ * @param collator the collator to use to sort strings
+ */
+ public WorkbenchViewerSorter(Collator collator) {
+ super(collator);
+ }
- @Override
+ @Override
public boolean isSorterProperty(Object element, String propertyId) {
- return propertyId.equals(IBasicPropertyConstants.P_TEXT);
- }
+ return propertyId.equals(IBasicPropertyConstants.P_TEXT);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/IWorkbenchOperationSupport.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/IWorkbenchOperationSupport.java
index b8e3ab3ebac..7e37d808f3f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/IWorkbenchOperationSupport.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/IWorkbenchOperationSupport.java
@@ -18,8 +18,8 @@ import org.eclipse.core.commands.operations.IOperationHistory;
import org.eclipse.core.commands.operations.IUndoContext;
/**
- * An instance of this interface provides support for managing a
- * a shared operations history and an shared undo context at the <code>IWorkbench</code>
+ * An instance of this interface provides support for managing a a shared
+ * operations history and an shared undo context at the <code>IWorkbench</code>
* level.
* <p>
* This interface is not intended to be extended or implemented by clients.
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/LinearUndoViolationUserApprover.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/LinearUndoViolationUserApprover.java
index 709780944c4..d1db420c1f0 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/LinearUndoViolationUserApprover.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/LinearUndoViolationUserApprover.java
@@ -41,8 +41,7 @@ import org.eclipse.ui.internal.WorkbenchMessages;
*
* @since 3.1
*/
-public final class LinearUndoViolationUserApprover extends
- LinearUndoViolationDetector {
+public final class LinearUndoViolationUserApprover extends LinearUndoViolationDetector {
private IWorkbenchPart part;
@@ -52,35 +51,30 @@ public final class LinearUndoViolationUserApprover extends
* Create a LinearUndoViolationUserApprover associated with the specified
* workbench part.
*
- * @param context
- * the undo context with the linear undo violation
- * @param part
- * the part that should be used for prompting the user
+ * @param context the undo context with the linear undo violation
+ * @param part the part that should be used for prompting the user
*/
- public LinearUndoViolationUserApprover(IUndoContext context,
- IWorkbenchPart part) {
+ public LinearUndoViolationUserApprover(IUndoContext context, IWorkbenchPart part) {
super();
this.part = part;
this.context = context;
}
@Override
- protected IStatus allowLinearRedoViolation(IUndoableOperation operation,
- IUndoContext context, IOperationHistory history, IAdaptable uiInfo) {
+ protected IStatus allowLinearRedoViolation(IUndoableOperation operation, IUndoContext context,
+ IOperationHistory history, IAdaptable uiInfo) {
if (this.context != context) {
return Status.OK_STATUS;
}
- final String message = NLS.bind(
- WorkbenchMessages.Operations_linearRedoViolation,
- getTitle(part), operation.getLabel());
- final boolean [] proceed = new boolean[1];
+ final String message = NLS.bind(WorkbenchMessages.Operations_linearRedoViolation, getTitle(part),
+ operation.getLabel());
+ final boolean[] proceed = new boolean[1];
PlatformUI.getWorkbench().getDisplay().syncExec(() -> {
// Show a dialog.
part.setFocus();
- proceed[0] = MessageDialog.openQuestion(part.getSite()
- .getShell(), getTitle(part), message);
+ proceed[0] = MessageDialog.openQuestion(part.getSite().getShell(), getTitle(part), message);
});
if (proceed[0]) {
@@ -107,22 +101,20 @@ public final class LinearUndoViolationUserApprover extends
}
@Override
- protected IStatus allowLinearUndoViolation(IUndoableOperation operation,
- IUndoContext context, IOperationHistory history, IAdaptable uiInfo) {
+ protected IStatus allowLinearUndoViolation(IUndoableOperation operation, IUndoContext context,
+ IOperationHistory history, IAdaptable uiInfo) {
if (this.context != context) {
return Status.OK_STATUS;
}
- final String message = NLS.bind(
- WorkbenchMessages.Operations_linearUndoViolation,
- getTitle(part), operation.getLabel());
- final boolean [] proceed = new boolean[1];
+ final String message = NLS.bind(WorkbenchMessages.Operations_linearUndoViolation, getTitle(part),
+ operation.getLabel());
+ final boolean[] proceed = new boolean[1];
PlatformUI.getWorkbench().getDisplay().syncExec(() -> {
// Show a dialog.
part.setFocus();
- proceed[0] = MessageDialog.openQuestion(part.getSite()
- .getShell(), getTitle(part), message);
+ proceed[0] = MessageDialog.openQuestion(part.getSite().getShell(), getTitle(part), message);
});
if (proceed[0]) {
@@ -148,8 +140,8 @@ public final class LinearUndoViolationUserApprover extends
}
/*
- * Get the title for the specified part. Use the newer interface
- * IWorkbenchPart2 if available.
+ * Get the title for the specified part. Use the newer interface IWorkbenchPart2
+ * if available.
*/
private String getTitle(IWorkbenchPart part) {
String title;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/NonLocalUndoUserApprover.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/NonLocalUndoUserApprover.java
index 7d837cef492..d59d43626ff 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/NonLocalUndoUserApprover.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/NonLocalUndoUserApprover.java
@@ -68,33 +68,35 @@ public final class NonLocalUndoUserApprover implements IOperationApprover {
private ArrayList elementsAndAdapters;
/**
- * Create a NonLocalUndoUserApprover associated with the specified editor
- * and undo context
+ * Create a NonLocalUndoUserApprover associated with the specified editor and
+ * undo context
*
- * @param context
- * the undo context of operations in question.
- * @param part
- * the editor part that is displaying the element
- * @param affectedObjects
- * the objects that are affected by the editor and considered to
- * be objects local to the editor. The objects are typically
- * instances of the preferredComparisonClass or else provide
- * adapters for the preferredComparisonClass, although this is
- * not required.
- * @param preferredComparisonClass
- * the preferred class to be used when comparing the editor's
- * affectedObjects with those provided by the undoable operation
- * using
- * {@link org.eclipse.core.commands.operations.IAdvancedUndoableOperation#getAffectedObjects()}.
- * If the operation's affected objects are not instances of the
- * specified class, but are instances of
- * {@link org.eclipse.core.runtime.IAdaptable}, then an adapter
- * for this class will be requested. The preferredComparisonClass
- * may be <code>null</code>, which indicates that there is no
- * expected class or adapter necessary for the comparison.
+ * @param context the undo context of operations in question.
+ * @param part the editor part that is displaying the
+ * element
+ * @param affectedObjects the objects that are affected by the editor
+ * and considered to be objects local to the
+ * editor. The objects are typically instances
+ * of the preferredComparisonClass or else
+ * provide adapters for the
+ * preferredComparisonClass, although this is
+ * not required.
+ * @param preferredComparisonClass the preferred class to be used when comparing
+ * the editor's affectedObjects with those
+ * provided by the undoable operation using
+ * {@link org.eclipse.core.commands.operations.IAdvancedUndoableOperation#getAffectedObjects()}.
+ * If the operation's affected objects are not
+ * instances of the specified class, but are
+ * instances of
+ * {@link org.eclipse.core.runtime.IAdaptable},
+ * then an adapter for this class will be
+ * requested. The preferredComparisonClass may
+ * be <code>null</code>, which indicates that
+ * there is no expected class or adapter
+ * necessary for the comparison.
*/
- public NonLocalUndoUserApprover(IUndoContext context, IEditorPart part,
- Object[] affectedObjects, Class preferredComparisonClass) {
+ public NonLocalUndoUserApprover(IUndoContext context, IEditorPart part, Object[] affectedObjects,
+ Class preferredComparisonClass) {
super();
this.context = context;
this.part = part;
@@ -103,43 +105,41 @@ public final class NonLocalUndoUserApprover implements IOperationApprover {
}
@Override
- public IStatus proceedRedoing(IUndoableOperation operation,
- IOperationHistory history, IAdaptable uiInfo) {
+ public IStatus proceedRedoing(IUndoableOperation operation, IOperationHistory history, IAdaptable uiInfo) {
// return immediately if the operation is not relevant
if (!requiresApproval(operation, uiInfo)) {
return Status.OK_STATUS;
}
- String message = NLS.bind(
- WorkbenchMessages.Operations_nonLocalRedoWarning, operation
- .getLabel(), part.getEditorInput().getName());
- return proceedWithOperation(operation, message, WorkbenchMessages.Operations_discardRedo, WorkbenchMessages.Workbench_redoToolTip);
+ String message = NLS.bind(WorkbenchMessages.Operations_nonLocalRedoWarning, operation.getLabel(),
+ part.getEditorInput().getName());
+ return proceedWithOperation(operation, message, WorkbenchMessages.Operations_discardRedo,
+ WorkbenchMessages.Workbench_redoToolTip);
}
@Override
- public IStatus proceedUndoing(IUndoableOperation operation,
- IOperationHistory history, IAdaptable uiInfo) {
+ public IStatus proceedUndoing(IUndoableOperation operation, IOperationHistory history, IAdaptable uiInfo) {
// return immediately if the operation is not relevant
if (!requiresApproval(operation, uiInfo)) {
return Status.OK_STATUS;
}
- String message = NLS.bind(
- WorkbenchMessages.Operations_nonLocalUndoWarning, operation
- .getLabel(), part.getEditorInput().getName());
- return proceedWithOperation(operation, message, WorkbenchMessages.Operations_discardUndo, WorkbenchMessages.Workbench_undoToolTip);
+ String message = NLS.bind(WorkbenchMessages.Operations_nonLocalUndoWarning, operation.getLabel(),
+ part.getEditorInput().getName());
+ return proceedWithOperation(operation, message, WorkbenchMessages.Operations_discardUndo,
+ WorkbenchMessages.Workbench_undoToolTip);
}
/*
- * Determine whether the operation in question affects elements outside of
- * the editor. If this can be determined and it does affect other elements,
- * prompt the user as to whether the operation should proceed.
+ * Determine whether the operation in question affects elements outside of the
+ * editor. If this can be determined and it does affect other elements, prompt
+ * the user as to whether the operation should proceed.
*/
- private IStatus proceedWithOperation(IUndoableOperation operation,
- final String message, final String discardButton, final String title) {
+ private IStatus proceedWithOperation(IUndoableOperation operation, final String message, final String discardButton,
+ final String title) {
// if the operation cannot tell us about its modified elements, there's
// nothing we can do.
@@ -148,8 +148,7 @@ public final class NonLocalUndoUserApprover implements IOperationApprover {
}
// Obtain the operation's affected objects.
- Object[] modifiedElements = ((IAdvancedUndoableOperation) operation)
- .getAffectedObjects();
+ Object[] modifiedElements = ((IAdvancedUndoableOperation) operation).getAffectedObjects();
// Since the operation participates in describing its affected objects,
// we assume for the rest of this method that an inability to
@@ -192,17 +191,19 @@ public final class NonLocalUndoUserApprover implements IOperationApprover {
return Status.OK_STATUS;
}
- // The operation affects more than just our element. Find out if
- // we should proceed, cancel, or discard the undo. Must be done in
+ // The operation affects more than just our element. Find out if
+ // we should proceed, cancel, or discard the undo. Must be done in
// a syncExec because operation approval notifications may come from
// a background thread.
final int[] answer = new int[1];
PlatformUI.getWorkbench().getDisplay().syncExec(() -> {
- MessageDialog dialog = new MessageDialog(part.getSite().getShell(), title,
- null, message, MessageDialog.QUESTION, 0, IDialogConstants.OK_LABEL, discardButton,
- IDialogConstants.CANCEL_LABEL); // yes is the default
- answer[0] = dialog.open();
-});
+ MessageDialog dialog = new MessageDialog(part.getSite().getShell(), title, null, message,
+ MessageDialog.QUESTION, 0, IDialogConstants.OK_LABEL, discardButton, IDialogConstants.CANCEL_LABEL); // yes
+ // is
+ // the
+ // default
+ answer[0] = dialog.open();
+ });
switch (answer[0]) {
case 0:
return Status.OK_STATUS;
@@ -216,11 +217,10 @@ public final class NonLocalUndoUserApprover implements IOperationApprover {
}
/*
- * Answer whether this operation is relevant enough to this operation
- * approver that it should be examined in detail.
+ * Answer whether this operation is relevant enough to this operation approver
+ * that it should be examined in detail.
*/
- private boolean requiresApproval(IUndoableOperation operation,
- IAdaptable uiInfo) {
+ private boolean requiresApproval(IUndoableOperation operation, IAdaptable uiInfo) {
// no approval is required if the operation doesn't have our undo
// context
if (!(operation.hasContext(context))) {
@@ -237,8 +237,7 @@ public final class NonLocalUndoUserApprover implements IOperationApprover {
// in our context.
if (uiInfo != null) {
IUndoContext originatingContext = Adapters.adapt(uiInfo, IUndoContext.class);
- if (originatingContext != null
- && !(originatingContext.matches(context))) {
+ if (originatingContext != null && !(originatingContext.matches(context))) {
return false;
}
}
@@ -261,8 +260,7 @@ public final class NonLocalUndoUserApprover implements IOperationApprover {
elementsAndAdapters = new ArrayList(elements.length);
for (Object element : elements) {
elementsAndAdapters.add(element);
- if (affectedObjectsClass != null
- && !affectedObjectsClass.isInstance(element)) {
+ if (affectedObjectsClass != null && !affectedObjectsClass.isInstance(element)) {
Object adapter = Adapters.adapt(element, affectedObjectsClass);
if (adapter != null) {
elementsAndAdapters.add(adapter);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/OperationHistoryActionHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/OperationHistoryActionHandler.java
index c60ce825a1b..3535e9d130b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/OperationHistoryActionHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/OperationHistoryActionHandler.java
@@ -74,8 +74,8 @@ import org.eclipse.ui.statushandlers.StatusManager;
*
* @since 3.1
*/
-public abstract class OperationHistoryActionHandler extends Action implements
- ActionFactory.IWorkbenchAction, IAdaptable {
+public abstract class OperationHistoryActionHandler extends Action
+ implements ActionFactory.IWorkbenchAction, IAdaptable {
private static final int MAX_LABEL_LENGTH = 33;
@@ -104,8 +104,7 @@ public abstract class OperationHistoryActionHandler extends Action implements
// Special case for MultiPageEditorSite
// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=103379
} else if ((site instanceof MultiPageEditorSite)
- && (part.equals(((MultiPageEditorSite) site)
- .getMultiPageEditor()))) {
+ && (part.equals(((MultiPageEditorSite) site).getMultiPageEditor()))) {
dispose();
}
}
@@ -152,12 +151,10 @@ public abstract class OperationHistoryActionHandler extends Action implements
if (pruning) {
IStatus status = event.getStatus();
/*
- * Prune the history unless we can determine
- * that this was a cancelled attempt. See
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=101215
+ * Prune the history unless we can determine that this was a cancelled attempt.
+ * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=101215
*/
- if (status == null
- || status.getSeverity() != IStatus.CANCEL) {
+ if (status == null || status.getSeverity() != IStatus.CANCEL) {
flush();
}
// not all flushes will trigger an update so
@@ -191,13 +188,11 @@ public abstract class OperationHistoryActionHandler extends Action implements
IWorkbenchPartSite site;
/**
- * Construct an operation history action for the specified workbench window
- * with the specified undo context.
+ * Construct an operation history action for the specified workbench window with
+ * the specified undo context.
*
- * @param site -
- * the workbench part site for the action.
- * @param context -
- * the undo context to be used
+ * @param site - the workbench part site for the action.
+ * @param context - the undo context to be used
*/
OperationHistoryActionHandler(IWorkbenchPartSite site, IUndoContext context) {
// string will be reset inside action
@@ -246,8 +241,8 @@ public abstract class OperationHistoryActionHandler extends Action implements
abstract String getCommandString();
/*
- * Return the string describing the command for a tooltip, including the
- * binding for the operation label.
+ * Return the string describing the command for a tooltip, including the binding
+ * for the operation label.
*/
abstract String getTooltipString();
@@ -271,8 +266,7 @@ public abstract class OperationHistoryActionHandler extends Action implements
return null;
}
- return PlatformUI.getWorkbench().getOperationSupport()
- .getOperationHistory();
+ return PlatformUI.getWorkbench().getOperationSupport().getOperationHistory();
}
/*
@@ -288,23 +282,21 @@ public abstract class OperationHistoryActionHandler extends Action implements
Shell parent = getWorkbenchWindow().getShell();
progressDialog = new TimeTriggeredProgressMonitorDialog(parent,
- getWorkbenchWindow().getWorkbench().getProgressService()
- .getLongOperationTime());
+ getWorkbenchWindow().getWorkbench().getProgressService().getLongOperationTime());
IRunnableWithProgress runnable = pm -> {
-try {
- runCommand(pm);
-} catch (ExecutionException e) {
- if (pruning) {
- flush();
- }
- throw new InvocationTargetException(e);
-}
-};
+ try {
+ runCommand(pm);
+ } catch (ExecutionException e) {
+ if (pruning) {
+ flush();
+ }
+ throw new InvocationTargetException(e);
+ }
+ };
try {
boolean runInBackground = false;
if (getOperation() instanceof IAdvancedUndoableOperation2) {
- runInBackground = ((IAdvancedUndoableOperation2) getOperation())
- .runInBackground();
+ runInBackground = ((IAdvancedUndoableOperation2) getOperation()).runInBackground();
}
progressDialog.run(runInBackground, true, runnable);
} catch (InvocationTargetException e) {
@@ -375,12 +367,10 @@ try {
abstract boolean shouldBeEnabled();
/**
- * Set the context shown by the handler. Normally the context is set up when
- * the action handler is created, but the context can also be changed
- * dynamically.
+ * Set the context shown by the handler. Normally the context is set up when the
+ * action handler is created, but the context can also be changed dynamically.
*
- * @param context
- * the context to be used for the undo history
+ * @param context the context to be used for the undo history
*/
public void setContext(IUndoContext context) {
// optimization - do nothing if there was no real change
@@ -396,9 +386,8 @@ try {
* history when invalid operations are encountered. The default value is
* <code>false</code>.
*
- * @param prune
- * <code>true</code> if the history should be pruned by the
- * handler, and <code>false</code> if it should not.
+ * @param prune <code>true</code> if the history should be pruned by the
+ * handler, and <code>false</code> if it should not.
*
*/
public void setPruneHistory(boolean prune) {
@@ -406,8 +395,8 @@ try {
}
/**
- * Update enabling and labels according to the current status of the
- * operation history.
+ * Update enabling and labels according to the current status of the operation
+ * history.
*/
public void update() {
if (isInvalid()) {
@@ -417,18 +406,15 @@ try {
boolean enabled = shouldBeEnabled();
String text, tooltipText;
if (enabled) {
- tooltipText = NLS.bind(getTooltipString(), getOperation()
- .getLabel());
+ tooltipText = NLS.bind(getTooltipString(), getOperation().getLabel());
text = NLS.bind(getCommandString(),
LegacyActionTools.escapeMnemonics(shortenText(getOperation().getLabel()))) + '@';
} else {
- tooltipText = NLS.bind(
- WorkbenchMessages.Operations_undoRedoCommandDisabled,
- getSimpleTooltipString());
+ tooltipText = NLS.bind(WorkbenchMessages.Operations_undoRedoCommandDisabled, getSimpleTooltipString());
text = getSimpleCommandString();
/*
- * if there is nothing to do and we are pruning the history, flush
- * the history of this context.
+ * if there is nothing to do and we are pruning the history, flush the history
+ * of this context.
*/
if (undoContext != null && pruning) {
flush();
@@ -468,18 +454,16 @@ try {
if (exceptionMessage == null) {
exceptionMessage = WorkbenchMessages.WorkbenchWindow_exceptionMessage;
}
- IStatus status = StatusUtil.newStatus(WorkbenchPlugin.PI_WORKBENCH,
- exceptionMessage, exception);
+ IStatus status = StatusUtil.newStatus(WorkbenchPlugin.PI_WORKBENCH, exceptionMessage, exception);
// Log and show the problem
WorkbenchPlugin.log(exceptionMessage, status);
- StatusUtil.handleStatus(status, StatusManager.SHOW,
- getWorkbenchWindow().getShell());
+ StatusUtil.handleStatus(status, StatusManager.SHOW, getWorkbenchWindow().getShell());
}
/*
- * Answer true if the receiver is not valid for running commands, accessing
- * the history, etc.
+ * Answer true if the receiver is not valid for running commands, accessing the
+ * history, etc.
*/
final boolean isInvalid() {
return undoContext == null || site == null;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/RedoActionHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/RedoActionHandler.java
index 9c75af520b6..2c1f91000e5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/RedoActionHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/RedoActionHandler.java
@@ -27,7 +27,7 @@ import org.eclipse.ui.internal.WorkbenchMessages;
/**
* <p>
* RedoActionHandler provides common behavior for redoing an operation, as well
- * as labelling and enabling the menu item. This class may be instantiated by
+ * as labelling and enabling the menu item. This class may be instantiated by
* clients.
* </p>
*
@@ -36,20 +36,17 @@ import org.eclipse.ui.internal.WorkbenchMessages;
public final class RedoActionHandler extends OperationHistoryActionHandler {
/**
- * Construct an action handler that handles the labelling and enabling of
- * the redo action for the specified undo context.
+ * Construct an action handler that handles the labelling and enabling of the
+ * redo action for the specified undo context.
*
- * @param site
- * the workbench part site that created the action.
- * @param context
- * the undo context to be used for redoing.
+ * @param site the workbench part site that created the action.
+ * @param context the undo context to be used for redoing.
*/
public RedoActionHandler(IWorkbenchPartSite site, IUndoContext context) {
super(site, context);
- setImageDescriptor(PlatformUI.getWorkbench().getSharedImages()
- .getImageDescriptor(ISharedImages.IMG_TOOL_REDO));
- setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages()
- .getImageDescriptor(ISharedImages.IMG_TOOL_REDO_DISABLED));
+ setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_REDO));
+ setDisabledImageDescriptor(
+ PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_REDO_DISABLED));
setActionDefinitionId(IWorkbenchCommandConstants.EDIT_REDO);
}
@@ -78,7 +75,6 @@ public final class RedoActionHandler extends OperationHistoryActionHandler {
return WorkbenchMessages.Workbench_redoToolTip;
}
-
@Override
IUndoableOperation getOperation() {
return getHistory().getRedoOperation(getUndoContext());
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/UndoActionHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/UndoActionHandler.java
index d0ab7b37b78..57b7c55a97a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/UndoActionHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/UndoActionHandler.java
@@ -24,12 +24,11 @@ import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.WorkbenchMessages;
-
/**
* <p>
- * UndoActionHandler provides common behavior for performing an undo, as
- * well as labelling and enabling the undo menu item. This class may be
- * instantiated by clients.
+ * UndoActionHandler provides common behavior for performing an undo, as well as
+ * labelling and enabling the undo menu item. This class may be instantiated by
+ * clients.
* </p>
*
* @since 3.1
@@ -37,20 +36,17 @@ import org.eclipse.ui.internal.WorkbenchMessages;
public final class UndoActionHandler extends OperationHistoryActionHandler {
/**
- * Construct an action handler that handles the labelling and enabling of
- * the undo action for the specified undo context.
+ * Construct an action handler that handles the labelling and enabling of the
+ * undo action for the specified undo context.
*
- * @param site
- * the workbench part site that created the action.
- * @param context
- * the undo context to be used for the undo
+ * @param site the workbench part site that created the action.
+ * @param context the undo context to be used for the undo
*/
public UndoActionHandler(IWorkbenchPartSite site, IUndoContext context) {
super(site, context);
- setImageDescriptor(PlatformUI.getWorkbench().getSharedImages()
- .getImageDescriptor(ISharedImages.IMG_TOOL_UNDO));
- setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages()
- .getImageDescriptor(ISharedImages.IMG_TOOL_UNDO_DISABLED));
+ setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_UNDO));
+ setDisabledImageDescriptor(
+ PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_UNDO_DISABLED));
setActionDefinitionId(IWorkbenchCommandConstants.EDIT_UNDO);
}
@@ -86,7 +82,7 @@ public final class UndoActionHandler extends OperationHistoryActionHandler {
}
@Override
- IStatus runCommand(IProgressMonitor pm) throws ExecutionException {
+ IStatus runCommand(IProgressMonitor pm) throws ExecutionException {
return getHistory().undo(getUndoContext(), pm, this);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/UndoRedoActionGroup.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/UndoRedoActionGroup.java
index 52261493d6c..ae9839ae9c0 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/UndoRedoActionGroup.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/UndoRedoActionGroup.java
@@ -37,21 +37,17 @@ public final class UndoRedoActionGroup extends ActionGroup {
private RedoActionHandler redoActionHandler;
/**
- * Construct an undo redo action group for the specified workbench part
- * site, using the specified undo context.
+ * Construct an undo redo action group for the specified workbench part site,
+ * using the specified undo context.
*
- * @param site
- * the workbench part site that is creating the action group
- * @param undoContext
- * the undo context to be used for filtering the operation
- * history
- * @param pruneHistory
- * a boolean that indicates whether the history for the specified
- * context should be pruned whenever an invalid operation is
- * encountered.
+ * @param site the workbench part site that is creating the action group
+ * @param undoContext the undo context to be used for filtering the operation
+ * history
+ * @param pruneHistory a boolean that indicates whether the history for the
+ * specified context should be pruned whenever an invalid
+ * operation is encountered.
*/
- public UndoRedoActionGroup(IWorkbenchPartSite site,
- IUndoContext undoContext, boolean pruneHistory) {
+ public UndoRedoActionGroup(IWorkbenchPartSite site, IUndoContext undoContext, boolean pruneHistory) {
// create the undo action handler
undoActionHandler = new UndoActionHandler(site, undoContext);
@@ -66,10 +62,8 @@ public final class UndoRedoActionGroup extends ActionGroup {
public void fillActionBars(IActionBars actionBars) {
super.fillActionBars(actionBars);
if (undoActionHandler != null) {
- actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(),
- undoActionHandler);
- actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(),
- redoActionHandler);
+ actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), undoActionHandler);
+ actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), redoActionHandler);
}
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/AbstractMultiEditor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/AbstractMultiEditor.java
index 2fb6b4cb5ab..624f30cafc5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/AbstractMultiEditor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/AbstractMultiEditor.java
@@ -36,187 +36,185 @@ import org.eclipse.ui.internal.e4.compatibility.E4Util;
*/
public abstract class AbstractMultiEditor extends EditorPart {
- private int activeEditorIndex;
+ private int activeEditorIndex;
- private IEditorPart innerEditors[];
+ private IEditorPart innerEditors[];
private IPartListener2 propagationListener;
/**
* Constructs an editor to contain other editors.
*/
- public AbstractMultiEditor() {
- super();
- }
+ public AbstractMultiEditor() {
+ super();
+ }
/**
* Handles a property change notification from a nested editor. The default
- * implementation simply forwards the change to listeners on this multi
- * editor by calling <code>firePropertyChange</code> with the same property
- * id. For example, if the dirty state of a nested editor changes (property
- * id <code>ISaveablePart.PROP_DIRTY</code>), this method handles it by
- * firing a property change event for <code>ISaveablePart.PROP_DIRTY</code>
- * to property listeners on this multi editor.
+ * implementation simply forwards the change to listeners on this multi editor
+ * by calling <code>firePropertyChange</code> with the same property id. For
+ * example, if the dirty state of a nested editor changes (property id
+ * <code>ISaveablePart.PROP_DIRTY</code>), this method handles it by firing a
+ * property change event for <code>ISaveablePart.PROP_DIRTY</code> to property
+ * listeners on this multi editor.
* <p>
* Subclasses may extend or reimplement this method.
* </p>
*
- * @param propId
- * the id of the property that changed
+ * @param propId the id of the property that changed
* @since 3.6
*/
protected void handlePropertyChange(int propId) {
firePropertyChange(propId);
}
- /*
- * @see IEditorPart#doSave(IProgressMonitor)
- */
- @Override
+ /*
+ * @see IEditorPart#doSave(IProgressMonitor)
+ */
+ @Override
public void doSave(IProgressMonitor monitor) {
- for (IEditorPart e : innerEditors) {
- e.doSave(monitor);
- }
- }
-
- /*
- * @see IEditorPart#doSaveAs()
- */
- @Override
+ for (IEditorPart e : innerEditors) {
+ e.doSave(monitor);
+ }
+ }
+
+ /*
+ * @see IEditorPart#doSaveAs()
+ */
+ @Override
public void doSaveAs() {
- //no-op
- }
-
- /*
- * @see IEditorPart#init(IEditorSite, IEditorInput)
- */
- @Override
- public void init(IEditorSite site, IEditorInput input)
- throws PartInitException {
- init(site, (MultiEditorInput) input);
- }
-
- /**
- * @param site
- * @param input
- * @throws PartInitException
+ // no-op
+ }
+
+ /*
+ * @see IEditorPart#init(IEditorSite, IEditorInput)
+ */
+ @Override
+ public void init(IEditorSite site, IEditorInput input) throws PartInitException {
+ init(site, (MultiEditorInput) input);
+ }
+
+ /**
+ * @param site
+ * @param input
+ * @throws PartInitException
*
* @see IEditorPart#init(IEditorSite, IEditorInput)
- */
- public void init(IEditorSite site, MultiEditorInput input)
- throws PartInitException {
- setInput(input);
- setSite(site);
- setPartName(input.getName());
- setTitleToolTip(input.getToolTipText());
- setupEvents();
- }
-
- /*
- * @see IEditorPart#isDirty()
- */
- @Override
+ */
+ public void init(IEditorSite site, MultiEditorInput input) throws PartInitException {
+ setInput(input);
+ setSite(site);
+ setPartName(input.getName());
+ setTitleToolTip(input.getToolTipText());
+ setupEvents();
+ }
+
+ /*
+ * @see IEditorPart#isDirty()
+ */
+ @Override
public boolean isDirty() {
- for (IEditorPart e : innerEditors) {
- if (e.isDirty()) {
+ for (IEditorPart e : innerEditors) {
+ if (e.isDirty()) {
return true;
}
- }
- return false;
- }
-
- /*
- * @see IEditorPart#isSaveAsAllowed()
- */
- @Override
+ }
+ return false;
+ }
+
+ /*
+ * @see IEditorPart#isSaveAsAllowed()
+ */
+ @Override
public boolean isSaveAsAllowed() {
- return false;
- }
+ return false;
+ }
/*
- * @see IWorkbenchPart#setFocus()
- */
- @Override
+ * @see IWorkbenchPart#setFocus()
+ */
+ @Override
public void setFocus() {
- innerEditors[activeEditorIndex].setFocus();
- }
-
- /**
- * Returns the active inner editor.
- * @return the active editor
- */
- public final IEditorPart getActiveEditor() {
- return innerEditors[activeEditorIndex];
- }
-
- /**
- * Returns an array with all inner editors.
- * @return the inner editors
- */
- public final IEditorPart[] getInnerEditors() {
- return innerEditors;
- }
+ innerEditors[activeEditorIndex].setFocus();
+ }
+
+ /**
+ * Returns the active inner editor.
+ *
+ * @return the active editor
+ */
+ public final IEditorPart getActiveEditor() {
+ return innerEditors[activeEditorIndex];
+ }
+
+ /**
+ * Returns an array with all inner editors.
+ *
+ * @return the inner editors
+ */
+ public final IEditorPart[] getInnerEditors() {
+ return innerEditors;
+ }
/**
* Set the inner editors.
*
* Should not be called by clients.
*
- * @param children
- * the inner editors of this multi editor
+ * @param children the inner editors of this multi editor
* @noreference This method is not intended to be referenced by clients.
*/
- public final void setChildren(IEditorPart[] children) {
- innerEditors = children;
- activeEditorIndex = 0;
+ public final void setChildren(IEditorPart[] children) {
+ innerEditors = children;
+ activeEditorIndex = 0;
for (IEditorPart child : children) {
- child.addPropertyListener( (source, propId) -> handlePropertyChange(propId));
+ child.addPropertyListener((source, propId) -> handlePropertyChange(propId));
}
- innerEditorsCreated();
- }
+ innerEditorsCreated();
+ }
/**
* Called as soon as the inner editors have been created and are available.
*/
protected abstract void innerEditorsCreated();
- /**
- * Activates the given nested editor.
- *
- * @param part the nested editor
- * @since 3.0
- */
- public void activateEditor(IEditorPart part) {
- activeEditorIndex = getIndex(part);
+ /**
+ * Activates the given nested editor.
+ *
+ * @param part the nested editor
+ * @since 3.0
+ */
+ public void activateEditor(IEditorPart part) {
+ activeEditorIndex = getIndex(part);
// IEditorPart e = getActiveEditor();
// EditorSite innerSite = (EditorSite) e.getEditorSite();
// ((WorkbenchPage) innerSite.getPage()).requestActivation(e);
E4Util.unsupported("We need to request an activation of this part"); //$NON-NLS-1$
- }
-
- /**
- * Returns the index of the given nested editor.
- *
- * @return the index of the nested editor
- * @since 3.0
- */
- protected int getIndex(IEditorPart editor) {
- for (int i = 0; i < innerEditors.length; i++) {
- if (innerEditors[i] == editor) {
+ }
+
+ /**
+ * Returns the index of the given nested editor.
+ *
+ * @return the index of the nested editor
+ * @since 3.0
+ */
+ protected int getIndex(IEditorPart editor) {
+ for (int i = 0; i < innerEditors.length; i++) {
+ if (innerEditors[i] == editor) {
return i;
}
- }
- return -1;
- }
-
- /**
- * Set up the AbstractMultiEditor to propagate events like partClosed().
- *
- * @since 3.2
- */
- private void setupEvents() {
+ }
+ return -1;
+ }
+
+ /**
+ * Set up the AbstractMultiEditor to propagate events like partClosed().
+ *
+ * @since 3.2
+ */
+ private void setupEvents() {
propagationListener = new IPartListener2() {
@Override
public void partActivated(IWorkbenchPartReference partRef) {
@@ -269,13 +267,13 @@ public abstract class AbstractMultiEditor extends EditorPart {
}
};
getSite().getPage().addPartListener(propagationListener);
- }
+ }
- /**
- * Release the added listener.
- *
- * @since 3.2
- */
+ /**
+ * Release the added listener.
+ *
+ * @since 3.2
+ */
@Override
public void dispose() {
getSite().getPage().removePartListener(propagationListener);
@@ -283,13 +281,13 @@ public abstract class AbstractMultiEditor extends EditorPart {
}
/**
- * This method is called after createPartControl has been executed and
- * should return the container for the given inner editor.
+ * This method is called after createPartControl has been executed and should
+ * return the container for the given inner editor.
*
- * @param innerEditorReference
- * a reference to the inner editor that is being created.
- * @return the container in which the inner editor's pane and part controls
- * are to be created.
+ * @param innerEditorReference a reference to the inner editor that is being
+ * created.
+ * @return the container in which the inner editor's pane and part controls are
+ * to be created.
*/
public abstract Composite getInnerEditorContainer(IEditorReference innerEditorReference);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/CellEditorActionHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/CellEditorActionHandler.java
index ccb948b2dbc..0484d5dc442 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/CellEditorActionHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/CellEditorActionHandler.java
@@ -52,767 +52,737 @@ import org.eclipse.ui.internal.WorkbenchMessages;
* @noextend This class is not intended to be subclassed by clients.
*/
public class CellEditorActionHandler {
- private CutActionHandler cellCutAction = new CutActionHandler();
+ private CutActionHandler cellCutAction = new CutActionHandler();
- private CopyActionHandler cellCopyAction = new CopyActionHandler();
+ private CopyActionHandler cellCopyAction = new CopyActionHandler();
- private PasteActionHandler cellPasteAction = new PasteActionHandler();
+ private PasteActionHandler cellPasteAction = new PasteActionHandler();
- private DeleteActionHandler cellDeleteAction = new DeleteActionHandler();
+ private DeleteActionHandler cellDeleteAction = new DeleteActionHandler();
- private SelectAllActionHandler cellSelectAllAction = new SelectAllActionHandler();
+ private SelectAllActionHandler cellSelectAllAction = new SelectAllActionHandler();
- private FindActionHandler cellFindAction = new FindActionHandler();
+ private FindActionHandler cellFindAction = new FindActionHandler();
- private UndoActionHandler cellUndoAction = new UndoActionHandler();
+ private UndoActionHandler cellUndoAction = new UndoActionHandler();
- private RedoActionHandler cellRedoAction = new RedoActionHandler();
+ private RedoActionHandler cellRedoAction = new RedoActionHandler();
- private IAction cutAction;
+ private IAction cutAction;
- private IAction copyAction;
+ private IAction copyAction;
- private IAction pasteAction;
+ private IAction pasteAction;
- private IAction deleteAction;
+ private IAction deleteAction;
- private IAction selectAllAction;
+ private IAction selectAllAction;
- private IAction findAction;
+ private IAction findAction;
- private IAction undoAction;
+ private IAction undoAction;
- private IAction redoAction;
+ private IAction redoAction;
- private IPropertyChangeListener cutActionListener = new ActionEnabledChangeListener(
- cellCutAction);
+ private IPropertyChangeListener cutActionListener = new ActionEnabledChangeListener(cellCutAction);
- private IPropertyChangeListener copyActionListener = new ActionEnabledChangeListener(
- cellCopyAction);
+ private IPropertyChangeListener copyActionListener = new ActionEnabledChangeListener(cellCopyAction);
- private IPropertyChangeListener pasteActionListener = new ActionEnabledChangeListener(
- cellPasteAction);
+ private IPropertyChangeListener pasteActionListener = new ActionEnabledChangeListener(cellPasteAction);
- private IPropertyChangeListener deleteActionListener = new ActionEnabledChangeListener(
- cellDeleteAction);
+ private IPropertyChangeListener deleteActionListener = new ActionEnabledChangeListener(cellDeleteAction);
- private IPropertyChangeListener selectAllActionListener = new ActionEnabledChangeListener(
- cellSelectAllAction);
+ private IPropertyChangeListener selectAllActionListener = new ActionEnabledChangeListener(cellSelectAllAction);
- private IPropertyChangeListener findActionListener = new ActionEnabledChangeListener(
- cellFindAction);
+ private IPropertyChangeListener findActionListener = new ActionEnabledChangeListener(cellFindAction);
- private IPropertyChangeListener undoActionListener = new ActionEnabledChangeListener(
- cellUndoAction);
+ private IPropertyChangeListener undoActionListener = new ActionEnabledChangeListener(cellUndoAction);
- private IPropertyChangeListener redoActionListener = new ActionEnabledChangeListener(
- cellRedoAction);
+ private IPropertyChangeListener redoActionListener = new ActionEnabledChangeListener(cellRedoAction);
- private CellEditor activeEditor;
+ private CellEditor activeEditor;
- private IPropertyChangeListener cellListener = new CellChangeListener();
+ private IPropertyChangeListener cellListener = new CellChangeListener();
- private Listener controlListener = new ControlListener();
+ private Listener controlListener = new ControlListener();
- private HashMap controlToEditor = new HashMap();
+ private HashMap controlToEditor = new HashMap();
- private class ControlListener implements Listener {
- @Override
+ private class ControlListener implements Listener {
+ @Override
public void handleEvent(Event event) {
- switch (event.type) {
- case SWT.Activate:
- activeEditor = (CellEditor) controlToEditor.get(event.widget);
- if (activeEditor != null) {
+ switch (event.type) {
+ case SWT.Activate:
+ activeEditor = (CellEditor) controlToEditor.get(event.widget);
+ if (activeEditor != null) {
activeEditor.addPropertyChangeListener(cellListener);
}
- updateActionsEnableState();
- break;
- case SWT.Deactivate:
- if (activeEditor != null) {
+ updateActionsEnableState();
+ break;
+ case SWT.Deactivate:
+ if (activeEditor != null) {
activeEditor.removePropertyChangeListener(cellListener);
}
- activeEditor = null;
- updateActionsEnableState();
- break;
- default:
- break;
- }
- }
- }
-
- private class ActionEnabledChangeListener implements
- IPropertyChangeListener {
- private IAction actionHandler;
-
- protected ActionEnabledChangeListener(IAction actionHandler) {
- super();
- this.actionHandler = actionHandler;
- }
-
- @Override
+ activeEditor = null;
+ updateActionsEnableState();
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ private class ActionEnabledChangeListener implements IPropertyChangeListener {
+ private IAction actionHandler;
+
+ protected ActionEnabledChangeListener(IAction actionHandler) {
+ super();
+ this.actionHandler = actionHandler;
+ }
+
+ @Override
public void propertyChange(PropertyChangeEvent event) {
- if (activeEditor != null) {
- return;
- }
- if (event.getProperty().equals(IAction.ENABLED)) {
- Boolean bool = (Boolean) event.getNewValue();
- actionHandler.setEnabled(bool.booleanValue());
- return;
- }
- // If the underlying action's text has changed, we need to
- // change the text. See
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=154410
- if (event.getProperty().equals(IAction.TEXT)) {
- String text = (String) event.getNewValue();
- actionHandler.setText(text);
- return;
- }
- if (event.getProperty().equals(IAction.TOOL_TIP_TEXT)) {
- String text = (String) event.getNewValue();
- actionHandler.setToolTipText(text);
- return;
- }
- }
- }
-
- private class CellChangeListener implements IPropertyChangeListener {
- @Override
+ if (activeEditor != null) {
+ return;
+ }
+ if (event.getProperty().equals(IAction.ENABLED)) {
+ Boolean bool = (Boolean) event.getNewValue();
+ actionHandler.setEnabled(bool.booleanValue());
+ return;
+ }
+ // If the underlying action's text has changed, we need to
+ // change the text. See
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=154410
+ if (event.getProperty().equals(IAction.TEXT)) {
+ String text = (String) event.getNewValue();
+ actionHandler.setText(text);
+ return;
+ }
+ if (event.getProperty().equals(IAction.TOOL_TIP_TEXT)) {
+ String text = (String) event.getNewValue();
+ actionHandler.setToolTipText(text);
+ return;
+ }
+ }
+ }
+
+ private class CellChangeListener implements IPropertyChangeListener {
+ @Override
public void propertyChange(PropertyChangeEvent event) {
- if (activeEditor == null) {
- return;
- }
- if (event.getProperty().equals(CellEditor.CUT)) {
- cellCutAction.setEnabled(activeEditor.isCutEnabled());
- return;
- }
- if (event.getProperty().equals(CellEditor.COPY)) {
- cellCopyAction.setEnabled(activeEditor.isCopyEnabled());
- return;
- }
- if (event.getProperty().equals(CellEditor.PASTE)) {
- cellPasteAction.setEnabled(activeEditor.isPasteEnabled());
- return;
- }
- if (event.getProperty().equals(CellEditor.DELETE)) {
- cellDeleteAction.setEnabled(activeEditor.isDeleteEnabled());
- return;
- }
- if (event.getProperty().equals(CellEditor.SELECT_ALL)) {
- cellSelectAllAction.setEnabled(activeEditor
- .isSelectAllEnabled());
- return;
- }
- if (event.getProperty().equals(CellEditor.FIND)) {
- cellFindAction.setEnabled(activeEditor.isFindEnabled());
- return;
- }
- if (event.getProperty().equals(CellEditor.UNDO)) {
- cellUndoAction.setEnabled(activeEditor.isUndoEnabled());
- return;
- }
- if (event.getProperty().equals(CellEditor.REDO)) {
- cellRedoAction.setEnabled(activeEditor.isRedoEnabled());
- return;
- }
- }
- }
-
- private class CutActionHandler extends Action {
- protected CutActionHandler() {
- setId("CellEditorCutActionHandler");//$NON-NLS-1$
- setEnabled(false);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.CELL_CUT_ACTION);
- }
-
- @Override
+ if (activeEditor == null) {
+ return;
+ }
+ if (event.getProperty().equals(CellEditor.CUT)) {
+ cellCutAction.setEnabled(activeEditor.isCutEnabled());
+ return;
+ }
+ if (event.getProperty().equals(CellEditor.COPY)) {
+ cellCopyAction.setEnabled(activeEditor.isCopyEnabled());
+ return;
+ }
+ if (event.getProperty().equals(CellEditor.PASTE)) {
+ cellPasteAction.setEnabled(activeEditor.isPasteEnabled());
+ return;
+ }
+ if (event.getProperty().equals(CellEditor.DELETE)) {
+ cellDeleteAction.setEnabled(activeEditor.isDeleteEnabled());
+ return;
+ }
+ if (event.getProperty().equals(CellEditor.SELECT_ALL)) {
+ cellSelectAllAction.setEnabled(activeEditor.isSelectAllEnabled());
+ return;
+ }
+ if (event.getProperty().equals(CellEditor.FIND)) {
+ cellFindAction.setEnabled(activeEditor.isFindEnabled());
+ return;
+ }
+ if (event.getProperty().equals(CellEditor.UNDO)) {
+ cellUndoAction.setEnabled(activeEditor.isUndoEnabled());
+ return;
+ }
+ if (event.getProperty().equals(CellEditor.REDO)) {
+ cellRedoAction.setEnabled(activeEditor.isRedoEnabled());
+ return;
+ }
+ }
+ }
+
+ private class CutActionHandler extends Action {
+ protected CutActionHandler() {
+ setId("CellEditorCutActionHandler");//$NON-NLS-1$
+ setEnabled(false);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.CELL_CUT_ACTION);
+ }
+
+ @Override
public void runWithEvent(Event event) {
- if (activeEditor != null) {
- activeEditor.performCut();
- return;
- }
- if (cutAction != null) {
- cutAction.runWithEvent(event);
- return;
- }
- }
-
- public void updateEnabledState() {
- if (activeEditor != null) {
- setEnabled(activeEditor.isCutEnabled());
- return;
- }
- if (cutAction != null) {
- setEnabled(cutAction.isEnabled());
- return;
- }
- setEnabled(false);
- }
- }
-
- private class CopyActionHandler extends Action {
- protected CopyActionHandler() {
- setId("CellEditorCopyActionHandler");//$NON-NLS-1$
- setEnabled(false);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.CELL_COPY_ACTION);
- }
-
- @Override
+ if (activeEditor != null) {
+ activeEditor.performCut();
+ return;
+ }
+ if (cutAction != null) {
+ cutAction.runWithEvent(event);
+ return;
+ }
+ }
+
+ public void updateEnabledState() {
+ if (activeEditor != null) {
+ setEnabled(activeEditor.isCutEnabled());
+ return;
+ }
+ if (cutAction != null) {
+ setEnabled(cutAction.isEnabled());
+ return;
+ }
+ setEnabled(false);
+ }
+ }
+
+ private class CopyActionHandler extends Action {
+ protected CopyActionHandler() {
+ setId("CellEditorCopyActionHandler");//$NON-NLS-1$
+ setEnabled(false);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.CELL_COPY_ACTION);
+ }
+
+ @Override
public void runWithEvent(Event event) {
- if (activeEditor != null) {
- activeEditor.performCopy();
- return;
- }
- if (copyAction != null) {
- copyAction.runWithEvent(event);
- return;
- }
- }
-
- public void updateEnabledState() {
- if (activeEditor != null) {
- setEnabled(activeEditor.isCopyEnabled());
- return;
- }
- if (copyAction != null) {
- setEnabled(copyAction.isEnabled());
- return;
- }
- setEnabled(false);
- }
- }
-
- private class PasteActionHandler extends Action {
- protected PasteActionHandler() {
- setId("CellEditorPasteActionHandler");//$NON-NLS-1$
- setEnabled(false);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.CELL_PASTE_ACTION);
- }
-
- @Override
+ if (activeEditor != null) {
+ activeEditor.performCopy();
+ return;
+ }
+ if (copyAction != null) {
+ copyAction.runWithEvent(event);
+ return;
+ }
+ }
+
+ public void updateEnabledState() {
+ if (activeEditor != null) {
+ setEnabled(activeEditor.isCopyEnabled());
+ return;
+ }
+ if (copyAction != null) {
+ setEnabled(copyAction.isEnabled());
+ return;
+ }
+ setEnabled(false);
+ }
+ }
+
+ private class PasteActionHandler extends Action {
+ protected PasteActionHandler() {
+ setId("CellEditorPasteActionHandler");//$NON-NLS-1$
+ setEnabled(false);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.CELL_PASTE_ACTION);
+ }
+
+ @Override
public void runWithEvent(Event event) {
- if (activeEditor != null) {
- activeEditor.performPaste();
- return;
- }
- if (pasteAction != null) {
- pasteAction.runWithEvent(event);
- return;
- }
- }
-
- public void updateEnabledState() {
- if (activeEditor != null) {
- setEnabled(activeEditor.isPasteEnabled());
- return;
- }
- if (pasteAction != null) {
- setEnabled(pasteAction.isEnabled());
- return;
- }
- setEnabled(false);
- }
- }
-
- private class DeleteActionHandler extends Action {
- protected DeleteActionHandler() {
- setId("CellEditorDeleteActionHandler");//$NON-NLS-1$
- setEnabled(false);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.CELL_DELETE_ACTION);
- }
-
- @Override
+ if (activeEditor != null) {
+ activeEditor.performPaste();
+ return;
+ }
+ if (pasteAction != null) {
+ pasteAction.runWithEvent(event);
+ return;
+ }
+ }
+
+ public void updateEnabledState() {
+ if (activeEditor != null) {
+ setEnabled(activeEditor.isPasteEnabled());
+ return;
+ }
+ if (pasteAction != null) {
+ setEnabled(pasteAction.isEnabled());
+ return;
+ }
+ setEnabled(false);
+ }
+ }
+
+ private class DeleteActionHandler extends Action {
+ protected DeleteActionHandler() {
+ setId("CellEditorDeleteActionHandler");//$NON-NLS-1$
+ setEnabled(false);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.CELL_DELETE_ACTION);
+ }
+
+ @Override
public void runWithEvent(Event event) {
- if (activeEditor != null) {
- activeEditor.performDelete();
- return;
- }
- if (deleteAction != null) {
- deleteAction.runWithEvent(event);
- return;
- }
- }
-
- public void updateEnabledState() {
- if (activeEditor != null) {
- setEnabled(activeEditor.isDeleteEnabled());
- return;
- }
- if (deleteAction != null) {
- setEnabled(deleteAction.isEnabled());
- return;
- }
- setEnabled(false);
- }
- }
-
- private class SelectAllActionHandler extends Action {
- protected SelectAllActionHandler() {
- setId("CellEditorSelectAllActionHandler");//$NON-NLS-1$
- setEnabled(false);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.CELL_SELECT_ALL_ACTION);
- }
-
- @Override
+ if (activeEditor != null) {
+ activeEditor.performDelete();
+ return;
+ }
+ if (deleteAction != null) {
+ deleteAction.runWithEvent(event);
+ return;
+ }
+ }
+
+ public void updateEnabledState() {
+ if (activeEditor != null) {
+ setEnabled(activeEditor.isDeleteEnabled());
+ return;
+ }
+ if (deleteAction != null) {
+ setEnabled(deleteAction.isEnabled());
+ return;
+ }
+ setEnabled(false);
+ }
+ }
+
+ private class SelectAllActionHandler extends Action {
+ protected SelectAllActionHandler() {
+ setId("CellEditorSelectAllActionHandler");//$NON-NLS-1$
+ setEnabled(false);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.CELL_SELECT_ALL_ACTION);
+ }
+
+ @Override
public void runWithEvent(Event event) {
- if (activeEditor != null) {
- activeEditor.performSelectAll();
- return;
- }
- if (selectAllAction != null) {
- selectAllAction.runWithEvent(event);
- return;
- }
- }
-
- public void updateEnabledState() {
- if (activeEditor != null) {
- setEnabled(activeEditor.isSelectAllEnabled());
- return;
- }
- if (selectAllAction != null) {
- setEnabled(selectAllAction.isEnabled());
- return;
- }
- setEnabled(false);
- }
- }
-
- private class FindActionHandler extends Action {
- protected FindActionHandler() {
- setId("CellEditorFindActionHandler");//$NON-NLS-1$
- setEnabled(false);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.CELL_FIND_ACTION);
- }
-
- @Override
+ if (activeEditor != null) {
+ activeEditor.performSelectAll();
+ return;
+ }
+ if (selectAllAction != null) {
+ selectAllAction.runWithEvent(event);
+ return;
+ }
+ }
+
+ public void updateEnabledState() {
+ if (activeEditor != null) {
+ setEnabled(activeEditor.isSelectAllEnabled());
+ return;
+ }
+ if (selectAllAction != null) {
+ setEnabled(selectAllAction.isEnabled());
+ return;
+ }
+ setEnabled(false);
+ }
+ }
+
+ private class FindActionHandler extends Action {
+ protected FindActionHandler() {
+ setId("CellEditorFindActionHandler");//$NON-NLS-1$
+ setEnabled(false);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.CELL_FIND_ACTION);
+ }
+
+ @Override
public void runWithEvent(Event event) {
- if (activeEditor != null) {
- activeEditor.performFind();
- return;
- }
- if (findAction != null) {
- findAction.runWithEvent(event);
- return;
- }
- }
-
- public void updateEnabledState() {
- if (activeEditor != null) {
- setEnabled(activeEditor.isFindEnabled());
- return;
- }
- if (findAction != null) {
- setEnabled(findAction.isEnabled());
- return;
- }
- setEnabled(false);
- }
- }
-
- private class UndoActionHandler extends Action {
- protected UndoActionHandler() {
- setId("CellEditorUndoActionHandler");//$NON-NLS-1$
- setEnabled(false);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.CELL_UNDO_ACTION);
- }
-
- @Override
+ if (activeEditor != null) {
+ activeEditor.performFind();
+ return;
+ }
+ if (findAction != null) {
+ findAction.runWithEvent(event);
+ return;
+ }
+ }
+
+ public void updateEnabledState() {
+ if (activeEditor != null) {
+ setEnabled(activeEditor.isFindEnabled());
+ return;
+ }
+ if (findAction != null) {
+ setEnabled(findAction.isEnabled());
+ return;
+ }
+ setEnabled(false);
+ }
+ }
+
+ private class UndoActionHandler extends Action {
+ protected UndoActionHandler() {
+ setId("CellEditorUndoActionHandler");//$NON-NLS-1$
+ setEnabled(false);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.CELL_UNDO_ACTION);
+ }
+
+ @Override
public void runWithEvent(Event event) {
- if (activeEditor != null) {
- activeEditor.performUndo();
- return;
- }
- if (undoAction != null) {
- undoAction.runWithEvent(event);
- return;
- }
- }
-
- public void updateEnabledState() {
- if (activeEditor != null) {
- setEnabled(activeEditor.isUndoEnabled());
- setText(WorkbenchMessages.Workbench_undo);
- setToolTipText(WorkbenchMessages.Workbench_undoToolTip);
- return;
- }
- if (undoAction != null) {
- setEnabled(undoAction.isEnabled());
- setText(undoAction.getText());
- setToolTipText(undoAction.getToolTipText());
- return;
- }
- setEnabled(false);
- }
- }
-
- private class RedoActionHandler extends Action {
- protected RedoActionHandler() {
- setId("CellEditorRedoActionHandler");//$NON-NLS-1$
- setEnabled(false);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.CELL_REDO_ACTION);
- }
-
- @Override
+ if (activeEditor != null) {
+ activeEditor.performUndo();
+ return;
+ }
+ if (undoAction != null) {
+ undoAction.runWithEvent(event);
+ return;
+ }
+ }
+
+ public void updateEnabledState() {
+ if (activeEditor != null) {
+ setEnabled(activeEditor.isUndoEnabled());
+ setText(WorkbenchMessages.Workbench_undo);
+ setToolTipText(WorkbenchMessages.Workbench_undoToolTip);
+ return;
+ }
+ if (undoAction != null) {
+ setEnabled(undoAction.isEnabled());
+ setText(undoAction.getText());
+ setToolTipText(undoAction.getToolTipText());
+ return;
+ }
+ setEnabled(false);
+ }
+ }
+
+ private class RedoActionHandler extends Action {
+ protected RedoActionHandler() {
+ setId("CellEditorRedoActionHandler");//$NON-NLS-1$
+ setEnabled(false);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.CELL_REDO_ACTION);
+ }
+
+ @Override
public void runWithEvent(Event event) {
- if (activeEditor != null) {
- activeEditor.performRedo();
- return;
- }
- if (redoAction != null) {
- redoAction.runWithEvent(event);
- return;
- }
- }
-
- public void updateEnabledState() {
- if (activeEditor != null) {
- setEnabled(activeEditor.isRedoEnabled());
- setText(WorkbenchMessages.Workbench_redo);
- setToolTipText(WorkbenchMessages.Workbench_redoToolTip);
- return;
- }
- if (redoAction != null) {
- setEnabled(redoAction.isEnabled());
- setText(redoAction.getText());
- setToolTipText(redoAction.getToolTipText());
- return;
- }
- setEnabled(false);
- }
- }
-
- /**
- * Creates a <code>CellEditor</code> action handler
- * for the global Cut, Copy, Paste, Delete, Select All,
- * Find, Undo, and Redo of the action bar.
- *
- * @param actionBar the action bar to register global
- * action handlers.
- */
- public CellEditorActionHandler(IActionBars actionBar) {
- super();
- actionBar.setGlobalActionHandler(ActionFactory.CUT.getId(),
- cellCutAction);
- actionBar.setGlobalActionHandler(ActionFactory.COPY.getId(),
- cellCopyAction);
- actionBar.setGlobalActionHandler(ActionFactory.PASTE.getId(),
- cellPasteAction);
- actionBar.setGlobalActionHandler(ActionFactory.DELETE.getId(),
- cellDeleteAction);
- actionBar.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(),
- cellSelectAllAction);
- actionBar.setGlobalActionHandler(ActionFactory.FIND.getId(),
- cellFindAction);
- actionBar.setGlobalActionHandler(ActionFactory.UNDO.getId(),
- cellUndoAction);
- actionBar.setGlobalActionHandler(ActionFactory.REDO.getId(),
- cellRedoAction);
- }
-
- /**
- * Adds a <code>CellEditor</code> to the handler so that the
- * Cut, Copy, Paste, Delete, Select All, Find, Undo, and Redo
- * actions are redirected to it when active.
- *
- * @param editor the <code>CellEditor</code>
- */
- public void addCellEditor(CellEditor editor) {
- if (editor == null) {
- return;
+ if (activeEditor != null) {
+ activeEditor.performRedo();
+ return;
+ }
+ if (redoAction != null) {
+ redoAction.runWithEvent(event);
+ return;
+ }
}
- Control control = editor.getControl();
- Assert.isNotNull(control);
- controlToEditor.put(control, editor);
- control.addListener(SWT.Activate, controlListener);
- control.addListener(SWT.Deactivate, controlListener);
-
- if (control.isFocusControl()) {
- activeEditor = editor;
- editor.addPropertyChangeListener(cellListener);
- updateActionsEnableState();
- }
- }
-
- /**
- * Disposes of this action handler
- */
- public void dispose() {
- setCutAction(null);
- setCopyAction(null);
- setPasteAction(null);
- setDeleteAction(null);
- setSelectAllAction(null);
- setFindAction(null);
- setUndoAction(null);
- setRedoAction(null);
-
- Iterator itr = controlToEditor.keySet().iterator();
- while (itr.hasNext()) {
- Control control = (Control) itr.next();
- if (!control.isDisposed()) {
- control.removeListener(SWT.Activate, controlListener);
- control.removeListener(SWT.Deactivate, controlListener);
- }
- }
- controlToEditor.clear();
-
- if (activeEditor != null) {
- activeEditor.removePropertyChangeListener(cellListener);
+ public void updateEnabledState() {
+ if (activeEditor != null) {
+ setEnabled(activeEditor.isRedoEnabled());
+ setText(WorkbenchMessages.Workbench_redo);
+ setToolTipText(WorkbenchMessages.Workbench_redoToolTip);
+ return;
+ }
+ if (redoAction != null) {
+ setEnabled(redoAction.isEnabled());
+ setText(redoAction.getText());
+ setToolTipText(redoAction.getToolTipText());
+ return;
+ }
+ setEnabled(false);
}
- activeEditor = null;
+ }
+
+ /**
+ * Creates a <code>CellEditor</code> action handler for the global Cut, Copy,
+ * Paste, Delete, Select All, Find, Undo, and Redo of the action bar.
+ *
+ * @param actionBar the action bar to register global action handlers.
+ */
+ public CellEditorActionHandler(IActionBars actionBar) {
+ super();
+ actionBar.setGlobalActionHandler(ActionFactory.CUT.getId(), cellCutAction);
+ actionBar.setGlobalActionHandler(ActionFactory.COPY.getId(), cellCopyAction);
+ actionBar.setGlobalActionHandler(ActionFactory.PASTE.getId(), cellPasteAction);
+ actionBar.setGlobalActionHandler(ActionFactory.DELETE.getId(), cellDeleteAction);
+ actionBar.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), cellSelectAllAction);
+ actionBar.setGlobalActionHandler(ActionFactory.FIND.getId(), cellFindAction);
+ actionBar.setGlobalActionHandler(ActionFactory.UNDO.getId(), cellUndoAction);
+ actionBar.setGlobalActionHandler(ActionFactory.REDO.getId(), cellRedoAction);
+ }
+
+ /**
+ * Adds a <code>CellEditor</code> to the handler so that the Cut, Copy, Paste,
+ * Delete, Select All, Find, Undo, and Redo actions are redirected to it when
+ * active.
+ *
+ * @param editor the <code>CellEditor</code>
+ */
+ public void addCellEditor(CellEditor editor) {
+ if (editor == null) {
+ return;
+ }
+
+ Control control = editor.getControl();
+ Assert.isNotNull(control);
+ controlToEditor.put(control, editor);
+ control.addListener(SWT.Activate, controlListener);
+ control.addListener(SWT.Deactivate, controlListener);
- }
+ if (control.isFocusControl()) {
+ activeEditor = editor;
+ editor.addPropertyChangeListener(cellListener);
+ updateActionsEnableState();
+ }
+ }
+
+ /**
+ * Disposes of this action handler
+ */
+ public void dispose() {
+ setCutAction(null);
+ setCopyAction(null);
+ setPasteAction(null);
+ setDeleteAction(null);
+ setSelectAllAction(null);
+ setFindAction(null);
+ setUndoAction(null);
+ setRedoAction(null);
+
+ Iterator itr = controlToEditor.keySet().iterator();
+ while (itr.hasNext()) {
+ Control control = (Control) itr.next();
+ if (!control.isDisposed()) {
+ control.removeListener(SWT.Activate, controlListener);
+ control.removeListener(SWT.Deactivate, controlListener);
+ }
+ }
+ controlToEditor.clear();
- /**
- * Removes a <code>CellEditor</code> from the handler
- * so that the Cut, Copy, Paste, Delete, Select All, Find
- * Undo, and Redo actions are no longer redirected to it.
- *
- * @param editor the <code>CellEditor</code>
- */
- public void removeCellEditor(CellEditor editor) {
- if (editor == null) {
+ if (activeEditor != null) {
+ activeEditor.removePropertyChangeListener(cellListener);
+ }
+ activeEditor = null;
+
+ }
+
+ /**
+ * Removes a <code>CellEditor</code> from the handler so that the Cut, Copy,
+ * Paste, Delete, Select All, Find Undo, and Redo actions are no longer
+ * redirected to it.
+ *
+ * @param editor the <code>CellEditor</code>
+ */
+ public void removeCellEditor(CellEditor editor) {
+ if (editor == null) {
return;
}
- if (activeEditor == editor) {
- activeEditor.removePropertyChangeListener(cellListener);
- activeEditor = null;
- }
-
- Control control = editor.getControl();
- if (control != null) {
- controlToEditor.remove(control);
- if (!control.isDisposed()) {
- control.removeListener(SWT.Activate, controlListener);
- control.removeListener(SWT.Deactivate, controlListener);
- }
- }
- }
-
- /**
- * Sets the default <code>IAction</code> handler for the Copy
- * action. This <code>IAction</code> is run only if no active
- * cell editor control.
- *
- * @param action the <code>IAction</code> to run for the
- * Copy action, or <code>null</code> if not interested.
- */
- public void setCopyAction(IAction action) {
- if (copyAction == action) {
+ if (activeEditor == editor) {
+ activeEditor.removePropertyChangeListener(cellListener);
+ activeEditor = null;
+ }
+
+ Control control = editor.getControl();
+ if (control != null) {
+ controlToEditor.remove(control);
+ if (!control.isDisposed()) {
+ control.removeListener(SWT.Activate, controlListener);
+ control.removeListener(SWT.Deactivate, controlListener);
+ }
+ }
+ }
+
+ /**
+ * Sets the default <code>IAction</code> handler for the Copy action. This
+ * <code>IAction</code> is run only if no active cell editor control.
+ *
+ * @param action the <code>IAction</code> to run for the Copy action, or
+ * <code>null</code> if not interested.
+ */
+ public void setCopyAction(IAction action) {
+ if (copyAction == action) {
return;
}
- if (copyAction != null) {
+ if (copyAction != null) {
copyAction.removePropertyChangeListener(copyActionListener);
}
- copyAction = action;
+ copyAction = action;
- if (copyAction != null) {
+ if (copyAction != null) {
copyAction.addPropertyChangeListener(copyActionListener);
}
- cellCopyAction.updateEnabledState();
- }
-
- /**
- * Sets the default <code>IAction</code> handler for the Cut
- * action. This <code>IAction</code> is run only if no active
- * cell editor control.
- *
- * @param action the <code>IAction</code> to run for the
- * Cut action, or <code>null</code> if not interested.
- */
- public void setCutAction(IAction action) {
- if (cutAction == action) {
+ cellCopyAction.updateEnabledState();
+ }
+
+ /**
+ * Sets the default <code>IAction</code> handler for the Cut action. This
+ * <code>IAction</code> is run only if no active cell editor control.
+ *
+ * @param action the <code>IAction</code> to run for the Cut action, or
+ * <code>null</code> if not interested.
+ */
+ public void setCutAction(IAction action) {
+ if (cutAction == action) {
return;
}
- if (cutAction != null) {
+ if (cutAction != null) {
cutAction.removePropertyChangeListener(cutActionListener);
}
- cutAction = action;
+ cutAction = action;
- if (cutAction != null) {
+ if (cutAction != null) {
cutAction.addPropertyChangeListener(cutActionListener);
}
- cellCutAction.updateEnabledState();
- }
-
- /**
- * Sets the default <code>IAction</code> handler for the Delete
- * action. This <code>IAction</code> is run only if no active
- * cell editor control.
- *
- * @param action the <code>IAction</code> to run for the
- * Delete action, or <code>null</code> if not interested.
- */
- public void setDeleteAction(IAction action) {
- if (deleteAction == action) {
+ cellCutAction.updateEnabledState();
+ }
+
+ /**
+ * Sets the default <code>IAction</code> handler for the Delete action. This
+ * <code>IAction</code> is run only if no active cell editor control.
+ *
+ * @param action the <code>IAction</code> to run for the Delete action, or
+ * <code>null</code> if not interested.
+ */
+ public void setDeleteAction(IAction action) {
+ if (deleteAction == action) {
return;
}
- if (deleteAction != null) {
+ if (deleteAction != null) {
deleteAction.removePropertyChangeListener(deleteActionListener);
}
- deleteAction = action;
+ deleteAction = action;
- if (deleteAction != null) {
+ if (deleteAction != null) {
deleteAction.addPropertyChangeListener(deleteActionListener);
}
- cellDeleteAction.updateEnabledState();
- }
-
- /**
- * Sets the default <code>IAction</code> handler for the Find
- * action. This <code>IAction</code> is run only if no active
- * cell editor control.
- *
- * @param action the <code>IAction</code> to run for the
- * Find action, or <code>null</code> if not interested.
- */
- public void setFindAction(IAction action) {
- if (findAction == action) {
+ cellDeleteAction.updateEnabledState();
+ }
+
+ /**
+ * Sets the default <code>IAction</code> handler for the Find action. This
+ * <code>IAction</code> is run only if no active cell editor control.
+ *
+ * @param action the <code>IAction</code> to run for the Find action, or
+ * <code>null</code> if not interested.
+ */
+ public void setFindAction(IAction action) {
+ if (findAction == action) {
return;
}
- if (findAction != null) {
+ if (findAction != null) {
findAction.removePropertyChangeListener(findActionListener);
}
- findAction = action;
+ findAction = action;
- if (findAction != null) {
+ if (findAction != null) {
findAction.addPropertyChangeListener(findActionListener);
}
- cellFindAction.updateEnabledState();
- }
-
- /**
- * Sets the default <code>IAction</code> handler for the Paste
- * action. This <code>IAction</code> is run only if no active
- * cell editor control.
- *
- * @param action the <code>IAction</code> to run for the
- * Paste action, or <code>null</code> if not interested.
- */
- public void setPasteAction(IAction action) {
- if (pasteAction == action) {
+ cellFindAction.updateEnabledState();
+ }
+
+ /**
+ * Sets the default <code>IAction</code> handler for the Paste action. This
+ * <code>IAction</code> is run only if no active cell editor control.
+ *
+ * @param action the <code>IAction</code> to run for the Paste action, or
+ * <code>null</code> if not interested.
+ */
+ public void setPasteAction(IAction action) {
+ if (pasteAction == action) {
return;
}
- if (pasteAction != null) {
+ if (pasteAction != null) {
pasteAction.removePropertyChangeListener(pasteActionListener);
}
- pasteAction = action;
+ pasteAction = action;
- if (pasteAction != null) {
+ if (pasteAction != null) {
pasteAction.addPropertyChangeListener(pasteActionListener);
}
- cellPasteAction.updateEnabledState();
- }
-
- /**
- * Sets the default <code>IAction</code> handler for the Redo
- * action. This <code>IAction</code> is run only if no active
- * cell editor control.
- *
- * @param action the <code>IAction</code> to run for the
- * Redo action, or <code>null</code> if not interested.
- */
- public void setRedoAction(IAction action) {
- if (redoAction == action) {
+ cellPasteAction.updateEnabledState();
+ }
+
+ /**
+ * Sets the default <code>IAction</code> handler for the Redo action. This
+ * <code>IAction</code> is run only if no active cell editor control.
+ *
+ * @param action the <code>IAction</code> to run for the Redo action, or
+ * <code>null</code> if not interested.
+ */
+ public void setRedoAction(IAction action) {
+ if (redoAction == action) {
return;
}
- if (redoAction != null) {
+ if (redoAction != null) {
redoAction.removePropertyChangeListener(redoActionListener);
}
- redoAction = action;
+ redoAction = action;
- if (redoAction != null) {
+ if (redoAction != null) {
redoAction.addPropertyChangeListener(redoActionListener);
}
- cellRedoAction.updateEnabledState();
- }
-
- /**
- * Sets the default <code>IAction</code> handler for the Select All
- * action. This <code>IAction</code> is run only if no active
- * cell editor control.
- *
- * @param action the <code>IAction</code> to run for the
- * Select All action, or <code>null</code> if not interested.
- */
- public void setSelectAllAction(IAction action) {
- if (selectAllAction == action) {
+ cellRedoAction.updateEnabledState();
+ }
+
+ /**
+ * Sets the default <code>IAction</code> handler for the Select All action. This
+ * <code>IAction</code> is run only if no active cell editor control.
+ *
+ * @param action the <code>IAction</code> to run for the Select All action, or
+ * <code>null</code> if not interested.
+ */
+ public void setSelectAllAction(IAction action) {
+ if (selectAllAction == action) {
return;
}
- if (selectAllAction != null) {
- selectAllAction
- .removePropertyChangeListener(selectAllActionListener);
+ if (selectAllAction != null) {
+ selectAllAction.removePropertyChangeListener(selectAllActionListener);
}
- selectAllAction = action;
+ selectAllAction = action;
- if (selectAllAction != null) {
+ if (selectAllAction != null) {
selectAllAction.addPropertyChangeListener(selectAllActionListener);
}
- cellSelectAllAction.updateEnabledState();
- }
-
- /**
- * Sets the default <code>IAction</code> handler for the Undo
- * action. This <code>IAction</code> is run only if no active
- * cell editor control.
- *
- * @param action the <code>IAction</code> to run for the
- * Undo action, or <code>null</code> if not interested.
- */
- public void setUndoAction(IAction action) {
- if (undoAction == action) {
+ cellSelectAllAction.updateEnabledState();
+ }
+
+ /**
+ * Sets the default <code>IAction</code> handler for the Undo action. This
+ * <code>IAction</code> is run only if no active cell editor control.
+ *
+ * @param action the <code>IAction</code> to run for the Undo action, or
+ * <code>null</code> if not interested.
+ */
+ public void setUndoAction(IAction action) {
+ if (undoAction == action) {
return;
}
- if (undoAction != null) {
+ if (undoAction != null) {
undoAction.removePropertyChangeListener(undoActionListener);
}
- undoAction = action;
+ undoAction = action;
- if (undoAction != null) {
+ if (undoAction != null) {
undoAction.addPropertyChangeListener(undoActionListener);
}
- cellUndoAction.updateEnabledState();
- }
-
- /**
- * Updates the enable state of the Cut, Copy,
- * Paste, Delete, Select All, Find, Undo, and
- * Redo action handlers
- */
- private void updateActionsEnableState() {
- cellCutAction.updateEnabledState();
- cellCopyAction.updateEnabledState();
- cellPasteAction.updateEnabledState();
- cellDeleteAction.updateEnabledState();
- cellSelectAllAction.updateEnabledState();
- cellFindAction.updateEnabledState();
- cellUndoAction.updateEnabledState();
- cellRedoAction.updateEnabledState();
- }
+ cellUndoAction.updateEnabledState();
+ }
+
+ /**
+ * Updates the enable state of the Cut, Copy, Paste, Delete, Select All, Find,
+ * Undo, and Redo action handlers
+ */
+ private void updateActionsEnableState() {
+ cellCutAction.updateEnabledState();
+ cellCopyAction.updateEnabledState();
+ cellPasteAction.updateEnabledState();
+ cellDeleteAction.updateEnabledState();
+ cellSelectAllAction.updateEnabledState();
+ cellFindAction.updateEnabledState();
+ cellUndoAction.updateEnabledState();
+ cellRedoAction.updateEnabledState();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/CoolItemGroupMarker.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/CoolItemGroupMarker.java
index de5330fd83f..06cc5af3058 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/CoolItemGroupMarker.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/CoolItemGroupMarker.java
@@ -16,25 +16,26 @@ package org.eclipse.ui.part;
import org.eclipse.jface.action.GroupMarker;
/**
- * A group marker used by EditorActionBars to delineate CoolItem groups.
- * Use this marker when contributing to the ToolBar for the EditorActionBar.
+ * A group marker used by EditorActionBars to delineate CoolItem groups. Use
+ * this marker when contributing to the ToolBar for the EditorActionBar.
* <p>
* This class may be instantiated; it is not intended to be subclassed.
* </p>
+ *
* @noextend This class is not intended to be subclassed by clients.
*/
public class CoolItemGroupMarker extends GroupMarker {
- /**
- * Create a new group marker with the given name.
- * The group name must not be <code>null</code> or the empty string.
- * The group name is also used as the item id.
- *
- * Note that CoolItemGroupMarkers must have a group name and the name must
- * be unique.
- *
- * @param groupName the name of the group
- */
- public CoolItemGroupMarker(String groupName) {
- super(groupName);
- }
+ /**
+ * Create a new group marker with the given name. The group name must not be
+ * <code>null</code> or the empty string. The group name is also used as the
+ * item id.
+ *
+ * Note that CoolItemGroupMarkers must have a group name and the name must be
+ * unique.
+ *
+ * @param groupName the name of the group
+ */
+ public CoolItemGroupMarker(String groupName) {
+ super(groupName);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/DrillDownAdapter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/DrillDownAdapter.java
index c6648fc25cd..61c8cc314e5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/DrillDownAdapter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/DrillDownAdapter.java
@@ -50,53 +50,53 @@ import org.eclipse.ui.internal.WorkbenchMessages;
* </p>
*/
public class DrillDownAdapter implements ISelectionChangedListener {
- private TreeViewer fChildTree;
+ private TreeViewer fChildTree;
- private DrillStack fDrillStack;
+ private DrillStack fDrillStack;
- private Action homeAction;
+ private Action homeAction;
- private Action backAction;
+ private Action backAction;
- private Action forwardAction;
+ private Action forwardAction;
- /**
- * Allocates a new DrillDownTreePart.
- *
- * @param tree the target tree for refocusing
- */
- public DrillDownAdapter(TreeViewer tree) {
- fDrillStack = new DrillStack();
- fChildTree = tree;
- }
+ /**
+ * Allocates a new DrillDownTreePart.
+ *
+ * @param tree the target tree for refocusing
+ */
+ public DrillDownAdapter(TreeViewer tree) {
+ fDrillStack = new DrillStack();
+ fChildTree = tree;
+ }
- /**
- * Adds actions for "go back", "go home", and "go into" to a menu manager.
- *
- * @param manager is the target manager to update
- */
- public void addNavigationActions(IMenuManager manager) {
- createActions();
- manager.add(homeAction);
- manager.add(backAction);
- manager.add(forwardAction);
- updateNavigationButtons();
- }
+ /**
+ * Adds actions for "go back", "go home", and "go into" to a menu manager.
+ *
+ * @param manager is the target manager to update
+ */
+ public void addNavigationActions(IMenuManager manager) {
+ createActions();
+ manager.add(homeAction);
+ manager.add(backAction);
+ manager.add(forwardAction);
+ updateNavigationButtons();
+ }
- /**
- * Adds actions for "go back", "go home", and "go into" to a tool bar manager.
- *
- * @param toolBar is the target manager to update
- */
- public void addNavigationActions(IToolBarManager toolBar) {
- createActions();
- toolBar.add(homeAction);
- toolBar.add(backAction);
- toolBar.add(forwardAction);
- updateNavigationButtons();
- }
+ /**
+ * Adds actions for "go back", "go home", and "go into" to a tool bar manager.
+ *
+ * @param toolBar is the target manager to update
+ */
+ public void addNavigationActions(IToolBarManager toolBar) {
+ createActions();
+ toolBar.add(homeAction);
+ toolBar.add(backAction);
+ toolBar.add(forwardAction);
+ updateNavigationButtons();
+ }
- /**
+ /**
* Returns whether expansion is possible for the current selection. This will
* only be true if it has children.
*
@@ -104,243 +104,238 @@ public class DrillDownAdapter implements ISelectionChangedListener {
* @return <code>true</code> if expansion is possible; otherwise return
* <code>false</code>
*/
- public boolean canExpand(Object element) {
- return fChildTree.isExpandable(element);
- }
+ public boolean canExpand(Object element) {
+ return fChildTree.isExpandable(element);
+ }
- /**
- * Returns whether "go back" is possible for child tree. This is only possible
- * if the client has performed one or more drilling operations.
- *
- * @return <code>true</code> if "go back" is possible; <code>false</code> otherwise
- */
- public boolean canGoBack() {
- return fDrillStack.canGoBack();
- }
+ /**
+ * Returns whether "go back" is possible for child tree. This is only possible
+ * if the client has performed one or more drilling operations.
+ *
+ * @return <code>true</code> if "go back" is possible; <code>false</code>
+ * otherwise
+ */
+ public boolean canGoBack() {
+ return fDrillStack.canGoBack();
+ }
- /**
- * Returns whether "go home" is possible for child tree. This is only possible
- * if the client has performed one or more drilling operations.
- *
- * @return <code>true</code> if "go home" is possible; <code>false</code> otherwise
- */
- public boolean canGoHome() {
- return fDrillStack.canGoHome();
- }
+ /**
+ * Returns whether "go home" is possible for child tree. This is only possible
+ * if the client has performed one or more drilling operations.
+ *
+ * @return <code>true</code> if "go home" is possible; <code>false</code>
+ * otherwise
+ */
+ public boolean canGoHome() {
+ return fDrillStack.canGoHome();
+ }
- /**
- * Returns whether "go into" is possible for child tree. This is only possible
- * if the current selection in the client has one item and it has children.
- *
- * @return <code>true</code> if "go into" is possible; <code>false</code> otherwise
- */
- public boolean canGoInto() {
+ /**
+ * Returns whether "go into" is possible for child tree. This is only possible
+ * if the current selection in the client has one item and it has children.
+ *
+ * @return <code>true</code> if "go into" is possible; <code>false</code>
+ * otherwise
+ */
+ public boolean canGoInto() {
IStructuredSelection oSelection = fChildTree.getStructuredSelection();
- if (oSelection == null || oSelection.size() != 1) {
+ if (oSelection == null || oSelection.size() != 1) {
return false;
}
- Object anElement = oSelection.getFirstElement();
- return canExpand(anElement);
- }
+ Object anElement = oSelection.getFirstElement();
+ return canExpand(anElement);
+ }
- /**
- * Create the actions for navigation.
- *
- */
- private void createActions() {
- // Only do this once.
- if (homeAction != null) {
+ /**
+ * Create the actions for navigation.
+ *
+ */
+ private void createActions() {
+ // Only do this once.
+ if (homeAction != null) {
return;
}
- // Home.
- homeAction = new Action(WorkbenchMessages.GoHome_text) {
- @Override
+ // Home.
+ homeAction = new Action(WorkbenchMessages.GoHome_text) {
+ @Override
public void run() {
- goHome();
- }
- };
- homeAction
- .setToolTipText(WorkbenchMessages.GoHome_toolTip);
- homeAction
- .setImageDescriptor(WorkbenchImages
- .getImageDescriptor(ISharedImages.IMG_ETOOL_HOME_NAV));
+ goHome();
+ }
+ };
+ homeAction.setToolTipText(WorkbenchMessages.GoHome_toolTip);
+ homeAction.setImageDescriptor(WorkbenchImages.getImageDescriptor(ISharedImages.IMG_ETOOL_HOME_NAV));
- // Back.
- ISharedImages images = PlatformUI.getWorkbench().getSharedImages();
- backAction = new Action(WorkbenchMessages.GoBack_text) {
- @Override
+ // Back.
+ ISharedImages images = PlatformUI.getWorkbench().getSharedImages();
+ backAction = new Action(WorkbenchMessages.GoBack_text) {
+ @Override
public void run() {
- goBack();
- }
- };
- backAction
- .setToolTipText(WorkbenchMessages.GoBack_toolTip);
- backAction.setImageDescriptor(images
- .getImageDescriptor(ISharedImages.IMG_TOOL_BACK));
- backAction.setDisabledImageDescriptor(images
- .getImageDescriptor(ISharedImages.IMG_TOOL_BACK_DISABLED));
+ goBack();
+ }
+ };
+ backAction.setToolTipText(WorkbenchMessages.GoBack_toolTip);
+ backAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_BACK));
+ backAction.setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_BACK_DISABLED));
- // Forward.
- forwardAction = new Action(WorkbenchMessages.GoInto_text) {
- @Override
+ // Forward.
+ forwardAction = new Action(WorkbenchMessages.GoInto_text) {
+ @Override
public void run() {
- goInto();
- }
- };
- forwardAction.setToolTipText(WorkbenchMessages.GoInto_toolTip);
- forwardAction.setImageDescriptor(images
- .getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD));
- forwardAction.setDisabledImageDescriptor(images
- .getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD_DISABLED));
+ goInto();
+ }
+ };
+ forwardAction.setToolTipText(WorkbenchMessages.GoInto_toolTip);
+ forwardAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD));
+ forwardAction.setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD_DISABLED));
- // Update the buttons when a selection change occurs.
- fChildTree.addSelectionChangedListener(this);
- updateNavigationButtons();
- }
+ // Update the buttons when a selection change occurs.
+ fChildTree.addSelectionChangedListener(this);
+ updateNavigationButtons();
+ }
- /**
- * Expands the given items in the tree. The list of items passed should be
- * derived by calling <code>getExpanded</code>.
- *
- * @param items is a list of items within the tree which should be expanded
- */
- private void expand(List items) {
- fChildTree.setExpandedElements(items.toArray());
- }
+ /**
+ * Expands the given items in the tree. The list of items passed should be
+ * derived by calling <code>getExpanded</code>.
+ *
+ * @param items is a list of items within the tree which should be expanded
+ */
+ private void expand(List items) {
+ fChildTree.setExpandedElements(items.toArray());
+ }
- /**
- * Returns a list of elements corresponding to expanded nodes in
- * child tree.
- *
- * @return a list of expandd elements
- */
- private List getExpanded() {
- return Arrays.asList(fChildTree.getExpandedElements());
- }
+ /**
+ * Returns a list of elements corresponding to expanded nodes in child tree.
+ *
+ * @return a list of expandd elements
+ */
+ private List getExpanded() {
+ return Arrays.asList(fChildTree.getExpandedElements());
+ }
- /**
- * Reverts the input for the tree back to the state when <code>goInto</code>
- * was last called.
- * <p>
- * A frame is removed from the drill stack. Then that frame is used to reset the
- * input and expansion state for the child tree.
- * </p>
- */
- public void goBack() {
- Object currentInput = fChildTree.getInput();
- DrillFrame oFrame = fDrillStack.goBack();
- Object input = oFrame.getElement();
- fChildTree.setInput(input);
- expand(oFrame.getExpansion());
- // if there was a selection, it should have been preserved,
- // but if not, select the element that was drilled into
- if (fChildTree.getSelection().isEmpty()) {
- fChildTree
- .setSelection(new StructuredSelection(currentInput), true);
+ /**
+ * Reverts the input for the tree back to the state when <code>goInto</code> was
+ * last called.
+ * <p>
+ * A frame is removed from the drill stack. Then that frame is used to reset the
+ * input and expansion state for the child tree.
+ * </p>
+ */
+ public void goBack() {
+ Object currentInput = fChildTree.getInput();
+ DrillFrame oFrame = fDrillStack.goBack();
+ Object input = oFrame.getElement();
+ fChildTree.setInput(input);
+ expand(oFrame.getExpansion());
+ // if there was a selection, it should have been preserved,
+ // but if not, select the element that was drilled into
+ if (fChildTree.getSelection().isEmpty()) {
+ fChildTree.setSelection(new StructuredSelection(currentInput), true);
}
- updateNavigationButtons();
- }
+ updateNavigationButtons();
+ }
- /**
- * Reverts the input for the tree back to the state when the adapter was
- * created.
- * <p>
- * All of the frames are removed from the drill stack. Then the oldest frame is
- * used to reset the input and expansion state for the child tree.
- * </p>
- */
- public void goHome() {
- Object currentInput = fChildTree.getInput();
- DrillFrame oFrame = fDrillStack.goHome();
- Object input = oFrame.getElement();
- fChildTree.setInput(input);
- expand(oFrame.getExpansion());
- // if there was a selection, it should have been preserved,
- // but if not, select the element that was last drilled into
- if (fChildTree.getSelection().isEmpty()) {
- fChildTree
- .setSelection(new StructuredSelection(currentInput), true);
+ /**
+ * Reverts the input for the tree back to the state when the adapter was
+ * created.
+ * <p>
+ * All of the frames are removed from the drill stack. Then the oldest frame is
+ * used to reset the input and expansion state for the child tree.
+ * </p>
+ */
+ public void goHome() {
+ Object currentInput = fChildTree.getInput();
+ DrillFrame oFrame = fDrillStack.goHome();
+ Object input = oFrame.getElement();
+ fChildTree.setInput(input);
+ expand(oFrame.getExpansion());
+ // if there was a selection, it should have been preserved,
+ // but if not, select the element that was last drilled into
+ if (fChildTree.getSelection().isEmpty()) {
+ fChildTree.setSelection(new StructuredSelection(currentInput), true);
}
- updateNavigationButtons();
- }
+ updateNavigationButtons();
+ }
- /**
- * Sets the input for the tree to the current selection.
- * <p>
- * The current input and expansion state are saved in a frame and added to the
- * drill stack. Then the input for the tree is changed to be the current selection.
- * The expansion state for the tree is maintained during the operation.
- * </p><p>
- * On return the client may revert back to the previous state by invoking
- * <code>goBack</code> or <code>goHome</code>.
- * </p>
- */
- public void goInto() {
+ /**
+ * Sets the input for the tree to the current selection.
+ * <p>
+ * The current input and expansion state are saved in a frame and added to the
+ * drill stack. Then the input for the tree is changed to be the current
+ * selection. The expansion state for the tree is maintained during the
+ * operation.
+ * </p>
+ * <p>
+ * On return the client may revert back to the previous state by invoking
+ * <code>goBack</code> or <code>goHome</code>.
+ * </p>
+ */
+ public void goInto() {
IStructuredSelection sel = fChildTree.getStructuredSelection();
- Object element = sel.getFirstElement();
- goInto(element);
- }
+ Object element = sel.getFirstElement();
+ goInto(element);
+ }
- /**
- * Sets the input for the tree to a particular item in the tree.
- * <p>
- * The current input and expansion state are saved in a frame and added to the
- * drill stack. Then the input for the tree is changed to be <code>newInput</code>.
- * The expansion state for the tree is maintained during the operation.
- * </p><p>
- * On return the client may revert back to the previous state by invoking
- * <code>goBack</code> or <code>goHome</code>.
- * </p>
- *
- * @param newInput the new input element
- */
- public void goInto(Object newInput) {
- // If we can drill ..
- if (canExpand(newInput)) {
- // Save the old state.
- Object oldInput = fChildTree.getInput();
- List expandedList = getExpanded();
- fDrillStack.add(new DrillFrame(oldInput, "null", expandedList));//$NON-NLS-1$
+ /**
+ * Sets the input for the tree to a particular item in the tree.
+ * <p>
+ * The current input and expansion state are saved in a frame and added to the
+ * drill stack. Then the input for the tree is changed to be
+ * <code>newInput</code>. The expansion state for the tree is maintained during
+ * the operation.
+ * </p>
+ * <p>
+ * On return the client may revert back to the previous state by invoking
+ * <code>goBack</code> or <code>goHome</code>.
+ * </p>
+ *
+ * @param newInput the new input element
+ */
+ public void goInto(Object newInput) {
+ // If we can drill ..
+ if (canExpand(newInput)) {
+ // Save the old state.
+ Object oldInput = fChildTree.getInput();
+ List expandedList = getExpanded();
+ fDrillStack.add(new DrillFrame(oldInput, "null", expandedList));//$NON-NLS-1$
- // Install the new state.
- fChildTree.setInput(newInput);
- expand(expandedList);
- updateNavigationButtons();
- }
- }
+ // Install the new state.
+ fChildTree.setInput(newInput);
+ expand(expandedList);
+ updateNavigationButtons();
+ }
+ }
- /**
- * Resets the drill down adapter.
- * <p>
- * This method is typically called when the input for the underlying view
- * is reset by something other than the adapter.
- * On return the drill stack has been cleared and the navigation buttons
- * reflect the new state of the underlying viewer.
- * </p>
- */
- public void reset() {
- fDrillStack.reset();
- updateNavigationButtons();
- }
+ /**
+ * Resets the drill down adapter.
+ * <p>
+ * This method is typically called when the input for the underlying view is
+ * reset by something other than the adapter. On return the drill stack has been
+ * cleared and the navigation buttons reflect the new state of the underlying
+ * viewer.
+ * </p>
+ */
+ public void reset() {
+ fDrillStack.reset();
+ updateNavigationButtons();
+ }
- /**
- * Updates the navigation buttons when a selection change occurs
- * in the tree.
- */
- @Override
+ /**
+ * Updates the navigation buttons when a selection change occurs in the tree.
+ */
+ @Override
public void selectionChanged(SelectionChangedEvent event) {
- updateNavigationButtons();
- }
+ updateNavigationButtons();
+ }
- /**
- * Updates the enabled state for each navigation button.
- */
- protected void updateNavigationButtons() {
- if (homeAction != null) {
- homeAction.setEnabled(canGoHome());
- backAction.setEnabled(canGoBack());
- forwardAction.setEnabled(canGoInto());
- }
- }
+ /**
+ * Updates the enabled state for each navigation button.
+ */
+ protected void updateNavigationButtons() {
+ if (homeAction != null) {
+ homeAction.setEnabled(canGoHome());
+ backAction.setEnabled(canGoBack());
+ forwardAction.setEnabled(canGoInto());
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/DrillDownComposite.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/DrillDownComposite.java
index b1b532b3223..d2c57b7b12f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/DrillDownComposite.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/DrillDownComposite.java
@@ -36,61 +36,61 @@ import org.eclipse.swt.widgets.ToolBar;
* </ol>
*/
public class DrillDownComposite extends Composite {
- private ToolBarManager toolBarMgr;
+ private ToolBarManager toolBarMgr;
- private TreeViewer fChildTree;
+ private TreeViewer fChildTree;
- private DrillDownAdapter adapter;
+ private DrillDownAdapter adapter;
- /**
- * Constructs a new DrillDownTreeViewer.
- *
- * @param parent the parent composite for this control
- * @param style the SWT style for this control
- */
- public DrillDownComposite(Composite parent, int style) {
- super(parent, style);
- createNavigationButtons();
- }
+ /**
+ * Constructs a new DrillDownTreeViewer.
+ *
+ * @param parent the parent composite for this control
+ * @param style the SWT style for this control
+ */
+ public DrillDownComposite(Composite parent, int style) {
+ super(parent, style);
+ createNavigationButtons();
+ }
- /**
- * Creates the navigation buttons for this viewer.
- */
- protected void createNavigationButtons() {
- GridData gid;
- GridLayout layout;
+ /**
+ * Creates the navigation buttons for this viewer.
+ */
+ protected void createNavigationButtons() {
+ GridData gid;
+ GridLayout layout;
- // Define layout.
- layout = new GridLayout();
- layout.marginHeight = layout.marginWidth = layout.horizontalSpacing = layout.verticalSpacing = 0;
- setLayout(layout);
+ // Define layout.
+ layout = new GridLayout();
+ layout.marginHeight = layout.marginWidth = layout.horizontalSpacing = layout.verticalSpacing = 0;
+ setLayout(layout);
- // Create a toolbar.
- toolBarMgr = new ToolBarManager(SWT.FLAT);
- ToolBar toolBar = toolBarMgr.createControl(this);
- gid = new GridData();
- gid.horizontalAlignment = GridData.FILL;
- gid.verticalAlignment = GridData.BEGINNING;
- toolBar.setLayoutData(gid);
- }
+ // Create a toolbar.
+ toolBarMgr = new ToolBarManager(SWT.FLAT);
+ ToolBar toolBar = toolBarMgr.createControl(this);
+ gid = new GridData();
+ gid.horizontalAlignment = GridData.FILL;
+ gid.verticalAlignment = GridData.BEGINNING;
+ toolBar.setLayoutData(gid);
+ }
- /**
- * Sets the child viewer. This method should only be called once, after the
- * viewer has been created.
- *
- * @param aViewer the new child viewer
- */
- public void setChildTree(TreeViewer aViewer) {
- // Save viewer.
- fChildTree = aViewer;
+ /**
+ * Sets the child viewer. This method should only be called once, after the
+ * viewer has been created.
+ *
+ * @param aViewer the new child viewer
+ */
+ public void setChildTree(TreeViewer aViewer) {
+ // Save viewer.
+ fChildTree = aViewer;
- // Create adapter.
- adapter = new DrillDownAdapter(fChildTree);
- adapter.addNavigationActions(toolBarMgr);
- toolBarMgr.update(true);
+ // Create adapter.
+ adapter = new DrillDownAdapter(fChildTree);
+ adapter.addNavigationActions(toolBarMgr);
+ toolBarMgr.update(true);
- // Set tree layout.
- fChildTree.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- layout();
- }
+ // Set tree layout.
+ fChildTree.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ layout();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/DrillFrame.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/DrillFrame.java
index b84a71a651c..926a025b19c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/DrillFrame.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/DrillFrame.java
@@ -21,75 +21,74 @@ import java.util.List;
*/
/* package */class DrillFrame {
- Object fElement;
+ Object fElement;
- Object fPropertyName;
+ Object fPropertyName;
- List fExpansion = null;
+ List fExpansion = null;
- /**
- * Allocates a new DrillFrame.
- *
- * @param oElement the tree input element
- * @param strPropertyName the visible tree property
- * @param vExpansion the current expansion state of the tree
- */
- public DrillFrame(Object oElement, Object strPropertyName, List vExpansion) {
- fElement = oElement;
- fPropertyName = strPropertyName;
- fExpansion = vExpansion;
- }
+ /**
+ * Allocates a new DrillFrame.
+ *
+ * @param oElement the tree input element
+ * @param strPropertyName the visible tree property
+ * @param vExpansion the current expansion state of the tree
+ */
+ public DrillFrame(Object oElement, Object strPropertyName, List vExpansion) {
+ fElement = oElement;
+ fPropertyName = strPropertyName;
+ fExpansion = vExpansion;
+ }
- /**
- * Compares two Objects for equality.
- * <p>
- *
- * @param obj the reference object with which to compare.
- * @return <code>true</code> if this object is the same as the obj
- * argument; <code>false</code> otherwise.
- */
- @Override
+ /**
+ * Compares two Objects for equality.
+ * <p>
+ *
+ * @param obj the reference object with which to compare.
+ * @return <code>true</code> if this object is the same as the obj argument;
+ * <code>false</code> otherwise.
+ */
+ @Override
public boolean equals(Object obj) {
- // Compare handles.
- if (this == obj) {
+ // Compare handles.
+ if (this == obj) {
return true;
}
- // Compare class.
- if (!(obj instanceof DrillFrame)) {
+ // Compare class.
+ if (!(obj instanceof DrillFrame)) {
return false;
}
- // Compare contents.
- DrillFrame oOther = (DrillFrame) obj;
- return ((fElement == oOther.fElement) && (fPropertyName
- .equals(oOther.fPropertyName)));
- }
+ // Compare contents.
+ DrillFrame oOther = (DrillFrame) obj;
+ return ((fElement == oOther.fElement) && (fPropertyName.equals(oOther.fPropertyName)));
+ }
- /**
- * Returns the input element.
- *
- * @return the input element
- */
- public Object getElement() {
- return fElement;
- }
+ /**
+ * Returns the input element.
+ *
+ * @return the input element
+ */
+ public Object getElement() {
+ return fElement;
+ }
- /**
- * Returns the expansion state for a tree.
- *
- * @return the expansion state for a tree
- */
- public List getExpansion() {
- return fExpansion;
- }
+ /**
+ * Returns the expansion state for a tree.
+ *
+ * @return the expansion state for a tree
+ */
+ public List getExpansion() {
+ return fExpansion;
+ }
- /**
- * Returns the property name.
- *
- * @return the property name
- */
- public Object getPropertyName() {
- return fPropertyName;
- }
+ /**
+ * Returns the property name.
+ *
+ * @return the property name
+ */
+ public Object getPropertyName() {
+ return fPropertyName;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/DrillStack.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/DrillStack.java
index 5005fcaaddc..dcfa5930dc6 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/DrillStack.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/DrillStack.java
@@ -21,84 +21,84 @@ import java.util.Stack;
*/
/* package */class DrillStack {
- Stack fStack = null;
+ Stack fStack = null;
- /**
- * Allocates a new DrillStack.
- */
- public DrillStack() {
- reset();
- }
+ /**
+ * Allocates a new DrillStack.
+ */
+ public DrillStack() {
+ reset();
+ }
- /**
- * Adds a drill frame to the stack.
- *
- * @param oRecord the new drill frame
- */
- public DrillFrame add(DrillFrame oRecord) {
- fStack.push(oRecord);
- return oRecord;
- }
+ /**
+ * Adds a drill frame to the stack.
+ *
+ * @param oRecord the new drill frame
+ */
+ public DrillFrame add(DrillFrame oRecord) {
+ fStack.push(oRecord);
+ return oRecord;
+ }
- /**
- * Returns true if backward navigation is possible. This is only true
- * if the stack size is greater than 0.
- *
- * @return true if backward navigation is possible
- */
- public boolean canGoBack() {
- return (fStack.size() > 0);
- }
+ /**
+ * Returns true if backward navigation is possible. This is only true if the
+ * stack size is greater than 0.
+ *
+ * @return true if backward navigation is possible
+ */
+ public boolean canGoBack() {
+ return (fStack.size() > 0);
+ }
- /**
- * Returns true if "go home" is possible. This is only true
- * if the stack size is greater than 0.
- *
- * @return true if "go home" is possible
- */
- public boolean canGoHome() {
- return (fStack.size() > 0);
- }
+ /**
+ * Returns true if "go home" is possible. This is only true if the stack size is
+ * greater than 0.
+ *
+ * @return true if "go home" is possible
+ */
+ public boolean canGoHome() {
+ return (fStack.size() > 0);
+ }
- /**
- * Navigate backwards one record.
- */
- public DrillFrame goBack() {
- DrillFrame aFrame = (DrillFrame) fStack.pop();
- return aFrame;
- }
+ /**
+ * Navigate backwards one record.
+ */
+ public DrillFrame goBack() {
+ DrillFrame aFrame = (DrillFrame) fStack.pop();
+ return aFrame;
+ }
- /**
- * Navigate to the home record.
- */
- public DrillFrame goHome() {
- DrillFrame aFrame = (DrillFrame) fStack.elementAt(0);
- reset();
- return aFrame;
- }
+ /**
+ * Navigate to the home record.
+ */
+ public DrillFrame goHome() {
+ DrillFrame aFrame = (DrillFrame) fStack.elementAt(0);
+ reset();
+ return aFrame;
+ }
- /**
- * Clears the navigation stack.
- */
- public void reset() {
- fStack = new Stack();
- }
+ /**
+ * Clears the navigation stack.
+ */
+ public void reset() {
+ fStack = new Stack();
+ }
- /**
- * Returns the stack size.
- *
- * @return the stack size
- */
- public int size() {
- return fStack.size();
- }
+ /**
+ * Returns the stack size.
+ *
+ * @return the stack size
+ */
+ public int size() {
+ return fStack.size();
+ }
- /**
- * Returns the top element on the stack.
- *
- * @return the top element on the stack
- */
- public DrillFrame top() {
- return (DrillFrame) fStack.peek();
- }
+ /**
+ * Returns the top element on the stack.
+ *
+ * @return the top element on the stack
+ */
+ public DrillFrame top() {
+ return (DrillFrame) fStack.peek();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/EditorActionBarContributor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/EditorActionBarContributor.java
index 66b37654342..248e506b293 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/EditorActionBarContributor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/EditorActionBarContributor.java
@@ -42,155 +42,157 @@ import org.eclipse.ui.IWorkbenchPage;
* </ul>
*/
public class EditorActionBarContributor implements IEditorActionBarContributor {
- /**
- * The action bars; <code>null</code> until <code>init</code> is called.
- */
- private IActionBars bars;
+ /**
+ * The action bars; <code>null</code> until <code>init</code> is called.
+ */
+ private IActionBars bars;
- /**
- * The workbench page; <code>null</code> until <code>init</code> is called.
- */
- private IWorkbenchPage page;
+ /**
+ * The workbench page; <code>null</code> until <code>init</code> is called.
+ */
+ private IWorkbenchPage page;
- /**
- * Creates an empty editor action bar contributor. The action bars are
- * furnished later via the <code>init</code> method.
- */
- public EditorActionBarContributor() {
- }
+ /**
+ * Creates an empty editor action bar contributor. The action bars are furnished
+ * later via the <code>init</code> method.
+ */
+ public EditorActionBarContributor() {
+ }
- /**
- * Contributes to the given menu.
- * <p>
- * The <code>EditorActionBarContributor</code> implementation of this method
- * does nothing. Subclasses may reimplement to add to the menu portion of this
- * contribution.
- * </p>
- *
- * @param menuManager the manager that controls the menu
- */
- public void contributeToMenu(IMenuManager menuManager) {
- }
+ /**
+ * Contributes to the given menu.
+ * <p>
+ * The <code>EditorActionBarContributor</code> implementation of this method
+ * does nothing. Subclasses may reimplement to add to the menu portion of this
+ * contribution.
+ * </p>
+ *
+ * @param menuManager the manager that controls the menu
+ */
+ public void contributeToMenu(IMenuManager menuManager) {
+ }
- /**
- * Contributes to the given status line.
- * <p>
- * The <code>EditorActionBarContributor</code> implementation of this method
- * does nothing. Subclasses may reimplement to add to the status line portion of
- * this contribution.
- * </p>
- *
- * @param statusLineManager the manager of the status line
- */
- public void contributeToStatusLine(IStatusLineManager statusLineManager) {
- }
+ /**
+ * Contributes to the given status line.
+ * <p>
+ * The <code>EditorActionBarContributor</code> implementation of this method
+ * does nothing. Subclasses may reimplement to add to the status line portion of
+ * this contribution.
+ * </p>
+ *
+ * @param statusLineManager the manager of the status line
+ */
+ public void contributeToStatusLine(IStatusLineManager statusLineManager) {
+ }
- /**
- * Contributes to the given tool bar.
- * <p>
- * The <code>EditorActionBarContributor</code> implementation of this method
- * does nothing. Subclasses may reimplement to add to the tool bar portion of
- * this contribution.
- * </p>
- *
- * @param toolBarManager the manager that controls the workbench tool bar
- */
- public void contributeToToolBar(IToolBarManager toolBarManager) {
- }
+ /**
+ * Contributes to the given tool bar.
+ * <p>
+ * The <code>EditorActionBarContributor</code> implementation of this method
+ * does nothing. Subclasses may reimplement to add to the tool bar portion of
+ * this contribution.
+ * </p>
+ *
+ * @param toolBarManager the manager that controls the workbench tool bar
+ */
+ public void contributeToToolBar(IToolBarManager toolBarManager) {
+ }
- /**
- * Contributes to the given cool bar.
- * <p>
- * The <code>EditorActionBarContributor</code> implementation of this method
- * does nothing. Subclasses may reimplement to add to the cool bar portion of
- * this contribution. There can only be contributions from a cool bar or a tool bar.
- * </p>
- *
- * @param coolBarManager the manager that controls the workbench cool bar.
- *
- * @since 3.0
- */
- public void contributeToCoolBar(ICoolBarManager coolBarManager) {
- }
+ /**
+ * Contributes to the given cool bar.
+ * <p>
+ * The <code>EditorActionBarContributor</code> implementation of this method
+ * does nothing. Subclasses may reimplement to add to the cool bar portion of
+ * this contribution. There can only be contributions from a cool bar or a tool
+ * bar.
+ * </p>
+ *
+ * @param coolBarManager the manager that controls the workbench cool bar.
+ *
+ * @since 3.0
+ */
+ public void contributeToCoolBar(ICoolBarManager coolBarManager) {
+ }
- /**
- * Returns this contributor's action bars.
- *
- * @return the action bars
- */
- public IActionBars getActionBars() {
- return bars;
- }
+ /**
+ * Returns this contributor's action bars.
+ *
+ * @return the action bars
+ */
+ public IActionBars getActionBars() {
+ return bars;
+ }
- /**
- * Returns this contributor's workbench page.
- *
- * @return the workbench page
- */
- public IWorkbenchPage getPage() {
- return page;
- }
+ /**
+ * Returns this contributor's workbench page.
+ *
+ * @return the workbench page
+ */
+ public IWorkbenchPage getPage() {
+ return page;
+ }
- /**
- * The <code>EditorActionBarContributor</code> implementation of this
- * <code>IEditorActionBarContributor</code> method does nothing,
- * subclasses may override.
- */
- @Override
+ /**
+ * The <code>EditorActionBarContributor</code> implementation of this
+ * <code>IEditorActionBarContributor</code> method does nothing, subclasses may
+ * override.
+ */
+ @Override
public void dispose() {
- }
+ }
- /**
- * The <code>EditorActionBarContributor</code> implementation of this
- * <code>IEditorActionBarContributor</code> method remembers the page
- * then forwards the call to <code>init(IActionBars)</code> for
- * backward compatibility
- */
- @Override
+ /**
+ * The <code>EditorActionBarContributor</code> implementation of this
+ * <code>IEditorActionBarContributor</code> method remembers the page then
+ * forwards the call to <code>init(IActionBars)</code> for backward
+ * compatibility
+ */
+ @Override
public void init(IActionBars bars, IWorkbenchPage page) {
- this.page = page;
- init(bars);
- }
+ this.page = page;
+ init(bars);
+ }
- /**
- * This method calls:
- * <ul>
- * <li><code>contributeToMenu</code> with <code>bars</code>' menu manager</li>
- * <li><code>contributeToToolBar</code> with <code>bars</code>' tool bar
- * manager</li>
- * <li><code>contributeToCoolBar</code> with <code>bars</code>' cool bar
- * manager if <code>IActionBars</code> is of extended type <code>IActionBars2</code> </li>
- * <li><code>contributeToStatusLine</code> with <code>bars</code>' status line
- * manager</li>
- * </ul>
- * The given action bars are also remembered and made accessible via
- * <code>getActionBars</code>.
- *
- * @param bars the action bars
- */
- public void init(IActionBars bars) {
- this.bars = bars;
- contributeToMenu(bars.getMenuManager());
- contributeToToolBar(bars.getToolBarManager());
- if (bars instanceof IActionBars2) {
- contributeToCoolBar(((IActionBars2) bars).getCoolBarManager());
- }
- contributeToStatusLine(bars.getStatusLineManager());
+ /**
+ * This method calls:
+ * <ul>
+ * <li><code>contributeToMenu</code> with <code>bars</code>' menu manager</li>
+ * <li><code>contributeToToolBar</code> with <code>bars</code>' tool bar
+ * manager</li>
+ * <li><code>contributeToCoolBar</code> with <code>bars</code>' cool bar manager
+ * if <code>IActionBars</code> is of extended type <code>IActionBars2</code>
+ * </li>
+ * <li><code>contributeToStatusLine</code> with <code>bars</code>' status line
+ * manager</li>
+ * </ul>
+ * The given action bars are also remembered and made accessible via
+ * <code>getActionBars</code>.
+ *
+ * @param bars the action bars
+ */
+ public void init(IActionBars bars) {
+ this.bars = bars;
+ contributeToMenu(bars.getMenuManager());
+ contributeToToolBar(bars.getToolBarManager());
+ if (bars instanceof IActionBars2) {
+ contributeToCoolBar(((IActionBars2) bars).getCoolBarManager());
+ }
+ contributeToStatusLine(bars.getStatusLineManager());
- }
+ }
- /**
- * Sets the active editor for the contributor.
- * <p>
- * The <code>EditorActionBarContributor</code> implementation of this method does
- * nothing. Subclasses may reimplement. This generally entails disconnecting
- * from the old editor, connecting to the new editor, and updating the actions
- * to reflect the new editor.
- * </p>
- *
- * @param targetEditor the new target editor
- */
- @Override
+ /**
+ * Sets the active editor for the contributor.
+ * <p>
+ * The <code>EditorActionBarContributor</code> implementation of this method
+ * does nothing. Subclasses may reimplement. This generally entails
+ * disconnecting from the old editor, connecting to the new editor, and updating
+ * the actions to reflect the new editor.
+ * </p>
+ *
+ * @param targetEditor the new target editor
+ */
+ @Override
public void setActiveEditor(IEditorPart targetEditor) {
- }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/EditorInputTransfer.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/EditorInputTransfer.java
index d5cbe70c51c..e2a4f8f42d9 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/EditorInputTransfer.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/EditorInputTransfer.java
@@ -34,42 +34,43 @@ import org.eclipse.ui.XMLMemento;
/**
* The <code>EditorInputTransfer</code> class is used to transfer an
* <code>IEditorInput</code> and corresponding editorId from one part to another
- * in a drag and drop operation. Only opening of internal editors is supported.
+ * in a drag and drop operation. Only opening of internal editors is supported.
* <p>
* In every drag and drop operation there is a <code>DragSource</code> and a
- * <code>DropTarget</code>. When a drag occurs a <code>Transfer</code> is used
- * to marshall the drag data from the source into a byte array. If a drop
- * occurs another <code>Transfer</code> is used to marshall the byte array into
- * drop data for the target.
+ * <code>DropTarget</code>. When a drag occurs a <code>Transfer</code> is used
+ * to marshall the drag data from the source into a byte array. If a drop occurs
+ * another <code>Transfer</code> is used to marshall the byte array into drop
+ * data for the target.
* </p>
* <p>
- * This class can be used for a <code>Viewer</code> or an SWT component directly.
- * A singleton is provided which may be serially reused (see <code>getInstance</code>).
- * For an implementor of <code>IEditorInput</code> to be supported by
- * <code>EditorInputTransfer</code>, it must provide a proper implementation of
- * <code>IEditorInput</code>.<code>getPersistable</code>. For further details,
- * consult the <code>org.eclipse.ui.elementFactories</code> extension point.
+ * This class can be used for a <code>Viewer</code> or an SWT component
+ * directly. A singleton is provided which may be serially reused (see
+ * <code>getInstance</code>). For an implementor of <code>IEditorInput</code> to
+ * be supported by <code>EditorInputTransfer</code>, it must provide a proper
+ * implementation of <code>IEditorInput</code>.<code>getPersistable</code>. For
+ * further details, consult the <code>org.eclipse.ui.elementFactories</code>
+ * extension point.
* </p>
* <p>
* The data for a transfer is represented by the <code>EditorInputData</code>
* class, and a convenience method <code>createEditorInputData</code> is
- * provided. A <code>DragSource</code>.<code>dragSetData</code> implementation
- * should set the data to an array of <code>EditorInputData</code>. In this
- * way, the dragging of multiple editor inputs is supported.
+ * provided. A <code>DragSource</code>.<code>dragSetData</code> implementation
+ * should set the data to an array of <code>EditorInputData</code>. In this way,
+ * the dragging of multiple editor inputs is supported.
* </p>
* <p>
- * Below is an example of how to set the data for dragging a single editor
- * input using a <code>EditorInputTransfer</code>.
+ * Below is an example of how to set the data for dragging a single editor input
+ * using a <code>EditorInputTransfer</code>.
* </p>
+ *
* <pre>
* public void dragSetData(DragSourceEvent event) {
- * if (EditorInputTransfer.getInstance().isSupportedType(event.dataType)) {
+ * if (EditorInputTransfer.getInstance().isSupportedType(event.dataType)) {
*
- * EditorInputTransfer.EditorInputData data =
- * EditorInputTransfer.
- * createEditorInputData(EDITOR_ID, getEditorInput());
- * event.data = new EditorInputTransfer.EditorInputData [] {data};
- * }
+ * EditorInputTransfer.EditorInputData data = EditorInputTransfer.createEditorInputData(EDITOR_ID,
+ * getEditorInput());
+ * event.data = new EditorInputTransfer.EditorInputData[] { data };
+ * }
* }
* </pre>
*
@@ -82,188 +83,182 @@ import org.eclipse.ui.XMLMemento;
*/
public class EditorInputTransfer extends ByteArrayTransfer {
- /**
- * Singleton instance.
- */
- private static final EditorInputTransfer instance = new EditorInputTransfer();
+ /**
+ * Singleton instance.
+ */
+ private static final EditorInputTransfer instance = new EditorInputTransfer();
- // Create a unique ID to make sure that different Eclipse
- // applications use different "types" of <code>EditorInputTransfer</code>
- private static final String TYPE_NAME = "editor-input-transfer-format:" + System.currentTimeMillis() + ":" + instance.hashCode(); //$NON-NLS-2$//$NON-NLS-1$
+ // Create a unique ID to make sure that different Eclipse
+ // applications use different "types" of <code>EditorInputTransfer</code>
+ private static final String TYPE_NAME = "editor-input-transfer-format:" + System.currentTimeMillis() + ":" //$NON-NLS-1$ //$NON-NLS-2$
+ + instance.hashCode();
- private static final int TYPEID = registerType(TYPE_NAME);
+ private static final int TYPEID = registerType(TYPE_NAME);
- public static class EditorInputData {
+ public static class EditorInputData {
- public String editorId;
+ public String editorId;
- public IEditorInput input;
+ public IEditorInput input;
- private EditorInputData(String editorId, IEditorInput input) {
- this.editorId = editorId;
- this.input = input;
- }
- }
-
- /**
- * Creates a new transfer object.
- */
- private EditorInputTransfer() {
- }
-
- /**
- * Returns the singleton instance.
- *
- * @return the singleton instance
- */
- public static EditorInputTransfer getInstance() {
- return instance;
- }
-
- @Override
+ private EditorInputData(String editorId, IEditorInput input) {
+ this.editorId = editorId;
+ this.input = input;
+ }
+ }
+
+ /**
+ * Creates a new transfer object.
+ */
+ private EditorInputTransfer() {
+ }
+
+ /**
+ * Returns the singleton instance.
+ *
+ * @return the singleton instance
+ */
+ public static EditorInputTransfer getInstance() {
+ return instance;
+ }
+
+ @Override
protected int[] getTypeIds() {
- return new int[] { TYPEID };
- }
+ return new int[] { TYPEID };
+ }
- @Override
+ @Override
protected String[] getTypeNames() {
- return new String[] { TYPE_NAME };
- }
+ return new String[] { TYPE_NAME };
+ }
- @Override
+ @Override
public void javaToNative(Object data, TransferData transferData) {
- if (!(data instanceof EditorInputData[])) {
- return;
- }
-
- EditorInputData[] editorInputs = (EditorInputData[]) data;
- /**
- * The editor input serialization format is:
- * (int) number of editor inputs
- * Then, the following for each editor input:
- * (String) editorId
- * (String) factoryId
- * (String) data used to recreate the IEditorInput
- */
-
- int editorInputCount = editorInputs.length;
-
- try {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- DataOutputStream dataOut = new DataOutputStream(out);
-
- //write the number of resources
- dataOut.writeInt(editorInputCount);
-
- //write each resource
- for (EditorInputData editorInput : editorInputs) {
- writeEditorInput(dataOut, editorInput);
- }
-
- //cleanup
- dataOut.close();
- out.close();
- byte[] bytes = out.toByteArray();
- super.javaToNative(bytes, transferData);
- } catch (IOException e) {
- }
- }
-
- @Override
+ if (!(data instanceof EditorInputData[])) {
+ return;
+ }
+
+ EditorInputData[] editorInputs = (EditorInputData[]) data;
+ /**
+ * The editor input serialization format is: (int) number of editor inputs Then,
+ * the following for each editor input: (String) editorId (String) factoryId
+ * (String) data used to recreate the IEditorInput
+ */
+
+ int editorInputCount = editorInputs.length;
+
+ try {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ DataOutputStream dataOut = new DataOutputStream(out);
+
+ // write the number of resources
+ dataOut.writeInt(editorInputCount);
+
+ // write each resource
+ for (EditorInputData editorInput : editorInputs) {
+ writeEditorInput(dataOut, editorInput);
+ }
+
+ // cleanup
+ dataOut.close();
+ out.close();
+ byte[] bytes = out.toByteArray();
+ super.javaToNative(bytes, transferData);
+ } catch (IOException e) {
+ }
+ }
+
+ @Override
public Object nativeToJava(TransferData transferData) {
- byte[] bytes = (byte[]) super.nativeToJava(transferData);
- if (bytes == null) {
+ byte[] bytes = (byte[]) super.nativeToJava(transferData);
+ if (bytes == null) {
+ return null;
+ }
+ DataInputStream in = new DataInputStream(new ByteArrayInputStream(bytes));
+ try {
+ int count = in.readInt();
+ EditorInputData[] results = new EditorInputData[count];
+ for (int i = 0; i < count; i++) {
+ results[i] = readEditorInput(in);
+ }
+ return results;
+ } catch (IOException e) {
+ return null;
+ } catch (WorkbenchException e) {
return null;
}
- DataInputStream in = new DataInputStream(
- new ByteArrayInputStream(bytes));
- try {
- int count = in.readInt();
- EditorInputData[] results = new EditorInputData[count];
- for (int i = 0; i < count; i++) {
- results[i] = readEditorInput(in);
- }
- return results;
- } catch (IOException e) {
- return null;
- } catch (WorkbenchException e) {
- return null;
- }
-
- }
-
- /**
- * Method readEditorInput.
- * @param in
- * @return EditorInputData
- */
- private EditorInputData readEditorInput(DataInputStream dataIn)
- throws IOException, WorkbenchException {
-
- String editorId = dataIn.readUTF();
- String factoryId = dataIn.readUTF();
- String xmlString = dataIn.readUTF();
-
- if (xmlString == null || xmlString.length() == 0) {
+
+ }
+
+ /**
+ * Method readEditorInput.
+ *
+ * @param in
+ * @return EditorInputData
+ */
+ private EditorInputData readEditorInput(DataInputStream dataIn) throws IOException, WorkbenchException {
+
+ String editorId = dataIn.readUTF();
+ String factoryId = dataIn.readUTF();
+ String xmlString = dataIn.readUTF();
+
+ if (xmlString == null || xmlString.length() == 0) {
return null;
}
- StringReader reader = new StringReader(xmlString);
-
- // Restore the editor input
- XMLMemento memento = XMLMemento.createReadRoot(reader);
-
- IElementFactory factory = PlatformUI.getWorkbench().getElementFactory(
- factoryId);
-
- if (factory != null) {
- IAdaptable adaptable = factory.createElement(memento);
- if (adaptable != null && (adaptable instanceof IEditorInput)) {
- return new EditorInputData(editorId, (IEditorInput) adaptable);
- }
- }
-
- return null;
- }
-
- /**
- * Method writeEditorInput.
- * @param dataOut
- * @param editorInputData
- */
- private void writeEditorInput(DataOutputStream dataOut,
- EditorInputData editorInputData) throws IOException {
- //write the id of the editor
- dataOut.writeUTF(editorInputData.editorId);
-
- //write the information needed to recreate the editor input
- if (editorInputData.input != null) {
- // Capture the editor information
- XMLMemento memento = XMLMemento.createWriteRoot("IEditorInput");//$NON-NLS-1$
-
- IPersistableElement element = editorInputData.input
- .getPersistable();
- if (element != null) {
- //get the IEditorInput to save its state
- element.saveState(memento);
-
- //convert memento to String
- StringWriter writer = new StringWriter();
- memento.save(writer);
- writer.close();
-
- //write the factor ID and state information
- dataOut.writeUTF(element.getFactoryId());
- dataOut.writeUTF(writer.toString());
- }
- }
- }
-
- public static EditorInputData createEditorInputData(String editorId,
- IEditorInput input) {
- return new EditorInputData(editorId, input);
- }
+ StringReader reader = new StringReader(xmlString);
+
+ // Restore the editor input
+ XMLMemento memento = XMLMemento.createReadRoot(reader);
+
+ IElementFactory factory = PlatformUI.getWorkbench().getElementFactory(factoryId);
+
+ if (factory != null) {
+ IAdaptable adaptable = factory.createElement(memento);
+ if (adaptable != null && (adaptable instanceof IEditorInput)) {
+ return new EditorInputData(editorId, (IEditorInput) adaptable);
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Method writeEditorInput.
+ *
+ * @param dataOut
+ * @param editorInputData
+ */
+ private void writeEditorInput(DataOutputStream dataOut, EditorInputData editorInputData) throws IOException {
+ // write the id of the editor
+ dataOut.writeUTF(editorInputData.editorId);
+
+ // write the information needed to recreate the editor input
+ if (editorInputData.input != null) {
+ // Capture the editor information
+ XMLMemento memento = XMLMemento.createWriteRoot("IEditorInput");//$NON-NLS-1$
+
+ IPersistableElement element = editorInputData.input.getPersistable();
+ if (element != null) {
+ // get the IEditorInput to save its state
+ element.saveState(memento);
+
+ // convert memento to String
+ StringWriter writer = new StringWriter();
+ memento.save(writer);
+ writer.close();
+
+ // write the factor ID and state information
+ dataOut.writeUTF(element.getFactoryId());
+ dataOut.writeUTF(writer.toString());
+ }
+ }
+ }
+
+ public static EditorInputData createEditorInputData(String editorId, IEditorInput input) {
+ return new EditorInputData(editorId, input);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/EditorPart.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/EditorPart.java
index 58b3f7edfd0..77dd834f462 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/EditorPart.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/EditorPart.java
@@ -78,233 +78,217 @@ import org.eclipse.ui.PartInitException;
*/
public abstract class EditorPart extends WorkbenchPart implements IEditorPart {
- /**
- * Editor input, or <code>null</code> if none.
- */
- private IEditorInput editorInput = null;
+ /**
+ * Editor input, or <code>null</code> if none.
+ */
+ private IEditorInput editorInput = null;
- /**
- * Listens to PROP_TITLE property changes in this object until the first call to
- * setContentDescription. Used for compatibility with old parts that call setTitle
- * or overload getTitle instead of using setContentDescription.
- */
- private IPropertyListener compatibilityTitleListener = (source, propId) -> {
- if (propId == IWorkbenchPartConstants.PROP_TITLE) {
- setDefaultPartName();
- }
+ /**
+ * Listens to PROP_TITLE property changes in this object until the first call to
+ * setContentDescription. Used for compatibility with old parts that call
+ * setTitle or overload getTitle instead of using setContentDescription.
+ */
+ private IPropertyListener compatibilityTitleListener = (source, propId) -> {
+ if (propId == IWorkbenchPartConstants.PROP_TITLE) {
+ setDefaultPartName();
+ }
};
- /**
- * Creates a new workbench editor.
- */
- protected EditorPart() {
- super();
+ /**
+ * Creates a new workbench editor.
+ */
+ protected EditorPart() {
+ super();
- addPropertyListener(compatibilityTitleListener);
- }
+ addPropertyListener(compatibilityTitleListener);
+ }
/*
- * Saves the contents of this editor.
- * <p>
- * Subclasses must override this method to implement the open-save-close
- * lifecycle for an editor. For greater details, see
- * <code>IEditorPart</code>
- * </p>
+ * Saves the contents of this editor. <p> Subclasses must override this method
+ * to implement the open-save-close lifecycle for an editor. For greater
+ * details, see <code>IEditorPart</code> </p>
*
* @see IEditorPart
*/
- @Override
+ @Override
public abstract void doSave(IProgressMonitor monitor);
/*
- * Saves the contents of this editor to another object.
- * <p>
- * Subclasses must override this method to implement the open-save-close
- * lifecycle for an editor. For greater details, see
- * <code>IEditorPart</code>
- * </p>
+ * Saves the contents of this editor to another object. <p> Subclasses must
+ * override this method to implement the open-save-close lifecycle for an
+ * editor. For greater details, see <code>IEditorPart</code> </p>
*
* @see IEditorPart
*/
- @Override
+ @Override
public abstract void doSaveAs();
- @Override
+ @Override
public IEditorInput getEditorInput() {
- return editorInput;
- }
+ return editorInput;
+ }
- @Override
+ @Override
public IEditorSite getEditorSite() {
- return (IEditorSite) getSite();
- }
+ return (IEditorSite) getSite();
+ }
- @Override
+ @Override
public String getTitleToolTip() {
- if (editorInput == null) {
+ if (editorInput == null) {
return super.getTitleToolTip();
}
return editorInput.getToolTipText();
- }
-
-
- /*
- * Initializes the editor part with a site and input.
- * <p>
- * Subclasses of <code>EditorPart</code> must implement this method. Within
- * the implementation subclasses should verify that the input type is acceptable
- * and then save the site and input. Here is sample code:
- * </p>
- * <pre>
- * if (!(input instanceof IFileEditorInput))
- * throw new PartInitException("Invalid Input: Must be IFileEditorInput");
- * setSite(site);
- * setInput(input);
- * </pre>
- */
- @Override
- public abstract void init(IEditorSite site, IEditorInput input)
- throws PartInitException;
+ }
+ /*
+ * Initializes the editor part with a site and input. <p> Subclasses of
+ * <code>EditorPart</code> must implement this method. Within the implementation
+ * subclasses should verify that the input type is acceptable and then save the
+ * site and input. Here is sample code: </p> <pre> if (!(input instanceof
+ * IFileEditorInput)) throw new
+ * PartInitException("Invalid Input: Must be IFileEditorInput"); setSite(site);
+ * setInput(input); </pre>
+ */
+ @Override
+ public abstract void init(IEditorSite site, IEditorInput input) throws PartInitException;
- /* Returns whether the contents of this editor have changed since the last save
- * operation.
- * <p>
- * Subclasses must override this method to implement the open-save-close lifecycle
- * for an editor. For greater details, see <code>IEditorPart</code>
- * </p>
- *
- * @see IEditorPart
- */
- @Override
+ /*
+ * Returns whether the contents of this editor have changed since the last save
+ * operation. <p> Subclasses must override this method to implement the
+ * open-save-close lifecycle for an editor. For greater details, see
+ * <code>IEditorPart</code> </p>
+ *
+ * @see IEditorPart
+ */
+ @Override
public abstract boolean isDirty();
-
- /*
- * Returns whether the "save as" operation is supported by this editor.
- * <p>
+ /*
+ * Returns whether the "save as" operation is supported by this editor. <p>
* Subclasses must override this method to implement the open-save-close
- * lifecycle for an editor. For greater details, see
- * <code>IEditorPart</code>
+ * lifecycle for an editor. For greater details, see <code>IEditorPart</code>
* </p>
*
* @see IEditorPart
*/
- @Override
+ @Override
public abstract boolean isSaveAsAllowed();
- /* Returns whether the contents of this editor should be saved when the editor
- * is closed.
- * <p>
- * This method returns <code>true</code> if and only if the editor is dirty
- * (<code>isDirty</code>).
- * </p>
- */
- @Override
+ /*
+ * Returns whether the contents of this editor should be saved when the editor
+ * is closed. <p> This method returns <code>true</code> if and only if the
+ * editor is dirty (<code>isDirty</code>). </p>
+ */
+ @Override
public boolean isSaveOnCloseNeeded() {
- return isDirty();
- }
+ return isDirty();
+ }
- /**
- * Sets the input to this editor. This method simply updates the internal
- * member variable.
- *
- * <p>Unlike most of the other set methods on this class, this method does
- * not fire a property change. Clients that call this method from a subclass
- * must ensure that they fire an IWorkbenchPartConstants.PROP_INPUT property
- * change after calling this method but before leaving whatever public method
- * they are in. Clients that expose this method as public API must fire
- * the property change within their implementation of setInput.</p>
- *
- * <p>Note that firing a property change may cause listeners to immediately
- * reach back and call methods on this editor. Care should be taken not to
- * fire the property change until the editor has fully updated its internal
- * state to reflect the new input.</p>
- *
- * @param input the editor input
- *
- * @see #setInputWithNotify(IEditorInput)
- */
- protected void setInput(IEditorInput input) {
- Assert.isLegal(input != null);
- editorInput = input;
- }
+ /**
+ * Sets the input to this editor. This method simply updates the internal member
+ * variable.
+ *
+ * <p>
+ * Unlike most of the other set methods on this class, this method does not fire
+ * a property change. Clients that call this method from a subclass must ensure
+ * that they fire an IWorkbenchPartConstants.PROP_INPUT property change after
+ * calling this method but before leaving whatever public method they are in.
+ * Clients that expose this method as public API must fire the property change
+ * within their implementation of setInput.
+ * </p>
+ *
+ * <p>
+ * Note that firing a property change may cause listeners to immediately reach
+ * back and call methods on this editor. Care should be taken not to fire the
+ * property change until the editor has fully updated its internal state to
+ * reflect the new input.
+ * </p>
+ *
+ * @param input the editor input
+ *
+ * @see #setInputWithNotify(IEditorInput)
+ */
+ protected void setInput(IEditorInput input) {
+ Assert.isLegal(input != null);
+ editorInput = input;
+ }
- /**
- * Sets the input to this editor and fires a PROP_INPUT property change if
- * the input has changed. This is the convenience method implementation.
- *
- * <p>Note that firing a property change may cause other objects to reach back
- * and invoke methods on the editor. Care should be taken not to call this method
- * until the editor has fully updated its internal state to reflect the
- * new input.</p>
- *
- * @since 3.2
- *
- * @param input the editor input
- */
- protected void setInputWithNotify(IEditorInput input) {
+ /**
+ * Sets the input to this editor and fires a PROP_INPUT property change if the
+ * input has changed. This is the convenience method implementation.
+ *
+ * <p>
+ * Note that firing a property change may cause other objects to reach back and
+ * invoke methods on the editor. Care should be taken not to call this method
+ * until the editor has fully updated its internal state to reflect the new
+ * input.
+ * </p>
+ *
+ * @since 3.2
+ *
+ * @param input the editor input
+ */
+ protected void setInputWithNotify(IEditorInput input) {
Assert.isLegal(input != null);
- editorInput = input;
- firePropertyChange(PROP_INPUT);
- }
+ editorInput = input;
+ firePropertyChange(PROP_INPUT);
+ }
- @Override
+ @Override
protected void setContentDescription(String description) {
- if (compatibilityTitleListener != null) {
- removePropertyListener(compatibilityTitleListener);
- compatibilityTitleListener = null;
- }
+ if (compatibilityTitleListener != null) {
+ removePropertyListener(compatibilityTitleListener);
+ compatibilityTitleListener = null;
+ }
- super.setContentDescription(description);
- }
+ super.setContentDescription(description);
+ }
- @Override
+ @Override
protected void setPartName(String partName) {
- if (compatibilityTitleListener != null) {
- removePropertyListener(compatibilityTitleListener);
- compatibilityTitleListener = null;
- }
-
- super.setPartName(partName);
- }
+ if (compatibilityTitleListener != null) {
+ removePropertyListener(compatibilityTitleListener);
+ compatibilityTitleListener = null;
+ }
- @Override
- public void setInitializationData(IConfigurationElement cfig,
- String propertyName, Object data) {
- super.setInitializationData(cfig, propertyName, data);
+ super.setPartName(partName);
+ }
- setDefaultPartName();
- }
+ @Override
+ public void setInitializationData(IConfigurationElement cfig, String propertyName, Object data) {
+ super.setInitializationData(cfig, propertyName, data);
+ setDefaultPartName();
+ }
- private void setDefaultPartName() {
- if (compatibilityTitleListener == null) {
- return;
- }
+ private void setDefaultPartName() {
+ if (compatibilityTitleListener == null) {
+ return;
+ }
- internalSetPartName(getTitle());
- }
+ internalSetPartName(getTitle());
+ }
- /**
- * Set the default title for the receiver.
- */
- @Override
+ /**
+ * Set the default title for the receiver.
+ */
+ @Override
void setDefaultTitle() {
- setTitle(getPartName());
- }
+ setTitle(getPartName());
+ }
- /**
- * Checks that the given site is valid for this type of part.
- * The site for an editor must be an <code>IEditorSite</code>.
- *
- * @param site the site to check
- * @since 3.1
- */
- @Override
+ /**
+ * Checks that the given site is valid for this type of part. The site for an
+ * editor must be an <code>IEditorSite</code>.
+ *
+ * @param site the site to check
+ * @since 3.1
+ */
+ @Override
protected final void checkSite(IWorkbenchPartSite site) {
- super.checkSite(site);
- Assert.isTrue(site instanceof IEditorSite, "The site for an editor must be an IEditorSite"); //$NON-NLS-1$
- }
+ super.checkSite(site);
+ Assert.isTrue(site instanceof IEditorSite, "The site for an editor must be an IEditorSite"); //$NON-NLS-1$
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IContributedContentsView.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IContributedContentsView.java
index c78146184e7..7350e9927fc 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IContributedContentsView.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IContributedContentsView.java
@@ -16,18 +16,16 @@ package org.eclipse.ui.part;
import org.eclipse.ui.IWorkbenchPart;
/**
- * This interface is used to identify workbench views which
- * allow other parts (typically the active part) to supply
- * their contents.
- * The interface allows access to the part which contributed the current
- * contents.
+ * This interface is used to identify workbench views which allow other parts
+ * (typically the active part) to supply their contents. The interface allows
+ * access to the part which contributed the current contents.
*/
public interface IContributedContentsView {
- /**
- * Returns the workbench part which contributed the
- * current contents of this view.
- *
- * @return the part which contributed the current contents
- */
- IWorkbenchPart getContributingPart();
+ /**
+ * Returns the workbench part which contributed the current contents of this
+ * view.
+ *
+ * @return the part which contributed the current contents
+ */
+ IWorkbenchPart getContributingPart();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IDropActionDelegate.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IDropActionDelegate.java
index 11a849a4df2..5a59bc39c76 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IDropActionDelegate.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IDropActionDelegate.java
@@ -18,11 +18,12 @@ package org.eclipse.ui.part;
* org.eclipse.ui.dropActions extension point.
*/
public interface IDropActionDelegate {
- /**
- * Runs the drop action on the given source and target.
- * @param source The object that is being dragged.
- * @param target The object that the drop is occurring over.
- * @return boolean True if the drop was successful, and false otherwise.
- */
- boolean run(Object source, Object target);
+ /**
+ * Runs the drop action on the given source and target.
+ *
+ * @param source The object that is being dragged.
+ * @param target The object that the drop is occurring over.
+ * @return boolean True if the drop was successful, and false otherwise.
+ */
+ boolean run(Object source, Object target);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IPage.java
index dc6188ab698..2555c5264c1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IPage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IPage.java
@@ -18,8 +18,8 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.IActionBars;
/**
- * This interface has been replaced by <code>IPageBookViewPage</code>
- * but is preserved for backward compatibility.
+ * This interface has been replaced by <code>IPageBookViewPage</code> but is
+ * preserved for backward compatibility.
* <p>
* This class is not intended to be directly implemented by clients; clients
* should instead subclass <code>Page</code>.
@@ -30,19 +30,18 @@ import org.eclipse.ui.IActionBars;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IPage {
- /**
- * Creates the SWT control for this page under the given parent
- * control.
- * <p>
- * Clients should not call this method (the workbench calls this method when
- * it needs to, which may be never).
- * </p>
- *
- * @param parent the parent control
- */
- void createControl(Composite parent);
+ /**
+ * Creates the SWT control for this page under the given parent control.
+ * <p>
+ * Clients should not call this method (the workbench calls this method when it
+ * needs to, which may be never).
+ * </p>
+ *
+ * @param parent the parent control
+ */
+ void createControl(Composite parent);
- /**
+ /**
* Disposes of this page.
* <p>
* This is the last method called on the <code>IPage</code>. Implementors should
@@ -59,30 +58,30 @@ public interface IPage {
* control may never have been created.
* </p>
*/
- void dispose();
+ void dispose();
- /**
- * Returns the SWT control for this page.
- *
- * @return the SWT control for this page, or <code>null</code> if this
- * page does not have a control
- */
- Control getControl();
+ /**
+ * Returns the SWT control for this page.
+ *
+ * @return the SWT control for this page, or <code>null</code> if this page does
+ * not have a control
+ */
+ Control getControl();
- /**
- * Allows the page to make contributions to the given action bars.
- * The contributions will be visible when the page is visible.
- * <p>
- * This method is automatically called shortly after
- * <code>createControl</code> is called
- * </p>
- *
- * @param actionBars the action bars for this page
- */
- void setActionBars(IActionBars actionBars);
+ /**
+ * Allows the page to make contributions to the given action bars. The
+ * contributions will be visible when the page is visible.
+ * <p>
+ * This method is automatically called shortly after <code>createControl</code>
+ * is called
+ * </p>
+ *
+ * @param actionBars the action bars for this page
+ */
+ void setActionBars(IActionBars actionBars);
- /**
- * Asks this page to take focus within its pagebook view.
- */
- void setFocus();
+ /**
+ * Asks this page to take focus within its pagebook view.
+ */
+ void setFocus();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IPageBookViewPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IPageBookViewPage.java
index 10ca8a130e6..c6e6a7eeb5a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IPageBookViewPage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IPageBookViewPage.java
@@ -20,28 +20,29 @@ import org.eclipse.ui.PartInitException;
* <p>
* Pages should implement this interface.
* </p>
+ *
* @see PageBookView
* @see Page
*/
public interface IPageBookViewPage extends IPage {
- /**
- * Returns the site for this page. May be <code>null</code>
- * if no site has been set.
- *
- * @return the page site or <code>null</code>
- */
- IPageSite getSite();
+ /**
+ * Returns the site for this page. May be <code>null</code> if no site has been
+ * set.
+ *
+ * @return the page site or <code>null</code>
+ */
+ IPageSite getSite();
- /**
- * Initializes this page with the given page site.
- * <p>
- * This method is automatically called by the workbench shortly after page
- * construction. It marks the start of the pages's lifecycle. Clients must
- * not call this method.
- * </p>
- *
- * @param site the page site
- * @exception PartInitException if this page was not initialized successfully
- */
- void init(IPageSite site) throws PartInitException;
+ /**
+ * Initializes this page with the given page site.
+ * <p>
+ * This method is automatically called by the workbench shortly after page
+ * construction. It marks the start of the pages's lifecycle. Clients must not
+ * call this method.
+ * </p>
+ *
+ * @param site the page site
+ * @exception PartInitException if this page was not initialized successfully
+ */
+ void init(IPageSite site) throws PartInitException;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IPageSite.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IPageSite.java
index 506957d7991..b6a66fbaab2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IPageSite.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IPageSite.java
@@ -24,43 +24,43 @@ import org.eclipse.ui.IWorkbenchSite;
* The workbench exposes its implemention of page sites via this interface,
* which is not intended to be implemented or extended by clients.
* </p>
+ *
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IPageSite extends IWorkbenchSite {
- /**
- * Registers a pop-up menu with a particular id for extension.
- * <p>
- * Within the workbench one plug-in may extend the pop-up menus for a view
- * or editor within another plug-in. In order to be eligible for extension,
- * the menu must be registered by calling <code>registerContextMenu</code>.
- * Once this has been done the workbench will automatically insert any action
- * extensions which exist.
- * </p>
- * <p>
- * A unique menu id must be provided for each registered menu. This id should
- * be published in the Javadoc for the page.
- * </p>
- * <p>
- * Any pop-up menu which is registered with the workbench should also define a
- * <code>GroupMarker</code> in the registered menu with id
- * <code>IWorkbenchActionConstants.MB_ADDITIONS</code>. Other plug-ins will use this
- * group as a reference point for insertion. The marker should be defined at an
- * appropriate location within the menu for insertion.
- * </p>
- *
- * @param menuId the menu id
- * @param menuManager the menu manager
- * @param selectionProvider the selection provider
- */
- void registerContextMenu(String menuId, MenuManager menuManager,
- ISelectionProvider selectionProvider);
+ /**
+ * Registers a pop-up menu with a particular id for extension.
+ * <p>
+ * Within the workbench one plug-in may extend the pop-up menus for a view or
+ * editor within another plug-in. In order to be eligible for extension, the
+ * menu must be registered by calling <code>registerContextMenu</code>. Once
+ * this has been done the workbench will automatically insert any action
+ * extensions which exist.
+ * </p>
+ * <p>
+ * A unique menu id must be provided for each registered menu. This id should be
+ * published in the Javadoc for the page.
+ * </p>
+ * <p>
+ * Any pop-up menu which is registered with the workbench should also define a
+ * <code>GroupMarker</code> in the registered menu with id
+ * <code>IWorkbenchActionConstants.MB_ADDITIONS</code>. Other plug-ins will use
+ * this group as a reference point for insertion. The marker should be defined
+ * at an appropriate location within the menu for insertion.
+ * </p>
+ *
+ * @param menuId the menu id
+ * @param menuManager the menu manager
+ * @param selectionProvider the selection provider
+ */
+ void registerContextMenu(String menuId, MenuManager menuManager, ISelectionProvider selectionProvider);
- /**
- * Returns the action bars for this page site.
- * Pages have exclusive use of their site's action bars.
- *
- * @return the action bars
- */
- IActionBars getActionBars();
+ /**
+ * Returns the action bars for this page site. Pages have exclusive use of their
+ * site's action bars.
+ *
+ * @return the action bars
+ */
+ IActionBars getActionBars();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/ISetSelectionTarget.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/ISetSelectionTarget.java
index 2cdc1e4d1ce..35d2d81d47b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/ISetSelectionTarget.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/ISetSelectionTarget.java
@@ -27,10 +27,10 @@ import org.eclipse.jface.viewers.ISelection;
* @see org.eclipse.ui.part.ViewPart
*/
public interface ISetSelectionTarget {
- /**
- * Reveals and selects the given element within this target view.
- *
- * @param selection the new element to select
- */
- void selectReveal(ISelection selection);
+ /**
+ * Reveals and selects the given element within this target view.
+ *
+ * @param selection the new element to select
+ */
+ void selectReveal(ISelection selection);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IShowInSource.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IShowInSource.java
index a288a993d7a..cef1437b09c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IShowInSource.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IShowInSource.java
@@ -15,10 +15,10 @@
package org.eclipse.ui.part;
/**
- * Parts which need to provide a particular context to a Show In...
- * target can provide this interface.
- * The part can either directly implement this interface, or provide it
- * via <code>IAdaptable.getAdapter(IShowInSource.class)</code>.
+ * Parts which need to provide a particular context to a Show In... target can
+ * provide this interface. The part can either directly implement this
+ * interface, or provide it via
+ * <code>IAdaptable.getAdapter(IShowInSource.class)</code>.
*
* @see IShowInTarget
*
@@ -26,11 +26,11 @@ package org.eclipse.ui.part;
*/
public interface IShowInSource {
- /**
- * Returns the context to show, or <code>null</code> if there is
- * currently no valid context to show.
- *
- * @return the context to show, or <code>null</code>
- */
- ShowInContext getShowInContext();
+ /**
+ * Returns the context to show, or <code>null</code> if there is currently no
+ * valid context to show.
+ *
+ * @return the context to show, or <code>null</code>
+ */
+ ShowInContext getShowInContext();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IShowInTarget.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IShowInTarget.java
index 6ee17c97371..4a43cce4354 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IShowInTarget.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IShowInTarget.java
@@ -15,10 +15,9 @@
package org.eclipse.ui.part;
/**
- * This interface must be provided by Show In targets (parts listed
- * in the Show In prompter).
- * The part can either directly implement this interface, or provide it
- * via <code>IAdaptable.getAdapter(IShowInTarget.class)</code>.
+ * This interface must be provided by Show In targets (parts listed in the Show
+ * In prompter). The part can either directly implement this interface, or
+ * provide it via <code>IAdaptable.getAdapter(IShowInTarget.class)</code>.
*
* @see org.eclipse.ui.IPageLayout#addShowInPart
*
@@ -26,15 +25,14 @@ package org.eclipse.ui.part;
*/
public interface IShowInTarget {
- /**
- * Shows the given context in this target.
- * The target should check the context's selection for elements
- * to show. If there are no relevant elements in the selection,
- * then it should check the context's input.
- *
- * @param context the context to show
- * @return <code>true</code> if the context could be shown,
- * <code>false</code> otherwise
- */
- boolean show(ShowInContext context);
+ /**
+ * Shows the given context in this target. The target should check the context's
+ * selection for elements to show. If there are no relevant elements in the
+ * selection, then it should check the context's input.
+ *
+ * @param context the context to show
+ * @return <code>true</code> if the context could be shown, <code>false</code>
+ * otherwise
+ */
+ boolean show(ShowInContext context);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IShowInTargetList.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IShowInTargetList.java
index d822f89cb4d..f2884565e81 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IShowInTargetList.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IShowInTargetList.java
@@ -15,10 +15,10 @@
package org.eclipse.ui.part;
/**
- * Show In sources which need to provide additional entries to the Show In list of targets
- * can provide this interface.
- * The part can either directly implement this interface, or provide it
- * via <code>IAdaptable.getAdapter(IShowInTargetList)</code>.
+ * Show In sources which need to provide additional entries to the Show In list
+ * of targets can provide this interface. The part can either directly implement
+ * this interface, or provide it via
+ * <code>IAdaptable.getAdapter(IShowInTargetList)</code>.
*
* @see IShowInSource
* @see IShowInTarget
@@ -27,13 +27,13 @@ package org.eclipse.ui.part;
*/
public interface IShowInTargetList {
- /**
- * Returns the identifiers for the target parts to show.
- * The target parts must be Show In targets.
- *
- * @return the identifiers for the target parts to show
- *
- * @see IShowInTarget
- */
- String[] getShowInTargetIds();
+ /**
+ * Returns the identifiers for the target parts to show. The target parts must
+ * be Show In targets.
+ *
+ * @return the identifiers for the target parts to show
+ *
+ * @see IShowInTarget
+ */
+ String[] getShowInTargetIds();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IntroPart.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IntroPart.java
index 682e84f0233..361b036ea1e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IntroPart.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IntroPart.java
@@ -60,129 +60,125 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
*
* @since 3.0
*/
-public abstract class IntroPart extends EventManager implements IIntroPart,
- IExecutableExtension {
+public abstract class IntroPart extends EventManager implements IIntroPart, IExecutableExtension {
- private IConfigurationElement configElement;
+ private IConfigurationElement configElement;
- private ImageDescriptor imageDescriptor;
+ private ImageDescriptor imageDescriptor;
- private IIntroSite partSite;
+ private IIntroSite partSite;
- private Image titleImage;
+ private Image titleImage;
private String titleLabel;
- /**
- * Creates a new intro part.
- */
- protected IntroPart() {
- super();
- }
+ /**
+ * Creates a new intro part.
+ */
+ protected IntroPart() {
+ super();
+ }
- @Override
+ @Override
public void addPropertyListener(IPropertyListener l) {
- addListenerObject(l);
- }
+ addListenerObject(l);
+ }
- @Override
+ @Override
public abstract void createPartControl(Composite parent);
- /**
- * The <code>IntroPart</code> implementation of this
- * <code>IIntroPart</code> method disposes the title image loaded by
- * <code>setInitializationData</code>. Subclasses may extend.
- */
- @Override
+ /**
+ * The <code>IntroPart</code> implementation of this <code>IIntroPart</code>
+ * method disposes the title image loaded by <code>setInitializationData</code>.
+ * Subclasses may extend.
+ */
+ @Override
public void dispose() {
- if (titleImage != null) {
- JFaceResources.getResources().destroyImage(imageDescriptor);
- titleImage = null;
- }
-
- // Clear out the property change listeners as we
- // should not be notifying anyone after the part
- // has been disposed.
- clearListeners();
- }
-
- /**
- * Fires a property changed event.
- *
- * @param propertyId
- * the id of the property that changed
- */
- protected void firePropertyChange(final int propertyId) {
+ if (titleImage != null) {
+ JFaceResources.getResources().destroyImage(imageDescriptor);
+ titleImage = null;
+ }
+
+ // Clear out the property change listeners as we
+ // should not be notifying anyone after the part
+ // has been disposed.
+ clearListeners();
+ }
+
+ /**
+ * Fires a property changed event.
+ *
+ * @param propertyId the id of the property that changed
+ */
+ protected void firePropertyChange(final int propertyId) {
for (Object listener : getListeners()) {
final IPropertyListener propertyListener = (IPropertyListener) listener;
- SafeRunner.run(new SafeRunnable() {
+ SafeRunner.run(new SafeRunnable() {
- @Override
+ @Override
public void run() {
propertyListener.propertyChanged(this, propertyId);
- }
- });
- }
- }
-
- /**
- * This implementation of the method declared by <code>IAdaptable</code>
- * passes the request along to the platform's adapter manager; roughly
- * <code>Platform.getAdapterManager().getAdapter(this, adapter)</code>.
- * Subclasses may override this method (however, if they do so, they should
- * invoke the method on their superclass to ensure that the Platform's
- * adapter manager is consulted).
- */
- @Override
+ }
+ });
+ }
+ }
+
+ /**
+ * This implementation of the method declared by <code>IAdaptable</code> passes
+ * the request along to the platform's adapter manager; roughly
+ * <code>Platform.getAdapterManager().getAdapter(this, adapter)</code>.
+ * Subclasses may override this method (however, if they do so, they should
+ * invoke the method on their superclass to ensure that the Platform's adapter
+ * manager is consulted).
+ */
+ @Override
public <T> T getAdapter(Class<T> adapter) {
- return Platform.getAdapterManager().getAdapter(this, adapter);
- }
-
- /**
- * Returns the configuration element for this part. The configuration
- * element comes from the plug-in registry entry for the extension defining
- * this part.
- *
- * @return the configuration element for this part
- */
- protected IConfigurationElement getConfigurationElement() {
- return configElement;
- }
-
- /**
- * Returns the default title image.
- *
- * @return the default image
- */
- protected Image getDefaultImage() {
- return PlatformUI.getWorkbench().getSharedImages().getImage(
- ISharedImages.IMG_DEF_VIEW);
- }
-
- @Override
+ return Platform.getAdapterManager().getAdapter(this, adapter);
+ }
+
+ /**
+ * Returns the configuration element for this part. The configuration element
+ * comes from the plug-in registry entry for the extension defining this part.
+ *
+ * @return the configuration element for this part
+ */
+ protected IConfigurationElement getConfigurationElement() {
+ return configElement;
+ }
+
+ /**
+ * Returns the default title image.
+ *
+ * @return the default image
+ */
+ protected Image getDefaultImage() {
+ return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_DEF_VIEW);
+ }
+
+ @Override
public final IIntroSite getIntroSite() {
- return partSite;
- }
+ return partSite;
+ }
- @Override
+ @Override
public Image getTitleImage() {
- if (titleImage != null) {
- return titleImage;
- }
- return getDefaultImage();
- }
+ if (titleImage != null) {
+ return titleImage;
+ }
+ return getDefaultImage();
+ }
- @Override
+ @Override
public String getTitle() {
- if (titleLabel != null) {
- return titleLabel;
- }
- return getDefaultTitle();
- }
-
- /**
- * Return the default title string.
- *
+ if (titleLabel != null) {
+ return titleLabel;
+ }
+ return getDefaultTitle();
+ }
+
+ /**
+ * Return the default title string.
+ *
* @return the default title string
*/
private String getDefaultTitle() {
@@ -190,119 +186,112 @@ public abstract class IntroPart extends EventManager implements IIntroPart,
}
/**
- * The base implementation of this {@link org.eclipse.ui.intro.IIntroPart}method ignores the
- * memento and initializes the part in a fresh state. Subclasses may extend
- * to perform any state restoration, but must call the super method.
- *
- * @param site
- * the intro site
- * @param memento
- * the intro part state or <code>null</code> if there is no
- * previous saved state
- * @exception PartInitException
- * if this part was not initialized successfully
- */
- @Override
- public void init(IIntroSite site, IMemento memento)
- throws PartInitException {
- setSite(site);
- }
-
- /**
- * Sets the part site.
- * <p>
- * Subclasses must invoke this method from {@link org.eclipse.ui.intro.IIntroPart#init(IIntroSite, IMemento)}.
- * </p>
- *
- * @param site the intro part site
- */
- protected void setSite(IIntroSite site) {
- this.partSite = site;
- }
-
- @Override
+ * The base implementation of this {@link org.eclipse.ui.intro.IIntroPart}method
+ * ignores the memento and initializes the part in a fresh state. Subclasses may
+ * extend to perform any state restoration, but must call the super method.
+ *
+ * @param site the intro site
+ * @param memento the intro part state or <code>null</code> if there is no
+ * previous saved state
+ * @exception PartInitException if this part was not initialized successfully
+ */
+ @Override
+ public void init(IIntroSite site, IMemento memento) throws PartInitException {
+ setSite(site);
+ }
+
+ /**
+ * Sets the part site.
+ * <p>
+ * Subclasses must invoke this method from
+ * {@link org.eclipse.ui.intro.IIntroPart#init(IIntroSite, IMemento)}.
+ * </p>
+ *
+ * @param site the intro part site
+ */
+ protected void setSite(IIntroSite site) {
+ this.partSite = site;
+ }
+
+ @Override
public void removePropertyListener(IPropertyListener l) {
- removeListenerObject(l);
- }
-
- /**
- * The base implementation of this {@link org.eclipse.ui.intro.IIntroPart} method does nothing.
- * Subclasses may override.
- *
- * @param memento
- * a memento to receive the object state
- */
- @Override
+ removeListenerObject(l);
+ }
+
+ /**
+ * The base implementation of this {@link org.eclipse.ui.intro.IIntroPart}
+ * method does nothing. Subclasses may override.
+ *
+ * @param memento a memento to receive the object state
+ */
+ @Override
public void saveState(IMemento memento) {
- //no-op
- }
+ // no-op
+ }
- @Override
+ @Override
public abstract void setFocus();
- /**
- * The <code>IntroPart</code> implementation of this
- * <code>IExecutableExtension</code> records the configuration element in
- * and internal state variable (accessible via <code>getConfigElement</code>).
- * It also loads the title image, if one is specified in the configuration
- * element. Subclasses may extend.
- *
- * Should not be called by clients. It is called by the core plugin when
- * creating this executable extension.
- */
- @Override
- public void setInitializationData(IConfigurationElement cfig,
- String propertyName, Object data) {
-
- // Save config element.
- configElement = cfig;
-
- titleLabel = cfig.getAttribute(IWorkbenchRegistryConstants.ATT_LABEL);
-
- // Icon.
- String strIcon = cfig.getAttribute(IWorkbenchRegistryConstants.ATT_ICON);
- if (strIcon == null) {
+ /**
+ * The <code>IntroPart</code> implementation of this
+ * <code>IExecutableExtension</code> records the configuration element in and
+ * internal state variable (accessible via <code>getConfigElement</code>). It
+ * also loads the title image, if one is specified in the configuration element.
+ * Subclasses may extend.
+ *
+ * Should not be called by clients. It is called by the core plugin when
+ * creating this executable extension.
+ */
+ @Override
+ public void setInitializationData(IConfigurationElement cfig, String propertyName, Object data) {
+
+ // Save config element.
+ configElement = cfig;
+
+ titleLabel = cfig.getAttribute(IWorkbenchRegistryConstants.ATT_LABEL);
+
+ // Icon.
+ String strIcon = cfig.getAttribute(IWorkbenchRegistryConstants.ATT_ICON);
+ if (strIcon == null) {
return;
}
- imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(
- configElement.getContributor().getName(), strIcon);
+ imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(configElement.getContributor().getName(), strIcon);
- if (imageDescriptor == null) {
+ if (imageDescriptor == null) {
return;
}
- Image image = JFaceResources.getResources().createImageWithDefault(imageDescriptor);
- titleImage = image;
- }
-
- /**
- * Sets or clears the title image of this part.
- *
- * @param titleImage
- * the title image, or <code>null</code> to clear
- */
- protected void setTitleImage(Image titleImage) {
- Assert.isTrue(titleImage == null || !titleImage.isDisposed());
- //Do not send changes if they are the same
- if (this.titleImage == titleImage) {
+ Image image = JFaceResources.getResources().createImageWithDefault(imageDescriptor);
+ titleImage = image;
+ }
+
+ /**
+ * Sets or clears the title image of this part.
+ *
+ * @param titleImage the title image, or <code>null</code> to clear
+ */
+ protected void setTitleImage(Image titleImage) {
+ Assert.isTrue(titleImage == null || !titleImage.isDisposed());
+ // Do not send changes if they are the same
+ if (this.titleImage == titleImage) {
return;
}
- this.titleImage = titleImage;
- firePropertyChange(IIntroPart.PROP_TITLE);
- }
-
- /**
- * Set the title string for this part.
- *
- * @param titleLabel the title string. Must not be <code>null</code>.
- * @since 3.2
- */
- protected void setTitle(String titleLabel) {
- Assert.isNotNull(titleLabel);
- if (Util.equals(this.titleLabel, titleLabel))
- return;
- this.titleLabel = titleLabel;
- firePropertyChange(IIntroPart.PROP_TITLE);
- }
+ this.titleImage = titleImage;
+ firePropertyChange(IIntroPart.PROP_TITLE);
+ }
+
+ /**
+ * Set the title string for this part.
+ *
+ * @param titleLabel the title string. Must not be <code>null</code>.
+ * @since 3.2
+ */
+ protected void setTitle(String titleLabel) {
+ Assert.isNotNull(titleLabel);
+ if (Util.equals(this.titleLabel, titleLabel))
+ return;
+ this.titleLabel = titleLabel;
+ firePropertyChange(IIntroPart.PROP_TITLE);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MessagePage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MessagePage.java
index a38babf222e..8af85310013 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MessagePage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MessagePage.java
@@ -29,57 +29,57 @@ import org.eclipse.swt.widgets.Label;
* @noextend This class is not intended to be subclassed by clients.
*/
public class MessagePage extends Page {
- private Composite pgComp;
+ private Composite pgComp;
- private Label msgLabel;
+ private Label msgLabel;
- private String message = "";//$NON-NLS-1$
+ private String message = "";//$NON-NLS-1$
- /**
- * Creates a new page. The message is the empty string.
- */
- public MessagePage() {
- // do nothing
- }
+ /**
+ * Creates a new page. The message is the empty string.
+ */
+ public MessagePage() {
+ // do nothing
+ }
- @Override
+ @Override
public void createControl(Composite parent) {
- // Message in default page of Outline should have margins
- pgComp = new Composite(parent, SWT.NULL);
- FillLayout layout = new FillLayout();
- layout.marginHeight = 5;
- layout.marginWidth = 5;
- pgComp.setLayout(layout);
+ // Message in default page of Outline should have margins
+ pgComp = new Composite(parent, SWT.NULL);
+ FillLayout layout = new FillLayout();
+ layout.marginHeight = 5;
+ layout.marginWidth = 5;
+ pgComp.setLayout(layout);
- msgLabel = new Label(pgComp, SWT.LEFT | SWT.TOP | SWT.WRAP);
- msgLabel.setText(message);
- }
+ msgLabel = new Label(pgComp, SWT.LEFT | SWT.TOP | SWT.WRAP);
+ msgLabel.setText(message);
+ }
- @Override
+ @Override
public Control getControl() {
- return pgComp;
- }
+ return pgComp;
+ }
- /**
- * Sets focus to a part in the page.
- */
- @Override
+ /**
+ * Sets focus to a part in the page.
+ */
+ @Override
public void setFocus() {
- // important to give focus to the composite rather than the label
- // as the composite will actually take focus (though hidden),
- // but setFocus on a Label is a no-op
- pgComp.setFocus();
- }
+ // important to give focus to the composite rather than the label
+ // as the composite will actually take focus (though hidden),
+ // but setFocus on a Label is a no-op
+ pgComp.setFocus();
+ }
- /**
- * Sets the message to the given string.
- *
- * @param message the message text
- */
- public void setMessage(String message) {
- this.message = message;
- if (msgLabel != null) {
+ /**
+ * Sets the message to the given string.
+ *
+ * @param message the message text
+ */
+ public void setMessage(String message) {
+ this.message = message;
+ if (msgLabel != null) {
msgLabel.setText(message);
}
- }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiEditor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiEditor.java
index 4a415656737..553f1e13f00 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiEditor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiEditor.java
@@ -35,60 +35,50 @@ import org.eclipse.ui.themes.ITheme;
public abstract class MultiEditor extends AbstractMultiEditor {
/**
- * The colors used to draw the title bar of the inner editors
- */
- public static class Gradient {
- public Color fgColor;
+ * The colors used to draw the title bar of the inner editors
+ */
+ public static class Gradient {
+ public Color fgColor;
- public Color[] bgColors;
+ public Color[] bgColors;
- public int[] bgPercents;
- }
+ public int[] bgPercents;
+ }
/**
* Updates the gradient in the title bar.
+ *
* @param editor
*/
public void updateGradient(IEditorPart editor) {
- boolean activeEditor = editor == getSite().getPage().getActiveEditor();
- boolean activePart = editor == getSite().getPage().getActivePart();
-
- ITheme theme = editor.getEditorSite().getWorkbenchWindow()
- .getWorkbench().getThemeManager().getCurrentTheme();
- Gradient g = new Gradient();
-
- ColorRegistry colorRegistry = theme.getColorRegistry();
- if (activePart) {
- g.fgColor = colorRegistry
- .get(IWorkbenchThemeConstants.ACTIVE_TAB_TEXT_COLOR);
- g.bgColors = new Color[2];
- g.bgColors[0] = colorRegistry
- .get(IWorkbenchThemeConstants.ACTIVE_TAB_BG_START);
- g.bgColors[1] = colorRegistry
- .get(IWorkbenchThemeConstants.ACTIVE_TAB_BG_END);
- } else {
- if (activeEditor) {
- g.fgColor = colorRegistry
- .get(IWorkbenchThemeConstants.ACTIVE_TAB_TEXT_COLOR);
- g.bgColors = new Color[2];
- g.bgColors[0] = colorRegistry
- .get(IWorkbenchThemeConstants.ACTIVE_TAB_BG_START);
- g.bgColors[1] = colorRegistry
- .get(IWorkbenchThemeConstants.ACTIVE_TAB_BG_END);
- } else {
- g.fgColor = colorRegistry
- .get(IWorkbenchThemeConstants.INACTIVE_TAB_TEXT_COLOR);
- g.bgColors = new Color[2];
- g.bgColors[0] = colorRegistry
- .get(IWorkbenchThemeConstants.INACTIVE_TAB_BG_START);
- g.bgColors[1] = colorRegistry
- .get(IWorkbenchThemeConstants.INACTIVE_TAB_BG_END);
- }
- }
- g.bgPercents = new int[] { theme
- .getInt(IWorkbenchThemeConstants.ACTIVE_TAB_PERCENT) };
-
- drawGradient(editor, g);
+ boolean activeEditor = editor == getSite().getPage().getActiveEditor();
+ boolean activePart = editor == getSite().getPage().getActivePart();
+
+ ITheme theme = editor.getEditorSite().getWorkbenchWindow().getWorkbench().getThemeManager().getCurrentTheme();
+ Gradient g = new Gradient();
+
+ ColorRegistry colorRegistry = theme.getColorRegistry();
+ if (activePart) {
+ g.fgColor = colorRegistry.get(IWorkbenchThemeConstants.ACTIVE_TAB_TEXT_COLOR);
+ g.bgColors = new Color[2];
+ g.bgColors[0] = colorRegistry.get(IWorkbenchThemeConstants.ACTIVE_TAB_BG_START);
+ g.bgColors[1] = colorRegistry.get(IWorkbenchThemeConstants.ACTIVE_TAB_BG_END);
+ } else {
+ if (activeEditor) {
+ g.fgColor = colorRegistry.get(IWorkbenchThemeConstants.ACTIVE_TAB_TEXT_COLOR);
+ g.bgColors = new Color[2];
+ g.bgColors[0] = colorRegistry.get(IWorkbenchThemeConstants.ACTIVE_TAB_BG_START);
+ g.bgColors[1] = colorRegistry.get(IWorkbenchThemeConstants.ACTIVE_TAB_BG_END);
+ } else {
+ g.fgColor = colorRegistry.get(IWorkbenchThemeConstants.INACTIVE_TAB_TEXT_COLOR);
+ g.bgColors = new Color[2];
+ g.bgColors[0] = colorRegistry.get(IWorkbenchThemeConstants.INACTIVE_TAB_BG_START);
+ g.bgColors[1] = colorRegistry.get(IWorkbenchThemeConstants.INACTIVE_TAB_BG_END);
+ }
+ }
+ g.bgPercents = new int[] { theme.getInt(IWorkbenchThemeConstants.ACTIVE_TAB_PERCENT) };
+
+ drawGradient(editor, g);
}
/**
@@ -96,58 +86,55 @@ public abstract class MultiEditor extends AbstractMultiEditor {
*/
protected abstract void drawGradient(IEditorPart innerEditor, Gradient g);
- /**
- * Create the control of the inner editor.
- *
- * Must be called by subclass.
- */
- public Composite createInnerPartControl(Composite parent,
- final IEditorPart e) {
- Composite content = new Composite(parent, SWT.NONE);
- content.setLayout(new FillLayout());
- e.createPartControl(content);
- parent.addListener(SWT.Activate, event -> {
- if (event.type == SWT.Activate) {
+ /**
+ * Create the control of the inner editor.
+ *
+ * Must be called by subclass.
+ */
+ public Composite createInnerPartControl(Composite parent, final IEditorPart e) {
+ Composite content = new Composite(parent, SWT.NONE);
+ content.setLayout(new FillLayout());
+ e.createPartControl(content);
+ parent.addListener(SWT.Activate, event -> {
+ if (event.type == SWT.Activate) {
activateEditor(e);
}
});
- return content;
- }
+ return content;
+ }
- /*
- * @see IWorkbenchPart#setFocus()
- */
- @Override
+ /*
+ * @see IWorkbenchPart#setFocus()
+ */
+ @Override
public void setFocus() {
- super.setFocus();
- updateGradient(getActiveEditor());
- }
-
- /**
- * Activates the given nested editor.
- *
- * @param part the nested editor
- * @since 3.5
- */
- @Override
+ super.setFocus();
+ updateGradient(getActiveEditor());
+ }
+
+ /**
+ * Activates the given nested editor.
+ *
+ * @param part the nested editor
+ * @since 3.5
+ */
+ @Override
public void activateEditor(IEditorPart part) {
- IEditorPart oldEditor = getActiveEditor();
- super.activateEditor(part);
- updateGradient(oldEditor);
- }
-
- /**
- * Return true if the shell is activated.
- */
- protected boolean getShellActivated() {
- WorkbenchWindow window = (WorkbenchWindow) getSite().getPage()
- .getWorkbenchWindow();
- return window.getShellActivated();
- }
+ IEditorPart oldEditor = getActiveEditor();
+ super.activateEditor(part);
+ updateGradient(oldEditor);
+ }
+
+ /**
+ * Return true if the shell is activated.
+ */
+ protected boolean getShellActivated() {
+ WorkbenchWindow window = (WorkbenchWindow) getSite().getPage().getWorkbenchWindow();
+ return window.getShellActivated();
+ }
@Override
- public Composite getInnerEditorContainer(
- IEditorReference innerEditorReference) {
+ public Composite getInnerEditorContainer(IEditorReference innerEditorReference) {
// This method is not used by MutliEditor
return null;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiEditorInput.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiEditorInput.java
index 9f6c1758f72..9d67878f3f9 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiEditorInput.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiEditorInput.java
@@ -22,55 +22,56 @@ import org.eclipse.ui.IPersistableElement;
/**
* Implements an input for a <code>AbstractMultiEditor</code>.
*
- * This class is intended to be instantiated by clients but is
- * not intended to be subclassed.
+ * This class is intended to be instantiated by clients but is not intended to
+ * be subclassed.
+ *
* @noextend This class is not intended to be subclassed by clients.
*/
public class MultiEditorInput implements IEditorInput {
- IEditorInput input[];
+ IEditorInput input[];
- String editors[];
+ String editors[];
- /**
- * Constructs a new MultiEditorInput.
- */
- public MultiEditorInput(String[] editorIDs, IEditorInput[] innerEditors) {
- Assert.isNotNull(editorIDs);
- Assert.isNotNull(innerEditors);
- editors = editorIDs;
- input = innerEditors;
- }
+ /**
+ * Constructs a new MultiEditorInput.
+ */
+ public MultiEditorInput(String[] editorIDs, IEditorInput[] innerEditors) {
+ Assert.isNotNull(editorIDs);
+ Assert.isNotNull(innerEditors);
+ editors = editorIDs;
+ input = innerEditors;
+ }
- /**
- * Returns an array with the input of all inner editors.
- */
- public IEditorInput[] getInput() {
- return input;
- }
+ /**
+ * Returns an array with the input of all inner editors.
+ */
+ public IEditorInput[] getInput() {
+ return input;
+ }
- /**
- * Retunrs an array with the id of all inner editors.
- */
- public String[] getEditors() {
- return editors;
- }
+ /**
+ * Retunrs an array with the id of all inner editors.
+ */
+ public String[] getEditors() {
+ return editors;
+ }
- /*
- * @see IEditorInput#exists()
- */
- @Override
+ /*
+ * @see IEditorInput#exists()
+ */
+ @Override
public boolean exists() {
- return true;
- }
+ return true;
+ }
- /*
- * @see IEditorInput#getImageDescriptor()
- */
- @Override
+ /*
+ * @see IEditorInput#getImageDescriptor()
+ */
+ @Override
public ImageDescriptor getImageDescriptor() {
- return null;
- }
+ return null;
+ }
@Override
public String getName() {
@@ -82,50 +83,48 @@ public class MultiEditorInput implements IEditorInput {
return name.toString();
}
- @Override
+ @Override
public IPersistableElement getPersistable() {
- return null;
- }
+ return null;
+ }
- /*
- * @see IEditorInput#getToolTipText()
- */
- @Override
+ /*
+ * @see IEditorInput#getToolTipText()
+ */
+ @Override
public String getToolTipText() {
- return getName();
- }
+ return getName();
+ }
- /*
- * @see IAdaptable#getAdapter(Class)
- */
- @Override
+ /*
+ * @see IAdaptable#getAdapter(Class)
+ */
+ @Override
public <T> T getAdapter(Class<T> adapter) {
- return null;
- }
-
+ return null;
+ }
- @Override
+ @Override
public boolean equals(Object obj) {
- if (this == obj) {
+ if (this == obj) {
return true;
}
- if (!(obj instanceof MultiEditorInput)) {
+ if (!(obj instanceof MultiEditorInput)) {
return false;
}
- MultiEditorInput other = (MultiEditorInput) obj;
- return Arrays.equals(this.editors, other.editors) && Arrays.equals(this.input, other.input);
- }
-
+ MultiEditorInput other = (MultiEditorInput) obj;
+ return Arrays.equals(this.editors, other.editors) && Arrays.equals(this.input, other.input);
+ }
- @Override
+ @Override
public int hashCode() {
- int hash = 0;
- for (String editor : editors) {
- hash = hash * 37 + editor.hashCode();
- }
- for (IEditorInput editorInput : input) {
- hash = hash * 37 + editorInput.hashCode();
- }
- return hash;
- }
+ int hash = 0;
+ for (String editor : editors) {
+ hash = hash * 37 + editor.hashCode();
+ }
+ for (IEditorInput editorInput : input) {
+ hash = hash * 37 + editorInput.hashCode();
+ }
+ return hash;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditor.java
index ce7c4b7382a..b9de28aba43 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditor.java
@@ -60,108 +60,107 @@ import org.eclipse.swt.widgets.TabFolder;
*/
@Deprecated
public abstract class MultiPageEditor extends EditorPart {
- private List syncVector;
+ private List syncVector;
- private TabFolder tabFolder;
+ private TabFolder tabFolder;
- /**
- * Creates a new multi-page editor.
- *
- * @deprecated Use the class <code>MultiPageEditorPart</code> instead
- */
- @Deprecated
+ /**
+ * Creates a new multi-page editor.
+ *
+ * @deprecated Use the class <code>MultiPageEditorPart</code> instead
+ */
+ @Deprecated
public MultiPageEditor() {
- super();
- }
+ super();
+ }
- /**
- * Adds a synchronized pagebook to this editor. Once added, the
- * visible page of the pagebook and the visible page of the editor
- * will be synchronized.
- *
- * @param pageBook the pagebook to add
- */
- protected void addSyncroPageBook(PageBook pageBook) {
- // Add the page.
- if (syncVector == null) {
+ /**
+ * Adds a synchronized pagebook to this editor. Once added, the visible page of
+ * the pagebook and the visible page of the editor will be synchronized.
+ *
+ * @param pageBook the pagebook to add
+ */
+ protected void addSyncroPageBook(PageBook pageBook) {
+ // Add the page.
+ if (syncVector == null) {
syncVector = new ArrayList(1);
}
- syncVector.add(pageBook);
+ syncVector.add(pageBook);
- // Set the visible page.
- syncPageBook(pageBook);
- }
+ // Set the visible page.
+ syncPageBook(pageBook);
+ }
- /**
- * The <code>MultiPageEditor</code> implementation of this <code>IWorkbenchPart</code>
- * method creates a <code>TabFolder</code> control.
- */
- @Override
+ /**
+ * The <code>MultiPageEditor</code> implementation of this
+ * <code>IWorkbenchPart</code> method creates a <code>TabFolder</code> control.
+ */
+ @Override
public void createPartControl(Composite parent) {
- tabFolder = new TabFolder(parent, SWT.NONE);
- tabFolder.addSelectionListener(widgetSelectedAdapter(e -> sync()));
- }
+ tabFolder = new TabFolder(parent, SWT.NONE);
+ tabFolder.addSelectionListener(widgetSelectedAdapter(e -> sync()));
+ }
- /**
- * Returns this editor's workbook.
- *
- * @return the editor workbook
- */
- protected TabFolder getFolder() {
- return tabFolder;
- }
+ /**
+ * Returns this editor's workbook.
+ *
+ * @return the editor workbook
+ */
+ protected TabFolder getFolder() {
+ return tabFolder;
+ }
- /**
- * Indicates that a page change has occurred. Updates the sync vector.
- */
- protected void onPageChange() {
- if (syncVector != null) {
- Iterator itr = syncVector.iterator();
- while (itr.hasNext()) {
- PageBook pageBook = (PageBook) itr.next();
- syncPageBook(pageBook);
- }
- }
- }
+ /**
+ * Indicates that a page change has occurred. Updates the sync vector.
+ */
+ protected void onPageChange() {
+ if (syncVector != null) {
+ Iterator itr = syncVector.iterator();
+ while (itr.hasNext()) {
+ PageBook pageBook = (PageBook) itr.next();
+ syncPageBook(pageBook);
+ }
+ }
+ }
- /**
- * Removes a synchronized pagebook from this editor.
- *
- * @param pageBook the pagebook to remove
- * @see #addSyncroPageBook(PageBook)
- */
- protected void removeSyncroPageBook(PageBook pageBook) {
- if (syncVector != null) {
+ /**
+ * Removes a synchronized pagebook from this editor.
+ *
+ * @param pageBook the pagebook to remove
+ * @see #addSyncroPageBook(PageBook)
+ */
+ protected void removeSyncroPageBook(PageBook pageBook) {
+ if (syncVector != null) {
syncVector.remove(pageBook);
}
- pageBook.dispose();
- }
+ pageBook.dispose();
+ }
- /**
- * Synchronizes each registered pagebook with the editor page.
- */
- protected void sync() {
- if (syncVector != null) {
- Iterator itr = syncVector.iterator();
- while (itr.hasNext()) {
- PageBook pageBook = (PageBook) itr.next();
- syncPageBook(pageBook);
- }
- }
- }
+ /**
+ * Synchronizes each registered pagebook with the editor page.
+ */
+ protected void sync() {
+ if (syncVector != null) {
+ Iterator itr = syncVector.iterator();
+ while (itr.hasNext()) {
+ PageBook pageBook = (PageBook) itr.next();
+ syncPageBook(pageBook);
+ }
+ }
+ }
- /**
- * Sets the visible page of the given pagebook to be the same as
- * the visible page of this editor.
- *
- * @param pageBook a pagebook to synchronize
- */
- protected void syncPageBook(PageBook pageBook) {
- int pos = tabFolder.getSelectionIndex();
- Control children[] = pageBook.getChildren();
- int size = children.length;
- if (pos < size) {
+ /**
+ * Sets the visible page of the given pagebook to be the same as the visible
+ * page of this editor.
+ *
+ * @param pageBook a pagebook to synchronize
+ */
+ protected void syncPageBook(PageBook pageBook) {
+ int pos = tabFolder.getSelectionIndex();
+ Control children[] = pageBook.getChildren();
+ int size = children.length;
+ if (pos < size) {
pageBook.showPage(children[pos]);
}
- }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditorActionBarContributor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditorActionBarContributor.java
index 4582c6a9640..2f0f909528d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditorActionBarContributor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditorActionBarContributor.java
@@ -30,40 +30,40 @@ import org.eclipse.ui.IEditorPart;
* line</li>
* </ul>
*/
-public abstract class MultiPageEditorActionBarContributor extends
- EditorActionBarContributor {
- /**
- * Creates a multi-page editor action contributor.
- */
- protected MultiPageEditorActionBarContributor() {
- super();
- }
+public abstract class MultiPageEditorActionBarContributor extends EditorActionBarContributor {
+ /**
+ * Creates a multi-page editor action contributor.
+ */
+ protected MultiPageEditorActionBarContributor() {
+ super();
+ }
/*
- * Registers the contributor with the multi-page editor for future editor
- * action redirection when the active page is changed, and sets the active
- * page.
+ * Registers the contributor with the multi-page editor for future editor action
+ * redirection when the active page is changed, and sets the active page.
*/
- @Override
+ @Override
public void setActiveEditor(IEditorPart part) {
- IEditorPart activeNestedEditor = null;
- if (part instanceof MultiPageEditorPart) {
- activeNestedEditor = ((MultiPageEditorPart) part).getActiveEditor();
- }
- setActivePage(activeNestedEditor);
- }
+ IEditorPart activeNestedEditor = null;
+ if (part instanceof MultiPageEditorPart) {
+ activeNestedEditor = ((MultiPageEditorPart) part).getActiveEditor();
+ }
+ setActivePage(activeNestedEditor);
+ }
- /**
- * Sets the active page of the the multi-page editor to be the given editor.
- * Redirect actions to the given editor if actions are not already being sent to it.
- * <p>
- * This method is called whenever the page changes.
- * Subclasses must implement this method to redirect actions to the given
- * editor (if not already directed to it).
- * </p>
- *
- * @param activeEditor the new active editor, or <code>null</code> if there is no active page, or if the
- * active page does not have a corresponding editor
- */
- public abstract void setActivePage(IEditorPart activeEditor);
+ /**
+ * Sets the active page of the the multi-page editor to be the given editor.
+ * Redirect actions to the given editor if actions are not already being sent to
+ * it.
+ * <p>
+ * This method is called whenever the page changes. Subclasses must implement
+ * this method to redirect actions to the given editor (if not already directed
+ * to it).
+ * </p>
+ *
+ * @param activeEditor the new active editor, or <code>null</code> if there is
+ * no active page, or if the active page does not have a
+ * corresponding editor
+ */
+ public abstract void setActivePage(IEditorPart activeEditor);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditorPart.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditorPart.java
index ee469522139..7b92fcaae34 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditorPart.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditorPart.java
@@ -108,9 +108,9 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
private static final String COMMAND_PREVIOUS_SUB_TAB = "org.eclipse.ui.navigate.previousSubTab"; //$NON-NLS-1$
/**
- * Subclasses that override {@link #createPageContainer(Composite)} can use
- * this constant to get a site for the container that can be active while
- * the current page is deactivated.
+ * Subclasses that override {@link #createPageContainer(Composite)} can use this
+ * constant to get a site for the container that can be active while the current
+ * page is deactivated.
*
* @since 3.4
* @see #activateSite()
@@ -125,9 +125,8 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
private static final String TRACING_COMPONENT = "MPE"; //$NON-NLS-1$
/**
- * The active service locator. This value may be <code>null</code> if
- * there is no selected page, or if the selected page is a control with
- * no site.
+ * The active service locator. This value may be <code>null</code> if there is
+ * no selected page, or if the selected page is a control with no site.
*/
private INestable activeServiceLocator;
@@ -138,9 +137,8 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
/**
* List of nested editors. Element type: IEditorPart. Need to hang onto them
- * here, in addition to using get/setData on the items, because dispose()
- * needs to access them, but widgetry has already been disposed at that
- * point.
+ * here, in addition to using get/setData on the items, because dispose() needs
+ * to access them, but widgetry has already been disposed at that point.
*/
private ArrayList nestedEditors = new ArrayList(3);
@@ -148,8 +146,7 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
private IServiceLocator pageContainerSite;
- private ListenerList<IPageChangedListener> pageChangeListeners = new ListenerList<>(
- ListenerList.IDENTITY);
+ private ListenerList<IPageChangedListener> pageChangeListeners = new ListenerList<>(ListenerList.IDENTITY);
/**
* Creates an empty multi-page editor with no pages.
@@ -159,12 +156,11 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
}
/**
- * Creates and adds a new page containing the given control to this
- * multi-page editor. The control may be <code>null</code>, allowing it
- * to be created and set later using <code>setControl</code>.
+ * Creates and adds a new page containing the given control to this multi-page
+ * editor. The control may be <code>null</code>, allowing it to be created and
+ * set later using <code>setControl</code>.
*
- * @param control
- * the control, or <code>null</code>
+ * @param control the control, or <code>null</code>
* @return the index of the new page
*
* @see MultiPageEditorPart#setControl(int, Control)
@@ -176,15 +172,13 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
}
/**
- * Creates and adds a new page containing the given control to this
- * multi-page editor. The page is added at the given index. The control may
- * be <code>null</code>, allowing it to be created and set later using
+ * Creates and adds a new page containing the given control to this multi-page
+ * editor. The page is added at the given index. The control may be
+ * <code>null</code>, allowing it to be created and set later using
* <code>setControl</code>.
*
- * @param index
- * the index at which to add the page (0-based)
- * @param control
- * the control, or <code>null</code>
+ * @param index the index at which to add the page (0-based)
+ * @param control the control, or <code>null</code>
*
* @see MultiPageEditorPart#setControl(int, Control)
*/
@@ -193,53 +187,42 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
}
/**
- * Creates and adds a new page containing the given editor to this
- * multi-page editor. This also hooks a property change listener on the
- * nested editor.
+ * Creates and adds a new page containing the given editor to this multi-page
+ * editor. This also hooks a property change listener on the nested editor.
*
- * @param editor
- * the nested editor
- * @param input
- * the input for the nested editor
+ * @param editor the nested editor
+ * @param input the input for the nested editor
* @return the index of the new page
- * @exception PartInitException
- * if a new page could not be created
+ * @exception PartInitException if a new page could not be created
*
- * @see MultiPageEditorPart#handlePropertyChange(int) the handler for
- * property change events from the nested editor
+ * @see MultiPageEditorPart#handlePropertyChange(int) the handler for property
+ * change events from the nested editor
*/
- public int addPage(IEditorPart editor, IEditorInput input)
- throws PartInitException {
+ public int addPage(IEditorPart editor, IEditorInput input) throws PartInitException {
int index = getPageCount();
addPage(index, editor, input);
return index;
}
/**
- * Creates and adds a new page containing the given editor to this
- * multi-page editor. The page is added at the given index. This also hooks
- * a property change listener on the nested editor.
+ * Creates and adds a new page containing the given editor to this multi-page
+ * editor. The page is added at the given index. This also hooks a property
+ * change listener on the nested editor.
*
- * @param index
- * the index at which to add the page (0-based)
- * @param editor
- * the nested editor
- * @param input
- * the input for the nested editor
- * @exception PartInitException
- * if a new page could not be created
+ * @param index the index at which to add the page (0-based)
+ * @param editor the nested editor
+ * @param input the input for the nested editor
+ * @exception PartInitException if a new page could not be created
*
- * @see MultiPageEditorPart#handlePropertyChange(int) the handler for
- * property change events from the nested editor
+ * @see MultiPageEditorPart#handlePropertyChange(int) the handler for property
+ * change events from the nested editor
*/
- public void addPage(int index, IEditorPart editor, IEditorInput input)
- throws PartInitException {
+ public void addPage(int index, IEditorPart editor, IEditorInput input) throws PartInitException {
IEditorSite site = createSite(editor);
// call init first so that if an exception is thrown, we have created no
// new widgets
editor.init(site, input);
- Composite parent2 = new Composite(getContainer(),
- getOrientation(editor));
+ Composite parent2 = new Composite(getContainer(), getOrientation(editor));
parent2.setLayout(new FillLayout());
editor.createPartControl(parent2);
editor.addPropertyListener((source, propertyId) -> MultiPageEditorPart.this.handlePropertyChange(propertyId));
@@ -268,55 +251,51 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
}
/**
- * Creates an empty container. Creates a CTabFolder with no style bits set,
- * and hooks a selection listener which calls <code>pageChange()</code>
- * whenever the selected tab changes.
+ * Creates an empty container. Creates a CTabFolder with no style bits set, and
+ * hooks a selection listener which calls <code>pageChange()</code> whenever the
+ * selected tab changes.
*
- * @param parent
- * The composite in which the container tab folder should be
- * created; must not be <code>null</code>.
+ * @param parent The composite in which the container tab folder should be
+ * created; must not be <code>null</code>.
* @return a new container
*/
private CTabFolder createContainer(Composite parent) {
// use SWT.FLAT style so that an extra 1 pixel border is not reserved
// inside the folder
parent.setLayout(new FillLayout());
- final CTabFolder newContainer = new CTabFolder(parent, SWT.BOTTOM
- | SWT.FLAT);
+ final CTabFolder newContainer = new CTabFolder(parent, SWT.BOTTOM | SWT.FLAT);
newContainer.addSelectionListener(widgetSelectedAdapter(e -> {
int newPageIndex = newContainer.indexOf((CTabItem) e.item);
pageChange(newPageIndex);
}));
newContainer.addTraverseListener(e -> {
switch (e.detail) {
- case SWT.TRAVERSE_PAGE_NEXT:
- case SWT.TRAVERSE_PAGE_PREVIOUS:
- int detail = e.detail;
- e.doit = true;
- e.detail = SWT.TRAVERSE_NONE;
- Control control = newContainer.getParent();
- do {
- if (control.traverse(detail))
- return;
- if (control.getListeners(SWT.Traverse).length != 0)
- return;
- if (control instanceof Shell)
- return;
- control = control.getParent();
- } while (control != null);
+ case SWT.TRAVERSE_PAGE_NEXT:
+ case SWT.TRAVERSE_PAGE_PREVIOUS:
+ int detail = e.detail;
+ e.doit = true;
+ e.detail = SWT.TRAVERSE_NONE;
+ Control control = newContainer.getParent();
+ do {
+ if (control.traverse(detail))
+ return;
+ if (control.getListeners(SWT.Traverse).length != 0)
+ return;
+ if (control instanceof Shell)
+ return;
+ control = control.getParent();
+ } while (control != null);
}
});
return newContainer;
}
/**
- * Creates a tab item at the given index and places the given control in the
- * new item. The item is a CTabItem with no style bits set.
+ * Creates a tab item at the given index and places the given control in the new
+ * item. The item is a CTabItem with no style bits set.
*
- * @param index
- * the index at which to add the control
- * @param control
- * is the control to be placed in an item
+ * @param index the index at which to add the control
+ * @param control is the control to be placed in an item
* @return a new item
*/
private CTabItem createItem(int index, Control control) {
@@ -335,14 +314,13 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
/**
* The <code>MultiPageEditor</code> implementation of this
- * <code>IWorkbenchPart</code> method creates the control for the
- * multi-page editor by calling <code>createContainer</code>, then
+ * <code>IWorkbenchPart</code> method creates the control for the multi-page
+ * editor by calling <code>createContainer</code>, then
* <code>createPages</code>. Subclasses should implement
* <code>createPages</code> rather than overriding this method.
*
- * @param parent
- * The parent in which the editor should be created; must not be
- * <code>null</code>.
+ * @param parent The parent in which the editor should be created; must not be
+ * <code>null</code>.
*/
@Override
public final void createPartControl(Composite parent) {
@@ -354,7 +332,7 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
if (getActivePage() == -1) {
setActivePage(0);
IEditorPart part = getEditor(0);
- if (part!=null) {
+ if (part != null) {
final IServiceLocator serviceLocator = part.getEditorSite();
if (serviceLocator instanceof INestable) {
activeServiceLocator = (INestable) serviceLocator;
@@ -367,9 +345,8 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
}
/**
- * Initialize the MultiPageEditorPart to use the page switching command.
- * Clients can override this method with an empty body if they wish to
- * opt-out.
+ * Initialize the MultiPageEditorPart to use the page switching command. Clients
+ * can override this method with an empty body if they wish to opt-out.
*
* @since 3.4
*/
@@ -421,18 +398,18 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
service.activateHandler(COMMAND_NEXT_SUB_TAB, new AbstractHandler() {
/**
* {@inheritDoc}
- * @throws ExecutionException
- * if an exception occurred during execution
+ *
+ * @throws ExecutionException if an exception occurred during execution
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- int n= getPageCount();
+ int n = getPageCount();
if (n == 0)
return null;
- int i= getActivePage() + 1;
+ int i = getActivePage() + 1;
if (i >= n)
- i= 0;
+ i = 0;
setActivePage(i);
return null;
}
@@ -441,18 +418,18 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
service.activateHandler(COMMAND_PREVIOUS_SUB_TAB, new AbstractHandler() {
/**
* {@inheritDoc}
- * @throws ExecutionException
- * if an exception occurred during execution
+ *
+ * @throws ExecutionException if an exception occurred during execution
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- int n= getPageCount();
+ int n = getPageCount();
if (n == 0)
return null;
- int i= getActivePage() - 1;
+ int i = getActivePage() - 1;
if (i < 0)
- i= n - 1;
+ i = n - 1;
setActivePage(i);
return null;
}
@@ -467,8 +444,7 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
* Subclasses may extend and must call super implementation first.
* </p>
*
- * @param parent
- * the parent for all of the editors contents.
+ * @param parent the parent for all of the editors contents.
* @return the parent for this editor's container. Must not be
* <code>null</code>.
*
@@ -480,12 +456,11 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
/**
* Creates the site for the given nested editor. The
- * <code>MultiPageEditorPart</code> implementation of this method creates
- * an instance of <code>MultiPageEditorSite</code>. Subclasses may
- * reimplement to create more specialized sites.
+ * <code>MultiPageEditorPart</code> implementation of this method creates an
+ * instance of <code>MultiPageEditorSite</code>. Subclasses may reimplement to
+ * create more specialized sites.
*
- * @param editor
- * the nested editor
+ * @param editor the nested editor
* @return the editor site
*/
protected IEditorSite createSite(IEditorPart editor) {
@@ -494,8 +469,8 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
/**
* The <code>MultiPageEditorPart</code> implementation of this
- * <code>IWorkbenchPart</code> method disposes all nested editors.
- * Subclasses may extend.
+ * <code>IWorkbenchPart</code> method disposes all nested editors. Subclasses
+ * may extend.
*/
@Override
public void dispose() {
@@ -539,8 +514,8 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
}
/**
- * Returns the index of the currently active page, or -1 if there is no
- * active page.
+ * Returns the index of the currently active page, or -1 if there is no active
+ * page.
* <p>
* Subclasses should not override this method
* </p>
@@ -559,49 +534,46 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
}
/**
- * Returns the composite control containing this multi-page editor's pages.
- * This should be used as the parent when creating controls for the
- * individual pages. That is, when calling <code>addPage(Control)</code>,
- * the passed control should be a child of this container.
+ * Returns the composite control containing this multi-page editor's pages. This
+ * should be used as the parent when creating controls for the individual pages.
+ * That is, when calling <code>addPage(Control)</code>, the passed control
+ * should be a child of this container.
* <p>
* Warning: Clients should not assume that the container is any particular
- * subclass of Composite. The actual class used may change in order to
- * improve the look and feel of multi-page editors. Any code making
- * assumptions on the particular subclass would thus be broken.
+ * subclass of Composite. The actual class used may change in order to improve
+ * the look and feel of multi-page editors. Any code making assumptions on the
+ * particular subclass would thus be broken.
* </p>
* <p>
* Subclasses should not override this method
* </p>
*
- * @return the composite, or <code>null</code> if
- * <code>createPartControl</code> has not been called yet
+ * @return the composite, or <code>null</code> if <code>createPartControl</code>
+ * has not been called yet
*/
protected Composite getContainer() {
return container;
}
/**
- * Returns the control for the given page index, or <code>null</code> if
- * no control has been set for the page. The page index must be valid.
+ * Returns the control for the given page index, or <code>null</code> if no
+ * control has been set for the page. The page index must be valid.
* <p>
* Subclasses should not override this method
* </p>
*
- * @param pageIndex
- * the index of the page
- * @return the control for the specified page, or <code>null</code> if
- * none has been set
+ * @param pageIndex the index of the page
+ * @return the control for the specified page, or <code>null</code> if none has
+ * been set
*/
protected Control getControl(int pageIndex) {
return getItem(pageIndex).getControl();
}
/**
- * Returns the editor for the given page index. The page index must be
- * valid.
+ * Returns the editor for the given page index. The page index must be valid.
*
- * @param pageIndex
- * the index of the page
+ * @param pageIndex the index of the page
* @return the editor for the specified page, or <code>null</code> if the
* specified page was not created with
* <code>addPage(IEditorPart,IEditorInput)</code>
@@ -618,16 +590,15 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
}
/**
- * Returns the service locator for the given page index. This method can be
- * used to create service locators for pages that are just controls. The
- * page index must be valid.
+ * Returns the service locator for the given page index. This method can be used
+ * to create service locators for pages that are just controls. The page index
+ * must be valid.
* <p>
- * This will return the editor site service locator for an editor, and
- * create one for a page that is just a control.
+ * This will return the editor site service locator for an editor, and create
+ * one for a page that is just a control.
* </p>
*
- * @param pageIndex
- * the index of the page
+ * @param pageIndex the index of the page
* @return the editor for the specified page, or <code>null</code> if the
* specified page was not created with
* <code>addPage(IEditorPart,IEditorInput)</code>
@@ -646,8 +617,7 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
} else if (data instanceof IServiceLocator) {
return (IServiceLocator) data;
} else if (data == null) {
- IServiceLocatorCreator slc = getSite()
- .getService(IServiceLocatorCreator.class);
+ IServiceLocatorCreator slc = getSite().getService(IServiceLocatorCreator.class);
IServiceLocator sl = slc.createServiceLocator(getSite(), null, () -> close());
item.setData(sl);
pageSites.add(sl);
@@ -676,19 +646,17 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
*/
private IServiceLocator getPageContainerSite() {
if (pageContainerSite == null) {
- IServiceLocatorCreator slc = getSite()
- .getService(IServiceLocatorCreator.class);
+ IServiceLocatorCreator slc = getSite().getService(IServiceLocatorCreator.class);
pageContainerSite = slc.createServiceLocator(getSite(), null, () -> close());
}
return pageContainerSite;
}
/**
- * Returns the tab item for the given page index (page index is 0-based).
- * The page index must be valid.
+ * Returns the tab item for the given page index (page index is 0-based). The
+ * page index must be valid.
*
- * @param pageIndex
- * the index of the page
+ * @param pageIndex the index of the page
* @return the tab item for the given page index
*/
private CTabItem getItem(int pageIndex) {
@@ -710,11 +678,10 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
}
/**
- * Returns the image for the page with the given index, or <code>null</code>
- * if no image has been set for the page. The page index must be valid.
+ * Returns the image for the page with the given index, or <code>null</code> if
+ * no image has been set for the page. The page index must be valid.
*
- * @param pageIndex
- * the index of the page
+ * @param pageIndex the index of the page
* @return the image, or <code>null</code> if none
*/
protected Image getPageImage(int pageIndex) {
@@ -722,12 +689,11 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
}
/**
- * Returns the text label for the page with the given index. Returns the
- * empty string if no text label has been set for the page. The page index
- * must be valid.
+ * Returns the text label for the page with the given index. Returns the empty
+ * string if no text label has been set for the page. The page index must be
+ * valid.
*
- * @param pageIndex
- * the index of the page
+ * @param pageIndex the index of the page
* @return the text label for the page
*/
protected String getPageText(int pageIndex) {
@@ -747,18 +713,16 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
/**
* Handles a property change notification from a nested editor. The default
* implementation simply forwards the change to listeners on this multi-page
- * editor by calling <code>firePropertyChange</code> with the same
- * property id. For example, if the dirty state of a nested editor changes
- * (property id <code>IEditorPart.PROP_DIRTY</code>), this method handles
- * it by firing a property change event for
- * <code>IEditorPart.PROP_DIRTY</code> to property listeners on this
- * multi-page editor.
+ * editor by calling <code>firePropertyChange</code> with the same property id.
+ * For example, if the dirty state of a nested editor changes (property id
+ * <code>IEditorPart.PROP_DIRTY</code>), this method handles it by firing a
+ * property change event for <code>IEditorPart.PROP_DIRTY</code> to property
+ * listeners on this multi-page editor.
* <p>
* Subclasses may extend or reimplement this method.
* </p>
*
- * @param propertyId
- * the id of the property that changed
+ * @param propertyId the id of the property that changed
*/
protected void handlePropertyChange(int propertyId) {
firePropertyChange(propertyId);
@@ -766,23 +730,19 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
/**
* The <code>MultiPageEditorPart</code> implementation of this
- * <code>IEditorPart</code> method sets its site to the given site, its
- * input to the given input, and the site's selection provider to a
- * <code>MultiPageSelectionProvider</code>. Subclasses may extend this
- * method.
+ * <code>IEditorPart</code> method sets its site to the given site, its input to
+ * the given input, and the site's selection provider to a
+ * <code>MultiPageSelectionProvider</code>. Subclasses may extend this method.
*
- * @param site
- * The site for which this part is being created; must not be
- * <code>null</code>.
- * @param input
- * The input on which this editor should be created; must not be
- * <code>null</code>.
- * @throws PartInitException
- * If the initialization of the part fails -- currently never.
+ * @param site The site for which this part is being created; must not be
+ * <code>null</code>.
+ * @param input The input on which this editor should be created; must not be
+ * <code>null</code>.
+ * @throws PartInitException If the initialization of the part fails --
+ * currently never.
*/
@Override
- public void init(IEditorSite site, IEditorInput input)
- throws PartInitException {
+ public void init(IEditorSite site, IEditorInput input) throws PartInitException {
setSite(site);
setInput(input);
site.setSelectionProvider(new MultiPageSelectionProvider(this));
@@ -790,9 +750,9 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
/**
* The <code>MultiPageEditorPart</code> implementation of this
- * <code>IEditorPart</code> method returns whether the contents of any of
- * this multi-page editor's nested editors have changed since the last save.
- * Pages created with <code>addPage(Control)</code> are ignored.
+ * <code>IEditorPart</code> method returns whether the contents of any of this
+ * multi-page editor's nested editors have changed since the last save. Pages
+ * created with <code>addPage(Control)</code> are ignored.
* <p>
* Subclasses may extend or reimplement this method.
* </p>
@@ -816,58 +776,50 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
* Notifies this multi-page editor that the page with the given id has been
* activated. This method is called when the user selects a different tab.
* <p>
- * The <code>MultiPageEditorPart</code> implementation of this method sets
- * focus to the new page, and notifies the action bar contributor (if there
- * is one). This checks whether the action bar contributor is an instance of
+ * The <code>MultiPageEditorPart</code> implementation of this method sets focus
+ * to the new page, and notifies the action bar contributor (if there is one).
+ * This checks whether the action bar contributor is an instance of
* <code>MultiPageEditorActionBarContributor</code>, and, if so, calls
- * <code>setActivePage</code> with the active nested editor. This also
- * fires a selection change event if required.
+ * <code>setActivePage</code> with the active nested editor. This also fires a
+ * selection change event if required.
* </p>
* <p>
* Subclasses may extend this method.
* </p>
*
- * @param newPageIndex
- * the index of the activated page
+ * @param newPageIndex the index of the activated page
*/
protected void pageChange(int newPageIndex) {
deactivateSite(false, false);
- IPartService partService = getSite().getService(
- IPartService.class);
+ IPartService partService = getSite().getService(IPartService.class);
if (partService.getActivePart() == this) {
setFocus();
}
IEditorPart activeEditor = getEditor(newPageIndex);
- IEditorActionBarContributor contributor = getEditorSite()
- .getActionBarContributor();
- if (contributor != null
- && contributor instanceof MultiPageEditorActionBarContributor) {
- ((MultiPageEditorActionBarContributor) contributor)
- .setActivePage(activeEditor);
+ IEditorActionBarContributor contributor = getEditorSite().getActionBarContributor();
+ if (contributor != null && contributor instanceof MultiPageEditorActionBarContributor) {
+ ((MultiPageEditorActionBarContributor) contributor).setActivePage(activeEditor);
}
if (activeEditor != null) {
- ISelectionProvider selectionProvider = activeEditor.getSite()
- .getSelectionProvider();
+ ISelectionProvider selectionProvider = activeEditor.getSite().getSelectionProvider();
if (selectionProvider != null) {
- ISelectionProvider outerProvider = getSite()
- .getSelectionProvider();
+ ISelectionProvider outerProvider = getSite().getSelectionProvider();
if (outerProvider instanceof MultiPageSelectionProvider) {
- SelectionChangedEvent event = new SelectionChangedEvent(
- selectionProvider, selectionProvider.getSelection());
+ SelectionChangedEvent event = new SelectionChangedEvent(selectionProvider,
+ selectionProvider.getSelection());
MultiPageSelectionProvider provider = (MultiPageSelectionProvider) outerProvider;
provider.fireSelectionChanged(event);
provider.firePostSelectionChanged(event);
} else {
if (Policy.DEBUG_MPE) {
- Tracing.printTrace(TRACING_COMPONENT,
- "MultiPageEditorPart " + getTitle() //$NON-NLS-1$
- + " did not propogate selection for " //$NON-NLS-1$
- + activeEditor.getTitle());
+ Tracing.printTrace(TRACING_COMPONENT, "MultiPageEditorPart " + getTitle() //$NON-NLS-1$
+ + " did not propogate selection for " //$NON-NLS-1$
+ + activeEditor.getTitle());
}
}
}
@@ -882,10 +834,9 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
/**
* This method can be used by implementors of
- * {@link MultiPageEditorPart#createPageContainer(Composite)} to deactivate
- * the active inner editor services while their header has focus. A
- * deactivateSite() must have a matching call to activateSite() when
- * appropriate.
+ * {@link MultiPageEditorPart#createPageContainer(Composite)} to deactivate the
+ * active inner editor services while their header has focus. A deactivateSite()
+ * must have a matching call to activateSite() when appropriate.
* <p>
* An new inner editor will have its site activated on a
* {@link MultiPageEditorPart#pageChange(int)}.
@@ -895,18 +846,16 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
* form.
* </p>
*
- * @param immediate
- * immediately deactivate the legacy keybinding service
- * @param containerSiteActive
- * Leave the page container site active.
+ * @param immediate immediately deactivate the legacy keybinding
+ * service
+ * @param containerSiteActive Leave the page container site active.
* @since 3.4
* @see #activateSite()
* @see #createPageContainer(Composite)
* @see #getPageSite(int)
* @see #PAGE_CONTAINER_SITE
*/
- protected final void deactivateSite(boolean immediate,
- boolean containerSiteActive) {
+ protected final void deactivateSite(boolean immediate, boolean containerSiteActive) {
// Deactivate the nested services from the last active service locator.
if (activeServiceLocator != null) {
activeServiceLocator.deactivate();
@@ -921,8 +870,9 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
final INestableKeyBindingService nestableService = (INestableKeyBindingService) service;
nestableService.activateKeyBindingService(null);
} else {
- WorkbenchPlugin
- .log("MultiPageEditorPart.deactivateSite() Parent key binding service was not an instance of INestableKeyBindingService. It was an instance of " + service.getClass().getName() + " instead."); //$NON-NLS-1$ //$NON-NLS-2$
+ WorkbenchPlugin.log(
+ "MultiPageEditorPart.deactivateSite() Parent key binding service was not an instance of INestableKeyBindingService. It was an instance of " //$NON-NLS-1$
+ + service.getClass().getName() + " instead."); //$NON-NLS-1$
}
}
@@ -937,8 +887,8 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
/**
* This method can be used by implementors of
- * {@link #createPageContainer(Composite)} to activate the active inner
- * editor services when their header loses focus.
+ * {@link #createPageContainer(Composite)} to activate the active inner editor
+ * services when their header loses focus.
* <p>
* An new inner editor will have its site activated on a
* {@link #pageChange(int)}.
@@ -967,12 +917,12 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
// active the service for this inner editor
if (service instanceof INestableKeyBindingService) {
final INestableKeyBindingService nestableService = (INestableKeyBindingService) service;
- nestableService.activateKeyBindingService(editor
- .getEditorSite());
+ nestableService.activateKeyBindingService(editor.getEditorSite());
} else {
- WorkbenchPlugin
- .log("MultiPageEditorPart.activateSite() Parent key binding service was not an instance of INestableKeyBindingService. It was an instance of " + service.getClass().getName() + " instead."); //$NON-NLS-1$ //$NON-NLS-2$
+ WorkbenchPlugin.log(
+ "MultiPageEditorPart.activateSite() Parent key binding service was not an instance of INestableKeyBindingService. It was an instance of " //$NON-NLS-1$
+ + service.getClass().getName() + " instead."); //$NON-NLS-1$
}
// Activate the services for the new service locator.
final IServiceLocator serviceLocator = editor.getEditorSite();
@@ -989,8 +939,9 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
final INestableKeyBindingService nestableService = (INestableKeyBindingService) service;
nestableService.activateKeyBindingService(null);
} else {
- WorkbenchPlugin
- .log("MultiPageEditorPart.activateSite() Parent key binding service was not an instance of INestableKeyBindingService. It was an instance of " + service.getClass().getName() + " instead."); //$NON-NLS-1$ //$NON-NLS-2$
+ WorkbenchPlugin.log(
+ "MultiPageEditorPart.activateSite() Parent key binding service was not an instance of INestableKeyBindingService. It was an instance of " //$NON-NLS-1$
+ + service.getClass().getName() + " instead."); //$NON-NLS-1$
}
if (item.getData() instanceof INestable) {
@@ -1003,8 +954,7 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
/**
* Disposes the given part and its site.
*
- * @param part
- * The part to dispose; must not be <code>null</code>.
+ * @param part The part to dispose; must not be <code>null</code>.
*/
private void disposePart(final IWorkbenchPart part) {
SafeRunner.run(new ISafeRunnable() {
@@ -1029,8 +979,7 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
* controls for the page are disposed of; if the page has an editor, it is
* disposed of too. The page index must be valid.
*
- * @param pageIndex
- * the index of the page
+ * @param pageIndex the index of the page
* @see MultiPageEditorPart#addPage(Control)
* @see MultiPageEditorPart#addPage(IEditorPart, IEditorInput)
*/
@@ -1071,8 +1020,8 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
/**
* Sets the currently active page.
*
- * @param pageIndex
- * the index of the page to be activated; the index must be valid
+ * @param pageIndex the index of the page to be activated; the index must be
+ * valid
*/
protected void setActivePage(int pageIndex) {
Assert.isTrue(pageIndex >= 0 && pageIndex < getPageCount());
@@ -1083,11 +1032,9 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
/**
* Sets the control for the given page index. The page index must be valid.
*
- * @param pageIndex
- * the index of the page
- * @param control
- * the control for the specified page, or <code>null</code> to
- * clear the control
+ * @param pageIndex the index of the page
+ * @param control the control for the specified page, or <code>null</code> to
+ * clear the control
*/
protected void setControl(int pageIndex, Control control) {
getItem(pageIndex).setControl(control);
@@ -1095,8 +1042,8 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
/**
* The <code>MultiPageEditor</code> implementation of this
- * <code>IWorkbenchPart</code> method sets focus on the active nested
- * editor, if there is one.
+ * <code>IWorkbenchPart</code> method sets focus on the active nested editor, if
+ * there is one.
* <p>
* Subclasses may extend or reimplement.
* </p>
@@ -1107,12 +1054,11 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
}
/**
- * Sets focus to the control for the given page. If the page has an editor,
- * this calls its <code>setFocus()</code> method. Otherwise, this calls
+ * Sets focus to the control for the given page. If the page has an editor, this
+ * calls its <code>setFocus()</code> method. Otherwise, this calls
* <code>setFocus</code> on the control for the page.
*
- * @param pageIndex
- * the index of the page
+ * @param pageIndex the index of the page
*/
private void setFocus(int pageIndex) {
if (pageIndex < 0 || pageIndex >= getPageCount()) {
@@ -1133,35 +1079,30 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
}
/**
- * Sets the image for the page with the given index, or <code>null</code>
- * to clear the image for the page. The page index must be valid.
+ * Sets the image for the page with the given index, or <code>null</code> to
+ * clear the image for the page. The page index must be valid.
*
- * @param pageIndex
- * the index of the page
- * @param image
- * the image, or <code>null</code>
+ * @param pageIndex the index of the page
+ * @param image the image, or <code>null</code>
*/
protected void setPageImage(int pageIndex, Image image) {
getItem(pageIndex).setImage(image);
}
/**
- * Sets the text label for the page with the given index. The page index
- * must be valid. The text label must not be null.
+ * Sets the text label for the page with the given index. The page index must be
+ * valid. The text label must not be null.
*
- * @param pageIndex
- * the index of the page
- * @param text
- * the text label
+ * @param pageIndex the index of the page
+ * @param text the text label
*/
protected void setPageText(int pageIndex, String text) {
getItem(pageIndex).setText(text);
}
/**
- * If there is an adapter registered against the subclass of
- * MultiPageEditorPart return that. Otherwise, delegate to the internal
- * editor.
+ * If there is an adapter registered against the subclass of MultiPageEditorPart
+ * return that. Otherwise, delegate to the internal editor.
*
* @see org.eclipse.ui.part.WorkbenchPart#getAdapter(java.lang.Class)
*/
@@ -1169,7 +1110,7 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
public <T> T getAdapter(Class<T> adapter) {
T result = super.getAdapter(adapter);
// restrict delegating to the UI thread for bug 144851
- if (result == null && Display.getCurrent()!=null) {
+ if (result == null && Display.getCurrent() != null) {
IEditorPart innerEditor = getActiveEditor();
// see bug 138823 - prevent some subclasses from causing
// an infinite loop
@@ -1181,11 +1122,12 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
}
/**
- * Find the editors contained in this multi-page editor
- * whose editor input match the provided input.
+ * Find the editors contained in this multi-page editor whose editor input match
+ * the provided input.
+ *
* @param input the editor input
- * @return the editors contained in this multi-page editor
- * whose editor input match the provided input
+ * @return the editors contained in this multi-page editor whose editor input
+ * match the provided input
* @since 3.3
*/
public final IEditorPart[] findEditors(IEditorInput input) {
@@ -1193,9 +1135,7 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
int count = getPageCount();
for (int i = 0; i < count; i++) {
IEditorPart editor = getEditor(i);
- if (editor != null
- && editor.getEditorInput() != null
- && editor.getEditorInput().equals(input)) {
+ if (editor != null && editor.getEditorInput() != null && editor.getEditorInput().equals(input)) {
result.add(editor);
}
}
@@ -1203,10 +1143,10 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
}
/**
- * Set the active page of this multi-page editor to the
- * page that contains the given editor part. This method has
- * no effect of the given editor part is not contained in this
- * multi-page editor.
+ * Set the active page of this multi-page editor to the page that contains the
+ * given editor part. This method has no effect of the given editor part is not
+ * contained in this multi-page editor.
+ *
* @param editorPart the editor part
* @since 3.3
*/
@@ -1225,12 +1165,12 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
* Returns the selected page for the current active page index, either the
* IEditorPart for editors or the Control for other pages.
* <p>
- * <b>Note:</b> clients may override this method to return a page
- * appropriate for their editors. Maybe be <code>null</code>.
+ * <b>Note:</b> clients may override this method to return a page appropriate
+ * for their editors. Maybe be <code>null</code>.
* </p>
*
- * @return The IEditorPart or Control representing the current active page,
- * or <code>null</code> if there are no active pages.
+ * @return The IEditorPart or Control representing the current active page, or
+ * <code>null</code> if there are no active pages.
* @since 3.5
* @see #getActivePage()
*/
@@ -1248,10 +1188,10 @@ public abstract class MultiPageEditorPart extends EditorPart implements IPageCha
}
/**
- * Add the page change listener to be notified when the page changes. The
- * newly selected page will be the Object returned from
- * {@link #getSelectedPage()}. In the default case, this will be the active
- * page Control, IEditorPart, or <code>null</code>.
+ * Add the page change listener to be notified when the page changes. The newly
+ * selected page will be the Object returned from {@link #getSelectedPage()}. In
+ * the default case, this will be the active page Control, IEditorPart, or
+ * <code>null</code>.
* <p>
* This method has no effect if the listener has already been added.
* </p>
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditorSite.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditorSite.java
index e3b02b195ad..de4cc1f9ecb 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditorSite.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditorSite.java
@@ -57,8 +57,8 @@ import org.eclipse.ui.services.IServiceScopes;
* forwarding the event to the multi-page editor's selection listeners; most
* other methods are forwarded to the multi-page editor's site.
* <p>
- * The base implementation of <code>MultiPageEditor.createSite</code> creates
- * an instance of this class. This class may be instantiated or subclassed.
+ * The base implementation of <code>MultiPageEditor.createSite</code> creates an
+ * instance of this class. This class may be instantiated or subclassed.
* </p>
*/
public class MultiPageEditorSite implements IEditorSite, INestable {
@@ -84,8 +84,8 @@ public class MultiPageEditorSite implements IEditorSite, INestable {
private ISelectionChangedListener postSelectionChangedListener;
/**
- * The selection change listener, initialized lazily; <code>null</code> if
- * not yet created.
+ * The selection change listener, initialized lazily; <code>null</code> if not
+ * yet created.
*/
private ISelectionChangedListener selectionChangedListener;
@@ -97,9 +97,8 @@ public class MultiPageEditorSite implements IEditorSite, INestable {
private ISelectionProvider selectionProvider;
/**
- * The cached copy of the key binding service specific to this multi-page
- * editor site. This value is <code>null</code> if it is not yet
- * initialized.
+ * The cached copy of the key binding service specific to this multi-page editor
+ * site. This value is <code>null</code> if it is not yet initialized.
*/
private IKeyBindingService service;
@@ -119,13 +118,10 @@ public class MultiPageEditorSite implements IEditorSite, INestable {
* Creates a site for the given editor nested within the given multi-page
* editor.
*
- * @param multiPageEditor
- * the multi-page editor
- * @param editor
- * the nested editor
+ * @param multiPageEditor the multi-page editor
+ * @param editor the nested editor
*/
- public MultiPageEditorSite(MultiPageEditorPart multiPageEditor,
- IEditorPart editor) {
+ public MultiPageEditorSite(MultiPageEditorPart multiPageEditor, IEditorPart editor) {
Assert.isNotNull(multiPageEditor);
Assert.isNotNull(editor);
this.multiPageEditor = multiPageEditor;
@@ -133,12 +129,11 @@ public class MultiPageEditorSite implements IEditorSite, INestable {
PartSite site = (PartSite) multiPageEditor.getSite();
- IServiceLocatorCreator slc = site
- .getService(IServiceLocatorCreator.class);
+ IServiceLocatorCreator slc = site.getService(IServiceLocatorCreator.class);
String name = "MultiPageEditorSite (" + editor.getClass().getName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
context = site.getModel().getContext().createChild(name);
- serviceLocator = (ServiceLocator) slc.createServiceLocator(
- multiPageEditor.getSite(), null, () -> getMultiPageEditor().close(), context);
+ serviceLocator = (ServiceLocator) slc.createServiceLocator(multiPageEditor.getSite(), null,
+ () -> getMultiPageEditor().close(), context);
initializeDefaultServices();
}
@@ -148,10 +143,8 @@ public class MultiPageEditorSite implements IEditorSite, INestable {
*/
private void initializeDefaultServices() {
serviceLocator.registerService(IWorkbenchLocationService.class,
- new WorkbenchLocationService(IServiceScopes.MPESITE_SCOPE,
- getWorkbenchWindow().getWorkbench(),
- getWorkbenchWindow(), getMultiPageEditor().getSite(),
- this, null, 3));
+ new WorkbenchLocationService(IServiceScopes.MPESITE_SCOPE, getWorkbenchWindow().getWorkbench(),
+ getWorkbenchWindow(), getMultiPageEditor().getSite(), this, null, 3));
serviceLocator.registerService(IMultiPageEditorSiteHolder.class,
(IMultiPageEditorSiteHolder) () -> MultiPageEditorSite.this);
@@ -159,8 +152,8 @@ public class MultiPageEditorSite implements IEditorSite, INestable {
@Override
public Object compute(IEclipseContext ctxt, String contextKey) {
if (contextService == null) {
- contextService = new NestableContextService(ctxt.getParent().get(
- IContextService.class), new ActivePartExpression(multiPageEditor));
+ contextService = new NestableContextService(ctxt.getParent().get(IContextService.class),
+ new ActivePartExpression(multiPageEditor));
}
return contextService;
}
@@ -229,8 +222,7 @@ public class MultiPageEditorSite implements IEditorSite, INestable {
// Remove myself from the list of nested key binding services.
if (service != null) {
- IKeyBindingService parentService = getMultiPageEditor().getEditorSite()
- .getKeyBindingService();
+ IKeyBindingService parentService = getMultiPageEditor().getEditorSite().getKeyBindingService();
if (parentService instanceof INestableKeyBindingService) {
INestableKeyBindingService nestableParent = (INestableKeyBindingService) parentService;
nestableParent.removeKeyBindingService(this);
@@ -253,8 +245,8 @@ public class MultiPageEditorSite implements IEditorSite, INestable {
/**
* The <code>MultiPageEditorSite</code> implementation of this
- * <code>IEditorSite</code> method returns <code>null</code>, since
- * nested editors do not have their own action bar contributor.
+ * <code>IEditorSite</code> method returns <code>null</code>, since nested
+ * editors do not have their own action bar contributor.
*
* @return <code>null</code>
*/
@@ -265,8 +257,8 @@ public class MultiPageEditorSite implements IEditorSite, INestable {
/**
* The <code>MultiPageEditorSite</code> implementation of this
- * <code>IEditorSite</code> method forwards to the multi-page editor to
- * return the action bars.
+ * <code>IEditorSite</code> method forwards to the multi-page editor to return
+ * the action bars.
*
* @return The action bars from the parent multi-page editor.
*/
@@ -282,16 +274,15 @@ public class MultiPageEditorSite implements IEditorSite, INestable {
/**
* The <code>MultiPageEditorSite</code> implementation of this
- * <code>IWorkbenchPartSite</code> method forwards to the multi-page
- * editor to return the decorator manager.
+ * <code>IWorkbenchPartSite</code> method forwards to the multi-page editor to
+ * return the decorator manager.
*
* @return The decorator from the workbench window.
* @deprecated use IWorkbench.getDecoratorManager()
*/
@Deprecated
public ILabelDecorator getDecoratorManager() {
- return getWorkbenchWindow().getWorkbench().getDecoratorManager()
- .getLabelDecorator();
+ return getWorkbenchWindow().getWorkbench().getDecoratorManager().getLabelDecorator();
}
/**
@@ -305,8 +296,8 @@ public class MultiPageEditorSite implements IEditorSite, INestable {
/**
* The <code>MultiPageEditorSite</code> implementation of this
- * <code>IWorkbenchPartSite</code> method returns an empty string since
- * the nested editor is not created from the registry.
+ * <code>IWorkbenchPartSite</code> method returns an empty string since the
+ * nested editor is not created from the registry.
*
* @return An empty string.
*/
@@ -318,20 +309,19 @@ public class MultiPageEditorSite implements IEditorSite, INestable {
@Override
public IKeyBindingService getKeyBindingService() {
if (service == null) {
- service = getMultiPageEditor().getEditorSite()
- .getKeyBindingService();
+ service = getMultiPageEditor().getEditorSite().getKeyBindingService();
if (service instanceof INestableKeyBindingService) {
INestableKeyBindingService nestableService = (INestableKeyBindingService) service;
service = nestableService.getKeyBindingService(this);
} else {
/*
- * This is an internal reference, and should not be copied by
- * client code. If you are thinking of copying this, DON'T DO
- * IT.
+ * This is an internal reference, and should not be copied by client code. If
+ * you are thinking of copying this, DON'T DO IT.
*/
- WorkbenchPlugin
- .log("MultiPageEditorSite.getKeyBindingService() Parent key binding service was not an instance of INestableKeyBindingService. It was an instance of " + service.getClass().getName() + " instead."); //$NON-NLS-1$ //$NON-NLS-2$
+ WorkbenchPlugin.log(
+ "MultiPageEditorSite.getKeyBindingService() Parent key binding service was not an instance of INestableKeyBindingService. It was an instance of " //$NON-NLS-1$
+ + service.getClass().getName() + " instead."); //$NON-NLS-1$
}
}
return service;
@@ -348,8 +338,8 @@ public class MultiPageEditorSite implements IEditorSite, INestable {
/**
* The <code>MultiPageEditorSite</code> implementation of this
- * <code>IWorkbenchPartSite</code> method forwards to the multi-page
- * editor to return the workbench page.
+ * <code>IWorkbenchPartSite</code> method forwards to the multi-page editor to
+ * return the workbench page.
*
* @return The workbench page in which this editor site resides.
*/
@@ -365,8 +355,8 @@ public class MultiPageEditorSite implements IEditorSite, INestable {
/**
* The <code>MultiPageEditorSite</code> implementation of this
- * <code>IWorkbenchPartSite</code> method returns an empty string since
- * the nested editor is not created from the registry.
+ * <code>IWorkbenchPartSite</code> method returns an empty string since the
+ * nested editor is not created from the registry.
*
* @return An empty string.
*/
@@ -390,8 +380,8 @@ public class MultiPageEditorSite implements IEditorSite, INestable {
/**
* The <code>MultiPageEditorSite</code> implementation of this
- * <code>IWorkbenchPartSite</code> method returns an empty string since
- * the nested editor is not created from the registry.
+ * <code>IWorkbenchPartSite</code> method returns an empty string since the
+ * nested editor is not created from the registry.
*
* @return An empty string.
*/
@@ -401,8 +391,8 @@ public class MultiPageEditorSite implements IEditorSite, INestable {
}
/**
- * Returns the selection changed listener which listens to the nested
- * editor's selection changes, and calls <code>handleSelectionChanged</code>.
+ * Returns the selection changed listener which listens to the nested editor's
+ * selection changes, and calls <code>handleSelectionChanged</code>.
*
* @return the selection changed listener
*/
@@ -415,8 +405,8 @@ public class MultiPageEditorSite implements IEditorSite, INestable {
/**
* The <code>MultiPageEditorSite</code> implementation of this
- * <code>IWorkbenchPartSite</code> method returns the selection provider
- * set by <code>setSelectionProvider</code>.
+ * <code>IWorkbenchPartSite</code> method returns the selection provider set by
+ * <code>setSelectionProvider</code>.
*
* @return The current selection provider.
*/
@@ -437,8 +427,8 @@ public class MultiPageEditorSite implements IEditorSite, INestable {
/**
* The <code>MultiPageEditorSite</code> implementation of this
- * <code>IWorkbenchPartSite</code> method forwards to the multi-page
- * editor to return the shell.
+ * <code>IWorkbenchPartSite</code> method forwards to the multi-page editor to
+ * return the shell.
*
* @return The shell in which this editor site resides.
*/
@@ -449,8 +439,8 @@ public class MultiPageEditorSite implements IEditorSite, INestable {
/**
* The <code>MultiPageEditorSite</code> implementation of this
- * <code>IWorkbenchPartSite</code> method forwards to the multi-page
- * editor to return the workbench window.
+ * <code>IWorkbenchPartSite</code> method forwards to the multi-page editor to
+ * return the workbench window.
*
* @return The workbench window in which this editor site resides.
*/
@@ -464,16 +454,14 @@ public class MultiPageEditorSite implements IEditorSite, INestable {
* <p>
* Subclasses may extend or reimplement this method
*
- * @param event the event
+ * @param event the event
*
* @since 3.2
*/
protected void handlePostSelectionChanged(SelectionChangedEvent event) {
- ISelectionProvider parentProvider = getMultiPageEditor().getSite()
- .getSelectionProvider();
+ ISelectionProvider parentProvider = getMultiPageEditor().getSite().getSelectionProvider();
if (parentProvider instanceof MultiPageSelectionProvider) {
- SelectionChangedEvent newEvent = new SelectionChangedEvent(
- parentProvider, event.getSelection());
+ SelectionChangedEvent newEvent = new SelectionChangedEvent(parentProvider, event.getSelection());
MultiPageSelectionProvider prov = (MultiPageSelectionProvider) parentProvider;
prov.firePostSelectionChanged(newEvent);
}
@@ -481,23 +469,19 @@ public class MultiPageEditorSite implements IEditorSite, INestable {
/**
* Handles a selection changed event from the nested editor. The default
- * implementation gets the selection provider from the multi-page editor's
- * site, and calls <code>fireSelectionChanged</code> on it (only if it is
- * an instance of <code>MultiPageSelectionProvider</code>), passing a new
- * event object.
+ * implementation gets the selection provider from the multi-page editor's site,
+ * and calls <code>fireSelectionChanged</code> on it (only if it is an instance
+ * of <code>MultiPageSelectionProvider</code>), passing a new event object.
* <p>
* Subclasses may extend or reimplement this method.
* </p>
*
- * @param event
- * the event
+ * @param event the event
*/
protected void handleSelectionChanged(SelectionChangedEvent event) {
- ISelectionProvider parentProvider = getMultiPageEditor().getSite()
- .getSelectionProvider();
+ ISelectionProvider parentProvider = getMultiPageEditor().getSite().getSelectionProvider();
if (parentProvider instanceof MultiPageSelectionProvider) {
- SelectionChangedEvent newEvent = new SelectionChangedEvent(
- parentProvider, event.getSelection());
+ SelectionChangedEvent newEvent = new SelectionChangedEvent(parentProvider, event.getSelection());
MultiPageSelectionProvider prov = (MultiPageSelectionProvider) parentProvider;
prov.fireSelectionChanged(newEvent);
}
@@ -510,72 +494,57 @@ public class MultiPageEditorSite implements IEditorSite, INestable {
/**
* The <code>MultiPageEditorSite</code> implementation of this
- * <code>IWorkbenchPartSite</code> method forwards to the multi-page
- * editor for registration.
+ * <code>IWorkbenchPartSite</code> method forwards to the multi-page editor for
+ * registration.
*
- * @param menuManager
- * The menu manager
- * @param selProvider
- * The selection provider.
+ * @param menuManager The menu manager
+ * @param selProvider The selection provider.
*/
@Override
- public void registerContextMenu(MenuManager menuManager,
- ISelectionProvider selProvider) {
- getMultiPageEditor().getSite().registerContextMenu(menuManager,
- selProvider);
+ public void registerContextMenu(MenuManager menuManager, ISelectionProvider selProvider) {
+ getMultiPageEditor().getSite().registerContextMenu(menuManager, selProvider);
}
@Override
- public final void registerContextMenu(final MenuManager menuManager,
- final ISelectionProvider selectionProvider,
+ public final void registerContextMenu(final MenuManager menuManager, final ISelectionProvider selectionProvider,
final boolean includeEditorInput) {
- registerContextMenu(getId(), menuManager, selectionProvider,
- includeEditorInput);
+ registerContextMenu(getId(), menuManager, selectionProvider, includeEditorInput);
}
/**
* The <code>MultiPageEditorSite</code> implementation of this
- * <code>IWorkbenchPartSite</code> method forwards to the multi-page
- * editor for registration.
+ * <code>IWorkbenchPartSite</code> method forwards to the multi-page editor for
+ * registration.
*
- * @param menuID
- * The identifier for the menu.
- * @param menuMgr
- * The menu manager
- * @param selProvider
- * The selection provider.
+ * @param menuID The identifier for the menu.
+ * @param menuMgr The menu manager
+ * @param selProvider The selection provider.
*/
@Override
- public void registerContextMenu(String menuID, MenuManager menuMgr,
- ISelectionProvider selProvider) {
+ public void registerContextMenu(String menuID, MenuManager menuMgr, ISelectionProvider selProvider) {
if (menuExtenders == null) {
menuExtenders = new ArrayList(1);
}
- PartSite.registerContextMenu(menuID, menuMgr, selProvider, true, editor, context,
- menuExtenders);
+ PartSite.registerContextMenu(menuID, menuMgr, selProvider, true, editor, context, menuExtenders);
}
@Override
- public final void registerContextMenu(final String menuId,
- final MenuManager menuManager,
- final ISelectionProvider selectionProvider,
- final boolean includeEditorInput) {
+ public final void registerContextMenu(final String menuId, final MenuManager menuManager,
+ final ISelectionProvider selectionProvider, final boolean includeEditorInput) {
if (menuExtenders == null) {
menuExtenders = new ArrayList(1);
}
- PartSite.registerContextMenu(menuId, menuManager, selectionProvider, includeEditorInput,
- editor, context, menuExtenders);
+ PartSite.registerContextMenu(menuId, menuManager, selectionProvider, includeEditorInput, editor, context,
+ menuExtenders);
}
/**
* The <code>MultiPageEditorSite</code> implementation of this
- * <code>IWorkbenchPartSite</code> method remembers the selection
- * provider, and also hooks a listener on it, which calls
- * <code>handleSelectionChanged</code> when a selection changed event
- * occurs.
+ * <code>IWorkbenchPartSite</code> method remembers the selection provider, and
+ * also hooks a listener on it, which calls <code>handleSelectionChanged</code>
+ * when a selection changed event occurs.
*
- * @param provider
- * The selection provider.
+ * @param provider The selection provider.
* @see MultiPageEditorSite#handleSelectionChanged(SelectionChangedEvent)
*/
@Override
@@ -583,19 +552,16 @@ public class MultiPageEditorSite implements IEditorSite, INestable {
ISelectionProvider oldSelectionProvider = selectionProvider;
selectionProvider = provider;
if (oldSelectionProvider != null) {
- oldSelectionProvider
- .removeSelectionChangedListener(getSelectionChangedListener());
+ oldSelectionProvider.removeSelectionChangedListener(getSelectionChangedListener());
if (oldSelectionProvider instanceof IPostSelectionProvider) {
((IPostSelectionProvider) oldSelectionProvider)
.removePostSelectionChangedListener(getPostSelectionChangedListener());
} else {
- oldSelectionProvider
- .removeSelectionChangedListener(getPostSelectionChangedListener());
+ oldSelectionProvider.removeSelectionChangedListener(getPostSelectionChangedListener());
}
}
if (selectionProvider != null) {
- selectionProvider
- .addSelectionChangedListener(getSelectionChangedListener());
+ selectionProvider.addSelectionChangedListener(getSelectionChangedListener());
if (selectionProvider instanceof IPostSelectionProvider) {
((IPostSelectionProvider) selectionProvider)
.addPostSelectionChangedListener(getPostSelectionChangedListener());
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageSelectionProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageSelectionProvider.java
index 228c4d03dce..b248c9fdfc9 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageSelectionProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageSelectionProvider.java
@@ -30,137 +30,138 @@ import org.eclipse.ui.IEditorPart;
* nested editor within the multi-page editor. When the selection changes,
* notifications are sent to all registered listeners.
* <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * The base implementation of <code>MultiPageEditor.init</code> creates
- * an instance of this class.
+ * This class may be instantiated; it is not intended to be subclassed. The base
+ * implementation of <code>MultiPageEditor.init</code> creates an instance of
+ * this class.
* </p>
+ *
* @noextend This class is not intended to be subclassed by clients.
*/
public class MultiPageSelectionProvider implements IPostSelectionProvider {
- /**
- * Registered selection changed listeners (element type:
- * <code>ISelectionChangedListener</code>).
- */
+ /**
+ * Registered selection changed listeners (element type:
+ * <code>ISelectionChangedListener</code>).
+ */
private ListenerList<ISelectionChangedListener> listeners = new ListenerList<>();
- /**
- * Registered post selection changed listeners.
- */
+ /**
+ * Registered post selection changed listeners.
+ */
private ListenerList<ISelectionChangedListener> postListeners = new ListenerList<>();
- /**
- * The multi-page editor.
- */
- private MultiPageEditorPart multiPageEditor;
-
- /**
- * Creates a selection provider for the given multi-page editor.
- *
- * @param multiPageEditor the multi-page editor
- */
- public MultiPageSelectionProvider(MultiPageEditorPart multiPageEditor) {
- Assert.isNotNull(multiPageEditor);
- this.multiPageEditor = multiPageEditor;
- }
-
- @Override
+ /**
+ * The multi-page editor.
+ */
+ private MultiPageEditorPart multiPageEditor;
+
+ /**
+ * Creates a selection provider for the given multi-page editor.
+ *
+ * @param multiPageEditor the multi-page editor
+ */
+ public MultiPageSelectionProvider(MultiPageEditorPart multiPageEditor) {
+ Assert.isNotNull(multiPageEditor);
+ this.multiPageEditor = multiPageEditor;
+ }
+
+ @Override
public void addSelectionChangedListener(ISelectionChangedListener listener) {
- listeners.add(listener);
- }
-
- /**
- * Adds a listener for post selection changes in this multi page selection provider.
- *
- * @param listener a selection changed listener
- * @since 3.2
- */
- @Override
+ listeners.add(listener);
+ }
+
+ /**
+ * Adds a listener for post selection changes in this multi page selection
+ * provider.
+ *
+ * @param listener a selection changed listener
+ * @since 3.2
+ */
+ @Override
public void addPostSelectionChangedListener(ISelectionChangedListener listener) {
- postListeners.add(listener);
+ postListeners.add(listener);
}
/**
- * Notifies all registered selection changed listeners that the editor's
- * selection has changed. Only listeners registered at the time this method is
- * called are notified.
- *
- * @param event the selection changed event
- */
- public void fireSelectionChanged(final SelectionChangedEvent event) {
- fireEventChange(event, listeners);
- }
-
- /**
- * Notifies all post selection changed listeners that the editor's
- * selection has changed.
- *
- * @param event the event to propogate.
- * @since 3.2
- */
- public void firePostSelectionChanged(final SelectionChangedEvent event) {
+ * Notifies all registered selection changed listeners that the editor's
+ * selection has changed. Only listeners registered at the time this method is
+ * called are notified.
+ *
+ * @param event the selection changed event
+ */
+ public void fireSelectionChanged(final SelectionChangedEvent event) {
+ fireEventChange(event, listeners);
+ }
+
+ /**
+ * Notifies all post selection changed listeners that the editor's selection has
+ * changed.
+ *
+ * @param event the event to propogate.
+ * @since 3.2
+ */
+ public void firePostSelectionChanged(final SelectionChangedEvent event) {
fireEventChange(event, postListeners);
}
private void fireEventChange(final SelectionChangedEvent event,
ListenerList<ISelectionChangedListener> listenersList) {
for (final ISelectionChangedListener l : listenersList) {
- SafeRunner.run(new SafeRunnable() {
- @Override
+ SafeRunner.run(new SafeRunnable() {
+ @Override
public void run() {
- l.selectionChanged(event);
- }
- });
- }
+ l.selectionChanged(event);
+ }
+ });
+ }
}
- /**
+ /**
* Returns the multi-page editor.
+ *
* @return the multi-page editor.
*/
- public MultiPageEditorPart getMultiPageEditor() {
- return multiPageEditor;
- }
+ public MultiPageEditorPart getMultiPageEditor() {
+ return multiPageEditor;
+ }
- @Override
+ @Override
public ISelection getSelection() {
- IEditorPart activeEditor = multiPageEditor.getActiveEditor();
- if (activeEditor != null) {
- ISelectionProvider selectionProvider = activeEditor.getSite()
- .getSelectionProvider();
- if (selectionProvider != null) {
+ IEditorPart activeEditor = multiPageEditor.getActiveEditor();
+ if (activeEditor != null) {
+ ISelectionProvider selectionProvider = activeEditor.getSite().getSelectionProvider();
+ if (selectionProvider != null) {
return selectionProvider.getSelection();
}
- }
- return StructuredSelection.EMPTY;
- }
-
- @Override
- public void removeSelectionChangedListener(
- ISelectionChangedListener listener) {
- listeners.remove(listener);
- }
-
- /**
- * Removes a listener for post selection changes in this multi page selection provider.
- *
- * @param listener a selection changed listener
- * @since 3.2
- */
- @Override
+ }
+ return StructuredSelection.EMPTY;
+ }
+
+ @Override
+ public void removeSelectionChangedListener(ISelectionChangedListener listener) {
+ listeners.remove(listener);
+ }
+
+ /**
+ * Removes a listener for post selection changes in this multi page selection
+ * provider.
+ *
+ * @param listener a selection changed listener
+ * @since 3.2
+ */
+ @Override
public void removePostSelectionChangedListener(ISelectionChangedListener listener) {
- postListeners.remove(listener);
+ postListeners.remove(listener);
}
- @Override
+ @Override
public void setSelection(ISelection selection) {
- IEditorPart activeEditor = multiPageEditor.getActiveEditor();
- if (activeEditor != null) {
- ISelectionProvider selectionProvider = activeEditor.getSite()
- .getSelectionProvider();
- if (selectionProvider != null) {
+ IEditorPart activeEditor = multiPageEditor.getActiveEditor();
+ if (activeEditor != null) {
+ ISelectionProvider selectionProvider = activeEditor.getSite().getSelectionProvider();
+ if (selectionProvider != null) {
selectionProvider.setSelection(selection);
}
- }
- }
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/Page.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/Page.java
index 302dc42353d..23ff36f15b4 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/Page.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/Page.java
@@ -50,88 +50,88 @@ import org.eclipse.ui.IActionBars;
* @see PageBookView
*/
public abstract class Page implements IPageBookViewPage {
- /**
- * The site which contains this page
- */
- private IPageSite site;
+ /**
+ * The site which contains this page
+ */
+ private IPageSite site;
- /*
- * Creates a new page for a pagebook view.
- */
- protected Page() {
- }
+ /*
+ * Creates a new page for a pagebook view.
+ */
+ protected Page() {
+ }
- @Override
+ @Override
public abstract void createControl(Composite parent);
- /**
- * The <code>Page</code> implementation of this <code>IPage</code> method
- * disposes of this page's control (if it has one and it has not already
- * been disposed). Subclasses may extend.
- */
- @Override
+ /**
+ * The <code>Page</code> implementation of this <code>IPage</code> method
+ * disposes of this page's control (if it has one and it has not already been
+ * disposed). Subclasses may extend.
+ */
+ @Override
public void dispose() {
- Control ctrl = getControl();
- if (ctrl != null && !ctrl.isDisposed()) {
+ Control ctrl = getControl();
+ if (ctrl != null && !ctrl.isDisposed()) {
ctrl.dispose();
}
site = null;
- }
+ }
- /**
- * The <code>Page</code> implementation of this <code>IPage</code> method returns
- * <code>null</code>. Subclasses must reimplement.
- */
- @Override
- public abstract Control getControl();
+ /**
+ * The <code>Page</code> implementation of this <code>IPage</code> method
+ * returns <code>null</code>. Subclasses must reimplement.
+ */
+ @Override
+ public abstract Control getControl();
- /**
- * This method exists for backward compatibility. Subclasses should
- * reimplement <code>init</code>.
+ /**
+ * This method exists for backward compatibility. Subclasses should reimplement
+ * <code>init</code>.
*/
- public void makeContributions(IMenuManager menuManager,
- IToolBarManager toolBarManager, IStatusLineManager statusLineManager) {
- }
+ public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager,
+ IStatusLineManager statusLineManager) {
+ }
- /**
- * This method exists for backward compatibility. Subclasses should
- * reimplement <code>init</code>.
+ /**
+ * This method exists for backward compatibility. Subclasses should reimplement
+ * <code>init</code>.
*/
- @Override
- public void setActionBars(IActionBars actionBars) {
- makeContributions(actionBars.getMenuManager(), actionBars
- .getToolBarManager(), actionBars.getStatusLineManager());
- }
+ @Override
+ public void setActionBars(IActionBars actionBars) {
+ makeContributions(actionBars.getMenuManager(), actionBars.getToolBarManager(),
+ actionBars.getStatusLineManager());
+ }
- /**
- * The <code>Page</code> implementation of this <code>IPageBookViewPage</code> method
- * stores a reference to the supplied site (the site which contains this
- * page).
- * <p>
- * Subclasses may extend.
- * </p>
- *
- * @since 2.0
- */
- @Override
- public void init(IPageSite pageSite) {
- site = pageSite;
- }
+ /**
+ * The <code>Page</code> implementation of this <code>IPageBookViewPage</code>
+ * method stores a reference to the supplied site (the site which contains this
+ * page).
+ * <p>
+ * Subclasses may extend.
+ * </p>
+ *
+ * @since 2.0
+ */
+ @Override
+ public void init(IPageSite pageSite) {
+ site = pageSite;
+ }
- /**
- * Returns the site which contains this page.
- *
- * @return the site which contains this page
- */
- @Override
- public IPageSite getSite() {
- return site;
- }
+ /**
+ * Returns the site which contains this page.
+ *
+ * @return the site which contains this page
+ */
+ @Override
+ public IPageSite getSite() {
+ return site;
+ }
- /**
- * The <code>Page</code> implementation of this <code>IPage</code> method
- * does nothing. Subclasses must implement.
- */
- @Override
+ /**
+ * The <code>Page</code> implementation of this <code>IPage</code> method does
+ * nothing. Subclasses must implement.
+ */
+ @Override
public abstract void setFocus();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PageBook.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PageBook.java
index 4cf2935fec3..55ea268a6d8 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PageBook.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PageBook.java
@@ -20,14 +20,14 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Layout;
/**
- * A pagebook is a composite control where only a single control is visible
- * at a time. It is similar to a notebook, but without tabs.
+ * A pagebook is a composite control where only a single control is visible at a
+ * time. It is similar to a notebook, but without tabs.
* <p>
* This class may be instantiated; it is not intended to be subclassed.
* </p>
* <p>
- * Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to set a layout on it.
+ * Note that although this class is a subclass of <code>Composite</code>, it
+ * does not make sense to set a layout on it.
* </p>
*
* @see PageBookView
@@ -35,75 +35,74 @@ import org.eclipse.swt.widgets.Layout;
*/
public class PageBook extends Composite {
- /**
- * <p>
- * [Issue: This class should be declared private.]
- * </p>
- */
- public class PageBookLayout extends Layout {
+ /**
+ * <p>
+ * [Issue: This class should be declared private.]
+ * </p>
+ */
+ public class PageBookLayout extends Layout {
- @Override
- protected Point computeSize(Composite composite, int wHint, int hHint,
- boolean flushCache) {
- if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT) {
+ @Override
+ protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) {
+ if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT) {
return new Point(wHint, hHint);
}
- Point result = null;
+ Point result = null;
if (currentPage != null && !currentPage.isDisposed()) {
- result = currentPage.computeSize(wHint, hHint, flushCache);
- } else {
- //Rectangle rect= composite.getClientArea();
- //result= new Point(rect.width, rect.height);
- result = new Point(0, 0);
- }
- if (wHint != SWT.DEFAULT) {
+ result = currentPage.computeSize(wHint, hHint, flushCache);
+ } else {
+ // Rectangle rect= composite.getClientArea();
+ // result= new Point(rect.width, rect.height);
+ result = new Point(0, 0);
+ }
+ if (wHint != SWT.DEFAULT) {
result.x = wHint;
}
- if (hHint != SWT.DEFAULT) {
+ if (hHint != SWT.DEFAULT) {
result.y = hHint;
}
- return result;
- }
+ return result;
+ }
- @Override
+ @Override
protected void layout(Composite composite, boolean flushCache) {
if (currentPage != null && !currentPage.isDisposed()) {
- currentPage.setBounds(composite.getClientArea());
- }
- }
- }
+ currentPage.setBounds(composite.getClientArea());
+ }
+ }
+ }
- /**
- * The current control; <code>null</code> if none.
- */
- private Control currentPage = null;
+ /**
+ * The current control; <code>null</code> if none.
+ */
+ private Control currentPage = null;
- /**
- * Creates a new empty pagebook.
- *
- * @param parent the parent composite
- * @param style the SWT style bits
- */
- public PageBook(Composite parent, int style) {
- super(parent, style);
- setLayout(new PageBookLayout());
- }
+ /**
+ * Creates a new empty pagebook.
+ *
+ * @param parent the parent composite
+ * @param style the SWT style bits
+ */
+ public PageBook(Composite parent, int style) {
+ super(parent, style);
+ setLayout(new PageBookLayout());
+ }
- /**
- * Shows the given page. This method has no effect if the given page is not
- * contained in this pagebook.
- *
- * @param page the page to show
- */
- public void showPage(Control page) {
+ /**
+ * Shows the given page. This method has no effect if the given page is not
+ * contained in this pagebook.
+ *
+ * @param page the page to show
+ */
+ public void showPage(Control page) {
if (page.isDisposed() || page.getParent() != this) {
return;
}
currentPage = page;
- // show new page
+ // show new page
page.setVisible(true);
layout(true);
@@ -114,5 +113,5 @@ public class PageBook extends Composite {
child.setVisible(false);
}
}
- }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PageBookView.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PageBookView.java
index 9d7a92a1cad..a416ebba578 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PageBookView.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PageBookView.java
@@ -117,14 +117,14 @@ public abstract class PageBookView extends ViewPart implements IPartListener {
private PageRec defaultPageRec;
/**
- * Map from parts to part records (key type: <code>IWorkbenchPart</code>;
- * value type: <code>PartRec</code>).
+ * Map from parts to part records (key type: <code>IWorkbenchPart</code>; value
+ * type: <code>PartRec</code>).
*/
private final Map<IWorkbenchPart, PageRec> mapPartToRec = new HashMap<>();
/**
- * Map from pages to view sites Note that view sites were not added to page
- * recs to avoid breaking binary compatibility with previous builds
+ * Map from pages to view sites Note that view sites were not added to page recs
+ * to avoid breaking binary compatibility with previous builds
*/
private final Map<IPage, IPageSite> mapPageToSite = new HashMap<>();
@@ -139,8 +139,8 @@ public abstract class PageBookView extends ViewPart implements IPartListener {
private PageRec activeRec;
/**
- * If the part is hidden (usually an editor) then store it so we can
- * continue to track it when it becomes visible.
+ * If the part is hidden (usually an editor) then store it so we can continue to
+ * track it when it becomes visible.
*/
private IWorkbenchPart hiddenPart;
@@ -148,8 +148,7 @@ public abstract class PageBookView extends ViewPart implements IPartListener {
* The action bar property listener.
*/
private IPropertyChangeListener actionBarPropListener = event -> {
- if (event.getProperty().equals(SubActionBars.P_ACTION_HANDLERS)
- && activeRec != null
+ if (event.getProperty().equals(SubActionBars.P_ACTION_HANDLERS) && activeRec != null
&& event.getSource() == activeRec.subActionBars) {
refreshGlobalActionHandlers();
}
@@ -171,8 +170,8 @@ public abstract class PageBookView extends ViewPart implements IPartListener {
private SelectionProvider selectionProvider = new SelectionProvider();
/**
- * A data structure used to store the information about a single page within
- * a pagebook view.
+ * A data structure used to store the information about a single page within a
+ * pagebook view.
*/
protected static class PageRec {
@@ -214,8 +213,7 @@ public abstract class PageBookView extends ViewPart implements IPartListener {
private static class SelectionManager extends EventManager {
/**
*
- * @param listener
- * listen
+ * @param listener listen
*/
public void addSelectionChangedListener(ISelectionChangedListener listener) {
addListenerObject(listener);
@@ -223,8 +221,7 @@ public abstract class PageBookView extends ViewPart implements IPartListener {
/**
*
- * @param listener
- * listen
+ * @param listener listen
*/
public void removeSelectionChangedListener(ISelectionChangedListener listener) {
removeListenerObject(listener);
@@ -232,8 +229,7 @@ public abstract class PageBookView extends ViewPart implements IPartListener {
/**
*
- * @param event
- * the event
+ * @param event the event
*/
public void selectionChanged(final SelectionChangedEvent event) {
// pass on the notification to listeners
@@ -251,8 +247,8 @@ public abstract class PageBookView extends ViewPart implements IPartListener {
}
/**
- * A selection provider/listener for this view. It is a selection provider
- * for this view's site.
+ * A selection provider/listener for this view. It is a selection provider for
+ * this view's site.
*/
protected class SelectionProvider implements IPostSelectionProvider {
@@ -291,11 +287,10 @@ public abstract class PageBookView extends ViewPart implements IPartListener {
}
/**
- * The selection has changed. Process the event, notifying selection
- * listeners and post selection listeners.
+ * The selection has changed. Process the event, notifying selection listeners
+ * and post selection listeners.
*
- * @param event
- * the change
+ * @param event the change
*/
public void selectionChanged(final SelectionChangedEvent event) {
fSelectionListener.selectionChanged(event);
@@ -304,8 +299,7 @@ public abstract class PageBookView extends ViewPart implements IPartListener {
/**
* The selection has changed, so notify any post-selection listeners.
*
- * @param event
- * the change
+ * @param event the change
*/
public void postSelectionChanged(final SelectionChangedEvent event) {
fPostSelectionListeners.selectionChanged(event);
@@ -356,22 +350,19 @@ public abstract class PageBookView extends ViewPart implements IPartListener {
* </p>
* <p>
* Subclasses must call initPage with the new page (if it is an
- * <code>IPageBookViewPage</code>) before calling createControl on the
- * page.
+ * <code>IPageBookViewPage</code>) before calling createControl on the page.
* </p>
*
- * @param book
- * the pagebook control
+ * @param book the pagebook control
* @return the default page
*/
protected abstract IPage createDefaultPage(PageBook book);
/**
- * Creates a page for a given part. Adds it to the pagebook but does not
- * show it.
+ * Creates a page for a given part. Adds it to the pagebook but does not show
+ * it.
*
- * @param part
- * The part we are making a page for.
+ * @param part The part we are making a page for.
* @return IWorkbenchPart
*/
private PageRec createPage(IWorkbenchPart part) {
@@ -427,8 +418,7 @@ public abstract class PageBookView extends ViewPart implements IPartListener {
* Subclasses may override
* </p>
*
- * @param page
- * The page to initialize
+ * @param page The page to initialize
*/
protected void initPage(IPageBookViewPage page) {
try {
@@ -440,8 +430,8 @@ public abstract class PageBookView extends ViewPart implements IPartListener {
/**
* The <code>PageBookView</code> implementation of this
- * <code>IWorkbenchPart</code> method creates a <code>PageBook</code>
- * control with its default page showing. Subclasses may extend.
+ * <code>IWorkbenchPart</code> method creates a <code>PageBook</code> control
+ * with its default page showing. Subclasses may extend.
*/
@Override
public void createPartControl(Composite parent) {
@@ -464,8 +454,8 @@ public abstract class PageBookView extends ViewPart implements IPartListener {
/**
* The <code>PageBookView</code> implementation of this
- * <code>IWorkbenchPart</code> method cleans up all the pages. Subclasses
- * may extend.
+ * <code>IWorkbenchPart</code> method cleans up all the pages. Subclasses may
+ * extend.
*/
@Override
public void dispose() {
@@ -481,7 +471,8 @@ public abstract class PageBookView extends ViewPart implements IPartListener {
defaultPageRec = null;
}
@SuppressWarnings("unchecked")
- Map<IWorkbenchPart, PageRec> clone = (Map<IWorkbenchPart, PageRec>) ((HashMap<IWorkbenchPart, PageRec>) mapPartToRec).clone();
+ Map<IWorkbenchPart, PageRec> clone = (Map<IWorkbenchPart, PageRec>) ((HashMap<IWorkbenchPart, PageRec>) mapPartToRec)
+ .clone();
clone.values().forEach(rec -> removePage(rec, true));
// Run super.
@@ -489,46 +480,40 @@ public abstract class PageBookView extends ViewPart implements IPartListener {
}
/**
- * Creates a new page in the pagebook for a particular part. This page will
- * be made visible whenever the part is active, and will be destroyed with a
- * call to <code>doDestroyPage</code>.
+ * Creates a new page in the pagebook for a particular part. This page will be
+ * made visible whenever the part is active, and will be destroyed with a call
+ * to <code>doDestroyPage</code>.
* <p>
* Subclasses must implement this method.
* </p>
* <p>
* Subclasses must call initPage with the new page (if it is an
- * <code>IPageBookViewPage</code>) before calling createControl on the
- * page.
+ * <code>IPageBookViewPage</code>) before calling createControl on the page.
* </p>
*
- * @param part
- * the input part
+ * @param part the input part
* @return the record describing a new page for this view
* @see #doDestroyPage
*/
protected abstract PageRec doCreatePage(IWorkbenchPart part);
/**
- * Destroys a page in the pagebook for a particular part. This page was
- * returned as a result from <code>doCreatePage</code>.
+ * Destroys a page in the pagebook for a particular part. This page was returned
+ * as a result from <code>doCreatePage</code>.
* <p>
* Subclasses must implement this method.
* </p>
*
- * @param part
- * the input part
- * @param pageRecord
- * a page record for the part
+ * @param part the input part
+ * @param pageRecord a page record for the part
* @see #doCreatePage
*/
- protected abstract void doDestroyPage(IWorkbenchPart part,
- PageRec pageRecord);
+ protected abstract void doDestroyPage(IWorkbenchPart part, PageRec pageRecord);
/**
* Returns true if the page has already been created.
*
- * @param page
- * the page to test
+ * @param page the page to test
* @return true if this page has already been created.
*/
protected boolean doesPageExist(IPage page) {
@@ -536,9 +521,9 @@ public abstract class PageBookView extends ViewPart implements IPartListener {
}
/**
- * The <code>PageBookView</code> implementation of this
- * <code>IAdaptable</code> method delegates to the current page, if it
- * implements <code>IAdaptable</code>.
+ * The <code>PageBookView</code> implementation of this <code>IAdaptable</code>
+ * method delegates to the current page, if it implements
+ * <code>IAdaptable</code>.
*/
@Override
public <T> T getAdapter(Class<T> key) {
@@ -559,18 +544,17 @@ public abstract class PageBookView extends ViewPart implements IPartListener {
}
/**
- * Returns an adapter of the specified type, as provided by this view (not
- * the current page), or <code>null</code> if this view does not provide
- * an adapter of the specified adapter.
+ * Returns an adapter of the specified type, as provided by this view (not the
+ * current page), or <code>null</code> if this view does not provide an adapter
+ * of the specified adapter.
* <p>
* The default implementation returns <code>null</code>. Subclasses may
* override.
* </p>
*
- * @param adapter
- * the adapter class to look up
- * @return a object castable to the given class, or <code>null</code> if
- * this object does not have an adapter for the given class
+ * @param adapter the adapter class to look up
+ * @return a object castable to the given class, or <code>null</code> if this
+ * object does not have an adapter for the given class
* @since 3.2
*/
protected <T> T getViewAdapter(Class<T> adapter) {
@@ -581,12 +565,12 @@ public abstract class PageBookView extends ViewPart implements IPartListener {
* Returns the active, important workbench part for this view.
* <p>
* When the page book view is created it has no idea which part within the
- * workbook should be used to generate the first page. Therefore, it
- * delegates the choice to subclasses of <code>PageBookView</code>.
+ * workbook should be used to generate the first page. Therefore, it delegates
+ * the choice to subclasses of <code>PageBookView</code>.
* </p>
* <p>
- * Implementors of this method should return an active, important part in
- * the workbench or <code>null</code> if none found.
+ * Implementors of this method should return an active, important part in the
+ * workbench or <code>null</code> if none found.
* </p>
* <p>
* Subclasses must implement this method.
@@ -599,8 +583,8 @@ public abstract class PageBookView extends ViewPart implements IPartListener {
/**
* Returns the part which contributed the current page to this view.
*
- * @return the part which contributed the current page or <code>null</code>
- * if no part contributed the current page
+ * @return the part which contributed the current page or <code>null</code> if
+ * no part contributed the current page
*/
protected IWorkbenchPart getCurrentContributingPart() {
if (activeRec == null) {
@@ -610,8 +594,8 @@ public abstract class PageBookView extends ViewPart implements IPartListener {
}
/**
- * Returns the currently visible page for this view or <code>null</code>
- * if no page is currently visible.
+ * Returns the currently visible page for this view or <code>null</code> if no
+ * page is currently visible.
*
* @return the currently visible page
*/
@@ -625,8 +609,7 @@ public abstract class PageBookView extends ViewPart implements IPartListener {
/**
* Returns the view site for the given page of this view.
*
- * @param page
- * the page
+ * @param page the page
* @return the corresponding site, or <code>null</code> if not found
*/
protected PageSite getPageSite(IPage page) {
@@ -654,10 +637,8 @@ public abstract class PageBookView extends ViewPart implements IPartListener {
/**
* Returns the page record for the given part.
*
- * @param part
- * the part
- * @return the corresponding page record, or <code>null</code> if not
- * found
+ * @param part the part
+ * @return the corresponding page record, or <code>null</code> if not found
*/
protected PageRec getPageRec(IWorkbenchPart part) {
return mapPartToRec.get(part);
@@ -666,10 +647,8 @@ public abstract class PageBookView extends ViewPart implements IPartListener {
/**
* Returns the page record for the given page of this view.
*
- * @param page
- * the page
- * @return the corresponding page record, or <code>null</code> if not
- * found
+ * @param page the page
+ * @return the corresponding page record, or <code>null</code> if not found
*/
protected PageRec getPageRec(IPage page) {
Iterator<PageRec> itr = mapPartToRec.values().iterator();
@@ -688,10 +667,9 @@ public abstract class PageBookView extends ViewPart implements IPartListener {
* Subclasses must implement this method.
* </p>
*
- * @param part
- * the input part
- * @return <code>true</code> if the part is relevant, and
- * <code>false</code> otherwise
+ * @param part the input part
+ * @return <code>true</code> if the part is relevant, and <code>false</code>
+ * otherwise
*/
protected abstract boolean isImportant(IWorkbenchPart part);
@@ -749,8 +727,8 @@ public abstract class PageBookView extends ViewPart implements IPartListener {
/**
* The <code>PageBookView</code> implementation of this
- * <code>IPartListener</code> method deal with the closing of the active
- * part. Subclasses may extend.
+ * <code>IPartListener</code> method deal with the closing of the active part.
+ * Subclasses may extend.
*/
@Override
public void partClosed(IWorkbenchPart part) {
@@ -800,13 +778,12 @@ public abstract class PageBookView extends ViewPart implements IPartListener {
}
/**
- * Removes a page record. If it is the last reference to the page dispose of
- * it - otherwise just decrement the reference count.
+ * Removes a page record. If it is the last reference to the page dispose of it
+ * - otherwise just decrement the reference count.
*
* @param rec
- * @param doDestroy
- * if <code>true</code>, also call
- * {@link #doDestroyPage(IWorkbenchPart, PageRec)}
+ * @param doDestroy if <code>true</code>, also call
+ * {@link #doDestroyPage(IWorkbenchPart, PageRec)}
*/
private void removePage(PageRec rec, boolean doDestroy) {
mapPartToRec.remove(rec.part);
@@ -895,16 +872,15 @@ public abstract class PageBookView extends ViewPart implements IPartListener {
}
/**
- * Shows page contained in the given page record in this view. The page
- * record must be one from this pagebook view.
+ * Shows page contained in the given page record in this view. The page record
+ * must be one from this pagebook view.
* <p>
- * The <code>PageBookView</code> implementation of this method asks the
- * pagebook control to show the given page's control, and records that the
- * given page is now current. Subclasses may extend.
+ * The <code>PageBookView</code> implementation of this method asks the pagebook
+ * control to show the given page's control, and records that the given page is
+ * now current. Subclasses may extend.
* </p>
*
- * @param pageRec
- * the page record containing the page to show
+ * @param pageRec the page record containing the page to show
*/
protected void showPageRec(PageRec pageRec) {
// If already showing do nothing
@@ -992,8 +968,7 @@ public abstract class PageBookView extends ViewPart implements IPartListener {
/**
* Extra diagnostic report for bug 453151
*
- * @param pr
- * the record for which we don't know the pageSite anymore
+ * @param pr the record for which we don't know the pageSite anymore
*/
private void reportNullPageSiteOnDeactivate(PageRec pr) {
IPage page = pr.page;
@@ -1068,6 +1043,7 @@ public abstract class PageBookView extends ViewPart implements IPartListener {
/**
* Make sure that the part is not considered if it is hidden.
+ *
* @param part
* @since 3.5
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PageSite.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PageSite.java
index b6ac9b973d4..d49bd4bfa70 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PageSite.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PageSite.java
@@ -46,8 +46,8 @@ import org.eclipse.ui.services.IServiceScopes;
/**
* This implementation of <code>IPageSite</code> provides a site for a page
- * within a <code>PageBookView</code>. Most methods are forwarded to the
- * view's site.
+ * within a <code>PageBookView</code>. Most methods are forwarded to the view's
+ * site.
*/
public class PageSite implements IPageSite, INestable {
@@ -62,8 +62,7 @@ public class PageSite implements IPageSite, INestable {
private IViewSite parentSite;
/**
- * A selection provider set by the page. Value is <code>null</code> until
- * set.
+ * A selection provider set by the page. Value is <code>null</code> until set.
*/
private ISelectionProvider selectionProvider;
@@ -87,8 +86,7 @@ public class PageSite implements IPageSite, INestable {
/**
* Creates a new sub view site of the given parent view site.
*
- * @param parentViewSite
- * the parent view site
+ * @param parentViewSite the parent view site
*/
public PageSite(final IViewSite parentViewSite) {
Assert.isNotNull(parentViewSite);
@@ -96,18 +94,16 @@ public class PageSite implements IPageSite, INestable {
subActionBars = new SubActionBars(parentViewSite.getActionBars(), this);
// Initialize the service locator.
- IServiceLocatorCreator slc = parentSite
- .getService(IServiceLocatorCreator.class);
+ IServiceLocatorCreator slc = parentSite.getService(IServiceLocatorCreator.class);
e4Context = ((PartSite) parentViewSite).getContext().createChild("PageSite"); //$NON-NLS-1$
- this.serviceLocator = (ServiceLocator) slc.createServiceLocator(parentViewSite, null,
- () -> {
- // final Control control =
- // ((PartSite)parentViewSite).getPane().getControl();
- // if (control != null && !control.isDisposed()) {
- // ((PartSite)parentViewSite).getPane().doHide();
- // }
- // TODO compat: not tsure what this should do
- }, e4Context);
+ this.serviceLocator = (ServiceLocator) slc.createServiceLocator(parentViewSite, null, () -> {
+ // final Control control =
+ // ((PartSite)parentViewSite).getPane().getControl();
+ // if (control != null && !control.isDisposed()) {
+ // ((PartSite)parentViewSite).getPane().doHide();
+ // }
+ // TODO compat: not tsure what this should do
+ }, e4Context);
initializeDefaultServices();
}
@@ -116,11 +112,9 @@ public class PageSite implements IPageSite, INestable {
*/
private void initializeDefaultServices() {
serviceLocator.registerService(IWorkbenchLocationService.class,
- new WorkbenchLocationService(IServiceScopes.PAGESITE_SCOPE,
- getWorkbenchWindow().getWorkbench(),
+ new WorkbenchLocationService(IServiceScopes.PAGESITE_SCOPE, getWorkbenchWindow().getWorkbench(),
getWorkbenchWindow(), parentSite, null, this, 3));
- serviceLocator.registerService(IPageSiteHolder.class,
- (IPageSiteHolder) () -> PageSite.this);
+ serviceLocator.registerService(IPageSiteHolder.class, (IPageSiteHolder) () -> PageSite.this);
// create a local handler service so that when this page
// activates/deactivates, its handlers will also be taken into/out of
@@ -132,8 +126,8 @@ public class PageSite implements IPageSite, INestable {
@Override
public Object compute(IEclipseContext context, String contextKey) {
if (contextService == null) {
- contextService = new NestableContextService(context.getParent().get(
- IContextService.class), new ActivePartExpression(parentSite.getPart()));
+ contextService = new NestableContextService(context.getParent().get(IContextService.class),
+ new ActivePartExpression(parentSite.getPart()));
}
return contextService;
}
@@ -151,9 +145,8 @@ public class PageSite implements IPageSite, INestable {
managers.add(ext.getManager());
ext.dispose();
}
- if (managers.size()>0) {
- for (Iterator iterator = managers.iterator(); iterator
- .hasNext();) {
+ if (managers.size() > 0) {
+ for (Iterator iterator = managers.iterator(); iterator.hasNext();) {
MenuManager mgr = (MenuManager) iterator.next();
mgr.dispose();
}
@@ -171,8 +164,8 @@ public class PageSite implements IPageSite, INestable {
}
/**
- * The PageSite implementation of this <code>IPageSite</code> method
- * returns the <code>SubActionBars</code> for this site.
+ * The PageSite implementation of this <code>IPageSite</code> method returns the
+ * <code>SubActionBars</code> for this site.
*
* @return the subactionbars for this site
*/
@@ -221,13 +214,12 @@ public class PageSite implements IPageSite, INestable {
}
@Override
- public void registerContextMenu(String menuID, MenuManager menuMgr,
- ISelectionProvider selProvider) {
+ public void registerContextMenu(String menuID, MenuManager menuMgr, ISelectionProvider selProvider) {
if (menuExtenders == null) {
menuExtenders = new ArrayList(1);
}
- PartSite.registerContextMenu(menuID, menuMgr, selProvider, false, parentSite.getPart(),
- e4Context, menuExtenders);
+ PartSite.registerContextMenu(menuID, menuMgr, selProvider, false, parentSite.getPart(), e4Context,
+ menuExtenders);
}
@Override
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PageSwitcher.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PageSwitcher.java
index d865b62b83e..28b0a767400 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PageSwitcher.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PageSwitcher.java
@@ -35,31 +35,25 @@ public abstract class PageSwitcher {
/**
* Register the handlers for page switching with this view or editor.
*
- * @param part
- * The part to register against.
+ * @param part The part to register against.
*/
public PageSwitcher(IWorkbenchPart part) {
- IHandlerService service = part.getSite().getService(
- IHandlerService.class);
+ IHandlerService service = part.getSite().getService(IHandlerService.class);
service.activateHandler(IWorkbenchCommandConstants.NAVIGATE_NEXT_PAGE, new CyclePageHandler(this));
- service.activateHandler(IWorkbenchCommandConstants.NAVIGATE_PREVIOUS_PAGE, new CyclePageHandler(
- this));
+ service.activateHandler(IWorkbenchCommandConstants.NAVIGATE_PREVIOUS_PAGE, new CyclePageHandler(this));
}
/**
- * Displays the given page in the view. The page must already exist in the
- * view.
+ * Displays the given page in the view. The page must already exist in the view.
*
- * @param page
- * the page to display, never <code>null</code>.
+ * @param page the page to display, never <code>null</code>.
*/
public abstract void activatePage(Object page);
/**
* Returns an {@link ImageDescriptor} for the page.
*
- * @param page
- * the page to retrieve an {@link ImageDescriptor}
+ * @param page the page to retrieve an {@link ImageDescriptor}
* @return An {@link ImageDescriptor} for the page, may be <code>null</code>.
*/
public abstract ImageDescriptor getImageDescriptor(Object page);
@@ -67,28 +61,27 @@ public abstract class PageSwitcher {
/**
* Returns a readable name to identify the page.
*
- * @param page
- * the page to get the name
+ * @param page the page to get the name
* @return the name of the page
*/
public abstract String getName(Object page);
/**
- * Returns the pages available in the view. These may be used for populating
- * the pop-up dialog when switching pages. These are the objects that will
- * be used in {@link #activatePage(Object)}.
+ * Returns the pages available in the view. These may be used for populating the
+ * pop-up dialog when switching pages. These are the objects that will be used
+ * in {@link #activatePage(Object)}.
*
* @return an array of pages
*/
public abstract Object[] getPages();
/**
- * Returns the index of the currently active page. The default
- * implementation returns 0. Subclasses can override.
+ * Returns the index of the currently active page. The default implementation
+ * returns 0. Subclasses can override.
*
* @return the 0-based index of the currently active page from
- * {@link #getPages()}, or an arbitrary value if
- * {@link #getPages()} is an empty array.
+ * {@link #getPages()}, or an arbitrary value if {@link #getPages()} is
+ * an empty array.
*/
public int getCurrentPageIndex() {
return 0;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PluginDropAdapter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PluginDropAdapter.java
index 1ae7a3e1e70..d7668c8d262 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PluginDropAdapter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PluginDropAdapter.java
@@ -36,104 +36,98 @@ import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants;
* </p>
*/
public class PluginDropAdapter extends ViewerDropAdapter {
- /**
- * The extension point attribute that defines the drop action class.
- */
- public static final String ATT_CLASS = "class";//$NON-NLS-1$
+ /**
+ * The extension point attribute that defines the drop action class.
+ */
+ public static final String ATT_CLASS = "class";//$NON-NLS-1$
- /**
- * The current transfer data, or <code>null</code> if none.
- */
- private TransferData currentTransfer;
+ /**
+ * The current transfer data, or <code>null</code> if none.
+ */
+ private TransferData currentTransfer;
- /**
- * Creates a plug-in drop adapter for the given viewer.
- *
- * @param viewer the viewer
- */
- public PluginDropAdapter(StructuredViewer viewer) {
- super(viewer);
- }
+ /**
+ * Creates a plug-in drop adapter for the given viewer.
+ *
+ * @param viewer the viewer
+ */
+ public PluginDropAdapter(StructuredViewer viewer) {
+ super(viewer);
+ }
- @Override
+ @Override
public void drop(DropTargetEvent event) {
- try {
- if (PluginTransfer.getInstance().isSupportedType(
- event.currentDataType)) {
- PluginTransferData pluginData = (PluginTransferData) event.data;
- IDropActionDelegate delegate = getPluginAdapter(pluginData);
- if (!delegate.run(pluginData.getData(), getCurrentTarget())) {
- event.detail = DND.DROP_NONE;
- }
- } else {
- super.drop(event);
- }
- } catch (CoreException e) {
- WorkbenchPlugin.log("Drop Failed", e.getStatus());//$NON-NLS-1$
- }
- }
+ try {
+ if (PluginTransfer.getInstance().isSupportedType(event.currentDataType)) {
+ PluginTransferData pluginData = (PluginTransferData) event.data;
+ IDropActionDelegate delegate = getPluginAdapter(pluginData);
+ if (!delegate.run(pluginData.getData(), getCurrentTarget())) {
+ event.detail = DND.DROP_NONE;
+ }
+ } else {
+ super.drop(event);
+ }
+ } catch (CoreException e) {
+ WorkbenchPlugin.log("Drop Failed", e.getStatus());//$NON-NLS-1$
+ }
+ }
- /**
- * Returns the current transfer.
- */
- protected TransferData getCurrentTransfer() {
- return currentTransfer;
- }
+ /**
+ * Returns the current transfer.
+ */
+ protected TransferData getCurrentTransfer() {
+ return currentTransfer;
+ }
- /**
- * Loads the class that will perform the action associated with the given drop
- * data.
- *
- * @param data the drop data
- * @return the viewer drop adapter
- */
- protected static IDropActionDelegate getPluginAdapter(
- PluginTransferData data) throws CoreException {
+ /**
+ * Loads the class that will perform the action associated with the given drop
+ * data.
+ *
+ * @param data the drop data
+ * @return the viewer drop adapter
+ */
+ protected static IDropActionDelegate getPluginAdapter(PluginTransferData data) throws CoreException {
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- String adapterName = data.getExtensionId();
- IExtensionPoint xpt = registry.getExtensionPoint(PlatformUI.PLUGIN_ID,
- IWorkbenchRegistryConstants.PL_DROP_ACTIONS);
- IExtension[] extensions = xpt.getExtensions();
- for (IExtension extension : extensions) {
- IConfigurationElement[] configs = extension.getConfigurationElements();
- if (configs != null && configs.length > 0) {
- for (IConfigurationElement config : configs) {
- String id = config.getAttribute("id");//$NON-NLS-1$
- if (id != null && id.equals(adapterName)) {
- return (IDropActionDelegate) WorkbenchPlugin
- .createExtension(config, ATT_CLASS);
- }
- }
- }
- }
- return null;
- }
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ String adapterName = data.getExtensionId();
+ IExtensionPoint xpt = registry.getExtensionPoint(PlatformUI.PLUGIN_ID,
+ IWorkbenchRegistryConstants.PL_DROP_ACTIONS);
+ IExtension[] extensions = xpt.getExtensions();
+ for (IExtension extension : extensions) {
+ IConfigurationElement[] configs = extension.getConfigurationElements();
+ if (configs != null && configs.length > 0) {
+ for (IConfigurationElement config : configs) {
+ String id = config.getAttribute("id");//$NON-NLS-1$
+ if (id != null && id.equals(adapterName)) {
+ return (IDropActionDelegate) WorkbenchPlugin.createExtension(config, ATT_CLASS);
+ }
+ }
+ }
+ }
+ return null;
+ }
- /**
- * @see ViewerDropAdapter#performDrop
- */
- @Override
+ /**
+ * @see ViewerDropAdapter#performDrop
+ */
+ @Override
public boolean performDrop(Object data) {
- //should never be called, since we override the drop() method.
- return false;
- }
+ // should never be called, since we override the drop() method.
+ return false;
+ }
- /**
- * The <code>PluginDropAdapter</code> implementation of this
- * <code>ViewerDropAdapter</code> method is used to notify the action that some
- * aspect of the drop operation has changed. Subclasses may override.
- */
- @Override
- public boolean validateDrop(Object target, int operation,
- TransferData transferType) {
- currentTransfer = transferType;
- if (currentTransfer != null
- && PluginTransfer.getInstance()
- .isSupportedType(currentTransfer)) {
- //plugin cannot be loaded without the plugin data
- return true;
- }
- return false;
- }
+ /**
+ * The <code>PluginDropAdapter</code> implementation of this
+ * <code>ViewerDropAdapter</code> method is used to notify the action that some
+ * aspect of the drop operation has changed. Subclasses may override.
+ */
+ @Override
+ public boolean validateDrop(Object target, int operation, TransferData transferType) {
+ currentTransfer = transferType;
+ if (currentTransfer != null && PluginTransfer.getInstance().isSupportedType(currentTransfer)) {
+ // plugin cannot be loaded without the plugin data
+ return true;
+ }
+ return false;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PluginTransfer.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PluginTransfer.java
index 09eb5c6e02e..8c7f78eea98 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PluginTransfer.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PluginTransfer.java
@@ -51,75 +51,75 @@ import org.eclipse.ui.internal.WorkbenchPlugin;
*/
public class PluginTransfer extends ByteArrayTransfer {
- private static final String TYPE_NAME = "pluggable-transfer-format";//$NON-NLS-1$
+ private static final String TYPE_NAME = "pluggable-transfer-format";//$NON-NLS-1$
- private static final int TYPEID = registerType(TYPE_NAME);
+ private static final int TYPEID = registerType(TYPE_NAME);
- /**
- * Singleton instance.
- */
- private static PluginTransfer instance = new PluginTransfer();
+ /**
+ * Singleton instance.
+ */
+ private static PluginTransfer instance = new PluginTransfer();
- /**
- * Creates a new transfer object.
- */
- private PluginTransfer() {
- super();
- }
+ /**
+ * Creates a new transfer object.
+ */
+ private PluginTransfer() {
+ super();
+ }
- /**
- * Returns the singleton instance.
- *
- * @return the singleton instance
- */
- public static PluginTransfer getInstance() {
- return instance;
- }
+ /**
+ * Returns the singleton instance.
+ *
+ * @return the singleton instance
+ */
+ public static PluginTransfer getInstance() {
+ return instance;
+ }
- @Override
+ @Override
protected int[] getTypeIds() {
- return new int[] { TYPEID };
- }
+ return new int[] { TYPEID };
+ }
- @Override
+ @Override
protected String[] getTypeNames() {
- return new String[] { TYPE_NAME };
- }
+ return new String[] { TYPE_NAME };
+ }
- @Override
+ @Override
protected void javaToNative(Object data, TransferData transferData) {
- PluginTransferData realData = (PluginTransferData) data;
- if (data == null) {
+ PluginTransferData realData = (PluginTransferData) data;
+ if (data == null) {
return;
}
- try {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- DataOutputStream dataOut = new DataOutputStream(out);
- dataOut.writeUTF(realData.getExtensionId());
- dataOut.writeInt(realData.getData().length);
- dataOut.write(realData.getData());
- dataOut.close();
- super.javaToNative(out.toByteArray(), transferData);
- } catch (IOException e) {
+ try {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ DataOutputStream dataOut = new DataOutputStream(out);
+ dataOut.writeUTF(realData.getExtensionId());
+ dataOut.writeInt(realData.getData().length);
+ dataOut.write(realData.getData());
+ dataOut.close();
+ super.javaToNative(out.toByteArray(), transferData);
+ } catch (IOException e) {
WorkbenchPlugin.log(e);
- }
- }
+ }
+ }
- @Override
+ @Override
protected Object nativeToJava(TransferData transferData) {
- try {
- byte[] bytes = (byte[]) super.nativeToJava(transferData);
- ByteArrayInputStream in = new ByteArrayInputStream(bytes);
- DataInputStream dataIn = new DataInputStream(in);
- String extensionName = dataIn.readUTF();
- int len = dataIn.readInt();
- byte[] pluginData = new byte[len];
- dataIn.readFully(pluginData);
- return new PluginTransferData(extensionName, pluginData);
- } catch (IOException e) {
+ try {
+ byte[] bytes = (byte[]) super.nativeToJava(transferData);
+ ByteArrayInputStream in = new ByteArrayInputStream(bytes);
+ DataInputStream dataIn = new DataInputStream(in);
+ String extensionName = dataIn.readUTF();
+ int len = dataIn.readInt();
+ byte[] pluginData = new byte[len];
+ dataIn.readFully(pluginData);
+ return new PluginTransferData(extensionName, pluginData);
+ } catch (IOException e) {
WorkbenchPlugin.log(e);
- }
- //can't get here
- return null;
- }
+ }
+ // can't get here
+ return null;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PluginTransferData.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PluginTransferData.java
index 5d29ebfce47..94654a4ad9f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PluginTransferData.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PluginTransferData.java
@@ -19,42 +19,43 @@ package org.eclipse.ui.part;
* of bytes. When the drop occurs, the data is interpreted by an action defined
* in the specified extension.
* <p>
- * Clients using PluginTransfer should create an instance to contain the
- * drop data.
+ * Clients using PluginTransfer should create an instance to contain the drop
+ * data.
* </p>
+ *
* @noextend This class is not intended to be subclassed by clients.
*/
public class PluginTransferData {
- String extensionName;
+ String extensionName;
- byte[] transferData;
+ byte[] transferData;
- /**
- * Creates a new record for the given extension id and data.
- *
- * @param extensionId the extension id
- * @param data the data to transfer
- */
- public PluginTransferData(String extensionId, byte[] data) {
- this.extensionName = extensionId;
- this.transferData = data;
- }
+ /**
+ * Creates a new record for the given extension id and data.
+ *
+ * @param extensionId the extension id
+ * @param data the data to transfer
+ */
+ public PluginTransferData(String extensionId, byte[] data) {
+ this.extensionName = extensionId;
+ this.transferData = data;
+ }
- /**
- * Returns the data being transferred.
- *
- * @return the data
- */
- public byte[] getData() {
- return transferData;
- }
+ /**
+ * Returns the data being transferred.
+ *
+ * @return the data
+ */
+ public byte[] getData() {
+ return transferData;
+ }
- /**
- * Returns the id of the extension that will provide the drop action.
- *
- * @return the extension id
- */
- public String getExtensionId() {
- return extensionName;
- }
+ /**
+ * Returns the id of the extension that will provide the drop action.
+ *
+ * @return the extension id
+ */
+ public String getExtensionId() {
+ return extensionName;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/ShowInContext.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/ShowInContext.java
index c6bd698bd59..f68c9d633bb 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/ShowInContext.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/ShowInContext.java
@@ -17,9 +17,8 @@ package org.eclipse.ui.part;
import org.eclipse.jface.viewers.ISelection;
/**
- * Carries the context for the Show In action.
- * The default implementation carries an input and a selection.
- * Subclasses may extend.
+ * Carries the context for the Show In action. The default implementation
+ * carries an input and a selection. Subclasses may extend.
*
* @see IShowInSource
* @see IShowInTarget
@@ -28,56 +27,56 @@ import org.eclipse.jface.viewers.ISelection;
*/
public class ShowInContext {
- private Object input;
+ private Object input;
- private ISelection selection;
+ private ISelection selection;
- /**
- * Constructs a new <code>ShowInContext</code> with the given input and
- * selection.
- *
- * @param input the input or <code>null</code>
- * @param selection the selection or <code>null</code>
- */
- public ShowInContext(Object input, ISelection selection) {
- setInput(input);
- setSelection(selection);
- }
+ /**
+ * Constructs a new <code>ShowInContext</code> with the given input and
+ * selection.
+ *
+ * @param input the input or <code>null</code>
+ * @param selection the selection or <code>null</code>
+ */
+ public ShowInContext(Object input, ISelection selection) {
+ setInput(input);
+ setSelection(selection);
+ }
- /**
- * Returns the input, or <code>null</code> to indicate no input
- *
- * @return the input or <code>null</code>.
- */
- public Object getInput() {
- return input;
- }
+ /**
+ * Returns the input, or <code>null</code> to indicate no input
+ *
+ * @return the input or <code>null</code>.
+ */
+ public Object getInput() {
+ return input;
+ }
- /**
- * Returns the selection, or <code>null</code> to indicate no selection.
- *
- * @return the selection or <code>null</code>
- */
- public ISelection getSelection() {
- return selection;
- }
+ /**
+ * Returns the selection, or <code>null</code> to indicate no selection.
+ *
+ * @return the selection or <code>null</code>
+ */
+ public ISelection getSelection() {
+ return selection;
+ }
- /**
- * Sets the input, or <code>null</code> to indicate no input.
- *
- * @param input the input or <code>null</code>
- */
- public void setInput(Object input) {
- this.input = input;
- }
+ /**
+ * Sets the input, or <code>null</code> to indicate no input.
+ *
+ * @param input the input or <code>null</code>
+ */
+ public void setInput(Object input) {
+ this.input = input;
+ }
- /**
- * Sets the selection, or <code>null</code> to indicate no selection.
- *
- * @param selection the selection or <code>null</code>
- */
- public void setSelection(ISelection selection) {
- this.selection = selection;
- }
+ /**
+ * Sets the selection, or <code>null</code> to indicate no selection.
+ *
+ * @param selection the selection or <code>null</code>
+ */
+ public void setSelection(ISelection selection) {
+ this.selection = selection;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/ViewPart.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/ViewPart.java
index e5f64045dda..2eef2f2c6ee 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/ViewPart.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/ViewPart.java
@@ -68,106 +68,101 @@ import org.eclipse.ui.internal.util.Util;
*/
public abstract class ViewPart extends WorkbenchPart implements IViewPart {
- /**
- * Listens to PROP_TITLE property changes in this object until the first call to
- * setContentDescription. Used for compatibility with old parts that call setTitle
- * or overload getTitle instead of using setContentDescription.
- */
- private IPropertyListener compatibilityTitleListener = (source, propId) -> {
- if (propId == IWorkbenchPartConstants.PROP_TITLE) {
- setDefaultContentDescription();
- }
+ /**
+ * Listens to PROP_TITLE property changes in this object until the first call to
+ * setContentDescription. Used for compatibility with old parts that call
+ * setTitle or overload getTitle instead of using setContentDescription.
+ */
+ private IPropertyListener compatibilityTitleListener = (source, propId) -> {
+ if (propId == IWorkbenchPartConstants.PROP_TITLE) {
+ setDefaultContentDescription();
+ }
};
- /**
- * Creates a new view.
- */
- protected ViewPart() {
- super();
+ /**
+ * Creates a new view.
+ */
+ protected ViewPart() {
+ super();
- addPropertyListener(compatibilityTitleListener);
- }
+ addPropertyListener(compatibilityTitleListener);
+ }
- @Override
+ @Override
public IViewSite getViewSite() {
- return (IViewSite) getSite();
- }
+ return (IViewSite) getSite();
+ }
-
- @Override
+ @Override
public void init(IViewSite site) throws PartInitException {
- setSite(site);
+ setSite(site);
- setDefaultContentDescription();
- }
+ setDefaultContentDescription();
+ }
- @Override
+ @Override
public void init(IViewSite site, IMemento memento) throws PartInitException {
- /*
- * Initializes this view with the given view site. A memento is passed to
- * the view which contains a snapshot of the views state from a previous
- * session. Where possible, the view should try to recreate that state
- * within the part controls.
- * <p>
- * This implementation will ignore the memento and initialize the view in
- * a fresh state. Subclasses may override the implementation to perform any
- * state restoration as needed.
- */
- init(site);
- }
-
-
- @Override
+ /*
+ * Initializes this view with the given view site. A memento is passed to the
+ * view which contains a snapshot of the views state from a previous session.
+ * Where possible, the view should try to recreate that state within the part
+ * controls. <p> This implementation will ignore the memento and initialize the
+ * view in a fresh state. Subclasses may override the implementation to perform
+ * any state restoration as needed.
+ */
+ init(site);
+ }
+
+ @Override
public void saveState(IMemento memento) {
- // do nothing
- }
+ // do nothing
+ }
- @Override
+ @Override
protected void setPartName(String partName) {
- if (compatibilityTitleListener != null) {
- removePropertyListener(compatibilityTitleListener);
- compatibilityTitleListener = null;
- }
+ if (compatibilityTitleListener != null) {
+ removePropertyListener(compatibilityTitleListener);
+ compatibilityTitleListener = null;
+ }
- super.setPartName(partName);
- }
+ super.setPartName(partName);
+ }
- @Override
+ @Override
protected void setContentDescription(String description) {
- if (compatibilityTitleListener != null) {
- removePropertyListener(compatibilityTitleListener);
- compatibilityTitleListener = null;
- }
-
- super.setContentDescription(description);
- }
-
- @Override
- public void setInitializationData(IConfigurationElement cfig,
- String propertyName, Object data) {
- super.setInitializationData(cfig, propertyName, data);
-
- setDefaultContentDescription();
- }
-
- private void setDefaultContentDescription() {
- if (compatibilityTitleListener == null) {
- return;
- }
-
- String partName = getPartName();
- String title = getTitle();
-
- if (Util.equals(partName, title)) {
- internalSetContentDescription(""); //$NON-NLS-1$
- } else {
- internalSetContentDescription(title);
- }
- }
-
- @Override
+ if (compatibilityTitleListener != null) {
+ removePropertyListener(compatibilityTitleListener);
+ compatibilityTitleListener = null;
+ }
+
+ super.setContentDescription(description);
+ }
+
+ @Override
+ public void setInitializationData(IConfigurationElement cfig, String propertyName, Object data) {
+ super.setInitializationData(cfig, propertyName, data);
+
+ setDefaultContentDescription();
+ }
+
+ private void setDefaultContentDescription() {
+ if (compatibilityTitleListener == null) {
+ return;
+ }
+
+ String partName = getPartName();
+ String title = getTitle();
+
+ if (Util.equals(partName, title)) {
+ internalSetContentDescription(""); //$NON-NLS-1$
+ } else {
+ internalSetContentDescription(title);
+ }
+ }
+
+ @Override
protected final void checkSite(IWorkbenchPartSite site) {
- super.checkSite(site);
- Assert.isTrue(site instanceof IViewSite, "The site for a view must be an IViewSite"); //$NON-NLS-1$
- }
+ super.checkSite(site);
+ Assert.isTrue(site instanceof IViewSite, "The site for a view must be an IViewSite"); //$NON-NLS-1$
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/WorkbenchPart.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/WorkbenchPart.java
index cfb25655d3e..32ec8d1d85d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/WorkbenchPart.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/WorkbenchPart.java
@@ -48,8 +48,8 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
/**
* Abstract base implementation of all workbench parts.
* <p>
- * This class is not intended to be subclassed by clients outside this
- * package; clients should instead subclass <code>ViewPart</code> or
+ * This class is not intended to be subclassed by clients outside this package;
+ * clients should instead subclass <code>ViewPart</code> or
* <code>EditorPart</code>.
* </p>
*
@@ -57,419 +57,414 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
* @see org.eclipse.ui.part.EditorPart
* @noextend This class is not intended to be subclassed by clients.
*/
-public abstract class WorkbenchPart extends EventManager implements
- IWorkbenchPart3, IExecutableExtension, IWorkbenchPartOrientation {
- private String title = ""; //$NON-NLS-1$
+public abstract class WorkbenchPart extends EventManager
+ implements IWorkbenchPart3, IExecutableExtension, IWorkbenchPartOrientation {
+ private String title = ""; //$NON-NLS-1$
- private ImageDescriptor imageDescriptor;
+ private ImageDescriptor imageDescriptor;
- private Image titleImage;
+ private Image titleImage;
private String toolTip = ""; //$NON-NLS-1$
- private IConfigurationElement configElement;
+ private IConfigurationElement configElement;
- private IWorkbenchPartSite partSite;
+ private IWorkbenchPartSite partSite;
- private String partName = ""; //$NON-NLS-1$
+ private String partName = ""; //$NON-NLS-1$
- private String contentDescription = ""; //$NON-NLS-1$
+ private String contentDescription = ""; //$NON-NLS-1$
private ListenerList<IPropertyChangeListener> partChangeListeners = new ListenerList<>();
- /**
- * Creates a new workbench part.
- */
- protected WorkbenchPart() {
- super();
- }
+ /**
+ * Creates a new workbench part.
+ */
+ protected WorkbenchPart() {
+ super();
+ }
- @Override
+ @Override
public void addPropertyListener(IPropertyListener l) {
- addListenerObject(l);
- }
+ addListenerObject(l);
+ }
- @Override
+ @Override
public abstract void createPartControl(Composite parent);
- /**
- * The <code>WorkbenchPart</code> implementation of this
- * <code>IWorkbenchPart</code> method disposes the title image
- * loaded by <code>setInitializationData</code>. Subclasses may extend.
- */
- @Override
+ /**
+ * The <code>WorkbenchPart</code> implementation of this
+ * <code>IWorkbenchPart</code> method disposes the title image loaded by
+ * <code>setInitializationData</code>. Subclasses may extend.
+ */
+ @Override
public void dispose() {
- if (imageDescriptor != null) {
- JFaceResources.getResources().destroyImage(imageDescriptor);
- }
-
- // Clear out the property change listeners as we
- // should not be notifying anyone after the part
- // has been disposed.
- clearListeners();
- partChangeListeners.clear();
- }
-
- /**
- * Fires a property changed event.
- *
- * @param propertyId the id of the property that changed
- */
- protected void firePropertyChange(final int propertyId) {
+ if (imageDescriptor != null) {
+ JFaceResources.getResources().destroyImage(imageDescriptor);
+ }
+
+ // Clear out the property change listeners as we
+ // should not be notifying anyone after the part
+ // has been disposed.
+ clearListeners();
+ partChangeListeners.clear();
+ }
+
+ /**
+ * Fires a property changed event.
+ *
+ * @param propertyId the id of the property that changed
+ */
+ protected void firePropertyChange(final int propertyId) {
for (Object listener : getListeners()) {
final IPropertyListener propertyListener = (IPropertyListener) listener;
- try {
+ try {
propertyListener.propertyChanged(WorkbenchPart.this, propertyId);
- } catch (RuntimeException e) {
- WorkbenchPlugin.log(e);
- }
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * Subclasses may override this method (however, if they do so, they
- * should invoke the method on their superclass to ensure that the
- * Platform's adapter manager is consulted).
- */
- @Override
+ } catch (RuntimeException e) {
+ WorkbenchPlugin.log(e);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * Subclasses may override this method (however, if they do so, they should
+ * invoke the method on their superclass to ensure that the Platform's adapter
+ * manager is consulted).
+ */
+ @Override
public <T> T getAdapter(Class<T> adapter) {
- /**
- * This implementation of the method declared by <code>IAdaptable</code>
- * passes the request along to the platform's adapter manager; roughly
- * <code>Platform.getAdapterManager().getAdapter(this, adapter)</code>.
- */
-
- return Platform.getAdapterManager().getAdapter(this, adapter);
- }
-
- /**
- * Returns the configuration element for this part. The configuration element
- * comes from the plug-in registry entry for the extension defining this part.
- *
- * @return the configuration element for this part
- */
- protected IConfigurationElement getConfigurationElement() {
- return configElement;
- }
-
- /**
- * Returns the default title image.
- *
- * @return the default image
- */
- protected Image getDefaultImage() {
- return PlatformUI.getWorkbench().getSharedImages().getImage(
- ISharedImages.IMG_DEF_VIEW);
- }
-
- @Override
+ /**
+ * This implementation of the method declared by <code>IAdaptable</code> passes
+ * the request along to the platform's adapter manager; roughly
+ * <code>Platform.getAdapterManager().getAdapter(this, adapter)</code>.
+ */
+
+ return Platform.getAdapterManager().getAdapter(this, adapter);
+ }
+
+ /**
+ * Returns the configuration element for this part. The configuration element
+ * comes from the plug-in registry entry for the extension defining this part.
+ *
+ * @return the configuration element for this part
+ */
+ protected IConfigurationElement getConfigurationElement() {
+ return configElement;
+ }
+
+ /**
+ * Returns the default title image.
+ *
+ * @return the default image
+ */
+ protected Image getDefaultImage() {
+ return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_DEF_VIEW);
+ }
+
+ @Override
public IWorkbenchPartSite getSite() {
- return partSite;
- }
-
- /**
- * {@inheritDoc}
- * <p>
- * It is considered bad practise to overload or extend this method.
- * Parts should set their title by calling setPartName and/or setContentDescription.
- * </p>
- */
- @Override
+ return partSite;
+ }
+
+ /**
+ * {@inheritDoc}
+ * <p>
+ * It is considered bad practise to overload or extend this method. Parts should
+ * set their title by calling setPartName and/or setContentDescription.
+ * </p>
+ */
+ @Override
public String getTitle() {
- return title;
- }
+ return title;
+ }
- @Override
+ @Override
public Image getTitleImage() {
- if (titleImage != null) {
- return titleImage;
- }
- return getDefaultImage();
- }
+ if (titleImage != null) {
+ return titleImage;
+ }
+ return getDefaultImage();
+ }
- @Override
+ @Override
public String getTitleToolTip() {
- return toolTip;
- }
+ return toolTip;
+ }
- @Override
+ @Override
public void removePropertyListener(IPropertyListener l) {
- removeListenerObject(l);
- }
+ removeListenerObject(l);
+ }
- @Override
+ @Override
public abstract void setFocus();
- /**
- * {@inheritDoc}
- * The <code>WorkbenchPart</code> implementation of this
- * <code>IExecutableExtension</code> records the configuration element in
- * and internal state variable (accessible via <code>getConfigElement</code>).
- * It also loads the title image, if one is specified in the configuration element.
- * Subclasses may extend.
- *
- * Should not be called by clients. It is called by the core plugin when creating
- * this executable extension.
- */
- @Override
- public void setInitializationData(IConfigurationElement cfig,
- String propertyName, Object data) {
-
- // Save config element.
- configElement = cfig;
-
- // Part name and title.
- partName = Util.safeString(cfig.getAttribute("name"));//$NON-NLS-1$;
- title = partName;
-
- // Icon.
- String strIcon = cfig.getAttribute("icon");//$NON-NLS-1$
- if (strIcon == null) {
+ /**
+ * {@inheritDoc} The <code>WorkbenchPart</code> implementation of this
+ * <code>IExecutableExtension</code> records the configuration element in and
+ * internal state variable (accessible via <code>getConfigElement</code>). It
+ * also loads the title image, if one is specified in the configuration element.
+ * Subclasses may extend.
+ *
+ * Should not be called by clients. It is called by the core plugin when
+ * creating this executable extension.
+ */
+ @Override
+ public void setInitializationData(IConfigurationElement cfig, String propertyName, Object data) {
+
+ // Save config element.
+ configElement = cfig;
+
+ // Part name and title.
+ partName = Util.safeString(cfig.getAttribute("name"));//$NON-NLS-1$ ;
+ title = partName;
+
+ // Icon.
+ String strIcon = cfig.getAttribute("icon");//$NON-NLS-1$
+ if (strIcon == null) {
return;
}
- imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(
- configElement.getContributor().getName(), strIcon);
+ imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(configElement.getContributor().getName(), strIcon);
- if (imageDescriptor == null) {
+ if (imageDescriptor == null) {
return;
}
- titleImage = JFaceResources.getResources().createImageWithDefault(imageDescriptor);
- }
-
- /**
- * Sets the part site.
- * <p>
- * Subclasses must invoke this method from <code>IEditorPart.init</code>
- * and <code>IViewPart.init</code>.
- *
- * @param site the workbench part site
- */
- protected void setSite(IWorkbenchPartSite site) {
- checkSite(site);
- this.partSite = site;
- }
-
- /**
- * Checks that the given site is valid for this type of part.
- * The default implementation does nothing.
- *
- * @param site the site to check
- * @since 3.1
- */
- protected void checkSite(IWorkbenchPartSite site) {
- // do nothing
- }
-
- /**
- * Sets or clears the title of this part. Clients should call this method instead
- * of overriding getTitle.
- * <p>
- * This may change a title that was previously set using setPartName or setContentDescription.
- * </p>
- *
- * @deprecated new code should use setPartName and setContentDescription
- *
- * @param title the title, or <code>null</code> to clear
- */
- @Deprecated
+ titleImage = JFaceResources.getResources().createImageWithDefault(imageDescriptor);
+ }
+
+ /**
+ * Sets the part site.
+ * <p>
+ * Subclasses must invoke this method from <code>IEditorPart.init</code> and
+ * <code>IViewPart.init</code>.
+ *
+ * @param site the workbench part site
+ */
+ protected void setSite(IWorkbenchPartSite site) {
+ checkSite(site);
+ this.partSite = site;
+ }
+
+ /**
+ * Checks that the given site is valid for this type of part. The default
+ * implementation does nothing.
+ *
+ * @param site the site to check
+ * @since 3.1
+ */
+ protected void checkSite(IWorkbenchPartSite site) {
+ // do nothing
+ }
+
+ /**
+ * Sets or clears the title of this part. Clients should call this method
+ * instead of overriding getTitle.
+ * <p>
+ * This may change a title that was previously set using setPartName or
+ * setContentDescription.
+ * </p>
+ *
+ * @deprecated new code should use setPartName and setContentDescription
+ *
+ * @param title the title, or <code>null</code> to clear
+ */
+ @Deprecated
protected void setTitle(String title) {
- title = Util.safeString(title);
+ title = Util.safeString(title);
- //Do not send changes if they are the same
- if (Util.equals(this.title, title)) {
+ // Do not send changes if they are the same
+ if (Util.equals(this.title, title)) {
return;
}
- this.title = title;
- firePropertyChange(IWorkbenchPart.PROP_TITLE);
- }
-
- /**
- * Sets or clears the title image of this part.
- *
- * @param titleImage the title image, or <code>null</code> to clear
- */
- protected void setTitleImage(Image titleImage) {
- Assert.isTrue(titleImage == null || !titleImage.isDisposed());
- //Do not send changes if they are the same
- if (this.titleImage == titleImage) {
+ this.title = title;
+ firePropertyChange(IWorkbenchPart.PROP_TITLE);
+ }
+
+ /**
+ * Sets or clears the title image of this part.
+ *
+ * @param titleImage the title image, or <code>null</code> to clear
+ */
+ protected void setTitleImage(Image titleImage) {
+ Assert.isTrue(titleImage == null || !titleImage.isDisposed());
+ // Do not send changes if they are the same
+ if (this.titleImage == titleImage) {
return;
}
- this.titleImage = titleImage;
- firePropertyChange(IWorkbenchPart.PROP_TITLE);
- if (imageDescriptor != null) {
- JFaceResources.getResources().destroyImage(imageDescriptor);
- imageDescriptor = null;
- }
- }
-
- /**
- * Sets or clears the title tool tip text of this part. Clients should
- * call this method instead of overriding <code>getTitleToolTip</code>
- *
- * @param toolTip the new tool tip text, or <code>null</code> to clear
- */
- protected void setTitleToolTip(String toolTip) {
- toolTip = Util.safeString(toolTip);
- //Do not send changes if they are the same
- if (Util.equals(this.toolTip, toolTip)) {
+ this.titleImage = titleImage;
+ firePropertyChange(IWorkbenchPart.PROP_TITLE);
+ if (imageDescriptor != null) {
+ JFaceResources.getResources().destroyImage(imageDescriptor);
+ imageDescriptor = null;
+ }
+ }
+
+ /**
+ * Sets or clears the title tool tip text of this part. Clients should call this
+ * method instead of overriding <code>getTitleToolTip</code>
+ *
+ * @param toolTip the new tool tip text, or <code>null</code> to clear
+ */
+ protected void setTitleToolTip(String toolTip) {
+ toolTip = Util.safeString(toolTip);
+ // Do not send changes if they are the same
+ if (Util.equals(this.toolTip, toolTip)) {
return;
}
- this.toolTip = toolTip;
- firePropertyChange(IWorkbenchPart.PROP_TITLE);
- }
-
- /**
- * Show that this part is busy due to a Job running that it
- * is listening to.
- * @param busy boolean to indicate that the busy state has started
- * or ended.
- * @see org.eclipse.ui.progress.IWorkbenchSiteProgressService#showBusyForFamily(Object)
- * @since 3.0
- */
- public void showBusy(boolean busy) {
- //By default do nothing
- }
-
- /**
- * {@inheritDoc}
- * <p>
- * It is considered bad practise to overload or extend this method.
- * Parts should call setPartName to change their part name.
- * </p>
- */
- @Override
+ this.toolTip = toolTip;
+ firePropertyChange(IWorkbenchPart.PROP_TITLE);
+ }
+
+ /**
+ * Show that this part is busy due to a Job running that it is listening to.
+ *
+ * @param busy boolean to indicate that the busy state has started or ended.
+ * @see org.eclipse.ui.progress.IWorkbenchSiteProgressService#showBusyForFamily(Object)
+ * @since 3.0
+ */
+ public void showBusy(boolean busy) {
+ // By default do nothing
+ }
+
+ /**
+ * {@inheritDoc}
+ * <p>
+ * It is considered bad practise to overload or extend this method. Parts should
+ * call setPartName to change their part name.
+ * </p>
+ */
+ @Override
public String getPartName() {
- return partName;
- }
-
- /**
- * Sets the name of this part. The name will be shown in the tab area for
- * the part. Clients should call this method instead of overriding getPartName.
- * Setting this to the empty string will cause a default part name to be used.
- *
- * <p>
- * setPartName and setContentDescription are intended to replace setTitle.
- * This may change a value that was previously set using setTitle.
- * </p>
- *
- * @param partName the part name, as it should be displayed in tabs.
- *
- * @since 3.0
- */
- protected void setPartName(String partName) {
-
- internalSetPartName(partName);
-
- setDefaultTitle();
- }
-
- void setDefaultTitle() {
- String description = getContentDescription();
- String name = getPartName();
- String newTitle = name;
-
- if (!Util.equals(description, "")) { //$NON-NLS-1$
- newTitle = MessageFormat
- .format(
- WorkbenchMessages.WorkbenchPart_AutoTitleFormat, name, description);
- }
-
- setTitle(newTitle);
- }
-
- /**
- * {@inheritDoc}
- * <p>
- * It is considered bad practise to overload or extend this method.
- * Parts should call setContentDescription to change their content description.
- * </p>
- */
- @Override
+ return partName;
+ }
+
+ /**
+ * Sets the name of this part. The name will be shown in the tab area for the
+ * part. Clients should call this method instead of overriding getPartName.
+ * Setting this to the empty string will cause a default part name to be used.
+ *
+ * <p>
+ * setPartName and setContentDescription are intended to replace setTitle. This
+ * may change a value that was previously set using setTitle.
+ * </p>
+ *
+ * @param partName the part name, as it should be displayed in tabs.
+ *
+ * @since 3.0
+ */
+ protected void setPartName(String partName) {
+
+ internalSetPartName(partName);
+
+ setDefaultTitle();
+ }
+
+ void setDefaultTitle() {
+ String description = getContentDescription();
+ String name = getPartName();
+ String newTitle = name;
+
+ if (!Util.equals(description, "")) { //$NON-NLS-1$
+ newTitle = MessageFormat.format(WorkbenchMessages.WorkbenchPart_AutoTitleFormat, name, description);
+ }
+
+ setTitle(newTitle);
+ }
+
+ /**
+ * {@inheritDoc}
+ * <p>
+ * It is considered bad practise to overload or extend this method. Parts should
+ * call setContentDescription to change their content description.
+ * </p>
+ */
+ @Override
public String getContentDescription() {
- return contentDescription;
- }
-
- /**
- * Sets the content description for this part. The content description is typically
- * a short string describing the current contents of the part. Setting this to the
- * empty string will cause a default content description to be used. Clients should
- * call this method instead of overriding getContentDescription(). For views, the
- * content description is shown (by default) in a line near the top of the view. For
- * editors, the content description is shown beside the part name when showing a
- * list of editors. If the editor is open on a file, this typically contains the path
- * to the input file, without the filename or trailing slash.
- *
- * <p>
- * This may overwrite a value that was previously set in setTitle
- * </p>
- *
- * @param description the content description
- *
- * @since 3.0
- */
- protected void setContentDescription(String description) {
- internalSetContentDescription(description);
-
- setDefaultTitle();
- }
-
- void internalSetContentDescription(String description) {
- Assert.isNotNull(description);
-
- //Do not send changes if they are the same
- if (Util.equals(contentDescription, description)) {
+ return contentDescription;
+ }
+
+ /**
+ * Sets the content description for this part. The content description is
+ * typically a short string describing the current contents of the part. Setting
+ * this to the empty string will cause a default content description to be used.
+ * Clients should call this method instead of overriding
+ * getContentDescription(). For views, the content description is shown (by
+ * default) in a line near the top of the view. For editors, the content
+ * description is shown beside the part name when showing a list of editors. If
+ * the editor is open on a file, this typically contains the path to the input
+ * file, without the filename or trailing slash.
+ *
+ * <p>
+ * This may overwrite a value that was previously set in setTitle
+ * </p>
+ *
+ * @param description the content description
+ *
+ * @since 3.0
+ */
+ protected void setContentDescription(String description) {
+ internalSetContentDescription(description);
+
+ setDefaultTitle();
+ }
+
+ void internalSetContentDescription(String description) {
+ Assert.isNotNull(description);
+
+ // Do not send changes if they are the same
+ if (Util.equals(contentDescription, description)) {
return;
}
- this.contentDescription = description;
+ this.contentDescription = description;
if (partSite instanceof PartSite) {
PartSite site = (PartSite) partSite;
ContributedPartRenderer.setDescription(site.getModel(), description);
}
- firePropertyChange(IWorkbenchPartConstants.PROP_CONTENT_DESCRIPTION);
- }
+ firePropertyChange(IWorkbenchPartConstants.PROP_CONTENT_DESCRIPTION);
+ }
- void internalSetPartName(String partName) {
- partName = Util.safeString(partName);
+ void internalSetPartName(String partName) {
+ partName = Util.safeString(partName);
- Assert.isNotNull(partName);
+ Assert.isNotNull(partName);
- //Do not send changes if they are the same
- if (Util.equals(this.partName, partName)) {
+ // Do not send changes if they are the same
+ if (Util.equals(this.partName, partName)) {
return;
}
- this.partName = partName;
+ this.partName = partName;
- firePropertyChange(IWorkbenchPartConstants.PROP_PART_NAME);
+ firePropertyChange(IWorkbenchPartConstants.PROP_PART_NAME);
- }
+ }
- @Override
- public int getOrientation(){
- //By default use the orientation in Window
- return Window.getDefaultOrientation();
- }
+ @Override
+ public int getOrientation() {
+ // By default use the orientation in Window
+ return Window.getDefaultOrientation();
+ }
- @Override
+ @Override
public void addPartPropertyListener(IPropertyChangeListener listener) {
- partChangeListeners.add(listener);
- }
+ partChangeListeners.add(listener);
+ }
- @Override
+ @Override
public void removePartPropertyListener(IPropertyChangeListener listener) {
- partChangeListeners.remove(listener);
- }
+ partChangeListeners.remove(listener);
+ }
- /**
+ /**
* @since 3.3
*/
- protected void firePartPropertyChanged(String key, String oldValue, String newValue) {
- final PropertyChangeEvent event = new PropertyChangeEvent(this, key, oldValue, newValue);
+ protected void firePartPropertyChanged(String key, String oldValue, String newValue) {
+ final PropertyChangeEvent event = new PropertyChangeEvent(this, key, oldValue, newValue);
for (IPropertyChangeListener l : partChangeListeners) {
try {
l.propertyChange(event);
@@ -477,28 +472,28 @@ public abstract class WorkbenchPart extends EventManager implements
WorkbenchPlugin.log(e);
}
}
- }
+ }
private Map<String, String> partProperties = new HashMap<>();
- @Override
+ @Override
public void setPartProperty(String key, String value) {
String oldValue = partProperties.get(key);
if (value == null) {
- partProperties.remove(key);
- } else {
- partProperties.put(key, value);
- }
- firePartPropertyChanged(key, oldValue, value);
- }
-
- @Override
+ partProperties.remove(key);
+ } else {
+ partProperties.put(key, value);
+ }
+ firePartPropertyChanged(key, oldValue, value);
+ }
+
+ @Override
public String getPartProperty(String key) {
return partProperties.get(key);
- }
+ }
- @Override
+ @Override
public Map<String, String> getPartProperties() {
- return Collections.unmodifiableMap(partProperties);
- }
+ return Collections.unmodifiableMap(partProperties);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/plugin/AbstractUIPlugin.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/plugin/AbstractUIPlugin.java
index 70c8394a655..1407bb438d6 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/plugin/AbstractUIPlugin.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/plugin/AbstractUIPlugin.java
@@ -60,63 +60,61 @@ import org.osgi.framework.BundleListener;
* <p>
* Preferences
* <ul>
- * <li> The platform core runtime contains general support for plug-in
- * preferences (<code>org.eclipse.core.runtime.Preferences</code>).
- * This class provides appropriate conversion to the older JFace preference
- * API (<code>org.eclipse.jface.preference.IPreferenceStore</code>).</li>
- * <li> The method <code>getPreferenceStore</code> returns the JFace preference
- * store (cf. <code>Plugin.getPluginPreferences</code> which returns
- * a core runtime preferences object.</li>
- * <li> Subclasses may reimplement <code>initializeDefaultPreferences</code>
- * to set up any default values for preferences using JFace API. In this
- * case, <code>initializeDefaultPluginPreferences</code> should not be
- * overridden.</li>
- * <li> Subclasses may reimplement
- * <code>initializeDefaultPluginPreferences</code> to set up any default
- * values for preferences using core runtime API. In this
- * case, <code>initializeDefaultPreferences</code> should not be
- * overridden.</li>
- * <li> Preferences are also saved automatically on plug-in shutdown.
- * However, saving preferences immediately after changing them is
- * strongly recommended, since that ensures that preference settings
- * are not lost even in the event of a platform crash.</li>
+ * <li>The platform core runtime contains general support for plug-in
+ * preferences (<code>org.eclipse.core.runtime.Preferences</code>). This class
+ * provides appropriate conversion to the older JFace preference API
+ * (<code>org.eclipse.jface.preference.IPreferenceStore</code>).</li>
+ * <li>The method <code>getPreferenceStore</code> returns the JFace preference
+ * store (cf. <code>Plugin.getPluginPreferences</code> which returns a core
+ * runtime preferences object.</li>
+ * <li>Subclasses may reimplement <code>initializeDefaultPreferences</code> to
+ * set up any default values for preferences using JFace API. In this case,
+ * <code>initializeDefaultPluginPreferences</code> should not be
+ * overridden.</li>
+ * <li>Subclasses may reimplement
+ * <code>initializeDefaultPluginPreferences</code> to set up any default values
+ * for preferences using core runtime API. In this case,
+ * <code>initializeDefaultPreferences</code> should not be overridden.</li>
+ * <li>Preferences are also saved automatically on plug-in shutdown. However,
+ * saving preferences immediately after changing them is strongly recommended,
+ * since that ensures that preference settings are not lost even in the event of
+ * a platform crash.</li>
* </ul>
* Dialogs
* <ul>
- * <li> The dialog store is read the first time <code>getDialogSettings</code>
- * is called.</li>
- * <li> The dialog store allows the plug-in to "record" important choices made
- * by the user in a wizard or dialog, so that the next time the
- * wizard/dialog is used the widgets can be defaulted to better values. A
- * wizard could also use it to record the last 5 values a user entered into
- * an editable combo - to show "recent values". </li>
- * <li> The dialog store is found in the file whose name is given by the
- * constant <code>FN_DIALOG_STORE</code>. A dialog store file is first
- * looked for in the plug-in's read/write state area; if not found there,
- * the plug-in's install directory is checked.
- * This allows a plug-in to ship with a read-only copy of a dialog store
- * file containing initial values for certain settings.</li>
- * <li> Plug-in code can call <code>saveDialogSettings</code> to cause settings to
- * be saved in the plug-in's read/write state area. A plug-in may opt to do
- * this each time a wizard or dialog is closed to ensure the latest
- * information is always safe on disk. </li>
- * <li> Dialog settings are also saved automatically on plug-in shutdown.</li>
+ * <li>The dialog store is read the first time <code>getDialogSettings</code> is
+ * called.</li>
+ * <li>The dialog store allows the plug-in to "record" important choices made by
+ * the user in a wizard or dialog, so that the next time the wizard/dialog is
+ * used the widgets can be defaulted to better values. A wizard could also use
+ * it to record the last 5 values a user entered into an editable combo - to
+ * show "recent values".</li>
+ * <li>The dialog store is found in the file whose name is given by the constant
+ * <code>FN_DIALOG_STORE</code>. A dialog store file is first looked for in the
+ * plug-in's read/write state area; if not found there, the plug-in's install
+ * directory is checked. This allows a plug-in to ship with a read-only copy of
+ * a dialog store file containing initial values for certain settings.</li>
+ * <li>Plug-in code can call <code>saveDialogSettings</code> to cause settings
+ * to be saved in the plug-in's read/write state area. A plug-in may opt to do
+ * this each time a wizard or dialog is closed to ensure the latest information
+ * is always safe on disk.</li>
+ * <li>Dialog settings are also saved automatically on plug-in shutdown.</li>
* </ul>
* Images
* <ul>
- * <li> A typical UI plug-in will have some images that are used very frequently
- * and so need to be cached and shared. The plug-in's image registry
- * provides a central place for a plug-in to store its common images.
- * Images managed by the registry are created lazily as needed, and will be
- * automatically disposed of when the plug-in shuts down. Note that the
- * number of registry images should be kept to a minimum since many OSs
- * have severe limits on the number of images that can be in memory at once.
+ * <li>A typical UI plug-in will have some images that are used very frequently
+ * and so need to be cached and shared. The plug-in's image registry provides a
+ * central place for a plug-in to store its common images. Images managed by the
+ * registry are created lazily as needed, and will be automatically disposed of
+ * when the plug-in shuts down. Note that the number of registry images should
+ * be kept to a minimum since many OSs have severe limits on the number of
+ * images that can be in memory at once.
* </ul>
* <p>
* For easy access to your plug-in object, use the singleton pattern. Declare a
- * static variable in your plug-in class for the singleton. Store the first
- * (and only) instance of the plug-in class in the singleton when it is created.
- * Then access the singleton when needed through a static <code>getDefault</code>
+ * static variable in your plug-in class for the singleton. Store the first (and
+ * only) instance of the plug-in class in the singleton when it is created. Then
+ * access the singleton when needed through a static <code>getDefault</code>
* method.
* </p>
* <p>
@@ -125,11 +123,11 @@ import org.osgi.framework.BundleListener;
*/
public abstract class AbstractUIPlugin extends Plugin {
- /**
- * The name of the dialog settings file (value
- * <code>"dialog_settings.xml"</code>).
- */
- private static final String FN_DIALOG_SETTINGS = "dialog_settings.xml"; //$NON-NLS-1$
+ /**
+ * The name of the dialog settings file (value
+ * <code>"dialog_settings.xml"</code>).
+ */
+ private static final String FN_DIALOG_SETTINGS = "dialog_settings.xml"; //$NON-NLS-1$
/**
* Key used to allow dialog_settings.xml customization. The value is the root
@@ -139,247 +137,249 @@ public abstract class AbstractUIPlugin extends Plugin {
*/
private static final String KEY_DEFAULT_DIALOG_SETTINGS_ROOTURL = "default_dialog_settings_rootUrl"; //$NON-NLS-1$
- /**
- * Storage for dialog and wizard data; <code>null</code> if not yet
- * initialized.
- */
+ /**
+ * Storage for dialog and wizard data; <code>null</code> if not yet initialized.
+ */
private IDialogSettings dialogSettings;
- /**
- * Storage for preferences.
- */
- private ScopedPreferenceStore preferenceStore;
+ /**
+ * Storage for preferences.
+ */
+ private ScopedPreferenceStore preferenceStore;
- /**
- * The registry for all graphic images; <code>null</code> if not yet
- * initialized.
- */
+ /**
+ * The registry for all graphic images; <code>null</code> if not yet
+ * initialized.
+ */
private ImageRegistry imageRegistry;
- /**
- * The bundle listener used for kicking off refreshPluginActions().
- *
- * @since 3.0.1
- */
- private BundleListener bundleListener;
-
- /**
- * Creates an abstract UI plug-in runtime object.
- * <p>
- * Plug-in runtime classes are <code>BundleActivators</code> and so must
- * have an default constructor. This method is called by the runtime when
- * the associated bundle is being activated.
- * <p>
- * For more details, see <code>Plugin</code>'s default constructor.
- *
- * @see Plugin#Plugin()
- * @since 3.0
- */
- public AbstractUIPlugin() {
- super();
- }
-
- /**
- * Returns a new image registry for this plugin-in. The registry will be
- * used to manage images which are frequently used by the plugin-in.
- * <p>
- * The default implementation of this method creates an empty registry.
- * Subclasses may override this method if needed.
- * </p>
- *
- * @return ImageRegistry the resulting registry.
- * @see #getImageRegistry
- */
- protected ImageRegistry createImageRegistry() {
-
- //If we are in the UI Thread use that
- if(Display.getCurrent() != null) {
+ /**
+ * The bundle listener used for kicking off refreshPluginActions().
+ *
+ * @since 3.0.1
+ */
+ private BundleListener bundleListener;
+
+ /**
+ * Creates an abstract UI plug-in runtime object.
+ * <p>
+ * Plug-in runtime classes are <code>BundleActivators</code> and so must have an
+ * default constructor. This method is called by the runtime when the associated
+ * bundle is being activated.
+ * <p>
+ * For more details, see <code>Plugin</code>'s default constructor.
+ *
+ * @see Plugin#Plugin()
+ * @since 3.0
+ */
+ public AbstractUIPlugin() {
+ super();
+ }
+
+ /**
+ * Returns a new image registry for this plugin-in. The registry will be used to
+ * manage images which are frequently used by the plugin-in.
+ * <p>
+ * The default implementation of this method creates an empty registry.
+ * Subclasses may override this method if needed.
+ * </p>
+ *
+ * @return ImageRegistry the resulting registry.
+ * @see #getImageRegistry
+ */
+ protected ImageRegistry createImageRegistry() {
+
+ // If we are in the UI Thread use that
+ if (Display.getCurrent() != null) {
return new ImageRegistry(Display.getCurrent());
}
- if(PlatformUI.isWorkbenchRunning()) {
+ if (PlatformUI.isWorkbenchRunning()) {
return new ImageRegistry(PlatformUI.getWorkbench().getDisplay());
}
- //Invalid thread access if it is not the UI Thread
- //and the workbench is not created.
- throw new SWTError(SWT.ERROR_THREAD_INVALID_ACCESS);
- }
-
- /**
- * Returns the dialog settings for this UI plug-in.
- * The dialog settings is used to hold persistent state data for the various
- * wizards and dialogs of this plug-in in the context of a workbench.
- * <p>
- * If an error occurs reading the dialog store, an empty one is quietly created
- * and returned.
- * </p>
- * <p>
- * Subclasses may override this method but are not expected to.
- * </p>
- *
- * @return the dialog settings
- */
- public IDialogSettings getDialogSettings() {
- if (dialogSettings == null) {
+ // Invalid thread access if it is not the UI Thread
+ // and the workbench is not created.
+ throw new SWTError(SWT.ERROR_THREAD_INVALID_ACCESS);
+ }
+
+ /**
+ * Returns the dialog settings for this UI plug-in. The dialog settings is used
+ * to hold persistent state data for the various wizards and dialogs of this
+ * plug-in in the context of a workbench.
+ * <p>
+ * If an error occurs reading the dialog store, an empty one is quietly created
+ * and returned.
+ * </p>
+ * <p>
+ * Subclasses may override this method but are not expected to.
+ * </p>
+ *
+ * @return the dialog settings
+ */
+ public IDialogSettings getDialogSettings() {
+ if (dialogSettings == null) {
loadDialogSettings();
}
- return dialogSettings;
- }
-
- /**
- * Returns the image registry for this UI plug-in.
- * <p>
- * The image registry contains the images used by this plug-in that are very
- * frequently used and so need to be globally shared within the plug-in. Since
- * many OSs have a severe limit on the number of images that can be in memory at
- * any given time, a plug-in should only keep a small number of images in their
- * registry.
- * <p>
- * Subclasses should reimplement <code>initializeImageRegistry</code> if they have
- * custom graphic images to load.
- * </p>
- * <p>
- * Subclasses may override this method but are not expected to.
- * </p>
- *
- * @return the image registry
- */
- public ImageRegistry getImageRegistry() {
- if (imageRegistry == null) {
- imageRegistry = createImageRegistry();
- initializeImageRegistry(imageRegistry);
- }
- return imageRegistry;
- }
-
- /**
- * Returns the preference store for this UI plug-in.
- * This preference store is used to hold persistent settings for this plug-in in
- * the context of a workbench. Some of these settings will be user controlled,
- * whereas others may be internal setting that are never exposed to the user.
- * <p>
- * If an error occurs reading the preference store, an empty preference store is
- * quietly created, initialized with defaults, and returned.
- * </p>
- * <p>
- * <strong>NOTE:</strong> As of Eclipse 3.1 this method is
- * no longer referring to the core runtime compatibility layer and so
- * plug-ins relying on Plugin#initializeDefaultPreferences
- * will have to access the compatibility layer themselves.
- * </p>
- *
- * @return the preference store
- */
- public IPreferenceStore getPreferenceStore() {
- // Create the preference store lazily.
- if (preferenceStore == null) {
+ return dialogSettings;
+ }
+
+ /**
+ * Returns the image registry for this UI plug-in.
+ * <p>
+ * The image registry contains the images used by this plug-in that are very
+ * frequently used and so need to be globally shared within the plug-in. Since
+ * many OSs have a severe limit on the number of images that can be in memory at
+ * any given time, a plug-in should only keep a small number of images in their
+ * registry.
+ * <p>
+ * Subclasses should reimplement <code>initializeImageRegistry</code> if they
+ * have custom graphic images to load.
+ * </p>
+ * <p>
+ * Subclasses may override this method but are not expected to.
+ * </p>
+ *
+ * @return the image registry
+ */
+ public ImageRegistry getImageRegistry() {
+ if (imageRegistry == null) {
+ imageRegistry = createImageRegistry();
+ initializeImageRegistry(imageRegistry);
+ }
+ return imageRegistry;
+ }
+
+ /**
+ * Returns the preference store for this UI plug-in. This preference store is
+ * used to hold persistent settings for this plug-in in the context of a
+ * workbench. Some of these settings will be user controlled, whereas others may
+ * be internal setting that are never exposed to the user.
+ * <p>
+ * If an error occurs reading the preference store, an empty preference store is
+ * quietly created, initialized with defaults, and returned.
+ * </p>
+ * <p>
+ * <strong>NOTE:</strong> As of Eclipse 3.1 this method is no longer referring
+ * to the core runtime compatibility layer and so plug-ins relying on
+ * Plugin#initializeDefaultPreferences will have to access the compatibility
+ * layer themselves.
+ * </p>
+ *
+ * @return the preference store
+ */
+ public IPreferenceStore getPreferenceStore() {
+ // Create the preference store lazily.
+ if (preferenceStore == null) {
preferenceStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, getBundle().getSymbolicName());
- }
- return preferenceStore;
- }
-
- /**
- * Returns the Platform UI workbench.
- * <p>
- * This method exists as a convenience for plugin implementors. The
- * workbench can also be accessed by invoking <code>PlatformUI.getWorkbench()</code>.
- * </p>
- * @return IWorkbench the workbench for this plug-in
- */
- public IWorkbench getWorkbench() {
- return PlatformUI.getWorkbench();
- }
-
- /**
- * Initializes a preference store with default preference values
- * for this plug-in.
- * <p>
- * This method is called after the preference store is initially loaded
- * (default values are never stored in preference stores).
- * </p>
- * <p>
- * The default implementation of this method does nothing.
- * Subclasses should reimplement this method if the plug-in has any preferences.
- * </p>
- * <p>
- * A subclass may reimplement this method to set default values for the
- * preference store using JFace API. This is the older way of initializing
- * default values. If this method is reimplemented, do not override
- * <code>initializeDefaultPluginPreferences()</code>.
- * </p>
- *
- * @param store the preference store to fill
- *
- * @deprecated this is only called if the runtime compatibility layer is
- * present. See {@link #initializeDefaultPluginPreferences}.
- */
- @Deprecated
+ }
+ return preferenceStore;
+ }
+
+ /**
+ * Returns the Platform UI workbench.
+ * <p>
+ * This method exists as a convenience for plugin implementors. The workbench
+ * can also be accessed by invoking <code>PlatformUI.getWorkbench()</code>.
+ * </p>
+ *
+ * @return IWorkbench the workbench for this plug-in
+ */
+ public IWorkbench getWorkbench() {
+ return PlatformUI.getWorkbench();
+ }
+
+ /**
+ * Initializes a preference store with default preference values for this
+ * plug-in.
+ * <p>
+ * This method is called after the preference store is initially loaded (default
+ * values are never stored in preference stores).
+ * </p>
+ * <p>
+ * The default implementation of this method does nothing. Subclasses should
+ * reimplement this method if the plug-in has any preferences.
+ * </p>
+ * <p>
+ * A subclass may reimplement this method to set default values for the
+ * preference store using JFace API. This is the older way of initializing
+ * default values. If this method is reimplemented, do not override
+ * <code>initializeDefaultPluginPreferences()</code>.
+ * </p>
+ *
+ * @param store the preference store to fill
+ *
+ * @deprecated this is only called if the runtime compatibility layer is
+ * present. See {@link #initializeDefaultPluginPreferences}.
+ */
+ @Deprecated
protected void initializeDefaultPreferences(IPreferenceStore store) {
- // spec'ed to do nothing
- }
-
- /**
- * The <code>AbstractUIPlugin</code> implementation of this
- * <code>Plugin</code> method forwards to
- * <code>initializeDefaultPreferences(IPreferenceStore)</code>.
- * <p>
- * A subclass may reimplement this method to set default values for the core
- * runtime preference store in the standard way. This is the recommended way
- * to do this. The older
- * <code>initializeDefaultPreferences(IPreferenceStore)</code> method
- * serves a similar purpose. If this method is reimplemented, do not send
- * super, and do not override
- * <code>initializeDefaultPreferences(IPreferenceStore)</code>.
- * </p>
- *
- * @deprecated this is only called if the runtime compatibility layer is
- * present. See the deprecated comment in
- * {@link Plugin#initializeDefaultPluginPreferences}.
- *
- * @see #initializeDefaultPreferences
- * @since 2.0
- */
- @Deprecated
+ // spec'ed to do nothing
+ }
+
+ /**
+ * The <code>AbstractUIPlugin</code> implementation of this <code>Plugin</code>
+ * method forwards to
+ * <code>initializeDefaultPreferences(IPreferenceStore)</code>.
+ * <p>
+ * A subclass may reimplement this method to set default values for the core
+ * runtime preference store in the standard way. This is the recommended way to
+ * do this. The older
+ * <code>initializeDefaultPreferences(IPreferenceStore)</code> method serves a
+ * similar purpose. If this method is reimplemented, do not send super, and do
+ * not override <code>initializeDefaultPreferences(IPreferenceStore)</code>.
+ * </p>
+ *
+ * @deprecated this is only called if the runtime compatibility layer is
+ * present. See the deprecated comment in
+ * {@link Plugin#initializeDefaultPluginPreferences}.
+ *
+ * @see #initializeDefaultPreferences
+ * @since 2.0
+ */
+ @Deprecated
@Override
protected void initializeDefaultPluginPreferences() {
- // N.B. by the time this method is called, the plug-in has a
- // core runtime preference store (no default values)
-
- // call loadPreferenceStore (only) for backwards compatibility with Eclipse 1.0
- loadPreferenceStore();
- // call initializeDefaultPreferences (only) for backwards compatibility
- // with Eclipse 1.0
- initializeDefaultPreferences(getPreferenceStore());
- }
-
- /**
- * Initializes an image registry with images which are frequently used by the
- * plugin.
- * <p>
- * The image registry contains the images used by this plug-in that are very
- * frequently used and so need to be globally shared within the plug-in. Since
- * many OSs have a severe limit on the number of images that can be in memory
- * at any given time, each plug-in should only keep a small number of images in
- * its registry.
- * </p><p>
- * Implementors should create a JFace image descriptor for each frequently used
- * image. The descriptors describe how to create/find the image should it be needed.
- * The image described by the descriptor is not actually allocated until someone
- * retrieves it.
- * </p><p>
- * Subclasses may override this method to fill the image registry.
- * </p>
- * @param reg the registry to initialize
- *
- * @see #getImageRegistry
- */
- protected void initializeImageRegistry(ImageRegistry reg) {
- // spec'ed to do nothing
- }
-
- /**
+ // N.B. by the time this method is called, the plug-in has a
+ // core runtime preference store (no default values)
+
+ // call loadPreferenceStore (only) for backwards compatibility with Eclipse 1.0
+ loadPreferenceStore();
+ // call initializeDefaultPreferences (only) for backwards compatibility
+ // with Eclipse 1.0
+ initializeDefaultPreferences(getPreferenceStore());
+ }
+
+ /**
+ * Initializes an image registry with images which are frequently used by the
+ * plugin.
+ * <p>
+ * The image registry contains the images used by this plug-in that are very
+ * frequently used and so need to be globally shared within the plug-in. Since
+ * many OSs have a severe limit on the number of images that can be in memory at
+ * any given time, each plug-in should only keep a small number of images in its
+ * registry.
+ * </p>
+ * <p>
+ * Implementors should create a JFace image descriptor for each frequently used
+ * image. The descriptors describe how to create/find the image should it be
+ * needed. The image described by the descriptor is not actually allocated until
+ * someone retrieves it.
+ * </p>
+ * <p>
+ * Subclasses may override this method to fill the image registry.
+ * </p>
+ *
+ * @param reg the registry to initialize
+ *
+ * @see #getImageRegistry
+ */
+ protected void initializeImageRegistry(ImageRegistry reg) {
+ // spec'ed to do nothing
+ }
+
+ /**
* Loads the dialog settings for this plug-in. The default implementation first
* looks for a standard named file in the plug-in's read/write state area; if no
* such file exists, default product dialog settings directory (specified by
@@ -394,8 +394,8 @@ public abstract class AbstractUIPlugin extends Plugin {
* unnecessary.
* </p>
*/
- protected void loadDialogSettings() {
- dialogSettings = createEmptySettings();
+ protected void loadDialogSettings() {
+ dialogSettings = createEmptySettings();
boolean loaded = loadDialogSettingsFromWorkspace();
// otherwise look for product custom dialog settings
if (!loaded) {
@@ -453,7 +453,7 @@ public abstract class AbstractUIPlugin extends Plugin {
* @return true if the workspace settings file was successfully read
*/
private boolean loadDialogSettingsFromWorkspace() {
- IPath dataLocation = getStateLocationOrNull();
+ IPath dataLocation = getStateLocationOrNull();
if (dataLocation == null) {
// bug 69387: The instance area should not be created (in the call to
// #getStateLocation) if -data @none or -data @noDefault was used
@@ -474,7 +474,7 @@ public abstract class AbstractUIPlugin extends Plugin {
return true;
}
return false;
- }
+ }
private void loadDefaultDialogSettingsFromBundle() {
Bundle bundle = getBundle();
@@ -498,234 +498,231 @@ public abstract class AbstractUIPlugin extends Plugin {
return new DialogSettings("Workbench"); //$NON-NLS-1$
}
- /**
- * Loads the preference store for this plug-in.
- * The default implementation looks for a standard named file in the
- * plug-in's read/write state area. If no file is found or a problem
- * occurs, a new empty preference store is silently created.
- * <p>
- * This framework method may be overridden, although this is typically
- * unnecessary.
- * </p>
- *
- * @deprecated As of Eclipse 2.0, a basic preference store exists for all
- * plug-ins. This method now exists only for backwards compatibility.
- * It is called as the plug-in's preference store is being initialized.
- * The plug-ins preferences are loaded from the file regardless of what
- * this method does.
- */
- @Deprecated
+ /**
+ * Loads the preference store for this plug-in. The default implementation looks
+ * for a standard named file in the plug-in's read/write state area. If no file
+ * is found or a problem occurs, a new empty preference store is silently
+ * created.
+ * <p>
+ * This framework method may be overridden, although this is typically
+ * unnecessary.
+ * </p>
+ *
+ * @deprecated As of Eclipse 2.0, a basic preference store exists for all
+ * plug-ins. This method now exists only for backwards
+ * compatibility. It is called as the plug-in's preference store is
+ * being initialized. The plug-ins preferences are loaded from the
+ * file regardless of what this method does.
+ */
+ @Deprecated
protected void loadPreferenceStore() {
- // do nothing by default
- }
-
- /**
- * Refreshes the actions for the plugin.
- * This method is called from <code>startup</code>.
- * <p>
- * This framework method may be overridden, although this is typically
- * unnecessary.
- * </p>
- */
- protected void refreshPluginActions() {
- // If the workbench is not started yet, or is no longer running, do nothing.
- if (!PlatformUI.isWorkbenchRunning()) {
+ // do nothing by default
+ }
+
+ /**
+ * Refreshes the actions for the plugin. This method is called from
+ * <code>startup</code>.
+ * <p>
+ * This framework method may be overridden, although this is typically
+ * unnecessary.
+ * </p>
+ */
+ protected void refreshPluginActions() {
+ // If the workbench is not started yet, or is no longer running, do nothing.
+ if (!PlatformUI.isWorkbenchRunning()) {
+ return;
+ }
+
+ // startup() is not guaranteed to be called in the UI thread,
+ // but refreshPluginActions must run in the UI thread,
+ // so use asyncExec. See bug 6623 for more details.
+ Display.getDefault().asyncExec(() -> WWinPluginAction.refreshActionList());
+ }
+
+ /**
+ * Saves this plug-in's dialog settings. Any problems which arise are silently
+ * ignored.
+ */
+ protected void saveDialogSettings() {
+ if (dialogSettings == null) {
return;
}
- // startup() is not guaranteed to be called in the UI thread,
- // but refreshPluginActions must run in the UI thread,
- // so use asyncExec. See bug 6623 for more details.
- Display.getDefault().asyncExec(() -> WWinPluginAction.refreshActionList());
- }
-
- /**
- * Saves this plug-in's dialog settings.
- * Any problems which arise are silently ignored.
- */
- protected void saveDialogSettings() {
- if (dialogSettings == null) {
- return;
- }
-
- try {
- IPath path = getStateLocationOrNull();
- if(path == null) {
+ try {
+ IPath path = getStateLocationOrNull();
+ if (path == null) {
return;
}
- String readWritePath = path
- .append(FN_DIALOG_SETTINGS).toOSString();
- dialogSettings.save(readWritePath);
- } catch (IOException e) {
- // spec'ed to ignore problems
- } catch (IllegalStateException e) {
- // spec'ed to ignore problems
- }
- }
-
- /**
- * Saves this plug-in's preference store.
- * Any problems which arise are silently ignored.
- *
- * @see Plugin#savePluginPreferences()
- * @deprecated As of Eclipse 2.0, preferences exist for all plug-ins. The
- * equivalent of this method is <code>Plugin.savePluginPreferences</code>.
- * This method now calls <code>savePluginPreferences</code>, and exists only for
- * backwards compatibility.
- */
- @Deprecated
+ String readWritePath = path.append(FN_DIALOG_SETTINGS).toOSString();
+ dialogSettings.save(readWritePath);
+ } catch (IOException e) {
+ // spec'ed to ignore problems
+ } catch (IllegalStateException e) {
+ // spec'ed to ignore problems
+ }
+ }
+
+ /**
+ * Saves this plug-in's preference store. Any problems which arise are silently
+ * ignored.
+ *
+ * @see Plugin#savePluginPreferences()
+ * @deprecated As of Eclipse 2.0, preferences exist for all plug-ins. The
+ * equivalent of this method is
+ * <code>Plugin.savePluginPreferences</code>. This method now calls
+ * <code>savePluginPreferences</code>, and exists only for backwards
+ * compatibility.
+ */
+ @Deprecated
protected void savePreferenceStore() {
- savePluginPreferences();
- }
+ savePluginPreferences();
+ }
- /**
- * The startup method was called
- * only for plug-ins which explicitly require the
+ /**
+ * The startup method was called only for plug-ins which explicitly require the
* org.eclipse.core.runtime.compatibility plug-in.
*
* It is not called anymore as Eclipse 4.6 removed this plug-in.
*/
- @Deprecated
+ @Deprecated
@Override
public void startup() throws CoreException {
- // this method no longer does anything
- // the code that used to be here in 2.1 has moved to start(BundleContext)
- super.startup();
- }
-
- /**
- * The <code>AbstractUIPlugin</code> implementation of this <code>Plugin</code>
- * method does nothing. Subclasses may extend this method, but must send
- * super first.
- * @deprecated
- * In Eclipse 3.0, <code>shutdown</code> has been replaced by {@link Plugin#stop(BundleContext context)}.
- * Implementations of <code>shutdown</code> should be changed to extend
- * <code>stop(BundleContext context)</code> and call <code>super.stop(context)</code>
- * instead of <code>super.shutdown()</code>. Unlike <code>super.shutdown()</code>,
- * <code>super.stop(context)</code> must be called as the very <b>last</b> thing rather
- * than as the very first thing. The <code>shutdown</code> method is called
- * only for plug-ins which explicitly require the
- * org.eclipse.core.runtime.compatibility plug-in;
- * in contrast, the <code>stop</code> method is always called.
- */
- @Deprecated
+ // this method no longer does anything
+ // the code that used to be here in 2.1 has moved to start(BundleContext)
+ super.startup();
+ }
+
+ /**
+ * The <code>AbstractUIPlugin</code> implementation of this <code>Plugin</code>
+ * method does nothing. Subclasses may extend this method, but must send super
+ * first.
+ *
+ * @deprecated In Eclipse 3.0, <code>shutdown</code> has been replaced by
+ * {@link Plugin#stop(BundleContext context)}. Implementations of
+ * <code>shutdown</code> should be changed to extend
+ * <code>stop(BundleContext context)</code> and call
+ * <code>super.stop(context)</code> instead of
+ * <code>super.shutdown()</code>. Unlike
+ * <code>super.shutdown()</code>, <code>super.stop(context)</code>
+ * must be called as the very <b>last</b> thing rather than as the
+ * very first thing. The <code>shutdown</code> method is called only
+ * for plug-ins which explicitly require the
+ * org.eclipse.core.runtime.compatibility plug-in; in contrast, the
+ * <code>stop</code> method is always called.
+ */
+ @Deprecated
@Override
public void shutdown() throws CoreException {
- // this method no longer does anything interesting
- // the code that used to be here in 2.1 has moved to stop(BundleContext),
- // which is called regardless of whether the plug-in being instantiated
- // requires org.eclipse.core.runtime.compatibility
- super.shutdown();
- }
-
- /**
- * The <code>AbstractUIPlugin</code> implementation of this <code>Plugin</code>
- * method refreshes the plug-in actions. Subclasses may extend this method,
- * but must send super <b>first</b>.
- * {@inheritDoc}
- *
- * @since 3.0
- */
- @Override
+ // this method no longer does anything interesting
+ // the code that used to be here in 2.1 has moved to stop(BundleContext),
+ // which is called regardless of whether the plug-in being instantiated
+ // requires org.eclipse.core.runtime.compatibility
+ super.shutdown();
+ }
+
+ /**
+ * The <code>AbstractUIPlugin</code> implementation of this <code>Plugin</code>
+ * method refreshes the plug-in actions. Subclasses may extend this method, but
+ * must send super <b>first</b>. {@inheritDoc}
+ *
+ * @since 3.0
+ */
+ @Override
public void start(BundleContext context) throws Exception {
- super.start(context);
+ super.start(context);
final BundleContext fc = context;
- // Should only attempt refreshPluginActions() once the bundle
- // has been fully started. Otherwise, action delegates
- // can be created while in the process of creating
- // a triggering action delegate (if UI events are processed during startup).
- // Also, if the start throws an exception, the bundle will be shut down.
- // We don't want to have created any delegates if this happens.
- // See bug 63324 for more details.
- bundleListener = new BundleListener() {
- @Override
+ // Should only attempt refreshPluginActions() once the bundle
+ // has been fully started. Otherwise, action delegates
+ // can be created while in the process of creating
+ // a triggering action delegate (if UI events are processed during startup).
+ // Also, if the start throws an exception, the bundle will be shut down.
+ // We don't want to have created any delegates if this happens.
+ // See bug 63324 for more details.
+ bundleListener = new BundleListener() {
+ @Override
public void bundleChanged(BundleEvent event) {
- if (event.getBundle() == getBundle()) {
- if (event.getType() == BundleEvent.STARTED) {
- // We're getting notified that the bundle has been started.
- // Make sure it's still active. It may have been shut down between
- // the time this event was dispatched and now.
- if (getBundle().getState() == Bundle.ACTIVE) {
- refreshPluginActions();
- }
- try {
- fc.removeBundleListener(this);
- } catch (IllegalStateException ex) {
- // bundleListener is removed in stop(BundleContext)
- }
- }
- }
- }
- };
- context.addBundleListener(bundleListener);
- }
-
- /**
- * The <code>AbstractUIPlugin</code> implementation of this {@link Plugin}
- * method saves this plug-in's preference and dialog stores and shuts down
- * its image registry (if they are in use). Subclasses may extend this
- * method, but must send super <b>last</b>. A try-finally statement should
- * be used where necessary to ensure that <code>super.stop()</code> is
- * always done.
- * {@inheritDoc}
- *
- * @since 3.0
- */
- @Override
+ if (event.getBundle() == getBundle()) {
+ if (event.getType() == BundleEvent.STARTED) {
+ // We're getting notified that the bundle has been started.
+ // Make sure it's still active. It may have been shut down between
+ // the time this event was dispatched and now.
+ if (getBundle().getState() == Bundle.ACTIVE) {
+ refreshPluginActions();
+ }
+ try {
+ fc.removeBundleListener(this);
+ } catch (IllegalStateException ex) {
+ // bundleListener is removed in stop(BundleContext)
+ }
+ }
+ }
+ }
+ };
+ context.addBundleListener(bundleListener);
+ }
+
+ /**
+ * The <code>AbstractUIPlugin</code> implementation of this {@link Plugin}
+ * method saves this plug-in's preference and dialog stores and shuts down its
+ * image registry (if they are in use). Subclasses may extend this method, but
+ * must send super <b>last</b>. A try-finally statement should be used where
+ * necessary to ensure that <code>super.stop()</code> is always done.
+ * {@inheritDoc}
+ *
+ * @since 3.0
+ */
+ @Override
public void stop(BundleContext context) throws Exception {
- try {
- if (bundleListener != null) {
- context.removeBundleListener(bundleListener);
- }
- saveDialogSettings();
- savePreferenceStore();
- preferenceStore = null;
- if (imageRegistry != null)
- imageRegistry.dispose();
- imageRegistry = null;
- } finally {
- super.stop(context);
- }
- }
+ try {
+ if (bundleListener != null) {
+ context.removeBundleListener(bundleListener);
+ }
+ saveDialogSettings();
+ savePreferenceStore();
+ preferenceStore = null;
+ if (imageRegistry != null)
+ imageRegistry.dispose();
+ imageRegistry = null;
+ } finally {
+ super.stop(context);
+ }
+ }
/**
- * Creates and returns a new image descriptor for an image file located
- * within the specified plug-in.
+ * Creates and returns a new image descriptor for an image file located within
+ * the specified plug-in.
* <p>
- * This is a convenience method that simply locates the image file in within
- * the plug-in. It will now query the ISharedImages registry first. The path
- * is relative to the root of the plug-in, and takes into account files
- * coming from plug-in fragments. The path may include $arg$ elements.
- * However, the path must not have a leading "." or path separator. Clients
- * should use a path like "icons/mysample.png" rather than
- * "./icons/mysample.png" or "/icons/mysample.png".
+ * This is a convenience method that simply locates the image file in within the
+ * plug-in. It will now query the ISharedImages registry first. The path is
+ * relative to the root of the plug-in, and takes into account files coming from
+ * plug-in fragments. The path may include $arg$ elements. However, the path
+ * must not have a leading "." or path separator. Clients should use a path like
+ * "icons/mysample.png" rather than "./icons/mysample.png" or
+ * "/icons/mysample.png".
* </p>
*
- * @param pluginId
- * the id of the plug-in containing the image file;
- * <code>null</code> is returned if the plug-in does not exist
- * @param imageFilePath
- * the relative path of the image file, relative to the root of
- * the plug-in; the path must be legal
- * @return an image descriptor, or <code>null</code> if no image could be
- * found
+ * @param pluginId the id of the plug-in containing the image file;
+ * <code>null</code> is returned if the plug-in does not
+ * exist
+ * @param imageFilePath the relative path of the image file, relative to the
+ * root of the plug-in; the path must be legal
+ * @return an image descriptor, or <code>null</code> if no image could be found
* @since 3.0
*/
- public static ImageDescriptor imageDescriptorFromPlugin(String pluginId,
- String imageFilePath) {
- if (pluginId == null || imageFilePath == null) {
- throw new IllegalArgumentException();
- }
+ public static ImageDescriptor imageDescriptorFromPlugin(String pluginId, String imageFilePath) {
+ if (pluginId == null || imageFilePath == null) {
+ throw new IllegalArgumentException();
+ }
IWorkbench workbench = PlatformUI.isWorkbenchRunning() ? PlatformUI.getWorkbench() : null;
- ImageDescriptor imageDescriptor = workbench == null ? null : workbench
- .getSharedImages().getImageDescriptor(imageFilePath);
+ ImageDescriptor imageDescriptor = workbench == null ? null
+ : workbench.getSharedImages().getImageDescriptor(imageFilePath);
if (imageDescriptor != null)
return imageDescriptor; // found in the shared images
- // if the bundle is not ready then there is no image
- Bundle bundle = Platform.getBundle(pluginId);
- if (!BundleUtility.isReady(bundle)) {
+ // if the bundle is not ready then there is no image
+ Bundle bundle = Platform.getBundle(pluginId);
+ if (!BundleUtility.isReady(bundle)) {
return null;
}
@@ -756,29 +753,29 @@ public abstract class AbstractUIPlugin extends Plugin {
}
// create image descriptor with the platform:/ URL
return ImageDescriptor.createFromURL(url);
- }
-
- /**
- * FOR INTERNAL WORKBENCH USE ONLY.
- *
- * Returns the path to a location in the file system that can be used
- * to persist/restore state between workbench invocations.
- * If the location did not exist prior to this call it will be created.
- * Returns <code>null</code> if no such location is available.
- *
- * @return path to a location in the file system where this plug-in can
- * persist data between sessions, or <code>null</code> if no such
- * location is available.
- * @since 3.1
- */
- private IPath getStateLocationOrNull() {
- try {
- return getStateLocation();
- } catch (IllegalStateException e) {
- // This occurs if -data=@none is explicitly specified, so ignore this silently.
- // Is this OK? See bug 85071.
- return null;
- }
- }
+ }
+
+ /**
+ * FOR INTERNAL WORKBENCH USE ONLY.
+ *
+ * Returns the path to a location in the file system that can be used to
+ * persist/restore state between workbench invocations. If the location did not
+ * exist prior to this call it will be created. Returns <code>null</code> if no
+ * such location is available.
+ *
+ * @return path to a location in the file system where this plug-in can persist
+ * data between sessions, or <code>null</code> if no such location is
+ * available.
+ * @since 3.1
+ */
+ private IPath getStateLocationOrNull() {
+ try {
+ return getStateLocation();
+ } catch (IllegalStateException e) {
+ // This occurs if -data=@none is explicitly specified, so ignore this silently.
+ // Is this OK? See bug 85071.
+ return null;
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/IWorkbenchPreferenceContainer.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/IWorkbenchPreferenceContainer.java
index d315dbb5d8b..a1fd8a28ecc 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/IWorkbenchPreferenceContainer.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/IWorkbenchPreferenceContainer.java
@@ -16,36 +16,37 @@ package org.eclipse.ui.preferences;
import org.eclipse.core.runtime.jobs.Job;
/**
- * IWorkbenchPreferenceContainer is the class that specifies
- * the workbench specific preferences support.
+ * IWorkbenchPreferenceContainer is the class that specifies the workbench
+ * specific preferences support.
+ *
* @since 3.1
*
*/
public interface IWorkbenchPreferenceContainer {
/**
- * Open the page specified in the org.eclipse.ui.preferencePage
- * extension point with id pageId. Apply data to it
- * when it is opened.
- * @param preferencePageId String the id specified for a page in
- * the plugin.xml of its defining plug-in.
- * @param data The data to be applied to the page when it
- * opens.
- * @return boolean <code>true</code> if the page was
- * opened successfully and data was applied.
+ * Open the page specified in the org.eclipse.ui.preferencePage extension point
+ * with id pageId. Apply data to it when it is opened.
+ *
+ * @param preferencePageId String the id specified for a page in the plugin.xml
+ * of its defining plug-in.
+ * @param data The data to be applied to the page when it opens.
+ * @return boolean <code>true</code> if the page was opened successfully and
+ * data was applied.
*/
boolean openPage(String preferencePageId, Object data);
/**
- * Get the working copy manager in use by this preference
- * page container. This IWorkingCopyManager will have
- * IWorkingCopyManager#applyChanges()
+ * Get the working copy manager in use by this preference page container. This
+ * IWorkingCopyManager will have IWorkingCopyManager#applyChanges()
+ *
* @return IWorkingCopyManager
*/
IWorkingCopyManager getWorkingCopyManager();
/**
* Register a job to be run after the container has been closed.
+ *
* @param job
*/
void registerUpdateJob(Job job);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/IWorkingCopyManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/IWorkingCopyManager.java
index 19f7c4cd4e1..07f65c3a9e9 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/IWorkingCopyManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/IWorkingCopyManager.java
@@ -17,8 +17,9 @@ import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.osgi.service.prefs.BackingStoreException;
/**
- * IWorkingCopyManager is the interface for the working copy
- * support for references to shared preference nodes.
+ * IWorkingCopyManager is the interface for the working copy support for
+ * references to shared preference nodes.
+ *
* @since 3.1
*
*/
@@ -28,22 +29,20 @@ public interface IWorkingCopyManager {
* working copy already exists then return it, otherwise create one and keep
* track of it for other clients who are looking for it.
*
- * @param original
- * the original node
+ * @param original the original node
* @return the working copy node
*/
IEclipsePreferences getWorkingCopy(IEclipsePreferences original);
/**
* Apply the changes for <em>all</em> working copies, to their original
- * preference nodes. Alternatively, if a client wishes to apply the changes
- * for a single working copy they can call <code>#flush</code> on that
- * working copy node.
+ * preference nodes. Alternatively, if a client wishes to apply the changes for
+ * a single working copy they can call <code>#flush</code> on that working copy
+ * node.
*
- * @throws BackingStoreException
- * if there were problems accessing the backing store
+ * @throws BackingStoreException if there were problems accessing the backing
+ * store
*/
void applyChanges() throws BackingStoreException;
-
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/ScopedPreferenceStore.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/ScopedPreferenceStore.java
index 9971dc7c931..6672762edbd 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/ScopedPreferenceStore.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/ScopedPreferenceStore.java
@@ -51,13 +51,12 @@ import org.osgi.service.prefs.BackingStoreException;
* @see org.eclipse.core.runtime.preferences
* @since 3.1
*/
-public class ScopedPreferenceStore extends EventManager implements
- IPreferenceStore, IPersistentPreferenceStore {
+public class ScopedPreferenceStore extends EventManager implements IPreferenceStore, IPersistentPreferenceStore {
/**
- * The storeContext is the context where values will stored with the
- * setValue methods. If there are no searchContexts this will be the search
- * context. (along with the "default" context)
+ * The storeContext is the context where values will stored with the setValue
+ * methods. If there are no searchContexts this will be the search context.
+ * (along with the "default" context)
*/
private IScopeContext storeContext;
@@ -73,14 +72,14 @@ public class ScopedPreferenceStore extends EventManager implements
protected boolean silentRunning = false;
/**
- * The listener on the IEclipsePreferences. This is used to forward updates
- * to the property change listeners on the preference store.
+ * The listener on the IEclipsePreferences. This is used to forward updates to
+ * the property change listeners on the preference store.
*/
IEclipsePreferences.IPreferenceChangeListener preferencesListener;
/**
- * The default context is the context where getDefault and setDefault
- * methods will search. This context is also used in the search.
+ * The default context is the context where getDefault and setDefault methods
+ * will search. This context is also used in the search.
*/
private IScopeContext defaultContext = DefaultScope.INSTANCE;
@@ -95,8 +94,7 @@ public class ScopedPreferenceStore extends EventManager implements
String defaultQualifier;
/**
- * Boolean value indicating whether or not this store has changes to be
- * saved.
+ * Boolean value indicating whether or not this store has changes to be saved.
*/
private boolean dirty;
@@ -105,15 +103,11 @@ public class ScopedPreferenceStore extends EventManager implements
* node looked up by qualifier. <strong>NOTE:</strong> Any instance of
* ScopedPreferenceStore should call
*
- * @param context
- * the scope to store to
- * @param qualifier
- * the qualifier used to look up the preference node
- * @param defaultQualifierPath
- * the qualifier used when looking up the defaults
+ * @param context the scope to store to
+ * @param qualifier the qualifier used to look up the preference node
+ * @param defaultQualifierPath the qualifier used when looking up the defaults
*/
- public ScopedPreferenceStore(IScopeContext context, String qualifier,
- String defaultQualifierPath) {
+ public ScopedPreferenceStore(IScopeContext context, String qualifier, String defaultQualifierPath) {
this(context, qualifier);
this.defaultQualifier = defaultQualifierPath;
}
@@ -122,18 +116,15 @@ public class ScopedPreferenceStore extends EventManager implements
* Create a new instance of the receiver. Store the values in context in the
* node looked up by qualifier.
*
- * @param context
- * the scope to store to
- * @param qualifier
- * the qualifer used to look up the preference node
+ * @param context the scope to store to
+ * @param qualifier the qualifer used to look up the preference node
*/
public ScopedPreferenceStore(IScopeContext context, String qualifier) {
storeContext = context;
this.nodeQualifier = qualifier;
this.defaultQualifier = qualifier;
- ((IEclipsePreferences) getStorePreferences().parent())
- .addNodeChangeListener(getNodeChangeListener());
+ ((IEclipsePreferences) getStorePreferences().parent()).addNodeChangeListener(getNodeChangeListener());
}
/**
@@ -146,10 +137,8 @@ public class ScopedPreferenceStore extends EventManager implements
return new IEclipsePreferences.INodeChangeListener() {
@Override
public void added(NodeChangeEvent event) {
- if (nodeQualifier.equals(event.getChild().name())
- && isListenerAttached()) {
- getStorePreferences().addPreferenceChangeListener(
- preferencesListener);
+ if (nodeQualifier.equals(event.getChild().name()) && isListenerAttached()) {
+ getStorePreferences().addPreferenceChangeListener(preferencesListener);
}
}
@@ -181,22 +170,19 @@ public class ScopedPreferenceStore extends EventManager implements
}
firePropertyChangeEvent(event.getKey(), oldValue, newValue);
};
- getStorePreferences().addPreferenceChangeListener(
- preferencesListener);
+ getStorePreferences().addPreferenceChangeListener(preferencesListener);
}
}
/**
- * Does its best at determining the default value for the given key. Checks
- * the given object's type and then looks in the list of defaults to see if
- * a value exists. If not or if there is a problem converting the value, the
- * default default value for that type is returned.
+ * Does its best at determining the default value for the given key. Checks the
+ * given object's type and then looks in the list of defaults to see if a value
+ * exists. If not or if there is a problem converting the value, the default
+ * default value for that type is returned.
*
- * @param key
- * the key to search
- * @param obj
- * the object who default we are looking for
+ * @param key the key to search
+ * @param obj the object who default we are looking for
* @return Object or <code>null</code>
*/
Object getDefault(String key, Object obj) {
@@ -212,8 +198,7 @@ public class ScopedPreferenceStore extends EventManager implements
} else if (obj instanceof Long) {
return Long.valueOf(defaults.getLong(key, LONG_DEFAULT_DEFAULT));
} else if (obj instanceof Boolean) {
- return defaults.getBoolean(key, BOOLEAN_DEFAULT_DEFAULT) ? Boolean.TRUE
- : Boolean.FALSE;
+ return defaults.getBoolean(key, BOOLEAN_DEFAULT_DEFAULT) ? Boolean.TRUE : Boolean.FALSE;
} else {
return null;
}
@@ -246,16 +231,15 @@ public class ScopedPreferenceStore extends EventManager implements
/**
* Return the preference path to search preferences on. This is the list of
- * preference nodes based on the scope contexts for this store. If there are
- * no search contexts set, then return this store's context.
+ * preference nodes based on the scope contexts for this store. If there are no
+ * search contexts set, then return this store's context.
* <p>
- * Whether or not the default context should be included in the resulting
- * list is specified by the <code>includeDefault</code> parameter.
+ * Whether or not the default context should be included in the resulting list
+ * is specified by the <code>includeDefault</code> parameter.
* </p>
*
- * @param includeDefault
- * <code>true</code> if the default context should be included
- * and <code>false</code> otherwise
+ * @param includeDefault <code>true</code> if the default context should be
+ * included and <code>false</code> otherwise
* @return IEclipsePreferences[]
* @since 3.4 public, was added in 3.1 as private method
*/
@@ -264,8 +248,7 @@ public class ScopedPreferenceStore extends EventManager implements
// this store was created on. (and optionally the default)
if (searchContexts == null) {
if (includeDefault) {
- return new IEclipsePreferences[] { getStorePreferences(),
- getDefaultPreferences() };
+ return new IEclipsePreferences[] { getStorePreferences(), getDefaultPreferences() };
}
return new IEclipsePreferences[] { getStorePreferences() };
}
@@ -286,22 +269,21 @@ public class ScopedPreferenceStore extends EventManager implements
}
/**
- * Set the search contexts to scopes. When searching for a value the seach
- * will be done in the order of scope contexts and will not search the
- * storeContext unless it is in this list.
+ * Set the search contexts to scopes. When searching for a value the seach will
+ * be done in the order of scope contexts and will not search the storeContext
+ * unless it is in this list.
* <p>
* If the given list is <code>null</code>, then clear this store's search
- * contexts. This means that only this store's scope context and default
- * scope will be used during preference value searching.
+ * contexts. This means that only this store's scope context and default scope
+ * will be used during preference value searching.
* </p>
* <p>
- * The defaultContext will be added to the end of this list automatically
- * and <em>MUST NOT</em> be included by the user.
+ * The defaultContext will be added to the end of this list automatically and
+ * <em>MUST NOT</em> be included by the user.
* </p>
*
- * @param scopes
- * a list of scope contexts to use when searching, or
- * <code>null</code>
+ * @param scopes a list of scope contexts to use when searching, or
+ * <code>null</code>
*/
public void setSearchContexts(IScopeContext[] scopes) {
this.searchContexts = scopes;
@@ -313,10 +295,7 @@ public class ScopedPreferenceStore extends EventManager implements
// the end)
for (IScopeContext scope : scopes) {
if (scope.equals(defaultContext)) {
- Assert
- .isTrue(
- false,
- WorkbenchMessages.ScopedPreferenceStore_DefaultAddedError);
+ Assert.isTrue(false, WorkbenchMessages.ScopedPreferenceStore_DefaultAddedError);
}
}
}
@@ -326,13 +305,11 @@ public class ScopedPreferenceStore extends EventManager implements
if (name == null) {
return false;
}
- return (Platform.getPreferencesService().get(name, null,
- getPreferenceNodes(true))) != null;
+ return (Platform.getPreferencesService().get(name, null, getPreferenceNodes(true))) != null;
}
@Override
- public void firePropertyChangeEvent(String name, Object oldValue,
- Object newValue) {
+ public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) {
// important: create intermediate array to protect against listeners
// being added/removed during the notification
final Object[] listeners = getListeners();
@@ -354,14 +331,12 @@ public class ScopedPreferenceStore extends EventManager implements
@Override
public boolean getBoolean(String name) {
String value = internalGet(name);
- return value == null ? BOOLEAN_DEFAULT_DEFAULT : Boolean.valueOf(value)
- .booleanValue();
+ return value == null ? BOOLEAN_DEFAULT_DEFAULT : Boolean.valueOf(value).booleanValue();
}
@Override
public boolean getDefaultBoolean(String name) {
- return getDefaultPreferences()
- .getBoolean(name, BOOLEAN_DEFAULT_DEFAULT);
+ return getDefaultPreferences().getBoolean(name, BOOLEAN_DEFAULT_DEFAULT);
}
@Override
@@ -403,17 +378,15 @@ public class ScopedPreferenceStore extends EventManager implements
}
/**
- * Return the string value for the specified key. Look in the nodes which
- * are specified by this object's list of search scopes. If the value does
- * not exist then return <code>null</code>.
+ * Return the string value for the specified key. Look in the nodes which are
+ * specified by this object's list of search scopes. If the value does not exist
+ * then return <code>null</code>.
*
- * @param key
- * the key to search with
+ * @param key the key to search with
* @return String or <code>null</code> if the value does not exist.
*/
private String internalGet(String key) {
- return Platform.getPreferencesService().get(key, null,
- getPreferenceNodes(true));
+ return Platform.getPreferencesService().get(key, null, getPreferenceNodes(true));
}
@Override
@@ -466,8 +439,7 @@ public class ScopedPreferenceStore extends EventManager implements
if (name == null) {
return false;
}
- return (Platform.getPreferencesService().get(name, null,
- getPreferenceNodes(false))) == null;
+ return (Platform.getPreferencesService().get(name, null, getPreferenceNodes(false))) == null;
}
@Override
@@ -652,8 +624,8 @@ public class ScopedPreferenceStore extends EventManager implements
getStorePreferences().putBoolean(name, value);
}
dirty = true;
- firePropertyChangeEvent(name, oldValue ? Boolean.TRUE
- : Boolean.FALSE, value ? Boolean.TRUE : Boolean.FALSE);
+ firePropertyChangeEvent(name, oldValue ? Boolean.TRUE : Boolean.FALSE,
+ value ? Boolean.TRUE : Boolean.FALSE);
} finally {
silentRunning = false;// Restart listening to preferences
}
@@ -675,9 +647,8 @@ public class ScopedPreferenceStore extends EventManager implements
*/
private void disposePreferenceStoreListener() {
- IEclipsePreferences root = (IEclipsePreferences) Platform
- .getPreferencesService().getRootNode().node(
- Plugin.PLUGIN_PREFERENCE_SCOPE);
+ IEclipsePreferences root = (IEclipsePreferences) Platform.getPreferencesService().getRootNode()
+ .node(Plugin.PLUGIN_PREFERENCE_SCOPE);
try {
if (!(root.nodeExists(nodeQualifier))) {
return;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/SettingsTransfer.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/SettingsTransfer.java
index 42e45f26999..48fa4a59002 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/SettingsTransfer.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/SettingsTransfer.java
@@ -20,24 +20,26 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.ui.internal.preferences.SettingsTransferRegistryReader;
/**
- * The SettingsTransfer is the abstract superclass of settings transfers
- * used when switching workspaces.
+ * The SettingsTransfer is the abstract superclass of settings transfers used
+ * when switching workspaces.
+ *
* @since 3.3
*
*/
public abstract class SettingsTransfer {
/**
- * Return the configuration elements for all of the settings
- * transfers.
+ * Return the configuration elements for all of the settings transfers.
+ *
* @return IConfigurationElement[]
*/
- public static IConfigurationElement[] getSettingsTransfers(){
+ public static IConfigurationElement[] getSettingsTransfers() {
return (new SettingsTransferRegistryReader()).getSettingTransfers();
}
/**
* Transfer the settings to a workspace rooted at newWorkspacwe
+ *
* @param newWorkspaceRoot
* @return {@link IStatus} the status of the transfer.
*/
@@ -45,8 +47,9 @@ public abstract class SettingsTransfer {
/**
* Return the name for the receiver.
+ *
* @return String
*/
- public abstract String getName() ;
+ public abstract String getName();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/ViewPreferencesAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/ViewPreferencesAction.java
index ab17266f3b5..c0494375405 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/ViewPreferencesAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/ViewPreferencesAction.java
@@ -17,8 +17,8 @@ import org.eclipse.jface.action.Action;
import org.eclipse.ui.internal.WorkbenchMessages;
/**
- * The ViewPreferencesAction is the action for opening
- * a view preferences dialog on a class.
+ * The ViewPreferencesAction is the action for opening a view preferences dialog
+ * on a class.
*
* @since 3.1
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/ViewSettingsDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/ViewSettingsDialog.java
index a2364cadb57..5860db74b10 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/ViewSettingsDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/ViewSettingsDialog.java
@@ -23,8 +23,8 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
/**
- * The ViewSettingsDialog is an abstract class that
- * provides some common functionality for view preferences.
+ * The ViewSettingsDialog is an abstract class that provides some common
+ * functionality for view preferences.
*
* @since 3.1
*/
@@ -34,6 +34,7 @@ public class ViewSettingsDialog extends Dialog {
/**
* Create a new instance of the receiver.
+ *
* @param parentShell
*/
public ViewSettingsDialog(Shell parentShell) {
@@ -48,16 +49,17 @@ public class ViewSettingsDialog extends Dialog {
super.buttonPressed(buttonId);
}
- /**
- * Performs special processing when this dialog Defaults button has been pressed.
- * <p>
- * This is a framework hook method for subclasses to do special things when
- * the Defaults button has been pressed.
- * Subclasses may override, but should call <code>super.performDefaults</code>.
- * </p>
- */
+ /**
+ * Performs special processing when this dialog Defaults button has been
+ * pressed.
+ * <p>
+ * This is a framework hook method for subclasses to do special things when the
+ * Defaults button has been pressed. Subclasses may override, but should call
+ * <code>super.performDefaults</code>.
+ * </p>
+ */
protected void performDefaults() {
- //Do nothing by default
+ // Do nothing by default
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/WizardPropertyPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/WizardPropertyPage.java
index 498322e500f..36e2d08f23b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/WizardPropertyPage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/WizardPropertyPage.java
@@ -32,9 +32,9 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.dialogs.PropertyPage;
/**
- * The wizard property page can wrap a property page around a wizard.
- * The property page shows the first page of the wizard. It is therefore
- * required, that the wizard consists of exactly one page.
+ * The wizard property page can wrap a property page around a wizard. The
+ * property page shows the first page of the wizard. It is therefore required,
+ * that the wizard consists of exactly one page.
*
* @since 3.4
*/
@@ -49,8 +49,8 @@ public abstract class WizardPropertyPage extends PropertyPage {
private PropertyPageWizardContainer(PropertyPage page, IWizard wizard) {
Assert.isLegal(wizard.getPageCount() == 1);
- fPage= page;
- fWizard= wizard;
+ fPage = page;
+ fWizard = wizard;
}
@Override
@@ -74,23 +74,21 @@ public abstract class WizardPropertyPage extends PropertyPage {
@Override
public void updateMessage() {
- IWizardPage page= getCurrentPage();
+ IWizardPage page = getCurrentPage();
- String message= fPage.getMessage();
- if (message != null &&
- fMessage == null)
- fMessage= message;
+ String message = fPage.getMessage();
+ if (message != null && fMessage == null)
+ fMessage = message;
if (page.getErrorMessage() != null) {
fPage.setMessage(page.getErrorMessage(), ERROR);
} else if (page instanceof IMessageProvider) {
- IMessageProvider messageProvider= (IMessageProvider)page;
+ IMessageProvider messageProvider = (IMessageProvider) page;
if (messageProvider.getMessageType() != IMessageProvider.NONE) {
fPage.setMessage(messageProvider.getMessage(), messageProvider.getMessageType());
} else {
- if (messageProvider.getMessage() != null &&
- fMessage == null)
- fMessage= messageProvider.getMessage();
+ if (messageProvider.getMessage() != null && fMessage == null)
+ fMessage = messageProvider.getMessage();
fPage.setMessage(fMessage, NONE);
}
@@ -101,10 +99,10 @@ public abstract class WizardPropertyPage extends PropertyPage {
@Override
public void updateTitleBar() {
- IWizardPage page= getCurrentPage();
- String name= page.getTitle();
+ IWizardPage page = getCurrentPage();
+ String name = page.getTitle();
if (name == null)
- name= page.getName();
+ name = page.getName();
fPage.setMessage(name);
}
@@ -114,8 +112,9 @@ public abstract class WizardPropertyPage extends PropertyPage {
}
@Override
- public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
- ProgressMonitorDialog dialog= new ProgressMonitorDialog(getShell());
+ public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable)
+ throws InvocationTargetException, InterruptedException {
+ ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
dialog.run(fork, cancelable, runnable);
}
}
@@ -127,7 +126,8 @@ public abstract class WizardPropertyPage extends PropertyPage {
}
/**
- * @return the wizard which is wrapped by this page or <b>null</b> if not yet created
+ * @return the wizard which is wrapped by this page or <b>null</b> if not yet
+ * created
*/
public IWizard getWizard() {
return fWizard;
@@ -136,7 +136,8 @@ public abstract class WizardPropertyPage extends PropertyPage {
/**
* Return a wizard.
*
- * @return an instance of the wizard to be wrapped or <b>null</b> if creation failed
+ * @return an instance of the wizard to be wrapped or <b>null</b> if creation
+ * failed
*/
protected abstract IWizard createWizard();
@@ -150,12 +151,12 @@ public abstract class WizardPropertyPage extends PropertyPage {
*/
@Override
protected Control createContents(final Composite parent) {
- fWizardPageContainer= new Composite(parent, SWT.NONE);
+ fWizardPageContainer = new Composite(parent, SWT.NONE);
fWizardPageContainer.setFont(parent.getFont());
fWizardPageContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- GridLayout layout= new GridLayout(1, false);
- layout.marginHeight= 0;
- layout.marginWidth= 0;
+ GridLayout layout = new GridLayout(1, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
fWizardPageContainer.setLayout(layout);
createWizardPageContent(fWizardPageContainer);
@@ -164,35 +165,35 @@ public abstract class WizardPropertyPage extends PropertyPage {
}
private void createWizardPageContent(Composite parent) {
- fWizard= createWizard();
+ fWizard = createWizard();
if (fWizard == null)
return;
fWizard.addPages();
- PropertyPageWizardContainer wizardContainer= new PropertyPageWizardContainer(this, fWizard);
+ PropertyPageWizardContainer wizardContainer = new PropertyPageWizardContainer(this, fWizard);
wizardContainer.updateButtons();
wizardContainer.updateMessage();
fWizard.setContainer(wizardContainer);
- Composite messageComposite= new Composite(parent, SWT.NONE);
+ Composite messageComposite = new Composite(parent, SWT.NONE);
messageComposite.setFont(parent.getFont());
messageComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
- GridLayout layout= new GridLayout(1, false);
- layout.marginHeight= 0;
+ GridLayout layout = new GridLayout(1, false);
+ layout.marginHeight = 0;
messageComposite.setLayout(layout);
- Label messageLabel= new Label(messageComposite, SWT.WRAP);
+ Label messageLabel = new Label(messageComposite, SWT.WRAP);
messageLabel.setFont(messageComposite.getFont());
messageLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
fWizard.createPageControls(parent);
- IWizardPage page= fWizard.getPages()[0];
+ IWizardPage page = fWizard.getPages()[0];
if (page.getControl() == null)
page.createControl(parent);
- Control pageControl= page.getControl();
+ Control pageControl = page.getControl();
pageControl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
setPageName(page);
@@ -204,21 +205,21 @@ public abstract class WizardPropertyPage extends PropertyPage {
}
private void setPageName(IWizardPage page) {
- String name= page.getTitle();
+ String name = page.getTitle();
if (name == null)
- name= page.getName();
+ name = page.getName();
setMessage(name);
}
private void setDescription(IWizardPage page, Label messageLabel) {
- String description= null;
+ String description = null;
if (page.getDescription() != null) {
- description= page.getDescription();
+ description = page.getDescription();
} else if (page instanceof IMessageProvider) {
- IMessageProvider messageProvider= (IMessageProvider)page;
+ IMessageProvider messageProvider = (IMessageProvider) page;
if (messageProvider.getMessageType() == IMessageProvider.NONE) {
- description= messageProvider.getMessage();
+ description = messageProvider.getMessage();
}
}
@@ -283,7 +284,7 @@ public abstract class WizardPropertyPage extends PropertyPage {
* Rebuilds the wizard page
*/
private void rebuildWizardPage() {
- Control[] children= fWizardPageContainer.getChildren();
+ Control[] children = fWizardPageContainer.getChildren();
for (Control controlElement : children) {
controlElement.dispose();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/WorkingCopyManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/WorkingCopyManager.java
index be35166660e..33ba74862c9 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/WorkingCopyManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/preferences/WorkingCopyManager.java
@@ -23,20 +23,19 @@ import org.eclipse.ui.internal.preferences.WorkingCopyPreferences;
import org.osgi.service.prefs.BackingStoreException;
/**
- * WorkingCopyManager is a concrete implementation of an
- * IWorkingCopyManager.
+ * WorkingCopyManager is a concrete implementation of an IWorkingCopyManager.
* <p>
* This class is not intended to be sub-classed by clients.
* </p>
+ *
* @since 3.2
*/
-public class WorkingCopyManager implements IWorkingCopyManager{
+public class WorkingCopyManager implements IWorkingCopyManager {
private static final String EMPTY_STRING = "";//$NON-NLS-1$
// all working copies - maps absolute path to PreferencesWorkingCopy instance
private Map workingCopies = new HashMap();
-
@Override
public IEclipsePreferences getWorkingCopy(IEclipsePreferences original) {
if (original instanceof WorkingCopyPreferences) {
@@ -51,11 +50,11 @@ public class WorkingCopyManager implements IWorkingCopyManager{
return preferences;
}
-
@Override
public void applyChanges() throws BackingStoreException {
Collection values = workingCopies.values();
- WorkingCopyPreferences[] valuesArray = (WorkingCopyPreferences[]) values.toArray(new WorkingCopyPreferences[values.size()]);
+ WorkingCopyPreferences[] valuesArray = (WorkingCopyPreferences[]) values
+ .toArray(new WorkingCopyPreferences[values.size()]);
for (WorkingCopyPreferences prefs : valuesArray) {
if (prefs.nodeExists(EMPTY_STRING))
prefs.flush();
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/DeferredTreeContentManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/DeferredTreeContentManager.java
index 44dcf82a85e..68ba0f49e8e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/DeferredTreeContentManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/DeferredTreeContentManager.java
@@ -58,9 +58,9 @@ public class DeferredTreeContentManager {
private ListenerList<IJobChangeListener> updateCompleteListenerList;
/**
- * The DeferredContentFamily is a class used to keep track of a
- * manager-object pair so that only jobs scheduled by the receiver are
- * canceled by the receiver.
+ * The DeferredContentFamily is a class used to keep track of a manager-object
+ * pair so that only jobs scheduled by the receiver are canceled by the
+ * receiver.
*
* @since 3.1
*
@@ -70,22 +70,21 @@ public class DeferredTreeContentManager {
protected Object element;
/**
- * Create a new instance of the receiver to define a family for object
- * in a particular scheduling manager.
+ * Create a new instance of the receiver to define a family for object in a
+ * particular scheduling manager.
*
* @param schedulingManager
* @param object
*/
- DeferredContentFamily(DeferredTreeContentManager schedulingManager,
- Object object) {
+ DeferredContentFamily(DeferredTreeContentManager schedulingManager, Object object) {
this.manager = schedulingManager;
this.element = object;
}
}
/**
- * Create a new instance of the receiver using the supplied content provider
- * and viewer. Run any jobs using the site.
+ * Create a new instance of the receiver using the supplied content provider and
+ * viewer. Run any jobs using the site.
*
* @param provider
* @param viewer
@@ -93,38 +92,34 @@ public class DeferredTreeContentManager {
* @deprecated in 3.4. provider is not used by this class
*/
@Deprecated
- public DeferredTreeContentManager(ITreeContentProvider provider,
- AbstractTreeViewer viewer, IWorkbenchPartSite site) {
+ public DeferredTreeContentManager(ITreeContentProvider provider, AbstractTreeViewer viewer,
+ IWorkbenchPartSite site) {
this(viewer, site);
}
/**
- * Create a new instance of the receiver using the supplied content provider
- * and viewer.
+ * Create a new instance of the receiver using the supplied content provider and
+ * viewer.
*
- * @param provider
- * The content provider that will be updated
- * @param viewer
- * The tree viewer that the results are added to
+ * @param provider The content provider that will be updated
+ * @param viewer The tree viewer that the results are added to
* @deprecated in 3.4. provider is not used by this class
*/
@Deprecated
- public DeferredTreeContentManager(ITreeContentProvider provider,
- AbstractTreeViewer viewer) {
+ public DeferredTreeContentManager(ITreeContentProvider provider, AbstractTreeViewer viewer) {
this(viewer);
}
/**
- * Create a new instance of the receiver using the supplied content provider
- * and viewer. Run any jobs using the site.
+ * Create a new instance of the receiver using the supplied content provider and
+ * viewer. Run any jobs using the site.
*
* @param viewer
* @param site
*
* @since 3.4
*/
- public DeferredTreeContentManager(AbstractTreeViewer viewer,
- IWorkbenchPartSite site) {
+ public DeferredTreeContentManager(AbstractTreeViewer viewer, IWorkbenchPartSite site) {
this(viewer);
Object siteService = Adapters.adapt(site, IWorkbenchSiteProgressService.class);
if (siteService != null) {
@@ -133,11 +128,10 @@ public class DeferredTreeContentManager {
}
/**
- * Create a new instance of the receiver using the supplied content provider
- * and viewer.
+ * Create a new instance of the receiver using the supplied content provider and
+ * viewer.
*
- * @param viewer
- * The tree viewer that the results are added to
+ * @param viewer The tree viewer that the results are added to
*
* @since 3.4
*/
@@ -146,31 +140,27 @@ public class DeferredTreeContentManager {
}
/**
- * Provides an optimized lookup for determining if an element has children.
- * This is required because elements that are populated lazilly can't answer
- * <code>getChildren</code> just to determine the potential for children.
- * Throw an AssertionFailedException if element is null.
+ * Provides an optimized lookup for determining if an element has children. This
+ * is required because elements that are populated lazilly can't answer
+ * <code>getChildren</code> just to determine the potential for children. Throw
+ * an AssertionFailedException if element is null.
*
- * @param element
- * The Object being tested. This should not be <code>null</code>.
+ * @param element The Object being tested. This should not be <code>null</code>.
* @return boolean <code>true</code> if there are potentially children.
- * @throws RuntimeException
- * if the element is null.
+ * @throws RuntimeException if the element is null.
*/
public boolean mayHaveChildren(Object element) {
- Assert.isNotNull(element,
- ProgressMessages.DeferredTreeContentManager_NotDeferred);
+ Assert.isNotNull(element, ProgressMessages.DeferredTreeContentManager_NotDeferred);
IDeferredWorkbenchAdapter adapter = getAdapter(element);
return adapter != null && adapter.isContainer();
}
/**
- * Returns the child elements of the given element, or in the case of a
- * deferred element, returns a placeholder. If a deferred element is used, a
- * job is created to fetch the children in the background.
+ * Returns the child elements of the given element, or in the case of a deferred
+ * element, returns a placeholder. If a deferred element is used, a job is
+ * created to fetch the children in the background.
*
- * @param parent
- * The parent object.
+ * @param parent The parent object.
* @return Object[] or <code>null</code> if parent is not an instance of
* IDeferredWorkbenchAdapter.
*/
@@ -196,9 +186,8 @@ public class DeferredTreeContentManager {
}
/**
- * Return the IDeferredWorkbenchAdapter for element or the element if it is
- * an instance of IDeferredWorkbenchAdapter. If it does not exist return
- * null.
+ * Return the IDeferredWorkbenchAdapter for element or the element if it is an
+ * instance of IDeferredWorkbenchAdapter. If it does not exist return null.
*
* @param element
* @return IDeferredWorkbenchAdapter or <code>null</code>
@@ -212,19 +201,14 @@ public class DeferredTreeContentManager {
* deferred adapter. If children are waiting to be retrieved for this parent
* already, that job is cancelled and another is started.
*
- * @param parent
- * The parent object being filled in,
- * @param adapter
- * The adapter being used to fetch the children.
- * @param placeholder
- * The adapter that will be used to indicate that results are
- * pending.
+ * @param parent The parent object being filled in,
+ * @param adapter The adapter being used to fetch the children.
+ * @param placeholder The adapter that will be used to indicate that results are
+ * pending.
*/
- protected void startFetchingDeferredChildren(final Object parent,
- final IDeferredWorkbenchAdapter adapter,
+ protected void startFetchingDeferredChildren(final Object parent, final IDeferredWorkbenchAdapter adapter,
final PendingUpdateAdapter placeholder) {
- final IElementCollector collector = createElementCollector(parent,
- placeholder);
+ final IElementCollector collector = createElementCollector(parent, placeholder);
// Cancel any jobs currently fetching children for the same parent
// instance.
cancel(parent);
@@ -252,17 +236,13 @@ public class DeferredTreeContentManager {
}
/**
- * Check if the parent of element is equal to the parent used in
- * this job.
+ * Check if the parent of element is equal to the parent used in this job.
*
- * @param family
- * The DeferredContentFamily that defines a potential
- * ancestor of the current parent in a particular
- * manager.
- * @param child
- * The object to check against.
- * @return boolean <code>true</code> if the child or one of its
- * parents are the same as the element of the family.
+ * @param family The DeferredContentFamily that defines a potential ancestor of
+ * the current parent in a particular manager.
+ * @param child The object to check against.
+ * @return boolean <code>true</code> if the child or one of its parents are the
+ * same as the element of the family.
*/
private boolean isParent(DeferredContentFamily family, Object child) {
if (family.element.equals(child)) {
@@ -282,8 +262,7 @@ public class DeferredTreeContentManager {
/**
* Get the workbench adapter for the element.
*
- * @param element
- * The object we are adapting to.
+ * @param element The object we are adapting to.
*/
private IWorkbenchAdapter getWorkbenchAdapter(Object element) {
return Adapters.adapt(element, IWorkbenchAdapter.class);
@@ -304,20 +283,15 @@ public class DeferredTreeContentManager {
}
/**
- * Returns a name to use for the job that fetches children of the given
- * parent. Subclasses may override. Default job name is parent's label.
+ * Returns a name to use for the job that fetches children of the given parent.
+ * Subclasses may override. Default job name is parent's label.
*
- * @param parent
- * parent that children are to be fetched for
- * @param adapter
- * parent's deferred adapter
+ * @param parent parent that children are to be fetched for
+ * @param adapter parent's deferred adapter
* @return job name
*/
- protected String getFetchJobName(Object parent,
- IDeferredWorkbenchAdapter adapter) {
- return NLS.bind(
- ProgressMessages.DeferredTreeContentManager_FetchingName,
- adapter.getLabel(parent));
+ protected String getFetchJobName(Object parent, IDeferredWorkbenchAdapter adapter) {
+ return NLS.bind(ProgressMessages.DeferredTreeContentManager_FetchingName, adapter.getLabel(parent));
}
/**
@@ -327,15 +301,12 @@ public class DeferredTreeContentManager {
* @param children
* @param monitor
*/
- protected void addChildren(final Object parent, final Object[] children,
- IProgressMonitor monitor) {
- WorkbenchJob updateJob = new WorkbenchJob(
- ProgressMessages.DeferredTreeContentManager_AddingChildren) {
+ protected void addChildren(final Object parent, final Object[] children, IProgressMonitor monitor) {
+ WorkbenchJob updateJob = new WorkbenchJob(ProgressMessages.DeferredTreeContentManager_AddingChildren) {
@Override
public IStatus runInUIThread(IProgressMonitor updateMonitor) {
// Cancel the job if the tree viewer got closed
- if (treeViewer.getControl().isDisposed()
- || updateMonitor.isCanceled()) {
+ if (treeViewer.getControl().isDisposed() || updateMonitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
treeViewer.add(parent, children);
@@ -360,9 +331,8 @@ public class DeferredTreeContentManager {
}
/**
- * Run a job to clear the placeholder. This is used when the update for the
- * tree is complete so that the user is aware that no more updates are
- * pending.
+ * Run a job to clear the placeholder. This is used when the update for the tree
+ * is complete so that the user is aware that no more updates are pending.
*
* @param placeholder
*/
@@ -371,8 +341,7 @@ public class DeferredTreeContentManager {
return;
}
// Clear the placeholder if it is still there
- WorkbenchJob clearJob = new WorkbenchJob(
- ProgressMessages.DeferredTreeContentManager_ClearJob) {
+ WorkbenchJob clearJob = new WorkbenchJob(ProgressMessages.DeferredTreeContentManager_ClearJob) {
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
if (!placeholder.isRemoved()) {
@@ -401,8 +370,8 @@ public class DeferredTreeContentManager {
}
/**
- * Cancel all jobs that are fetching content for the given parent or any of
- * its children.
+ * Cancel all jobs that are fetching content for the given parent or any of its
+ * children.
*
* @param parent
*/
@@ -417,15 +386,12 @@ public class DeferredTreeContentManager {
/**
* Create the element collector for the receiver.
*
- * @param parent
- * The parent object being filled in,
- * @param placeholder
- * The adapter that will be used to indicate that results are
- * pending.
+ * @param parent The parent object being filled in,
+ * @param placeholder The adapter that will be used to indicate that results are
+ * pending.
* @return IElementCollector
*/
- protected IElementCollector createElementCollector(final Object parent,
- final PendingUpdateAdapter placeholder) {
+ protected IElementCollector createElementCollector(final Object parent, final PendingUpdateAdapter placeholder) {
return new IElementCollector() {
@Override
public void add(Object element, IProgressMonitor monitor) {
@@ -449,19 +415,18 @@ public class DeferredTreeContentManager {
* attached to the job that updates the viewer content (clears the pending
* entry, etc.) after all deferred content has been retrieved.
*
- * This method has no effect if the listener has already been added to the
- * list of listeners.
+ * This method has no effect if the listener has already been added to the list
+ * of listeners.
*
* Since 3.6, this listener is added to a list of listeners rather than
- * replacing the previously added listener. For backward compatibility,
- * adding a null listener will be interpreted as removal of a listener if
- * only one listener has been registered.
+ * replacing the previously added listener. For backward compatibility, adding a
+ * null listener will be interpreted as removal of a listener if only one
+ * listener has been registered.
*
- * @param listener
- * the listener to add to the list of update listeners
+ * @param listener the listener to add to the list of update listeners
* @since 3.4
*/
- public void addUpdateCompleteListener(IJobChangeListener listener){
+ public void addUpdateCompleteListener(IJobChangeListener listener) {
// Maintain backward compatibility.
// Earlier only one listener was supported, so it can be removed by
// passing null
@@ -479,17 +444,16 @@ public class DeferredTreeContentManager {
}
/**
- * Removes the listener from the list of update listeners that are attached
- * to the job that updates the viewer content (clears the pending entry,
- * etc.) after all deferred content has been retrieved. If the listener is
- * already attached to a running job, it is not removed, but it will not be
- * added to any subsequent jobs that are run.
+ * Removes the listener from the list of update listeners that are attached to
+ * the job that updates the viewer content (clears the pending entry, etc.)
+ * after all deferred content has been retrieved. If the listener is already
+ * attached to a running job, it is not removed, but it will not be added to any
+ * subsequent jobs that are run.
*
* This method has no effect if the listener was not previously added to the
* listener list.
*
- * @param listener
- * the listener to be removed
+ * @param listener the listener to be removed
* @since 3.6
*/
public void removeUpdateCompleteListener(IJobChangeListener listener) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IDeferredWorkbenchAdapter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IDeferredWorkbenchAdapter.java
index 2cd7ff05814..b15e90a8ab1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IDeferredWorkbenchAdapter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IDeferredWorkbenchAdapter.java
@@ -18,15 +18,16 @@ import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.ui.model.IWorkbenchAdapter;
/**
- * This adapter interface provides support for lazy initialization of UI workbench elements
- * that are displayed visually. This adapter is used with an associated deferred content provider.
+ * This adapter interface provides support for lazy initialization of UI
+ * workbench elements that are displayed visually. This adapter is used with an
+ * associated deferred content provider.
*
* @see DeferredTreeContentManager
* @since 3.0
*/
public interface IDeferredWorkbenchAdapter extends IWorkbenchAdapter {
- /**
+ /**
* Called by a job run in a separate thread to fetch the children of this
* adapter. The adapter should in return notify of new children via the
* collector. This is generally used when a content provider is getting
@@ -42,30 +43,30 @@ public interface IDeferredWorkbenchAdapter extends IWorkbenchAdapter {
* @param monitor a progress monitor that will never be <code>null</code> to
* support reporting and cancellation.
*/
- void fetchDeferredChildren(Object object,
- IElementCollector collector, IProgressMonitor monitor);
+ void fetchDeferredChildren(Object object, IElementCollector collector, IProgressMonitor monitor);
- /**
- * Returns whether this adapter may have children. This is an optimized method
- * used by content providers to allow showing the [+] expand icon without having
- * yet fetched the children for the element.
- * <p>
- * If <code>false</code> is returned, then the content provider may assume
- * that this adapter has no children. If <code>true</code> is returned,
- * then the job manager may assume that this adapter may have children.
- * <p>
- *
- * @return <code>true</code>if the adapter may have childen, and <code>false</code>
- * otherwise.
- */
- boolean isContainer();
+ /**
+ * Returns whether this adapter may have children. This is an optimized method
+ * used by content providers to allow showing the [+] expand icon without having
+ * yet fetched the children for the element.
+ * <p>
+ * If <code>false</code> is returned, then the content provider may assume that
+ * this adapter has no children. If <code>true</code> is returned, then the job
+ * manager may assume that this adapter may have children.
+ * <p>
+ *
+ * @return <code>true</code>if the adapter may have childen, and
+ * <code>false</code> otherwise.
+ */
+ boolean isContainer();
- /**
- * Returns the rule used to schedule the deferred fetching of children for this adapter.
- *
- * @param object the object whose children are being fetched
- * @return the scheduling rule. May be <code>null</code>.
- * @see org.eclipse.core.runtime.jobs.Job#setRule(ISchedulingRule)
- */
- ISchedulingRule getRule(Object object);
+ /**
+ * Returns the rule used to schedule the deferred fetching of children for this
+ * adapter.
+ *
+ * @param object the object whose children are being fetched
+ * @return the scheduling rule. May be <code>null</code>.
+ * @see org.eclipse.core.runtime.jobs.Job#setRule(ISchedulingRule)
+ */
+ ISchedulingRule getRule(Object object);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IElementCollector.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IElementCollector.java
index fe36ab9fb73..21caccfa173 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IElementCollector.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IElementCollector.java
@@ -17,39 +17,35 @@ import org.eclipse.core.runtime.IProgressMonitor;
/**
* IElementCollector is a type that allows for the incremental update of a
- * collection of objects. This used for updating trees incrementally with
- * a progress monitor so that the update can be reported.
+ * collection of objects. This used for updating trees incrementally with a
+ * progress monitor so that the update can be reported.
*
* @see org.eclipse.ui.progress.IDeferredWorkbenchAdapter
* @see org.eclipse.ui.progress.DeferredTreeContentManager
* @since 3.0
*/
public interface IElementCollector {
- /**
- * Add the element to the IElementCollector. Send any progress information
- * to monitor.
- *
- * @param element
- * The element being added
- * @param monitor
- * The monitor to send updates to.
- */
- void add(Object element, IProgressMonitor monitor);
+ /**
+ * Add the element to the IElementCollector. Send any progress information to
+ * monitor.
+ *
+ * @param element The element being added
+ * @param monitor The monitor to send updates to.
+ */
+ void add(Object element, IProgressMonitor monitor);
- /**
- * Add the elements to the IElementCollector. Send any progress information
- * to monitor.
- *
- * @param elements
- * The elements being added
- * @param monitor
- * The monitor to send updates to.
- */
- void add(Object[] elements, IProgressMonitor monitor);
+ /**
+ * Add the elements to the IElementCollector. Send any progress information to
+ * monitor.
+ *
+ * @param elements The elements being added
+ * @param monitor The monitor to send updates to.
+ */
+ void add(Object[] elements, IProgressMonitor monitor);
- /**
- * The element collection is done. Clean up any temporary state.
- *
- */
- void done();
+ /**
+ * The element collection is done. Clean up any temporary state.
+ *
+ */
+ void done();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IJobRunnable.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IJobRunnable.java
index 37f7018841b..32d52555d70 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IJobRunnable.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IJobRunnable.java
@@ -29,16 +29,14 @@ public interface IJobRunnable {
* <p>
* The provided monitor can be used to report progress and respond to
* cancellation. If the progress monitor has been canceled, the runnable should
- * finish its execution at the earliest convenience and return a result
- * status of severity <code>IStatus.CANCEL</code>. The singleton cancel
- * status <code>Status.CANCEL_STATUS</code> can be used for this purpose.
+ * finish its execution at the earliest convenience and return a result status
+ * of severity <code>IStatus.CANCEL</code>. The singleton cancel status
+ * <code>Status.CANCEL_STATUS</code> can be used for this purpose.
* <p>
*
- * @param monitor
- * the monitor to be used for reporting progress and responding
- * to cancelation. The monitor is never <code>null</code>
- * @return resulting status of the run. The result must not be
- * <code>null</code>
+ * @param monitor the monitor to be used for reporting progress and responding
+ * to cancelation. The monitor is never <code>null</code>
+ * @return resulting status of the run. The result must not be <code>null</code>
*/
IStatus run(IProgressMonitor monitor);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IProgressConstants.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IProgressConstants.java
index ada525e8baf..e77bd81d3ab 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IProgressConstants.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IProgressConstants.java
@@ -19,61 +19,59 @@ import org.eclipse.ui.PlatformUI;
/**
* Constants relating to progress UI functionality of the workbench plug-in.
* <p>
- * The four constants define property keys that are used to associate
- * UI related information with Jobs (<code>org.eclipse.core.runtime.jobs.Job</code>).
+ * The four constants define property keys that are used to associate UI related
+ * information with Jobs (<code>org.eclipse.core.runtime.jobs.Job</code>).
*
* @see org.eclipse.core.runtime.jobs.Job#setProperty
* @since 3.0
*/
public interface IProgressConstants {
- /**
- * Common prefix for properties defined in this interface.
- */
- String PROPERTY_PREFIX = PlatformUI.PLUGIN_ID
- + ".workbench.progress"; //$NON-NLS-1$
+ /**
+ * Common prefix for properties defined in this interface.
+ */
+ String PROPERTY_PREFIX = PlatformUI.PLUGIN_ID + ".workbench.progress"; //$NON-NLS-1$
- /**
- * This property provides a hint to the progress UI to keep Jobs
- * in the UI after they have finished. This can be used to communicate results of a Job
- * back to the user.
- * <p>
- * The property must be of type <code>Boolean</code> and the hint is used
- * if its value is <code>true</code>.
- * </p>
- */
- QualifiedName KEEP_PROPERTY = new QualifiedName(
- PROPERTY_PREFIX, "keep"); //$NON-NLS-1$
+ /**
+ * This property provides a hint to the progress UI to keep Jobs in the UI after
+ * they have finished. This can be used to communicate results of a Job back to
+ * the user.
+ * <p>
+ * The property must be of type <code>Boolean</code> and the hint is used if its
+ * value is <code>true</code>.
+ * </p>
+ */
+ QualifiedName KEEP_PROPERTY = new QualifiedName(PROPERTY_PREFIX, "keep"); //$NON-NLS-1$
- /**
- * The KEEPONE_PROPERTY is an extension to the KEEP_PROPERTY, that provides a hint
- * to the progress UI to ensure that only a single Job of a Job family is kept in the
- * set of kept Jobs. That is, whenever a Job that has the KEEPONE_PROPERTY starts or finishes,
- * all other kept Jobs of the same family are removed first.
- * <p>
- * Membership to family is determined using a Job's <code>belongsTo</code>
- * method. The progress service will pass each job that currently exists in the
- * view to the <code>belongsTo</code> method of a newly added job. Clients who
- * set the <code>KEEPONE_PROPERTY</code> must implement a <code>belongsTo</code>
- * method that determines if the passed job is of the same family as their job
- * and return <code>true</code> if it is.
- * </p>
- * <p>
- * Please note that other Jobs of the same family are only removed if they have finished.
- * Non finished jobs of the same family are left alone.
- * </p>
- **/
- QualifiedName KEEPONE_PROPERTY = new QualifiedName(
- PROPERTY_PREFIX, "keepone"); //$NON-NLS-1$
+ /**
+ * The KEEPONE_PROPERTY is an extension to the KEEP_PROPERTY, that provides a
+ * hint to the progress UI to ensure that only a single Job of a Job family is
+ * kept in the set of kept Jobs. That is, whenever a Job that has the
+ * KEEPONE_PROPERTY starts or finishes, all other kept Jobs of the same family
+ * are removed first.
+ * <p>
+ * Membership to family is determined using a Job's <code>belongsTo</code>
+ * method. The progress service will pass each job that currently exists in the
+ * view to the <code>belongsTo</code> method of a newly added job. Clients who
+ * set the <code>KEEPONE_PROPERTY</code> must implement a <code>belongsTo</code>
+ * method that determines if the passed job is of the same family as their job
+ * and return <code>true</code> if it is.
+ * </p>
+ * <p>
+ * Please note that other Jobs of the same family are only removed if they have
+ * finished. Non finished jobs of the same family are left alone.
+ * </p>
+ **/
+ QualifiedName KEEPONE_PROPERTY = new QualifiedName(PROPERTY_PREFIX, "keepone"); //$NON-NLS-1$
/**
- * This property is used to associate an <code>IAction</code> with a Job. If
- * the Job is shown in the UI, the action might be represented as a button
- * or hyper link to allow the user to trigger a job specific action, like
- * showing the Job's results.
+ * This property is used to associate an <code>IAction</code> with a Job. If the
+ * Job is shown in the UI, the action might be represented as a button or hyper
+ * link to allow the user to trigger a job specific action, like showing the
+ * Job's results.
* <p>
- * The progress UI will track the enabled state of the action and its
- * tooltip text.
+ * The progress UI will track the enabled state of the action and its tooltip
+ * text.
* </p>
* <p>
* If the action implements <code>ActionFactory.IWorkbenchAction</code>, its
@@ -88,51 +86,50 @@ public interface IProgressConstants {
* @see org.eclipse.jface.action.IAction
* @see org.eclipse.ui.actions.ActionFactory.IWorkbenchAction
**/
- QualifiedName ACTION_PROPERTY = new QualifiedName(
- PROPERTY_PREFIX, "action"); //$NON-NLS-1$
+ QualifiedName ACTION_PROPERTY = new QualifiedName(PROPERTY_PREFIX, "action"); //$NON-NLS-1$
- /**
- * This property is used to associate an <code>ImageDescriptor</code> with a Job.
- * If the Job is shown in the UI, this descriptor is used to create an icon that
- * represents the Job.
- * <p>
- * Please note, that this property is only used if no <code>ImageDescriptor</code> has been
- * registered for the Job family with the <code>IProgressService</code>.
- * </p>
- * @see org.eclipse.jface.resource.ImageDescriptor
- * @see org.eclipse.ui.progress.IProgressService
- **/
- QualifiedName ICON_PROPERTY = new QualifiedName(
- PROPERTY_PREFIX, "icon"); //$NON-NLS-1$
+ /**
+ * This property is used to associate an <code>ImageDescriptor</code> with a
+ * Job. If the Job is shown in the UI, this descriptor is used to create an icon
+ * that represents the Job.
+ * <p>
+ * Please note, that this property is only used if no
+ * <code>ImageDescriptor</code> has been registered for the Job family with the
+ * <code>IProgressService</code>.
+ * </p>
+ *
+ * @see org.eclipse.jface.resource.ImageDescriptor
+ * @see org.eclipse.ui.progress.IProgressService
+ **/
+ QualifiedName ICON_PROPERTY = new QualifiedName(PROPERTY_PREFIX, "icon"); //$NON-NLS-1$
- /**
- * Constant for the progress view id.
- */
- String PROGRESS_VIEW_ID = "org.eclipse.ui.views.ProgressView"; //$NON-NLS-1$
+ /**
+ * Constant for the progress view id.
+ */
+ String PROGRESS_VIEW_ID = "org.eclipse.ui.views.ProgressView"; //$NON-NLS-1$
- /**
- * This is a property set on a user job if the user has not decided to
- * run the job in the background.
- * The value is set to <code>true</code> when the job starts and set to
- * <code>false</code> if the user subsequently decides to complete the job in the
- * background.
- * <p>
- * This property is not intended to be set by clients.
- * </p>
- * @see org.eclipse.core.runtime.jobs.Job#isUser()
- */
- QualifiedName PROPERTY_IN_DIALOG = new QualifiedName(
- IProgressConstants.PROPERTY_PREFIX, "inDialog"); //$NON-NLS-1$
+ /**
+ * This is a property set on a user job if the user has not decided to run the
+ * job in the background. The value is set to <code>true</code> when the job
+ * starts and set to <code>false</code> if the user subsequently decides to
+ * complete the job in the background.
+ * <p>
+ * This property is not intended to be set by clients.
+ * </p>
+ *
+ * @see org.eclipse.core.runtime.jobs.Job#isUser()
+ */
+ QualifiedName PROPERTY_IN_DIALOG = new QualifiedName(IProgressConstants.PROPERTY_PREFIX, "inDialog"); //$NON-NLS-1$
- /**
- * This property provides a hint to the progress UI to not prompt on errors
- * immediately but instead make the errors available through the progress UI.
- * <p>
- * The property must be of type <code>Boolean</code> and the hint is used
- * if its value is <code>true</code>.
- * </p>
- * @since 3.1
- */
- QualifiedName NO_IMMEDIATE_ERROR_PROMPT_PROPERTY = new QualifiedName(
- PROPERTY_PREFIX, "delayErrorPrompt"); //$NON-NLS-1$
+ /**
+ * This property provides a hint to the progress UI to not prompt on errors
+ * immediately but instead make the errors available through the progress UI.
+ * <p>
+ * The property must be of type <code>Boolean</code> and the hint is used if its
+ * value is <code>true</code>.
+ * </p>
+ *
+ * @since 3.1
+ */
+ QualifiedName NO_IMMEDIATE_ERROR_PROMPT_PROPERTY = new QualifiedName(PROPERTY_PREFIX, "delayErrorPrompt"); //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IProgressConstants2.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IProgressConstants2.java
index 2c30bb1034f..cc133a56132 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IProgressConstants2.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IProgressConstants2.java
@@ -33,17 +33,16 @@ import org.eclipse.ui.progress.IProgressConstants;
*/
public interface IProgressConstants2 extends IProgressConstants {
- /**
- * Common prefix for properties defined in this interface.
- */
- String PROPERTY_PREFIX = PlatformUI.PLUGIN_ID
- + ".workbench.progress"; //$NON-NLS-1$
+ /**
+ * Common prefix for properties defined in this interface.
+ */
+ String PROPERTY_PREFIX = PlatformUI.PLUGIN_ID + ".workbench.progress"; //$NON-NLS-1$
/**
- * This property is used to associate a <code>ParameterizedCommand</code>
- * with a Job. If the Job is shown in the UI, the command might be
- * represented as a button or hyper link to allow the user to trigger a job
- * specific action, like showing the Job's results.
+ * This property is used to associate a <code>ParameterizedCommand</code> with a
+ * Job. If the Job is shown in the UI, the command might be represented as a
+ * button or hyper link to allow the user to trigger a job specific action, like
+ * showing the Job's results.
* <p>
* Note: Only one of <code>ACTION_PROPERTY</code> or
* <code>COMMAND_PROPERTY</code> should be used
@@ -51,17 +50,15 @@ public interface IProgressConstants2 extends IProgressConstants {
*
* @see org.eclipse.core.commands.ParameterizedCommand
**/
- QualifiedName COMMAND_PROPERTY = new QualifiedName(
- PROPERTY_PREFIX, "command"); //$NON-NLS-1$
+ QualifiedName COMMAND_PROPERTY = new QualifiedName(PROPERTY_PREFIX, "command"); //$NON-NLS-1$
/**
- * This property provides a hint to the progress UI to show the progress of
- * the job in the application TaskBar
+ * This property provides a hint to the progress UI to show the progress of the
+ * job in the application TaskBar
* <p>
- * The property must be of type <code>Boolean</code> and the hint is used if
- * its value is <code>true</code>.
+ * The property must be of type <code>Boolean</code> and the hint is used if its
+ * value is <code>true</code>.
* </p>
*/
- QualifiedName SHOW_IN_TASKBAR_ICON_PROPERTY = new QualifiedName(
- PROPERTY_PREFIX, "inTaskBarIcon"); //$NON-NLS-1$
+ QualifiedName SHOW_IN_TASKBAR_ICON_PROPERTY = new QualifiedName(PROPERTY_PREFIX, "inTaskBarIcon"); //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IProgressService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IProgressService.java
index 418e943f3b8..8b53e680987 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IProgressService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IProgressService.java
@@ -58,25 +58,27 @@ import org.eclipse.swt.widgets.Shell;
*/
public interface IProgressService extends IRunnableContext {
- /**
- * The time at which an operation becomes considered a long
- * operation. Used to determine when the busy cursor will
- * be replaced with a progress monitor.
- * @return int
- * @see IProgressService#busyCursorWhile(IRunnableWithProgress)
- */
- int getLongOperationTime();
+ /**
+ * The time at which an operation becomes considered a long operation. Used to
+ * determine when the busy cursor will be replaced with a progress monitor.
+ *
+ * @return int
+ * @see IProgressService#busyCursorWhile(IRunnableWithProgress)
+ */
+ int getLongOperationTime();
- /**
- * Register the ImageDescriptor to be the icon used for
- * all jobs that belong to family within the workbench.
- * @param icon ImageDescriptor that will be used when the job is being displayed
- * @param family The family to associate with
- * @see Job#belongsTo(Object)
- */
- void registerIconForFamily(ImageDescriptor icon, Object family);
+ /**
+ * Register the ImageDescriptor to be the icon used for all jobs that belong to
+ * family within the workbench.
+ *
+ * @param icon ImageDescriptor that will be used when the job is being
+ * displayed
+ * @param family The family to associate with
+ * @see Job#belongsTo(Object)
+ */
+ void registerIconForFamily(ImageDescriptor icon, Object family);
- /**
+ /**
* Runs the given operation in the UI thread using the given runnable context.
* The given scheduling rule, if any, will be acquired for the duration of the
* operation. If the rule is not available when this method is called, a
@@ -109,61 +111,59 @@ public interface IProgressService extends IRunnableContext {
* exception.
*
*/
- void runInUI(IRunnableContext context,
- IRunnableWithProgress runnable, ISchedulingRule rule)
- throws InvocationTargetException, InterruptedException;
+ void runInUI(IRunnableContext context, IRunnableWithProgress runnable, ISchedulingRule rule)
+ throws InvocationTargetException, InterruptedException;
- /**
- * Get the icon that has been registered for a Job by
- * checking if the job belongs to any of the registered
- * families.
- * @param job
- * @return Icon or <code>null</code> if there isn't one.
- * @see IProgressService#registerIconForFamily(ImageDescriptor,Object)
- */
- Image getIconFor(Job job);
+ /**
+ * Get the icon that has been registered for a Job by checking if the job
+ * belongs to any of the registered families.
+ *
+ * @param job
+ * @return Icon or <code>null</code> if there isn't one.
+ * @see IProgressService#registerIconForFamily(ImageDescriptor,Object)
+ */
+ Image getIconFor(Job job);
- /**
- * Set the cursor to busy and run the runnable in a non-UI Thread.
- * The calling thread will be blocked for the duration of the execution
- * of the supplied runnable.
- *
- * After the cursor has been running for
- * <code>getLongOperationTime()</code> replace it with
- * a ProgressMonitorDialog so that the user may cancel.
- * Do not open the ProgressMonitorDialog if there is already a modal
- * dialog open.
- *
- * @param runnable The runnable to execute and show the progress for.
- * @see IProgressService#getLongOperationTime
- * @throws InvocationTargetException
- * @throws InterruptedException
- */
- void busyCursorWhile(IRunnableWithProgress runnable)
- throws InvocationTargetException, InterruptedException;
+ /**
+ * Set the cursor to busy and run the runnable in a non-UI Thread. The calling
+ * thread will be blocked for the duration of the execution of the supplied
+ * runnable.
+ *
+ * After the cursor has been running for <code>getLongOperationTime()</code>
+ * replace it with a ProgressMonitorDialog so that the user may cancel. Do not
+ * open the ProgressMonitorDialog if there is already a modal dialog open.
+ *
+ * @param runnable The runnable to execute and show the progress for.
+ * @see IProgressService#getLongOperationTime
+ * @throws InvocationTargetException
+ * @throws InterruptedException
+ */
+ void busyCursorWhile(IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException;
- /**
- * This specialization of IRunnableContext#run(boolean, boolean,
- * IRunnableWithProgress) might run the runnable asynchronously
- * if <code>fork</code> is <code>true</code>.
- *
- * @since 3.2
- */
- @Override void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException;
+ /**
+ * This specialization of IRunnableContext#run(boolean, boolean,
+ * IRunnableWithProgress) might run the runnable asynchronously if
+ * <code>fork</code> is <code>true</code>.
+ *
+ * @since 3.2
+ */
+ @Override
+ void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable)
+ throws InvocationTargetException, InterruptedException;
- /**
- * Open a dialog on job when it starts to run and close it
- * when the job is finished. Wait for ProgressManagerUtil#SHORT_OPERATION_TIME
- * before opening the dialog. Do not open if it is already done or
- * if the user has set a preference to always run in the background.
- *
- * Parent the dialog from the shell.
- *
- * @param shell The Shell to parent the dialog from or
- * <code>null</code> if the active shell is to be used.
- * @param job The Job that will be reported in the dialog. job
- * must not be <code>null</code>.
- */
- void showInDialog(Shell shell, Job job);
+ /**
+ * Open a dialog on job when it starts to run and close it when the job is
+ * finished. Wait for ProgressManagerUtil#SHORT_OPERATION_TIME before opening
+ * the dialog. Do not open if it is already done or if the user has set a
+ * preference to always run in the background.
+ *
+ * Parent the dialog from the shell.
+ *
+ * @param shell The Shell to parent the dialog from or <code>null</code> if the
+ * active shell is to be used.
+ * @param job The Job that will be reported in the dialog. job must not be
+ * <code>null</code>.
+ */
+ void showInDialog(Shell shell, Job job);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IWorkbenchSiteProgressService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IWorkbenchSiteProgressService.java
index 39906d7735b..d923e4e0ec5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IWorkbenchSiteProgressService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/IWorkbenchSiteProgressService.java
@@ -47,92 +47,88 @@ import org.eclipse.ui.IWorkbenchPartSite;
*/
public interface IWorkbenchSiteProgressService extends IProgressService {
- /**
- * The property that is sent with busy notifications.
- * @deprecated this property is no longer in use in the Eclipse SDK
- */
- @Deprecated String BUSY_PROPERTY = "SITE_BUSY"; //$NON-NLS-1$
+ /**
+ * The property that is sent with busy notifications.
+ *
+ * @deprecated this property is no longer in use in the Eclipse SDK
+ */
+ @Deprecated
+ String BUSY_PROPERTY = "SITE_BUSY"; //$NON-NLS-1$
/**
* Jobs scheduled with this method will cause the part's presentation to be
- * changed to indicate that the part is busy and in a transient state until
- * the job completes. Parts can also add customized busy indication by
- * overriding <code>WorkbenchPart.showBusy()</code>. If useHalfBusyCursor is
- * true then the cursor will change to the half busy cursor for the duration
- * of the job.
+ * changed to indicate that the part is busy and in a transient state until the
+ * job completes. Parts can also add customized busy indication by overriding
+ * <code>WorkbenchPart.showBusy()</code>. If useHalfBusyCursor is true then the
+ * cursor will change to the half busy cursor for the duration of the job.
*
- * @param job
- * The job to schedule
- * @param delay
- * The delay in scheduling.
- * @param useHalfBusyCursor
- * A boolean to indicate if the half busy cursor should be used
- * while this job is running.
+ * @param job The job to schedule
+ * @param delay The delay in scheduling.
+ * @param useHalfBusyCursor A boolean to indicate if the half busy cursor should
+ * be used while this job is running.
* @see Job#schedule(long)
*/
- void schedule(Job job, long delay, boolean useHalfBusyCursor);
+ void schedule(Job job, long delay, boolean useHalfBusyCursor);
/**
* Jobs scheduled with this method will cause the part's presentation to be
- * changed to indicate that the part is busy and in a transient state until
- * the job completes. Parts can also add customized busy indication by
- * overriding <code>WorkbenchPart.showBusy</code>.
+ * changed to indicate that the part is busy and in a transient state until the
+ * job completes. Parts can also add customized busy indication by overriding
+ * <code>WorkbenchPart.showBusy</code>.
*
- * @param job
- * The job to schedule
- * @param delay
- * The delay in scheduling.
+ * @param job The job to schedule
+ * @param delay The delay in scheduling.
* @see Job#schedule(long)
*/
- void schedule(Job job, long delay);
+ void schedule(Job job, long delay);
/**
* Jobs scheduled with this method will cause the part's presentation to be
- * changed to indicate that the part is busy and in a transient state until
- * the job completes. Parts can also add customized busy indication by
- * overriding <code>WorkbenchPart.showBusy</code>.
+ * changed to indicate that the part is busy and in a transient state until the
+ * job completes. Parts can also add customized busy indication by overriding
+ * <code>WorkbenchPart.showBusy</code>.
*
- * @param job
- * The job to schedule
+ * @param job The job to schedule
* @see Job#schedule()
*/
- void schedule(Job job);
+ void schedule(Job job);
- /**
- * Show busy state if any job of the specified family is running.
- * @param family Object
- * @see Job#belongsTo(Object)
- */
- void showBusyForFamily(Object family);
+ /**
+ * Show busy state if any job of the specified family is running.
+ *
+ * @param family Object
+ * @see Job#belongsTo(Object)
+ */
+ void showBusyForFamily(Object family);
- /**
- * Warn that the content of the part has changed. How this change is
- * displayed to the end user is left up to the workbench renderer.
+ /**
+ * Warn that the content of the part has changed. How this change is displayed
+ * to the end user is left up to the workbench renderer.
*/
- void warnOfContentChange();
+ void warnOfContentChange();
- /**
- * Increments the busy counter for this workbench site. This API should only
- * be used for background work that does not use jobs. As long as there have
- * been more calls to incrementBusy() than to decrementBusy(), the part will
- * show a busy affordance. Each call to incrementBusy must be followed by a
- * call to decrementBusy once the caller no longer needs the part to show
- * the busy affordance.
+ /**
+ * Increments the busy counter for this workbench site. This API should only be
+ * used for background work that does not use jobs. As long as there have been
+ * more calls to incrementBusy() than to decrementBusy(), the part will show a
+ * busy affordance. Each call to incrementBusy must be followed by a call to
+ * decrementBusy once the caller no longer needs the part to show the busy
+ * affordance.
* <p>
- * Note that the job-related methods on this class are another way to let
- * the part show a busy affordance. A part will only appear non-busy if no
- * jobs have been scheduled through this service, and the internal busy
- * counter is not positive.
+ * Note that the job-related methods on this class are another way to let the
+ * part show a busy affordance. A part will only appear non-busy if no jobs have
+ * been scheduled through this service, and the internal busy counter is not
+ * positive.
* </p>
*
* @since 3.3
*/
void incrementBusy();
- /**
- * Decrements the busy counter for this workbench site. This API should only
- * be used for background work that does not use jobs. It is an error to call
- * this method without first making a matching call to {@link #incrementBusy()}.
+ /**
+ * Decrements the busy counter for this workbench site. This API should only be
+ * used for background work that does not use jobs. It is an error to call this
+ * method without first making a matching call to {@link #incrementBusy()}.
*
* @since 3.3
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/PendingUpdateAdapter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/PendingUpdateAdapter.java
index ba494a23c55..aad522a20cb 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/PendingUpdateAdapter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/PendingUpdateAdapter.java
@@ -19,71 +19,73 @@ import org.eclipse.ui.internal.progress.ProgressMessages;
import org.eclipse.ui.model.IWorkbenchAdapter;
/**
- * The PendingUpdateAdapter is a convenience object that can be used
- * by a BaseWorkbenchContentProvider that wants to show a pending update.
+ * The PendingUpdateAdapter is a convenience object that can be used by a
+ * BaseWorkbenchContentProvider that wants to show a pending update.
*
* @since 3.2
*/
public class PendingUpdateAdapter implements IWorkbenchAdapter, IAdaptable {
- private boolean removed = false;
+ private boolean removed = false;
- /**
- * Return whether or not this has been removed from the tree.
- * @return boolean
- */
- protected boolean isRemoved() {
- return removed;
- }
+ /**
+ * Return whether or not this has been removed from the tree.
+ *
+ * @return boolean
+ */
+ protected boolean isRemoved() {
+ return removed;
+ }
- /**
- * Set whether or not this has been removed from the tree.
- * @param removedValue boolean
- */
- protected void setRemoved(boolean removedValue) {
- this.removed = removedValue;
- }
+ /**
+ * Set whether or not this has been removed from the tree.
+ *
+ * @param removedValue boolean
+ */
+ protected void setRemoved(boolean removedValue) {
+ this.removed = removedValue;
+ }
- /**
- * Create a new instance of the receiver.
- */
- public PendingUpdateAdapter() {
- //No initial behavior
- }
+ /**
+ * Create a new instance of the receiver.
+ */
+ public PendingUpdateAdapter() {
+ // No initial behavior
+ }
@Override
public <T> T getAdapter(Class<T> adapter) {
- if (adapter == IWorkbenchAdapter.class) {
+ if (adapter == IWorkbenchAdapter.class) {
return adapter.cast(this);
}
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public Object[] getChildren(Object o) {
- return new Object[0];
- }
+ return new Object[0];
+ }
- @Override
+ @Override
public ImageDescriptor getImageDescriptor(Object object) {
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public String getLabel(Object o) {
- return ProgressMessages.PendingUpdateAdapter_PendingLabel;
- }
+ return ProgressMessages.PendingUpdateAdapter_PendingLabel;
+ }
- @Override
+ @Override
public Object getParent(Object o) {
- return null;
- }
+ return null;
+ }
- /**
+ /**
* @since 3.4
*/
- @Override
+ @Override
public String toString() {
- return getLabel(null);
- }
+ return getLabel(null);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/UIJob.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/UIJob.java
index 43346b63f0e..ab04c34b3ad 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/UIJob.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/UIJob.java
@@ -30,125 +30,118 @@ import org.eclipse.ui.internal.progress.ProgressMessages;
* @since 3.0
*/
public abstract class UIJob extends Job {
- private Display cachedDisplay;
+ private Display cachedDisplay;
- /**
- * Create a new instance of the receiver with the supplied name. The display
- * used will be the one from the workbench if this is available. UIJobs with
- * this constructor will determine their display at runtime.
- *
- * @param name
- * the job name
- *
- */
- public UIJob(String name) {
- super(name);
- }
+ /**
+ * Create a new instance of the receiver with the supplied name. The display
+ * used will be the one from the workbench if this is available. UIJobs with
+ * this constructor will determine their display at runtime.
+ *
+ * @param name the job name
+ *
+ */
+ public UIJob(String name) {
+ super(name);
+ }
- /**
- * Create a new instance of the receiver with the supplied Display.
- *
- * @param jobDisplay
- * the display
- * @param name
- * the job name
- * @see Job
- */
- public UIJob(Display jobDisplay, String name) {
- this(name);
- setDisplay(jobDisplay);
- }
+ /**
+ * Create a new instance of the receiver with the supplied Display.
+ *
+ * @param jobDisplay the display
+ * @param name the job name
+ * @see Job
+ */
+ public UIJob(Display jobDisplay, String name) {
+ this(name);
+ setDisplay(jobDisplay);
+ }
- /**
- * Convenience method to return a status for an exception.
- *
- * @param exception
- * @return IStatus an error status built from the exception
- * @see Job
- */
- public static IStatus errorStatus(Throwable exception) {
- return WorkbenchPlugin.getStatus(exception);
- }
+ /**
+ * Convenience method to return a status for an exception.
+ *
+ * @param exception
+ * @return IStatus an error status built from the exception
+ * @see Job
+ */
+ public static IStatus errorStatus(Throwable exception) {
+ return WorkbenchPlugin.getStatus(exception);
+ }
- /**
- * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
- * Note: this message is marked final. Implementors should use
- * runInUIThread() instead.
- */
- @Override
+ /**
+ * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
+ * Note: this message is marked final. Implementors should use
+ * runInUIThread() instead.
+ */
+ @Override
public final IStatus run(final IProgressMonitor monitor) {
- if (monitor.isCanceled()) {
+ if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
- Display asyncDisplay = getDisplay();
- if (asyncDisplay == null || asyncDisplay.isDisposed()) {
- return Status.CANCEL_STATUS;
- }
- asyncDisplay.asyncExec(() -> {
- IStatus result = null;
- Throwable throwable = null;
- try {
- //As we are in the UI Thread we can
- //always know what to tell the job.
- setThread(Thread.currentThread());
- if (monitor.isCanceled()) {
+ Display asyncDisplay = getDisplay();
+ if (asyncDisplay == null || asyncDisplay.isDisposed()) {
+ return Status.CANCEL_STATUS;
+ }
+ asyncDisplay.asyncExec(() -> {
+ IStatus result = null;
+ Throwable throwable = null;
+ try {
+ // As we are in the UI Thread we can
+ // always know what to tell the job.
+ setThread(Thread.currentThread());
+ if (monitor.isCanceled()) {
result = Status.CANCEL_STATUS;
} else {
- UIStats.start(UIStats.UI_JOB, getName());
- result = runInUIThread(monitor);
- }
+ UIStats.start(UIStats.UI_JOB, getName());
+ result = runInUIThread(monitor);
+ }
- } catch(Throwable t){
- throwable = t;
- } finally {
- UIStats.end(UIStats.UI_JOB, UIJob.this, getName());
- if (result == null) {
- result = new Status(IStatus.ERROR,
- PlatformUI.PLUGIN_ID, IStatus.ERROR,
- ProgressMessages.InternalError,
- throwable);
+ } catch (Throwable t) {
+ throwable = t;
+ } finally {
+ UIStats.end(UIStats.UI_JOB, UIJob.this, getName());
+ if (result == null) {
+ result = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.ERROR,
+ ProgressMessages.InternalError, throwable);
}
- done(result);
- }
+ done(result);
+ }
});
- return Job.ASYNC_FINISH;
- }
+ return Job.ASYNC_FINISH;
+ }
- /**
- * Run the job in the UI Thread.
- *
- * @param monitor
- * @return IStatus
- */
- public abstract IStatus runInUIThread(IProgressMonitor monitor);
+ /**
+ * Run the job in the UI Thread.
+ *
+ * @param monitor
+ * @return IStatus
+ */
+ public abstract IStatus runInUIThread(IProgressMonitor monitor);
- /**
- * Sets the display to execute the asyncExec in. Generally this is not'
- * used if there is a valid display available via PlatformUI.isWorkbenchRunning().
- *
- * @param runDisplay
- * Display
- * @see UIJob#getDisplay()
- * @see PlatformUI#isWorkbenchRunning()
- */
- public void setDisplay(Display runDisplay) {
- Assert.isNotNull(runDisplay);
- cachedDisplay = runDisplay;
- }
+ /**
+ * Sets the display to execute the asyncExec in. Generally this is not' used if
+ * there is a valid display available via PlatformUI.isWorkbenchRunning().
+ *
+ * @param runDisplay Display
+ * @see UIJob#getDisplay()
+ * @see PlatformUI#isWorkbenchRunning()
+ */
+ public void setDisplay(Display runDisplay) {
+ Assert.isNotNull(runDisplay);
+ cachedDisplay = runDisplay;
+ }
- /**
- * Returns the display for use by the receiver when running in an
- * asyncExec. If it is not set then the display set in the workbench
- * is used.
- * If the display is null the job will not be run.
- *
- * @return Display or <code>null</code>.
- */
- public Display getDisplay() {
- //If it was not set get it from the workbench
- if (cachedDisplay == null && PlatformUI.isWorkbenchRunning()) {
+ /**
+ * Returns the display for use by the receiver when running in an asyncExec. If
+ * it is not set then the display set in the workbench is used. If the display
+ * is null the job will not be run.
+ *
+ * @return Display or <code>null</code>.
+ */
+ public Display getDisplay() {
+ // If it was not set get it from the workbench
+ if (cachedDisplay == null && PlatformUI.isWorkbenchRunning()) {
return PlatformUI.getWorkbench().getDisplay();
}
- return cachedDisplay;
- }
+ return cachedDisplay;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/WorkbenchJob.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/WorkbenchJob.java
index 8bb0bd72de9..b763b69eb6d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/WorkbenchJob.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/progress/WorkbenchJob.java
@@ -20,80 +20,79 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PlatformUI;
/**
- * WorkbenchJob is a type of job that implements a done listener
- * and does the shutdown checks before scheduling. This is used if
- * a job is not meant to run when the Workbench is shutdown.
+ * WorkbenchJob is a type of job that implements a done listener and does the
+ * shutdown checks before scheduling. This is used if a job is not meant to run
+ * when the Workbench is shutdown.
+ *
* @since 3.0
*/
public abstract class WorkbenchJob extends UIJob {
- /**
- * Create a new instance of the receiver with the
- * supplied display and name.
- * Normally this constructor would not be used as
- * it is best to let the job find the display from
- * the workbench
- * @param jobDisplay Display. The display to run the
- * job with.
- * @param name String
- */
- public WorkbenchJob(Display jobDisplay, String name) {
- super(jobDisplay, name);
- addDefaultJobChangeListener();
- }
+ /**
+ * Create a new instance of the receiver with the supplied display and name.
+ * Normally this constructor would not be used as it is best to let the job find
+ * the display from the workbench
+ *
+ * @param jobDisplay Display. The display to run the job with.
+ * @param name String
+ */
+ public WorkbenchJob(Display jobDisplay, String name) {
+ super(jobDisplay, name);
+ addDefaultJobChangeListener();
+ }
- /**
- * Add a new instance of the receiver with the
- * supplied name.
- * @param name String
- */
- public WorkbenchJob(String name) {
- super(name);
- addDefaultJobChangeListener();
- }
+ /**
+ * Add a new instance of the receiver with the supplied name.
+ *
+ * @param name String
+ */
+ public WorkbenchJob(String name) {
+ super(name);
+ addDefaultJobChangeListener();
+ }
- /**
- * Add a job change listeners that handles a done
- * event if the result was IStatus.OK.
- *
- */
- private void addDefaultJobChangeListener() {
- addJobChangeListener(new JobChangeAdapter() {
+ /**
+ * Add a job change listeners that handles a done event if the result was
+ * IStatus.OK.
+ *
+ */
+ private void addDefaultJobChangeListener() {
+ addJobChangeListener(new JobChangeAdapter() {
- @Override
+ @Override
public void done(IJobChangeEvent event) {
- //Abort if it is not running
- if (!PlatformUI.isWorkbenchRunning()) {
+ // Abort if it is not running
+ if (!PlatformUI.isWorkbenchRunning()) {
return;
}
- if (event.getResult().getCode() == IStatus.OK) {
+ if (event.getResult().getCode() == IStatus.OK) {
performDone(event);
}
- }
- });
- }
+ }
+ });
+ }
- /**
- * Perform done with the supplied event. This will
- * only occur if the returned status was OK.
- * This is called only if the job is finished with an IStatus.OK
- * result and the workbench is still running.
- * @param event IJobChangeEvent
- */
- public void performDone(IJobChangeEvent event) {
- //Do nothing by default.
- }
+ /**
+ * Perform done with the supplied event. This will only occur if the returned
+ * status was OK. This is called only if the job is finished with an IStatus.OK
+ * result and the workbench is still running.
+ *
+ * @param event IJobChangeEvent
+ */
+ public void performDone(IJobChangeEvent event) {
+ // Do nothing by default.
+ }
- @Override
+ @Override
public boolean shouldSchedule() {
- return super.shouldSchedule() && PlatformUI.isWorkbenchRunning();
- }
+ return super.shouldSchedule() && PlatformUI.isWorkbenchRunning();
+ }
- @Override
+ @Override
public boolean shouldRun() {
- return super.shouldRun() && PlatformUI.isWorkbenchRunning();
- }
+ return super.shouldRun() && PlatformUI.isWorkbenchRunning();
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/quickaccess/QuickAccessElement.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/quickaccess/QuickAccessElement.java
index 3fcea98148e..00257dc5cdb 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/quickaccess/QuickAccessElement.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/quickaccess/QuickAccessElement.java
@@ -14,7 +14,6 @@
*******************************************************************************/
package org.eclipse.ui.quickaccess;
-
import org.eclipse.jface.resource.ImageDescriptor;
/**
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/quickaccess/QuickAccessProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/quickaccess/QuickAccessProvider.java
index 7aaaf66298a..d37785b68ea 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/quickaccess/QuickAccessProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/quickaccess/QuickAccessProvider.java
@@ -65,8 +65,7 @@ public abstract class QuickAccessProvider {
* Returns the element for the given ID if available, or null if no matching
* element is available.
*
- * @param id
- * the ID of an element
+ * @param id the ID of an element
* @return the element with the given ID, or null if not found.
*/
public QuickAccessElement getElementForId(String id) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/services/AbstractServiceFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/services/AbstractServiceFactory.java
index 884d6d09827..84158f211a2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/services/AbstractServiceFactory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/services/AbstractServiceFactory.java
@@ -16,9 +16,9 @@ package org.eclipse.ui.services;
/**
* A factory for creating services for use with the
- * <code>org.eclipse.ui.services</code> extension point. You are given a
- * service locator to look up other services, and can retrieve your parent
- * service (if one has already been created).
+ * <code>org.eclipse.ui.services</code> extension point. You are given a service
+ * locator to look up other services, and can retrieve your parent service (if
+ * one has already been created).
*
* @since 3.4
*/
@@ -30,22 +30,19 @@ public abstract class AbstractServiceFactory {
* <p>
* You can use the locator to get any needed services and a parent service
* locator will be provided if you need access to the parent service. If the
- * parent object return from the parent locator is not <code>null</code>
- * it can be cast to the service interface that is requested. The parent
- * service locator will only return the serviceInterface service.
+ * parent object return from the parent locator is not <code>null</code> it can
+ * be cast to the service interface that is requested. The parent service
+ * locator will only return the serviceInterface service.
* </p>
*
- * @param serviceInterface
- * the service we need to create. Will not be <code>null</code>.
- * @param parentLocator
- * A locator that can return a parent service instance if
- * desired. The parent service can be cast to serviceInterface.
- * Will not be <code>null</code>.
- * @param locator
- * the service locator which can be used to retrieve dependent
- * services. Will not be <code>null</code>
+ * @param serviceInterface the service we need to create. Will not be
+ * <code>null</code>.
+ * @param parentLocator A locator that can return a parent service instance
+ * if desired. The parent service can be cast to
+ * serviceInterface. Will not be <code>null</code>.
+ * @param locator the service locator which can be used to retrieve
+ * dependent services. Will not be <code>null</code>
* @return the created service or <code>null</code>
*/
- public abstract Object create(Class serviceInterface,
- IServiceLocator parentLocator, IServiceLocator locator);
+ public abstract Object create(Class serviceInterface, IServiceLocator parentLocator, IServiceLocator locator);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/services/IDisposable.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/services/IDisposable.java
index a846120f2e6..4d0bb76f5e2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/services/IDisposable.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/services/IDisposable.java
@@ -40,8 +40,8 @@ package org.eclipse.ui.services;
public interface IDisposable {
/**
- * Disposes of this service. All resources must be freed. All listeners must
- * be detached. Dispose will only be called once during the life cycle of a
+ * Disposes of this service. All resources must be freed. All listeners must be
+ * detached. Dispose will only be called once during the life cycle of a
* service.
*/
void dispose();
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/services/IEvaluationService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/services/IEvaluationService.java
index a33ad3cdf0e..e0b7f3c31fe 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/services/IEvaluationService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/services/IEvaluationService.java
@@ -81,68 +81,61 @@ public interface IEvaluationService extends IServiceWithSources {
/**
* When a source change starts recalculating expressions the
- * {@link #PROP_NOTIFYING} property change is fired with the newValue=<code>Boolean.TRUE</code>.
- * This property is not fired for any source changes caused by the outer
- * recalculations.
+ * {@link #PROP_NOTIFYING} property change is fired with the
+ * newValue=<code>Boolean.TRUE</code>. This property is not fired for any source
+ * changes caused by the outer recalculations.
* <p>
- * <b>Note:</b> listeners should be removed when no longer necessary. If
- * not, they will be removed when the IServiceLocator used to acquire this
- * service is disposed.
+ * <b>Note:</b> listeners should be removed when no longer necessary. If not,
+ * they will be removed when the IServiceLocator used to acquire this service is
+ * disposed.
* </p>
*
- * @param listener
- * The listener to be notified. Must not be <code>null</code>.
- * Has no effect if the listener has already been added.
+ * @param listener The listener to be notified. Must not be <code>null</code>.
+ * Has no effect if the listener has already been added.
*/
void addServiceListener(IPropertyChangeListener listener);
/**
* Remove the listener for {@link #PROP_NOTIFYING} property changes.
*
- * @param listener
- * The listener to remove. Must not be <code>null</code>. Has
- * no effect if the listener is not currently registered.
+ * @param listener The listener to remove. Must not be <code>null</code>. Has no
+ * effect if the listener is not currently registered.
*/
void removeServiceListener(IPropertyChangeListener listener);
/**
- * Add a listener that can be notified when the workbench application
- * context causes the expression evaluation value to change.
+ * Add a listener that can be notified when the workbench application context
+ * causes the expression evaluation value to change.
* <p>
- * <b>Note:</b> listeners should be removed when no longer necessary. If
- * not, they will be removed when the IServiceLocator used to acquire this
- * service is disposed.
+ * <b>Note:</b> listeners should be removed when no longer necessary. If not,
+ * they will be removed when the IServiceLocator used to acquire this service is
+ * disposed.
* </p>
*
- * @param expression
- * the core expression to evaluate.
- * @param listener
- * the listener to be notified.
- * @param property
- * the property contained in the notification
+ * @param expression the core expression to evaluate.
+ * @param listener the listener to be notified.
+ * @param property the property contained in the notification
* @return a token that can be used to remove this listener.
- * {@link #removeEvaluationListener(IEvaluationReference)}
+ * {@link #removeEvaluationListener(IEvaluationReference)}
*/
- IEvaluationReference addEvaluationListener(Expression expression,
- IPropertyChangeListener listener, String property);
+ IEvaluationReference addEvaluationListener(Expression expression, IPropertyChangeListener listener,
+ String property);
/**
* Re-add a property change listener that has already been removed by
* {@link #removeEvaluationListener(IEvaluationReference)}.
* <p>
- * It will only accept IEvaluationReferences returned from a previous call
- * to
+ * It will only accept IEvaluationReferences returned from a previous call to
* {@link #addEvaluationListener(Expression, IPropertyChangeListener, String)}
* on this service.
* </p>
* <p>
- * <b>Note:</b> references should be removed when no longer necessary. If
- * not, they will be removed when the IServiceLocator used to acquire this
- * service is disposed.
+ * <b>Note:</b> references should be removed when no longer necessary. If not,
+ * they will be removed when the IServiceLocator used to acquire this service is
+ * disposed.
* </p>
*
- * @param ref
- * The listener to re-add.
+ * @param ref The listener to re-add.
* @see #removeEvaluationListener(IEvaluationReference)
*/
void addEvaluationReference(IEvaluationReference ref);
@@ -150,15 +143,14 @@ public interface IEvaluationService extends IServiceWithSources {
/**
* Remove the listener represented by the evaluation reference.
*
- * @param ref
- * the reference to be removed.
+ * @param ref the reference to be removed.
*/
void removeEvaluationListener(IEvaluationReference ref);
/**
- * Get an IEvaluationContext that contains the current state of the
- * workbench application context. This context changes with the application
- * state, but becomes invalid when the global current selection changes.
+ * Get an IEvaluationContext that contains the current state of the workbench
+ * application context. This context changes with the application state, but
+ * becomes invalid when the global current selection changes.
* <p>
* Note: This context should not be modified.
* </p>
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/services/IServiceLocator.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/services/IServiceLocator.java
index 6821e504a89..13fb00e36a0 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/services/IServiceLocator.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/services/IServiceLocator.java
@@ -37,26 +37,23 @@ public interface IServiceLocator {
/**
* Retrieves the service corresponding to the given API.
*
- * @param api
- * This is the interface that the service implements. Must not be
+ * @param api This is the interface that the service implements. Must not be
* <code>null</code>.
- * @return The service, or <code>null</code> if no such service could be
- * found.
+ * @return The service, or <code>null</code> if no such service could be found.
*/
<T> T getService(Class<T> api);
/**
- * Whether this service exists within the scope of this service locator.
- * This does not include looking for the service within the scope of the
- * parents. This method can be used to determine whether a particular
- * service supports nesting in this scope.
+ * Whether this service exists within the scope of this service locator. This
+ * does not include looking for the service within the scope of the parents.
+ * This method can be used to determine whether a particular service supports
+ * nesting in this scope.
*
- * @param api
- * This is the interface that the service implements. Must not be
+ * @param api This is the interface that the service implements. Must not be
* <code>null</code>.
- * @return <code>true</code> if the service locator can find a service for
- * the given API; <code>false</code> otherwise.
+ * @return <code>true</code> if the service locator can find a service for the
+ * given API; <code>false</code> otherwise.
*/
boolean hasService(Class<?> api);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/services/IServiceScopes.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/services/IServiceScopes.java
index 8838d99e3b2..abb5b3e2ab5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/services/IServiceScopes.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/services/IServiceScopes.java
@@ -14,7 +14,6 @@
package org.eclipse.ui.services;
-
/**
* Different levels of service locators supported by the workbench.
*
@@ -40,12 +39,12 @@ public interface IServiceScopes {
String WINDOW_SCOPE = "org.eclipse.ui.IWorkbenchWindow"; //$NON-NLS-1$
/**
- * A part site service locator scope. Found in editors and views.
+ * A part site service locator scope. Found in editors and views.
*/
String PARTSITE_SCOPE = "org.eclipse.ui.part.IWorkbenchPartSite"; //$NON-NLS-1$
/**
- * A page site service locator scope. Found in pages in a PageBookView.
+ * A page site service locator scope. Found in pages in a PageBookView.
*/
String PAGESITE_SCOPE = "org.eclipse.ui.part.PageSite"; //$NON-NLS-1$
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/services/IServiceWithSources.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/services/IServiceWithSources.java
index dd020fa3d31..6df30694743 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/services/IServiceWithSources.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/services/IServiceWithSources.java
@@ -31,22 +31,20 @@ public interface IServiceWithSources extends IDisposable {
/**
* Adds a source provider to this service. A source provider will notify the
- * service when the source it provides changes. An example of a source might
- * be an active editor or the current selection. This amounts to a pluggable
- * state tracker for the service.
+ * service when the source it provides changes. An example of a source might be
+ * an active editor or the current selection. This amounts to a pluggable state
+ * tracker for the service.
*
- * @param provider
- * The provider to add; must not be <code>null</code>.
+ * @param provider The provider to add; must not be <code>null</code>.
*/
void addSourceProvider(ISourceProvider provider);
/**
- * Removes a source provider from this service. Most of the time, this
- * method call is not required as source providers typically share the same
- * life span as the workbench itself.
+ * Removes a source provider from this service. Most of the time, this method
+ * call is not required as source providers typically share the same life span
+ * as the workbench itself.
*
- * @param provider
- * The provider to remove; must not be <code>null</code>.
+ * @param provider The provider to remove; must not be <code>null</code>.
*/
void removeSourceProvider(ISourceProvider provider);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/services/ISourceProviderService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/services/ISourceProviderService.java
index bc3269d2b2b..ccfb0ffaf57 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/services/ISourceProviderService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/services/ISourceProviderService.java
@@ -43,8 +43,7 @@ public interface ISourceProviderService {
* Retrieves a source provider providing the given source. This is used by
* clients who only need specific sources.
*
- * @param sourceName
- * The name of the source; must not be <code>null</code>.
+ * @param sourceName The name of the source; must not be <code>null</code>.
* @return A source provider which provides the request source, or
* <code>null</code> if no such source exists.
* @see org.eclipse.ui.ISources
@@ -55,9 +54,9 @@ public interface ISourceProviderService {
* Retrieves all of the source providers registered with this service at the
* time of this call.
* <p>
- * <code>org.eclipse.ui.services.IEvaluationService</code> can be used
- * to receive notifications about source variable changes and to
- * evaluate core expressions against source providers.
+ * <code>org.eclipse.ui.services.IEvaluationService</code> can be used to
+ * receive notifications about source variable changes and to evaluate core
+ * expressions against source providers.
* </p>
*
* @return The source providers registered with this service. This value is
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/splash/AbstractSplashHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/splash/AbstractSplashHandler.java
index c5e3de9e066..64cd2133ac3 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/splash/AbstractSplashHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/splash/AbstractSplashHandler.java
@@ -38,25 +38,24 @@ public abstract class AbstractSplashHandler {
* Initialize this splash implementation. This is called very early in the
* workbench lifecycle before any window is created. The provided shell will
* already have a background image provided to it but subclasses are free to
- * customize the shell in whatever way they see fit. Subclasses should
- * ensure that they call the base implementation of this method at some
- * point after their own method is invoked.
+ * customize the shell in whatever way they see fit. Subclasses should ensure
+ * that they call the base implementation of this method at some point after
+ * their own method is invoked.
*
* <p>
* Calls to this method will be made from the UI thread.
* </p>
*
- * @param splash
- * the splash shell
+ * @param splash the splash shell
*/
public void init(Shell splash) {
this.shell = splash;
}
/**
- * Signal the handler to end the splash and dispose of any resources.
- * Subclasses should ensure that they call the base implementation of this
- * method at some point after their own method is invoked.
+ * Signal the handler to end the splash and dispose of any resources. Subclasses
+ * should ensure that they call the base implementation of this method at some
+ * point after their own method is invoked.
*
* <p>
* Calls to this method will be made from the UI thread.
@@ -68,22 +67,21 @@ public abstract class AbstractSplashHandler {
}
/**
- * Return the progress monitor responsible for showing bundle loading.
- * Default implementation returns a null progress monitor.
+ * Return the progress monitor responsible for showing bundle loading. Default
+ * implementation returns a null progress monitor.
*
* <p>
* Calls made to methods on this progress monitor may be made from non-UI
- * threads so implementors must take care to ensure proper synchronization
- * with the UI thread if necessary.
+ * threads so implementors must take care to ensure proper synchronization with
+ * the UI thread if necessary.
* </p>
*
* <p>
* Please note that progress will only be shown if the
* "org.eclipse.ui/SHOW_PROGRESS_ON_STARTUP" property has been set to
- * <code>true</code>. Because this property defaults to <code>false</code>
- * RCP developers must set this property via a
- * <code>plugin_customization.ini</code> file or by setting the preference
- * on the Platform UI preference store in the
+ * <code>true</code>. Because this property defaults to <code>false</code> RCP
+ * developers must set this property via a <code>plugin_customization.ini</code>
+ * file or by setting the preference on the Platform UI preference store in the
* {@link WorkbenchAdvisor#initialize(org.eclipse.ui.application.IWorkbenchConfigurer)}
* method if they wish to have progress reported on startup.
* </p>
@@ -100,15 +98,15 @@ public abstract class AbstractSplashHandler {
/**
* Get the {@link Shell} associated with this splash screen. If this method
- * returns a non-<code>null</code> value prior to the
- * {@link #init(Shell)} being invoked then this shell will be used for the
- * splash shell and it will subsequently be passed to the
- * {@link #init(Shell)} method. In this way a splash handler may participate
- * in splash processes prior to the workbench startup.
+ * returns a non-<code>null</code> value prior to the {@link #init(Shell)} being
+ * invoked then this shell will be used for the splash shell and it will
+ * subsequently be passed to the {@link #init(Shell)} method. In this way a
+ * splash handler may participate in splash processes prior to the workbench
+ * startup.
*
* <p>
- * Calls to this method may be made from any thread. Implementors must take
- * care to ensure proper synchronization with the UI thread if necessary.
+ * Calls to this method may be made from any thread. Implementors must take care
+ * to ensure proper synchronization with the UI thread if necessary.
* </p>
*
* @return the splash shell
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/splash/BasicSplashHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/splash/BasicSplashHandler.java
index d9b89a035b0..4bd811bb182 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/splash/BasicSplashHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/splash/BasicSplashHandler.java
@@ -44,8 +44,8 @@ public abstract class BasicSplashHandler extends AbstractSplashHandler {
private static final String SPLASH_PROGRESS_TEXT_ID = "org-eclipse-ui-splash-progressText"; //$NON-NLS-1$
/**
- * Hacks the progress monitor to have absolute positioning for its controls.
- * In addition, all methods that access the controls will be wrapped in an
+ * Hacks the progress monitor to have absolute positioning for its controls. In
+ * addition, all methods that access the controls will be wrapped in an
* asynchExec().
*/
class AbsolutePositionProgressMonitorPart extends ProgressMonitorPart {
@@ -75,8 +75,7 @@ public abstract class BasicSplashHandler extends AbstractSplashHandler {
updateUI(() -> {
if (isDisposed())
return;
- AbsolutePositionProgressMonitorPart.super.beginTask(name,
- totalWork);
+ AbsolutePositionProgressMonitorPart.super.beginTask(name, totalWork);
});
}
@@ -98,8 +97,7 @@ public abstract class BasicSplashHandler extends AbstractSplashHandler {
updateUI(() -> {
if (isDisposed())
return;
- AbsolutePositionProgressMonitorPart.super
- .internalWorked(work);
+ AbsolutePositionProgressMonitorPart.super.internalWorked(work);
});
}
@@ -137,7 +135,7 @@ public abstract class BasicSplashHandler extends AbstractSplashHandler {
if (monitor == null) {
Composite parent = new Composite(getSplash(), Window.getDefaultOrientation());
Point size = getSplash().getSize();
- parent.setBounds(new Rectangle(0,0,size.x,size.y));
+ parent.setBounds(new Rectangle(0, 0, size.x, size.y));
monitor = new AbsolutePositionProgressMonitorPart(parent);
monitor.setSize(size);
if (progressRect != null)
@@ -153,8 +151,7 @@ public abstract class BasicSplashHandler extends AbstractSplashHandler {
if (foreground != null)
monitor.getProgressText().setForeground(foreground);
monitor.setBackgroundMode(SWT.INHERIT_FORCE);
- monitor.setBackgroundImage(getSplash().getShell()
- .getBackgroundImage());
+ monitor.setBackgroundImage(getSplash().getShell().getBackgroundImage());
}
return monitor;
}
@@ -170,21 +167,18 @@ public abstract class BasicSplashHandler extends AbstractSplashHandler {
* Set the foreground text color. This method has no effect after
* {@link #getBundleProgressMonitor()} has been invoked.
*
- * @param foregroundRGB
- * the color
+ * @param foregroundRGB the color
*/
protected void setForeground(RGB foregroundRGB) {
if (monitor != null)
return;
if (this.foreground != null)
this.foreground.dispose();
- this.foreground = new Color(getSplash().getShell().getDisplay(),
- foregroundRGB);
+ this.foreground = new Color(getSplash().getShell().getDisplay(), foregroundRGB);
}
/**
- * Get the foreground text color. This color should not be disposed by
- * callers.
+ * Get the foreground text color. This color should not be disposed by callers.
*
* @return the foreground color
*/
@@ -193,44 +187,41 @@ public abstract class BasicSplashHandler extends AbstractSplashHandler {
}
/**
- * Set the location of the message text in the splash. This method has no
- * effect after {@link #getBundleProgressMonitor()} has been invoked.
+ * Set the location of the message text in the splash. This method has no effect
+ * after {@link #getBundleProgressMonitor()} has been invoked.
*
- * @param messageRect
- * the location of the message text
+ * @param messageRect the location of the message text
*/
protected void setMessageRect(Rectangle messageRect) {
this.messageRect = messageRect;
}
/**
- * Set the location of the progress bar in the splash. This method has no
- * effect after {@link #getBundleProgressMonitor()} has been invoked.
+ * Set the location of the progress bar in the splash. This method has no effect
+ * after {@link #getBundleProgressMonitor()} has been invoked.
*
- * @param progressRect
- * the location of the progress bar
+ * @param progressRect the location of the progress bar
*/
protected void setProgressRect(Rectangle progressRect) {
this.progressRect = progressRect;
}
/**
- * Get the composite on which any supplemental controls should be drawn.
- * This will not have a layout set and clients are responsible for setting
- * the location of child controls manually.
+ * Get the composite on which any supplemental controls should be drawn. This
+ * will not have a layout set and clients are responsible for setting the
+ * location of child controls manually.
*
* <p>
* This method must be called in the
- * {@link #init(org.eclipse.swt.widgets.Shell)} method of a subclasses to
- * ensure proper creation of controls
+ * {@link #init(org.eclipse.swt.widgets.Shell)} method of a subclasses to ensure
+ * proper creation of controls
* </p>
*
* <p>
- * Please note that the default implementation of this method assumes that
- * the {@link IProgressMonitor} returned from
- * {@link #getBundleProgressMonitor()} can be safely casted to a
- * {@link Composite}. If this is not the case this method must be
- * reimplemented to reflect the new progress controls.
+ * Please note that the default implementation of this method assumes that the
+ * {@link IProgressMonitor} returned from {@link #getBundleProgressMonitor()}
+ * can be safely casted to a {@link Composite}. If this is not the case this
+ * method must be reimplemented to reflect the new progress controls.
* </p>
*
* @see #init(org.eclipse.swt.widgets.Shell)
@@ -241,12 +232,11 @@ public abstract class BasicSplashHandler extends AbstractSplashHandler {
}
/**
- * Perform some update on the splash. If called from a non-UI thread it will
- * be wrapped by a runnable that may be run before the workbench has been
- * fully realized.
+ * Perform some update on the splash. If called from a non-UI thread it will be
+ * wrapped by a runnable that may be run before the workbench has been fully
+ * realized.
*
- * @param r
- * the update runnable
+ * @param r the update runnable
* @throws Throwable
*/
private void updateUI(final Runnable r) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/statushandlers/AbstractStatusAreaProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/statushandlers/AbstractStatusAreaProvider.java
index 7385fdcc895..7479fd1ffa5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/statushandlers/AbstractStatusAreaProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/statushandlers/AbstractStatusAreaProvider.java
@@ -27,8 +27,8 @@ import org.eclipse.swt.widgets.Control;
* </p>
*
* <p>
- * The area provider can be set in {@link WorkbenchStatusDialogManager} as well as in
- * JFace {@link Policy} since its extends {@link ErrorSupportProvider}.
+ * The area provider can be set in {@link WorkbenchStatusDialogManager} as well
+ * as in JFace {@link Policy} since its extends {@link ErrorSupportProvider}.
* </p>
*
* @see Policy#setErrorSupportProvider(ErrorSupportProvider)
@@ -41,14 +41,11 @@ public abstract class AbstractStatusAreaProvider extends ErrorSupportProvider {
/**
* Create an area for detailed support area as a child of the given parent.
*
- * @param parent
- * A {@link Composite} that will host support area.
- * @param statusAdapter
- * The {@link StatusAdapter} to be supported.
+ * @param parent A {@link Composite} that will host support area.
+ * @param statusAdapter The {@link StatusAdapter} to be supported.
* @return a control, that hold all support elements.
*/
- public abstract Control createSupportArea(Composite parent,
- StatusAdapter statusAdapter);
+ public abstract Control createSupportArea(Composite parent, StatusAdapter statusAdapter);
@Override
public final Control createSupportArea(Composite parent, IStatus status) {
@@ -61,15 +58,13 @@ public abstract class AbstractStatusAreaProvider extends ErrorSupportProvider {
* display any significant implementation.
* <p>
* <b>Important</b>: This API is a part of work in progress and therefore is
- * suitable only for support area providers (which are presented in the
- * status dialog tray).
+ * suitable only for support area providers (which are presented in the status
+ * dialog tray).
* </p>
*
- * @param statusAdapter
- * - {@link StatusAdapter} for which status are will be
- * requested.
- * @return true if provider is able to process particular
- * {@link StatusAdapter}
+ * @param statusAdapter - {@link StatusAdapter} for which status are will be
+ * requested.
+ * @return true if provider is able to process particular {@link StatusAdapter}
* @since 3.6
*/
public boolean validFor(StatusAdapter statusAdapter) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/statushandlers/AbstractStatusHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/statushandlers/AbstractStatusHandler.java
index b9756516395..d12427d682f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/statushandlers/AbstractStatusHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/statushandlers/AbstractStatusHandler.java
@@ -29,9 +29,9 @@ import org.eclipse.ui.application.WorkbenchAdvisor;
* <p>
* All status handlers extends
* <code>org.eclipse.ui.statushandlers.AbstractStatusHandler</code>. Each
- * handler implements <code>handle(StatusAdapter status, int style)</code>.
- * This method handles statuses due to handling style. The style indicates how
- * status handler should handle a status.
+ * handler implements <code>handle(StatusAdapter status, int style)</code>. This
+ * method handles statuses due to handling style. The style indicates how status
+ * handler should handle a status.
* </p>
*
* <p>
@@ -42,10 +42,10 @@ import org.eclipse.ui.application.WorkbenchAdvisor;
* Handlers shoudn't be used directly but through the {@link StatusManager}. It
* chooses which handler should be used for handling. There are two ways for
* adding handlers to the handling flow. First using extension point
- * <code>org.eclipse.ui.statusHandlers</code>, second by the workbench
- * advisor and its method {@link WorkbenchAdvisor#getWorkbenchErrorHandler()}.
- * If a handler is associated with a product, it is used instead of this defined
- * in advisor.
+ * <code>org.eclipse.ui.statusHandlers</code>, second by the workbench advisor
+ * and its method {@link WorkbenchAdvisor#getWorkbenchErrorHandler()}. If a
+ * handler is associated with a product, it is used instead of this defined in
+ * advisor.
* </p>
*
* <p>
@@ -66,11 +66,10 @@ public abstract class AbstractStatusHandler {
/**
* Handles {@link StatusAdapter} objects based on the set style.
*
- * @param statusAdapter
- * the status adapter. May not be <code>null</code>.
- * @param style
- * style constant. Acceptable values are defined in
- * {@link StatusManager} and can be combined with logical OR.
+ * @param statusAdapter the status adapter. May not be <code>null</code>.
+ * @param style style constant. Acceptable values are defined in
+ * {@link StatusManager} and can be combined with logical
+ * OR.
*
* @see StatusManager#BLOCK
* @see StatusManager#NONE
@@ -89,13 +88,12 @@ public abstract class AbstractStatusHandler {
}
/**
- * Returns the value of the handler's parameter identified by the given key,
- * or <code>null</code> if this handler has no such parameter.
+ * Returns the value of the handler's parameter identified by the given key, or
+ * <code>null</code> if this handler has no such parameter.
*
- * @param key
- * the name of the property
- * @return the value of the parameter, or <code>null</code> if this
- * handler has no such parameter
+ * @param key the name of the property
+ * @return the value of the parameter, or <code>null</code> if this handler has
+ * no such parameter
*/
public Object getParam(Object key) {
if (params != null) {
@@ -108,12 +106,10 @@ public abstract class AbstractStatusHandler {
/**
* Sets the parameters for the handler. If the handler is added via the
* <code> org.eclipse.ui.statushandlers extension</code>, the parameters are set
- * during initialization of the handler using <code>parameter</code>
- * elements from <code>statusHandler</code>
- * element.
+ * during initialization of the handler using <code>parameter</code> elements
+ * from <code>statusHandler</code> element.
*
- * @param params
- * the parameters to set
+ * @param params the parameters to set
*/
public void setParams(Map params) {
this.params = params;
@@ -129,30 +125,27 @@ public abstract class AbstractStatusHandler {
}
/**
- * Sets the id for the handler. If the handler is added as an extension, the
- * id is set during initialization of the handler using <code>id</code>
- * attribute of <code>statusHandler</code> element.
+ * Sets the id for the handler. If the handler is added as an extension, the id
+ * is set during initialization of the handler using <code>id</code> attribute
+ * of <code>statusHandler</code> element.
*
- * @param id
- * the id to set
+ * @param id the id to set
*/
public void setId(String id) {
this.id = id;
}
/**
- * This methods indicates if particular notification type is supported and
- * if {@link StatusManager#fireNotification(int, StatusAdapter[])} will be
- * called after the event occurs. Only known notification types should be
- * accepted, whereas unknown types should be always rejected.
+ * This methods indicates if particular notification type is supported and if
+ * {@link StatusManager#fireNotification(int, StatusAdapter[])} will be called
+ * after the event occurs. Only known notification types should be accepted,
+ * whereas unknown types should be always rejected.
*
- * @param type
- * - a notification type that should be checked.
- * @return true if particular event notification is supported, false
- * otherwise
+ * @param type - a notification type that should be checked.
+ * @return true if particular event notification is supported, false otherwise
* @since 3.5
*/
- public boolean supportsNotification(int type){
+ public boolean supportsNotification(int type) {
return false;
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/statushandlers/IStatusAdapterConstants.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/statushandlers/IStatusAdapterConstants.java
index 1cf405b31ce..348cdbdd1c6 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/statushandlers/IStatusAdapterConstants.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/statushandlers/IStatusAdapterConstants.java
@@ -32,54 +32,49 @@ public interface IStatusAdapterConstants {
/**
* Common prefix for properties defined in this interface.
*/
- String PROPERTY_PREFIX = PlatformUI.PLUGIN_ID
- + ".workbench.statusHandlers.adapters"; //$NON-NLS-1$
+ String PROPERTY_PREFIX = PlatformUI.PLUGIN_ID + ".workbench.statusHandlers.adapters"; //$NON-NLS-1$
/**
- * This property is used to add title to the adapter. If the adapter is
- * shown in a dialog, this property is used to create title of the dialog.
+ * This property is used to add title to the adapter. If the adapter is shown in
+ * a dialog, this property is used to create title of the dialog.
*
* <p>
* The property must be of type <code>String</code>.
* </p>
*/
- QualifiedName TITLE_PROPERTY = new QualifiedName(
- PROPERTY_PREFIX, "title"); //$NON-NLS-1$
+ QualifiedName TITLE_PROPERTY = new QualifiedName(PROPERTY_PREFIX, "title"); //$NON-NLS-1$
/**
- * This property is used to add a timestamp to the adapter. If the adapter
- * is shown in the UI, this property can be used for sorting and showing
+ * This property is used to add a timestamp to the adapter. If the adapter is
+ * shown in the UI, this property can be used for sorting and showing
* information about the status creation time.
*
* <p>
* The property must be of type <code>Long</code>.
* </p>
*/
- QualifiedName TIMESTAMP_PROPERTY = new QualifiedName(
- PROPERTY_PREFIX, "timestamp"); //$NON-NLS-1$
+ QualifiedName TIMESTAMP_PROPERTY = new QualifiedName(PROPERTY_PREFIX, "timestamp"); //$NON-NLS-1$
/**
- * This property is used to add an explanation to the adapter. If the
- * adapter is shown in the UI, this property should be used to present
- * additional explanation for the status.
+ * This property is used to add an explanation to the adapter. If the adapter is
+ * shown in the UI, this property should be used to present additional
+ * explanation for the status.
*
* <p>
* The property must be of type <code>String</code>.
* </p>
*/
- QualifiedName EXPLANATION_PROPERTY = new QualifiedName(
- PROPERTY_PREFIX, "explanation"); //$NON-NLS-1$
+ QualifiedName EXPLANATION_PROPERTY = new QualifiedName(PROPERTY_PREFIX, "explanation"); //$NON-NLS-1$
/**
- * This property is used to add a hint to the adapter. If the adapter is
- * shown in the UI, this property should be used to present suggested
- * actions that have to be performed by the user.
+ * This property is used to add a hint to the adapter. If the adapter is shown
+ * in the UI, this property should be used to present suggested actions that
+ * have to be performed by the user.
*
* <p>
* The property must be of type <code>String</code>.
* </p>
*/
- QualifiedName HINT_PROPERTY = new QualifiedName(
- PROPERTY_PREFIX, "suggestedAction"); //$NON-NLS-1$
+ QualifiedName HINT_PROPERTY = new QualifiedName(PROPERTY_PREFIX, "suggestedAction"); //$NON-NLS-1$
} \ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/statushandlers/StatusAdapter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/statushandlers/StatusAdapter.java
index 77c5c7de6cc..dd03655ffaf 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/statushandlers/StatusAdapter.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/statushandlers/StatusAdapter.java
@@ -22,8 +22,8 @@ import org.eclipse.core.runtime.QualifiedName;
/**
* <p>
* The StatusAdapter wraps an instance of IStatus subclass and can hold
- * additional information either by using properties or by adding a new adapter. Used during
- * status handling process.
+ * additional information either by using properties or by adding a new adapter.
+ * Used during status handling process.
* </p>
*
* @since 3.3
@@ -31,8 +31,8 @@ import org.eclipse.core.runtime.QualifiedName;
public class StatusAdapter implements IAdaptable {
/**
- * This property is used to add title to the adapter. If the adapter is
- * shown in a dialog, this property is used to create title of the dialog.
+ * This property is used to add title to the adapter. If the adapter is shown in
+ * a dialog, this property is used to create title of the dialog.
*
* @deprecated use {@link IStatusAdapterConstants#TITLE_PROPERTY} instead
*/
@@ -40,16 +40,15 @@ public class StatusAdapter implements IAdaptable {
public static final QualifiedName TITLE_PROPERTY = IStatusAdapterConstants.TITLE_PROPERTY;
/**
- * This property is used to add a timestamp to the adapter. If the adapter
- * is shown in the UI, this property can be used for sorting and showing
+ * This property is used to add a timestamp to the adapter. If the adapter is
+ * shown in the UI, this property can be used for sorting and showing
* information about the status creation time.
*
* <p>
* The property must be of type <code>Long</code>.
* </p>
*
- * @deprecated use {@link IStatusAdapterConstants#TIMESTAMP_PROPERTY}
- * instead
+ * @deprecated use {@link IStatusAdapterConstants#TIMESTAMP_PROPERTY} instead
*/
@Deprecated
public static final QualifiedName TIMESTAMP_PROPERTY = IStatusAdapterConstants.TIMESTAMP_PROPERTY;
@@ -63,8 +62,7 @@ public class StatusAdapter implements IAdaptable {
/**
* Creates an instance of this class.
*
- * @param status
- * the status to wrap. May not be <code>null</code>.
+ * @param status the status to wrap. May not be <code>null</code>.
*/
public StatusAdapter(IStatus status) {
this.status = status;
@@ -72,13 +70,11 @@ public class StatusAdapter implements IAdaptable {
/**
* Associates new object which is an instance of the given class with this
- * adapter. object will be returned when {@link IAdaptable#getAdapter(Class)}
- * is called on the receiver with {@link Class} adapter as a parameter.
+ * adapter. object will be returned when {@link IAdaptable#getAdapter(Class)} is
+ * called on the receiver with {@link Class} adapter as a parameter.
*
- * @param adapter
- * the adapter class
- * @param object
- * the adapter instance
+ * @param adapter the adapter class
+ * @param object the adapter instance
*/
public void addAdapter(Class adapter, Object object) {
if (adapters == null) {
@@ -108,21 +104,19 @@ public class StatusAdapter implements IAdaptable {
/**
* Sets a new status for this adapter.
*
- * @param status
- * the status to set. May not be <code>null</code>.
+ * @param status the status to set. May not be <code>null</code>.
*/
public void setStatus(IStatus status) {
this.status = status;
}
/**
- * Returns the value of the adapter's property identified by the given key,
- * or <code>null</code> if this adapter has no such property.
+ * Returns the value of the adapter's property identified by the given key, or
+ * <code>null</code> if this adapter has no such property.
*
- * @param key
- * the qualified name of the property
- * @return the value of the property, or <code>null</code> if this adapter
- * has no such property
+ * @param key the qualified name of the property
+ * @return the value of the property, or <code>null</code> if this adapter has
+ * no such property
*/
public Object getProperty(QualifiedName key) {
if (properties == null) {
@@ -134,10 +128,8 @@ public class StatusAdapter implements IAdaptable {
/**
* Sets the value of the receiver's property identified by the given key.
*
- * @param key
- * the qualified name of the property
- * @param value
- * the value of the property
+ * @param key the qualified name of the property
+ * @param value the value of the property
*/
public void setProperty(QualifiedName key, Object value) {
if (properties == null) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/statushandlers/StatusManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/statushandlers/StatusManager.java
index edbe80947c0..f557e52668a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/statushandlers/StatusManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/statushandlers/StatusManager.java
@@ -79,9 +79,8 @@ import org.osgi.framework.BundleContext;
*/
public class StatusManager {
/**
- * A style indicating that the status should not be acted on. This is used
- * by objects such as log listeners that do not want to report a status
- * twice.
+ * A style indicating that the status should not be acted on. This is used by
+ * objects such as log listeners that do not want to report a status twice.
*/
public static final int NONE = 0;
@@ -92,21 +91,22 @@ public class StatusManager {
/**
* A style indicating that handlers should show a problem to an user without
- * blocking the calling method while awaiting user response. This is
- * generally done using a non modal {@link Dialog}.
+ * blocking the calling method while awaiting user response. This is generally
+ * done using a non modal {@link Dialog}.
*/
public static final int SHOW = 0x02;
/**
- * A style indicating that the handling should block the calling thread
- * until the status has been handled.
+ * A style indicating that the handling should block the calling thread until
+ * the status has been handled.
* <p>
* A typical usage of this would be to ensure that the user's actions are
- * blocked until they've dealt with the status in some manner. It is
- * therefore likely but not required that the <code>StatusHandler</code>
- * would achieve this through the use of a modal dialog.
- * </p><p>Due to the fact
- * that use of <code>BLOCK</code> will block UI, care should be
+ * blocked until they've dealt with the status in some manner. It is therefore
+ * likely but not required that the <code>StatusHandler</code> would achieve
+ * this through the use of a modal dialog.
+ * </p>
+ * <p>
+ * Due to the fact that use of <code>BLOCK</code> will block UI, care should be
* taken in this use of this flag.
* </p>
*/
@@ -141,7 +141,7 @@ public class StatusManager {
Platform.addLogListener(new StatusManagerLogListener());
}
- private AbstractStatusHandler getStatusHandler(){
+ private AbstractStatusHandler getStatusHandler() {
if (statusHandler != null) {
return statusHandler;
}
@@ -171,31 +171,29 @@ public class StatusManager {
}
return statusHandler;
}
+
/**
* Handles the given status adapter due to the style. Because the facility
* depends on Workbench, this method will log the status, if Workbench isn't
- * initialized and the style isn't {@link #NONE}. If Workbench isn't
- * initialized and the style is {@link #NONE}, the manager will do nothing.
+ * initialized and the style isn't {@link #NONE}. If Workbench isn't initialized
+ * and the style is {@link #NONE}, the manager will do nothing.
*
- * @param statusAdapter
- * the status adapter
- * @param style
- * the style. Value can be combined with logical OR. One of
- * {@link #NONE}, {@link #LOG}, {@link #SHOW} and
- * {@link #BLOCK}.
+ * @param statusAdapter the status adapter
+ * @param style the style. Value can be combined with logical OR. One of
+ * {@link #NONE}, {@link #LOG}, {@link #SHOW} and
+ * {@link #BLOCK}.
*/
public void handle(StatusAdapter statusAdapter, int style) {
try {
// The manager will only log the error when the status adapter or
// the embedded status is null.
if (statusAdapter == null) {
- logError(
- "Error occurred during status handling",//$NON-NLS-1$
+ logError("Error occurred during status handling", //$NON-NLS-1$
new NullPointerException("StatusAdapter object is null")); //$NON-NLS-1$
return;
}
if (statusAdapter.getStatus() == null) {
- logError("Error occurred during status handling",//$NON-NLS-1$
+ logError("Error occurred during status handling", //$NON-NLS-1$
new NullPointerException("Status object is null")); //$NON-NLS-1$
return;
}
@@ -221,8 +219,7 @@ public class StatusManager {
// if attached status handler is not able to notify StatusManager
// about particular event, use the default policy and fake the
// notification
- if (handler == null || !handler.supportsNotification(
- INotificationTypes.HANDLED)) {
+ if (handler == null || !handler.supportsNotification(INotificationTypes.HANDLED)) {
generateFakeNotification(statusAdapter, style);
}
} catch (Throwable ex) {
@@ -235,28 +232,24 @@ public class StatusManager {
}
/**
- * Handles the given status adapter. The {@link #LOG} style is used when
- * this method is called.
+ * Handles the given status adapter. The {@link #LOG} style is used when this
+ * method is called.
*
- * @param statusAdapter
- * the status adapter
+ * @param statusAdapter the status adapter
*/
public void handle(StatusAdapter statusAdapter) {
handle(statusAdapter, StatusManager.LOG);
}
/**
- * Handles the given status due to the style. Because the facility depends
- * on Workbench, this method will log the status, if Workbench isn't
- * initialized and the style isn't {@link #NONE}. If Workbench isn't
- * initialized and the style is {@link #NONE}, the manager will do nothing.
+ * Handles the given status due to the style. Because the facility depends on
+ * Workbench, this method will log the status, if Workbench isn't initialized
+ * and the style isn't {@link #NONE}. If Workbench isn't initialized and the
+ * style is {@link #NONE}, the manager will do nothing.
*
- * @param status
- * the status to handle
- * @param style
- * the style. Value can be combined with logical OR. One of
- * {@link #NONE}, {@link #LOG}, {@link #SHOW} and
- * {@link #BLOCK}.
+ * @param status the status to handle
+ * @param style the style. Value can be combined with logical OR. One of
+ * {@link #NONE}, {@link #LOG}, {@link #SHOW} and {@link #BLOCK}.
*/
public void handle(IStatus status, int style) {
StatusAdapter statusAdapter = new StatusAdapter(status);
@@ -264,11 +257,10 @@ public class StatusManager {
}
/**
- * Handles the given status. The {@link #LOG} style is used when this method
- * is called.
+ * Handles the given status. The {@link #LOG} style is used when this method is
+ * called.
*
- * @param status
- * the status to handle
+ * @param status the status to handle
*/
public void handle(IStatus status) {
handle(status, StatusManager.LOG);
@@ -283,6 +275,7 @@ public class StatusManager {
* StatusManager.getManager().handle(coreException.getStatus());
* </code>
* </pre>
+ *
* that does not print the stack trace to the log.
*
* @param coreException a CoreException to be handled.
@@ -291,27 +284,23 @@ public class StatusManager {
* @since 3.4
*
*/
- public void handle(CoreException coreException,String pluginId) {
+ public void handle(CoreException coreException, String pluginId) {
IStatus exceptionStatus = coreException.getStatus();
- handle(new Status(exceptionStatus.getSeverity(), pluginId,
- coreException
- .getLocalizedMessage(), coreException));
+ handle(new Status(exceptionStatus.getSeverity(), pluginId, coreException.getLocalizedMessage(), coreException));
}
/**
- * This method informs the StatusManager that this IStatus is being handled
- * by the handler and to ignore it when it shows up in our ILogListener.
+ * This method informs the StatusManager that this IStatus is being handled by
+ * the handler and to ignore it when it shows up in our ILogListener.
*
- * @param status
- * already handled and logged status
+ * @param status already handled and logged status
*/
public void addLoggedStatus(IStatus status) {
loggedStatuses.add(status);
}
private void logError(String message, Throwable ex) {
- IStatus status = StatusUtil.newStatus(WorkbenchPlugin.PI_WORKBENCH,
- message, ex);
+ IStatus status = StatusUtil.newStatus(WorkbenchPlugin.PI_WORKBENCH, message, ex);
addLoggedStatus(status);
WorkbenchPlugin.log(status);
}
@@ -341,19 +330,17 @@ public class StatusManager {
}
/**
- * This method should be called by custom status handlers when an event
- * occurs. This method has no effect if statushandler does not support
- * particular event type.
+ * This method should be called by custom status handlers when an event occurs.
+ * This method has no effect if statushandler does not support particular event
+ * type.
*
- * @param type
- * - type of the event.
- * @param adapters
- * - array of affected {@link StatusAdapter}s.
+ * @param type - type of the event.
+ * @param adapters - array of affected {@link StatusAdapter}s.
* @see INotificationTypes
* @see AbstractStatusHandler#supportsNotification(int)
* @since 3.5
*/
- public void fireNotification(int type, StatusAdapter[] adapters){
+ public void fireNotification(int type, StatusAdapter[] adapters) {
AbstractStatusHandler handler = getStatusHandler();
if (handler != null && handler.supportsNotification(type)) {
doFireNotification(type, adapters);
@@ -368,18 +355,15 @@ public class StatusManager {
private void generateFakeNotification(StatusAdapter statusAdapter, int style) {
if (((style & StatusManager.SHOW) == StatusManager.SHOW || (style & StatusManager.BLOCK) == StatusManager.BLOCK)
- && statusAdapter
- .getProperty(IProgressConstants.NO_IMMEDIATE_ERROR_PROMPT_PROPERTY) != Boolean.TRUE) {
- doFireNotification(INotificationTypes.HANDLED,
- new StatusAdapter[] { statusAdapter });
+ && statusAdapter.getProperty(IProgressConstants.NO_IMMEDIATE_ERROR_PROMPT_PROPERTY) != Boolean.TRUE) {
+ doFireNotification(INotificationTypes.HANDLED, new StatusAdapter[] { statusAdapter });
}
}
/**
* Adds a listener to the StatusManager.
*
- * @param listener
- * - a listener to be added.
+ * @param listener - a listener to be added.
* @since 3.5
*/
public void addListener(INotificationListener listener) {
@@ -389,11 +373,10 @@ public class StatusManager {
/**
* Removes a listener from StatusManager.
*
- * @param listener
- * - a listener to be removed.
+ * @param listener - a listener to be removed.
* @since 3.5
*/
- public void removeListener(INotificationListener listener){
+ public void removeListener(INotificationListener listener) {
this.listeners.remove(listener);
}
@@ -407,13 +390,11 @@ public class StatusManager {
* @since 3.5
*
*/
- public interface INotificationListener{
+ public interface INotificationListener {
/**
*
- * @param type
- * - a type of notification.
- * @param adapters
- * - affected {@link StatusAdapter}s
+ * @param type - a type of notification.
+ * @param adapters - affected {@link StatusAdapter}s
*/
void statusManagerNotified(int type, StatusAdapter[] adapters);
}
@@ -429,8 +410,8 @@ public class StatusManager {
public interface INotificationTypes {
/**
- * This type notifications are used when a particular
- * {@link StatusAdapter} was handled.
+ * This type notifications are used when a particular {@link StatusAdapter} was
+ * handled.
*/
int HANDLED = 0x01;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/statushandlers/WorkbenchErrorHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/statushandlers/WorkbenchErrorHandler.java
index 606ceefba99..41b5f56e68a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/statushandlers/WorkbenchErrorHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/statushandlers/WorkbenchErrorHandler.java
@@ -56,22 +56,18 @@ public class WorkbenchErrorHandler extends AbstractStatusHandler {
}
if ((style & StatusManager.LOG) == StatusManager.LOG) {
- StatusManager.getManager().addLoggedStatus(
- statusAdapter.getStatus());
- WorkbenchPlugin.getDefault().getLog()
- .log(statusAdapter.getStatus());
+ StatusManager.getManager().addLoggedStatus(statusAdapter.getStatus());
+ WorkbenchPlugin.getDefault().getLog().log(statusAdapter.getStatus());
}
}
/**
* Requests the status dialog manager to show the status adapter.
*
- * @param statusAdapter
- * the status adapter to show
- * @param block
- * <code>true</code> to request a modal dialog and suspend the
- * calling thread till the dialog is closed, <code>false</code>
- * otherwise.
+ * @param statusAdapter the status adapter to show
+ * @param block <code>true</code> to request a modal dialog and suspend
+ * the calling thread till the dialog is closed,
+ * <code>false</code> otherwise.
*/
private void showStatusAdapter(StatusAdapter statusAdapter, boolean block) {
if (!PlatformUI.isWorkbenchRunning()) {
@@ -84,8 +80,7 @@ public class WorkbenchErrorHandler extends AbstractStatusHandler {
if (block) {
Shell shell;
- while ((shell = getStatusDialogShell()) != null
- && !shell.isDisposed()) {
+ while ((shell = getStatusDialogShell()) != null && !shell.isDisposed()) {
if (!shell.getDisplay().readAndDispatch()) {
Display.getDefault().sleep();
}
@@ -94,8 +89,7 @@ public class WorkbenchErrorHandler extends AbstractStatusHandler {
}
private Shell getStatusDialogShell() {
- return (Shell) getStatusDialogManager().getProperty(
- IStatusDialogConstants.SHELL);
+ return (Shell) getStatusDialogManager().getProperty(IStatusDialogConstants.SHELL);
}
/**
@@ -108,13 +102,9 @@ public class WorkbenchErrorHandler extends AbstractStatusHandler {
synchronized (this) {
if (statusDialogManager == null) {
statusDialogManager = new WorkbenchStatusDialogManager(null);
- statusDialogManager.setProperty(
- IStatusDialogConstants.SHOW_SUPPORT, Boolean.TRUE);
- statusDialogManager.setProperty(
- IStatusDialogConstants.HANDLE_OK_STATUSES,
- Boolean.TRUE);
- statusDialogManager.setProperty(
- IStatusDialogConstants.ERRORLOG_LINK, Boolean.TRUE);
+ statusDialogManager.setProperty(IStatusDialogConstants.SHOW_SUPPORT, Boolean.TRUE);
+ statusDialogManager.setProperty(IStatusDialogConstants.HANDLE_OK_STATUSES, Boolean.TRUE);
+ statusDialogManager.setProperty(IStatusDialogConstants.ERRORLOG_LINK, Boolean.TRUE);
configureStatusDialog(statusDialogManager);
}
}
@@ -133,12 +123,10 @@ public class WorkbenchErrorHandler extends AbstractStatusHandler {
* </ul>
* Default configuration does nothing.
*
- * @param statusDialog
- * a status dialog to be configured.
+ * @param statusDialog a status dialog to be configured.
* @since 3.4
*/
- protected void configureStatusDialog(
- final WorkbenchStatusDialogManager statusDialog) {
+ protected void configureStatusDialog(final WorkbenchStatusDialogManager statusDialog) {
// default configuration does nothing
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/statushandlers/WorkbenchStatusDialogManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/statushandlers/WorkbenchStatusDialogManager.java
index d0bd2a4ecd8..5b273af5a3c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/statushandlers/WorkbenchStatusDialogManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/statushandlers/WorkbenchStatusDialogManager.java
@@ -66,19 +66,18 @@ import org.eclipse.ui.progress.IProgressConstants;
*/
public class WorkbenchStatusDialogManager {
- static final QualifiedName HINT = new QualifiedName(
- IStatusAdapterConstants.PROPERTY_PREFIX, "hint"); //$NON-NLS-1$
+ static final QualifiedName HINT = new QualifiedName(IStatusAdapterConstants.PROPERTY_PREFIX, "hint"); //$NON-NLS-1$
private WorkbenchStatusDialogManagerImpl manager;
/**
* Creates workbench status dialog.
*
- * @param displayMask
- * the mask used to filter the handled <code>StatusAdapter</code>
- * objects, the mask is a logical sum of status severities
- * @param dialogTitle
- * the title of the dialog. If null, than default will be used.
+ * @param displayMask the mask used to filter the handled
+ * <code>StatusAdapter</code> objects, the mask is a logical
+ * sum of status severities
+ * @param dialogTitle the title of the dialog. If null, than default will be
+ * used.
*/
public WorkbenchStatusDialogManager(int displayMask, String dialogTitle) {
@@ -98,20 +97,18 @@ public class WorkbenchStatusDialogManager {
* @see #WorkbenchStatusDialogManager(int, String)
*/
@Deprecated
- public WorkbenchStatusDialogManager(Shell parentShell, int displayMask,
- String dialogTitle) {
+ public WorkbenchStatusDialogManager(Shell parentShell, int displayMask, String dialogTitle) {
this(displayMask, dialogTitle);
}
/**
* Creates workbench status dialog.
*
- * @param dialogTitle
- * the title of the dialog. If null, than default will be used.
+ * @param dialogTitle the title of the dialog. If null, than default will be
+ * used.
*/
public WorkbenchStatusDialogManager(String dialogTitle) {
- this(IStatus.INFO | IStatus.WARNING | IStatus.ERROR | IStatus.CANCEL,
- dialogTitle);
+ this(IStatus.INFO | IStatus.WARNING | IStatus.ERROR | IStatus.CANCEL, dialogTitle);
}
/**
@@ -151,8 +148,7 @@ public class WorkbenchStatusDialogManager {
* <code>false</code> otherwise
* @param statusAdapter the status adapter
*/
- public void addStatusAdapter(final StatusAdapter statusAdapter,
- final boolean modal) {
+ public void addStatusAdapter(final StatusAdapter statusAdapter, final boolean modal) {
manager.addStatusAdapter(statusAdapter, modal);
}
@@ -160,13 +156,10 @@ public class WorkbenchStatusDialogManager {
* Enables the default support area that shows stack trace of the exception
* contained in the selected status.
*
- * @param enable
- * true enables, false disables default support
+ * @param enable true enables, false disables default support
*/
public void enableDefaultSupportArea(boolean enable) {
- manager.getDialogState().put(
- IStatusDialogConstants.ENABLE_DEFAULT_SUPPORT_AREA,
- Boolean.valueOf(enable));
+ manager.getDialogState().put(IStatusDialogConstants.ENABLE_DEFAULT_SUPPORT_AREA, Boolean.valueOf(enable));
}
/**
@@ -182,28 +175,25 @@ public class WorkbenchStatusDialogManager {
* Sets the details area provider. If null is set, the default area provider
* will be used.
*
- * @param provider
- * A details area provider to be set.
+ * @param provider A details area provider to be set.
*/
public void setDetailsAreaProvider(AbstractStatusAreaProvider provider) {
- manager.setProperty(IStatusDialogConstants.CUSTOM_DETAILS_PROVIDER,
- provider);
+ manager.setProperty(IStatusDialogConstants.CUSTOM_DETAILS_PROVIDER, provider);
}
/**
- * Sets new label provider for the status list. This label provider is used
- * also to display the second message on the dialog if only one status is
- * available.
+ * Sets new label provider for the status list. This label provider is used also
+ * to display the second message on the dialog if only one status is available.
*
* <p>
- * This method is no longer recommended to use as it is impossible to
- * achieve consistent behavior after changing only one label provider.
+ * This method is no longer recommended to use as it is impossible to achieve
+ * consistent behavior after changing only one label provider.
* </p>
*
* @deprecated As of 3.5 {@link #setMessageDecorator} is recommended.
*
- * @param labelProvider
- * a label provider to be used when displaying status adapters.
+ * @param labelProvider a label provider to be used when displaying status
+ * adapters.
*/
@Deprecated
public void setStatusListLabelProvider(ITableLabelProvider labelProvider) {
@@ -220,85 +210,77 @@ public class WorkbenchStatusDialogManager {
* <li>use the default support area, if enabled</li>
* </ol>
*
- * @param provider
- * Support provider to be set.
+ * @param provider Support provider to be set.
*/
public void setSupportAreaProvider(AbstractStatusAreaProvider provider) {
- manager.setProperty(IStatusDialogConstants.CUSTOM_SUPPORT_PROVIDER,
- provider);
+ manager.setProperty(IStatusDialogConstants.CUSTOM_SUPPORT_PROVIDER, provider);
}
/**
* <p>
- * This methods sets up the decorator, which is used to modify displayed
- * strings extracted from StatusAdapter. The decorator should be used to
- * remove technical codes from the dialog, f.e. following message
- * "<i>ERR2008 Invalid password</i>" can be translated into
- * "<i>Invalid password</i>".
+ * This methods sets up the decorator, which is used to modify displayed strings
+ * extracted from StatusAdapter. The decorator should be used to remove
+ * technical codes from the dialog, f.e. following message "<i>ERR2008 Invalid
+ * password</i>" can be translated into "<i>Invalid password</i>".
* </p>
* <p>
- * The decorator will be applied only to messages extracted from
- * StatusAdapter (predefined messages like
- * "This status has children statuses. See 'Details' for more information."
- * are not affected.
+ * The decorator will be applied only to messages extracted from StatusAdapter
+ * (predefined messages like "This status has children statuses. See 'Details'
+ * for more information." are not affected.
* </p>
* <p>
* This method should not be used together with
* {@link #setStatusListLabelProvider(ITableLabelProvider)}.
* </p>
*
- * @param decorator
- * - the decorator to be set. Only
- * {@link ILabelDecorator#decorateText(String, Object)} method
- * will be used. This method should return <code>null</code> if
- * and only if the first argument is null. StatusAdapter is
- * passed as second parameter. Other methods should have default
- * behavior as they may be used in future versions of the dialog.
+ * @param decorator - the decorator to be set. Only
+ * {@link ILabelDecorator#decorateText(String, Object)} method
+ * will be used. This method should return <code>null</code> if
+ * and only if the first argument is null. StatusAdapter is
+ * passed as second parameter. Other methods should have
+ * default behavior as they may be used in future versions of
+ * the dialog.
* @since 3.5
*/
- public void setMessageDecorator(ILabelDecorator decorator){
+ public void setMessageDecorator(ILabelDecorator decorator) {
manager.setMessageDecorator(decorator);
}
/**
* This method sets various properties on the manager.
*
- * @param key
- * a key of the property to be set.
- * @param value
- * a value of the property to be set. The value must be of type
- * specified by the property key. <code>null</code> should never
- * be passed unless the property key javadoc allows for that.
+ * @param key a key of the property to be set.
+ * @param value a value of the property to be set. The value must be of type
+ * specified by the property key. <code>null</code> should never be
+ * passed unless the property key javadoc allows for that.
* @since 3.5
*/
- public void setProperty(Object key, Object value){
+ public void setProperty(Object key, Object value) {
manager.setProperty(key, value);
}
/**
* This method gets various dialog properties.
*
- * @param key
- * a key of the property to be get.
- * @return a value of the property. The value will be of type specified by
- * the property key. <code>null</code> can be returned.
+ * @param key a key of the property to be get.
+ * @return a value of the property. The value will be of type specified by the
+ * property key. <code>null</code> can be returned.
* @since 3.5
*/
- public Object getProperty(Object key){
+ public Object getProperty(Object key) {
return manager.getProperty(key);
}
-
/**
* This method makes the dialog to be similar to the JFace ErrorDialog. The
- * dialog handles {@link StatusAdapter}s wrapping {@link IStatus} with
- * severity {@link IStatus#OK}, does not display the link to the error log,
- * does not display the link to the support area but always opens it.
+ * dialog handles {@link StatusAdapter}s wrapping {@link IStatus} with severity
+ * {@link IStatus#OK}, does not display the link to the error log, does not
+ * display the link to the support area but always opens it.
*
* @see ErrorDialog
* @since 3.5
*/
- public void enableErrorDialogCompatibility(){
+ public void enableErrorDialogCompatibility() {
manager.enableErrorDialogCompatibility();
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/swt/IFocusService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/swt/IFocusService.java
index 2f7a13e50b7..f060cac9f53 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/swt/IFocusService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/swt/IFocusService.java
@@ -60,14 +60,14 @@ import org.eclipse.swt.widgets.Control;
*/
public interface IFocusService {
/**
- * Use the value to provide default copy behaviour in a handler element
- * class attribute.
+ * Use the value to provide default copy behaviour in a handler element class
+ * attribute.
*/
String COPY_HANDLER = "org.eclipse.ui.internal.handlers.WidgetMethodHandler:copy"; //$NON-NLS-1$
/**
- * Use the value to provide default paste behaviour in a handler element
- * class attribute.
+ * Use the value to provide default paste behaviour in a handler element class
+ * attribute.
*/
String PASTE_HANDLER = "org.eclipse.ui.internal.handlers.WidgetMethodHandler:paste"; //$NON-NLS-1$
@@ -78,16 +78,15 @@ public interface IFocusService {
String CUT_HANDLER = "org.eclipse.ui.internal.handlers.WidgetMethodHandler:cut"; //$NON-NLS-1$
/**
- * Use the value to provide default select all behaviour in a handler
- * element class attribute.
+ * Use the value to provide default select all behaviour in a handler element
+ * class attribute.
*/
String SELECT_ALL_HANDLER = "org.eclipse.ui.internal.handlers.SelectAllHandler"; //$NON-NLS-1$
/**
- * A Control for which the service will track focus. When in focus, this
- * Control and its ID will be provided as variables to core expressions for
- * the various services, as activeFocusControl and activeFocusControlId
- * respectively.
+ * A Control for which the service will track focus. When in focus, this Control
+ * and its ID will be provided as variables to core expressions for the various
+ * services, as activeFocusControl and activeFocusControlId respectively.
* <p>
* A control must only be registered once, but different controls can be
* registered with the same ID. Expressions evaluated against the
@@ -98,11 +97,9 @@ public interface IFocusService {
* We will remove ourselves as a listener when the Control is disposed.
* </p>
*
- * @param control
- * the control. Must not be <code>null</code>. If the control
- * is already registered with this service this call is a no-op.
- * @param id
- * an ID for this control. Must not be <code>null</code>.
+ * @param control the control. Must not be <code>null</code>. If the control is
+ * already registered with this service this call is a no-op.
+ * @param id an ID for this control. Must not be <code>null</code>.
*/
void addFocusTracker(Control control, String id);
@@ -110,9 +107,8 @@ public interface IFocusService {
* No longer track focus events for this control. Use this method when the
* control should no longer be tracked, but is not disposed.
*
- * @param control
- * the control registered with the service. Must not be
- * <code>null</code>.
+ * @param control the control registered with the service. Must not be
+ * <code>null</code>.
*/
void removeFocusTracker(Control control);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/themes/ColorUtil.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/themes/ColorUtil.java
index 2fe03f950a3..027e1c9836c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/themes/ColorUtil.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/themes/ColorUtil.java
@@ -36,13 +36,12 @@ public final class ColorUtil {
/**
* Process the given string and return a corresponding RGB object.
*
- * @param value
- * the SWT constant <code>String</code>
- * @return the value of the SWT constant, or <code>SWT.COLOR_BLACK</code>
- * if it could not be determined
+ * @param value the SWT constant <code>String</code>
+ * @return the value of the SWT constant, or <code>SWT.COLOR_BLACK</code> if it
+ * could not be determined
*/
private static RGB process(String value) {
- Field [] fields = getFields();
+ Field[] fields = getFields();
try {
for (Field field : fields) {
if (field.getName().equals(value)) {
@@ -72,10 +71,8 @@ public final class ColorUtil {
ArrayList<Field> applicableFields = new ArrayList<>(allFields.length);
for (Field field : allFields) {
- if (field.getType() == Integer.TYPE
- && Modifier.isStatic(field.getModifiers())
- && Modifier.isPublic(field.getModifiers())
- && Modifier.isFinal(field.getModifiers())
+ if (field.getType() == Integer.TYPE && Modifier.isStatic(field.getModifiers())
+ && Modifier.isPublic(field.getModifiers()) && Modifier.isFinal(field.getModifiers())
&& field.getName().startsWith("COLOR")) { //$NON-NLS-1$
applicableFields.add(field);
@@ -89,12 +86,9 @@ public final class ColorUtil {
/**
* Blends the two color values according to the provided ratio.
*
- * @param c1
- * first color
- * @param c2
- * second color
- * @param ratio
- * percentage of the first color in the blend (0-100)
+ * @param c1 first color
+ * @param c2 second color
+ * @param ratio percentage of the first color in the blend (0-100)
* @return the RGB value of the blended color
*
* @since 3.3
@@ -112,13 +106,10 @@ public final class ColorUtil {
}
/**
- * Blend the two color values returning a value that is halfway between
- * them.
+ * Blend the two color values returning a value that is halfway between them.
*
- * @param val1
- * the first value
- * @param val2
- * the second value
+ * @param val1 the first value
+ * @param val2 the second value
* @return the blended color
*/
public static RGB blend(RGB val1, RGB val2) {
@@ -129,13 +120,10 @@ public final class ColorUtil {
}
/**
- * Blend the two color values returning a value that is halfway between
- * them.
+ * Blend the two color values returning a value that is halfway between them.
*
- * @param temp1
- * the first value
- * @param temp2
- * the second value
+ * @param temp1 the first value
+ * @param temp2 the second value
* @return the blended int value
*/
private static int blend(int temp1, int temp2) {
@@ -145,8 +133,7 @@ public final class ColorUtil {
/**
* Return the system color that matches the provided SWT constant value.
*
- * @param colorId
- * the system color identifier
+ * @param colorId the system color identifier
* @return the RGB value of the supplied system color
*/
private static RGB getSystemColor(int colorId) {
@@ -156,11 +143,10 @@ public final class ColorUtil {
/**
* Get the RGB value for a given color.
*
- * @param rawValue
- * the raw value, either an RGB triple or an SWT constant name
+ * @param rawValue the raw value, either an RGB triple or an SWT constant name
* @return the RGB value
- * @throws DataFormatException
- * thrown if the value cannot be interpreted as a color
+ * @throws DataFormatException thrown if the value cannot be interpreted as a
+ * color
*/
public static RGB getColorValue(String rawValue) throws DataFormatException {
if (rawValue == null) {
@@ -179,8 +165,7 @@ public final class ColorUtil {
/**
* Get the RGB values for a given color array.
*
- * @param rawValues
- * the raw values, either RGB triple or an SWT constant
+ * @param rawValues the raw values, either RGB triple or an SWT constant
* @return the RGB values
*/
public static RGB[] getColorValues(String[] rawValues) {
@@ -192,11 +177,11 @@ public final class ColorUtil {
}
/**
- * Return whether the value returned by <code>getValue()</code> is already
- * in RGB form.
+ * Return whether the value returned by <code>getValue()</code> is already in
+ * RGB form.
*
- * @return whether the value returned by <code>getValue()</code> is
- * already in RGB form
+ * @return whether the value returned by <code>getValue()</code> is already in
+ * RGB form
*/
private static boolean isDirectValue(String rawValue) {
return rawValue.indexOf(',') >= 0;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/themes/IColorFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/themes/IColorFactory.java
index 42a7de0c776..4039eb4a78b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/themes/IColorFactory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/themes/IColorFactory.java
@@ -33,10 +33,10 @@ import org.eclipse.swt.graphics.RGB;
*/
public interface IColorFactory {
- /**
- * Create a new color.
- *
- * @return a new color. This must never be <code>null</code>.
- */
- RGB createColor();
+ /**
+ * Create a new color.
+ *
+ * @return a new color. This must never be <code>null</code>.
+ */
+ RGB createColor();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/themes/ITheme.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/themes/ITheme.java
index 25030fd8ed9..1c89576e820 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/themes/ITheme.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/themes/ITheme.java
@@ -20,14 +20,16 @@ import org.eclipse.jface.resource.FontRegistry;
import org.eclipse.jface.util.IPropertyChangeListener;
/**
- * A theme is a collection of colors, fonts and supporting data that may
- * be used by plugins to help provide uniform look and feel to their components.
- * The workbench has a default theme (one whos id has the value {@link org.eclipse.ui.themes.IThemeManager#DEFAULT_THEME})
- * that defines the initial values for a collection of fonts and colors. Other
- * themes may extend and override the default theme to provide new values.
+ * A theme is a collection of colors, fonts and supporting data that may be used
+ * by plugins to help provide uniform look and feel to their components. The
+ * workbench has a default theme (one whos id has the value
+ * {@link org.eclipse.ui.themes.IThemeManager#DEFAULT_THEME}) that defines the
+ * initial values for a collection of fonts and colors. Other themes may extend
+ * and override the default theme to provide new values.
*
* <p>
- * Clients may obtain themes via {@link org.eclipse.ui.themes.IThemeManager#getTheme(String)}.
+ * Clients may obtain themes via
+ * {@link org.eclipse.ui.themes.IThemeManager#getTheme(String)}.
* </p>
*
* <p>
@@ -40,88 +42,87 @@ import org.eclipse.jface.util.IPropertyChangeListener;
*/
public interface ITheme {
- /**
- * Adds a property listener to the theme. Any events fired by the
- * underlying registries will cause an event to be fired. This event is the
- * same event that was fired by the registry. As such, the "source"
- * attribute of the event will not be this theme, but rather the color or
- * font registry.
- *
- * @param listener the listener to add
- */
- void addPropertyChangeListener(IPropertyChangeListener listener);
+ /**
+ * Adds a property listener to the theme. Any events fired by the underlying
+ * registries will cause an event to be fired. This event is the same event that
+ * was fired by the registry. As such, the "source" attribute of the event will
+ * not be this theme, but rather the color or font registry.
+ *
+ * @param listener the listener to add
+ */
+ void addPropertyChangeListener(IPropertyChangeListener listener);
- /**
- * Dispose of this theme. This method is called by the workbench when
- * appropriate and should never be called by a user.
- */
- void dispose();
+ /**
+ * Dispose of this theme. This method is called by the workbench when
+ * appropriate and should never be called by a user.
+ */
+ void dispose();
- /**
- * Get arbitrary data associated with this theme.
- *
- * @param key the key
- * @return the data, or the default value <code>false</code> if none exists
- * or if the value cannot be treated as a boolean.
- */
- boolean getBoolean(String key);
+ /**
+ * Get arbitrary data associated with this theme.
+ *
+ * @param key the key
+ * @return the data, or the default value <code>false</code> if none exists or
+ * if the value cannot be treated as a boolean.
+ */
+ boolean getBoolean(String key);
- /**
- * Return this themes color registry.
- *
- * @return this themes color registry
- */
- ColorRegistry getColorRegistry();
+ /**
+ * Return this themes color registry.
+ *
+ * @return this themes color registry
+ */
+ ColorRegistry getColorRegistry();
- /**
- * Return this themes font registry.
- *
- * @return this themes font registry
- */
- FontRegistry getFontRegistry();
+ /**
+ * Return this themes font registry.
+ *
+ * @return this themes font registry
+ */
+ FontRegistry getFontRegistry();
- /**
- * Returns the id of this theme.
- *
- * @return the id of this theme. Guaranteed not to be <code>null</code>.
- */
- String getId();
+ /**
+ * Returns the id of this theme.
+ *
+ * @return the id of this theme. Guaranteed not to be <code>null</code>.
+ */
+ String getId();
- /**
- * Get arbitrary data associated with this theme.
- *
- * @param key the key
- * @return the data, or the default value <code>0</code> if none exists or
- * if the value cannot be treated as an integer.
- */
- int getInt(String key);
+ /**
+ * Get arbitrary data associated with this theme.
+ *
+ * @param key the key
+ * @return the data, or the default value <code>0</code> if none exists or if
+ * the value cannot be treated as an integer.
+ */
+ int getInt(String key);
- /**
- * Returns the label of this theme.
- *
- * @return the label of this theme. Guaranteed not be <code>null</code>.
- */
- String getLabel();
+ /**
+ * Returns the label of this theme.
+ *
+ * @return the label of this theme. Guaranteed not be <code>null</code>.
+ */
+ String getLabel();
- /**
- * Get arbitrary data associated with this theme.
- *
- * @param key the key
- * @return the data, or <code>null</code> if none exists.
- */
- String getString(String key);
+ /**
+ * Get arbitrary data associated with this theme.
+ *
+ * @param key the key
+ * @return the data, or <code>null</code> if none exists.
+ */
+ String getString(String key);
- /**
- * Get the set of keys associated with this theme.
- *
- * @return the Set of keys
- */
- Set keySet();
+ /**
+ * Get the set of keys associated with this theme.
+ *
+ * @return the Set of keys
+ */
+ Set keySet();
- /**
- * Removes a property listener from the theme.
- *
- * @param listener the listener to remove
- */
- void removePropertyChangeListener(IPropertyChangeListener listener);
+ /**
+ * Removes a property listener from the theme.
+ *
+ * @param listener the listener to remove
+ */
+ void removePropertyChangeListener(IPropertyChangeListener listener);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/themes/IThemeManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/themes/IThemeManager.java
index 9a16482711f..f8d6ba4e2d1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/themes/IThemeManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/themes/IThemeManager.java
@@ -18,13 +18,13 @@ import org.eclipse.jface.util.IPropertyChangeListener;
/**
* A theme manager is an object that contains references to usable
* <code>ITheme</code> objects and maintains a reference to the currently active
- * theme. This theme will be used by the workbench to decorate tab folders and
- * other controls where possible. The workbench implementation of this
- * interface will push the values of the current theme into the underlying jface
+ * theme. This theme will be used by the workbench to decorate tab folders and
+ * other controls where possible. The workbench implementation of this interface
+ * will push the values of the current theme into the underlying jface
* registries ({@link org.eclipse.jface.resource.ColorRegistry} and
* {@link org.eclipse.jface.resource.FontRegistry} whenever the current theme
- * changes. Clients who do not need access to specific themes may instead
- * attach listeners to these registries directly.
+ * changes. Clients who do not need access to specific themes may instead attach
+ * listeners to these registries directly.
*
* <p>
* This interface is not intended to be implemented or extended by clients.
@@ -36,55 +36,55 @@ import org.eclipse.jface.util.IPropertyChangeListener;
*/
public interface IThemeManager {
- /**
- * Indicates that the current theme has changed to a new theme.
- */
- String CHANGE_CURRENT_THEME = "CHANGE_CURRENT_THEME"; //$NON-NLS-1$
+ /**
+ * Indicates that the current theme has changed to a new theme.
+ */
+ String CHANGE_CURRENT_THEME = "CHANGE_CURRENT_THEME"; //$NON-NLS-1$
- /**
- * The default theme id.
- */
- String DEFAULT_THEME = "org.eclipse.ui.defaultTheme"; //$NON-NLS-1$
+ /**
+ * The default theme id.
+ */
+ String DEFAULT_THEME = "org.eclipse.ui.defaultTheme"; //$NON-NLS-1$
- /**
- * Adds a property listener to the manager. Any events fired by the
- * underlying registries of the current theme will cause an event to be
- * fired. This event is the same event that was fired by the registry.
- * As such, the "source" attribute of the event will not be this manager,
- * but rather the color or font registry. Additionally, an event is fired
- * when the current theme changes to a new theme. The "property" attribute
- * of such an event will have the value {@link IThemeManager#CHANGE_CURRENT_THEME}.
- *
- * @param listener the listener to add
- */
- void addPropertyChangeListener(IPropertyChangeListener listener);
+ /**
+ * Adds a property listener to the manager. Any events fired by the underlying
+ * registries of the current theme will cause an event to be fired. This event
+ * is the same event that was fired by the registry. As such, the "source"
+ * attribute of the event will not be this manager, but rather the color or font
+ * registry. Additionally, an event is fired when the current theme changes to a
+ * new theme. The "property" attribute of such an event will have the value
+ * {@link IThemeManager#CHANGE_CURRENT_THEME}.
+ *
+ * @param listener the listener to add
+ */
+ void addPropertyChangeListener(IPropertyChangeListener listener);
- /**
- * Get the currently active theme.
- *
- * @return the current theme. This will never be <code>null</code>.
- */
- ITheme getCurrentTheme();
+ /**
+ * Get the currently active theme.
+ *
+ * @return the current theme. This will never be <code>null</code>.
+ */
+ ITheme getCurrentTheme();
- /**
- * Get a theme.
- *
- * @param id the theme to find.
- * @return the <code>ITheme</code> or <code>null</code> if it cannot be found.
- */
- ITheme getTheme(String id);
+ /**
+ * Get a theme.
+ *
+ * @param id the theme to find.
+ * @return the <code>ITheme</code> or <code>null</code> if it cannot be found.
+ */
+ ITheme getTheme(String id);
- /**
- * Removes a property listener from the workbench.
- *
- * @param listener the listener to remove
- */
- void removePropertyChangeListener(IPropertyChangeListener listener);
+ /**
+ * Removes a property listener from the workbench.
+ *
+ * @param listener the listener to remove
+ */
+ void removePropertyChangeListener(IPropertyChangeListener listener);
- /**
- * Set the currently active theme.
- *
- * @param id the id of the new active theme
- */
- void setCurrentTheme(String id);
+ /**
+ * Set the currently active theme.
+ *
+ * @param id the id of the new active theme
+ */
+ void setCurrentTheme(String id);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/themes/IThemePreview.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/themes/IThemePreview.java
index 05cde786096..ee66ce894b7 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/themes/IThemePreview.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/themes/IThemePreview.java
@@ -23,17 +23,17 @@ import org.eclipse.swt.widgets.Composite;
*/
public interface IThemePreview {
- /**
- * Create the preview control.
- *
- * @param parent the Composite in which to create the example
- * @param currentTheme the theme to preview
- */
- void createControl(Composite parent, ITheme currentTheme);
+ /**
+ * Create the preview control.
+ *
+ * @param parent the Composite in which to create the example
+ * @param currentTheme the theme to preview
+ */
+ void createControl(Composite parent, ITheme currentTheme);
- /**
- * Dispose of resources used by this previewer. This method is called by
- * the workbench when appropriate and should never be called by a user.
- */
- void dispose();
+ /**
+ * Dispose of resources used by this previewer. This method is called by the
+ * workbench when appropriate and should never be called by a user.
+ */
+ void dispose();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/themes/RGBBlendColorFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/themes/RGBBlendColorFactory.java
index 7a05469e48d..a848c565cb4 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/themes/RGBBlendColorFactory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/themes/RGBBlendColorFactory.java
@@ -46,43 +46,43 @@ import org.eclipse.swt.graphics.RGB;
* @see org.eclipse.swt.SWT
* @since 3.0
*/
-public class RGBBlendColorFactory implements IColorFactory,
- IExecutableExtension {
+public class RGBBlendColorFactory implements IColorFactory, IExecutableExtension {
- private String color1, color2;
+ private String color1, color2;
- @Override
+ @Override
public RGB createColor() {
- if (color1 == null && color2 == null) {
- return new RGB(0, 0, 0);
- } else if (color1 != null && color2 == null) {
- return ColorUtil.getColorValue(color1);
- } else if (color1 == null && color2 != null) {
- return ColorUtil.getColorValue(color2);
- } else {
- RGB rgb1 = ColorUtil.getColorValue(color1);
- RGB rgb2 = ColorUtil.getColorValue(color2);
- return ColorUtil.blend(rgb1, rgb2);
- }
- }
+ if (color1 == null && color2 == null) {
+ return new RGB(0, 0, 0);
+ } else if (color1 != null && color2 == null) {
+ return ColorUtil.getColorValue(color1);
+ } else if (color1 == null && color2 != null) {
+ return ColorUtil.getColorValue(color2);
+ } else {
+ RGB rgb1 = ColorUtil.getColorValue(color1);
+ RGB rgb2 = ColorUtil.getColorValue(color2);
+ return ColorUtil.blend(rgb1, rgb2);
+ }
+ }
- /**
- * This executable extension requires parameters to be explicitly declared
- * via the second method described in the <code>IExecutableExtension</code>
- * documentation. This class expects that there will be two parameters,
- * <code>color1</code> and <code>color2</code>, that describe the two colors
- * to be blended. These values may either be RGB triples or SWT constants.
- *
- * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
- */
- @Override
- public void setInitializationData(IConfigurationElement config,
- String propertyName, Object data) throws CoreException {
+ /**
+ * This executable extension requires parameters to be explicitly declared via
+ * the second method described in the <code>IExecutableExtension</code>
+ * documentation. This class expects that there will be two parameters,
+ * <code>color1</code> and <code>color2</code>, that describe the two colors to
+ * be blended. These values may either be RGB triples or SWT constants.
+ *
+ * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement,
+ * java.lang.String, java.lang.Object)
+ */
+ @Override
+ public void setInitializationData(IConfigurationElement config, String propertyName, Object data)
+ throws CoreException {
- if (data instanceof Hashtable) {
- Hashtable table = (Hashtable) data;
- color1 = (String) table.get("color1"); //$NON-NLS-1$
- color2 = (String) table.get("color2"); //$NON-NLS-1$
- }
- }
+ if (data instanceof Hashtable) {
+ Hashtable table = (Hashtable) data;
+ color1 = (String) table.get("color1"); //$NON-NLS-1$
+ color2 = (String) table.get("color2"); //$NON-NLS-1$
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/views/IStickyViewDescriptor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/views/IStickyViewDescriptor.java
index d0f41f15c2a..2df9b1ebef7 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/views/IStickyViewDescriptor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/views/IStickyViewDescriptor.java
@@ -26,33 +26,33 @@ package org.eclipse.ui.views;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IStickyViewDescriptor {
- /**
- * Return the id of the view to be made sticky.
- *
- * @return the id of the view to be made sticky
- */
- String getId();
+ /**
+ * Return the id of the view to be made sticky.
+ *
+ * @return the id of the view to be made sticky
+ */
+ String getId();
- /**
- * Return the location of this sticky view. Must be one of
- * <code>IPageLayout.LEFT</code>, <code>IPageLayout.RIGHT</code>,
- * <code>IPageLayout.TOP</code>, or <code>IPageLayout.BOTTOM</code>.
- *
- * @return the location constant
- */
- int getLocation();
+ /**
+ * Return the location of this sticky view. Must be one of
+ * <code>IPageLayout.LEFT</code>, <code>IPageLayout.RIGHT</code>,
+ * <code>IPageLayout.TOP</code>, or <code>IPageLayout.BOTTOM</code>.
+ *
+ * @return the location constant
+ */
+ int getLocation();
- /**
- * Return whether this view should be closeable.
- *
- * @return whether this view should be closeeable
- */
- boolean isCloseable();
+ /**
+ * Return whether this view should be closeable.
+ *
+ * @return whether this view should be closeeable
+ */
+ boolean isCloseable();
- /**
- * Return whether this view should be moveable.
- *
- * @return whether this view should be moveable
- */
- boolean isMoveable();
+ /**
+ * Return whether this view should be moveable.
+ *
+ * @return whether this view should be moveable
+ */
+ boolean isMoveable();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/views/IViewCategory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/views/IViewCategory.java
index 58c1c0981c7..3487f1bcb8b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/views/IViewCategory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/views/IViewCategory.java
@@ -26,33 +26,34 @@ import org.eclipse.core.runtime.IPath;
*/
public interface IViewCategory {
- /**
- * Return the views contained within this category. Never <code>null</code>,
- * but may be empty.
- *
- * @return the views contained within this category
- */
- IViewDescriptor[] getViews();
+ /**
+ * Return the views contained within this category. Never <code>null</code>, but
+ * may be empty.
+ *
+ * @return the views contained within this category
+ */
+ IViewDescriptor[] getViews();
- /**
- * Return the id of this category. Never <code>null</code>.
- *
- * @return the id
- */
- String getId();
+ /**
+ * Return the id of this category. Never <code>null</code>.
+ *
+ * @return the id
+ */
+ String getId();
- /**
- * Return the human readable name of this view category. Never <code>null</code>.
- *
- * @return the label
- */
- String getLabel();
+ /**
+ * Return the human readable name of this view category. Never
+ * <code>null</code>.
+ *
+ * @return the label
+ */
+ String getLabel();
- /**
- * Return this categories path. The segments of this path will correspond to
- * category ids.
- *
- * @return the path
- */
- IPath getPath();
+ /**
+ * Return this categories path. The segments of this path will correspond to
+ * category ids.
+ *
+ * @return the path
+ */
+ IPath getPath();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/views/IViewDescriptor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/views/IViewDescriptor.java
index 77da3f455d0..fdfd4a1942e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/views/IViewDescriptor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/views/IViewDescriptor.java
@@ -21,11 +21,11 @@ import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPartDescriptor;
/**
- * This is a view descriptor. It provides a "description" of a given
- * given view so that the view can later be constructed.
+ * This is a view descriptor. It provides a "description" of a given given view
+ * so that the view can later be constructed.
* <p>
- * The view registry provides facilities to map from an extension
- * to a IViewDescriptor.
+ * The view registry provides facilities to map from an extension to a
+ * IViewDescriptor.
* </p>
* <p>
* This interface is not intended to be implemented by clients.
@@ -36,69 +36,72 @@ import org.eclipse.ui.IWorkbenchPartDescriptor;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IViewDescriptor extends IWorkbenchPartDescriptor, IAdaptable {
- /**
- * Creates an instance of the view defined in the descriptor.
- *
- * @return the view part
- * @throws CoreException thrown if there is a problem creating the part
- */
- IViewPart createView() throws CoreException;
+ /**
+ * Creates an instance of the view defined in the descriptor.
+ *
+ * @return the view part
+ * @throws CoreException thrown if there is a problem creating the part
+ */
+ IViewPart createView() throws CoreException;
- /**
- * Returns an array of strings that represent
- * view's category path. This array will be used
- * for hierarchical presentation of the
- * view in places like submenus.
- * @return array of category tokens or null if not specified.
- */
- String[] getCategoryPath();
+ /**
+ * Returns an array of strings that represent view's category path. This array
+ * will be used for hierarchical presentation of the view in places like
+ * submenus.
+ *
+ * @return array of category tokens or null if not specified.
+ */
+ String[] getCategoryPath();
- /**
- * Returns the description of this view.
- *
- * @return the description
- */
- String getDescription();
+ /**
+ * Returns the description of this view.
+ *
+ * @return the description
+ */
+ String getDescription();
- /**
- * Returns the id of the view.
- *
- * @return the id
- */
- @Override String getId();
+ /**
+ * Returns the id of the view.
+ *
+ * @return the id
+ */
+ @Override
+ String getId();
- /**
- * Returns the descriptor for the icon to show for this view.
- */
- @Override ImageDescriptor getImageDescriptor();
+ /**
+ * Returns the descriptor for the icon to show for this view.
+ */
+ @Override
+ ImageDescriptor getImageDescriptor();
- /**
- * Returns the label to show for this view.
- *
- * @return the label
- */
- @Override String getLabel();
+ /**
+ * Returns the label to show for this view.
+ *
+ * @return the label
+ */
+ @Override
+ String getLabel();
- /**
- * Returns the default fast view width ratio for this view.
- *
- * @return the fast view width ratio
- */
- float getFastViewWidthRatio();
+ /**
+ * Returns the default fast view width ratio for this view.
+ *
+ * @return the fast view width ratio
+ */
+ float getFastViewWidthRatio();
- /**
- * Returns whether this view allows multiple instances.
- *
- * @return whether this view allows multiple instances
- */
- boolean getAllowMultiple();
+ /**
+ * Returns whether this view allows multiple instances.
+ *
+ * @return whether this view allows multiple instances
+ */
+ boolean getAllowMultiple();
- /**
- * Returns whether this view can be restored upon workbench restart.
- *
- * @return whether whether this view can be restored upon workbench restart
- * @since 3.4
- */
- boolean isRestorable();
+ /**
+ * Returns whether this view can be restored upon workbench restart.
+ *
+ * @return whether whether this view can be restored upon workbench restart
+ * @since 3.4
+ */
+ boolean isRestorable();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/views/IViewRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/views/IViewRegistry.java
index be8cdd4bf78..9d52b271f70 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/views/IViewRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/views/IViewRegistry.java
@@ -14,10 +14,9 @@
*******************************************************************************/
package org.eclipse.ui.views;
-
/**
- * The view registry maintains a list of views explicitly registered
- * against the view extension point..
+ * The view registry maintains a list of views explicitly registered against the
+ * view extension point..
* <p>
* The description of a given view is kept in a <code>IViewDescriptor</code>.
* </p>
@@ -31,35 +30,34 @@ package org.eclipse.ui.views;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IViewRegistry {
- /**
- * Return a view descriptor with the given extension id. If no view exists
- * with the id return <code>null</code>.
- * Will also return <code>null</code> if the view descriptor exists, but
- * is filtered by an expression-based activity.
- *
- * @param id the id to search for
- * @return the descriptor or <code>null</code>
- */
- IViewDescriptor find(String id);
+ /**
+ * Return a view descriptor with the given extension id. If no view exists with
+ * the id return <code>null</code>. Will also return <code>null</code> if the
+ * view descriptor exists, but is filtered by an expression-based activity.
+ *
+ * @param id the id to search for
+ * @return the descriptor or <code>null</code>
+ */
+ IViewDescriptor find(String id);
- /**
- * Returns an array of view categories.
- *
- * @return the categories. Never <code>null</code>.
- */
- IViewCategory[] getCategories();
+ /**
+ * Returns an array of view categories.
+ *
+ * @return the categories. Never <code>null</code>.
+ */
+ IViewCategory[] getCategories();
- /**
- * Return a list of views defined in the registry.
- *
- * @return the views. Never <code>null</code>.
- */
- IViewDescriptor[] getViews();
+ /**
+ * Return a list of views defined in the registry.
+ *
+ * @return the views. Never <code>null</code>.
+ */
+ IViewDescriptor[] getViews();
- /**
- * Return a list of sticky views defined in the registry.
- *
- * @return the sticky views. Never <code>null</code>.
- */
- IStickyViewDescriptor[] getStickyViews();
+ /**
+ * Return a list of sticky views defined in the registry.
+ *
+ * @return the sticky views. Never <code>null</code>.
+ */
+ IStickyViewDescriptor[] getStickyViews();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/IWizardCategory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/IWizardCategory.java
index 1e491baac36..5867b8d92e9 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/IWizardCategory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/IWizardCategory.java
@@ -28,22 +28,20 @@ import org.eclipse.core.runtime.IPath;
public interface IWizardCategory {
/**
- * Returns the category child object corresponding to the passed path
- * (relative to this object), or <code>null</code> if such an object could
- * not be found. The segments of this path should correspond to category ids.
+ * Returns the category child object corresponding to the passed path (relative
+ * to this object), or <code>null</code> if such an object could not be found.
+ * The segments of this path should correspond to category ids.
*
- * @param path
- * the search path
+ * @param path the search path
* @return the category or <code>null</code>
*/
IWizardCategory findCategory(IPath path);
/**
- * Find a wizard that has the provided id. This will search recursivly over
- * this categories children.
+ * Find a wizard that has the provided id. This will search recursivly over this
+ * categories children.
*
- * @param id
- * the id to search for
+ * @param id the id to search for
* @return the wizard or <code>null</code>
*/
IWizardDescriptor findWizard(String id);
@@ -85,8 +83,8 @@ public interface IWizardCategory {
IPath getPath();
/**
- * Return the wizards in this category, minus the wizards which failed
- * the Expressions check.
+ * Return the wizards in this category, minus the wizards which failed the
+ * Expressions check.
*
* @return the wizards in this category. Never <code>null</code>
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/IWizardDescriptor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/IWizardDescriptor.java
index 6bab44e0a1d..d4af6d57586 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/IWizardDescriptor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/IWizardDescriptor.java
@@ -32,14 +32,13 @@ import org.eclipse.ui.IWorkbenchWizard;
public interface IWizardDescriptor extends IWorkbenchPartDescriptor, IAdaptable {
/**
- * Answer the selection for the receiver based on whether the it can handle
- * the selection. If it can return the selection. If it can handle the
- * adapted to IResource value of the selection. If it satisfies neither of
- * these conditions return an empty IStructuredSelection.
+ * Answer the selection for the receiver based on whether the it can handle the
+ * selection. If it can return the selection. If it can handle the adapted to
+ * IResource value of the selection. If it satisfies neither of these conditions
+ * return an empty IStructuredSelection.
*
* @return IStructuredSelection
- * @param selection
- * IStructuredSelection
+ * @param selection IStructuredSelection
*/
IStructuredSelection adaptedSelection(IStructuredSelection selection);
@@ -55,7 +54,7 @@ public interface IWizardDescriptor extends IWorkbenchPartDescriptor, IAdaptable
*
* @return the tags associated with this wizard
*/
- String [] getTags();
+ String[] getTags();
/**
* Create a wizard.
@@ -87,11 +86,11 @@ public interface IWizardDescriptor extends IWorkbenchPartDescriptor, IAdaptable
IWizardCategory getCategory();
/**
- * Answer <code>true</code> if this wizard is able to finish without
- * loading any pages. This is a hint to any
- * {@link org.eclipse.jface.wizard.WizardSelectionPage} or container that
- * may contain this wizard to allow the finish button to be pressed without
- * actually entering the wizard. If this occurs the
+ * Answer <code>true</code> if this wizard is able to finish without loading any
+ * pages. This is a hint to any
+ * {@link org.eclipse.jface.wizard.WizardSelectionPage} or container that may
+ * contain this wizard to allow the finish button to be pressed without actually
+ * entering the wizard. If this occurs the
* {@link org.eclipse.jface.wizard.IWizard#performFinish()} method should be
* invoked by the containing wizard without creating any pages.
*
@@ -100,10 +99,10 @@ public interface IWizardDescriptor extends IWorkbenchPartDescriptor, IAdaptable
boolean canFinishEarly();
/**
- * Answer <code>true</code> if this wizard has any pages. This is a
- * hint to any {@link org.eclipse.jface.wizard.WizardSelectionPage} or
- * container that may contain this wizard that they should enable the "Next"
- * button, if appropriate.
+ * Answer <code>true</code> if this wizard has any pages. This is a hint to any
+ * {@link org.eclipse.jface.wizard.WizardSelectionPage} or container that may
+ * contain this wizard that they should enable the "Next" button, if
+ * appropriate.
*
* @return <code>true</code> if this wizard has wizard pages
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/IWizardRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/IWizardRegistry.java
index 672f4509df9..23c728812d1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/IWizardRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/IWizardRegistry.java
@@ -13,7 +13,6 @@
*******************************************************************************/
package org.eclipse.ui.wizards;
-
/**
* A registry describing all wizard extensions known to the workbench.
* <p>
@@ -36,9 +35,9 @@ public interface IWizardRegistry {
/**
* Return the wizards that have been designated as "primary".
*
- * @return the primary wizard descriptors. Never <code>null</code>.
+ * @return the primary wizard descriptors. Never <code>null</code>.
*/
- IWizardDescriptor [] getPrimaryWizards();
+ IWizardDescriptor[] getPrimaryWizards();
/**
* Find the category with the given id.
@@ -51,7 +50,7 @@ public interface IWizardRegistry {
/**
* Return the root category.
*
- * @return the root category. Never <code>null</code>.
+ * @return the root category. Never <code>null</code>.
*/
IWizardCategory getRootCategory();
}

Back to the top